mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-23 18:38:08 -07:00
Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
Closes: 282a51b4d0
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
# Gentoo custom Makefile for the JNI portion of lz4-java
|
|
#
|
|
# Adapted from the logic for target "compile-jni" in build.xml,
|
|
# but uses lz4 installed on the system. This Makefile respects
|
|
# custom CFLAGS and LDFLAGS settings, whereas build.xml does not.
|
|
|
|
# Java system properties read by build.xml
|
|
PLATFORM ?= linux
|
|
SRC ?= src
|
|
BUILD ?= build
|
|
JAVA_HOME ?=
|
|
# Requires lz4-java-*-print-os-props.patch
|
|
OS_ARCH := $(shell ant os-props 2>&1 > /dev/null && \
|
|
grep 'os\.arch=' os.properties | sed -e 's/os\.arch=//')
|
|
|
|
MKDIR_P = mkdir -p
|
|
|
|
SRC_DIR := $(SRC)/jni
|
|
OBJS_DIR_PREFIX := $(BUILD)/objects
|
|
OBJS_DIR := $(OBJS_DIR_PREFIX)/$(SRC_DIR)
|
|
OUT_DIR := $(BUILD)/jni/net/jpountz/util/$(PLATFORM)/$(OS_ARCH)
|
|
|
|
SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
|
|
OBJS := $(addprefix $(OBJS_DIR_PREFIX)/,$(SRC_FILES:.c=.o))
|
|
SONAME = liblz4-java.so
|
|
|
|
# C compiler arguments may be obtained by running 'ant -v compile-jni',
|
|
# as long as dev-java/cpptasks is in the classpath
|
|
CFLAGS := -fPIC $(CFLAGS)
|
|
# '--as-needed' causes test failure
|
|
LDFLAGS := $(LDFLAGS) -Wl,--no-as-needed
|
|
|
|
$(OUT_DIR)/$(SONAME): $(OBJS) | $(OUT_DIR)
|
|
$(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ -llz4 $^
|
|
|
|
$(OBJS_DIR_PREFIX)/%.o: %.c | $(OBJS_DIR)
|
|
$(CC) $(CFLAGS) -c -o $@ \
|
|
-I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/$(PLATFORM) \
|
|
-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(PLATFORM) \
|
|
-I$(BUILD)/jni-headers \
|
|
$<
|
|
|
|
$(OUT_DIR):
|
|
$(MKDIR_P) $@
|
|
|
|
$(OBJS_DIR):
|
|
$(MKDIR_P) $@
|