Commit b7d82cff authored by Gary V. Vaughan's avatar Gary V. Vaughan

Initial import.

Signed-off-by: 's avatarGary V. Vaughan <gary@gnu.org>
parents
*~
*.o
*.lo
*.la
*.so
*.html
.DS_Store
.deps
.dirstamp
.libs
/release-notes-*
/ChangeLog
/Makefile
/Makefile.in
/NEWS
/aclocal.m4
/autom4te.cache
/config.h.in
/configure
/docs
/config.h
/config.log
/config.lt
/config.status
/libtool
/luarocks-config.lua
/lyaml-*.rockspec
/lyaml-*.tar.gz
/stamp-h1
lyaml Contributors
==================
This file list contributors to lyaml. If you think you should be in
this list, please file an issue on github (run `./configure --help`
for the URL).
* Andrew Danforth <acd@weirdness.net>:
Designed and implemented lyaml.
* Gary V. Vaughan <gary@gnu.org>:
Lua 5.2 compatibility, build system, luarock packaging, releases.
## maintainer rules.
dont-forget-to-bootstrap = $(wildcard Makefile)
ifeq ($(dont-forget-to-bootstrap),)
Makefile: Makefile.in
./configure
$(MAKE)
Makefile.in:
./bootstrap --force --verbose -Wall --skip-git
else
include Makefile
MKROCKSPECS = $(ROCKSPEC_ENV) $(LUA) $(srcdir)/build-aux/mkrockspecs.lua
ROCKSPEC_TEMPLATE = $(srcdir)/lyaml-rockspec.lua
luarocks-config.lua:
$(AM_V_GEN){ \
echo 'rocks_trees = {'; \
echo ' "$(abs_srcdir)/luarocks"'; \
echo '}'; \
} > '$@'
rockspecs: luarocks-config.lua
rm -f *.rockspec
$(MKROCKSPECS) $(PACKAGE) $(VERSION) $(ROCKSPEC_TEMPLATE)
$(MKROCKSPECS) $(PACKAGE) git $(ROCKSPEC_TEMPLATE)
GIT ?= git
tag-release:
$(GIT) diff --exit-code && \
$(GIT) tag -f -a -m "Release tag" v$(VERSION)
define unpack-distcheck-release
rm -rf $(PACKAGE)-$(VERSION)/ && \
tar zxf $(PACKAGE)-$(VERSION).tar.gz && \
cp -a -f $(PACKAGE)-$(VERSION)/* . && \
rm -rf $(PACKAGE)-$(VERSION)/ && \
echo "unpacked $(PACKAGE)-$(VERSION).tar.gz over current directory" && \
echo './configure && make all rockspecs' && \
./configure --version && ./configure && \
$(MAKE) all rockspecs
endef
check-in-release: distcheck
current_branch=`$(GIT) symbolic-ref HEAD`; \
{ $(GIT) checkout -b release 2>/dev/null || $(GIT) checkout release; } && \
{ $(GIT) pull origin release || true; } && \
$(unpack-distcheck-release) && \
$(GIT) add . && \
$(GIT) commit -a -m "Release v$(VERSION)" && \
$(GIT) tag -a -m "Full source release tag" release-v$(VERSION); \
$(GIT) checkout `echo "$$current_branch" | sed 's,.*/,,g'`
## To test the release process without publishing upstream, use:
## make release WOGER=: GIT_PUBLISH=:
GIT_PUBLISH ?= $(GIT)
WOGER ?= woger
WOGER_ENV = LUA_INIT= LUA_PATH='$(abs_srcdir)/?-git-1.rockspec'
WOGER_OUT = $(WOGER_ENV) $(LUA) -l$(PACKAGE) -e
release:
$(MAKE) tag-release && \
$(MAKE) check-in-release && \
$(GIT_PUBLISH) push && $(GIT_PUBLISH) push --tags && \
$(WOGER) lua \
package=$(PACKAGE) \
package_name=$(PACKAGE_NAME) \
version=$(VERSION) \
notes=docs/RELEASE-NOTES-$(VERSION) \
home="`$(WOGER_OUT) 'print (description.homepage)'`" \
description="`$(WOGER_OUT) 'print (description.summary)'`"
endif
# Non-recursive Make rules.
#
# Copyright (C) 2013 Gary V. Vaughan
# Written by Gary V. Vaughan, 2013
#
# 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, 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/>.
## ---------- ##
## Bootstrap. ##
## ---------- ##
ACLOCAL_AMFLAGS = -I m4
## ------------- ##
## Declarations. ##
## ------------- ##
lib_LTLIBRARIES = lyaml.la
lyaml_la_LDFLAGS = -module -avoid-version
lyaml_la_CPPFLAGS = $(LUA_INCLUDE) $(YAML_INCLUDE)
EXTRA_DIST = lua52compat.h
## ------------- ##
## Distribution. ##
## ------------- ##
gitlog_to_changelog = $(srcdir)/build-aux/gitlog-to-changelog
dist-hook: ChangeLog
ChangeLog: FORCE
$(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
$(gitlog_to_changelog) > '$@T'; \
rm -f '$@'; mv '$@T' '$@'; \
fi
EXTRA_DIST += \
GNUmakefile \
lyaml-rockspec.lua
## ------------ ##
## Maintenance. ##
## ------------ ##
FORCE:
lyaml
=====
LibYAML binding for [Lua][].
1. Usage
--------
local lyaml = require "lyaml"
local ok = lyaml.configure (OPTION-NAME, BOOLEAN)
local t = lyaml.load (FILENAME)
local yamlstr = lyaml.dump (LUA-TABLE)
local null = lyaml.null ()
The configure function allows enabling and disabling of the following
options:
* `dump_auto_array`
* `dump_check_metatables`
* `dump_error_on_unsupported`
* `load_set_metatables`
* `load_numeric_scalars`
* `load_nulls_as_nil`
2. Instalation
--------------
./configure --prefix=INSTALLATION-ROOT-DIRECTORY
make all install
or:
make
make rockspecs
luarocks make lyaml-git-1.rockspec
This source diff could not be displayed because it is too large. You can view the blob instead.
# bootstrap.conf (Specl) version 2013-02-24
#
# Copyright (C) 2013 Gary V. Vaughan
# Written by Gary V. Vaughan, 2013
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# 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 GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## -------------- ##
## Configuration. ##
## -------------- ##
# List of programs, minimum versions, and software urls required to
# bootstrap, maintain and release GNU Zile.
# Build prerequisites
buildreq='
git 1.5.5 http://git-scm.com
tar - http://www.gnu.org/s/tar
'
# No need to do any gnulib-tooling here.
gnulib_tool=true
# The not-synced with gnulib warning is bogus until upstream adopts
# the saner bootstrap script.
require_bootstrap_uptodate=:
## --------------- ##
## Hook functions. ##
## --------------- ##
# lyaml_force_changelog
# ---------------------
# Automake requires that ChangeLog exist.
lyaml_force_changelog ()
{
$debug_cmd
echo "Autogenerated by 'make dist'" > ChangeLog || exit 1
}
func_add_hook func_gnulib_tool lyaml_force_changelog
# Local variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "# bootstrap.conf (Specl) version "
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "$"
# End:
/ar-lib
/config.guess
/config.sub
/depcomp
/install-sh
/ltmain.sh
/missing
/speclc
-- Generate rockspecs from a prototype with variants
require "std"
if select ("#", ...) < 2 then
io.stderr:write "Usage: mkrockspecs PACKAGE VERSION TEMPLATE\n"
os.exit ()
end
package_name = select (1, ...)
version = select (2, ...)
template = select (3, ...)
function format (x, indent)
indent = indent or ""
if type (x) == "table" then
local s = "{\n"
for i, v in pairs (x) do
if type (i) ~= "number" then
s = s..indent..i.." = "..format (v, indent.." ")..",\n"
end
end
for i, v in ipairs (x) do
s = s..indent..format (v, indent.." ")..",\n"
end
return s..indent:sub (1, -3).."}"
elseif type (x) == "string" then
return string.format ("%q", x)
else
return tostring (x)
end
end
local settings = loadfile (template) ()
local qualified_version = settings.default.version
for f, spec in pairs (settings) do
if f ~= "default" then
local specfile = package_name.."-"..(f ~= "" and f:lower ().."-" or "")..qualified_version..".rockspec"
io.stderr:write ("specfile = "..specfile.."\n")
h = io.open (specfile, "w")
assert (h)
flavour = f -- a global, visible in loadfile
local specs = loadfile (template) () -- reload to get current flavour interpolated
local spec = tree.merge (tree.new (specs.default), tree.new (specs[f]))
local s = ""
for i, v in pairs (spec) do
s = s..i.." = "..format (v, " ").."\n"
end
h:write (s)
h:close ()
os.execute ("luarocks lint " .. specfile)
end
end
dnl configure.ac
dnl
dnl Copyright (c) 2013 Free Software Foundation, Inc.
dnl Written by Gary V. Vaughan, 2013
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published
dnl by the Free Software Foundation; either version 3, or (at your
dnl option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.69])
dnl Initialise autoconf and automake
AC_INIT([lyaml], [1], [http://github.com/gvvaughan/lyaml/issues])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])
echo
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl required by automake 1.12.x, not available in 1.10.x
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_PREREQ([2.4.2])
LT_INIT([disable-static])
module=yes eval shrext=$shrext_cmds
AC_SUBST([objdir])
AC_SUBST([shrext])
AC_SUBST(LIBTOOL_DEPS)
dnl Check for programs
AC_PROG_CC
AX_PROG_LUA(5.1, 5.3)
AX_LUA_HEADERS
dnl Check for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([yaml.h])
dnl Search libs
AC_SEARCH_LIBS([yaml_document_initialize], [yaml], [], [
AC_MSG_ERROR([Required library 'yaml' could not be found])])
dnl Generate output files
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
/*
* Lua 5.2 compatibility
* (c) Reuben Thomas (maintainer) <rrt@sc3d.org> 2010-2012
* This file is in the public domain.
*
* Include this file after Lua headers
*/
#if LUA_VERSION_NUM == 502
static int luaL_typerror(lua_State *L, int narg, const char *tname)
{
const char *msg = lua_pushfstring(L, "%s expected, got %s",
tname, luaL_typename(L, narg));
return luaL_argerror(L, narg, msg);
}
#define lua_objlen lua_rawlen
#define lua_strlen lua_rawlen
#define luaL_getn luaL_len
#define luaL_openlib(L,n,l,nup) luaL_setfuncs((L),(l),(nup))
#define luaL_register(L,n,l) (luaL_newlib(L,l))
#endif
-- lyaml rockspec data
-- Variables to be interpolated:
--
-- package
-- version
local default = {
package = package_name,
version = version.."-1",
source = {
url = "http://github.com/gvvaughan/"..package_name.."/archive/release-v"..version..".zip",
dir = package_name.."-release-v"..version,
},
description = {
summary = "libYAML binding for Lua",
detailed = [[
Read and write YAML format files with Lua.
]],
homepage = "http://github.com/gvvaughan/"..package_name.."/",
license = "GPLv3+",
},
dependencies = {
"lua >= 5.1",
},
external_dependencies = {
YAML = { library = "yaml" }
},
build = {
type = "command",
build_command = "LUA=$(LUA) LUA_INCLUDE=-I$(LUA_INCDIR) " ..
"./configure CPPFLAGS=-I$(YAML_INCDIR) LDFLAGS='-L$(YAML_LIBDIR)' " ..
"--prefix=$(PREFIX) --libdir=$(LIBDIR) --datadir=$(LUADIR) " ..
"&& make clean && make",
install_command = "make install",
copy_directories = {},
},
}
if version == "git" then
default.build.build_command = "./bootstrap && " .. default.build.build_command
end
return {default=default, [""]={}}
This diff is collapsed.
/libtool.m4
/ltoptions.m4
/ltsugar.m4
/ltversion.m4
/lt~obsolete.m4
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
#
# DESCRIPTION
#
# This macro compares two version strings. Due to the various number of
# minor-version numbers that can exist, and the fact that string
# comparisons are not compatible with numeric comparisons, this is not
# necessarily trivial to do in a autoconf script. This macro makes doing
# these comparisons easy.
#
# The six basic comparisons are available, as well as checking equality
# limited to a certain number of minor-version levels.
#
# The operator OP determines what type of comparison to do, and can be one
# of:
#
# eq - equal (test A == B)
# ne - not equal (test A != B)
# le - less than or equal (test A <= B)
# ge - greater than or equal (test A >= B)
# lt - less than (test A < B)
# gt - greater than (test A > B)
#
# Additionally, the eq and ne operator can have a number after it to limit
# the test to that number of minor versions.
#
# eq0 - equal up to the length of the shorter version
# ne0 - not equal up to the length of the shorter version
# eqN - equal up to N sub-version levels
# neN - not equal up to N sub-version levels
#
# When the condition is true, shell commands ACTION-IF-TRUE are run,
# otherwise shell commands ACTION-IF-FALSE are run. The environment
# variable 'ax_compare_version' is always set to either 'true' or 'false'
# as well.
#
# Examples:
#
# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
#
# would both be true.
#
# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
#
# would both be false.
#
# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
#
# would be true because it is only comparing two minor versions.
#
# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
#
# would be true because it is only comparing the lesser number of minor
# versions of the two values.
#
# Note: The characters that separate the version numbers do not matter. An
# empty string is the same as version 0. OP is evaluated by autoconf, not
# configure, so must be a string, not a variable.
#
# The author would like to acknowledge Guido Draheim whose advice about
# the m4_case and m4_ifvaln functions make this macro only include the
# portions necessary to perform the specific comparison specified by the
# OP argument in the final configure script.
#
# LICENSE
#
# Copyright (c) 2008 Tim Toolan <toolan@ele.uri.edu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 11
dnl #########################################################################
AC_DEFUN([AX_COMPARE_VERSION], [
AC_REQUIRE([AC_PROG_AWK])
# Used to indicate true or false condition
ax_compare_version=false
# Convert the two version strings to be compared into a format that
# allows a simple string comparison. The end result is that a version
# string of the form 1.12.5-r617 will be converted to the form
# 0001001200050617. In other words, each number is zero padded to four
# digits, and non digits are removed.
AS_VAR_PUSHDEF([A],[ax_compare_version_A])
A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
AS_VAR_PUSHDEF([B],[ax_compare_version_B])
B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
-e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
-e 's/[[^0-9]]//g'`
dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
dnl # then the first line is used to determine if the condition is true.
dnl # The sed right after the echo is to remove any indented white space.
m4_case(m4_tolower($2),
[lt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[gt],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
],
[le],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],
[ge],[
ax_compare_version=`echo "x$A
x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
],[
dnl Split the operator from the subversion count if present.
m4_bmatch(m4_substr($2,2),
[0],[
# A count of zero means use the length of the shorter version.
# Determine the number of characters in A and B.
ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
# Set A to no more than B's length and B to no more than A's length.
A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
],
[[0-9]+],[
# A count greater than zero means use only that many subversions
A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
],
[.+],[
AC_WARNING(
[illegal OP numeric parameter: $2])
],[])
# Pad zeros at end of numbers to make same length.
ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
B="$B`echo $A | sed 's/./0/g'`"
A="$ax_compare_version_tmp_A"
# Check for equality or inequality as necessary.
m4_case(m4_tolower(m4_substr($2,0,2)),
[eq],[
test "x$A" = "x$B" && ax_compare_version=true
],
[ne],[
test "x$A" != "x$B" && ax_compare_version=true
],[
AC_WARNING([illegal OP parameter: $2])
])
])
AS_VAR_POPDEF([A])dnl
AS_VAR_POPDEF([B])dnl
dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
if test "$ax_compare_version" = "true" ; then
m4_ifvaln([$4],[$4],[:])dnl
m4_ifvaln([$5],[else $5])dnl
fi
]) dnl AX_COMPARE_VERSION
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment