diff --git a/arc-core/.temp/336a72a4/libarc64.so b/arc-core/.temp/336a72a4/libarc64.so new file mode 100644 index 00000000..eebada22 Binary files /dev/null and b/arc-core/.temp/336a72a4/libarc64.so differ diff --git a/arc-core/build.gradle b/arc-core/build.gradle index ca6244fa..2252d7ca 100644 --- a/arc-core/build.gradle +++ b/arc-core/build.gradle @@ -21,12 +21,16 @@ jar{ } } -//now, you may ask: why don't I make this a new module? why do I include JARs in the repository? why don't I make this a separate build step? -//the reason is: I don't want to deal with compiler arguments, --add-opens, or whatever else Java throws at you these days -//this just works and I don't want to touch it, it's a dependency that has already been compiled and won't explode as much as source compilation might -//"why are you using unsafe, why aren't you using the new memory access APIs?" because they don't work on Android or iOS -//and no, I cannot work with buffer put() because of Java's idiotic design making it so that you need to put()/limit()/position() to write memory, breaking multithreading -//this makes Unsafe the only viable option - any "state independent" methods are Java-16 specific, and iOS/Android don't support those +/* +now, you may ask: why don't I make this a new module? why do I include JARs in the repository? why don't I make this a separate build step? +the reason is: I don't want to deal with compiler arguments, --add-opens, or whatever else Java throws at you these days +this just works and I don't want to touch it, it's a dependency that has already been compiled and won't explode as much as source compilation might +"why are you using unsafe, why aren't you using the new memory access APIs?" because they don't work on Android or iOS +and no, I cannot work with buffer put() because of Java's idiotic design making it so that you need to put()/limit()/position() to write memory, breaking multithreading +this makes Unsafe the only viable option - any "state independent" methods are Java-16 specific, and iOS/Android don't support those + +tbh skill issue but im not gonna make seperate build for ts +*/ tasks.register("compileBuffersUnsafe", Exec){ workingDir "unsafe" @@ -50,9 +54,11 @@ tasks.register("recompileUnsafe", Exec){ } test{ - testLogging{ - exceptionFormat = 'full' - showStandardStreams = true + systemProperty "java.library.path", project(":backends:backend-sdl").file("libs/freebsd64").absolutePath + //more more log + testLogging { + events "passed", "skipped", "failed" + exceptionFormat "full" } } @@ -186,3 +192,7 @@ jnigenBuild.finalizedBy postJni getTasksByName("jnigen", true).each{ it.dependsOn preJni } + +tasks.withType(Jar).all { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} diff --git a/arc-core/libarc64.so b/arc-core/libarc64.so new file mode 100644 index 00000000..eebada22 Binary files /dev/null and b/arc-core/libarc64.so differ diff --git a/arc-core/src/arc/util/OS.java b/arc-core/src/arc/util/OS.java index 5e85f16c..8f3f7355 100644 --- a/arc-core/src/arc/util/OS.java +++ b/arc-core/src/arc/util/OS.java @@ -25,7 +25,9 @@ public class OS{ public static final int javaVersionNumber = OS.isAndroid || OS.isIos || javaVersion == null || !javaVersion.contains(".") ? 0 : javaVersion.startsWith("1.") ? 8 : Strings.parseInt(javaVersion.substring(0, javaVersion.indexOf('.')), 8); public static boolean isWindows = propNoNull("os.name").contains("Windows"); - public static boolean isLinux = propNoNull("os.name").contains("Linux") || propNoNull("os.name").contains("BSD"); + public static boolean isLinux = propNoNull("os.name").contains("Linux"); + // DONT CHANGE THIS ELSE IT WONT WORK FOR OTHER BSD'S AND FREEBSD 15.X + public static boolean isFreeBSD = propNoNull("os.name").contains("FreeBSD") || propNoNull("os.name").contains("BSD"); public static boolean isMac = propNoNull("os.name").contains("Mac"); public static boolean isIos = false; public static boolean isAndroid = false; diff --git a/arc-core/src/arc/util/SharedLibraryLoader.java b/arc-core/src/arc/util/SharedLibraryLoader.java index 383c4d44..14b2fc2b 100644 --- a/arc-core/src/arc/util/SharedLibraryLoader.java +++ b/arc-core/src/arc/util/SharedLibraryLoader.java @@ -59,7 +59,8 @@ public String crc(InputStream input){ public String mapLibraryName(String libraryName){ if(isWindows) return libraryName + (is64Bit ? "64.dll" : ".dll"); if(isLinux) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.so" : ".so"); - if(isMac) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.dylib" : ".dylib"); + if(isFreeBSD) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.so" : ".so"); + if(isMac) return "lib" + libraryName + (isARM ? "arm" : "") + (is64Bit ? "64.dylib" : ".dylib"); return libraryName; } diff --git a/backends/backend-sdl/build.gradle b/backends/backend-sdl/build.gradle index 03cc3ff3..4d27e32c 100644 --- a/backends/backend-sdl/build.gradle +++ b/backends/backend-sdl/build.gradle @@ -1,5 +1,5 @@ sourceSets.main.java.srcDirs = ["src"] -sourceSets.main.resources.srcDirs = ["libs/linux64", "libs/macosx64","libs/windows32", "libs/windows64", "libs/openal"] +sourceSets.main.resources.srcDirs = ["libs/linux64", "libs/macosx64","libs/windows32", "libs/windows64", "libs/openal", "libs/freebsd64"] dependencies { testImplementation libraries.jnigen @@ -131,3 +131,34 @@ getTasksByName("jnigen", true).each{ it.dependsOn classes it.dependsOn aproj(":arc-core").getTasksByName("compileJava", true) } + +//gdx-jnigen doesnt supports freebsd so this xml needs to stay at here + +task natives(type: Exec) { + // wait until jnigen + dependsOn jnigen + + def nativesDir = "jni" + workingDir nativesDir + def osName = System.getProperty("os.name") + + // runs our xml and "ant" crap for freebsd/generic bsd + if (osName.contains("FreeBSD") || osName.contains("BSD")) { + println "FreeBSD detected, Running build-freebsd64.xml..." + commandLine "ant", "-f", "build-freebsd64.xml", "-v" + } + // runs "ant" crap for others (why anuke :c) + else if (osName.contains("Linux")) { + commandLine "ant", "-f", "build-linux64.xml", "-v" + } else if (osName.contains("Mac")) { + commandLine "ant", "-f", "build-macosx64.xml", "-v" + } else if (osName.contains("Windows")) { + //README: idk if this right, ive never used windows since 1968 + commandLine "cmd", "/c", "ant", "-f", "build-windows64.xml", "-v" + } +} + +// runs natives while generating jar +tasks.named('jar') { + dependsOn 'natives' +} diff --git a/natives/build-freebsd.sh b/natives/build-freebsd.sh new file mode 100644 index 00000000..d431e0d5 --- /dev/null +++ b/natives/build-freebsd.sh @@ -0,0 +1,2 @@ +# TODO: freebsd build script +# no need anymore i implemented it inside build.gradle