aports/community/java-snappy/unbundle-snappy.patch
2021-08-19 05:48:38 +00:00

86 lines
2.8 KiB
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Wed, 6 Apr 2016 00:52:00 +0200
Subject: [PATCH] Unbundle snappy
Use system-provided snappy library instead of downloading and building
snappy from the upstream.
--- old/Makefile
+++ new/Makefile
@@ -10,7 +10,7 @@
SNAPPY_OUT:=$(TARGET)/snappy-$(SNAPPY_VERSION)-$(os_arch)
SNAPPY_ARCHIVE:=$(TARGET)/snappy-$(SNAPPY_VERSION).tar.gz
-SNAPPY_CC:=snappy-sinksource.cc snappy-stubs-internal.cc snappy-c.cc snappy.cc
+SNAPPY_CC:=
SNAPPY_SRC_DIR:=$(TARGET)/snappy-$(SNAPPY_VERSION)
SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
SNAPPY_GIT_REPO_URL:=https://github.com/google/snappy
@@ -66,29 +66,16 @@
endif
$(SNAPPY_ARCHIVE):
- @mkdir -p $(@D)
- curl -L -o$@ https://github.com/google/snappy/releases/download/$(SNAPPY_VERSION)/snappy-$(SNAPPY_VERSION).tar.gz
$(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
- $(TAR) xvfz $< -C $(TARGET)
- touch $@
$(SNAPPY_GIT_UNPACKED):
- @mkdir -p $(SNAPPY_OUT)
- rm -rf $(SNAPPY_SRC_DIR)
- @mkdir -p $(SNAPPY_SRC_DIR)
- git clone $(SNAPPY_GIT_REPO_URL) $(SNAPPY_SRC_DIR)
- git --git-dir=$(SNAPPY_SRC_DIR)/.git --work-tree=$(SNAPPY_SRC_DIR) checkout -b local/snappy-$(SNAPPY_VERSION) $(SNAPPY_GIT_REV)
- touch $@
$(SNAPPY_CMAKE_CACHE): $(SNAPPY_GIT_UNPACKED)
- @mkdir -p $(SNAPPY_OUT)
- cd $(SNAPPY_OUT) && cmake $(SNAPPY_CMAKE_OPTS) ../../$(SNAPPY_SRC_DIR)
- touch $@
-jni-header: $(SNAPPY_GIT_UNPACKED) $(BITSHUFFLE_UNPACKED) $(SRC)/org/xerial/snappy/SnappyNative.h $(SRC)/org/xerial/snappy/BitShuffleNative.h
+jni-header: $(BITSHUFFLE_UNPACKED) $(SRC)/org/xerial/snappy/SnappyNative.h $(SRC)/org/xerial/snappy/BitShuffleNative.h
-snappy-header: $(SNAPPY_CMAKE_CACHE)
+snappy-header:
$(TARGET)/jni-classes/org/xerial/snappy/SnappyNative.class: $(SRC)/org/xerial/snappy/SnappyNative.java
@mkdir -p $(TARGET)/jni-classes
@@ -102,7 +89,7 @@
$(SRC)/org/xerial/snappy/BitShuffleNative.h: $(TARGET)/jni-classes/org/xerial/snappy/BitShuffleNative.class
-$(SNAPPY_SRC): $(SNAPPY_GIT_UNPACKED)
+$(SNAPPY_SRC):
# aarch64 can use big-endian optimzied code
ifeq ($(OS_ARCH),aarch64)
@@ -124,7 +111,7 @@
$(CXX) $(CXXFLAGS) -c $< -o $@
$(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ)
- $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS)
+ $(CXX) $(CXXFLAGS) -o $@ $+ $(LINKFLAGS) -lsnappy
# Workaround for strip Protocol error when using VirtualBox on Mac
cp $@ /tmp/$(@F)
$(STRIP) /tmp/$(@F)
@@ -144,7 +131,7 @@
native: jni-header snappy-header $(NATIVE_DLL)
native-nocmake: jni-header $(NATIVE_DLL)
-snappy: native $(TARGET)/$(snappy-jar-version).jar
+snappy: native
native-all: native mac64 win32 win64 native-arm linux32 linux64 linux-ppc64le
@@ -153,6 +140,7 @@
cp $(SNAPPY_OUT)/$(LIBNAME) $@
@mkdir -p $(NATIVE_TARGET_DIR)
cp $(SNAPPY_OUT)/$(LIBNAME) $(NATIVE_TARGET_DIR)/$(LIBNAME)
+ cp $(SNAPPY_OUT)/$(LIBNAME) $(TARGET)/
package: $(TARGET)/$(snappy-jar-version).jar