Linux Newbie help
 help / color / mirror / Atom feed
* How do you apply patches to source code?
@ 2003-05-26 11:03 Robert
  2003-05-26 12:42 ` Ken Moffat
  2003-05-26 13:52 ` J S
  0 siblings, 2 replies; 6+ messages in thread
From: Robert @ 2003-05-26 11:03 UTC (permalink / raw)
  To: linux-newbie

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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How do you apply patches to source code?
  2003-05-26 11:03 How do you apply patches to source code? Robert
@ 2003-05-26 12:42 ` Ken Moffat
  2003-05-26 13:16   ` Robert
  2003-05-26 13:40   ` Amin
  2003-05-26 13:52 ` J S
  1 sibling, 2 replies; 6+ messages in thread
From: Ken Moffat @ 2003-05-26 12:42 UTC (permalink / raw)
  To: Robert; +Cc: linux-newbie

On Mon, 26 May 2003, Robert wrote:

> 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.
>

 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
-- 
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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How do you apply patches to source code?
  2003-05-26 12:42 ` Ken Moffat
@ 2003-05-26 13:16   ` Robert
  2003-05-26 20:36     ` Ken Moffat
  2003-05-26 13:40   ` Amin
  1 sibling, 1 reply; 6+ messages in thread
From: Robert @ 2003-05-26 13:16 UTC (permalink / raw)
  To: linux-newbie


"Ken Moffat" <ken@kenmoffat.uklinux.net> wrote in message
news:Pine.LNX.4.53.0305261333460.3342@reg_kipling...
> On Mon, 26 May 2003, Robert wrote:
>
> > 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.
> >
>
>  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
> --
> 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 majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How do you apply patches to source code?
  2003-05-26 12:42 ` Ken Moffat
  2003-05-26 13:16   ` Robert
@ 2003-05-26 13:40   ` Amin
  1 sibling, 0 replies; 6+ messages in thread
From: Amin @ 2003-05-26 13:40 UTC (permalink / raw)
  To: linux-newbie

In message <Pine.LNX.4.53.0305261333460.3342@reg_kipling>, Ken Moffat writes:
> On Mon, 26 May 2003, Robert wrote:
> 
> > 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.bz
> 2
> > 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.
> >
> 
>  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').

On slightly older systems, this command is

   rpm --rebuild package.src.rpm

On newer systems, it's

   rpmbuild --rebuild package.src.rpm

Try the latter first.  Notice that you never have to see the
contents of the source rpm file.  You only need to run the
above commands on it.  Everything is automatically taken
care of.

>  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.

Logically, the specfile should specify rules for
automatically applying patches, or what would be the
convenience (to the user) of having the patches?

> 
>  Sorry I can't be more help, but `rpm' has broken on the only box I've
> got it on.
> 
> Ken

HTH,
Yawar Amin
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How do you apply patches to source code?
  2003-05-26 11:03 How do you apply patches to source code? Robert
  2003-05-26 12:42 ` Ken Moffat
@ 2003-05-26 13:52 ` J S
  1 sibling, 0 replies; 6+ messages in thread
From: J S @ 2003-05-26 13:52 UTC (permalink / raw)
  To: Robert; +Cc: linux-newbie

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

On Mon, 2003-05-26 at 07:03, Robert wrote:
> 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 majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How do you apply patches to source code?
  2003-05-26 13:16   ` Robert
@ 2003-05-26 20:36     ` Ken Moffat
  0 siblings, 0 replies; 6+ messages in thread
From: Ken Moffat @ 2003-05-26 20:36 UTC (permalink / raw)
  To: Robert; +Cc: linux-newbie

On Mon, 26 May 2003, Robert wrote:

> 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
-- 
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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-26 20:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-26 11:03 How do you apply patches to source code? Robert
2003-05-26 12:42 ` Ken Moffat
2003-05-26 13:16   ` Robert
2003-05-26 20:36     ` Ken Moffat
2003-05-26 13:40   ` Amin
2003-05-26 13:52 ` J S

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox