On Mon, Apr 14, 2008 at 12:14 PM, Nicolas FRANCOIS <[EMAIL PROTECTED]> wrote: > Le Mon, 14 Apr 2008 20:00:00 +0200 Thomas Trepl > <[EMAIL PROTECTED]> a écrit : > > > > > Am Montag, 14. April 2008 15:31:08 schrieb Dan Nicholson: > > > On Mon, Apr 14, 2008 at 4:59 AM, Nicolas FRANCOIS > > > ... > > > > > > I haven't looked at the source, but it should be pretty > > > straightforward. Just lump <limits.h> in with the other system > > > headers. > > Yes it is. I have prepared a patch for that but forgot to post it. Here it > > is... > > Could you explain how you make this patch ? And how comes that some > patches foound on Internet work the basic LFS way (patch -Np > -i ../toto.patch) and others don't ?
For starters, read the patch(1) and diff(1) manpages. But basically, you create a patch with diff and apply it with patch. diff just takes two arguments and finds the differences between them. The output is then just redirected to a file. There are a few other options that change the behavior, but most of the time you can use same set for each utility, respectively. Here's my typical "patch this tarball routine": Unpack a fresh copy; we don't want unrelated junk creeping into the patch. $ tar -xf somepkg.tar.gz Make a recursive copy of the pristine sources to diff against later. $ cp -a somepkg somepkg.orig Make changes to the source. $ cd somepkg; hack; hack; hack Go back to the parent directory. When diff is called from the parent, the somepkg directory will be prefixed in the diff output. This becomes important later when we tell patch that we want to strip the first path component. $ cd .. Recursively diff the pristine sources to the altered sources. The -p and -u options just control the format of the generated diff, but are unnecessary. -N means that any new or removed files will be considered instead of being ignored. -r means to act recursively. The ordering of the arguments is important, too: somepkg.orig goes first because I want to find the differences from the unaltered source to my changes. $ diff -pNur somepkg.orig somepkg > somepkg.patch Apply the changes to an unaltered source tree. The -p1 option means that we will strip 1 leading component. This is necessary since we prefixed the patch with the name of the source directory when creating the diff _and_ we've entered the source tree. The paths wouldn't match without it. The -N tries to detect if a patch hunk has already been applied and skips it. Usually I don't use this option since I like to know when my patches have been obsoleted by something else. $ cd somepkg.orig $ patch -Np1 -i ../somepkg.patch That's it. There are a ton of other options for diff and patch, but generally that's what I always use (especially if I'm the one who's actually generated the patch). The case of "why doesn't this random patch from the internet work" is usually because of a difference in leading components when the patch was generated. Many patches don't include the leading directory name, so using the -p0 option to patch is needed instead of -p1. -- Dan -- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page