summaryrefslogtreecommitdiff
path: root/dev-java/jffi
diff options
context:
space:
mode:
Diffstat (limited to 'dev-java/jffi')
-rw-r--r--dev-java/jffi/Manifest6
-rw-r--r--dev-java/jffi/files/jffi-1.2.8-junit-4.11.patch14
-rw-r--r--dev-java/jffi/files/jffi-1.2.8-makefile.patch52
-rw-r--r--dev-java/jffi/files/jffi_maven-build.xml259
-rw-r--r--dev-java/jffi/jffi-1.2.9.ebuild130
-rw-r--r--dev-java/jffi/metadata.xml11
6 files changed, 472 insertions, 0 deletions
diff --git a/dev-java/jffi/Manifest b/dev-java/jffi/Manifest
new file mode 100644
index 000000000000..8fbe06c446b0
--- /dev/null
+++ b/dev-java/jffi/Manifest
@@ -0,0 +1,6 @@
+AUX jffi-1.2.8-junit-4.11.patch 700 BLAKE2B 4533e3a8d6a5921b1e39ea20c9b4dcbbc66d08a3d0ce2494ed22e5af753f0cbfbc5fa064f19877816e2cc44c666c48aa5a1f8be44fe8dcc7a9368f033acf8828 SHA512 9cc2d41665ec3c2271d6c1c2e66dbfb506922a290e906df51fa66c61c918e1835dcb93313077fac92a8a622f132dfee08cf3b79ebce0be3a4b104c1cbcda5ea9
+AUX jffi-1.2.8-makefile.patch 1443 BLAKE2B 9accbdcd70c1c76e3f94a2131728fa83f7c988b5ce52aa7874d012700cfa4ed1cf3c3c2a281ce18c74776639e653f5a18e9c4b1d86baeaa9d10e577ca067e8eb SHA512 02f28b00e1ca6d16046c5f25c38268f78a41b5b202c4f284e8dac10dc245ad150f4639849c0af8c20f50dc3e7cf715bee6dfd2f1edc48496f822d78aaef01b39
+AUX jffi_maven-build.xml 11287 BLAKE2B 01ef4db6fef9d963bd52e0c15317ae836b629d9b22987c2d69a393d5513ab60bf2b062a083bb5b1a04301493c982f3926d5c9225972f7861e4ad668c9fc7a1f1 SHA512 56ebbb915d359f3eacf170d08fc1cf30f6efe900c91df0259a1fb69c6873ae839df829227b55e1538b4435387a82ec3e774180cfb531eb747e05a562aa7b97c7
+DIST jffi-1.2.9.tar.gz 1952668 BLAKE2B 320329b02ee9e93153fc334b73a6216da74ac2d924a64c8a1569f1f1507e1196d0b922f7d158ea91f6bc7164979b2ac12de239adbe98664a3708dd29c8d40f96 SHA512 2fd9a95cce9a3406a09856761d1318d4c6b976b1f9b66c7c5b0b5e95d44b19ba654ab8288f396782c7bb53e6d9949e7cfa9c46763f2a0761c6e86f102cd202e4
+EBUILD jffi-1.2.9.ebuild 3133 BLAKE2B 1008f67f92a9a34efdc0d3c2236383702554ee83bc4d327de61557a7d70dab9bca2d1745807498e9b69e7a2f9221380f21090df11a60424bf2548d4865161d9d SHA512 d19837738e4db90dc762ea76e6e067e6270d6d11d8f50d72c52c18c542cac2a07bda089935fccd1c0392eff1b056097e5d3a1bf18e10a08de8bd0ced188bdd2b
+MISC metadata.xml 319 BLAKE2B 999865e43b7f7ecf6784131fc903f80f208bf39dc54e96f6f80bd991998ab9694fb92ce8cd5e998a2e0800b64e47068859a7c63d46ea74294f1da77f1a18c46a SHA512 ed411e700c518b64ce76a437771c3a4779ebf47207d839924220ae6174ab7fd9cde92cd347c93b1916849cc2fb7fd4a5e5c29911420bc3485cb2916034d3f71b
diff --git a/dev-java/jffi/files/jffi-1.2.8-junit-4.11.patch b/dev-java/jffi/files/jffi-1.2.8-junit-4.11.patch
new file mode 100644
index 000000000000..ac3843a0053a
--- /dev/null
+++ b/dev-java/jffi/files/jffi-1.2.8-junit-4.11.patch
@@ -0,0 +1,14 @@
+--- a/src/test/java/com/kenai/jffi/NumberTest.java
++++ b/src/test/java/com/kenai/jffi/NumberTest.java
+@@ -234,9 +234,8 @@
+ private void returnF32(InvokerType type) {
+ LibNumberTest lib = UnitHelper.loadTestLibrary(LibNumberTest.class, type);
+ float[] values = { 0f, 1.0f, -2.0f };
+- for (int i = 0; i < values.length; ++i) {
+- assertEquals("Value not returned correctly", values[i], lib.ret_float(values[i]), 0.1f);
+- }
++ float[] lib_values = { lib.ret_float(0f), lib.ret_float(1.0f), lib.ret_float(-2.0f) };
++ assertArrayEquals("Value not returned correctly", values, lib_values, 0.1f);
+ }
+
+ @Test public void returnDefaultF64() {
diff --git a/dev-java/jffi/files/jffi-1.2.8-makefile.patch b/dev-java/jffi/files/jffi-1.2.8-makefile.patch
new file mode 100644
index 000000000000..7f9f07a500c5
--- /dev/null
+++ b/dev-java/jffi/files/jffi-1.2.8-makefile.patch
@@ -0,0 +1,52 @@
+--- jni/GNUmakefile
++++ jni/GNUmakefile
+@@ -41,6 +41,7 @@
+ JFFI_BUILD_DIR = $(BUILD_DIR)/jffi
+
+ ifeq ($(USE_SYSTEM_LIBFFI),1)
++ LIBFFI =
+ LIBFFI_LIBS ?= $(shell pkg-config --libs libffi)
+ LIBFFI_CFLAGS ?= $(shell pkg-config --cflags libffi)
+ else
+@@ -64,9 +65,8 @@
+ OFLAGS = -O2 $(JFLAGS)
+
+ # MacOS headers aren't completely warning free, so turn them off
+-WERROR = -Werror
+ ifneq ($(OS),darwin)
+- WFLAGS += -Wundef $(WERROR)
++ WFLAGS += -Wundef
+ endif
+ WFLAGS += -W -Wall -Wno-unused -Wno-parentheses -Wno-unused-parameter
+ PICFLAGS = -fPIC
+@@ -279,7 +279,7 @@
+ @echo "JFFI_BUILD_DIR=$(JFFI_BUILD_DIR)"
+ @echo "OBJS=$(OBJS)"
+
+-$(LIBJFFI): $(OBJS) $(LIBFFI_LIBS)
++$(LIBJFFI): $(OBJS) $(LIBFFI)
+ $(CC) -o $@ $(LDFLAGS) $(SOFLAGS) $(OBJS) $(LIBFFI_LIBS) $(LIBS)
+ $(STRIP) $@
+
+@@ -291,7 +291,7 @@
+ @mkdir -p $(@D)
+ @$(CC) $(CFLAGS) -o $@ -c $<
+
+-$(OBJS) : $(LIBFFI_LIBS)
++$(OBJS) : $(LIBFFI)
+
+ ifeq ($(OS), darwin)
+ build_ffi = \
+--- libtest/GNUmakefile
++++ libtest/GNUmakefile
+@@ -44,8 +44,8 @@
+ # Compiler/linker flags from:
+ # http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html
+ JFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing
+-OFLAGS = -O2 $(JFLAGS)
+-WFLAGS = -W -Werror -Wall -Wno-unused -Wno-unused-parameter -Wno-parentheses
++OFLAGS = $(JFLAGS)
++WFLAGS = -W -Wall -Wno-unused -Wno-unused-parameter -Wno-parentheses
+ PICFLAGS = -fPIC
+ SOFLAGS = -shared -Wl,-O1
+ LDFLAGS += $(SOFLAGS)
diff --git a/dev-java/jffi/files/jffi_maven-build.xml b/dev-java/jffi/files/jffi_maven-build.xml
new file mode 100644
index 000000000000..d8114185ee41
--- /dev/null
+++ b/dev-java/jffi/files/jffi_maven-build.xml
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
+<!-- ====================================================================== -->
+
+<!-- ====================================================================== -->
+<!-- ===================== - DO NOT EDIT THIS FILE! - ===================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- Any modifications will be overwritten. -->
+<!-- -->
+<!-- Generated by Maven Ant Plugin on 1/9/12 9:52 AM -->
+<!-- See: http://maven.apache.org/plugins/maven-ant-plugin/ -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<project name="jffi-from-maven" default="package" basedir=".">
+
+ <!-- ====================================================================== -->
+ <!-- Build environment properties -->
+ <!-- ====================================================================== -->
+
+ <property file="${user.home}/.m2/maven.properties"/>
+ <property file="maven-build.properties"/>
+
+ <property name="maven.build.finalName" value="jffi-1.0.11"/>
+ <property name="maven.build.dir" value="target"/>
+ <property name="maven.build.outputDir" value="${maven.build.dir}/classes"/>
+ <property name="maven.build.srcDir.0" value="src/main/java"/>
+ <property name="maven.build.resourceDir.0" value="src/main/resources"/>
+ <property name="maven.build.testOutputDir" value="${maven.build.dir}/test-classes"/>
+ <property name="maven.build.testDir.0" value="src/test/java"/>
+ <property name="maven.build.testResourceDir.0" value="src/test/resources"/>
+ <property name="maven.test.reports" value="${maven.build.dir}/test-reports"/>
+ <property name="maven.reporting.outputDirectory" value="${maven.build.dir}/site"/>
+
+ <property name="maven.repo.local" value="${user.home}/.m2/repository"/>
+ <property name="maven.settings.offline" value="false"/>
+ <property name="maven.settings.interactiveMode" value="true"/>
+
+ <!-- ====================================================================== -->
+ <!-- Defining classpaths -->
+ <!-- ====================================================================== -->
+
+ <path id="build.classpath"/>
+ <path id="build.test.classpath">
+ <pathelement location="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"/>
+ </path>
+
+ <!-- ====================================================================== -->
+ <!-- Cleaning up target -->
+ <!-- ====================================================================== -->
+
+ <target name="clean" description="Clean the output directory">
+ <delete dir="${maven.build.dir}"/>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- Compilation target -->
+ <!-- ====================================================================== -->
+
+ <target name="compile" depends="get-deps" description="Compile the code">
+ <mkdir dir="${maven.build.outputDir}"/>
+ <javac destdir="${maven.build.outputDir}"
+ nowarn="false"
+ debug="true"
+ optimize="false"
+ deprecation="true"
+ target="1.1"
+ verbose="false"
+ fork="false"
+ source="1.3">
+ <src>
+ <pathelement location="${maven.build.srcDir.0}"/>
+ </src>
+ <classpath refid="build.classpath"/>
+ </javac>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- Test-compilation target -->
+ <!-- ====================================================================== -->
+
+ <target name="compile-tests"
+ depends="compile"
+ description="Compile the test code"
+ unless="maven.test.skip">
+ <mkdir dir="${maven.build.testOutputDir}"/>
+ <javac destdir="${maven.build.testOutputDir}"
+ nowarn="false"
+ debug="true"
+ optimize="false"
+ deprecation="true"
+ target="1.1"
+ verbose="false"
+ fork="false"
+ source="1.3">
+ <src>
+ <pathelement location="${maven.build.testDir.0}"/>
+ </src>
+ <classpath>
+ <path refid="build.test.classpath"/>
+ <pathelement location="${maven.build.outputDir}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- Run all tests -->
+ <!-- ====================================================================== -->
+
+ <target name="test"
+ depends="compile-tests, junit-missing"
+ unless="junit.skipped"
+ description="Run the test cases">
+ <mkdir dir="${maven.test.reports}"/>
+ <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
+ <sysproperty key="basedir" value="."/>
+ <formatter type="xml"/>
+ <formatter type="plain" usefile="false"/>
+ <classpath>
+ <path refid="build.test.classpath"/>
+ <pathelement location="${maven.build.outputDir}"/>
+ <pathelement location="${maven.build.testOutputDir}"/>
+ </classpath>
+ <batchtest todir="${maven.test.reports}" unless="test">
+ <fileset dir="${maven.build.testDir.0}">
+ <include name="**/Test*.java"/>
+ <include name="**/*Test.java"/>
+ <include name="**/*TestCase.java"/>
+ <exclude name="**/*Abstract*Test.java"/>
+ </fileset>
+ </batchtest>
+ <batchtest todir="${maven.test.reports}" if="test">
+ <fileset dir="${maven.build.testDir.0}">
+ <include name="**/${test}.java"/>
+ <exclude name="**/*Abstract*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="test-junit-present">
+ <available classname="junit.framework.Test" property="junit.present"/>
+ </target>
+
+ <target name="test-junit-status"
+ depends="test-junit-present">
+ <condition property="junit.missing">
+ <and>
+ <isfalse value="${junit.present}"/>
+ <isfalse value="${maven.test.skip}"/>
+ </and>
+ </condition>
+ <condition property="junit.skipped">
+ <or>
+ <isfalse value="${junit.present}"/>
+ <istrue value="${maven.test.skip}"/>
+ </or>
+ </condition>
+ </target>
+
+ <target name="junit-missing"
+ depends="test-junit-status"
+ if="junit.missing">
+ <echo>=================================== WARNING ===================================</echo>
+ <echo> JUnit is not present in your $ANT_HOME/lib directory. Tests not executed.</echo>
+ <echo>===============================================================================</echo>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- Javadoc target -->
+ <!-- ====================================================================== -->
+
+ <target name="javadoc" description="Generates the Javadoc of the application">
+ <javadoc sourcepath="${maven.build.srcDir.0}"
+ packagenames="*"
+ destdir="${maven.reporting.outputDirectory}/apidocs"
+ access="protected"
+ old="false"
+ verbose="false"
+ version="true"
+ use="true"
+ author="true"
+ splitindex="false"
+ nodeprecated="false"
+ nodeprecatedlist="false"
+ notree="false"
+ noindex="false"
+ nohelp="false"
+ nonavbar="false"
+ serialwarn="false"
+ charset="ISO-8859-1"
+ linksource="false"
+ breakiterator="false"/>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- Package target -->
+ <!-- ====================================================================== -->
+
+ <target name="package" depends="compile,test" description="Package the application">
+ <jar jarfile="${maven.build.dir}/${maven.build.finalName}.jar"
+ compress="true"
+ index="false"
+ basedir="${maven.build.outputDir}"
+ excludes="**/package.html"/>
+ </target>
+
+ <!-- ====================================================================== -->
+ <!-- A dummy target for the package named after the type it creates -->
+ <!-- ====================================================================== -->
+
+ <target name="jar" depends="package" description="Builds the jar for the application"/>
+
+ <!-- ====================================================================== -->
+ <!-- Download dependencies target -->
+ <!-- ====================================================================== -->
+
+ <target name="test-offline">
+ <condition property="maven.mode.offline">
+ <equals arg1="${maven.settings.offline}" arg2="true"/>
+ </condition>
+ </target>
+
+ <target name="get-deps"
+ depends="test-offline"
+ description="Download all dependencies"
+ unless="maven.mode.offline">
+ <mkdir dir="${maven.repo.local}"/>
+ <mkdir dir="${maven.repo.local}/junit/junit/4.8.2"/>
+ <get src="http://repository.jboss.com/maven2/junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ <get src="http://snapshots.jboss.org/maven2/junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ <get src="http://repository.jboss.org/maven2//junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ <get src="https://repository.jboss.org/nexus/content/groups/public-jboss//junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ <get src="https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ <get src="http://repo1.maven.org/maven2/junit/junit/4.8.2/junit-4.8.2.jar"
+ dest="${maven.repo.local}/junit/junit/4.8.2/junit-4.8.2.jar"
+ usetimestamp="false"
+ ignoreerrors="true"/>
+ </target>
+
+</project>
diff --git a/dev-java/jffi/jffi-1.2.9.ebuild b/dev-java/jffi/jffi-1.2.9.ebuild
new file mode 100644
index 000000000000..51bc215bdac7
--- /dev/null
+++ b/dev-java/jffi/jffi-1.2.9.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+JAVA_PKG_IUSE="doc source test"
+
+inherit eutils java-pkg-2 java-ant-2 versionator
+
+DESCRIPTION="An optimized Java interface to libffi"
+HOMEPAGE="https://github.com/jnr/jffi"
+SRC_URI="https://github.com/jnr/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="|| ( Apache-2.0 LGPL-3 )"
+SLOT="1.2"
+KEYWORDS="amd64 ~arm64 ppc64 x86 ~ppc-macos ~x64-macos ~x86-macos"
+
+CDEPEND="virtual/libffi:0"
+
+RDEPEND="${CDEPEND}
+ >=virtual/jre-1.6"
+
+DEPEND="${CDEPEND}
+ >=virtual/jdk-1.6
+ virtual/pkgconfig
+ test? (
+ dev-java/ant-junit4:0
+ dev-java/junit:4
+ )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.2.8-makefile.patch
+ "${FILESDIR}"/${PN}-1.2.8-junit-4.11.patch
+)
+
+RESTRICT="test"
+
+java_prepare() {
+ cp "${FILESDIR}"/${PN}_maven-build.xml build.xml || die
+
+ epatch "${PATCHES[@]}"
+
+ # misc fixes for Darwin
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ local uarch
+ # don't do multiarch
+ # avoid using Xcode stuff
+ # use Prefix' headers
+ # don't mess with deployment target
+ # set install_name
+ use x64-macos && uarch=x86_64
+ use x86-macos && uarch=i386
+ use ppc-macos && uarch=ppc
+ sed -i \
+ -e "/ARCHES +=/s/=.*$/= ${uarch}/" \
+ -e "/XCODE=/s:=.*$:=${EPREFIX}:" \
+ -e "/MACSDK/s/^/#/" \
+ -e "/MACOSX_DEPLOYMENT_TARGET=/s/MAC/NOMAC/" \
+ -e "/SOFLAGS =/s:=.*:= -install_name ${EPREFIX}/usr/lib/jffi-${SLOT}/libjffi-${SLOT}.jnilib:" \
+ jni/GNUmakefile || die
+ fi
+
+ find "${WORKDIR}" -iname '*.jar' -delete || die
+}
+
+JAVA_ANT_REWRITE_CLASSPATH="yes"
+EANT_EXTRA_ARGS="-Dmaven.build.finalName=${PN}"
+
+src_compile() {
+ # generate Version.java
+ cat > src/main/java/com/kenai/jffi/Version.java <<-EOF
+ package com.kenai.jffi;
+ public final class Version {
+ private Version() {}
+ public static final int MAJOR = $(get_version_component_range 1);
+ public static final int MINOR = $(get_version_component_range 2);
+ public static final int MICRO = $(get_version_component_range 3);
+ }
+ EOF
+
+ java-pkg-2_src_compile
+
+ # generate headers
+ mkdir -p build/jni
+ javah -d build/jni -classpath target/classes \
+ com.kenai.jffi.Foreign \
+ com.kenai.jffi.ObjectBuffer \
+ com.kenai.jffi.Version \
+ || die
+
+ #build native library.
+ local args=(
+ SRC_DIR=jni
+ JNI_DIR=jni
+ BUILD_DIR=build/jni
+ VERSION=$(get_version_component_range 1-2)
+ USE_SYSTEM_LIBFFI=1
+ CCACHE=
+ -f jni/GNUmakefile
+ )
+ emake "${args[@]}"
+}
+
+EANT_TEST_GENTOO_CLASSPATH="ant-junit4,junit-4"
+
+src_test() {
+ # build native test library
+ emake BUILD_DIR=build -f libtest/GNUmakefile
+
+ _JAVA_OPTIONS="-Djffi.boot.library.path=${S}/build/jni" \
+ java-pkg-2_src_test
+}
+
+src_install() {
+ local libname=".so"
+
+ [[ ${CHOST} == *-darwin* ]] && libname=.jnilib
+ java-pkg_doso build/jni/lib${PN}-$(get_version_component_range 1-2)${libname}
+
+ # must by after _doso to have JAVA_PKG_LIBDEST set
+ cat > boot.properties <<-EOF
+ jffi.boot.library.path = ${JAVA_PKG_LIBDEST}
+ EOF
+ jar -uf target/${PN}.jar boot.properties || die
+
+ java-pkg_dojar target/${PN}.jar
+
+ use doc && java-pkg_dojavadoc target/site/apidocs
+ use source && java-pkg_dosrc src/main/java/*
+}
diff --git a/dev-java/jffi/metadata.xml b/dev-java/jffi/metadata.xml
new file mode 100644
index 000000000000..d78b07b4d6bb
--- /dev/null
+++ b/dev-java/jffi/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>java@gentoo.org</email>
+ <name>Java</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">jnr/jffi</remote-id>
+ </upstream>
+</pkgmetadata>