summaryrefslogtreecommitdiff
path: root/dev-java/jssc/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-java/jssc/files
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-java/jssc/files')
-rw-r--r--dev-java/jssc/files/jssc-2.8.0-library-load.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/dev-java/jssc/files/jssc-2.8.0-library-load.patch b/dev-java/jssc/files/jssc-2.8.0-library-load.patch
new file mode 100644
index 000000000000..829a18af69bd
--- /dev/null
+++ b/dev-java/jssc/files/jssc-2.8.0-library-load.patch
@@ -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 + ")");
+- }
+ }
+ }
+