libreboot-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lbwww-build][ v1 4/4] Convert to autotools to enable configuring th


From: Adrien Bourmault
Subject: Re: [lbwww-build][ v1 4/4] Convert to autotools to enable configuring the lbwww directory
Date: Wed, 22 Mar 2023 14:41:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2

Acked-by: Adrien 'neox' Bourmault <neox@a-lec.org>

Le 22/03/2023 à 13:09, Denis 'GNUtoo' Carikli a écrit :
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).

I don't know how autotools work very well, but I acknowledge the improvements it implicates.


Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
---
  .gitignore              | 11 +++++++++-
  Makefile => Makefile.am | 13 ++++++++++--
  README                  |  2 ++
  autogen.sh              | 17 +++++++++++++++
  configure.ac            | 46 +++++++++++++++++++++++++++++++++++++++++
  5 files changed, 86 insertions(+), 3 deletions(-)
  rename Makefile => Makefile.am (85%)
  create mode 100755 autogen.sh
  create mode 100644 configure.ac

diff --git a/.gitignore b/.gitignore
index 13ff559..68bc85b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
\ No newline at end of file
diff --git a/Makefile b/Makefile.am
similarity index 85%
rename from Makefile
rename to Makefile.am
index 8e2ccc4..48da047 100644
--- a/Makefile
+++ b/Makefile.am
@@ -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" \
diff --git a/README b/README
index 78fcaf0..37b9cfb 100644
--- a/README
+++ b/README
@@ -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
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..9bc3b0b
--- /dev/null
+++ b/autogen.sh
@@ -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 "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..953fd69
--- /dev/null
+++ b/configure.ac
@@ -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"])])


Attachment: OpenPGP_0xAAD6B069819E6979.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]