Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jul 2005 23:56:21 +0200
From:      Jeremie Le Hen <jeremie@le-hen.org>
To:        Thierry Herbelot <thierry@herbelot.com>
Cc:        freebsd-current@freebsd.org, Jeremie Le Hen <jeremie@le-hen.org>
Subject:   Re: HEADS UP: Ports are not ready for CFLAGS=-O2 in 6.0
Message-ID:  <20050708215620.GN39292@obiwan.tataz.chchile.org>
In-Reply-To: <200507061116.17267.thierry@herbelot.com>
References:  <20041102222000.GA65845@xor.obsecurity.org> <20050706073205.GA942@galgenberg.net> <20050706085737.GT73907@obiwan.tataz.chchile.org> <200507061116.17267.thierry@herbelot.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 >



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050708215620.GN39292>