void-packages/srcpkgs/ghdl/patches/install-paths.patch
2021-05-18 02:12:14 +02:00

164 lines
7 KiB
Diff

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 e4923c2..c94853f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -24,6 +24,7 @@ prefix=@prefix@
backend=@backend@
libdirsuffix=@libdirsuffix@
libdirreverse=@libdirreverse@
+incdirsuffix=@incdirsuffix@
EXEEXT=@EXEEXT@
SOEXT=@SOEXT@
PIC_FLAGS=@PIC_FLAGS@
@@ -46,8 +47,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
@@ -200,7 +201,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)
@@ -372,8 +373,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)
test.llvm: ghdl_llvm$(EXEEXT)
cd $(srcdir)/testsuite; GHDL=$(CURDIR)/ghdl_llvm$(EXEEXT) ./testsuite.sh
diff --git a/configure b/configure
index 917215a..c1c1a6d 100755
--- a/configure
+++ b/configure
@@ -32,6 +32,7 @@ MAKE=${MAKE:-make}
LDFLAGS=
prefix=/usr/local
libdirsuffix=lib/ghdl
+incdirsuffix=include
libdirreverse=../..
gcc_src_dir=
llvm_config=
@@ -52,7 +53,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_gplcompat 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_gplcompat enable_libghdl libghdl_version ghdl_version"
# Find srcdir
srcdir=`dirname $progname`
@@ -91,6 +92,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"
@@ -126,6 +129,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
@@ -400,10 +405,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/scripts/gcc/Make-lang.in b/scripts/gcc/Make-lang.in
index 108b05b..f9f3b16 100644
--- a/scripts/gcc/Make-lang.in
+++ b/scripts/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 ec6b68d..0b773ce 100644
--- a/src/ghdldrv/default_paths.ads.in
+++ b/src/ghdldrv/default_paths.ads.in
@@ -23,6 +23,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 3ecd831..36fdc6f 100644
--- a/src/ghdldrv/ghdlvpi.adb
+++ b/src/ghdldrv/ghdlvpi.adb
@@ -37,7 +37,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.
@@ -48,7 +48,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