mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-26 22:38:07 -05:00
gnu: CMake: Do not use source files from system libarchive.
* gnu/packages/cmake.scm (%common-build-phases): Remove phase 'use-system-libarchive'. (%preserved-third-party-files): New variable. (cmake-bootstrap)[native-inputs]: Remove. [source](snippet): Rewrite in terms of FILE-SYSTEM-FOLD, and preserve two files from the bundled libarchive. (cmake-minimal)[source](snippet): Adjust accordingly.
This commit is contained in:
parent
717c433c46
commit
f9dcc39ac1
1 changed files with 46 additions and 46 deletions
|
@ -60,26 +60,6 @@ (define %common-build-phases
|
||||||
(substitute* "Auxiliary/CMakeLists.txt"
|
(substitute* "Auxiliary/CMakeLists.txt"
|
||||||
((".*cmake-mode.el.*") ""))
|
((".*cmake-mode.el.*") ""))
|
||||||
#t))
|
#t))
|
||||||
(add-after 'unpack 'use-system-libarchive
|
|
||||||
;; 'Source/cm_get_date.c' includes archive_getdate.c wholesale,
|
|
||||||
;; so it needs to be available along with the header file.
|
|
||||||
(lambda* (#:key native-inputs inputs #:allow-other-keys)
|
|
||||||
(let ((libarchive-source (assoc-ref (or native-inputs inputs)
|
|
||||||
"libarchive:source"))
|
|
||||||
;; XXX: We can not use ,(package-version libarchive) here due to
|
|
||||||
;; a cyclic module reference at the top-level.
|
|
||||||
(libarchive-version "3.4.1")
|
|
||||||
(files-to-unpack '("libarchive/archive_getdate.c"
|
|
||||||
"libarchive/archive_getdate.h")))
|
|
||||||
(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
|
||||||
|
@ -105,6 +85,12 @@ (define %common-disabled-tests
|
||||||
;; This test requires 'ldconfig' which is not available in Guix.
|
;; This test requires 'ldconfig' which is not available in Guix.
|
||||||
"RunCMake.install"))
|
"RunCMake.install"))
|
||||||
|
|
||||||
|
(define %preserved-third-party-files
|
||||||
|
'(;; 'Source/cm_getdate.c' includes archive_getdate.c wholesale, so it must
|
||||||
|
;; be available along with the required headers.
|
||||||
|
"Utilities/cmlibarchive/libarchive/archive_getdate.c"
|
||||||
|
"Utilities/cmlibarchive/libarchive/archive_getdate.h"))
|
||||||
|
|
||||||
;;; The "bootstrap" CMake. It is used to build 'cmake-minimal' below, as well
|
;;; The "bootstrap" CMake. It is used to build 'cmake-minimal' below, as well
|
||||||
;;; as any dependencies that need cmake-build-system.
|
;;; as any dependencies that need cmake-build-system.
|
||||||
(define-public cmake-bootstrap
|
(define-public cmake-bootstrap
|
||||||
|
@ -122,26 +108,44 @@ (define-public cmake-bootstrap
|
||||||
(modules '((guix build utils)
|
(modules '((guix build utils)
|
||||||
(ice-9 ftw)))
|
(ice-9 ftw)))
|
||||||
(snippet
|
(snippet
|
||||||
'(begin
|
`(begin
|
||||||
(with-directory-excursion "Utilities"
|
;; CMake bundles its dependencies in the "Utilities" directory.
|
||||||
;; CMake bundles its dependencies below "Utilities" with a
|
;; Delete those to ensure the system libraries are used.
|
||||||
;; "cm" prefix in the directory name. Delete those to ensure
|
(define preserved-files
|
||||||
;; the system libraries are used.
|
'(,@%preserved-third-party-files
|
||||||
(for-each delete-file-recursively
|
;; Use the bundled JsonCpp during bootstrap to work around
|
||||||
(scandir
|
;; a circular dependency. TODO: JsonCpp can be built with
|
||||||
"."
|
;; Meson instead of CMake, but meson-build-system currently
|
||||||
(lambda (file)
|
;; does not support cross-compilation.
|
||||||
(and (string-prefix? "cm" file)
|
"Utilities/cmjsoncpp"
|
||||||
(eq? 'directory (stat:type (stat file)))
|
;; LibUV is required to bootstrap the initial build system.
|
||||||
|
"Utilities/cmlibuv"))
|
||||||
|
|
||||||
;; These inputs are required to bootstrap
|
(file-system-fold (lambda (dir stat result) ;enter?
|
||||||
;; the initial build system. They are
|
(or (string=? "Utilities" dir) ;init
|
||||||
;; deleted in 'cmake-minimal' below.
|
;; The bundled dependencies are
|
||||||
;; TODO: Consider building jsoncpp with
|
;; distinguished by having a "cm"
|
||||||
;; Meson instead, once meson-build-system
|
;; prefix to their upstream names.
|
||||||
;; learns cross-compilation.
|
(and (string-prefix? "Utilities/cm" dir)
|
||||||
(not (string=? "cmjsoncpp" file))
|
(not (member dir preserved-files)))))
|
||||||
(not (string=? "cmlibuv" file)))))))
|
(lambda (file stat result) ;leaf
|
||||||
|
(unless (or (member file preserved-files)
|
||||||
|
;; Preserve top-level files.
|
||||||
|
(string=? "Utilities"
|
||||||
|
(dirname file)))
|
||||||
|
(delete-file file)))
|
||||||
|
(const #t) ;down
|
||||||
|
(lambda (dir stat result) ;up
|
||||||
|
(when (equal? (scandir dir) '("." ".."))
|
||||||
|
(rmdir dir)))
|
||||||
|
(const #t) ;skip
|
||||||
|
(lambda (file stat errno result)
|
||||||
|
(format (current-error-port)
|
||||||
|
"warning: failed to delete ~a: ~a~%"
|
||||||
|
file (strerror errno)))
|
||||||
|
#t
|
||||||
|
"Utilities"
|
||||||
|
lstat)
|
||||||
#t))
|
#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)
|
||||||
|
@ -196,8 +200,6 @@ (define-public cmake-bootstrap
|
||||||
(replace 'configure
|
(replace 'configure
|
||||||
(lambda* (#:key (configure-flags '()) #:allow-other-keys)
|
(lambda* (#:key (configure-flags '()) #:allow-other-keys)
|
||||||
(apply invoke "./configure" configure-flags))))))
|
(apply invoke "./configure" configure-flags))))))
|
||||||
(native-inputs
|
|
||||||
`(("libarchive:source" ,(package-source libarchive))))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("bzip2" ,bzip2)
|
`(("bzip2" ,bzip2)
|
||||||
("curl" ,curl-minimal)
|
("curl" ,curl-minimal)
|
||||||
|
@ -245,12 +247,10 @@ (define-public cmake-minimal
|
||||||
(inherit (package-source cmake-bootstrap))
|
(inherit (package-source cmake-bootstrap))
|
||||||
(snippet
|
(snippet
|
||||||
(match (origin-snippet (package-source cmake-bootstrap))
|
(match (origin-snippet (package-source cmake-bootstrap))
|
||||||
((begin exp ...)
|
((_ _ exp ...)
|
||||||
;; Now we can delete the remaining software bundles.
|
;; Now we can delete the remaining software bundles.
|
||||||
(append '(begin
|
(append `(begin
|
||||||
(for-each delete-file-recursively
|
(define preserved-files ',%preserved-third-party-files))
|
||||||
'("Utilities/cmjsoncpp"
|
|
||||||
"Utilities/cmlibuv")))
|
|
||||||
exp))))))
|
exp))))))
|
||||||
(inputs
|
(inputs
|
||||||
`(("curl" ,curl)
|
`(("curl" ,curl)
|
||||||
|
|
Loading…
Reference in a new issue