test-driver
tests/*.log
tests/*.trs
+
+# Leftovers from constructing the Windows installer
+file-list.txt
+*.nsi
+*.nsh
+/openconnect-installer*.exe
+/tap-windows*.exe
+/vpnc-script-win.js
#
# The Makefile snippet in each generated file adds the full DLL
# pathname to $(DLLS), adds the .d file itself to the dependencies of
-# dll-list.txt, and then includes more .d files for each other DLL
+# file-list.txt, and then includes more .d files for each other DLL
# that this DLL links to.
#
# Because we use -include, we just skip any DLLs we can't find, which
# The result, after manually -including the top-level .openconnect.exe.d,
# is that we have a full transitive list of required non-system DLLs
# in the $(DLLS) variable. Which will contain duplicates, hence the
-# use of $(sort) when writing it out to dll-list.txt.
+# use of $(sort) when writing it out to file-list.txt.
.%.d: .libs/% Makefile
( echo "DLLS += $<" ; \
- echo "dll-list.txt: $@" ; \
+ echo "file-list.txt: $@" ; \
mingw-objdump -p "$<" | sed -n '/DLL Name:/{s%^.*DLL Name: %-include .%;s/$$/.d/;p}' | tr A-Z a-z ) > $@
.%.d: $(bindir)/% Makefile
( echo "DLLS += $<" ; \
- echo "dll-list.txt: $@" ; \
+ echo "file-list.txt: $@" ; \
mingw-objdump -p "$<" | sed -n '/DLL Name:/{s%^.*DLL Name: %-include .%;s/$$/.d/;p}' | tr A-Z a-z ) > $@
-include .openconnect.exe.d
-dll-list.txt: Makefile
+file-list.txt: Makefile tap-windows-9.21.2.exe vpnc-script-win.js
for dll in $(sort $(DLLS)); do echo "$${dll}"; done > $@
+ echo "$$PWD/tap-windows-9.21.2.exe" >> $@
+ echo "$$PWD/vpnc-script-win.js" >> $@
+
+# OpenVPN TAP driver for Windows Vista/2003 and newer
+# (see https://community.openvpn.net/openvpn/wiki/GettingTapWindows)
+tap-windows-9.21.2.exe:
+ curl https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.exe -o $@
+ echo "db9d441c209fb28b7c07286a74fe000738304dac $@" | sha1sum -c
+
+# Latest vpnc-script-win.js
+vpnc-script-win.js:
+ curl https://gitlab.com/openconnect/vpnc-scripts/raw/master/vpnc-script-win.js -o $@
# Rather than trying to get clever in NSIS and iterate over lists,
# just emit raw snippets to be included separately in the install
# and uninstall sections.
-instfiles.nsh: dll-list.txt
+instfiles.nsh: file-list.txt
sed 's%\(.*\)%File "\1"%' $< | tee $@
-uninstfiles.nsh: dll-list.txt
+uninstfiles.nsh: file-list.txt
sed 's%.*/\(.*\)%Delete /rebootok "$$INSTDIR\\\\\1"%' $< > $@
# Theoretically makensis can define symbols with the -D command line
echo "VIAddVersionKey Comments \"OpenConnect multi-protocol VPN client for Windows (command-line version, built with $$TLS_LIBRARY). For more information, visit http://www.infradead.org/openconnect/\""; \
echo "!include $(srcdir)/openconnect.nsi.in" ) > $@
-openconnect-installer.exe: openconnect.nsi instfiles.nsh uninstfiles.nsh $(srcdir)/openconnect.nsi.in openconnect$(EXEEXT) libopenconnect.la html-recursive
+openconnect-installer.exe: openconnect.nsi instfiles.nsh uninstfiles.nsh $(srcdir)/openconnect.nsi.in openconnect$(EXEEXT) libopenconnect.la html-recursive tap-windows-9.21.2.exe vpnc-script-win.js
$(MAKENSIS) $<
endif
+++ /dev/null
-#!/bin/bash
-#
-# Copyright (C) 2021 Daniel Lenski
-#
-# This builds a Windows installer for OpenConnect using the Fedora nsiswrapper
-# program from https://fedoraproject.org/wiki/MinGW, which in turn depends on
-# NSIS (https://nsis.sourceforge.io).
-#
-# This script should be run *after* successfully cross-building openconnect.exe
-# and libopenconnect-5.dll.
-
-set -e
-
-SYSROOT=/usr/i686-w64-mingw32/sys-root
-
-# only X.Y.Z.W is allowed for the installer's "product version" property
-VERSION=$(cut -f2 -d\" version.c)
-PROD_VERSION=$(echo "$VERSION" | perl -ne 'm|v(\d+)\.(\d+)(?:\-(\d+)-g.+)|; print "$1.$2." . ($3 or "0") . ".0"')
-
-if egrep -q '^#define OPENCONNECT_GNUTLS' config.h; then
- TLS_LIBRARY=GnuTLS
-elif egrep -q '^#define OPENCONNECT_OPENSSL' config.h; then
- TLS_LIBRARY=OpenSSL
-else
- TLS_LIBRARY="Unknown TLS library"
-fi
-
-mkdir nsis
-cd nsis
-
-# build HTML documentation
-make -C ../www update
-ln -s ../public docs
-
-# download latest vpnc-script-win.js
-curl "https://gitlab.com/openconnect/vpnc-scripts/raw/master/vpnc-script-win.js" > vpnc-script-win.js
-
-# add symlinks to OpenConnect .exe/.dll, and all DLLs installed by package manager
-# (so that nsiswrapper can find them)
-ln -s ../.libs/openconnect.exe ../.libs/libopenconnect-5.dll $SYSROOT/mingw/{bin,lib}/*.dll .
-
-# build openconnect.nsi (input to makensis)
-PATH="$PATH:." nsiswrapper --name OpenConnect --outfile openconnect-installer.exe \
- openconnect.exe docs vpnc-script-win.js > openconnect.nsi.in
-
-# add version information
-cat <<EOF > openconnect.nsi
-SetCompressor /FINAL lzma
-VIAddVersionKey ProductName "OpenConnect"
-VIProductVersion "$PROD_VERSION"
-VIAddVersionKey ProductVersion "$VERSION"
-VIAddVersionKey Comments "OpenConnect multi-protocol VPN client for Windows (command-line version, built with $TLS_LIBRARY). For more information, visit https://openconnect.gitlab.io/openconnect"
-EOF
-
-# build installer
-cat openconnect.nsi.in >> openconnect.nsi
-makensis openconnect.nsi
!include instfiles.nsh
SectionEnd
+Section -prerequisites
+ SectionIn RO
+
+ MessageBox MB_OK \
+ "OpenConnect uses the TAP-Windows driver from OpenVPN to create virtual Ethernet adapters for \
+ VPN connections. If you haven't already installed this driver, you should now install v9.21.2, \
+ which works on Windows 2003, Windows Vista, or newer. \
+ More information on this driver, and available versions, can be found at \
+ https://community.openvpn.net/openvpn/wiki/GettingTapWindows"
+
+ MessageBox MB_YESNO "Install TAP-Windows driver v9.21.2?" /SD IDYES IDNO endTapWindows
+ DetailPrint "Running TAP-Windows driver setup..."
+ ExecWait "$INSTDIR\tap-windows-9.21.2.exe"
+ DetailPrint "Finished TAP-Windows driver setup"
+ Delete /rebootok "$INSTDIR\tap-windows-9.21.2.exe"
+ endTapWindows:
+SectionEnd
+
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\OpenConnect"
CreateShortCut "$SMPROGRAMS\OpenConnect\Uninstall OpenConnect.lnk" "$INSTDIR\Uninstall OpenConnect.exe" "" "$INSTDIR\Uninstall OpenConnect.exe" 0