diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4c841f --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# autotools- and configure-generated +/aclocal.m4 +/Makefile.in +/Makefile +/*.cache/ +/configure +/config.* + +# should be added using autoreconf -i +/build-aux/install-sh +/build-aux/missing +/build-aux/mdate-sh +/build-aux/texinfo.tex + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..7911740 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,40 @@ +## Ulambda Makefile.am +# +# Copyright (C) 2018 Mike Gerwitz +# +# This file is part of Ulambda Scheme. +# +# Ulambda Scheme 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 . +## + +path_build_aux = $(top_srcdir)/build_aux +path_bootstrap = $(top_srcdir)/bootstrap + +.PHONY: bootstrap + +all: bootstrap + +# will force a reconfigure (for version data) if in the git repo +reconf: + test ! -d .git || ./autogen.sh + +bootstrap: +if HAS_NODEJS + cd "$(path_bootstrap)" && "$(NODEJS)" bootstrap.js +else + @echo "Node.js is required for command-line bootstrapping." + @echo "Alternatively, direct your web browser to" + @echo "bootstrap/bootstrap.html to bootstrap in-browser." + @exit 1 +endif diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..8ba5e6c --- /dev/null +++ b/autogen.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Generate configure script from repository +# +# Copyright (C) 2018 Mike Gerwitz +# +# This file is part of Ulambda Scheme. +# +# Ulambda Scheme 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 . +# +# This script is not necessary to configure GNU ease.js; it is provided for +# convenience. +## + +which autoreconf >/dev/null || { + echo "fatal: missing autoreconf" >&2 + exit 1 +} + +exec autoreconf -fvi diff --git a/bootstrap/Bootstrap.js b/bootstrap/Bootstrap.js index 2c23efd..b1d30bd 100644 --- a/bootstrap/Bootstrap.js +++ b/bootstrap/Bootstrap.js @@ -413,7 +413,9 @@ class Bootstrap * * @param {Error} e error * - * @return {boolean} false + * @throws {Error} e + * + * @return {undefined} */ _error( e ) { @@ -421,7 +423,7 @@ class Bootstrap this._logf( str, e ); - return false; + throw e; } diff --git a/bootstrap/bootstrap.js b/bootstrap/bootstrap.js index fbf4b8a..296eead 100644 --- a/bootstrap/bootstrap.js +++ b/bootstrap/bootstrap.js @@ -50,4 +50,7 @@ const getf = path => Promise.resolve( const strap = new Bootstrap( getf, logf, new Prebirth() ); -strap.bootstrap(); +// Attempt bootstrap. Error output is handled by Bootstrap, since the +// output must also work correctly in a browser environment. +strap.bootstrap() + .catch( _ => process.exit( 1 ) ); diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4690324 --- /dev/null +++ b/configure.ac @@ -0,0 +1,40 @@ +# For use by Autoconf +# +# Copyright (C) 2018 Mike Gerwitz +# +# This file is part of Ulambda Scheme +# +# Ulambda Scheme 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 . +## + +AC_INIT([easejs], [0.0.0-dev], [mtg@gnu.org]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([foreign]) + +# Node.js is required for command-line bootstrapping +AC_ARG_VAR([NODEJS], [The Node.js interpreter]) +AC_CHECK_PROGS(NODEJS, [node nodejs]) +AM_CONDITIONAL(HAS_NODEJS, [test "$NODEJS"]) + +# certain portions of the build process require that node be installed (in the +# future, we may be able to allow alternatives, such as SpiderMonkey) +test "$NODEJS" || AC_MSG_WARN([ + + Node.js is not installed; command-line bootstrapping will not be + available, but you may bootstrap using your web browser. +]) + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT