]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix handling of downloaded files
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 29 Mar 2021 16:09:32 +0000 (17:09 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 29 Mar 2021 21:49:34 +0000 (22:49 +0100)
We want the MinGW package builds to have the downloads provided in advance
as part of the source RPM, instead of requiring network access and fetching
them once for each of the win32 and win64 builds.

So let make find the file in its VPATH and then use the full pathname that
it puts into $< for the recipe. And use that recipe to validate the hash
of the file too.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Makefile.am

index 38a1fc4623c9a988da8e8a88a8f3b3b1c402b8e5..fa28828f589e4d2ea3ef4a225c4874685e7e7dab 100644 (file)
@@ -278,27 +278,36 @@ if BUILD_NSIS
 
 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:
+TAPDRIVER = tap-windows-9.21.2.exe
+TAPSHA256 = 645bee92ba4e9f32ddfdd9f8519dc1b9f9ff0b0a8e87e342f08d39da77e499a9
+
+$(TAPDRIVER):
        curl https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.exe -o $@
-       echo "db9d441c209fb28b7c07286a74fe000738304dac $@" | sha1sum -c
+
+# Validate file and also let make find it in VPATH
+file-list-$(TAPDRIVER).txt: $(TAPDRIVER)
+       echo $(TAPSHA256) $< | sha256sum -c
+       echo $< > $@
 
 # Latest vpnc-script-win.js
 vpnc-script-win.js:
        curl https://gitlab.com/openconnect/vpnc-scripts/raw/master/vpnc-script-win.js -o $@
 
+# Let make find the file in VPATH
+file-list-%.txt: %
+       echo $< > $@
+
 # 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: file-list.txt
-       sed 's%\(.*\)%File "\1"%' $< | tee $@
+instfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-tap-windows-9.21.2.exe.txt
+       sed 's%\(.*\)%File "\1"%' $^ | tee $@
 
-uninstfiles.nsh: file-list.txt
-       sed 's%.*/\(.*\)%Delete /rebootok "$$INSTDIR\\\\\1"%' $< > $@
+uninstfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-tap-windows-9.21.2.exe.txt
+       sed 's%.*/\(.*\)%Delete /rebootok "$$INSTDIR\\\\\1"%' $^ > $@
 
 # Theoretically makensis can define symbols with the -D command line
 # option and much of this could just be done that way, but I couldn't