![]() You can also use sh scripts under %prep section to perform this action but %setup macro simplifies the process by using predefined sh scripts. In the below example, I have used a macro called %setup which removes any previous builds, untar the source files and changes the ownership of the files. You may be using this macros when you try to build any complex packages. One more key thing is to understand there are pre-defined macros available to perform various shortcut options to build rpm.Any previous builds are removed during this process and the source file(.tar) file is expanded, etc. %prep – In this section, we prepare the software for building process.In general, the preamble consists of entries, one per line, that start with a tag followed by a colon, and then some information. Preamble – The preamble section contains information about the package being built and define any dependencies to the package.The spec file usually consists of the following eight different sections: In this step, we direct RPM in the build process by creating a spec file. You just have to download the corresponding source code for the RPM that you are trying to build. But, the steps are exactly the same for building RPM for any other application. ![]() Next, download the source tar file for the package that you want to build and save it under SOURCES directory.įor this example, I’ve used the source code of icecase open source application, which is a server software for streaming multi-media. Specify the topdir parameter in the rpmrc file or rpmmacros file.Use –buildroot option and specify the custom directory during the rpmbuild.If you want to use your own directory structure instead of the /root/rpmbuild, you can use one of the following option: If you are doing this on SuSE Enterprise Linux, use /usr/src/packages directory. You can also use /usr/src/redhat directory, but you need to change the topdir parameter accordingly during the rpm build. Note: The above directory structure is for both CentOS and RedHat when using rpmbuild package. 2 root root 4096 Feb 4 12:21 BUILDROOT/ĭrwxr-xr-x. Rpm-build will automatically create the following directory structures that will be used during the RPM build. If you don’t have these installed already, yum will automatically install these dependencies for you. Rpm-build is dependent on the following package. Rpmbuild command is part of rpm-build package. To build an rpm file based on the spec file that we just created, we need to use rpmbuild command. If you are new to rpm package, you may first want to understand how to use rpm command to install, upgrade and remove packages on CentOS or RedHat. Let us see how to create a simple source and BIN RPM packages using a tar file. The source package usually consists of the original compressed tar file, spec file and the patches which are required to create the binary package file. Binary package file contain complete applications or libraries of functions compiled for a particular architecture. It is usually enabled with all the options for installing the package that are platform specific. The binary package file consists of all source files along with any additional information to install or uninstall the package. Once the RPM executes the above steps, it creates the binary package file and source package file. Macros from the file list is also executed at this step. Executes the commands and macros in the build section of the spec file.Executes the commands and macros mentioned in the prep section of the spec file.The RPM performs the following tasks during the build process. The SPEC file typically contains instructions on how to build RPM, what files are part of package and where it should be installed. ![]() In order to build RPMs, you will need source code, which usually means a compressed tar file that also includes the SPEC file. This tutorial explains how to build a RPM package from the source code. There might also be a situation where you want to build a custom RPM package for the application that you developed. In that situation, you can either compile the source code and install the application from source code, or build a RPM file from source code yourself, and use the RPM file to install the application. Sometimes you might have access to an open source application source code but might not have the RPM file to install it on your system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |