blob: 2b0bbe85f60ef6dd09882c7eab07f09451ddd89e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
JAVA_PKG_IUSE="doc source test"
MAVEN_PROVIDES="
net.java.dev.jna:jna:${PV}
net.java.dev.jna:jna-platform:${PV}
"
JAVA_TESTING_FRAMEWORKS="junit-4"
inherit java-pkg-2 java-pkg-simple toolchain-funcs
DESCRIPTION="Java Native Access"
HOMEPAGE="https://github.com/java-native-access/jna"
SRC_URI="https://github.com/java-native-access/jna/archive/${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${P}"
LICENSE="|| ( Apache-2.0 LGPL-2.1+ )"
SLOT="4"
KEYWORDS="amd64 arm64 ppc64"
BDEPEND="
virtual/pkgconfig
"
CDEPEND="
>=dev-libs/libffi-3.4:=
"
DEPEND="
>=virtual/jdk-1.8:*
test? (
dev-java/reflections:0
)
${CDEPEND}
x11-libs/libXt
"
RDEPEND="
>=virtual/jre-1.8:*
${CDEPEND}
"
DOCS=( README.md CHANGES.md OTHERS TODO )
PATCHES=(
"${FILESDIR}/5.11.0-makefile-flags.patch"
"${FILESDIR}/jna-5.11.0-no-Werror.patch"
"${FILESDIR}/jna-5.13.0-testpath.patch"
"${FILESDIR}/jna-5.13.0-LibCTest.patch"
)
src_prepare() {
default
java-pkg-2_src_prepare
java-pkg_clean
mkdir -p "res/META-INF" || die
echo "Main-Class: com.sun.jna.Native" > "res/META-INF/MANIFEST.MF" || die
# https://github.com/java-native-access/jna/blob/5.13.0/build.xml#L402-L407
sed \
-e "/VERSION =/s:TEMPLATE:${PV}:" \
-e '/VERSION_NATIVE =/s:TEMPLATE:5.1.0:' \
-i src/com/sun/jna/Version.java || die
}
src_compile() {
einfo "Compiling jna.jar"
JAVA_AUTOMATIC_MODULE_NAME="com.sun.jna"
JAVA_JAR_FILENAME="jna.jar"
JAVA_RESOURCE_DIRS="res"
JAVA_SRC_DIR="src"
java-pkg-simple_src_compile
JAVA_GENTOO_CLASSPATH_EXTRA+=":jna.jar"
rm -r target || die
einfo "Compiling jna-platform.jar"
JAVA_AUTOMATIC_MODULE_NAME="com.sun.jna.platform"
JAVA_JAR_FILENAME="jna-platform.jar"
JAVA_RESOURCE_DIRS=""
JAVA_SRC_DIR="contrib/platform/src"
java-pkg-simple_src_compile
JAVA_GENTOO_CLASSPATH_EXTRA+=":jna-platform.jar"
rm -r target || die
if use doc; then
einfo "Compiling javadocs"
JAVA_SRC_DIR=(
"src"
"contrib/platform/src"
)
JAVA_JAR_FILENAME="ignoreme.jar"
java-pkg-simple_src_compile
fi
einfo "Generating headers com_sun_jna_Native.h com_sun_jna_Function.h"
ejavac -h native -classpath "src" \
"src/com/sun/jna/Function.java" \
"src/com/sun/jna/Native.java" || die
einfo "Building native library"
cd native || die
local args=(
CC="$(tc-getCC)"
STRIP=true
DYNAMIC_LIBFFI=true
)
# Using -j1 since otherwise fails to build:
# cannot find ../build/native/libtestlib.so: No such file or directory
# [Makefile:505: ../build/native/libtestlib2.so] Error 1
emake -j1 "${args[@]}"
}
src_test() {
JAVA_TEST_EXTRA_ARGS=(
-Djna.nosys=true
-Djna.boot.library.path=build/native
-Djna.library.path=build/native
)
JAVA_TEST_GENTOO_CLASSPATH="
junit-4
reflections
"
JAVA_TEST_SRC_DIR="contrib/platform/test"
rm -r contrib/platform/test/com/sun/jna/platform/{mac,unix,win32} || die
JAVA_TEST_EXCLUDES=(
# 1) testGetXAttr(com.sun.jna.platform.linux.XAttrUtilTest)
# java.io.IOException: errno: 95
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:85)
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:70)
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:56)
# at com.sun.jna.platform.linux.XAttrUtilTest.testGetXAttr(XAttrUtilTest.java:83)
# 2) setXAttr(com.sun.jna.platform.linux.XAttrUtilTest)
# java.io.IOException: errno: 95
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:85)
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:70)
# at com.sun.jna.platform.linux.XAttrUtil.setXAttr(XAttrUtil.java:56)
# at com.sun.jna.platform.linux.XAttrUtilTest.setXAttr(XAttrUtilTest.java:53)
com.sun.jna.platform.linux.XAttrUtilTest
)
java-pkg-simple_src_test
JAVA_TEST_SRC_DIR="test"
rm -r test/com/sun/jna/wince || die
rm -r test/com/sun/jna/win32 || die
# 1) testLoadFromJarAbsolute(com.sun.jna.LibraryLoadTest)
# java.lang.UnsatisfiedLinkError: Unable to load library '/libtestlib-jar.so':
# /libtestlib-jar.so: cannot open shared object file: No such file or directory
jar cvf build/jna-test.jar \
-C build/native libtestlib-jar.so \
-C test com/sun/jna/data || die
JAVA_GENTOO_CLASSPATH_EXTRA+=":build/jna-test.jar"
JAVA_TEST_EXCLUDES=(
com.sun.jna.CallbacksTest # Needs to run separately
com.sun.jna.DirectTest # Needs to run separately
com.sun.jna.NativeTest # Needs to run separately
com.sun.jna.TypeMapperTest # Needs to run separately
com.sun.jna.UnionTest # Needs to run separately
com.sun.jna.VMCrashProtectionTest # Needs to run separately
)
java-pkg-simple_src_test
JAVA_TEST_RUN_ONLY=(
com.sun.jna.CallbacksTest
com.sun.jna.DirectTest
com.sun.jna.UnionTest
)
java-pkg-simple_src_test
JAVA_TEST_RUN_ONLY=( com.sun.jna.NativeTest )
java-pkg-simple_src_test
JAVA_TEST_RUN_ONLY=( com.sun.jna.VMCrashProtectionTest )
java-pkg-simple_src_test
JAVA_TEST_RUN_ONLY=( com.sun.jna.TypeMapperTest )
java-pkg-simple_src_test
}
src_install() {
default
java-pkg_dojar jna.jar jna-platform.jar
java-pkg_doso build/native/libjnidispatch.so
if use doc; then
java-pkg_dojavadoc target/api
fi
if use source; then
java-pkg_dosrc "src/*"
java-pkg_dosrc "contrib/platform/src/*"
fi
}
|