[tbb-dev] [tor-dev] RFC: porting torbrowser

ng0 ng0 at n0.is
Fri Mar 9 14:19:44 UTC 2018


Georg Koppen transcribed 11K bytes:
> ng0:
> > Hi,
> > 
> > (top-posting and keeping the old email as reference in complete quote)
> > I have now started working on a package for Guix. While I've had some
> > exposure to the packaging of the ESR or Firefox and also some old code
> > base fork of Firefox (Palemoon), I'm not sure if the problem I experience
> > is something I can report or ask for at your side or elsewhere.
> > 
> > Building fails in the part of the build phase where interaction with quitter
> > happens (for a lack of more insight into the actual codebase).
> > 
> > My package definition is not yet published (and early stages), I'll publish
> > a public preview tomorrow.
> > 
> > The build error is curious for me, because Firefox ESR (not in upstream Guix)
> > succeeds with builds. Icecat with patches from ESR applied in Guix master builds
> > fine. I assume what I experience is Tor Browser specific.
> > 
> > I can send in a full build log in about 12 hours, for now there's this:

Sorry, I just learned that we don't keep build logs on disk for failed builds.

> > processing /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/testing/marionette/jar.mn
> > make[4]: Leaving directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff/testing/marionette'
> > make[4]: Entering directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff/tools/quitter'
> > mkdir -p '../../dist/xpi-stage/quitter/chrome/'
> > /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff/_virtualenv/bin/python -m mozbuild.action.jar_maker   -d 
> > ../../dist/xpi-stage/quitter -t /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout -f symlink  -e 
> > --relativesrcdir=tools/quitter -c /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/tools/quitter/en-US -DNDEBUG=1 
> > -DTRIMMED=1 -DA11Y_LOG=1 -DACCESSIBILITY=1 -DATK_MAJOR_VERSION=2 -DATK_MINOR_VERSION=26 -DATK_REV_VERSION=1 -DBUILD_CTYPES=1 
> > -DCROSS_COMPILE='' -DD_INO=d_ino -DENABLE_INTL_API=1 -DENABLE_MARIONETTE=1 -DENABLE_SYSTEM_EXTENSION_DIRS=1 -DEXPOSE_INTL_API=1 
> > -DFIREFOX_VERSION=52.6.0 -DFORCE_PR_LOG=1 -DFUNCPROTO=15 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_26 
> > -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DGL_PROVIDER_GLX=1 -DHAVE_64BIT_BUILD=1 -DHAVE_ALLOCA_H=1 -DHAVE_BYTESWAP_H=1 
> > -DHAVE_CLOCK_MONOTONIC=1 -DHAVE_CPUID_H=1 -DHAVE_DIRENT_H=1 -DHAVE_DLADDR=1 -DHAVE_DLOPEN=1 -DHAVE_FONTCONFIG_FCFREETYPE_H=1 
> > -DHAVE_FT_BITMAP_SIZE_Y_PPEM=1 -DHAVE_FT_GLYPHSLOT_EMBOLDEN=1 -DHAVE_FT_LOAD_SFNT_TABLE=1 -DHAVE_GETOPT_H=1 -DHAVE_GMTIME_R=1 
> > -DHAVE_I18N_LC_MESSAGES=1 -DHAVE_INTTYPES_H=1 -DHAVE_LANGINFO_CODESET=1 -DHAVE_LCHOWN=1 -DHAVE_LIBVPX=1 -DHAVE_LIBXSS=1 
> > -DHAVE_LINUX_IF_ADDR_H=1 -DHAVE_LINUX_PERF_EVENT_H=1 -DHAVE_LINUX_QUOTA_H=1 -DHAVE_LINUX_RTNETLINK_H=1 -DHAVE_LOCALECONV=1 
> > -DHAVE_LOCALTIME_R=1 -DHAVE_LSTAT64=1 -DHAVE_MALLINFO=1 -DHAVE_MALLOC_H=1 -DHAVE_MALLOC_USABLE_SIZE=1 -DHAVE_MEMALIGN=1 
> > -DHAVE_MEMMEM=1 -DHAVE_NETINET_IN_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_POSIX_MEMALIGN=1 
> > -DHAVE_PTHREAD_H=1 -DHAVE_RES_NINIT=1 -DHAVE_SETPRIORITY=1 -DHAVE_STAT64=1 -DHAVE_STDINT_H=1 -DHAVE_STRERROR=1 -DHAVE_STRNDUP=1 
> > -DHAVE_SYSCALL=1 -DHAVE_SYS_QUEUE_H=1 -DHAVE_SYS_QUOTA_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_THREAD_TLS_KEYWORD=1 -DHAVE_TRUNCATE64=1 
> > -DHAVE_UNISTD_H=1 -DHAVE_VALLOC=1 -DHAVE_VA_COPY=1 -DHAVE_VA_LIST_AS_ARRAY=1 -DHAVE_VISIBILITY_ATTRIBUTE=1 
> > -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE__UNWIND_BACKTRACE=1 -DHAVE___CXA_DEMANGLE=1 -DJS_DEFAULT_JITREPORT_GRANULARITY=3 
> > -DMALLOC_H='<malloc.h>' -DMALLOC_USABLE_SIZE_CONST_PTR='' -DMOZILLA_UAVERSION='"52.0"' -DMOZILLA_VERSION='"52.6.0"' 
> > -DMOZILLA_VERSION_U=52.6.0 -DMOZ_ACCESSIBILITY_ATK=1 -DMOZ_ADDON_SIGNING=1 -DMOZ_APP_UA_NAME='""' -DMOZ_APP_UA_VERSION='"52.6.0"' 
> > -DMOZ_B2G_OS_NAME='""' -DMOZ_B2G_VERSION='"1.0.0"' -DMOZ_BUILD_APP=browser -DMOZ_BUNDLED_FONTS=1 -DMOZ_CONTENT_SANDBOX=1 
> > -DMOZ_CRASHREPORTER_ENABLE_PERCENT=100 -DMOZ_DATA_REPORTING=1 -DMOZ_DISTRIBUTION_ID='"org.mozilla"' -DMOZ_DLL_SUFFIX='".so"' 
> > -DMOZ_ENABLE_DBUS=1 -DMOZ_ENABLE_GIO=1 -DMOZ_ENABLE_PROFILER_SPS=1 -DMOZ_ENABLE_SIGNMAR=1 -DMOZ_ENABLE_SKIA=1 
> > -DMOZ_ENABLE_STARTUP_NOTIFICATION=1 -DMOZ_ENABLE_XREMOTE=1 -DMOZ_FEEDS=1 -DMOZ_FFMPEG=1 -DMOZ_FFVPX=1 -DMOZ_FMP4=1 -DMOZ_GAMEPAD=1 
> > -DMOZ_GLUE_IN_PROGRAM=1 -DMOZ_GMP_SANDBOX=1 -DMOZ_INSTRUMENT_EVENT_LOOP=1 -DMOZ_JSDOWNLOADS=1 -DMOZ_LIBAV_FFT=1 -DMOZ_LOGGING=1 
> > -DMOZ_MACBUNDLE_ID=org.mozilla.torbrowser -DMOZ_MEMORY=1 -DMOZ_MEMORY_LINUX=1 -DMOZ_OFFICIAL_BRANDING=1 -DMOZ_PERMISSIONS=1 
> > -DMOZ_PHOENIX=1 -DMOZ_PLACES=1 -DMOZ_PULSEAUDIO=1 -DMOZ_SAMPLE_TYPE_FLOAT32=1 -DMOZ_SANDBOX=1 -DMOZ_SECUREELEMENT=1 
> > -DMOZ_SERVICES_HEALTHREPORT=1 -DMOZ_STATIC_JS=1 -DMOZ_SYSTEM_SQLITE=1 -DMOZ_UPDATE_CHANNEL=default -DMOZ_USER_DIR='".mozilla"' 
> > -DMOZ_VORBIS=1 -DMOZ_VPX_NO_MEM_REPORTING=1 -DMOZ_WEBGL_CONFORMANT=1 -DMOZ_WEBM_ENCODER=1 -DMOZ_WEBSPEECH=1 
> > -DMOZ_WEBSPEECH_TEST_BACKEND=1 -DMOZ_WIDGET_GTK=2 -DMOZ_X11=1 -DMOZ_XUL=1 -DNO_NSPR_10_SUPPORT=1 -DNS_PRINTING=1 
> > -DNS_PRINT_PREVIEW=1 -DRELEASE_OR_BETA=1 -DSPIDERMONKEY_PROMISE=1 -DSTATIC_JS_API=1 -DSTDC_HEADERS=1 
> > -DTARGET_XPCOM_ABI='"x86_64-gcc3"' -DTOR_BROWSER_VERSION='"7.5"' -DUSE_SKIA=1 -DUSE_SKIA_GPU=1 -DVA_COPY=va_copy -DXP_LINUX=1 
> > -DXP_UNIX=1 -D_REENTRANT=1 -DXPI_NAME=quitter -DAB_CD=en-US 
> > /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/tools/quitter/jar.mn
> > processing /tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/tools/quitter/jar.mn
> > Traceback (most recent call last):
> >   File "/gnu/store/j4vj7h3wyb532g2j0axzjj43z2a0dg81-python-2.7.14/lib/python2.7/runpy.py", line 174, in _run_module_as_main
> >     "__main__", fname, loader, pkg_name)
> >   File "/gnu/store/j4vj7h3wyb532g2j0axzjj43z2a0dg81-python-2.7.14/lib/python2.7/runpy.py", line 72, in _run_code
> >     exec code in run_globals
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/action/jar_maker.py", line 17, in 
> > <module>
> >     sys.exit(main(sys.argv[1:]))
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/action/jar_maker.py", line 13, in 
> > main
> >     return mozbuild.jar.main(args)
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/jar.py", line 597, in main
> >     jm.makeJar(infile, options.d)
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/jar.py", line 333, in makeJar
> >     self.processJarSection(info, jardir)
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/jar.py", line 391, in 
> > processJarSection
> >     jarinfo.chrome_manifests)
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/jar.py", line 281, in finalizeJar
> >     chromebasepath.format(chromebase), register)
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/jar.py", line 307, in 
> > updateManifest
> >     addEntriesToListFile(manifestPath, myregister.iterkeys())
> >   File "/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/python/mozbuild/mozbuild/action/buildlist.py", line 36, in 
> > addEntriesToListFile
> >     with open(listFile, 'wb') as f:
> > IOError: [Errno 13] Permission denied: '../../dist/xpi-stage/quitter/chrome.manifest'
> > make[4]: *** [/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/config/rules.mk:1187: libs] Error 1
> > make[4]: Leaving directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff/tools/quitter'
> > make[3]: *** [/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/config/recurse.mk:79: tools/quitter/libs] Error 2
> > make[3]: Leaving directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff'
> > make[2]: *** [/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/config/recurse.mk:33: libs] Error 2
> > make[2]: Leaving directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff'
> > make[1]: *** [/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/config/rules.mk:523: default] Error 2
> > make[1]: Leaving directory '/tmp/guix-build-tor-browser-7.5.drv-0/tor-browser-7.5-checkout/ff'
> > make: *** [client.mk:415: realbuild] Error 2
> > phase `build' failed after 2129.5 seconds
> > builder for `/gnu/store/r66p868620dpvzmfymclz50qfdsvphyv-tor-browser-7.5.drv' failed with exit code 1
> > @ build-failed /gnu/store/r66p868620dpvzmfymclz50qfdsvphyv-tor-browser-7.5.drv - 1 builder for 
> > `/gnu/store/r66p868620dpvzmfymclz50qfdsvphyv-tor-browser-7.5.drv' failed with exit code 1
> > guix build: error: build failed: build of `/gnu/store/r66p868620dpvzmfymclz50qfdsvphyv-tor-browser-7.5.drv' failed
> 
> What exactly did you check out and how?

The build is run with Guix, the rather hacky package definition so far is this commit:
https://c.n0.is/ng0/ports/commit/?id=320fa06ca3af881ba7c1b26514f04eb69d56f0a6
For reader convenience I'll attach the guile module to this email. It is in early stages
and I was mainly focused on getting the configure and build stages running, the rest
is inherited from an firefox-esr package and needs to be adjusted once I get there.

As you can read in the file, I use the following checkout url and commit/tag:
+       (uri (git-reference
+             (url "https://git.torproject.org/tor-browser.git")
+             (commit "tor-browser-52.6.0esr-7.5-2-build1")))

> What .mozconfig file are you using (if any)?

The .mozconfig is programmatically assembled in the package definition. It boils down to
these lines, ";;" is a commented line:

+                     ". $topsrcdir/browser/config/mozconfig\n"
+                     ;;"mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj- at CONFIG_GUESS@\n"
+                     "mk_add_options MOZ_OBJDIR=" (getenv "BUILD_OBJ_DIR") "\n"
+                     "mk_add_options MOZ_APP_DISPLAYNAME=\"Tor Browser\"\n"
+                     "mk_add_options XARGS=" (which "xargs") "\n"
+                     "mk_add_options MOZILLA_OFFICIAL=1\n"
+                     "mk_add_options BUILD_OFFICIAL=1\n"
+                     "ac_add_options --enable-extensions=default\n"
+                     ;;"ac_add_options --enable-optimize\n"
+                     ;;#ac_add_options --disable-optimize
+                     "ac_add_options --enable-official-branding\n"
+                     ;; # Let's support GTK2 for ESR52
+                     "ac_add_options --enable-default-toolkit=cairo-gtk2\n"
+                     ;; ---- poncho didn't have those 2:
+                     ;;"ac_add_options --enable-signmar\n"
+                     ;;"ac_add_options --enable-verify-mar\n"
+                     ;; ----
+                     "ac_add_options --disable-strip\n"
+                     "ac_add_options --disable-install-strip\n"
+                     "ac_add_options --disable-tests\n"
+                     ;; "ac_add_options --disable-debug\n"
+                     ;; ac_add_options --disable-maintenance-service
+                     ;; ac_add_options --disable-crashreporter
+                     "ac_add_options --disable-webrtc\n"
+                     "ac_add_options --disable-eme\n"
+
+
+                     "ac_add_options --with-app-name=torbrowser\n"
+                     "ac_add_options --with-app-basename=torbrowser\n"
+                     "ac_add_options --with-tor-browser-version=7.5\n"
+                     "ac_add_options --disable-tor-browser-update\n"
+                     ;;"ac_add_options --enable-tor-browser-data-outside-app-dir\n"
+
+                     ;; "ac_add_options --enable-default-toolkit=cairo-gtk3\n"
+                     "ac_add_options --enable-gio\n"
+                     "ac_add_options --enable-startup-notification\n"
+                     "ac_add_options --enable-pulseaudio\n"
+
+                     "ac_add_options --disable-gconf\n"
+                     "ac_add_options --disable-gnomeui\n"
+
+                     "ac_add_options --disable-maintenance-service\n"
+                     "ac_add_options --disable-updater\n"
+                     "ac_add_options --disable-necko-wifi\n"
+                     ;;"ac_add_options --enable-safe-browsing\n"
+                     "ac_add_options --disable-crashreporter\n"
+
+                     ;; Until 55 ESR we can disable this:
+                     "ac_add_options --disable-rust\n"
+
+                     ;; Building with debugging symbols takes ~5GiB, so
+                     ;; disable it.
+                     "ac_add_options --disable-debug\n"
+                     "ac_add_options --disable-debug-symbols\n"
+                     ;;"ac_add_options --enable-pie\n"
+
+                     ;; Avoid bundled libraries.
+                     "ac_add_options --with-system-zlib\n"
+                     "ac_add_options --with-system-bz2\n"
+                     "ac_add_options --with-system-jpeg\n"        ; must be libjpeg-turbo
+                     "ac_add_options --with-system-libevent\n"
+                     "ac_add_options --with-system-libvpx\n"
+                     "ac_add_options --with-system-icu\n"
+                     "ac_add_options --with-system-nspr\n"
+                     "ac_add_options --with-system-nss\n"
+                     ;;"--with-system-harfbuzz"
+                     ;;"--with-system-graphite2"
+                     "ac_add_options --enable-system-pixman\n"
+                     "ac_add_options --enable-system-cairo\n"
+                     "ac_add_options --enable-system-ffi\n"
+                     "ac_add_options --enable-system-hunspell\n"
+                     "ac_add_options --enable-system-sqlite\n"))))


> What are your commands to start the build?

The configure phase is:
  make --file=client.mk configure
which is followed by the build phase:
  make -f client.mk realbuild

> Georg
> 




> _______________________________________________
> tbb-dev mailing list
> tbb-dev at lists.torproject.org
> https://lists.torproject.org/cgi-bin/mailman/listinfo/tbb-dev


-- 
A88C8ADD129828D7EAC02E52E22F9BBFEE348588
https://n0.is/~ng0
-------------- next part --------------
;;; packages - package definitions for infotropique OS
;;; Copyright (C) 2017, 2018 ng0 <ng0 at infotropique.org>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;; Part of this module were originally based on the gnu/packages/gnuzilla.scm file
;; from GNU Guix which is covered by the GPL3 license. Consult the file for the
;; list of contributors.

(define-module (www torbrowser torbrowser)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system trivial)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages)
  #:use-module (gnu packages gnuzilla)
  #:use-module (gnu packages rust)
  #:use-module ((srfi srfi-1) #:hide (zip))
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-26)
  #:use-module (guix utils)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages gnome)
  #:use-module (guix base16)
  #:use-module (gnu packages libcanberra)
  #:use-module (gnu packages cups)
  #:use-module (gnu packages kerberos)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages llvm)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages libevent)
  #:use-module (gnu packages libreoffice)  ;for hunspell
  #:use-module (gnu packages image)
  #:use-module (gnu packages libffi)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages python)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages assembly)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages video)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages readline))


(define-public tor-browser-data
  (package
    (name "tor-browser-data")
    (version "7.5")
    (source
     (origin
       (method url-fetch)
       (uri (list (string-append "https://dist.torproject.org/torbrowser/"
                                 version "/tor-browser-linux64-" version "_en-US.tar.xz")
                  (string-append "https://archive.torproject.org/tor-package-archive/torbrowser/"
                                 version "/tor-browser-linux64-" version "_en-US.tar.xz")))
       (file-name (string-append name "-" version ".tar.xz"))
       (sha256
        (base32
 	 "1ia8qv5hj7zrrli5d9qf65s3rlrls0whrx3q96lw63x2gn05nwv7"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           (use-modules (ice-9 ftw))
           ;; Delete .pyc files, typically present in icecat source tarballs
           (for-each delete-file (find-files "." "\\.pyc$"))
           ;; Delete obj-* directories, sometimes present in icecat tarballs
           (for-each delete-file-recursively
                     (scandir "." (lambda (name)
                                    (string-prefix? "obj-" name))))
           #t))))
    (build-system trivial-build-system)
    (native-inputs
     `(("tar" ,tar)
       ("xz" ,xz)))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let ((out (assoc-ref %outputs "out"))
               (source (assoc-ref %build-inputs "source"))
               (tar (string-append (assoc-ref %build-inputs "tar") "/bin/tar"))
               (xz-path (string-append (assoc-ref %build-inputs "xz") "/bin")))
           (setenv "PATH" xz-path)
           (mkdir out)
           (invoke tar "xvf" source "-C" out "--strip=3")))))
    (home-page "https://www.torproject.org/projects/torbrowser.html")
    (synopsis "Data files for Tor Browser")
    (description
     "Torbrowser-data provides the data files required by the Tor Browser package.")
    (license license:mpl2.0)))     ;and others


(define-public tor-browser
  (package
    (name "tor-browser")
    (version "7.5")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://git.torproject.org/tor-browser.git")
             (commit "tor-browser-52.6.0esr-7.5-2-build1")))
       (file-name (string-append name "-" version "-checkout"))
       (sha256
        (base32
         "0253aqyjawsjyp493g98y7jxp4ixid4lx4xxdrg2x8qp4n2425hd"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           (use-modules (ice-9 ftw))
           ;; Delete .pyc files, typically present in icecat source tarballs
           (for-each delete-file (find-files "." "\\.pyc$"))
           ;; Delete obj-* directories, sometimes present in icecat tarballs
           (for-each delete-file-recursively
                     (scandir "." (lambda (name)
                                    (string-prefix? "obj-" name))))
           #t))))
    (build-system gnu-build-system)
    (inputs
     `(("alsa-lib" ,alsa-lib)
       ("bzip2" ,bzip2)
       ("cairo" ,cairo)
       ("cups" ,cups)
       ("dbus-glib" ,dbus-glib)
       ("gdk-pixbuf" ,gdk-pixbuf)
       ("glib" ,glib)
       ("gtk+" ,gtk+)
       ("gtk+-2" ,gtk+-2)
       ("graphite2" ,graphite2)
       ("pango" ,pango)
       ("freetype" ,freetype)
       ("harfbuzz" ,harfbuzz)
       ("hunspell" ,hunspell)
       ("libcanberra" ,libcanberra)
       ("libgnome" ,libgnome)
       ("libjpeg-turbo" ,libjpeg-turbo)
       ("libxft" ,libxft)
       ("libevent" ,libevent-2.0)
       ("libxinerama" ,libxinerama)
       ("libxscrnsaver" ,libxscrnsaver)
       ("libxcomposite" ,libxcomposite)
       ("libxt" ,libxt)
       ("libffi" ,libffi)
       ("ffmpeg" ,ffmpeg)
       ("libvpx" ,libvpx)
       ("icu4c" ,icu4c)
       ("pixman" ,pixman)
       ("pulseaudio" ,pulseaudio)
       ("mesa" ,mesa)
       ("mit-krb5" ,mit-krb5)
       ("nspr" ,nspr)
       ("nss" ,nss)
       ("sqlite" ,sqlite)
       ("startup-notification" ,startup-notification)
       ("tor-browser-data" ,tor-browser-data)
       ("unzip" ,unzip)
       ("zip" ,zip)
       ("zlib" ,zlib)))
    (native-inputs
     `(("perl" ,perl)
       ("python" ,python-2) ; Python 3 not supported
       ("python2-pysqlite" ,python2-pysqlite)
       ("yasm" ,yasm)
       ("pkg-config" ,pkg-config)
       ("autoconf" ,autoconf-2.13)
       ("which" ,which)))
    (arguments
     `(#:tests? #f          ; no check target
       #:out-of-source? #t  ; must be built outside of the source directory

       ;; XXX: There are RUNPATH issues such as
       ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
       ;; which is not in its RUNPATH, but they appear to be harmless in
       ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
       #:validate-runpath? #f
       #:make-flags (list "-f" "client.mk" "realbuild")
       #:modules ((ice-9 ftw)
                  (ice-9 rdelim)
                  (ice-9 match)
                  ,@%gnu-build-system-modules)
       #:phases
       (modify-phases %standard-phases
         (add-after
             'unpack 'ensure-no-mtimes-pre-1980
           (lambda _
             ;; Without this, the 'source/test/addons/packed.xpi' and
             ;; 'source/test/addons/simple-prefs.xpi' targets fail while trying
             ;; to create zip archives.
             (let ((early-2000 946684800)) ; 2000-01-01 UTC
               (ftw "." (lambda (file stat flag)
                          (unless (<= early-2000 (stat:mtime stat))
                            (utime file early-2000 early-2000))
                          #t))
               #t)))
         (add-after 'unpack 'keep-codebase-the-same
           (lambda _
             (substitute* "browser/branding/aurora/configure.sh"
               (("MOZ_DEV_EDITION=1")
                ""))
             (substitute* "browser/installer/Makefile.in"
               (("^MOZ_PKG_FATAL_WARNINGS = 1")
                "MOZ_PKG_FATAL_WARNINGS = 0"))
             #t))
         ;; (add-before 'configure 'autoconf
         ;;   (lambda _
         ;;     (invoke "autoreconf" "old-configure.in")))
    ;;      (add-after
    ;;          'unpack 'use-skia-by-default
    ;;        (lambda _
    ;;          ;; Use the bundled Skia library by default, since IceCat appears
    ;;          ;; to be far more stable when using it than when using our system
    ;;          ;; Cairo.
    ;;          (let ((out (open "browser/app/profile/firefox.js"
    ;;                           (logior O_WRONLY O_APPEND))))
    ;;            (format out "~%// Use Skia by default~%")
    ;;            (format out "pref(~s, ~s);~%" "gfx.canvas.azure.backends" "skia")
    ;;            (format out "pref(~s, ~s);~%" "gfx.content.azure.backends" "skia")
    ;;            (close-port out))
    ;;          #t))
    ;;      (add-after
    ;;          'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
    ;;        (lambda _
    ;;          ;; libxul.so dynamically opens libraries, so here we explicitly
    ;;          ;; link them into libxul.so instead.
    ;;          ;;
    ;;          ;; TODO: It might be preferable to patch in absolute file names in
    ;;          ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
    ;;          ;; work.  More investigation is needed.
    ;;          (substitute* "toolkit/library/moz.build"
    ;;            (("^# This library needs to be last" all)
    ;;             (string-append "OS_LIBS += [
    ;; 'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
    ;; 'avcodec', 'avutil', 'pulse' ]\n\n"
    ;;                            all)))
    ;;          #t))
         (replace 'configure
           (lambda* (#:key outputs configure-flags #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bash (which "bash"))
                    (abs-srcdir (getcwd))
                    (srcdir (string-append "../" (basename abs-srcdir)))
                    (flags `(,(string-append "--prefix=" out)
                             , at configure-flags))
                    (mozconfig (string-append (getcwd) "/.mozconfig")))
               (chmod mozconfig #o755)
               (setenv "SHELL" bash)
               (setenv "AUTOCONF"
                      (string-append (assoc-ref %build-inputs
                                                "autoconf")
                                     "/bin/autoconf"))
               (setenv "CONFIG_SHELL" bash)
               (setenv "BUILD_OBJ_DIR"
                       (string-append (getcwd) "/ff"))
               (setenv "QA_CONFIGURE_OPTIONS" ".*")
               (setenv "MOZBUILD_STATE_PATH"
                       (string-append (getcwd) "/mach_state"))
               (setenv "MOZCONFIG"
                       (string-append (getcwd) "/.mozconfig"))
               (setenv "MOZ_NOSPAM" "1")
               ;; (setenv "builddir" (string-append (getcwd) "/build"))
               ;; (mkdir-p (getenv "MOZBUILD_STATE_PATH"))
               ;;(mkdir-p (string-append (getcwd) "/builddir"))
               (with-output-to-file mozconfig
                 (lambda ()
                   (display
                    (string-append
                     ". $topsrcdir/browser/config/mozconfig\n"
                     ;;"mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj- at CONFIG_GUESS@\n"
                     "mk_add_options MOZ_OBJDIR=" (getenv "BUILD_OBJ_DIR") "\n"
                     "mk_add_options MOZ_APP_DISPLAYNAME=\"Tor Browser\"\n"
                     "mk_add_options XARGS=" (which "xargs") "\n"
                     "mk_add_options MOZILLA_OFFICIAL=1\n"
                     "mk_add_options BUILD_OFFICIAL=1\n"
                     "ac_add_options --enable-extensions=default\n"
                     ;;"ac_add_options --enable-optimize\n"
                     ;;#ac_add_options --disable-optimize
                     "ac_add_options --enable-official-branding\n"
                     ;; # Let's support GTK2 for ESR52
                     "ac_add_options --enable-default-toolkit=cairo-gtk2\n"
                     ;; ---- poncho didn't have those 2:
                     ;;"ac_add_options --enable-signmar\n"
                     ;;"ac_add_options --enable-verify-mar\n"
                     ;; ----
                     "ac_add_options --disable-strip\n"
                     "ac_add_options --disable-install-strip\n"
                     "ac_add_options --disable-tests\n"
                     ;; "ac_add_options --disable-debug\n"
                     ;; ac_add_options --disable-maintenance-service
                     ;; ac_add_options --disable-crashreporter
                     "ac_add_options --disable-webrtc\n"
                     "ac_add_options --disable-eme\n"


                     "ac_add_options --with-app-name=torbrowser\n"
                     "ac_add_options --with-app-basename=torbrowser\n"
                     "ac_add_options --with-tor-browser-version=7.5\n"
                     "ac_add_options --disable-tor-browser-update\n"
                     ;;"ac_add_options --enable-tor-browser-data-outside-app-dir\n"

                     ;; "ac_add_options --enable-default-toolkit=cairo-gtk3\n"
                     "ac_add_options --enable-gio\n"
                     "ac_add_options --enable-startup-notification\n"
                     "ac_add_options --enable-pulseaudio\n"

                     "ac_add_options --disable-gconf\n"
                     "ac_add_options --disable-gnomeui\n"

                     "ac_add_options --disable-maintenance-service\n"
                     "ac_add_options --disable-updater\n"
                     "ac_add_options --disable-necko-wifi\n"
                     ;;"ac_add_options --enable-safe-browsing\n"
                     "ac_add_options --disable-crashreporter\n"

                     ;; Until 55 ESR we can disable this:
                     "ac_add_options --disable-rust\n"

                     ;; Building with debugging symbols takes ~5GiB, so
                     ;; disable it.
                     "ac_add_options --disable-debug\n"
                     "ac_add_options --disable-debug-symbols\n"
                     ;;"ac_add_options --enable-pie\n"

                     ;; Avoid bundled libraries.
                     "ac_add_options --with-system-zlib\n"
                     "ac_add_options --with-system-bz2\n"
                     "ac_add_options --with-system-jpeg\n"        ; must be libjpeg-turbo
                     "ac_add_options --with-system-libevent\n"
                     "ac_add_options --with-system-libvpx\n"
                     "ac_add_options --with-system-icu\n"
                     "ac_add_options --with-system-nspr\n"
                     "ac_add_options --with-system-nss\n"
                     ;;"--with-system-harfbuzz"
                     ;;"--with-system-graphite2"
                     "ac_add_options --enable-system-pixman\n"
                     "ac_add_options --enable-system-cairo\n"
                     "ac_add_options --enable-system-ffi\n"
                     "ac_add_options --enable-system-hunspell\n"
                     "ac_add_options --enable-system-sqlite\n"))))
               (display (getcwd))
               (newline)
               (display "make -f client.mk configure")
               (invoke "make" "--file=client.mk" "configure"))))
         ;; (replace 'build
         ;;   (lambda _
         ;;     (chdir "build")
         ;;     (display (getcwd))
         ;;     (display (string-append (getcwd) ".."))
         ;;     (invoke "../source/mach" "--file=../source/client.mk" "build")
         ;;     #t))
        ;; (add-after 'install 'run-check
        ;;    (lambda* (#:key outputs #:allow-other-keys)
        ;;      (let ((out (assoc-ref outputs "out")))
         ;;        (invoke (string-append out "/bin/firefox" " --version")))))
         (add-after 'install-desktop-entry 'install-icons
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (with-directory-excursion "../firefox-52.6.0esr/browser/branding/aurora"
                 (for-each
                  (lambda (file)
                    (let* ((size (string-filter char-numeric? file))
                           (icons (string-append out "/share/icons/hicolor/"
                                                 size "x" size "/apps")))
                      (mkdir-p icons)
                      (copy-file file (string-append icons "/aurora.png"))))
                  '("default16.png" "default32.png" "default48.png" "content/icon64.png"
                    "mozicon128.png"))))))
         ;; This fixes the file chooser crash that happens with GTK 3.
         (add-after 'install 'wrap-program
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (lib (string-append out "/lib"))
                    (gtk (assoc-ref inputs "gtk+"))
                    (gtk-share (string-append gtk "/share")))
               (wrap-program (car (find-files lib "^firefox$"))
                 `("XDG_DATA_DIRS" ":" prefix (,gtk-share))))))
         (add-after 'build 'install-desktop-entry
           (lambda* (#:key outputs #:allow-other-keys)
             ;; Add .desktop files for the 2 variants and the symlink
             (let* ((out (assoc-ref outputs "out"))
                    (prefs (string-append out "/lib/firefox-52.6.0/browser/"
                                          "defaults/preferences/")))
               (mkdir-p prefs)
               (with-output-to-file
                   (string-append prefs "vendor.js")
                 (lambda _
                   (format #t
                           "// Disable default browser checking.~@
pref(\"browser.shell.checkDefaultBrowser\", false);~@
// Don't disable our bundled extensions in the application directory~@
pref(\"extensions.autoDisableScopes\", 11);~@
pref(\"extensions.shownSelectionUI\", true);~@
// Disable Signature Verification~@
pref(\"xpinstall.signatures.required\", false);~%"
                           out))))
             #t)))))

    (native-search-paths
     (list (search-path-specification
            (variable "MOZ_PLUGIN_PATH")
            (files (list (string-append "lib/mozilla/plugins"))))))
    (home-page "https://mozilla.org/en-US/firefox/")
    (synopsis "Web browser built from Firefox ESR source tree")
    (description
     "Web browser built from Firefox ESR source tree.")
    (license license:mpl2.0)))     ;and others, see toolkit/content/license.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.torproject.org/pipermail/tbb-dev/attachments/20180309/07f26c23/attachment-0001.sig>


More information about the tbb-dev mailing list