Mk/bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV

And remove it from individual ports.  Use WRK_ENV in custom build
commands where necessary.

FreeBSD make(1) includes /usr/share/mk/sys.mk and that includes
/etc/make.conf if it exists.  This happens when you run make in a port
directory but it also happens when the upstream build system uses make.
This commit disables make.conf inclusion in the latter case because
users can define variables like CFLAGS in make.conf that override ports
framework variables and this can cause problems that are difficult to
diagnose.

If there are any build customisations made through make.conf that stop
working because of this commit then they should be made available by the
ports tree through some mechanism, e.g. an option in a port.

Some ports were picking up variables from Poudriere make.conf and
required fixes:

- astro/wmspaceweather x11-clocks/wmcalclock: Add OPSYS to MAKE_ENV.
- games/zhlt: Add ARCH to MAKE_ENV.
- graphics/tachyon: Upstream ARCH is not ports tree ARCH.
  Set ALL_TARGET=bsd so upstream ARCH is defined correctly.
  Enable multi-threading support while here.

PR:		277455
Exp-run by:	antoine
This commit is contained in:
Tijl Coosemans 2024-02-29 22:11:00 +01:00
parent bf99270dd4
commit d7511b9d00
30 changed files with 86 additions and 80 deletions

View file

@ -1633,7 +1633,8 @@ PKG_NOTE_flavor= ${FLAVOR}
. endif
WRK_ENV+= HOME=${WRKDIR} \
PWD="$${PWD}"
PWD="$${PWD}" \
__MAKE_CONF=${NONEXISTENT}
. for e in OSVERSION PATH TERM TMPDIR \
UNAME_b UNAME_i UNAME_K UNAME_m UNAME_n \
UNAME_p UNAME_r UNAME_s UNAME_U UNAME_v

View file

@ -11,7 +11,7 @@ USES= uidfix
USE_LDCONFIG= yes
SRCFILE= ${WRKSRC}/listcab.cpp
PROGFILE= ${SRCFILE:S/.cpp$//}
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
post-build:
${CXX} ${CXXFLAGS} -o ${PROGFILE} ${SRCFILE} -L${WRKSRC} -lcabinet -lz

View file

@ -20,6 +20,7 @@ WRKSRC= ${WRKDIR}/${DISTNAME}/wmSpaceWeather
SHEBANG_FILES= GetKp
USE_XORG= x11 xext xpm
ALL_TARGET= clean all
MAKE_ENV= OPSYS=${OPSYS}
MAKE_JOBS_UNSAFE= yes
PLIST_FILES= bin/GetKp bin/wmSpaceWeather \

View file

@ -17,7 +17,7 @@ LIB_DEPENDS= libexpat.so:textproc/expat2
USES= tar:bz2
USE_LDCONFIG= yes
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
WRKSRC_SUBDIR= pdel

View file

@ -13,7 +13,7 @@ LICENSE= ART10
USES= uidfix
MAKEFILE= ${FILESDIR}/Makefile.lib
USE_LDCONFIG= yes
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
OPTIONS_DEFINE= DOCS

View file

@ -14,7 +14,7 @@ USES= uidfix
MAKEFILE= ${FILESDIR}/Makefile.lib
USE_LDCONFIG= yes
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
post-install:
@${MKDIR} ${STAGEDIR}${DOCSDIR}

View file

@ -34,7 +34,6 @@ MAKE_ARGS+= LIBUSB_GLOBAL_INCLUDE_FILE=libusb_global_linux.h
MAKE_ARGS+= WITHOUT_PROFILE=yes
MAKE_ARGS+= WITHOUT_SSP=yes
MAKE_ARGS+= WITHOUT_WERROR=yes
MAKE_ARGS+= __MAKE_CONF=""
MAKE_ENV+= LDADD="-lrt"
.include <bsd.port.pre.mk>
@ -49,14 +48,15 @@ PLIST_FILES+= usr/lib/libusb.so.3 \
do-build:
${MKDIR} ${WRKSRC}/${LIBDIR_${ARCH}}
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} MAKEOBJDIR=${LIBDIR_${ARCH}} \
${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} \
${MAKE_ARGS:N${DESTDIRNAME}=*}
cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} \
MAKEOBJDIR=${LIBDIR_${ARCH}} ${MAKE_CMD} ${MAKE_FLAGS} \
${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*}
.if ${ARCH} == amd64
${MKDIR} ${WRKSRC}/lib
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV:NCC=*} CC="${CC} -m32" \
MAKEOBJDIR=lib ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} \
${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*} COMPAT_32BIT=yes
cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${MAKE_ENV:NCC=*} \
CC="${CC} -m32" MAKEOBJDIR=lib ${MAKE_CMD} ${MAKE_FLAGS} \
${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:N${DESTDIRNAME}=*} \
COMPAT_32BIT=yes
.endif
do-install:

View file

@ -14,7 +14,7 @@ BUILD_DEPENDS= as:devel/binutils
WRKSRC= ${WRKDIR}/${PORTNAME}/src
USES= iconv
MAKE_ENV+= __MAKE_CONF=/dev/null ASFLAGS="${ASFLAGS}"
MAKE_ENV+= ASFLAGS="${ASFLAGS}"
MAKE_ENV+= LD="${CC}"
SBINS= vmw vmshrink vmftp

View file

@ -9,7 +9,7 @@ WWW= https://libstocks.sourceforge.net/
USE_LDCONFIG= yes
REINPLACE_ARGS= -i ""
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
MAKE_ENV+= STAGEDIR="${STAGEDIR}"
USES= uidfix
@ -23,8 +23,8 @@ post-patch:
do-build do-install:
.for d in lib client
cd ${WRKSRC}/$d && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKEFLAGS} -j2 \
-f ${FILESDIR}/Makefile.$d ${.TARGET:S/do-//}
cd ${WRKSRC}/$d && ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} \
${MAKEFLAGS} -j2 -f ${FILESDIR}/Makefile.$d ${.TARGET:S/do-//}
.endfor
post-install:

View file

@ -14,7 +14,7 @@ USES= xorg
USE_XORG= xpm
MAKEFILE= ${FILESDIR}/Makefile.lib
USE_LDCONFIG= yes
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
OPTIONS_DEFINE= DOCS

View file

@ -18,6 +18,7 @@ DOS2UNIX_FILES= common/bspfile.h common/cmdlib.cpp common/mathlib.h \
hlvis/flow.cpp hlvis/vis.cpp hlvis/vis.h
MAKEFILE= ${FILESDIR}/Makefile
MAKE_ENV= ARCH=${ARCH}
NO_WRKSUBDIR= yes
PLIST_FILES= bin/hlbsp bin/hlcsg bin/hlrad bin/hlvis bin/ripent

View file

@ -1,5 +1,6 @@
PORTNAME= tachyon
DISTVERSION= 0.98.9
PORTREVISION= 1
CATEGORIES= graphics science
MASTER_SITES= http://jedi.ks.uiuc.edu/~johns/raytracer/files/${DISTVERSION}/
@ -8,10 +9,11 @@ COMMENT= Multiproccess ray tracing system
WWW= http://jedi.ks.uiuc.edu/~johns/raytracer/
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/../Copyright
LICENSE_FILE= ${WRKSRC}/Copyright
ALL_TARGET= bsd
BUILD_WRKSRC= ${WRKSRC}/unix
WRKSRC= ${WRKDIR}/${PORTNAME}
WRKSRC_SUBDIR= unix
PLIST_FILES= bin/tachyon \
lib/libtachyon.a
@ -19,7 +21,7 @@ PLIST_FILES= bin/tachyon \
.include <bsd.port.pre.mk>
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/../compile/${ARCH}/tachyon ${STAGEDIR}${PREFIX}/bin
${INSTALL_LIB} ${WRKSRC}/../compile/${ARCH}/libtachyon.a ${STAGEDIR}${PREFIX}/lib
${INSTALL_PROGRAM} ${WRKSRC}/compile/bsd/tachyon ${STAGEDIR}${PREFIX}/bin
${INSTALL_LIB} ${WRKSRC}/compile/bsd/libtachyon.a ${STAGEDIR}${PREFIX}/lib
.include <bsd.port.post.mk>

View file

@ -1,11 +0,0 @@
--- Makefile.orig 2009-04-23 15:11:55 UTC
+++ Makefile
@@ -18,6 +18,8 @@ include Make-distrib
COMPILEDIR=../compile
ARCHDIR=../compile/${ARCH}
OBJDIR=${ARCHDIR}/libtachyon
+LIBS=-L. -ltachyon -lm
+STRIP=strip
#
# Name of raytracing library file to create

View file

@ -0,0 +1,11 @@
--- src/threads.c.orig 2009-04-23 15:01:01 UTC
+++ src/threads.c
@@ -13,7 +13,7 @@
#include <winbase.h> /* system services headers */
#endif
-#if defined(SunOS) || defined(Irix) || defined(Linux) || defined(_CRAY) || defined(__osf__) || defined(AIX)
+#if defined(SunOS) || defined(Irix) || defined(Linux) || defined(Bsd) || defined(_CRAY) || defined(__osf__) || defined(AIX)
#include<unistd.h> /* sysconf() headers, used by most systems */
#endif

View file

@ -0,0 +1,11 @@
--- src/threads.h.orig 2009-04-22 15:43:14 UTC
+++ src/threads.h
@@ -13,7 +13,7 @@
#endif
/* POSIX Threads */
-#if defined(HPUX) || defined(__PARAGON__) || defined(Irix) || defined(Linux) || defined(_CRAY) || defined(__osf__) || defined(AIX) || defined(__APPLE__)
+#if defined(HPUX) || defined(__PARAGON__) || defined(Irix) || defined(Linux) || defined(Bsd) || defined(_CRAY) || defined(__osf__) || defined(AIX) || defined(__APPLE__)
#if !defined(USEUITHREADS) && !defined(USEPOSIXTHREADS)
#define USEPOSIXTHREADS
#endif

View file

@ -0,0 +1,11 @@
--- src/trace.c.orig 2010-01-18 06:13:18 UTC
+++ src/trace.c
@@ -88,7 +88,7 @@ void * thread_trace(thr_parms * t) {
* wraparound in _anyone's_ lifetime, so no need to even check....
* On lesser-bit platforms, we're not quite so lucky, so we have to check.
*/
-#if !defined(LP64)
+#if !defined(LP64) && !defined(_LP64)
if (local_mbox != NULL) {
if (t->serialno > (((unsigned long) 1) << ((sizeof(unsigned long) * 8) - 3))) {
memset(local_mbox, 0, sizeof(unsigned long) * scene->objgroup.numobjects);

View file

@ -0,0 +1,18 @@
--- unix/Make-arch.orig 2010-01-18 19:13:41 UTC
+++ unix/Make-arch
@@ -954,13 +954,12 @@ bsd:
bsd:
$(MAKE) all \
"ARCH = bsd" \
- "CC = gcc" \
- "CFLAGS = -O3 -fomit-frame-pointer -ffast-math -DBsd $(MISCFLAGS)" \
+ "CFLAGS = $(CFLAGS) -DBsd -DTHR $(MISCFLAGS)" \
"AR = ar" \
"ARFLAGS = r" \
"STRIP = strip" \
"RANLIB = ranlib" \
- "LIBS = -L. -ltachyon $(MISCLIB) -lm"
+ "LIBS = -L. -ltachyon $(MISCLIB) -lm -lpthread"
bsd-sparc:
$(MAKE) all \

View file

@ -14,14 +14,6 @@ LICENSE= MIT
USES= cpe libedit lua:core,51
USE_LDCONFIG= yes
# Overriding __MAKE_CONF makes sure that we don't re-parse
# /etc/make.conf during do-build, which would jeopardize the build
# if, for instance, the user set CFLAGS=mumble
# NOTE: /etc/make.conf is read BEFORE Makefile, so we already
# have its settings when we get here.
# See http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt
MAKE_ARGS= __MAKE_CONF=${NONEXISTENT}
# liblua.so requires libm, so make sure it has an explicit dependency
# so that applications need not second-guess lua's dependencies.
CPPFLAGS+= -I${LOCALBASE}/include

View file

@ -14,14 +14,6 @@ LICENSE= MIT
USES= cpe libedit lua:core,52
USE_LDCONFIG= yes
# Overriding __MAKE_CONF makes sure that we don't re-parse
# /etc/make.conf during do-build, which would jeopardize the build
# if, for instance, the user set CFLAGS=mumble
# NOTE: /etc/make.conf is read BEFORE Makefile, so we already
# have its settings when we get here.
# See http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt
MAKE_ARGS= __MAKE_CONF=${NONEXISTENT}
# liblua.so requires libm, so make sure it has an explicit dependency
# so that applications need not second-guess lua's dependencies.
CPPFLAGS+= -I${LOCALBASE}/include

View file

@ -14,14 +14,6 @@ LICENSE= MIT
USES= cpe lua:core,53
USE_LDCONFIG= yes
# Overriding __MAKE_CONF makes sure that we don't re-parse
# /etc/make.conf during do-build, which would jeopardize the build
# if, for instance, the user set CFLAGS=mumble
# NOTE: /etc/make.conf is read BEFORE Makefile, so we already
# have its settings when we get here.
# See http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt
MAKE_ARGS= __MAKE_CONF=${NONEXISTENT}
# using the "bsd" target rather than "freebsd" saves patching out the
# assumption of using base libedit in order to make it configurable. "bsd"
# is "generic" plus the POSIX and DLOPEN options, plus -Wl,-E at link time;

View file

@ -14,14 +14,6 @@ LICENSE= MIT
USES= cpe lua:core,54
USE_LDCONFIG= yes
# Overriding __MAKE_CONF makes sure that we don't re-parse
# /etc/make.conf during do-build, which would jeopardize the build
# if, for instance, the user set CFLAGS=mumble
# NOTE: /etc/make.conf is read BEFORE Makefile, so we already
# have its settings when we get here.
# See http://wiki.freebsd.org/MatthiasAndree/LuaLessonsLearnt
MAKE_ARGS= __MAKE_CONF=${NONEXISTENT}
# using the "bsd" target rather than "freebsd" saves patching out the
# assumption of using base libedit in order to make it configurable. "bsd"
# is "generic" plus the POSIX and DLOPEN options, plus -Wl,-E at link time;

View file

@ -18,8 +18,7 @@ GH_ACCOUNT= corecode
GH_TAGNAME= 92937587bbfeab53653b841afe76af2fa6dad345
USE_RC_SUBR= dma_flushq
MAKE_ENV= __MAKE_CONF=/dev/null \
MANDIR=${PREFIX}/share/man/man \
MAKE_ENV= MANDIR=${PREFIX}/share/man/man \
MK_WERROR=no \
SRCCONF=/dev/null

View file

@ -17,7 +17,6 @@ CONFIGURE_ARGS= --have-resn
USE_RC_SUBR= spamilter
LDFLAGS+= -lpthread
MAKE_ENV+= __MAKE_CONF=/dev/null
BINFILES= spamilter-system-report spamilter-user-report
SHEBANG_FILES= ${BINFILES}

View file

@ -15,7 +15,7 @@ USE_LDCONFIG= yes
USES= tar:xz uidfix
MAKE_ENV= LDADD=-lmpc LIB=missing SHLIB_MAJOR="${SHLIB_MAJOR}" \
SRCCONF=/dev/null SRCS="${SRCS}" __MAKE_CONF=/dev/null
SRCCONF=/dev/null SRCS="${SRCS}"
OPTIONS_DEFINE= PROFILE EXAMPLES
@ -61,10 +61,11 @@ post-patch:
${WRKSRC}/c/sp/Makefile
do-test:
@cd ${WRKSRC}/c; ${SETENV} ${MAKE_ENV} XCFLAGS="${CFLAGS} -frounding-math" \
XINCLUDES="-I${WRKSRC}" XLDFLAGS="${LDFLAGS}" XLIBS="-L${WRKSRC} -lmissing" \
@cd ${WRKSRC}/c; ${SETENVI} ${WRK_ENV} ${MAKE_ENV} \
XCFLAGS="${CFLAGS} -frounding-math" XINCLUDES="-I${WRKSRC}" \
XLDFLAGS="${LDFLAGS}" XLIBS="-L${WRKSRC} -lmissing" \
LD_LIBRARY_PATH="/lib:/usr/lib:${LOCALBASE}/lib:${WRKSRC}" \
${MAKE} ${_MAKE_JOBS} ${MAKE_ARGS} all3
${MAKE_CMD} ${_MAKE_JOBS} ${MAKE_ARGS} all3
.for t in d q s
@${PRINTF} "\n\n\n\t\t%s\n\n\n" "REPORT OF ${t:tu}. PRECISION TEST RESULTS:"
@${CAT} ${WRKSRC}/c/${t}p/tall${t}p.lst-xxx

View file

@ -11,7 +11,7 @@ WWW= https://www.netlib.org/linpack/
LIB_DEPENDS= libblas.so:math/blas
MAKE_ENV= WITHOUT_PROFILE=yes __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV= WITHOUT_PROFILE=yes SRCCONF=/dev/null
MAKEFILE= ${FILESDIR}/Makefile.lib
USES= fortran uidfix

View file

@ -21,7 +21,7 @@ MAKE_ARGS+= MAN1DIR=${PREFIX}/share/man/man1
# CCACHE has options, so may need d4p, make d4p not ccache friendly
# to avoid circular dependency
NO_CCACHE= yes
MAKE_ENV+= __MAKE_CONF=/dev/null SRCCONF=/dev/null
MAKE_ENV+= SRCCONF=/dev/null
.if !exists(/usr/lib/libdialog.so)
BROKEN= Requires libdialog in base

View file

@ -18,11 +18,6 @@ PLIST_FILES= bin/dirdiff lib/libfilecmp.so.0.0
CFLAGS+= -fPIC -I${TCL_INCLUDEDIR}
# When bsdmake is used to build the port, the ports infrastructure should call
# it with MAKE_ENV+= __MAKE_CONF=/dev/null to avoid sourcing make.conf twice.
# This is a workaround to make sure CFLAGS are passed through.
MAKE_ARGS= CFLAGS="${CFLAGS}"
post-patch:
@${REINPLACE_CMD} -e \
's|.0.0|.0|g ; \

View file

@ -18,7 +18,6 @@ USES= iconv jpeg
USE_RC_SUBR= pfstatd
MAKE_ARGS= "LD_GD=gd"
MAKE_ENV+= __MAKE_CONF=/dev/null
PLIST_FILES= bin/pfstat \
bin/pfstatd \

View file

@ -30,7 +30,6 @@ CFLAGS+= -DHAVE_ALTQ=1
.endif
MAKE_ARGS+= CSTD=gnu89
MAKE_ENV+= __MAKE_CONF=/dev/null
PLIST_FILES= sbin/pftop \
share/man/man8/pftop.8.gz

View file

@ -13,6 +13,7 @@ LICENSE_FILE= ${WRKSRC}/../COPYING
USES= xorg
USE_XORG= x11 xext xpm
MAKE_ENV= OPSYS=${OPSYS}
WRKSRC= ${WRKDIR}/${DISTNAME}/Src
PLIST_FILES= bin/wmCalClock man/man1/${PORTNAME}.1.gz
PORTDOCS= BUGS CHANGES HINTS INSTALL README TODO