2024-08-26 14:25:26 +02:00
|
|
|
# Copyright (C) 2022-2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
2022-11-22 20:30:28 +01:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2024-05-19 13:12:53 +02:00
|
|
|
.PHONY: all build check help publish serve website.tar.gz
|
2022-11-22 20:30:28 +01:00
|
|
|
|
2024-05-19 13:25:36 +02:00
|
|
|
all: help
|
2022-11-22 20:48:57 +01:00
|
|
|
|
2023-03-22 03:04:30 +01:00
|
|
|
BUILD_OPTIONS :=
|
2023-11-08 03:40:27 +01:00
|
|
|
GUIX_SHARE_OPTIONS := --share=`realpath ../`
|
2023-04-01 12:38:02 +02:00
|
|
|
|
2023-04-03 02:47:23 +02:00
|
|
|
if WANT_UNTITLED_PATH
|
|
|
|
BUILD_OPTIONS += --with-untitled-path $(UNTITLED_PATH)
|
|
|
|
GUIX_SHARE_OPTIONS += --share=`realpath $(UNTITLED_PATH)`
|
|
|
|
endif
|
|
|
|
|
2024-06-03 21:16:01 +02:00
|
|
|
index.html: index.html.tmpl
|
|
|
|
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
|
|
|
|
|
2024-11-11 22:07:41 +01:00
|
|
|
if WANT_GUIX
|
2024-08-26 14:25:27 +02:00
|
|
|
history/git-history.jpg: history/git-history.dot
|
2024-11-11 22:07:41 +01:00
|
|
|
guix time-machine \
|
|
|
|
--commit=$(GUIX_REVISION) \
|
|
|
|
-- \
|
|
|
|
shell \
|
|
|
|
--system=i686-linux \
|
|
|
|
--container \
|
|
|
|
graphviz \
|
|
|
|
-- \
|
2024-08-26 14:25:27 +02:00
|
|
|
dot -T jpg history/git-history.dot > "$@"
|
2024-11-11 22:07:41 +01:00
|
|
|
else
|
|
|
|
history/git-history.jpg: history/git-history.dot
|
|
|
|
dot -T jpg history/git-history.dot > "$@"
|
|
|
|
endif
|
2024-08-26 14:25:27 +02:00
|
|
|
|
2024-09-06 18:15:39 +02:00
|
|
|
# We need force the regeneration of the page because if only the git
|
|
|
|
# commit changes, there is no way to know about it. In addition the
|
|
|
|
# full website is regenerated each time the build target is run, so
|
|
|
|
# generating one more page has insignificant performance impact.
|
|
|
|
.PHONY: pages/footer-git-commit.include
|
|
|
|
pages/footer-git-commit.include:
|
|
|
|
rm -f $@
|
|
|
|
|
|
|
|
printf "This page was generated with %s from the commit %s\n" \
|
|
|
|
"[Untitled](https://untitled.vimuser.org/)" \
|
|
|
|
"`git show --no-patch HEAD --pretty=\"%h\"`" \
|
|
|
|
>> $@
|
|
|
|
|
|
|
|
printf "(\"%s\").\n" \
|
|
|
|
"`git show --no-patch HEAD --pretty=\"%s\"`" \
|
|
|
|
>> $@
|
|
|
|
|
|
|
|
printf "\n" >> $@
|
|
|
|
|
|
|
|
pages/footer.include: pages/footer.include.tmpl pages/footer-git-commit.include
|
|
|
|
cat \
|
|
|
|
pages/footer.include.tmpl \
|
|
|
|
pages/footer-git-commit.include \
|
|
|
|
> $@
|
|
|
|
|
2024-06-03 21:16:01 +02:00
|
|
|
site.cfg: site.cfg.tmpl
|
|
|
|
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
|
|
|
|
|
2023-04-08 13:15:52 +02:00
|
|
|
if WANT_GUIX
|
2024-09-06 18:15:39 +02:00
|
|
|
build: site.cfg pages/footer.include
|
2023-03-16 17:03:09 +01:00
|
|
|
guix time-machine \
|
2023-12-07 04:33:36 +01:00
|
|
|
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
|
2023-03-16 17:03:09 +01:00
|
|
|
-- shell \
|
2022-11-22 20:30:28 +01:00
|
|
|
--container \
|
|
|
|
--network \
|
|
|
|
--emulate-fhs \
|
2023-04-01 12:38:02 +02:00
|
|
|
$(GUIX_SHARE_OPTIONS) \
|
2022-11-22 20:30:28 +01:00
|
|
|
bash \
|
|
|
|
coreutils \
|
|
|
|
findutils \
|
|
|
|
git \
|
|
|
|
grep \
|
|
|
|
nss-certs \
|
|
|
|
pandoc \
|
|
|
|
sed \
|
|
|
|
-- \
|
2023-03-22 03:04:30 +01:00
|
|
|
./build.sh $(BUILD_OPTIONS)
|
2023-04-08 13:15:52 +02:00
|
|
|
else
|
2024-09-06 18:15:39 +02:00
|
|
|
build: site.cfg pages/footer.include
|
2023-04-08 13:15:52 +02:00
|
|
|
./build.sh $(BUILD_OPTIONS)
|
|
|
|
endif
|
2022-11-22 20:48:57 +01:00
|
|
|
|
2023-04-08 13:15:52 +02:00
|
|
|
if WANT_GUIX
|
2024-08-26 14:25:27 +02:00
|
|
|
check: build website.tar.gz index.html history/git-history.jpg
|
2024-05-19 15:45:47 +02:00
|
|
|
rm -rf site/
|
2024-06-03 21:16:01 +02:00
|
|
|
mkdir -p site/$(WEBSITE_PREFIX)
|
|
|
|
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
2024-05-19 15:45:47 +02:00
|
|
|
|
2023-04-02 01:31:29 +02:00
|
|
|
guix shell \
|
|
|
|
--container \
|
|
|
|
--network \
|
|
|
|
--emulate-fhs \
|
|
|
|
bash \
|
|
|
|
coreutils \
|
2024-05-19 15:45:47 +02:00
|
|
|
findutils \
|
2023-04-02 01:31:29 +02:00
|
|
|
grep \
|
|
|
|
gzip \
|
2024-05-19 15:45:47 +02:00
|
|
|
sed \
|
2023-04-02 01:31:29 +02:00
|
|
|
tar \
|
|
|
|
-- \
|
2024-06-03 21:16:01 +02:00
|
|
|
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
|
|
|
--directory site && \
|
|
|
|
./check.sh --website-prefix $(WEBSITE_PREFIX) \
|
|
|
|
--tarball website.tar.gz
|
2023-04-08 13:15:52 +02:00
|
|
|
else
|
2024-08-26 14:25:27 +02:00
|
|
|
check: build website.tar.gz index.html history/git-history.jpg
|
2024-05-19 15:45:47 +02:00
|
|
|
rm -rf site/
|
2024-06-03 21:16:01 +02:00
|
|
|
mkdir -p site/$(WEBSITE_PREFIX)
|
|
|
|
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
|
|
|
|
./check.sh --website-prefix $(WEBSITE_PREFIX) --directory site
|
|
|
|
./check.sh --website-prefix $(WEBSITE_PREFIX) --tarball website.tar.gz
|
2023-04-08 13:15:52 +02:00
|
|
|
endif
|
2023-04-02 01:31:29 +02:00
|
|
|
|
2022-11-22 21:17:24 +01:00
|
|
|
help:
|
2024-05-19 13:12:53 +02:00
|
|
|
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
|
2022-11-22 21:17:24 +01:00
|
|
|
"Available commands:" \
|
|
|
|
"help # Print this help" \
|
2024-05-19 13:12:53 +02:00
|
|
|
"build # Build the website" \
|
|
|
|
"serve # run lighttpd on localhost:$(LIGHTTPD_PORT)" \
|
2024-06-03 21:16:01 +02:00
|
|
|
"publish # Publish the website to https://gnu.org/$(WEBSITE_PREFIX)" \
|
2023-04-02 01:31:29 +02:00
|
|
|
"check # Run automatic tests" \
|
2022-11-22 21:17:24 +01:00
|
|
|
"website.tar.gz # Create a tarball of the website"
|
|
|
|
|
2023-04-08 13:15:52 +02:00
|
|
|
if WANT_GUIX
|
2024-05-19 13:12:53 +02:00
|
|
|
serve: website.tar.gz
|
2022-11-23 01:39:34 +01:00
|
|
|
guix shell \
|
|
|
|
--container \
|
|
|
|
--network \
|
|
|
|
--emulate-fhs \
|
|
|
|
bash \
|
|
|
|
coreutils \
|
|
|
|
gzip \
|
|
|
|
lighttpd \
|
|
|
|
sed \
|
|
|
|
tar \
|
|
|
|
-- \
|
2024-06-03 21:16:01 +02:00
|
|
|
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
|
|
|
website.tar.gz $(LIGHTTPD_PORT)
|
2023-04-08 13:15:52 +02:00
|
|
|
else
|
2023-04-08 13:58:15 +02:00
|
|
|
if WANT_LIGHTTPD
|
2024-05-19 13:12:53 +02:00
|
|
|
serve: website.tar.gz
|
2024-06-03 21:16:01 +02:00
|
|
|
./serve.sh --website-prefix $(WEBSITE_PREFIX) \
|
|
|
|
website.tar.gz $(LIGHTTPD_PORT)
|
2023-04-08 13:58:15 +02:00
|
|
|
else
|
2024-05-19 13:12:53 +02:00
|
|
|
serve:
|
2023-04-08 13:58:15 +02:00
|
|
|
@printf "%s %s\n" \
|
|
|
|
"The test target is disabled." \
|
|
|
|
"To enable it, run './configure --enable-lighttpd'."
|
|
|
|
@false
|
|
|
|
endif
|
2023-04-08 13:15:52 +02:00
|
|
|
endif
|
2022-11-23 01:39:34 +01:00
|
|
|
|
2023-10-15 16:38:44 +02:00
|
|
|
# The rsync options are hardcoded here because some options are known
|
|
|
|
# not to work. For instance --delete results in rsync hanging. Also
|
|
|
|
# note that it's possible to rsync some files to gnu.org but not from
|
|
|
|
# gnu.org.
|
|
|
|
RSYNC_OPTIONS := -av --progress
|
2024-05-19 13:12:53 +02:00
|
|
|
publish: website.tar.gz
|
2023-10-15 16:38:44 +02:00
|
|
|
rm -rf deploy
|
|
|
|
mkdir -p deploy
|
|
|
|
tar xf website.tar.gz -C deploy
|
|
|
|
rsync $(RSYNC_OPTIONS) \
|
|
|
|
deploy/ \
|
|
|
|
$(RSYNC_DESTINATION)/
|
2022-11-22 21:17:24 +01:00
|
|
|
|
2024-08-26 14:25:27 +02:00
|
|
|
website.tar.gz: build index.html history/git-history.jpg
|
2022-11-22 20:48:57 +01:00
|
|
|
tar \
|
2022-11-23 01:39:34 +01:00
|
|
|
--exclude-vcs \
|
2022-11-22 20:48:57 +01:00
|
|
|
--format=gnu \
|
|
|
|
--owner=0 --group=0 --numeric-owner \
|
|
|
|
--sort=name \
|
|
|
|
-czf \
|
|
|
|
website.tar.gz \
|
2023-08-17 01:25:02 +02:00
|
|
|
untitled/www/lbwww/site \
|
|
|
|
index.html \
|
2024-08-26 14:25:27 +02:00
|
|
|
history/git-history.dot \
|
|
|
|
history/git-history.jpg \
|
|
|
|
--transform="s#untitled/www/lbwww/site#web#" \
|
|
|
|
--transform="s#^history/#web/history/#"
|