1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00
cde/src/cmd/INIT/cc.darwin
Martijn Dekker e856094ca2 Fix build scripts so ksh compiles on recent macOS (Mac OS X)
This updates the cc.darwin* compiler compatibility wrapper scripts
and patches bin/package to identify a 64-bit system, allowing ksh
to build using a simple 'bin/package make' command on at least on
macOS Mojave (10.14.6). Testing on other macOS versions is invited.

src/cmd/INIT/cc.darwin:
- Remove obsolete compatibility cruft
- Update compiler flags:
  * remove obsolete/unneeded -DCLK_TCK=100 (this is already defined
    in the system header i386/limits.h included by time.h)
  * add necessary flags from Apple's Makefile in ksh-27.tar.gz:
    -DSHOPT_SPAWN=0 -D_ast_int8_t=int64_t -D_lib_memccpy
    source: https://opensource.apple.com/tarballs/ksh/
  * add -Wno-unused-value and -Wno-parentheses to suppress excessive
    clang warnings that object to David Korn's coding style.
- Update linker flags:
  * remove obsolete -Wl,-m
  * add flag from Apple's Makefile: -Wl,-search_paths_first

src/cmd/INIT/cc.darwin.i386,
src/cmd/INIT/cc.darwin.i386-64:
- Removed as superfluous (was identical to generic cc.darwin).

bin/package,
src/cmd/INIT/package.sh:
- Fix the recognition of a 64-bit system from the output of a 'file
  /bin/sh' command (what an ugly hack... never mind), so that the
  architecture is correctly identified as darwin.i386-64.

(cherry picked from commit e74e98b886a2bc5760166c124412474293f85fd8)
2020-06-12 01:45:13 +02:00

55 lines
774 B
Text
Executable file

: unix wrapper for macOS cc : 2020-05-13 :
HOSTTYPE=darwin.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
CC=/usr/bin/cc
op=init
for arg
do case $op in
init) op=ld
set ''
;;
esac
case $arg in
-c) op=cc
;;
-E) op=cpp
continue
;;
-G) op=dll
continue
;;
-lc) continue
;;
-lm) continue
;;
-O) continue
;;
esac
set "$@" "$arg"
done
case $# in
0) ;;
*) shift ;;
esac
case $* in
-v) $CC "$@"; exit ;;
esac
case $op in
init) echo "cc: arguments expected" >&2
exit 1
;;
cpp) $CC -E "$@"
;;
cc) $CC -DSHOPT_SPAWN=0 -D_ast_int8_t=int64_t -D_lib_memccpy \
-Wno-unused-value -Wno-parentheses "$@"
;;
dll) $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@"
;;
ld) $CC -Wl,-search_paths_first "$@"
;;
esac