Search code examples
linuxdistributionfedorapackagingrpm

steps needed to create binary package for distribution in linux


I am little confused on how to create a complete binary package using rpmbuild from a project I just created (already compiled binary).

my current project contain similar format as this user (Packaging proprietary software for Linux) Where I have

  • foo (binary)
  • data
  • libs
  • foo.sh

libs will contain all the shared libraries the project requires, and foo.sh is a script that sets LD_LIBRARY_PATH to include libs. Therefore, the user will execute foo.sh and the program should start.

I am looking at the tutorial from this site (rpm tutorial)

I understand to create a rpm I create a build area use rpmdev-setuptree I can create a spec file use cd ~/rpmbuild/SPECS; rpmdev-newspec foo and if I got a good SOURCES folder I can build it with rpmbuild -ba foo.spec

But I have no idea how to setup the SOURCES directory. The tutorial stated (here) that I should create a tarball and place all my source file in it and put in SOURCE directory. What would be the source file in my case?


Solution

  • You are trying to create a RPM from binary files you have already? In that case, you can just leave the whole building stuff out of the SPEC file, and you need a SOURCE directory to keep the bundles you've got, the %prep step described below will take them from here. In a binary package I built a while back from zip files, I did:

    • Heading, with name, version, description written by me/cribbed from the originals
    • Sources: The original places to download the Linux packages, official documentation, ...
    • %prep: Just unpack the different pieces, delete some redundant files, ...
    • %build: Nothing to do
    • %install: Create the relevant directories under $RPM_BUILD_ROOT by hand, copy files there by install, copy/create configuration files, ...
    • %clean: Blow away $RPM_BUILD_ROOT
    • %files: An exhaustive list of all files installed.

    This required a few iterations to get right. Afterwards I followed the upstream package by rebuilding my RPM (conveniently I had everything packaged up in a SRPM, where the Source part was kind of a misnomer...)