Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Sep 2011 07:27:18 +0400
From:      Dmitry Marakasov <amdmi3@amdmi3.ru>
To:        freebsd-ports@freebsd.org
Subject:   LDFLAGS support for bsd.port.mk and CPPFLAGS/LDFLAGS cleanup
Message-ID:  <20110907032718.GJ42123@hades.panopticon>

next in thread | raw e-mail | index | archive | help
Hi!

As CPPFLAGS support was recently added to ports ([1]) I've proposed to
add support for LDFLAGS as well ([2]). That is quite logical in terms of
consistence, and also may be useful for other purposes such as passing
LTO flags to the linker.

Since many ports set LDFLAGS via CONFIGURE_ENV, e.g.

CONFIGURE_ENV=	CPPFLAGS=-I${LOCALBASE}/include LDFLAGS=-L${LOCALBASE}/lib

which will override ${LDFLAGS}, it's also required to get rid of these.
The same thing should also be done with CPPFLAGS leftovers.

For now, I've processed about 10% of ports which set CONFIGURE_ENV and I
want the community to skim through this partial patch and check if
there are any errors or something should be done differently/should
not be done. See http://people.freebsd.org/~amdmi3/ldflags.patch

Currently, changes are:
* Move CPPFLAGS/LDFLAGS overrides out of CONFIGURE_ENV:

-CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include"
+CPPFLAGS+=	-I${LOCALBASE}/include

appends is processed correctly, e.g.

-CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include"
+CPPFLAGS+=	-I${LOCALBASE}/include

* Drop simple passing of CPPFLAGS/LDFLAGS to configure (since it's now
done by ports framework):

-CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}"

* Change CPPFLAGS/LDFLAGS assignments to append (to allow user to tune
these and to be consistent with CFLAGS/CXXFLAGS):

-CPPFLAGS=	-I${LOCALBASE}/include
+CPPFLAGS+=	-I${LOCALBASE}/include

There are also some other changes made by hand, such as moving CFLAGS
out of CONFIGURE_ENV and tuning MAKE_ENV in the same manner as
CONFIGURE_ENV, but I guess I'll do these automatically as well.

The changes are processed by a perl script, which applies fixes to
each port and then shows a diff for me to check and accept or fix
manually.

I also plan to do an additional pass to fix some other errors such
as using += in CONFIGURE_ENV (e.g. CONFIGURE_ENV=CPPFLAGS+="-I..."),
which is illegal and maybe other error I run into before submitting
final version of a patch for an exp-run.

[1] http://www.freebsd.org/cgi/cvsweb.cgi/ports/Mk/bsd.port.mk.diff?r1=1.673;r2=1.674
[2] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/157936

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru



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