Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
07113a7d by Raymond Toy at 2024-09-06T16:02:17-07:00
Remove debugging prints and add some comments.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -632,6 +632,8 @@
accrued exceptions are cleared at the start of the body to support
their testing within, and restored on exit."))
+;; Solaris/x86 needs to handle the x87 and sse2 mode bits separately
+;; instead of using a merged from from FLOATING-POINT-MODES.
#+(and solaris x86)
(macrolet
((with-float-traps (name merge-traps docstring)
@@ -646,22 +648,22 @@
`(progn
(defmacro ,macro-name (traps &body body)
,docstring
- (let* ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
- float-traps-byte #xffffffff))
- ;; The x87 trap masks are ordered the same as
- ;; sse2 trap masks, but are located in a
- ;; different part of the word.
- (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
- float-traps-byte #xffffffff))
- (exception-mask (dpb (lognot (vm::float-trap-mask traps))
- float-sticky-bits #xffffffff))
- (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
- (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
+ (let ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
+ float-traps-byte #xffffffff))
+ ;; The x87 trap masks are ordered the same as
+ ;; sse2 trap masks, but are located in a
+ ;; different part of the word.
+ (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
+ float-traps-byte #xffffffff))
+ ;; The exception bits (sticky bits) are located in
+ ;; the same place for both x87 and sse2 modes so
+ ;; we can use just one exception mask for both.
+ (exception-mask (dpb (lognot (vm::float-trap-mask traps))
+ float-sticky-bits #xffffffff))
+ (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
+ (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
`(let ((,orig-modes-x87 (x87-floating-point-modes))
(,orig-modes-sse2 (sse2-floating-point-modes)))
- (format t "In W-F-T:~%")
- (format t " orig x87 modes: ~32,'0b~%" ,orig-modes-x87)
- (format t " orig sse2 modes: ~32,'0b~%" ,orig-modes-sse2)
(unwind-protect
(progn
(setf (x87-floating-point-modes)
@@ -672,8 +674,6 @@
(ldb (byte 32 0)
(logand (,',merge-traps ,orig-modes-sse2 ,sse2-trap-mask)
,exception-mask)))
- (format t " masked x87 modes: ~32,'0b~%" (x87-floating-point-modes))
- (format t " masked sse2 modes: ~32,'0b~%" (sse2-floating-point-modes))
,@body)
;; Restore the modes exactly as they were.
(setf (x87-floating-point-modes) ,orig-modes-x87)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/07113a7d9df3314094b92e4…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/07113a7d9df3314094b92e4…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
5db3c51f by Raymond Toy at 2024-09-06T15:39:33-07:00
Solaris/x86 needs its own with-float-traps macro
For Solaris/x86, `with-float-traps` needs to handle the x87 and sse2
mode bits separately.
The previous version used the merged value returned by
`vm:floating-point-modes`. If the original mode had, say, the
overflow flag set, when the macro restored the modes, the overflow
flag was also set for x87 and sse2. Later on this can cause an
expected overflow because the x87 mode has overflow set along with the
sse2 mode. This shows up in the SIGFPE handler.
To fix this, we handle the x87 and sse2 mode bits separately. Hence,
we don't spuriously add back the overflow bit for x87 which didn't
have it previously set.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -568,6 +568,7 @@
(alien:sap-alien scp (* unix:sigcontext))
(logandc2 sse2-modes trap-bit)))))))
+#-(and solaris x86)
(macrolet
((with-float-traps (name merge-traps docstring)
;; Define macros to enable or disable floating-point
@@ -631,6 +632,71 @@
accrued exceptions are cleared at the start of the body to support
their testing within, and restored on exit."))
+#+(and solaris x86)
+(macrolet
+ ((with-float-traps (name merge-traps docstring)
+ ;; Define macros to enable or disable floating-point
+ ;; exceptions. Masked exceptions and enabled exceptions only
+ ;; differ whether we AND in the bits or OR them, respectively.
+ ;; MERGE-TRAPS is the logical operation to merge the traps with
+ ;; the current floating-point mode. Thus, use and MERGE-EXCEPTIONS is the
+ ;; logical operation to merge the exceptions (sticky bits) with
+ ;; the current mode.
+ (let ((macro-name (symbolicate "WITH-FLOAT-TRAPS-" name)))
+ `(progn
+ (defmacro ,macro-name (traps &body body)
+ ,docstring
+ (let* ((sse2-trap-mask (dpb (lognot (float-trap-mask traps))
+ float-traps-byte #xffffffff))
+ ;; The x87 trap masks are ordered the same as
+ ;; sse2 trap masks, but are located in a
+ ;; different part of the word.
+ (x87-trap-mask (dpb (lognot (ash (float-trap-mask traps) 16))
+ float-traps-byte #xffffffff))
+ (exception-mask (dpb (lognot (vm::float-trap-mask traps))
+ float-sticky-bits #xffffffff))
+ (orig-modes-x87 (gensym "ORIG-MODES-X87-"))
+ (orig-modes-sse2 (gensym "ORIG-MODES-SSE2-")))
+ `(let ((,orig-modes-x87 (x87-floating-point-modes))
+ (,orig-modes-sse2 (sse2-floating-point-modes)))
+ (format t "In W-F-T:~%")
+ (format t " orig x87 modes: ~32,'0b~%" ,orig-modes-x87)
+ (format t " orig sse2 modes: ~32,'0b~%" ,orig-modes-sse2)
+ (unwind-protect
+ (progn
+ (setf (x87-floating-point-modes)
+ (ldb (byte 32 0)
+ (logand (,',merge-traps ,orig-modes-x87 ,x87-trap-mask)
+ ,exception-mask)))
+ (setf (sse2-floating-point-modes)
+ (ldb (byte 32 0)
+ (logand (,',merge-traps ,orig-modes-sse2 ,sse2-trap-mask)
+ ,exception-mask)))
+ (format t " masked x87 modes: ~32,'0b~%" (x87-floating-point-modes))
+ (format t " masked sse2 modes: ~32,'0b~%" (sse2-floating-point-modes))
+ ,@body)
+ ;; Restore the modes exactly as they were.
+ (setf (x87-floating-point-modes) ,orig-modes-x87)
+ (setf (sse2-floating-point-modes) ,orig-modes-sse2)))))))))
+
+ ;; WITH-FLOAT-TRAPS-MASKED -- Public
+ (with-float-traps masked logand
+ _N"Execute BODY with the floating point exceptions listed in TRAPS
+ masked (disabled). TRAPS should be a list of possible exceptions
+ which includes :UNDERFLOW, :OVERFLOW, :INEXACT, :INVALID and
+ :DIVIDE-BY-ZERO and on the X86 :DENORMALIZED-OPERAND. The respective
+ accrued exceptions are cleared at the start of the body to support
+ their testing within, and restored on exit.")
+
+ ;; WITH-FLOAT-TRAPS-ENABLED -- Public
+ (with-float-traps enabled logorc2
+ _N"Execute BODY with the floating point exceptions listed in TRAPS
+ enabled. TRAPS should be a list of possible exceptions which
+ includes :UNDERFLOW, :OVERFLOW, :INEXACT, :INVALID and
+ :DIVIDE-BY-ZERO and on the X86 :DENORMALIZED-OPERAND. The respective
+ accrued exceptions are cleared at the start of the body to support
+ their testing within, and restored on exit."))
+
(defmacro with-float-rounding-mode ((rounding-mode) &body body)
_N"Execute BODY with the floating-point rounding mode set to
ROUNDING-MODE. ROUNDING-MODE must be a one:
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5db3c51f755738d221eae41…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5db3c51f755738d221eae41…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
83899880 by Carl Shapiro at 2024-08-29T23:32:31-07:00
Remove the call to malloc and strdup from obj_run_linker
- - - - -
5f6bce01 by Carl Shapiro at 2024-08-30T17:07:11+00:00
Merge branch 'obj-run-linker-no-malloc-or-strdup' into 'master'
Remove the call to malloc and strdup from obj_run_linker
Closes #309
See merge request cmucl/cmucl!251
- - - - -
706eb21f by Raymond Toy at 2024-09-01T08:30:51-07:00
Fix #356: Put x87 status word in low 16 bits of mode
`x87-floating-point-modes` combines the FPU status word and control
word into a single 32-bit value. Currently the control word is in the
low 16-bits and the status word is in the high 16 bits. The status
word contains the flags to show if an exception has occurred.
However, the SSE2 mscsr register has the exception flags in the low
part of the register.
For consistency, put the status word in the low 16-bits of the result
to match more closely what SSE2 does. This simplifies debugging when
looking at the the x87 and sse2 modes independently.
- - - - -
ab7cfc59 by Raymond Toy at 2024-09-03T06:21:12-07:00
Clean up indentation; add a few comments.
- - - - -
c0f457a2 by Raymond Toy at 2024-09-03T07:22:59-07:00
Oops. Fix the comments for the x87 mode vops
The comments for the x87 mode getter and setter vops had incorrect
comments. The low 16-bits have the status word.
- - - - -
f0bd9f3e by Raymond Toy at 2024-09-04T07:54:26-07:00
Merge branch 'issue-356-x87-status-word-in-low-part' into issue-355-solaris-x86-fp-trap-handler
- - - - -
3 changed files:
- src/code/float-trap.lisp
- src/compiler/x86/float-sse2.lisp
- src/lisp/elf.c
Changes:
=====================================
src/code/float-trap.lisp
=====================================
@@ -102,9 +102,11 @@
;; FPU and only use the SSE2 rounding control bits.
(let* ((x87-modes (vm::x87-floating-point-modes))
(sse-modes (vm::sse2-floating-point-modes))
+ (x87-exceptions (logand #x3f x87-modes))
+ (x87-enables (logand #x3f (ash x87-modes -16)))
(final-mode (logior sse-modes
- (ash (logand #x3f x87-modes) 7) ; control
- (logand #x3f (ash x87-modes -16)))))
+ x87-exceptions
+ (ash x87-enables 7))))
final-mode))
(defun (setf floating-point-modes) (new-mode)
@@ -112,15 +114,17 @@
;; Set the floating point modes for both X87 and SSE2. This
;; include the rounding control bits.
(let* ((rc (ldb float-rounding-mode new-mode))
+ (new-exceptions (logand #x3f new-mode))
+ (new-enables (logand #x3f (ash new-mode -7)))
(x87-modes
- (logior (ash (logand #x3f new-mode) 16)
+ (logior new-exceptions
(ash rc 10)
- (logand #x3f (ash new-mode -7))
+ (ash new-enables 16)
;; Set precision control to be 64-bit, always. We
;; don't use the x87 registers with sse2, so this
;; is ok and would be the correct setting if we
;; ever support long-floats.
- (ash 3 8))))
+ (ash 3 (+ 8 16)))))
(setf (vm::sse2-floating-point-modes) (ldb (byte 24 0) new-mode))
(setf (vm::x87-floating-point-modes) (ldb (byte 24 0) x87-modes)))
new-mode)
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1380,7 +1380,7 @@
float-modes)
;; Extract the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-floating-point-modes)
(:results (res :scs (unsigned-reg)))
(:result-types unsigned-num)
@@ -1396,12 +1396,15 @@
(inst byte #x66) ; operand size prefix
(inst or sw-reg cw-stack)
(inst xor sw-reg #x3f) ; invert exception mask
- (move res sw-reg)))
+ (move res sw-reg)
+ ;; Put status word in the low 16 bits and the control word in the
+ ;; high 16 bits.
+ (inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-set-floating-point-modes)
- (:args (new :scs (unsigned-reg) :to :result :target res))
+ (:args (new-modes :scs (unsigned-reg) :to :result :target res))
(:results (res :scs (unsigned-reg)))
(:arg-types unsigned-num)
(:result-types unsigned-num)
@@ -1410,7 +1413,12 @@
(:temporary (:sc unsigned-stack) cw-stack)
(:temporary (:sc byte-reg :offset al-offset) sw-reg)
(:temporary (:sc unsigned-reg :offset ecx-offset) old)
+ (:temporary (:sc unsigned-reg) new)
(:generator 6
+ (move new new-modes)
+ ;; Put the status word in the high 16 bits and the control word in
+ ;; the low 16 bits.
+ (inst rol new 16)
(inst mov cw-stack new)
(inst xor cw-stack #x3f) ; invert exception mask
(inst fnstsw)
@@ -1425,7 +1433,7 @@
(inst fldenv (make-ea :dword :base esp-tn))
(inst add esp-tn 28)
DONE
- (move res new)))
+ (move res new-modes)))
(defun sse2-floating-point-modes ()
=====================================
src/lisp/elf.c
=====================================
@@ -11,11 +11,11 @@
$Id: elf.c,v 1.32 2010/12/23 03:20:27 rtoy Exp $
*/
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
-#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@@ -319,59 +319,65 @@ write_space_object(const char *dir, int id, os_vm_address_t start, os_vm_address
return ret;
}
+#ifdef UNICODE
+#define LISPCHAR unsigned short
+#else
+#define LISPCHAR char
+#endif
+
+static LISPCHAR *
+tokenize(LISPCHAR *str, LISPCHAR **end)
+{
+ LISPCHAR *ptr;
+
+ ptr = str;
+again:
+ while (*ptr != '\0' && *ptr != ':')
+ ptr++;
+ if (str == ptr && *ptr == ':') {
+ str = ++ptr;
+ goto again;
+ }
+ *end = ptr;
+ return str;
+}
+
int
obj_run_linker(long init_func_address, char *file)
{
lispobj libstring = SymbolValue(CMUCL_LIB); /* Get library: */
struct vector *vec = (struct vector *)PTR(libstring);
- char *paths;
- char command[FILENAME_MAX + 1];
- char command_line[FILENAME_MAX + FILENAME_MAX + 10];
- char *strptr;
- struct stat st;
+ char command[PATH_MAX];
+ char command_line[PATH_MAX * 2 + 10];
+ LISPCHAR *strptr, *end = (LISPCHAR *)vec->data;
int ret;
extern int debug_lisp_search;
-#ifndef UNICODE
- paths = strdup((char *)vec->data);
- if (paths == NULL) {
- perror("strdup");
- return -1;
- }
-#else
- /*
- * What should we do here with 16-bit characters? For now we just
- * take the low 8-bits.
- */
- paths = malloc(vec->length);
- if (paths == NULL) {
- perror("malloc");
- return -1;
- } else {
- int k;
- unsigned short *data;
- data = (unsigned short*) vec->data;
-
- for (k = 0; k < vec->length; ++k) {
- paths[k] = data[k] & 0xff;
- }
- }
-#endif
- strptr = strtok(paths, ":");
if (debug_lisp_search) {
printf("Searching for linker.sh script\n");
}
- while(strptr != NULL) {
-
- sprintf(command, "%s/%s", strptr, LINKER_SCRIPT);
+ while ((strptr = tokenize(end, &end)) != end) {
+ ptrdiff_t len = end - strptr;
+ ptrdiff_t i;
+
+ if (len + strlen("/" LINKER_SCRIPT) > PATH_MAX)
+ continue;
+
+ /*
+ * What should we do here with 16-bit characters? For now we just
+ * take the low 8-bits.
+ */
+ for (i = 0; i < len; i++)
+ command[i] = strptr[i] & 0xFF;
+ command[i] = '\0';
+ strcat(command, "/" LINKER_SCRIPT);
if (debug_lisp_search) {
printf(" %s\n", command);
}
- if (stat(command, &st) == 0) {
- free(paths);
+ if (access(command, F_OK) == 0) {
printf("\t[%s: linking %s... \n", command, file);
fflush(stdout);
#if defined(__linux__) || defined(__FreeBSD__) || defined(SOLARIS) || defined(__NetBSD__)
@@ -394,15 +400,14 @@ obj_run_linker(long init_func_address, char *file)
}
return ret;
}
- strptr = strtok(NULL, ":");
}
fprintf(stderr,
"Can't find %s script in CMUCL library directory list.\n", LINKER_SCRIPT);
- free(paths);
return -1;
}
+#undef LISPCHAR
/* Read the ELF header from a file descriptor and stuff it into a
structure. Make sure it is really an elf header etc. */
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/959faae166c9f9df7bf448…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/959faae166c9f9df7bf448…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-356-x87-status-word-in-low-part at cmucl / cmucl
Commits:
c0f457a2 by Raymond Toy at 2024-09-03T07:22:59-07:00
Oops. Fix the comments for the x87 mode vops
The comments for the x87 mode getter and setter vops had incorrect
comments. The low 16-bits have the status word.
- - - - -
1 changed file:
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1380,7 +1380,7 @@
float-modes)
;; Extract the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-floating-point-modes)
(:results (res :scs (unsigned-reg)))
(:result-types unsigned-num)
@@ -1402,7 +1402,7 @@
(inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
-;; contain the control word, and the high 16 bits contain the status.
+;; contain the status word, and the high 16 bits contain the control.
(define-vop (x87-set-floating-point-modes)
(:args (new-modes :scs (unsigned-reg) :to :result :target res))
(:results (res :scs (unsigned-reg)))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c0f457a2c55c47d477f4122…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/c0f457a2c55c47d477f4122…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-356-x87-status-word-in-low-part at cmucl / cmucl
Commits:
ab7cfc59 by Raymond Toy at 2024-09-03T06:21:12-07:00
Clean up indentation; add a few comments.
- - - - -
1 changed file:
- src/compiler/x86/float-sse2.lisp
Changes:
=====================================
src/compiler/x86/float-sse2.lisp
=====================================
@@ -1396,8 +1396,10 @@
(inst byte #x66) ; operand size prefix
(inst or sw-reg cw-stack)
(inst xor sw-reg #x3f) ; invert exception mask
- (move res sw-reg)
- (inst rol res 16)))
+ (move res sw-reg)
+ ;; Put status word in the low 16 bits and the control word in the
+ ;; high 16 bits.
+ (inst rol res 16)))
;; Set the control and status words from the FPU. The low 16 bits
;; contain the control word, and the high 16 bits contain the status.
@@ -1414,6 +1416,8 @@
(:temporary (:sc unsigned-reg) new)
(:generator 6
(move new new-modes)
+ ;; Put the status word in the high 16 bits and the control word in
+ ;; the low 16 bits.
(inst rol new 16)
(inst mov cw-stack new)
(inst xor cw-stack #x3f) ; invert exception mask
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ab7cfc599c973e6215c4a5d…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ab7cfc599c973e6215c4a5d…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
4fce8c07 by Raymond Toy at 2024-09-01T15:13:49+00:00
Fix #352: New compression methods for distribution tarballs
- - - - -
40e553b6 by Raymond Toy at 2024-09-01T15:13:50+00:00
Merge branch 'issue-352-new-compression-for-dist' into 'master'
Fix #352: New compression methods for distribution tarballs
Closes #352
See merge request cmucl/cmucl!252
- - - - -
4 changed files:
- bin/make-dist.sh
- bin/make-extra-dist.sh
- bin/make-main-dist.sh
- bin/make-src-dist.sh
Changes:
=====================================
bin/make-dist.sh
=====================================
@@ -12,10 +12,10 @@
# $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/make-dist.sh,v 1.20 2011/04/11 16:34:49 rtoy Exp $
usage() {
- echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] [-A arch] [-V version] [-o OS] dir"
+ echo "make-dist.sh: [-h] [-C compress] [-G group] [-O owner] [-I destdir] [-M mandir] [-A arch] [-V version] [-o OS] dir"
echo " -h This help"
- echo " -b Use bzip2 compression"
- echo " -g Use gzip compression"
+ echo " -C compress Compression method to use for the tar archives. Must be one of"
+ echo " bzip2, xz, or gzip. The default depends on the OS"
echo " -G group Group to use"
echo " -O owner Owner to use"
echo " -I destdir Install directly to given directory instead of creating a tarball"
@@ -109,15 +109,20 @@ if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
DEFAULT_VERSION="${GIT_HASH}"
fi
-while getopts "G:O:I:M:bghSA:o:V:?" arg
+# Default compression is -J (xz). These variables are passed to the
+# other scripts via the environmen, so export them.
+COMPRESS=-J
+COMPRESS_EXT=xz
+COMPRESS_NAME=xz
+
+while getopts "C:G:O:I:M:hSA:o:V:?" arg
do
case $arg in
+ C) COMPRESS_ARG=$OPTARG ;;
G) GROUP=$OPTARG ;;
O) OWNER=$OPTARG ;;
I) INSTALL_DIR=$OPTARG ;;
M) MANDIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
S) MAKE_SRC_DIST=yes ;;
A) ARCH=$OPTARG ;;
o) OS=$OPTARG ;;
@@ -133,6 +138,27 @@ if [ $# -lt 1 ]; then
usage
fi
+# Verify that the -C option is valid
+if [ -n "$COMPRESS_ARG" ]; then
+ case $COMPRESS_ARG in
+ bzip2)
+ COMPRESS=-j
+ COMPRESS_EXT=bz2
+ COMPRESS_NAME=bzip2
+ ;;
+ xz) # Defaults work
+ ;;
+ gzip)
+ COMPRESS=-z
+ COMPRESS_EXT=gz
+ COMPRESS_NAME=gzip
+ ;;
+ *) echo '-C option "'$COMPRESS_ARG'" must be one of bzip2, xz or gzip'
+ exit 1
+ ;;
+ esac
+fi
+
if [ -z "$VERSION" ]; then
# If a default version exists, use it. Otherwise this is an
# error---at least one of these must not be empty.
@@ -171,21 +197,17 @@ fi
echo cmucl-$VERSION-$ARCH-$OS
ROOT=`dirname $0`
-# If no compression options given, default to bzip
-if [ -z "$ENABLE_GZIP" -a -z "$ENABLE_BZIP" ]; then
- ENABLE_BZIP="-b"
-fi
-
-OPTIONS="${GROUP:+ -G ${GROUP}} ${OWNER:+ -O ${OWNER}} ${INSTALL_DIR:+ -I ${INSTALL_DIR}} $ENABLE_GZIP $ENABLE_BZIP"
+GTAR_OPTS="-t ${GTAR:-tar}"
+EXTRA_OPTS="${GROUP:+ -G ${GROUP}} ${OWNER:+ -O ${OWNER}}"
+INSTALL_OPTS="${INSTALL_DIR:+ -I ${INSTALL_DIR}}"
MANDIR="${MANDIR:+ -M ${MANDIR}}"
+OPTIONS="${GTAR_OPTS} ${EXTRA_OPTS} ${INSTALL_OPTS} ${MANDIR}"
+set -x
echo Creating distribution for $ARCH $OS
-$ROOT/make-main-dist.sh $OPTIONS ${MANDIR} $TARGET $VERSION $ARCH $OS || exit 1
-$ROOT/make-extra-dist.sh $OPTIONS $TARGET $VERSION $ARCH $OS || exit 2
+$ROOT/make-main-dist.sh -C $COMPRESS -E $COMPRESS_EXT $OPTIONS ${MANDIR} $TARGET $VERSION $ARCH $OS || exit 1
+$ROOT/make-extra-dist.sh -C $COMPRESS -E $COMPRESS_EXT $OPTIONS $TARGET $VERSION $ARCH $OS || exit 2
if [ X"$MAKE_SRC_DIST" = "Xyes" ]; then
- # If tar is not GNU tar, set the environment variable GTAR to
- # point to GNU tar.
- OPTIONS="${INSTALL_DIR:+ -I ${INSTALL_DIR}} $ENABLE_GZIP $ENABLE_BZIP"
- $ROOT/make-src-dist.sh $OPTIONS -t ${GTAR:-tar} $VERSION
+ $ROOT/make-src-dist.sh -C $COMPRESS -E $COMPRESS_EXT ${GTAR_OPTS} ${INSTALL_OPTS} $VERSION
fi
=====================================
bin/make-extra-dist.sh
=====================================
@@ -1,23 +1,57 @@
#!/bin/sh
-while getopts "G:O:I:bgh?" arg
+usage() {
+ cat <<EOF
+`basename $0` -C option -E ext [-t tar] [-I destdir] [-G group] [-O owner]
+ -h This help
+ -? This help
+ -t tar Tar program to use
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ -G group Group to use
+ -O owner Owner to use
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tarball of the extra components for cmucl. This includes things like
+CLX; Hemlock; CLM; contrib library not already included in the main
+distribution; locale messages.
+EOF
+ exit 1
+}
+
+GTAR=tar
+while getopts "C:E:G:O:I:t:h?" arg
do
case $arg in
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
G) GROUP="-g $OPTARG" ;;
O) OWNER="-o $OPTARG" ;;
I) INSTALL_DIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ t) GTAR=$OPTARG ;;
h | \?) usage; exit 1 ;;
esac
done
shift `expr $OPTIND - 1`
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
+fi
+
if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
then
- echo "Usage: $0 target-directory version arch os"
- exit 1
+ usage
fi
if [ ! -d "$1" ]
@@ -134,16 +168,7 @@ done
if [ -z "$INSTALL_DIR" ]; then
sync ; sleep 1 ; sync ; sleep 1 ; sync
echo Tarring extra components
- if [ -n "$ENABLE_GZIP" ]; then
- echo " Compressing with gzip"
- ( cd $DESTDIR >/dev/null ; tar cf - lib ) | \
- gzip -c > cmucl-$VERSION-$ARCH-$OS.extra.tar.gz
- fi
- if [ -n "$ENABLE_BZIP" ]; then
- echo " Compressing with bzip"
- ( cd $DESTDIR >/dev/null ; tar cf - lib ) | \
- bzip2 > cmucl-$VERSION-$ARCH-$OS.extra.tar.bz2
- fi
+ $GTAR -C $DESTDIR $COMPRESS -cf cmucl-$VERSION-$ARCH-$OS.extra.tar.$COMPRESS_EXT lib
echo Cleaning $DESTDIR
[ -d $DESTDIR ] && rm -rf $DESTDIR
=====================================
bin/make-main-dist.sh
=====================================
@@ -1,25 +1,61 @@
#!/bin/sh
-# set -x
-while getopts "G:O:I:M:bgh?" arg
+usage() {
+ cat <<EOF
+`basename $0` -C option -E ext [-h?] [-t tar][-I destdir] [-G group] [-O owner] [-M mandir]
+ target-directory version arch os
+ -h This help
+ -? This help
+ -t tar Tar program to use
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ -G group Group to use
+ -O owner Owner to use
+ -M mandir Install manpages in this subdirectory. Default is man/man1
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tarball consisting of the main components needed to distribute
+a binary installation of cmucl. This includes the C executable and support
+libraries; the subsystems like Gray streams, and simple streams; external
+formats; contribs like asdf and defsystem; manpages and READMEs."
+EOF
+ exit 1
+}
+
+GTAR=tar
+while getopts "C:E:G:O:I:M:t:h?" arg
do
case $arg in
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
G) GROUP="-g $OPTARG" ;;
O) OWNER="-o $OPTARG" ;;
I) INSTALL_DIR=$OPTARG ;;
M) MANDIR=$OPTARG ;;
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ t) GTAR=$OPTARG ;;
h | \?) usage; exit 1 ;;
esac
done
shift `expr $OPTIND - 1`
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
+fi
+
if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
then
- echo "Usage: $0 target-directory version arch os"
- exit 1
+ usage
fi
if [ ! -d "$1" ]
@@ -178,16 +214,7 @@ fi
if [ -z "$INSTALL_DIR" ]; then
sync ; sleep 1 ; sync ; sleep 1 ; sync
echo Tarring main components
- if [ -n "$ENABLE_GZIP" ]; then
- echo " Compressing with gzip"
- ( cd $DESTDIR >/dev/null ; tar cf - . ) | \
- gzip -c > cmucl-$VERSION-$ARCH-$OS.tar.gz
- fi
- if [ -n "$ENABLE_BZIP" ]; then
- echo " Compressing with bzip"
- ( cd $DESTDIR >/dev/null ; tar cf - . ) | \
- bzip2 > cmucl-$VERSION-$ARCH-$OS.tar.bz2
- fi
+ $GTAR -C $DESTDIR $COMPRESS -cf cmucl-$VERSION-$ARCH-$OS.tar.$COMPRESS_EXT .
echo Cleaning $DESTDIR
[ -d $DESTDIR ] && rm -rf $DESTDIR
=====================================
bin/make-src-dist.sh
=====================================
@@ -1,22 +1,31 @@
#!/bin/sh
usage() {
- echo "make-src-dist.sh: [-bgh] [-t gnutar] [-I destdir] version"
- echo " -h This help"
- echo " -b Use bzip2 compression"
- echo " -g Use gzip compression"
- echo " -t tar Name/path to GNU tar"
- echo " -I destdir Install directly to given directory instead of creating a tarball"
- echo ""
- echo 'Create a tar ball of the cmucl sources. The tarball is named '
- echo 'cmucl-src-$version.tar.bz2 (or gz if using gzip compression)'
+ cat <<EOF
+`basename $0` -C option -E ext [-h?] [-t gnutar] [-I destdir] [version]
+ -h This help
+ -? This help
+ -t tar Name/path to GNU tar
+ -C option Tar option for compressing the tarball; required.
+ -E ext Extension to use for the tarball. Must be consistent with
+ -C option. Required.
+ -I destdir Install directly to given directory instead of creating a tarball
+ version The version. Defaults to the current date
+
+This is generally called by make-dist.sh and not normally invoked by the user
+
+Create a tar ball of the cmucl sources."
+EOF
+ exit 1
}
-while getopts "bgh?t:I:" arg
+GTAR=tar
+
+while getopts "C:E:h?t:I:" arg
do
case $arg in
- b) ENABLE_BZIP=-b ;;
- g) ENABLE_GZIP=-g ;;
+ C) COMPRESS=$OPTARG ;;
+ E) COMPRESS_EXT=$OPTARG ;;
t) GTAR=$OPTARG ;;
I) INSTALL_DIR=$OPTARG ;;
h | \?) usage; exit 1 ;;
@@ -25,10 +34,15 @@ done
shift `expr $OPTIND - 1`
-# If no compression given, default to gzip (on the assumption that
-# that is available everywhere.)
-if [ -z "$ENABLE_BZIP" -a -z "$ENABLE_GZIP" ]; then
- ENABLE_GZIP=-b
+# -C and -E options are required
+if [ -z "$COMPRESS" ]; then
+ echo "-C option is required"
+ exit 2
+fi
+
+if [ -z "$COMPRESS_EXT" ]; then
+ echo "-E option is required"
+ exit 2
fi
# If no version is given, default to today's date
@@ -39,20 +53,11 @@ else
fi
echo Creating source distribution
-if [ -n "$ENABLE_GZIP" ]; then
- ZIP="gzip -c"
- ZIPEXT="gz"
-fi
-if [ -n "$ENABLE_BZIP" ]; then
- ZIP="bzip2"
- ZIPEXT="bz2"
-fi
-
GTAR_OPTIONS="--exclude=.git --exclude='*.pot.~*~'"
if [ -z "$INSTALL_DIR" ]; then
- echo " Compressing with $ZIP"
- ${GTAR:-tar} ${GTAR_OPTIONS} -cf - bin src tests | ${ZIP} > cmucl-src-$VERSION.tar.$ZIPEXT
+ # echo " Compressing with $ZIP"
+ ${GTAR} ${GTAR_OPTIONS} ${COMPRESS} -cf cmucl-src-$VERSION.tar.$COMPRESS_EXT bin src tests
else
# Install in the specified directory
- ${GTAR:-tar} ${GTAR_OPTIONS} -cf - bin src tests | (cd $INSTALL_DIR; ${GTAR:-tar} xf -)
+ ${GTAR} ${GTAR_OPTIONS} -cf - bin src tests | (cd $INSTALL_DIR; ${GTAR:-tar} xf -)
fi
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c1514a66cfc9cd04a2da58…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/c1514a66cfc9cd04a2da58…
You're receiving this email because of your account on gitlab.common-lisp.net.