Makefile.am 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. SUBDIRS = tests
  2. # We kind of want openconnect to be built before we try to test it
  3. check-recursive: openconnect$(EXEEXT)
  4. # And even *building* some of tests/*.c needs libopenconnect
  5. install-recursive: libopenconnect.la
  6. all-recursive: libopenconnect.la
  7. if BUILD_WWW
  8. SUBDIRS += www
  9. endif
  10. if USE_NLS
  11. SUBDIRS += po
  12. endif
  13. if BUILD_NSIS
  14. noinst_DATA = openconnect-installer.exe
  15. endif
  16. lib_LTLIBRARIES = libopenconnect.la
  17. sbin_PROGRAMS = openconnect
  18. man8_MANS = openconnect.8
  19. noinst_PROGRAMS :=
  20. AM_CFLAGS = @WFLAGS@
  21. AM_CPPFLAGS = -DLOCALEDIR="\"$(localedir)\""
  22. openconnect_SOURCES = xml.c main.c
  23. openconnect_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) \
  24. $(LIBXML2_CFLAGS) $(JSON_CFLAGS) $(LIBPROXY_CFLAGS) \
  25. $(ZLIB_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBPSKC_CFLAGS) \
  26. $(GSSAPI_CFLAGS) $(INTL_CFLAGS) $(ICONV_CFLAGS) \
  27. $(LIBPCSCLITE_CFLAGS)
  28. openconnect_LDADD = libopenconnect.la $(SSL_LIBS) $(LIBXML2_LIBS) \
  29. $(LIBPROXY_LIBS) $(INTL_LIBS) $(ICONV_LIBS)
  30. if OPENCONNECT_WIN32
  31. openconnect_SOURCES += openconnect.rc
  32. endif
  33. library_srcs = ssl.c http.c textbuf.c http-auth.c auth-common.c \
  34. auth-html.c library.c compat.c lzs.c mainloop.c script.c \
  35. ntlm.c digest.c mtucalc.c openconnect-internal.h
  36. lib_srcs_cisco = auth.c cstp.c hpke.c multicert.c
  37. lib_srcs_juniper = oncp.c lzo.c auth-juniper.c
  38. lib_srcs_pulse = pulse.c
  39. lib_srcs_globalprotect = gpst.c win32-ipicmp.h auth-globalprotect.c
  40. lib_srcs_array = array.c
  41. lib_srcs_oath = oath.c
  42. lib_srcs_oidc = oidc.c
  43. lib_srcs_ppp = ppp.c ppp.h
  44. lib_srcs_nullppp = nullppp.c
  45. lib_srcs_f5 = f5.c
  46. lib_srcs_fortinet = fortinet.c
  47. lib_srcs_h3c = h3c.c
  48. lib_srcs_json = jsondump.c
  49. library_srcs += $(lib_srcs_juniper) $(lib_srcs_cisco) $(lib_srcs_oath) \
  50. $(lib_srcs_globalprotect) $(lib_srcs_pulse) \
  51. $(lib_srcs_oidc) $(lib_srcs_ppp) $(lib_srcs_nullppp) \
  52. $(lib_srcs_f5) $(lib_srcs_fortinet) $(lib_srcs_h3c) \
  53. $(lib_srcs_json) $(lib_srcs_array)
  54. lib_srcs_gnutls = gnutls.c gnutls_tpm.c gnutls_tpm2.c
  55. lib_srcs_openssl = openssl.c openssl-pkcs11.c
  56. lib_srcs_win32 = wintun.c tun-win32.c sspi.c
  57. lib_srcs_posix = tun.c
  58. lib_srcs_gssapi = gssapi.c
  59. lib_srcs_iconv = iconv.c
  60. lib_srcs_yubikey = yubikey.c
  61. lib_srcs_stoken = stoken.c
  62. lib_srcs_esp = esp.c esp-seqno.c
  63. lib_srcs_dtls = dtls.c
  64. lib_srcs_vhost = vhost.c
  65. POTFILES = $(openconnect_SOURCES) gnutls-esp.c gnutls-dtls.c openssl-esp.c openssl-dtls.c \
  66. $(lib_srcs_esp) $(lib_srcs_dtls) gnutls_tpm2_esys.c gnutls_tpm2_ibm.c \
  67. $(lib_srcs_openssl) $(lib_srcs_gnutls) $(library_srcs) \
  68. $(lib_srcs_win32) $(lib_srcs_posix) $(lib_srcs_gssapi) $(lib_srcs_iconv) \
  69. $(lib_srcs_yubikey) $(lib_srcs_stoken) $(lib_srcs_oidc) $(lib_srcs_vhost)
  70. if OPENCONNECT_VHOST
  71. library_srcs += $(lib_srcs_vhost)
  72. endif
  73. if OPENCONNECT_LIBPCSCLITE
  74. library_srcs += $(lib_srcs_yubikey)
  75. endif
  76. if OPENCONNECT_STOKEN
  77. library_srcs += $(lib_srcs_stoken)
  78. endif
  79. if OPENCONNECT_GSSAPI
  80. library_srcs += $(lib_srcs_gssapi)
  81. endif
  82. if OPENCONNECT_GNUTLS
  83. library_srcs += $(lib_srcs_gnutls)
  84. lib_srcs_esp += gnutls-esp.c
  85. lib_srcs_dtls += gnutls-dtls.c
  86. endif
  87. if OPENCONNECT_TSS2_ESYS
  88. library_srcs += gnutls_tpm2_esys.c
  89. endif
  90. if OPENCONNECT_TSS2_IBM
  91. library_srcs += gnutls_tpm2_ibm.c
  92. endif
  93. if OPENCONNECT_OPENSSL
  94. library_srcs += $(lib_srcs_openssl)
  95. lib_srcs_esp += openssl-esp.c
  96. lib_srcs_dtls += openssl-dtls.c
  97. endif
  98. if OPENCONNECT_DTLS
  99. lib_srcs_cisco += $(lib_srcs_dtls)
  100. endif
  101. if OPENCONNECT_ESP
  102. lib_srcs_juniper += $(lib_srcs_esp)
  103. endif
  104. if OPENCONNECT_ICONV
  105. library_srcs += $(lib_srcs_iconv)
  106. endif
  107. if BUILTIN_JSON
  108. library_srcs += json/json.c json/json.h
  109. endif
  110. if OPENCONNECT_WIN32
  111. library_srcs += $(lib_srcs_win32)
  112. .rc.o:
  113. $(WINDRES) $^ -o $@
  114. %.o : %.rc
  115. $(WINDRES) $^ -o $@
  116. else
  117. library_srcs += $(lib_srcs_posix)
  118. endif
  119. libopenconnect_la_SOURCES = version.c $(library_srcs)
  120. libopenconnect_la_CFLAGS = $(AM_CFLAGS) $(SSL_CFLAGS) $(DTLS_SSL_CFLAGS) \
  121. $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS) $(P11KIT_CFLAGS) \
  122. $(TSS_CFLAGS) $(LIBSTOKEN_CFLAGS) $(LIBPSKC_CFLAGS) $(GSSAPI_CFLAGS) \
  123. $(INTL_CFLAGS) $(ICONV_CFLAGS) $(LIBPCSCLITE_CFLAGS) $(LIBP11_CFLAGS) \
  124. $(LIBLZ4_CFLAGS) $(JSON_CFLAGS)
  125. libopenconnect_la_LIBADD = $(SSL_LIBS) $(DTLS_SSL_LIBS) \
  126. $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(P11KIT_LIBS) \
  127. $(TSS_LIBS) $(LIBSTOKEN_LIBS) $(LIBPSKC_LIBS) $(GSSAPI_LIBS) \
  128. $(INTL_LIBS) $(ICONV_LIBS) $(LIBPCSCLITE_LIBS) $(LIBP11_LIBS)\
  129. $(LIBLZ4_LIBS) ${JSON_LIBS}
  130. if OPENBSD_LIBTOOL
  131. # OpenBSD's libtool doesn't have -version-number, but its -version-info arg
  132. # does what GNU libtool's -version-number does. Which arguably is what the
  133. # GNU -version-info arg ought to do too. I hate libtool.
  134. LT_VER_ARG = -version-info
  135. else
  136. LT_VER_ARG = -version-number
  137. endif
  138. libopenconnect_la_LDFLAGS = $(LT_VER_ARG) @APIMAJOR@:@APIMINOR@ -no-undefined
  139. noinst_HEADERS = openconnect-internal.h openconnect.h gnutls.h lzo.h
  140. include_HEADERS = openconnect.h
  141. if HAVE_VSCRIPT
  142. libopenconnect_la_LDFLAGS += @VSCRIPT_LDFLAGS@,libopenconnect.map
  143. libopenconnect_la_DEPENDENCIES = libopenconnect.map
  144. endif
  145. if OPENCONNECT_JNI
  146. if JNI_STANDALONE
  147. libopenconnect_la_SOURCES += jni.c
  148. libopenconnect_la_CFLAGS += $(JNI_CFLAGS) -Wno-missing-declarations
  149. else
  150. lib_LTLIBRARIES += libopenconnect-wrapper.la
  151. libopenconnect_wrapper_la_SOURCES = jni.c
  152. libopenconnect_wrapper_la_CFLAGS = $(AM_CFLAGS) $(JNI_CFLAGS) -Wno-missing-declarations
  153. libopenconnect_wrapper_la_LIBADD = libopenconnect.la
  154. endif
  155. endif
  156. if OPENCONNECT_SYSTEM_KEYS
  157. noinst_PROGRAMS += list-system-keys
  158. list_system_keys_SOURCES = list-system-keys.c
  159. list_system_keys_CFLAGS = $(GNUTLS_CFLAGS)
  160. list_system_keys_LDADD = $(GNUTLS_LIBS)
  161. endif
  162. pkgconfig_DATA = openconnect.pc
  163. EXTRA_DIST = AUTHORS version.sh COPYING.LGPL openconnect.ico $(POTFILES) openconnect.nsi.in
  164. EXTRA_DIST += json/AUTHORS json/LICENSE json/json.c json/json.h
  165. EXTRA_DIST += $(shell cd "$(top_srcdir)" && \
  166. git ls-tree HEAD -r --name-only -- android/ java/ trojans/ bash/ 2>/dev/null)
  167. DISTCLEANFILES = $(pkgconfig_DATA) version.c
  168. pkglibexec_SCRIPTS = trojans/csd-post.sh trojans/csd-wrapper.sh trojans/tncc-wrapper.py \
  169. trojans/hipreport.sh trojans/hipreport-android.sh trojans/tncc-emulate.py
  170. bashcompletiondir = $(datadir)/bash-completion/completions
  171. bashcompletion_DATA = bash/openconnect
  172. # main.c includes version.c
  173. openconnect-main.$(OBJEXT): version.c
  174. version.c: $(library_srcs) $(lib_openssl_srcs) $(lib_gnutls_srcs) \
  175. $(openconnect_SOURCES) Makefile.am configure.ac \
  176. openconnect.h openconnect-internal.h version.sh @GITVERSIONDEPS@
  177. @cd $(srcdir) && ./version.sh $(abs_builddir)/version.c
  178. AUTHORS: @GITVERSIONDEPS@
  179. @git shortlog -sen > AUTHORS
  180. tmp-dist: uncommitted-check
  181. $(MAKE) $(AM_MAKEFLAGS) VERSION=$(patsubst v%,%,$(shell git describe --tags)) DISTHOOK=0 dist
  182. tmp-distdir: uncommitted-check
  183. $(MAKE) $(AM_MAKEFLAGS) VERSION=$(patsubst v%,%,$(shell git describe --tags)) DISTHOOK=0 distdir
  184. uncommitted-check:
  185. @if ! git update-index --refresh --unmerged || \
  186. ! git diff-index --name-only --exit-code HEAD; then \
  187. echo "*** ERROR: Uncommitted changes in above files"; exit 1; fi
  188. DISTHOOK=1
  189. dist-hook: uncommitted-check
  190. @if [ $(DISTHOOK) = 1 ]; then \
  191. if ! git rev-parse --verify v$(VERSION) &> /dev/null; then \
  192. echo "*** ERROR: Version v$(VERSION) is not tagged"; exit 1; fi ; \
  193. if ! git diff --name-only --exit-code v$(VERSION) HEAD > /dev/null; then \
  194. echo "*** ERROR: Git checkout not at version v$(VERSION)"; exit 1; fi ; \
  195. fi
  196. sign-dist: dist
  197. @for a in $(DIST_ARCHIVES); do \
  198. gpg --default-key 67E2F359 --detach-sign -a $$a ; \
  199. done
  200. tag: uncommitted-check
  201. @if git rev-parse --verify v$(VERSION) &> /dev/null; then \
  202. echo "*** ERROR: Version v$(VERSION) is already tagged"; exit 1; fi
  203. @sed 's/AC_INIT.*/AC_INIT([openconnect], [$(VERSION)])/' -i $(srcdir)/configure.ac
  204. @sed 's/^v=.*/v="v$(VERSION)"/' -i $(srcdir)/version.sh
  205. @( echo '1,/<!-- latest-release-start -->/p' ;\
  206. echo '/<!-- latest-release-end -->/,$$p' ;\
  207. echo '/<!-- latest-release-start -->/a\' ;\
  208. echo 'The latest release is <a href="https://www.infradead.org/openconnect/download/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a>\' ;\
  209. echo '<i>(<a href="https://www.infradead.org/openconnect/download/openconnect-$(VERSION).tar.gz.asc">PGP signature</a>)</i>,\' ;\
  210. echo 'released on $(shell date +%Y-%m-%d) with the following changelog:</p>\' ;\
  211. sed '0,/<b>OpenConnect HEAD/d;/<\/ul><br\/>/,$$d;s/$$/\\/' $(srcdir)/www/changelog.xml ;\
  212. echo ' </ul>' ) | \
  213. sed -n -f - -i $(srcdir)/www/download.xml
  214. @( echo "s/Last modified: .*/Last modified: $(shell date)/" ;\
  215. echo '/ <li><b>OpenConnect HEAD/a\' ;\
  216. echo ' <ul>\' ;\
  217. echo ' <li><i>No changelog entries yet</i></li>\';\
  218. echo ' </ul><br/>\' ; echo ' </li>\' ;\
  219. echo ' <li><b><a href="https://www.infradead.org/openconnect/download/openconnect-$(VERSION).tar.gz">OpenConnect v$(VERSION)</a></b>\' ;\
  220. echo ' <i>(<a href="https://www.infradead.org/openconnect/download/openconnect-$(VERSION).tar.gz.asc">PGP signature</a>)</i> &#8212; $(shell date +%Y-%m-%d)' ) | \
  221. sed -f - -i $(srcdir)/www/changelog.xml
  222. @echo '/API version [0-9]\+\.[0-9]\+:$$/s/:/ (v$(VERSION); $(shell date +%Y-%m-%d)):/' | \
  223. sed -f - -i $(srcdir)/openconnect.h
  224. # stupid syntax highlighting '
  225. @cd $(srcdir) && git commit -s -m "Tag version $(VERSION)" configure.ac version.sh www/download.xml www/changelog.xml openconnect.h
  226. @git tag v$(VERSION)
  227. @cd $(srcdir) && ./autogen.sh
  228. ###########################################################################
  229. #
  230. # Translations are handled in the NetworkManager-openconnect repository by
  231. # GNOME translation teams. We export all our translatable strings to a file
  232. # 'openconnect-strings.txt' which is included in their set of files to be
  233. # translated.
  234. #
  235. # We have an 'import-strings' make target which, for each translation, does
  236. # a merge of their file with ours and compares with a canonicalised version
  237. # of ours to see if there are any substantive changes. The strings from
  238. # NetworkManager-openconnect take precedence over ours, so if there are
  239. # any *corrections* to translations they need to be applied there first,
  240. # because changes in openconnect to a string which is already translated
  241. # in NetworkManager-openconnect will get overwritten on the next sync.
  242. #
  243. # Given that precedence, the 'export-strings' target is mostly only useful
  244. # when we add *new* strings which already have translations, which happens
  245. # occasionally when we change a non-translated part of a string (e.g. when
  246. # we recently replaced URLs and email addresses with '%s' and could do that
  247. # without 'losing' the existing translations by changing those too).
  248. #
  249. # A decent guess at where NetworkManager-openconnect might be checked out...
  250. NMO_DIR := $(srcdir)/../NetworkManager-openconnect
  251. NMO_POT := $(NMO_DIR)/po/NetworkManager-openconnect.pot
  252. NMO_STRINGS := $(NMO_DIR)/openconnect-strings.txt
  253. NMO_LINGUAS = $(wildcard $(NMO_DIR)/po/*.po)
  254. OC_LINGUAS = $(shell grep -v ^\# $(srcdir)/po/LINGUAS)
  255. # Generate the openconnect-strings.txt file in the NetworkManager-openconnect
  256. # repository, which 'injects' our strings there to be translated.
  257. $(NMO_STRINGS): po/$(PACKAGE).pot uncommitted-check
  258. $(srcdir)/export-strings.sh $@ $<
  259. .PHONY: $(NMO_POT)
  260. $(NMO_POT): $(NMO_STRINGS)
  261. make -C $(NMO_DIR)/po NetworkManager-openconnect.pot
  262. # Sync translations from our own po/ directory to NetworkManager-openconnect,
  263. # with theirs taking precedence. Use a strange path with extra 'po/..' to
  264. # avoid circular dependencies.
  265. $(NMO_DIR)/po/../po/%.po: $(srcdir)/po/%.po $(NMO_POT) po/$(PACKAGE).pot
  266. @msgattrib -F --no-fuzzy $< > $@.openconnect
  267. # Merge using local strings as additional compendium
  268. @msgmerge -q -N -F $@ -C $@.openconnect ${NMO_POT} > $@.merged
  269. # Dummy merge (cleanup) for comparison.
  270. @msgmerge -q -N -F $@ ${NMO_POT} > $@.unmerged
  271. # If the result is different, update the NM version.
  272. @if ! cmp $@.merged $@.unmerged; then \
  273. echo "New changes for NetworkManager-openconnect $(notdir $@)"; \
  274. mv $@.merged $@; \
  275. else \
  276. echo "No changes for NetworkManager-openconnect $(notdir $@)"; \
  277. fi
  278. @rm -f $@.openconnect $@.merged $@.unmerged
  279. # Sync translations from NetworkManager-openconnect, with theirs taking
  280. # precedence.
  281. $(srcdir)/po/../po/%.po: $(NMO_DIR)/po/%.po $(NMO_POT) po/$(PACKAGE).pot
  282. @msgattrib -F --no-fuzzy $< > $@.nmo
  283. # Merge NM against openconnect.pot, using local strings as additional compendium
  284. @msgmerge -q -N -C $@ -F $@.nmo po/$(PACKAGE).pot > $@.merged1
  285. # Remove fuzzy and obsolete translations
  286. @msgattrib -F --no-fuzzy --no-obsolete $@.merged1 > $@.merged2
  287. # Unmerged, clean up for simple comparison
  288. @msgmerge -q -N -F $@ po/$(PACKAGE).pot > $@.unmerged
  289. @if ! cmp $@.merged2 $@.unmerged; then \
  290. echo "New changes for $(notdir $@)"; \
  291. mv $@.merged2 $@; \
  292. else \
  293. echo "No changes for $(notdir $@)"; \
  294. fi
  295. @rm -f $@.nmo $@.merged1 $@.merged2 $@.unmerged
  296. # Import translated strings from NetworkManager-openconnect
  297. import-strings: $(patsubst $(NMO_DIR)/%,$(srcdir)/po/../%,$(NMO_LINGUAS))
  298. if ! git update-index -q --refresh --unmerged || \
  299. ! git diff-index --name-only --exit-code HEAD -- $(srcdir)/po/ >/dev/null; then \
  300. git commit -s -m "Import translations from GNOME" -- $(srcdir)/po/ ; \
  301. else \
  302. echo No changes to commit ; \
  303. fi
  304. # Export our translatable strings to NetworkManager-openconnect
  305. export-strings: $(patsubst $(NMO_DIR)/%,$(NMO_DIR)/po/../%,$(NMO_LINGUAS))
  306. # Just resync the translation comments to reflect accurate line numbers, etc.
  307. update-po: po/$(PACKAGE).pot
  308. @cd $(top_srcdir); if ! git diff-index --name-only --exit-code HEAD -- po/; then \
  309. echo "*** ERROR: Uncommitted changes in above files"; exit 1; \
  310. else \
  311. > po/LINGUAS; \
  312. for a in po/*.po; do \
  313. msgmerge -q -N -F $$a $(abs_builddir)/po/$(PACKAGE).pot > $$a.merge ; \
  314. msgattrib -F --no-fuzzy --no-obsolete $$a.merge > $$a ; \
  315. rm $$a.merge ; \
  316. if msgattrib --translated $$a | grep -q msgstr; then \
  317. echo $$a | sed 's%^po/\(.*\)\.po%\1%' >> po/LINGUAS ; \
  318. fi ; \
  319. done && \
  320. if ! git update-index -q --refresh --unmerged || \
  321. ! git diff-index --name-only --exit-code HEAD -- po/ >/dev/null; then \
  322. git commit -s -m "Resync translations with sources" -- po/ ; \
  323. else \
  324. echo No changes to commit ; \
  325. fi; \
  326. fi
  327. po/$(PACKAGE).pot: $(POTFILES) version.sh
  328. @echo "Regenerating $@" ; rm -f $@ && \
  329. xgettext --directory=$(top_srcdir) --from-code=UTF-8 \
  330. --sort-by-file --add-comments --keyword=_ --keyword=N_ \
  331. --package-name="@PACKAGE@" --package-version="@VERSION@" \
  332. --msgid-bugs-address=openconnect-devel@lists.infradead.org \
  333. -o $@ $(POTFILES)
  334. ACLOCAL_AMFLAGS = -I m4
  335. if BUILD_NSIS
  336. DISTCLEANFILES += .*.dll.d .*.exe.d file-list*.txt instfiles.nsh uninstfiles.nsh vpnc-script-win.js openconnect.nsi openconnect-installer.exe
  337. # Including openconnect-gui.exe and Qt bits (as a hack)
  338. #EXTRA_EXECUTABLES := openconnect-gui.exe qwindows.dll qwindowsvistastyle.dll
  339. #EXTRA_NSIS_FILES := $(OPENCONNECT_GUI_DIR)/nsis/qt.conf
  340. #EXTRA_DLLDIRS := $(OPENCONNECT_GUI_DIR)/bin $(libdir)/qt5/plugins/platforms $(libdir)/qt5/plugins/styles
  341. DLL_EXECUTABLES := openconnect$(EXEEXT) $(EXTRA_EXECUTABLES)
  342. if OPENCONNECT_WINTUN
  343. WINTUN_DLL = .libs/wintun.dll
  344. DISTCLEANFILES += $(WINTUN_DLL)
  345. DLL_EXECUTABLES += wintun.dll
  346. endif
  347. if OPENCONNECT_SYSTEM_KEYS
  348. DLL_EXECUTABLES += list-system-keys$(EXEEXT)
  349. endif
  350. # DLL dependencies are found recursively with make, with each .foo.dll.d being
  351. # generated automatically from foo.dll by a pattern rule. However, we don't
  352. # want the normal top-level Makefile doing that directly because it would try
  353. # to do so *every* time it's invoked, just because of the -include directives.
  354. # So we split it out to a *separate* Makefile.dlldeps to be invoked only when
  355. # we are actually building the NSIS installer.
  356. #
  357. # The 'file-list.txt' contains the full transitive list of executables and
  358. # DLLs to be included in the installer. It potentially needs to be rebuilt if
  359. # any of them change (as they may now link against a different set of DLLs),
  360. # and *that* much does need to be visible to this top-level Makefile, so
  361. # include them if they exist.
  362. -include $(patsubst %,.%.d,$(DLL_EXECUTABLES))
  363. export V AM_DEFAULT_VERBOSITY bindir libdir OBJDUMP DLL_EXECUTABLES EXTRA_DLLDIRS
  364. file-list.txt: Makefile.dlldeps openconnect$(EXEEXT) libopenconnect.la $(WINTUN_DLL)
  365. @$(MAKE) --no-print-directory -f $< $@
  366. # Wintun Layer 3 TUN driver for Windows 7 and newer
  367. # (see https://wintun.net)
  368. WINTUNDRIVER = wintun-0.13.zip
  369. WINTUNSHA256 = 34afe7d0de1fdb781af3defc0a75fd8c97daa756279b42dd6be6a1bd8ccdc7f0
  370. # OpenVPN TAP driver for Windows Vista/2003 and newer
  371. # (see https://community.openvpn.net/openvpn/wiki/GettingTapWindows)
  372. # XX: Newer releases exist, but are split between Win7+ and Win10+ versions.
  373. TAPDRIVER = tap-windows-9.21.2.exe
  374. TAPSHA256 = 645bee92ba4e9f32ddfdd9f8519dc1b9f9ff0b0a8e87e342f08d39da77e499a9
  375. $(TAPDRIVER):
  376. curl https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.exe -o $@
  377. # Validate file and also let make find it in VPATH
  378. file-list-$(TAPDRIVER).txt: $(TAPDRIVER)
  379. echo $(TAPSHA256) $< | sha256sum -c
  380. echo $< > $@
  381. $(WINTUNDRIVER):
  382. curl https://www.wintun.net/builds/$(WINTUNDRIVER) -o $@
  383. .libs/wintun.dll: $(WINTUNDRIVER)
  384. echo $(WINTUNSHA256) $< | sha256sum -c
  385. unzip -DD -o -j -d .libs $< wintun/bin/$(WINTUN_ARCH)/wintun.dll
  386. # Latest vpnc-script-win.js, annotated with a header documenting the
  387. # exact source revision.
  388. vpnc-script-win.js:
  389. curl 'https://gitlab.com/api/v4/projects/openconnect%2Fvpnc-scripts/repository/commits?path=vpnc-script-win.js&branch=master' | \
  390. jq -r '.[0] | "// This script matches the version found at " + (.web_url | sub("/commit/"; "/blob/")) + "/vpnc-script-win.js\n// Updated on " + .authored_date[:10] + " by " + .author_name + " <" + .author_email + "> (\"" + .title + "\")\n//"' > $@
  391. curl https://gitlab.com/openconnect/vpnc-scripts/raw/master/vpnc-script-win.js >> $@
  392. # Let make find the file in VPATH
  393. file-list-%.txt: %
  394. echo $< > $@
  395. file-list-extra.txt:
  396. $(AM_V_GEN) for f in $(EXTRA_NSIS_FILES); do echo "$${f}" ; done > $@
  397. # Rather than trying to get clever in NSIS and iterate over lists,
  398. # just emit raw snippets to be included separately in the install
  399. # and uninstall sections.
  400. instfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-$(TAPDRIVER).txt file-list-extra.txt
  401. $(AM_V_GEN) ( grep -hv "^$(libdir)/qt5/plugins" $^ | sed 's%\(.*\)%File "\1"%' ; \
  402. grep -h "^$(libdir)/qt5/plugins" $^ | sed 's%\(.*/qt5/plugins\)/\([^/]*\)/\([^/]*\)%SetOutPath "$$INSTDIR\\\\\2"\nFile "\1/\2/\3"%' ) > $@
  403. uninstfiles.nsh: file-list.txt file-list-vpnc-script-win.js.txt file-list-$(TAPDRIVER).txt file-list-extra.txt
  404. $(AM_V_GEN) ( grep -hv "^$(libdir)/qt5/plugins" $^ | sed 's%\(.*/\)\?\([^/]*\)%Delete /rebootok "$$INSTDIR\\\\\2"%' ; \
  405. grep -h "^$(libdir)/qt5/plugins" $^ | sed 's%.*/qt5/plugins/\([^/]*\)/\([^/]*\)%Delete /rebootok "$$INSTDIR\\\\\1\\\\\2"\nRMDir "$$INSTDIR\\\\\1"%' ) > $@
  406. # Theoretically makensis can define symbols with the -D command line
  407. # option and much of this could just be done that way, but I couldn't
  408. # get it to work and life's too short.
  409. openconnect.nsi: version.c
  410. $(AM_V_GEN) VERSION=$$(cut -f2 -d\" version.c); \
  411. PROD_VERSION=$$(echo "$$VERSION" | perl -ne 'm|v(\d+)\.(\d+)(?:\.git\.\|\-)?(\d+)?(?:-g.+\|.*)|; print "$$1.$$2." . ($$3 or "0") . ".0"'); \
  412. if egrep -q '^#define OPENCONNECT_GNUTLS' config.h; then \
  413. TLS_LIBRARY=GnuTLS; \
  414. elif egrep -q '^#define OPENCONNECT_OPENSSL' config.h; then \
  415. TLS_LIBRARY=OpenSSL; \
  416. else \
  417. TLS_LIBRARY="Unknown TLS library"; \
  418. fi; \
  419. ( echo "VIProductVersion \"$$PROD_VERSION\""; \
  420. echo "VIAddVersionKey ProductVersion \"$$VERSION\""; \
  421. echo "VIAddVersionKey Comments \"OpenConnect multi-protocol VPN client for Windows (command-line version, built with $$TLS_LIBRARY). For more information, visit https://www.infradead.org/openconnect/\""; \
  422. echo "!include $(srcdir)/openconnect.nsi.in" ) > $@
  423. AM_V_MAKENSIS = $(am__v_MAKENSIS_$(V))
  424. am__v_MAKENSIS_ = $(am__v_MAKENSIS_$(AM_DEFAULT_VERBOSITY))
  425. am__v_MAKENSIS_0 = @echo " MAKENSIS " $@;
  426. am__v_MAKENSIS_1 =
  427. openconnect-installer.exe: openconnect.nsi instfiles.nsh uninstfiles.nsh $(srcdir)/openconnect.nsi.in html-recursive
  428. $(AM_V_MAKENSIS) $(MAKENSIS) $<
  429. endif