Index | Thread | Search

From:
Larry Moore <lmoore@starwon.com.au>
Subject:
[PATCH] comms/hylafax
To:
OpenBSD Ports <ports@openbsd.org>
Date:
Tue, 25 Aug 2026 14:13:59 +0800

Download raw body.

Thread
Attached is a patch for HylaFAX+ 7.0.11 updating it to Patch Revision 1.

Changes in this patch:
  - Update the URL to point to the copyright information for HylaFAX+.
  - Update faxsetup to generate a functional Fontmap.HylaFAX  file for 
OpenBSD
  - Tweak some other settings in faxsetup
  - Tweak settings in hylafax script
  - Removal of patch to disable threaded logging on OpenBSD
  - New RC script (hylafax) to start and stop the faxq & hfaxd services 
together
  - Update PLIST permissions to include some executable scripts missed 
earlier

To update your existing Fontmap.HylaFAX file, simply run;

  /usr/local/sbin/faxsetup -client

This has been tested on OpenBSD 7.9-stable amd64.
diff -Nupr /usr/ports/comms/hylafax/Makefile ./Makefile
--- /usr/ports/comms/hylafax/Makefile	Fri Jun 26 17:06:58 2026
+++ ./Makefile	Sun Jul 19 12:32:51 2026
@@ -1,14 +1,14 @@
 COMMENT=		send/receive faxes and share modems
 
 DISTNAME=		hylafax-7.0.11
-REVISION=		0
+REVISION=		1
 CATEGORIES=		comms
 
 HOMEPAGE=		https://hylafax.sourceforge.io/
 SITES=			${SITE_SOURCEFORGE:=hylafax/}
 
 # License: BSD
-# http://www.hylafax.org/HylaFAQ/copyright.html
+# https://sourceforge.net/p/hylafax/HylaFAX+/HEAD/tree/trunk/COPYRIGHT
 PERMIT_PACKAGE=		Yes
 
 FLAVORS=		a4
@@ -47,7 +47,8 @@ CONFIGURE_ARGS=		--nointeractive \
 			--with-SCRIPT_SH="/bin/ksh" \
 			--with-INSTALLROOT="${DESTDIR}" \
 			--with-DIR_MAN="${TRUEPREFIX}/man" \
-			--with-DIR_LIBDATA="${TRUEPREFIX}/libdata/hylafax/etc"
+			--with-DIR_LIBDATA="${TRUEPREFIX}/libdata/hylafax/etc" \
+			--with-PATH_AFM="${TRUEPREFIX}/share/fonts/ghostscript"
 
 CONFIGURE_ENV+=		DISABLE_PODOFO=yes
 
diff -Nupr /usr/ports/comms/hylafax/patches/patch-etc_faxsetup_sh_in ./patches/patch-etc_faxsetup_sh_in
--- /usr/ports/comms/hylafax/patches/patch-etc_faxsetup_sh_in	Fri Jun 26 17:06:58 2026
+++ ./patches/patch-etc_faxsetup_sh_in	Tue Aug 25 11:44:13 2026
@@ -21,18 +21,68 @@ Index: etc/faxsetup.sh.in
  PASSWD=/etc/passwd		# where to go for password entries
  PROTOUID=@FAXUID@		# user who's uid we use for FAX user
  defPROTOUID=3			# use this uid if PROTOUID doesn't exist
-@@ -1265,7 +1265,7 @@ if onClient; then
+@@ -1259,34 +1259,67 @@ if onClient; then
+ 			}	
+ 		'
+ 	}
++	genFontmap()
++	{
++	    FONTMAP_FILE=$1
++	    Note ""
++	    Note "Generating Fontmap $FONTMAP_FILE."
++	    Note ""
++
++	    $ECHO "% HylaFAX FontMap file generated by faxsetup on `date 2>/dev/null`" > $FONTMAP_FILE
++	    for d in `$ECHO $2 | $SED 's/:/ /g'`; do
++		if [ -d "$d" ]; then
++		    cd $d
++		    for f in `ls | grep '\.afm'`; do
++			$AWK -F '[ ]' '/FontName/ {print "/"$2"\t("FILENAME")\t;"; exit}; // {}' $f >> $FONTMAP_FILE
++		    done
++		fi
++	    done
++	    if [ -z "`$GREP Courier $FONTMAP_FILE`" ]; then
++	    Note ""
++	    Note "Adding aliases to Fontmap $FONTMAP_FILE."
++	    Note ""
++		$ECHO "" >> $FONTMAP_FILE
++		$ECHO "% Aliases" >> $FONTMAP_FILE
++		$ECHO "" >> $FONTMAP_FILE
++		$ECHO "/Courier		/NimbusMonL-Regu ;" >> $FONTMAP_FILE
++		$ECHO "/Courier-Bold		/NimbusMonL-Bold ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica		/NimbusSanL-Regu ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica-Oblique	/NimbusSanL-ReguItal ;" >> $FONTMAP_FILE
++		$ECHO "/Helvetica-Bold		/NimbusSanL-Bold ;" >> $FONTMAP_FILE
++		$ECHO "/Times-Bold		/NimbusRomNo9L-Medi ;" >> $FONTMAP_FILE
++	    fi
++	}
+ 	# If configure --with-PATH_AFM=<path> was used then we need to include it first.
+ 	RUNTIME_PATH_AFM=$PATH_AFM:`getGSFonts`
+ 	if [ -n "$RUNTIME_PATH_AFM" \
  				-a "$RUNTIME_PATH_AFM" != "$PATH_AFM" ]; then 
  	    Note ""
++	    #
++	    # When ghostscript is built with COMPILE_INITS=1, the fonts are compiled in to the ghostscript executable.
++	    # The textfmt(1) program in HylaFAX uses fonts in afm font files.
++	    # The Fontmap.HylaFAX file is created from afm font files found in the paths listed in RUNTIME_PATH_AFM.
++	    #
++	    genFontmap $DIR_SPOOL/etc/Fontmap.HylaFAX $RUNTIME_PATH_AFM
  	    FONTPATHS=`echo $RUNTIME_PATH_AFM | sed 's/:/ /g'`
 -	    $PATH_GSRIP -q -sDEVICE=tiffg3 -sFONTPATH="$FONTPATHS" $DIR_SPOOL/bin/genfontmap.ps > $DIR_SPOOL/etc/Fontmap.HylaFAX 2>/dev/null
-+	    $PATH_GSRIP -q -dNOSAFER -sDEVICE=tiffg3 -sFONTPATH="$FONTPATHS" $DIR_SPOOL/bin/genfontmap.ps > $DIR_SPOOL/etc/Fontmap.HylaFAX 2>/dev/null
- 	    # Ghostscript 8.71 segfaults on that, but produces a valid Fontmap file, so we don't test exit code, but examine the product, instead.
+-	    # Ghostscript 8.71 segfaults on that, but produces a valid Fontmap file, so we don't test exit code, but examine the product, instead.
  	    {
  		#
-@@ -1280,8 +1280,8 @@ if onClient; then
+-		# genfontmap.ps really just gives us a copy of Fontmap.GS, and in later Ghostscript versions there
+-		# are many Fontmap.GS references that are left undefined.  This may work for Ghostscript, but 
+-		# it does not work for us.  So, we need to do what we can to define them.
+-		#
+ 		fontmap=$DIR_SPOOL/etc/Fontmap.HylaFAX
+ 		newfontmap=$TMPDIR/Fontmap.HylaFAX.new.$$
+ 		tmpfile=$TMPDIR/fontmap-fixup.$$
+ 		$CP $fontmap $newfontmap
  		for fontname in `$CAT $fontmap | $GREP "	/" | $SED -e 's/^[^\/]*\///g' -e 's/ .*//g'`; do 
- 		    if [ -z "`$GREP "^($fontname)" $fontmap`" ]; then
+-		    if [ -z "`$GREP "^($fontname)" $fontmap`" ]; then
++		    if [ -z "`$GREP "^/$fontname" $fontmap`" ]; then
  			# There is a blind reference to this font.  Fix that.
 -			for fontpath in `$PATH_GSRIP -h | $GREP -A 100 "Search path:" | $GREP " :" | $SED 's/://g'`; do 
 -			    $GREP -l -d recurse -a "FontDirectory/$fontname known" $fontpath 2>/dev/null; 
@@ -41,7 +91,16 @@ Index: etc/faxsetup.sh.in
  			done | $SED q > $tmpfile
  			fontfile=`$CAT $tmpfile`
  			if [ -n "$fontfile" ]; then
-@@ -2425,12 +2425,7 @@ if onServer; then
+-			    echo "($fontname)	($fontfile) ;" >> $newfontmap
+-		        else
++			    $ECHO "/$fontname	($fontfile) ;" >> $newfontmap
++		        fi
++		        fontalias=`$ECHO $fontname | $SED -e 's/^\/*\///g'`
++		        if [ -z "`$GREP "^/$fontalias" $fontmap`" ]; then
+ 			    echo "Warning: No font file found for \"$fontname\" but the font map includes it."
+ 			fi
+ 		    fi
+@@ -2425,12 +2458,7 @@ if onServer; then
  
      findproc()
      {
@@ -55,3 +114,54 @@ Index: etc/faxsetup.sh.in
  	echo "$pid"
      }
  
+@@ -2446,9 +2474,9 @@ if onServer; then
+ 	    echo
+ 	fi
+ 	if isOK "$x"; then
+-	    if [ -x /bin/systemctl ]; then
+-		echo "Executing '/bin/systemctl stop hylafax-hfaxd'..."
+-		/bin/systemctl stop hylafax-hfaxd
++	    if [ -x /usr/sbin/rcctl ]; then
++		echo "Executing '/usr/sbin/rcctl stop hfaxd'..."
++		/usr/sbin/rcctl stop hfaxd
+ 	    elif kill $HFAXD; then
+ 		echo "Sent a SIGTERM to processes $HFAXD."
+ 	    else
+@@ -2497,9 +2525,9 @@ EOF
+ 	    echo
+ 	fi
+ 	if isOK "$x"; then
+-	    if [ -x /bin/systemctl ]; then
+-		echo "Executing '/bin/systemctl stop hylafax-faxq'..."
+-		/bin/systemctl stop hylafax-faxq
++	    if [ -x /usr/sbin/rcctl ]; then
++		echo "Executing '/usr/sbin/rcctl stop faxq'..."
++		/usr/sbin/rcctl stop faxq
+ 	    else
+ 		$DIR_SBIN/faxquit >/dev/null 2>&1
+ 	    fi
+@@ -2589,18 +2617,18 @@ EOF
+     fi
+     if isOK "$x"; then
+ 	echo ""
+-	if [ -x /bin/systemctl ]; then
+-	    echo "Executing '/bin/systemctl start hylafax-faxq'..."
+-	    /bin/systemctl start hylafax-faxq
+-	    echo "Executing '/bin/systemctl start hylafax-hfaxd'..."
+-	    /bin/systemctl start hylafax-hfaxd
++	if [ -x /usr/sbin/rcctl ]; then
++	    echo "Executing '/usr/sbin/rcctl start faxq'..."
++	    /usr/sbin/rcctl start faxq
++	    echo "Executing '/usr/sbin/rcctl start hfaxd'..."
++	    /usr/sbin/rcctl start hfaxd
+ 	elif [ -x ${DIR_SYSVINIT}/hylafax ]; then
+ 	    echo ${DIR_SYSVINIT}/hylafax start
+ 	    ${DIR_SYSVINIT}/hylafax start
+ 	else
+ 	    echo $DIR_SBIN/faxq; $DIR_SBIN/faxq
+ 	    hfaxdopts=
+-	    if isOK "$HFAXD_SERVER"; then hfaxdopts="-i hylafax "; fi
++	    if isOK "$HFAXD_SERVER"; then hfaxdopts="-f all -l 0.0.0.0 -i hylafax -l ::0 -i hylafax "; fi
+ 	    if isOK "$HFAXD_SNPP_SERVER"; then hfaxdopts="$hfaxdopts\-s snpp"; fi
+ 	    echo "$DIR_SBIN/hfaxd $hfaxdopts"; eval "$DIR_SBIN/hfaxd $hfaxdopts"
+ 	fi
diff -Nupr /usr/ports/comms/hylafax/patches/patch-etc_hylafax_in ./patches/patch-etc_hylafax_in
--- /usr/ports/comms/hylafax/patches/patch-etc_hylafax_in	Thu Jan  1 08:00:00 1970
+++ ./patches/patch-etc_hylafax_in	Sat Jul 11 07:23:59 2026
@@ -0,0 +1,38 @@
+--- etc/hylafax.in.orig	Wed Oct 13 03:42:48 2021
++++ etc/hylafax.in	Sat Jul 11 07:20:51 2026
+@@ -90,9 +90,6 @@ fi
+ if [ -z "$HFAXD_SNPP_SERVER" ]; then
+     HFAXD_SNPP_SERVER=@HFAXD_SNPP_SERVER@
+ fi
+-if [ -z "$HFAXD_ARGS" ]; then
+-    HFAXD_ARGS=
+-fi
+ 
+ IS_ON=/etc/chkconfig		# NB: chkconfig is IRIX- and Linux-specific
+ FAXQ=$SBIN/faxq
+@@ -101,6 +98,10 @@ FAXQUIT=$SBIN/faxquit
+ FAXPORT=hylafax			# designated port for new protocol
+ SNPPPORT=444			# official port for SNPP
+ 
++if [ -z "$HFAXD_ARGS" ]; then
++    HFAXD_ARGS="-f all -l 0.0.0.0 -i $FAXPORT -l ::0 "
++fi
++
+ if test ! -x $IS_ON ; then
+     IS_ON=true
+ fi
+@@ -150,13 +151,7 @@ fi
+ #
+ killall()
+ {
+-	# NB: ps ax should give an error on System V, so we try it first!
+-	pid="`ps ax 2>/dev/null | $AWK \"\
+-		/[\/ (]$2[ )]/	{print \\$1;}
+-		/[\/ ]$2\$/	{print \\$1;}\"`"
+-	test "$pid" ||
+-	    pid="`ps -e 2>/dev/null | $AWK \"/ $2[ ]*\$/ {print \\$1;}\"`"
+-	test "$pid" && kill $1 $pid; return
++	/usr/bin/pkill $1 $2
+ }
+ 
+ do_start()
diff -Nupr /usr/ports/comms/hylafax/patches/patch-faxd_FaxMachineLog_c++ ./patches/patch-faxd_FaxMachineLog_c++
--- /usr/ports/comms/hylafax/patches/patch-faxd_FaxMachineLog_c++	Wed Mar 25 23:47:01 2026
+++ ./patches/patch-faxd_FaxMachineLog_c++	Thu Jan  1 08:00:00 1970
@@ -1,15 +0,0 @@
-Index: faxd/FaxMachineLog.c++
---- faxd/FaxMachineLog.c++.orig
-+++ faxd/FaxMachineLog.c++
-@@ -70,7 +70,11 @@ FaxMachineLog::FaxMachineLog(int f, const fxStr& numbe
- 	struct loggingThreadData *r = (struct loggingThreadData *) malloc(sizeof(struct loggingThreadData));
- 	r->pfd = lpfd[0];
- 	r->wfd = fd;
-+#if defined(__OpenBSD__)
-+	if (1) {	// loggingThread has SIGABRTs in OpenBSD
-+#else
- 	if (pthread_create(&lt, NULL, &loggingThread, (void *) r) != 0) {
-+#endif
- 	    if (lpfd[0] > 0) Sys::close(lpfd[0]);
- 	    if (lpfd[1] > 0) Sys::close(lpfd[1]);
- 	    lpfd[0] = -1;
diff -Nupr /usr/ports/comms/hylafax/patches/patch-faxd_sslfaxproxy_c++ ./patches/patch-faxd_sslfaxproxy_c++
--- /usr/ports/comms/hylafax/patches/patch-faxd_sslfaxproxy_c++	Wed Mar 25 23:47:01 2026
+++ ./patches/patch-faxd_sslfaxproxy_c++	Tue Aug 25 12:05:11 2026
@@ -10,3 +10,11 @@ Index: faxd/sslfaxproxy.c++
      timeval curTime;
      gettimeofday(&curTime, 0);
      return curTime;
+@@ -94,6 +94,7 @@ sslFaxThread(void* sd)
+ done:
+     Sys::close(s->wfd);
+     Sys::close(s->rfd);
++    free(sd);
+     return (NULL);
+ }
+ 
diff -Nupr /usr/ports/comms/hylafax/pkg/MESSAGE ./pkg/MESSAGE
--- /usr/ports/comms/hylafax/pkg/MESSAGE	Thu Jan  1 08:00:00 1970
+++ ./pkg/MESSAGE	Sun Aug 16 10:57:08 2026
@@ -0,0 +1,5 @@
+If you've updated your installation from an earlier version of HylaFAX 7.0.11,
+update your Fontmap.HylaFAX file by running;
+
+    /usr/local/sbin/faxsetup -client
+
diff -Nupr /usr/ports/comms/hylafax/pkg/PLIST ./pkg/PLIST
--- /usr/ports/comms/hylafax/pkg/PLIST	Fri Jun 26 17:06:58 2026
+++ ./pkg/PLIST	Sun Aug 16 10:26:44 2026
@@ -3,6 +3,7 @@
 @newuser _hylafax:902:_hylafax::HylaFAX Server:/var/spool/hylafax:/sbin/nologin
 @rcscript ${RCDIR}/faxq
 @rcscript ${RCDIR}/hfaxd
+@rcscript ${RCDIR}/hylafax
 @mode 555
 @bin bin/faxalter
 @bin bin/faxcover
@@ -159,10 +160,13 @@ libdata/hylafax/etc/faxcover.ps
 libdata/hylafax/etc/faxmail/
 libdata/hylafax/etc/faxmail.ps
 libdata/hylafax/etc/faxmail/application/
+@mode 555
 libdata/hylafax/etc/faxmail/application/binary
 libdata/hylafax/etc/faxmail/application/octet-stream
 libdata/hylafax/etc/faxmail/application/pdf
+@mode
 libdata/hylafax/etc/faxmail/image/
+@mode 555
 libdata/hylafax/etc/faxmail/image/tiff
 @mode 644
 libdata/hylafax/etc/hfaxd.conf
diff -Nupr /usr/ports/comms/hylafax/pkg/README ./pkg/README
--- /usr/ports/comms/hylafax/pkg/README	Fri Jun 26 17:06:58 2026
+++ ./pkg/README	Sat Aug 15 14:46:17 2026
@@ -25,6 +25,13 @@ something like this:
 and send a SIGHUP to init(8).
 
 
+Updating HylaFAX+ fontmap file
+=======================================================
+To refresh or create a missing HylaFAX fontmap file after an update simply run;
+
+    ${TRUEPREFIX}/sbin/faxsetup -client
+
+
 Updating file ownership to use the new _hylafax account
 =======================================================
 To update the ownership of directories and files in the HylaFAX spool directory,
diff -Nupr /usr/ports/comms/hylafax/pkg/hylafax.rc ./pkg/hylafax.rc
--- /usr/ports/comms/hylafax/pkg/hylafax.rc	Thu Jan  1 08:00:00 1970
+++ ./pkg/hylafax.rc	Sun Jul  5 19:01:32 2026
@@ -0,0 +1,21 @@
+#!/bin/ksh
+
+# "meta" script running the following rc.d(8) scripts with the given argument;
+# note that "daemon_*" variables are not passed to the child scripts.
+_pkg_scripts="faxq hfaxd"
+
+if [[ $1 == restart ]]; then
+	$0 stop && $0 start
+	exit
+fi
+
+if [[ $1 == stop ]]; then
+	for _i in ${_pkg_scripts}; do _l="${_i} ${_l}"; done
+	_pkg_scripts=${_l% }
+fi
+
+for _i in ${_pkg_scripts}; do
+	if [[ -x /etc/rc.d/${_i} ]]; then
+		/etc/rc.d/${_i} $@ || exit $?
+	fi
+done