Elegant way to hack port source

Alejandro Imass ait at p2ee.org
Fri Mar 19 16:58:09 UTC 2010

On Fri, Mar 19, 2010 at 12:44 PM, Alberto Mijares <amijaresp at gmail.com> wrote:
> On Fri, Mar 19, 2010 at 12:05 PM, Alejandro Imass <ait at p2ee.org> wrote:
>> Hi,
>> I need to modify a file from a port before building. Specifically, the
>> sane-backends pnm.c driver has a bug and the folks at the original
>> project has not fixed for a while. I need to modify pnm.c in the work
>> directory before compiling. What is an elegant way of doing this? If I
>> make and then modify, the main make file does not see the change made
>> in the file and will not recompile. And since there is no actual
>> makefile in the work subdirectory I can't compile there either!
> You could make a copy of graphics/sane-backends to
> graphics/sane-backends-devel, fix the source in the new port's
> directory and install it as a regular port.
> Check this out too
> http://www.freebsd.org/doc/en/books/porters-handbook/
> Best regards

Thanks Alberto. I have checked the porter's handbook before writing
this, in fact I discovered the CONFIGURE_ARGS variable which proved
very useful for passing the --enable-pnm-backend switch to the
configure script.

Nevertheless, the problem is that pnm.c has a bug since last year and
it has not been fixed, and only developers use that driver, so I guess
we've all gotten used to fiddling with the source, instead of forcing
the maintainer to fix it. BTW today I got tired of this BS so I
formnally filed the bug:

Anyway, back to the port, this is the problem I have: whe I type make
CONFIGURE_ARGS=--enable-pnm-backend it effectively makes all the
backends in the correct way, including the infamous pnm backend. I
later go to the work directory, go into the sane-backendsxxxx
sub-directory and modify backends/pnm.c. I latter go back to the root
of the port (/usr/ports/graphics/sane-backends/) and type make again
and nothing happens. In a normal make scenario, make would detct the
.c had changed and re-compile and link just that file(s). In the ports
make scenario, make doesn't do that. Is there a special switch to the
port's make process, to actually go and re-make the source?

Alejandro Imass

> Alberto Mijares

More information about the freebsd-questions mailing list