dev-util/bam: initial import of version 0.4.0

Change-Id: I47700ffab5ccbf16948ddf9a96092b95755325d5
Reviewed-on: https://galileo.mailstation.de/gerrit/6100
Reviewed-by: Jenkins <wk@mailstation.de>
Reviewed-by: Julian Ospald <hasufell@posteo.de>
This commit is contained in:
Julian Ospald 2016-05-19 20:07:37 +02:00
parent 85ed03323a
commit e8ff20f208
3 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,67 @@
# Copyright 2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2
require lua [ multibuild=false whitelist="5.1" ]
require github [ user=matricks suffix=tar.gz ]
SUMMARY="Fast and flexible Lua-based build system"
LICENCES="ZLIB"
SLOT="0"
PLATFORMS="~amd64 ~x86"
MYOPTIONS=""
DEPENDENCIES="
test:
dev-lang/python:2.7
"
BUGS_TO="hasufell@posteo.de"
DEFAULT_SRC_PREPARE_PATCHES=(
"${FILES}"/${PNV}-fix-tests.patch
"${FILES}"/${PNV}-Add-Makefile.patch
)
DEFAULT_SRC_INSTALL_PARAMS=(
INSTALL_BINDIR="/usr/$(exhost --target)/bin"
)
src_compile() {
emake \
LUA_LIBS="$(${PKG_CONFIG} --libs lua-$(lua_get_abi))" \
LUA_CFLAGS="$(${PKG_CONFIG} --cflags lua-$(lua_get_abi))"
}
src_test() {
# don't ask
# https://github.com/matricks/bam/issues/93
local i
for i in tests/*/bam.lua ; do
edo sed -i -e "/^s = NewSettings/a s.optimize = 0\n\
s.cc.exe_c = \"${CC}\"\n\
s.cc.exe_cxx = \"${CXX}\"\n\
s.cc.flags_c:Add(\"${CFLAGS}\")\n\
s.cc.flags_cxx:Add(\"${CXXFLAGS}\")\n\
s.link.exe = \"${CXX}\"\n\
s.link.flags:Add(\"${LDFLAGS}\")\n\
s.dll.exe = \"${CXX}\"\n\
s.lib.exe = \"${AR}\"" \
-e "/^settings = NewSettings/a settings.optimize = 0\n\
settings.cc.exe_c = \"${CC}\"\n\
settings.cc.exe_cxx = \"${CXX}\"\n\
settings.cc.flags_c:Add(\"${CFLAGS}\")\n\
settings.cc.flags_cxx:Add(\"${CXXFLAGS}\")\n\
settings.link.exe = \"${CXX}\"\n\
settings.link.flags:Add(\"${LDFLAGS}\")\n\
settings.dll.exe = \"${CXX}\"\n\
settings.lib.exe = \"${AR}\"\n" ${i}
done
emake \
LUA_LIBS="$(${PKG_CONFIG} --libs lua-$(lua_get_abi))" \
LUA_CFLAGS="$(${PKG_CONFIG} --cflags lua-$(lua_get_abi))" \
PYTHON="python2.7" \
test
}

View File

@ -0,0 +1,71 @@
From c74e0bde7033139427bc2812c6ee0f68d6e15962 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Thu, 19 May 2016 17:32:16 +0200
Subject: [PATCH] Add Makefile
Upstram: pending, https://github.com/matricks/bam/pull/92
This is needed to package bam correctly in linux distributions.
The current shell script is insufficient and doesn't give enough control.
---
Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 Makefile
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4eace57
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+# install directories
+INSTALL_PREFIX = /usr
+INSTALL_BINDIR = $(INSTALL_PREFIX)/bin
+
+
+# toolchain
+PKG_CONFIG ?= pkg-config
+PYTHON ?= python
+
+
+# flags
+LUA_LIBS := $(shell $(PKG_CONFIG) --libs lua 2>/dev/null || echo "-llua")
+LIBS += -lm -lpthread $(LUA_LIBS) -ldl
+LUA_CFLAGS := $(shell $(PKG_CONFIG) --cflags lua 2>/dev/null || echo "-I/usr/include/lua")
+CFLAGS += $(LUA_CFLAGS)
+
+
+# objects
+TARGETS = txt2c internal_base bam
+BAM_OBJ = $(patsubst %.c,%.o,$(wildcard src/*.c))
+TXT2C_LUA = $(wildcard src/*.lua)
+
+
+# make rules
+all: $(TARGETS)
+
+txt2c: src/tools/txt2c
+
+internal_base: src/internal_base.h
+
+src/internal_base.h:
+ src/tools/txt2c $(TXT2C_LUA) > src/internal_base.h
+
+bam: txt2c internal_base $(BAM_OBJ)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BAM_OBJ) $(LIBS)
+
+test: $(TARGETS)
+ $(PYTHON) scripts/test.py
+
+install: bam
+ install -d "$(DESTDIR)$(INSTALL_BINDIR)"
+ install -m755 bam "$(DESTDIR)$(INSTALL_BINDIR)"/bam
+
+clean:
+ rm -f $(BAM_OBJ) $(TARGETS) src/internal_base.h src/tools/txt2c
+
+
+.PHONY: all test install clean
+
--
2.8.1

View File

@ -0,0 +1,23 @@
From 4b186524ba0b9956147e040a006c9805aec20678 Mon Sep 17 00:00:00 2001
From: Magnus Auvinen <magnus.auvinen@gmail.com>
Date: Mon, 2 May 2011 19:18:53 +0200
Subject: [PATCH] fixed so that test.py exits with errors codes (thanks to
debfx)
---
scripts/test.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/test.py b/scripts/test.py
index 078e633..90b9b26 100755
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -246,6 +246,8 @@ def __init__(self):
print "FAILED TESTS:"
for t in failed_tests:
print "\t"+t
+ sys.exit(1)
else:
print "ALL TESTS PASSED!"
+ sys.exit(0)