aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2019-09-07 21:17:52 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2019-09-07 22:29:12 +0100
commit44570a44be60a8fc33bd05089047c1f2980b3047 (patch)
treed0ce8fe2aa6b3316f5ec53090d1cd560d56af26d /Makefile
parentMakefile: drop C*FLAGS from Makefile as gcc-wrapper is no more (diff)
downloadgcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.tar.gz
gcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.tar.bz2
gcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.zip
gcc-config: store gcc backup into /lib/gcc-backup, not /lib
Writing (and removing) libraries to /lib outside package manager was a surprise to users in bug #667020# where libunwind.so was clobbered by gcc-config runs. This change isolates all logic that handles file copies outside package manager into /lib/gcc-backup directory. To make new library still resolveable we install env.d entry with contents of LDPATH="/lib/gcc-backup" Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 19 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2b3b235..087000b 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ EPREFIX ?=
PN = gcc-config
PV = git
P = $(PN)-$(PV)
+BACKUPDIR = gcc-backup
PREFIX = $(EPREFIX)/usr
BINDIR = $(PREFIX)/bin
@@ -11,15 +12,18 @@ ESELECTDIR = $(PREFIX)/share/eselect/modules
SUBLIBDIR = lib
LIBDIR = $(PREFIX)/$(SUBLIBDIR)
+LIBGCC_BACKUPDIR = $(EPREFIX)/$(SUBLIBDIR)/$(BACKUPDIR)
+
+ENVD = $(EPREFIX)/etc/env.d
MKDIR_P = mkdir -p -m 755
INSTALL_EXE = install -m 755
INSTALL_DATA = install -m 644
-all: .gcc-config
+all: .gcc-config .envd-gcc-backup
clean:
- rm -f .gcc-config
+ rm -f .gcc-config .envd-gcc-backup
.gcc-config: gcc-config
sed \
@@ -27,14 +31,26 @@ clean:
-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
-e 's:@PV@:$(PV):g' \
+ -e 's:@GENTOO_GCC_BACKUP_DIR@:$(BACKUPDIR):g' \
$< > $@
chmod a+rx $@
+.envd-gcc-backup: envd-gcc-backup
+ sed \
+ -e 's:@LIBGCC_BACKUPDIR@:$(LIBGCC_BACKUPDIR):g' \
+ $< > $@
+
install: all
- $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(DOCDIR)
+ $(MKDIR_P) $(DESTDIR)$(BINDIR)
$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
+ $(MKDIR_P) $(DESTDIR)$(ESELECTDIR)
$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
+ $(MKDIR_P) $(DESTDIR)$(DOCDIR)
$(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)
+ $(MKDIR_P) $(DESTDIR)$(LIBGCC_BACKUPDIR)
+ $(INSTALL_DATA) gcc-backup/README $(DESTDIR)$(LIBGCC_BACKUPDIR)
+ $(MKDIR_P) $(DESTDIR)$(ENVD)
+ $(INSTALL_DATA) .envd-gcc-backup $(DESTDIR)$(ENVD)/99gcc-backup
test check: .gcc-config
cd tests && ./run_tests