Date: Sunday, February 12, 2023 @ 21:27:50 Author: andyrtr Revision: 468683
upgpkg: libpaper 2.0.8-1: upstream update 2.0.8; move to new upstream reposotory replacing the unmaintained Debian libpaper1 - also replaces paper package Added: libpaper/trunk/localepaper.c Modified: libpaper/trunk/PKGBUILD ---------------+ PKGBUILD | 51 ++++++++++++++++++++++++++++++++++----------------- localepaper.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 17 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2023-02-12 21:06:34 UTC (rev 468682) +++ PKGBUILD 2023-02-12 21:27:50 UTC (rev 468683) @@ -5,21 +5,26 @@ # Contributor: royrocks <[email protected]> pkgname=libpaper -pkgver=1.1.28 -pkgrel=2 -pkgdesc='Library for handling paper characteristics' +pkgver=2.0.8 +pkgrel=1 +pkgdesc="Library for handling paper characteristics" arch=('x86_64') -url='https://packages.debian.org/unstable/source/libpaper' -license=('GPL') -depends=('sh' 'run-parts') +url="https://github.com/rrthomas/libpaper" +license=('LGPL2.1' 'GPL3') +depends=('glibc') backup=('etc/papersize') -#source=("https://debian.org/debian/pool/main/libp/$pkgname/${pkgname}_$pkgver+nmu5.tar.gz") # broken cert -source=("http://ftp.de.debian.org/debian/pool/main/libp/$pkgname/${pkgname}_$pkgver.tar.gz") -sha256sums=('c8bb946ec93d3c2c72bbb1d7257e90172a22a44a07a07fb6b802a5bb2c95fddc') +source=(https://github.com/rrthomas/libpaper/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz + localepaper.c) +sha256sums=('e543bdfdcdd8935e09da6a0ebc1ea154ee565055bc06cc936631ee49fc8baf5f' + '7e49c6ce67fbaea77929ab5849026412d0f91f692a902805c0134a071cccde22') +provides=('paper') +replaces=('paper') +conflicts=('paper') prepare() { cd "$pkgname-$pkgver" - autoreconf -vfi + cp ../localepaper.c src/ + #autoreconf -vfi } build() { @@ -29,12 +34,24 @@ --sysconfdir=/etc \ --sbindir=/usr/bin make + # localepaper + pushd src + gcc $CFLAGS -I.. -Ilibgnu -o localepaper localepaper.c libgnu/.libs/libgnupaper.a + popd } +check() { + cd "$pkgname-$pkgver" + make -k check +} package() { cd "$pkgname-$pkgver" make DESTDIR="$pkgdir" install + # localepaper + install -Dt "$pkgdir/usr/lib" -m0755 src/localepaper + + # add systemwide default papersize read by many office applications install -dm 755 "$pkgdir"/etc echo '# Simply write the paper name. See papersize(5) for possible values' > "$pkgdir"/etc/papersize @@ -42,11 +59,11 @@ # add libpaper.d directory other packages can use to store files install -dm 755 "$pkgdir"/etc/libpaper.d - # add localisation - pushd debian/po - for i in `ls *.po`; do - install -dm 755 "${pkgdir}"/usr/share/locale/${i%.po}/LC_MESSAGES/; - msgfmt $i -o "${pkgdir}"/usr/share/locale/${i%.po}/LC_MESSAGES/${pkgname}.mo; - done - popd + # currently no localisation available +# pushd debian/po +# for i in `ls *.po`; do +# install -dm 755 "${pkgdir}"/usr/share/locale/${i%.po}/LC_MESSAGES/; +# msgfmt $i -o "${pkgdir}"/usr/share/locale/${i%.po}/LC_MESSAGES/${pkgname}.mo; +# done +# popd } Added: localepaper.c =================================================================== --- localepaper.c (rev 0) +++ localepaper.c 2023-02-12 21:27:50 UTC (rev 468683) @@ -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 <[email protected]>, 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 <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <locale.h> +#if defined LC_PAPER && defined _GNU_SOURCE +#include <langinfo.h> +#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 +}
