Skip to content

Commit

Permalink
Mk/bsd.port.mk: Add __MAKE_CONF=${NONEXISTENT} to WRK_ENV
Browse files Browse the repository at this point in the history
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
  • Loading branch information
TijlCoosemans committed Mar 23, 2024
1 parent bf99270 commit d7511b9
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 80 deletions.
3 changes: 2 additions & 1 deletion Mk/bsd.port.mk
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion archivers/libcabinet/Makefile
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions astro/wmspaceweather/Makefile
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion devel/libpdel/Makefile
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion devel/libshhmsg/Makefile
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion devel/libxalloc/Makefile
Expand Up @@ -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}
Expand Down
14 changes: 7 additions & 7 deletions devel/linux_libusb/Makefile
Expand Up @@ -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>
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion emulators/vmw/Makefile
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions finance/libstocks/Makefile
Expand Up @@ -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

Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion games/libshhcards/Makefile
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions games/zhlt/Makefile
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions graphics/tachyon/Makefile
@@ -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}/

Expand All @@ -8,18 +9,19 @@ 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

.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>
11 changes: 0 additions & 11 deletions graphics/tachyon/files/patch-Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions graphics/tachyon/files/patch-src_threads.c
@@ -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

11 changes: 11 additions & 0 deletions graphics/tachyon/files/patch-src_threads.h
@@ -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
11 changes: 11 additions & 0 deletions graphics/tachyon/files/patch-src_trace.c
@@ -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);
18 changes: 18 additions & 0 deletions graphics/tachyon/files/patch-unix_Make-arch
@@ -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 \
8 changes: 0 additions & 8 deletions lang/lua51/Makefile
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions lang/lua52/Makefile
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions lang/lua53/Makefile
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions lang/lua54/Makefile
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions mail/dma/Makefile
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion mail/spamilter/Makefile
Expand Up @@ -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}
Expand Down
9 changes: 5 additions & 4 deletions math/libmissing/Makefile
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion math/linpack/Makefile
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ports-mgmt/dialog4ports/Makefile
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions sysutils/dirdiff/Makefile
Expand Up @@ -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 ; \
Expand Down
1 change: 0 additions & 1 deletion sysutils/pfstat/Makefile
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion sysutils/pftop/Makefile
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions x11-clocks/wmcalclock/Makefile
Expand Up @@ -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
Expand Down

0 comments on commit d7511b9

Please sign in to comment.