[bug#77976,2/3] gnu: make-torbrowser: Untangle from x86-64.

Message ID 20250421223106.4782-1-nandre@riseup.net
State New
Headers
Series [bug#77976,1/3] gnu: torbrowser: Update to 14.5. |

Commit Message

André Batista April 21, 2025, 10:31 p.m. UTC
  * gnu/packages/tor-browsers.scm (make-torbrowser)[native-inputs]:
Use nasm only on x86.
[arguments] <#:phases> 'mozconfig: Conditionally select mozconfig file.
[supported-systems]: Restrict build to upstream supported architectures.

Change-Id: Ia13795f88ea84339b851f52537cffc779142d404
---
 gnu/packages/tor-browsers.scm | 49 ++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 21 deletions(-)
  

Patch

diff --git a/gnu/packages/tor-browsers.scm b/gnu/packages/tor-browsers.scm
index 644bdac5ee..dd2f98f6b9 100644
--- a/gnu/packages/tor-browsers.scm
+++ b/gnu/packages/tor-browsers.scm
@@ -265,21 +265,22 @@  (define* (make-torbrowser #:key
            zip
            zlib))
     (native-inputs
-     (list
-      rust
-      `(,rust "cargo")
-      rust-cbindgen-0.26
-      lld-as-ld-wrapper-18  ; for cargo rustc
-      llvm-18
-      clang-18
-      perl
-      node-lts
-      python-wrapper
-      yasm
-      nasm                         ; XXX FIXME: only needed on x86_64 and i686
-      pkg-config
-      m4
-      which))
+     (append
+      (list
+       rust
+       `(,rust "cargo")
+       rust-cbindgen-0.26
+       lld-as-ld-wrapper-18  ; for cargo rustc
+       llvm-18
+       clang-18
+       perl
+       node-lts
+       python-wrapper
+       yasm
+       pkg-config
+       m4
+       which)
+      (if (target-x86?) (list nasm) '())))
     (arguments
      (list
       #:tests? #f                       ;not worth the cost
@@ -524,12 +525,16 @@  (define (runpaths-of-input label)
               (setenv "MOZ_BUILD_DATE" #$build-date)))
           (add-before 'configure 'mozconfig
             (lambda* (#:key configure-flags #:allow-other-keys)
-              (with-output-to-file "mozconfig"
-                (lambda ()
-                  (format #t ". $topsrcdir/mozconfig-linux-x86_64~%")
-                  (for-each (lambda (flag)
-                              (format #t "ac_add_options ~a~%" flag))
-                            configure-flags)))))
+              (let ((arch (cond (#$(target-arm32?) "arm")
+                                (#$(target-aarch64?) "aarch64")
+                                (#$(target-x86-32?) "i686")
+                                (#$(target-x86-64?) "x86_64"))))
+                (with-output-to-file "mozconfig"
+                  (lambda ()
+                    (format #t ". $topsrcdir/mozconfig-linux-~a~%" arch)
+                    (for-each (lambda (flag)
+                                (format #t "ac_add_options ~a~%" flag))
+                              configure-flags))))))
           ;; See tor-browser-build/projects/common/browser-localization.
           (add-before 'configure 'copy-firefox-locales
             (lambda _
@@ -798,6 +803,8 @@  (define (runpaths-of-input label)
             (variable "ICECAT_SYSTEM_DIR")
             (separator #f)              ;single entry
             (files '("lib/icecat")))))
+    (supported-systems (list "x86_64-linux" "i686-linux"
+                             "aarch64-linux" "armhf-linux"))
     (home-page "https://www.torproject.org")
     (synopsis "Anonymous browser derived from Mozilla Firefox")
     (description