From 40580c0409449f1a02664649e97bd397ed9eb171 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 May 2015 14:52:19 -0700 Subject: [PATCH 1/4] Change the behavior of the DESTDIR make variable DESTDIR is a common make idiom. As per the GNU coding standards https://www.gnu.org/prep/standards/html_node/DESTDIR.html "DESTDIR is a variable prepended to each installed target file, like this: $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a The DESTDIR variable is specified by the user on the make command line as an absolute file name. For example: make DESTDIR=/tmp/stage install DESTDIR should be supported only in the install* and uninstall* targets, as those are the only targets where it is useful. If your installation step would normally install /usr/local/bin/foo and /usr/local/lib/libfoo.a, then an installation invoked as in the example above would install /tmp/stage/usr/local/bin/foo and /tmp/stage/usr/local/lib/libfoo.a instead." The current Makefile.in uses DESTDIR, but has a slightly non-standard behavior: the target install location doesn't include "$prefix". This breaks package managers, because stuff ends up getting installed to the wrong location. Unfortunately the only way I can think of to fix this involves silently changing the behavior of DESTDIR. Hopefully nobody is using it...? [port of 8a2088b59162fe16c16d26ddc1cfcaaaa8c4156f in riscv-fesvr] --- Makefile.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index d9841e26..1d8d9b25 100644 --- a/Makefile.in +++ b/Makefile.in @@ -55,14 +55,14 @@ enable_stow := @enable_stow@ ifeq ($(enable_stow),yes) stow_pkg_dir := $(prefix)/pkgs - DESTDIR ?= $(stow_pkg_dir)/$(project_name)-$(project_ver) + INSTALLDIR ?= $(DESTDIR)/$(stow_pkg_dir)/$(project_name)-$(project_ver) else - DESTDIR ?= $(prefix) + INSTALLDIR ?= $(DESTDIR)/$(prefix) endif -install_hdrs_dir := $(DESTDIR)/include/$(project_name) -install_libs_dir := $(DESTDIR)/lib -install_exes_dir := $(DESTDIR)/bin +install_hdrs_dir := $(INSTALLDIR)/include/$(project_name) +install_libs_dir := $(INSTALLDIR)/lib +install_exes_dir := $(INSTALLDIR)/bin #------------------------------------------------------------------------- # List of subprojects From 126beb482ff62c31cfde36cc1a3d06f15d13a873 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 May 2015 14:54:24 -0700 Subject: [PATCH 2/4] Install pkg-config files for Spike The actual Spike package consists of a whole bunch of libraries. This installs a pkg-config file for each generated library, and a meta pkg-config file (riscv-spike.pc) that links in all the other Spike libraries except dummy_rocc (which I figure isn't interesting). This allows me to package and install spike, and then use that package to build an extension library (so I don't have to fork Spike for my own ISA extension). --- Makefile.in | 10 +++++++++- configure.ac | 6 ++++++ riscv-dummy_rocc.pc.in | 11 +++++++++++ riscv-hwacha.pc.in | 11 +++++++++++ riscv-riscv.pc.in | 11 +++++++++++ riscv-softfloat.pc.in | 11 +++++++++++ riscv-spike.pc.in | 10 ++++++++++ riscv-spike_main.pc.in | 12 ++++++++++++ 8 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 riscv-dummy_rocc.pc.in create mode 100644 riscv-hwacha.pc.in create mode 100644 riscv-riscv.pc.in create mode 100644 riscv-softfloat.pc.in create mode 100644 riscv-spike.pc.in create mode 100644 riscv-spike_main.pc.in diff --git a/Makefile.in b/Makefile.in index 1d8d9b25..4dfc07b7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -307,6 +307,7 @@ test_outs += $$($(2)_test_outs) install_hdrs += $$(addprefix $(src_dir)/$(1)/, $$($(2)_hdrs)) $$($(2)_gen_hdrs) install_libs += lib$(1).so install_exes += $$($(2)_install_prog_exes) +install_pcs += riscv-$(1).pc endef @@ -358,7 +359,14 @@ install-exes : $(install_exes) $(INSTALL_EXE) $$file $(install_exes_dir); \ done -install : install-hdrs install-libs install-exes +install-pc : $(install_pcs) + $(MKINSTALLDIRS) $(install_libs_dir)/pkgconfig/ + for file in $^; \ + do \ + $(INSTALL_HDR) $$file $(install_libs_dir)/pkgconfig/; \ + done + +install : install-hdrs install-libs install-exes install-pc ifeq ($(enable_stow),yes) $(MKINSTALLDIRS) $(stow_pkg_dir) cd $(stow_pkg_dir) && \ diff --git a/configure.ac b/configure.ac index 03b50484..d0c26b6a 100644 --- a/configure.ac +++ b/configure.ac @@ -100,4 +100,10 @@ MCPPBS_SUBPROJECTS([ riscv, hwacha, dummy_rocc, softfloat, spike_main ]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([riscv-spike.pc]) +AC_CONFIG_FILES([riscv-riscv.pc]) +AC_CONFIG_FILES([riscv-hwacha.pc]) +AC_CONFIG_FILES([riscv-softfloat.pc]) +AC_CONFIG_FILES([riscv-dummy_rocc.pc]) +AC_CONFIG_FILES([riscv-spike_main.pc]) AC_OUTPUT diff --git a/riscv-dummy_rocc.pc.in b/riscv-dummy_rocc.pc.in new file mode 100644 index 00000000..31635f6d --- /dev/null +++ b/riscv-dummy_rocc.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-dummy_rocc +Description: Example RISC-V ROCC accelerator +Version: git +Libs: -Wl,-rpath,${libdir} -L${libdir} -ldummy_rocc +Cflags: -I${includedir} +URL: http://riscv.org/download.html#tab_spike diff --git a/riscv-hwacha.pc.in b/riscv-hwacha.pc.in new file mode 100644 index 00000000..cad4e299 --- /dev/null +++ b/riscv-hwacha.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-hwacha +Description: RISC-V Hwacha binary library +Version: git +Libs: -Wl,-rpath,${libdir} -L${libdir} -lhwacha +Cflags: -I${includedir} +URL: http://riscv.org/download.html#tab_spike diff --git a/riscv-riscv.pc.in b/riscv-riscv.pc.in new file mode 100644 index 00000000..5e86b1c4 --- /dev/null +++ b/riscv-riscv.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-riscv +Description: RISC-V +Version: git +Libs: -Wl,-rpath,${libdir} -L${libdir} -lriscv +Cflags: -I${includedir} +URL: http://riscv.org/download.html#tab_spike diff --git a/riscv-softfloat.pc.in b/riscv-softfloat.pc.in new file mode 100644 index 00000000..6b18e884 --- /dev/null +++ b/riscv-softfloat.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-softfloat +Description: RISC-V softfloat library +Version: git +Libs: -Wl,-rpath,${libdir} -L${libdir} -lsoftfloat +Cflags: -I${includedir} +URL: http://riscv.org/download.html#tab_spike diff --git a/riscv-spike.pc.in b/riscv-spike.pc.in new file mode 100644 index 00000000..ee2ab99d --- /dev/null +++ b/riscv-spike.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-spike +Description: RISC-V spike meta library +Version: git +Depends: riscv-spike_main riscv-riscv riscv-hwacha riscv-softfloat +URL: http://riscv.org/download.html#tab_spike diff --git a/riscv-spike_main.pc.in b/riscv-spike_main.pc.in new file mode 100644 index 00000000..14a6f65e --- /dev/null +++ b/riscv-spike_main.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=${prefix}/@libdir@ +includedir=${prefix}/@includedir@ + +Name: riscv-spike_main +Description: RISC-V ISA simulator library +Version: git +Depends: riscv-riscv riscv-hwacha riscv-softfloat +Libs: -Wl,-rpath,${libdir} -L${libdir} -lspike_main +Cflags: -I${includedir} +URL: http://riscv.org/download.html#tab_spike From 8e20c328f8cb0d28189cca7a072f9d95cbcb3474 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 May 2015 15:36:45 -0700 Subject: [PATCH 3/4] autoreconf 126beb482ff6 ("Install pkg-config files for Spike") --- configure | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/configure b/configure index 910dd860..5ef634d4 100755 --- a/configure +++ b/configure @@ -4378,6 +4378,18 @@ ac_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files riscv-spike.pc" + +ac_config_files="$ac_config_files riscv-riscv.pc" + +ac_config_files="$ac_config_files riscv-hwacha.pc" + +ac_config_files="$ac_config_files riscv-softfloat.pc" + +ac_config_files="$ac_config_files riscv-dummy_rocc.pc" + +ac_config_files="$ac_config_files riscv-spike_main.pc" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -5075,6 +5087,12 @@ do "spike_main.mk") CONFIG_FILES="$CONFIG_FILES spike_main.mk:spike_main/spike_main.mk.in" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "riscv-spike.pc") CONFIG_FILES="$CONFIG_FILES riscv-spike.pc" ;; + "riscv-riscv.pc") CONFIG_FILES="$CONFIG_FILES riscv-riscv.pc" ;; + "riscv-hwacha.pc") CONFIG_FILES="$CONFIG_FILES riscv-hwacha.pc" ;; + "riscv-softfloat.pc") CONFIG_FILES="$CONFIG_FILES riscv-softfloat.pc" ;; + "riscv-dummy_rocc.pc") CONFIG_FILES="$CONFIG_FILES riscv-dummy_rocc.pc" ;; + "riscv-spike_main.pc") CONFIG_FILES="$CONFIG_FILES riscv-spike_main.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac From 11a49d0be23d1649316fac29c40cc1a0167598f2 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 May 2015 15:36:57 -0700 Subject: [PATCH 4/4] Install "disasm.h" Something includes this somewhere, so I see no reason not to just install it. --- riscv/riscv.mk.in | 1 + 1 file changed, 1 insertion(+) diff --git a/riscv/riscv.mk.in b/riscv/riscv.mk.in index d3072593..7ce2cb94 100644 --- a/riscv/riscv.mk.in +++ b/riscv/riscv.mk.in @@ -10,6 +10,7 @@ riscv_hdrs = \ htif.h \ common.h \ decode.h \ + disasm.h \ mmu.h \ processor.h \ sim.h \