about summary refs log tree commit diff
path: root/loft/patching.scm
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:02:16 +0900
committerNguyễn Gia Phong <cnx@loang.net>2024-11-19 11:02:16 +0900
commit1725ce5a7daf99a75508f15650a01321dd5a8ecc (patch)
tree77373eb85fd08c0236edf9d9a6b648eb28cbec00 /loft/patching.scm
downloadloftix-1725ce5a7daf99a75508f15650a01321dd5a8ecc.tar.gz
Define some packages
Diffstat (limited to 'loft/patching.scm')
-rw-r--r--loft/patching.scm74
1 files changed, 74 insertions, 0 deletions
diff --git a/loft/patching.scm b/loft/patching.scm
new file mode 100644
index 0000000..747dadf
--- /dev/null
+++ b/loft/patching.scm
@@ -0,0 +1,74 @@
+(use-modules (gnu packages compression)
+             (gnu packages elf)
+             (gnu packages engineering)
+             (gnu packages markup)
+             (gnu packages vim)
+             (guix build-system gnu)
+             (guix git-download)
+             ((guix licenses) #:prefix license:)
+             (guix packages))
+
+(define-public e9patch
+  (let ((commit "b4e7175abb8bd49ebbb6d09c7057aa43ddacac10")
+        (revision "0"))
+    (package
+      (name "e9patch")
+      (version (git-version "1.0.0-dev" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                     (url "https://github.com/GJDuck/e9patch")
+                     (commit commit)))
+                (sha256
+                 (base32
+                  "0a9s7h43ryyl4bvn0sid0dq78v24bnbcf271smj1a8wvffsih0jy"))
+                (file-name (git-file-name name version))
+                (patches (search-patches
+                           ;; https://github.com/GJDuck/e9patch/pull/94
+                           "e9patch-devendor.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/99
+                           "e9patch-plugin-api-headers.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/92
+                           "e9patch-check.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/95
+                           "e9patch-check-intel-format.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/88
+                           "e9patch-check-mode.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/93
+                           "e9patch-check-mov-imm.patch"
+                           ;; https://github.com/GJDuck/e9patch/issues/96
+                           "e9patch-check-rflags.patch"
+                           ;; https://github.com/GJDuck/e9patch/pull/97
+                           "e9patch-check-same_op_2.patch"))))
+      (build-system gnu-build-system)
+      (arguments (list #:modules `((ice-9 string-fun) ; string-replace-substring
+                                   ,@%default-gnu-modules)
+                       #:phases
+                       #~(modify-phases %standard-phases
+                           (add-after 'unpack 'fix-prefix
+                             (lambda _
+                               (substitute* "Makefile"
+                                 ;; https://github.com/GJDuck/e9patch/pull/87
+                                 (("\\\\/usr")
+                                  (string-replace-substring #$output "/" "\\/"))
+                                 (("/usr") #$output))))
+                           (delete 'configure))))
+      (native-inputs (list markdown xxd))
+      (inputs (list elfutils zycore zydis zlib))
+      (home-page "https://github.com/GJDuck/e9patch")
+      (synopsis "Static binary rewriting tool")
+      (description
+       "E9Patch is a static binary rewriting tool for x86-64 ELF binaries.
+E9Patch is:
+@itemize
+@item Scalable: E9Patch can reliably rewrite large/complex binaries
+      including web browsers (>100MB in size).
+@item Compatible: The rewritten binary is a drop-in replacement of the original,
+      with no additional dependencies.
+@item Fast: E9Patch can rewrite most binaries in a few seconds.
+@item Low Overheads: Both performance and memory.
+@item Programmable: E9Patch is designed so that it can be easily integrated
+      into other projects.
+@end itemize")
+      (license (list license:expat ;src/e9patch/e9loader_*.cpp
+                     license:gpl3+))))) ;rest