HEADS UP: Ports are not ready for CFLAGS=-O2 in 6.0
Jeremie Le Hen
jeremie at le-hen.org
Fri Jul 8 21:56:20 GMT 2005
Hi Thierry,
> and it does not work if he ports tree is "physically" elsewhere (mine is
> shared over NFS from /files2/ports -> .CURDIR does not begin
> with /usr/ports).
>
> Perhaps a better way would be to use a variable set in bsd.ports.mk
> (BUILDING_PORT="YES")
I thought a bit more about this. This seems to be a better idea than
having a PORT_CFLAGS variable, because when a user wants to compile a
port with uncommon CFLAGS, he will do the following (for instance) :
%%%
cd /usr/ports/misc/vera
make CFLAGS='-O3' install clean
%%%
If we add something like this in ports/Mk/bsd.port.mk :
%%%
.if defined(PORT_CFLAGS)
CFLAGS=${PORT_CFLAGS}
.end
%%%
This will obviously break POLA because setting CFLAGS won't work as
expected.
Having a BUILDING_PORT or some such variable might appear as a good
idea but there is one technical problem that I don't know how to
circumvent. make(1) manual page indeed states that share/mk/sys.mk
will be read before everything else, and this is this file which
includes /etc/make.conf, if the latter exists. And then only will be
read ports/Mk/bsd.port.mk, when the port's Makefile will include it.
Therefore, when make.conf(5) will be read, BUILDING_PORT will not be
set yet.
This can be checked easily :
%%%
obiwan:tmp$ cat Makefile
VAR1="hello I'm VAR1"
.if defined(VAR2)
VAR1=${VAR2}
.endif
VAR2="hello I'm VAR2"
all:
@echo ${VAR1}
obiwan:tmp$ make
hello I'm VAR1
%%%
Having a /etc/ports.conf file as Ulrich Spoerlein proposed could be
a good solution, but some port commiters need to be convinced of its
usefulness first in order to have their support.
Best regards,
--
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >
More information about the freebsd-current
mailing list