me
/
guix
Archived
1
0
Fork 0

gnu: CMake: Remove most bundled libraries.

* gnu/packages/cmake.scm (cmake-bootstrap)[source](modules): Add (ice-9 ftw).
[source](snippet): Change to a whitelist approach, keeping "jsoncpp" and "libuv".
[arguments]: Add phase "use-system-libarchive".  Remove substitution of deleted file.
[native-inputs]: Add (PACKAGE-SOURCE LIBARCHIVE)
[license]: Remove LICENSE:BSD-4 and LICENSE:BSD-2.
master
Marius Bakke 2020-01-25 14:44:53 +01:00
parent b5fc075d01
commit ed24dda76d
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 43 additions and 14 deletions

View File

@ -63,21 +63,34 @@
(sha256 (sha256
(base32 (base32
"0s06wrp0jnw2l4yq94skj53hwnz7lqrmhh96sq7w7njkkggickz5")) "0s06wrp0jnw2l4yq94skj53hwnz7lqrmhh96sq7w7njkkggickz5"))
(modules '((guix build utils))) (modules '((guix build utils)
(ice-9 ftw)))
(snippet (snippet
'(begin '(begin
;; Drop bundled software.
(with-directory-excursion "Utilities" (with-directory-excursion "Utilities"
;; CMake bundles its dependencies below "Utilities" with a
;; "cm" prefix in the directory name. Delete those to ensure
;; the system libraries are used.
(for-each delete-file-recursively (for-each delete-file-recursively
'("cmbzip2" (scandir
;; "cmcompress" "."
"cmcurl" (lambda (file)
"cmexpat" (and (string-prefix? "cm" file)
;; "cmlibarchive" (eq? 'directory (stat:type (stat file)))
"cmliblzma"
;; "cmlibuv" ;; jsoncpp must be kept around for now to
"cmzlib")) ;; work around a circular dependency. It
#t))) ;; gets deleted once we reach "cmake-minimal".
;; TODO: Consider building jsoncpp with
;; Meson instead, once meson-build-system
;; learns cross-compilation.
(not (string=? "cmjsoncpp" file))
;; XXX: cmake's bootstrap script appears to
;; rquire libuv, even though it detects and
;; uses the system version eventually.
(not (string=? "cmlibuv" file)))))))
#t))
(patches (search-patches "cmake-curl-certificates.patch")))) (patches (search-patches "cmake-curl-certificates.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
@ -127,6 +140,24 @@
(substitute* "Auxiliary/CMakeLists.txt" (substitute* "Auxiliary/CMakeLists.txt"
((".*cmake-mode.el.*") "")) ((".*cmake-mode.el.*") ""))
#t)) #t))
(add-after 'unpack 'use-system-libarchive
(lambda* (#:key native-inputs inputs #:allow-other-keys)
(let ((libarchive-source (assoc-ref (or native-inputs inputs)
"libarchive:source"))
(libarchive-version ,(package-version libarchive))
(files-to-unpack '("libarchive/archive_getdate.c"
"libarchive/archive_getdate.h")))
;; XXX: Source/cm_get_date.c includes archive_getdate.c wholesale,
;; so it needs to be available along with the header file.
(mkdir-p "Utilities/cmlibarchive")
(apply invoke "tar" "-xvf" libarchive-source
"--strip-components=1"
"-C" "Utilities/cmlibarchive"
(map (lambda (file)
(string-append "libarchive-" libarchive-version
"/" file))
files-to-unpack))
#t)))
(add-before 'configure 'patch-bin-sh (add-before 'configure 'patch-bin-sh
(lambda _ (lambda _
;; Replace "/bin/sh" by the right path in... a lot of ;; Replace "/bin/sh" by the right path in... a lot of
@ -138,7 +169,6 @@
"Source/cmLocalUnixMakefileGenerator3.cxx" "Source/cmLocalUnixMakefileGenerator3.cxx"
"Source/cmExecProgramCommand.cxx" "Source/cmExecProgramCommand.cxx"
"Utilities/Release/release_cmake.cmake" "Utilities/Release/release_cmake.cmake"
"Utilities/cmlibarchive/libarchive/archive_write_set_format_shar.c"
"Tests/CMakeLists.txt" "Tests/CMakeLists.txt"
"Tests/RunCMake/File_Generate/RunCMakeTest.cmake") "Tests/RunCMake/File_Generate/RunCMakeTest.cmake")
(("/bin/sh") (which "sh"))) (("/bin/sh") (which "sh")))
@ -163,6 +193,7 @@
("expat" ,expat) ("expat" ,expat)
("file" ,file) ("file" ,file)
("libarchive" ,libarchive) ("libarchive" ,libarchive)
("libarchive:source" ,(package-source libarchive))
("libuv" ,libuv) ("libuv" ,libuv)
("rhash" ,rhash) ("rhash" ,rhash)
("zlib" ,zlib))) ("zlib" ,zlib)))
@ -192,8 +223,6 @@ and compiler independent configuration files. CMake generates native makefiles
and workspaces that can be used in the compiler environment of your choice.") and workspaces that can be used in the compiler environment of your choice.")
(properties '((hidden? . #t))) (properties '((hidden? . #t)))
(license (list license:bsd-3 ; cmake (license (list license:bsd-3 ; cmake
license:bsd-4 ; cmcompress
license:bsd-2 ; cmlibarchive
license:expat ; cmjsoncpp is dual MIT/public domain license:expat ; cmjsoncpp is dual MIT/public domain
license:public-domain)))) ; cmlibarchive/archive_getdate.c license:public-domain)))) ; cmlibarchive/archive_getdate.c