Gentoo Archives: gentoo-commits

From: "Miroslav Šulc" <fordfrog@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/snappy/files/, dev-java/snappy/
Date: Mon, 07 Feb 2022 08:00:10
Message-Id: 1644220797.77bf00d28f1a424b8ab2fae483927df1cd1b5bf8.fordfrog@gentoo
1 commit: 77bf00d28f1a424b8ab2fae483927df1cd1b5bf8
2 Author: Yuan Liao <liaoyuan <AT> gmail <DOT> com>
3 AuthorDate: Mon Dec 20 16:55:39 2021 +0000
4 Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 7 07:59:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77bf00d2
7
8 dev-java/snappy: Add 1.1.7.8
9
10 Signed-off-by: Yuan Liao <liaoyuan <AT> gmail.com>
11 Closes: https://github.com/gentoo/gentoo/pull/23438/commits/1c957771ab63735f4981bb3ee5243e442c802655
12 Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>
13
14 dev-java/snappy/Manifest | 1 +
15 dev-java/snappy/files/1.1.7.8-gentoo.patch | 28 ++++++
16 .../snappy/files/1.1.7.8-java-version-target.patch | 47 ++++++++++
17 .../snappy/files/1.1.7.8-remove-perl-usage.patch | 38 ++++++++
18 .../snappy/files/1.1.7.8-unbundle-bitshuffle.patch | 26 ++++++
19 .../snappy/files/1.1.7.8-unbundle-snappy.patch | 54 +++++++++++
20 dev-java/snappy/snappy-1.1.7.8.ebuild | 103 +++++++++++++++++++++
21 7 files changed, 297 insertions(+)
22
23 diff --git a/dev-java/snappy/Manifest b/dev-java/snappy/Manifest
24 index 3b685046ec3a..7c04b3f1d2a6 100644
25 --- a/dev-java/snappy/Manifest
26 +++ b/dev-java/snappy/Manifest
27 @@ -1 +1,2 @@
28 DIST snappy-java-1.1.0.1.tar.gz 4909520 BLAKE2B 65daf3d01f1cb46dd0d51609e2d95fc954d56e41fbb2d22e9eca24fad16a6d4ba16083e633fb13e68dacf6c2fb0d10ec6fb1e6dcdda6dc611b58b172710fcd62 SHA512 32d0afce880ecccd814f7738eb375a13bd533998c73d79908964061337730ad76fb4794f78fd1fcdc4a4562db57cbc4c6f912d9f3351b1d75b12ce3224ec387e
29 +DIST snappy-java-1.1.7.8.tar.gz 3558859 BLAKE2B 871f4190212399c5bd34a72766d7f3abca9a09608d9acddc126905bcdafc723613aa33d0cdb59419e6bfba46ff27e91f5ca5382073dd895d5601f6d84929ef96 SHA512 8129d4ae2abd78f967c07e7f13df8cb9043cc34bd8346be28625a3d2bea06674ce6dd09b521af2b7053b25d0132a0e822b78c06e09bacd0067ba8178bd167691
30
31 diff --git a/dev-java/snappy/files/1.1.7.8-gentoo.patch b/dev-java/snappy/files/1.1.7.8-gentoo.patch
32 new file mode 100644
33 index 000000000000..b4a58e6482be
34 --- /dev/null
35 +++ b/dev-java/snappy/files/1.1.7.8-gentoo.patch
36 @@ -0,0 +1,28 @@
37 +--- a/Makefile
38 ++++ b/Makefile
39 +@@ -124,11 +124,7 @@
40 + $(CXX) $(CXXFLAGS) -c $< -o $@
41 +
42 + $(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
43 +- $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy -lbitshuffle
44 +- # Workaround for strip Protocol error when using VirtualBox on Mac
45 +- cp $@ /tmp/$(@F)
46 +- $(STRIP) /tmp/$(@F)
47 +- cp /tmp/$(@F) $@
48 ++ $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy -lbitshuffle $(LDFLAGS)
49 +
50 + clean-native:
51 + rm -rf $(SNAPPY_OUT)
52 +--- a/Makefile.common
53 ++++ b/Makefile.common
54 +@@ -274,8 +274,8 @@
55 +
56 + CXX := $($(os_arch)_CXX)
57 + STRIP := $($(os_arch)_STRIP)
58 +-CXXFLAGS := $($(os_arch)_CXXFLAGS)
59 +-LINKFLAGS := $($(os_arch)_LINKFLAGS)
60 ++CXXFLAGS := $($(os_arch)_CXXFLAGS) $(CXXFLAGS)
61 ++LINKFLAGS := $($(os_arch)_LINKFLAGS) $(LDFLAGS)
62 + LIBNAME := $($(os_arch)_LIBNAME)
63 + SNAPPY_FLAGS := $($(os_arch)_SNAPPY_FLAGS)
64 +
65
66 diff --git a/dev-java/snappy/files/1.1.7.8-java-version-target.patch b/dev-java/snappy/files/1.1.7.8-java-version-target.patch
67 new file mode 100644
68 index 000000000000..a852d0bdb807
69 --- /dev/null
70 +++ b/dev-java/snappy/files/1.1.7.8-java-version-target.patch
71 @@ -0,0 +1,47 @@
72 +From e7d1d0167426790ba9b1d28ffa11e0d0c523f3b5 Mon Sep 17 00:00:00 2001
73 +From: Yuan Liao <liaoyuan@×××××.com>
74 +Date: Sun, 6 Feb 2022 08:29:20 -0800
75 +Subject: [PATCH] Allow Java version target to be specified using variable
76 +
77 +Signed-off-by: Yuan Liao <liaoyuan@×××××.com>
78 +---
79 + Makefile | 4 ++--
80 + Makefile.common | 2 ++
81 + 2 files changed, 4 insertions(+), 2 deletions(-)
82 +
83 +diff --git a/Makefile b/Makefile
84 +index 1d82a8a..8eaa319 100644
85 +--- a/Makefile
86 ++++ b/Makefile
87 +@@ -92,13 +92,13 @@ snappy-header: $(SNAPPY_CMAKE_CACHE)
88 +
89 + $(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class: $(SRC)/org/xerial/snappy/SnappyNative.java
90 + @mkdir -p $(TARGET)/jni-classes
91 +- $(JAVAC) -source 1.7 -target 1.7 -h $(SRC)/org/xerial/snappy/ -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
92 ++ $(JAVAC) -source $(JAVA_SOURCE) -target $(JAVA_TARGET) -h $(SRC)/org/xerial/snappy/ -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
93 +
94 + $(SRC)/org/xerial/snappy/SnappyNative.h: $(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class
95 +
96 + $(TARGET)/jni-classes/org/xerial/snappy/BitShuffleNative.class: $(SRC)/org/xerial/snappy/BitShuffleNative.java
97 + @mkdir -p $(TARGET)/jni-classes
98 +- $(JAVAC) -source 1.7 -target 1.7 -h $(SRC)/org/xerial/snappy/ -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
99 ++ $(JAVAC) -source $(JAVA_SOURCE) -target $(JAVA_TARGET) -h $(SRC)/org/xerial/snappy/ -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
100 +
101 + $(SRC)/org/xerial/snappy/BitShuffleNative.h: $(TARGET)/jni-classes/org/xerial/snappy/BitShuffleNative.class
102 +
103 +diff --git a/Makefile.common b/Makefile.common
104 +index 534bc4f..86d839b 100755
105 +--- a/Makefile.common
106 ++++ b/Makefile.common
107 +@@ -10,6 +10,8 @@ endif
108 + JAVA := "$$JAVA_HOME/bin/java"
109 + JAVAC := "$$JAVA_HOME/bin/javac"
110 + JAVAH := "$$JAVA_HOME/bin/javah"
111 ++JAVA_SOURCE := 1.8
112 ++JAVA_TARGET := 1.8
113 +
114 + LITTLE_ENDIAN := "Little Endian"
115 + BIG_ENDIAN := "Big Endian"
116 +--
117 +2.34.1
118 +
119
120 diff --git a/dev-java/snappy/files/1.1.7.8-remove-perl-usage.patch b/dev-java/snappy/files/1.1.7.8-remove-perl-usage.patch
121 new file mode 100644
122 index 000000000000..0c64240f12a3
123 --- /dev/null
124 +++ b/dev-java/snappy/files/1.1.7.8-remove-perl-usage.patch
125 @@ -0,0 +1,38 @@
126 +From 1413a33ef00e722bacab2e17297b89bb55b2bd49 Mon Sep 17 00:00:00 2001
127 +From: Yuan Liao <liaoyuan@×××××.com>
128 +Date: Tue, 21 Dec 2021 07:33:52 -0800
129 +Subject: [PATCH] Makefile: Eliminate usage of the `perl` command
130 +
131 +dev-lang/perl is not an implicit system dependency, so we cannot assume
132 +its existence during build time. The Makefile uses the `perl` command
133 +to generate the name of the JAR being built with it, but the ebuild uses
134 +Ant and a custom build.xml to build the JAR, and it uses the Makefile to
135 +build only the JNI part, thus the name of JAR in the Makefile will not
136 +be used. For this reason, this package can still be built and installed
137 +without dev-lang/perl. However, a QA notice for absent `perl` command
138 +will appear in this case. Rather than declaring dev-lang/perl as a
139 +dependency, it might be better to eliminate usage of the `perl` command
140 +if it is never used in any meaningful way.
141 +
142 +Signed-off-by: Yuan Liao <liaoyuan@×××××.com>
143 +---
144 + Makefile | 3 ++-
145 + 1 file changed, 2 insertions(+), 1 deletion(-)
146 +
147 +diff --git a/Makefile b/Makefile
148 +index a7bd87c..d1d3d32 100644
149 +--- a/Makefile
150 ++++ b/Makefile
151 +@@ -138,7 +138,8 @@ NATIVE_DIR:=src/main/resources/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
152 + NATIVE_TARGET_DIR:=$(TARGET)/classes/org/xerial/snappy/native/$(OS_NAME)/$(OS_ARCH)
153 + NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
154 +
155 +-snappy-jar-version:=snappy-java-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
156 ++#snappy-jar-version:=snappy-java-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
157 ++snappy-jar-version:=snappy
158 +
159 + native: jni-header snappy-header $(NATIVE_DLL)
160 + native-nocmake: jni-header $(NATIVE_DLL)
161 +--
162 +2.32.0
163 +
164
165 diff --git a/dev-java/snappy/files/1.1.7.8-unbundle-bitshuffle.patch b/dev-java/snappy/files/1.1.7.8-unbundle-bitshuffle.patch
166 new file mode 100644
167 index 000000000000..e4f699ad123e
168 --- /dev/null
169 +++ b/dev-java/snappy/files/1.1.7.8-unbundle-bitshuffle.patch
170 @@ -0,0 +1,26 @@
171 +--- a/Makefile
172 ++++ b/Makefile
173 +@@ -36,11 +36,11 @@
174 +
175 + $(SNAPPY_OUT)/%.o: $(BITSHUFFLE_SRC_DIR)/%.c
176 + @mkdir -p $(@D)
177 +- $(CXX) $(CXXFLAGS) $(CXXFLAGS_BITSHUFFLE) -c $< -o $@
178 ++ $(CXX) $(CXXFLAGS) -c $< -o $@
179 +
180 +-SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) $(patsubst %.c,%.o,$(BITSHUFFLE_C)) SnappyNative.o BitShuffleNative.o)
181 ++SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) SnappyNative.o BitShuffleNative.o)
182 +
183 +-CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR) -I$(SNAPPY_OUT) -I$(BITSHUFFLE_SRC_DIR)
184 ++CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR) -I$(SNAPPY_OUT)
185 +
186 + ifndef CXXFLAGS_BITSHUFFLE
187 + ifeq ($(OS_NAME)-$(OS_ARCH),Linux-x86_64)
188 +@@ -124,7 +124,7 @@
189 + $(CXX) $(CXXFLAGS) -c $< -o $@
190 +
191 + $(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
192 +- $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy
193 ++ $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy -lbitshuffle
194 + # Workaround for strip Protocol error when using VirtualBox on Mac
195 + cp $@ /tmp/$(@F)
196 + $(STRIP) /tmp/$(@F)
197
198 diff --git a/dev-java/snappy/files/1.1.7.8-unbundle-snappy.patch b/dev-java/snappy/files/1.1.7.8-unbundle-snappy.patch
199 new file mode 100644
200 index 000000000000..6113019be3ea
201 --- /dev/null
202 +++ b/dev-java/snappy/files/1.1.7.8-unbundle-snappy.patch
203 @@ -0,0 +1,54 @@
204 +diff --git a/Makefile b/Makefile
205 +index 0821c87..04f0435 100644
206 +--- a/Makefile
207 ++++ b/Makefile
208 +@@ -8,7 +8,8 @@
209 +
210 + SNAPPY_OUT:=$(TARGET)/snappy-$(SNAPPY_VERSION)-$(os_arch)
211 + SNAPPY_ARCHIVE:=$(TARGET)/snappy-$(SNAPPY_VERSION).tar.gz
212 +-SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
213 ++#SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy.cc
214 ++SNAPPY_CC:=
215 + SNAPPY_SRC_DIR:=$(TARGET)/snappy-$(SNAPPY_VERSION)
216 + SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
217 + SNAPPY_GIT_REPO_URL:=https://github.com/google/snappy
218 +@@ -100,7 +101,8 @@
219 +
220 + $(SRC)/org/xerial/snappy/BitShuffleNative.h: $(TARGET)/jni-classes/org/xerial/snappy/BitShuffleNative.class
221 +
222 +-$(SNAPPY_SRC): $(SNAPPY_GIT_UNPACKED)
223 ++$(SNAPPY_SRC):
224 ++# $(SNAPPY_GIT_UNPACKED)
225 +
226 + # aarch64 can use big-endian optimzied code
227 + ifeq ($(OS_ARCH),aarch64)
228 +@@ -122,7 +124,7 @@
229 + $(CXX) $(CXXFLAGS) -c $< -o $@
230 +
231 + $(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
232 +- $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
233 ++ $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy
234 + # Workaround for strip Protocol error when using VirtualBox on Mac
235 + cp $@ /tmp/$(@F)
236 + $(STRIP) /tmp/$(@F)
237 +@@ -140,9 +142,9 @@
238 + #snappy-jar-version:=snappy-java-$(shell perl -npe "s/version in ThisBuild\s+:=\s+\"(.*)\"/\1/" version.sbt | sed -e "/^$$/d")
239 + snappy-jar-version:=snappy
240 +
241 +-native: jni-header snappy-header $(NATIVE_DLL)
242 +-native-nocmake: jni-header $(NATIVE_DLL)
243 +-snappy: native $(TARGET)/$(snappy-jar-version).jar
244 ++native: $(NATIVE_DLL)
245 ++native-nocmake: $(NATIVE_DLL)
246 ++snappy: native
247 +
248 + native-all: native win32 win64 native-arm linux32 linux64 linux-ppc64le
249 +
250 +@@ -151,6 +153,7 @@
251 + cp $(SNAPPY_OUT)/$(LIBNAME) $@
252 + @mkdir -p $(NATIVE_TARGET_DIR)
253 + cp $(SNAPPY_OUT)/$(LIBNAME) $(NATIVE_TARGET_DIR)/$(LIBNAME)
254 ++ cp $< $(TARGET)/
255 +
256 + package: $(TARGET)/$(snappy-jar-version).jar
257 +
258
259 diff --git a/dev-java/snappy/snappy-1.1.7.8.ebuild b/dev-java/snappy/snappy-1.1.7.8.ebuild
260 new file mode 100644
261 index 000000000000..63853626e97c
262 --- /dev/null
263 +++ b/dev-java/snappy/snappy-1.1.7.8.ebuild
264 @@ -0,0 +1,103 @@
265 +# Copyright 1999-2022 Gentoo Authors
266 +# Distributed under the terms of the GNU General Public License v2
267 +
268 +EAPI=8
269 +
270 +JAVA_PKG_IUSE="doc source test"
271 +MAVEN_ID="org.xerial.snappy:snappy-java:1.1.7.8"
272 +
273 +inherit java-pkg-2 java-ant-2 toolchain-funcs
274 +
275 +MY_PN="${PN}-java"
276 +MY_P="${MY_PN}-${PV}"
277 +
278 +DESCRIPTION="Snappy compressor/decompressor for Java"
279 +HOMEPAGE="https://github.com/xerial/snappy-java/"
280 +SRC_URI="https://github.com/xerial/${MY_PN}/archive/${PV}.tar.gz -> ${MY_P}.tar.gz"
281 +
282 +LICENSE="Apache-2.0"
283 +SLOT="1.1"
284 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
285 +
286 +# Tests require org.apache.hadoop:hadoop-common:2.7.*, which is yet to be
287 +# packaged. Some extra steps are required before running the tests:
288 +# 1. Download hadoop-common 2.7.x from https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-common
289 +# 2. Set EANT_GENTOO_CLASSPATH_EXTRA to the path to hadoop-common-2.7.*.jar
290 +# 3. arm, arm64 and ppc64 only: Install test dependencies that are unkeyworded
291 +# 4. Set ALLOW_TEST="all"
292 +RESTRICT="test"
293 +
294 +CDEPEND="dev-java/osgi-core-api:0
295 + app-arch/snappy
296 + dev-libs/bitshuffle"
297 +
298 +# Some test dependencies are unsatisfied on arm, arm64, and ppc64
299 +DEPEND=">=virtual/jdk-1.8:*
300 + ${CDEPEND}
301 + test? (
302 + dev-java/ant-junit4:0
303 + dev-java/commons-io:1
304 + !arm? (
305 + dev-java/commons-lang:2.1
306 + )
307 + !arm? ( !arm64? ( !ppc64? (
308 + dev-java/plexus-classworlds:0
309 + dev-java/xerial-core:0
310 + ) ) )
311 + )"
312 +
313 +RDEPEND=">=virtual/jre-1.8:*
314 + ${CDEPEND}"
315 +
316 +S="${WORKDIR}/${MY_P}"
317 +
318 +JAVA_ANT_REWRITE_CLASSPATH="true"
319 +JAVA_ANT_CLASSPATH_TAGS="javac javadoc"
320 +EANT_GENTOO_CLASSPATH="osgi-core-api"
321 +EANT_TEST_GENTOO_CLASSPATH="
322 + ${EANT_GENTOO_CLASSPATH}
323 + commons-io-1
324 + commons-lang-2.1
325 + plexus-classworlds
326 + xerial-core
327 +"
328 +
329 +src_prepare() {
330 + cp "${FILESDIR}/1.x-build.xml" build.xml || die
331 + rm -r src/main/resources/org/xerial/snappy/native || die
332 + eapply "${FILESDIR}/${PV}-java-version-target.patch"
333 + eapply "${FILESDIR}/${PV}-remove-perl-usage.patch"
334 + eapply "${FILESDIR}/${PV}-unbundle-snappy.patch"
335 + eapply "${FILESDIR}/${PV}-unbundle-bitshuffle.patch"
336 + eapply "${FILESDIR}/${PV}-gentoo.patch"
337 + java-pkg-2_src_prepare
338 +}
339 +
340 +src_compile() {
341 + emake \
342 + CXX="$(tc-getCXX)" \
343 + JAVA_SOURCE="$(java-pkg_get-source)" \
344 + JAVA_TARGET="$(java-pkg_get-target)"
345 + java-pkg-2_src_compile
346 +}
347 +
348 +src_test() {
349 + cp -r src/test/resources/org/xerial/snappy/* \
350 + src/test/java/org/xerial/snappy || die
351 + java-pkg-2_src_test
352 +}
353 +
354 +src_install() {
355 + local jniext=.so
356 + if [[ ${CHOST} == *-darwin* ]] ; then
357 + jniext=.jnilib
358 + # avoid install_name check failure
359 + install_name_tool -id "@loader_path/libsnappyjava${jniext}" \
360 + "target/libsnappyjava${jniext}"
361 + fi
362 + java-pkg_doso "target/libsnappyjava${jniext}"
363 + java-pkg_dojar "target/${PN}.jar"
364 +
365 + use source && java-pkg_dosrc src/main/java/*
366 + use doc && java-pkg_dojavadoc target/site/apidocs
367 +}