From 6e695f55f902e692d1157a08a1c4a3f0a04c60dc Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 18 Jan 2025 14:33:47 +0000 Subject: [PATCH] Bundle tcllib with Windows installer --- .github/workflows/build-test.yml | 2 + .github/workflows/test-osvvm.yml | 28 +++++----- NEWS.md | 1 + contrib/msi/Makemodule.am | 21 +++++++- contrib/msi/genlibs.py | 91 +++++++++++++++++++++----------- contrib/msi/installer.wxs.in | 2 - src/cov/cov-report.c | 2 +- 7 files changed, 99 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 0c194a13c..5b3b8c4d9 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -466,3 +466,5 @@ jobs: nvc.exe -a test\regress\ieee1.vhd nvc.exe -e ieee1 nvc.exe -r ieee1 + 'package require msgcat; package require sdfsd' | Set-Content -Path test.tcl + nvc.exe --do .\test.tcl diff --git a/.github/workflows/test-osvvm.yml b/.github/workflows/test-osvvm.yml index 6b182d181..09a17248b 100644 --- a/.github/workflows/test-osvvm.yml +++ b/.github/workflows/test-osvvm.yml @@ -29,22 +29,22 @@ jobs: update: true install: >- mingw-w64-x86_64-tcllib - # - name: Test OSVVM - # shell: powershell - # run: | - # $Env:OSVVM_DIR = $(Resolve-Path -Path OsvvmLibraries) - # echo $Env:OSVVM_DIR - # $Env:OSVVM_MUST_BUILD = 1 - # nvc.exe --do .\test\test-osvvm.tcl - name: Test OSVVM - shell: msys2 {0} + shell: powershell run: | - export PATH=/c/Program\ Files/NVC/bin:$PATH - export OSVVM_DIR=$(realpath OsvvmLibraries) - export OSVVM_MUST_BUILD=1 - find $OSVVM_DIR -name VendorScripts_NVC.tcl -exec \ - sed -i '/puts $SimulateMessage/d' \{} \; - tclsh ./test/test-osvvm.tcl + $Env:OSVVM_DIR = $(Resolve-Path -Path OsvvmLibraries) + echo $Env:OSVVM_DIR + $Env:OSVVM_MUST_BUILD = 1 + nvc.exe --do .\test\test-osvvm.tcl + # - name: Test OSVVM + # shell: msys2 {0} + # run: | + # export PATH=/c/Program\ Files/NVC/bin:$PATH + # export OSVVM_DIR=$(realpath OsvvmLibraries) + # export OSVVM_MUST_BUILD=1 + # find $OSVVM_DIR -name VendorScripts_NVC.tcl -exec \ + # sed -i '/puts $SimulateMessage/d' \{} \; + # tclsh ./test/test-osvvm.tcl - name: Publish results uses: dorny/test-reporter@v1 with: diff --git a/NEWS.md b/NEWS.md index bc4b3f529..fd6641ef6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ element (#1137). - Fixed a regression that caused some array aggregates to be incorrectly reported as ambiguous (#1138). +- The Windows installer now bundles the Tcllib library (#1136). ## Version 1.15.0 - 2025-01-11 - `--load` is now a global option and should be placed before the `-r` diff --git a/contrib/msi/Makemodule.am b/contrib/msi/Makemodule.am index a41ac4fa0..e3d12ec04 100644 --- a/contrib/msi/Makemodule.am +++ b/contrib/msi/Makemodule.am @@ -22,12 +22,31 @@ libs.wxs: $(srcdir)/contrib/msi/genlibs.py bin/nvc$(EXEEXT) WIXOBJS = installer.wixobj libs.wixobj -$(PACKAGE_NAME)-$(PACKAGE_VERSION).msi: $(WIXOBJS) $(srcdir)/contrib/msi/gpl-3.0.rtf +$(PACKAGE_NAME)-$(PACKAGE_VERSION).msi: $(WIXOBJS) $(srcdir)/contrib/msi/gpl-3.0.rtf tcllib.install light -ext WixUIExtension -cultures:en-us \ -dWixUILicenseRtf=$(srcdir)/contrib/msi/gpl-3.0.rtf -out $@ $(WIXOBJS) msi-installer: $(PACKAGE_NAME)-$(PACKAGE_VERSION).msi +tcllib-1.21.tar.gz: + wget https://core.tcl-lang.org/tcllib/uv/tcllib-1.21.tar.gz + +tcllib.extract: tcllib-1.21.tar.gz + tar zxf tcllib-1.21.tar.gz + touch tcllib.extract + +tcllib.configure: tcllib.extract + cd tcllib-1.21 && ./configure --prefix=$$(cygpath -u $(PREFIX)) + touch tcllib.configure + +tcllib.install: tcllib.configure + cd tcllib-1.21 && make install-libraries + touch tcllib.install + +DISTCLEANFILES += tcllib-1.21.tar.gz + +CLEANFILES += tcllib.install tcllib.configure tcllib.extract + else msi-installer: diff --git a/contrib/msi/genlibs.py b/contrib/msi/genlibs.py index 751484489..6a92bce42 100644 --- a/contrib/msi/genlibs.py +++ b/contrib/msi/genlibs.py @@ -15,6 +15,37 @@ prefix = subprocess.check_output( ["cygpath", "-u", wprefix]).decode("utf-8").strip() +allrefs = [] + +def get_ref(prefix, d): + suffix = os.path.basename(d).upper().replace("-", "_").replace("+", ".") + return f"{prefix}_{suffix}" + + +def walk_dir(prefix, d): + fs = glob(f"{d}\\*") + fs.sort() + + for f in fs: + ref = get_ref(prefix, f) + base = os.path.basename(f) + if os.path.isdir(f): + print(f"") + walk_dir(ref, f) + print("") + else: + print(f"") + print(f" ") + print("") + + allrefs.append(ref) + + +################################################################################ +# DLLs + dlls = set() ldd = subprocess.Popen(["ldd", sys.argv[1]], stdout=subprocess.PIPE) for line in io.TextIOWrapper(ldd.stdout, encoding="utf-8"): @@ -28,12 +59,6 @@ dlls = list(dlls) dlls.sort() - -def get_ref(prefix, d): - suffix = os.path.basename(d).upper().replace("-", "_").replace("+", "_") - return f"{prefix}_{suffix}" - - for d in dlls: base = os.path.basename(d) ref = get_ref("BIN", d) @@ -42,29 +67,42 @@ def get_ref(prefix, d): print(f" ") print("") + allrefs.append(ref) print("") -print("") -tcl = glob(wprefix + "\\lib\\tcl8.6\\*") -tcl.sort() +################################################################################ +# TCL core libraries + +print("") + +print("") +walk_dir("TCL", f"{wprefix}\\lib\\tcl8.6") +print("") + +print("") +walk_dir("TCL8", f"{wprefix}\\lib\\tcl8") +print("") + +print("") -for t in tcl: - if os.path.isdir(t): - pass - else: - base = os.path.basename(t) - ref = get_ref("LIB_TCL", t) - print(f"") - print(f" ") - print("") + +################################################################################ +# TclLib + +print("") + +print(f"") +walk_dir("TCLLIB", f"{wprefix}\\lib\\tcllib1.21") +print("") print("") +################################################################################ +# Compiled VHDL libraries + libdirs = [ ("LIB_NVC_NVC", "\\lib\\nvc\\nvc"), ("LIB_NVC_NVC.08", "\\lib\\nvc\\nvc.08"), @@ -76,7 +114,6 @@ def get_ref(prefix, d): ("LIB_NVC_IEEE.08", "\\lib\\nvc\\ieee.08"), ("LIB_NVC_IEEE.19", "\\lib\\nvc\\ieee.19"), ] -allrefs = [] for (prefix, folder) in libdirs: print(f"") @@ -102,16 +139,10 @@ def get_ref(prefix, d): print("") -print("") - -for d in dlls: - print(f"") +################################################################################ +# Emit component groups -for t in tcl: - if os.path.isdir(t): - pass - else: - print(f"") +print("") for r in allrefs: print(f"") diff --git a/contrib/msi/installer.wxs.in b/contrib/msi/installer.wxs.in index 0b3703175..54ee2f140 100644 --- a/contrib/msi/installer.wxs.in +++ b/contrib/msi/installer.wxs.in @@ -34,8 +34,6 @@ - - diff --git a/src/cov/cov-report.c b/src/cov/cov-report.c index a9a207976..61b5f5dd0 100644 --- a/src/cov/cov-report.c +++ b/src/cov/cov-report.c @@ -551,7 +551,7 @@ static void cover_print_code_loc(FILE *f, cover_pair_t *pair) continue; } else - fprintf(f, "%lu:", loc.first_line + (curr_line - pair->line)); + fprintf(f, "%zu:", loc.first_line + (curr_line - pair->line)); int curr_char = 0; while (curr_char < curr_line->len) {