Convert to autotools to enable configuring the lbwww directory

Using autotools has several advantages against trying to add such a
feature to the Makefile:
- we don't need to always pass an extra option to make, so once
  configured there is less to type
- we also check for dependencies along the way
- the trade-off between easy to use and code simplicity looks better
  than with plain Makefile: with a single option we can easily make
  the Makefile use --share and --with-lbwww-path conditionally. Doing
  that with a plain Makefile would probably be way more complex, or
  would require code duplication (to only use --share and
  --with-lbwww-path when an option is passed to the Makefile), or
  would require to pass raw build.sh options (which would complicate
  usage).

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@a-lec.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-03-22 03:04:30 +01:00
parent 0259444361
commit 3e9180a277
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
5 changed files with 86 additions and 3 deletions

11
.gitignore vendored
View File

@ -1,4 +1,13 @@
/autom4te.cache/
/untitled/
/aclocal.m4
/config.log
/config.status
/configure
/id_oauth2_bearer
/install-sh
/lighttpd.conf
/website.tar.gz
/Makefile
/Makefile.in
/missing
/website.tar.gz

View File

@ -1,4 +1,4 @@
# Copyright (C) 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
# Copyright (C) 2022-2023 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
@ -18,6 +18,14 @@ DOMAIN := libreboot.at
all: website.tar.gz
if WANT_LBWWW_PATH
BUILD_OPTIONS := --with-lbwww-path $(LBWWW_PATH)
GUIX_SHARE_LBWWW_OPTION := --share=`realpath $(LBWWW_PATH)`
else
BUILD_OPTIONS :=
GUIX_SHARE_LBWWW_OPTION :=
endif
build:
guix time-machine \
--commit=07f19ef04b5a8f4d7a12a8940333e67db8da81c0 \
@ -25,6 +33,7 @@ build:
--container \
--network \
--emulate-fhs \
$(GUIX_SHARE_LBWWW_OPTION) \
bash \
coreutils \
findutils \
@ -34,7 +43,7 @@ build:
pandoc \
sed \
-- \
./build.sh
./build.sh $(BUILD_OPTIONS)
help:
@printf "%s\n\t%s\n\t%s\n\t%s\n\t%s\n" \

2
README
View File

@ -20,6 +20,8 @@ does not exist." message).
[1]https://srht.site/quickstart
== Dependencies ==
* autoconf
* automake
* coreutils
* curl: for uploading the website to sourcehut
* guix

17
autogen.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# Copyright (C) 2023 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/>.
autoreconf -vfi "$@"

46
configure.ac Normal file
View File

@ -0,0 +1,46 @@
# Copyright (C) 2023 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/>.
AC_INIT([lbwww-build],[0.1],[GNUtoo@cyberdimension.org])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_FILES([Makefile])
AC_SUBST([LBWWW_PATH], [])
AC_SUBST([LBWWW_GIT_FOUND], [])
# Check dependencies
AC_CHECK_PROG([CAT], [cat], [cat])
AC_CHECK_PROG([CP], [cp], [cp])
AC_CHECK_PROG([CURL], [curl], [curl])
AC_CHECK_PROG([GUIX], [guix], [guix])
AC_CHECK_PROG([PRINTF], [printf], [printf])
AC_CHECK_PROG([REALPATH], [realpath], [realpath])
AC_CHECK_PROG([TAR], [tar], [tar])
AC_ARG_WITH([lbwww-path],
[AS_HELP_STRING([--with-lbwww-path=PATH],
[Use a local lbwww directory from PATH instead of downloading
the latest version from https://git.sr.ht/~libreboot/lbwww])],
[LBWWW_PATH=$withval],
[])
AM_CONDITIONAL( [WANT_LBWWW_PATH], [test x"$LBWWW_PATH" != x""])
AC_OUTPUT
AS_IF([test x"$LBWWW_PATH" != x""],
[AS_ECHO(["Configuration options:"])
AS_ECHO([])
AS_ECHO([" LBWWW_PATH: $LBWWW_PATH"])])