about summary refs log tree commit diff
path: root/loftix/emulation.scm
diff options
context:
space:
mode:
Diffstat (limited to 'loftix/emulation.scm')
-rw-r--r--loftix/emulation.scm64
1 files changed, 33 insertions, 31 deletions
diff --git a/loftix/emulation.scm b/loftix/emulation.scm
index 372428e..14b5dea 100644
--- a/loftix/emulation.scm
+++ b/loftix/emulation.scm
@@ -17,25 +17,27 @@
 
 (define-public qemu-for-aflplusplus
   (let ((base qemu-minimal)
-        (base-version "5.2.50")
-        (commit "790d2124fd054621d3c0d3ec31bea114b60601f9")
-        (revision "master"))
+        (commit "3babe948e64da063861c20583bda14b402c5c07a")
+        (revision "0"))
     (hidden-package
      (package
        (inherit base)
-       (synopsis "QEMU for AFL++")
-       (name "qemu-for-aflplusplus")
-       (version (git-version base-version revision commit))
-       (home-page "https://github.com/AFLplusplus/qemuafl")
+       (name "qemu")
+       (version (git-version "5.2.50" revision commit))
        (source
         (origin
           (method git-fetch)
-          (uri (git-reference (url home-page)
+          (uri (git-reference (url "https://github.com/AFLplusplus/qemuafl")
                               (commit commit)
                               (recursive? #t)))
           (file-name (git-file-name name version))
           (sha256
-           (base32 "1l2kl8768l4mbkiaj63zn6gsdn3qpl3rg7s6h62rmd7599ar3xn3"))))
+           (base32 "0k2mhwzi7wav6r0bgba3s154lrwm3s3fc1cl2fxz8z2fmj52iq69"))
+          (patches (search-patches
+                    ;; https://github.com/AFLplusplus/qemuafl/pull/79
+                    "patches/qemu-for-aflplusplus-casts.patch"
+                    ;; https://github.com/AFLplusplus/qemuafl/pull/78
+                    "patches/qemu-for-aflplusplus-imported-headers.patch"))))
        (arguments
         (substitute-keyword-arguments (package-arguments base)
           ((#:configure-flags _ #~'())
@@ -44,12 +46,13 @@
                     ;; AFL++ only supports using a single afl-qemu-trace,
                     ;; so we only build qemu for the native target.
                     (match #$(let-system system system)
-                      ("x86_64-linux"   "x86_64-linux-user")
-                      ("i686-linux"     "i386-linux-user")
                       ("aarch64-linux"  "aarch64-linux-user")
                       ("armhf-linux"    "arm-linux-user")
+                      ("i686-linux"     "i386-linux-user")
                       ("mips64el-linux" "mips64el-linux-user")
-                      ("powerpc-linux"  "ppc-linux-user")))))
+                      ("powerpc-linux"  "ppc-linux-user")
+                      ("riscv64-linux"  "riscv64-linux-user")
+                      ("x86_64-linux"   "x86_64-linux-user")))))
           ((#:phases phases)
            #~(modify-phases #$phases
                (delete 'replace-firmwares)
@@ -57,29 +60,28 @@
                (delete 'fix-optionrom-makefile)
                (delete 'disable-unusable-tests)
                (replace 'configure
-                 (lambda* (#:key outputs configure-flags
-                           #:allow-other-keys)
+                 (lambda* (#:key configure-flags #:allow-other-keys)
                    ;; The `configure' script doesn't understand some of the
                    ;; GNU options.  Thus, add a new phase that's compatible.
-                   (let ((out (assoc-ref outputs "out")))
-                     (setenv "SHELL" (which "bash"))
-                     ;; The binaries need to be linked against -lrt.
-                     (setenv "LDFLAGS" "-lrt")
-                     (apply invoke
-                            `("./configure"
-                              ,(string-append "--cc=" (which "gcc"))
-                              ;; Some architectures insist on using HOST_CC
-                              ,(string-append "--host-cc=" (which "gcc"))
-                              "--disable-debug-info" ; save build space
-                              ,(string-append "--prefix=" out)
-                              ,(string-append "--sysconfdir=/etc")
-                              ,@configure-flags)))))
+                   (setenv "SHELL" (which "bash"))
+                   ;; The binaries need to be linked against -lrt.
+                   (setenv "LDFLAGS" "-lrt")
+                   (apply invoke
+                          "./configure"
+                          (string-append "--cc=" #$(cc-for-target))
+                          ;; Some architectures insist on using HOST_CC
+                          (string-append "--host-cc=" #$(cc-for-target))
+                          "--disable-debug-info" ; save build space
+                          (string-append "--prefix=" #$output)
+                          (string-append "--sysconfdir=/etc")
+                          configure-flags)))
                (add-after 'install 'install-qasan-header
-                 (lambda* (#:key outputs #:allow-other-keys)
+                 (lambda _
                    (install-file "qemuafl/qasan.h"
-                                 (string-append (assoc-ref outputs "out")
-                                                "/include"))))
-               (delete 'delete-firmwares)))))))))
+                                 (string-append #$output "/include"))))
+               (delete 'delete-firmwares)))))
+       (home-page "https://github.com/AFLplusplus/qemuafl")
+       (synopsis "QEMU for AFL++")))))
 
 (define-public qemu-for-fuzzolic
   (let ((base qemu-minimal)