summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-07-06 22:45:54 +0200
committerMarius Bakke <marius@gnu.org>2022-07-16 23:25:17 +0200
commit12e77c03bcc41c143157d12d75d9b8a94457019d (patch)
tree5a53b7b03e025680af6a953ff4b1c885967d0d39
parent397147aaad2e5d357479c0ff3ac3042432e320ae (diff)
gnu: libpaper: Update to 1.2.1.
* gnu/packages/ghostscript.scm (libpaper): Update to 1.2.1. [source]: Switch to currently maintained fork. [home-page]: Likewise. [arguments]: Remove #:phases. Add "--enable-relocatable" to #:configure-flags. [native-inputs]: Remove AUTOMAKE. Add HELP2MAN. [outputs]: Add "debug". * gnu/packages/tex.scm (texlive-bin)[arguments]: Add phase to patch test expected test result with libpaper 1.2. * gnu/packages/patches/libpaper-free-systempapername.patch, gnu/packages/patches/libpaper-free-xdg-config-home.patch, gnu/packages/patches/libpaper-invalid-paperspecs.patch: New files. * gnu/local.mk (dist_patch_DATA): Adjust accordingly.
-rw-r--r--gnu/local.mk3
-rw-r--r--gnu/packages/ghostscript.scm65
-rw-r--r--gnu/packages/patches/libpaper-free-systempapername.patch38
-rw-r--r--gnu/packages/patches/libpaper-free-xdg-config-home.patch37
-rw-r--r--gnu/packages/patches/libpaper-invalid-paperspecs.patch97
-rw-r--r--gnu/packages/tex.scm10
6 files changed, 212 insertions, 38 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 0d977d1f49c..65d23fd1208 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1404,6 +1404,9 @@ dist_patch_DATA = \
1404 %D%/packages/patches/libmpeg2-global-symbol-test.patch \ 1404 %D%/packages/patches/libmpeg2-global-symbol-test.patch \
1405 %D%/packages/patches/libmygpo-qt-fix-qt-5.11.patch \ 1405 %D%/packages/patches/libmygpo-qt-fix-qt-5.11.patch \
1406 %D%/packages/patches/libmygpo-qt-missing-qt5-modules.patch \ 1406 %D%/packages/patches/libmygpo-qt-missing-qt5-modules.patch \
1407 %D%/packages/patches/libpaper-free-systempapername.patch \
1408 %D%/packages/patches/libpaper-free-xdg-config-home.patch \
1409 %D%/packages/patches/libpaper-invalid-paperspecs.patch \
1407 %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch \ 1410 %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch \
1408 %D%/packages/patches/libquicktime-ffmpeg.patch \ 1411 %D%/packages/patches/libquicktime-ffmpeg.patch \
1409 %D%/packages/patches/librecad-support-for-boost-1.76.patch \ 1412 %D%/packages/patches/librecad-support-for-boost-1.76.patch \
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index ca522e52abe..060fc43a1ac 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -33,6 +33,7 @@
33 #:use-module (gnu packages cups) 33 #:use-module (gnu packages cups)
34 #:use-module (gnu packages fontutils) 34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages image) 35 #:use-module (gnu packages image)
36 #:use-module (gnu packages man)
36 #:use-module (gnu packages perl) 37 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config) 38 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python) 39 #:use-module (gnu packages python)
@@ -74,45 +75,35 @@ Consortium standard (ICC), approved as ISO 15076-1.")
74 75
75(define-public libpaper 76(define-public libpaper
76 (package 77 (package
77 (name "libpaper") 78 (name "libpaper")
78 (version "1.1.24") 79 (version "1.2.1")
79 (source (origin 80 (source (origin
80 (method url-fetch) 81 (method url-fetch)
81 (uri (string-append 82 (uri (string-append "https://github.com/rrthomas/libpaper/releases"
82 ;; Debian moved their libpaper-1.1.24 to archive.debian.net 83 "/download/v" version "/libpaper-"
83 ;; but in the move the hash of their tarball changed. 84 version ".tar.gz"))
84 "http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_" 85 (patches (search-patches "libpaper-free-xdg-config-home.patch"
85 version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_" 86 "libpaper-free-systempapername.patch"
86 version ".tar.gz")) 87 "libpaper-invalid-paperspecs.patch"))
87 (sha256 (base32 88 (sha256
88 "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q")))) 89 (base32
89 (build-system gnu-build-system) 90 "18m1yas7lihlyaxr0vpgy65bq9ri429wrm4sfxyhd5gj88gn16lr"))))
90 (native-inputs 91 (build-system gnu-build-system)
91 (list automake)) ; For up to date 'config.guess' and 'config.sub'. 92 (native-inputs
92 (arguments 93 (list help2man))
93 `(#:configure-flags '("--disable-static") 94 (arguments
94 #:phases 95 '(#:configure-flags '("--disable-static"
95 (modify-phases %standard-phases 96 ;; Tests require a relocatable build.
96 (add-after 'unpack 'fix-configure 97 "--enable-relocatable")))
97 (lambda* (#:key inputs native-inputs #:allow-other-keys) 98 (outputs '("out" "debug"))
98 ;; Replace outdated config.sub and config.guess: 99 (home-page "https://github.com/rrthomas/libpaper")
99 (for-each (lambda (file) 100 (synopsis "Library for handling paper sizes")
100 (install-file 101 (description
101 (string-append (assoc-ref 102 "The paper library and accompanying files are intended to provide a simple
102 (or native-inputs inputs) "automake")
103 "/share/automake-"
104 ,(version-major+minor
105 (package-version automake))
106 "/" file) "."))
107 '("config.sub" "config.guess"))
108 #t)))))
109 (synopsis "Library for handling paper sizes")
110 (description
111 "The paper library and accompanying files are intended to provide a simple
112way for applications to take actions based on a system- or user-specified 103way for applications to take actions based on a system- or user-specified
113paper size.") 104paper size.")
114 (license license:gpl2) 105 ;; The library is LGPL3+, everything else GPL3+.
115 (home-page "https://packages.qa.debian.org/libp/libpaper.html"))) 106 (license (list license:lgpl3+ license:gpl3+))))
116 107
117(define-public psutils 108(define-public psutils
118 (package 109 (package
diff --git a/gnu/packages/patches/libpaper-free-systempapername.patch b/gnu/packages/patches/libpaper-free-systempapername.patch
new file mode 100644
index 00000000000..12fea8ee103
--- /dev/null
+++ b/gnu/packages/patches/libpaper-free-systempapername.patch
@@ -0,0 +1,38 @@
1Ensure backwards compatibility with libpaper 1.1 by returning a value that
2must be free()'d.
3
4Taken from upstream:
5
6 https://github.com/rrthomas/libpaper/commit/9a4f7cdd6b749fd9d08ec92b6e3b434f7d322b6d
7
8diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
9index aa86d06..19e3332 100644
10--- a/lib/libpaper.c.in.in
11+++ b/lib/libpaper.c.in.in
12@@ -316,9 +316,9 @@ const char *defaultpapername(void) {
13 return paperstr;
14 }
15
16-/* Alias for defaultpapername. */
17+/* Alias for defaultpapername; its return value must be freed! */
18 const char *systempapername(void) {
19- return defaultpapername();
20+ return strdup(defaultpapername());
21 }
22
23 /* Get the default paper size. */
24diff --git a/lib/paper.h b/lib/paper.h
25index c940bed..fe5d4be 100644
26--- a/lib/paper.h
27+++ b/lib/paper.h
28@@ -123,8 +123,8 @@ const struct paper *defaultpaper(void);
29 const char *defaultpapername(void);
30
31 /*
32- * Deprecated, only for backwards compatibility; an alias for
33- * defaultpapername().
34+ * Deprecated, only for backwards compatibility; does the same as
35+ * defaultpapername(), but returns a value that must be freed.
36 */
37 const char *systempapername(void);
38
diff --git a/gnu/packages/patches/libpaper-free-xdg-config-home.patch b/gnu/packages/patches/libpaper-free-xdg-config-home.patch
new file mode 100644
index 00000000000..79c3d8173d8
--- /dev/null
+++ b/gnu/packages/patches/libpaper-free-xdg-config-home.patch
@@ -0,0 +1,37 @@
1Free the xdg_config_home_variable only when needed.
2
3Taken from upstream:
4
5 https://github.com/rrthomas/libpaper/commit/29e3e3800cfea738f12a9760290b92d5c199092b
6
7diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
8index f7af1d7..aa86d06 100644
9--- a/lib/libpaper.c.in.in
10+++ b/lib/libpaper.c.in.in
11@@ -295,7 +295,6 @@ const char *defaultpapername(void) {
12
13 const char *paperstr = getenv("PAPERSIZE");
14 if (paperstr == NULL && xdg_config_home != NULL) {
15- free_xdg_config_home = true;
16 char *papersize = mfile_name_concat(xdg_config_home, PAPERSIZE_FILENAME, NULL);
17 if (papersize != NULL) {
18 paperstr = papernamefile(papersize);
19@@ -374,6 +373,7 @@ int paperinit(void)
20 xdg_config_home = getenv("XDG_CONFIG_HOME");
21 if (xdg_config_home == NULL) {
22 char *home = getenv("HOME");
23+ free_xdg_config_home = true;
24 xdg_config_home = mfile_name_concat(home, ".config", NULL);
25 if (xdg_config_home == NULL)
26 return PAPER_NOMEM;
27@@ -409,8 +409,10 @@ int paperdone(void)
28 {
29 if (initialized) {
30 free(sysconfdir);
31+ sysconfdir = NULL;
32 if (free_xdg_config_home)
33 free(xdg_config_home);
34+ xdg_config_home = NULL;
35 initialized = false;
36 }
37 return PAPER_OK;
diff --git a/gnu/packages/patches/libpaper-invalid-paperspecs.patch b/gnu/packages/patches/libpaper-invalid-paperspecs.patch
new file mode 100644
index 00000000000..29f1ca64a35
--- /dev/null
+++ b/gnu/packages/patches/libpaper-invalid-paperspecs.patch
@@ -0,0 +1,97 @@
1Handle invalid paper specifications.
2
3Taken from upstream:
4
5 https://github.com/rrthomas/libpaper/commit/24bcaa54e2813683404e3e13a4fedd47f3e4d614
6
7diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
8index 19e3332..c68a936 100644
9--- a/lib/libpaper.c.in.in
10+++ b/lib/libpaper.c.in.in
11@@ -164,10 +164,8 @@ const struct paper *papernext(const struct paper *paper)
12 }
13
14 /* Constructor. */
15-static int readspecs(struct paper **papers_list, const char *specsfile, struct paper **last) {
16- paper_lineno = 0;
17- free(paper_specsfile);
18- paper_specsfile = strdup(specsfile);
19+static int readspecs(struct paper **papers_list, const char *specsfile, struct paper **last, size_t *lineno) {
20+ *lineno = 0;
21 char *old_locale = setlocale(LC_ALL, NULL);
22 if (old_locale != NULL)
23 old_locale = strdup(old_locale);
24@@ -178,7 +176,7 @@ static int readspecs(struct paper **papers_list, const char *specsfile, struct p
25 struct paper *prev = *papers_list, *p;
26 size_t n;
27 char *l;
28- for (paper_lineno = 1, l = NULL; getline(&l, &n, ps) > 0; prev = p, paper_lineno++) {
29+ for (*lineno = 1, l = NULL; getline(&l, &n, ps) > 0; prev = p, (*lineno)++) {
30 char *saveptr;
31 char *name = gettok(l, &saveptr);
32 char *wstr = gettok(NULL, &saveptr), *hstr = gettok(NULL, &saveptr);
33@@ -350,6 +348,8 @@ int paperinit(void)
34 return PAPER_OK;
35 initialized = true;
36
37+ int ret = PAPER_OK;
38+
39 /* Read system paperspecs. */
40 struct paper *system_papers = NULL;
41 sysconfdir = alloc_relocate("@sysconfdir@");
42@@ -357,12 +357,9 @@ int paperinit(void)
43 char *system_paperspecs = mfile_name_concat(sysconfdir, PAPERSPECS_FILENAME, NULL);
44 if (system_paperspecs == NULL)
45 return PAPER_NOMEM;
46- int ret = readspecs(&system_papers, system_paperspecs, NULL);
47- free(system_paperspecs);
48- if (ret != PAPER_OK) {
49- paperdone();
50- return ret;
51- }
52+ ret = readspecs(&system_papers, system_paperspecs, NULL, &paper_lineno);
53+ free(paper_specsfile);
54+ paper_specsfile = system_paperspecs;
55 }
56
57 /* Set default paper to first system paper, if any. */
58@@ -381,11 +378,15 @@ int paperinit(void)
59 char *user_paperspecs = mfile_name_concat(xdg_config_home, PAPERSPECS_FILENAME, NULL);
60 struct paper *last_paper = NULL;
61 if (user_paperspecs != NULL) {
62- int ret = readspecs(&papers, user_paperspecs, &last_paper);
63- free(user_paperspecs);
64- if (ret != PAPER_OK) {
65- paperdone();
66- return ret;
67+ size_t user_lineno;
68+ int user_ret = readspecs(&papers, user_paperspecs, &last_paper, &user_lineno);
69+ if (ret == PAPER_OK) {
70+ ret = user_ret;
71+ free(user_paperspecs);
72+ } else if (paper_lineno == 0) {
73+ free(paper_specsfile);
74+ paper_specsfile = user_paperspecs;
75+ paper_lineno = user_lineno;
76 }
77 }
78
79@@ -395,13 +396,16 @@ int paperinit(void)
80 default_paper = papers;
81
82 /* Concatenate system papers to user papers. */
83- last_paper->next = system_papers;
84+ if (last_paper != NULL)
85+ last_paper->next = system_papers;
86+ else
87+ last_paper = system_papers;
88 }
89
90 if (papers == NULL) /* System papers are all we have. */
91 papers = system_papers;
92
93- return PAPER_OK;
94+ return ret;
95 }
96
97 /* Shut down the library. */
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 5207c787e9b..e22bff90e48 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -8,7 +8,7 @@
8;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be> 8;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
9;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net> 9;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
10;;; Copyright © 2017 Leo Famulari <leo@famulari.name> 10;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
11;;; Copyright © 2017, 2020, 2021 Marius Bakke <marius@gnu.org> 11;;; Copyright © 2017, 2020-2022 Marius Bakke <marius@gnu.org>
12;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> 12;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
13;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org> 13;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
14;;; Copyright © 2018, 2020 Arun Isaac <arunisaac@systemreboot.net> 14;;; Copyright © 2018, 2020 Arun Isaac <arunisaac@systemreboot.net>
@@ -361,6 +361,14 @@ files from LOCATIONS with expected checksum HASH. CODE is not currently in use.
361 361
362 #:phases 362 #:phases
363 (modify-phases %standard-phases 363 (modify-phases %standard-phases
364 (add-after 'unpack 'patch-psutils-test
365 (lambda _
366 ;; This test fails due to a rounding difference with libpaper 1.2:
367 ;; https://github.com/rrthomas/libpaper/issues/23
368 ;; Adjust the expected outcome to account for the minute difference.
369 (substitute* "texk/psutils/tests/playres.ps"
370 (("844\\.647799")
371 "844.647797"))))
364 (add-after 'unpack 'configure-ghostscript-executable 372 (add-after 'unpack 'configure-ghostscript-executable
365 ;; ps2eps.pl uses the "gswin32c" ghostscript executable on Windows, 373 ;; ps2eps.pl uses the "gswin32c" ghostscript executable on Windows,
366 ;; and the "gs" ghostscript executable on Unix. It detects Unix by 374 ;; and the "gs" ghostscript executable on Unix. It detects Unix by