mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-17 04:20:44 +02:00
gnu: zstd: Fix cross-building to mingw32.
* gnu/packages/compression.scm (zstd)[arguments]: Adjust the custom 'adjust-library-locations phase to have separate logic for targeting mingw32. Adjust the make-flags to add some extra flags when targeting mingw32. Change-Id: Ifd32a6bd9157af93c7338dacc96467e2756b9314
This commit is contained in:
parent
767bfcb45c
commit
b764dbc319
1 changed files with 33 additions and 12 deletions
|
@ -7,7 +7,7 @@
|
||||||
;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021, 2022, 2024 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2015, 2016, 2017, 2018, 2020, 2021, 2022, 2024 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2015, 2017, 2018 Leo Famulari <leo@famulari.name>
|
;;; Copyright © 2015, 2017, 2018 Leo Famulari <leo@famulari.name>
|
||||||
;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
|
;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
|
||||||
;;; Copyright © 2015-2023 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2015-2024 Efraim Flashner <efraim@flashner.co.il>
|
||||||
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
|
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
|
||||||
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
|
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
|
||||||
;;; Copyright © 2016–2022 Tobias Geerinckx-Rice <me@tobias.gr>
|
;;; Copyright © 2016–2022 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||||
|
@ -1779,24 +1779,45 @@ or junctions, and always follows hard links.")
|
||||||
(static (assoc-ref outputs "static"))
|
(static (assoc-ref outputs "static"))
|
||||||
(shared-libs (string-append lib "/lib"))
|
(shared-libs (string-append lib "/lib"))
|
||||||
(static-libs (string-append static "/lib")))
|
(static-libs (string-append static "/lib")))
|
||||||
;; Move the static library to its own output to save ~1MiB.
|
|
||||||
(mkdir-p static-libs)
|
(mkdir-p static-libs)
|
||||||
(for-each (lambda (ar)
|
;; This is based on the win64 release zip file from zstd.
|
||||||
(link ar (string-append static-libs "/"
|
,@(if (target-mingw?)
|
||||||
(basename ar)))
|
`((for-each delete-file (find-files out "\\.so"))
|
||||||
(delete-file ar))
|
(for-each delete-file (find-files shared-libs "\\.so"))
|
||||||
(find-files shared-libs "\\.a$"))
|
(rename-file (string-append shared-libs "/libzstd.a")
|
||||||
|
(string-append static-libs "/libzstd_static.lib"))
|
||||||
|
(delete-file-recursively
|
||||||
|
(string-append shared-libs "/pkgconfig"))
|
||||||
|
;; no binary for interpreter `sh' found in $PATH
|
||||||
|
(delete-file (string-append out "/bin/zstdgrep"))
|
||||||
|
(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.
|
||||||
|
(for-each (lambda (ar)
|
||||||
|
(link ar (string-append static-libs "/"
|
||||||
|
(basename ar)))
|
||||||
|
(delete-file ar))
|
||||||
|
(find-files shared-libs "\\.a$"))
|
||||||
|
|
||||||
;; Make sure the pkg-config file refers to the right output.
|
;; Make sure the pkg-config file refers to the right output.
|
||||||
(substitute* (string-append shared-libs "/pkgconfig/libzstd.pc")
|
(substitute* (string-append shared-libs "/pkgconfig/libzstd.pc")
|
||||||
(("^prefix=.*")
|
(("^prefix=.*")
|
||||||
;; Note: The .pc file expects a trailing slash for 'prefix'.
|
;; Note: The .pc file expects a trailing slash for 'prefix'.
|
||||||
(string-append "prefix=" lib "/\n")))))))
|
(string-append "prefix=" lib "/\n")))))))))
|
||||||
#:make-flags
|
#:make-flags
|
||||||
(list ,(string-append "CC=" (cc-for-target))
|
(list ,(string-append "CC=" (cc-for-target))
|
||||||
(string-append "prefix=" (assoc-ref %outputs "out"))
|
(string-append "prefix=" (assoc-ref %outputs "out"))
|
||||||
(string-append "libdir=" (assoc-ref %outputs "lib") "/lib")
|
(string-append "libdir=" (assoc-ref %outputs "lib") "/lib")
|
||||||
(string-append "includedir=" (assoc-ref %outputs "lib") "/include")
|
(string-append "includedir=" (assoc-ref %outputs "lib") "/include")
|
||||||
|
,@(if (target-mingw?)
|
||||||
|
`(;; See the note in the Makefile.
|
||||||
|
"TARGET_SYSTEM=Windows"
|
||||||
|
;; Don't try to link with pthread.
|
||||||
|
"THREAD_LD="
|
||||||
|
;; This isn't picked up correctly in the Makefiles.
|
||||||
|
"EXT=.exe")
|
||||||
|
'())
|
||||||
;; Auto-detection is over-engineered and buggy.
|
;; Auto-detection is over-engineered and buggy.
|
||||||
"PCLIBDIR=lib"
|
"PCLIBDIR=lib"
|
||||||
"PCINCDIR=include"
|
"PCINCDIR=include"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue