From 90fe864412ec16776e61fd47c812fba54110e8d4 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Thu, 16 Jan 2014 13:06:14 +1300 Subject: [PATCH] Sync with master to pick up working rockspecs among others. Signed-off-by: Gary V. Vaughan --- .travis.yml | 49 +++-- ChangeLog | 179 ++++++++++++++++ GNUmakefile | 5 +- Makefile.in | 18 +- NEWS | 29 +++ bootstrap | 376 ++++++++++++++++++++++++++++++++-- bootstrap.conf | 21 +- build-aux/bootstrap.in | 53 +++-- build-aux/bootstrap.slingshot | 270 ++++++++++++++++++++++++ build-aux/merge-sections | 70 ++++++- build-aux/mkrockspecs | 58 +++++- build-aux/specl.mk | 13 +- configure | 45 +--- configure.ac | 2 +- docs/mkrockspecs.1 | 5 +- local.mk | 2 +- m4/slingshot.m4 | 20 -- slingshot-6-1.rockspec | 6 +- src/merge-sections.in | 68 +++++- src/mkrockspecs.in | 56 ++++- travis.yml.in | 49 +++-- 21 files changed, 1195 insertions(+), 199 deletions(-) diff --git a/.travis.yml b/.travis.yml index f45ccc0..460c327 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,6 @@ env: - LUAROCKS_CONFIG=build-aux/luarocks-config.lua - LUAROCKS_BASE=luarocks-2.1.1 - LUAROCKS="$LUA $HOME/bin/luarocks" - - GENDOC=luarocks/bin/ - - SPECL=bin/specl matrix: - LUA=lua5.1 LUA_INCDIR=/usr/include/lua5.1 LUA_SUFFIX=5.1 - LUA=lua5.2 LUA_INCDIR=/usr/include/lua5.2 LUA_SUFFIX=5.2 @@ -17,6 +15,10 @@ env: # Tool setup. install: + # Put back the links for libyaml, which are missing on recent Travis VMs + - test -f /usr/lib/libyaml.so || + sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; + - sudo apt-get install help2man - sudo apt-get install luajit - sudo apt-get install libluajit-5.1-dev @@ -24,40 +26,43 @@ install: - sudo apt-get install liblua5.1-dev - sudo apt-get install lua5.2 - sudo apt-get install liblua5.2-dev - # Put back the links for libyaml, which missing on recent Travis VMs - - test -f /usr/lib/libyaml.so || - sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; - # Luadoc and Ldoc work best on Travis with Lua 5.1. - # sudo apt-get install luarocks - # sudo luarocks install - # mkdir -p luarocks/bin - # sed 's|^exec "[^"]*"|exec lua5.1|' `which ` > $GENDOC - # chmod a+rx $GENDOC # Install a recent luarocks release locally for everything else. - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz - tar zxvpf $LUAROCKS_BASE.tar.gz - - cd $LUAROCKS_BASE - - ./configure - --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX - --with-lua-include=$LUA_INCDIR - - make all install - - cd .. + - ( cd $LUAROCKS_BASE; + ./configure + --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX + --with-lua-include=$LUA_INCDIR; + make all install; ) # Configure and build. script: - - ./bootstrap + # Initial bootstrap to build luarocks-config.lua, before we've + # installed our rocks. + - ./bootstrap --skip-rock-checks - ./configure LUA="$LUA" - make $LUAROCKS_CONFIG LUA="$LUA" LUA_INCDIR="$LUA_INCDIR" V=1 || cat $LUAROCKS_CONFIG config.log + # Set Lua and Shell paths up for local luarocks tree. + # this package depends on will be installed. - eval `$LUAROCKS path` - export PATH=`pwd`/luarocks/bin:$PATH + + # Install extra rocks into $LUAROCKS_CONFIG rocks tree. - $LUAROCKS install lyaml; $LUAROCKS install specl; + + # Make git rockspec for this slingshot - make rockspecs LUAROCKS="$LUAROCKS" V=1 || { $LUAROCKS path; cat $ROCKSPEC; } - # LuaRocks make will fail if dependencies are missing. + + # The git rockspec will rerun bootstrap, and check any rock versions + # in bootstrap.conf:buildreq this time. - $LUAROCKS make $ROCKSPEC LUA="$LUA" - # Use bin/specl if we built it, or else the specl rock we just installed. - - test -f "$SPECL" || SPECL=luarocks/bin/specl; - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" make check SPECL="$SPECL" V=1 + + # Run self-tests in the `luarocks make` build tree. + - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" + LUA_CPATH=`pwd`'/ext/?.so;'"${LUA_CPATH-;}" + LUA_INIT= LUA_INIT_5_2= + make check V=1 diff --git a/ChangeLog b/ChangeLog index 25fe115..54ce617 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,184 @@ +2014-01-16 Gary V. Vaughan + + configury: bump version to 7. + * configure.ac (AC_INIT): Bump version to 7. + * build-aux/merge-sections: Regenerate. + +2014-01-16 Gary V. Vaughan + + Revert "mkrockspecs: slingshot doesn't need slingshot submodule git magic!" and others... + This reverts commits 039367682f360cec97324e3fdb58bc3443938468, + d963b9832cd68fb938bc50ff423b9c6231e00abc and most of + 0613d6e152f698bc4f570f00aed14103e8ed6683. + + The whole issue was a red-herring, better solved by a tiny one-line + fix to bootstrap $GIT detection. + +2014-01-15 Gary V. Vaughan + + bootstrap: sync with upstream. + * build-aux/bootstrap.in: Sync with upstream. + * bootstrap: Regenerate. + + mkrockspecs: add missing semi-colon. + * src/mkrockspecs.in (build): Add missing semicolon. + + mkrockspecs: slingshot doesn't need slingshot submodule git magic! + * src/mkrockspecs.in (build): Only add the git magic if the + name of the current package is not "slingshot". + + mkrockspecs: dont turn an existing git repo into a sparse checkout! + * src/mkrockspecs.in (build): Only run the git magic if slingshot + is missing. + + configury: bump git revision to 1.7.0 for sparse checkout support. + * bootstrap.conf (buildreq): Bump minimum git revision to 1.7.0, + the first to support the sparse checkout features used in git/scm + rockspecs. + + mkrockspecs: git magic to reenable slingshot submodule in PKG-git-1.rockspec. + Without this changeset, it was not possible to run bootstrap + inside a non-release revision checked out by luarocks install. + * mkrockspecs.in (prog): New --branch/-b option. + (build): Ugly git magic to fetch the missing slingshot submodule + from `luarocks install http://raw.github.com/owner/package.git`. + * NEWS: Update. + + travis: let specl take care of itself. + * travis.yml.in (SPECL): Remove all references. + * .travis.yml: Regenerate. + +2014-01-13 Gary V. Vaughan + + travis: cosmetic improvements to travis.yml.in. + * travis.yml.in: Cosmetic improvements. + * .travis.yml: Regenerate. + + configury: make sure make launched rebootstraps don't fall over. + * GNUmakefile (%::): Pass --skip-rock-checks to bootstrap. + + travis: use if statements instead of && short circuiting. + * travis.yml.in (script): Travis treats a short circuit fail as + a script failure, so use full blown if statement. + * .travis.yml: Regenerate. + + travis: fix SPECL environment setting. + * travis.yml.in (SPECL): Set it properly. + * .travis.yml: Regenerate. + + travis: don't export SPECL until required. + * travis.yml.in (global): Remove SPECL. + (script): Set SPECL just prior to running it. + * .travis.yml: Regenerate. + + slingshot: use buildreq to check specl version, not custom configury. + * bootstrap.conf (buildreq): Add specl requirement. + * m4/slingshot.m4 (SPECL_MIN): Remove. + * build-aux/specl.mk (specl-check-local): Simplify. + + travis: use a single luarocks tree. + Now that LDoc and LuaDoc work correctly on Lua 5.2, no need to + jump through hoops to keep a separate 5.1 rockstree for them. + * m4/slingshot.m4 (GENDOC, GENDOC_FALSE): Remove. + * travis.yml.in: Some extra comments and spacing for better + readability. + (global): Remove GENDOC export. + (install): Remove @GENDOC_FALSE@ section. + (script): Use new --skip-rock-checks when building a Makefile + for luarocks-config.lua generation. + * .travis.yml: Regenerate. + + bootstrap: add --skip-rock-checks option. + * build-aux/bootstrap.slingshot (slingshot_options_prep): Add + default value and usage text for --skip-rock-checks option. + (slingshot_parse_options): Parse --skip-rock-checks option. + (slingshot_check_rockspecs): Early return if --skip-rock-checks + was passed. + * bootstrap: Regenerate. + +2014-01-08 Gary V. Vaughan + + bootstrap: allow pre-emptive APPVAR to skip rockspec version checks. + Avoid a catch-22 where you can't run bootstrap because + prerequisite rocks are missing, but you can't install the rocks + until you have the configured Makefiles necessary to generate + luarocks-config.lua. + * build-aux/bootstrap.slingshot (slingshot_check_rockspecs): If + APPVARs (e.g. LDOC, SPECL) are already set in the environment, + but the paths they point to don't yet exist, skip the version + check, but show a warning that configure and/or make will be + needing them to work properly. + * bootstrap: Regenerate. + * NEWS: Update. + +2014-01-07 Gary V. Vaughan + + travis: be explicit about which LuaRocks tree is being used. + Older LDoc, and all Luadoc release only work with Lua 5.1, so on + Travis we have a system luarocks configured with Lua 5.1 to hold + those, but a separate LuaRocks tree managed by the latest LuaRocks + release for rock dependencies. + * travis.yml.in: Specify the system luarocks tree for bootstrap, + so that it will find LuaDoc correctly. + + bootstrap: sync with upstream. + * build-aux/bootstrap.in: Sync with upstream, for --version fix. + * bootstrap: Regenerate. + + bootstrap: support rockspecs in $buildreq, and --luarocks-tree. + * build-aux/bootstrap.slingshot (require_rockspecs_req) + (slingshot_rockspec_error, slingshot_split_buildreq) + (slingshot_check_rockspecs): New functions. Add support for + checking versions of rockspecs listed in $buildreq. + (slingshot_check_rockstree_path): New function. Warn if a + custom rockstree is passed, but not added to PATH. + (slingshot_options_prep, slingshot_parse_options) + (slingshot_option_validation): New functions. Add support for + --luarocks-tree=DIR. + * bootstrap: Regenerate. + * NEWS: Update. + + bootstrap: sync with upstream. + * build-aux/bootstrap.in: sync with upstream. + * bootstrap: Regenerate. + +2014-01-05 Gary V. Vaughan + + bootstrap: sync with upstream. + * build-aux/bootstrap.in: Sync with upstream bootstrap. + * bootstrap: Regenerate. + + mkrockspecs: reset LUA_INIT and LUA_INIT_5_2 before re-exec. + * src/merge-sections.in, src/mkrockspecs.in: Add 'Bourne compat' + boilerplate, and ensure LUA_INIT and LUA_INIT_5_2 are reset in + the environment before re-execing with $LUA. + * build-aux/merge-sections: Regenerate. + 2014-01-04 Gary V. Vaughan + bootstrap: check in the merge-sections script. + We need build-aux/merge-sections available at bootstrap time so + that bootstrap can rebuild itself to check for updates. + * bootstrap.conf (require_bootstrap_uptodate): Improve failure + message. + * .gitignore: Remove build-aux/merge-sections. + * build-aux/merge-sections: Check in. + + bootstrap: call func_ensure_changelog manually. + * bootstrap.conf: Call func_ensure_changelog manually. + + bootstrap: ensure slingshot_copy function is merged in. + * src/merg-sections.in: Add support for `--verbose` flag. + * build-aux/bootstrap.in: Sync with upstream, now that section + header comment typos are fixed. + * bootstrap: Regenerate. + * NEWS: Update. + + maint: post-release administrivia. + * NEWS: Add header line for next release. + * .prev-version: Record previous version. + * ./local.mk (old_NEWS_hash): Auto-update. + Release version 6 * NEWS: Record release date. diff --git a/GNUmakefile b/GNUmakefile index b713701..307d9a6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -23,9 +23,12 @@ dont-forget-to-bootstrap = $(wildcard Makefile.in) ifeq ($(dont-forget-to-bootstrap),) +## Don't redo any pedantic rock version checks, incase they derail +## a subdirectory bootstrap of slingshot. + %:: @echo '$(ME): rebootstrap' - @test -f Makefile.in || ./bootstrap + @test -f Makefile.in || ./bootstrap --skip-rock-checks @test -f Makefile || ./configure $(MAKE) $@ diff --git a/Makefile.in b/Makefile.in index 4bec1da..636f925 100644 --- a/Makefile.in +++ b/Makefile.in @@ -92,7 +92,7 @@ # terms of the MIT license reproduced below. # ==================================================================== # -# Copyright (C) 2013-2014 Gary V. Vaughan # +# Copyright (C) 2013-2014 Gary V. Vaughan # # # # Permission is hereby granted, free of charge, to any person # # obtaining a copy of this software and associated documentation # @@ -324,8 +324,6 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXTRA_ROCKS = @EXTRA_ROCKS@ -GENDOC = @GENDOC@ -GENDOC_FALSE = @GENDOC_FALSE@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ INSTALL = @INSTALL@ @@ -356,7 +354,6 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SPECL = @SPECL@ -SPECL_MIN = @SPECL_MIN@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ @@ -423,7 +420,7 @@ install_exec_hooks = lib_LTLIBRARIES = man_MANS = docs/mkrockspecs.1 save_release_files = $(scm_rockspec) -old_NEWS_hash = b7f5ee3470e07fef2c1a882767f9b99b +old_NEWS_hash = 4a4a721668a1516c046d865c7b425586 update_copyright_env = \ UPDATE_COPYRIGHT_HOLDER='(Free Software Foundation, Inc.|Gary V. Vaughan|Reuben Thomas)' \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ @@ -1012,16 +1009,7 @@ docs/mkrockspecs.1: build-aux/mkrockspecs Makefile build-aux/mkrockspecs; \ fi specl-check-local: $(specl_SPECS) - @v=`$(SPECL) --version | sed -e 's|^.* ||' -e 1q`; \ - if test "$$v" -lt "$(SPECL_MIN)"; then \ - printf "%s%s\n%s\n" \ - "ERROR: Specl version $$v is too old," \ - " please upgrade to at least version $(SPECL_MIN)," \ - "ERROR: and rerun \`make check\`"; \ - exit 1; \ - else \ - $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS); \ - fi + $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) $(luarocks_config): Makefile.am @test -d build-aux || mkdir build-aux diff --git a/NEWS b/NEWS index fefee5f..3dbe180 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,34 @@ Slingshot NEWS - User visible changes. +* Noteworthy changes in release ?.?.? (????-??-??) + +** New Features: + + - `mkrockspecs` accepts a new `--branch` option for generating a + git/scm rockspec that pulls that branch instead of master. + + - Slingshot bootstrap will check rockspecs listed in $buildreq, + according to the URL part of a specification-triple ending in + `.rockspec`. So that we don't have to install, say, LDoc twice + for Travis (once in the system rocks tree so that bootstrap + won't bomb out with a missing rockspec error, and then again + in the project rocks tree after luarocks-config.ld has been + built by make), the rockspec version checks can be short- + circuited by setting an APPVAR in bootstrap's environment, e.g: + + LDOC=`pwd`/luarocks/bin/ldoc ./bootstrap + + - Slingshot bootstrap accepts a new `--luarocks-tree` option to + check a particular tree for prerequisite rocks. + + - `build-aux/merge-sections` has a new `--verbose` flag that reports + progress to stderr in real time. + +** Bugs fixed: + + - `bootstrap` now has `slingshot_copy` merged in correctly. + + * Noteworthy changes in release 6 (2014-01-04) [stable] ** New Features: diff --git a/bootstrap b/bootstrap index 888917a..82dcf5c 100755 --- a/bootstrap +++ b/bootstrap @@ -109,6 +109,11 @@ export AUTORECONF export CONFIG_SHELL +: ${LUAROCKS="luarocks"} + +export LUAROCKS + + ## -------------- ## ## Configuration. ## ## -------------- ## @@ -233,6 +238,10 @@ slingshot_files=$slingshot_files slingshot_path=$slingshot_path slingshot_url=$slingshot_url +# NOTE: slingshot bootstrap will check rockspecs listed in $buildreq, +# according to the URL part of a specification triple ending in +# `.rockspec`. + ## ------------------- ## ## External Libraries. ## @@ -436,6 +445,7 @@ test -z "$SED" && { } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed SED=$func_path_progs_result } @@ -690,6 +700,44 @@ func_require_term_colors () } +# require_rockspecs_req +# --------------------- +# Remove rockspecs from $buildreq, and add them to $rockspecs_req. +require_rockspecs_req=slingshot_require_rockspecs_req +slingshot_require_rockspecs_req () +{ + $debug_cmd + + test -n "$rockspecs_req" || { + _G_non_rockspecs= + + set dummy $buildreq; shift + + while test $# -gt 2; do + case $3 in + *.rockspec) + func_append rockspecs_req " $1 $2 $3" + ;; + [a-z]*://*) + func_append _G_non_rockspecs " $1 $2 $3" + ;; + *) func_fatal_error "\ +'$3' from the buildreq table in +'bootstrap.conf' does not look like the URL for downloading +$1. Please ensure that buildreq is a strict newline +delimited list of triples; 'program min-version url'." + ;; + esac + shift; shift; shift + done + + buildreq=$_G_non_rockspecs + } + + require_rockspecs_req=: +} + + # require_slingshot_dotgitmodules # ------------------------------- # Ensure we have a '.gitmodules' file, with appropriate 'slingshot' settings. @@ -1674,7 +1722,7 @@ func_lt_ver () #! /bin/sh # Set a version string for this script. -scriptversion=2014-01-03.01; # UTC +scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 @@ -2096,9 +2144,92 @@ func_validate_options () -## ------------------## + +# slingshot_options_prep +# ---------------------- +# Preparation for additional slingshot option parsing. +slingshot_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_skip_rock_checks=false + # opt_luarocks_tree default in *unset*! + + # Extend the existing usage message. + usage_message=$usage_message' +Slingshot Options: + + --luarocks-tree=DIR + check a non-default tree for prerequisite rocks + --skip-rock-checks + ignore Lua rocks in bootstrap.conf:buidreq' + + func_quote_for_eval ${1+"$@"} + slingshot_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep slingshot_options_prep + + +# slingshot_parse_options OPT... +# ------------------------------ +# Called at the end of each main option parse loop to process any +# additional slingshot options. +slingshot_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --luarocks-tree) + test $# = 0 && func_missing_arg $_G_opt && break + opt_luarocks_tree=$1 + shift + ;; + + --skip-rock-checks) + opt_skip_rock_checks=: + ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + slingshot_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options slingshot_parse_options + + +# slingshot_option_validation +# --------------------------- +# Flag any inconsistencies in users' selection of slingshot options. +slingshot_option_validation () +{ + $debug_cmd + + test -z "$opt_luarocks_tree" \ + || test -d "$opt_luarocks_tree" \ + || func_fatal_help "$opt_luarocks_tree: not a directory" +} +func_add_hook func_validate_options slingshot_option_validation + + +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. @@ -2247,7 +2378,7 @@ func_version () $debug_cmd printf '%s\n' "$progname $scriptversion" - $SED -n '/^##/q + $SED -n ' /(C)/!b go :more /\./!{ @@ -2293,7 +2424,7 @@ test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser # Set a version string. -scriptversion=2013-08-22.10; # UTC +scriptversion=2014-01-04.01; # UTC # 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 @@ -2311,6 +2442,82 @@ scriptversion=2013-08-22.10; # UTC # Please report bugs or propose patches to gary@gnu.org. +# slingshot_copy FILENAME SRCDIR DESTDIR +# -------------------------------------- +# If option '--copy' was specified, or soft-linking SRCFILE to DESTFILE +# fails, then try to copy SRCFILE to DESTFILE (making sure to update the +# timestamp so that a series of files with dependencies can be copied +# in the right order that their timestamps won't trigger rebuilds). +slingshot_copy () +{ + $debug_cmd + + slingshot_srcfile=`echo "$2/$1" |sed -e 's|/\./|/|g'` + slingshot_destfile=`echo "$3/$1" |sed -e 's|/\./|/|g'` + + $opt_force || { + # Nothing to do if the files are already identical. + if func_cmp_s "$slingshot_srcfile" "$slingshot_destfile"; then + func_verbose "'$slingshot_destfile' is up to date." + return 0 + fi + } + + # Require --force to remove existing $slingshot_destfile. + $opt_force && $RM "$slingshot_destfile" + test -f "$slingshot_destfile" && { + func_warn_and_continue "'$slingshot_destfile' exists: use '--force' to overwrite" + return 0 + } + + # Be careful to support 'func_copy dir/target srcbase destbase'. + func_dirname "$slingshot_destfile" + func_mkdir_p "$func_dirname_result" + + # Copy or link according to '--copy' option. + if $opt_copy; then + slingshot_copycmd=$CP + slingshot_copy_type=copying + else + slingshot_copycmd=$LN_S + slingshot_copy_type=linking + + func_relative_path "$3" "$2" + slingshot_srcfile=$func_relative_path_result/$1 + fi + slingshot_copy_msg="$slingshot_copy_type file '$slingshot_destfile'" + $opt_verbose && \ + slingshot_copy_msg="$slingshot_copy_type $slingshot_srcfile $3" + + if $opt_dry_run || { + ( umask 0 + $slingshot_copycmd "$slingshot_srcfile" "$slingshot_destfile" + ) >/dev/null 2>&1 + } + then + echo "$slingshot_copy_msg" + else + func_error "$slingshot_copy_type '$2/$1' to '$3/' failed" + return 1 + fi +} + + +# slingshot_rockspec_error +# ------------------------ +# Called by zile_check_rockspecs for missing rocks. +slingshot_rockspec_error () +{ + $debug_cmd + + _G_strippedver=`expr "$_G_reqver" : '=*\(.*\)'` + func_error "\ +Prerequisite LuaRock '$_G_rock $_G_strippedver' not found. Please install it." + + rockspecs_uptodate_result=false +} + + ## ------ ## ## Usage. ## ## ------ ## @@ -2325,9 +2532,9 @@ scriptversion=2013-08-22.10; # UTC -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of # 'extract-trace'. @@ -2696,12 +2903,12 @@ test extract-trace = "$progname" && func_main "$@" # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string for *this* script. -scriptversion=2014-01-03.01; # UTC +scriptversion=2014-01-04.01; # UTC ## ------------------- ## @@ -3016,6 +3223,104 @@ func_gettext_configuration () +## The section title above is chosen for what section of bootstrap +## these functions will be merged to, so that the invocations of +## `func_add_hook` are guaranteed not to be executed until after +## the hook management functions are defined. + + +# slingshot_split_buildreq +# ------------------------ +# For convenience, let the user add rockspec requirements to $buildreq. +# Note that this is for *build-time* requirements (e.g. ldoc), so that +# make can complete without error. You should add *run-time* rockspec +# requirements (e.g. stdlib) to rockspec.conf. +slingshot_split_buildreq () +{ + $debug_cmd + + $require_rockspecs_req +} +func_add_hook func_init slingshot_split_buildreq + + +# slingshot_check_rockspecs +# ------------------------- +# Check build-time rockspecs from $buildreq are uptodate. +# It would be nice if we could rely on luarock binaries to respond to +# `--version` like GNU apps, but there is no reliable consensus, so we +# have to check installed luarock versions directly, and warn the user +# if the apps we're checking for are not somewhere along PATH. +slingshot_check_rockspecs () +{ + $debug_cmd + + $opt_skip_rock_checks && return + + $require_rockspecs_req + + _G_req= + rockspecs_uptodate_result=: + + set dummy $rockspecs_req; shift + while test $# -gt 0; do + _G_rock=$1; shift + _G_reqver=$1; shift + _G_url=$1; shift + + func_append _G_req " $_G_rock $_G_url" + + # Honor $APP variables ($LDOC, $SPECL, etc.) + _G_appvar=`echo $_G_rock |tr '[a-z]' '[A-Z]'` + eval "_G_rock=\${$_G_appvar-$_G_rock}" + + # Trust the user will ensure the binaries will arive at the + # specified location before they are needed if they set these. + if eval 'test -n "${'$_G_appvar'+set}"'; then + eval test -f '"${'$_G_appvar'}"' \ + || eval 'func_warning settings "\ +not checking whether $'$_G_appvar' has version $_G_reqver; +configure or make may fail because you set $_G_appvar, but +$'$_G_appvar' does not yet exist!"' + else + _G_instver=`$LUAROCKS ${opt_luarocks_tree+--tree=$opt_luarocks_tree} \ + show $_G_rock 2>/dev/null \ + |sed -n '/^'"$_G_rock"' .* - /{s/^'"$_G_rock"' \(.*\) - .*$/\1/p;}'` + + if test -z "$_G_instver"; then + slingshot_rockspec_error + else + func_verbose "found '$_G_rock' version $_G_instver." + + case $_G_reqver in + =*) + test "x$_G_reqver" = "x=$_G_instver" || slingshot_rockspec_error + ;; + *) + func_lt_ver "$_G_reqver" "$_G_instver" || slingshot_rockspec_error + ;; + esac + fi + fi + done + + $rockspecs_uptodate_result || { + func_strtable 0 10 48 \ + "Program" "Rockspec_URL" $_G_req + func_fatal_error "Missing rocks: +$func_strtable_result +Install missing rockspecs with: + $LUAROCKS ${opt_luarocks_tree+--tree=$opt_luarocks_tree }install \$Rockspec_URL +and then rerun bootstrap with the --luarocks-tree option set +appropriately, or if you're sure that the missing rocks will +be installed before running make by exporting: + APPNAME=/path/to/app. +" + } +} +func_add_hook func_prep slingshot_check_rockspecs + + # slingshot_copy_files # -------------------- # Update files from slingshot subproject. @@ -3062,6 +3367,25 @@ slingshot_ensure_changelog () func_add_hook func_prep slingshot_ensure_changelog +# slingshot_check_rockstree_path +# ------------------------------ +# Show a warning at the end of bootstrap if --luarocks-tree was passed +# set, but $opt_luarocks_tree/bin is not in the command PATH. +slingshot_check_rockstree_path () +{ + $debug_cmd + + test -z "$rockspecs_req" || { + case :$PATH: in + *:$opt_luarocks_tree/bin:*) ;; + *) func_warning recommend \ + "If configure or make fail, try adding $opt_luarocks_tree/bin to PATH" ;; + esac + } +} +func_add_hook func_fini slingshot_check_rockstree_path + + ## --------------- ## ## Core functions. ## ## --------------- ## @@ -3882,8 +4206,8 @@ func_require_git () $opt_skip_git && GIT=true test true = "$GIT" || { - if test -f .gitignore && ($GIT --version) >/dev/null 2>&1; then :; else - GIT=true + if test -f .git; then + ($GIT --version) >/dev/null 2>&1 || GIT=true fi } @@ -4499,9 +4823,9 @@ func_require_vc_ignore_files () } -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of 'bootstrap'. @@ -4989,9 +5313,6 @@ delimited list of triples; 'program min-version url'." else _G_instver=`func_get_version $_G_app` - test -z "$_G_instver" \ - || func_verbose "found '$_G_app' version $_G_instver." - # Fail if --version didn't work. if test -z "$_G_instver"; then func_error "Prerequisite '$_G_app' not found. Please install it, or @@ -5000,12 +5321,29 @@ delimited list of triples; 'program min-version url'." # Fail if a newer version than what we have is required. else - func_lt_ver "$_G_reqver" "$_G_instver" || { - func_error "\ + func_verbose "found '$_G_app' version $_G_instver." + + case $_G_reqver in + =*) + # If $buildreq version starts with '=', version must + # match the installed program exactly. + test "x$_G_reqver" = "x=$_G_instver" || { + func_error "\ + '$_G_app' version == $_G_instver is too old + 'exactly $_G_app-$_G_reqver is required" + func_check_versions_result=false + } + ;; + *) + # Otherwise, anything that is not older is a match. + func_lt_ver "$_G_reqver" "$_G_instver" || { + func_error "\ '$_G_app' version == $_G_instver is too old '$_G_app' version >= $_G_reqver is required" func_check_versions_result=false - } + } + ;; + esac fi fi done diff --git a/bootstrap.conf b/bootstrap.conf index 1370bec..e070fb4 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -32,8 +32,9 @@ # Build prerequisites buildreq=' - git 1.5.5 http://git-scm.com + git 1.7.0 http://git-scm.com help2man 1.29 http://www.gnu.org/s/help2man + specl 5 http://luarocks.org/repositories/rocks/specl-9-1.rockspec ' # No need to do any gnulib-tooling here. @@ -61,18 +62,17 @@ func_require_bootstrap_uptodate () $build_aux/merge-sections " - _G_missing_bootstrap_sources=false + _G_missing_bootstrap_sources= for _G_src in $_G_bootstrap_sources; do - test -f "$_G_src" || _G_missing_bootstrap_sources=: + test -f "$_G_src" || func_append _G_missing_bootstrap_sources " $_G_src" done - if $_G_missing_bootstrap_sources; then + if test -n "$_G_missing_bootstrap_sources"; then func_warning upgrade "\ -Please add bootstrap to your gnulib_modules list in -'bootstrap.conf', so that I can tell you when there are -updates available." +Please check-in$_G_missing_bootstrap_sources to your git +repository, so that I can tell you when bootstrap needs +rebuilding." else - # delete this rm -f bootstrap.new $build_aux/merge-sections $build_aux/bootstrap.slingshot < $build_aux/bootstrap.in > bootstrap.new @@ -98,6 +98,11 @@ following to 'bootstrap.conf': } +# Since we have neither slingshot_files nor gnulib_modules, we need +# to call this manually. +func_ensure_changelog + + # Local variables: # mode: shell-script diff --git a/build-aux/bootstrap.in b/build-aux/bootstrap.in index 86ff9f7..2094e73 100755 --- a/build-aux/bootstrap.in +++ b/build-aux/bootstrap.in @@ -426,6 +426,7 @@ test -z "$SED" && { } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed SED=$func_path_progs_result } @@ -1535,7 +1536,7 @@ func_lt_ver () #! /bin/sh # Set a version string for this script. -scriptversion=2014-01-03.01; # UTC +scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 @@ -1957,9 +1958,9 @@ func_validate_options () -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. @@ -2108,7 +2109,7 @@ func_version () $debug_cmd printf '%s\n' "$progname $scriptversion" - $SED -n '/^##/q + $SED -n ' /(C)/!b go :more /\./!{ @@ -2154,7 +2155,7 @@ test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser # Set a version string. -scriptversion=2013-08-22.10; # UTC +scriptversion=2014-01-04.01; # UTC # 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 @@ -2186,9 +2187,9 @@ scriptversion=2013-08-22.10; # UTC -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of # 'extract-trace'. @@ -2557,12 +2558,12 @@ test extract-trace = "$progname" && func_main "$@" # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string for *this* script. -scriptversion=2014-01-03.01; # UTC +scriptversion=2014-01-04.01; # UTC ## ------------------- ## @@ -3697,8 +3698,8 @@ func_require_git () $opt_skip_git && GIT=true test true = "$GIT" || { - if test -f .gitignore && ($GIT --version) >/dev/null 2>&1; then :; else - GIT=true + if test -f .git; then + ($GIT --version) >/dev/null 2>&1 || GIT=true fi } @@ -4314,9 +4315,9 @@ func_require_vc_ignore_files () } -## ------------------## +## ----------------- ## ## Helper functions. ## -## ------------------## +## ----------------- ## # This section contains the helper functions used by the rest of 'bootstrap'. @@ -4804,9 +4805,6 @@ delimited list of triples; 'program min-version url'." else _G_instver=`func_get_version $_G_app` - test -z "$_G_instver" \ - || func_verbose "found '$_G_app' version $_G_instver." - # Fail if --version didn't work. if test -z "$_G_instver"; then func_error "Prerequisite '$_G_app' not found. Please install it, or @@ -4815,12 +4813,29 @@ delimited list of triples; 'program min-version url'." # Fail if a newer version than what we have is required. else - func_lt_ver "$_G_reqver" "$_G_instver" || { - func_error "\ + func_verbose "found '$_G_app' version $_G_instver." + + case $_G_reqver in + =*) + # If $buildreq version starts with '=', version must + # match the installed program exactly. + test "x$_G_reqver" = "x=$_G_instver" || { + func_error "\ + '$_G_app' version == $_G_instver is too old + 'exactly $_G_app-$_G_reqver is required" + func_check_versions_result=false + } + ;; + *) + # Otherwise, anything that is not older is a match. + func_lt_ver "$_G_reqver" "$_G_instver" || { + func_error "\ '$_G_app' version == $_G_instver is too old '$_G_app' version >= $_G_reqver is required" func_check_versions_result=false - } + } + ;; + esac fi fi done diff --git a/build-aux/bootstrap.slingshot b/build-aux/bootstrap.slingshot index b9b7caa..1293a4e 100644 --- a/build-aux/bootstrap.slingshot +++ b/build-aux/bootstrap.slingshot @@ -36,6 +36,19 @@ slingshot_files=$slingshot_files slingshot_path=$slingshot_path slingshot_url=$slingshot_url +# NOTE: slingshot bootstrap will check rockspecs listed in $buildreq, +# according to the URL part of a specification triple ending in +# `.rockspec`. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +: ${LUAROCKS="luarocks"} + +export LUAROCKS + ## ----------------- ## ## Helper functions. ## @@ -102,10 +115,210 @@ slingshot_copy () } +# slingshot_rockspec_error +# ------------------------ +# Called by zile_check_rockspecs for missing rocks. +slingshot_rockspec_error () +{ + $debug_cmd + + _G_strippedver=`expr "$_G_reqver" : '=*\(.*\)'` + func_error "\ +Prerequisite LuaRock '$_G_rock $_G_strippedver' not found. Please install it." + + rockspecs_uptodate_result=false +} + + +## --------------- ## +## Option parsing. ## +## --------------- ## + + +# slingshot_options_prep +# ---------------------- +# Preparation for additional slingshot option parsing. +slingshot_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_skip_rock_checks=false + # opt_luarocks_tree default in *unset*! + + # Extend the existing usage message. + usage_message=$usage_message' +Slingshot Options: + + --luarocks-tree=DIR + check a non-default tree for prerequisite rocks + --skip-rock-checks + ignore Lua rocks in bootstrap.conf:buidreq' + + func_quote_for_eval ${1+"$@"} + slingshot_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep slingshot_options_prep + + +# slingshot_parse_options OPT... +# ------------------------------ +# Called at the end of each main option parse loop to process any +# additional slingshot options. +slingshot_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --luarocks-tree) + test $# = 0 && func_missing_arg $_G_opt && break + opt_luarocks_tree=$1 + shift + ;; + + --skip-rock-checks) + opt_skip_rock_checks=: + ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + slingshot_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options slingshot_parse_options + + +# slingshot_option_validation +# --------------------------- +# Flag any inconsistencies in users' selection of slingshot options. +slingshot_option_validation () +{ + $debug_cmd + + test -z "$opt_luarocks_tree" \ + || test -d "$opt_luarocks_tree" \ + || func_fatal_help "$opt_luarocks_tree: not a directory" +} +func_add_hook func_validate_options slingshot_option_validation + + ## ------------------- ## ## Hookable functions. ## ## ------------------- ## +## The section title above is chosen for what section of bootstrap +## these functions will be merged to, so that the invocations of +## `func_add_hook` are guaranteed not to be executed until after +## the hook management functions are defined. + + +# slingshot_split_buildreq +# ------------------------ +# For convenience, let the user add rockspec requirements to $buildreq. +# Note that this is for *build-time* requirements (e.g. ldoc), so that +# make can complete without error. You should add *run-time* rockspec +# requirements (e.g. stdlib) to rockspec.conf. +slingshot_split_buildreq () +{ + $debug_cmd + + $require_rockspecs_req +} +func_add_hook func_init slingshot_split_buildreq + + +# slingshot_check_rockspecs +# ------------------------- +# Check build-time rockspecs from $buildreq are uptodate. +# It would be nice if we could rely on luarock binaries to respond to +# `--version` like GNU apps, but there is no reliable consensus, so we +# have to check installed luarock versions directly, and warn the user +# if the apps we're checking for are not somewhere along PATH. +slingshot_check_rockspecs () +{ + $debug_cmd + + $opt_skip_rock_checks && return + + $require_rockspecs_req + + _G_req= + rockspecs_uptodate_result=: + + set dummy $rockspecs_req; shift + while test $# -gt 0; do + _G_rock=$1; shift + _G_reqver=$1; shift + _G_url=$1; shift + + func_append _G_req " $_G_rock $_G_url" + + # Honor $APP variables ($LDOC, $SPECL, etc.) + _G_appvar=`echo $_G_rock |tr '[a-z]' '[A-Z]'` + eval "_G_rock=\${$_G_appvar-$_G_rock}" + + # Trust the user will ensure the binaries will arive at the + # specified location before they are needed if they set these. + if eval 'test -n "${'$_G_appvar'+set}"'; then + eval test -f '"${'$_G_appvar'}"' \ + || eval 'func_warning settings "\ +not checking whether $'$_G_appvar' has version $_G_reqver; +configure or make may fail because you set $_G_appvar, but +$'$_G_appvar' does not yet exist!"' + else + _G_instver=`$LUAROCKS ${opt_luarocks_tree+--tree=$opt_luarocks_tree} \ + show $_G_rock 2>/dev/null \ + |sed -n '/^'"$_G_rock"' .* - /{s/^'"$_G_rock"' \(.*\) - .*$/\1/p;}'` + + if test -z "$_G_instver"; then + slingshot_rockspec_error + else + func_verbose "found '$_G_rock' version $_G_instver." + + case $_G_reqver in + =*) + test "x$_G_reqver" = "x=$_G_instver" || slingshot_rockspec_error + ;; + *) + func_lt_ver "$_G_reqver" "$_G_instver" || slingshot_rockspec_error + ;; + esac + fi + fi + done + + $rockspecs_uptodate_result || { + func_strtable 0 10 48 \ + "Program" "Rockspec_URL" $_G_req + func_fatal_error "Missing rocks: +$func_strtable_result +Install missing rockspecs with: + $LUAROCKS ${opt_luarocks_tree+--tree=$opt_luarocks_tree }install \$Rockspec_URL +and then rerun bootstrap with the --luarocks-tree option set +appropriately, or if you're sure that the missing rocks will +be installed before running make by exporting: + APPNAME=/path/to/app. +" + } +} +func_add_hook func_prep slingshot_check_rockspecs + + # slingshot_copy_files # -------------------- # Update files from slingshot subproject. @@ -152,10 +365,67 @@ slingshot_ensure_changelog () func_add_hook func_prep slingshot_ensure_changelog +# slingshot_check_rockstree_path +# ------------------------------ +# Show a warning at the end of bootstrap if --luarocks-tree was passed +# set, but $opt_luarocks_tree/bin is not in the command PATH. +slingshot_check_rockstree_path () +{ + $debug_cmd + + test -z "$rockspecs_req" || { + case :$PATH: in + *:$opt_luarocks_tree/bin:*) ;; + *) func_warning recommend \ + "If configure or make fail, try adding $opt_luarocks_tree/bin to PATH" ;; + esac + } +} +func_add_hook func_fini slingshot_check_rockstree_path + + ## -------------------- ## ## Resource management. ## ## -------------------- ## +# require_rockspecs_req +# --------------------- +# Remove rockspecs from $buildreq, and add them to $rockspecs_req. +require_rockspecs_req=slingshot_require_rockspecs_req +slingshot_require_rockspecs_req () +{ + $debug_cmd + + test -n "$rockspecs_req" || { + _G_non_rockspecs= + + set dummy $buildreq; shift + + while test $# -gt 2; do + case $3 in + *.rockspec) + func_append rockspecs_req " $1 $2 $3" + ;; + [a-z]*://*) + func_append _G_non_rockspecs " $1 $2 $3" + ;; + *) func_fatal_error "\ +'$3' from the buildreq table in +'bootstrap.conf' does not look like the URL for downloading +$1. Please ensure that buildreq is a strict newline +delimited list of triples; 'program min-version url'." + ;; + esac + shift; shift; shift + done + + buildreq=$_G_non_rockspecs + } + + require_rockspecs_req=: +} + + # require_slingshot_dotgitmodules # ------------------------------- # Ensure we have a '.gitmodules' file, with appropriate 'slingshot' settings. diff --git a/build-aux/merge-sections b/build-aux/merge-sections index 2c63f73..382c837 100755 --- a/build-aux/merge-sections +++ b/build-aux/merge-sections @@ -28,8 +28,26 @@ SH=--[[ # -*- mode: lua; -*- ## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ==================================================================== -lua_version_re='"Lua 5."[12]*' -lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +_lua_version_re='"Lua 5."[12]*' +_lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +export LUA_INIT +export LUA_INIT_5_2 +export LUA_PATH +export LUA_CPATH + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi # If LUA is not set, search PATH for something suitable. test -n "$LUA" || { @@ -39,7 +57,7 @@ test -n "$LUA" || { { test -x "$1" && { eval 'case `'$1' -e "print (_VERSION)" 2>/dev/null` in - '"$lua_version_re"') LUA='$1' ;; + '"$_lua_version_re"') LUA='$1' ;; esac' } } @@ -48,7 +66,7 @@ test -n "$LUA" || { save_IFS="$IFS" LUA= - for x in $lua_binaries; do + for x in $_lua_binaries; do IFS=: for dir in $PATH; do IFS="$save_IFS" @@ -66,6 +84,9 @@ test -n "$LUA" || { exit 1 } +LUA_INIT= +LUA_INIT_5_2= + # Reexecute using the interpreter suppiled in LUA, or found above. exec "$LUA" "$0" "$@" ]]SH @@ -111,6 +132,7 @@ and copied to standard output with the sections from read files merged in at the end of identically named sections from standard input. -e PATT REPLACE replace Lua pattern PATT with REPLACE + -v, --verbose verbosely report processing --help print this help, then exit --version print version number, then exit @@ -123,7 +145,7 @@ Report bugs to http://github.com/gvvaughan/slingshot/issues.]]) end prog["--version"] = function () - print [[merge-sections (slingshot) 6 + print [[merge-sections (slingshot) 7 Written by Gary V. Vaughan , 2014 Copyright (C) 2014, Gary V. Vaughan @@ -132,6 +154,12 @@ See source files for individual license conditions.]] os.exit (0) end +prog["--verbose"] = function (arglist, i) + prog.opts.verbose = true + return i +end +prog["-v"] = prog["--verbose"] + prog["-e"] = function (arglist, i) local opt = arglist[i] if i + 2 > #arglist then @@ -179,8 +207,31 @@ if select ("#", ...) < 1 then opterr "no file arguments provided" end + +--[[ ================= ]]-- +--[[ Helper functions. ]]-- +--[[ ================= ]]-- + +-- Print a warning message to standard error. +local function warn (msg) + io.stderr:write (prog.name .. ": warning: " .. msg .. ".\n") +end + + +-- Print a progress message, only if --verbose was given. +local function verbose (msg) + if prog.opts.verbose then + io.stderr:write (prog.name .. ": " .. msg .. "\n") + end +end + + +--[[ ===== ]]-- +--[[ Main. ]]-- +--[[ ===== ]]-- + local header_pattern = "## ([%w%s.]+%.) ##" -local section_pattern = " %-+ ##\n" .. header_pattern .. "\n## %-+ ##\n\n(.-)\n##" +local section_pattern = "%-%- ##\n" .. header_pattern .. "\n## %-+ ##\n\n(.-)\n## %-%-" local sections = {} -- Read sections to merge, from listed filenames. @@ -192,6 +243,7 @@ for _, filename in ipairs (arg) do h:close () s:gsub (section_pattern, function (title, code) + verbose (filename .. ": found " .. (sections[title] and "" or "initial ") .. title) sections[title] = sections[title] or "" sections[title] = sections[title] .. code end) @@ -203,6 +255,7 @@ for line in io.stdin:lines () do if line:match ("^## %-+ ##$") then next_section = not next_section if next_section and in_section and sections[in_section] then + verbose ("stdout: emitting additional code from " .. in_section) print (sections[in_section]) sections[in_section] = nil end @@ -210,6 +263,7 @@ for line in io.stdin:lines () do if next_section and line:match ("^" .. header_pattern .. "$") then in_section = line:gsub (header_pattern, "%1") + verbose ("stdin: changing into section " .. in_section) end for _, e in ipairs (prog.opts.exprs) do @@ -217,3 +271,7 @@ for line in io.stdin:lines () do end print (line) end + +for name in pairs (sections) do + warn ("section '" .. name .. "' was not merged") +end diff --git a/build-aux/mkrockspecs b/build-aux/mkrockspecs index f9bff46..1ce3e85 100755 --- a/build-aux/mkrockspecs +++ b/build-aux/mkrockspecs @@ -28,6 +28,27 @@ SH=--[[ # -*- mode: lua; -*- ## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ==================================================================== + +_lua_version_re='"Lua 5."[12]*' +_lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +export LUA_INIT +export LUA_INIT_5_2 +export LUA_PATH +export LUA_CPATH + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi + # If LUA is not set, search PATH for something suitable. test -n "$LUA" || { # Check that the supplied binary is executable and returns a compatible @@ -35,15 +56,17 @@ test -n "$LUA" || { func_vercheck () { test -x "$1" && { - case `$1 -e 'print (_VERSION)' 2>/dev/null` in - "Lua 5."[12]) LUA=$1 ;; - esac + eval 'case `'$1' -e "print (_VERSION)" 2>/dev/null` in + '"$_lua_version_re"') LUA='$1' ;; + esac' } } + progname=`echo "$0" |${SED-sed} 's|.*/||'` + save_IFS="$IFS" LUA= - for x in lua lua5.2 lua5.1; do + for x in $_lua_binaries; do IFS=: for dir in $PATH; do IFS="$save_IFS" @@ -52,9 +75,18 @@ test -n "$LUA" || { done IFS="$save_IFS" test -n "$LUA" && break + e="${e+$e\n}$progname: command not found on PATH: $x" done } +test -n "$LUA" || { + printf "${e+$e\n}$progname: retry after 'export LUA=/path/to/lua'\n" >&2 + exit 1 +} + +LUA_INIT= +LUA_INIT_5_2= + # Reexecute using the interpreter suppiled in LUA, or found above. exec "$LUA" "$0" "$@" ]]SH @@ -105,6 +137,7 @@ rockspec if the default "-1" revision was released with errors. --help print this help, then exit --version print version number, then exit + -b, --branch=BRANCH make git rockspec use BRANCH -m, --module-dir=ROOT directory of lua-files for builtin build type Report bugs to http://github.com/gvvaughan/slingshot/issues.]]) @@ -112,7 +145,7 @@ Report bugs to http://github.com/gvvaughan/slingshot/issues.]]) end prog["--version"] = function () - print [[mkrockspecs (slingshot) 6 + print [[mkrockspecs (slingshot) 7 Written by Gary V. Vaughan , 2013 Copyright (C) 2013, Gary V. Vaughan @@ -133,6 +166,18 @@ end prog["-m"] = prog["--module-dir"] +prog["--branch"] = function (arglist, i) + local opt = arglist[i] + if i + 1 > #arglist then + opterr ("option '" .. opt .. "' requires an argument") + end + + prog.opts.branch = arglist[i + 1] + return i + 1 +end + +prog["-b"] = prog["--branch"] + local nonopts local i = 0 while i < #arg do @@ -326,8 +371,9 @@ if version ~= "scm" and version ~= "git" then spec.source.dir = package .. "-release-v" .. version else spec.source.url = "git://" .. url .. ".git" - default.build.build_command = "./bootstrap && " .. default.build.build_command + spec.source.branch = prog.opts.branch spec.build.modules = nil + default.build.build_command = "./bootstrap && " .. default.build.build_command end diff --git a/build-aux/specl.mk b/build-aux/specl.mk index 47ab86f..f5ec9fc 100644 --- a/build-aux/specl.mk +++ b/build-aux/specl.mk @@ -4,7 +4,7 @@ # terms of the MIT license reproduced below. # ==================================================================== # -# Copyright (C) 2013-2014 Gary V. Vaughan # +# Copyright (C) 2013-2014 Gary V. Vaughan # # # # Permission is hereby granted, free of charge, to any person # # obtaining a copy of this software and associated documentation # @@ -35,16 +35,7 @@ check_local += specl-check-local specl-check-local: $(specl_SPECS) - @v=`$(SPECL) --version | sed -e 's|^.* ||' -e 1q`; \ - if test "$$v" -lt "$(SPECL_MIN)"; then \ - printf "%s%s\n%s\n" \ - "ERROR: Specl version $$v is too old," \ - " please upgrade to at least version $(SPECL_MIN)," \ - "ERROR: and rerun \`make check\`"; \ - exit 1; \ - else \ - $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS); \ - fi + $(SPECL_ENV) $(SPECL) $(SPECL_OPTS) $(specl_SPECS) ## ------------- ## diff --git a/configure b/configure index cebc48f..e317833 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Slingshot 6. +# Generated by GNU Autoconf 2.69 for Slingshot 7. # # Report bugs to . # @@ -580,17 +580,14 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Slingshot' PACKAGE_TARNAME='slingshot' -PACKAGE_VERSION='6' -PACKAGE_STRING='Slingshot 6' +PACKAGE_VERSION='7' +PACKAGE_STRING='Slingshot 7' PACKAGE_BUGREPORT='http://github.com/gvvaughan/slingshot/issues' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS EXTRA_ROCKS -SPECL_MIN -GENDOC -GENDOC_FALSE SED EGREP GREP @@ -1220,7 +1217,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Slingshot 6 to adapt to many kinds of systems. +\`configure' configures Slingshot 7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1286,7 +1283,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Slingshot 6:";; + short | recursive ) echo "Configuration of Slingshot 7:";; esac cat <<\_ACEOF @@ -1366,7 +1363,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Slingshot configure 6 +Slingshot configure 7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1383,7 +1380,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Slingshot $as_me 6, which was +It was created by Slingshot $as_me 7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1763,7 +1760,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. $as_echo "## ----------------------- ## -## Configuring slingshot 6 ## +## Configuring slingshot 7 ## ## ----------------------- ##" echo @@ -2253,7 +2250,7 @@ fi # Define the identity of the package. PACKAGE='slingshot' - VERSION='6' + VERSION='7' cat >>confdefs.h <<_ACEOF @@ -3070,29 +3067,9 @@ $as_echo "$ac_cv_path_SED" >&6; } - # Luadoc only works with Lua 5.1, and LDoc works better with Lua 5.1 on - # Travis, so must they be installed with care... - GENDOC_FALSE=# - - GENDOC= - - - SPECL_MIN=${SPECL_MIN-"5"} - - - # luarocks requires a separate invocation per luarock, and lyaml # is required by all slingshot clients for mkrockspecs. EXTRA_ROCKS=- for _ss_rock in lyaml specl; do - # Enable associated .travis sections for special rocks. - case $_ss_rock in - luadoc|ldoc) - GENDOC=$_ss_rock - GENDOC_FALSE=- - continue - ;; - esac - case $EXTRA_ROCKS in *" $_ss_rock;"*) ;; # ignore duplicates *) @@ -3666,7 +3643,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Slingshot $as_me 6, which was +This file was extended by Slingshot $as_me 7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3719,7 +3696,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Slingshot config.status 6 +Slingshot config.status 7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 892d839..2993bae 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ dnl along with this program. If not, see . AC_PREREQ([2.68]) dnl Initialise autoconf and automake -AC_INIT([Slingshot], [6], [http://github.com/gvvaughan/slingshot/issues]) +AC_INIT([Slingshot], [7], [http://github.com/gvvaughan/slingshot/issues]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/docs/mkrockspecs.1 b/docs/mkrockspecs.1 index 3c57e93..8571b62 100644 --- a/docs/mkrockspecs.1 +++ b/docs/mkrockspecs.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3. -.TH MKROCKSPECS "1" "January 2014" "mkrockspecs (slingshot) 6" "User Commands" +.TH MKROCKSPECS "1" "January 2014" "mkrockspecs (slingshot) 7" "User Commands" .SH NAME mkrockspecs \- Slingshot .SH SYNOPSIS @@ -22,6 +22,9 @@ print this help, then exit \fB\-\-version\fR print version number, then exit .TP +\fB\-b\fR, \fB\-\-branch\fR=\fIBRANCH\fR +make git rockspec use BRANCH +.TP \fB\-m\fR, \fB\-\-module\-dir\fR=\fIROOT\fR directory of lua\-files for builtin build type .SH AUTHOR diff --git a/local.mk b/local.mk index 28958ee..846dc22 100644 --- a/local.mk +++ b/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -old_NEWS_hash = b7f5ee3470e07fef2c1a882767f9b99b +old_NEWS_hash = 4a4a721668a1516c046d865c7b425586 update_copyright_env = \ UPDATE_COPYRIGHT_HOLDER='(Free Software Foundation, Inc.|Gary V. Vaughan|Reuben Thomas)' \ diff --git a/m4/slingshot.m4 b/m4/slingshot.m4 index afd30ec..541f8f5 100644 --- a/m4/slingshot.m4 +++ b/m4/slingshot.m4 @@ -20,29 +20,9 @@ dnl along with this program. If not, see . # -------------------------- # Generate .travis.yml, ensuring LUAROCKS are installed. AC_DEFUN([SS_CONFIG_TRAVIS], [ - # Luadoc only works with Lua 5.1, and LDoc works better with Lua 5.1 on - # Travis, so must they be installed with care... - GENDOC_FALSE=# - AC_SUBST(GENDOC_FALSE) - GENDOC= - AC_SUBST(GENDOC) - - SPECL_MIN=${SPECL_MIN-"5"} - AC_SUBST([SPECL_MIN]) - - # luarocks requires a separate invocation per luarock, and lyaml # is required by all slingshot clients for mkrockspecs. EXTRA_ROCKS=- for _ss_rock in lyaml $1; do - # Enable associated .travis sections for special rocks. - case $_ss_rock in - luadoc|ldoc) - GENDOC=$_ss_rock - GENDOC_FALSE=- - continue - ;; - esac - case $EXTRA_ROCKS in *" $_ss_rock;"*) ;; # ignore duplicates *) diff --git a/slingshot-6-1.rockspec b/slingshot-6-1.rockspec index dd29d4c..f146456 100644 --- a/slingshot-6-1.rockspec +++ b/slingshot-6-1.rockspec @@ -1,5 +1,5 @@ package = "slingshot" -version = "6-1" +version = "7-1" description = { detailed = "A framework for automatic rockspecs creation and simplified release thereof.", homepage = "http://github.com/gvvaughan/slingshot", @@ -7,8 +7,8 @@ description = { summary = "Slingshot releases rocks!", } source = { - dir = "slingshot-release-v6", - url = "http://github.com/gvvaughan/slingshot/archive/release-v6.zip", + dir = "slingshot-release-v7", + url = "http://github.com/gvvaughan/slingshot/archive/release-v7.zip", } dependencies = { "lua >= 5.1", diff --git a/src/merge-sections.in b/src/merge-sections.in index 7fd4800..b5acca2 100755 --- a/src/merge-sections.in +++ b/src/merge-sections.in @@ -28,8 +28,26 @@ SH=--[[ # -*- mode: lua; -*- ## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ==================================================================== -lua_version_re='"Lua 5."[12]*' -lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +_lua_version_re='"Lua 5."[12]*' +_lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +export LUA_INIT +export LUA_INIT_5_2 +export LUA_PATH +export LUA_CPATH + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi # If LUA is not set, search PATH for something suitable. test -n "$LUA" || { @@ -39,7 +57,7 @@ test -n "$LUA" || { { test -x "$1" && { eval 'case `'$1' -e "print (_VERSION)" 2>/dev/null` in - '"$lua_version_re"') LUA='$1' ;; + '"$_lua_version_re"') LUA='$1' ;; esac' } } @@ -48,7 +66,7 @@ test -n "$LUA" || { save_IFS="$IFS" LUA= - for x in $lua_binaries; do + for x in $_lua_binaries; do IFS=: for dir in $PATH; do IFS="$save_IFS" @@ -66,6 +84,9 @@ test -n "$LUA" || { exit 1 } +LUA_INIT= +LUA_INIT_5_2= + # Reexecute using the interpreter suppiled in LUA, or found above. exec "$LUA" "$0" "$@" ]]SH @@ -111,6 +132,7 @@ and copied to standard output with the sections from read files merged in at the end of identically named sections from standard input. -e PATT REPLACE replace Lua pattern PATT with REPLACE + -v, --verbose verbosely report processing --help print this help, then exit --version print version number, then exit @@ -132,6 +154,12 @@ See source files for individual license conditions.]] os.exit (0) end +prog["--verbose"] = function (arglist, i) + prog.opts.verbose = true + return i +end +prog["-v"] = prog["--verbose"] + prog["-e"] = function (arglist, i) local opt = arglist[i] if i + 2 > #arglist then @@ -179,8 +207,31 @@ if select ("#", ...) < 1 then opterr "no file arguments provided" end + +--[[ ================= ]]-- +--[[ Helper functions. ]]-- +--[[ ================= ]]-- + +-- Print a warning message to standard error. +local function warn (msg) + io.stderr:write (prog.name .. ": warning: " .. msg .. ".\n") +end + + +-- Print a progress message, only if --verbose was given. +local function verbose (msg) + if prog.opts.verbose then + io.stderr:write (prog.name .. ": " .. msg .. "\n") + end +end + + +--[[ ===== ]]-- +--[[ Main. ]]-- +--[[ ===== ]]-- + local header_pattern = "## ([%w%s.]+%.) ##" -local section_pattern = " %-+ ##\n" .. header_pattern .. "\n## %-+ ##\n\n(.-)\n##" +local section_pattern = "%-%- ##\n" .. header_pattern .. "\n## %-+ ##\n\n(.-)\n## %-%-" local sections = {} -- Read sections to merge, from listed filenames. @@ -192,6 +243,7 @@ for _, filename in ipairs (arg) do h:close () s:gsub (section_pattern, function (title, code) + verbose (filename .. ": found " .. (sections[title] and "" or "initial ") .. title) sections[title] = sections[title] or "" sections[title] = sections[title] .. code end) @@ -203,6 +255,7 @@ for line in io.stdin:lines () do if line:match ("^## %-+ ##$") then next_section = not next_section if next_section and in_section and sections[in_section] then + verbose ("stdout: emitting additional code from " .. in_section) print (sections[in_section]) sections[in_section] = nil end @@ -210,6 +263,7 @@ for line in io.stdin:lines () do if next_section and line:match ("^" .. header_pattern .. "$") then in_section = line:gsub (header_pattern, "%1") + verbose ("stdin: changing into section " .. in_section) end for _, e in ipairs (prog.opts.exprs) do @@ -217,3 +271,7 @@ for line in io.stdin:lines () do end print (line) end + +for name in pairs (sections) do + warn ("section '" .. name .. "' was not merged") +end diff --git a/src/mkrockspecs.in b/src/mkrockspecs.in index 68d2fcf..b44e191 100755 --- a/src/mkrockspecs.in +++ b/src/mkrockspecs.in @@ -28,6 +28,27 @@ SH=--[[ # -*- mode: lua; -*- ## WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ## ==================================================================== + +_lua_version_re='"Lua 5."[12]*' +_lua_binaries='lua lua5.2 lua52 lua5.1 lua51' + +export LUA_INIT +export LUA_INIT_5_2 +export LUA_PATH +export LUA_CPATH + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi + # If LUA is not set, search PATH for something suitable. test -n "$LUA" || { # Check that the supplied binary is executable and returns a compatible @@ -35,15 +56,17 @@ test -n "$LUA" || { func_vercheck () { test -x "$1" && { - case `$1 -e 'print (_VERSION)' 2>/dev/null` in - "Lua 5."[12]) LUA=$1 ;; - esac + eval 'case `'$1' -e "print (_VERSION)" 2>/dev/null` in + '"$_lua_version_re"') LUA='$1' ;; + esac' } } + progname=`echo "$0" |${SED-sed} 's|.*/||'` + save_IFS="$IFS" LUA= - for x in lua lua5.2 lua5.1; do + for x in $_lua_binaries; do IFS=: for dir in $PATH; do IFS="$save_IFS" @@ -52,9 +75,18 @@ test -n "$LUA" || { done IFS="$save_IFS" test -n "$LUA" && break + e="${e+$e\n}$progname: command not found on PATH: $x" done } +test -n "$LUA" || { + printf "${e+$e\n}$progname: retry after 'export LUA=/path/to/lua'\n" >&2 + exit 1 +} + +LUA_INIT= +LUA_INIT_5_2= + # Reexecute using the interpreter suppiled in LUA, or found above. exec "$LUA" "$0" "$@" ]]SH @@ -105,6 +137,7 @@ rockspec if the default "-1" revision was released with errors. --help print this help, then exit --version print version number, then exit + -b, --branch=BRANCH make git rockspec use BRANCH -m, --module-dir=ROOT directory of lua-files for builtin build type Report bugs to http://github.com/gvvaughan/slingshot/issues.]]) @@ -133,6 +166,18 @@ end prog["-m"] = prog["--module-dir"] +prog["--branch"] = function (arglist, i) + local opt = arglist[i] + if i + 1 > #arglist then + opterr ("option '" .. opt .. "' requires an argument") + end + + prog.opts.branch = arglist[i + 1] + return i + 1 +end + +prog["-b"] = prog["--branch"] + local nonopts local i = 0 while i < #arg do @@ -326,8 +371,9 @@ if version ~= "scm" and version ~= "git" then spec.source.dir = package .. "-release-v" .. version else spec.source.url = "git://" .. url .. ".git" - default.build.build_command = "./bootstrap && " .. default.build.build_command + spec.source.branch = prog.opts.branch spec.build.modules = nil + default.build.build_command = "./bootstrap && " .. default.build.build_command end diff --git a/travis.yml.in b/travis.yml.in index 0fb136c..602e072 100644 --- a/travis.yml.in +++ b/travis.yml.in @@ -8,8 +8,6 @@ env: - LUAROCKS_CONFIG=build-aux/luarocks-config.lua - LUAROCKS_BASE=luarocks-2.1.1 - LUAROCKS="$LUA $HOME/bin/luarocks" - - GENDOC=luarocks/bin/@GENDOC@ - - SPECL=bin/specl matrix: - LUA=lua5.1 LUA_INCDIR=/usr/include/lua5.1 LUA_SUFFIX=5.1 - LUA=lua5.2 LUA_INCDIR=/usr/include/lua5.2 LUA_SUFFIX=5.2 @@ -17,6 +15,10 @@ env: # Tool setup. install: + # Put back the links for libyaml, which are missing on recent Travis VMs + - test -f /usr/lib/libyaml.so || + sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; + - sudo apt-get install help2man - sudo apt-get install luajit - sudo apt-get install libluajit-5.1-dev @@ -24,40 +26,43 @@ install: - sudo apt-get install liblua5.1-dev - sudo apt-get install lua5.2 - sudo apt-get install liblua5.2-dev - # Put back the links for libyaml, which missing on recent Travis VMs - - test -f /usr/lib/libyaml.so || - sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; - # Luadoc and Ldoc work best on Travis with Lua 5.1. - @GENDOC_FALSE@ sudo apt-get install luarocks - @GENDOC_FALSE@ sudo luarocks install @GENDOC@ - @GENDOC_FALSE@ mkdir -p luarocks/bin - @GENDOC_FALSE@ sed 's|^exec "[^"]*"|exec lua5.1|' `which @GENDOC@` > $GENDOC - @GENDOC_FALSE@ chmod a+rx $GENDOC # Install a recent luarocks release locally for everything else. - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz - tar zxvpf $LUAROCKS_BASE.tar.gz - - cd $LUAROCKS_BASE - - ./configure - --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX - --with-lua-include=$LUA_INCDIR - - make all install - - cd .. + - ( cd $LUAROCKS_BASE; + ./configure + --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX + --with-lua-include=$LUA_INCDIR; + make all install; ) # Configure and build. script: - - ./bootstrap + # Initial bootstrap to build luarocks-config.lua, before we've + # installed our rocks. + - ./bootstrap --skip-rock-checks - ./configure LUA="$LUA" - make $LUAROCKS_CONFIG LUA="$LUA" LUA_INCDIR="$LUA_INCDIR" V=1 || cat $LUAROCKS_CONFIG config.log + # Set Lua and Shell paths up for local luarocks tree. + # this package depends on will be installed. - eval `$LUAROCKS path` - export PATH=`pwd`/luarocks/bin:$PATH + + # Install extra rocks into $LUAROCKS_CONFIG rocks tree. @EXTRA_ROCKS@ + + # Make git rockspec for this @PACKAGE@ - make rockspecs LUAROCKS="$LUAROCKS" V=1 || { $LUAROCKS path; cat $ROCKSPEC; } - # LuaRocks make will fail if dependencies are missing. + + # The git rockspec will rerun bootstrap, and check any rock versions + # in bootstrap.conf:buildreq this time. - $LUAROCKS make $ROCKSPEC LUA="$LUA" - # Use bin/specl if we built it, or else the specl rock we just installed. - - test -f "$SPECL" || SPECL=luarocks/bin/specl; - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" make check SPECL="$SPECL" V=1 + + # Run self-tests in the `luarocks make` build tree. + - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" + LUA_CPATH=`pwd`'/ext/?.so;'"${LUA_CPATH-;}" + LUA_INIT= LUA_INIT_5_2= + make check V=1