diff options
author | Francesco Colista <fcolista@alpinelinux.org> | 2018-03-16 11:26:45 +0000 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2018-03-16 11:26:56 +0000 |
commit | 48aaa1d6b757959dd3d1ea49460df3ce197434ba (patch) | |
tree | 755d4e9a93dad988a4344e1aeb1f6d0aff422ac1 /testing/hylafaxplus | |
parent | 29db8fdc62a425024e5ec0cb4bf710a2b88ac2f6 (diff) | |
download | aports-48aaa1d6b757959dd3d1ea49460df3ce197434ba.tar.bz2 aports-48aaa1d6b757959dd3d1ea49460df3ce197434ba.tar.xz |
testing/hylafaxplus: new aport. Fixes #8659
Diffstat (limited to 'testing/hylafaxplus')
-rw-r--r-- | testing/hylafaxplus/APKBUILD | 99 | ||||
-rw-r--r-- | testing/hylafaxplus/hylafaxplus.confd | 29 | ||||
-rw-r--r-- | testing/hylafaxplus/hylafaxplus.initd | 176 | ||||
-rw-r--r-- | testing/hylafaxplus/musl-reg-startend.patch | 20 |
4 files changed, 324 insertions, 0 deletions
diff --git a/testing/hylafaxplus/APKBUILD b/testing/hylafaxplus/APKBUILD new file mode 100644 index 0000000000..9ab9cf9c0a --- /dev/null +++ b/testing/hylafaxplus/APKBUILD @@ -0,0 +1,99 @@ +# Contributor: Cameron Banta <cbanta@gmail.com> +# Maintainer: Cameron Banta <cbanta@gmail.com> +pkgname=hylafaxplus +_pkgname=hylafax +pkgver=5.5.9 +pkgrel=0 +pkgdesc="Making the Premier Open-Source Fax Management System Even Bette" +url="http://hylafax.sourceforge.net" +arch="all" +license="MIT" +# check/test not supported from upstream +options="!check" +depends="ghostscript bash tiff-tools" +makedepends="zlib-dev tiff-dev gettext-dev openldap-dev lcms2-dev jbig2dec-dev" +subpackages="$pkgname-doc $pkgname-lang" +source="https://downloads.sourceforge.net/hylafax/${_pkgname}-${pkgver}.tar.gz + $pkgname.initd + $pkgname.confd + musl-reg-startend.patch + " +builddir="$srcdir"/$_pkgname-$pkgver + +prepare() { + default_prepare +} + +build() { + cd "$builddir" + # the configure script does not handle ccache or distcc + export CC=gcc + export CXX=g++ + ./configure \ + --nointeractive \ + --disable-pam \ + --with-DIR_BIN=/usr/bin \ + --with-DIR_SBIN=/usr/sbin \ + --with-DIR_LIB=/usr/lib \ + --with-DIR_LIBEXEC=/usr/sbin \ + --with-DIR_LIBDATA=/var/spool/"$pkgname"/lib \ + --with-DIR_LOCALE=/usr/share/locale/"$pkgname" \ + --with-DIR_LOCKS=/var/lock \ + --with-DIR_MAN=/usr/share/man \ + --with-DIR_SPOOL=/var/spool/"$pkgname" \ + --with-DIR_HTML=/usr/share/doc/"$pkgname"/html \ + --with-PATH_IMPRIP="" \ + --with-SYSVINIT=no \ + --with-REGEX=yes \ + --with-LIBTIFF="-ltiff -lz" \ + --with-LIBINTL="-lintl" \ + --with-DSO=auto \ + --with-PATH_EGETTY=/bin/false \ + --with-PATH_VGETTY=/bin/false + + # parallel build breaks libfaxutil dso building + make -j1 +} + +package(){ + cd "$builddir" + # this makefile has issues installing, it doesn't use the standard + # install - but the following seems to work + mkdir -p "${pkgdir}"/usr/bin "${pkgdir}"/usr/sbin + mkdir -p "${pkgdir}"/usr/lib/"$pkgname" "${pkgdir}"/usr/share/man + mkdir -p "${pkgdir}"/usr/share/locale/$pkgname + mkdir -p "${pkgdir}"/var/spool/"$pkgname" + mkdir -p "${pkgdir}"/var/spool/"$pkgname"/lib + touch "${pkgdir}"/var/spool/"$pkgname"/lib/pagesizes + chown uucp:uucp "${pkgdir}"/var/spool/"$pkgname" + chmod 0600 "${pkgdir}"/var/spool/"$pkgname" + + make \ + BIN="${pkgdir}/usr/bin" \ + SBIN="${pkgdir}/usr/sbin" \ + LIBDIR="${pkgdir}/usr/lib" \ + LIB="${pkgdir}/usr/lib" \ + LIBEXEC="${pkgdir}/usr/sbin" \ + LIBDATA="${pkgdir}/var/spool/$pkgname"/lib \ + MAN="${pkgdir}/usr/share/man" \ + LOCALEDIR="${pkgdir}/usr/share/locale/$pkgname" \ + SPOOL="${pkgdir}/var/spool/$pkgname" \ + HTMLDIR="${pkgdir}/usr/share/doc/$pkgname/html" \ + install + + install -m644 -D "$srcdir/$_pkgname-$pkgver/COPYRIGHT" \ + "$pkgdir"/usr/share/licenses/$pkgname/COPYRIGHT + install -m644 -D "$srcdir/$_pkgname-$pkgver/README" \ + "$pkgdir"/usr/share/doc/$pkgname/README + + install -D -m755 "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname + install -D -m644 "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname + +} + +sha512sums="67ac84df2619db7fb88cd7ad3af4beff9918b2481fc8edf7cc7574941161dd7aa6186cfc49c6cdb2a1f073f6cbf2f2a4ed084ca70ebe288bf7cd8e752cd56b2d hylafax-5.5.9.tar.gz +3862cefcd26092000e4489c097537e5e0e2ae1f7c2a7a16b1e933b3bb78d136b6d8a65fb712ae245dd8ca881900408d0d9788bd2e0b859a9569fc6f4ede8cc7c hylafaxplus.initd +3c07726cc9d7351dceb80a46354c6626e54b033b0f434c1db01db2a3b3ab5e9084d551dd23cae3ab40806f27aa5fa0a5b70c43a6b7802356871c0b343baa2376 hylafaxplus.confd +be6e9f9d86340c63919aaf158c92d541904f2567b78ad2742a041f86333549b66715f108012de9a968b78bcdada8f94aa98320cda69724bf518ff3efbdf00f32 musl-reg-startend.patch" diff --git a/testing/hylafaxplus/hylafaxplus.confd b/testing/hylafaxplus/hylafaxplus.confd new file mode 100644 index 0000000000..e82610fe0b --- /dev/null +++ b/testing/hylafaxplus/hylafaxplus.confd @@ -0,0 +1,29 @@ +# Spool directory for HylaFAX +spooldir="/var/spool/hylafax" + +# Faxq program path +faxq="/usr/sbin/faxq" + +# hfaxd program path +hfaxd="/usr/sbin/hfaxd" + +# faxgetty program path +faxgetty="/usr/sbin/faxgetty" + +# Port of the hfaxd daemon for new protocol +faxport=hylafax + +# Address used by hfaxd as binding address. +faxbind="127.0.0.1" + +# Port of the hfaxd daemon for SNPP protocol +snppport=444 + +# Port of the hfaxd daemon for old protocol +oldprotoport=4557 + +# newproto | oldproto | snpp | any +mode="newproto" + +# Directory where the pidfiles of HylaFAX are saved. +piddir="/var/run" diff --git a/testing/hylafaxplus/hylafaxplus.initd b/testing/hylafaxplus/hylafaxplus.initd new file mode 100644 index 0000000000..d5c5df37f4 --- /dev/null +++ b/testing/hylafaxplus/hylafaxplus.initd @@ -0,0 +1,176 @@ +#!/sbin/openrc-run +# Copyright 1999-2008 Gentoo Foundation +# Author Geaaru +# Distributed under the terms of the GNU General Public License v2 + +opts="zap" + +depend() { + use lo +} + +checkconfig() { + ebegin "Check hylafax server configuration..." + + if [ x$spooldir == x ] ; then + eerror "No spooldir directory defined" + return 1 + else + SPOOL=$spooldir + einfo "Use spool directory $SPOOL" + fi + + if [ x$mode == x ] ; then + eerror "No mode defined" + return 1 + fi + + if [ ! -f $SPOOL/etc/setup.cache ] ; then + eerror "No $SPOOL/etc/setup.cache file founded. Use faxsetup command" + return 1 + fi + + if [[ x$hfaxd == x || ! -f $hfaxd ]] ; then + eerror "No hfaxd daemon founded" + return 1 + fi + + if [[ x$faxq == x || ! -f $faxq ]] ; then + eerror "No faxq program founded" + return 1 + fi + + if [[ x$faxgetty == x || ! -f $faxgetty ]] ; then + eerror "No faxgetty program founded" + return 1 + fi + + if [ x$faxbind == x ] ; then + eerror "No binding address supply" + return 1 + fi + + if [ x$piddir == x ] ; then + PIDDIR=$SPOOL + else + PIDDIR=$piddir + fi + + + hfaxd_args="-l $faxbind -q $SPOOL" + + case $mode in + newproto) + if [[ x$faxport == x ]] ; then + eerror "No faxport defined" + return 1 + fi + hfaxd_args="$hfaxd_args -i $faxport" + ;; + oldproto) + if [[ x$oldprotoport == x ]] ; then + eerror "No oldprotoport defined" + return 1 + fi + hfaxd_args="$hfaxd_args -o $oldprotoport" + ;; + snpp) + if [[ x$snppport == x ]] ; then + eerror "No snppport defined" + return 1 + fi + hfaxd_args="$hfaxd_args -s $snppport" + ;; + any) + if [[ x$faxport == x || x$snppport == x || x$oldprotoport == x ]] ; then + eerror "No port data founded for old services" + return 1 + fi + hfaxd_args="$hfaxd_args -i $faxport -s $snppport -o $oldprotoport" + ;; + *) + eerror "Invalid mode" + return 1 + ;; + + esac + + faxq_args="-q $SPOOL" + + # workaround for manage save of pidfile with start-stop-daemon + hfaxd_args="$hfaxd_args -d" + faxq_args="$faxq_args -D" + + return 0 +} + +start() { + local result + + checkconfig || return 1 + + ebegin "Starting HylaFAX server daemons" + + start_faxq + result=$? + + if [ $result -ne 0 ] ; then + eerror "Error on start $faxq daemon" + return 1 + fi + + start_hfaxd + result=$? + + eend $result +} + +start_hfaxd() { + local arguments="--start \ + --make-pidfile --pidfile $PIDDIR/hfaxd.pid" + + einfo "Starting $hfaxd with args $hfaxd_args" + + start-stop-daemon -b ${arguments} --exec $hfaxd -- $hfaxd_args > /dev/null 2>&1 + + return $?; +} + +start_faxq() { + local arguments="--start \ + --make-pidfile --pidfile $PIDDIR/faxq.pid" + einfo "Starting $faxq ... " + + start-stop-daemon -b ${arguments} --exec $faxq -- $faxq_args > /dev/null 2>&1 + + return $? +} + +stop() { + checkconfig || return 1 + + ebegin "Stopping HylaFAX server daemons" + + start-stop-daemon --stop --quiet --pidfile $PIDDIR/hfaxd.pid + start-stop-daemon --stop --quiet --pidfile $PIDDIR/faxq.pid + eend $? +} + +zap() { + checkconfig || return 1 + + ebegin "Zap HylaFAX server daemon files" + + if [ -f $PIDFILE/hfaxd.pid ] ; then + rm -f $PIDFILE/hfaxd.pid + fi + + if [ -f $PIDFILE/faxq.pid ] ; then + rm -f $PIDFILE/faxq.pid + fi +} + +restart() { + stop + start +} diff --git a/testing/hylafaxplus/musl-reg-startend.patch b/testing/hylafaxplus/musl-reg-startend.patch new file mode 100644 index 0000000000..f101a83d95 --- /dev/null +++ b/testing/hylafaxplus/musl-reg-startend.patch @@ -0,0 +1,20 @@ +diff --git a/util/RE.c++ b/util/RE.c++ +index 77150e8..6a11b1c 100644 +--- a/util/RE.c++ ++++ b/util/RE.c++ +@@ -77,8 +77,13 @@ RE::Find(const char* text, u_int length, u_int off) + else { + matches[0].rm_so = off; + matches[0].rm_eo = length; +- execResult = regexec(&c_pattern, text, c_pattern.re_nsub+1, +- matches, REG_STARTEND); ++ char newtext[length-off+1]; ++ strncpy(newtext,&text[off],length-off); ++ newtext[length-off]='\0'; ++ execResult = regexec(&c_pattern, newtext, c_pattern.re_nsub+1, ++ matches, 0x0); ++ for (int j=0;j<c_pattern.re_nsub+1;j++) ++ matches[j].rm_so+=off, matches[j].rm_eo+=off; + } + } + return (execResult == 0); |