Date: Saturday, January 28, 2012 @ 21:46:41
  Author: eric
Revision: 147949

upgpkg: hylafax 6.0.5-3

Rebuild against libpng 1.5 and libtiff 4.0, Remove necessity to build as root, 
Make .install script quieter

Added:
  hylafax/trunk/hylafax-libtiff4.patch
Modified:
  hylafax/trunk/PKGBUILD
  hylafax/trunk/hylafax.install

------------------------+
 PKGBUILD               |   30 +-----
 hylafax-libtiff4.patch |  229 +++++++++++++++++++++++++++++++++++++++++++++++
 hylafax.install        |   18 ++-
 3 files changed, 248 insertions(+), 29 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2012-01-28 21:21:33 UTC (rev 147948)
+++ PKGBUILD    2012-01-29 02:46:41 UTC (rev 147949)
@@ -2,7 +2,7 @@
 # Maintainer: Paul Mattal <[email protected]>
 pkgname=hylafax
 pkgver=6.0.5
-pkgrel=2
+pkgrel=3
 pkgdesc="Fax Server"
 arch=('i686' 'x86_64')
 install='hylafax.install'
@@ -17,44 +17,32 @@
         hylafax 
         hylafax.cron.daily 
         config.local
-        configure-6.0.5.patch)
+        configure-6.0.5.patch 
+        hylafax-libtiff4.patch)
 md5sums=('eb9ac942354ad708e20e4583cec6615f'
          '6602288a405324d8c8e3c5eac2bf19fd'
          '52beffe7dc296b4f9ce9fd0387f7804e'
          '0d2ce24d918226a852539aebf57d3f4a'
-         '51d9f639bb76e5e39cdc8e2ac07e208d')
+         '51d9f639bb76e5e39cdc8e2ac07e208d'
+         '3d239c186f24720e945508d349b069b1')
 
-# build as root for successful build!
 build() {
-  uucp_created=0
-  if ! grep 'uucp' /etc/passwd > /dev/null; then
-    uucp_created=1
-    groupadd -g 14 uucp &>/dev/null
-    useradd -u 10 -g uucp -d '/' -s /bin/false uucp &>/dev/null
-    useradd -u 69 -g daemon -d '/' -s /bin/false fax &>/dev/null
-  fi
-  mkdir -p "$pkgdir"/usr/{bin,lib/fax,sbin,share/ghostscript/fonts}
-  mkdir -p "$pkgdir"/var/{spool/hylafax,lock}
-  "cd $srcdir/${pkgname}-${pkgver}"
-
+  cd "$srcdir/${pkgname}-${pkgver}"
   cp ../config.local .
   # fix compiling
   patch -Np0 -i ../configure-6.0.5.patch
+  patch -Np1 -i ../hylafax-libtiff4.patch
   ./configure --nointeractive --with-OPTIMIZER="${CFLAGS}"
   make
 }
 
 package () {
   cd "$srcdir/${pkgname}-${pkgver}"
+  mkdir -p "$pkgdir"/usr/{bin,lib/fax,sbin,share/ghostscript/fonts}
+  mkdir -p "$pkgdir"/var/{spool/hylafax,lock}
   make ROOT="$pkgdir" install
   install -D -m 755 "$srcdir"/hylafax "$pkgdir"/etc/rc.d/hylafax
   install -D -m 744 "$srcdir"/hylafax.cron.daily 
"$pkgdir"/etc/cron.daily/hylafax
-  # remove group if created
-  if [ $uucp_created -eq 1 ]; then
-    userdel uucp &>/dev/null
-    groupdel uucp &>/dev/null
-    userdel fax &>/dev/null
-  fi
   # add missing awk file for notify-4.1 script
   install -D -m 755 "$srcdir"/${pkgname}-${pkgver}/util/notify.awk \
        "$pkgdir"/var/spool/hylafax/bin/notify.awk

Added: hylafax-libtiff4.patch
===================================================================
--- hylafax-libtiff4.patch                              (rev 0)
+++ hylafax-libtiff4.patch      2012-01-29 02:46:41 UTC (rev 147949)
@@ -0,0 +1,229 @@
+--- hylafax-6.0.5/configure    2010-09-15 10:42:36.000000000 -0400
++++ hylafax-5.5.1/configure    2012-01-02 17:44:20.000000000 -0500
+@@ -2531,6 +2566,7 @@
+     Note "... checking TIFF library version"
+     tiff_runlen_t=""
+     cat>t.c<<EOF
++#include <stdlib.h>
+ #include <stdio.h>
+ #include "tiffio.h"
+ main()
+@@ -2550,8 +2586,18 @@
+       Note "  Found libtiff version ${lib_ver}"
+       if [ ${header_ver} -ge 19960307 ]; then
+           case ${lib_ver} in
+-              3.4)            tiff_runlen_t="uint16" ;;
+-              3.[56789])      tiff_runlen_t="uint32" ;;
++              3.4)            tiff_runlen_t="uint16"
++                              echo '#define TIFFSTRIPBYTECOUNTS uint32'
++                              echo '#define TIFFVERSION TIFF_VERSION'
++                              echo '#define TIFFHEADER TIFFHeader';;
++              3.[56789])      tiff_runlen_t="uint32"
++                              echo '#define TIFFSTRIPBYTECOUNTS uint32'
++                              echo '#define TIFFVERSION TIFF_VERSION'
++                              echo '#define TIFFHEADER TIFFHeader';;
++              4.0)            tiff_runlen_t="uint32"
++                              echo '#define TIFFSTRIPBYTECOUNTS uint64'
++                              echo '#define TIFFVERSION TIFF_VERSION_CLASSIC'
++                              echo '#define TIFFHEADER TIFFHeaderClassic';;
+           esac
+       fi
+     else
+@@ -2588,7 +2634,7 @@
+ Incompatible TIFF Library.
+ 
+ HylaFAX ${VERSION} requires TIFF software distribution versions 3.4 through
+-3.9.  If you do not have up to date TIFF software on your system
++4.0.  If you do not have up to date TIFF software on your system
+ then you can retrieve it from the location where you obtained this software.
+ The Home Page for version 3.5 and later is 
http://www.remotesensing.org/libtiff/
+ EOF
+--- hylafax-6.0.5/hfaxd/FileTransfer.c++       2010-09-15 10:42:36.000000000 
-0400
++++ hylafax-5.5.1/hfaxd/FileTransfer.c++       2012-01-02 17:44:19.000000000 
-0500
+@@ -164,26 +142,26 @@
+  * a single IFD/image from a TIFF file.
+  */
+ typedef struct {
+-    TIFFDirEntry      SubFileType;
+-    TIFFDirEntry      ImageWidth;
+-    TIFFDirEntry      ImageLength;
+-    TIFFDirEntry      BitsPerSample;
+-    TIFFDirEntry      Compression;
+-    TIFFDirEntry      Photometric;
+-    TIFFDirEntry      FillOrder;
+-    TIFFDirEntry      StripOffsets;
+-    TIFFDirEntry      Orientation;
+-    TIFFDirEntry      SamplesPerPixel;
+-    TIFFDirEntry      RowsPerStrip;
+-    TIFFDirEntry      StripByteCounts;
+-    TIFFDirEntry      XResolution;
+-    TIFFDirEntry      YResolution;
+-    TIFFDirEntry      Options;                // T4 or T6
+-    TIFFDirEntry      ResolutionUnit;
+-    TIFFDirEntry      PageNumber;
+-    TIFFDirEntry      BadFaxLines;
+-    TIFFDirEntry      CleanFaxData;
+-    TIFFDirEntry      ConsecutiveBadFaxLines;
++    HFClassicTIFFDirEntry     SubFileType;
++    HFClassicTIFFDirEntry     ImageWidth;
++    HFClassicTIFFDirEntry     ImageLength;
++    HFClassicTIFFDirEntry     BitsPerSample;
++    HFClassicTIFFDirEntry     Compression;
++    HFClassicTIFFDirEntry     Photometric;
++    HFClassicTIFFDirEntry     FillOrder;
++    HFClassicTIFFDirEntry     StripOffsets;
++    HFClassicTIFFDirEntry     Orientation;
++    HFClassicTIFFDirEntry     SamplesPerPixel;
++    HFClassicTIFFDirEntry     RowsPerStrip;
++    HFClassicTIFFDirEntry     StripByteCounts;
++    HFClassicTIFFDirEntry     XResolution;
++    HFClassicTIFFDirEntry     YResolution;
++    HFClassicTIFFDirEntry     Options;                // T4 or T6
++    HFClassicTIFFDirEntry     ResolutionUnit;
++    HFClassicTIFFDirEntry     PageNumber;
++    HFClassicTIFFDirEntry     BadFaxLines;
++    HFClassicTIFFDirEntry     CleanFaxData;
++    HFClassicTIFFDirEntry     ConsecutiveBadFaxLines;
+     uint32            link;                   // offset to next directory
+     uint32            xres[2];                // X resolution indirect value
+     uint32            yres[2];                // Y resolution indirect value
+@@ -226,10 +204,10 @@
+                * amount of image data and then adding in
+                * the expected data for the TIFF headers.
+                */
+-              uint32* sb;
++              TIFFSTRIPBYTECOUNTS* sb;
+               TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
+               file_size = sizeof (DirTemplate) +
+-                  sizeof (TIFFHeader) + sizeof (uint16);
++                  sizeof (TIFFHEADER) + sizeof (uint16);
+               for (tstrip_t s = 0, ns = TIFFNumberOfStrips(tif); s < ns; s++)
+                   file_size += sb[s];
+               reply(code, "%s for %s (%lu bytes).",
+@@ -261,10 +239,10 @@
+       if (fd >= 0) {
+           union {
+               char buf[512];
+-              TIFFHeader h;
++              TIFFHEADER h;
+           } b;
+           ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
+-          if (cc > (ssize_t)sizeof (b.h) && b.h.tiff_version == TIFF_VERSION 
&&
++          if (cc > (ssize_t)sizeof (b.h) && b.h.tiff_version == TIFFVERSION &&
+             (b.h.tiff_magic == TIFF_BIGENDIAN ||
+              b.h.tiff_magic == TIFF_LITTLEENDIAN)) {
+               (void) lseek(fd, 0L, SEEK_SET);         // rewind
+@@ -318,12 +296,12 @@
+ }
+ 
+ static void
+-getLong(TIFF* tif, TIFFDirEntry& de)
++getLong(TIFF* tif, HFClassicTIFFDirEntry& de)
+ {
+     TIFFGetField(tif, de.tdir_tag, &de.tdir_offset);
+ }
+ static void
+-getShort(TIFF* tif, TIFFDirEntry& de)
++getShort(TIFF* tif, HFClassicTIFFDirEntry& de)
+ {
+     uint16 v;
+     TIFFGetField(tif, de.tdir_tag, &v);
+@@ -343,7 +321,7 @@
+ {
+     static DirTemplate templ = {
+ #define       TIFFdiroff(v) \
+-    (uint32) (sizeof (TIFFHeader) + sizeof (uint16) + \
++    (uint32) (sizeof (TIFFHEADER) + sizeof (uint16) + \
+       (intptr_t) &(((DirTemplate*) 0)->v))
+       { TIFFTAG_SUBFILETYPE,          TIFF_LONG,      1 },
+       { TIFFTAG_IMAGEWIDTH,           TIFF_LONG,      1 },
+@@ -368,7 +346,7 @@
+       0,                                      // next directory
+       { 0, 1 }, { 0, 1 },                     // x+y resolutions
+     };
+-#define       NTAGS   ((TIFFdiroff(link)-TIFFdiroff(SubFileType)) / sizeof 
(TIFFDirEntry))
++#define       NTAGS   ((TIFFdiroff(link)-TIFFdiroff(SubFileType)) / sizeof 
(HFClassicTIFFDirEntry))
+     /*
+      * Construct the TIFF header for this IFD using
+      * the preconstructed template above.  We extract
+@@ -377,14 +355,14 @@
+      * of things about the contents of the TIFF file.
+      */
+     struct {
+-      TIFFHeader h;
++      TIFFHEADER h;
+       uint16  dircount;
+       u_char  dirstuff[sizeof (templ)];
+     } buf;
+     union { int32 i; char c[4]; } u; u.i = 1;
+     buf.h.tiff_magic = (u.c[0] == 0 ? TIFF_BIGENDIAN : TIFF_LITTLEENDIAN);
+-    buf.h.tiff_version = TIFF_VERSION;
+-    buf.h.tiff_diroff = sizeof (TIFFHeader);
++    buf.h.tiff_version = TIFFVERSION;
++    buf.h.tiff_diroff = sizeof (TIFFHEADER);
+     buf.dircount = (uint16) NTAGS;
+     getLong(tif, templ.SubFileType);
+     getLong(tif, templ.ImageWidth);
+@@ -412,7 +390,7 @@
+     getShort(tif, templ.CleanFaxData);
+     getLong(tif, templ.ConsecutiveBadFaxLines);
+     if (buf.h.tiff_magic == TIFF_BIGENDIAN) {
+-      TIFFDirEntry* dp = &templ.SubFileType;
++      HFClassicTIFFDirEntry* dp = &templ.SubFileType;
+       for (u_int i = 0; i < NTAGS; i++) {
+           if (dp->tdir_type == TIFF_SHORT)
+               dp->tdir_offset <<= 16;
+@@ -441,7 +419,7 @@
+ bool
+ HylaFAXServer::sendITIFFData(TIFF* tif, int fdout)
+ {
+-    uint32* sb;
++    TIFFSTRIPBYTECOUNTS* sb;
+     (void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &sb);
+     tdata_t buf = _TIFFmalloc(sb[0]);
+     tsize_t bsize = sb[0];
+--- hylafax-6.0.5/hfaxd/FileTransfer.c++       2012-01-28 15:27:47.000000000 
-0500
++++ hylafax-5.5.1/hfaxd/FileTransfer.c++       2012-01-28 15:30:12.000000000 
-0500
+@@ -69,7 +69,7 @@
+ 
+ 
+ static bool
+-isTIFF(const TIFFHeader& h)
++isTIFF(const TIFFHEADER& h)
+ {
+     if (h.tiff_magic != TIFF_BIGENDIAN && h.tiff_magic != TIFF_LITTLEENDIAN)
+       return (false);
+@@ -82,11 +82,23 @@
+     // byte swap version stamp if opposite byte order
+     if ((u.c[0] == 0) ^ (h.tiff_magic == TIFF_BIGENDIAN))
+       TIFFSwabShort(&version);
+-    return (version == TIFF_VERSION);
++    return (version == TIFFVERSION);
+ }
+ 
+ 
+ /*
++ * This is copied right from tiff.h in version 3.8.2.  This was necessary
++ * to localize here because it was removed from tiff.h in version 4.0.
++ * In tiff.h 3.8.2 it was known as "TIFFDirEntry".
++ */
++typedef struct {
++      uint16          tdir_tag;
++      uint16          tdir_type;      /* data type */
++      uint32          tdir_count;     /* number of items; length in spec */
++      uint32          tdir_offset;    /* byte offset to field data */
++} HFClassicTIFFDirEntry;
++ 
++/*
+  * Record a file transfer in the log file.
+  */
+ void
+@@ -957,7 +957,7 @@
+       if (FileCache::lookup(docname, sb) && S_ISREG(sb.st_mode)) {
+           union {
+               char buf[512];
+-              TIFFHeader h;
++              TIFFHEADER h;
+           } b;
+           ssize_t cc = Sys::read(fd, (char*) &b, sizeof (b));
+           if (cc > 2 && b.buf[0] == '%' && b.buf[1] == '!')

Modified: hylafax.install
===================================================================
--- hylafax.install     2012-01-28 21:21:33 UTC (rev 147948)
+++ hylafax.install     2012-01-29 02:46:41 UTC (rev 147949)
@@ -1,8 +1,6 @@
 
 print_install() {
   printf "\n"
-  echo "If installing new:"
-  printf "\n"
   echo "Add the following to /etc/inittab and run telinit q"
   echo "  f1:2345:respawn:/usr/lib/fax/faxgetty ttyS0"
   echo "faxgetty should now be running"
@@ -24,16 +22,20 @@
 }
 
 post_install() {
-  groupadd -g 14 uucp &>/dev/null
-  useradd -u 10 -g uucp -d '/' -s /bin/false uucp &>/dev/null
-  useradd -u 69 -g daemon -d '/' -s /bin/false fax &>/dev/null
+  post_upgrade
   print_install
 }
 
 post_upgrade() {
-  post_install
-  usermod -d '/' uucp
-  usermod -d '/' fax
+  groupadd -g 14 uucp &>/dev/null
+  useradd -u 10 -g uucp -d '/' -s /bin/false uucp &>/dev/null
+  useradd -u 69 -g daemon -d '/' -s /bin/false fax &>/dev/null
+  chown uucp /var/spool/hylafax/{,archive,bin,client,config,dev,docq,doneq,etc}
+  chown uucp /var/spool/hylafax/{FIFO,info,log,pollq,recvq,sendq,status,tmp}
+  chown uucp /var/spool/hylafax/etc/{hosts.hfaxd,lutRS18.pcf,xferfaxlog}
+  chown -R uucp /var/spool/hylafax/etc/templates
+  usermod -d '/' uucp &>/dev/null
+  usermod -d '/' fax &>/dev/null
 }
 
 pre_remove() {

Reply via email to