From nobody Mon Feb 27 18:18:42 2023 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 4PQTJy53KFz3vRft; Mon, 27 Feb 2023 18:18:42 +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 4PQTJy2bW6z3xkr; Mon, 27 Feb 2023 18:18:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677521922; 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=Cd3finbTMNGkHkdWtsE8xUFPbnmPuRpr1JyphfgrUNY=; b=k0XUkyEEtVd8bEyohSrR/Q6s67Rlnrrky2nk3duVJout1rLzBwPmL07pBkQcq+0TwM4gg7 xlatc10OI7lK2gMngnWQREy7YnN1cKGo829xRZJX9A1WM/4mFZjAI8pZ+sKElNZEcSNSr5 FG52NGWlfuYRCRwSNAykMkjlr6da+cG+Gz9I6B1XBC16c4OU4tx1uU3XS6ohD7QSdGYI/m f69c1PvXg2ZM7vvXo4iGJJDwbtGgs107b7moygUEwLCpPy4KYtS9xQGysSegky8T+ho3YJ Et0J4ezePbzCbHi3C0ny+WA3mF73Hvf4f/5G+fWsavfQcAKUYhzRvJiYsW3Wow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677521922; 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=Cd3finbTMNGkHkdWtsE8xUFPbnmPuRpr1JyphfgrUNY=; b=H9GIu1dxYNc6D7CUYKQjwwj7ZR7cZyBWeIT6VOW+5ymMCokGKp5xX8nHydTuUunwgh719T aLD2JI+oTz0LLXcM/hx8zU1ba7XVAeQSqKSx9E9JsKVrXftFLXOQBjZIlPsn9z8trDf+Ty F0xScnLDpwhVDAO28UItl20g30j2Y1pF17GfSFPR0UPzA5SrD8h5PoLbaE+CIMBx5nqzJx bEBhXZgnk0N1g35ZKtfux8YrI5JJPloZGndn7Ks1rqONHc0VeSZYKLkrRDVJzdZ8eXh2O9 fzsPuEMzPZX0DIAtRTgZWFXS5dLU+csAAX2KIBgcpkwdoxA64iF72f9X5LIsxQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677521922; a=rsa-sha256; cv=none; b=EOGaEuTXIfMkHNuzpnb5OwiAxvoM0ILNrU/bGrkQCqafy7qcsIo7J7ntQ7HgTBUksn4HG4 hv5994gp9kDq2eL9JgVIvbiGu0A7bTSBuftFJy3dpCb9zy3kH2yxqcQH3aCfqnqbs/x1wr abuqnbtJjz1OGgm+FsskhVEHZHoJzGv+bBcBSYVp5BmJkK4yiM0i/D9faIFAhAhe2jn8FF sSjbmFbmJmAsRcq4kwZSaY/v6DyQfFwq+f2ZB5n6QJBaLu3Oaycr7gfWpsyyKX6S/0bp16 KJ6evEAQJU26TlU5EaeAbywueKUDQNT726EQLs12sIU90hn+m8CN1vizkdRR0g== 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 4PQTJy1fnVzbkC; Mon, 27 Feb 2023 18:18:42 +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 31RIIgDT034443; Mon, 27 Feb 2023 18:18:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31RIIg34034442; Mon, 27 Feb 2023 18:18:42 GMT (envelope-from git) Date: Mon, 27 Feb 2023 18:18:42 GMT Message-Id: <202302271818.31RIIg34034442@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: 37b66193453c - main - Uses/cabal.mk: Add support for LTO feature. 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: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37b66193453c2ed2c103385aebf7e9f034a58ac1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=37b66193453c2ed2c103385aebf7e9f034a58ac1 commit 37b66193453c2ed2c103385aebf7e9f034a58ac1 Author: Gleb Popov AuthorDate: 2023-02-27 10:54:00 +0000 Commit: Gleb Popov CommitDate: 2023-02-27 18:11:10 +0000 Uses/cabal.mk: Add support for LTO feature. Haskell code benefits greatly from splitting functions into distinct ELF sections and then letting the linker to garbage-collect them. devel/hs-haskell-language-server port goes from 277MiB to 176MiB in size. net-p2p/cardano-node ports goes 302MiB -> 76.2MiB Relevant blog post: http://brandon.si/code/linking-smaller-haskell-binaries/ Reported by: Greg Steuck --- Mk/Features/lto.mk | 4 ++++ Mk/Uses/cabal.mk | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Mk/Features/lto.mk b/Mk/Features/lto.mk index d17484e05f53..aadd27b5d61f 100644 --- a/Mk/Features/lto.mk +++ b/Mk/Features/lto.mk @@ -16,6 +16,10 @@ LTO_Include_MAINTAINER= pkubaj@FreeBSD.org CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 . elif defined(_INCLUDE_USES_MESON_MK) MESON_ARGS+= -Db_lto=true +. elif defined(_INCLUDE_USES_CABAL_MK) + CABAL_LTO_ARGS= --ghc-options=-split-sections \ + --gcc-options="-fdata-sections -ffunction-sections" \ + --ld-options=-Wl,--gc-sections,--build-id,--icf=all . else # Overridable as a user may want to use -flto LTO_FLAGS?= -flto=thin diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk index 27237bde3974..23d0b0fa6ebb 100644 --- a/Mk/Uses/cabal.mk +++ b/Mk/Uses/cabal.mk @@ -215,12 +215,12 @@ cabal-extract: check-cabal # This pulls in all source dependencies, resolves them and generates build plan cabal-configure: check-cabal cd ${WRKSRC} && \ - ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --dry-run --disable-benchmarks --disable-tests --flags="${CABAL_FLAGS}" ${CABAL_WITH_ARGS} ${BUILD_ARGS} ${BUILD_TARGET} + ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --dry-run --disable-benchmarks --disable-tests --flags="${CABAL_FLAGS}" ${CABAL_WITH_ARGS} ${CABAL_LTO_ARGS} ${BUILD_ARGS} ${BUILD_TARGET} # Calls cabal build on the Haskell package located in ${WRKSRC} cabal-build: check-cabal cd ${WRKSRC} && \ - ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} ${BUILD_ARGS} ${BUILD_TARGET} + ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} ${CABAL_LTO_ARGS} ${BUILD_ARGS} ${BUILD_TARGET} # Generates USE_CABAL= ... line ready to be pasted into the port based on the plan.json file generated by cabal configure. make-use-cabal: check-cabal2tuple @@ -306,7 +306,7 @@ cabal-pre-configure: . if !target(do-build) do-build: cd ${WRKSRC} && \ - ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} + ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} ${CABAL_LTO_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} . endif . if !target(do-install)