--- bsd.port.mk.orig 2021-03-29 18:42:20.109852000 +1100 +++ bsd.port.mk 2021-07-06 20:37:39.510889000 +1000 @@ -1062,6 +1062,9 @@ .include "${PORTSDIR}/Mk/bsd.commands.mk" +BSDSUNIX_HACK?= yes +AUTOTOOLS_HACK?= yes + # Do not leak flavors to childs make .MAKEOVERRIDES:= ${.MAKEOVERRIDES:NFLAVOR} @@ -1166,17 +1169,37 @@ _EXPORTED_VARS+= OSREL # Get __FreeBSD_version -.if !defined(OSVERSION) -.if exists(/usr/include/sys/param.h) +. if ${OPSYS} == "FreeBSD" +. if !defined(OSVERSION) +. if exists(/usr/include/sys/param.h) OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h -.elif exists(${SRC_BASE}/sys/sys/param.h) +. elif exists(${SRC_BASE}/sys/sys/param.h) OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h -.else -.error Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE. -.endif -.endif +. else +. error Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE. +. endif +. endif +. else +. if !defined(OSVERSION) || ${OSVERSION} == "" +. if exists(/usr/include/sys/param.h) +OSVERSION!= ${AWK} '/^\#define[[:blank:]]__BSDSUniX_version/ {print $$3}' < /usr/include/sys/param.h +. elif exists(${SRC_BASE}/sys/sys/param.h) +OSVERSION!= ${AWK} '/^\#define[[:blank:]]__BSDSUniX_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h +. else +OSVERSION!= ${SYSCTL} -n kern.osreldate +. endif +. endif +. endif _EXPORTED_VARS+= OSVERSION + +. if ${OPSYS} == "FreeBSD" +. if !defined(WITH_PKGNG) && !defined(NO_WARNING_PKG_INSTALL_EOL) +WARNING+= "pkg_* tools were deliberately broken by bapt@freebsd.org on 1st Sept 2014, this tree undoes that." +WARNING+= "If you do not want to see this message again set NO_WARNING_PKG_INSTALL_EOL=yes in your make.conf" +. endif +. endif + .if (${OPSYS} == FreeBSD && (${OSVERSION} < 1104000 || (${OSVERSION} >= 1200000 && ${OSVERSION} < 1202000))) || \ (${OPSYS} == DragonFly && ${DFLYVERSION} < 400400) _UNSUPPORTED_SYSTEM_MESSAGE= Ports Collection support for your ${OPSYS} version has ended, and no ports\ @@ -1452,6 +1475,14 @@ DESTDIRNAME?= DESTDIR +. if ${OPSYS} == "BSDSUniX" && (defined(NO_BSDSUX_USES_HACK) && ${NO_BSDSUX_USES_HACK:tl} == "no") +. if ${OSVERSION} >= 100000 && ${OSVERSION} <= 199999 +USES+= alias:9 +. elif ${OSVERSION} >= 200000 && ${OSVERSION} <= 299999 +USES+= alias:12 +. endif +. endif + # setup empty variables for USES targets .for target in sanity fetch extract patch configure build install test package stage _USES_${target}?= @@ -1912,6 +1943,22 @@ .endif .endif +BSDSUX_USES_HACK?= yes +NO_BSDSUX_USES_HACK= no + +. if defined(BSDSUX_USES_HACK) && ${BSDSUX_USES_HACK:tl} == "no" +NO_BSDSUX_USES_HACK= yes +. endif + +AUTOTOOLS_HACK?= yes +. if defined(AUTOTOOLS_HACK) && ${AUTOTOOLS_HACK:tl} == "no" +NO_BSDSUNIX_AUTOTOOLS_HACK= yes +. endif + +. if ${OPSYS} == "BSDSUniX" +BSDSUNIX_HACK?= yes +. endif + PKG_IGNORE_DEPENDS?= 'this_port_does_not_exist' .if defined(_DESTDIR_VIA_ENV) @@ -3231,8 +3278,9 @@ .if !target(run-autotools-fixup) run-autotools-fixup: +. if ${OPSYS} == "FreeBSD" # Work around an issue where FreeBSD 10.0 is detected as FreeBSD 1.x. -.if !defined(WITHOUT_FBSD10_FIX) +. if !defined(WITHOUT_FBSD10_FIX) -@for f in `${FIND} ${WRKDIR} -type f \( -name config.libpath -o \ -name config.rpath -o -name configure -o -name libtool.m4 -o \ -name ltconfig -o -name libtool -o -name aclocal.m4 -o \ @@ -3249,7 +3297,65 @@ ${TOUCH} ${TOUCH_FLAGS} -mr $${f}.fbsd10bak $${f} ; \ ${RM} $${f}.fbsd10bak ; \ done -.endif +. endif +. else # not FreeBSD +# Hack in a fix where BSDSUniX is not known in the autotools... This +# could make a real mess, but in theory it should be fine. First we +# get rid of the early freebsd tokens, then we do generic search and +# for the common tokens used. But don't touch something already patched! +# -e 's|freebsd1\*)|OldFBSD1.\*)|g' \ +# -e 's|freebsd\[12\]\*)|OldFBSD[12].*)|g' \ +# -e 's|freebsd\[123\]\*)|OldFBSD[123].*)|g' \ +# -e 's|freebsd\[\[12\]\]\*)|OldFBSD[[12]].*)|g' \ +# -e 's|freebsd\[\[123\]\]\*)|OldFBSD[[123]].*)|g' \ +# -e '/bsdsunix/!s/freebsd[^123]/bsdsunix/g' \ +# +# -e '/kbsdsunix\*/!s/\*-\*-kfreebsd\*/&|\*-\*-kbsdsunix\*/' \ +# -e '/kbsdsunix\*/!s/kfreebsd\*/&|kbsdsunix\*/' \ +. if !defined(NO_BSDSUNIX_AUTOTOOLS_HACK) +. if ${OSVERSION} < 200000 + -@for f in `${FIND} ${WRKDIR} -type f \( -name config.libpath -o \ + -name config.rpath -o -name configure -o -name libtool.m4 -o \ + -name ltconfig -o -name libtool -o -name aclocal.m4 -o \ + -name acinclude.m4 -o -name config.links -o -name ltmail.sh -o \ + -name '*.m4' -o -name config.sub \) -exec ${GREP} -vqi 'bsdsunix' {} \; -print` ; do \ + ${SED} -i.bsdsux_1_0_bak \ + -e '/bsdsunix\*/!s/\*-\*-freebsd\*/&|\*-\*-bsdsunix\*/' \ + -e '/bsdsunix\*/!s/freebsd\*/&|bsdsunix\*/' \ + -e 's|FreeBSD|BSDSUniX|g' \ + -e 's|FREEBSD|BSDSUNIX|g' \ + -e 's|fbsd|bsdsux|g' \ + -e '/bsdsunix/!s/freebsd\[^12345678\]/bsdsunix/g' \ + $${f} ; \ + cmp -s $${f}.bsdsux_1_0_bak $${f} || \ + ${ECHO_MSG} "===> BSDSUniX autotools hack applied to $${f}" ; \ + ${TOUCH} ${TOUCH_FLAGS} -mr $${f}.bsdsux_1_0_bak $${f} && \ + ${RM} -f $${f}.bsdsux_1_0_bak ; \ + done +. else # version => 200000 +# This is still the same as the 1.0 hack until I get time to look at whether there +# is stuff for 10+.x that is different to 9.x otherwise it should be the same + -@for f in `${FIND} ${WRKDIR} -type f \( -name config.libpath -o \ + -name config.rpath -o -name configure -o -name libtool.m4 -o \ + -name ltconfig -o -name libtool -o -name aclocal.m4 -o \ + -name acinclude.m4 -o -name config.links -o -name ltmail.sh -o \ + -name '*.m4' -o -name config.sub \) -exec ${GREP} -vqi 'bsdsunix' {} \; -print` ; do \ + ${SED} -i.bsdsux_2_0_bak \ + -e '/bsdsunix\*/!s/\*-\*-freebsd\*/&|\*-\*-bsdsunix\*/' \ + -e '/bsdsunix\*/!s/freebsd\*/&|bsdsunix\*/' \ + -e 's|FreeBSD|BSDSUniX|g' \ + -e 's|FREEBSD|BSDSUNIX|g' \ + -e 's|fbsd|bsdsux|g' \ + -e '/bsdsunix/!s/freebsd\[^12345678\]/bsdsunix/g' \ + $${f} ; \ + cmp -s $${f}.bsdsux_1_0_bak $${f} || \ + ${ECHO_MSG} "===> BSDSUniX 2.0 autotools hack applied to $${f}" ; \ + ${TOUCH} ${TOUCH_FLAGS} -mr $${f}.bsdsux_2_0_bak $${f} && \ + ${RM} -f $${f}.bsdsux_2_0_bak ; \ + done +. endif # BSDSUniX version... +. endif # !defined(NO_BSDSUNIX_AUTOTOOLS_HACK) +. endif # ${OPSYS} == "FreeBSD" .endif # Configure