aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2022-03-12 16:27:22 +0100
committertgingold <tgingold@users.noreply.github.com>2022-03-13 08:58:58 +0100
commita89bb895d87768df1c0d78d3941f8cec37593222 (patch)
tree7d3109a68c3eb54f6abd98858e4d9ca3e285fb9f
parente59396cf31a30c7c8ba6480ea02e34bfde97e4c9 (diff)
downloadghdl-a89bb895d87768df1c0d78d3941f8cec37593222.tar.gz
ghdl-a89bb895d87768df1c0d78d3941f8cec37593222.tar.bz2
ghdl-a89bb895d87768df1c0d78d3941f8cec37593222.zip
Fix hardcoded values in gcc backend's default_paths
The gcc backend's Make-lang.in still had hardcoded install paths. Since this is copied to the gcc build system we don't have access to our configure variables, so just treat it as a subst_file in the configure script. While we're at it we get rid of the separate sed invocation for default_paths and have that go through config.status instead.
-rw-r--r--Makefile.in7
-rwxr-xr-xconfigure39
-rw-r--r--default_paths.ads.in (renamed from src/ghdldrv/default_paths.ads.in)0
-rw-r--r--scripts/gcc/Make-lang.in.in (renamed from scripts/gcc/Make-lang.in)8
4 files changed, 30 insertions, 24 deletions
diff --git a/Makefile.in b/Makefile.in
index 5ad6423f5..f99927395 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -166,6 +166,9 @@ Makefile: $(srcdir)/Makefile.in ./config.status
setup.py: $(srcdir)/setup.py.in ./config.status
./config.status
+scripts/gcc/Make-lang.in: $(srcdir)/scripts/gcc/Make-lang.in.in ./config.status
+ ./config.status
+
GHDL_COMMON_INCFLAGS=-aI$(srcdir)/src -aI$(srcdir)/src/vhdl -aI$(srcdir)/src/synth -aI$(srcdir)/src/grt -aI$(srcdir)/src/psl -aI$(srcdir)/src/vhdl/translate
GRTSRCDIR=$(abs_srcdir)/src/grt
@@ -240,7 +243,7 @@ all.gcc:
@echo "3) $(MAKE) ghdllib"
@echo "4) $(MAKE) install"
-copy-sources.gcc: version.ads
+copy-sources.gcc: version.ads scripts/gcc/Make-lang.in
$(RM) -rf $(gcc_vhdl_dir)
$(MKDIR) $(gcc_vhdl_dir)
$(CP) -p version.ads ghdlsynth_maybe.ads $(gcc_vhdl_dir)
@@ -282,7 +285,7 @@ copy-sources.gcc: version.ads
$(CP) -p $(srcdir)/doc/ghdl.texi $(srcdir)/doc/ghdl.1 $(gcc_vhdl_dir)
$(MKDIR) $(gcc_vhdl_dir)/ghdldrv
$(CP) -pR $(srcdir)/src/ghdldrv/*.ad? $(gcc_vhdl_dir)/ghdldrv
- $(CP) -p $(srcdir)/scripts/gcc/Make-lang.in $(gcc_vhdl_dir)
+ $(CP) -p scripts/gcc/Make-lang.in $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/scripts/gcc/config-lang.in $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/scripts/gcc/lang-options.h $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/scripts/gcc/lang-specs.h $(gcc_vhdl_dir)
diff --git a/configure b/configure
index d7bcfe57f..f55987961 100755
--- a/configure
+++ b/configure
@@ -59,7 +59,10 @@ subst_vars="CC CXX GNATMAKE ADA_FLAGS MAKE CFLAGS CXXFLAGS LDFLAGS build
srcdir abs_srcdir prefix backend libdirsuffix libghdldirsuffix
incdirsuffix gcc_src_dir llvm_config llvm_be backtrace_lib
build_mode EXEEXT SOEXT PIC_FLAGS default_pic enable_werror enable_checks
-enable_gplcompat enable_libghdl libghdl_version ghdl_version"
+enable_gplcompat enable_libghdl libghdl_version ghdl_version
+COMPILER_GCC COMPILER_DEBUG COMPILER_MCODE COMPILER_LLVM POST_PROCESSOR
+INSTALL_PREFIX LIBDIR_SUFFIX LIBGHDLDIR_SUFFIX INCDIR_SUFFIX
+"
# Find srcdir
srcdir=`dirname $progname`
@@ -337,6 +340,20 @@ if [ ! -d pic ]; then
fi
fi
+# Define variables derrived from configuration
+#
+# Note most of these are used to generate default_paths.ads, you should
+# also update scripts/windows/mcode/default_paths.ads if you change them.
+COMPILER_GCC=ghdl1-gcc$EXEEXT
+COMPILER_DEBUG=ghdl1-debug$EXEEXT
+COMPILER_MCODE=ghdl1-mcode$EXEEXT
+COMPILER_LLVM=ghdl1-llvm$EXEEXT
+POST_PROCESSOR=oread-$backend
+INSTALL_PREFIX=$prefix
+LIBDIR_SUFFIX=$libdirsuffix
+LIBGHDLDIR_SUFFIX=$libghdldirsuffix
+INCDIR_SUFFIX=$incdirsuffix
+
# Generate config.status
rm -f config.status
{
@@ -359,9 +376,10 @@ rm -f config.status
eval vval=\$$v
echo $v=\"$vval\"
done
- subst_files="ghdl.gpr Makefile"
+ subst_files="Makefile default_paths.ads ghdl.gpr scripts/gcc/Make-lang.in"
echo "for f in $subst_files; do"
echo ' echo "Creating $f"'
+ echo ' mkdir -p "$(dirname "$f")"'
echo " sed \\"
for v in $subst_vars; do
echo " -e \"s%@$v@%\$$v%g\" \\"
@@ -419,21 +437,4 @@ fi
echo "with $pkg_synth;" > ghdlsynth_maybe.ads
echo "package Ghdlsynth_Maybe renames $pkg_synth;" >> ghdlsynth_maybe.ads
-# Generate default_paths.ads
-# Also update scripts/windows/mcode/default_paths.ads if you change this
-# template.
-echo "Generate default_paths.ads"
-sed -e "s%@COMPILER_GCC@%ghdl1-gcc$EXEEXT%" \
- -e "s%@COMPILER_DEBUG@%ghdl1-debug$EXEEXT%" \
- -e "s%@COMPILER_MCODE@%ghdl1-mcode$EXEEXT%" \
- -e "s%@COMPILER_LLVM@%ghdl1-llvm$EXEEXT%" \
- -e "s%@POST_PROCESSOR@%oread-$backend%" \
- -e "s%@INSTALL_PREFIX@%$prefix%" \
- -e "s%@LIBDIR_SUFFIX@%$libdirsuffix%" \
- -e "s%@LIBGHDLDIR_SUFFIX@%$libghdldirsuffix%" \
- -e "s%@INCDIR_SUFFIX@%$incdirsuffix%" \
- -e "s%@SOEXT@%$SOEXT%" \
- -e "s%@default_pic@%$default_pic%" \
- < $srcdir/src/ghdldrv/default_paths.ads.in > default_paths.ads
-
exit 0
diff --git a/src/ghdldrv/default_paths.ads.in b/default_paths.ads.in
index 03addd784..03addd784 100644
--- a/src/ghdldrv/default_paths.ads.in
+++ b/default_paths.ads.in
diff --git a/scripts/gcc/Make-lang.in b/scripts/gcc/Make-lang.in.in
index 826f65538..cdea74be8 100644
--- a/scripts/gcc/Make-lang.in
+++ b/scripts/gcc/Make-lang.in.in
@@ -103,12 +103,14 @@ vhdl/default_paths.ads: Makefile
echo " Compiler_Mcode : constant String := \"\";" >> tmp-dpaths.ads
echo " Compiler_Llvm : constant String := \"\";" >> tmp-dpaths.ads
echo " Post_Processor : constant String := \"\";" >> tmp-dpaths.ads
+ # Note: the @VARs@ below are replaced by ghdl's configure script
+ # not gcc's.
echo " LibDir_Suffix : constant String :=">> tmp-dpaths.ads
- echo " \"lib\";" >> tmp-dpaths.ads
+ echo " \"@LIBDIR_SUFFIX@\";" >> tmp-dpaths.ads
echo " LibGhdlDir_Suffix : constant String :=">> tmp-dpaths.ads
- echo " \"lib/ghdl\";" >> tmp-dpaths.ads
+ echo " \"@LIBGHDLDIR_SUFFIX@\";" >> tmp-dpaths.ads
echo " IncDir_Suffix : constant String :=" >> tmp-dpaths.ads
- echo " \"include/ghdl\";" >> tmp-dpaths.ads
+ echo " \"@INCDIR_SUFFIX@\";" >> tmp-dpaths.ads
echo " Shared_Library_Extension : constant String :=">> tmp-dpaths.ads
echo " \"$(VHDL_SOEXT)\";" >> tmp-dpaths.ads
echo " Default_Pie : constant Boolean := False;" >> tmp-dpaths.ads