From owner-freebsd-questions@FreeBSD.ORG Fri Mar 19 22:01:31 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AE2C106566B for ; Fri, 19 Mar 2010 22:01:31 +0000 (UTC) (envelope-from corky1951@comcast.net) Received: from qmta08.westchester.pa.mail.comcast.net (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) by mx1.freebsd.org (Postfix) with ESMTP id E84268FC15 for ; Fri, 19 Mar 2010 22:01:30 +0000 (UTC) Received: from omta23.westchester.pa.mail.comcast.net ([76.96.62.74]) by qmta08.westchester.pa.mail.comcast.net with comcast id v78t1d01T1c6gX858A1WD6; Fri, 19 Mar 2010 22:01:30 +0000 Received: from comcast.net ([98.203.142.76]) by omta23.westchester.pa.mail.comcast.net with comcast id vA4X1d00B1f6R9u3jA4Yv4; Fri, 19 Mar 2010 22:04:33 +0000 Received: by comcast.net (sSMTP sendmail emulation); Fri, 19 Mar 2010 15:01:27 -0700 Date: Fri, 19 Mar 2010 15:01:27 -0700 From: Charlie Kester To: freebsd-questions@freebsd.org Message-ID: <20100319220126.GH265@comcast.net> Mail-Followup-To: freebsd-questions@freebsd.org References: <20100319170159.GB71392@slackbox.erewhon.net> <20100319200130.GE265@comcast.net> <3D386E86A152519AA850205C@utd65257.utdallas.edu> <8B123BA51B43B4AAC86E0F3C@utd65257.utdallas.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <8B123BA51B43B4AAC86E0F3C@utd65257.utdallas.edu> X-Mailer: Mutt 1.5.20 X-Composer: VIM 7.2 User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: Elegant way to hack port source X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2010 22:01:31 -0000 On Fri 19 Mar 2010 at 14:34:23 PDT Paul Schmehl wrote: >--On Friday, March 19, 2010 17:04:17 -0400 Alejandro Imass = wrote: >>> >>>To the O.P.: >>> >>>How about submiting the patch to the community so it can be added by the >>>port maintainer? =A0If it actually fixes a bug in the software you can't= be >>>the only one would benefit from the patch. >>> >> >>That was going to be my next question, but I am currently debugging to >>see why this common fix I've used in Linux is not not working on FBSD. > >Ports can throw you for a loop if you're used to building from=20 >source. Others have given you good instructions on how to fix the=20 >problem, but here's a brief overview: > >1) Go in to the port directory >2) Type make clean to remove any work directories >3) Type make extract - this extracts the tarball into the working=20 >directories that FreeBSD expects to find >4) Type make patch to apply any patches that the port maintainer has inclu= ded 'make patch' will also do the extract from the distfile, so you don't need your step 3 >5) Enter the directory where the problem source file is - usually=20 >work/portname-version/some subdir >6) Copy it to filename.c.orig If the port maintainer has already patched filename.c, 'make patch' will=20 already have created filename.c.orig >7) Edit filename.c to include your changes >8) Diff the two files and put the resulting patch file in=20 >portdir/files (Note: If the file in question is already being patched=20 >by the port, you will need to apply your diff to file as well as the=20 >edits in the existing patch - doing that is not an exercise for the=20 >faint of heart. If that's the case here, respond and folks will help=20 >you sort it out.) Not true. If the maintainer patched filename.c, 'make patch' will create filename.c.orig (which is the original author's file) and filename.c (which is the result of the maintainer's patches.) If you edit filename.c and then diff it from filename.c.orig, the result is a patch the includes your changes AND the maintainer's. >9) Edit the patch file (now in portdir/files) so that the first two=20 >lines "point" to the actual location of the file in the working=20 >directories. (For example, if the working directory has a subdir=20 >named "sc", and your file is in there, the first two lines of the=20 >patch would be edited thus: >from filename.c to src/filename.c and from filename.c.orig to=20 >src/filename.c.orig No need for this if you do the diff from the top level of the working directory. I.e., if filename.c is in work/foo-x.y/bar/ you should cd to work/foo-x.y/ and then run diff -u bar/filename.c.orig bar/filename.c > ../../files/patch-filename.c >10) Return to the portdir and type make clean >11) Type make extract and then make patch - if it works, you should=20 >be able to do the install - if it doesn't work, post the errors here >and we'll figure it out Again, no need for the separate 'make extract' step. =20 In fact, I'd go straight to 'make build' or 'make install' here, and skip the separate 'make patch' too.