[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 8d01c84 1/2: BuildProgram's configuration file
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 8d01c84 1/2: BuildProgram's configuration file only built with -I or -L options |
Date: |
Sat, 21 Jul 2018 12:45:31 -0400 (EDT) |
branch: master
commit 8d01c84e5cab72e295d71e6f9d8c3d32acc7a4d6
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
BuildProgram's configuration file only built with -I or -L options
By definition, the CPPFLAGS and LDFLAGS environment variables are designed
to pass options to the pre-processor and linker and in particular the `-I'
and `-L' options to specify the directories to look for headers and
libraries.
Until now, when building BuildProgram's configuration file, we just assumed
that only the `-I' option is given to CPPFLAGS and `-L' to LDFLAGS. But
while packaging in Debian's `pdebuild', I noticed that it is passing `-W'
options to these two environment variables: `-Wdate-time
-D_FORTIFY_SOURCE=2' and `-Wl,-z,relro -Wl,-z,now' respectively.
This might happen in other situations is well. With this commit, the script
to add the `includedir' and `linkdir' directories to BuildProgram's
configuration file now only uses strings that start with `-I' or `-L'. Any
other string in these environment variables will be ignored.
This fixes bug #54346.
---
bin/buildprog/Makefile.am | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/bin/buildprog/Makefile.am b/bin/buildprog/Makefile.am
index 446186e..58d9b03 100644
--- a/bin/buildprog/Makefile.am
+++ b/bin/buildprog/Makefile.am
@@ -51,26 +51,37 @@ EXTRA_DIST = main.h authors-cite.h args.h ui.h buildprog.h
astbuildprog.conf.in
# directories in order to compile its programs. With the rule below, the
# directories in these variables will be written into the final
# BuildProgram configuration file.
+#
+# The user might give non-`-I' arguments to CPPFLAGS and non-`-L' arguments
+# to LDFLAGS (see bug #54346). But here, we only want these two options,
+# and nothing else. To make the check, we'll see if `$i' (the input string)
+# is the same as `$v' or not. If the string starts with `-I' or `-L', it
+# will change between the two (the `-I' or `-L' have been removed), so it
+# shouldn't be the same.
astbuildprog.conf: $(top_srcdir)/bin/buildprog/astbuildprog.conf.in
cp $< $@
infoadded="no"; \
for i in $(CPPFLAGS); do \
- if test $$infoadded = "no"; then \
- echo "" >> $@; \
- echo "# Installation information" >> $@; \
- infoadded="yes"; \
+ v=$$(echo $$i | sed -e 's/^-I//'); \
+ if test $$i != $$v; then \
+ if test $$infoadded = "no"; then \
+ echo "" >> $@; \
+ echo "# Installation information" >> $@; \
+ infoadded="yes"; \
+ fi; \
+ echo " includedir $$v" >> $@; \
fi; \
- v=$$(echo $$i | sed -e 's/-I//'); \
- echo " includedir $$v" >> $@; \
done; \
for i in $(LDFLAGS); do \
- if test $$infoadded = "no"; then \
- echo "" >> $@; \
- echo "# Installation information" >> $@; \
- infoadded="yes"; \
+ v=$$(echo $$i | sed -e 's/^-L//'); \
+ if test $$i != $$v; then \
+ if test $$infoadded = "no"; then \
+ echo "" >> $@; \
+ echo "# Installation information" >> $@; \
+ infoadded="yes"; \
+ fi; \
+ echo " linkdir $$v" >> $@; \
fi; \
- v=$$(echo $$i | sed -e 's/-L//'); \
- echo " linkdir $$v" >> $@; \
done