forked from apache/maven-mvnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a native library, fixes apache#400
- Loading branch information
Showing
36 changed files
with
8,217 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
include Makefile.common | ||
|
||
.phony: all package native native-all deploy | ||
|
||
all: package | ||
|
||
MVNDNATIVE_OUT:=target/native-$(OS_NAME)-$(OS_ARCH) | ||
|
||
CCFLAGS:= -I$(MVNDNATIVE_OUT) $(CCFLAGS) | ||
|
||
|
||
clean-native: | ||
rm -rf $(MVNDNATIVE_OUT) | ||
|
||
$(MVNDNATIVE_OUT)/%.o: src/main/native/%.c | ||
@mkdir -p $(@D) | ||
$(info running: $(CC) $(CCFLAGS) -c $< -o $@) | ||
$(CC) $(CCFLAGS) -c $< -o $@ | ||
|
||
$(MVNDNATIVE_OUT)/$(LIBNAME): $(MVNDNATIVE_OUT)/mvndnative.o | ||
@mkdir -p $(@D) | ||
$(CC) $(CCFLAGS) -o $@ $(MVNDNATIVE_OUT)/mvndnative.o $(LINKFLAGS) | ||
|
||
NATIVE_DIR=src/main/resources/org/mvndaemon/mvnd/nativ/$(OS_NAME)/$(OS_ARCH) | ||
NATIVE_TARGET_DIR:=target/classes/org/mvndaemon/mvnd/nativ/$(OS_NAME)/$(OS_ARCH) | ||
NATIVE_DLL:=$(NATIVE_DIR)/$(LIBNAME) | ||
|
||
# For cross-compilation, install docker. See also https://github.com/dockcross/dockcross | ||
# Disabled linux-armv6 build because of this issue; https://github.com/dockcross/dockcross/issues/190 | ||
native-all: linux-x86 linux-x86_64 linux-arm linux-armv7 \ | ||
linux-arm64 linux-ppc64 win-x86 win-x86_64 mac-x86 mac-x86_64 freebsd-x86 freebsd-x86_64 | ||
|
||
native: $(NATIVE_DLL) | ||
|
||
$(NATIVE_DLL): $(MVNDNATIVE_OUT)/$(LIBNAME) | ||
@mkdir -p $(@D) | ||
cp $< $@ | ||
@mkdir -p $(NATIVE_TARGET_DIR) | ||
cp $< $(NATIVE_TARGET_DIR)/$(LIBNAME) | ||
|
||
linux-x86: | ||
./docker/dockcross-linux-x86 bash -c 'make clean-native native OS_NAME=Linux OS_ARCH=x86' | ||
|
||
linux-x86_64: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=x86_64-linux-gnu multiarch/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=x86_64 | ||
|
||
linux-arm: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=arm-linux-gnueabi multiarch/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=arm | ||
|
||
linux-armv7: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=arm-linux-gnueabihf multiarch/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=armv7 | ||
|
||
linux-arm64: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=aarch64-linux-gnu multiarch/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=arm64 | ||
|
||
linux-ppc64: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=powerpc64le-linux-gnu multiarch/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=ppc64 | ||
|
||
win-x86: | ||
./docker/dockcross-windows-static-x86 bash -c 'make clean-native native CROSS_PREFIX=i686-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86' | ||
|
||
win-x86_64: | ||
./docker/dockcross-windows-static-x64 bash -c 'make clean-native native CROSS_PREFIX=x86_64-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86_64' | ||
|
||
mac-x86: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=i386-apple-darwin multiarch/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86 | ||
|
||
mac-x86_64: | ||
docker run -it --rm -v $$PWD:/workdir -e CROSS_TRIPLE=x86_64-apple-darwin multiarch/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86_64 | ||
|
||
freebsd-x86: | ||
docker run -it --rm -v $$PWD:/workdir empterdose/freebsd-cross-build:9.3 make clean-native native CROSS_PREFIX=i386-freebsd9- OS_NAME=FreeBSD OS_ARCH=x86 | ||
|
||
freebsd-x86_64: | ||
docker run -it --rm -v $$PWD:/workdir empterdose/freebsd-cross-build:9.3 make clean-native native CROSS_PREFIX=x86_64-freebsd9- OS_NAME=FreeBSD OS_ARCH=x86_64 | ||
|
||
#sparcv9: | ||
# $(MAKE) native OS_NAME=SunOS OS_ARCH=sparcv9 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# os=Default is meant to be generic unix/linux | ||
|
||
known_targets := Linux-x86 Linux-x86_64 Linux-arm Linux-armv6 Linux-armv7 Linux-android-arm Linux-ppc64 Mac-x86 Mac-x86_64 DragonFly-x86_64 FreeBSD-x86_64 OpenBSD-x86_64 Windows-x86 Windows-x86_64 SunOS-sparcv9 HPUX-ia64_32 | ||
target := $(OS_NAME)-$(OS_ARCH) | ||
|
||
ifeq (,$(findstring $(strip $(target)),$(known_targets))) | ||
target := Default | ||
endif | ||
|
||
# cross-compilation toolchain prefix (e.g. "arm-linux-gnueabi-") | ||
CROSS_PREFIX := | ||
|
||
Default_CC := $(CROSS_PREFIX)gcc | ||
Default_STRIP := $(CROSS_PREFIX)strip | ||
Default_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -fvisibility=hidden | ||
Default_LINKFLAGS := -shared | ||
Default_LIBNAME := libmvndnative.so | ||
Default_JANSI_FLAGS := | ||
|
||
Linux-x86_CC := $(CROSS_PREFIX)gcc | ||
Linux-x86_STRIP := $(CROSS_PREFIX)strip | ||
Linux-x86_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -m32 -fvisibility=hidden | ||
Linux-x86_LINKFLAGS := -shared -static-libgcc | ||
Linux-x86_LIBNAME := libmvndnative.so | ||
Linux-x86_JANSI_FLAGS := | ||
|
||
Linux-x86_64_CC := $(CROSS_PREFIX)gcc | ||
Linux-x86_64_STRIP := $(CROSS_PREFIX)strip | ||
Linux-x86_64_CCFLAGS := -Isrc/main/lib/inc_linux -I$(JAVA_HOME)/include -Os -fPIC -m64 -fvisibility=hidden | ||
Linux-x86_64_LINKFLAGS := -shared -static-libgcc | ||
Linux-x86_64_LIBNAME := libmvndnative.so | ||
Linux-x86_64_JANSI_FLAGS := | ||
|
||
Linux-arm_CC := $(CROSS_PREFIX)gcc | ||
Linux-arm_STRIP := $(CROSS_PREFIX)strip | ||
Linux-arm_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -mfloat-abi=softfp -mfpu=vfp -fvisibility=hidden | ||
Linux-arm_LINKFLAGS := -shared -static-libgcc | ||
Linux-arm_LIBNAME := libmvndnative.so | ||
Linux-arm_JANSI_FLAGS := | ||
|
||
Linux-armv6_CC := $(CROSS_PREFIX)gcc | ||
Linux-armv6_STRIP := $(CROSS_PREFIX)strip | ||
Linux-armv6_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden | ||
Linux-armv6_LINKFLAGS := -shared -static-libgcc | ||
Linux-armv6_LIBNAME := libmvndnative.so | ||
Linux-armv6_JANSI_FLAGS := | ||
|
||
Linux-armv7_CC := $(CROSS_PREFIX)gcc | ||
Linux-armv7_STRIP := $(CROSS_PREFIX)strip | ||
Linux-armv7_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden | ||
Linux-armv7_LINKFLAGS := -shared -static-libgcc | ||
Linux-armv7_LIBNAME := libmvndnative.so | ||
Linux-armv7_JANSI_FLAGS := | ||
|
||
Linux-arm64_CC := $(CROSS_PREFIX)gcc | ||
Linux-arm64_STRIP := $(CROSS_PREFIX)strip | ||
Linux-arm64_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -mfloat-abi=hard -mfpu=vfp -fPIC -fvisibility=hidden | ||
Linux-arm64_LINKFLAGS := -shared -static-libgcc | ||
Linux-arm64_LIBNAME := libmvndnative.so | ||
Linux-arm64_JANSI_FLAGS := | ||
|
||
Linux-ppc64_CC := $(CROSS_PREFIX)gcc | ||
Linux-ppc64_STRIP := $(CROSS_PREFIX)strip | ||
Linux-ppc64_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -fvisibility=hidden | ||
Linux-ppc64_LINKFLAGS := -shared -static-libgcc | ||
Linux-ppc64_LIBNAME := libmvndnative.so | ||
Linux-ppc64_JANSI_FLAGS := | ||
|
||
DragonFly-x86_64_CC := $(CROSS_PREFIX)cc | ||
DragonFly-x86_64_STRIP := $(CROSS_PREFIX)strip | ||
DragonFly-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -O2 -fPIC -fvisibility=hidden | ||
DragonFly-x86_64_LINKFLAGS := -shared | ||
DragonFly-x86_64_LIBNAME := libmvndnative.so | ||
DragonFly-x86_64_JANSI_FLAGS := | ||
|
||
FreeBSD-x86_CC := $(CROSS_PREFIX)gcc | ||
FreeBSD-x86_STRIP := $(CROSS_PREFIX)strip | ||
FreeBSD-x86_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -fvisibility=hidden | ||
FreeBSD-x86_LINKFLAGS := -shared | ||
FreeBSD-x86_LIBNAME := libmvndnative.so | ||
FreeBSD-x86_JANSI_FLAGS := | ||
|
||
FreeBSD-x86_64_CC := $(CROSS_PREFIX)gcc | ||
FreeBSD-x86_64_STRIP := $(CROSS_PREFIX)strip | ||
FreeBSD-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -fvisibility=hidden | ||
FreeBSD-x86_64_LINKFLAGS := -shared | ||
FreeBSD-x86_64_LIBNAME := libmvndnative.so | ||
FreeBSD-x86_64_JANSI_FLAGS := | ||
|
||
OpenBSD-x86_64_CC := $(CROSS_PREFIX)gcc | ||
OpenBSD-x86_64_STRIP := $(CROSS_PREFIX)strip | ||
OpenBSD-x86_64_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -Os -fPIC -fvisibility=hidden | ||
OpenBSD-x86_64_LINKFLAGS := -shared | ||
OpenBSD-x86_64_LIBNAME := libmvndnative.so | ||
OpenBSD-x86_64_JANSI_FLAGS := | ||
|
||
SunOS-sparcv9_CC := $(CROSS_PREFIX)gcc | ||
SunOS-sparcv9_STRIP := $(CROSS_PREFIX)strip | ||
SunOS-sparcv9_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_linux -O2s-fPIC -m64 -fvisibility=hidden | ||
SunOS-sparcv9_LINKFLAGS := -shared -static-libgcc | ||
SunOS-sparcv9_LIBNAME := libmvndnative.so | ||
SunOS-sparcv9_JANSI_FLAGS := | ||
|
||
HPUX-ia64_32_CC := cc | ||
HPUX-ia64_32_STRIP := strip | ||
HPUX-ia64_32_CCFLAGS := -Isrc/main/lib/inc_linux +Osize +z -Bhidden | ||
HPUX-ia64_32_LINKFLAGS := -b | ||
HPUX-ia64_32_LIBNAME := libmvndnative.so | ||
HPUX-ia64_32_JANSI_FLAGS := | ||
|
||
Mac-x86_CC := gcc | ||
Mac-x86_STRIP := strip -x | ||
Mac-x86_CCFLAGS := -I$(JAVA_HOME)/include -Isrc/main/lib/inc_mac -Os -fPIC -mmacosx-version-min=10.4 -fvisibility=hidden | ||
Mac-x86_LINKFLAGS := -dynamiclib | ||
Mac-x86_LIBNAME := libmvndnative.jnilib | ||
Mac-x86_JANSI_FLAGS := -DJANSI_ENABLE_LOCKING_STYLE=0 | ||
|
||
Mac-x86_64_CC := gcc -arch $(OS_ARCH) | ||
Mac-x86_64_STRIP := strip -x | ||
MAC_SDK := /Developer/SDKs/MacOSX10.10.sdk | ||
ifeq ($(wildcard MAC_SDK),) | ||
MAC_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk | ||
endif | ||
Mac-x86_64_CCFLAGS := -I$(MAC_SDK)/System/Library/Frameworks/JavaVM.framework/Headers -Isrc/main/lib/inc_mac -Os -fPIC -mmacosx-version-min=10.6 -fvisibility=hidden | ||
Mac-x86_64_LINKFLAGS := -dynamiclib | ||
Mac-x86_64_LIBNAME := libmvndnative.jnilib | ||
Mac-x86_64_JANSI_FLAGS := | ||
|
||
Windows-x86_CC := $(CROSS_PREFIX)gcc | ||
Windows-x86_STRIP := $(CROSS_PREFIX)strip | ||
Windows-x86_CCFLAGS := -D_JNI_IMPLEMENTATION_ -Isrc/main/lib/inc_win -Os | ||
Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc | ||
Windows-x86_LIBNAME := mvndnative.dll | ||
Windows-x86_JANSI_FLAGS := | ||
|
||
Windows-x86_64_CC := $(CROSS_PREFIX)gcc | ||
Windows-x86_64_STRIP := $(CROSS_PREFIX)strip | ||
Windows-x86_64_CCFLAGS := -D_JNI_IMPLEMENTATION_ -Isrc/main/lib/inc_win -Os | ||
Windows-x86_64_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc | ||
Windows-x86_64_LIBNAME := mvndnative.dll | ||
Windows-x86_64_JANSI_FLAGS := | ||
|
||
|
||
CC := $($(target)_CC) | ||
STRIP := $($(target)_STRIP) | ||
CCFLAGS := $($(target)_CCFLAGS) | ||
LINKFLAGS := $($(target)_LINKFLAGS) | ||
LIBNAME := $($(target)_LIBNAME) | ||
CCFLAGS := $(CCFLAGS) |
Oops, something went wrong.