{"id":47,"date":"2008-03-08T00:37:00","date_gmt":"2008-03-07T17:37:00","guid":{"rendered":"http:\/\/www.jfdesignnet.com\/?p=47"},"modified":"2008-03-08T00:37:00","modified_gmt":"2008-03-07T17:37:00","slug":"rpm-build-environment-structure","status":"publish","type":"post","link":"https:\/\/www.jfdesignnet.com\/?p=47","title":{"rendered":"RPM build environment structure"},"content":{"rendered":"<div style=\"text-align: justify;\"><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/2.bp.blogspot.com\/_ULyNQk0WQMM\/R9GAFlq4R1I\/AAAAAAAAADI\/bweI3IG54Iw\/s1600-h\/rpm.png\" rel=\"lightbox[47]\"><img decoding=\"async\" style=\"margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 111px; height: 111px;\" src=\"http:\/\/2.bp.blogspot.com\/_ULyNQk0WQMM\/R9GAFlq4R1I\/AAAAAAAAADI\/bweI3IG54Iw\/s320\/rpm.png\" alt=\"\" id=\"BLOGGER_PHOTO_ID_5175058280325072722\" border=\"0\" \/><\/a>In order to safely build <span class=\"search_hit\">RPM<\/span>S, we are going to setup a build environment. By default, the build environment is in \/usr\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span> and requires you to be logged as root to build <span class=\"search_hit\">RPM<\/span>S. This is dangerous because while you are logged as a superuser, you have too much potential to harm your system and a failed attempt to build a <span class=\"search_hit\">RPM<\/span> could damage your system. To create a build environment, you will first need to create a set of directories in your home folder (write them as I do as it is case sensitive). Below is an example of my build directories.<\/div>\n<pre  class=\"code\" style=\"font-family:arial;\"><span style=\"font-size:85%;\">\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/noarch<br \/>(this is where multi architecture <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i586<br \/>(this is where i586 <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i686<br \/>(this is where i686 <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i486<br \/>(this is where i486 <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i386<br \/>(this is where i386 <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/athlon<br \/>(this is where athlon <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/BUILD<br \/>(this is where the source files are installed during the build process)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/S<span class=\"search_hit\">RPM<\/span>S<br \/>(this is where the source <span class=\"search_hit\">rpm<\/span>s will be created)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/SOURCES<br \/>(this is where you will place the source codes of the <span class=\"search_hit\">RPM<\/span> to be built)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/SPECS<br \/>(this is where you will place the spec file of the <span class=\"search_hit\">RPM<\/span> to be built)<br \/>\/home\/<span class=\"search_hit\">jfdesign<\/span>\/<span class=\"search_hit\">src<\/span>\/tmp<br \/>(this is where the build process takes place and error logs are created)<\/span><\/pre>\n<p>This command will create the directory structure:<\/p>\n<pre  class=\"code bash\" style=\"font-family:arial;\"><span style=\"font-size:85%;\"><span class=\"kw3\">cd<\/span> ~<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i386<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i486<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i586<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/i686<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/noarch<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/<span class=\"search_hit\">RPM<\/span>S\/athlon<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/S<span class=\"search_hit\">RPM<\/span>S<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/SOURCES<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/SPECS<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/<span class=\"search_hit\">rpm<\/span>\/BUILD<br \/>mkdir -p <span class=\"search_hit\">src<\/span>\/tmp<\/span><\/pre>\n<div style=\"text-align: justify;\">Once we have all the directories setup, we need to create two files to let the system know that we will be using our own build environment. The two files must be placed in your home directory (my files are in <strong>\/home\/<span class=\"search_hit\">jfdesign<\/span><\/strong>). Use a plaintext editor such as SCiTE or KWrite to create these files. The first file is called <strong>.<span class=\"search_hit\">rpm<\/span>rc<\/strong> (do not forget the dot at the start of the name as it is a hidden file). Place the following content in this file.<\/div>\n<pre  class=\"code\" style=\"font-family:arial;\"><span style=\"font-size:85%;\">buildarchtranslate: i386: i586<br \/>buildarchtranslate: i486: i586<br \/>buildarchtranslate: i586: i586<\/span><br \/><span style=\"font-size:85%;\">buildarchtranslate: i686: i586<\/span><\/pre>\n<div style=\"text-align: justify;\"> The second file is called <strong>.<span class=\"search_hit\">rpm<\/span>macros<\/strong> (do not forget the dot at the start of the name as it is a hidden file). Place the following content in this file (do not forget to remove my name and put yours in it).<\/div>\n<p><span style=\"font-size:85%;\"><br \/><\/span><span style=\"font-size:85%;\">%_topdir        \/home\/<\/span><span class=\"search_hit\"  style=\"font-size:85%;\">jfdesign<\/span><span style=\"font-size:85%;\">\/<\/span><span class=\"search_hit\"  style=\"font-size:85%;\">src<\/span><span style=\"font-size:85%;\">\/<\/span><span class=\"search_hit\"  style=\"font-size:85%;\">rpm<\/span><span style=\"font-size:85%;\"><br \/><\/span><\/p>\n<pre  class=\"code spec\" style=\"font-family:arial;\"><span style=\"font-size:85%;\">%_tmppath    \/home\/<\/span><span class=\"search_hit\"  style=\"font-size:85%;\">jfdesign<\/span><span style=\"font-size:85%;\">\/<\/span><span class=\"search_hit\"  style=\"font-size:85%;\">src<\/span><span style=\"font-size:85%;\">\/tmp<br \/><br \/>%distribution    KLIXs<br \/>%vendor        Kreators<br \/>%distsuffix    klixs2007<\/span><\/pre>\n<p>Now   our system is ready to build <span class=\"search_hit\">rpm<\/span>s.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to safely build RPMS, we are going to setup a build environment. By default, the build environment is in \/usr\/src\/rpm and requires you to be logged as root to build RPMS. This is dangerous because while you are logged as a superuser, you have too much potential to harm your system and a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=\/wp\/v2\/posts\/47"}],"collection":[{"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":0,"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jfdesignnet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}