tolua, new recipe (#7003)

This commit is contained in:
Schrijvers Luc
2022-06-26 08:00:05 +02:00
committed by GitHub
parent 492d82a0ae
commit 73229ef498
3 changed files with 301 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
From 4aa7c35b1a528adef0ab93685d91feea02c444e4 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 23 Jun 2022 14:30:28 +0200
Subject: tolua, import patches from openSUSE
diff --git a/Makefile b/Makefile
index 2d5f6af..0e25252 100755
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,16 @@
# makefile for tolua hierarchy
+MAJOR = 5
+MINOR = 2
+REL = 4
+VERSION = $(MAJOR).$(MINOR).$(REL)
+
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+LIB = lib
+LIBDIR = $(PREFIX)/$(LIB)
+INCLUDEDIR = $(PREFIX)/include
+
tolua:
cd src/lib; make all
cd src/bin; make all
@@ -7,6 +18,18 @@ tolua:
tests:
cd src/tests; make all
+install:
+ mkdir -p $(BINDIR)
+ mkdir -p $(INCLUDEDIR)
+ mkdir -p $(LIBDIR)
+ install -m 0644 bin/tolua $(BINDIR)
+ install -m 0644 include/tolua.h $(INCLUDEDIR)
+ install -m 0644 lib/libtolua.a $(LIBDIR)
+ install -m 0644 lib/libtolua.so.$(VERSION) $(LIBDIR)
+ ln -sf libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so.$(MAJOR).$(MINOR)
+ ln -sf libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so.$(MAJOR)
+ ln -sf libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so
+
all clean klean:
cd src/lib; make $@
cd src/bin; make $@
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 4731778..9db4861 100755
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -17,16 +17,16 @@ T_D = $(TOLUA)/bin/tolua_lua
all: $(T)
$(T): $(OBJS)
- $(CC) -o $@ $(OBJS) $(LIB) -ltolua -llua -lm
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIB) -ltolua -llua -lm
toluabind.c: $(T_D)
$(T_D) -o toluabind.c tolua.pkg
$(T_D): $(OBJS_D)
- $(CC) -o $@ $(OBJS_D) $(LIB) -ltolua -llua -lm
+ $(CC) $(CFLAGS) -o $@ $(OBJS_D) $(LIB) -ltolua -llua -lm
tolua_lua.o: tolua.c
- $(CC) -c -DLUA_SOURCE $(INC) -o $@ $<
+ $(CC) $(CFLAGS) -c -DLUA_SOURCE $(INC) -o $@ $<
clean:
rm -f tolua_lua.o $(OBJS) -$(OBJS_D) $(T) $(T_D)
diff --git a/src/lib/Makefile b/src/lib/Makefile
index b2091f3..5d66a69 100755
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -11,17 +11,26 @@ OBJS= \
tolua_push.o \
tolua_to.o
+MAJOR = 5
+MINOR = 2
+REL = 4
+VERSION = $(MAJOR).$(MINOR).$(REL)
+
T= $(TOLUA)/lib/libtolua.a
+T_S = $(TOLUA)/lib/libtolua.so.$(VERSION)
-all: $T
+all: $T $(T_S)
$T: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
+$(T_S): $(OBJS)
+ $(CC) -shared -Wl,-soname,libtolua.so.$(MAJOR) $^ -o $@
+
clean:
- rm -f $(OBJS)
-
+ rm -f $(OBJS)
+
klean:
rm -f $T
--
2.36.1

View File

@@ -0,0 +1,106 @@
From f4414319686b3119dca3678c4dba23e407bbe354 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 23 Jun 2022 14:30:28 +0200
Subject: tolua, import patches from openSUSE
diff --git a/Makefile b/Makefile
index 2d5f6af..a2fcb89 100755
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,16 @@
# makefile for tolua hierarchy
+MAJOR = 5
+MINOR = 2
+REL = 4
+VERSION = $(MAJOR).$(MINOR).$(REL)
+
+PREFIX = /usr
+BINDIR = $(PREFIX)/bin
+LIB = lib
+LIBDIR = $(PREFIX)/$(LIB)
+INCLUDEDIR = $(PREFIX)/include
+
tolua:
cd src/lib; make all
cd src/bin; make all
@@ -7,6 +18,17 @@ tolua:
tests:
cd src/tests; make all
+install:
+ mkdir -p $(BINDIR)
+ mkdir -p $(INCLUDEDIR)
+ mkdir -p $(LIBDIR)
+ install -m 0644 bin/tolua $(BINDIR)
+ install -m 0644 include/tolua.h $(INCLUDEDIR)
+ install -m 0644 lib/libtolua.so.$(VERSION) $(LIBDIR)
+ ln -sf $(PREFIX)$(LIB)/libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so.$(MAJOR).$(MINOR)
+ ln -sf $(PREFIX)$(LIB)/libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so.$(MAJOR)
+ ln -sf $(PREFIX)$(LIB)/libtolua.so.$(VERSION) $(LIBDIR)/libtolua.so
+
all clean klean:
cd src/lib; make $@
cd src/bin; make $@
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 4731778..9db4861 100755
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -17,16 +17,16 @@ T_D = $(TOLUA)/bin/tolua_lua
all: $(T)
$(T): $(OBJS)
- $(CC) -o $@ $(OBJS) $(LIB) -ltolua -llua -lm
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIB) -ltolua -llua -lm
toluabind.c: $(T_D)
$(T_D) -o toluabind.c tolua.pkg
$(T_D): $(OBJS_D)
- $(CC) -o $@ $(OBJS_D) $(LIB) -ltolua -llua -lm
+ $(CC) $(CFLAGS) -o $@ $(OBJS_D) $(LIB) -ltolua -llua -lm
tolua_lua.o: tolua.c
- $(CC) -c -DLUA_SOURCE $(INC) -o $@ $<
+ $(CC) $(CFLAGS) -c -DLUA_SOURCE $(INC) -o $@ $<
clean:
rm -f tolua_lua.o $(OBJS) -$(OBJS_D) $(T) $(T_D)
diff --git a/src/lib/Makefile b/src/lib/Makefile
index b2091f3..5d66a69 100755
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -11,17 +11,26 @@ OBJS= \
tolua_push.o \
tolua_to.o
+MAJOR = 5
+MINOR = 2
+REL = 4
+VERSION = $(MAJOR).$(MINOR).$(REL)
+
T= $(TOLUA)/lib/libtolua.a
+T_S = $(TOLUA)/lib/libtolua.so.$(VERSION)
-all: $T
+all: $T $(T_S)
$T: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
+$(T_S): $(OBJS)
+ $(CC) -shared -Wl,-soname,libtolua.so.$(MAJOR) $^ -o $@
+
clean:
- rm -f $(OBJS)
-
+ rm -f $(OBJS)
+
klean:
rm -f $T
--
2.36.1

View File

@@ -0,0 +1,88 @@
SUMMARY="Greatly simplifies the integration of C/C++ code with Lua"
DESCRIPTION="tolua is a tool that greatly simplifies the integration of C/C++ code with Lua.
Based on a 'cleaned' header file, tolua automatically generates the binding code to access C/C++ \
features from Lua.
Using Lua API and tag method facilities, the current version automatically maps C/C++ constants, \
external variables, functions, namespace, classes, and methods to Lua. It also provides \
facilities to create Lua modules."
HOMEPAGE="https://web.tecgraf.puc-rio.br/~celes/tolua/"
COPYRIGHT="2015 Waldemar Celes"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://web.tecgraf.puc-rio.br/~celes/tolua/tolua-5.2.4.tar.gz"
CHECKSUM_SHA256="c5a6b701b3ced9a66e7a9881c9d94430f8612040827650abe1aa3c5c3fc95bf2"
PATCHES="tolua-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
tolua$secondaryArchSuffix = $portVersion
cmd:tolua
lib:libtolua$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
lib:liblua$secondaryArchSuffix
"
PROVIDES_devel="
tolua${secondaryArchSuffix}_devel = $portVersion
devel:libtolua$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
tolua$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:liblua$secondaryArchSuffix >= 5.3
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
defineDebugInfoPackage tolua$secondaryArchSuffix \
$prefix/bin/tolua \
$libDir/libtolua.so.$libVersion
BUILD()
{
make LUAINC=$(finddir B_SYSTEM_HEADERS_DIRECTORY)$secondaryArchSubDir/lua53/ \
LUALIB=$(finddir B_SYSTEM_LIB_DIRECTORY)$secondaryArchSubDir
}
INSTALL()
{
make PREFIX=$prefix \
INCLUDEDIR=$includeDir \
LIBDIR=$libDir install
# Add pkgconfig file
mkdir -p $developLibDir/pkgconfig
cat > $developLibDir/pkgconfig/tolua.pc << EOF
bindir=$prefix/bin
exec_prefix=$prefix
libdir=$libDir
includedir=$includeDir
Name: libtolua
Description: $SUMMARY
Version: $portVersion
Libs: -L$developLibDir -ltolua
Cflags: -I$includeDir
EOF
prepareInstalledDevelLib libtolua
fixPkgconfig
packageEntries devel \
$developDir
}