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

Sanitise standards/feature macros, remove compiler/linker wrappers

The goal is to get rid of all compiler/linker wrapper scripts as
they are overridden by passing CC/LD and it should be possible to
select your compiler or linker without breaking the build. The
probing and feature testing system should set the appropriate flags
and macros. This makes some progress towards that.

src/lib/libast/features/standards:
- Eliminate the shotgun approach to standards macros on popular
  systems where the macros we we need to set are known and
  documented. The following will enable standards compliance plus
  all the available extensions:
  - Set no macros at all for any BSD system (excluding macOS).
  - Set _DARWIN_C_SOURCE on Darwin/macOS.
  - Set everything and the kitchen sink for Solaris/illumos in
    a way that enables backwards compatibility with older Solaris.
    This is unofficial, but following the standards(5) manual
    disables a lot of basic functionality that we depend on.
  - Set _GNU_SOURCE for GNU (glibc).
  - Remove the covered macros from the shotgun approach fallback.
- Add a new heuristic. _POSIX_PATH_MAX and _SC_PAGESIZE are among
  the basic macros disabled when you pass recommended standards
  macros, killing the build, so it's good to check if they compile.

src/cmd/INIT/ar.freebsd12.amd64,
src/cmd/INIT/ar.linux.i386-64:
- Removed. May cause build failures on some systems as not all 'ar'
  implementations support the U option. Plus, I can think of no
  good reason to disable deterministic mode (which always creates
  identical output) on 'ar' implementations that support it. See:
  https://groups.google.com/g/comp.unix.shell/c/LdOD1Ya0C9E/m/U6DhgHVICwAJ

src/cmd/INIT/cc.linux.*-icc,
  Removed icc wrappers. These manually source /etc/profile.d/icc.sh
  but I don't think that is the build system's job. Profile scripts
  should be run at login time and export variables we inherit
  through the environment.

src/cmd/INIT.cc.{freebsd,linux,openbsd}*:
- Removed. Should be entirely superfluous now that the standards
  feature test sets the appropriate macros.

src/cmd/INIT.cc.sol11.*:
- Removed as the standards feature test now sets the approopriate
  macros. Note the Solaris build system should now simply pass CC
  as normal instead of passing CC_EXPLICIT.
This commit is contained in:
Martijn Dekker 2021-12-20 12:21:37 +00:00
parent d3f553ca76
commit 24fc1bbca9
15 changed files with 138 additions and 236 deletions

View file

@ -1,6 +0,0 @@
: freebsd12.amd64 ar wrapper
case $1 in
*x*) /usr/bin/ar "$@" ;;
*) /usr/bin/ar U"$@" ;;
esac

View file

@ -1,6 +0,0 @@
: linux.i386-64 ar wrapper
case $1 in
*x*) /usr/bin/ar "$@" ;;
*) /usr/bin/ar U"$@" ;;
esac

View file

@ -1,9 +0,0 @@
: FreeBSD cc wrapper
HOSTTYPE=freebsd.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P "$@"

View file

@ -1,9 +0,0 @@
: linux cc wrapper : 2021-04-08 :
HOSTTYPE=linux.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P -D_LARGEFILE64_SOURCE "$@"

View file

@ -1,9 +0,0 @@
: linux.aarch64 cc wrapper : 2006-02-14 :
HOSTTYPE=linux.aarch64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -P "$@"

View file

@ -1,9 +0,0 @@
: linux.i386-64 cc wrapper : 2006-02-14 :
HOSTTYPE=linux.i386-64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -P "$@"

View file

@ -1,22 +0,0 @@
: linux.i386-64 icc wrapper : 2011-10-18 :
HOSTTYPE=linux.i386-64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
$icc "$@"

View file

@ -1,22 +0,0 @@
: linux.i386 icc wrapper : 2021-01-31 :
HOSTTYPE=linux.ia64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
exec "$icc" -D_LARGEFILE64_SOURCE "$@"

View file

@ -1,22 +0,0 @@
: linux.ia64 icc wrapper : 2011-10-18 :
HOSTTYPE=linux.ia64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
$icc "$@"

View file

@ -1,9 +0,0 @@
: OpenBSD cc wrapper
HOSTTYPE=openbsd.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P "$@"

View file

@ -1,18 +0,0 @@
: solaris.i386 cc wrapper for 32 bit : 2021-05-12 :
HOSTTYPE=sol11.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac
# Note: the _XPG6 macro is now defined in src/lib/libast/features/common
$CC_EXPLICIT -m32 -std=c11 "$@"

View file

@ -1,18 +0,0 @@
: solaris.i386-64 cc wrapper for 64 bit : 2021-05-12 :
HOSTTYPE=sol11.i386-64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac
# Note: the _XPG6 macro is now defined in src/lib/libast/features/common
$CC_EXPLICIT -m64 -std=c11 "$@"

View file

@ -1,18 +0,0 @@
: solaris.sparc cc wrapper for 32 bit : 2021-05-12 :
HOSTTYPE=sol11.sparc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac
# Note: the _XPG6 macro is now defined in src/lib/libast/features/common
$CC_EXPLICIT -m32 -std=c11 "$@"

View file

@ -1,18 +0,0 @@
: solaris.sparc-64 cc wrapper for 64 bit : 2021-05-12 :
HOSTTYPE=sol11.sparc-64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac
# Note: the _XPG6 macro is now defined in src/lib/libast/features/common
$CC_EXPLICIT -m64 -std=c11 "$@"