diff --git a/Makefile.in b/Makefile.in index 1a90b46ab..025294225 100644 --- a/Makefile.in +++ b/Makefile.in @@ -266,11 +266,15 @@ mkbindirs: installbin: | mkbindirs cd $(srcdir)/bin; \ for p in $(VL_INST_PUBLIC_SCRIPT_FILES) ; do \ - $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkgdatadir)/bin/$$p; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ done + perl -p -i -e 'use File::Spec;' \ + -e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(pkgdatadir))", "$(realpath $(DESTDIR)$(bindir))");' \ + -e 's/my \$$verilator_pkgdatadir_relpath = .*/my \$$verilator_pkgdatadir_relpath = "$$path";/g' \ + -- "$(DESTDIR)/$(bindir)/verilator" cd bin; \ for p in $(VL_INST_PUBLIC_BIN_FILES) ; do \ - $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkgdatadir)/bin/$$p; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \ done cd $(srcdir)/bin; \ for p in $(VL_INST_PRIVATE_SCRIPT_FILES) ; do \ @@ -280,11 +284,11 @@ installbin: | mkbindirs installredirect: installbin | mkbindirs cp ${srcdir}/bin/redirect ${srcdir}/bin/redirect.tmp perl -p -i -e 'use File::Spec;' \ - -e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(pkgdatadir)/bin)", "$(realpath $(DESTDIR)$(bindir))");' \ + -e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(bindir))", "$(realpath $(DESTDIR)$(pkgdatadir)/bin)");' \ -e 's/RELPATH.*/"$$path";/g' -- "${srcdir}/bin/redirect.tmp" cd $(srcdir)/bin; \ for p in $(VL_INST_PUBLIC_SCRIPT_FILES) $(VL_INST_PUBLIC_BIN_FILES) ; do \ - $(INSTALL_PROGRAM) redirect.tmp $(DESTDIR)$(bindir)/$$p; \ + $(INSTALL_PROGRAM) redirect.tmp $(DESTDIR)$(pkgdatadir)/bin/$$p; \ done rm ${srcdir}/bin/redirect.tmp diff --git a/bin/verilator b/bin/verilator index d25f6e525..1ca6d3b8c 100755 --- a/bin/verilator +++ b/bin/verilator @@ -69,7 +69,9 @@ if (! GetOptions( pod2usage(-exitstatus => 2, -verbose => 0); } -my $verilator_root = realpath("$RealBin/.."); +# WARNING: $verilator_pkgdatadir_relpath is substituted during Verilator 'make install' +my $verilator_pkgdatadir_relpath = ".."; +my $verilator_root = realpath("$RealBin/$verilator_pkgdatadir_relpath"); if (defined $ENV{VERILATOR_ROOT}) { if ((!-d $ENV{VERILATOR_ROOT}) || $verilator_root ne realpath($ENV{VERILATOR_ROOT})) { warn "%Error: verilator: VERILATOR_ROOT is set to inconsistent path. Suggest leaving it unset.\n"; diff --git a/nodist/install_test b/nodist/install_test index bf15fd796..8534ebf4f 100755 --- a/nodist/install_test +++ b/nodist/install_test @@ -31,7 +31,10 @@ def test(): print("== stage 0") run("/bin/rm -rf " + blddir) run("/bin/mkdir -p " + blddir) - run("cd " + blddir + " && " + srcdir + "/configure --prefix " + prefix) + # Matches Ubuntu's e.g. /usr/share/pkgconfig/verilator.pc + run("cd " + blddir + " && " + srcdir + "/configure --prefix " + prefix + + " --exec-prefix " + prefix + " --datarootdir " + prefix + "/share" + " --includedir " + + prefix + "/share/verilator/include") run("cd " + blddir + " && make -j " + str(calc_jobs())) # Install it under the prefix diff --git a/test_regress/t/t_flag_help.py b/test_regress/t/t_flag_help.py index d9ec36e3c..262ed934f 100755 --- a/test_regress/t/t_flag_help.py +++ b/test_regress/t/t_flag_help.py @@ -14,26 +14,22 @@ test.scenarios('dist') # See also t_flag_version.py -def check(interpreter, prog): +def check(prog): logfile = test.obj_dir + "/t_help__" + os.path.basename(prog) + ".log" - test.run(fails=False, - cmd=[interpreter, prog, "--help"], - logfile=logfile, - tee=False, - verilator_run=True) + test.run(fails=False, cmd=[prog, "--help"], logfile=logfile, tee=False, verilator_run=True) test.file_grep(logfile, r'(DISTRIBUTION|usage:)') -check("perl", os.environ["VERILATOR_ROOT"] + "/bin/verilator") -check("perl", os.environ["VERILATOR_ROOT"] + "/bin/verilator_coverage") +check(os.environ["VERILATOR_ROOT"] + "/bin/verilator") +check(os.environ["VERILATOR_ROOT"] + "/bin/verilator_coverage") -check("python3", os.environ["VERILATOR_ROOT"] + "/bin/verilator_ccache_report") -check("python3", os.environ["VERILATOR_ROOT"] + "/bin/verilator_gantt") -check("python3", os.environ["VERILATOR_ROOT"] + "/bin/verilator_profcfunc") +check(os.environ["VERILATOR_ROOT"] + "/bin/verilator_ccache_report") +check(os.environ["VERILATOR_ROOT"] + "/bin/verilator_gantt") +check(os.environ["VERILATOR_ROOT"] + "/bin/verilator_profcfunc") if os.path.exists(os.environ["VERILATOR_ROOT"] + "/bin/verilator_difftree"): - check("python3", os.environ["VERILATOR_ROOT"] + "/bin/verilator_difftree") + check(os.environ["VERILATOR_ROOT"] + "/bin/verilator_difftree") test.passes()