aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-snappy/unbundle-snappy.patch
blob: 8143e6dac8ae1da26e667fe042d03015c73e3b20 (plain) (blame)
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
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