Raymond Toy pushed to branch issue-365-add-strerror-with-generated-errno-pkg at cmucl / cmucl

Commits:

28 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -51,9 +51,9 @@ linux:build:
    51 51
         # instead of clang. 
    
    52 52
         - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp
    
    53 53
         # - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp
    
    54
    -    # Use -V to specify the version in case some tag makes git
    
    55
    -    # describe return something that make-dist.sh doesn't like.
    
    56
    -    - bin/make-dist.sh -V `git describe --dirty` -I dist linux-4
    
    54
    +    # When the result of `git describe` cannot be used as a version
    
    55
    +    # string, an alternative can be provided with the -V flag
    
    56
    +    - bin/make-dist.sh -I dist linux-4
    
    57 57
     
    
    58 58
     linux:cross-build:
    
    59 59
       stage: build
    
    ... ... @@ -80,8 +80,8 @@ linux:cross-build:
    80 80
         - bin/create-target.sh xtarget
    
    81 81
         - bin/create-target.sh xcross
    
    82 82
         - bin/cross-build-world.sh -crl xtarget xcross src/tools/cross-scripts/cross-x86-x86.lisp dist/bin/lisp
    
    83
    -    - bin/build.sh -b xlinux $bootstrap -R -C "" -o xtarget/lisp/lisp
    
    84
    -    - bin/make-dist.sh -V `git describe --dirty` -I xdist xlinux-4
    
    83
    +    - bin/build.sh -b xlinux $bootstrap -R -C "" -o "xtarget/lisp/lisp -lib xtarget/lisp"
    
    84
    +    - bin/make-dist.sh -I xdist xlinux-4
    
    85 85
     
    
    86 86
     linux:test:
    
    87 87
       stage: test
    
    ... ... @@ -194,9 +194,9 @@ osx:build:
    194 194
         # Regular build using the cross-compiled result or snapshot.
    
    195 195
         # Need /opt/local/bin to get msgmerge and msgfmt programs.
    
    196 196
         - PATH=/opt/local/bin:$PATH bin/build.sh $bootstrap -R -C "" -o snapshot/bin/lisp
    
    197
    -    # Use -V to specify the version in case some tag makes git
    
    197
    +    # If needed use -V to specify the version in case some tag makes git
    
    198 198
         # describe return something that make-dist.sh doesn't like.
    
    199
    -    - bin/make-dist.sh -V `git describe --dirty` -I dist darwin-4
    
    199
    +    - bin/make-dist.sh -I dist darwin-4
    
    200 200
     
    
    201 201
     osx:test:
    
    202 202
       stage: test
    
    ... ... @@ -319,9 +319,9 @@ opensuse:build:
    319 319
         # instead of clang. 
    
    320 320
         - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp
    
    321 321
         # - bin/build.sh $bootstrap -R -C "x86_linux" -o snapshot/bin/lisp
    
    322
    -    # Use -V to specify the version in case some tag makes git
    
    322
    +    # If needed use -V to specify the version in case some tag makes git
    
    323 323
         # describe return something that make-dist.sh doesn't like.
    
    324
    -    - bin/make-dist.sh -V `git describe --dirty` -I dist linux-4
    
    324
    +    - bin/make-dist.sh -I dist linux-4
    
    325 325
     
    
    326 326
     opensuse:test:
    
    327 327
       stage: test
    

  • bin/build-utils.sh
    ... ... @@ -16,7 +16,7 @@ TARGET="`echo $1 | sed 's:/*$::'`"
    16 16
     shift
    
    17 17
     
    
    18 18
     $TARGET/lisp/lisp \
    
    19
    -	-noinit -nositeinit -batch "$@" <<EOF || exit 3
    
    19
    +	-lib $TARGET/lisp -noinit -nositeinit -batch "$@" <<EOF || exit 3
    
    20 20
     (in-package :cl-user)
    
    21 21
     
    
    22 22
     (setf lisp::*enable-package-locked-errors* nil)
    

  • bin/build.sh
    ... ... @@ -110,6 +110,13 @@ case `uname -s` in
    110 110
           esac ;;
    
    111 111
     esac
    
    112 112
     
    
    113
    +# Set default version and generate lisp/cmucl-version.h
    
    114
    +DEFAULT_VERSION="`bin/git-version.sh`"
    
    115
    +export DEFAULT_VERISON
    
    116
    +echo DEFAULT_VERSION = $DEFAULT_VERSION
    
    117
    +
    
    118
    +bin/git-version.sh -f > src/lisp/cmucl-version.h
    
    119
    +
    
    113 120
     export LANG=en_US.UTF-8
    
    114 121
     
    
    115 122
     buildit ()
    
    ... ... @@ -146,9 +153,10 @@ buildit ()
    146 153
     	then
    
    147 154
     	    $BUILDWORLD $TARGET $OLDLISP $BOOT || { echo "Failed: $BUILDWORLD"; exit 1; }
    
    148 155
     	fi
    
    149
    -	$TOOLDIR/load-world.sh $TARGET "$VERSION" || { echo "Failed: $TOOLDIR/load-world.sh"; exit 1; }
    
    156
    +	$TOOLDIR/load-world.sh $TARGET || { echo "Failed: $TOOLDIR/load-world.sh"; exit 1; }
    
    157
    +
    
    158
    +	$TARGET/lisp/lisp -lib $TARGET/lisp -batch -noinit -nositeinit < /dev/null || { echo "Failed: $TARGET/lisp/lisp -batch -noinit"; exit 1; }
    
    150 159
     
    
    151
    -	$TARGET/lisp/lisp -batch -noinit -nositeinit < /dev/null || { echo "Failed: $TARGET/lisp/lisp -batch -noinit"; exit 1; }
    
    152 160
     	return 0;
    
    153 161
         fi
    
    154 162
     }
    
    ... ... @@ -230,7 +238,7 @@ buildit
    230 238
     bootfiles=
    
    231 239
     
    
    232 240
     TARGET=$BASE-3
    
    233
    -OLDLISP="${BASE}-2/lisp/lisp $OLDLISPFLAGS"
    
    241
    +OLDLISP="${BASE}-2/lisp/lisp -lib ${BASE}-2/lisp $OLDLISPFLAGS"
    
    234 242
     ENABLE=$ENABLE3
    
    235 243
     
    
    236 244
     BUILD=2
    
    ... ... @@ -241,7 +249,7 @@ buildit
    241 249
     
    
    242 250
     TARGET=$BASE-4
    
    243 251
     CLEAN_FLAGS="-K all"
    
    244
    -OLDLISP="${BASE}-3/lisp/lisp $OLDLISPFLAGS"
    
    252
    +OLDLISP="${BASE}-3/lisp/lisp -lib ${BASE}-3/lisp $OLDLISPFLAGS"
    
    245 253
     ENABLE=$ENABLE4
    
    246 254
     
    
    247 255
     if [ "${BUILD_POT}" = "yes" ]; then
    
    ... ... @@ -259,7 +267,7 @@ buildit
    259 267
     
    
    260 268
     # Asdf and friends are part of the base install, so we need to build
    
    261 269
     # them now.
    
    262
    -$TARGET/lisp/lisp -noinit -nositeinit -batch << EOF || exit 3
    
    270
    +$TARGET/lisp/lisp -lib $TARGET/lisp -noinit -nositeinit -batch << EOF || exit 3
    
    263 271
     (in-package :cl-user)
    
    264 272
     (setf (ext:search-list "target:")
    
    265 273
           '("$TARGET/" "src/"))
    
    ... ... @@ -279,7 +287,7 @@ EOF
    279 287
     
    
    280 288
     if [ "$SKIPUTILS" = "no" ];
    
    281 289
     then
    
    282
    -    OLDLISP="${BASE}-4/lisp/lisp $OLDLISPFLAGS"
    
    290
    +    OLDLISP="${BASE}-4/lisp/lisp -lib ${BASE}-4/lisp $OLDLISPFLAGS"
    
    283 291
         time $TOOLDIR/build-utils.sh $TARGET
    
    284 292
     fi
    
    285 293
     
    

  • bin/cross-build-world.sh
    ... ... @@ -141,10 +141,11 @@ EOF
    141 141
     
    
    142 142
     if [ "$BUILD_RUNTIME" = "yes" ]; then
    
    143 143
         echo Building runtime
    
    144
    +    bin/git-version.sh -f > src/lisp/cmucl-version.h
    
    144 145
         (cd $TARGET/lisp; ${MAKE})
    
    145 146
     fi
    
    146 147
     
    
    147 148
     if [ "$LOAD_KERNEL" = "yes" ]; then
    
    148 149
         echo Load kernel.core
    
    149
    -    bin/load-world.sh -p $TARGET cross-compiled
    
    150
    +    bin/load-world.sh -p $TARGET
    
    150 151
     fi

  • bin/git-version.sh
    1
    +#!/bin/sh 
    
    2
    +
    
    3
    +# If FILE=yes, print out the version as a C file #define.  Otherwise,
    
    4
    +# just print the version to stdout and exit.
    
    5
    +FILE=""
    
    6
    +
    
    7
    +while getopts "f" arg; do
    
    8
    +    case $arg in
    
    9
    +	f) FILE=yes
    
    10
    +	   ;;
    
    11
    +    esac
    
    12
    +done
    
    13
    +
    
    14
    +# Script to determine the cmucl version based on git describe
    
    15
    +GIT_HASH="`(git describe --dirty 2>/dev/null || git describe 2>/dev/null)`"
    
    16
    +
    
    17
    +if [ `expr "X$GIT_HASH" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]'` != 0 ]; then
    
    18
    +    # The git hash looks like snapshot-yyyy-mm-<stuff>.  Remove the
    
    19
    +    # "snapshot-" part.
    
    20
    +    DEFAULT_VERSION=`expr "$GIT_HASH" : "snapshot-\(.*\)"`
    
    21
    +elif [ `expr "X$GIT_HASH" : 'X[0-9][0-9][a-f]'` != 0 ]; then
    
    22
    +    # The git hash looks like a release which is 3 hex digits.  Use it as is.
    
    23
    +    DEFAULT_VERSION="${GIT_HASH}"
    
    24
    +fi
    
    25
    +
    
    26
    +if [ -z "$FILE" ]; then
    
    27
    +    echo $DEFAULT_VERSION
    
    28
    +else
    
    29
    +    cat <<EOF
    
    30
    +/*
    
    31
    + * Cmucl version
    
    32
    + *
    
    33
    + * DO NOT EDIT!  This file is auto-generated via bin/git-version.sh.
    
    34
    + */
    
    35
    +
    
    36
    +#define CMUCL_VERSION "$DEFAULT_VERSION"
    
    37
    +EOF
    
    38
    +fi
    
    39
    +

  • bin/load-world.sh
    ... ... @@ -2,30 +2,14 @@
    2 2
     
    
    3 3
     usage()
    
    4 4
     {
    
    5
    -    echo "load-world.sh [-?p] target-directory [version-string]"
    
    5
    +    echo "load-world.sh [-?p] target-directory"
    
    6 6
         echo "   -p    Skip loading of PCL (Mostly for cross-compiling)"
    
    7 7
         echo "   -?    This help"
    
    8
    -    echo " If the version-string is not given, the current date and time is used"
    
    9 8
         exit 1
    
    10 9
     }
    
    11 10
     
    
    12 11
     SKIP_PCL=
    
    13 12
     NO_PCL_FEATURE=
    
    14
    -# Default version is the date with the git hash.  Older versions of
    
    15
    -# git don't support --dirty, but the output in that case is what we
    
    16
    -# want (except for ending with "dirty"), so we're set.
    
    17
    -GIT_HASH="`(cd src; git describe --dirty 2>/dev/null || git describe 2>/dev/null)`"
    
    18
    -
    
    19
    -# If the git hash looks like a snapshot tag or release, don't add the date.
    
    20
    -VERSION="`date '+%Y-%m-%d %H:%M:%S'`${GIT_HASH:+ $GIT_HASH}"
    
    21
    -if expr "X${GIT_HASH}" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]' > /dev/null; then
    
    22
    -    VERSION="${GIT_HASH}"
    
    23
    -fi
    
    24
    -
    
    25
    -if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
    
    26
    -    VERSION="${GIT_HASH}"
    
    27
    -fi
    
    28
    -echo $VERSION
    
    29 13
     
    
    30 14
     while getopts "p" arg
    
    31 15
     do
    

  • bin/make-dist.sh
    ... ... @@ -94,21 +94,6 @@ def_arch_os () {
    94 94
     # Figure out the architecture and OS in case options aren't given
    
    95 95
     def_arch_os
    
    96 96
     
    
    97
    -# Choose a version based on the git hash as the default version.  We
    
    98
    -# only compute a default if the git hash looks like a snapshot
    
    99
    -# ("snapshot-yyyy-mm") or a release number..
    
    100
    -GIT_HASH="`(cd src; git describe --dirty 2>/dev/null)`"
    
    101
    -
    
    102
    -echo GIT_HASH = ${GIT_HASH}
    
    103
    -
    
    104
    -if expr "X${GIT_HASH}" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]' > /dev/null; then
    
    105
    -    DEFAULT_VERSION=`expr "${GIT_HASH}" : "snapshot-\(.*\)"`
    
    106
    -fi
    
    107
    -
    
    108
    -if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
    
    109
    -    DEFAULT_VERSION="${GIT_HASH}"
    
    110
    -fi
    
    111
    -
    
    112 97
     # Default compression is -J (xz).  These variables are passed to the
    
    113 98
     # other scripts via the environmen, so export them.
    
    114 99
     COMPRESS=-J
    
    ... ... @@ -159,17 +144,6 @@ if [ -n "$COMPRESS_ARG" ]; then
    159 144
         esac
    
    160 145
     fi
    
    161 146
     
    
    162
    -if [ -z "$VERSION" ]; then
    
    163
    -    # If a default version exists, use it. Otherwise this is an
    
    164
    -    # error---at least one of these must not be empty.
    
    165
    -    if [ -z "${DEFAULT_VERSION}" ]; then
    
    166
    -	echo "Version (-V) must be specified because default version cannot be determined."
    
    167
    -	usage
    
    168
    -    else
    
    169
    -	VERSION=${DEFAULT_VERSION}
    
    170
    -    fi
    
    171
    -fi
    
    172
    -
    
    173 147
     if [ ! -d "$1" ]
    
    174 148
     then
    
    175 149
     	echo "$1 isn't a directory"
    
    ... ... @@ -190,10 +164,24 @@ fi
    190 164
     
    
    191 165
     TARGET="`echo $1 | sed 's:/*$::'`"
    
    192 166
     
    
    193
    -if [ -n "$INSTALL_DIR" ]; then
    
    194
    -    VERSION="today"
    
    167
    +# Choose a version based on the git hash as the default version.  We
    
    168
    +# only compute a default if the git hash looks like a snapshot
    
    169
    +# ("snapshot-yyyy-mm") or a release number..
    
    170
    +DEFAULT_VERSION="`$TARGET/lisp/lisp --version`"
    
    171
    +
    
    172
    +if [ -z "$VERSION" ]; then
    
    173
    +    # If a default version exists, use it. Otherwise this is an
    
    174
    +    # error---at least one of these must not be empty.
    
    175
    +    if [ -z "${DEFAULT_VERSION}" ]; then
    
    176
    +	echo "Version (-V) must be specified because default version cannot be determined."
    
    177
    +	usage
    
    178
    +    else
    
    179
    +	VERSION=${DEFAULT_VERSION}
    
    180
    +    fi
    
    195 181
     fi
    
    196 182
     
    
    183
    +echo INSTALL_DIR = $INSTALL_DIR
    
    184
    +
    
    197 185
     echo cmucl-$VERSION-$ARCH-$OS
    
    198 186
     ROOT=`dirname $0`
    
    199 187
     
    

  • bin/make-extra-dist.sh
    ... ... @@ -66,6 +66,8 @@ VERSION=$2
    66 66
     ARCH=$3
    
    67 67
     OS=$4
    
    68 68
     
    
    69
    +CMUCLLIBVER="lib/cmucl/$VERSION"
    
    70
    +
    
    69 71
     case $ARCH in
    
    70 72
     	x86*)		FASL="sse2f" ;;
    
    71 73
     	sparc*)		FASL=sparcf ;;
    
    ... ... @@ -90,41 +92,29 @@ if [ -z "$INSTALL_DIR" ]; then
    90 92
     fi
    
    91 93
     
    
    92 94
     echo Installing extra components
    
    93
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib
    
    95
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib
    
    94 96
     
    
    95
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
    
    97
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/subsystems
    
    96 98
     
    
    97
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/contrib
    
    99
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/contrib
    
    98 100
     
    
    99 101
     for ext in $FASL
    
    100 102
     do
    
    101 103
       install ${GROUP} ${OWNER} -m 0644 $TARGET/clx/clx-library.$ext \
    
    102
    -      $DESTDIR/lib/cmucl/lib/subsystems/
    
    104
    +      $DESTDIR/$CMUCLLIBVER/lib/subsystems/
    
    103 105
       install ${GROUP} ${OWNER} -m 0644 $TARGET/hemlock/hemlock-library.$ext \
    
    104
    -      $DESTDIR/lib/cmucl/lib/subsystems/
    
    106
    +      $DESTDIR/$CMUCLLIBVER/lib/subsystems/
    
    105 107
       install ${GROUP} ${OWNER} -m 0644 $TARGET/interface/clm-library.$ext  \
    
    106
    -      $DESTDIR/lib/cmucl/lib/subsystems/
    
    108
    +      $DESTDIR/$CMUCLLIBVER/lib/subsystems/
    
    107 109
     done
    
    108 110
     
    
    109
    -# Not sure we really need these, but we'll install them in the
    
    110
    -# ext-formats directory.  (Should they go somewhere else?)
    
    111
    -#install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/ext-formats
    
    112
    -#for f in src/i18n/NameAliases.txt src/i18n/UnicodeData.txt
    
    113
    -#do
    
    114
    -#    echo $f
    
    115
    -#    install ${GROUP} ${OWNER} -m 0644 $f $DESTDIR/lib/cmucl/lib/ext-formats/
    
    116
    -#done
    
    117
    -
    
    118
    -# install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/fonts/
    
    119
    -# install ${GROUP} ${OWNER} -m 0644 misc/8x13u.snf misc/fonts.dir \
    
    120
    -#	$DESTDIR/lib/cmucl/lib/fonts/
    
    121 111
     install ${GROUP} ${OWNER} -m 0644 src/hemlock/XKeysymDB \
    
    122 112
     	src/hemlock/hemlock11.cursor src/hemlock/hemlock11.mask \
    
    123 113
     	$TARGET/hemlock/spell-dictionary.bin \
    
    124
    -	$DESTDIR/lib/cmucl/lib/
    
    125
    -install ${GROUP} ${OWNER} -m 0755 src/hemlock/mh-scan $DESTDIR/lib/cmucl/lib/
    
    114
    +	$DESTDIR/$CMUCLLIBVER/lib/
    
    115
    +install ${GROUP} ${OWNER} -m 0755 src/hemlock/mh-scan $DESTDIR/$CMUCLLIBVER/lib/
    
    126 116
     install ${GROUP} ${OWNER} -m 0755 $TARGET/motif/server/motifd \
    
    127
    -	$DESTDIR/lib/cmucl/lib/
    
    117
    +	$DESTDIR/$CMUCLLIBVER/lib/
    
    128 118
     
    
    129 119
     # Install the contrib stuff.  Create the directories and then copy the files.
    
    130 120
     #
    
    ... ... @@ -132,39 +122,29 @@ install ${GROUP} ${OWNER} -m 0755 $TARGET/motif/server/motifd \
    132 122
     # these directories.
    
    133 123
     for d in `(cd src; find contrib -type d -print | grep -v "asdf\|defsystem")`
    
    134 124
     do
    
    135
    -    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/$d
    
    125
    +    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/$d
    
    136 126
     done
    
    137 127
     
    
    138 128
     for f in `(cd src/contrib; find . -type f -print | grep -v "asdf\|defsystem\|unix")`
    
    139 129
     do
    
    140
    -    FILE=`basename $f`
    
    141 130
         DIR=`dirname $f`
    
    142
    -    install ${GROUP} ${OWNER} -m 0644 src/contrib/$f $DESTDIR/lib/cmucl/lib/contrib/$DIR
    
    131
    +    install ${GROUP} ${OWNER} -m 0644 src/contrib/$f $DESTDIR/$CMUCLLIBVER/lib/contrib/$DIR
    
    143 132
     done
    
    144 133
     
    
    145 134
     # Install all the locale data.
    
    146 135
     
    
    147 136
     for d in `(cd src/i18n/; find locale -type d -print)`
    
    148 137
     do
    
    149
    -    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/$d
    
    138
    +    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/$d
    
    150 139
     done
    
    151 140
     
    
    152 141
     # Install mo files.  Ignore any emacs-style backup files.
    
    153 142
     for f in `(cd $TARGET/i18n; find locale -type f -print | grep -v '~.*~\|.*~')`
    
    154 143
     do
    
    155
    -    FILE=`basename $f`
    
    156 144
         DIR=`dirname $f`
    
    157
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/i18n/$f $DESTDIR/lib/cmucl/lib/$DIR
    
    145
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/i18n/$f $DESTDIR/$CMUCLLIBVER/lib/$DIR
    
    158 146
     done
    
    159 147
     
    
    160
    -# Install po files.  (Do we really need to distribute the po files?)
    
    161
    -#for f in `(cd $TARGET/i18n; find locale -type f -print | grep -v '~.*~\|.*~')`
    
    162
    -#do
    
    163
    -#    FILE=`basename $f`
    
    164
    -#    DIR=`dirname $f`
    
    165
    -#    install ${GROUP} ${OWNER} -m 0644 $TARGET/i18n/$f $DESTDIR/lib/cmucl/lib/$DIR
    
    166
    -#done
    
    167
    -
    
    168 148
     if [ -z "$INSTALL_DIR" ]; then
    
    169 149
         sync ; sleep 1 ; sync ; sleep 1 ; sync
    
    170 150
         echo Tarring extra components
    

  • bin/make-main-dist.sh
    ... ... @@ -64,14 +64,24 @@ then
    64 64
     	exit 2
    
    65 65
     fi
    
    66 66
     
    
    67
    -DESTDIR=${INSTALL_DIR:-release-$$}
    
    68
    -DOCDIR=${DOCDIR:-doc/cmucl}
    
    69
    -MANDIR=${MANDIR:-man/man1}
    
    70
    -TARGET="`echo $1 | sed 's:/*$::'`"
    
    71 67
     VERSION=$2
    
    72 68
     ARCH=$3
    
    73 69
     OS=$4
    
    74 70
     
    
    71
    +# Where to install the main library of cmucl files
    
    72
    +CMUCLLIBVER="lib/cmucl/$VERSION"
    
    73
    +
    
    74
    +# Where to install everything
    
    75
    +DESTDIR=${INSTALL_DIR:-release-$$}
    
    76
    +
    
    77
    +# Where to install docs
    
    78
    +DOCDIR=${DOCDIR:-share/cmucl/$VERSION/doc}
    
    79
    +
    
    80
    +# Where to install man pages
    
    81
    +MANDIR=${MANDIR:-share/man/man1}
    
    82
    +
    
    83
    +TARGET="`echo $1 | sed 's:/*$::'`"
    
    84
    +
    
    75 85
     # Core file to look for.
    
    76 86
     CORE=lisp.core
    
    77 87
     case $ARCH in
    
    ... ... @@ -123,52 +133,59 @@ fi
    123 133
     # set -x
    
    124 134
     echo Installing main components
    
    125 135
     install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/bin
    
    126
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl
    
    127
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib
    
    128
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
    
    129
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/ext-formats
    
    136
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER
    
    137
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib
    
    138
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/subsystems
    
    139
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/ext-formats
    
    130 140
     install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/${DOCDIR}
    
    131 141
     install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/${MANDIR}
    
    132
    -install ${GROUP} ${OWNER} -m 0755 $TARGET/lisp/lisp $DESTDIR/bin/
    
    142
    +install ${GROUP} ${OWNER} -m 0755 $TARGET/lisp/lisp $DESTDIR/bin/lisp-$VERSION
    
    143
    +# Install symlink for lisp
    
    144
    +(cd $DESTDIR/bin; ln -fs lisp-$VERSION lisp)
    
    145
    +# Install symlink for man pages
    
    146
    +(cd $DESTDIR/${MANDIR}
    
    147
    + ln -fs lisp-$VERSION.1 lisp.1
    
    148
    + ln -fs cmucl-$VERSION.1 cmucl.1)
    
    149
    +
    
    133 150
     if [ "$EXECUTABLE" = "true" ]
    
    134 151
     then
    
    135
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/lisp.a $DESTDIR/lib/cmucl/lib/
    
    136
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/exec-init.o $DESTDIR/lib/cmucl/lib/
    
    137
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/exec-final.o $DESTDIR/lib/cmucl/lib/
    
    138
    -    install ${GROUP} ${OWNER} -m 0755 src/tools/linker.sh $DESTDIR/lib/cmucl/lib/
    
    152
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/lisp.a $DESTDIR/$CMUCLLIBVER/lib/
    
    153
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/exec-init.o $DESTDIR/$CMUCLLIBVER/lib/
    
    154
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/exec-final.o $DESTDIR/$CMUCLLIBVER/lib/
    
    155
    +    install ${GROUP} ${OWNER} -m 0755 src/tools/linker.sh $DESTDIR/$CMUCLLIBVER/lib/
    
    139 156
         if [ -f src/tools/$SCRIPT-cmucl-linker-script ]; then
    
    140
    -	install ${GROUP} ${OWNER} -m 0755 src/tools/$SCRIPT-cmucl-linker-script $DESTDIR/lib/cmucl/lib/
    
    157
    +	install ${GROUP} ${OWNER} -m 0755 src/tools/$SCRIPT-cmucl-linker-script $DESTDIR/$CMUCLLIBVER/lib/
    
    141 158
         fi
    
    142 159
     fi
    
    143 160
     for corefile in $TARGET/lisp/$CORE
    
    144 161
     do
    
    145
    -  install ${GROUP} ${OWNER} -m 0644 $corefile $DESTDIR/lib/cmucl/lib/
    
    162
    +  install ${GROUP} ${OWNER} -m 0644 $corefile $DESTDIR/$CMUCLLIBVER/lib/
    
    146 163
     done
    
    147 164
     install ${GROUP} ${OWNER} -m 0755 src/tools/load-foreign.csh src/tools/config \
    
    148
    -	$DESTDIR/lib/cmucl/lib/
    
    165
    +	$DESTDIR/$CMUCLLIBVER/lib/
    
    149 166
     install ${GROUP} ${OWNER} -m 0644 src/tools/config.lisp \
    
    150
    -	$DESTDIR/lib/cmucl/lib/
    
    167
    +	$DESTDIR/$CMUCLLIBVER/lib/
    
    151 168
     install ${GROUP} ${OWNER} -m 0644 src/code/default-site-init.lisp \
    
    152
    -	$DESTDIR/lib/cmucl/lib/
    
    169
    +	$DESTDIR/$CMUCLLIBVER/lib/
    
    153 170
     install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/lisp.nm $TARGET/lisp/lisp.map \
    
    154
    -	$TARGET/lisp/internals.h $TARGET/lisp/internals.inc $DESTDIR/lib/cmucl/
    
    155
    -install ${GROUP} ${OWNER} -m 0755 src/tools/sample-wrapper $DESTDIR/lib/cmucl/
    
    171
    +	$TARGET/lisp/internals.h $TARGET/lisp/internals.inc $DESTDIR/$CMUCLLIBVER/
    
    172
    +install ${GROUP} ${OWNER} -m 0755 src/tools/sample-wrapper $DESTDIR/$CMUCLLIBVER/
    
    156 173
     
    
    157 174
     for f in gray-streams gray-compat simple-streams iodefs
    
    158 175
     do
    
    159
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/pcl/$f-library.$FASL $DESTDIR/lib/cmucl/lib/subsystems/
    
    176
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/pcl/$f-library.$FASL $DESTDIR/$CMUCLLIBVER/lib/subsystems/
    
    160 177
     done
    
    161 178
     
    
    162 179
     for f in src/pcl/simple-streams/external-formats/*.lisp src/pcl/simple-streams/external-formats/aliases src/i18n/unidata.bin
    
    163 180
     do
    
    164
    -    install ${GROUP} ${OWNER} -m 0644 $f $DESTDIR/lib/cmucl/lib/ext-formats/
    
    181
    +    install ${GROUP} ${OWNER} -m 0644 $f $DESTDIR/$CMUCLLIBVER/lib/ext-formats/
    
    165 182
     done
    
    166 183
     
    
    167 184
     # set -x
    
    168 185
     # Create the directories for asdf and defsystem
    
    169 186
     for f in asdf defsystem asdf/doc
    
    170 187
     do
    
    171
    -    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/contrib/$f
    
    188
    +    install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/contrib/$f
    
    172 189
     done
    
    173 190
     
    
    174 191
     case `uname -s` in
    
    ... ... @@ -176,34 +193,34 @@ case `uname -s` in
    176 193
       *) UCONTRIB="unix" ;;
    
    177 194
     esac
    
    178 195
     
    
    179
    -install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/contrib/unix
    
    180
    -install ${GROUP} ${OWNER} -m 0644 $TARGET/contrib/unix/$UCONTRIB.$FASL $DESTDIR/lib/cmucl/lib/contrib/unix
    
    181
    -install ${GROUP} ${OWNER} -m 0644 src/contrib/load-unix.lisp $DESTDIR/lib/cmucl/lib/contrib
    
    182
    -install ${GROUP} ${OWNER} -m 0644 src/contrib/unix/${UCONTRIB}.lisp $DESTDIR/lib/cmucl/lib/contrib/unix
    
    196
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/$CMUCLLIBVER/lib/contrib/unix
    
    197
    +install ${GROUP} ${OWNER} -m 0644 $TARGET/contrib/unix/$UCONTRIB.$FASL $DESTDIR/$CMUCLLIBVER/lib/contrib/unix
    
    198
    +install ${GROUP} ${OWNER} -m 0644 src/contrib/load-unix.lisp $DESTDIR/$CMUCLLIBVER/lib/contrib
    
    199
    +install ${GROUP} ${OWNER} -m 0644 src/contrib/unix/${UCONTRIB}.lisp $DESTDIR/$CMUCLLIBVER/lib/contrib/unix
    
    183 200
     
    
    184 201
     # Copy the source files for asdf and defsystem
    
    185 202
     for f in `(cd src; find contrib/asdf contrib/defsystem -type f -print | grep -v CVS)`
    
    186 203
     do
    
    187
    -    install ${GROUP} ${OWNER} -m 0644 src/$f $DESTDIR/lib/cmucl/lib/$f
    
    204
    +    install ${GROUP} ${OWNER} -m 0644 src/$f $DESTDIR/$CMUCLLIBVER/lib/$f
    
    188 205
     done
    
    189 206
     
    
    190 207
     # Install the fasl files for asdf and defsystem
    
    191 208
     for f in asdf defsystem
    
    192 209
     do
    
    193
    -    install ${GROUP} ${OWNER} -m 0644 $TARGET/contrib/$f/$f.$FASL $DESTDIR/lib/cmucl/lib/contrib/$f
    
    210
    +    install ${GROUP} ${OWNER} -m 0644 $TARGET/contrib/$f/$f.$FASL $DESTDIR/$CMUCLLIBVER/lib/contrib/$f
    
    194 211
     done
    
    195 212
     
    
    196 213
     # Install the docs for asdf
    
    197 214
     for f in src/contrib/asdf/doc/*
    
    198 215
     do
    
    199 216
         base=`basename $f`
    
    200
    -    install ${GROUP} ${OWNER} -m 0644 $f $DESTDIR/lib/cmucl/lib/contrib/asdf/doc/$base
    
    217
    +    install ${GROUP} ${OWNER} -m 0644 $f $DESTDIR/$CMUCLLIBVER/lib/contrib/asdf/doc/$base
    
    201 218
     done
    
    202 219
     
    
    203 220
     install ${GROUP} ${OWNER} -m 0644 src/general-info/cmucl.1 \
    
    204
    -	$DESTDIR/${MANDIR}/
    
    221
    +	$DESTDIR/${MANDIR}/cmucl-$VERSION.1
    
    205 222
     install ${GROUP} ${OWNER} -m 0644 src/general-info/lisp.1 \
    
    206
    -	$DESTDIR/${MANDIR}/
    
    223
    +	$DESTDIR/${MANDIR}/lisp-$VERSION.1
    
    207 224
     install ${GROUP} ${OWNER} -m 0644 src/general-info/README $DESTDIR/${DOCDIR}
    
    208 225
     if [ -f src/general-info/release-$VERSION.txt ] 
    
    209 226
     then
    

  • bin/make-src-dist.sh
    ... ... @@ -52,12 +52,18 @@ else
    52 52
         VERSION="`date '+%Y-%m-%d-%H:%M:%S'`"
    
    53 53
     fi
    
    54 54
     
    
    55
    +DESTDIR=${INSTALL_DIR:-release-$$}
    
    56
    +
    
    55 57
     echo Creating source distribution
    
    56 58
     GTAR_OPTIONS="--exclude=.git --exclude='*.pot.~*~'"
    
    59
    +install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/share/cmucl/$VERSION/
    
    60
    +install ${GROUP} ${OWNER} -m 0755 bin/run-unit-tests.sh $DESTDIR/bin
    
    61
    +${GTAR} ${GTAR_OPTIONS} -cf - src tests | (cd $DESTDIR/share/cmucl/$VERSION; ${GTAR} xf -)
    
    57 62
     if [ -z "$INSTALL_DIR" ]; then
    
    58 63
         # echo "  Compressing with $ZIP"
    
    59
    -    ${GTAR} ${GTAR_OPTIONS} ${COMPRESS} -cf cmucl-src-$VERSION.tar.$COMPRESS_EXT bin src tests
    
    64
    +    ls $DESTDIR/share/cmucl/$VERSION/
    
    65
    +    ${GTAR} ${GTAR_OPTIONS} ${COMPRESS} -C $DESTDIR -cf cmucl-src-$VERSION.tar.$COMPRESS_EXT share/cmucl/$VERSION/src
    
    60 66
     else
    
    61 67
         # Install in the specified directory
    
    62
    -    ${GTAR} ${GTAR_OPTIONS} -cf - bin src tests | (cd $INSTALL_DIR; ${GTAR:-tar} xf -)
    
    68
    +    ${GTAR} ${GTAR_OPTIONS} -cf - src tests | (cd $DESTDIR/share/cmucl/$VERSION; ${GTAR:-tar} xf -)
    
    63 69
     fi

  • bin/run-unit-tests.sh
    ... ... @@ -6,7 +6,8 @@
    6 6
     # then just those tests are run.
    
    7 7
     
    
    8 8
     usage() {
    
    9
    -    echo "run-tests.sh [?] [-l lisp] [tests]"
    
    9
    +    echo "run-tests.sh [?] [-d test-dir] [-l lisp] [tests]"
    
    10
    +    echo "    -d test-dir  Directory containing the unit test files"
    
    10 11
         echo "    -l lisp      Lisp to use for the tests; defaults to lisp"
    
    11 12
         echo "    -?           This help message"
    
    12 13
         echo ""
    
    ... ... @@ -23,10 +24,11 @@ usage() {
    23 24
     }
    
    24 25
     
    
    25 26
     LISP=lisp
    
    26
    -while getopts "h?l:" arg
    
    27
    +while getopts "h?l:d:" arg
    
    27 28
     do
    
    28 29
         case $arg in
    
    29 30
           l) LISP=$OPTARG ;;
    
    31
    +      d) TESTDIR=$OPTARG ;;
    
    30 32
           \?) usage ;;
    
    31 33
         esac
    
    32 34
     done
    
    ... ... @@ -47,14 +49,21 @@ function cleanup {
    47 49
     
    
    48 50
     trap cleanup EXIT
    
    49 51
     
    
    52
    +if [ -n "${TESTDIR}" ]; then
    
    53
    +    TESTDIRARG=" :test-directory \"$TESTDIR/\""
    
    54
    +else
    
    55
    +    TESTDIR="tests/"
    
    56
    +    TESTDIRARG=""
    
    57
    +fi
    
    50 58
     # Compile up the C file that is used for testing alien funcalls to
    
    51 59
     # functions that return integer types of different lengths.  We use
    
    52 60
     # gcc since clang isn't always available.
    
    53
    -(cd tests; gcc -m32 -O3 -c test-return.c)
    
    61
    +(cd "$TESTDIR"; gcc -m32 -O3 -c test-return.c)
    
    54 62
     
    
    55 63
     if [ $# -eq 0 ]; then
    
    64
    +    # Test directory arg for run-all-tests if a non-default 
    
    56 65
         # No args so run all the tests
    
    57
    -    $LISP -nositeinit -noinit -load tests/run-tests.lisp -eval '(cmucl-test-runner:run-all-tests)'
    
    66
    +    $LISP -nositeinit -noinit -load "$TESTDIR"/run-tests.lisp -eval "(cmucl-test-runner:run-all-tests ${TESTDIRARG})"
    
    58 67
     else
    
    59 68
         # Run selected files.  Convert each file name to uppercase and append "-TESTS"
    
    60 69
         result=""
    
    ... ... @@ -63,6 +72,6 @@ else
    63 72
     	new=`echo $f | tr '[a-z]' '[A-Z]'`
    
    64 73
             result="$result "\"$new-TESTS\"
    
    65 74
         done
    
    66
    -    $LISP -nositeinit -noinit -load tests/run-tests.lisp -eval "(progn (cmucl-test-runner:load-test-files) (cmucl-test-runner:run-test $result))"
    
    75
    +    $LISP -nositeinit -noinit -load "$TESTDIR"/run-tests.lisp -eval "(progn (cmucl-test-runner:load-test-files) (cmucl-test-runner:run-test $result))"
    
    67 76
     fi
    
    68 77
     

  • src/code/commandline.lisp
    ... ... @@ -109,7 +109,13 @@
    109 109
     	(return (setf *command-line-switches*
    
    110 110
     		      (nreverse *command-line-switches*))))
    
    111 111
           (let* ((position (position #\= (the simple-string str) :test #'char=))
    
    112
    -	     (switch (subseq (the simple-string str) 1 position))
    
    112
    +	     ;; Extract the name of the switch.  The actual arg can be
    
    113
    +	     ;; "-switch" or "--switch".
    
    114
    +	     (switch (subseq (the simple-string str)
    
    115
    +			     (position-if-not #'(lambda (c)
    
    116
    +						  (char= c #\-))
    
    117
    +					      str)
    
    118
    +			     position))
    
    113 119
     	     (value (if position
    
    114 120
     			(subseq (the simple-string str) (1+ position)
    
    115 121
     				(length (the simple-string str))))))
    
    ... ... @@ -143,7 +149,14 @@
    143 149
       the switch.  If no value was specified, then any following words are
    
    144 150
       returned.  If there are no following words, then t is returned.  If
    
    145 151
       the switch was not specified, then nil is returned."
    
    146
    -  (let* ((name (if (char= (schar sname 0) #\-) (subseq sname 1) sname))
    
    152
    +  (let* ((posn (position-if-not #'(lambda (ch)
    
    153
    +				    (char= ch #\-))
    
    154
    +				sname))
    
    155
    +	 ;; Strip up to 2 leading "-" to get the switch name.
    
    156
    +	 ;; Otherwise, return the entire switch name.
    
    157
    +	 (name (if (and posn (<= posn 2))
    
    158
    +		   (subseq sname posn)
    
    159
    +		   sname))
    
    147 160
     	 (switch (find name *command-line-switches*
    
    148 161
     		       :test #'string-equal
    
    149 162
     		       :key #'cmd-switch-name)))
    
    ... ... @@ -177,17 +190,17 @@
    177 190
     					 (demons *command-switch-demons*))
    
    178 191
       (flet ((invoke-demon (switch)
    
    179 192
     	   (let* ((name (cmd-switch-name switch))
    
    180
    -		  (demon (cdr (assoc name demons :test #'string-equal))))
    
    193
    +		  (demon (cdr (assoc name demons :test #'string=))))
    
    181 194
     	     (cond (demon (funcall demon switch))
    
    182
    -		   ((or (member name *legal-cmd-line-switches* :test #'string-equal :key #'car)
    
    195
    +		   ((or (member name *legal-cmd-line-switches* :test #'string= :key #'car)
    
    183 196
     			(not *complain-about-illegal-switches*)))
    
    184 197
     		   (t (warn (intl:gettext "~S is an illegal switch") switch)))
    
    185 198
     	     (lisp::finish-standard-output-streams))))
    
    186 199
         ;; We want to process -help (or --help) first, if it's given.
    
    187 200
         ;; Since we're asking for help, we don't want to process any of
    
    188 201
         ;; the other switches.
    
    189
    -    (let ((maybe-help (or (find "help" switches :key #'cmd-switch-name :test #'string-equal)
    
    190
    -			  (find "-help" switches :key #'cmd-switch-name :test #'string-equal))))
    
    202
    +    (let ((maybe-help (or (find "help" switches :key #'cmd-switch-name :test #'string=)
    
    203
    +			  (find "-help" switches :key #'cmd-switch-name :test #'string=))))
    
    191 204
           (if maybe-help
    
    192 205
     	(invoke-demon maybe-help)
    
    193 206
     	(dolist (switch switches t)
    
    ... ... @@ -230,12 +243,12 @@
    230 243
     	(lisp::finish-standard-output-streams)
    
    231 244
     	(setf start next)))))
    
    232 245
     
    
    233
    -;; Docstrings should have lines longer than 72 characters so that we
    
    234
    -;; can print out the docstrings nicely on one line for help.
    
    235
    -;;                                                                     | <-- char 72
    
    246
    +;; Docstrings MUST consist of simple text and punctuation and
    
    247
    +;; newlines; no special markup is allowed.  When help is printed, the
    
    248
    +;; help string is automatically filled and wrapped to 80 columns.
    
    236 249
     (defswitch "eval" #'eval-switch-demon
    
    237 250
       "Evaluate the specified Lisp expression during the start up
    
    238
    -  sequence.  the value of the form will not be printed unless it is
    
    251
    +  sequence.  The value of the form will not be printed unless it is
    
    239 252
       wrapped in a form that does output."
    
    240 253
       "expression")
    
    241 254
     
    
    ... ... @@ -325,7 +338,7 @@
    325 338
     
    
    326 339
     (defswitch "quiet" nil
    
    327 340
       "Causes Lisp to start up silently, disabling printing of the herald
    
    328
    -  and causing most unnecessary noise, like GC messages,load messages,
    
    341
    +  and causing most unnecessary noise, like GC messages, load messages,
    
    329 342
       etc. to be suppressed.")
    
    330 343
     
    
    331 344
     (defswitch "debug-lisp-search" nil
    
    ... ... @@ -338,7 +351,8 @@
    338 351
     
    
    339 352
     (defun help-switch-demon (switch)
    
    340 353
       (declare (ignore switch))
    
    341
    -  (format t (intl:gettext "~&Usage: ~A <options>~2%") *command-line-utility-name*)
    
    354
    +  (format t (intl:gettext "~&Usage: ~A <options> [-- [app-args]*]~2%")
    
    355
    +	  *command-line-utility-name*)
    
    342 356
       (flet
    
    343 357
           ((get-words (s)
    
    344 358
     	 (declare (string s))
    
    ... ... @@ -366,7 +380,12 @@
    366 380
     		     :key #'car))
    
    367 381
           (destructuring-bind (name doc arg)
    
    368 382
     	  s
    
    369
    -	(format t "    -~A ~@[~A~]~%" name (if arg (intl:gettext arg)))
    
    383
    +	;; Print both -switch and --switch, and the optional arg
    
    384
    +	;; value.
    
    385
    +	(format t "    -~A|--~A   ~@[~A~]~%"
    
    386
    +		name name
    
    387
    +		(if arg (intl:gettext arg)))
    
    388
    +
    
    370 389
     	;; Poor man's formatting of the help string
    
    371 390
     	(let ((*print-right-margin* 80))
    
    372 391
     	  ;; Extract all the words from the string and print them out
    
    ... ... @@ -392,19 +411,14 @@
    392 411
     (defswitch "help" #'help-switch-demon
    
    393 412
       "Print out the command line options and exit")
    
    394 413
     
    
    395
    -(defswitch "-help" #'help-switch-demon
    
    396
    -  "Same as -help.")
    
    397
    -
    
    398 414
     (defun version-switch-demon (switch)
    
    399 415
       (declare (ignore switch))
    
    400 416
       (format t "~A~%" (lisp-implementation-version))
    
    401 417
       (ext:quit))
    
    402 418
     
    
    419
    +;; the switches "-version" and "--version" are never actually called
    
    420
    +;; from lisp because main() handles it and returns before the lisp
    
    421
    +;; initial function is ever run.  It's here so that -help will print
    
    422
    +;; it out so the user knows about it.
    
    403 423
     (defswitch "version" #'version-switch-demon
    
    404
    -  "Prints the cmucl version and exits")
    
    405
    -
    
    406
    -;; Make --version work for the benefit of those who are accustomed to
    
    407
    -;; GNU software.
    
    408
    -(defswitch "-version" #'version-switch-demon
    
    409
    -  "Prints the cmucl version and exits; same as -version")
    
    410
    -
    424
    +  "Prints the cmucl version and exits, without loading the lisp core.")

  • src/code/default-site-init.lisp
    ... ... @@ -32,13 +32,22 @@
    32 32
     ;;;   bin/
    
    33 33
     ;;;   lib/
    
    34 34
     ;;;    cmucl/
    
    35
    -;;;     lib/
    
    36
    -;;;      lisp*.coore
    
    37
    -;;;   man/
    
    38
    -;;;   src/
    
    35
    +;;;     <version>/
    
    36
    +;;;       lib/
    
    37
    +;;;   share/
    
    38
    +;;;    cmucl/
    
    39
    +;;;     <version>/
    
    40
    +;;;      src/
    
    41
    +;;;      tests/
    
    42
    +;;;    man/
    
    43
    +;;;     man1/
    
    39 44
     ;;;
    
    40 45
     ;;; If your sources are located somewhere else, change this
    
    41 46
     ;;; accordingly.
    
    42
    -(setf (search-list "target:")
    
    43
    -      '("library:../src/"))
    
    47
    +(push (pathname
    
    48
    +       (concatenate 'string
    
    49
    +		    "library:../../../../share/cmucl/"
    
    50
    +		    lisp::*lisp-implementation-version*
    
    51
    +		    "/src/"))
    
    52
    +      (search-list "target:"))
    
    44 53
     

  • src/code/exports.lisp
    ... ... @@ -1910,6 +1910,7 @@
    1910 1910
     	   
    
    1911 1911
     	   "STRING-TO-OCTETS" "OCTETS-TO-STRING" "*DEFAULT-EXTERNAL-FORMAT*"
    
    1912 1912
     	   "STRING-ENCODE" "STRING-DECODE"
    
    1913
    +	   "STRING-OCTET-COUNT"
    
    1913 1914
     	   "SET-SYSTEM-EXTERNAL-FORMAT"
    
    1914 1915
     	   "+REPLACEMENT-CHARACTER-CODE+"
    
    1915 1916
     	   "LIST-ALL-EXTERNAL-FORMATS"
    

  • src/code/unix.lisp
    ... ... @@ -2600,37 +2600,82 @@
    2600 2600
     (defun unix-mkstemp (template)
    
    2601 2601
       _N"Generates a unique temporary file name from TEMPLATE, and creates
    
    2602 2602
       and opens the file.  On success, the corresponding file descriptor
    
    2603
    -  and name of the file is returned.
    
    2604
    -
    
    2605
    - The last six characters of the template must be \"XXXXXX\"."
    
    2606
    -  ;; Hope this buffer is large enough!
    
    2607
    -  (let ((octets (%name->file template)))
    
    2608
    -    (syscall ("mkstemp" c-call:c-string)
    
    2603
    +  and name of the file is returned.  Otherwise, NIL and the UNIX error
    
    2604
    +  code is returned."
    
    2605
    +  (let* ((format (if (eql *filename-encoding* :null)
    
    2606
    +		     :iso8859-1
    
    2607
    +		     *filename-encoding*))
    
    2608
    +	 ;; Convert the string to octets using the
    
    2609
    +	 ;; *FILENAME-ENCODING*.  Should we signal an error if the
    
    2610
    +	 ;; string can't be encoded?
    
    2611
    +	 (octets (stream:string-to-octets template
    
    2612
    +					  :external-format format))
    
    2613
    +	 (length (length octets)))
    
    2614
    +    (with-alien ((buffer (* c-call:unsigned-char)))
    
    2615
    +      (setf buffer (make-alien c-call:unsigned-char (1+ length)))
    
    2616
    +      ;; Copy the octets from OCTETS to the null-terminated array BUFFER.
    
    2617
    +      (system:without-gcing
    
    2618
    +	  (kernel:system-area-copy (vector-sap octets) 0
    
    2619
    +				   (alien-sap buffer) 0
    
    2620
    +				   (* length vm:byte-bits)))
    
    2621
    +      (setf (deref buffer length) 0)
    
    2622
    +
    
    2623
    +      (syscall ("mkstemp" (* c-call:char))
    
    2609 2624
     	       (values result
    
    2610
    -		       ;; Convert the file name back to a Lisp string.
    
    2611
    -		       (%file->name octets))
    
    2612
    -	       octets)))
    
    2625
    +		       (progn
    
    2626
    +			 ;; Copy out the alien bytes and convert back
    
    2627
    +			 ;; to a lisp string.
    
    2628
    +			 (system:without-gcing
    
    2629
    +			     (kernel:system-area-copy (alien-sap buffer) 0
    
    2630
    +						      (vector-sap octets) 0
    
    2631
    +						      (* length vm:byte-bits)))
    
    2632
    +			 (stream:octets-to-string octets
    
    2633
    +						  :external-format format)))
    
    2634
    +	       (cast buffer (* c-call:char))))))
    
    2613 2635
     
    
    2614 2636
     (defun unix-mkdtemp (template)
    
    2615
    -  _N"Generate a uniquely named temporary directory from Template,
    
    2616
    -  which must have \"XXXXXX\" as the last six characters.  The
    
    2637
    +  _N"Generate a uniquely named temporary directory from Template.  The
    
    2617 2638
       directory is created with permissions 0700.  The name of the
    
    2618
    -  directory is returned."
    
    2619
    -  (let* ((octets (%name->file template))
    
    2620
    -	 (result (alien-funcall
    
    2621
    -		  (extern-alien "mkdtemp"
    
    2622
    -				(function (* char)
    
    2623
    -					  c-call:c-string))
    
    2624
    -		  octets)))
    
    2625
    -    (if (null-alien result)
    
    2626
    -	(values nil (unix-errno))
    
    2627
    -	(%file->name octets))))
    
    2639
    +  directory is returned.
    
    2640
    +
    
    2641
    +  If the directory cannot be created NIL and the UNIX error code is
    
    2642
    +  returned."
    
    2643
    +  (let* ((format (if (eql *filename-encoding* :null)
    
    2644
    +		     :iso8859-1
    
    2645
    +		     *filename-encoding*))
    
    2646
    +	 ;; Encode the string using the appropriate
    
    2647
    +	 ;; *filename-encoding*.  Should we signal an error if the
    
    2648
    +	 ;; string can't be encoded in that format?
    
    2649
    +	 (octets (stream:string-to-octets template
    
    2650
    +					  :external-format format))
    
    2651
    +	 (length (length octets)))
    
    2652
    +    (with-alien ((buffer (* c-call:unsigned-char)))
    
    2653
    +      (setf buffer (make-alien c-call:unsigned-char (1+ length)))
    
    2654
    +      ;; Copy the octets from OCTETS to the null-terminated array BUFFER.
    
    2655
    +      (system:without-gcing
    
    2656
    +	  (kernel:system-area-copy (vector-sap octets) 0
    
    2657
    +				   (alien-sap buffer) 0
    
    2658
    +				   (* length vm:byte-bits)))
    
    2659
    +      (setf (deref buffer length) 0)
    
    2660
    +
    
    2661
    +      (let ((result (alien-funcall
    
    2662
    +		     (extern-alien "mkdtemp"
    
    2663
    +				   (function (* char)
    
    2664
    +					     (* char)))
    
    2665
    +		     (cast buffer (* char)))))
    
    2666
    +	;; If mkdtemp worked, a non-NIL value is returned, return the
    
    2667
    +	;; resulting name.  Otherwise, return NIL and the errno.
    
    2668
    +	(if (null-alien result)
    
    2669
    +	    (values nil (unix-errno))
    
    2670
    +	    (%file->name (cast result c-call:c-string)))))))
    
    2628 2671
     
    
    2629 2672
     (defun unix-strerror (errno)
    
    2630 2673
       _N"Returns a string that describes the error code Errno"
    
    2631
    -  (cast
    
    2632
    -      (alien-funcall
    
    2633
    -       (extern-alien "strerror"
    
    2634
    -		     (function (* char) int))
    
    2635
    -       errno)
    
    2636
    -    c-string))
    2674
    +  (let ((result
    
    2675
    +	  (alien-funcall
    
    2676
    +	   (extern-alien "strerror"
    
    2677
    +			 (function (* char) int))
    
    2678
    +	   errno)))
    
    2679
    +    ;; Result from strerror can be localized so we need to decode
    
    2680
    +    ;; those octets to get a proper Lisp string.
    
    2681
    +    (string-decode (cast result c-string) :default)))

  • src/compiler/arm/parms.lisp
    ... ... @@ -343,11 +343,11 @@
    343 343
         :key-or-value
    
    344 344
     
    
    345 345
         lisp::*unidata-path*
    
    346
    +    lisp::*lisp-implementation-version*
    
    346 347
         
    
    347 348
         ;; Some spare static symbols.  Useful for adding another static
    
    348 349
         ;; symbol without having to do a cross-compile.  Just rename one
    
    349 350
         ;; of these to the desired name.
    
    350
    -    spare-9
    
    351 351
         spare-8
    
    352 352
         spare-7
    
    353 353
         spare-6
    

  • src/compiler/ppc/parms.lisp
    ... ... @@ -295,9 +295,9 @@
    295 295
         :key-and-value
    
    296 296
         :key-or-value
    
    297 297
         
    
    298
    +    lisp::*lisp-implementation-version*
    
    298 299
         ;; Spare symbols.  Rename these when you need to add some static
    
    299 300
         ;; symbols and don't want to do a cross-compile.
    
    300
    -    sparc-9
    
    301 301
         spare-8
    
    302 302
         spare-7
    
    303 303
         spare-6
    

  • src/compiler/sparc/parms.lisp
    ... ... @@ -358,11 +358,11 @@
    358 358
         *fp-constant-0f0*
    
    359 359
     
    
    360 360
         lisp::*unidata-path*
    
    361
    +    lisp::*lisp-implementation-version*
    
    361 362
         
    
    362 363
         ;; Some spare static symbols.  Useful for adding another static
    
    363 364
         ;; symbol without having to do a cross-compile.  Just rename one
    
    364 365
         ;; of these to the desired name.
    
    365
    -    spare-9
    
    366 366
         spare-8
    
    367 367
         spare-7
    
    368 368
         spare-6
    

  • src/compiler/x86/parms.lisp
    ... ... @@ -380,9 +380,9 @@
    380 380
           :key-or-value
    
    381 381
     
    
    382 382
           lisp::*unidata-path*
    
    383
    +      lisp::*lisp-implementation-version*
    
    383 384
           ;; Spare symbols.  Rename these when you need to add some static
    
    384 385
           ;; symbols and don't want to do a cross-compile.
    
    385
    -      spare-9
    
    386 386
           spare-8
    
    387 387
           spare-7
    
    388 388
           spare-6
    

  • src/docs/cmu-user/unix.tex
    ... ... @@ -244,9 +244,10 @@ for SAPs when possible, so the consing overhead is generally minimal.
    244 244
     
    
    245 245
     \begin{defun}{system:}{sap-ref-8}{\args{\var{sap} \var{offset}}}
    
    246 246
       \defunx[system:]{sap-ref-16}{\args{\var{sap} \var{offset}}}
    
    247
    -  \defunx[system:]{sap-ref-32}{\args{\var{sap} \var{offset}}}
    
    248
    -  
    
    249
    -  These functions return the 8, 16 or 32 bit unsigned integer at
    
    247
    +  \defunx[system:]{sap-ref-32}{\args{\var{sap} \var{offset}}
    
    248
    +  \defunx[system:]{sap-ref-64}{\args{\var{sap} \var{offset}}}
    
    249
    +
    
    250
    +  These functions return the 8, 16, 32 or 64 bit unsigned integer at
    
    250 251
       \var{offset} from \var{sap}.  The \var{offset} is always a byte
    
    251 252
       offset, regardless of the number of bits accessed.  \code{setf} may
    
    252 253
       be used with the these functions to deposit values into virtual
    
    ... ... @@ -256,7 +257,8 @@ for SAPs when possible, so the consing overhead is generally minimal.
    256 257
     \begin{defun}{system:}{signed-sap-ref-8}{\args{\var{sap} \var{offset}}}
    
    257 258
       \defunx[system:]{signed-sap-ref-16}{\args{\var{sap} \var{offset}}}
    
    258 259
       \defunx[system:]{signed-sap-ref-32}{\args{\var{sap} \var{offset}}}
    
    259
    -  
    
    260
    +  \defunx[system:]{signed-sap-ref-64}{\args{\var{sap} \var{offset}}}
    
    261
    +
    
    260 262
       These functions are the same as the above unsigned operations,
    
    261 263
       except that they sign-extend, returning a negative number if the
    
    262 264
       high bit is set.
    

  • src/general-info/release-21f.md
    ... ... @@ -27,6 +27,8 @@ public domain.
    27 27
         * The RNG has changed from an old version of xoroshiro128+ to
    
    28 28
           xoroshiro128**.  This means sequences of random numbers will be
    
    29 29
           different from before.  See ~~#276~~.
    
    30
    +    * The layout of the distribution has changed.  Version numbers are
    
    31
    +      added to files and directories.  For the exact layout, see !261.
    
    30 32
       * ANSI compliance fixes:
    
    31 33
       * Bug fixes:
    
    32 34
       * Gitlab tickets:
    
    ... ... @@ -112,9 +114,15 @@ public domain.
    112 114
         * ~~#360~~ Adding site-init file
    
    113 115
         * ~~#361~~ Add herald item to mention where to report issues
    
    114 116
         * ~~#362~~ Simplify "library:" search-list
    
    117
    +    * ~~#363~~ Version numbers added to files and directories.  The
    
    118
    +      distribution layout has changed.
    
    115 119
         * ~~#364~~ Add interface to `mkdtemp` and `mkstemp`
    
    116
    -    * ~~#367~~ Add stream:string-count-octets to count octets in a string
    
    120
    +    * ~~#367~~ Add `stream:string-count-octets` to count octets in a string
    
    117 121
         * ~~#369~~ Improve docstring for `unix::unix-setlocale`
    
    122
    +    * ~~#375~~ `unix-mkstemp` and `unix-mkdtemp` actually returns the
    
    123
    +      file names now.
    
    124
    +    * ~~#379~~ Support GNU-style command-line option names
    
    125
    +    * ~~#382~~ Command-line options are case-sensitive
    
    118 126
       * Other changes:
    
    119 127
       * Improvements to the PCL implementation of CLOS:
    
    120 128
       * Changes to building procedure:
    

  • src/i18n/locale/cmucl-bsd-os.pot
    ... ... @@ -15,10 +15,6 @@ msgstr ""
    15 15
     "Content-Type: text/plain; charset=UTF-8\n"
    
    16 16
     "Content-Transfer-Encoding: 8bit\n"
    
    17 17
     
    
    18
    -#: src/code/bsd-os.lisp
    
    19
    -msgid "Unix system call getrusage failed: ~A."
    
    20
    -msgstr ""
    
    21
    -
    
    22 18
     #: src/code/signal.lisp
    
    23 19
     msgid "Emt instruction"
    
    24 20
     msgstr ""
    

  • src/i18n/locale/cmucl.pot
    ... ... @@ -6060,7 +6060,7 @@ msgstr ""
    6060 6060
     #: src/code/commandline.lisp
    
    6061 6061
     msgid ""
    
    6062 6062
     "Evaluate the specified Lisp expression during the start up\n"
    
    6063
    -"  sequence.  the value of the form will not be printed unless it is\n"
    
    6063
    +"  sequence.  The value of the form will not be printed unless it is\n"
    
    6064 6064
     "  wrapped in a form that does output."
    
    6065 6065
     msgstr ""
    
    6066 6066
     
    
    ... ... @@ -6182,7 +6182,7 @@ msgstr ""
    6182 6182
     #: src/code/commandline.lisp
    
    6183 6183
     msgid ""
    
    6184 6184
     "Causes Lisp to start up silently, disabling printing of the herald\n"
    
    6185
    -"  and causing most unnecessary noise, like GC messages,load messages,\n"
    
    6185
    +"  and causing most unnecessary noise, like GC messages, load messages,\n"
    
    6186 6186
     "  etc. to be suppressed."
    
    6187 6187
     msgstr ""
    
    6188 6188
     
    
    ... ... @@ -6197,7 +6197,7 @@ msgid "Specify the unidata.bin file to be used."
    6197 6197
     msgstr ""
    
    6198 6198
     
    
    6199 6199
     #: src/code/commandline.lisp
    
    6200
    -msgid "~&Usage: ~A <options>~2%"
    
    6200
    +msgid "~&Usage: ~A <options> [-- [app-args]*]~2%"
    
    6201 6201
     msgstr ""
    
    6202 6202
     
    
    6203 6203
     #: src/code/commandline.lisp
    
    ... ... @@ -6205,15 +6205,7 @@ msgid "Print out the command line options and exit"
    6205 6205
     msgstr ""
    
    6206 6206
     
    
    6207 6207
     #: src/code/commandline.lisp
    
    6208
    -msgid "Same as -help."
    
    6209
    -msgstr ""
    
    6210
    -
    
    6211
    -#: src/code/commandline.lisp
    
    6212
    -msgid "Prints the cmucl version and exits"
    
    6213
    -msgstr ""
    
    6214
    -
    
    6215
    -#: src/code/commandline.lisp
    
    6216
    -msgid "Prints the cmucl version and exits; same as -version"
    
    6208
    +msgid "Prints the cmucl version and exits, without loading the lisp core."
    
    6217 6209
     msgstr ""
    
    6218 6210
     
    
    6219 6211
     #: src/code/env-access.lisp
    

  • src/lisp/Linux-os.c
    ... ... @@ -476,7 +476,7 @@ sigsegv_handler(HANDLER_ARGS)
    476 476
     #endif
    
    477 477
         if (gc_write_barrier(code->si_addr))
    
    478 478
     	return;
    
    479
    -    DPRINTF(0, (stderr, "sigsegv: PC: %p\n", SC_PC(os_context)));
    
    479
    +    DPRINTF(0, (stderr, "sigsegv: PC: %#lx\n", SC_PC(os_context)));
    
    480 480
     
    
    481 481
     #ifdef RED_ZONE_HIT
    
    482 482
         {
    

  • src/lisp/elf.h
    ... ... @@ -9,7 +9,7 @@
    9 9
      * interface to both elf and mach-o support.  I (rtoy) was too lazy to
    
    10 10
      * change the name to something more descriptive.
    
    11 11
      */
    
    12
    -#if !defined(_ELF_H_INCLUDED_)
    
    12
    +#if !defined(ELF_H_INCLUDED)
    
    13 13
     
    
    14 14
     #define ELF_H_INCLUDED
    
    15 15
     
    

  • src/lisp/lisp.c
    ... ... @@ -42,6 +42,12 @@
    42 42
     #include <time.h>
    
    43 43
     #endif
    
    44 44
     
    
    45
    +#include "cmucl-version.h"
    
    46
    +
    
    47
    +#ifndef CMUCL_VERSION
    
    48
    +#error CMUCL_VERSION not defined!
    
    49
    +#endif
    
    50
    +
    
    45 51
     
    
    46 52
     
    
    47 53
     /* SIGINT handler that invokes the monitor. */
    
    ... ... @@ -89,10 +95,11 @@ alloc_str_list(const char *list[])
    89 95
     }
    
    90 96
     
    
    91 97
     /* Default paths for CMUCLLIB */
    
    98
    +
    
    99
    +static char cmucl_version[] = CMUCL_VERSION;
    
    100
    +
    
    92 101
     static char *cmucllib_search_list[] = {
    
    93
    -    "./.",
    
    94
    -    "./../lib/cmucl/lib",
    
    95
    -    "./../lib",
    
    102
    +    "./../lib/cmucl/" CMUCL_VERSION "/lib",
    
    96 103
         NULL
    
    97 104
     };
    
    98 105
     
    
    ... ... @@ -335,7 +342,7 @@ search_core(const char *lib, const char *default_core)
    335 342
     	    return buf;
    
    336 343
     	} else {
    
    337 344
     	    if (debug_lisp_search) {
    
    338
    -		fprintf(stderr, "Found it, but we can't read it!\n");
    
    345
    +		fprintf(stderr, "Does not exist, or can't read it if it does!\n");
    
    339 346
     	    }
    
    340 347
     	}
    
    341 348
         } while (*lib++ == ':');
    
    ... ... @@ -453,6 +460,41 @@ core_failure(const char* core, const char* argv[])
    453 460
         exit(1);
    
    454 461
     }
    
    455 462
     
    
    463
    +/*
    
    464
    + * Match the actual command line option "arg" with the arg name in
    
    465
    + * "argname".  The option matches if it is exacty the arg name
    
    466
    + * prefixed by either one or two "-" characters.
    
    467
    + *
    
    468
    + * Returns non-zero if it matches.
    
    469
    + */
    
    470
    +int match_option(const char* arg, const char* argname)
    
    471
    +{
    
    472
    +    if ((strlen(arg) < 2) || strlen(argname) < 1) {
    
    473
    +	/*
    
    474
    +	 * The actual arg must be at least 2 characters.  The argname
    
    475
    +	 * must have at least 1.
    
    476
    +	 */
    
    477
    +	return 0;
    
    478
    +    }
    
    479
    +
    
    480
    +    /* Must start with a "-" */
    
    481
    +    if (arg[0] != '-') {
    
    482
    +	return 0;
    
    483
    +    }
    
    484
    +
    
    485
    +    if (strcmp(arg + 1, argname) == 0) {
    
    486
    +	/* We have "-" followed by the argname.  That's a match. */
    
    487
    +	return 1;
    
    488
    +    }
    
    489
    +    
    
    490
    +    if ((arg[1] == '-') && (strcmp(arg + 2, argname) == 0)) {
    
    491
    +	/* We have "--" followed by the argname.  That's a match. */
    
    492
    +	return 1;
    
    493
    +    }
    
    494
    +
    
    495
    +    return 0;
    
    496
    +}
    
    497
    +    
    
    456 498
     int
    
    457 499
     main(int argc, const char *argv[], const char *envp[])
    
    458 500
     {
    
    ... ... @@ -522,7 +564,7 @@ main(int argc, const char *argv[], const char *envp[])
    522 564
     
    
    523 565
         argptr = argv;
    
    524 566
         while ((arg = *++argptr) != NULL) {
    
    525
    -	if (strcmp(arg, "-core") == 0) {
    
    567
    +	if (match_option(arg, "core")) {
    
    526 568
     	    if (builtin_image_flag) {
    
    527 569
     		fprintf(stderr,
    
    528 570
     			"Warning:  specifying a core file with an executable image is unusual,\nbut should work.\n");
    
    ... ... @@ -536,87 +578,98 @@ main(int argc, const char *argv[], const char *envp[])
    536 578
     	    core = *++argptr;
    
    537 579
     	    if (core == NULL) {
    
    538 580
     		fprintf(stderr,
    
    539
    -			"-core must be followed by the name of the core file to use.\n");
    
    581
    +			"%s must be followed by the name of the core file to use.\n",
    
    582
    +			arg);
    
    540 583
     		exit(1);
    
    541 584
     	    }
    
    542
    -	} else if (strcmp(arg, "-lib") == 0) {
    
    585
    +	} else if (match_option(arg, "lib")) {
    
    543 586
     	    lib = *++argptr;
    
    544 587
     	    if (lib == NULL) {
    
    545 588
     		fprintf(stderr,
    
    546
    -			"-lib must be followed by a string denoting the CMUCL library path.\n");
    
    589
    +			"%s must be followed by a string denoting the CMUCL library path.\n",
    
    590
    +			arg);
    
    547 591
     		exit(1);
    
    548 592
     	    }
    
    549
    -        } else if (strcmp(arg, "-read-only-space-size") == 0) {
    
    593
    +        } else if (match_option(arg, "read-only-space-size")) {
    
    550 594
                 const char *str = *++argptr;
    
    551 595
     
    
    552 596
                 if (str == NULL) {
    
    553 597
                     fprintf(stderr,
    
    554
    -                        "-read-only-space-size must be followed by the size in MBytes.\n");
    
    598
    +                        "%s must be followed by the size in MBytes.\n",
    
    599
    +			arg);
    
    555 600
                     exit(1);
    
    556 601
                 }
    
    557 602
                 read_only_space_size = atoi(str) * 1024 * 1024;
    
    558 603
                 if (read_only_space_size > READ_ONLY_SPACE_SIZE) {
    
    559 604
                     fprintf(stderr,
    
    560
    -                        "-read-only-space-size must be no greater than %lu MBytes.\n",
    
    605
    +                        "%s must be no greater than %lu MBytes.\n",
    
    606
    +			arg,
    
    561 607
                             READ_ONLY_SPACE_SIZE / (1024 * 1024UL));
    
    562 608
                     fprintf(stderr, "  Continuing with default size.\n");
    
    563 609
                     read_only_space_size = READ_ONLY_SPACE_SIZE;
    
    564 610
                 }
    
    565
    -        } else if (strcmp(arg, "-static-space-size") == 0) {
    
    611
    +        } else if (match_option(arg, "static-space-size")) {
    
    566 612
                 const char *str = *++argptr;
    
    567 613
     
    
    568 614
                 if (str == NULL) {
    
    569 615
                     fprintf(stderr,
    
    570
    -                        "-static-space-size must be followed by the size in MBytes.\n");
    
    616
    +                        "%s must be followed by the size in MBytes.\n",
    
    617
    +			arg);
    
    571 618
                     exit(1);
    
    572 619
                 }
    
    573 620
                 static_space_size = atoi(str) * 1024 * 1024;
    
    574 621
                 if (static_space_size > STATIC_SPACE_SIZE) {
    
    575 622
                     fprintf(stderr,
    
    576
    -                        "-static-space-size must be no greater than %lu MBytes.\n",
    
    623
    +                        "%s must be no greater than %lu MBytes.\n",
    
    624
    +			arg,
    
    577 625
                             STATIC_SPACE_SIZE / (1024 * 1024UL));
    
    578 626
                     fprintf(stderr, "  Continuing with default size.\n");
    
    579 627
                     static_space_size = STATIC_SPACE_SIZE;
    
    580 628
                 }
    
    581
    -        } else if (strcmp(arg, "-binding-stack-size") == 0) {
    
    629
    +        } else if (match_option(arg, "binding-stack-size")) {
    
    582 630
                 const char *str = *++argptr;
    
    583 631
     
    
    584 632
                 if (str == NULL) {
    
    585 633
                     fprintf(stderr,
    
    586
    -                        "-binding-stack-size must be followed by the size in MBytes.\n");
    
    634
    +                        "%s must be followed by the size in MBytes.\n",
    
    635
    +			arg);
    
    587 636
                     exit(1);
    
    588 637
                 }
    
    589 638
                 binding_stack_size = atoi(str) * 1024 * 1024;
    
    590 639
                 if (binding_stack_size > BINDING_STACK_SIZE) {
    
    591 640
                     fprintf(stderr,
    
    592
    -                        "-binding-stack-size must be no greater than %lu MBytes.\n",
    
    641
    +                        "%s must be no greater than %lu MBytes.\n",
    
    642
    +			arg,
    
    593 643
                             BINDING_STACK_SIZE / (1024 * 1024UL));
    
    594 644
                     fprintf(stderr, "  Continuing with default size.\n");
    
    595 645
                     binding_stack_size = BINDING_STACK_SIZE;
    
    596 646
                 }
    
    597
    -        } else if (strcmp(arg, "-control-stack-size") == 0) {
    
    647
    +        } else if (match_option(arg, "control-stack-size")) {
    
    598 648
                 const char *str = *++argptr;
    
    599 649
     
    
    600 650
                 if (str == NULL) {
    
    601 651
                     fprintf(stderr,
    
    602
    -                        "-control-stack-size must be followed by the size in MBytes.\n");
    
    652
    +                        "%s must be followed by the size in MBytes.\n",
    
    653
    +			arg);
    
    603 654
                     exit(1);
    
    604 655
                 }
    
    605 656
                 control_stack_size = atoi(str) * 1024 * 1024;
    
    606 657
                 if (control_stack_size > CONTROL_STACK_SIZE) {
    
    607 658
                     fprintf(stderr,
    
    608
    -                        "-control-stack-size must be no greater than %lu MBytes.\n",
    
    659
    +                        "%s must be no greater than %lu MBytes.\n",
    
    660
    +			arg,
    
    609 661
                             CONTROL_STACK_SIZE / (1024 * 1024UL));
    
    610 662
                     fprintf(stderr, "  Continuing with default size.\n");
    
    611 663
                     control_stack_size = CONTROL_STACK_SIZE;
    
    612 664
                 }
    
    613
    -	} else if (strcmp(arg, "-dynamic-space-size") == 0) {
    
    665
    +	} else if (match_option(arg, "dynamic-space-size")) {
    
    614 666
     	    const char *str;
    
    615 667
     
    
    616 668
     	    str = *++argptr;
    
    617 669
     	    if (str == NULL) {
    
    618 670
     		fprintf(stderr,
    
    619
    -			"-dynamic-space-size must be followed by the size to use in MBytes.\n");
    
    671
    +			"%s must be followed by the size to use in MBytes.\n",
    
    672
    +			arg);
    
    620 673
     		exit(1);
    
    621 674
     	    }
    
    622 675
     #ifndef sparc
    
    ... ... @@ -662,17 +715,26 @@ main(int argc, const char *argv[], const char *envp[])
    662 715
     #endif
    
    663 716
     	    if (dynamic_space_size > DYNAMIC_SPACE_SIZE) {
    
    664 717
     		fprintf(stderr,
    
    665
    -			"-dynamic-space-size must be no greater than %lu MBytes.\n",
    
    718
    +			"%s must be no greater than %lu MBytes.\n",
    
    719
    +			arg,
    
    666 720
     			DYNAMIC_SPACE_SIZE / (1024 * 1024UL));
    
    667 721
     		exit(1);
    
    668 722
     	    }
    
    669
    -	} else if (strcmp(arg, "-monitor") == 0) {
    
    723
    +	} else if (match_option(arg, "monitor")) {
    
    670 724
     	    monitor = TRUE;
    
    671
    -	} else if (strcmp(arg, "-debug-lisp-search") == 0) {
    
    725
    +	} else if (match_option(arg, "debug-lisp-search")) {
    
    672 726
     	    debug_lisp_search = TRUE;
    
    673
    -        } else if (strcmp(arg, "-unidata") == 0) {
    
    727
    +        } else if (match_option(arg, "unidata")) {
    
    674 728
               unidata = *++argptr;
    
    675
    -        }
    
    729
    +        } else if ((strcmp(arg, "-version") == 0) ||
    
    730
    +		   (strcmp(arg, "--version") == 0)) {
    
    731
    +	    /*
    
    732
    +	     * Print the version and exit; we don't want to do
    
    733
    +	     * anything else!
    
    734
    +	     */
    
    735
    +	    printf("%s\n", cmucl_version);
    
    736
    +	    return 0;
    
    737
    +	}
    
    676 738
         }
    
    677 739
     
    
    678 740
         default_core = arch_init(fpu_mode);
    
    ... ... @@ -889,7 +951,7 @@ main(int argc, const char *argv[], const char *envp[])
    889 951
     
    
    890 952
         argptr = argv;
    
    891 953
         while ((arg = *++argptr) != NULL) {
    
    892
    -	if (strcmp(arg, "-batch") == 0)
    
    954
    +	if (match_option(arg, "batch"))
    
    893 955
     	    SetSymbolValue(BATCH_MODE, T);
    
    894 956
         }
    
    895 957
     
    
    ... ... @@ -899,6 +961,10 @@ main(int argc, const char *argv[], const char *envp[])
    899 961
         }
    
    900 962
     #endif
    
    901 963
         
    
    964
    +#ifdef LISP_IMPLEMENTATION_VERSION
    
    965
    +    SetSymbolValue(LISP_IMPLEMENTATION_VERSION, alloc_string(cmucl_version));
    
    966
    +#endif
    
    967
    +
    
    902 968
         /*
    
    903 969
          * Pick off sigint until the lisp system gets far enough along to
    
    904 970
          * install it's own.
    

  • src/tools/worldload.lisp
    ... ... @@ -31,12 +31,6 @@
    31 31
     ;(setf lisp::*enable-dynamic-space-code* t)
    
    32 32
     
    
    33 33
     
    
    34
    -;;; Get some data on this core.
    
    35
    -;;;
    
    36
    -(write-string "What is the current lisp-implementation-version? ")
    
    37
    -(force-output)
    
    38
    -(set '*lisp-implementation-version* (read-line))
    
    39
    -
    
    40 34
     ;;; Load the rest of the reader (maybe byte-compiled.)
    
    41 35
     (maybe-byte-load "target:code/sharpm")
    
    42 36
     (maybe-byte-load "target:code/backq")
    

  • tests/unix.lisp
    1
    +;;; Tests for the unix interface
    
    2
    +
    
    3
    +(defpackage :unix-tests
    
    4
    +  (:use :cl :lisp-unit))
    
    5
    +
    
    6
    +(in-package "UNIX-TESTS")
    
    7
    +
    
    8
    +(define-test mkstemp.name-returned
    
    9
    +  (:tag :issues)
    
    10
    +  (let (fd filename)
    
    11
    +    (unwind-protect
    
    12
    +	 (progn
    
    13
    +	   (let ((template "test-XXXXXX"))
    
    14
    +	     (multiple-value-setq (fd filename)
    
    15
    +	       (unix::unix-mkstemp (copy-seq template)))
    
    16
    +	     (assert-true fd)
    
    17
    +	     (assert-true (equalp (length filename) (length template)))
    
    18
    +	     (assert-false (equalp filename template))
    
    19
    +	     (assert-true (>= 5 (mismatch filename template))))))
    
    20
    +      (when fd
    
    21
    +	(unix:unix-unlink filename)))))
    
    22
    +
    
    23
    +(define-test mkstemp.non-ascii-name-returned
    
    24
    +  (:tag :issues)
    
    25
    +  (let ((unix::*filename-encoding* :utf-8)
    
    26
    +	fd name)
    
    27
    +    (unwind-protect
    
    28
    +	 (progn
    
    29
    +	   ;; Temp name starts with a lower case alpha character.
    
    30
    +	   (let* ((template (concatenate 'string (string #\u+3b1)
    
    31
    +					 "test-XXXXXX"))
    
    32
    +		  (x-posn (position #\X template)))
    
    33
    +	     (multiple-value-setq (fd name)
    
    34
    +	       (unix::unix-mkstemp template))
    
    35
    +	     (assert-true fd)
    
    36
    +	     (assert-false (search "XXXXXX" name)
    
    37
    +			   name)
    
    38
    +	     (assert-true (string= name template :end1 x-posn :end2 x-posn)
    
    39
    +			  name)))
    
    40
    +      (when fd
    
    41
    +	(unix:unix-unlink name)))))
    
    42
    +
    
    43
    +(define-test mkstemp.bad-path
    
    44
    +  (:tag :issues)
    
    45
    +  (multiple-value-bind (fd errno)
    
    46
    +      ;; Assumes that the directory "random-dir" doesn't exist
    
    47
    +      (unix::unix-mkstemp "random-dir/test-XXXXXX")
    
    48
    +    ;; Can't create and open the file so the FD should be NIL, and a
    
    49
    +    ;; positive Unix errno value should be returned.
    
    50
    +    (assert-false fd)
    
    51
    +    (assert-true (and (integerp errno) (plusp errno)))))
    
    52
    +
    
    53
    +(define-test mkdtemp.name-returned
    
    54
    +  (:tag :issues)
    
    55
    +  (let (name)
    
    56
    +    (unwind-protect
    
    57
    +	 (progn
    
    58
    +	   (setf name (unix::unix-mkdtemp "dir-XXXXXX"))
    
    59
    +	   ;; Verify that the dir name no longer has X's.
    
    60
    +	   (assert-true (stringp name))
    
    61
    +	   (assert-false (search "XXXXXX" name)))
    
    62
    +      (when name
    
    63
    +	(unix:unix-rmdir name)))))
    
    64
    +
    
    65
    +(define-test mkdtemp.non-ascii-name-returned
    
    66
    +  (:tag :issues)
    
    67
    +  (let ((unix::*filename-encoding* :utf-8)
    
    68
    +	name)
    
    69
    +    (unwind-protect
    
    70
    +	 (progn
    
    71
    +	   ;; Temp name starts with a lower case alpha character.
    
    72
    +	   (let* ((template (concatenate 'string (string #\u+3b1)
    
    73
    +					 "dir-XXXXXX"))
    
    74
    +		  (x-posn (position #\X template)))
    
    75
    +	     (setf name (unix::unix-mkdtemp template))
    
    76
    +	     ;; Verify that the dir name no longer has X's.
    
    77
    +	     (assert-true (stringp name))
    
    78
    +	     (assert-false (search "XXXXXX" name))
    
    79
    +	     (assert-true (string= name template :end1 x-posn :end2 x-posn)
    
    80
    +			  name x-posn)))
    
    81
    +      (when name
    
    82
    +	(unix:unix-rmdir name)))))
    
    83
    +
    
    84
    +(define-test mkdtemp.bad-path
    
    85
    +  (:tag :issues)
    
    86
    +  (multiple-value-bind (result errno)
    
    87
    +      (unix::unix-mkdtemp "random-dir/dir-XXXXXX")
    
    88
    +    (assert-false result)
    
    89
    +    (assert-true (and (integerp errno) (plusp errno)))))
    
    90
    +
    
    91
    +