| ... | ... | @@ -12,7 +12,7 @@ | 
| 12 | 12 |  # $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/make-dist.sh,v 1.20 2011/04/11 16:34:49 rtoy Exp $
 | 
| 13 | 13 |  
 | 
| 14 | 14 |  usage() {
 | 
| 15 |  | -    echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] dir [version arch os]"
 | 
|  | 15 | +    echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] [-A arch] [-V version] [-o OS] dir"
 | 
| 16 | 16 |      echo "  -h           This help"
 | 
| 17 | 17 |      echo "  -b           Use bzip2 compression"
 | 
| 18 | 18 |      echo "  -g           Use gzip compression"
 | 
| ... | ... | @@ -24,10 +24,10 @@ usage() { | 
| 24 | 24 |      echo "                 The compressed tar file is named cmucl-src-<VERSION>.tar.<ext>"
 | 
| 25 | 25 |      echo "                 If -I is also given, the -S means that the sources are "
 | 
| 26 | 26 |      echo "                 installed in the <destdir>/src"
 | 
|  | 27 | +    echo "  -A arch      Architecture (x86, sparc, ppc, etc.)"
 | 
|  | 28 | +    echo "  -o OS        OS (linux, solaris10, etc.)"
 | 
|  | 29 | +    echo "  -V version   Version (usually date and/or other version info)"
 | 
| 27 | 30 |      echo "   dir         Directory where the build is located"
 | 
| 28 |  | -    echo "   version     Version (usually date and/or other version info)"
 | 
| 29 |  | -    echo "   arch        Architecture (x86, sparc, etc.)"
 | 
| 30 |  | -    echo "   os          OS (linux, solaris8, etc.)"
 | 
| 31 | 31 |      echo ""
 | 
| 32 | 32 |      echo "If the -I option is given, directly install all of the files to the"
 | 
| 33 | 33 |      echo "specified directory.  Otherwise, Make a CMUCL distribution consisting"
 | 
| ... | ... | @@ -57,7 +57,7 @@ def_arch_os () { | 
| 57 | 57 |        SunOS)
 | 
| 58 | 58 |  	  case `uname -m` in
 | 
| 59 | 59 |  	    sun*)
 | 
| 60 |  | -		ARCH=sparcv9 ;;
 | 
|  | 60 | +		ARCH=sparc ;;
 | 
| 61 | 61 |  	    i*)
 | 
| 62 | 62 |  		ARCH=x86 ;;
 | 
| 63 | 63 |  	  esac
 | 
| ... | ... | @@ -90,7 +90,21 @@ def_arch_os () { | 
| 90 | 90 |        esac
 | 
| 91 | 91 |  }
 | 
| 92 | 92 |  
 | 
| 93 |  | -while getopts "G:O:I:M:bghS?" arg
 | 
|  | 93 | +# Figure out the architecture and OS in case options aren't given
 | 
|  | 94 | +def_arch_os
 | 
|  | 95 | +
 | 
|  | 96 | +# Choose a version based on the git hash as the default version.
 | 
|  | 97 | +GIT_HASH="`(cd src; git describe --dirty 2>/dev/null)`"
 | 
|  | 98 | +
 | 
|  | 99 | +if expr "X${GIT_HASH}" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]' > /dev/null; then
 | 
|  | 100 | +    VERSION=`expr "${GIT_HASH}" : "snapshot-\(.*\)"`
 | 
|  | 101 | +fi
 | 
|  | 102 | +
 | 
|  | 103 | +if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
 | 
|  | 104 | +    VERSION="${GIT_HASH}"
 | 
|  | 105 | +fi
 | 
|  | 106 | +
 | 
|  | 107 | +while getopts "G:O:I:M:bghSA:o:V:?" arg
 | 
| 94 | 108 |  do
 | 
| 95 | 109 |      case $arg in
 | 
| 96 | 110 |  	G) GROUP=$OPTARG ;;
 | 
| ... | ... | @@ -100,47 +114,18 @@ do | 
| 100 | 114 |  	b) ENABLE_BZIP=-b ;;
 | 
| 101 | 115 |  	g) ENABLE_GZIP=-g  ;;
 | 
| 102 | 116 |          S) MAKE_SRC_DIST=yes ;;
 | 
|  | 117 | +        A) ARCH=$OPTARG ;;
 | 
|  | 118 | +        o) OS=$OPTARG ;;
 | 
|  | 119 | +        V) VERSION=$OPTARG ;;
 | 
| 103 | 120 |  	h | \?) usage; exit 1 ;;
 | 
| 104 | 121 |      esac
 | 
| 105 | 122 |  done
 | 
| 106 | 123 |  
 | 
| 107 | 124 |  shift `expr $OPTIND - 1`
 | 
| 108 | 125 |  
 | 
| 109 |  | -# Figure out the architecture and OS
 | 
| 110 |  | -ARCH=
 | 
| 111 |  | -OS=
 | 
| 112 |  | -
 | 
| 113 |  | -# Figure out the architecture and OS
 | 
| 114 |  | -def_arch_os
 | 
| 115 |  | -
 | 
| 116 |  | -if [ -n "${INSTALL_DIR}" ]; then
 | 
| 117 |  | -    # Doing direct installation
 | 
| 118 |  | -    if [ $# -lt 1 ]; then
 | 
| 119 |  | -	usage
 | 
| 120 |  | -    else
 | 
| 121 |  | -	def_arch_os
 | 
| 122 |  | -    fi
 | 
| 123 |  | -elif [ $# -lt 2 ]; then
 | 
| 124 |  | -    # Version not specified so choose a version based on the git hash.
 | 
| 125 |  | -    GIT_HASH="`(cd src; git describe --dirty 2>/dev/null)`"
 | 
| 126 |  | -
 | 
| 127 |  | -    if expr "X${GIT_HASH}" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]' > /dev/null; then
 | 
| 128 |  | -	VERSION=`expr "${GIT_HASH}" : "snapshot-\(.*\)"`
 | 
| 129 |  | -    fi
 | 
| 130 |  | -
 | 
| 131 |  | -    if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
 | 
| 132 |  | -	VERSION="${GIT_HASH}"
 | 
| 133 |  | -    fi
 | 
| 134 |  | -
 | 
| 135 |  | -    echo "Defaulting version to $VERSION"
 | 
| 136 |  | -else
 | 
| 137 |  | -    VERSION="$2"
 | 
| 138 |  | -    if [ $# -eq 3 ]; then
 | 
| 139 |  | -	ARCH=$3
 | 
| 140 |  | -    elif [ $# -eq 4 ]; then
 | 
| 141 |  | -	ARCH=$3
 | 
| 142 |  | -	OS=$4
 | 
| 143 |  | -    fi
 | 
|  | 126 | +# Directory is required; exit if not given
 | 
|  | 127 | +if [ $# -lt 1 ]; then
 | 
|  | 128 | +    usage
 | 
| 144 | 129 |  fi
 | 
| 145 | 130 |  
 | 
| 146 | 131 |  if [ ! -d "$1" ]
 |