On Sat, May 05, 2012 at 05:57:30PM +0200, Tobias Ulmer wrote:
> Setting DEBUG not only sets additional CFLAGS, it also disables
> stripping during the 'fake' stage for ports that use BSD make as build
> system.
>
> Curiously this does not work for ports that have a custom 'do-install'
> target (or friends) and use INSTALL_PROGRAM.
>
> After pulling my hair a bit, it became obvious that _SUDOMAKESYS
> filters out most environment variables, including DEBUG (usage begins
> in bsd.port.mk:2527, implementation is in pkgpath.mk:115).
>
> I can see two options to fix this: Either extend the default sudoers to
> pass DEBUG/INSTALL_STRIP(?). Or pass MAKE_ENV like the standard install
> target does. It seems to do the right thing in my light testing. I've
> also modified _SUDOMAKE for symmetry.
>
> devel/csup is a port that ignores DEBUG partially.
> x11/spectrwm as an example where it works.
>
> Comments?
For building ports you're supposed to use
SUDO=/usr/bin/sudo -E
in /etc/mk.conf
I guess the documentation should be made aware of that... Is using -E helping
in your case?
> Index: pkgpath.mk
> ===================================================================
> RCS file: /home/vcs/cvs/openbsd/ports/infrastructure/mk/pkgpath.mk,v
> retrieving revision 1.44
> diff -u -p -r1.44 pkgpath.mk
> --- pkgpath.mk 17 Feb 2012 07:40:35 -0000 1.44
> +++ pkgpath.mk 5 May 2012 15:31:22 -0000
> @@ -110,9 +110,9 @@ _cache_fragment = \
> HTMLIFY = sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
>
> _MAKE = cd ${.CURDIR} && PKGPATH=${PKGPATH} exec ${MAKE}
> -_SUDOMAKE = cd ${.CURDIR} && PKGPATH=${PKGPATH} exec ${SUDO} ${MAKE}
> +_SUDOMAKE = cd ${.CURDIR} && exec ${SUDO} ${SETENV} ${MAKE_ENV}
> PKGPATH=${PKGPATH} ${MAKE}
> _MAKESYS = cd ${.CURDIR} && PKGPATH=${PKGPATH} exec ${_SYSTRACE_CMD} ${MAKE}
> -_SUDOMAKESYS = cd ${.CURDIR} && PKGPATH=${PKGPATH} exec ${SUDO}
> ${_SYSTRACE_CMD} ${MAKE}
> +_SUDOMAKESYS = cd ${.CURDIR} && exec ${SUDO} ${SETENV} ${MAKE_ENV}
> PKGPATH=${PKGPATH} ${_SYSTRACE_CMD} ${MAKE}
>
> REPORT_PROBLEM_LOGFILE ?=
> .if !empty(REPORT_PROBLEM_LOGFILE)
>
--
Antoine