summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuan Liao <liaoyuan@gmail.com>2022-02-11 11:36:49 -0800
committerMiroslav Šulc <fordfrog@gentoo.org>2022-02-12 11:11:20 +0100
commita1c2381aa825760e85cae829e7075121df1cbade (patch)
tree688d0f64d0a6878072c268d852f54635af615961 /dev-java/lz4-java/files
parentprofiles/package.mask: Mask postgresql:9.6, EOL upstream (diff)
downloadgentoo-a1c2381aa825760e85cae829e7075121df1cbade.tar.gz
gentoo-a1c2381aa825760e85cae829e7075121df1cbade.tar.bz2
gentoo-a1c2381aa825760e85cae829e7075121df1cbade.zip
dev-java/lz4-java: Fix test error with --as-needed in LDFLAGS
Signed-off-by: Yuan Liao <liaoyuan@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/24164 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'dev-java/lz4-java/files')
-rw-r--r--dev-java/lz4-java/files/lz4-java-1.8.0-r1-Makefile47
1 files changed, 47 insertions, 0 deletions
diff --git a/dev-java/lz4-java/files/lz4-java-1.8.0-r1-Makefile b/dev-java/lz4-java/files/lz4-java-1.8.0-r1-Makefile
new file mode 100644
index 000000000000..4a766552c65e
--- /dev/null
+++ b/dev-java/lz4-java/files/lz4-java-1.8.0-r1-Makefile
@@ -0,0 +1,47 @@
+# 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)
+
+$(OUT_DIR)/$(SONAME): $(OBJS) | $(OUT_DIR)
+ # '-llz4' must be listed after this package's objects
+ # https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Importance_of_linking_order
+ $(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) $@