commit:     b9d7d11ecc603f1c52825ab0b0f83985966febdf
Author:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 19 21:35:20 2016 +0000
Commit:     Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Sat Mar 19 21:35:20 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b9d7d11e

dev-java/jssc: Rewrite ebuild to properly compile missing .so.

Gentoo-Bug: https://bugs.gentoo.org/577756

Package-Manager: portage-2.2.26

 dev-java/jssc/Manifest                            |   1 +
 dev-java/jssc/files/jssc-2.8.0-library-load.patch | 117 ++++++++++++++++++++++
 dev-java/jssc/jssc-2.8.0-r1.ebuild                |  61 +++++++++++
 3 files changed, 179 insertions(+)

diff --git a/dev-java/jssc/Manifest b/dev-java/jssc/Manifest
index 9a06377..b5c168f 100644
--- a/dev-java/jssc/Manifest
+++ b/dev-java/jssc/Manifest
@@ -1 +1,2 @@
 DIST jssc-2.8.0.jar 19489 SHA256 
b5a9609b99b4543c88d20e0425a83461209d4851ef3ce312349c64b76ce1dc68 SHA512 
7f3a8482d0982ed3e604b00217cbfa37ad442b5a2b562ff68805c186ee56423bd82706bbbe3b9f2705c8337009b7c71068ba7ebbb829ea3c96bc61f43b540b9d
 WHIRLPOOL 
4c10ba9b373cb057c50c01564124a2258b15b335a059d2cb195b8d8b14b761cbe98a713020dc21118d17a3274f346357812a3dc64103eb12916052e1a1e37050
+DIST jssc-2.8.0.zip 171914 SHA256 
5909c4c2103de81e274c53617cc72c17a5b6fea761b8e06b8cc4006fbd1f893a SHA512 
4d767054085a79cff4fe60d96d664918f69a791c8263d96c9d9fd622070f567acacb621079f23d5c54253366beb9d2a01fea7ea48b95f6267bc693a9bacb8466
 WHIRLPOOL 
f9f63980f93698d5d2529e774e3bc855703d363aa17ac505eabb562b648d8c15f392a940d27815ae8f07da2c12946678a75ed35894dba4dadf1ca7db9bc98773

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 0000000..829a18a
--- /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 + ")");
+-            }
+         }
+     }
+ 

diff --git a/dev-java/jssc/jssc-2.8.0-r1.ebuild 
b/dev-java/jssc/jssc-2.8.0-r1.ebuild
new file mode 100644
index 0000000..794058f
--- /dev/null
+++ b/dev-java/jssc/jssc-2.8.0-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+JAVA_PKG_IUSE="doc source"
+
+inherit java-pkg-2 java-pkg-simple toolchain-funcs
+
+MY_PN="java-simple-serial-connector"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Java Simple Serial Connector"
+HOMEPAGE="https://github.com/scream3r/java-simple-serial-connector";
+SRC_URI="https://github.com/scream3r/${MY_PN}/archive/${PV}.zip -> ${P}.zip"
+
+LICENSE="GPL-1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+
+IUSE=""
+
+RDEPEND="
+       >=virtual/jre-1.6"
+
+DEPEND="
+       source? ( app-arch/zip )
+       >=virtual/jdk-1.6"
+
+PATCHES=(
+       "${FILESDIR}/${P}-library-load.patch"
+)
+
+S="${WORKDIR}/${MY_P}"
+
+java_prepare() {
+       epatch "${PATCHES[@]}"
+}
+
+src_compile() {
+       java-pkg-simple_src_compile
+       $(tc-getCXX) \
+               ${CPP_FLAGS} ${CXX_FLAGS} \
+               -c -o ${PN}.o \
+               -fPIC -Wall \
+               -I$(java-config-2 -o)/include \
+               -I$(java-config-2 -o)/include/linux \
+               "${S}/src/cpp/_nix_based/${PN}.cpp" || die
+
+       $(tc-getCXX) \
+               -Wl,-soname,libjssc.so \
+               -shared -o "libjssc.so.${PV}" \
+               -Wall "${PN}.o" || die
+}
+
+src_install() {
+       java-pkg-simple_src_install
+       dolib libjssc*
+       dosym "libjssc.so.${PV}" /usr/$(get_libdir)/libjssc.so
+}

Reply via email to