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.master
parent
397147aaad
commit
12e77c03bc
|
@ -1404,6 +1404,9 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/libmpeg2-global-symbol-test.patch \
|
||||
%D%/packages/patches/libmygpo-qt-fix-qt-5.11.patch \
|
||||
%D%/packages/patches/libmygpo-qt-missing-qt5-modules.patch \
|
||||
%D%/packages/patches/libpaper-free-systempapername.patch \
|
||||
%D%/packages/patches/libpaper-free-xdg-config-home.patch \
|
||||
%D%/packages/patches/libpaper-invalid-paperspecs.patch \
|
||||
%D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch \
|
||||
%D%/packages/patches/libquicktime-ffmpeg.patch \
|
||||
%D%/packages/patches/librecad-support-for-boost-1.76.patch \
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#:use-module (gnu packages cups)
|
||||
#:use-module (gnu packages fontutils)
|
||||
#:use-module (gnu packages image)
|
||||
#:use-module (gnu packages man)
|
||||
#:use-module (gnu packages perl)
|
||||
#:use-module (gnu packages pkg-config)
|
||||
#:use-module (gnu packages python)
|
||||
|
@ -74,45 +75,35 @@ Consortium standard (ICC), approved as ISO 15076-1.")
|
|||
|
||||
(define-public libpaper
|
||||
(package
|
||||
(name "libpaper")
|
||||
(version "1.1.24")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append
|
||||
;; Debian moved their libpaper-1.1.24 to archive.debian.net
|
||||
;; but in the move the hash of their tarball changed.
|
||||
"http://pkgs.fedoraproject.org/repo/pkgs/libpaper/libpaper_"
|
||||
version ".tar.gz/5bc87d494ba470aba54f6d2d51471834/libpaper_"
|
||||
version ".tar.gz"))
|
||||
(sha256 (base32
|
||||
"0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q"))))
|
||||
(build-system gnu-build-system)
|
||||
(native-inputs
|
||||
(list automake)) ; For up to date 'config.guess' and 'config.sub'.
|
||||
(arguments
|
||||
`(#:configure-flags '("--disable-static")
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(add-after 'unpack 'fix-configure
|
||||
(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
||||
;; Replace outdated config.sub and config.guess:
|
||||
(for-each (lambda (file)
|
||||
(install-file
|
||||
(string-append (assoc-ref
|
||||
(or native-inputs inputs) "automake")
|
||||
"/share/automake-"
|
||||
,(version-major+minor
|
||||
(package-version automake))
|
||||
"/" file) "."))
|
||||
'("config.sub" "config.guess"))
|
||||
#t)))))
|
||||
(synopsis "Library for handling paper sizes")
|
||||
(description
|
||||
"The paper library and accompanying files are intended to provide a simple
|
||||
(name "libpaper")
|
||||
(version "1.2.1")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://github.com/rrthomas/libpaper/releases"
|
||||
"/download/v" version "/libpaper-"
|
||||
version ".tar.gz"))
|
||||
(patches (search-patches "libpaper-free-xdg-config-home.patch"
|
||||
"libpaper-free-systempapername.patch"
|
||||
"libpaper-invalid-paperspecs.patch"))
|
||||
(sha256
|
||||
(base32
|
||||
"18m1yas7lihlyaxr0vpgy65bq9ri429wrm4sfxyhd5gj88gn16lr"))))
|
||||
(build-system gnu-build-system)
|
||||
(native-inputs
|
||||
(list help2man))
|
||||
(arguments
|
||||
'(#:configure-flags '("--disable-static"
|
||||
;; Tests require a relocatable build.
|
||||
"--enable-relocatable")))
|
||||
(outputs '("out" "debug"))
|
||||
(home-page "https://github.com/rrthomas/libpaper")
|
||||
(synopsis "Library for handling paper sizes")
|
||||
(description
|
||||
"The paper library and accompanying files are intended to provide a simple
|
||||
way for applications to take actions based on a system- or user-specified
|
||||
paper size.")
|
||||
(license license:gpl2)
|
||||
(home-page "https://packages.qa.debian.org/libp/libpaper.html")))
|
||||
;; The library is LGPL3+, everything else GPL3+.
|
||||
(license (list license:lgpl3+ license:gpl3+))))
|
||||
|
||||
(define-public psutils
|
||||
(package
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
Ensure backwards compatibility with libpaper 1.1 by returning a value that
|
||||
must be free()'d.
|
||||
|
||||
Taken from upstream:
|
||||
|
||||
https://github.com/rrthomas/libpaper/commit/9a4f7cdd6b749fd9d08ec92b6e3b434f7d322b6d
|
||||
|
||||
diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
|
||||
index aa86d06..19e3332 100644
|
||||
--- a/lib/libpaper.c.in.in
|
||||
+++ b/lib/libpaper.c.in.in
|
||||
@@ -316,9 +316,9 @@ const char *defaultpapername(void) {
|
||||
return paperstr;
|
||||
}
|
||||
|
||||
-/* Alias for defaultpapername. */
|
||||
+/* Alias for defaultpapername; its return value must be freed! */
|
||||
const char *systempapername(void) {
|
||||
- return defaultpapername();
|
||||
+ return strdup(defaultpapername());
|
||||
}
|
||||
|
||||
/* Get the default paper size. */
|
||||
diff --git a/lib/paper.h b/lib/paper.h
|
||||
index c940bed..fe5d4be 100644
|
||||
--- a/lib/paper.h
|
||||
+++ b/lib/paper.h
|
||||
@@ -123,8 +123,8 @@ const struct paper *defaultpaper(void);
|
||||
const char *defaultpapername(void);
|
||||
|
||||
/*
|
||||
- * Deprecated, only for backwards compatibility; an alias for
|
||||
- * defaultpapername().
|
||||
+ * Deprecated, only for backwards compatibility; does the same as
|
||||
+ * defaultpapername(), but returns a value that must be freed.
|
||||
*/
|
||||
const char *systempapername(void);
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
Free the xdg_config_home_variable only when needed.
|
||||
|
||||
Taken from upstream:
|
||||
|
||||
https://github.com/rrthomas/libpaper/commit/29e3e3800cfea738f12a9760290b92d5c199092b
|
||||
|
||||
diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
|
||||
index f7af1d7..aa86d06 100644
|
||||
--- a/lib/libpaper.c.in.in
|
||||
+++ b/lib/libpaper.c.in.in
|
||||
@@ -295,7 +295,6 @@ const char *defaultpapername(void) {
|
||||
|
||||
const char *paperstr = getenv("PAPERSIZE");
|
||||
if (paperstr == NULL && xdg_config_home != NULL) {
|
||||
- free_xdg_config_home = true;
|
||||
char *papersize = mfile_name_concat(xdg_config_home, PAPERSIZE_FILENAME, NULL);
|
||||
if (papersize != NULL) {
|
||||
paperstr = papernamefile(papersize);
|
||||
@@ -374,6 +373,7 @@ int paperinit(void)
|
||||
xdg_config_home = getenv("XDG_CONFIG_HOME");
|
||||
if (xdg_config_home == NULL) {
|
||||
char *home = getenv("HOME");
|
||||
+ free_xdg_config_home = true;
|
||||
xdg_config_home = mfile_name_concat(home, ".config", NULL);
|
||||
if (xdg_config_home == NULL)
|
||||
return PAPER_NOMEM;
|
||||
@@ -409,8 +409,10 @@ int paperdone(void)
|
||||
{
|
||||
if (initialized) {
|
||||
free(sysconfdir);
|
||||
+ sysconfdir = NULL;
|
||||
if (free_xdg_config_home)
|
||||
free(xdg_config_home);
|
||||
+ xdg_config_home = NULL;
|
||||
initialized = false;
|
||||
}
|
||||
return PAPER_OK;
|
|
@ -0,0 +1,97 @@
|
|||
Handle invalid paper specifications.
|
||||
|
||||
Taken from upstream:
|
||||
|
||||
https://github.com/rrthomas/libpaper/commit/24bcaa54e2813683404e3e13a4fedd47f3e4d614
|
||||
|
||||
diff --git a/lib/libpaper.c.in.in b/lib/libpaper.c.in.in
|
||||
index 19e3332..c68a936 100644
|
||||
--- a/lib/libpaper.c.in.in
|
||||
+++ b/lib/libpaper.c.in.in
|
||||
@@ -164,10 +164,8 @@ const struct paper *papernext(const struct paper *paper)
|
||||
}
|
||||
|
||||
/* Constructor. */
|
||||
-static int readspecs(struct paper **papers_list, const char *specsfile, struct paper **last) {
|
||||
- paper_lineno = 0;
|
||||
- free(paper_specsfile);
|
||||
- paper_specsfile = strdup(specsfile);
|
||||
+static int readspecs(struct paper **papers_list, const char *specsfile, struct paper **last, size_t *lineno) {
|
||||
+ *lineno = 0;
|
||||
char *old_locale = setlocale(LC_ALL, NULL);
|
||||
if (old_locale != NULL)
|
||||
old_locale = strdup(old_locale);
|
||||
@@ -178,7 +176,7 @@ static int readspecs(struct paper **papers_list, const char *specsfile, struct p
|
||||
struct paper *prev = *papers_list, *p;
|
||||
size_t n;
|
||||
char *l;
|
||||
- for (paper_lineno = 1, l = NULL; getline(&l, &n, ps) > 0; prev = p, paper_lineno++) {
|
||||
+ for (*lineno = 1, l = NULL; getline(&l, &n, ps) > 0; prev = p, (*lineno)++) {
|
||||
char *saveptr;
|
||||
char *name = gettok(l, &saveptr);
|
||||
char *wstr = gettok(NULL, &saveptr), *hstr = gettok(NULL, &saveptr);
|
||||
@@ -350,6 +348,8 @@ int paperinit(void)
|
||||
return PAPER_OK;
|
||||
initialized = true;
|
||||
|
||||
+ int ret = PAPER_OK;
|
||||
+
|
||||
/* Read system paperspecs. */
|
||||
struct paper *system_papers = NULL;
|
||||
sysconfdir = alloc_relocate("@sysconfdir@");
|
||||
@@ -357,12 +357,9 @@ int paperinit(void)
|
||||
char *system_paperspecs = mfile_name_concat(sysconfdir, PAPERSPECS_FILENAME, NULL);
|
||||
if (system_paperspecs == NULL)
|
||||
return PAPER_NOMEM;
|
||||
- int ret = readspecs(&system_papers, system_paperspecs, NULL);
|
||||
- free(system_paperspecs);
|
||||
- if (ret != PAPER_OK) {
|
||||
- paperdone();
|
||||
- return ret;
|
||||
- }
|
||||
+ ret = readspecs(&system_papers, system_paperspecs, NULL, &paper_lineno);
|
||||
+ free(paper_specsfile);
|
||||
+ paper_specsfile = system_paperspecs;
|
||||
}
|
||||
|
||||
/* Set default paper to first system paper, if any. */
|
||||
@@ -381,11 +378,15 @@ int paperinit(void)
|
||||
char *user_paperspecs = mfile_name_concat(xdg_config_home, PAPERSPECS_FILENAME, NULL);
|
||||
struct paper *last_paper = NULL;
|
||||
if (user_paperspecs != NULL) {
|
||||
- int ret = readspecs(&papers, user_paperspecs, &last_paper);
|
||||
- free(user_paperspecs);
|
||||
- if (ret != PAPER_OK) {
|
||||
- paperdone();
|
||||
- return ret;
|
||||
+ size_t user_lineno;
|
||||
+ int user_ret = readspecs(&papers, user_paperspecs, &last_paper, &user_lineno);
|
||||
+ if (ret == PAPER_OK) {
|
||||
+ ret = user_ret;
|
||||
+ free(user_paperspecs);
|
||||
+ } else if (paper_lineno == 0) {
|
||||
+ free(paper_specsfile);
|
||||
+ paper_specsfile = user_paperspecs;
|
||||
+ paper_lineno = user_lineno;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,13 +396,16 @@ int paperinit(void)
|
||||
default_paper = papers;
|
||||
|
||||
/* Concatenate system papers to user papers. */
|
||||
- last_paper->next = system_papers;
|
||||
+ if (last_paper != NULL)
|
||||
+ last_paper->next = system_papers;
|
||||
+ else
|
||||
+ last_paper = system_papers;
|
||||
}
|
||||
|
||||
if (papers == NULL) /* System papers are all we have. */
|
||||
papers = system_papers;
|
||||
|
||||
- return PAPER_OK;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/* Shut down the library. */
|
|
@ -8,7 +8,7 @@
|
|||
;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
|
||||
;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
|
||||
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
||||
;;; Copyright © 2017, 2020, 2021 Marius Bakke <marius@gnu.org>
|
||||
;;; Copyright © 2017, 2020-2022 Marius Bakke <marius@gnu.org>
|
||||
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
|
||||
;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
|
||||
;;; 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.
|
|||
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(add-after 'unpack 'patch-psutils-test
|
||||
(lambda _
|
||||
;; This test fails due to a rounding difference with libpaper 1.2:
|
||||
;; https://github.com/rrthomas/libpaper/issues/23
|
||||
;; Adjust the expected outcome to account for the minute difference.
|
||||
(substitute* "texk/psutils/tests/playres.ps"
|
||||
(("844\\.647799")
|
||||
"844.647797"))))
|
||||
(add-after 'unpack 'configure-ghostscript-executable
|
||||
;; ps2eps.pl uses the "gswin32c" ghostscript executable on Windows,
|
||||
;; and the "gs" ghostscript executable on Unix. It detects Unix by
|
||||
|
|
Reference in New Issue