From c92e9790001a1a8a6d4964bbd13ef2557e72cb79 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 28 Aug 2017 12:58:38 -0400 Subject: [PATCH] Add bin/server to invoke server using configure'd node * .gitignore (bin/server): Ignore generated file. * bin/server.in: Add script. * configure.ac: (NODE): Correct description (capitalize `Node'). (NODE_FLAGS): Add arg var. (NODE_DESTRUCTURE): Use determined node path for test. (AUTOGENERATED): Add substitution. (AC_CONFIG_FILES): Add bin/server. Make it executable. --- .gitignore | 1 + bin/server.in | 32 ++++++++++++++++++++++++++++++++ configure.ac | 17 +++++++++++++---- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 bin/server.in diff --git a/.gitignore b/.gitignore index 89c1bde..b7e2a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ configure Makefile.in # generated by configure +bin/server src/version.js /config.* Makefile diff --git a/bin/server.in b/bin/server.in new file mode 100644 index 0000000..9ecc856 --- /dev/null +++ b/bin/server.in @@ -0,0 +1,32 @@ +#!/bin/sh +# Start Liza Server using Node.js executable determined at configure-time +# +# Copyright (C) 2017 R-T Specialty, LLC. +# +# This file is part of liza. +# +# 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 . +# +# In addition to the configure-time NODE_FLAGS, the NODE_FLAGS environment +# variable can be used to add additional arguments to this script. +# WARNING: NODE_FLAGS arguments provided via environment varialbes are _not_ +# escaped, so be mindful of word expansion! +# +# @AUTOGENERATED@ +## + +cd "$( dirname $( readlink -f "$0" ) )" + +"@NODE@" @NODE_FLAGS@ $NODE_FLAGS server.js "$@" + diff --git a/configure.ac b/configure.ac index cc58591..40164e6 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,8 @@ AC_SUBST(MINOR, m4_argn(2, ver_split)) AC_SUBST(REV, m4_argn(3, ver_split)) AC_SUBST(SUFFIX, m4_argn(4, ver_split)) -AC_ARG_VAR([NODE], [The node.js interpreter]) +AC_ARG_VAR([NODE], [The Node.js interpreter]) +AC_ARG_VAR([NODE_FLAGS], [Arguments to Node.js for Liza Server (bin/server)]) AC_CHECK_PROGS(NODE, [node nodejs]) test -n "$NODE" || AC_MSG_ERROR([missing Node.js]) @@ -43,12 +44,15 @@ AC_CHECK_PROGS(TWOPI, [twopi]) AM_CONDITIONAL(HAS_TWOPI, [test "$TWOPI"]) # only needed for older versions of Node -AC_MSG_CHECKING([node --harmony_destructuring]) -AS_IF([node --harmony_destructuring >/dev/null 2>/dev/null], +AC_MSG_CHECKING([$NODE --harmony_destructuring]) +AS_IF(["$NODE" --harmony_destructuring >/dev/null 2>/dev/null], [AC_MSG_RESULT(available) AC_SUBST([NODE_DESTRUCTURE], [--harmony_destructuring])], [AC_MSG_RESULT(no)]) +# include above check(s) in NODE_FLAGS +NODE_FLAGS="$NODE_FLAGS $NODE_DESTRUCTURE" + set_devnotes='@set DEVNOTES' AC_ARG_ENABLE( [devnotes], @@ -68,8 +72,13 @@ AC_ARG_WITH( AC_SUBST([SET_SRCURI], [$set_srcuri]) +AC_SUBST([AUTOGENERATED], + ["THIS FILE IS AUTOGENERATED! DO NOT MODIFY! See *.in."]) + # generate files from their *.in counterparts AC_CONFIG_FILES([Makefile package.json doc/Makefile doc/config.texi - src/version.js]) + src/version.js + bin/server], + [chmod +x bin/server]) AC_OUTPUT