[Git][cmucl/cmucl][issue-386-generate-def-unix-error] Make create-errno.sh self-contained

Raymond Toy pushed to branch issue-386-generate-def-unix-error at cmucl / cmucl Commits: 5611669b by Raymond Toy at 2025-02-27T18:34:54-08:00 Make create-errno.sh self-contained All of the logic is moved to create-errno.sh so that the callers don't need to know anything about what's happening. The output is always src/code/errno.lisp. Update callers to remove stuff that is now in create-errno.sh - - - - - 3 changed files: - bin/build.sh - bin/create-errno.sh - bin/cross-build-world.sh Changes: ===================================== bin/build.sh ===================================== @@ -157,14 +157,8 @@ buildit () fi } -# Create src/code/errno.lisp by reading the errno definitions from the -# header files. -case `uname -s` in - Linux) ERRNO_FILES=/usr/include/asm-generic/errno*.h - ;; -esac - -bin/create-errno.sh ${ERRNO_FILES} > src/code/errno.lisp +# Create the errno file containing all the def-unix-error forms. +bin/create-errno.sh BUILDWORLD="$TOOLDIR/build-world.sh" BUILD_POT="yes" ===================================== bin/create-errno.sh ===================================== @@ -5,11 +5,14 @@ # definitions of all the Unix errno values. # +# Where the output should go. +OUTPUT="src/code/errno.lisp" + # The header was copied from code/unix.lisp. This includes all the # support code for DEF-UNIX-ERROR and for all OSes that don't use the # awk script to create the DEF-UNIX-ERROR forms. # -cat <<EOF +cat > $OUTPUT <<EOF ;;; -*- Package: ERRNO -*- ;;; ;;; ********************************************************************** @@ -51,7 +54,11 @@ cat <<EOF (declaim (simple-vector *unix-errors*))))) ) ;eval-when +EOF +# Output the default def-unix-error forms for the OSes where we don't +# grovel the include files to get the errno definitions. +cat >> $OUTPUT <<EOF ;;; ;;; From <errno.h> ;;; @@ -249,13 +256,20 @@ EOF # Create appropriate DEF-UNIX-ERROR forms by reading header files # containing the C definitions. + +# Set ERRNO_FILES to the files where we can find errno definitions. +case `uname -s` in + Linux) ERRNO_FILES=/usr/include/asm-generic/errno*.h + ;; +esac + awk '/^#define[ \t]+(E[A-Z0-9]+)[ \t]+([A-Z0-9]+).*$/ { printf "(def-unix-error %s %s)\n", $2, $3; -}' "$@" +}' "$@" ${ERRNO_FILES} >> $OUTPUT # The tail was also copied from code/unix.lisp. It's needed to tell # Lisp about the errno values. -cat <<EOF +cat >>$OUTPUT <<EOF ;;; End auto-generated forms, if any. ;;; ===================================== bin/cross-build-world.sh ===================================== @@ -84,13 +84,8 @@ then sed "s:^src:$CROSS:g" | xargs mkdir fi -# Create unix-errno.lisp -case `uname -s` in - Linux) ERRNO_FILES=/usr/include/asm-generic/errno*.h - ;; -esac - -bin/create-errno.sh ${ERRNO_FILES} > src/code/errno.lisp +# Create the errno file containing all the def-unix-error forms. +bin/create-errno.sh echo cross boot = $CROSSBOOT $LISP "$@" -noinit -nositeinit <<EOF View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5611669b2c2e95093f53a17c... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5611669b2c2e95093f53a17c... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)