From dd840091839a0129152dcd2ba6260236e5543ded Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Fri, 26 Mar 2021 09:48:38 -0700 Subject: [PATCH] remove now-unneeded make-windows-installer.sh, re-embed vpnc-script-win.js, embed OpenVPN TAP-Windows installer Signed-off-by: Daniel Lenski --- .gitignore | 8 ++++++ Makefile.am | 28 +++++++++++++------ make-windows-installer.sh | 57 --------------------------------------- openconnect.nsi.in | 18 +++++++++++++ 4 files changed, 46 insertions(+), 65 deletions(-) delete mode 100755 make-windows-installer.sh diff --git a/.gitignore b/.gitignore index a5d3705e..be379a50 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,11 @@ Makefile 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 diff --git a/Makefile.am b/Makefile.am index e8f06a10..6a04d5e9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -254,7 +254,7 @@ if BUILD_NSIS # # 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 @@ -263,29 +263,41 @@ if BUILD_NSIS # 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 @@ -306,7 +318,7 @@ openconnect.nsi: version.c 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 diff --git a/make-windows-installer.sh b/make-windows-installer.sh deleted file mode 100755 index 34136a67..00000000 --- a/make-windows-installer.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/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 < 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 diff --git a/openconnect.nsi.in b/openconnect.nsi.in index 5935fe79..b791cfae 100644 --- a/openconnect.nsi.in +++ b/openconnect.nsi.in @@ -51,6 +51,24 @@ Section "OpenConnect" !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 -- 2.49.0