diff mbox series

[bug#63765,v6,10/10] gnu: python-lief: Rename to lief.

Message ID 830b737f3fc3f03303daee9d53169d5676db9598.1691240736.git.hako@ultrarare.space
State New
Headers show
Series gnu: python-lief: Update to 0.13.2. | expand

Commit Message

Hilton Chain Aug. 5, 2023, 1:19 p.m. UTC
* gnu/packages/elf.scm(lief): Renamed from ...
* gnu/packages/python-xyz.scm (python-lief): ...this.
(shrinkwrap)[inputs]: Adjust accordingly.
---
 gnu/packages/elf.scm        | 125 +++++++++++++++++++++++++++++++++++-
 gnu/packages/python-xyz.scm | 117 +--------------------------------
 2 files changed, 125 insertions(+), 117 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/elf.scm b/gnu/packages/elf.scm
index 3ddb6c4064..41fd1c72f2 100644
--- a/gnu/packages/elf.scm
+++ b/gnu/packages/elf.scm
@@ -33,18 +33,27 @@  (define-module (gnu packages elf)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
-  #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+ lgpl2.1 gpl2 bsd-2))
+  #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+ lgpl2.1 gpl2 asl2.0 bsd-2))
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages boost)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages logging)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages textutils)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages xml)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
@@ -342,6 +351,120 @@  (define-public libdwarf
     ;; See https://www.prevanders.net/dwarflicense.html:
     (license (list lgpl2.1 gpl2 bsd-2))))
 
+(define-public lief
+  (package
+    (name "lief")
+    (version "0.13.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/lief-project/LIEF")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (patches (search-patches "lief-unbundle-test-dependencies.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin (delete-file-recursively "third-party")
+                       (substitute* "api/python/config-default.toml"
+                         (("(ninja *= ).*" _ m)
+                          (string-append m "false\n")))))
+              (sha256
+               (base32
+                "0y48x358ppig5xp97ahcphfipx7cg9chldj2q5zrmn610fmi4zll"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:imported-modules
+      `(,@%cmake-build-system-modules
+        (guix build python-build-system))
+      #:modules
+      '(((guix build python-build-system) #:prefix python:)
+        (guix build cmake-build-system)
+        (guix build utils))
+      #:configure-flags
+      #~'("-DBUILD_SHARED_LIBS=ON"
+          "-DLIEF_INSTALL_COMPILED_EXAMPLES=ON"
+          "-DLIEF_TESTS=ON"
+          ;; Use dependencies from Guix.
+          "-DLIEF_EXTERNAL_SPDLOG=ON"
+          "-DLIEF_OPT_EXTERNAL_LEAF=ON"
+          "-DLIEF_OPT_EXTERNAL_SPAN=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
+      ;; Python bindings.
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'configure-python-build
+            (lambda* (#:key configure-flags build-type parallel-build?
+                      #:allow-other-keys)
+              (with-directory-excursion "api/python"
+                (substitute* "config-default.toml"
+                  ;; Honor `#:build-type'.
+                  (("(type *)= .*" _ m)
+                   (format #f "~a= \"~a\"~%"
+                           m build-type))
+                  ;; Honor `#:parallel-build?'.
+                  (("(parallel-jobs *)= .*" _ m)
+                   (format #f "~a= ~a~%"
+                           m (if parallel-build?
+                                 (parallel-job-count)
+                                 1))))
+                (substitute* "setup.py"
+                  ;; Honor `#:configure-flags'.
+                  (("(configure_cmd = .*)\n" _ m)
+                   (format #f "~a + [~a]~%"
+                           m (apply string-append
+                                    (map (lambda (flag)
+                                           (format #f "\"~a\"," flag))
+                                         (append configure-flags
+                                                 '("-DBUILD_SHARED_LIBS=OFF"))))
+                           ))))))
+          (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 '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 catch2
+           melkor
+           python-wrapper
+           python-tomli))
+    (inputs
+     (list boost-leaf
+           frozen
+           mbedtls-apache
+           nlohmann-json
+           pybind11
+           spdlog
+           tcb-span
+           utfcpp))
+    (outputs '("out" "python"))
+    (home-page "https://lief-project.github.io/")
+    (synopsis "Library to instrument executable formats")
+    (description
+     "@acronym{LIEF, Library to Instrument Executable Formats} is a cross
+platform library which can parse, modify and abstract ELF, PE and MachO
+formats.")
+    (license asl2.0)))
+
 (define-public melkor
   (let ((commit "ac2495bef2a744e7931537e023b1129229b001c4")
         (revision "8"))
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5066fcd1dd..8aa39f679a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -167,7 +167,6 @@  (define-module (gnu packages python-xyz)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages bdw-gc)
-  #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
@@ -215,7 +214,6 @@  (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)
@@ -33438,119 +33436,6 @@  (define-public python-misskey
 platform using the ActivityPub protocol.")
     (license license:expat)))
 
-(define-public python-lief
-  (package
-    (name "python-lief")
-    (version "0.13.2")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/lief-project/LIEF")
-                    (commit version)))
-              (file-name (git-file-name name version))
-              (patches (search-patches "lief-unbundle-test-dependencies.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               '(begin (delete-file-recursively "third-party")
-                       (substitute* "api/python/config-default.toml"
-                         (("(ninja *= ).*" _ m)
-                          (string-append m "false\n")))))
-              (sha256
-               (base32
-                "0y48x358ppig5xp97ahcphfipx7cg9chldj2q5zrmn610fmi4zll"))))
-    (build-system cmake-build-system)
-    (arguments
-     (list
-      #:imported-modules
-      `(,@%cmake-build-system-modules
-        (guix build python-build-system))
-      #:modules
-      '(((guix build python-build-system) #:prefix python:)
-        (guix build cmake-build-system)
-        (guix build utils))
-      #:configure-flags
-      #~'("-DBUILD_SHARED_LIBS=ON"
-          "-DLIEF_INSTALL_COMPILED_EXAMPLES=ON"
-          "-DLIEF_TESTS=ON"
-          ;; Use dependencies from Guix.
-          "-DLIEF_EXTERNAL_SPDLOG=ON"
-          "-DLIEF_OPT_EXTERNAL_LEAF=ON"
-          "-DLIEF_OPT_EXTERNAL_SPAN=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
-      ;; Python bindings.
-      #~(modify-phases %standard-phases
-          (add-after 'unpack 'configure-python-build
-            (lambda* (#:key configure-flags build-type parallel-build?
-                      #:allow-other-keys)
-              (with-directory-excursion "api/python"
-                (substitute* "config-default.toml"
-                  ;; Honor `#:build-type'.
-                  (("(type *)= .*" _ m)
-                   (format #f "~a= \"~a\"~%"
-                           m build-type))
-                  ;; Honor `#:parallel-build?'.
-                  (("(parallel-jobs *)= .*" _ m)
-                   (format #f "~a= ~a~%"
-                           m (if parallel-build?
-                                 (parallel-job-count)
-                                 1))))
-                (substitute* "setup.py"
-                  ;; Honor `#:configure-flags'.
-                  (("(configure_cmd = .*)\n" _ m)
-                   (format #f "~a + [~a]~%"
-                           m (apply string-append
-                                    (map (lambda (flag)
-                                           (format #f "\"~a\"," flag))
-                                         (append configure-flags
-                                                 '("-DBUILD_SHARED_LIBS=OFF"))))
-                           ))))))
-          (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 '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 catch2
-           melkor
-           python-wrapper
-           python-tomli))
-    (inputs
-     (list boost-leaf
-           frozen
-           mbedtls-apache
-           nlohmann-json
-           pybind11
-           spdlog
-           tcb-span
-           utfcpp))
-    (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
-and abstract ELF, PE and MachO formats.")
-    (license license:asl2.0)))
-
 (define-public python-eris
   (package
     (name "python-eris")
@@ -33592,7 +33477,7 @@  (define-public shrinkwrap
            python-poetry-core
            python-pypa-build
            python-pytest))
-    (inputs (list `(,python-lief "python") python-sh))
+    (inputs (list `(,lief "python") python-sh))
     (home-page "https://github.com/fzakaria/shrinkwrap")
     (synopsis "Emboss needed dependencies on the top level executable")
     (description