| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 |
|
| 41 | (define-module (gnu packages tor-browsers)
|
| 42 | #:use-module ((guix licenses) #:prefix license:)
|
| 43 | #:use-module (gnu packages assembly)
|
| 44 | #:use-module (gnu packages base)
|
| 45 | #:use-module (gnu packages bash)
|
| 46 | #:use-module (gnu packages browser-extensions)
|
| 47 | #:use-module (gnu packages compression)
|
| 48 | #:use-module (gnu packages cups)
|
| 49 | #:use-module (gnu packages freedesktop)
|
| 50 | #:use-module (gnu packages fontutils)
|
| 51 | #:use-module (gnu packages gl)
|
| 52 | #:use-module (gnu packages glib)
|
| 53 | #:use-module (gnu packages gnome)
|
| 54 | #:use-module (gnu packages golang-web)
|
| 55 | #:use-module (gnu packages gtk)
|
| 56 | #:use-module (gnu packages hunspell)
|
| 57 | #:use-module (gnu packages icu4c)
|
| 58 | #:use-module (gnu packages image)
|
| 59 | #:use-module (gnu packages kerberos)
|
| 60 | #:use-module (gnu packages libcanberra)
|
| 61 | #:use-module (gnu packages libevent)
|
| 62 | #:use-module (gnu packages libffi)
|
| 63 | #:use-module (gnu packages linux)
|
| 64 | #:use-module (gnu packages llvm)
|
| 65 | #:use-module (gnu packages m4)
|
| 66 | #:use-module (gnu packages node)
|
| 67 | #:use-module (gnu packages nss)
|
| 68 | #:use-module (gnu packages pciutils)
|
| 69 | #:use-module (gnu packages perl)
|
| 70 | #:use-module (gnu packages pkg-config)
|
| 71 | #:use-module (gnu packages pulseaudio)
|
| 72 | #:use-module (gnu packages python)
|
| 73 | #:use-module (gnu packages rust)
|
| 74 | #:use-module (gnu packages rust-apps)
|
| 75 | #:use-module (gnu packages tor)
|
| 76 | #:use-module (gnu packages video)
|
| 77 | #:use-module (gnu packages xdisorg)
|
| 78 | #:use-module (gnu packages xorg)
|
| 79 | #:use-module (gnu packages)
|
| 80 | #:use-module (guix build-system cargo)
|
| 81 | #:use-module (guix build-system copy)
|
| 82 | #:use-module (guix build-system gnu)
|
| 83 | #:use-module (guix build-system mozilla)
|
| 84 | #:use-module (guix download)
|
| 85 | #:use-module (guix gexp)
|
| 86 | #:use-module (guix git-download)
|
| 87 | #:use-module (guix hg-download)
|
| 88 | #:use-module (guix packages)
|
| 89 | #:use-module (ice-9 regex)
|
| 90 | #:use-module (guix utils))
|
| 91 |
|
| 92 | |
| 93 | (define firefox-locales
|
| 94 | (let ((commit "412690f1368e37f70af57eecabb93497167eb9ba")
|
| 95 | (revision "2"))
|
| 96 | (package
|
| 97 | (name "firefox-locales")
|
| 98 | (version (git-version "0.0.0" revision commit))
|
| 99 | (source
|
| 100 | (origin
|
| 101 | (method git-fetch)
|
| 102 | (uri (git-reference
|
| 103 | (url "https://github.com/mozilla-l10n/firefox-l10n")
|
| 104 | (commit commit)))
|
| 105 | (file-name (git-file-name name version))
|
| 106 | (sha256
|
| 107 | (base32
|
| 108 | "15614g94zdk3n1nnx5jy622zryv2ydd5cmn4pidwrl07g1f3xxxa"))))
|
| 109 | (build-system copy-build-system)
|
| 110 | (home-page "https://github.com/mozilla-l10n/firefox-l10n")
|
| 111 | (synopsis "Firefox Locales")
|
| 112 | (description "This package contains localized messages for all
|
| 113 | Firefox locales.")
|
| 114 | (license license:mpl2.0))))
|
| 115 |
|
| 116 | |
| 117 | |
| 118 | (define %torbrowser-build-date "20260928083000")
|
| 119 |
|
| 120 | |
| 121 | (define %torbrowser-version "15.0.24")
|
| 122 |
|
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | (define %torbrowser-firefox-version "140.17.0esr-15.0-1-build4")
|
| 128 |
|
| 129 | |
| 130 | (define %torbrowser-locales (list "ar" "be" "bg" "ca" "cs" "da" "de" "el" "es-ES" "fa"
|
| 131 | "fi" "fr" "ga-IE" "he" "hu" "id" "is" "it" "ja" "ka"
|
| 132 | "ko" "lt" "mk" "ms" "my" "nb-NO" "nl" "pl" "pt-BR"
|
| 133 | "pt-PT" "ro" "ru" "sq" "sv-SE" "th" "tr" "uk" "vi"
|
| 134 | "zh-CN" "zh-TW"))
|
| 135 |
|
| 136 | |
| 137 | (define torbrowser-translation-base
|
| 138 | (origin
|
| 139 | (method git-fetch)
|
| 140 | (uri (git-reference
|
| 141 | (url "https://gitlab.torproject.org/tpo/translation.git")
|
| 142 | (commit "c62d7c244409d6d6ca37cd7f4819260ffc3cf60b")))
|
| 143 | (file-name "translation-base-browser")
|
| 144 | (sha256
|
| 145 | (base32
|
| 146 | "0gasp5gx4zc603yjhxi5rhagjq5pswvyxdgin75ax5p76bkaypcp"))))
|
| 147 |
|
| 148 | |
| 149 | (define torbrowser-translation-specific
|
| 150 | (origin
|
| 151 | (method git-fetch)
|
| 152 | (uri (git-reference
|
| 153 | (url "https://gitlab.torproject.org/tpo/translation.git")
|
| 154 | (commit "8cae94965791def3a7e63a1acb9e998ce8133de9")))
|
| 155 | (file-name "translation-tor-browser")
|
| 156 | (sha256
|
| 157 | (base32
|
| 158 | "03dhx4zlawmymp3v7fv9mr9nywpryblha3iz344s7riwk7iv8ivl"))))
|
| 159 |
|
| 160 | (define torbrowser-assets
|
| 161 | |
| 162 | (package
|
| 163 | (name "torbrowser-assets")
|
| 164 | (version %torbrowser-version)
|
| 165 | (source
|
| 166 | (origin
|
| 167 | (method url-fetch)
|
| 168 | (uri
|
| 169 | (string-append
|
| 170 | "https://archive.torproject.org/tor-package-archive/torbrowser/"
|
| 171 | version "/tor-browser-linux-x86_64-" version ".tar.xz"))
|
| 172 | (sha256
|
| 173 | (base32
|
| 174 | "016n0nc1vj66x236aqlx1yffs36zq2ajry343lxbbb72xfvfygmh"))))
|
| 175 | (arguments
|
| 176 | (list
|
| 177 | #:install-plan
|
| 178 | ''(("Browser" "." #:include-regexp
|
| 179 | ("^\\./TorBrowser/Data/Tor/torrc-defaults"
|
| 180 | "^\\./fonts/")))))
|
| 181 | (build-system copy-build-system)
|
| 182 | (home-page "https://www.torproject.org")
|
| 183 | (synopsis "Tor Browser assets")
|
| 184 | (description "This package contains fonts and configuration files for Tor
|
| 185 | Browser.")
|
| 186 | (license license:silofl1.1)))
|
| 187 |
|
| 188 | |
| 189 | (define lld-as-ld-wrapper-19
|
| 190 | (make-lld-wrapper lld-19 #:lld-as-ld? #t))
|
| 191 |
|
| 192 | (define* (make-torbrowser #:key
|
| 193 | moz-app-name
|
| 194 | moz-app-remotingname
|
| 195 | branding-directory
|
| 196 | translation-base
|
| 197 | translation-specific
|
| 198 | assets
|
| 199 | locales
|
| 200 | build-date
|
| 201 | base-browser-version)
|
| 202 | (package
|
| 203 | (name "torbrowser")
|
| 204 | (version %torbrowser-version)
|
| 205 | (source
|
| 206 | (origin
|
| 207 | (method url-fetch)
|
| 208 | (uri
|
| 209 | (string-append
|
| 210 | "https://archive.torproject.org/tor-package-archive/torbrowser/"
|
| 211 | version "/src-firefox-tor-browser-" %torbrowser-firefox-version
|
| 212 | ".tar.xz"))
|
| 213 | (sha256
|
| 214 | (base32
|
| 215 | "17qnisicbr6rvlc7kaxjjinif1jkvh8fnivj47aq36lj3jdac5y2"))))
|
| 216 | (build-system mozilla-build-system)
|
| 217 | (inputs
|
| 218 | (list lyrebird
|
| 219 | firefox-locales
|
| 220 | tor-client
|
| 221 | alsa-lib
|
| 222 | bash-minimal |
| 223 | cups
|
| 224 | dbus-glib
|
| 225 | gdk-pixbuf
|
| 226 | glib
|
| 227 | gtk+
|
| 228 | cairo
|
| 229 | pango
|
| 230 | freetype
|
| 231 | libcanberra
|
| 232 | libgnome
|
| 233 | libjpeg-turbo
|
| 234 | libpng-apng-next
|
| 235 | libwebp
|
| 236 | libxft
|
| 237 | libevent
|
| 238 | libxinerama
|
| 239 | libxscrnsaver
|
| 240 | libxcomposite
|
| 241 | libxt
|
| 242 | libffi
|
| 243 | |
| 244 | ffmpeg-6
|
| 245 | libvpx
|
| 246 | icu4c-76
|
| 247 | pixman
|
| 248 | pulseaudio
|
| 249 | mesa
|
| 250 | pciutils
|
| 251 | mit-krb5
|
| 252 | hunspell
|
| 253 | libnotify
|
| 254 | nspr
|
| 255 | nss-rapid
|
| 256 | shared-mime-info
|
| 257 | eudev
|
| 258 | unzip
|
| 259 | zip
|
| 260 | zlib))
|
| 261 | (native-inputs
|
| 262 | (append
|
| 263 | (list
|
| 264 | rust
|
| 265 | `(,rust "cargo")
|
| 266 | rust-cbindgen-0.28
|
| 267 | lld-as-ld-wrapper-19 |
| 268 | llvm-19
|
| 269 | clang-19
|
| 270 | perl
|
| 271 | node-lts
|
| 272 | python-wrapper
|
| 273 | yasm
|
| 274 | pkg-config
|
| 275 | m4
|
| 276 | which)
|
| 277 | (if (target-x86?) (list nasm) '())))
|
| 278 | (arguments
|
| 279 | (list
|
| 280 | #:tests? #f |
| 281 |
|
| 282 | |
| 283 | #:validate-runpath? #f
|
| 284 |
|
| 285 | #:configure-flags
|
| 286 | #~(list
|
| 287 | "--without-relative-data-dir" |
| 288 | "--disable-base-browser-update"
|
| 289 | |
| 290 | "--enable-update-channel=release"
|
| 291 | |
| 292 | |
| 293 | (string-append "--with-user-appdir=." #$moz-app-name)
|
| 294 | (string-append "--with-branding=" #$branding-directory)
|
| 295 | (string-append "--prefix=" #$output)
|
| 296 | (string-append "--with-base-browser-version="
|
| 297 | #$base-browser-version)
|
| 298 |
|
| 299 | "--enable-application=browser"
|
| 300 | "--with-distribution-id=org.gnu"
|
| 301 | "--enable-geckodriver"
|
| 302 | |
| 303 | |
| 304 | "--with-unsigned-addon-scopes=app,system"
|
| 305 | "--allow-addon-sideload"
|
| 306 |
|
| 307 | "--enable-pulseaudio"
|
| 308 |
|
| 309 | "--disable-tests"
|
| 310 | "--disable-updater"
|
| 311 | "--disable-crashreporter"
|
| 312 | |
| 313 | #$(if (target-aarch64?) "" "--disable-eme")
|
| 314 |
|
| 315 | |
| 316 | "--disable-debug"
|
| 317 | "--disable-debug-symbols"
|
| 318 |
|
| 319 | "--enable-rust-simd"
|
| 320 | "--enable-release"
|
| 321 | "--enable-optimize"
|
| 322 | "--enable-strip"
|
| 323 | "--disable-elf-hack"
|
| 324 |
|
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | (string-append "--with-clang-path="
|
| 331 | (search-input-file %build-inputs "bin/clang"))
|
| 332 | (string-append "--with-libclang-path="
|
| 333 | (dirname (search-input-file %build-inputs
|
| 334 | "lib/libclang.so")))
|
| 335 |
|
| 336 | |
| 337 | "--without-wasm-sandboxed-libraries"
|
| 338 |
|
| 339 | |
| 340 | "--with-system-jpeg" |
| 341 | "--with-system-png" |
| 342 | "--with-system-webp"
|
| 343 | "--with-system-zlib"
|
| 344 | "--with-system-libevent"
|
| 345 | "--with-system-libvpx"
|
| 346 | "--with-system-icu"
|
| 347 | "--with-system-nspr"
|
| 348 | "--with-system-nss"
|
| 349 | "--with-system-ffi"
|
| 350 |
|
| 351 | "--enable-system-pixman"
|
| 352 | )
|
| 353 |
|
| 354 | #:imported-modules %cargo-utils-modules |
| 355 |
|
| 356 | #:modules `((ice-9 ftw)
|
| 357 | (ice-9 match)
|
| 358 | (srfi srfi-1)
|
| 359 | (srfi srfi-26)
|
| 360 | (rnrs bytevectors)
|
| 361 | (rnrs io ports)
|
| 362 | (guix elf)
|
| 363 | (guix build gremlin)
|
| 364 | ,@%default-gnu-imported-modules)
|
| 365 | #:phases
|
| 366 | #~(modify-phases %standard-phases
|
| 367 | (add-after 'unpack 'apply-guix-specific-patches
|
| 368 | (lambda _
|
| 369 | (for-each
|
| 370 | (lambda (file) (invoke "patch" "--force" "-p1" "-i" file))
|
| 371 | '(#$(local-file
|
| 372 | (search-patch "torbrowser-compare-paths.patch"))
|
| 373 | #$(local-file
|
| 374 | (search-patch
|
| 375 | "torbrowsers-add-store-to-rdd-allowlist.patch"))
|
| 376 | #$(local-file
|
| 377 | (search-patch "torbrowser-use-system-wide-dir.patch"))))))
|
| 378 | (add-after 'apply-guix-specific-patches 'remove-bundled-libraries
|
| 379 | (lambda _
|
| 380 | |
| 381 | |
| 382 | |
| 383 | (for-each (lambda (file)
|
| 384 | (format #t "deleting '~a'...~%" file)
|
| 385 | (delete-file-recursively file))
|
| 386 | '( |
| 387 | |
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | |
| 394 | |
| 395 | |
| 396 | |
| 397 | |
| 398 | "modules/freetype2"
|
| 399 | |
| 400 | "modules/zlib"
|
| 401 | "ipc/chromium/src/third_party/libevent"
|
| 402 | "media/libvpx"
|
| 403 | |
| 404 | "media/libwebp"
|
| 405 | "js/src/ctypes/libffi"
|
| 406 | |
| 407 | "testing/web-platform"
|
| 408 | ))))
|
| 409 | (add-after 'remove-bundled-libraries 'fix-ffmpeg-runtime-linker
|
| 410 | (lambda* (#:key inputs #:allow-other-keys)
|
| 411 | |
| 412 | (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
|
| 413 | (("libavcodec\\.so")
|
| 414 | (search-input-file inputs "lib/libavcodec.so")))))
|
| 415 |
|
| 416 | (add-after 'fix-ffmpeg-runtime-linker 'fix-zucchini
|
| 417 | (lambda _
|
| 418 | |
| 419 | (substitute* "browser/config/mozconfigs/base-browser"
|
| 420 | (("ac_add_options --disable-zucchini") ""))))
|
| 421 | (add-after 'patch-source-shebangs 'patch-cargo-checksums
|
| 422 | (lambda _
|
| 423 | (use-modules (guix build cargo-utils))
|
| 424 | (let ((null-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
|
| 425 | (for-each (lambda (file)
|
| 426 | (format #t "patching checksums in ~a~%" file)
|
| 427 | (substitute* file
|
| 428 | (("^checksum = \".*\"")
|
| 429 | (string-append "checksum = \"" null-hash "\""))))
|
| 430 | (find-files "." "Cargo.lock$"))
|
| 431 | (for-each generate-all-checksums
|
| 432 | '("services"
|
| 433 | "js"
|
| 434 | "third_party/rust"
|
| 435 | "dom/media"
|
| 436 | "dom/webauthn"
|
| 437 | "toolkit"
|
| 438 | "gfx"
|
| 439 | "storage"
|
| 440 | "modules"
|
| 441 | "xpcom/rust"
|
| 442 | "media"
|
| 443 | "mozglue/static/rust"
|
| 444 | "netwerk"
|
| 445 | "remote"
|
| 446 | "intl"
|
| 447 | "servo"
|
| 448 | "security/manager/ssl"
|
| 449 | "build")))))
|
| 450 | (add-after 'patch-cargo-checksums 'remove-cargo-frozen-flag
|
| 451 | (lambda _
|
| 452 | |
| 453 | |
| 454 | |
| 455 | (substitute* "build/RunCbindgen.py"
|
| 456 | (("args.append\\(\"--frozen\"\\)") "pass"))))
|
| 457 | (delete 'bootstrap)
|
| 458 | (add-before 'configure 'setenv
|
| 459 | (lambda _
|
| 460 | (setenv "CONFIG_SHELL" (which "bash"))
|
| 461 | |
| 462 | (setenv "AR" "llvm-ar")
|
| 463 | (setenv "NM" "llvm-nm")
|
| 464 | (setenv "CC" "clang")
|
| 465 | (setenv "CXX" "clang++")
|
| 466 | |
| 467 | |
| 468 | |
| 469 | (setenv "MOZ_APP_NAME" #$moz-app-name)
|
| 470 | |
| 471 | (setenv "MOZ_APP_REMOTINGNAME" #$moz-app-remotingname)
|
| 472 | |
| 473 | |
| 474 | (setenv "MOZBUILD_STATE_PATH"
|
| 475 | (in-vicinity (getcwd) ".mozbuild"))
|
| 476 | (setenv "MOZ_CHROME_MULTILOCALE"
|
| 477 | (string-join (list #$@locales)))
|
| 478 | |
| 479 | (setenv "MOZ_BUILD_DATE" #$build-date)))
|
| 480 | (add-before 'configure 'mozconfig
|
| 481 | (lambda* (#:key configure-flags #:allow-other-keys)
|
| 482 | (let ((arch (cond (#$(target-arm32?) "arm")
|
| 483 | (#$(target-aarch64?) "aarch64")
|
| 484 | (#$(target-x86-32?) "i686")
|
| 485 | (#$(target-x86-64?) "x86_64"))))
|
| 486 | (with-output-to-file "mozconfig"
|
| 487 | (lambda ()
|
| 488 | (format #t ". $topsrcdir/mozconfig-linux-~a~%" arch)
|
| 489 | (for-each (lambda (flag)
|
| 490 | (format #t "ac_add_options ~a~%" flag))
|
| 491 | configure-flags))))))
|
| 492 | |
| 493 | (add-before 'configure 'copy-firefox-locales
|
| 494 | (lambda _
|
| 495 | (let ((l10ncentral ".mozbuild/l10n-central")
|
| 496 | (ff-locales #$(this-package-input "firefox-locales")))
|
| 497 | (mkdir-p l10ncentral)
|
| 498 | (for-each
|
| 499 | (lambda (lang)
|
| 500 | (copy-recursively (string-append ff-locales "/" lang)
|
| 501 | (in-vicinity l10ncentral lang)))
|
| 502 | (list #$@locales)))))
|
| 503 | (add-after 'copy-firefox-locales 'copy-basebrowser-locales
|
| 504 | (lambda _
|
| 505 | (let ((l10ncentral ".mozbuild/l10n-central"))
|
| 506 | |
| 507 | |
| 508 | (copy-recursively #$translation-base
|
| 509 | "translation-base-browser")
|
| 510 | (for-each
|
| 511 | (lambda (lang)
|
| 512 | (system
|
| 513 | (format
|
| 514 | #f (string-join
|
| 515 | '("mv"
|
| 516 | "translation-base-browser/~a/base-browser.ftl"
|
| 517 | "~a/~a/toolkit/toolkit/global/"))
|
| 518 | lang l10ncentral lang)))
|
| 519 | (list #$@locales)))))
|
| 520 | (add-after 'copy-basebrowser-locales 'copy-torbrowser-locales
|
| 521 | (lambda _
|
| 522 | (let ((l10ncentral ".mozbuild/l10n-central"))
|
| 523 | |
| 524 | |
| 525 | (copy-recursively #$translation-specific
|
| 526 | "translation-tor-browser")
|
| 527 | (for-each
|
| 528 | (lambda (lang)
|
| 529 | (system
|
| 530 | (format
|
| 531 | #f (string-join
|
| 532 | '("mv"
|
| 533 | "translation-tor-browser/~a/tor-browser.ftl"
|
| 534 | "~a/~a/toolkit/toolkit/global/"))
|
| 535 | lang l10ncentral lang))
|
| 536 | (mkdir-p (string-append l10ncentral "/" lang
|
| 537 | "/" #$branding-directory))
|
| 538 | (system
|
| 539 | (format
|
| 540 | #f (string-join
|
| 541 | '("mv"
|
| 542 | "translation-tor-browser/~a/branding/brand.ftl"
|
| 543 | "~a/~a/~a/"))
|
| 544 | lang l10ncentral lang #$branding-directory))
|
| 545 | (system
|
| 546 | (format
|
| 547 | #f (string-join
|
| 548 | '("mv"
|
| 549 | "translation-tor-browser/~a/brand.properties"
|
| 550 | "~a/~a/~a/"))
|
| 551 | lang l10ncentral lang #$branding-directory))
|
| 552 | (mkdir-p (string-append "toolkit/torbutton/chrome/locale/"
|
| 553 | lang))
|
| 554 | (system
|
| 555 | (format
|
| 556 | #f (string-join
|
| 557 | '("mv"
|
| 558 | "translation-tor-browser/~a/*.properties"
|
| 559 | "toolkit/torbutton/chrome/locale/~a/"))
|
| 560 | lang lang))
|
| 561 | (let ((port (open-file "toolkit/torbutton/jar.mn" "a")))
|
| 562 | (format port "% locale torbutton ~a %locale/~a/~%"
|
| 563 | lang lang)
|
| 564 | (format port " locale/~a/ (chrome/locale/~a/*)~%"
|
| 565 | lang lang)
|
| 566 | (close port)))
|
| 567 | (list #$@locales)))))
|
| 568 | (replace 'configure
|
| 569 | (lambda _
|
| 570 | (invoke "./mach" "configure")))
|
| 571 | (add-before 'build 'fix-addons-placeholder
|
| 572 | (lambda _
|
| 573 | (substitute*
|
| 574 | "toolkit/locales/en-US/toolkit/about/aboutAddons.ftl"
|
| 575 | (("addons.mozilla.org") "gnuzilla.gnu.org"))))
|
| 576 | (replace 'build
|
| 577 | (lambda* (#:key (make-flags '()) (parallel-build? #t)
|
| 578 | #:allow-other-keys)
|
| 579 | (apply invoke "./mach" "build"
|
| 580 | |
| 581 | |
| 582 | `(,(string-append
|
| 583 | "-j" (number->string (if parallel-build?
|
| 584 | (parallel-job-count)
|
| 585 | 1)))
|
| 586 | ,@make-flags))))
|
| 587 | |
| 588 | (add-after 'build 'build-locales
|
| 589 | (lambda _
|
| 590 | (system (string-join '("./mach package-multi-locale --locales"
|
| 591 | "en-US $MOZ_CHROME_MULTILOCALE")))))
|
| 592 | (add-after 'build-locales 'neutralise-store-references
|
| 593 | (lambda _
|
| 594 | |
| 595 | |
| 596 | (let* ((obj-dir (match (scandir "." (cut string-prefix? "obj-" <>))
|
| 597 | ((dir) dir)))
|
| 598 | (file (string-append
|
| 599 | obj-dir
|
| 600 | "/dist/bin/chrome/toolkit/content/global/buildconfig.html")))
|
| 601 | (substitute* file
|
| 602 | (("[0-9a-df-np-sv-z]{32}" hash)
|
| 603 | (string-append (string-take hash 8)
|
| 604 | "<!-- Guix: not a runtime dependency -->"
|
| 605 | (string-drop hash 8)))))))
|
| 606 | (replace 'install
|
| 607 | (lambda* (#:key outputs #:allow-other-keys)
|
| 608 | (invoke "./mach" "install")
|
| 609 | |
| 610 | |
| 611 | |
| 612 | (install-file (first (find-files "." "geckodriver"))
|
| 613 | (string-append #$output "/bin"))))
|
| 614 | (add-after 'install 'remove-duplicate-bin
|
| 615 | (lambda* (#:key outputs #:allow-other-keys)
|
| 616 | (delete-file (string-append #$output "/lib/"
|
| 617 | #$moz-app-name "/"
|
| 618 | #$moz-app-name "-bin"))))
|
| 619 | (add-after 'install 'wrap-program
|
| 620 | (lambda* (#:key inputs #:allow-other-keys)
|
| 621 | (let* ((gtk #$(this-package-input "gtk+"))
|
| 622 | (gtk-share (string-append gtk "/share"))
|
| 623 | (fonts.conf (format #f "~a/lib/~a/fonts/fonts.conf"
|
| 624 | #$output #$moz-app-name))
|
| 625 | (ld-libs '#$(cons
|
| 626 | (file-append
|
| 627 | (this-package-input "libcanberra")
|
| 628 | "/lib/gtk-3.0/modules")
|
| 629 | (map (lambda (label)
|
| 630 | (file-append (this-package-input label) "/lib"))
|
| 631 | '("libpng-apng"
|
| 632 | "libxscrnsaver"
|
| 633 | "mesa"
|
| 634 | "pciutils"
|
| 635 | "mit-krb5"
|
| 636 | "eudev"
|
| 637 | "pulseaudio"
|
| 638 | |
| 639 | |
| 640 | "libnotify")))))
|
| 641 | (wrap-program (format #f "~a/lib/~a/~a"
|
| 642 | #$output #$moz-app-name #$moz-app-name)
|
| 643 | `("XDG_DATA_DIRS" prefix (,gtk-share))
|
| 644 | |
| 645 | |
| 646 | |
| 647 | |
| 648 | `("LD_LIBRARY_PATH" prefix ,ld-libs)
|
| 649 | `("FONTCONFIG_FILE" prefix (,fonts.conf))))))
|
| 650 | (add-after 'wrap-program 'install-desktop-entry
|
| 651 | (lambda _
|
| 652 | (let ((apps (in-vicinity #$output "share/applications")))
|
| 653 | (mkdir-p apps)
|
| 654 | (make-desktop-entry-file
|
| 655 | (string-append apps "/" #$moz-app-name ".desktop")
|
| 656 | #:name #$moz-app-remotingname
|
| 657 | #:exec (format #f "~a/bin/~a %u" #$output #$moz-app-name)
|
| 658 | #:categories '("Network" "WebBrowser" "Security")
|
| 659 | #:startup-w-m-class #$moz-app-remotingname
|
| 660 | #:icon #$moz-app-name))))
|
| 661 | (add-after 'install-desktop-entry 'install-icons
|
| 662 | (lambda* (#:key inputs #:allow-other-keys)
|
| 663 | (for-each
|
| 664 | (lambda (size)
|
| 665 | (let ((oldpath (string-append
|
| 666 | #$branding-directory "/default" size ".png"))
|
| 667 | (newpath (string-append
|
| 668 | #$output "/share/icons/hicolor/" size "x"
|
| 669 | size "/apps/" #$moz-app-name ".png")))
|
| 670 | (mkdir-p (dirname newpath))
|
| 671 | (copy-file oldpath newpath)))
|
| 672 | '("16" "22" "24" "32" "48" "64" "128" "256"))))
|
| 673 | (add-after 'install 'deploy-fonts
|
| 674 | (lambda* (#:key inputs #:allow-other-keys)
|
| 675 | (let ((lib (string-append #$output "/lib/" #$moz-app-name)))
|
| 676 | |
| 677 | (delete-file-recursively (in-vicinity lib "fonts"))
|
| 678 | (copy-recursively (in-vicinity #$assets "fonts")
|
| 679 | (in-vicinity lib "fonts"))
|
| 680 | (substitute* (in-vicinity lib "fonts/fonts.conf")
|
| 681 | (("<dir prefix=\"cwd\">fonts</dir>")
|
| 682 | (format #f "<dir>~a</dir>" (in-vicinity lib "fonts")))))))
|
| 683 | (add-after 'deploy-fonts 'deploy-tor-assets
|
| 684 | (lambda* (#:key inputs #:allow-other-keys)
|
| 685 | (let ((lib (in-vicinity #$output "lib/torbrowser"))
|
| 686 | (tor #$(this-package-input "tor-client")))
|
| 687 | |
| 688 | (copy-recursively (in-vicinity #$assets "TorBrowser")
|
| 689 | (in-vicinity lib "TorBrowser"))
|
| 690 | (substitute*
|
| 691 | (in-vicinity lib "TorBrowser/Data/Tor/torrc-defaults")
|
| 692 | (("exec ./TorBrowser/Tor/PluggableTransports/lyrebird")
|
| 693 | (string-append
|
| 694 | "exec " (search-input-file inputs "bin/lyrebird"))))
|
| 695 | |
| 696 | |
| 697 | (mkdir-p (in-vicinity lib "TorBrowser/Data/Tor"))
|
| 698 | (copy-file (in-vicinity tor "share/tor/geoip6")
|
| 699 | (in-vicinity lib "TorBrowser/Data/Tor/geoip6"))
|
| 700 | (copy-file (in-vicinity tor "share/tor/geoip")
|
| 701 | (in-vicinity lib "TorBrowser/Data/Tor/geoip")))))
|
| 702 | (add-after 'install 'autoconfig
|
| 703 | (lambda* (#:key inputs #:allow-other-keys)
|
| 704 | (let ((lib (string-append #$output "/lib/" #$moz-app-name))
|
| 705 | (config-file (string-append #$moz-app-name ".cfg")))
|
| 706 | (with-output-to-file (in-vicinity
|
| 707 | lib "defaults/pref/autoconfig.js")
|
| 708 | (lambda ()
|
| 709 | (format #t "// first line must be a comment~%")
|
| 710 | (format #t "pref(~s, ~s);~%"
|
| 711 | "general.config.filename" config-file)
|
| 712 | (format #t "pref(~s, ~a);~%"
|
| 713 | "general.config.obscure_value" "0")))
|
| 714 | (with-output-to-file (in-vicinity lib config-file)
|
| 715 | (lambda ()
|
| 716 | (format #t "// first line must be a comment~%")
|
| 717 | |
| 718 | |
| 719 | |
| 720 | (format #t "pref(~s, ~a);~%"
|
| 721 | "extensions.enabledScopes" "13")
|
| 722 | |
| 723 | (format #t "pref(~s, ~s);~%"
|
| 724 | "extensions.getAddons.search.browseURL"
|
| 725 | "https://gnuzilla.gnu.org/mozzarella")
|
| 726 | (format #t "pref(~s, ~s);~%"
|
| 727 | "extensions.getAddons.get.url"
|
| 728 | "https://gnuzilla.gnu.org/mozzarella")
|
| 729 | (format #t "pref(~s, ~s);~%"
|
| 730 | "extensions.getAddons.link.url"
|
| 731 | "https://gnuzilla.gnu.org/mozzarella")
|
| 732 | (format #t "pref(~s, ~s);~%"
|
| 733 | "extensions.getAddons.discovery.api_url"
|
| 734 | "https://gnuzilla.gnu.org/mozzarella")
|
| 735 | (format #t "pref(~s, ~s);~%"
|
| 736 | "extensions.getAddons.langpacks.url"
|
| 737 | "https://gnuzilla.gnu.org/mozzarella")
|
| 738 | (format #t "pref(~s, ~s);~%"
|
| 739 | "lightweightThemes.getMoreURL"
|
| 740 | "https://gnuzilla.gnu.org/mozzarella"))))))
|
| 741 | (add-after 'autoconfig 'autoconfig-tor
|
| 742 | (lambda* (#:key inputs #:allow-other-keys)
|
| 743 | (let ((lib (in-vicinity #$output "lib/torbrowser"))
|
| 744 | (config-file (string-append #$moz-app-name ".cfg")))
|
| 745 | (let ((port (open-file (in-vicinity lib config-file) "a")))
|
| 746 | (format port "pref(~s, ~s);~%"
|
| 747 | "extensions.torlauncher.torrc-defaults_path"
|
| 748 | (in-vicinity
|
| 749 | lib "TorBrowser/Data/Tor/torrc-defaults"))
|
| 750 | (format port "pref(~s, ~s);~%"
|
| 751 | "extensions.torlauncher.tor_path"
|
| 752 | (search-input-file inputs "bin/tor"))
|
| 753 | (close port))))))))
|
| 754 | (propagated-inputs
|
| 755 | (list noscript/icecat))
|
| 756 | (native-search-paths
|
| 757 | (list (search-path-specification
|
| 758 | (variable "ICECAT_SYSTEM_DIR")
|
| 759 | (separator #f) |
| 760 | (files '("lib/icecat")))))
|
| 761 | (supported-systems (list "x86_64-linux" "i686-linux"
|
| 762 | "aarch64-linux" "armhf-linux"))
|
| 763 | (home-page "https://www.torproject.org")
|
| 764 | (synopsis "Anonymous browser derived from Mozilla Firefox")
|
| 765 | (description
|
| 766 | "Tor Browser is the Tor Project version of Firefox browser. It is the
|
| 767 | only recommended way to anonymously browse the web that is supported by the
|
| 768 | project. It modifies Firefox in order to avoid many known application level
|
| 769 | attacks on the privacy of Tor users.")
|
| 770 | (license license:mpl2.0))) |
| 771 | |
| 772 |
|
| 773 | (define-public torbrowser
|
| 774 | (make-torbrowser #:moz-app-name "torbrowser"
|
| 775 | #:moz-app-remotingname "Tor Browser"
|
| 776 | #:branding-directory "browser/branding/tb-release"
|
| 777 | #:translation-base torbrowser-translation-base
|
| 778 | #:translation-specific torbrowser-translation-specific
|
| 779 | #:assets torbrowser-assets
|
| 780 | #:locales %torbrowser-locales
|
| 781 | #:build-date %torbrowser-build-date
|
| 782 | #:base-browser-version %torbrowser-version))
|
| 783 |
|
| 784 |
|
| 785 | |
| 786 | (define %mullvadbrowser-locales (list "ar" "da" "de" "es-ES" "fa" "fi" "fr" "it"
|
| 787 | "ja" "ko" "my" "nb-NO" "nl" "pl" "pt-BR"
|
| 788 | "ru" "sv-SE" "th" "tr" "zh-CN" "zh-TW"))
|
| 789 |
|
| 790 | |
| 791 | |
| 792 | (define %mullvadbrowser-build-date "20260928083000")
|
| 793 |
|
| 794 | |
| 795 | |
| 796 | (define %mullvadbrowser-version "15.0.24")
|
| 797 |
|
| 798 | |
| 799 | |
| 800 | |
| 801 | |
| 802 | (define %mullvadbrowser-firefox-version "140.17.0esr-15.0-1-build2")
|
| 803 |
|
| 804 | |
| 805 | (define mullvadbrowser-translation-base
|
| 806 | (origin
|
| 807 | (method git-fetch)
|
| 808 | (uri (git-reference
|
| 809 | (url "https://gitlab.torproject.org/tpo/translation.git")
|
| 810 | (commit "c62d7c244409d6d6ca37cd7f4819260ffc3cf60b")))
|
| 811 | (file-name "translation-base-browser")
|
| 812 | (sha256
|
| 813 | (base32
|
| 814 | "0gasp5gx4zc603yjhxi5rhagjq5pswvyxdgin75ax5p76bkaypcp"))))
|
| 815 |
|
| 816 | |
| 817 | (define mullvadbrowser-translation-specific
|
| 818 | (origin
|
| 819 | (method git-fetch)
|
| 820 | (uri (git-reference
|
| 821 | (url "https://gitlab.torproject.org/tpo/translation.git")
|
| 822 | (commit "7ccb76bc67daa5d88da4a1e3ae0021b19bc55c4b")))
|
| 823 | (file-name "translation-mullvad-browser")
|
| 824 | (sha256
|
| 825 | (base32
|
| 826 | "0a8h46iq3zvc2b0l59y8w628vs21gfh1nz9079hdz5nkpjzk28gi"))))
|
| 827 |
|
| 828 | (define mullvadbrowser-assets
|
| 829 | |
| 830 | (package
|
| 831 | (name "mullvadbrowser-assets")
|
| 832 | (version %mullvadbrowser-version)
|
| 833 | (source
|
| 834 | (origin
|
| 835 | (method url-fetch)
|
| 836 | (uri
|
| 837 | (string-append
|
| 838 | "https://archive.torproject.org/tor-package-archive/mullvadbrowser/"
|
| 839 | version "/mullvad-browser-linux-x86_64-" version ".tar.xz"))
|
| 840 | (sha256
|
| 841 | (base32
|
| 842 | "1skgqmylpbdpdp4vl96frfs51i3j7r67sdhgcn0awjvxddknb9dw"))))
|
| 843 | (arguments
|
| 844 | (list
|
| 845 | #:install-plan
|
| 846 | ''(("Browser" "." #:include-regexp
|
| 847 | ("^\\./fonts/"
|
| 848 | "^\\./fontconfig/fonts.conf"
|
| 849 | |
| 850 | "^\\./distribution/extensions/\\{d19a89b9-76c1-4a61-bcd4-49e8de916403\\}.xpi"
|
| 851 | )))))
|
| 852 | (build-system copy-build-system)
|
| 853 | (home-page "https://www.torproject.org")
|
| 854 | (synopsis "Mullvad Browser assets")
|
| 855 | (description "This package contains fonts and configuration files for
|
| 856 | Mullvad Browser.")
|
| 857 | (license license:silofl1.1)))
|
| 858 |
|
| 859 | (define mullvadbrowser-base
|
| 860 | (make-torbrowser #:moz-app-name "mullvadbrowser"
|
| 861 | #:moz-app-remotingname "Mullvad Browser"
|
| 862 | #:branding-directory "browser/branding/mb-release"
|
| 863 | #:translation-base mullvadbrowser-translation-base
|
| 864 | #:translation-specific mullvadbrowser-translation-specific
|
| 865 | #:assets mullvadbrowser-assets
|
| 866 | #:locales %mullvadbrowser-locales
|
| 867 | #:build-date %mullvadbrowser-build-date
|
| 868 | #:base-browser-version %mullvadbrowser-version))
|
| 869 |
|
| 870 | (define-public mullvadbrowser
|
| 871 | (package
|
| 872 | (inherit mullvadbrowser-base)
|
| 873 | (name "mullvadbrowser")
|
| 874 | (version %mullvadbrowser-version)
|
| 875 | (source
|
| 876 | (origin
|
| 877 | (method url-fetch)
|
| 878 | (uri
|
| 879 | (string-append
|
| 880 | "https://archive.torproject.org/tor-package-archive/mullvadbrowser/"
|
| 881 | version "/src-firefox-mullvad-browser-"
|
| 882 | %mullvadbrowser-firefox-version ".tar.xz"))
|
| 883 | (sha256
|
| 884 | (base32
|
| 885 | "0j4kl4kzdm68mj20b0571l6jsygmchp85gwx16z9lbkk47l95csl"))))
|
| 886 | (arguments
|
| 887 | (substitute-keyword-arguments arguments
|
| 888 | ((#:phases phases)
|
| 889 | #~(modify-phases #$phases
|
| 890 | (add-after 'unpack 'ublock-private-allowed
|
| 891 | (lambda _
|
| 892 | (substitute* "toolkit/components/extensions/Extension.sys.mjs"
|
| 893 | |
| 894 | |
| 895 | |
| 896 | (("this.isNoScript")
|
| 897 | (format #f "this.isNoScript || this.id === ~s"
|
| 898 | "[email protected]")))))
|
| 899 | |
| 900 | (replace 'copy-torbrowser-locales
|
| 901 | (lambda _
|
| 902 | (for-each
|
| 903 | (lambda (lang)
|
| 904 | (system
|
| 905 | (format #f "cp -Lr ~a/~a .mozbuild/l10n-central/"
|
| 906 | #$mullvadbrowser-translation-specific lang)))
|
| 907 | (list #$@%mullvadbrowser-locales))))
|
| 908 | (add-before 'build 'fix-profiles
|
| 909 | |
| 910 | |
| 911 | |
| 912 | |
| 913 | (lambda _
|
| 914 | (substitute* "browser/moz.configure"
|
| 915 | (("\"MOZ_DEDICATED_PROFILES\", True")
|
| 916 | "\"MOZ_DEDICATED_PROFILES\", False")
|
| 917 | (("\"MOZ_BLOCK_PROFILE_DOWNGRADE\", True")
|
| 918 | "\"MOZ_BLOCK_PROFILE_DOWNGRADE\", False"))))
|
| 919 | (add-after 'deploy-fonts 'deploy-extension
|
| 920 | (lambda _
|
| 921 | (let ((lib (in-vicinity #$output "lib/mullvadbrowser")))
|
| 922 | |
| 923 | (copy-recursively
|
| 924 | (in-vicinity #$mullvadbrowser-assets "distribution")
|
| 925 | (in-vicinity lib "distribution")))))
|
| 926 | (delete 'deploy-tor-assets)
|
| 927 | (delete 'autoconfig-tor)))))
|
| 928 | (inputs
|
| 929 | (modify-inputs inputs
|
| 930 | (delete lyrebird)))
|
| 931 | (propagated-inputs
|
| 932 | (modify-inputs propagated-inputs
|
| 933 | (append ublock-origin/icecat)))
|
| 934 | (home-page "https://mullvad.net/en/browser")
|
| 935 | (synopsis "Privacy-focused web browser")
|
| 936 | (description "Mullvad Browser is a privacy-focused web browser developed
|
| 937 | in collaboration between Mullvad VPN and the Tor Project. It’s produced to
|
| 938 | minimize tracking and fingerprinting.")))
|