void-packages/srcpkgs/ghdl/patches/install-paths.patch

165 lines
6.9 KiB
Diff
Raw Normal View History

This is needed so that llvm and mcode backends can coexist.
Taken and adapted from Debian (simplified).
Description: Patch installation paths for Debian packaging
Author: Andreas Bombe <aeb@debian.org>
Last-Update: 2020-03-28
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
diff --git a/Makefile.in b/Makefile.in
index 9a6b1731..3aba6532 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -26,6 +26,7 @@ prefix=@prefix@
backend=@backend@
libdirsuffix=@libdirsuffix@
libdirreverse=@libdirreverse@
+incdirsuffix=@incdirsuffix@
EXEEXT=@EXEEXT@
SOEXT=@SOEXT@
PIC_FLAGS=@PIC_FLAGS@
@@ -48,8 +49,8 @@ INSTALL_DATA=install -m 644
PWD=$(CURDIR)
DESTDIR=
bindir=$(prefix)/bin
-libdir=$(prefix)/lib
-incdir=$(prefix)/include
+libdir=$(prefix)/$(libdirsuffix)
+incdir=$(prefix)/$(incdirsuffix)
MKDIR=mkdir
LN=ln -s
CP=cp
@@ -192,7 +193,7 @@ libs.vhdl.mcode: ghdl_mcode$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_mcode$(EXEEXT) GHDL_FLAGS="" VHDL_COPY_OBJS=no vhdl.libs.all
install.mcode.program: install.dirs ghdl_mcode$(EXEEXT)
- $(INSTALL_PROGRAM) ghdl_mcode$(EXEEXT) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
+ $(INSTALL_PROGRAM) ghdl_mcode$(EXEEXT) $(DESTDIR)$(bindir)/ghdl-mcode$(EXEEXT)
uninstall.mcode.program:
$(RM) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
@@ -355,8 +356,8 @@ oread-llvm$(EXEEXT): force
LLVM_CONFIG="$(LLVM_CONFIG)" CXX="$(CXX)"
install.llvm.program: install.dirs ghdl1-llvm$(EXEEXT) ghdl_llvm$(EXEEXT)
- $(INSTALL_PROGRAM) ghdl_llvm$(EXEEXT) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
- $(INSTALL_PROGRAM) ghdl1-llvm$(EXEEXT) $(DESTDIR)$(bindir)/ghdl1-llvm$(EXEEXT)
+ $(INSTALL_PROGRAM) ghdl_llvm$(EXEEXT) $(DESTDIR)$(bindir)/ghdl-llvm$(EXEEXT)
+ $(INSTALL_PROGRAM) ghdl1-llvm$(EXEEXT) $(DESTDIR)$(libdir)/ghdl1-llvm$(EXEEXT)
uninstall.llvm.program:
$(RM) $(DESTDIR)$(bindir)/ghdl1-llvm$(EXEEXT)
diff --git a/configure b/configure
index ce052534..22e1335a 100755
--- a/configure
+++ b/configure
@@ -34,6 +34,7 @@ MAKE=${MAKE:-make}
LDFLAGS=
prefix=/usr/local
libdirsuffix=lib/ghdl
+incdirsuffix=include
libdirreverse=../..
gcc_src_dir=
llvm_config=
@@ -54,7 +55,7 @@ PIC_FLAGS=-fPIC
show_help=no
progname=$0
-subst_vars="CC CXX GNATMAKE MAKE CFLAGS LDFLAGS build srcdir abs_srcdir prefix backend libdirsuffix libdirreverse gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pic enable_werror enable_checks enable_openieee enable_libghdl libghdl_version ghdl_version"
+subst_vars="CC CXX GNATMAKE MAKE CFLAGS LDFLAGS build srcdir abs_srcdir prefix backend libdirsuffix libdirreverse incdirsuffix gcc_src_dir llvm_config llvm_be backtrace_lib build_mode EXEEXT SOEXT PIC_FLAGS default_pic enable_werror enable_checks enable_openieee enable_libghdl libghdl_version ghdl_version"
# Find srcdir
srcdir=`dirname $progname`
@@ -93,6 +94,8 @@ for opt do
;;
--prefix=*) prefix="$optarg";;
--srcdir=*) srcdir="$optarg";;
+ --libdir=*) libdirsuffix="$optarg";;
+ --incdir=*) incdirsuffix="$optarg";;
--with-gcc=*) gcc_src_dir="$optarg"; backend=gcc;;
--with-llvm=*)
echo "--with-llvm is deprecated, use --with-llvm-config"
@@ -128,6 +131,8 @@ Usage: configure [options]
Options [defaults in brackets]:
--prefix=PREFIX install in PREFIX [$prefix]
--srcdir=SRCDIR source code path [$srcdir]
+ --libdir=LIBDIR lib dir path relative to PREFIX [$libdirsuffix]
+ --incdir=INCDIR C include dir path relative to PREFIX [$incdirsuffix]
--with-gcc=DIR use gcc backend from DIR
--with-llvm-config[=LLVM-CONFIG] use llvm backend [llvm-config]
--with-backtrace-lib=LIB.a link with libbacktrace LIB.a to display a
@@ -405,10 +410,11 @@ 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%@COMPILER_LLVM@%lib/ghdl/llvm/ghdl1-llvm$EXEEXT%" \
-e "s%@POST_PROCESSOR@%oread-$backend%" \
-e "s%@INSTALL_PREFIX@%$prefix%" \
-e "s%@LIB_PREFIX@%$libdirsuffix%" \
+ -e "s%@INC_PREFIX@%$incdirsuffix%" \
-e "s%@SOEXT@%$SOEXT%" \
-e "s%@default_pic@%$default_pic%" \
< $srcdir/src/ghdldrv/default_paths.ads.in > default_paths.ads
diff --git a/dist/gcc/Make-lang.in b/dist/gcc/Make-lang.in
index cca1e4df..37d95d20 100644
--- a/dist/gcc/Make-lang.in
+++ b/dist/gcc/Make-lang.in
@@ -104,7 +104,9 @@ vhdl/default_paths.ads: Makefile
echo " Compiler_Llvm : constant String := \"\";" >> tmp-dpaths.ads
echo " Post_Processor : constant String := \"\";" >> tmp-dpaths.ads
echo " Lib_Prefix : constant String :=">> tmp-dpaths.ads
- echo " \"lib/ghdl\";" >> tmp-dpaths.ads
+ echo " \"lib/ghdl/gcc\";" >> tmp-dpaths.ads
+ echo " Inc_Prefix : constant String :=" >> tmp-dpaths.ads
+ echo " \"lib/ghdl/include\";" >> 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
@@ -159,8 +161,8 @@ vhdl.install-plugin:
# Install the driver program as ghdl.
vhdl.install-common: ghdl$(exeext) ghdl1$(exeext)
-mkdir $(DESTDIR)$(bindir)
- -$(RM) $(DESTDIR)$(bindir)/ghdl$(exeext)
- $(INSTALL_PROGRAM) ghdl$(exeext) $(DESTDIR)$(bindir)/ghdl$(exeext)
+ -$(RM) $(DESTDIR)$(bindir)/ghdl-gcc$(exeext)
+ $(INSTALL_PROGRAM) ghdl$(exeext) $(DESTDIR)$(bindir)/ghdl-gcc$(exeext)
-mkdir $(DESTDIR)$(libdir)
-mkdir $(DESTDIR)$(libdir)/ghdl
$(INSTALL_DATA) ../libbacktrace/.libs/libbacktrace.a $(DESTDIR)$(libdir)/ghdl
diff --git a/src/ghdldrv/default_paths.ads.in b/src/ghdldrv/default_paths.ads.in
index ae321011..228c0696 100644
--- a/src/ghdldrv/default_paths.ads.in
+++ b/src/ghdldrv/default_paths.ads.in
@@ -25,6 +25,8 @@ package Default_Paths is
"@INSTALL_PREFIX@";
Lib_Prefix : constant String :=
"@LIB_PREFIX@";
+ Inc_Prefix : constant String :=
+ "@INC_PREFIX@";
Compiler_Gcc : constant String :=
"@COMPILER_GCC@";
diff --git a/src/ghdldrv/ghdlvpi.adb b/src/ghdldrv/ghdlvpi.adb
index 295b7300..487eb0e6 100644
--- a/src/ghdldrv/ghdlvpi.adb
+++ b/src/ghdldrv/ghdlvpi.adb
@@ -39,7 +39,7 @@ package body Ghdlvpi is
-- Compute install path
Ghdllocal.Set_Exec_Prefix_From_Program_Name;
- return Ghdllocal.Exec_Prefix.all & Directory_Separator & "include";
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator & Inc_Prefix;
end Get_Vpi_Include_Dir;
-- Return the lib directory.
@@ -50,7 +50,7 @@ package body Ghdlvpi is
Ghdllocal.Set_Exec_Prefix_From_Program_Name;
end if;
- return Ghdllocal.Exec_Prefix.all & Directory_Separator & "lib";
+ return Ghdllocal.Exec_Prefix.all & Directory_Separator & Lib_Prefix;
end Get_Vpi_Lib_Dir;
-- Return the lib directory, but unixify the path (for a unix shell in