summaryrefslogtreecommitdiffstats
path: root/source.mk
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2021-01-07 17:24:08 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2021-01-07 17:24:08 (EST)
commit2a2f1745ace9c33b22831ce67d96416cd229864d (patch)
tree1e5d8f8065e9593bc9972c1ac126cdefa530f3a6 /source.mk
Initial commit
Diffstat (limited to 'source.mk')
-rw-r--r--source.mk37
1 files changed, 37 insertions, 0 deletions
diff --git a/source.mk b/source.mk
new file mode 100644
index 0000000..da0904c
--- /dev/null
+++ b/source.mk
@@ -0,0 +1,37 @@
+z = gz
+keys = \
+ '3AB0 57B7 E78D 945C 8C55 91FB D36F 769B C118 04F0'
+
+upstream_sf_base = https://downloads.sourceforge.net/project/$(OPK_SOURCE)
+upstream_path = $(OPK_SOURCE)/v$(OPK_SOURCE_VERSION_UPSTREAM)
+upstream_archive = $(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).tar.$(z)
+upstream_url = $(upstream_sf_base)/$(upstream_path)/$(upstream_archive)
+source_archive = ../$(OPK_SOURCE)-$(OPK_SOURCE_VERSION_UPSTREAM).orig.tar.$(z)
+
+GNUPGHOME = gnupghome
+# TODO: When GnuPG is built with TLS support, delete the second "keyserver" line
+# to switch to a non-SKS keyserver. We can't switch yet, because the Web server
+# at keys.openpgp.org redirects (HTTP 301) to HTTPS (and enforces it with HSTS).
+keyserver = hkps://keys.openpgp.org
+keyserver = hkp://pool.sks-keyservers.net
+keyring = ../keyring.gpg
+cleanup = gpgconf --kill all; rm -Rf '$(GNUPGHOME)'; sleep 5
+
+$(keyring):
+ gpg --recv-keys $(keys) || { rm -Rf '$@'; exit 1; }
+ rm -f '$@~'
+
+$(source_archive): $(keyring)
+ wget -c '$(upstream_url)' '$(upstream_url).asc'
+ gpg --verify '$(upstream_archive).asc'
+ mv '$(upstream_archive)' '$(source_archive)'
+
+source:
+ install -m 0700 -d '$(GNUPGHOME)'
+ umask 0177; printf 'keyserver $(keyserver)\n' \
+ 1>'$(GNUPGHOME)/dirmngr.conf'
+ umask 0177; printf 'no-default-keyring\nkeyring $(keyring)\nverbose\n' \
+ 1>'$(GNUPGHOME)/gpg.conf'
+ GNUPGHOME='$(GNUPGHOME)' $(MAKE) -f ../source.mk '$(source_archive)' \
+ || { $(cleanup); exit 1; }
+ $(cleanup)