mirror of
https://github.com/xerial/snappy-java.git
synced 2025-07-20 20:44:28 +02:00
dding support to download native snappy source code using git.
Usage Example: make USE_GIT=true GIT_REPO_URL=https://git_repo/snappy GIT_SNAPPY_BRANCH=origin/my-branch/snappy-1.1.0
This commit is contained in:
parent
317ca823f6
commit
0740ef703b
29
Makefile
29
Makefile
@ -13,6 +13,16 @@ SNAPPY_SRC:=$(addprefix $(SNAPPY_SRC_DIR)/,$(SNAPPY_CC))
|
|||||||
SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) SnappyNative.o)
|
SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/,$(patsubst %.cc,%.o,$(SNAPPY_CC)) SnappyNative.o)
|
||||||
|
|
||||||
SNAPPY_UNPACKED:=$(TARGET)/snappy-extracted.log
|
SNAPPY_UNPACKED:=$(TARGET)/snappy-extracted.log
|
||||||
|
SNAPPY_GIT_UNPACKED:=$(TARGET)/snappy-git-extracted.log
|
||||||
|
|
||||||
|
ifdef USE_GIT
|
||||||
|
ifndef GIT_REPO_URL
|
||||||
|
$(warning GIT_REPO_URL is not set when using git)
|
||||||
|
endif
|
||||||
|
ifndef GIT_SNAPPY_BRANCH
|
||||||
|
$(warning GIT_SNAPPY_BRANCH is not set when using git)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR)
|
CXXFLAGS:=$(CXXFLAGS) -I$(SNAPPY_SRC_DIR)
|
||||||
|
|
||||||
@ -31,6 +41,13 @@ $(SNAPPY_UNPACKED): $(SNAPPY_ARCHIVE)
|
|||||||
touch $@
|
touch $@
|
||||||
cd $(SNAPPY_SRC_DIR) && ./configure
|
cd $(SNAPPY_SRC_DIR) && ./configure
|
||||||
|
|
||||||
|
$(SNAPPY_GIT_UNPACKED):
|
||||||
|
@mkdir -p $(SNAPPY_SRC_DIR)
|
||||||
|
git clone $(GIT_REPO_URL) $(SNAPPY_SRC_DIR)
|
||||||
|
git --git-dir=$(SNAPPY_SRC_DIR)/.git --work-tree=$(SNAPPY_SRC_DIR) checkout -b local/snappy-$(GIT_SNAPPY_BRANCH) $(GIT_SNAPPY_BRANCH)
|
||||||
|
touch $@
|
||||||
|
cd $(SNAPPY_SRC_DIR) && ./configure
|
||||||
|
|
||||||
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
|
jni-header: $(SRC)/org/xerial/snappy/SnappyNative.h
|
||||||
|
|
||||||
$(TARGET)/classes/org/xerial/snappy/SnappyNative.class : $(SRC)/org/xerial/snappy/SnappyNative.java
|
$(TARGET)/classes/org/xerial/snappy/SnappyNative.class : $(SRC)/org/xerial/snappy/SnappyNative.java
|
||||||
@ -47,7 +64,11 @@ src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode: src/main/resou
|
|||||||
$(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
|
$(JAVAC) -source 1.5 -target 1.5 -d $(TARGET)/temp $<
|
||||||
cp $(TARGET)/temp/org/xerial/snappy/SnappyNativeLoader.class $@
|
cp $(TARGET)/temp/org/xerial/snappy/SnappyNativeLoader.class $@
|
||||||
|
|
||||||
$(SNAPPY_SRC): $(SNAPPY_UNPACKED)
|
ifndef USE_GIT
|
||||||
|
$(SNAPPY_SRC): $(SNAPPY_UNPACKED)
|
||||||
|
else
|
||||||
|
$(SNAPPY_SRC): $(SNAPPY_GIT_UNPACKED)
|
||||||
|
endif
|
||||||
|
|
||||||
$(SNAPPY_OUT)/%.o : $(SNAPPY_SRC_DIR)/%.cc
|
$(SNAPPY_OUT)/%.o : $(SNAPPY_SRC_DIR)/%.cc
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@ -74,7 +95,11 @@ NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME)
|
|||||||
|
|
||||||
snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
|
snappy-jar-version:=snappy-java-$(shell $(JAVA) -jar lib/silk-weaver.jar find 'project(artifactId, version)' pom.xml | grep snappy-java | awk '{ print $$2; }')
|
||||||
|
|
||||||
native: $(SNAPPY_UNPACKED) $(NATIVE_DLL)
|
ifndef USE_GIT
|
||||||
|
native: $(SNAPPY_UNPACKED) $(NATIVE_DLL)
|
||||||
|
else
|
||||||
|
native: $(SNAPPY_GIT_UNPACKED) $(NATIVE_DLL)
|
||||||
|
endif
|
||||||
snappy: native $(TARGET)/$(snappy-jar-version).jar
|
snappy: native $(TARGET)/$(snappy-jar-version).jar
|
||||||
|
|
||||||
$(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
|
$(NATIVE_DLL): $(SNAPPY_OUT)/$(LIBNAME)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user