gnu: zstd: Use G-expressions.

* gnu/packages/compression.scm (zstd)[arguments]: Use G-expressions.

Change-Id: Ic5dba01331a0c3c6f119ab9f800ac51829767ec2
This commit is contained in:
Zheng Junjie 2025-02-07 12:16:44 +08:00 committed by Andreas Enge
parent f48719a585
commit 00e2697620
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -1777,13 +1777,12 @@ or junctions, and always follows hard links.")
"lib" ;1.2MiB shared library and headers
"static")) ;1.2MiB static library
(arguments
`(#:phases
(modify-phases %standard-phases
(list #:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-command-file-names
;; Don't require hard requirements to be in $PATH.
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(our (lambda (name) (string-append out "/bin/" name))))
(lambda _
(let* ((our (lambda (name) (string-append #$output "/bin/" name))))
(substitute* "programs/zstdgrep"
(("(:-)(grep)" _ prefix command)
(string-append prefix (which command)))
@ -1794,16 +1793,16 @@ or junctions, and always follows hard links.")
(our command))))))
(delete 'configure) ;no configure script
(add-after 'install 'adjust-library-locations
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (assoc-ref outputs "lib"))
(static (assoc-ref outputs "static"))
(lambda _
(let* ((out #$output)
(lib #$output:lib)
(static #$output:static)
(shared-libs (string-append lib "/lib"))
(static-libs (string-append static "/lib")))
(mkdir-p static-libs)
;; This is based on the win64 release zip file from zstd.
,@(if (target-mingw?)
`((for-each delete-file (find-files out "\\.so"))
#$@(if (target-mingw?)
#~((for-each delete-file (find-files out "\\.so"))
(for-each delete-file (find-files shared-libs "\\.so"))
(rename-file (string-append shared-libs "/libzstd.a")
(string-append static-libs "/libzstd_static.lib"))
@ -1814,7 +1813,7 @@ or junctions, and always follows hard links.")
(delete-file (string-append out "/bin/zstdless"))
(delete-file (string-append out "/share/man/man1/zstdgrep.1"))
(delete-file (string-append out "/share/man/man1/zstdless.1")))
`(;; Move the static library to its own output to save ~1MiB.
#~(;; Move the static library to its own output to save ~1MiB.
(for-each (lambda (ar)
(link ar (string-append static-libs "/"
(basename ar)))
@ -1827,11 +1826,11 @@ or junctions, and always follows hard links.")
;; Note: The .pc file expects a trailing slash for 'prefix'.
(string-append "prefix=" lib "/\n")))))))))
#:make-flags
(list ,(string-append "CC=" (cc-for-target))
(string-append "prefix=" (assoc-ref %outputs "out"))
(string-append "libdir=" (assoc-ref %outputs "lib") "/lib")
(string-append "includedir=" (assoc-ref %outputs "lib") "/include")
,@(if (target-mingw?)
#~(list (string-append "CC=" #$(cc-for-target))
(string-append "prefix=" #$output)
(string-append "libdir=" #$output:lib "/lib")
(string-append "includedir=" #$output:lib "/include")
#$@(if (target-mingw?)
`(;; See the note in the Makefile.
"TARGET_SYSTEM=Windows"
;; Don't try to link with pthread.
@ -1848,7 +1847,7 @@ or junctions, and always follows hard links.")
;; Not currently detected, but be explicit & avoid surprises later.
"HAVE_LZ4=0"
"HAVE_ZLIB=0")
#:tests? ,(not (or (target-hurd?)
#:tests? (not (or (target-hurd?)
(%current-target-system)))))
(home-page "https://facebook.github.io/zstd/")
(synopsis "Zstandard real-time compression algorithm")