Skip to content

Commit

Permalink
MovingBlocks#9 Provide Arm Build for mac
Browse files Browse the repository at this point in the history
  • Loading branch information
asotona committed Dec 8, 2022
1 parent 93e12fa commit aa5e03c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ To build the Java side of JNLua, a simple "./gradlew build" is sufficient.

Building the natives is more involved. Generally, JNLua expects natives to be present with the following filenames:

libjnlua-[5.2,5.3]-[windows,linux]-[i686,amd64].[dll,so]
libjnlua-[5.2,5.3]-[windows,linux,mac]-[i686,amd64,aarch64].[dll,so]

To build the natives on Linux you need:

Expand Down
4 changes: 2 additions & 2 deletions build-natives-eris_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi
cd native

for lua_ver in 5.2 5.3; do
for arch_type in amd64; do
for arch_type in amd64 aarch64; do
for plat_type in mac; do

MY_GCC="gcc"
Expand Down Expand Up @@ -46,7 +46,7 @@ make CC="$MY_GCC" CFLAGS="$MY_CFLAGS $MY_LUA_CFLAGS" LDFLAGS="$MY_LDFLAGS" $LUA_
cd ../native
rm *.dll *.so build/*.o

CFLAGS="$MY_CFLAGS -DJNLUA_USE_ERIS -DLUA_USE_POSIX" LDFLAGS="$MY_LDFLAGS" ARCH=amd64 JNLUA_SUFFIX="$MY_JNLUA_SUFFIX" \
CFLAGS="$MY_CFLAGS -DJNLUA_USE_ERIS -DLUA_USE_POSIX" LDFLAGS="$MY_LDFLAGS" ARCH="$arch_type" JNLUA_SUFFIX="$MY_JNLUA_SUFFIX" \
LUA_LIB_NAME=lua LUA_INC_DIR=../eris/src LUA_LIB_DIR=../eris/src LIB_SUFFIX="$MY_LIB_SUFFIX" \
CC="$MY_GCC" LUA_VERSION="$lua_ver" \
make -f Makefile.mac libjnlua
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
testCompile 'junit:junit:4.12'
testImplementation("junit:junit:4.13.2")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.8.2")
}

version = '0.1.0-SNAPSHOT'
version = '0.1.1-SNAPSHOT'
group = 'org.terasology.jnlua'

tasks.withType(Test) {
Expand Down
1 change: 0 additions & 1 deletion native/Makefile.mac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ JNLUA_SUFFIX?=53
LUA_INC_DIR?=/usr/include/lua$(LUA_VERSION)
LUA_LIB_NAME?=lua$(LUA_VERSION)
LIB_SUFFIX?=so
ARCH?=amd64
CFLAGS?=-O2 -DLUA_USE_POSIX
LDFLAGS?=

Expand Down
2 changes: 1 addition & 1 deletion publishNatives.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'base'
apply plugin: 'maven-publish'

version = '0.1.0-SNAPSHOT'
version = '0.1.1-SNAPSHOT'
group = 'org.terasology.jnlua'

task zipNatives(type: Zip) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/terasology/jnlua/NativeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ public void load(Class src) {
builder.append("linux-");
}

if (System.getProperty("os.arch").endsWith("64")) {
if (System.getProperty("os.arch").endsWith("aarch64")) {
builder.append("aarch64");
} else if (System.getProperty("os.arch").endsWith("64")) {
// Assume x86_64
builder.append("amd64");
} else {
Expand Down

0 comments on commit aa5e03c

Please sign in to comment.