mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 13:15:27 +00:00
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
include Makefile.common
|
include Makefile.common
|
||||||
|
|
||||||
.phony: all package native native-all deploy
|
.PHONY: all package native native-all deploy crossbuild crossbuild-uid ducible clean-native
|
||||||
|
|
||||||
all: package
|
all: package
|
||||||
|
|
||||||
@@ -25,8 +25,10 @@ MVNDNATIVE_OUT:=target/native-$(OS_NAME)-$(OS_ARCH)
|
|||||||
|
|
||||||
CCFLAGS:= -I$(MVNDNATIVE_OUT) $(CCFLAGS)
|
CCFLAGS:= -I$(MVNDNATIVE_OUT) $(CCFLAGS)
|
||||||
|
|
||||||
download-includes:
|
target:
|
||||||
@test -d target || mkdir target
|
@test -d target || mkdir target
|
||||||
|
|
||||||
|
download-includes: target
|
||||||
@test -d target/inc || mkdir target/inc
|
@test -d target/inc || mkdir target/inc
|
||||||
@test -d target/inc/unix || mkdir target/inc/unix
|
@test -d target/inc/unix || mkdir target/inc/unix
|
||||||
@test -d target/inc/windows || mkdir target/inc/windows
|
@test -d target/inc/windows || mkdir target/inc/windows
|
||||||
@@ -34,6 +36,19 @@ download-includes:
|
|||||||
test -f target/inc/unix/jni_md.h || wget -O target/inc/unix/jni_md.h https://raw.githubusercontent.com/openjdk/jdk/jdk-11%2B28/src/java.base/unix/native/include/jni_md.h
|
test -f target/inc/unix/jni_md.h || wget -O target/inc/unix/jni_md.h https://raw.githubusercontent.com/openjdk/jdk/jdk-11%2B28/src/java.base/unix/native/include/jni_md.h
|
||||||
test -f target/inc/windows/jni_md.h || wget -O target/inc/windows/jni_md.h https://raw.githubusercontent.com/openjdk/jdk/jdk-11%2B28/src/java.base/windows/native/include/jni_md.h
|
test -f target/inc/windows/jni_md.h || wget -O target/inc/windows/jni_md.h https://raw.githubusercontent.com/openjdk/jdk/jdk-11%2B28/src/java.base/windows/native/include/jni_md.h
|
||||||
|
|
||||||
|
crossbuild: target
|
||||||
|
@test -d target || mkdir target
|
||||||
|
test -d target/crossbuild || git clone https://github.com/multiarch/crossbuild.git target/crossbuild
|
||||||
|
git -C target/crossbuild reset --hard d06cdc31fce0c85ad78408b44794366dafd59554
|
||||||
|
docker build target/crossbuild -t multiarch/crossbuild
|
||||||
|
|
||||||
|
crossbuild-uid: crossbuild
|
||||||
|
docker build docker/crossbuild-uid -t maven-mvnd/crossbuild
|
||||||
|
|
||||||
|
ducible: target
|
||||||
|
test -d target/ducible || git clone --branch v1.2.2 https://github.com/jasonwhite/ducible.git target/ducible
|
||||||
|
make --directory=target/ducible ducible CROSS_PREFIX= CXX=g++ CC=gcc
|
||||||
|
|
||||||
clean-native:
|
clean-native:
|
||||||
rm -rf $(MVNDNATIVE_OUT)
|
rm -rf $(MVNDNATIVE_OUT)
|
||||||
|
|
||||||
@@ -49,10 +64,7 @@ $(MVNDNATIVE_OUT)/$(LIBNAME): $(MVNDNATIVE_OUT)/mvndnative.o
|
|||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CCFLAGS) -o $@ $(MVNDNATIVE_OUT)/mvndnative.o $(LINKFLAGS)
|
$(CC) $(CCFLAGS) -o $@ $(MVNDNATIVE_OUT)/mvndnative.o $(LINKFLAGS)
|
||||||
ifeq ($(OS_NAME), Windows)
|
ifeq ($(OS_NAME), Windows)
|
||||||
echo "running ducible on $(OS_NAME)"
|
|
||||||
target/ducible/ducible $(MVNDNATIVE_OUT)/$(LIBNAME)
|
target/ducible/ducible $(MVNDNATIVE_OUT)/$(LIBNAME)
|
||||||
else
|
|
||||||
echo "not running ducible on $(OS_NAME)"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
NATIVE_DIR=src/main/resources/org/mvndaemon/mvnd/nativ/$(OS_NAME)/$(OS_ARCH)
|
NATIVE_DIR=src/main/resources/org/mvndaemon/mvnd/nativ/$(OS_NAME)/$(OS_ARCH)
|
||||||
@@ -75,23 +87,33 @@ $(NATIVE_DLL): $(MVNDNATIVE_OUT)/$(LIBNAME)
|
|||||||
linux-x86: download-includes
|
linux-x86: download-includes
|
||||||
./docker/dockcross-linux-x86 bash -c 'make clean-native native OS_NAME=Linux OS_ARCH=x86'
|
./docker/dockcross-linux-x86 bash -c 'make clean-native native OS_NAME=Linux OS_ARCH=x86'
|
||||||
|
|
||||||
linux-x86_64: download-includes
|
linux-x86_64: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=x86_64-linux-gnu maven-mvnd/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=x86_64
|
||||||
|
|
||||||
linux-arm: download-includes
|
linux-arm: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=arm-linux-gnueabi maven-mvnd/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=arm
|
||||||
|
|
||||||
linux-armv6:
|
linux-armv6:
|
||||||
./docker/dockcross-linux-armv6 bash -c 'make clean-native native CROSS_PREFIX=armv6-unknown-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armv6'
|
./docker/dockcross-linux-armv6 bash -c 'make clean-native native CROSS_PREFIX=armv6-unknown-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armv6'
|
||||||
|
|
||||||
linux-armv7: download-includes
|
linux-armv7: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=arm-linux-gnueabihf maven-mvnd/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=armv7
|
||||||
|
|
||||||
linux-arm64: download-includes
|
linux-arm64: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=aarch64-linux-gnu maven-mvnd/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=arm64
|
||||||
|
|
||||||
linux-ppc64: download-includes
|
linux-ppc64: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=powerpc64le-linux-gnu maven-mvnd/crossbuild make clean-native native OS_NAME=Linux OS_ARCH=ppc64
|
||||||
|
|
||||||
win-x86: download-includes
|
win-x86: download-includes
|
||||||
./docker/dockcross-windows-static-x86 bash -c 'make clean-native native CROSS_PREFIX=i686-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86'
|
./docker/dockcross-windows-static-x86 bash -c 'make clean-native native CROSS_PREFIX=i686-w64-mingw32.static- OS_NAME=Windows OS_ARCH=x86'
|
||||||
@@ -99,25 +121,28 @@ win-x86: download-includes
|
|||||||
win-x86_64: download-includes
|
win-x86_64: download-includes
|
||||||
./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'
|
./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: download-includes
|
mac-x86: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=i386-apple-darwin maven-mvnd/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86
|
||||||
|
|
||||||
mac-x86_64: download-includes
|
mac-x86_64: download-includes crossbuild-uid
|
||||||
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
|
docker run -it --rm -v $$PWD:/workdir \
|
||||||
|
-e BUILDER_UID=$$( id -u ) -e BUILDER_GID=$$( id -g ) -e BUILDER_USER=$$( id -un ) -e BUILDER_GROUP=$$( id -gn ) \
|
||||||
|
-e CROSS_TRIPLE=x86_64-apple-darwin maven-mvnd/crossbuild make clean-native native OS_NAME=Mac OS_ARCH=x86_64
|
||||||
|
|
||||||
mac-arm64: download-includes
|
mac-arm64: download-includes crossbuild-uid
|
||||||
docker run -it --rm -v $$PWD:/src -e TARGET=arm64-apple-darwin mcandre/snek:darwin sh -c "make clean-native native CROSS_PREFIX=arm64-apple-darwin20.4- OS_NAME=Mac OS_ARCH=arm64"
|
docker run -it --rm -v $$PWD:/src \
|
||||||
|
-e TARGET=arm64-apple-darwin mcandre/snek:darwin sh -c "make clean-native native CROSS_PREFIX=arm64-apple-darwin20.4- OS_NAME=Mac OS_ARCH=arm64"
|
||||||
|
|
||||||
freebsd-x86: download-includes
|
freebsd-x86: download-includes
|
||||||
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
|
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: download-includes
|
freebsd-x86_64: download-includes
|
||||||
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
|
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:
|
#sparcv9:
|
||||||
# $(MAKE) native OS_NAME=SunOS OS_ARCH=sparcv9
|
# $(MAKE) native OS_NAME=SunOS OS_ARCH=sparcv9
|
||||||
|
|
||||||
ducible:
|
|
||||||
test -d target/ducible || git clone --branch v1.2.2 https://github.com/jasonwhite/ducible.git target/ducible
|
|
||||||
make --directory=target/ducible ducible CROSS_PREFIX= CXX=g++ CC=gcc
|
|
||||||
|
|
||||||
|
11
native/docker/crossbuild-uid/Dockerfile
Normal file
11
native/docker/crossbuild-uid/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM multiarch/crossbuild
|
||||||
|
RUN cd /tmp; \
|
||||||
|
git clone https://github.com/ncopa/su-exec.git; \
|
||||||
|
cd /tmp/su-exec; \
|
||||||
|
make; \
|
||||||
|
cp su-exec /usr/bin; \
|
||||||
|
rm -Rf /tmp/su-exec
|
||||||
|
ENTRYPOINT [ "/usr/bin/crossbuild-uid", "/usr/bin/crossbuild" ]
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
WORKDIR /workdir
|
||||||
|
COPY crossbuild-uid /usr/bin/crossbuild-uid
|
31
native/docker/crossbuild-uid/crossbuild-uid
Executable file
31
native/docker/crossbuild-uid/crossbuild-uid
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This is the entrypoint script for the dockerfile. Executed in the
|
||||||
|
# container at runtime.
|
||||||
|
|
||||||
|
export PATH_ORIGIN=$PATH
|
||||||
|
export LD_LIBRARY_PATH_ORIGIN=$LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
# If we are running docker natively, we want to create a user in the container
|
||||||
|
# with the same UID and GID as the user on the host machine, so that any files
|
||||||
|
# created are owned by that user. Without this they are all owned by root.
|
||||||
|
# The dockcross script sets the BUILDER_UID and BUILDER_GID vars.
|
||||||
|
if [[ -n $BUILDER_UID ]] && [[ -n $BUILDER_GID ]]; then
|
||||||
|
|
||||||
|
groupadd -o -g $BUILDER_GID $BUILDER_GROUP 2> /dev/null
|
||||||
|
useradd -o -m -g $BUILDER_GID -u $BUILDER_UID $BUILDER_USER 2> /dev/null
|
||||||
|
export HOME=/home/${BUILDER_USER}
|
||||||
|
shopt -s dotglob
|
||||||
|
cp -r /root/* $HOME/
|
||||||
|
chown -R $BUILDER_UID:$BUILDER_GID $HOME
|
||||||
|
|
||||||
|
# Enable passwordless sudo capabilities for the user
|
||||||
|
chown root:$BUILDER_GID $(which su-exec)
|
||||||
|
chmod +s $(which su-exec); sync
|
||||||
|
|
||||||
|
# Run the command as the specified user/group.
|
||||||
|
exec su-exec $BUILDER_UID:$BUILDER_GID "$@"
|
||||||
|
else
|
||||||
|
# Just run the command as root.
|
||||||
|
exec "$@"
|
||||||
|
fi
|
2
pom.xml
2
pom.xml
@@ -334,7 +334,7 @@ limitations under the License.</inlineHeader>
|
|||||||
<exclude>**/*.dll</exclude>
|
<exclude>**/*.dll</exclude>
|
||||||
<exclude>**/*.jnilib</exclude>
|
<exclude>**/*.jnilib</exclude>
|
||||||
<exclude>**/Makefile*</exclude>
|
<exclude>**/Makefile*</exclude>
|
||||||
<exclude>**/docker/*</exclude>
|
<exclude>**/docker/**</exclude>
|
||||||
<exclude>**/*.tpl</exclude>
|
<exclude>**/*.tpl</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
<mapping>
|
<mapping>
|
||||||
|
Reference in New Issue
Block a user