Re: Rpm and Code Developer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Browder wrote:

I've read Maximum RPM fairly closely, but I haven't found an example of
someone using rpm as a source developer (i.e., the packager is the source
developer, too).  The examples assume the "pristine" source is in an archive
somewhere and can be placed in the SOURCES directory.

Can someone point to an example of a source tree that produces a binary
source rpm (in its development directory) as part of its ordinary build?


A somewhat late answer, perhaps, but I've been doing essentially what you're talking about. As others have pointed out, having make produce the rpms may not be such a great idea. Part of the problem is that there is no simple and direct way to tell rpmbuild *via the command line* what file(s) to output to, or alternatively ask it what it's going to create. And of course, you normally want to execute make as part of the build process for rpm, so starting that process via make is perhaps a bit messy.

Having said that, building without a pre-packaged source code archive is simple enough, and really equally well supported by rpm as building with one. What you need to realise, is that everything involved in building a package is done via normal shell-script commands, which also means means the build process can do just about anything you choose. OK, there is a certain amount of special support for building via source tarballs, but it amounts to little more than the definition of various convenience macros - rpmbuild does not in any way access archive files unless you tell it to.

So to build your package directly from a source code directory you might use a spec file looking something like this:

   Summary: A package
   Name: a-package
   Version: 1
   Release: 1
   License: GPL
   Group: X11/Applications/Graphics

   %description
   Just a package

   %prep

   %build
   cd /usr/work/a-package-source
   make


%install cd /usr/work/a-package-source make install


%files /usr/bin/a-file


That's assuming the source is found on a directory known in advance - in this case /usr/work/a-package-source - of course. And 'make install' will have to create "/usr/bin/a-file", or if you are using "BuildRoot:", <build root>/usr/bin/a-file. Alternatively, you might drop the 'cd' commands and include something like


   %define _builddir /usr/work/a-package-source

near the top of the file. That works because rpmbuild does execute *some* commands without anyone telling it to - and one of them is cd'ing to whatever the value of the macro "_builddir" is. In fact, maybe what you really want is:

   %define _builddir %(pwd)

Or you might even remove all the commands and assume that the files listed are always installed before you call rpmbuild...

I could also give you some examples related to the attempted (closer) integration with the make system, but perhaps this is enough for a start.

- Toralf

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux