mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
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)
This commit is contained in:
parent
38df54982f
commit
e856094ca2
5 changed files with 7 additions and 171 deletions
|
@ -2487,7 +2487,7 @@ int b() { return 0; }
|
|||
;;
|
||||
*) case $bits in
|
||||
'') case `file /bin/sh 2>/dev/null` in
|
||||
*universal*64*)
|
||||
*universal*64* | *64-bit* | *x86[_-]64*)
|
||||
pwd=`pwd`
|
||||
cd ${TMPDIR:-/tmp}
|
||||
tmp=hi$$
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
: unix wrapper for mac osx cc : 2012-01-20 :
|
||||
: unix wrapper for macOS cc : 2020-05-13 :
|
||||
|
||||
HOSTTYPE=darwin.generic
|
||||
|
||||
|
@ -45,29 +45,11 @@ init) echo "cc: arguments expected" >&2
|
|||
;;
|
||||
cpp) $CC -E "$@"
|
||||
;;
|
||||
cc) $CC -DCLK_TCK=100 "$@"
|
||||
cc) $CC -DSHOPT_SPAWN=0 -D_ast_int8_t=int64_t -D_lib_memccpy \
|
||||
-Wno-unused-value -Wno-parentheses "$@"
|
||||
;;
|
||||
dll) # what a compatibility mess -- surely they can get the apis to play nice
|
||||
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in
|
||||
*undefined*dynamic_lookup*)
|
||||
ld -m -flat_namespace -undefined suppress -dylib -dynamic \
|
||||
-ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
*) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
esac
|
||||
egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
|
||||
exit $status
|
||||
dll) $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@"
|
||||
;;
|
||||
ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
$CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
|
||||
exit $status
|
||||
ld) $CC -Wl,-search_paths_first "$@"
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
: unix wrapper for mac osx cc : 2012-02-29 :
|
||||
|
||||
HOSTTYPE=darwin.i386
|
||||
|
||||
case " $* " in
|
||||
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
|
||||
esac
|
||||
|
||||
CC='/usr/bin/cc -m32'
|
||||
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 -DCLK_TCK=100 "$@"
|
||||
;;
|
||||
dll) # what a compatibility mess -- surely they can get the apis to play nice
|
||||
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in
|
||||
*undefined*dynamic_lookup*)
|
||||
ld -m -flat_namespace -undefined suppress -dylib -dynamic \
|
||||
-ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
*) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
esac
|
||||
egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
|
||||
exit $status
|
||||
;;
|
||||
ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
$CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
|
||||
exit $status
|
||||
;;
|
||||
esac
|
|
@ -1,73 +0,0 @@
|
|||
: unix wrapper for mac osx cc : 2012-02-29 :
|
||||
|
||||
HOSTTYPE=darwin.i386-64
|
||||
|
||||
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 -DCLK_TCK=100 "$@"
|
||||
;;
|
||||
dll) # what a compatibility mess -- surely they can get the apis to play nice
|
||||
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in
|
||||
*undefined*dynamic_lookup*)
|
||||
ld -m -flat_namespace -undefined suppress -dylib -dynamic \
|
||||
-ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
*) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
;;
|
||||
esac
|
||||
egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
|
||||
exit $status
|
||||
;;
|
||||
ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
|
||||
trap "rm -f $tmp" EXIT
|
||||
$CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
|
||||
status=$?
|
||||
egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
|
||||
exit $status
|
||||
;;
|
||||
esac
|
|
@ -2486,7 +2486,7 @@ int b() { return 0; }
|
|||
;;
|
||||
*) case $bits in
|
||||
'') case `file /bin/sh 2>/dev/null` in
|
||||
*universal*64*)
|
||||
*universal*64* | *64-bit* | *x86[_-]64*)
|
||||
pwd=`pwd`
|
||||
cd ${TMPDIR:-/tmp}
|
||||
tmp=hi$$
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue