me
/
guix
Archived
1
0
Fork 0

gnu: icecat: Move the snippet and patches out of the 'source'.

This commit changes the 'source' field of the 'icecat' package to
simply be 'icecat-source', which aims to be suitable for use on any
system that IceCat supports.

* gnu/packages/gnuzilla.scm (icecat)[source]: Change to simply
be 'icecat-source'.
[native-inputs]: Add 'patch', along with the Guix-specific patches
that were previously applied within 'source'.
[arguments]: Remove the 'ensure-no-mtimes-pre-1980' phase.
Add 'apply-guix-specific-patches' and 'remove-bundled-libraries'
phases.  Touch 'configure' in the bootstrap phase.  Return #t from
the 'augment-CPLUS_INCLUDE_PATH' phase.  Reindent.
master
Mark H Weaver 2019-05-06 05:58:54 -04:00
parent 3e605b6998
commit 46ce12d0a3
No known key found for this signature in database
GPG Key ID: 7CEF29847562C516
1 changed files with 122 additions and 116 deletions

View File

@ -596,68 +596,7 @@ from forcing GEXP-PROMISE."
(package
(name "icecat")
(version %icecat-version)
(source
(origin
(inherit icecat-source)
(patches (search-patches "icecat-avoid-bundled-libraries.patch"
"icecat-use-system-graphite2+harfbuzz.patch"
"icecat-use-system-media-libs.patch"))
(modules '((guix build utils)))
(snippet
'(begin
(use-modules (ice-9 ftw))
;; Remove bundled libraries that we don't use, since they may
;; contain unpatched security flaws, they waste disk space and
;; network bandwidth, and may cause confusion.
(for-each delete-file-recursively
'(;; FIXME: Removing the bundled icu breaks configure.
;; * The bundled icu headers are used in some places.
;; * The version number is taken from the bundled copy.
;;"intl/icu"
;;
;; FIXME: A script from the bundled nspr is used.
;;"nsprpub"
;;
;; FIXME: With the update to IceCat 60, using system NSS
;; broke certificate validation. See
;; <https://bugs.gnu.org/32833>. For now, we use
;; the bundled NSPR and NSS. TODO: Investigate,
;; and try to unbundle these libraries again.
;; UNBUNDLE-ME! "security/nss"
;;
;; TODO: Use more system media libraries. See:
;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
;; * libtheora: esr60 wants v1.2, not yet released.
;; * soundtouch: avoiding the bundled library would
;; result in some loss of functionality. There's
;; also an issue with exception handling
;; configuration. It seems that this is needed in
;; some moz.build:
;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
;; * libopus
;; * speex
;;
"modules/freetype2"
"modules/zlib"
"modules/libbz2"
"ipc/chromium/src/third_party/libevent"
"media/libjpeg"
"media/libvpx"
"media/libogg"
"media/libvorbis"
;; "media/libtheora" ; wants theora-1.2, not yet released
"media/libtremor"
"gfx/harfbuzz"
"gfx/graphite2"
"js/src/ctypes/libffi"
"db/sqlite3"))
;; 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))))
(source icecat-source)
(build-system gnu-build-system)
(inputs
`(("alsa-lib" ,alsa-lib)
@ -703,8 +642,21 @@ from forcing GEXP-PROMISE."
("zip" ,zip)
("zlib" ,zlib)))
(native-inputs
;; Icecat 60 checkes for rust>=1.24
`(("rust" ,rust-1.24)
;; The following patches are specific to the Guix packaging of IceCat,
;; and therefore we prefer to leave them out of 'source', which should be
;; a tarball suitable for compilation on any system that IceCat supports.
;; (Bug fixes and security fixes, however, should go in 'source').
`(("icecat-avoid-bundled-libraries.patch"
,(search-patch "icecat-avoid-bundled-libraries.patch"))
("icecat-use-system-graphite2+harfbuzz.patch"
,(search-patch "icecat-use-system-graphite2+harfbuzz.patch"))
("icecat-use-system-media-libs.patch"
,(search-patch "icecat-use-system-media-libs.patch"))
("patch" ,(canonical-package patch))
;; Icecat 60 checks for rust>=1.24
("rust" ,rust-1.24)
("cargo" ,rust-1.24 "cargo")
("llvm" ,llvm-3.9.1)
("clang" ,clang-3.9.1)
@ -804,20 +756,71 @@ from forcing GEXP-PROMISE."
,@%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-1980 315619200)) ; 1980-01-02 UTC
(ftw "." (lambda (file stat flag)
(unless (<= early-1980 (stat:mtime stat))
(utime file early-1980 early-1980))
(add-after 'unpack 'apply-guix-specific-patches
(lambda* (#:key inputs native-inputs #:allow-other-keys)
(let ((patch (string-append (assoc-ref (or native-inputs inputs)
"patch")
"/bin/patch")))
(for-each (match-lambda
((label . file)
(when (and (string-prefix? "icecat-" label)
(string-suffix? ".patch" label))
(format #t "applying '~a'...~%" file)
(invoke patch "--force" "--no-backup-if-mismatch"
"-p1" "--input" file))))
(or native-inputs inputs)))
#t))
#t)))
(add-after
'unpack 'link-libxul-with-libraries
(add-after 'apply-guix-specific-patches 'remove-bundled-libraries
(lambda _
;; Remove bundled libraries that we don't use, since they may
;; contain unpatched security flaws, they waste disk space and
;; memory, and may cause confusion.
(for-each (lambda (file)
(format #t "deleting '~a'...~%" file)
(delete-file-recursively file))
'(;; FIXME: Removing the bundled icu breaks configure.
;; * The bundled icu headers are used in some places.
;; * The version number is taken from the bundled copy.
;;"intl/icu"
;;
;; FIXME: A script from the bundled nspr is used.
;;"nsprpub"
;;
;; FIXME: With the update to IceCat 60, using system NSS
;; broke certificate validation. See
;; <https://bugs.gnu.org/32833>. For now, we use
;; the bundled NSPR and NSS. TODO: Investigate,
;; and try to unbundle these libraries again.
;; UNBUNDLE-ME! "security/nss"
;;
;; TODO: Use more system media libraries. See:
;; <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
;; * libtheora: esr60 wants v1.2, not yet released.
;; * soundtouch: avoiding the bundled library would
;; result in some loss of functionality. There's
;; also an issue with exception handling
;; configuration. It seems that this is needed in
;; some moz.build:
;; DEFINES['ST_NO_EXCEPTION_HANDLING'] = 1
;; * libopus
;; * speex
;;
"modules/freetype2"
"modules/zlib"
"modules/libbz2"
"ipc/chromium/src/third_party/libevent"
"media/libjpeg"
"media/libvpx"
"media/libogg"
"media/libvorbis"
;; "media/libtheora" ; wants theora-1.2, not yet released
"media/libtremor"
"gfx/harfbuzz"
"gfx/graphite2"
"js/src/ctypes/libffi"
"db/sqlite3"))
#t))
(add-after 'remove-bundled-libraries 'link-libxul-with-libraries
(lambda _
;; libxul.so dynamically opens libraries, so here we explicitly
;; link them into libxul.so instead.
@ -834,7 +837,10 @@ from forcing GEXP-PROMISE."
#t))
(replace 'bootstrap
(lambda _
(invoke "sh" "-c" "autoconf old-configure.in > old-configure")))
(invoke "sh" "-c" "autoconf old-configure.in > old-configure")
;; 'configure' must be newer than 'old-configure.in', or else the
;; build system will raise an alarm and abort.
(invoke "touch" "configure")))
(add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda _
(use-modules (guix build cargo-utils))
@ -866,9 +872,9 @@ from forcing GEXP-PROMISE."
(setenv "CPLUS_INCLUDE_PATH"
(string-append gcc "/include/c++" ":"
gcc "/include/c++/" build ":"
(getenv "CPLUS_INCLUDE_PATH"))))))
(replace
'configure
(getenv "CPLUS_INCLUDE_PATH"))))
#t))
(replace 'configure
;; configure does not work followed by both "SHELL=..." and
;; "CONFIG_SHELL=..."; set environment variables instead
(lambda* (#:key outputs configure-flags #:allow-other-keys)