How do you apply patches to source code?
I have recently obtained the source code to an application as a .src.rpm file. I have unbundled the code into /usr/src/RPMS/SOURCES. There are a whole lot of .patch.bz2 files in the directory, as well as the main .tar.bz2 file.
How do I compile the program with the patches?
I realise this is probably an easy one, but I can't find any documentation about applying patches.
Robert.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 5 lines · Robert
I have recently obtained the source code to an application as a .src.rpm file. I have unbundled the code into
/usr/src/RPMS/SOURCES. There are a whole lot of .patch.bz2 files in the directory, as well as the main .tar.bz2 file.
Quoted 7 lines
How do I compile the program with the patches?
I realise this is probably an easy one, but I can't find any documentation about applying patches.
Robert.
I believe that every .src.rpm has a file telling rpm how to build it,
maybe called specfile, and there is some option you give to rpm to build this (see `man rpm').
Of course, if you _want_ to build it by hand for some reason, you
first need to unpack the .tar.bz2 (probably with
tar -xvjf filename.tar.bz2), then cd into the directory it creates and run `bzcat ../patchname.patch.bz2 | patch -p1' for each patch, then build it as normal (typically ./configure ; make ; make install) - you'll want to see what options configure will support or need.
But, you probably still need the specfile or whatever to tell you in
what order the packages should be applied.
Sorry I can't be more help, but `rpm' has broken on the only box I've
got it on.
Ken
Signature · 6 lines
Live Long or Prosper! No, wait, that wasn't it... - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
"Ken Moffat" <[email protected]> wrote in message news:Pine.LNX.4.53.0305261333460.3342@reg_kipling...
Quoted 4 lines · Robert
Quoted 3 lines
I have recently obtained the source code to an application as a .src.rpm file. I have unbundled the code into
/usr/src/RPMS/SOURCES. There are
a
Quoted 1 line
Quoted 1 line
whole lot of .patch.bz2 files in the directory, as well as the main
.tar.bz2
Quoted 5 lines
Quoted 5 lines
file.
How do I compile the program with the patches?
I realise this is probably an easy one, but I can't find any
documentation
Quoted 22 lines
Quoted 4 lines
about applying patches.
Robert.
I believe that every .src.rpm has a file telling rpm how to build it,
maybe called specfile, and there is some option you give to rpm to build this (see `man rpm').Of course, if you _want_ to build it by hand for some reason, you
first need to unpack the .tar.bz2 (probably with
tar -xvjf filename.tar.bz2), then cd into the directory it creates and run `bzcat ../patchname.patch.bz2 | patch -p1' for each patch, then build it as normal (typically ./configure ; make ; make install) - you'll want to see what options configure will support or need.But, you probably still need the specfile or whatever to tell you in
what order the packages should be applied.Sorry I can't be more help, but `rpm' has broken on the only box I've
got it on.
Quoted 9 lines
Ken
--
Live Long or Prosper! No, wait, that wasn't it...
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Many thanks.
I want to compile the package links with graphics and java enabled. They aren't in most RPMs.
I've got a spec file. How do I actually use it? Is it possible to use it to automatically add the patches or do I just need to apply the patches (as you've specified) in the order that they are listed in the spec file?
Robert.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
Quoted 11 lines · Robert
Many thanks.
I want to compile the package links with graphics and java enabled. They aren't in most RPMs.
I've got a spec file. How do I actually use it? Is it possible to use it to automatically add the patches or do I just need to apply the patches (as you've specified) in the order that they are listed in the spec file?
Robert.
Well, as others have replied, the specfile has rules. I haven't looked
at a specfile for about 2 years, but I imagine there is something within it that runs the package's configure script *after* applying the patches. For sure the specfile will have commands to cause the patches to be applied.
Before trying to build it, untar the main archive and read any README
or INSTALL files to see what you will need to do.
Either the ./configure script enables graphics and java because it finds the required headers and libraries (in which case you would have nothing more to do),
or you need to give it some extra options
(e.g. --with-java-package=/usr/local/java) : for this you will need to edit how ./configure is invoked by the specfile to add, remove, or alter options,
or it doesn't use autoconf and you need to edit a Makefile or an Imakefile (the latter is used by xmkmf, common with older packages that install into the /usr/X11R6 hierarchy) : in these cases you need to read the comments in the file and edit it appropriately - you might even find that some of the patches are altering the file to turn options off.
If you have to edit the specfile, other than to remove patches, you
might find it useful to do a test run (and watch what gets built, and where). Assuming that the specfile invokes make' and make install' by name (as I say, I haven't seen a specfile in ages), you could edit the latter to make -n install' (so that it does try to build but does a dummy install : see man make') then run rpm something like
rpm --whichever-options 2>errors 1>buildlog
to put the output into files you can read in `less'.
HTH,
Ken
Signature · 6 lines
Live Long or Prosper! No, wait, that wasn't it... - To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.linux-learn.org/faqs
Here's the easiest way to get a SRPM into buildable condition...
On "older" versions of RH / other distros, do ...
rpm -bp <specfile>
On RH 8 & 9, the command is rpmbuild -bp <specfile>
This will apply all the patches that were included with the SRPM. When finished, there should be a "makeable" source tree in a BUILD directory. On RH systems, it's in /usr/src/redhat/BUILD.
Of course, to get the specfile, you need to install (rpm -I) the SRPM. That puts the specfile into a SPEC directory (/usr/src/redhat/SPEC on RH systems).
If you simply want to get a binary executable out of an SRPM, use rpmbuild --rebuild <SRPM>. There are lots of other options for rpm and rpmbuild. I use these options the most. The manpages for rpm and rpmbuild are pretty good as far as manpages go.
Josh
Quoted 14 lines · Robert
I have recently obtained the source code to an application as a .src.rpm file. I have unbundled the code into
/usr/src/RPMS/SOURCES. There are a whole lot of .patch.bz2 files in the directory, as well as the main .tar.bz2 file.How do I compile the program with the patches?
I realise this is probably an easy one, but I can't find any documentation about applying patches.
Robert.
Quoted 5 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs