Skip to content

Commit

Permalink
use windres for win-wsl build metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed Oct 11, 2024
1 parent 7af7a28 commit 960a617
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
36 changes: 36 additions & 0 deletions build/stamp-exe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

# this script is needed to inscribe metadata in the .exe files
# targeting windows. it creates a .rs to be used when linking

cat << EOF > cjit.rc
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Dyne.org Foundation"
VALUE "FileDescription", "CJIT, Just in Time C"
VALUE "FileVersion", "`date +'%Y%m%d'`"
VALUE "InternalName", "cjit"
VALUE "LegalCopyright", "Copyright by the Dyne.org Foundation"
VALUE "OriginalFilename", "cjit.exe"
VALUE "ProductName", "CJIT"
VALUE "ProductVersion", "3"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END
EOF

if [ "$(which windres)" = "" ]; then
x86_64-w64-mingw32-windres cjit.rc -O coff -o cjit.res
else
windres cjit.rc -O coff -o cjit.res
fi
3 changes: 2 additions & 1 deletion build/win-wsl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ldflags += -static-libgcc
all: deps cjit.exe

cjit.exe: ${SOURCES}
$(cc) $(cflags) -o $@ $(SOURCES) ${ldflags} ${ldadd}
./build/stamp-exe.sh
$(cc) $(cflags) -o $@ $(SOURCES) cjit.res ${ldflags} ${ldadd}

# upx-ucl -q $@
# somehow upx compression helps the binary to function: it
Expand Down

0 comments on commit 960a617

Please sign in to comment.