Add generation of a few files in phase 1 that will help speed up phase 2
All checks were successful
the build was successful
All checks were successful
the build was successful
This commit is contained in:
parent
b5759da7a0
commit
d991f1bc43
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,8 @@ d_year.en.xml
|
||||
d_month.en.xml
|
||||
d_day.en.xml
|
||||
.default.xsl
|
||||
tools/.texts-??.xml
|
||||
.fundraising.??.xml
|
||||
.*.xmllist
|
||||
tags/tagged-*.en.xhtml
|
||||
news/*/.*.??.xml
|
||||
|
87
Makefile
87
Makefile
@ -1,9 +1,10 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Makefile for "premake" step
|
||||
# Makefile for FSFE website build, phase 1
|
||||
# -----------------------------------------------------------------------------
|
||||
# This Makefile creates some .xml and xhtml files which serve as source files
|
||||
# in the main build run. It is executed in the source directory, before the
|
||||
# Makefile for the main build run is constructed and executed.
|
||||
# This Makefile is executed in the root of the source directory tree, and
|
||||
# creates some .xml and xhtml files as well as some symlinks, all of which
|
||||
# serve as input files in phase 2. The whole phase 1 runs within the source
|
||||
# directory tree and does not touch the target directory tree at all.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
.PHONY: all .FORCE
|
||||
@ -50,15 +51,83 @@ d_month.en.xml: $(if $(findstring $(MONTH),$(shell cat d_month.en.xml)),,.FORCE)
|
||||
d_year.en.xml: $(if $(findstring $(YEAR),$(shell cat d_year.en.xml)),,.FORCE)
|
||||
printf %s\\n '$(YEAR)' >$@
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Create XML symlinks
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# After this step, the following symlinks will exist:
|
||||
# * tools/.texts-<lang>.xml for each language
|
||||
# * ./fundraising.<lang>.xml for each language
|
||||
# Each of these symlinks will point to the corresponding file without a dot at
|
||||
# the beginning of the filename, if present, and to the English version
|
||||
# otherwise. This symlinks make sure that phase 2 can easily use the right file
|
||||
# for each language, also as a prerequisite in the Makefile.
|
||||
|
||||
LANGUAGES := $(shell . build/languages.sh && get_languages)
|
||||
|
||||
TEXTS_LINKS := $(foreach lang,$(LANGUAGES),tools/.texts-$(lang).xml)
|
||||
|
||||
all: $(TEXTS_LINKS)
|
||||
tools/.texts-%.xml: .FORCE
|
||||
@if [ -f tools/texts-$*.xml ]; then \
|
||||
ln -sf texts-$*.xml $@; \
|
||||
else \
|
||||
ln -sf texts-en.xml $@; \
|
||||
fi
|
||||
|
||||
FUNDRAISING_LINKS := $(foreach lang,$(LANGUAGES),.fundraising.$(lang).xml)
|
||||
|
||||
all: $(FUNDRAISING_LINKS)
|
||||
.fundraising.%.xml: .FORCE
|
||||
@if [ -f fundraising.$*.xml ]; then \
|
||||
ln -sf fundraising.$*.xml $@; \
|
||||
else \
|
||||
ln -sf fundraising.en.xml $@; \
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Create XSL symlinks
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# After this step, each directory with source files for HTML pages contains a
|
||||
# symlink named .default.xsl and pointing to the default.xsl "responsible" for
|
||||
# this directory. These symlinks make it easier for the phase 2 Makefile to
|
||||
# determine which XSL script should be used to build a HTML page from a source
|
||||
# file.
|
||||
|
||||
# All directories containing source files for HTML pages.
|
||||
XHTML_DIRS := $(patsubst %/,%,$(sort $(dir $(shell find -name '*.??.xhtml'))))
|
||||
|
||||
.PHONY: default_xsl
|
||||
all: default_xsl
|
||||
default_xsl:
|
||||
@for directory in $(XHTML_DIRS); do \
|
||||
dir="$${directory}"; \
|
||||
prefix=""; \
|
||||
until [ -f "$${dir}/default.xsl" -o "$${dir}" = "." ]; do \
|
||||
dir="$${dir%/*}"; \
|
||||
prefix="$${prefix}../"; \
|
||||
done; \
|
||||
ln -sf "$${prefix}default.xsl" "$${directory}/.default.xsl"; \
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Generate XML filelists
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Generation of XML filelists is handled in an external script which generates
|
||||
# all .xmllist and the tags/tagged-*.en.xhtml files. These files cannot be
|
||||
# targets in this Makefile, because the list of tags is not known when the
|
||||
# Makefile starts - some new tags might be created when generating the .xml
|
||||
# files in the news/* subdirectories.
|
||||
# After this step, the following files will be up to date:
|
||||
# * tags/tagged-<tags>.en.xhtml for each tag used. Apart from being
|
||||
# automatically created, these are regular source files for HTML pages, and
|
||||
# in phase 2 are built into pages listing all news items and events for a
|
||||
# tag.
|
||||
# * <dir>/.<base>.xmllist for each <dir>/<base>.sources as well as for each
|
||||
# tags/tagged-<tags>.en.xhtml. These files are used in phase 2 to include the
|
||||
# correct XML files when generating the HTML pages. It is taken care that
|
||||
# these files are only updated whenever their content actually changes, so
|
||||
# they can serve as a prerequisite in the phase 2 Makefile.
|
||||
# This step is handled in an external script, because the list of files to
|
||||
# generate is not known when the Makefile starts - some new tags might be
|
||||
# introduced when generating the .xml files in the news/* subdirectories.
|
||||
|
||||
.PHONY: xmllists
|
||||
all: xmllists
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
# lazy-ass include guard
|
||||
inc_languages=true
|
||||
[ -z "$inc_filenames" ] && . "$basedir/build/filenames.sh"
|
||||
|
||||
languages(){
|
||||
cat <<EOL
|
||||
@ -42,5 +41,6 @@ EOL
|
||||
}
|
||||
|
||||
get_languages(){
|
||||
languages |cut -d\ -f1
|
||||
# The list of all languages in one line, separated by blanks
|
||||
echo `languages | cut -d\ -f1`
|
||||
}
|
||||
|
@ -2,18 +2,18 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update XML filelists (*.xmllist) and tag list pages (tags/tagged-*)
|
||||
# -----------------------------------------------------------------------------
|
||||
# From all <tag> content from all XML files, and from all .sources filelists,
|
||||
# this script creates or updates the following files:
|
||||
# This script is called from the phase 1 Makefile.
|
||||
#
|
||||
# */.<base>.xmllist - a list of all XML files matching the patterns in the
|
||||
# corresponding */<base>.sources list.
|
||||
# * tags/tagged-<tags>.en.xhtml for each tag used. Apart from being
|
||||
# automatically created, these are regular source files for HTML pages, and
|
||||
# in phase 2 are built into pages listing all news items and events for a
|
||||
# tag.
|
||||
#
|
||||
# tags/tagged-<tag>.en.xhtml - a source file which will be built by the
|
||||
# standard build process into a web page listing all news and events with
|
||||
# this tag.
|
||||
#
|
||||
# Each of these files is only touched when the actual content has changed,
|
||||
# so the build makefile can determine which web pages must be rebuilt.
|
||||
# * <dir>/.<base>.xmllist for each <dir>/<base>.sources as well as for each
|
||||
# tags/tagged-<tags>.en.xhtml. These files are used in phase 2 to include the
|
||||
# correct XML files when generating the HTML pages. It is taken care that
|
||||
# these files are only updated whenever their content actually changes, so
|
||||
# they can serve as a prerequisite in the phase 2 Makefile.
|
||||
#
|
||||
# Changing or removing tags in XML files is also considered, in which case a
|
||||
# file is removed from the .xmllist files.
|
||||
@ -52,8 +52,7 @@ for tag in `ls /tmp/tagmaps`; do
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update only those files where a change has happened (an XML file been added
|
||||
# or removed) so make can later see what has changed since the last build
|
||||
# Update only those files where a change has happened
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
for tag in `ls /tmp/tagmaps`; do
|
||||
@ -65,7 +64,7 @@ for tag in `ls /tmp/tagmaps`; do
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Remove the map files for tags which have been completely deleted
|
||||
# Remove the files for tags which have been completely deleted
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
for tag in `ls tags | sed -rn 's/tagged-(.*)\.en.xhtml/\1/p'`; do
|
||||
@ -83,7 +82,7 @@ done
|
||||
rm -rf /tmp/tagmaps
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update map files for .sources
|
||||
# Update .xmllist files for .sources
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
all_xml="`find * -name '*.xml' | sed -r 's;\...\.xml$;;' | sort -u`"
|
||||
|
@ -139,7 +139,7 @@ tree_maker(){
|
||||
shift 2
|
||||
|
||||
# List of languages in a single line, separated by blanks
|
||||
languages=$(echo $(get_languages))
|
||||
languages=$(get_languages)
|
||||
|
||||
cache_textsfile
|
||||
cache_fundraising
|
||||
|
Loading…
Reference in New Issue
Block a user