1
0
Fork 0

Initial build system

master
Mike Gerwitz 2015-12-20 00:03:52 -05:00
parent 017567193b
commit 2f1967a902
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
6 changed files with 213 additions and 0 deletions

19
.gitignore vendored 100644
View File

@ -0,0 +1,19 @@
# generated by autotools
/aclocal.m4
/autom4te.cache
/configure
/Makefile.in
/build-aux/
!/build-aux/gen-index
# generated by configure
/src/version.js
/config.*
/Makefile
/package.json
# generated by gen-index
/src/**/index.js
# npm
/node_modules

37
Makefile.am 100644
View File

@ -0,0 +1,37 @@
## Automake script
#
# Copyright (C) 2015 Mike Gerwitz
#
# This file is part of LaserTank.js.
#
# 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 <http://www.gnu.org/licenses/>.
##
namespaces=$(shell find src -type d)
nsindex=$(addsuffix /index.js, $(namespaces))
.PHONY: FORCE
all-am: modindex
modindex: $(nsindex)
%/index.js: FORCE
./build-aux/gen-index "$*" > "$@"
test: check
check:
@PATH="$(PATH):$(CURDIR)/node_modules/mocha/bin" \
mocha --recursive $(TESTARGS)
FORCE:

View File

@ -0,0 +1,45 @@
#!/bin/bash
# Generates index.js from sources in destination directory
#
# Copyright (C) 2014 LoVullo Associates, Inc.
# Copyright (C) 2015 Mike Gerwitz
#
# This file is part of liza. It has been modified by Mike Gerwitz.
#
# 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 <http://www.gnu.org/licenses/>.
##
shopt -s extglob
destpath="${1?Destination path required}"
cat <<EOH
/*** GENERATED BY gen-index; DO NOT MODIFY ***/
module.exports = {
EOH
# generate require for each module
for module in "$destpath"/!(index).js; do
modname="$( basename "$module" .js )"
echo " '$modname': require( './$modname' ),"
done
# include index.js for any sub-directories (namespace)
for dir in $( find "$destpath" -maxdepth 1 -mindepth 1 -type d ); do
ns=$( basename "$dir" )
echo " '$ns': require( './$ns' ),"
done
echo '};'

34
configure.ac 100644
View File

@ -0,0 +1,34 @@
## Autoconf script
#
# Copyright (C) 2015 Mike Gerwitz
#
# This file is part of LaserTank.js.
#
# 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 <http://www.gnu.org/licenses/>.
##
AC_INIT([lasertank-js], [0.0.0-dev], [mtg@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])
# provide more granular version numbers based on the above AC_INIT line
m4_define([ver_split], m4_split(m4_translit(AC_PACKAGE_VERSION, [-], [.]), [\.]))
AC_SUBST(MAJOR, m4_argn(1, ver_split))
AC_SUBST(MINOR, m4_argn(2, ver_split))
AC_SUBST(REV, m4_argn(3, ver_split))
AC_SUBST(SUFFIX, m4_argn(4, ver_split))
# generate files from their *.in counterparts
AC_CONFIG_FILES([Makefile package.json src/version.js])
AC_OUTPUT

37
package.json.in 100644
View File

@ -0,0 +1,37 @@
{
"name": "lasertank-js",
"description": "A faithful JavaScript clone of LaserTank",
"version": "@VERSION@",
"author": "Mike Gerwitz (https://mikegerwitz.com)",
"homepage": "https://mikegerwitz.com/",
"repository": {
"type": "git",
"url": "https://gitlab.com/mikegerwitz/lasertank-js"
},
"engines": {
"node": ">0.0.0"
},
"dependencies": {
"easejs": ">=0.2.7"
},
"devDependencies": {
"chai": ">=1.9.1",
"mocha": ">=1.18.2"
},
"licenses": [
{
"type": "GPLv3+",
"url": "https://www.gnu.org/licenses/gpl.html"
}
],
"tags": [
"game",
"lasertank",
"tile game"
]
}

41
src/version.js.in 100644
View File

@ -0,0 +1,41 @@
/**
* Provides version information
*
* Copyright (C) 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
*
* This file is part of GNU ease.js.
*
* ease.js 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 <http://www.gnu.org/licenses/>.
*/
var major = @MAJOR@,
minor = @MINOR@,
rev = @REV@,
suffix = '@SUFFIX@',
version = [ major, minor, rev, suffix ];
version.major = major;
version.minor = minor;
version.rev = rev;
version.suffix = suffix;
version.toString = function()
{
return this.join( '.' )
.replace( /\.([^.]+)$/, '-$1' )
.replace( /-$/, '' );
};
module.exports = version;