From 948879eeda8fcacf6bdbf45111941eb5e964156e Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Tue, 29 Jan 2019 21:15:36 -0500 Subject: gnu: icecat: Add icecat-source. * gnu/packages/gnuzilla.scm (computed-origin-method): New variable. (%icecat-version, icecat-source): New variables. * gnu/packages/patches/icecat-makeicecat.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 3 +- gnu/packages/gnuzilla.scm | 175 ++++++++++++++++++++++++++- gnu/packages/patches/icecat-makeicecat.patch | 154 +++++++++++++++++++++++ 3 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/icecat-makeicecat.patch diff --git a/gnu/local.mk b/gnu/local.mk index 6b649e1f86..c4b172f90e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2,7 +2,7 @@ # Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Andreas Enge # Copyright © 2016 Mathieu Lirzin -# Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Mark H Weaver +# Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver # Copyright © 2016 Chris Marusich # Copyright © 2016, 2017, 2018 Kei Kebreau # Copyright © 2016, 2017 Rene Saavedra @@ -886,6 +886,7 @@ dist_patch_DATA = \ %D%/packages/patches/hurd-fix-eth-multiplexer-dependency.patch \ %D%/packages/patches/hplip-remove-imageprocessor.patch \ %D%/packages/patches/hydra-disable-darcs-test.patch \ + %D%/packages/patches/icecat-makeicecat.patch \ %D%/packages/patches/icecat-avoid-bundled-libraries.patch \ %D%/packages/patches/icecat-use-system-graphite2+harfbuzz.patch \ %D%/packages/patches/icecat-use-system-media-libs.patch \ diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm index 0ef8a91bfa..8f400dc74d 100644 --- a/gnu/packages/gnuzilla.scm +++ b/gnu/packages/gnuzilla.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2015 Andreas Enge ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès -;;; Copyright © 2014, 2015, 2016, 2017, 2018 Mark H Weaver +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver ;;; Copyright © 2015 Sou Bunnbu ;;; Copyright © 2016, 2017, 2018 Efraim Flashner ;;; Copyright © 2016 Alex Griffin @@ -33,12 +33,17 @@ (define-module (gnu packages gnuzilla) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) + #:use-module (guix gexp) + #:use-module (guix store) + #:use-module (guix monads) #:use-module (guix utils) #:use-module (guix build-system gnu) #:use-module (guix build-system cargo) + #:use-module (gnu packages admin) #:use-module (gnu packages audio) #:use-module (gnu packages autotools) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages check) #:use-module (gnu packages databases) #:use-module (gnu packages glib) @@ -559,6 +564,174 @@ (define (mozilla-patch file-name changeset hash) (sha256 (base32 hash)) (file-name file-name))) +(define* (computed-origin-method gexp-promise hash-algo hash + #:optional (name "source") + #:key (system (%current-system)) + (guile (default-guile))) + "Return a derivation that executes the G-expression that results +from forcing GEXP-PROMISE." + (mlet %store-monad ((guile (package->derivation guile system))) + (gexp->derivation (or name "computed-origin") + (force gexp-promise) + #:system system + #:guile-for-build guile))) + +(define %icecat-version "60.5.0-guix1") + +;; 'icecat-source' is a "computed" origin that generates an IceCat tarball +;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat' +;; script from the upstream IceCat project. +(define icecat-source + (let* ((base-version (first (string-split %icecat-version #\-))) + + (major-version (first (string-split base-version #\.))) + (minor-version (second (string-split base-version #\.))) + (sub-version (third (string-split base-version #\.))) + + (upstream-firefox-version (string-append base-version "esr")) + (upstream-firefox-source + (origin + (method url-fetch) + (uri (string-append + "https://ftp.mozilla.org/pub/firefox/releases/" + upstream-firefox-version "/source/" + "firefox-" upstream-firefox-version ".source.tar.xz")) + (sha256 + (base32 + "09a0kk250r03984n1hdwr2rg1vmhi2jkyzzgbbvkf9h9hzp6j7qs")))) + + (upstream-icecat-base-version "60.3.0") ; maybe older than base-version + (upstream-icecat-gnu-version "1") + (upstream-icecat-version (string-append upstream-icecat-base-version + "-gnu" + upstream-icecat-gnu-version)) + (upstream-icecat-source + (origin + (method url-fetch) + (uri (string-append + "mirror://gnu/gnuzilla/" upstream-icecat-base-version + "/icecat-" upstream-icecat-version ".tar.bz2")) + (sha256 + (base32 + "0icnl64nxcyf7dprpdpygxhabsvyhps8c3ixysj9bcdlj9q34ib1")))) + + (gnuzilla-commit (string-append "v" upstream-icecat-base-version)) + (gnuzilla-source + (origin + (method git-fetch) + (uri (git-reference + (url "git://git.savannah.gnu.org/gnuzilla.git") + (commit gnuzilla-commit))) + (file-name (git-file-name "gnuzilla" upstream-icecat-base-version)) + (sha256 + (base32 + "19wal7hkbb4wvk40hs6d7a5paal2bfday08hwssm02srcbv48fj0")))) + + (makeicecat-patch + (local-file (search-patch "icecat-makeicecat.patch")))) + + (origin + (method computed-origin-method) + (file-name (string-append "icecat-" %icecat-version ".tar.xz")) + (sha256 #f) + (uri + (delay + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (let ((firefox-dir + (string-append "firefox-" #$base-version)) + (icecat-dir + (string-append "icecat-" #$%icecat-version)) + (old-icecat-dir + (string-append "icecat-" #$upstream-icecat-base-version))) + + (mkdir "/tmp/bin") + (set-path-environment-variable + "PATH" '("bin") + (list "/tmp" + #+(canonical-package bash) + #+(canonical-package coreutils) + #+(canonical-package findutils) + #+(canonical-package patch) + #+(canonical-package xz) + #+(canonical-package sed) + #+(canonical-package grep) + #+(canonical-package bzip2) + #+(canonical-package gzip) + #+(canonical-package tar) + #+rename)) + + (symlink #+(file-append rename "/bin/rename") + "/tmp/bin/prename") + + ;; We copy the gnuzilla source directory because it is + ;; read-only in 'gnuzilla-source', and the makeicecat script + ;; uses "cp -a" to copy parts of it and assumes that the + ;; copies will be writable. + (copy-recursively #+gnuzilla-source "/tmp/gnuzilla" + #:log (%make-void-port "w")) + + (with-directory-excursion "/tmp/gnuzilla" + (make-file-writable "makeicecat") + (invoke "patch" "--force" "--no-backup-if-mismatch" + "-p1" "--input" #+makeicecat-patch) + (patch-shebang "makeicecat") + (substitute* "makeicecat" + (("^FFMAJOR=.*") + (string-append "FFMAJOR=" #$major-version "\n")) + (("^FFMINOR=.*") + (string-append "FFMINOR=" #$minor-version "\n")) + (("^FFSUB=.*") + (string-append "FFSUB=" #$sub-version "\n")) + (("^GNUVERSION=.*") + (string-append "GNUVERSION=" + #$upstream-icecat-gnu-version "\n")) + (("^DATA=.*") + "DATA=/tmp/gnuzilla/data\n") + (("^sed .* debian/" all) + (string-append "echo warning: skipped: " all)) + (("^debian/rules " all) + (string-append "echo warning: skipped: " all)) + (("^find extensions/gnu/ ") + "find extensions/gnu/ | sort ") + (("/bin/sed") + #+(file-append (canonical-package sed) "/bin/sed")))) + + (format #t "Unpacking upstream firefox tarball...~%") + (force-output) + (invoke "tar" "xf" #+upstream-firefox-source) + (rename-file firefox-dir icecat-dir) + + (with-directory-excursion icecat-dir + (for-each mkdir-p '("l10n" "debian/config")) + (call-with-output-file "debian/control" (const #t)) + (format #t "Running makeicecat script...~%") + (force-output) + (invoke "bash" "/tmp/gnuzilla/makeicecat") + (for-each delete-file-recursively '("l10n" "debian"))) + + (format #t (string-append "Unpacking l10n/* and debian/* from" + " upstream IceCat tarball...~%")) + (force-output) + (unless (string=? icecat-dir old-icecat-dir) + (symlink icecat-dir old-icecat-dir)) + (invoke "tar" "xf" #+upstream-icecat-source + (string-append old-icecat-dir "/l10n") + (string-append old-icecat-dir "/debian")) + + (format #t (string-append "Packing new IceCat tarball...~%")) + (force-output) + (invoke "tar" "cfa" #$output + ;; avoid non-determinism in the archive + "--mtime=@0" + "--owner=root:0" + "--group=root:0" + "--sort=name" + icecat-dir) + + #t)))))))) + (define-public icecat (package (name "icecat") diff --git a/gnu/packages/patches/icecat-makeicecat.patch b/gnu/packages/patches/icecat-makeicecat.patch new file mode 100644 index 0000000000..2a11bf0b70 --- /dev/null +++ b/gnu/packages/patches/icecat-makeicecat.patch @@ -0,0 +1,154 @@ +Make some of the changes needed to the 'makeicecat' script, to allow it to run +in a snippet without network access. After this patch is applied, some +additional changes will be made using 'substitute*'. + +diff --git a/makeicecat b/makeicecat +index aa46b94..db27a86 100644 +--- a/makeicecat ++++ b/makeicecat +@@ -36,75 +36,75 @@ export DEBFULLNAME="Ruben Rodriguez" + + DATA="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/data + +-mkdir output +-cd output ++# mkdir output ++# cd output + + ############################################################################### + # Retrieve FF source code + ############################################################################### + +-rm mozilla-esr${FFMAJOR} $SOURCEDIR -rf +- +-wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz +-wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc +-gpg --recv-keys --keyserver keyserver.ubuntu.com 24C6F355 +-gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc +- +-echo Extracting Firefox tarball +-tar -xf firefox-${FFVERSION}esr.source.tar.xz +- +-mv firefox-${FFVERSION} $SOURCEDIR ++# rm mozilla-esr${FFMAJOR} $SOURCEDIR -rf ++# ++# wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz ++# wget -N https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FFVERSION}esr/source/firefox-${FFVERSION}esr.source.tar.xz.asc ++# gpg --recv-keys --keyserver keyserver.ubuntu.com 24C6F355 ++# gpg --verify firefox-${FFVERSION}esr.source.tar.xz.asc ++# ++# echo Extracting Firefox tarball ++# tar -xf firefox-${FFVERSION}esr.source.tar.xz ++# ++# mv firefox-${FFVERSION} $SOURCEDIR + + ############################################################################### + # Retrieve /debian from Ubuntu + ############################################################################### + +-rm -rf firefox.$CODENAME +-bzr branch https://code.launchpad.net/~mozillateam/firefox/firefox.$CODENAME +-cd firefox.$CODENAME +-bzr revert -r$REVISION +-echo '3.0 (native)' > debian/source/format +- +-for PATCH in ubuntu-bookmarks.patch ubuntu-ua-string-changes.patch unity-menubar.patch ubuntu-search-defaults.patch fix-make-package-tests-without-webrtc.patch revert-upstream-search-engine-changes.patch +-do +- rm debian/patches/$PATCH +- sed "/$PATCH/d" -i debian/patches/series +-done +-sed "/test-/d" -i debian/patches/series +-cd .. +- +-mv firefox.$CODENAME/debian $SOURCEDIR +-rm -rf firefox.$CODENAME ++# rm -rf firefox.$CODENAME ++# bzr branch https://code.launchpad.net/~mozillateam/firefox/firefox.$CODENAME ++# cd firefox.$CODENAME ++# bzr revert -r$REVISION ++# echo '3.0 (native)' > debian/source/format ++# ++# for PATCH in ubuntu-bookmarks.patch ubuntu-ua-string-changes.patch unity-menubar.patch ubuntu-search-defaults.patch fix-make-package-tests-without-webrtc.patch revert-upstream-search-engine-changes.patch ++# do ++# rm debian/patches/$PATCH ++# sed "/$PATCH/d" -i debian/patches/series ++# done ++# sed "/test-/d" -i debian/patches/series ++# cd .. ++# ++# mv firefox.$CODENAME/debian $SOURCEDIR ++# rm -rf firefox.$CODENAME + + ############################################################################### + # Retrieve l10n + ############################################################################### + +-mkdir l10n +-cd l10n +-while read line;do +- line=$(echo $line |cut -d' ' -f1) +- #[ $line = "es-ES" ] || continue # To speed up testing +- [ $line = "en-US" ] && continue +- hg clone https://hg.mozilla.org/l10n-central/$line +- mkdir -p $line/browser/chrome/browser/preferences +- touch $line/browser/chrome/browser/preferences/advanced-scripts.dtd +- rm -rf $line/.hg* +-done < ../$SOURCEDIR/browser/locales/shipped-locales +-cd .. +- +-mv l10n $SOURCEDIR +- +-hg clone http://hg.mozilla.org/l10n/compare-locales/ +-cd compare-locales/ +-hg checkout RELEASE_3_3_0 +-cd .. +-rm compare-locales/.hg* compare-locales/.git* -rf +-mv compare-locales $SOURCEDIR/l10n ++# mkdir l10n ++# cd l10n ++# while read line;do ++# line=$(echo $line |cut -d' ' -f1) ++# #[ $line = "es-ES" ] || continue # To speed up testing ++# [ $line = "en-US" ] && continue ++# hg clone https://hg.mozilla.org/l10n-central/$line ++# mkdir -p $line/browser/chrome/browser/preferences ++# touch $line/browser/chrome/browser/preferences/advanced-scripts.dtd ++# rm -rf $line/.hg* ++# done < ../$SOURCEDIR/browser/locales/shipped-locales ++# cd .. ++# ++# mv l10n $SOURCEDIR ++# ++# hg clone http://hg.mozilla.org/l10n/compare-locales/ ++# cd compare-locales/ ++# hg checkout RELEASE_3_3_0 ++# cd .. ++# rm compare-locales/.hg* compare-locales/.git* -rf ++# mv compare-locales $SOURCEDIR/l10n + + ####################################################### + +-cd $SOURCEDIR ++# cd $SOURCEDIR + + #for patch in $DATA/patches/*; do + # echo Patching with file: $patch +@@ -720,7 +720,7 @@ debian/rules debian/control + touch -d "yesterday" debian/control + debian/rules debian/control + +-echo | dch -b -D stable -v "$ICECATVERSION" "Converted into IceCat (http://www.gnu.org/software/gnuzilla/)" ++# echo | dch -b -D stable -v "$ICECATVERSION" "Converted into IceCat (http://www.gnu.org/software/gnuzilla/)" + sed "1s/firefox/icecat/" -i debian/changelog + + touch configure js/src/configure +@@ -734,6 +734,6 @@ sed 's/777/755/;' -i toolkit/crashreporter/google-breakpad/Makefile.in + /bin/sed 's/chmod a+w/chmod u+w/' -i ./js/src/ctypes/libffi/Makefile.in ./toolkit/crashreporter/google-breakpad/Makefile.in ./toolkit/crashreporter/google-breakpad/src/third_party/glog/Makefile.in || true + + +-cd .. +-echo Packaging tarball +-tar cfj icecat-$ICECATVERSION.tar.bz2 $SOURCEDIR ++# cd .. ++# echo Packaging tarball ++# tar cfj icecat-$ICECATVERSION.tar.bz2 $SOURCEDIR -- cgit v1.2.3