From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:46396) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWKBr-0005jj-MQ for guix-patches@gnu.org; Sun, 17 Nov 2019 08:02:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWKBp-0004pa-Lu for guix-patches@gnu.org; Sun, 17 Nov 2019 08:02:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59863) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWKBp-0004nk-7s for guix-patches@gnu.org; Sun, 17 Nov 2019 08:02:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWKBm-0005AP-Vk for guix-patches@gnu.org; Sun, 17 Nov 2019 08:02:05 -0500 Subject: [bug#38244] [PATCH] build librsvg-next with packaged crates Resent-Message-ID: Received: from eggs.gnu.org ([2001:470:142:3::10]:46313) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWKAx-0005gU-8T for guix-patches@gnu.org; Sun, 17 Nov 2019 08:01:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWKAu-0001pk-B5 for guix-patches@gnu.org; Sun, 17 Nov 2019 08:01:10 -0500 Received: from flashner.co.il ([178.62.234.194]:58834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iWKAt-0001bV-To for guix-patches@gnu.org; Sun, 17 Nov 2019 08:01:08 -0500 Received: from localhost (unknown [141.226.13.108]) by flashner.co.il (Postfix) with ESMTPSA id CA7C7401A3 for ; Sun, 17 Nov 2019 13:00:59 +0000 (UTC) Date: Sun, 17 Nov 2019 15:00:28 +0200 From: Efraim Flashner Message-ID: <20191117130028.GE12423@E5400> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Zs/RYxT/hKAHzkfQ" Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 38244@debbugs.gnu.org --Zs/RYxT/hKAHzkfQ Content-Type: multipart/mixed; boundary="10jrOL3x2xqLmOsH" Content-Disposition: inline --10jrOL3x2xqLmOsH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've built librsvg-next with a bunch of the packaged crates. It seems like a good start to de-vendoring the crates in librsvg. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --10jrOL3x2xqLmOsH Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="librsvg-crate-replacement.patch" Content-Transfer-Encoding: quoted-printable diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm index f9126d18e1..afcda4cd1c 100644 --- a/gnu/packages/gnome.scm +++ b/gnu/packages/gnome.scm @@ -75,6 +75,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) + #:use-module (gnu packages crates-io) #:use-module (gnu packages cups) #:use-module (gnu packages curl) #:use-module (gnu packages cyrus-sasl) @@ -165,6 +166,7 @@ #:use-module (gnu packages xorg) #:use-module (gnu packages xorg) #:use-module (gnu artwork) + #:use-module (guix build-system cargo) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) #:use-module (guix build-system gnu) @@ -177,6 +179,8 @@ #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix gexp) + #:use-module (guix monads) + #:use-module (guix store) #:use-module (ice-9 match) #:use-module (srfi srfi-1)) =20 @@ -1403,37 +1407,239 @@ dealing with different structured file formats.") library.") (license license:lgpl2.0+))) =20 +(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) + #:graft? #f ;nothing to graft + #:system system + #:guile-for-build guile))) + +(define librsvg-next-source + (let* ((version "2.46.3") + (upstream-source (origin + (method url-fetch) + (uri (string-append "mirror://gnome/sources/lib= rsvg/" + (version-major+minor versio= n) "/" + "librsvg-" version ".tar.xz= ")) + (sha256 + (base32 + "1s3a96i7f4pynjwxxvhysp4b6r7kyi8nasdxfyi62hc7= gm34d3kn"))))) + (origin + (method computed-origin-method) + (file-name (string-append "librsvg-" version ".tar.xz")) + (sha256 #f) + (uri + (delay + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (set-path-environment-variable + "PATH" '("bin") + (list "/tmp" + #+(canonical-package xz) + #+(canonical-package gzip) + #+(canonical-package tar))) + (invoke "tar" "xvf" #+upstream-source) + (with-directory-excursion (string-append "librsvg-" #$versio= n) + (for-each + (lambda (crate) + (delete-file-recursively (string-append "vendor/" (car= crate))) + (invoke "tar" "xvf" (cdr crate) "-C" "vendor")) + '( +;; aho-corasick 0.7 +;; alga 0.9 +;; approx 0.3 +;; arrayvec 0.4 + ("atty" . #+(package-source rust-atty-0.2)) + ("autocfg" . #+(package-source rust-autocfg-0.1)) + ("bitflags" . #+(package-source rust-bitflags-1)) +;; block 0.1 +;; bstr 0.2 +;; byteorder 1.3 +;; cairo-rs 0.7 +;; cairo-sys-rs 0.9 +;; cast 0.2 + ("cfg-if" . #+(package-source rust-cfg-if-0.1)) + ("clap" . #+(package-source rust-clap-2)) + ;("cloudabi" . #+(package-source rust-cloudabi-0.0)) +;; criterion 0.2 +;; criterion-plot 0.3 +;; crossbeam-deque 0.7 +;; crossbeam-epoch 0.7 +;; crossbeam-queue 0.1 +;; crossbeam-utils 0.6 +;; cssparser 0.25 +;; cssparser-macros 0.3 +;; csv 1.1 +;; csv-core 0.1 +;; data-url 0.1 +;; downcast-rs 1.0 + ("dtoa" . #+(package-source rust-dtoa-0.4)) +;; dtoa-short 0.3 +;; either 1.5 +;; encoding 0.2 +;; encoding-index-japanese 1.20141219.5 +;; encoding-index-korean 1.20141219.5 +;; encoding-index-simpchinese 1.20141219.5 +;; encoding-index-singlebyte 1.20141219.5 +;; encoding-index-tradchinese 1.20141219.5 +;; encoding_index_tests 0.1 +;; float-cmp 0.5 +;; fragile 0.3 + ;("fuchsia-cprng" . #+(package-source rust-fuchsia-cpr= ng-0.1)) +;; futf 0.1 +;; gdk-pixbuf 0.7 +;; gdk-pixbuf-sys 0.9 +;; generic-array 0.12 +;; gio 0.7 +;; gio-sys 0.9 +;; glib 0.8 +;; glib-sys 0.9 +;; gobject-sys 0.9 +;; idna 0.2 +;; itertools 0.8 + ("itoa" . #+(package-source rust-itoa-0.4)) + ;("language-tags" . #+(package-source rust-language-ta= gs-0.2)) + ("lazy_static" . #+(package-source rust-lazy-static-1.= 3)) + ("libc" . #+(package-source rust-libc-0.2)) +;; libm 0.1 +;; locale_config 0.3 + ("log" . #+(package-source rust-log-0.4)) +;; mac 0.1 +;; malloc_buf 0.0 +;; markup5ever 0.9 + ;("matches" . #+(package-source rust-matches-0.1)) +;; matrixmultiply 0.2 +;; memchr 2.2 +;; memoffset 0.5 +;; nalgebra 0.18 +;; new_debug_unreachable 1.0 + ("nodrop" . #+(package-source rust-nodrop-0.1)) +;; num-complex 0.2 + ("num-integer" . #+(package-source rust-num-integer-0.= 1)) +;; num-rational 0.2 + ("num-traits" . #+(package-source rust-num-traits-0.2)) + ("num_cpus" . #+(package-source rust-num-cpus-1.10)) +;; objc 0.2 +;; objc-foundation 0.1 +;; objc_id 0.1 +;; pango 0.7 +;; pango-sys 0.9 +;; pangocairo 0.8 +;; pangocairo-sys 0.10 + ("percent-encoding" . #+(package-source rust-percent-e= ncoding-2.1)) +;; phf 0.7.24 +;; phf_codegen 0.7.24 +;; phf_generator 0.7.24 +;; phf_shared 0.7.24 + ;("pkg-config" . #+(package-source rust-pkg-config-0.3= )) +;; precomputed-hash 0.1 + ("proc-macro2" . #+(package-source rust-proc-macro2-1.= 0)) +;; procedural-masquerade 0.1 + ("quote" . #+(package-source rust-quote-1.0)) + ;("rand" . #+(package-source rust-rand-0.6)) + ("rand_chacha" . #+(package-source rust-rand-chacha-0.= 1)) + ("rand_core-0.3.1" . #+(package-source rust-rand-core-= 0.3)) + ("rand_core" . #+(package-source rust-rand-core-0.4)) + ("rand_hc" . #+(package-source rust-rand-hc-0.1)) + ("rand_isaac" . #+(package-source rust-rand-isaac-0.1)) + ("rand_jitter" . #+(package-source rust-rand-jitter-0.= 1)) + ("rand_os" . #+(package-source rust-rand-os-0.1)) + ("rand_pcg" . #+(package-source rust-rand-pcg-0.1)) + ("rand_xorshift" . #+(package-source rust-rand-xorshif= t-0.1)) +;; rand_xoshiro 0.1 + ;("rawpointer" . #+(package-source rust-rawpointer-0.1= )) +;; rayon 1.2 +;; rayon-core 1.6 +;; rctree 0.3 + ("rdrand" . #+(package-source rust-rdrand-0.4)) +;; regex 1.3 +;; regex-automata 0.1 + ;("regex-syntax" . #+(package-source rust-regex-syntax= -0.6)) +;; rustc_version 0.2 + ("ryu" . #+(package-source rust-ryu-1.0)) + ("same-file" . #+(package-source rust-same-file-1.0)) + ("scopeguard" . #+(package-source rust-scopeguard-1.0)) +;; semver 0.9 + ;("semver-parser" . #+(package-source rust-semver-pars= er-0.7)) + ("serde" . #+(package-source rust-serde-1.0)) + ("serde_derive" . #+(package-source rust-serde-derive-= 1.0)) + ("serde_json" . #+(package-source rust-serde-json-1.0)) +;; siphasher 0.2 +;; smallvec 0.6 +;; string_cache 0.7 +;; string_cache_codegen 0.4 +;; string_cache_shared 0.3 + ("syn" . #+(package-source rust-syn-1.0)) +;; tendril 0.4 + ("textwrap" . #+(package-source rust-textwrap-0.11)) + ;("thread_local" . #+(package-source rust-thread-local= -0.3)) +;; tinytemplate 1.0 + ;("typenum" . #+(package-source rust-typenum-1.10)) +;; unicode-bidi 0.3 +;; unicode-normalization 0.1 + ("unicode-width" . #+(package-source rust-unicode-widt= h-0.1)) + ("unicode-xid" . #+(package-source rust-unicode-xid-0.= 2)) +;; url 2.1 +;; utf-8 0.7 + ("walkdir" . #+(package-source rust-walkdir-2.2)) + ("winapi" . #+(package-source rust-winapi-0.3)) + ;("winapi-i686-pc-windows-gnu" . #+(package-source rus= t-winapi-i686-pc-windows-gnu-0.4)) + ("winapi-util" . #+(package-source rust-winapi-util-0.= 1)) + ;("winapi-x86_64-pc-windows-gnu" . #+(package-source r= ust-winapi-x86-64-pc-windows-gnu-0.4)) +;; xml-rs 0.8 + ))) + (format #t "Replacing vendored crates in the tarball and rep= acking ...~%") + (force-output) + (invoke "tar" "cfa" #$output + ;; Avoid non-determinism in the archive. We set the + ;; mtime of files in the archive to early 1980 becau= se + ;; the build process fails if the mtime of source + ;; files is pre-1980, due to the creation of zip + ;; archives. + "--mtime=3D@315619200" ; 1980-01-02 UTC + "--owner=3Droot:0" + "--group=3Droot:0" + "--sort=3Dname" + (string-append "librsvg-" #$version)) + #t))))))) + (define-public librsvg-next (package (name "librsvg") (version "2.46.3") - (source (origin - (method url-fetch) - (uri (string-append "mirror://gnome/sources/librsvg/" - (version-major+minor version) "/" - "librsvg-" version ".tar.xz")) - (sha256 - (base32 - "1s3a96i7f4pynjwxxvhysp4b6r7kyi8nasdxfyi62hc7gm34d3kn")))) + (source librsvg-next-source) (build-system gnu-build-system) (arguments `(#:configure-flags (list "--disable-static" "--enable-vala") ; needed for e.g. gnome-mines #:make-flags '("CC=3Dgcc") + #:imported-modules ,%cargo-utils-modules ;for `generate-all-checksu= ms' #:phases (modify-phases %standard-phases - ;; Don't patch anything in vendor/ to avoid having to recompute - ;; checksums for the bundled Cargo "crates". TODO: Unbundle thos= e. - (delete 'patch-source-shebangs) - (delete 'patch-generated-file-shebangs) - (delete 'patch-usr-bin-file) - (add-before 'configure 'patch-all-the-things + (add-after 'configure 'patch-cargo-checksums (lambda _ - (for-each patch-shebang '("tap-driver.sh" "tap-test")) - (patch-/usr/bin/file "configure") - (patch-makefile-SHELL "po/Makefile.in.in") - #t)) + (use-modules (guix build cargo-utils)) + (substitute* "librsvg/Cargo.toml" + (("bitflags .*") "bitflags =3D \"1\"\n")) ; 1.2 is vendored + (for-each + (lambda (filename) + (delete-file filename) + (let ((dir (dirname filename))) + (display (string-append + "patch-cargo-checksums: generate-checksums f= or " + dir "\n")) + (generate-checksums dir))) + (find-files "vendor" "\\.cargo(-checksum|_vcs_info).json")) + (delete-file "Cargo.lock") + (invoke "cargo" "generate-lockfile"))) (add-before 'configure 'pre-configure (lambda* (#:key inputs #:allow-other-keys) (substitute* "gdk-pixbuf-loader/Makefile.in" --10jrOL3x2xqLmOsH-- --Zs/RYxT/hKAHzkfQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl3RRGwACgkQQarn3Mo9 g1HnVA//bKpMqEaAZYSQ6b9acqOSJxKgdyM8z72y8P0EcrKXdGrcH3i2cJUe+0Si 64xT3bsMzn8P2FnOFbzp67yjhZIUFNp775ujihFBqR8rXvB+TT9Scn6yYVO61moB BcDhmuAhPep5SngteRNXBVabIdvG9JNOlhCFqZZHXcy2XmmVn+yVNN8Tyj2QFJXC h4WdBpKMMJJuW2npjfjkua9R4NhwOFZZ1Mf0bUgy1NmPyLHm8ELodgjuz7TaIGSG EsKsFQm36HIFrZVu5+spPQ6kzJ8LK9UzVG1CRRRk7n24rrOuA31yFbBPnBktYRc0 jcw9lDJZT+zulCAQaKwJU68Y8tTymoj0CTmimNSGLCLC7IETE0S4JHZedCx47/3u sd7wPnacc7wxT3SjnTlAybkNKg+mGrtPFmaJcfKO6bYbTAslWSCa1KOxN9y2/pWJ 21m7zr+DRT2hKqL9tT9UcsNIYeKfRCLlAtlr3LHTuF8q8QEeOCV3iahU++Vz2bpp vKoo4fU19mFDGtGXUi+N9q8zZU6dBOZ2SeTFmOwdsFl5IjCh+ZGdEBPrA2iv0/Ih yFGVIiZDUUAciWM1xEonufvSAFeL2T5WsRwMBznjRk3R9uiV7L+m8z4AHNnZVmYB /0JflNGLhOcrKFOFkCEpj1PcWMcs/fiH+5jOzblm3D3eom8PQ/Q= =URcx -----END PGP SIGNATURE----- --Zs/RYxT/hKAHzkfQ--