Date: Tue, 26 Nov 2013 16:38:02 +1100 From: Kubilay Kocak <koobs.freebsd@gmail.com> To: Eitan Adler <lists@eitanadler.com>, Andriy Gapon <avg@freebsd.org>, Baptiste Daroussin <bapt@freebsd.org>, FreeBSD Ports <ports@freebsd.org> Subject: Re: Making WITH_DEBUG less magical Message-ID: <529433BA.6040206@FreeBSD.org> In-Reply-To: <CAF6rxgmwLTzF3CQ7OQBPR64cDCaaDV9KB=7oQKnF=KH5uHxVvA@mail.gmail.com> References: <CAF6rxgmwLTzF3CQ7OQBPR64cDCaaDV9KB=7oQKnF=KH5uHxVvA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 26/11/2013 4:14 PM, Eitan Adler wrote: > Hi all, > > At the moment WITH_DEBUG is treated specially by the ports system. I > propose to turn the old WITH_DEBUG into a port option 'DEBUG' which is > understood by the port system as a whole (similar to DOCS, etc.) > > This change also changes what DEBUG does: it only appends > DEBUG_{CFLAGS,CPPFLAGS,CXXFLAGS} to the appropriate variable. It does > not any longer strip off -O*. > > My first attempt is below. One known problem is that requires the > option DEBUG to be in OPTIONS_DEFINE. I am not sure how to change this > (or if we want to change it). I am also unsure if the code changes > should live above or below the inclusion of Mk/bsd.options.mk. > > Documentation changes are intentionally ignored at the moment. > > Thoughts? > > Index: Mk/bsd.port.mk > =================================================================== > --- Mk/bsd.port.mk (revision 334916) > +++ Mk/bsd.port.mk (working copy) > @@ -1311,17 +1311,6 @@ MAKE_ENV+= TMPDIR="${TMPDIR}" > CONFIGURE_ENV+= TMPDIR="${TMPDIR}" > .endif # defined(TMPDIR) > > -.if defined(WITH_DEBUG_PORTS) > -.if ${WITH_DEBUG_PORTS:M${PKGORIGIN}} > -WITH_DEBUG= yes > -.endif > -.endif > - > -# Reset value from bsd.own.mk. > -.if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG) > -STRIP= #none > -.endif > - > .include "${PORTSDIR}/Mk/bsd.options.mk" > > # Start of pre-makefile section. > @@ -1603,11 +1592,25 @@ CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//} > .endif > .endif > > -.if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG) > +.if defined(WITH_DEBUG_PORTS) > +.if ${WITH_DEBUG_PORTS:M${PKGORIGIN}} > +WITH_DEBUG= yes > +.endif > +.endif > + > +DEBUG_CFLAGS?= -g > +DEBUG_CXXFLAGS?= -g > +DEBUG_CPPFLAGS?= -g > + > +.if defined(PORT_OPTIONS) > +.if ${PORT_OPTIONS:MDEBUG} || defined(WITH_DEBUG) > +STRIP= #none > STRIP_CMD= ${TRUE} > -DEBUG_FLAGS?= -g > -CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} > +CFLAGS+= ${DEBUG_CFLAGS} > +CXXFLAGS+= ${DEBUG_CXXFLAGS} > +CPPFLAGS+= ${DEBUG_CPPFLAGS} > .endif > +.endif > > .if defined(WITH_SSP) || defined(WITH_SSP_PORTS) > .include "${PORTSDIR}/Mk/bsd.ssp.mk" > Thanks Eitan :) Its much easier for me to see/grok in your code how we can evolve and get to: - DEBUG sets good global defaults (if any) - DEBUG is user-configurable (make.conf *and/or* make config) - A port can define DEBUG as an OPTION - A port can extend DEBUG with additional flags, defines, tools, etc - b.p.m provides common boilerplate (where it is valuable) to: -- reduce code duplication in port Makefiles -- ensure consistent use of DEBUG -- eg: CONFIGURE_ARGS+=--enable-debug (if GNU_CONFIGURE) -- eg: CONFIGURE_ARGS+=--disable-strip (if GNU_CONFIGURE) -- eg: User messaging (if necessary and useful) -- eg: im sure many others On the above goals (not a code review), your changes look great :] Thanks again -- koobs
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?529433BA.6040206>