SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
53
java/jna/Makefile
Normal file
53
java/jna/Makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
COMMENT= Java Native Access (JNA)
|
||||
|
||||
GH_PROJECT= jna
|
||||
GH_ACCOUNT= java-native-access
|
||||
GH_TAGNAME= 5.11.0
|
||||
CATEGORIES= devel
|
||||
|
||||
REVISION= 2
|
||||
|
||||
HOMEPAGE= https://github.com/java-native-access/jna
|
||||
|
||||
# LGPLv2.1+
|
||||
PERMIT_PACKAGE= Yes
|
||||
|
||||
MODULES= java
|
||||
MODJAVA_VER= 11
|
||||
MODJAVA_BUILD= ant
|
||||
|
||||
# use the system libffi
|
||||
MODJAVA_BUILD_ARGS +=-Ddynlink.native=true
|
||||
|
||||
# build.xml specifically wants gmake (and ggrep)
|
||||
USE_GMAKE= Yes
|
||||
|
||||
BUILD_DEPENDS= sysutils/ggrep
|
||||
LIB_DEPENDS= devel/libffi
|
||||
# clojure needs to have the jna.jar installed
|
||||
TEST_DEPENDS= ${BASE_PKGPATH} \
|
||||
lang/clojure
|
||||
|
||||
MAKE_ENV= CC="${CC}" \
|
||||
PORTS_CFLAGS="${CFLAGS}"
|
||||
|
||||
GNU_ARCH= ${MACHINE_ARCH:S/amd64/x86-64/:S/i386/x86/:S/sparc64/sparcv9/}
|
||||
|
||||
pre-configure:
|
||||
sed -i -e 's,-Wno-unknown-warning-option,,' \
|
||||
-e 's,-Wno-clobbered,,' ${WRKSRC}/native/Makefile
|
||||
|
||||
do-install:
|
||||
${INSTALL_DATA_DIR} ${MODJAVA_JAR_DIR} ${MODJAVA_DOC_DIR}/jna/
|
||||
${INSTALL_DATA} ${WRKSRC}/build/openbsd-${GNU_ARCH}.jar \
|
||||
${MODJAVA_JAR_DIR}/jna-platform.jar
|
||||
${INSTALL_DATA} ${WRKSRC}/build/jna*.jar ${MODJAVA_JAR_DIR}
|
||||
cp -r ${WRKSRC}/doc/javadoc ${MODJAVA_DOC_DIR}
|
||||
|
||||
do-test:
|
||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/ant \
|
||||
${MODJAVA_BUILD_ARGS} test
|
||||
# needs to be run interactively with lang/clojure set up
|
||||
#${SHELL} ${FILESDIR}/test.sh
|
||||
|
||||
.include <bsd.port.mk>
|
2
java/jna/distinfo
Normal file
2
java/jna/distinfo
Normal file
|
@ -0,0 +1,2 @@
|
|||
SHA256 (jna-5.11.0.tar.gz) = IZCGxh+AQwCHHC7C7iILaqwPuLbLzHLcU9TzXcf2H7Y=
|
||||
SIZE (jna-5.11.0.tar.gz) = 107424072
|
2
java/jna/files/deps.edn
Normal file
2
java/jna/files/deps.edn
Normal file
|
@ -0,0 +1,2 @@
|
|||
{:paths ["."]
|
||||
:deps {jna/jna {:local/root "/usr/local/share/java/classes/jna.jar"}}}
|
47
java/jna/files/jna.clj
Normal file
47
java/jna/files/jna.clj
Normal file
|
@ -0,0 +1,47 @@
|
|||
;;; Basic set of JNA tests for use with Clojure
|
||||
|
||||
(import '(com.sun.jna Library))
|
||||
|
||||
(gen-interface
|
||||
:name jna.CLibrary
|
||||
:extends [com.sun.jna.Library]
|
||||
:methods [[printf [String] void]])
|
||||
|
||||
(def libc (com.sun.jna.Native/loadLibrary "c" jna.CLibrary))
|
||||
(.printf libc "Hello, World\n")
|
||||
|
||||
(defn- get-function [s]
|
||||
`(com.sun.jna.Function/getFunction ~(namespace s) ~(name s)))
|
||||
|
||||
(defmacro jna-call
|
||||
"Call a native library function"
|
||||
[return-type function-symbol & args]
|
||||
`(.invoke ~(get-function function-symbol) ~return-type (to-array [~@args])))
|
||||
|
||||
(jna-call Integer c/printf "-> %d\n" 42)
|
||||
|
||||
; Write a macro that wraps a native library function call
|
||||
(defmacro jna-func
|
||||
[ret-type func-symbol]
|
||||
`(let [func# ~(get-function func-symbol)]
|
||||
(fn [& args#]
|
||||
(.invoke func# ~ret-type (to-array args#)))))
|
||||
|
||||
(def c-printf (jna-func Integer c/printf))
|
||||
(c-printf "int: %d\nfloat: %.2f\n" 42 42.0)
|
||||
|
||||
(defmacro jna-malloc [size]
|
||||
`(let [buffer# (java.nio.ByteBuffer/allocateDirect ~size)
|
||||
pointer# (com.sun.jna.Native/getDirectBufferPointer buffer#)]
|
||||
(.order buffer# java.nio.ByteOrder/LITTLE_ENDIAN)
|
||||
{:pointer pointer# :buffer buffer#}))
|
||||
|
||||
(let [struct (jna-malloc 44)]
|
||||
(jna-call Integer c/statvfs "/tmp" (:pointer struct))
|
||||
(let [fbsize (.getInt (:buffer struct))
|
||||
frsize (.getInt (:buffer struct) 4)
|
||||
blocks (.getInt (:buffer struct) 8)
|
||||
bfree (.getInt (:buffer struct) 12)
|
||||
bavail (.getInt (:buffer struct) 16)]
|
||||
|
||||
(c-printf "# ignore statvfs\n")))
|
12
java/jna/files/test.sh
Normal file
12
java/jna/files/test.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Simple JNA tests to ensure Clojure can still call native library functions
|
||||
|
||||
expected=`mktemp`
|
||||
results=`mktemp`
|
||||
echo "Hello, World\n-> 42\nint: 42\nfloat: 42.00\n# ignore statvfs" > $expected
|
||||
cd files && /usr/local/bin/clojure -M jna.clj > $results
|
||||
|
||||
cmp $expected $results || exit 1
|
||||
|
||||
rm -f $expected $results
|
11
java/jna/patches/patch-build_xml
Normal file
11
java/jna/patches/patch-build_xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- build.xml.orig Sat Jan 14 17:15:07 2017
|
||||
+++ build.xml Sat Feb 25 14:58:20 2017
|
||||
@@ -126,7 +126,7 @@
|
||||
<!-- Miscellaneous -->
|
||||
<property name="build.compiler.emacs" value="true"/>
|
||||
|
||||
- <target name="default" depends="test" description="Build and Test."/>
|
||||
+ <target name="default" depends="-enable-native,jar,javadoc" description="Build and Test."/>
|
||||
|
||||
<target name="init" depends="-setup"/>
|
||||
<target name="compile-test-single" depends="compile-tests"/>
|
20
java/jna/patches/patch-native_Makefile
Normal file
20
java/jna/patches/patch-native_Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- native/Makefile.orig Mon Mar 6 21:59:50 2017
|
||||
+++ native/Makefile Mon Mar 6 22:00:22 2017
|
||||
@@ -81,7 +81,7 @@ LIBPFX=lib
|
||||
LIBSFX=.so
|
||||
ARSFX=.a
|
||||
JNISFX=$(LIBSFX)
|
||||
-CC=gcc
|
||||
+CC?=gcc
|
||||
LD=$(CC)
|
||||
LIBS=
|
||||
# CC_OPTS only applied to objects build for jnidispatch, not for libffi
|
||||
@@ -95,7 +95,7 @@ LIBS=
|
||||
# variables is ignored.
|
||||
LOC_CC_OPTS=-Wno-unknown-warning-option -Werror -Wno-clobbered
|
||||
# Default to Sun recommendations for JNI compilation
|
||||
-COPT=-O2 -fno-omit-frame-pointer -fno-strict-aliasing
|
||||
+COPT=${PORTS_CFLAGS} -fno-omit-frame-pointer -fno-strict-aliasing
|
||||
CASM=-S
|
||||
ifeq ($(DEBUG),true)
|
||||
CDEBUG=-g
|
12
java/jna/patches/patch-test_com_sun_jna_LibraryLoadTest_java
Normal file
12
java/jna/patches/patch-test_com_sun_jna_LibraryLoadTest_java
Normal file
|
@ -0,0 +1,12 @@
|
|||
--- test/com/sun/jna/LibraryLoadTest.java.orig Sat Jan 14 17:15:07 2017
|
||||
+++ test/com/sun/jna/LibraryLoadTest.java Sat Feb 25 14:58:20 2017
|
||||
@@ -171,7 +171,8 @@ public class LibraryLoadTest extends TestCase implemen
|
||||
dst.deleteOnExit();
|
||||
}
|
||||
catch(UnsatisfiedLinkError e) {
|
||||
- fail("Library '" + newLibName + "' at " + dst + " could not be loaded: " + e);
|
||||
+ // Loading a library with a unicode name isn't known to work on OpenBSD anyway
|
||||
+ //fail("Library '" + newLibName + "' at " + dst + " could not be loaded: " + e);
|
||||
}
|
||||
}
|
||||
|
10
java/jna/pkg/DESCR
Normal file
10
java/jna/pkg/DESCR
Normal file
|
@ -0,0 +1,10 @@
|
|||
JNA provides Java programs easy access to native shared libraries
|
||||
without writing anything but Java code -- no JNI or native code is
|
||||
required. This functionality is comparable to Windows' Platform/Invoke
|
||||
and Python's ctypes. Access is dynamic at runtime without code
|
||||
generation.
|
||||
|
||||
JNA allows you to call directly into native functions using natural Java
|
||||
method invocation. The Java call looks just like it does in native code.
|
||||
Most calls require no special handling or configuration; no boilerplate
|
||||
or generated code is required.
|
1390
java/jna/pkg/PLIST
Normal file
1390
java/jna/pkg/PLIST
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue