Fixed explanation of why the unset SHELL test is uselessif /bin/sh is bash.
[mmh] / SPECS / build-nmh-cygwin
index 2f18d7e..8bbc644 100755 (executable)
@@ -1,5 +1,13 @@
 #!/bin/bash
 #
+# ==========================================================================
+# Change from generic-build-script:  added this comment block.
+# Based on Cygwin generic package build script, customized for nmh.
+#
+# This script is incompatible with directory names that contain spaces, etc.
+# To fix that, a whole bunch of shell variables need to be wrapped with "".
+# ==========================================================================
+#
 # Generic package build script
 #
 # $Id: generic-build-script,v 1.47 2006/02/01 14:01:14 igor Exp $
@@ -40,13 +48,19 @@ export REL=`echo $tscriptname | sed -e "s/${PKG}\-${VER}\-//"`
 # from the upstream package name, you will want to redefine BASEPKG.
 # Example: For Apache 2, BASEPKG=httpd-2.x.xx but SHORTPKG=apache2-2.x.xx
 export BASEPKG=${PKG}-${VER}
+# Change from generic-build-script:  redefined BASEPKG.
+export BASEPKG=${PKG}-${VER}-dev
 export SHORTPKG=${PKG}-${VER}
 export FULLPKG=${SHORTPKG}-${REL}
 
 # determine correct decompression option and tarball filename
-export src_orig_pkg_name=
+# Change from generic-build-script:  set scr_orig_pkg_name here.
+export src_orig_pkg_name=nmh-1.5-dev.tar.gz
 if [ -e "${src_orig_pkg_name}" ] ; then
-  export opt_decomp=? # Make sure tar punts if unpack() is not redefined
+  # Change from generic-build-script:  don't need the following line, use
+  # opt_decomp of z.
+  # export opt_decomp=? # Make sure tar punts if unpack() is not redefined
+  export opt_decomp=z
 elif [ -e ${BASEPKG}.tar.bz2 ] ; then
   export opt_decomp=j
   export src_orig_pkg_name=${BASEPKG}.tar.bz2
@@ -92,7 +106,8 @@ export checklogfile=${srcinstdir}/${checklogname}
 export installlogfile=${srcinstdir}/${installlogname}
 
 prefix=/usr
-sysconfdir=/etc
+# Change from generic-build-script:  use /etc/nmh instead of /etc.
+sysconfdir=/etc/nmh
 localstatedir=/var
 if [ -z "$MY_CFLAGS" ]; then
   MY_CFLAGS="-O2"
@@ -101,34 +116,12 @@ if [ -z "$MY_LDFLAGS" ]; then
   MY_LDFLAGS=
 fi
 
-export install_docs="\
-       ABOUT-NLS \
-       ANNOUNCE \
-       AUTHORS \
-       BUG-REPORTS \
-       CHANGES \
-       CONTRIBUTORS \
-       COPYING \
-       COPYRIGHT \
-       CREDITS \
-       CHANGELOG \
-       ChangeLog* \
-       FAQ \
-       HOW-TO-CONTRIBUTE \
-       INSTALL \
-       KNOWNBUG \
-       LEGAL \
-       LICENSE \
-       NEWS \
-       NOTES \
-       PROGLIST \
-       README \
-       RELEASE_NOTES \
-       THANKS \
-       TODO \
-       USAGE \
-"
-export install_docs="`for i in ${install_docs}; do echo $i; done | sort -u`"
+# Change from generic-build-script:  disabled install_docs because
+# nmh's make install takes care of it.  Though it installs in
+# /usr/share/doc/nmh/ instead of /usr/share/doc/nmh-<version>/,
+# that seems to be more common on Cygwin than using the -<version>.
+export install_docs=
+#export install_docs="`for i in ${install_docs}; do echo $i; done | sort -u`"
 export test_rule=check
 if [ -z "$SIG" ]; then
   export SIG=0 # set to 1 to turn on signing by default
@@ -213,12 +206,20 @@ prep_log() {
   prep "$@" && \
   mkdirs_log && \
   if [ -f ${topdir}/${log_pkg_name} ] ; then \
-    cd ${buildlogdir} && \
-    tar xvjf ${topdir}/${log_pkg_name}
+    # Change from generic-build-script:  do the following in subshell
+    # so that cd isn't permanent.
+    (cd ${buildlogdir} && \
+    tar xvjf "${topdir}"/${log_pkg_name})
   fi
 }
 
 # Configure the package.
+# Change from generic-build-script:  added following notes:
+# Could add --with-cyrus-sasl if libsasl2 and libsas2-devel
+#   packages are installed.
+# Could add --with-tls if libgnutls26 and gnutls-devel
+#   packages are installed.
+#
 conf() {
   (cd ${objdir} && \
   CFLAGS="${MY_CFLAGS}" LDFLAGS="${MY_LDFLAGS}" \
@@ -274,6 +275,8 @@ clean() {
 }
 
 # Install the package, with DESTDIR set to '.inst'.
+# Change from generic-build-script:  added ":;" after "find ... | gzip"
+# because it returns non-zero status.
 install() {
   (cd ${objdir} && \
   rm -fr ${instdir}/* && \
@@ -294,7 +297,7 @@ install() {
   if [ -d ${instdir}${prefix}/share/man ] ; then \
     find ${instdir}${prefix}/share/man -name "*.1" -o -name "*.3" -o \
       -name "*.3x" -o -name "*.3pm" -o -name "*.5" -o -name "*.6" -o \
-      -name "*.7" -o -name "*.8" | xargs -r gzip -q ; \
+      -name "*.7" -o -name "*.8" | xargs -r gzip -q ; :; \
   fi && \
   templist="" && \
   for fp in ${install_docs} ; do \