1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Restore building on old Mac OS X (Darwin) with GCC (re: e74e98b8)

In making ksh build on new macOS, it stopped building on old Mac OS
X (old gcc-based Darwin). There is no real reason for this. We can
just restore the old cc wrapper script and use it if an old gcc
compiler is detected.

This is only tested on Mac OS X 10.3 on my old Power Mac G5 so far.
But at least that allows me to test fixes on that platform. Unusual
platforms sometimes expose corner case bugs...

bin/package, src/cmd/INIT/package.sh:
- If /usr/bin/cc is GCC, change 'darwin' host name to 'darwin_old'.
  This removes the long-obsolete 'darwin7' host name.

src/cmd/INIT/cc.darwin_old:
- Restore the old cc.darwin script for darwin_old hosts.

(cherry picked from commit 93d4c6497ea8e9cc9f4977b75d06a673a2229f80)
This commit is contained in:
Martijn Dekker 2020-06-04 20:53:23 +02:00
parent 794d1c8601
commit 3552a2bafd
3 changed files with 77 additions and 4 deletions

View file

@ -2395,8 +2395,8 @@ int main()
esac
case $lhs in
bsdi) lhs=bsd ;;
darwin) case $rel in
[01234567].*) lhs=${lhs}7 ;;
darwin) case $(/usr/bin/cc --version) in
*'(GCC)'*) lhs=${lhs}_old ;;
esac
;;
freebsd) case $rel in

73
src/cmd/INIT/cc.darwin_old Executable file
View file

@ -0,0 +1,73 @@
: unix wrapper for mac osx cc : 2012-01-20 :
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 -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

View file

@ -2394,8 +2394,8 @@ int main()
esac
case $lhs in
bsdi) lhs=bsd ;;
darwin) case $rel in
[01234567].*) lhs=${lhs}7 ;;
darwin) case $(/usr/bin/cc --version) in
*'(GCC)'*) lhs=${lhs}_old ;;
esac
;;
freebsd) case $rel in