gnuboot/website/Makefile.am

283 lines
7.0 KiB
Makefile
Raw Permalink Normal View History

# Copyright (C) 2022-2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# 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/>.
Add a minimal GNU Boot manual. Currently GNU Boot has no manual, and it needs one to organize better the information it provides to users and/or contributors. Since we need to start somewhere, beside adding the manual license, we describe a bit what the GNU Boot project is, and also ask for help for completing the manual. The GFDL 1.3 comes from the gnulib source code at the commit d64d66cc4897d605f543257dcd038524a0a55215 ("autoupdate"). The beginning and the end of the document are also very similar to the GNU Hello manual from the commit 24225d705684322f482135e8a2d679485fce0811 ("maint: remove the obsolete gettext module") as they were copied and modified from that. The 'dircategory Kernel' was chosen to be the same than GRUB, so they both appear in the same group in the Emacs info reader ('info' command in Emacs). As for the "Overview" of GNU Boot it also contains background information that will be needed later on and that needs to be introduced right from the start: - If people reading the manual do not understand what a boot software is, all the rest will be too complicated to explain. - We also need to explain where GNU Boot is physically located on the computer from the start as we plan not to use the 'ROM' terminology as it's confusing: ROM means read-only-memory, and so there is no point of providing GNU Boot ROM images if the nonfree boot software can't be replaced. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien Bourmault <neox@gnu.org>
2024-11-24 18:10:47 +01:00
SENTINEL =
.PHONY: all build check help publish serve website.tar.gz
all: help
BUILD_OPTIONS :=
GUIX_SHARE_OPTIONS := --share=`realpath ../`
if WANT_UNTITLED_PATH
BUILD_OPTIONS += --with-untitled-path $(UNTITLED_PATH)
GUIX_SHARE_OPTIONS += --share=`realpath $(UNTITLED_PATH)`
endif
index.html: index.html.tmpl
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
GUIX_SHELL_CONTAINER = guix time-machine \
--commit=$(GUIX_REVISION) \
-- \
shell \
--system=i686-linux \
--container \
website: use Guix v1.4.0. While the website code is separate from the rest, the same rationale than in the commit ada459875cab33c7986726c1647b713f2a45af62 ("Use a released guix revision globally.") applies for using Guix 1.4.0 (having access to the Guix manual for the right Guix version, not needing to run guix pull in some cases). However if we do that we run into an issue where guix fails to find a substitute for pandoc for Guix 1.4.0 for i686-linux. This results in Guix bootstraping ghc and then building pandoc and its dependencies. The ghc bootstrap is extremely long (many hours / few days on a ThinkPad X200, and it takes more than one night inside a VM with 8 cores and 16 GiB of RAM that runs on a KGPE-D16). Not running the ghc tests also doesn't speed up the build enough to be practical. However while the pandoc substitutes are not available on ci.guix.gnu.org, they are available on bordeaux.guix.gnu.org which is also in the default substitute servers. So the workaround is to tell users to make sure to authorize bordeaux.guix.gnu.org and then to force its use if it is authorized. This still enable users to not use substitute (for security reasons) if they want to. To do the detection we use guix repl as the guix command is supposed to be available and it also has access to Guix's guile modules. In addition, running ./autogen.sh && ./configure && make check results in the following error without this commit: guix time-machine --commit= -- shell --system=i686-linux --container --network --emulate-fhs --share=`realpath ../` bash coreutils findutils git grep nss-certs pandoc sed -- ./build.sh guix time-machine: error: Git error: unable to parse OID - too short make: *** [Makefile:696: build] Error 1 This was broken by the commit 07e9cbd12c99e39d0bc0b8449423bd914bb92b10 ("website: properly handle the dot dependency."). However if we bisect it, we instead find that the commit f8874d77803426cc01305e7f895284dbe7caae00 ("website: remove history/git-history.jpg") broke 'make check'. This is because history/git-history.jpg is supposed to be generated but it was included in git in the commit 388c0ef3d09623dd10a4f44f8f610244c3337e4c ("website: add history page of the GNU Boot git repositories.") and so once we starts generating the file again, 'make check' breaks. So we modified the commit 388c0ef3d09623dd10a4f44f8f610244c3337e4c ("website: add history page of the GNU Boot git repositories.") to not add history/git-history.jpg to properly bisect it. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> neox: fixed typos in message and diff Acked-by: Adrien Bourmault <neox@gnu.org>
2024-11-23 17:04:07 +01:00
`guix repl force-bordeaux-substitute.scm force` \
$(SENTINEL)
if WANT_GUIX
DOT_CMD = $(GUIX_SHELL_CONTAINER) \
graphviz \
-- \
dot
else
DOT_CMD = dot
endif
history/git-history.jpg: history/git-history.dot
$(DOT_CMD) -T jpg history/git-history.dot > "$@"
# 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 \
> $@
site.cfg: site.cfg.tmpl
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
Add a minimal GNU Boot manual. Currently GNU Boot has no manual, and it needs one to organize better the information it provides to users and/or contributors. Since we need to start somewhere, beside adding the manual license, we describe a bit what the GNU Boot project is, and also ask for help for completing the manual. The GFDL 1.3 comes from the gnulib source code at the commit d64d66cc4897d605f543257dcd038524a0a55215 ("autoupdate"). The beginning and the end of the document are also very similar to the GNU Hello manual from the commit 24225d705684322f482135e8a2d679485fce0811 ("maint: remove the obsolete gettext module") as they were copied and modified from that. The 'dircategory Kernel' was chosen to be the same than GRUB, so they both appear in the same group in the Emacs info reader ('info' command in Emacs). As for the "Overview" of GNU Boot it also contains background information that will be needed later on and that needs to be introduced right from the start: - If people reading the manual do not understand what a boot software is, all the rest will be too complicated to explain. - We also need to explain where GNU Boot is physically located on the computer from the start as we plan not to use the 'ROM' terminology as it's confusing: ROM means read-only-memory, and so there is no point of providing GNU Boot ROM images if the nonfree boot software can't be replaced. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien Bourmault <neox@gnu.org>
2024-11-24 18:10:47 +01:00
if WANT_GUIX
# We can't use MAKEINFO as it's defined in configure.ac
MAKEINFO_CMD = $(GUIX_SHELL_CONTAINER) \
--expose=`realpath ../manual/` \
coreutils \
diffutils \
gcc-toolchain \
grep \
sed \
tar \
texinfo \
texlive-bin \
texlive-cm \
texlive-epsf \
texlive-kpathsea \
texlive-latex-base \
texlive-metafont \
texlive-tex-texinfo \
-- \
makeinfo
else
MAKEINFO_CMD = makeinfo
endif
../manual/version.texi: Makefile
@if git --no-pager name-rev --tags HEAD | awk '{print $$2}' | grep -q '^tags/' ; then \
printf '@set VERSION %s' \
`git describe --tag HEAD` > $@ ; \
else \
printf '@set VERSION %s' \
`git --no-pager show --no-patch HEAD --pretty="%h"` > $@ ; \
fi
# If we use GNUBOOT_MANUAL_DEPENDENCIES, autoreconf 2.71 will output the
# following warning:
# Makefile.am:115: warning: variable 'GNUBOOT_MANUAL_DEPENDENCIES' is
# defined but no program or
# Makefile.am:115: library has 'GNUBOOT_MANUAL' as canonical name (possible
# typo)
# Some other variable names are also reserved by automake such as
# *_SOURCES, so we used GNUBOOT_MANUAL_FILES to avoid conflicts or
# potentially unintended side effects.
GNUBOOT_MANUAL_FILES = \
../manual/fdl-1.3.texi \
../manual/gnuboot.texi \
../manual/images/SOIC-16.png \
../manual/version.texi \
Makefile \
$(SENTINEL)
pages/manual/gnuboot.%: $(GNUBOOT_MANUAL_FILES)
mkdir -p `dirname $@`
$(MAKEINFO_CMD) \
--$(subst pages/manual/gnuboot.,,$@) \
--no-split \
-o $@ \
../manual/gnuboot.texi
if WANT_GUIX
GM_CMD = $(GUIX_SHELL_CONTAINER) \
--expose=`realpath ../manual/` \
graphicsmagick \
-- \
gm
else
GM_CMD = gm
endif
pages/manual/images/SOIC-16.png: ../manual/SOIC-16.jpeg
mkdir -p `dirname $@`
$(GM_CMD) convert $< $@
# In the manual we include SOIC-16.png as @image{images/SOIC-16,
# [...]}. This was done to make it easier to later on package the
# manual in FHS distributions like Trisquel as the info manual ends up
# in /usr/share/info/ while its images are expected to go in
# /usr/share/info/images instead. But then the manual also
# needs to be able to find its images during the compilation.
../manual/images/SOIC-16.png: pages/manual/images/SOIC-16.png
mkdir -p `dirname $@`
install -m 644 $< $@
pages/manual/images/SOIC-16.jpeg: ../manual/SOIC-16.jpeg
mkdir -p `dirname $@`
install -m 644 $< $@
GNUBOOT_MANUAL = \
pages/manual/images/SOIC-16.jpeg \
pages/manual/images/SOIC-16.png \
pages/manual/gnuboot.html \
pages/manual/gnuboot.pdf \
$(SENTINEL)
if WANT_GUIX
BUILD_SH_CMD = $(GUIX_SHELL_CONTAINER) \
--network \
--emulate-fhs \
$(GUIX_SHARE_OPTIONS) \
bash \
coreutils \
findutils \
git \
grep \
nss-certs \
pandoc \
sed \
-- \
./build.sh
else
BUILD_SH_CMD = ./build.sh
endif
Add a minimal GNU Boot manual. Currently GNU Boot has no manual, and it needs one to organize better the information it provides to users and/or contributors. Since we need to start somewhere, beside adding the manual license, we describe a bit what the GNU Boot project is, and also ask for help for completing the manual. The GFDL 1.3 comes from the gnulib source code at the commit d64d66cc4897d605f543257dcd038524a0a55215 ("autoupdate"). The beginning and the end of the document are also very similar to the GNU Hello manual from the commit 24225d705684322f482135e8a2d679485fce0811 ("maint: remove the obsolete gettext module") as they were copied and modified from that. The 'dircategory Kernel' was chosen to be the same than GRUB, so they both appear in the same group in the Emacs info reader ('info' command in Emacs). As for the "Overview" of GNU Boot it also contains background information that will be needed later on and that needs to be introduced right from the start: - If people reading the manual do not understand what a boot software is, all the rest will be too complicated to explain. - We also need to explain where GNU Boot is physically located on the computer from the start as we plan not to use the 'ROM' terminology as it's confusing: ROM means read-only-memory, and so there is no point of providing GNU Boot ROM images if the nonfree boot software can't be replaced. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> Acked-by: Adrien Bourmault <neox@gnu.org>
2024-11-24 18:10:47 +01:00
build: site.cfg pages/footer.include $(GNUBOOT_MANUAL)
$(BUILD_SH_CMD) $(BUILD_OPTIONS)
if WANT_GUIX
CHECK_SH_CMD = $(GUIX_SHELL_CONTAINER) \
--network \
--emulate-fhs \
bash \
coreutils \
findutils \
grep \
gzip \
sed \
tar \
-- \
./check.sh
else
CHECK_SH_CMD = ./check.sh
endif
check: build website.tar.gz index.html history/git-history.jpg
rm -rf site/
mkdir -p site/$(WEBSITE_PREFIX)
tar xf website.tar.gz -C site/$(WEBSITE_PREFIX)
$(CHECK_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
--directory site
$(CHECK_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
--tarball website.tar.gz
help:
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \
"Available commands:" \
"help # Print this help" \
"build # Build the website" \
"serve # run lighttpd on localhost:$(LIGHTTPD_PORT)" \
"publish # Publish the website to https://gnu.org/$(WEBSITE_PREFIX)" \
"check # Run automatic tests" \
"website.tar.gz # Create a tarball of the website"
if WANT_GUIX
SERVE_SH_CMD = $(GUIX_SHELL_CONTAINER) \
--network \
--emulate-fhs \
bash \
coreutils \
gzip \
lighttpd \
sed \
tar \
-- \
./serve.sh
else
SERVE_SH_CMD = ./serve.sh
endif
if ! WANT_LIGHTTPD
serve:
@printf "%s %s\n" \
"The $@ target is disabled." \
"To enable it, run './configure --enable-lighttpd'."
@false
else
serve: website.tar.gz
$(SERVE_SH_CMD) --website-prefix $(WEBSITE_PREFIX) \
website.tar.gz $(LIGHTTPD_PORT)
endif
RSYNC_OPTIONS := -av --progress --delete
publish: website.tar.gz
rm -rf deploy
mkdir -p deploy
tar xf website.tar.gz -C deploy
rsync $(RSYNC_OPTIONS) \
deploy/ \
$(RSYNC_DESTINATION)/
website.tar.gz: build index.html history/git-history.jpg
tar \
--exclude-vcs \
--format=gnu \
--owner=0 --group=0 --numeric-owner \
--sort=name \
-czf \
website.tar.gz \
untitled/www/lbwww/site \
index.html \
history/git-history.dot \
history/git-history.jpg \
--transform="s#untitled/www/lbwww/site#web#" \
--transform="s#^history/#web/history/#"