Skip to content

Commit

Permalink
Bundle tcllib with Windows installer
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Jan 18, 2025
1 parent bee4cf2 commit f972b06
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Build and test

on: [push, pull_request]

concurrency: ${{ github.workflow }}-${{ github.ref }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-ubuntu:
Expand Down Expand Up @@ -466,3 +468,5 @@ jobs:
nvc.exe -a test\regress\ieee1.vhd
nvc.exe -e ieee1
nvc.exe -r ieee1
'package require msgcat; package require yaml' | Set-Content -Path test.tcl
nvc.exe --do .\test.tcl
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
21 changes: 20 additions & 1 deletion contrib/msi/Makemodule.am
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
94 changes: 64 additions & 30 deletions contrib/msi/genlibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
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):
if not os.path.isdir(d):
raise Exception(f"Non-existent directory {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"<Directory Id=\"{ref}\" Name=\"{base}\">")
walk_dir(ref, f)
print("</Directory>")
else:
print(f"<Component Id=\"{ref}\" Win64=\"yes\" DiskId=\"1\"")
print(f" Guid=\"{uuid.uuid3(uuid.NAMESPACE_OID, ref)}\">")
print(f" <File Id=\"{ref}\" Name=\"{base}\"")
print(f" Source=\"{f}\" />")
print("</Component>")

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"):
Expand All @@ -28,12 +62,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)
Expand All @@ -42,29 +70,42 @@ def get_ref(prefix, d):
print(f" <File Id=\"{ref}\" Name=\"{base}\"")
print(f" Source=\"{d}\" />")
print("</Component>")
allrefs.append(ref)

print("</DirectoryRef>")

print("<DirectoryRef Id=\"TCL\">")

tcl = glob(wprefix + "\\lib\\tcl8.6\\*")
tcl.sort()
################################################################################
# TCL core libraries

print("<DirectoryRef Id=\"LIB\">")

print("<Directory Id=\"TCL\" Name=\"tcl8.6\">")
walk_dir("TCL", f"{wprefix}\\lib\\tcl8.6")
print("</Directory>")

print("<Directory Id=\"TCL8\" Name=\"tcl8\">")
walk_dir("TCL8", f"{wprefix}\\lib\\tcl8")
print("</Directory>")

print("</DirectoryRef>")

for t in tcl:
if os.path.isdir(t):
pass
else:
base = os.path.basename(t)
ref = get_ref("LIB_TCL", t)
print(f"<Component Id=\"{ref}\" Win64=\"yes\" DiskId=\"1\"")
print(f" Guid=\"{uuid.uuid3(uuid.NAMESPACE_OID, base)}\">")
print(f" <File Id=\"{ref}\" Name=\"{base}\"")
print(f" Source=\"{t}\" />")
print("</Component>")

################################################################################
# TclLib

print("<DirectoryRef Id=\"LIB\">")

print(f"<Directory Id=\"TCLLIB\" Name=\"tcllib1.21\">")
walk_dir("TCLLIB", f"{sys.argv[2]}\\lib\\tcllib1.21")
print("</Directory>")

print("</DirectoryRef>")


################################################################################
# Compiled VHDL libraries

libdirs = [
("LIB_NVC_NVC", "\\lib\\nvc\\nvc"),
("LIB_NVC_NVC.08", "\\lib\\nvc\\nvc.08"),
Expand All @@ -76,7 +117,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"<DirectoryRef Id=\"{prefix}\">")
Expand All @@ -102,16 +142,10 @@ def get_ref(prefix, d):
print("</DirectoryRef>")


print("<ComponentGroup Id=\"LIBS\">")

for d in dlls:
print(f"<ComponentRef Id=\"{get_ref('BIN', d)}\" />")
################################################################################
# Emit component groups

for t in tcl:
if os.path.isdir(t):
pass
else:
print(f"<ComponentRef Id=\"{get_ref('LIB_TCL', t)}\" />")
print("<ComponentGroup Id=\"LIBS\">")

for r in allrefs:
print(f"<ComponentRef Id=\"{r}\" />")
Expand Down
2 changes: 0 additions & 2 deletions contrib/msi/installer.wxs.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
</Component>
</Directory>
<Directory Id="LIB" Name="lib">
<Directory Id="TCL" Name="tcl8.6">
</Directory>
<Directory Id="LIB_NVC" Name="nvc">
<Component Win64="yes" Id="LIBNVCIMP.A" DiskId="1"
Guid="4AA37250-6FCE-4718-9C5A-F269A5AD62D0">
Expand Down
2 changes: 1 addition & 1 deletion src/cov/cov-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f972b06

Please sign in to comment.