public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-config:master commit in: tests/multi-native-configs/usr/share/gcc-config/, ...
@ 2020-06-20 21:12 Sergei Trofimovich
  0 siblings, 0 replies; only message in thread
From: Sergei Trofimovich @ 2020-06-20 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     06f9083246c2d705520ab82e8bd822fd2428e12f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 20 21:07:59 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jun 20 21:07:59 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=06f90832

gcc-config: install /usr/bin/c{89,99}, take over from toolchain.eclass

Reported-by: Kent Fredric
Bug: https://bugs.gentoo.org/728722
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 .gitignore                                         |  2 ++
 Makefile                                           | 34 ++++++++++++++++++++--
 c89                                                | 22 ++++++++++++++
 c99                                                | 23 +++++++++++++++
 gcc-config                                         | 14 ++++++++-
 .../multi-native-configs/usr/share/gcc-config/c89  |  0
 .../multi-native-configs/usr/share/gcc-config/c99  |  0
 .../usr/share/gcc-config/c89                       |  0
 .../usr/share/gcc-config/c99                       |  0
 9 files changed, 91 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index b79124b..44ddfac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,6 @@
 
 /gcc-config-*.tar.*
 
+/.c89
+/.c99
 /.gcc-config

diff --git a/Makefile b/Makefile
index c74adec..61ba0d9 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
 

diff --git a/c89 b/c89
new file mode 100755
index 0000000..34dcd60
--- /dev/null
+++ b/c89
@@ -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 "$@"

diff --git a/c99 b/c99
new file mode 100755
index 0000000..b013510
--- /dev/null
+++ b/c99
@@ -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+"$@"}

diff --git a/gcc-config b/gcc-config
index ad69b9b..d05dabe 100755
--- a/gcc-config
+++ b/gcc-config
@@ -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

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

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

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-20 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-20 21:12 [gentoo-commits] proj/gcc-config:master commit in: tests/multi-native-configs/usr/share/gcc-config/, Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox