Date: Tue, 26 Nov 2013 00:14:13 -0500 From: Eitan Adler <lists@eitanadler.com> To: Kubilay Kocak <koobs@freebsd.org>, Andriy Gapon <avg@freebsd.org>, Baptiste Daroussin <bapt@freebsd.org>, FreeBSD Ports <ports@freebsd.org> Subject: Making WITH_DEBUG less magical Message-ID: <CAF6rxgmwLTzF3CQ7OQBPR64cDCaaDV9KB=7oQKnF=KH5uHxVvA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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" -- Eitan Adler
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgmwLTzF3CQ7OQBPR64cDCaaDV9KB=7oQKnF=KH5uHxVvA>