diff --git a/bindings/Config.in b/bindings/Config.in index bf916b13d..12a696ba8 100644 --- a/bindings/Config.in +++ b/bindings/Config.in @@ -86,4 +86,20 @@ config CONFIG_PERL_LIB default "perl58.lib" endmenu +config CONFIG_LUA_BINDINGS + bool "Create Lua bindings" + default n + depends on CONFIG_BINDINGS && !CONFIG_PLATFORM_WIN32 + help + Build Lua bindings (see www.lua.org). + +menu "Lua Home" +depends on CONFIG_LUA_BINDINGS +config CONFIG_LUA_CORE + string "Location of Lua CORE" + default "/usr/local" + help: + If the Lua exists on another directory then this needs to be changed +endmenu + endmenu diff --git a/bindings/Makefile b/bindings/Makefile index 19c896d2c..887415943 100644 --- a/bindings/Makefile +++ b/bindings/Makefile @@ -37,6 +37,10 @@ ifdef CONFIG_PERL_BINDINGS all: perl/axTLSp_wrap.c endif +ifdef CONFIG_LUA_BINDINGS +all: lua/axTLSl_wrap.c +endif + csharp/axInterface.cs: ../ssl/ssl.h @perl ./generate_interface.pl -csharp @@ -55,9 +59,16 @@ perl/axTLSp.i: ../ssl/ssl.h perl/axTLSp_wrap.c: perl/axTLSp.i @cd perl; swig -perl5 axTLSp.i; $(MAKE) +lua/axTLSl.i: ../ssl/ssl.h + @perl ./generate_SWIG_interface.pl -lua + +lua/axTLSl_wrap.c: lua/axTLSl.i + @cd lua; swig -lua axTLSl.i; $(MAKE) + clean:: $(MAKE) -C csharp clean $(MAKE) -C vbnet clean $(MAKE) -C java clean $(MAKE) -C perl clean + $(MAKE) -C lua clean diff --git a/bindings/generate_SWIG_interface.pl b/bindings/generate_SWIG_interface.pl index c5a7916b7..e21873d5b 100755 --- a/bindings/generate_SWIG_interface.pl +++ b/bindings/generate_SWIG_interface.pl @@ -121,10 +121,16 @@ elsif ($ARGV[0] eq "-perl") $module = "axtlsp"; $interfaceFile = "perl/axTLSp.i"; } +elsif ($ARGV[0] eq "-lua") +{ + print "Generating lua interface file\n"; + $module = "axtlsl"; + $interfaceFile = "lua/axTLSl.i"; +} else { ouch: - die "Usage: $0 [-java | -perl]\n"; + die "Usage: $0 [-java | -perl | -lua]\n"; } # Input file required to generate SWIG interface file. @@ -313,6 +319,10 @@ JNIEXPORT jint JNICALL Java_axTLSj_axtlsjJNI_getFd(JNIEnv *env, jclass jcls, job #endif +/* Some SWIG magic to make the API a bit more Lua friendly */ +#ifdef SWIGLUA +#endif + END # Initialise loop variables diff --git a/bindings/lua/Makefile b/bindings/lua/Makefile new file mode 100644 index 000000000..771c1acb8 --- /dev/null +++ b/bindings/lua/Makefile @@ -0,0 +1,55 @@ +# +# Copyright(C) 2007 Cameron Rich +# +# 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 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +include ../../config/.config +include ../../config/makefile.conf + +all: lib + +ifdef CONFIG_PLATFORM_WIN32 +TARGET=../../$(STAGE)/axtlsl.dll +else +TARGET=../../$(STAGE)/libaxtlsl.so +endif + +ifneq ($(MAKECMDGOALS), clean) + +lib: $(TARGET) +AXTLS_HOME=../.. +SSL_HOME=$(AXTLS_HOME)/ssl +CONFIG_HOME=$(AXTLS_HOME)/config +OBJ:=axTLSl_wrap.o +include ../../config/makefile.post + +$(TARGET) : $(OBJ) + $(LD) $(LDFLAGS) -L ../../$(STAGE) -L $(CONFIG_LUA_CORE)/lib $(LDSHARED) -o $@ $(OBJ) -laxtls -llua +ifdef CONFIG_PLATFORM_CYGWIN + cd ../../$(STAGE); ln -sf $(notdir $@) axtlsl.dll +endif + +CFLAGS += -I$(CONFIG_HOME) -I$(SSL_HOME) -I $(CONFIG_LUA_CORE)/include +else +CFLAGS += /I"`cygpath -w $(CONFIG_HOME)`" /I"`cygpath -w $(SSL_HOME)`" /I"`cygpath -w $(CONFIG_LUA_CORE)/include`" +LDFLAGS += axtls.lib /libpath:"../../$(STAGE)" + +$(TARGET) : $(OBJ) + $(LD) $(LDFLAGS) $(LDSHARED) /out:$@ $(OBJ) +endif # WIN32 + +clean:: + @rm -f $(TARGET) *.i axTLSl* .depend