mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-06 00:48:18 -07:00
dev-java/jssc: Rewrite ebuild to properly compile missing .so.
Gentoo-Bug: https://bugs.gentoo.org/577756 Package-Manager: portage-2.2.26
This commit is contained in:
117
dev-java/jssc/files/jssc-2.8.0-library-load.patch
Normal file
117
dev-java/jssc/files/jssc-2.8.0-library-load.patch
Normal file
@@ -0,0 +1,117 @@
|
||||
--- src/java/jssc/SerialNativeInterface.java.orig 2016-03-13 16:35:20.521644430 -0400
|
||||
+++ src/java/jssc/SerialNativeInterface.java 2016-03-13 16:38:00.022571256 -0400
|
||||
@@ -44,7 +44,7 @@
|
||||
public static final int OS_SOLARIS = 2;//since 0.9.0
|
||||
public static final int OS_MAC_OS_X = 3;//since 0.9.0
|
||||
|
||||
- private static int osType = -1;
|
||||
+ private static int osType = OS_LINUX;
|
||||
|
||||
/**
|
||||
* @since 2.3.0
|
||||
@@ -77,104 +77,11 @@
|
||||
public static final String PROPERTY_JSSC_PARMRK = "JSSC_PARMRK";
|
||||
|
||||
static {
|
||||
- String libFolderPath;
|
||||
- String libName;
|
||||
-
|
||||
- String osName = System.getProperty("os.name");
|
||||
- String architecture = System.getProperty("os.arch");
|
||||
- String userHome = System.getProperty("user.home");
|
||||
- String fileSeparator = System.getProperty("file.separator");
|
||||
- String tmpFolder = System.getProperty("java.io.tmpdir");
|
||||
-
|
||||
- //since 2.3.0 ->
|
||||
- String libRootFolder = new File(userHome).canWrite() ? userHome : tmpFolder;
|
||||
- //<- since 2.3.0
|
||||
-
|
||||
- String javaLibPath = System.getProperty("java.library.path");//since 2.1.0
|
||||
-
|
||||
- if(osName.equals("Linux")){
|
||||
- osName = "linux";
|
||||
- osType = OS_LINUX;
|
||||
- }
|
||||
- else if(osName.startsWith("Win")){
|
||||
- osName = "windows";
|
||||
- osType = OS_WINDOWS;
|
||||
- }//since 0.9.0 ->
|
||||
- else if(osName.equals("SunOS")){
|
||||
- osName = "solaris";
|
||||
- osType = OS_SOLARIS;
|
||||
- }
|
||||
- else if(osName.equals("Mac OS X") || osName.equals("Darwin")){//os.name "Darwin" since 2.6.0
|
||||
- osName = "mac_os_x";
|
||||
- osType = OS_MAC_OS_X;
|
||||
- }//<- since 0.9.0
|
||||
-
|
||||
- if(architecture.equals("i386") || architecture.equals("i686")){
|
||||
- architecture = "x86";
|
||||
- }
|
||||
- else if(architecture.equals("amd64") || architecture.equals("universal")){//os.arch "universal" since 2.6.0
|
||||
- architecture = "x86_64";
|
||||
- }
|
||||
- else if(architecture.equals("arm")) {//since 2.1.0
|
||||
- String floatStr = "sf";
|
||||
- if(javaLibPath.toLowerCase().contains("gnueabihf") || javaLibPath.toLowerCase().contains("armhf")){
|
||||
- floatStr = "hf";
|
||||
- }
|
||||
- else {
|
||||
- try {
|
||||
- Process readelfProcess = Runtime.getRuntime().exec("readelf -A /proc/self/exe");
|
||||
- BufferedReader reader = new BufferedReader(new InputStreamReader(readelfProcess.getInputStream()));
|
||||
- String buffer = "";
|
||||
- while((buffer = reader.readLine()) != null && !buffer.isEmpty()){
|
||||
- if(buffer.toLowerCase().contains("Tag_ABI_VFP_args".toLowerCase())){
|
||||
- floatStr = "hf";
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- reader.close();
|
||||
- }
|
||||
- catch (Exception ex) {
|
||||
- //Do nothing
|
||||
- }
|
||||
- }
|
||||
- architecture = "arm" + floatStr;
|
||||
- }
|
||||
-
|
||||
- libFolderPath = libRootFolder + fileSeparator + ".jssc" + fileSeparator + osName;
|
||||
- libName = "jSSC-" + libVersion + "_" + architecture;
|
||||
- libName = System.mapLibraryName(libName);
|
||||
-
|
||||
- if(libName.endsWith(".dylib")){//Since 2.1.0 MacOSX 10.8 fix
|
||||
- libName = libName.replace(".dylib", ".jnilib");
|
||||
- }
|
||||
-
|
||||
- boolean loadLib = false;
|
||||
-
|
||||
- if(isLibFolderExist(libFolderPath)){
|
||||
- if(isLibFileExist(libFolderPath + fileSeparator + libName)){
|
||||
- loadLib = true;
|
||||
- }
|
||||
- else {
|
||||
- if(extractLib((libFolderPath + fileSeparator + libName), osName, libName)){
|
||||
- loadLib = true;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- else {
|
||||
- if(new File(libFolderPath).mkdirs()){
|
||||
- if(extractLib((libFolderPath + fileSeparator + libName), osName, libName)){
|
||||
- loadLib = true;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (loadLib) {
|
||||
- System.load(libFolderPath + fileSeparator + libName);
|
||||
+ System.loadLibrary("jssc");
|
||||
String versionBase = getLibraryBaseVersion();
|
||||
String versionNative = getNativeLibraryVersion();
|
||||
if (!versionBase.equals(versionNative)) {
|
||||
System.err.println("Warning! jSSC Java and Native versions mismatch (Java: " + versionBase + ", Native: " + versionNative + ")");
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user