From 46222bba365f4ea2e23bab295ede7abb13cdfb1e Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 5 Apr 2025 14:52:38 -0300 Subject: Makefile: Update to match Makefile in euandre.org --- .gitignore | 3 ++ Makefile | 72 ++++++++++++++++++++++++++++++++++++++++++------ deps.mk | 21 ++++++++++++++ meta.json | 1 + mkdeps.sh | 4 +++ src/base.conf | 13 --------- src/content/favicon.ico | Bin 0 -> 265206 bytes src/static.conf | 10 +++++++ 8 files changed, 103 insertions(+), 21 deletions(-) delete mode 100644 src/base.conf create mode 100644 src/content/favicon.ico create mode 100644 src/static.conf diff --git a/.gitignore b/.gitignore index 036d4c0..0eb5b70 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.embedded-config *.conf *.snippets +*.links +*.caslinks *.html *.html.*.txt *.indexentry @@ -21,6 +23,7 @@ feed.xml /install.txt /email.txt /baseurl.txt +/fingerprint.txt /expiry.txt /src/content/security.txt /src/content/.well-known/security.txt diff --git a/Makefile b/Makefile index 95e9b4e..e6227ce 100644 --- a/Makefile +++ b/Makefile @@ -19,12 +19,13 @@ EXEC = ./ ## Where to store the installation. Empty by default. DESTDIR = LDLIBS = +PUBURL = public.asc .SUFFIXES: .SUFFIXES: .adoc .conf .snippets .indexentry .feedentry .sortdata .xml -.SUFFIXES: .htmlbody .htmlheader .htmlfooter .htmllisting .html +.SUFFIXES: .htmlbody .htmlheader .htmlfooter .htmllisting .html .links .caslinks .SUFFIXES: .gz .adoc.conf: @@ -57,6 +58,14 @@ LDLIBS = .conf.sortdata: mkwb sortdata $< > $@ +.adoc.links: + mkwb links $< > $@ + +.links.caslinks: + grep -v '^link:' $< | xargs -I_ sh -c '\ + printf "%s\n" "_" | sha256sum | \ + printf "%s\t%s\n" "`cut -d" " -f1`" "_"' > $@ + all: @@ -69,6 +78,8 @@ sources.html = $(sources.adoc:.adoc=.html) sources.snippets = $(sources.adoc:.adoc=.snippets) sources.snippets.gz = $(sources.adoc:.adoc=.snippets.gz) sources.conf = $(sources.adoc:.adoc=.conf) +sources.links = $(sources.adoc:.adoc=.links) +sources.caslinks = $(sources.adoc:.adoc=.caslinks) articles.indexentry = $(articles.adoc:.adoc=.indexentry) articles.feedentry = $(articles.adoc:.adoc=.feedentry) articles.sortdata = $(articles.adoc:.adoc=.sortdata) @@ -79,8 +90,11 @@ listings.html = $(listings.adoc:.adoc=.html) sources = \ $(sources.adoc) \ + $(sources.extras) \ $(images.svg) \ + src/content/favicon.ico \ src/content/style.css \ + src/content/$(PUBURL) \ dynamic-contents = \ $(sources.html) \ @@ -89,14 +103,18 @@ dynamic-contents = \ static-contents = \ $(sources.extras) \ $(images.svg) \ + src/content/favicon.ico \ src/content/style.css \ + src/content/$(PUBURL) \ src/content/.well-known/security.txt \ dynamic-contents.gz = $(dynamic-contents:=.gz) static-contents.gz = \ $(images.svg:=.gz) \ + src/content/favicon.ico.gz \ src/content/style.css.gz \ + src/content/$(PUBURL).gz \ src/content/.well-known/security.txt.gz \ contents.gz = \ @@ -124,7 +142,11 @@ derived-assets = \ $(sources.htmlbody) \ $(sources.snippets) \ $(sources.snippets.gz) \ + $(sources.links) \ + $(sources.caslinks) \ $(sources.conf) \ + src/dyn.conf \ + src/base.conf \ src/global.conf \ $(listings.htmlheader) \ $(listings.htmlfooter) \ @@ -134,6 +156,7 @@ derived-assets = \ $(articles.sortdata) \ email.txt \ baseurl.txt \ + fingerprint.txt \ expiry.txt \ src/content/security.txt \ src/content/security.txt.gz \ @@ -159,13 +182,23 @@ side-assets = \ ## Default target. Builds all artifacts required for testing ## and installation. all: $(derived-assets) -all: src/content/public.asc +all: src/content/$(PUBURL) src/content/favicon.ico $(derived-assets): Makefile deps.mk $(sources.conf): src/global.conf src/headers.txt +src/dyn.conf: email.txt baseurl.txt fingerprint.txt + printf "export url_pre='%s'\n" "`cat baseurl.txt`" > $@ + printf "export email='%s'\n" "`cat email.txt`" >> $@ + printf "export publickey='%s'\n" "`cat fingerprint.txt`" >> $@ + printf "export publickey_url='$(PUBURL)'\n" >> $@ + printf 'export sourcecode_url="$$url_pre/git/$(NAME)"\n' >> $@ + +src/base.conf: src/dyn.conf src/static.conf + cat src/dyn.conf src/static.conf > $@ + src/global.conf: src/base.conf mkwb conf -G src/base.conf > $@ @@ -177,24 +210,34 @@ $(feeds.xml): $(contents.gz): gzip -9fk $* - touch $@ + touch $@ $(sources.snippets.gz): if [ -s $* ]; then gzip -9fk `cat $*`; fi sed 's/$$/.gz/' $* > $@ -src/content/public.asc: +src/content/$(PUBURL).gz: src/content/$(PUBURL) +src/content/$(PUBURL): gpg --export --armour "`jq -r '.email' < meta.json`" > $@ +src/content/favicon.ico.gz: src/content/favicon.ico +src/content/favicon.ico: src/content/img/favicon.svg + convert src/content/img/favicon.svg $@ + email.txt: meta.json jq -r '.email' < meta.json > $@ baseurl.txt: meta.json jq -r '.baseurl' < meta.json > $@ -expiry.txt: src/content/public.asc +fingerprint.txt: src/content/$(PUBURL) + gpg --always-trust --no-keyring --show-key --with-colons \ + src/content/$(PUBURL) | \ + awk -F: '/^pub:/ { print $$5 }' > $@ + +expiry.txt: src/content/$(PUBURL) gpg --always-trust --no-keyring --show-key --with-colons \ - src/content/public.asc | \ + src/content/$(PUBURL) | \ awk -F: '/^pub:/ { print $$7 }' | \ xargs -I% date -Is -d@% > $@ @@ -208,7 +251,7 @@ src/content/.well-known/security.txt: email.txt baseurl.txt expiry.txt mkdir -p $(@D) printf 'Contact: mailto:%s\n' "`cat email.txt`" > $@ printf 'Expires: %s\n' "`cat expiry.txt`" >> $@ - printf 'Encryption: %s/public.asc\n' "`cat baseurl.txt`" >> $@ + printf 'Encryption: %s/$(PUBURL)\n' "`cat baseurl.txt`" >> $@ printf 'Preferred-Languages: en, pt, fr, eo, es\n' >> $@ src/sources.txt: @@ -230,7 +273,20 @@ sources.txt install.txt: -check-unit: +.SUFFIXES: .links-check-internal +sources.links-check-internal = $(sources.adoc:.adoc=.links-check-internal) +$(sources.links-check-internal): $(sources.html) + grep '^link:' $*.links | cut -d: -f2- | xargs -tI% test -e $(*D)/% + +check-internal: $(sources.links-check-internal) + + +check-external: + + +check-links: check-internal check-external + +check-unit: check-links integration-tests = \ diff --git a/deps.mk b/deps.mk index 6c75183..79df563 100644 --- a/deps.mk +++ b/deps.mk @@ -80,6 +80,27 @@ src/content/incidents/index.snippets.gz: src/content/incidents/index.snippets src/content/blog/feed.xml.gz: src/content/blog/feed.xml src/content/incidents/feed.xml.gz: src/content/incidents/feed.xml +src/content/about.links-check-internal: src/content/about.links +src/content/index.links-check-internal: src/content/index.links +src/content/pricing.links-check-internal: src/content/pricing.links +src/content/privacy.links-check-internal: src/content/privacy.links +src/content/terms.links-check-internal: src/content/terms.links +src/content/blog/1970/01/01/launch.links-check-internal: src/content/blog/1970/01/01/launch.links +src/content/blog/2000/01/01/feature-ann.links-check-internal: src/content/blog/2000/01/01/feature-ann.links +src/content/incidents/2000/01/01/service-start.links-check-internal: src/content/incidents/2000/01/01/service-start.links +src/content/blog/index.links-check-internal: src/content/blog/index.links +src/content/incidents/index.links-check-internal: src/content/incidents/index.links +src/content/about.caslinks: src/content/about.links +src/content/index.caslinks: src/content/index.links +src/content/pricing.caslinks: src/content/pricing.links +src/content/privacy.caslinks: src/content/privacy.links +src/content/terms.caslinks: src/content/terms.links +src/content/blog/1970/01/01/launch.caslinks: src/content/blog/1970/01/01/launch.links +src/content/blog/2000/01/01/feature-ann.caslinks: src/content/blog/2000/01/01/feature-ann.links +src/content/incidents/2000/01/01/service-start.caslinks: src/content/incidents/2000/01/01/service-start.links +src/content/blog/index.caslinks: src/content/blog/index.links +src/content/incidents/index.caslinks: src/content/incidents/index.links + src/content/blog/1970/01/01/launch.feedentry: src/content/blog/1970/01/01/launch.conf src/content/blog/1970/01/01/launch.htmlbody src/content/blog/2000/01/01/feature-ann.feedentry: src/content/blog/2000/01/01/feature-ann.conf src/content/blog/2000/01/01/feature-ann.htmlbody src/content/incidents/2000/01/01/service-start.feedentry: src/content/incidents/2000/01/01/service-start.conf src/content/incidents/2000/01/01/service-start.htmlbody diff --git a/meta.json b/meta.json index 4899103..7a1638f 100644 --- a/meta.json +++ b/meta.json @@ -1,4 +1,5 @@ { + "description": "Landing page for Papo website (papo.im).", "baseurl": "https://papo.im", "email": "support@papo.im" } diff --git a/mkdeps.sh b/mkdeps.sh index e9141f9..9ede4ff 100755 --- a/mkdeps.sh +++ b/mkdeps.sh @@ -53,6 +53,10 @@ files | sed 's/^\(.*\)\.adoc$/\1.snippets.gz:\t\1.snippets/' listings | sed 's|^\(.*\)/index\.adoc$|\1/feed.xml.gz:\t\1/feed.xml|' printf '\n' +files | sed 's/^\(.*\)\.adoc$/\1.links-check-internal:\t\1.links/' +files | sed 's/^\(.*\)\.adoc$/\1.caslinks:\t\1.links/' +printf '\n' + articles | sed 's/^\(.*\)\.adoc$/\1.feedentry:\t\1.conf\t\1.htmlbody/' articles | sed 's/^\(.*\)\.adoc$/\1.sortdata:\t\1.conf/' printf '\n' diff --git a/src/base.conf b/src/base.conf deleted file mode 100644 index 22358f0..0000000 --- a/src/base.conf +++ /dev/null @@ -1,13 +0,0 @@ -export root_dir=src/content -export header_links=src/headers.txt -export url_pre='https://papo.im' -export email='info@papo.im' -export list_addr='~euandreh/papoim@lists.sr.ht' -export discussions_url_prefix='https://lists.sr.ht/~euandreh/papoim?search=' -export sourcecode_url='https://papo.im/git/papo.im' -export sourcecode_url_prefix="$sourcecode_url/tree" -export author='papo.im' -export site_name='Papo' -export feed_title='Articles from papo.im' -export feed_url='atom.xml' -export feed_alternate_url='./blog/' diff --git a/src/content/favicon.ico b/src/content/favicon.ico new file mode 100644 index 0000000..27e23c2 Binary files /dev/null and b/src/content/favicon.ico differ diff --git a/src/static.conf b/src/static.conf new file mode 100644 index 0000000..f2ec25f --- /dev/null +++ b/src/static.conf @@ -0,0 +1,10 @@ +export root_dir=src/content +export header_links=src/headers.txt +export list_addr='~euandreh/papoim@lists.sr.ht' +export discussions_url_prefix='https://lists.sr.ht/~euandreh/papoim?search=' +export sourcecode_url_prefix="$sourcecode_url/tree" +export author='papo.im' +export site_name='Papo' +export feed_title='Articles from papo.im' +export feed_url='atom.xml' +export feed_alternate_url='./blog/' -- cgit v1.2.3