From nobody Wed Jul 27 13:22:20 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LtDwD3tFzz4XWsJ; Wed, 27 Jul 2022 13:22:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LtDwD3SdWz3Yjb; Wed, 27 Jul 2022 13:22:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658928140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SeSAccD+oWTNEeffLJzcOw9R6dv9TDZzdB51R/Lak9E=; b=T8tPLPu8uPh0M0c6bvPLz0mLEz3rvTAhf0HUP2OM5kXFAjsutN/Ztlovh1VRF5/pcfMcjO v39oWHvUSRrWCkEbjXTCsUHmrh6Wq5MlyLSouxRbkgChJACJUQ0c9giJ+jBI8pFFQ0Y5dB WCq3co5rdZ0h+EF/+FdsTrPYPTAcOYiY7K/H0qoOdqvjgQ5DM6eA9xyzc2hcWttIyuTbh9 BEl5WPl5kbB3KzOyjsIVK+Utk4xBdvESdRYgekBKuAHwcocNsyYUelm6mJLXpi5U0sLUxz zHMHsouNyvg0DYOruM0Mg1c57HdGZdx9wd6XXgbkWZaVO8KrHZqMxKhVnk8EDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LtDwD2V1dzJcc; Wed, 27 Jul 2022 13:22:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26RDMKxv083503; Wed, 27 Jul 2022 13:22:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26RDMKmA083502; Wed, 27 Jul 2022 13:22:20 GMT (envelope-from git) Date: Wed, 27 Jul 2022 13:22:20 GMT Message-Id: <202207271322.26RDMKmA083502@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Baptiste Daroussin Subject: git: b26839acc225 - main - framework: generalize WITH_ code List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b26839acc225c7007ebb8910e7136703667effda Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658928140; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SeSAccD+oWTNEeffLJzcOw9R6dv9TDZzdB51R/Lak9E=; b=em+obp4WN99jLLCjqMmGD0HB5ERdJfJdrqA66xaEXkow8TGirGNwBFBI1pojwoDxkaGudu 9oTqZuqnfhoomD5E0PwVGc8av7flv3rCwDaVbGMwU/HqGPuYiHgPi9ZfvN+gYL45HIHMpX nBwIQgwRD8boc09ly18Ni/Cwl4HiQaGkX0/oKAkzJRdm0tKUfVEdtlOUkWsoHCyO76GrL7 GhToxEDXVaxlxlk7VYKe7uflaAF/ZEbHl4d7jaO0u1V9Vt50C7m7mRkcXmY5pqdOWVWbVP NMHXP1b40LxytDUwmtucBr3njYIofKe1WZcblsFwJs4uJcr4deqY1rZFeN7fCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658928140; a=rsa-sha256; cv=none; b=HVMz/oSnCEFRI4x563hlFC2xjXp6qYpHAczyyQO7qRzKnrrUUUr0AFaj3putDw2qzMvdrN RlJxpW6+Hb+IqYW5iaYkyf6IczguNK3/zxCvOdW8JMecEMWc4TSamE16C8EGcWC0Yz69Af WJWmBv5pYLyz8y4NOicSXoDoWn1Tw/OYIBFbS0me2OecmluyrgEtcdV9EhUqVjaeMcAzU+ NMt6HH+ywokLXluMuuY3Qcr5hfZS4ecY7Be15+91z5E5qL2PMp649xCDrCnfccpD0RvTK0 WflmEdayvQBdh6n8JBxNzr1y6A7M1HEVcZ53xpwe4NqQI6HEjnegifTWj9xkfA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=b26839acc225c7007ebb8910e7136703667effda commit b26839acc225c7007ebb8910e7136703667effda Author: Baptiste Daroussin AuthorDate: 2022-07-21 09:56:06 +0000 Commit: Baptiste Daroussin CommitDate: 2022-07-27 13:21:32 +0000 framework: generalize WITH_ code Make the definition of WITH_ variable (end user actionable) a define via a generic code Move the WITH_DEBUG code into its own file Features/debug.mk Replace USE_LTO into WITH_LTO and move it into Features/lto.mk Move WITH_SSP into its own Features/ssp.mk Add a variable to defined which one are activated by default (here SSP) Reviewed by: portmgr (tcberner) Differential Revision: https://reviews.freebsd.org/D35873 --- Mk/Features/debug.mk | 24 ++++++++++++++++++++++ Mk/{bsd.lto.mk => Features/lto.mk} | 8 ++++++-- Mk/{bsd.ssp.mk => Features/ssp.mk} | 5 ++++- Mk/bsd.port.mk | 42 ++++++++++---------------------------- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/Mk/Features/debug.mk b/Mk/Features/debug.mk new file mode 100644 index 000000000000..6e67a2315223 --- /dev/null +++ b/Mk/Features/debug.mk @@ -0,0 +1,24 @@ +# DEBUG Support +# +# Add WITH_DEBUG into make.conf: +# - If set, debugging flags are added to CFLAGS and the binaries don't get +# stripped by INSTALL_PROGRAM or INSTALL_LIB. Besides, individual ports might +# add their specific to produce binaries for debugging purposes. You can +# override the debug flags that are passed to the compiler by setting +# DEBUG_FLAGS. It is set to "-g" at default. + +.if !defined(_DEBUG_MK_INCLUDED) +_DEBUG_MK_INCLUDED= yes +DEBUG_Include_MAINTAINER= portmgr@FreeBSD.org + +. if !defined(INSTALL_STRIPPED) +STRIP= #none +MAKE_ENV+= DONTSTRIP=yes +STRIP_CMD= ${TRUE} +. endif +DEBUG_FLAGS?= -g +CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} +. if defined(INSTALL_TARGET) +INSTALL_TARGET:= ${INSTALL_TARGET:S/^install-strip$/install/g} +. endif +.endif diff --git a/Mk/bsd.lto.mk b/Mk/Features/lto.mk similarity index 62% rename from Mk/bsd.lto.mk rename to Mk/Features/lto.mk index 196f686f9a7c..9d38448f312c 100644 --- a/Mk/bsd.lto.mk +++ b/Mk/Features/lto.mk @@ -1,13 +1,17 @@ # LTO Support +# # This file enforces Link Time Optimization for ports. -# In order to use it, add USE_LTO=yes to your /etc/make.conf. +# In order to use it, add WITH_LTO=yes to your /etc/make.conf. +.if !defined(_LTO_MK_INCLUDED) +_LTO_MK_INCLUDED= yes LTO_Include_MAINTAINER= pkubaj@FreeBSD.org -.if !defined(LTO_UNSAFE) +. if !defined(LTO_UNSAFE) # Overridable as a user may want to use -flto LTO_FLAGS?= -flto=thin CFLAGS+= ${LTO_FLAGS} CXXFLAGS+= ${LTO_FLAGS} LDFLAGS+= ${LTO_FLAGS} +. endif .endif diff --git a/Mk/bsd.ssp.mk b/Mk/Features/ssp.mk similarity index 71% rename from Mk/bsd.ssp.mk rename to Mk/Features/ssp.mk index f85b4e5c58a8..4213e6d668a6 100644 --- a/Mk/bsd.ssp.mk +++ b/Mk/Features/ssp.mk @@ -1,11 +1,14 @@ # SSP Support +.if !defined(_SSP_MK_INCLUDED) +_SSP_MK_INCLUDED= yes SSP_Include_MAINTAINER= portmgr@FreeBSD.org -.if !defined(SSP_UNSAFE) && \ +. if !defined(SSP_UNSAFE) && \ (! ${ARCH:Mmips*}) # Overridable as a user may want to use -fstack-protector-all SSP_CFLAGS?= -fstack-protector-strong CFLAGS+= ${SSP_CFLAGS} LDFLAGS+= ${SSP_CFLAGS} +. endif .endif diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index bcffecf2ab93..cc4de5aff0c4 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -325,17 +325,6 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org # usage inside the ports framework, and the latter are reserved for user- # settable options. (Setting USE_* in /etc/make.conf is always wrong). # -# WITH_DEBUG - If set, debugging flags are added to CFLAGS and the -# binaries don't get stripped by INSTALL_PROGRAM or -# INSTALL_LIB. Besides, individual ports might -# add their specific to produce binaries for debugging -# purposes. You can override the debug flags that are -# passed to the compiler by setting DEBUG_FLAGS. It is -# set to "-g" at default. -# -# NOTE: to override a globally defined WITH_DEBUG at a -# later time ".undef WITH_DEBUG" can be used -# # WITH_DEBUG_PORTS - A list of origins for which WITH_DEBUG will be set # # WITHOUT_SSP - Disable SSP. @@ -1019,6 +1008,8 @@ LC_ALL= C # These need to be absolute since we don't know how deep in the ports # tree we are and thus can't go relative. They can, of course, be overridden # by individual Makefiles or local system make configuration. +_LIST_OF_WITH_FEATURES= debug lto ssp +_DEFAULT_WITH_FEATURES= ssp PORTSDIR?= /usr/ports LOCALBASE?= /usr/local LINUXBASE?= /compat/linux @@ -1312,6 +1303,11 @@ WITH_DEBUG= yes . endif . endif +. if defined(USE_LTO) +WITH_LTO= ${USE_LTO} +WARNING+= USE_LTO is precrecated in favor of WITH_LTO +. endif + .include "${PORTSDIR}/Mk/bsd.default-versions.mk" .include "${PORTSDIR}/Mk/bsd.options.mk" @@ -1766,27 +1762,11 @@ CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//} . endif . endif -# Reset value from bsd.own.mk. -. if defined(WITH_DEBUG) -. if !defined(INSTALL_STRIPPED) -STRIP= #none -MAKE_ENV+= DONTSTRIP=yes -STRIP_CMD= ${TRUE} -. endif -DEBUG_FLAGS?= -g -CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS} -. if defined(INSTALL_TARGET) -INSTALL_TARGET:= ${INSTALL_TARGET:S/^install-strip$/install/g} +. for f in ${_LIST_OF_WITH_FEATURES} +. if defined(WITH_${f:tu}) || ( ${_DEFAULT_WITH_FEATURES:M${f}} && !defined(WITHOUT_${f:tu}) ) +.include "${PORTSDIR}/Mk/Features/$f.mk" . endif -. endif - -. if defined(USE_LTO) -.include "${PORTSDIR}/Mk/bsd.lto.mk" -. endif - -. if !defined(WITHOUT_SSP) -.include "${PORTSDIR}/Mk/bsd.ssp.mk" -. endif +. endfor # XXX PIE support to be added here MAKE_ENV+= NO_PIE=yes