@@ -208,6 +208,7 @@ (define-module (gnu packages python-xyz)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
+ #:use-module (gnu packages logging)
#:use-module (gnu packages machine-learning)
#:use-module (gnu packages man)
#:use-module (gnu packages markup)
@@ -32815,29 +32816,94 @@ (define-public python-misskey
(define-public python-lief
(package
(name "python-lief")
- (version "0.12.3")
+ (version "0.13.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/lief-project/LIEF")
(commit version)))
(file-name (git-file-name name version))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Configure build for Python bindings.
+ (substitute* "api/python/config-default.toml"
+ (("(ninja = )true" all m)
+ (string-append m "false"))
+ (("(parallel-jobs = )0" all m)
+ (string-append m (number->string (parallel-job-count)))))
+ ;; Unbundle third-party dependencies.
+ (for-each delete-file
+ (find-files "third-party/"
+ (string-join '("spdlog"
+ "frozen"
+ "json"
+ "mbedtls"
+ "pybind11"
+ "utfcpp")
+ "|" )))
+ ;; Same in argument #:configure-flags.
+ (substitute* "api/python/setup.py"
+ (("self\\._get_third_party_opt\\(\\)")
+ "[\"-DLIEF_EXTERNAL_SPDLOG=ON\",
+ \"-DLIEF_OPT_FROZEN_EXTERNAL=ON\",
+ \"-DLIEF_OPT_MBEDTLS_EXTERNAL=ON\",
+ \"-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON\",
+ \"-DLIEF_OPT_PYBIND11_EXTERNAL=ON\",
+ \"-DLIEF_OPT_UTFCPP_EXTERNAL=ON\"]"))))
(sha256
(base32
- "11i6hqmcjh56y554kqhl61698n9v66j2qk1c1g63mv2w07h2z661"))))
- (build-system python-build-system)
- (native-inputs (list cmake))
+ "0ms6zsb6mm6jys8nbfl2nml4l2y1zcgy26639adznj4n7b8n7lxk"))))
+ (build-system cmake-build-system)
(arguments
- (list
- #:tests? #f ;needs network
- #:phases #~(modify-phases %standard-phases
- (replace 'build
- (lambda _
- (invoke
- "python" "setup.py" "--sdk" "build"
- (string-append
- "-j" (number->string (parallel-job-count)))))))))
- (home-page "https://github.com/lief-project/LIEF")
+ (list #:modules
+ '((guix build utils)
+ (guix build cmake-build-system)
+ ((guix build python-build-system) #:prefix python:))
+ #:imported-modules
+ (append %cmake-build-system-modules
+ '((guix build python-build-system)))
+ #:configure-flags
+ #~'("-DCMAKE_LINK_WHAT_YOU_USE=ON"
+ "-DBUILD_SHARED_LIBS=ON"
+ "-DLIEF_INSTALL_COMPILED_EXAMPLES=ON"
+ "-DLIEF_TESTS=ON"
+ ;; Unbundle third-party dependencies
+ "-DLIEF_EXTERNAL_SPDLOG=ON"
+ "-DLIEF_OPT_FROZEN_EXTERNAL=ON"
+ "-DLIEF_OPT_MBEDTLS_EXTERNAL=ON"
+ "-DLIEF_OPT_NLOHMANN_JSON_EXTERNAL=ON"
+ "-DLIEF_OPT_PYBIND11_EXTERNAL=ON"
+ "-DLIEF_OPT_UTFCPP_EXTERNAL=ON")
+ #:phases
+ ;; Phases from python-build-system, for Python bindings.
+ #~(modify-phases %standard-phases
+ (add-after 'install 'chdir
+ (lambda _
+ (chdir "../source/api/python/")))
+ (add-after 'chdir 'ensure-no-mtimes-pre-1980
+ (assoc-ref python:%standard-phases 'ensure-no-mtimes-pre-1980))
+ (add-after 'ensure-no-mtimes-pre-1980 'enable-bytecode-determinism
+ (assoc-ref python:%standard-phases 'enable-bytecode-determinism))
+ (add-after 'enable-bytecode-determinism 'ensure-no-cythonized-files
+ (assoc-ref python:%standard-phases 'ensure-no-cythonized-files))
+ (add-after 'ensure-no-cythonized-files 'python-install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ((assoc-ref python:%standard-phases 'install)
+ #:inputs inputs
+ #:outputs outputs
+ #:configure-flags '()
+ #:use-setuptools? #t)))
+ (add-after 'python-install 'add-install-to-pythonpath
+ (assoc-ref python:%standard-phases 'add-install-to-pythonpath))
+ (add-after 'add-install-to-pythonpath 'add-install-to-path
+ (assoc-ref python:%standard-phases 'add-install-to-path))
+ (add-after 'add-install-to-path 'python-wrap
+ (assoc-ref python:%standard-phases 'wrap)))))
+ (native-inputs (list python-minimal-wrapper python-tomli))
+ (inputs (list frozen mbedtls-apache nlohmann-json pybind11 utfcpp spdlog))
+ (outputs '("out" "python"))
+ (home-page "https://lief-project.github.io/")
(synopsis "Library to instrument executable formats")
(description
"@code{python-lief} is a cross platform library which can parse, modify
@@ -32885,7 +32951,7 @@ (define-public shrinkwrap
python-poetry-core
python-pypa-build
python-pytest))
- (inputs (list python-lief python-sh))
+ (inputs (list `(,python-lief "python") python-sh))
(home-page "https://github.com/fzakaria/shrinkwrap")
(synopsis "Emboss needed dependencies on the top level executable")
(description