Date: Fri, 12 Apr 2024 07:54:47 GMT From: Mathieu Arnold <mat@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 06601897e5cd - main - framework: reintroduce the feature enabling code Message-ID: <202404120754.43C7slbr026326@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mat: URL: https://cgit.FreeBSD.org/ports/commit/?id=06601897e5cd4afcc31f3b508b2cbb2bc7d4a677 commit 06601897e5cd4afcc31f3b508b2cbb2bc7d4a677 Author: Mathieu Arnold <mat@FreeBSD.org> AuthorDate: 2024-04-12 07:49:01 +0000 Commit: Mathieu Arnold <mat@FreeBSD.org> CommitDate: 2024-04-12 07:53:27 +0000 framework: reintroduce the feature enabling code For each feature (see in Mk/Features) users can now set these variables in their make.conf. Using LTO as an example. To enable globally: WITH_LTO= yes To disable globally (for example ssp is enabled by default): WITHOUT_LTO= yes To enable for a specific list of ports: WITH_LTO_PORTS= lang/perl5.36 To disable for a specific list of ports: WITHOUT_LTO_PORTS= lang/perl5.36 Differential Revision: https://reviews.freebsd.org/D44750 --- Mk/Uses/cargo.mk | 4 +--- Mk/bsd.port.mk | 42 ++++++++++++++++++++++++++++++++++-------- net-mgmt/net-snmp/Makefile | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index e3b733d35821..8710374e3584 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -139,10 +139,8 @@ CARGO_ENV+= \ CARGO_ENV+= RUST_BACKTRACE=1 . endif -. if !defined(_WITHOUT_LTO) && (!defined(WITHOUT_LTO_PORTS) || ${WITHOUT_LTO_PORTS:N${PKGORIGIN}}) +. if defined(WITH_LTO) _CARGO_MSG= "===> Additional optimization to port applied" -_WITH_LTO= yes -.undef _WITHOUT_LTO . endif # Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index a0cde979317e..f396d4ee4eec 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1324,19 +1324,45 @@ LDCONFIG32_DIR= libdata/ldconfig32 TMPDIR?= /tmp . endif # defined(PACKAGE_BUILDING) +# If user specified WITH_FEATURE=yes for a feature that is disabled by default +# treat it as enabled by default +. for feature in ${_LIST_OF_WITH_FEATURES} +. if ${_DEFAULT_WITH_FEATURES:N${feature}} && defined(WITH_${feature:tu}) +_DEFAULT_WITH_FEATURES+= ${feature} +. endif +. endfor + +. for feature in ${_LIST_OF_WITH_FEATURES} +# Create _{WITH,WITHOUT}_FEATURE vars based on user-provided {WITH,WITHOUT}_FEATURE +# Test WITHOUT_* first to make sure a port can disable the feature +. if defined(WITHOUT_${feature:tu}) +_WITHOUT_${feature:tu}= ${WITHOUT_${feature:tu}} +. elif defined(WITH_${feature:tu}) +_WITH_${feature:tu}= ${WITH_${feature:tu}} +. endif # For each Feature we support, process the # WITH_FEATURE_PORTS and WITHOUT_FEATURE_PORTS variables -. for feature in ${_LIST_OF_WITH_FEATURES} . if ${_DEFAULT_WITH_FEATURES:M${feature}} -_WITH_OR_WITHOUT= WITHOUT +. if defined(WITHOUT_${feature:tu}_PORTS) && ${WITHOUT_${feature:tu}_PORTS:M${PKGORIGIN}} +_WITHOUT_${feature:tu}= yes +.undef _WITH_${feature:tu} +. endif . else -_WITH_OR_WITHOUT= WITH +. if defined(WITH_${feature:tu}_PORTS) && ${WITH_${feature:tu}_PORTS:M${PKGORIGIN}} +_WITH_${feature:tu}= yes +.undef _WITHOUT_${feature:tu} +. endif . endif +. endfor -. if defined(${_WITH_OR_WITHOUT}_${feature:tu}_PORTS) -. if ${${_WITH_OR_WITHOUT}_${feature:tu}_PORTS:M${PKGORIGIN}} -${_WITH_OR_WITHOUT}_${feature:tu}= yes -. endif +# Now we made sure the features are either on or off, let's put them back in +# the WITH_* variable. From now on, we only need to test defined(WITH_*) or +# !defined(WITH_*) +. for feature in ${_LIST_OF_WITH_FEATURES} +. if defined(_WITH_${feature:tu}) +WITH_${feature:tu}= _WITH_${feature:tu} +. else +.undef WITH_${feature:tu} . endif . endfor @@ -1800,7 +1826,7 @@ CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//} . endif . for f in ${_LIST_OF_WITH_FEATURES} -. if defined(WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(WITHOUT_${f:tu}) ) +. if defined(WITH_${f:tu}) .include "${PORTSDIR}/Mk/Features/$f.mk" . endif . endfor diff --git a/net-mgmt/net-snmp/Makefile b/net-mgmt/net-snmp/Makefile index 744bd5126b80..f4b7df20ef0b 100644 --- a/net-mgmt/net-snmp/Makefile +++ b/net-mgmt/net-snmp/Makefile @@ -58,7 +58,7 @@ CONFIGURE_ARGS+=--enable-shared --enable-internal-md5 \ --with-ldflags="-lm -lkvm -ldevstat -L${PKG_PREFIX}/lib -L${LOCALBASE}/lib ${LCRYPTO}" SUB_FILES= pkg-message -.if !defined(WITHOUT_SSP) +.if defined(WITH_SSP) CONFIGURE_ARGS+=--with-libs="-lssp_nonshared" .endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404120754.43C7slbr026326>