From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MGBfEPD2H19dHgAA0tVLHw (envelope-from ) for ; Tue, 28 Jul 2020 09:59:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id W2VVDPD2H1/ILgAAB5/wlQ (envelope-from ) for ; Tue, 28 Jul 2020 09:59:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A8B79940876 for ; Tue, 28 Jul 2020 09:59:11 +0000 (UTC) Received: from localhost ([::1]:40598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0MO5-0004bY-3n for larch@yhetil.org; Tue, 28 Jul 2020 05:59:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0MNy-0004bC-Hb for guix-patches@gnu.org; Tue, 28 Jul 2020 05:59:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k0MNy-0005DO-9F for guix-patches@gnu.org; Tue, 28 Jul 2020 05:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k0MNy-0005Vv-7n for guix-patches@gnu.org; Tue, 28 Jul 2020 05:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42576] [PATCH 1/2] gnu: llvm: Move dynamic libraries to a separate "lib" output. Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 28 Jul 2020 09:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42576 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42576@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159593032321168 (code B ref -1); Tue, 28 Jul 2020 09:59:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Jul 2020 09:58:43 +0000 Received: from localhost ([127.0.0.1]:57323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0MNe-0005VL-OF for submit@debbugs.gnu.org; Tue, 28 Jul 2020 05:58:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:43054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k0MNa-0005VB-Pa for submit@debbugs.gnu.org; Tue, 28 Jul 2020 05:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0MNa-0004a4-HA for guix-patches@gnu.org; Tue, 28 Jul 2020 05:58:38 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:39825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0MNY-0005Aw-2S for guix-patches@gnu.org; Tue, 28 Jul 2020 05:58:38 -0400 X-Originating-IP: 86.246.37.13 Received: from localhost.localdomain (lfbn-idf2-1-572-13.w86-246.abo.wanadoo.fr [86.246.37.13]) (Authenticated sender: mail@ambrevar.xyz) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id C5665240014 for ; Tue, 28 Jul 2020 09:58:32 +0000 (UTC) From: Pierre Neidhardt Date: Tue, 28 Jul 2020 11:58:22 +0200 Message-Id: <20200728095822.28375-1-mail@ambrevar.xyz> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=217.70.183.193; envelope-from=mail@ambrevar.xyz; helo=relay1-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/28 05:58:33 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=1, FROM_SUSPICIOUS_NTLD_FP=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.1 (--) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: VmMRrDqHrTZt * gnu/packages/llvm.scm (llvm)[arguments]: Set configure-flags to build a dynamic library bundle in the "lib" output. Add phases to move the /bin and /include directories to the "out" output. The goal of this change is to reduce the closure size of LLVM dependents. - The dynamic library bundles saves a few dozen MiB over the separate dynamic libraries. - Removing the /bin and the /include directories from the dependent input saves about 35 MiB for LLVM 10. --- gnu/packages/llvm.scm | 65 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index b7bc21ea6e..3e9d428b9f 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -99,7 +99,7 @@ as \"x86_64-linux\"." (base32 "1pwgm6cr0xr5a0hrbqs1zvsvvjvy0yq1y47c96804wcs795s90yz")))) (build-system cmake-build-system) - (outputs '("out" "opt-viewer")) + (outputs '("out" "opt-viewer" "lib")) (native-inputs `(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2 ("perl" ,perl))) @@ -108,12 +108,18 @@ as \"x86_64-linux\"." (propagated-inputs `(("zlib" ,zlib))) ;to use output from llvm-config (arguments - `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" - "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" - "-DBUILD_SHARED_LIBS:BOOL=TRUE" - "-DLLVM_ENABLE_FFI:BOOL=TRUE" - "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities - "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. + `(#:configure-flags (list "-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" + ;; LLVM cannot enable BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB. + ;; "-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DLLVM_BUILD_LLVM_DYLIB=ON" + "-DLLVM_LINK_LLVM_DYLIB=ON" + (string-append "-DCMAKE_INSTALL_PREFIX=" (assoc-ref %outputs "lib")) + (string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "lib") + "/lib") + "-DLLVM_ENABLE_FFI:BOOL=TRUE" + "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities + "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. ;; Don't use '-g' during the build, to save space. #:build-type "Release" @@ -128,14 +134,49 @@ as \"x86_64-linux\"." (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/lib")) #t)) - (add-after 'install 'install-opt-viewer + (add-after 'install 'install-bin (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) + (out-lib (string-append out "/lib")) + (lib-output (assoc-ref outputs "lib")) + (lib-bin (string-append lib-output "/bin"))) + (mkdir-p out) + (rename-file (string-append lib-output "/bin") + (string-append out "/bin")) + ;; llvm-config is required by most lib dependents. It's only a + ;; few KiB, so it does not warrant a separate output. + (mkdir-p lib-bin) + (rename-file (string-append out "/bin/llvm-config") + (string-append lib-bin "/llvm-config")) + (rename-file (string-append lib-output "/include") + (string-append out "/include")) + (mkdir-p out-lib) + (if (file-exists? (string-append lib-output "/lib/cmake")) + (rename-file (string-append lib-output "/lib/cmake") + (string-append out-lib "/cmake")) + ;; The cmake files change location in llvm 3.9. + (begin + (mkdir-p (string-append out "/share/llvm")) + (rename-file (string-append lib-output "/share/llvm/cmake") + (string-append out "/share/llvm/cmake")))) + (for-each + (lambda (file) + (rename-file file + (string-append out-lib "/" (basename file)))) + (find-files (string-append lib-output "/lib") "\\.a$")) + (for-each + (lambda (file) + (symlink file + (string-append out-lib "/" (basename file)))) + (find-files (string-append lib-output "/lib") "\\.so"))) + #t)) + (add-after 'install 'install-opt-viewer + (lambda* (#:key outputs #:allow-other-keys) + (let* ((lib-output (assoc-ref outputs "lib")) (opt-viewer-out (assoc-ref outputs "opt-viewer")) - (opt-viewer-share-dir (string-append opt-viewer-out "/share")) - (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer"))) - (mkdir-p opt-viewer-share-dir) - (rename-file (string-append out "/share/opt-viewer") + (opt-viewer-dir (string-append opt-viewer-out "/share/opt-viewer"))) + (mkdir-p (dirname opt-viewer-dir)) + (rename-file (string-append lib-output "/share/opt-viewer") opt-viewer-dir)) #t))))) (home-page "https://www.llvm.org") base-commit: 0e1428ac5dc3a7f1aa68988dd88885009e9706a6 -- 2.27.0