Making WITH_DEBUG less magical

Eitan Adler lists at eitanadler.com
Fri Dec 13 14:50:36 UTC 2013


Ping.  After 2 weeks.

On Tue, Nov 26, 2013 at 12:14 AM, Eitan Adler <lists at eitanadler.com> 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"
>
>
> --
> Eitan Adler



-- 
Eitan Adler


More information about the freebsd-ports mailing list