This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

generic build script 'help' patch


Here is a patch that adds some 'help' or 'usage' text to the generic
build script.  This seems to me to be a useful thing for someone who has 
downloaded and unpacked a package source archive; sees the package source, 
patch, and build script; and wonders what to do next.  As a guess, they try 
running './package-ver.sh --help' or similar, and now instead of getting back 
'Error: bad arguments', they get some description of the script's purpose and 
available options, as well as a pointer to the build script discussion on 
cygwin.com.  I also find the usage summary useful as a reminder to myself of 
what some of my available operations are, and exactly what 'all' does.

Feel free to improve the particulars of my help text.  The main thing is that
I think some help text is needed.

Andrew.

--- generic-build-script.orig 2004-10-08 22:48:07.000000000 -0400
+++ generic-build-script 2004-10-10 23:58:23.000000000 -0400
@@ -30,6 +30,7 @@
   fi
 fi
 
+scriptname=`basename $0`
 tscriptname=`basename $0 .sh`
 export PKG=`echo $tscriptname | sed -e 's/\-[^\-]*\-[^\-]*$//'`
 export VER=`echo $tscriptname | sed -e "s/${PKG}\-//" -e 's/\-[^\-]*$//'`
@@ -320,6 +321,47 @@
     echo "You need the gnupg package installed in order to check 
signatures." ; \
   fi
 }
+usage() {
+  echo "Build script for the Cygwin ${PKG} package.
+Adapted from the Cygwin generic-build-script; see
+http://cygwin.com/setup.html#srcpackage_contents for detailed usage 
instructions.
+Usage: ${scriptname} operation...
+build operations:
+  all          build source and binary packages
+               (same as: prep conf build check install strip pkg spkg)
+  build        run 'make' on patched source
+  conf         run ./configure
+  configure    run ./configure
+  check        run test suite
+  make         run 'make' on patched source
+  prep         unpack and patch package source; run mkdirs
+  strip        strip built executables
+  test         run test suite
+packaging operations:
+  first        build source package first time, from existing patched 
+               source directory (same as: mkdirs spkg finish)
+  install      install package into installation staging subdir 
+  package      build binary package
+  pkg          build binary package
+  spkg         build source package
+  src-package  build source package
+information:
+  depend       list packages on which the binary package depends
+  help         display this message
+  list         list files in the binary package
+  usage        display this message
+minor operations:
+  acceptpatch  accept Cygwin source patch
+  checksig     check package, patch, and script signatures
+  clean        run 'make clean'
+  finish       remove source directory
+  mkdirs       create package staging directories
+  mkpatch      create Cygwin source patch
+  reconf       remove build staging dir and rerun ./configure
+"
+}
+
+test -n "$1" || set "usage"
 while test -n "$1" ; do
   case $1 in
     prep)  prep ; STATUS=$? ;;
@@ -348,7 +390,10 @@
     all)  checksig && prep && conf && build && install && \
    strip && pkg && spkg && finish ; \
    STATUS=$? ;;
-    *) echo "Error: bad arguments" ; exit 1 ;;
+    help|-help|--help|usage) usage ; STATUS=$? ;;
+    *) echo "${scriptname}: error: unknown argument \"$1\"" ; 
+       echo "${scriptname}: run \"${scriptname} help\" to get a usage 
summary" ;
+       exit 1 ;;
   esac
   ( exit ${STATUS} ) || exit ${STATUS}
   shift


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]