diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 34 | ||||
-rwxr-xr-x | c89 | 22 | ||||
-rwxr-xr-x | c99 | 23 | ||||
-rwxr-xr-x | gcc-config | 14 | ||||
-rw-r--r-- | tests/multi-native-configs/usr/share/gcc-config/c89 | 0 | ||||
-rw-r--r-- | tests/multi-native-configs/usr/share/gcc-config/c99 | 0 | ||||
-rw-r--r-- | tests/rw-multi-native-configs/usr/share/gcc-config/c89 | 0 | ||||
-rw-r--r-- | tests/rw-multi-native-configs/usr/share/gcc-config/c99 | 0 |
9 files changed, 91 insertions, 4 deletions
@@ -7,4 +7,6 @@ /gcc-config-*.tar.* +/.c89 +/.c99 /.gcc-config @@ -1,10 +1,15 @@ # configurable options: + # Avoid installing native symlinks like: # /usr/bin/gcc -> ${CTARGET}-gcc # and keep only # ${CTARGET}-gcc USE_NATIVE_LINKS ?= yes +# Prepend toolchain prefix to 'gcc' in c89/c99 wrapeprs. +# Should usually be '${CHOST}-'. +TOOLCHAIN_PREFIX ?= + EPREFIX ?= PN = gcc-config @@ -14,6 +19,7 @@ P = $(PN)-$(PV) PREFIX = $(EPREFIX)/usr BINDIR = $(PREFIX)/bin DOCDIR = $(PREFIX)/share/doc/$(P) +SHAREDIR = $(PREFIX)/share/$(PN) ESELECTDIR = $(PREFIX)/share/eselect/modules SUBLIBDIR = lib @@ -23,10 +29,10 @@ MKDIR_P = mkdir -p -m 755 INSTALL_EXE = install -m 755 INSTALL_DATA = install -m 644 -all: .gcc-config +all: .gcc-config .c89 .c99 clean: - rm -f .gcc-config + rm -f .gcc-config .c89 .c99 .gcc-config: gcc-config sed \ @@ -38,9 +44,31 @@ clean: $< > $@ chmod a+rx $@ +.c89: c89 + sed \ + -e '1s:/:$(EPREFIX)/:' \ + -e 's:@PV@:$(PV):g' \ + -e 's:@TOOLCHAIN_PREFIX@:$(TOOLCHAIN_PREFIX):g' \ + $< > $@ + chmod a+rx $@ + +.c99: c99 + sed \ + -e '1s:/:$(EPREFIX)/:' \ + -e 's:@PV@:$(PV):g' \ + -e 's:@TOOLCHAIN_PREFIX@:$(TOOLCHAIN_PREFIX):g' \ + $< > $@ + chmod a+rx $@ + install: all - $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(DOCDIR) + $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(SHAREDIR) $(DESTDIR)$(DOCDIR) $(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config + $(INSTALL_EXE) .c89 $(DESTDIR)$(SHAREDIR)/c89 + $(INSTALL_EXE) .c99 $(DESTDIR)$(SHAREDIR)/c99 + if [ "$(USE_NATIVE_LINKS)" = yes ] ; then \ + $(INSTALL_EXE) .c89 $(DESTDIR)$(BINDIR)/c89 && \ + $(INSTALL_EXE) .c99 $(DESTDIR)$(BINDIR)/c99 ; \ + fi $(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR) $(INSTALL_DATA) README $(DESTDIR)$(DOCDIR) @@ -0,0 +1,22 @@ +#!/bin/sh + +# Managed by gcc-config-@PV@ + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-2.95): +# -ansi +# -std=c89 +# -std=iso9899:1990 + +for i; do + case "$i" in + -ansi|-std=c89|-std=iso9899:1990) + ;; + -std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" + exit 1 + ;; + esac +done + +exec @TOOLCHAIN_PREFIX@gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" @@ -0,0 +1,23 @@ +#!/bin/sh + +# Managed by gcc-config-@PV@ + +# Call the appropriate C compiler with options to accept ANSI/ISO C +# The following options are the same (as of gcc-3.3): +# -std=c99 +# -std=c9x +# -std=iso9899:1999 +# -std=iso9899:199x + +for i; do + case "$i" in + -std=c9[9x]|-std=iso9899:199[9x]) + ;; + -ansi|-std=*) + echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" + exit 1 + ;; + esac +done + +exec @TOOLCHAIN_PREFIX@gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} @@ -330,7 +330,7 @@ update_wrappers() { # legacy cruft, make sure we dont leave it laying around #143205 rm -f "${EROOT}usr/bin/${CTARGET}-cc" "${EROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64} - # install the canonical cpp wrapper + # handle the canonical cpp wrapper if ! is_cross_compiler ; then if [[ ${USE_NATIVE_LINKS} == yes ]]; then atomic_ln "${EPREFIX%/}/usr/bin/${CTARGET}-cpp" "${EROOT}lib" "cpp" @@ -338,6 +338,18 @@ update_wrappers() { rm -f "${EROOT}lib/cpp" fi fi + + # handle c89 and c99 wrappers + if ! is_cross_compiler ; then + if [[ ${USE_NATIVE_LINKS} == yes ]]; then + # In June 2020 gcc-config taken over file handling from toolchain.eclass. + cp -fpP "${EROOT}"usr/share/gcc-config/c89 "${EROOT}"usr/bin/c89 + cp -fpP "${EROOT}"usr/share/gcc-config/c99 "${EROOT}"usr/bin/c99 + else + rm -f "${EROOT}"usr/bin/c89 + rm -f "${EROOT}"usr/bin/c99 + fi + fi } mv_if_diff() { diff --git a/tests/multi-native-configs/usr/share/gcc-config/c89 b/tests/multi-native-configs/usr/share/gcc-config/c89 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/multi-native-configs/usr/share/gcc-config/c89 diff --git a/tests/multi-native-configs/usr/share/gcc-config/c99 b/tests/multi-native-configs/usr/share/gcc-config/c99 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/multi-native-configs/usr/share/gcc-config/c99 diff --git a/tests/rw-multi-native-configs/usr/share/gcc-config/c89 b/tests/rw-multi-native-configs/usr/share/gcc-config/c89 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/rw-multi-native-configs/usr/share/gcc-config/c89 diff --git a/tests/rw-multi-native-configs/usr/share/gcc-config/c99 b/tests/rw-multi-native-configs/usr/share/gcc-config/c99 new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/rw-multi-native-configs/usr/share/gcc-config/c99 |