diff options
| author | EuAndreh <eu@euandre.org> | 2026-09-03 09:19:35 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2026-09-03 09:19:35 -0300 |
| commit | 7c016c48b6356147c567a9222de45dd50dd8a405 (patch) | |
| tree | 9ca75538543556d9afd58910906f775be634b337 /mkdeps.sh | |
| parent | src/static.conf ($discussions_url_prefix): Fix typo in address (diff) | |
| download | euandre.org-7c016c48b6356147c567a9222de45dd50dd8a405.tar.gz euandre.org-7c016c48b6356147c567a9222de45dd50dd8a405.tar.xz | |
Diffstat (limited to '')
| -rwxr-xr-x | mkdeps.sh | 125 |
1 files changed, 98 insertions, 27 deletions
@@ -8,8 +8,17 @@ normalize() { xargs realpath --relative-to=. | sort } +## A language's front page is excluded: it is a listing now, and +## naming it here as well puts it in $(sources.adoc) twice. pages() { - find src/pages/*/*.adoc -type f | normalize + find src/pages/*/*.adoc -type f ! -name 'index.adoc' | normalize +} + +## The front page of each language, which lists what is newest +## across that language's collections rather than holding articles +## of its own. +homes() { + find src/pages/*/index.adoc -type f | normalize } articles() { @@ -17,7 +26,7 @@ articles() { } slides() { - find src/slides/*/*/ -type f -name '*.adoc' | normalize + find src/slides/*/*/ -type f -name '*.eslaides' | normalize } indexes() { @@ -29,11 +38,19 @@ categories() { } media() { - find src/content/ \( -type f -and \! -type l \) -and \( \ + # src/content/music is excluded: those .ogg files are score + # renderings, not published media, and the old site never + # offered them over BitTorrent. + find src/content/ -path 'src/content/music' -prune -or \ + \( \( -type f -and \! -type l \) -and \( \ -name '*.flac' -or \ -name '*.ogg' -or \ -name '*.webm' \ - \) + \) -print \) +} + +music() { + find src/content/music/*.ly | normalize } tarballs() { @@ -50,6 +67,29 @@ extras() { listings() { indexes categories + homes +} + +## Which pages are one another's translations. po4a already says +## so, set by set, so read it there rather than keep a second list +## that can quietly disagree with the first. +po4a_sets() { + awk ' + /^\[type: asciidoc\]/ { set = "" } + /^\[type: asciidoc\]/ || cont { + line = $0 + sub(/^\[type: asciidoc\][ \t]*/, "", line) + cont = (line ~ /\\$/) + sub(/[ \t]*\\$/, "", line) + n = split(line, f, /[ \t]+/) + for (i = 1; i <= n; i++) { + if (f[i] == "" || f[i] ~ /^add_/) continue + sub(/^[a-z]+:/, "", f[i]) + set = set (set == "" ? "" : " ") f[i] + } + if (!cont && set != "") { print set; set = "" } + } + ' po/po4a.cfg } files() { @@ -60,43 +100,41 @@ files() { pages | varlist 'pages.adoc' +homes | varlist 'homes.adoc' articles | varlist 'articles.adoc' -slides | varlist 'slides.adoc' +slides | varlist 'slides.eslaides' categories | varlist 'categories.adoc' indexes | varlist 'indexes.adoc' indexes | sed 's|/index\.adoc$|/feed.xml|' | varlist 'feeds.xml' -find src/content/img/ -name '*.svg' | varlist 'images.svg' +find src/content/img/ -name '*.svg' | sort | varlist 'images.svg' media | varlist 'sources.media' tarballs | varlist 'sources.tarballs' extras | varlist 'sources.extras' find po/*.po po/*.pot | varlist 'sources.po' +music | varlist 'music.ly' +find src/content/music/*.ogg | varlist 'music.ogg' +find src/content/music/*.ly.include | varlist 'music.include' +# lilypond emits the score alongside the MIDI, from one run. +music | sed 's/^\(.*\)\.ly$/\1.pdf:\t\1.midi/' -{ - files | sed 's/^\(.*\)\.adoc$/\1.html/' - files | sed 's/^\(.*\)\.adoc$/\1.snippets/' - slides | sed 's/^\(.*\)\.adoc$/\1.pdf/' - indexes | sed 's|^\(.*\)/index\.adoc$|\1/feed.xml|' - media | sed 's/^\(.*\)$/\1.torrent/' -} | sed 's/^\(.*\)$/\1.gz:\t\1/' -printf '\n' -files | sed 's/^\(.*\)\.adoc$/\1.htmlbody\t\1.snippets\t\1.conf:\t\1.adoc/' -files | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.conf\t\1.htmlbody/' +files | sed 's/^\(.*\)\.adoc$/\1.htmlbody\t\1.snippets\t\1.json:\t\1.adoc/' +files | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.json\t\1.htmlbody/' printf '\n' -files | sed 's/^\(.*\)\.adoc$/\1.updatedat-check:\t\1.conf/' +files | sed 's/^\(.*\)\.adoc$/\1.updatedat-check:\t\1.json/' files | sed 's/^\(.*\)\.adoc$/\1.links-internal-check:\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/' -articles | sed 's/^\(.*\)\.adoc$/\1.categorydata:\t\1.conf/' +articles | sed 's/^\(.*\)\.adoc$/\1.feedentry:\t\1.json\t\1.htmlbody/' +articles | sed 's/^\(.*\)\.adoc$/\1.sortdata:\t\1.json/' +articles | sed 's/^\(.*\)\.adoc$/\1.categorydata:\t\1.json/' printf '\n' -listings | sed 's/^\(.*\)\.adoc$/\1.htmlheader\t\1.htmlfooter:\t\1.conf/' -listings | sed 's/^\(.*\)\.adoc$/\1.htmllisting:\t\1.conf/' +listings | sed 's/^\(.*\)\.adoc$/\1.htmlheader\t\1.htmlfooter:\t\1.json/' +listings | sed 's/^\(.*\)\.adoc$/\1.htmllisting:\t\1.json/' listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmlheader\t\1.htmlfooter/' listings | sed 's/^\(.*\)\.adoc$/\1.html:\t\1.htmllisting\t\1.htmlbody/' printf '\n' @@ -104,8 +142,8 @@ printf '\n' media | sed 's/^\(.*\)$/\1.torrent:\t\1/' printf '\n' -slides | sed 's/^\(.*\)\.adoc$/\1.ps:\t\1.adoc/' -slides | sed 's/^\(.*\)\.adoc$/\1.pdf:\t\1.ps/' +slides | sed 's/^\(.*\)\.eslaides$/\1.ps:\t\1.eslaides/' +slides | sed 's/^\(.*\)\.eslaides$/\1.pdf:\t\1.ps/' printf '\n' @@ -120,11 +158,15 @@ collectionentries() { printf '\n\n' name="$(basename "$c")" art=articles."$lang" - find "$c"/*/ -type f -name '*.adoc' | varlist "$art.$name.adoc" + # A collection with no articles yet -- every non-English one -- + # has no YYYY/ directories for the glob to match. + find "$c"/*/ -type f -name '*.adoc' 2>/dev/null | + varlist "$art.$name.adoc" echo "$art.$name.sortdata = \$($art.$name.adoc:.adoc=.sortdata)" echo "$art.$name.indexentry = \$($art.$name.adoc:.adoc=.indexentry)" echo "$art.$name.feedentry = \$($art.$name.adoc:.adoc=.feedentry)" echo "$art.$name.categorydata = \$($art.$name.adoc:.adoc=.categorydata)" + echo "$art.$name.homeentry = \$($art.$name.adoc:.adoc=.homeentry)" printf '%s/sortdata.txt:\tdeps.mk\n' "$c" printf '\tprintf %s $(%s.%s.sortdata) > $@\n\n' "'%s\n'" "$art" "$name" @@ -154,8 +196,6 @@ collectionentries() { printf '%s/%s.htmllisting\t' "$c" "$plural" printf '%s/%s.xml:\t' "$c" "$plural" printf '%s/%s.txt\n' "$c" "$plural" - - printf '%s/%s.xml.gz:\t%s/%s.xml\n' "$c" "$plural" "$c" "$plural" } @@ -164,3 +204,34 @@ for langlink in src/collections/*; do collectionentries "$langlink" "$colllink" done done + +## A front page lists each collection, so it is rebuilt when any +## of that language's collections gains an entry. +printf '\n' +for langlink in src/collections/*; do + lang="$(basename "$langlink")" + deps= + for colllink in "$langlink"/*; do + [ -d "$colllink" ] || continue + name="$(basename "$colllink")" + deps="$deps src/content/$lang/$name/sortdata.txt" + deps="$deps \$(articles.$lang.$name.homeentry)" + done + [ -n "$deps" ] || continue + printf 'src/content/%s/index.htmllisting:%s\n\n' "$lang" "$deps" +done + + +## The map mkwb conf reads to link a page to its translations, +## written out here so it cannot drift from po4a.cfg. +printf '\ntranslations.map = src/translations.map\n\n' +printf 'src/translations.map: deps.mk\n' +printf '\tprintf %s \\\n' "'%s\\n'" +po4a_sets | sed "s/^/\t\t'/; s/\$/' \\\\/" +printf '\t\t> $@\n\n' + + +## The canonical rules, inlined so no include is needed +## at make time. +echo +mkwb rules |
