Paste number 316172: Tor Browser

Paste number 316172: Tor Browser
Pasted by: kyamashita
When:5 years, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+6RYK
Channel:None
Paste contents:
Raw Source | XML | Display As
(define-public tor-browser
  (package
    (name "tor-browser")
    (version "5.5.5")
    (source
     (origin
       (method url-fetch)
       (uri
        (string-append "https://dist.torproject.org/torbrowser/"
                       version "/" name "-linux"
                       (cond
                        ((string-prefix? "x86_64"
                                         (or (%current-target-system)
                                             (%current-system)))
                         "64")
                        (else "32"))
                       "-" version "_en-US.tar.xz"))
       (sha256
        (base32
         (cond
          ((string-prefix? "x86_64"
                           (or (%current-target-system)
                               (%current-system)))
           "0k6v41j880fb4zdxk1v13kmizdaz5rwvi5lskdbdi68iml4p53gj")
          (else "04mqjmnxwa75yi8gmdwadkzrzikgxn08bkvr50zdm7id9fj4nkza"))))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ; no check target
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'patch-binaries
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (glibc (assoc-ref inputs "glibc"))
                    (patchelf (string-append (assoc-ref inputs "patchelf")
                                             "/bin/patchelf"))
                    (path (string-join
                           '((string-append (assoc-ref inputs "gcc:lib") "/lib")
                             (string-append (assoc-ref inputs "glibc") "/lib")
                             (string-append (assoc-ref inputs "libevent") "/lib")
                             (string-append (assoc-ref inputs "openssl") "/lib")
                             (string-append (assoc-ref inputs "zlib") "/lib"))
                           ":")))
               (zero?
                (system* patchelf "--set-interpreter"
                         glibc "/lib/ld-linux-x86-64.so.2" "firefox"))
               (zero?
                (system* patchelf "--set-interpreter"
                         glibc "/lib/ld-linux-x86-64.so.2"
                         "Browser/TorBrowser/Tor/tor"))
               (zero?
                (system* patchelf "--set-rpath"
                         path "firefox"))
               (zero?
                (system* patchelf "--set-rpath"
                         path "Browser/TorBrowser/Tor/tor"))
               (zero?
                (system* "sed" "-e"
                         (string-append "\"s,./TorBrowser," out
                                        "/share/tor-browser/Browser/TorBrowser,g")
                         "-i" "Browser/TorBrowser/Data/Tor/torrc-defaults")))
             #t))
         (delete 'configure) ; no building or configuration necessary
         (delete 'build)
         (replace 'install
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (mkdir-p (string-append out "/share/tor-browser"))
               (mkdir-p (string-append out "/bin"))
               (copy-recursively "." (string-append out "/share/tor-browser")))
             #t))
         (add-after 'install 'wrap-program
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out")))
               (call-with-output-file (string-append out "/bin/tor-browser")
                 (lambda (port)
                   (format port "#!~a/bin/sh
unset SESSION_MANAGER
export HOME=\"\\$HOME/.torbrowser4\"
if [ ! -d \\$HOME ]; then
  mkdir -p \\$HOME && cp -R ~a/share/tor-browser/Browser/TorBrowser/Data \\$HOME/ && chmod -R +w \\$HOME
  echo \"pref(\\\"extensions.torlauncher.tordatadir_path\\\", \\\"\\$HOME/Data/Tor/\");\" >> \
    ~/Data/Browser/profile.default/preferences/extension-overrides.js
fi
export FONTCONFIG_PATH=\\$HOME/Data/fontconfig
export LD_LIBRARY_PATH=~a:~a/share/tor-browser/Browser/TorBrowser/Tor
exec ~a/share/tor-browser/Browser/firefox --class \"Tor Browser\" -no-remote -profile ~/Data/Browser/profile.default \"$@\"~%"
                           (assoc-ref inputs "bash")
                           (string-append out)
                           (string-join
                            '((string-append (assoc-ref inputs "alsa-lib") "/lib")
                              (string-append (assoc-ref inputs "atk") "/lib")
                              (string-append (assoc-ref inputs "cairo") "/lib")
                              (string-append (assoc-ref inputs "dbus") "/lib")
                              (string-append (assoc-ref inputs "dbus-glib") "/lib")
                              (string-append (assoc-ref inputs "fontconfig") "/lib")
                              (string-append (assoc-ref inputs "freetype") "/lib")
                              (string-append (assoc-ref inputs "gdk-pixbuf") "/lib")
                              (string-append (assoc-ref inputs "glib") "/lib")
                              (string-append (assoc-ref inputs "gtk+") "/lib")
                              (string-append (assoc-ref inputs "libx11") "/lib")
                              (string-append (assoc-ref inputs "libxext") "/lib")
                              (string-append (assoc-ref inputs "libxrender") "/lib")
                              (string-append (assoc-ref inputs "libxt") "/lib")
                              (string-append (assoc-ref inputs "pango") "/lib")
                              (string-append (assoc-ref inputs "zlib") "/lib"))
                            ":")
                           (string-append out)
                           (string-append out))))
               (chmod (string-append out "/bin/tor-browser") #o555))
             #t)))))
    (inputs
     `(("alsa-lib" ,alsa-lib)
       ("atk" ,atk)
       ("bash" ,bash)
       ("cairo" ,cairo)
       ("dbus" ,dbus)
       ("dbus-glib" ,dbus-glib)
       ("fontconfig" ,fontconfig)
       ("freetype" ,freetype)
       ("gcc:lib" ,gcc-6 "lib")
       ("gdk-pixbuf" ,gdk-pixbuf)
       ("glib" ,glib)
       ("glibc" ,glibc)
       ("gtk+" ,gtk+)
       ("libevent" ,libevent)
       ("libx11" ,libx11)
       ("libxext" ,libxext)
       ("libxrender" ,libxrender)
       ("libxt" ,libxt)
       ("openssl" ,openssl)
       ("pango" ,pango)
       ("patchelf" ,patchelf)
       ("zlib" ,zlib)))
    (home-page "https://www.torproject.org/projects/torbrowser.html")
    (synopsis "Web browser that preserves users' anonymity")
    (description
     "The Tor Browser automatically starts Tor background processes and routes
traffic through the Tor network.  Upon termination of a session the browser
deletes privacy-sensitive data such as HTTP cookies and the browsing history.")
    (license mpl2.0)))  ;and other licenses, see toolkit/content/license.html

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.