Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,15 @@

# Debug files
*.dSYM/

iOS/build
Plugins/
iOS/tolua.xcodeproj/xcuserdata
iOS/tolua.xcodeproj/project.xcworkspace
iOS/DerivedData
tags
macnojit/build
macnojit/DerivedData
DerivedData
xcuserdata
lua/build
Binary file removed Plugins/Android/libs/armeabi-v7a/libtolua.so
Binary file not shown.
Binary file removed Plugins/Android/libs/x86/libtolua.so
Binary file not shown.
Binary file removed Plugins/iOS/libtolua.a
Binary file not shown.
64 changes: 0 additions & 64 deletions Plugins/tolua.bundle/Contents/Info.plist

This file was deleted.

Binary file removed Plugins/tolua.bundle/Contents/MacOS/tolua
Binary file not shown.
Binary file removed Plugins/x86/tolua.dll
Binary file not shown.
Binary file removed Plugins/x86_64/tolua.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
**
** [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
*/

#if !defined(LUA_LJDIR)
#define LUA_BITOP_VERSION "1.0.2"

#define LUA_LIB
Expand Down Expand Up @@ -186,4 +186,4 @@ LUALIB_API int luaopen_bit(lua_State *L)
#endif
return 1;
}

#endif // #if !defined(LUA_LJDIR) && LUA_VERSION_NUM==501
75 changes: 54 additions & 21 deletions build_ios.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
#!/usr/bin/env bash

LUALIB="${1:-luajit}"
set -e
set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LIPO="xcrun -sdk iphoneos lipo"
STRIP="xcrun -sdk iphoneos strip"
LIBTOOL="xcrun -sdk iphoneos libtool"

SRCDIR=$DIR/luajit-2.1/
JITSRCDIR=$DIR/luajit-2.1/
LUASRCDIR=$DIR/lua
DESTDIR=$DIR/iOS
IXCODE=`xcode-select -print-path`
ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer
ISDKD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/
ISDKVER=iPhoneOS.sdk
ISDKP=$IXCODE/usr/bin/

ISDKSim=$IXCODE/Platforms/iPhoneSimulator.platform/Developer
ISDKVERSim=iPhoneSimulator.sdk

ISDKFCom="-miphoneos-version-min=7.0 -fembed-bitcode -DLJ_NO_SYSTEM=1"

if [ ! -e $ISDKP/ar ]; then
sudo cp $ISDKD/usr/bin/ar $ISDKP
fi
Expand All @@ -23,28 +34,50 @@ if [ ! -e $ISDKP/strip ]; then
sudo cp $ISDKD/usr/bin/strip $ISDKP
fi

rm "$DESTDIR"/*.a
cd $SRCDIR
rm -f "$DESTDIR"/*.a

make clean
ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER -miphoneos-version-min=8.0 -fembed-bitcode"
make HOST_CC="gcc -m32" TARGET_FLAGS="$ISDKF" TARGET=armv7 TARGET_SYS=iOS BUILDMODE=static
mv "$SRCDIR"/src/libluajit.a "$DESTDIR"/libluajit-armv7.a
if [ $LUALIB = 'lua' ]
then
cd $LUASRCDIR
xcodebuild clean
xcodebuild -configuration Release
mv $LUASRCDIR/build/Release-iphoneos/liblua.a $DESTDIR/lib$LUALIB.a
else
cd $JITSRCDIR
make clean
ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER $ISDKFCom"
make HOST_CC="gcc -m32" TARGET_FLAGS="$ISDKF" TARGET=armv7 TARGET_SYS=iOS BUILDMODE=static
mv "$JITSRCDIR"/src/lib$LUALIB.a "$DESTDIR"/lib$LUALIB-armv7.a

make clean
ISDKF="-arch armv7s -isysroot $ISDK/SDKs/$ISDKVER -miphoneos-version-min=8.0 -fembed-bitcode"
make HOST_CC="gcc -m32" TARGET_FLAGS="$ISDKF" TARGET=armv7s TARGET_SYS=iOS BUILDMODE=static
mv "$SRCDIR"/src/libluajit.a "$DESTDIR"/libluajit-armv7s.a
make clean
ISDKF="-arch arm64 -isysroot $ISDK/SDKs/$ISDKVER $ISDKFCom"
make HOST_CC="gcc " TARGET_FLAGS="$ISDKF" TARGET=arm64 TARGET_SYS=iOS BUILDMODE=static
mv "$JITSRCDIR"/src/lib$LUALIB.a "$DESTDIR"/lib$LUALIB-arm64.a

make clean
ISDKF="-arch arm64 -isysroot $ISDK/SDKs/$ISDKVER -miphoneos-version-min=8.0 -fembed-bitcode"
make HOST_CC="gcc " TARGET_FLAGS="$ISDKF" TARGET=arm64 TARGET_SYS=iOS BUILDMODE=static
mv "$SRCDIR"/src/libluajit.a "$DESTDIR"/libluajit-arm64.a
make clean
make clean

cd ../iOS
$LIPO -create "$DESTDIR"/libluajit-*.a -output "$DESTDIR"/libluajit.a
$STRIP -S "$DESTDIR"/libluajit.a
cd ../iOS
$LIPO -create "$DESTDIR"/lib$LUALIB-*.a -output "$DESTDIR"/lib$LUALIB.a
$STRIP -S "$DESTDIR"/lib$LUALIB.a

cd $DIR
fi

cd $DESTDIR
xcodebuild clean
xcodebuild -configuration=Release
cp -f ./build/Release-iphoneos/libtolua.a ../Plugins/iOS/
xcodebuild -configuration=Release HEADER_SEARCH_PATHS=$LUASRCDIR/src OTHER_LDFLAGS="-ObjC -l$LUALIB"

cd $LUASRCDIR
xcodebuild clean
xcodebuild -configuration Release -sdk iphonesimulator
mv $LUASRCDIR/build/Release-iphonesimulator/liblua.a $DESTDIR/libluasim.a

cd $DESTDIR
xcodebuild -configuration=Release -sdk iphonesimulator HEADER_SEARCH_PATHS=$LUASRCDIR/src OTHER_LDFLAGS="-ObjC -lluasim"

mkdir -p $DIR/Plugins/iOS

cd $DESTDIR
$LIPO -create build/Release-iphoneos/libtolua.a build/Release-iphonesimulator/libtolua.a -output $DESTDIR/libtolua.a
$LIBTOOL -static -o $DIR/Plugins/iOS/libtolua.a $DESTDIR/libtolua.a $DESTDIR/lib$LUALIB.a $DESTDIR/libluasim.a

4 changes: 2 additions & 2 deletions cjson/lua_cjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,8 @@ static int json_decode(lua_State *l)

/* ===== INITIALISATION ===== */

//#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
#if 0
#if !defined(LUA_LJDIR) && (!defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502)
//#if 0
/* Compatibility for Lua 5.1.
*
* luaL_setfuncs() is used to create a module table where the functions have
Expand Down
39 changes: 29 additions & 10 deletions iOS/tolua.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
objects = {

/* Begin PBXBuildFile section */
8400929F1CCF43D600F89A56 /* tolua.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8400929E1CCF43D600F89A56 /* tolua.h */; };
4870775F2033EBD100C78F71 /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 4870775E2033EBD100C78F71 /* compat.c */; };
487077632033F2F500C78F71 /* bit.c in Sources */ = {isa = PBXBuildFile; fileRef = 487077622033F2F400C78F71 /* bit.c */; };
8400929F1CCF43D600F89A56 /* tolua.h in Copy Files */ = {isa = PBXBuildFile; fileRef = 8400929E1CCF43D600F89A56 /* tolua.h */; };
840092A11CCF43D600F89A56 /* tolua.m in Sources */ = {isa = PBXBuildFile; fileRef = 840092A01CCF43D600F89A56 /* tolua.m */; };
840092A81CCF44F800F89A56 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 840092A71CCF44F800F89A56 /* libluajit.a */; };
840092AA1CCF450F00F89A56 /* int64.c in Sources */ = {isa = PBXBuildFile; fileRef = 840092A91CCF450F00F89A56 /* int64.c */; };
840092AC1CCF451400F89A56 /* lpeg.c in Sources */ = {isa = PBXBuildFile; fileRef = 840092AB1CCF451400F89A56 /* lpeg.c */; };
840092AE1CCF451C00F89A56 /* pb.c in Sources */ = {isa = PBXBuildFile; fileRef = 840092AD1CCF451C00F89A56 /* pb.c */; };
Expand Down Expand Up @@ -37,23 +38,26 @@
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
840092991CCF43D600F89A56 /* CopyFiles */ = {
840092991CCF43D600F89A56 /* Copy Files */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "include/$(PRODUCT_NAME)";
dstSubfolderSpec = 16;
files = (
8400929F1CCF43D600F89A56 /* tolua.h in CopyFiles */,
8400929F1CCF43D600F89A56 /* tolua.h in Copy Files */,
);
name = "Copy Files";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
4870775D2033EBD100C78F71 /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = "<group>"; };
4870775E2033EBD100C78F71 /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = "<group>"; };
487077622033F2F400C78F71 /* bit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bit.c; path = ../../bit.c; sourceTree = "<group>"; };
8400929B1CCF43D600F89A56 /* libtolua.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtolua.a; sourceTree = BUILT_PRODUCTS_DIR; };
8400929E1CCF43D600F89A56 /* tolua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tolua.h; sourceTree = "<group>"; };
840092A01CCF43D600F89A56 /* tolua.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = tolua.m; sourceTree = "<group>"; };
840092A71CCF44F800F89A56 /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libluajit.a; sourceTree = SOURCE_ROOT; };
840092A91CCF450F00F89A56 /* int64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = int64.c; path = ../../int64.c; sourceTree = "<group>"; };
840092AB1CCF451400F89A56 /* lpeg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = lpeg.c; path = ../../lpeg.c; sourceTree = "<group>"; };
840092AD1CCF451C00F89A56 /* pb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pb.c; path = ../../pb.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -103,7 +107,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
840092A81CCF44F800F89A56 /* libluajit.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -132,12 +135,12 @@
840092BD1CCF45A800F89A56 /* luasocket */,
840092B31CCF455100F89A56 /* cjson */,
840092A91CCF450F00F89A56 /* int64.c */,
487077622033F2F400C78F71 /* bit.c */,
8445EB141D4C9F8A00397F5E /* uint64.c */,
840092AB1CCF451400F89A56 /* lpeg.c */,
840092AD1CCF451C00F89A56 /* pb.c */,
840092AF1CCF452100F89A56 /* struct.c */,
840092B11CCF452700F89A56 /* tolua.c */,
840092A71CCF44F800F89A56 /* libluajit.a */,
8400929E1CCF43D600F89A56 /* tolua.h */,
840092A01CCF43D600F89A56 /* tolua.m */,
);
Expand All @@ -160,6 +163,8 @@
840092BD1CCF45A800F89A56 /* luasocket */ = {
isa = PBXGroup;
children = (
4870775E2033EBD100C78F71 /* compat.c */,
4870775D2033EBD100C78F71 /* compat.h */,
840092BE1CCF45A800F89A56 /* auxiliar.c */,
840092BF1CCF45A800F89A56 /* auxiliar.h */,
840092C01CCF45A800F89A56 /* buffer.c */,
Expand Down Expand Up @@ -205,7 +210,7 @@
buildPhases = (
840092971CCF43D600F89A56 /* Sources */,
840092981CCF43D600F89A56 /* Frameworks */,
840092991CCF43D600F89A56 /* CopyFiles */,
840092991CCF43D600F89A56 /* Copy Files */,
);
buildRules = (
);
Expand Down Expand Up @@ -262,10 +267,12 @@
840092B01CCF452100F89A56 /* struct.c in Sources */,
840092B21CCF452700F89A56 /* tolua.c in Sources */,
8445EB151D4C9F8A00397F5E /* uint64.c in Sources */,
487077632033F2F500C78F71 /* bit.c in Sources */,
840092E71CCF45A800F89A56 /* luasocket.c in Sources */,
840092EC1CCF45A800F89A56 /* tcp.c in Sources */,
840092F01CCF45A800F89A56 /* usocket.c in Sources */,
840092EF1CCF45A800F89A56 /* unix.c in Sources */,
4870775F2033EBD100C78F71 /* compat.c in Sources */,
840092AA1CCF450F00F89A56 /* int64.c in Sources */,
840092ED1CCF45A800F89A56 /* timeout.c in Sources */,
840092E11CCF45A800F89A56 /* auxiliar.c in Sources */,
Expand Down Expand Up @@ -369,6 +376,7 @@
840092A51CCF43D600F89A56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_C_LANGUAGE_STANDARD = c99;
HEADER_SEARCH_PATHS = "../luajit-2.1/src";
Expand All @@ -377,25 +385,36 @@
"$(PROJECT_DIR)",
);
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-ObjC";
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
"-lluajit",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 armv7s x86_64 i386";
};
name = Debug;
};
840092A61CCF43D600F89A56 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_C_LANGUAGE_STANDARD = c99;
HEADER_SEARCH_PATHS = "../luajit-2.1/src";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
);
OTHER_LDFLAGS = "-ObjC";
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
"-lluajit",
);
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 armv7s x86_64 i386";
};
name = Release;
};
Expand Down
3 changes: 3 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

cp -a Plugins/* ~/lib/tolua/
34 changes: 34 additions & 0 deletions lua/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Lua License
-----------

Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.

For details and rationale, see http://www.lua.org/license.html .

===============================================================================

Copyright (C) 1994-2012 Lua.org, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

===============================================================================

(end of COPYRIGHT)
Loading