From ba689997defb7be6c912934fe81d97465603415e Mon Sep 17 00:00:00 2001 From: Nick White Date: Wed, 3 Nov 2021 13:23:35 +0000 Subject: Update windows build config and add a basic guide to get it working --- BUILDING | 21 +++++++++++++++++++++ Makefile | 3 +-- config.mk | 8 ++++---- 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 BUILDING diff --git a/BUILDING b/BUILDING new file mode 100644 index 0000000..95019d9 --- /dev/null +++ b/BUILDING @@ -0,0 +1,21 @@ +To cross compile for Windows, the following needs to be done: + +1) Uncomment the lines under "mingw" in config.mk, and comment any earlier CC & LDFLAGS lines. + +2) Compile a copy of openssl for mingw. + Download OpenSSL from openssl.org, then run: + ./Configure mingw --cross-compile-prefix=i686-w64-mingw32- + make + +3) Set the OPENSSLDIR variable in config.mk to match where you compiled openssl + +4: Set up tcl Starkit prerequisites: + Download tclkit from http://tclkits.rkeene.org/fossil/wiki/Downloads + Download sdx from https://chiselapp.com/user/aspect/repository/sdx/index + Create a shell script called sdx and put it in your path, containing something like this: + #!/bin/sh + d="$HOME/src/getxbook" + "$d/tclkit-8.6.3-rhel5-x86_64" "$d/sdx-20110317.kit" "$@" + Download a windows tclkit including tk from http://tclkits.rkeene.org/fossil/wiki/Downloads and ensure the adjust W32TCLKIT to the appropriate filename in config.mk if needed + +Then 'make' and 'make dist-win' should all work as expected diff --git a/Makefile b/Makefile index b697fd2..90d1241 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ getxbookgui.exe: getxbookgui.tcl dist-win: $(BIN) $(GUI:.tcl=.exe) mkdir -p $(NAME)-win/tools cp $(GUI:.tcl=.exe) $(NAME)-win - for f in $(BIN); do cp $$f $(NAME)-win/tools/$$f.exe; done + for f in $(BIN); do cp $$f.exe $(NAME)-win/tools/$$f.exe; done mkdir -p $(NAME)-win/icons cp icons/* $(NAME)-win/icons/ for f in LEGAL README COPYING; do \ @@ -110,7 +110,6 @@ dist-win: $(BIN) $(GUI:.tcl=.exe) groff -m man -T utf8 < $$f | col -bx | sed 's/$$/\r/g' > $(NAME)-win/tools/$$b.txt; done mv $(NAME)-win/tools/getxbookgui.txt $(NAME)-win/ cd $(NAME)-win; zip -r ../$(NAME)-$(VERSION)-win.zip .;cd .. - gpg -b < $(NAME)-$(VERSION)-win.zip > $(NAME)-$(VERSION)-win.zip.sig rm -rf $(NAME)-win echo $(NAME)-$(VERSION)-win.zip $(NAME)-$(VERSION)-win.zip.sig diff --git a/config.mk b/config.mk index f763235..e9505e9 100644 --- a/config.mk +++ b/config.mk @@ -11,8 +11,6 @@ LIBS = -lssl -lcrypto CFLAGS = -std=c99 -pedantic -Wall -Wextra -Werror -g -D_POSIX_C_SOURCE=200112L \ -DVERSION=\"$(VERSION)\" -W32TCLKIT = tclkit-8.5.9-win32.upx.exe - # glibc dynamic CC = cc LDFLAGS = $(LIBS) @@ -22,9 +20,11 @@ LDFLAGS = $(LIBS) #LDFLAGS = $(LIBS) -static #-s # mingw +#W32TCLKIT = tclkit-gui-8_6_11-twapi-4_5_2-x86-max.exe +#OPENSSLDIR = $(HOME)/tmp/openssl-1.1.1l #CC = i686-w64-mingw32-gcc #AR = i686-w64-mingw32-ar -#CFLAGS = -ansi -Wall -DVERSION=\"$(VERSION)\" -DWINVER=0x0501 -#LDFLAGS = $(LIBS) -lws2_32 +#CFLAGS = -ansi -Wall -DVERSION=\"$(VERSION)\" -DWINVER=0x0501 -I$(OPENSSLDIR)/include +#LDFLAGS = -L$(OPENSSLDIR) $(LIBS) -lws2_32 -static LD = $(CC) -- cgit v1.2.3