diff --git a/hardware/printer/libpaper/actions.py b/hardware/printer/libpaper/actions.py index 03ec10baf4..ebd863b013 100644 --- a/hardware/printer/libpaper/actions.py +++ b/hardware/printer/libpaper/actions.py @@ -19,9 +19,14 @@ def setup(): def build(): autotools.make() + shelltools.cd("src") + shelltools.system("gcc $CFLAGS $LDFLAGS -I.. -Ilibgnu -o localepaper localepaper.c libgnu/.libs/libgnupaper.a") + def install(): autotools.install() + pisitools.dolib("src/localepaper") + for lang in shelltools.ls("debian/po/*.po"): pisitools.domo(lang, shelltools.baseName(lang).replace(".po", ""), "libpaper.mo") diff --git a/hardware/printer/libpaper/files/fedora/localepaper.c b/hardware/printer/libpaper/files/fedora/localepaper.c new file mode 100644 index 0000000000..78404a3707 --- /dev/null +++ b/hardware/printer/libpaper/files/fedora/localepaper.c @@ -0,0 +1,44 @@ +/* + * localepaper: print the dimensions in mm of the current locale's + * paper size, if possible. + * + * Based on a patch by Caolan McNamara: + * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=481213 + * + * Copyright (C) Reuben Thomas , 2013. + * + * Copying and distribution of this file, with or without modification, + * are permitted in any medium without royalty provided the copyright + * notice and this notice are preserved. + */ + +#include + +#include +#include +#include +#if defined LC_PAPER && defined _GNU_SOURCE +#include +#endif + +#include "progname.h" + +int main(int argc, char *argv[]) +{ + set_program_name(argv[0]); + argc = argc; /* Avoid a compiler warning. */ + +#if defined LC_PAPER && defined _GNU_SOURCE + setlocale(LC_ALL, ""); + +#define NL_PAPER_GET(x) \ + ((union { char *string; unsigned word; })nl_langinfo(x)).word + + printf("%d %d\n", NL_PAPER_GET(_NL_PAPER_WIDTH), NL_PAPER_GET(_NL_PAPER_HEIGHT)); + return EXIT_SUCCESS; + +#else + printf("%s: locale paper size information is not supported on this system", program_name); + return EXIT_FAILURE; +#endif +} diff --git a/hardware/printer/libpaper/pspec.xml b/hardware/printer/libpaper/pspec.xml index 88068a30f6..8147b46ed5 100644 --- a/hardware/printer/libpaper/pspec.xml +++ b/hardware/printer/libpaper/pspec.xml @@ -12,7 +12,10 @@ library Library for handling paper characteristics Libpaper is a programming library for handling paper characteristics. - http://ftp.debian.org/debian/pool/main/libp/libpaper/libpaper_1.1.28.tar.gz + https://github.com/rrthomas/libpaper/releases/download/v2.1.1/libpaper-2.1.1.tar.gz + + fedora/localepaper.c + @@ -21,6 +24,9 @@ libpaper + + paper + /usr/bin /usr/sbin @@ -48,6 +54,13 @@ + + 2023-07-28 + 2.1.1 + Version bump. + Mustafa Cinasal + muscnsl@gmail.com + 2021-07-16 1.1.28