aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-01-01 22:46:44 -0500
committerMike Frysinger <vapier@gentoo.org>2013-01-02 13:30:18 -0500
commit8bb26aedded1daafbe7dfb2e16e0ae262600c4ef (patch)
tree21b318c6db4b126271e1000702b7fbe80b236a44
parentgcc-config: drop Solaris special casing with /lib/cpp (diff)
downloadgcc-config-8bb26aedded1daafbe7dfb2e16e0ae262600c4ef.tar.gz
gcc-config-8bb26aedded1daafbe7dfb2e16e0ae262600c4ef.tar.bz2
gcc-config-8bb26aedded1daafbe7dfb2e16e0ae262600c4ef.zip
compile gcc-config into .gcc-config so we can test it properly
Otherwise, it means we can't sed certain values in a way which we then attempt to test. e.g. EPREFIX. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--.gitignore1
-rw-r--r--Makefile19
-rw-r--r--tests/args/test.bad2
-rwxr-xr-xtests/run_tests3
4 files changed, 15 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 96dd0d5..23938ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,5 @@ a.out
/gcc-config-*.tar.*
+/.gcc-config
/wrapper
diff --git a/Makefile b/Makefile
index 85ac80d..409d7b0 100644
--- a/Makefile
+++ b/Makefile
@@ -14,21 +14,24 @@ LIBEXECDIR = $(LIBDIR)/misc
MKDIR_P = mkdir -p -m 755
INSTALL_EXE = install -m 755
-all: wrapper
+all: .gcc-config wrapper
clean:
- rm -f wrapper *.o core
+ rm -f .gcc-config wrapper *.o core
-install: all
- $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
- $(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
+.gcc-config: gcc-config
sed \
-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
-e 's:@PV@:$(PV):g' \
- gcc-config > $(DESTDIR)$(BINDIR)/gcc-config
- chmod a+rx $(DESTDIR)$(BINDIR)/gcc-config
+ $< > $@
+ chmod a+rx $@
+
+install: all
+ $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
+ $(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
+ $(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
-test check:
+test check: .gcc-config
cd tests && ./run_tests
dist:
diff --git a/tests/args/test.bad b/tests/args/test.bad
index d8a9df2..80a646a 100644
--- a/tests/args/test.bad
+++ b/tests/args/test.bad
@@ -9,4 +9,4 @@ for f in "${flags[@]}" ; do
gcc-config ${f} && exit 1
done
-exec gcc-config -h >/dev/null
+gcc-config -h >/dev/null
diff --git a/tests/run_tests b/tests/run_tests
index b0a45c0..2ff7d77 100755
--- a/tests/run_tests
+++ b/tests/run_tests
@@ -22,7 +22,7 @@ vars=( CHOST GCC_CONFIG ROOT TROOT NOCOLOR RC_NOCOLOR )
unset ${vars[@]}
TROOT=${PWD}
-GCC_CONFIG="${TROOT}/../gcc-config"
+GCC_CONFIG="${TROOT}/../.gcc-config"
if ! "${GCC_CONFIG}" --help >/dev/null ; then
die "could not find gcc-config in ${TROOT}/../"
fi
@@ -86,6 +86,7 @@ for t in "$@" ; do
cd "${ROOT}"
$(for v in PATH ${vars[@]} ; do printf '%s="%s"\n' ${v} "${!v}" ; done)
export ${vars[@]}
+ gcc-config() { bash -c ". \${GCC_CONFIG}" gcc-config "\$@" ; }
. ./${test}
EOF
chmod a+rx "${r}"