diff --git a/docker/pi4j-docker-rpi-compiler/.dockerignore b/docker/pi4j-docker-rpi-compiler/.dockerignore
deleted file mode 100644
index 78fbd9ca..00000000
--- a/docker/pi4j-docker-rpi-compiler/.dockerignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.git
-.ipynb_checkpoints/*
-.DS_Store
-.gitignore
-README.md
-test
-build.sh
-deploy.sh
-pom.xml
-
-# To prevent storing dev/temporary container data
-*.csv
-tmp
diff --git a/docker/pi4j-docker-rpi-compiler/Dockerfile b/docker/pi4j-docker-rpi-compiler/Dockerfile
deleted file mode 100644
index 43ccf736..00000000
--- a/docker/pi4j-docker-rpi-compiler/Dockerfile
+++ /dev/null
@@ -1,34 +0,0 @@
-FROM ubuntu:18.04
-
-MAINTAINER Robert Savage "robert@pi4j.com"
-
-LABEL com.pi4j.docker.compiler.raspberrypi="{\"Description\":\"Pi4J Cross Compiler Container for Raspberry Pi\",\"Usage\":\"docker run -it -v ~/mybuild:/build pi4j/raspberrypi-compiler\",\"Version\":\"1.0.0\"}"
-
-# make sure ubuntu is up to date and install required GIT binaries
-RUN apt-get update -qq && \
- apt-get install -qq -y git
-
-# get the latest RPI cross compiler tools from the GitHub repo
-RUN git clone --progress --verbose https://github.com/raspberrypi/tools.git --depth=1 /rpi-tools
-
-# install additional build tools and utilities as well as the OpenJDK
-RUN apt-get install -qq -y build-essential && \
- apt-get install -qq -y tree && \
- apt-get install -qq -y nano && \
- apt install -qq -y openjdk-11-jdk
-
-# configure the require environment variables for cross-compiling
-ENV PATH="${PATH}:/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin"
-ENV ARCH="arm"
-ENV CROSS_PREFIX="/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-"
-ENV CCPREFIX="${CROSS_PREFIX}"
-#ENV CC="arm-linux-gnueabihf-gcc"
-ENV RPI_CROSS_COMPILE="true"
-ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/bin/"
-ENV BUILD_FOLDER /build
-ENV BUILD_TARGET="all"
-
-# set the working path to the build mounted volume
-WORKDIR ${BUILD_FOLDER}
-
-CMD ["/bin/bash", "-c", "make clean ${BUILD_TARGET} --always-make -f ${BUILD_FOLDER}/Makefile CROSS_PREFIX=\"${CROSS_PREFIX}\""]
diff --git a/docker/pi4j-docker-rpi-compiler/build.sh b/docker/pi4j-docker-rpi-compiler/build.sh
deleted file mode 100755
index e445caee..00000000
--- a/docker/pi4j-docker-rpi-compiler/build.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash -e
-###
-# #%L
-# **********************************************************************
-# ORGANIZATION : Pi4J
-# PROJECT : Pi4J :: Build Docker Image for Raspberry Pi Cross-Compiler
-# FILENAME : build.sh
-#
-# This file is part of the Pi4J project. More information about
-# this project can be found here: https://pi4j.com/
-# **********************************************************************
-# %%
-# Copyright (C) 2012 - 2020 Pi4J
-# %%
-#
-# Licensed 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.
-#
-# #L%
-###
-
-docker build -t raspberrypi-compiler .
-docker tag raspberrypi-compiler pi4j/raspberrypi-compiler
diff --git a/docker/pi4j-docker-rpi-compiler/deploy.sh b/docker/pi4j-docker-rpi-compiler/deploy.sh
deleted file mode 100755
index 6f625c0d..00000000
--- a/docker/pi4j-docker-rpi-compiler/deploy.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash -e
-###
-# #%L
-# **********************************************************************
-# ORGANIZATION : Pi4J
-# PROJECT : Pi4J :: Deploy Docker Image for Raspberry Pi Cross-Compiler
-# FILENAME : deploy.sh
-#
-# This file is part of the Pi4J project. More information about
-# this project can be found here: https://pi4j.com/
-# **********************************************************************
-# %%
-# Copyright (C) 2012 - 2020 Pi4J
-# %%
-#
-# Licensed 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.
-#
-# #L%
-###
-
-docker login
-docker tag raspberrypi-compiler pi4j/raspberrypi-compiler
-docker push pi4j/raspberrypi-compiler
diff --git a/docker/pi4j-docker-rpi-compiler/pom.xml b/docker/pi4j-docker-rpi-compiler/pom.xml
deleted file mode 100644
index 04f074d6..00000000
--- a/docker/pi4j-docker-rpi-compiler/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
- pi4j-docker
- com.pi4j
- 2.0-SNAPSHOT
- ../pi4j-docker
-
- 4.0.0
-
-
- pi4j-docker-rpi-compiler
- Pi4J :: DOCKER :: RPi Compiler Docker Image
- Raspberry Pi Cross-Compiler Docker Image
- pom
-
-
-
-
-
- com.spotify
- dockerfile-maven-plugin
-
- pi4j/raspberrypi-compiler
-
- true
- ${project.basedir}
-
-
- true
- true
-
-
- ${project.name}
- ${project.version}
- ${project.groupId}.${project.artifactId}
- ${maven.build.timestamp}
- pi4j/raspberrypi-compiler:${project.version}
-
-
-
-
-
- build-docker-image
- package
-
- build
-
-
-
- push-version
- deploy
-
- push
-
-
-
-
-
-
-
diff --git a/docker/pi4j-docker/pom.xml b/docker/pi4j-docker/pom.xml
deleted file mode 100644
index 35849b89..00000000
--- a/docker/pi4j-docker/pom.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
- pi4j-parent
- com.pi4j
- 2.0-SNAPSHOT
-
- 4.0.0
-
-
- pi4j-docker
- Pi4J :: DOCKER :: Docker Parent POM
- Cross-Compiler Docker Images
- pom
-
-
-
-
-
- docker
-
- ../pi4j-docker-rpi-compiler
-
-
-
-
-
-
-
-
- ${project.build.directory}
- false
-
- LICENSE.txt
- NOTICE.txt
- README.md
-
-
-
- src/main/resources
-
- **/**
-
-
-
-
-
-
-
- org.codehaus.mojo
- license-maven-plugin
-
- false
-
-
-
- append-license-file-headers
-
- update-file-header
-
- process-sources
-
- lgpl_v3
- ${basedir}/../../src/license/template.ftl
- true
- true
- true
-
- *.sh
-
-
- src/main/native
- src/main/java
- src/test
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
-
-
-
-
-
-
- oss-snapshots-repo
- Sonatype OSS Maven Repository
- https://oss.sonatype.org/content/groups/public
-
- true
- always
-
-
-
-
diff --git a/libraries/pi4j-library-pigpio/pom.xml b/libraries/pi4j-library-pigpio/pom.xml
index c1f19ad7..66e7075f 100644
--- a/libraries/pi4j-library-pigpio/pom.xml
+++ b/libraries/pi4j-library-pigpio/pom.xml
@@ -51,7 +51,8 @@
LICENSE.txt
NOTICE.txt
README.md
- lib/libpi4j-pigpio.so
+ lib/armhf/libpi4j-pigpio.so
+ lib/aarch64/libpi4j-pigpio.so
@@ -63,7 +64,7 @@
-
+
org.apache.maven.plugins
@@ -79,7 +80,10 @@
- ${project.build.outputDirectory}/lib/libpi4j-pigpio.so
+
+ ${project.build.outputDirectory}/lib/armhf/libpi4j-pigpio.so
+
+ ${project.build.outputDirectory}/lib/aarch64/libpi4j-pigpio.so
@@ -136,7 +140,10 @@
-
+
+
+
+
@@ -198,16 +205,31 @@
-
+
${project.groupId}
${project.artifactId}
${project.version}
+ armhf
so
true
- ${project.build.directory}/lib
+ ${project.build.directory}/lib/armhf
+ libpi4j-pigpio.so
+
+
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ so
+ aarch64
+ true
+ ${project.build.directory}/lib/aarch64
libpi4j-pigpio.so
@@ -258,8 +280,10 @@
+
-
+
pi4j-build-native
generate-resources
@@ -268,13 +292,43 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file="${project.build.directory}/build/native/lib/aarch64/libpi4j-pigpio.so"
+ todir="${project.build.directory}/lib/aarch64"/>
diff --git a/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/util/NativeLibraryLoader.java b/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/util/NativeLibraryLoader.java
index 52b73b1c..338d6be8 100644
--- a/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/util/NativeLibraryLoader.java
+++ b/libraries/pi4j-library-pigpio/src/main/java/com/pi4j/library/pigpio/util/NativeLibraryLoader.java
@@ -87,7 +87,26 @@ public static synchronized void load(String fileName, String libName) {
// if there is no overriding library path defined, then attempt to load native library from embedded resource
else {
- String path = "/lib/" + fileName;
+ // get CPU architecture from system properties
+ String osArch = System.getProperty("os.arch").toLowerCase();
+
+ // sanitize CPU architecture string
+ switch (osArch) {
+ case "arm":
+ osArch = "armhf";
+ break;
+ case "arm64":
+ osArch = "aarch64";
+ break;
+ case "aarch64":
+ break;
+ default:
+ throw new IllegalStateException("Pi4J has detected and UNKNOWN/UNSUPPORTED 'os.arch' : [" +
+ osArch + "]; only 'arm|armhf' and 'arm64|aarch64' are supported.");
+ }
+
+ // include the CPU architecture in the embedded path
+ String path = "/lib/" + osArch + "/" + fileName;
logger.debug("Attempting to load library [" + fileName + "] using path: [" + path + "]");
try {
loadLibraryFromClasspath(path);
diff --git a/libraries/pi4j-library-pigpio/src/main/native/Makefile b/libraries/pi4j-library-pigpio/src/main/native/Makefile
index 75600269..01bcefca 100644
--- a/libraries/pi4j-library-pigpio/src/main/native/Makefile
+++ b/libraries/pi4j-library-pigpio/src/main/native/Makefile
@@ -3,9 +3,9 @@
# pi4j-pigpio - Pi4J Java (JNI) library wrapper for PIGPIO
#
-
#DEBUG = -g -O0
-DEBUG = -O3
+ARCH := armhf
+DEBUG = -O3
CC = $(CROSS_PREFIX)gcc
AR = $(CROSS_PREFIX)ar
RANLIB = $(CROSS_PREFIX)ranlib
@@ -27,7 +27,7 @@ INCLUDE = -I. -Ipigpio \
-I/usr/local/include -I/usr/local/include/linux
CFLAGS := $(DEBUG) -Wall $(INCLUDE) -Winline -pipe $(CARGS) -fPIC
-LIBS = -L pigpio -lpigpio -lrt
+LIBS = -L lib/$(ARCH) -L pigpio -lpigpio -lrt
TARGET=libpi4j-pigpio.so
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build-docker.sh b/libraries/pi4j-library-pigpio/src/main/native/build-docker.sh
new file mode 100755
index 00000000..3d8e640a
--- /dev/null
+++ b/libraries/pi4j-library-pigpio/src/main/native/build-docker.sh
@@ -0,0 +1,59 @@
+#!/bin/bash -e
+###
+# #%L
+# **********************************************************************
+# ORGANIZATION : Pi4J
+# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
+# FILENAME : build-docker.sh
+#
+# This file is part of the Pi4J project. More information about
+# this project can be found here: https://pi4j.com/
+# **********************************************************************
+# %%
+# Copyright (C) 2012 - 2019 Pi4J
+# %%
+#
+# Licensed 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.
+#
+# #L%
+###
+
+echo
+echo "**********************************************************************"
+echo "**********************************************************************"
+echo "* *"
+echo "* COMPILE Pi4J NATIVE LIBRARIES USING Pi4J DOCKER BUILDER IMAGE *"
+echo "* *"
+echo "**********************************************************************"
+echo "**********************************************************************"
+echo
+
+# validate compatible that "docker" exists
+DOCKER=$(which docker)
+if [[ ("$DOCKER" == "") ]]; then
+ echo "This native build is requires that 'docker' (https://www.docker.com/) is "
+ echo "installed and running on an Intel/AMD or ARM 64-bit platform."
+ echo "BUILD ABORTED; REASON: Missing 'docker' executable."
+ exit
+fi
+
+# set executable permissions on build scripts
+chmod +x build.sh
+
+# -------------------------------------------------------------
+# BUILD NATIVE LIBRARIES USING THE Pi4J DOCKER BUILDER IMAGE
+# FOR ARMv6,ARMv7, ARMv8 32-BIT (ARMHF)
+# FOR ARMv8 64-BIT (ARM64)
+# -------------------------------------------------------------
+docker pull pi4j/pi4j-builder-native:2.0
+docker run --user "$(id -u):$(id -g)" --rm --volume $(pwd):/build pi4j/pi4j-builder-native:2.0 $@
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build-libpi4j.sh b/libraries/pi4j-library-pigpio/src/main/native/build-libpi4j.sh
new file mode 100644
index 00000000..99f303ce
--- /dev/null
+++ b/libraries/pi4j-library-pigpio/src/main/native/build-libpi4j.sh
@@ -0,0 +1,76 @@
+#!/bin/bash -e
+###
+# #%L
+# **********************************************************************
+# ORGANIZATION : Pi4J
+# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
+# FILENAME : build-libpi4j.sh
+#
+# This file is part of the Pi4J project. More information about
+# this project can be found here: https://pi4j.com/
+# **********************************************************************
+# %%
+# Copyright (C) 2012 - 2020 Pi4J
+# %%
+#
+# Licensed 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.
+#
+# #L%
+###
+
+# ----------------------------------------------
+# build latest Pi4J PiGPIO JNI Wrapper Library
+# ----------------------------------------------
+
+echo
+echo "============================================================================="
+echo " STARTED BUILDING Pi4J-PIGPIO JNI NATIVE LIBRARY: ('${ARCH}/libpi4j-pigpio')"
+echo "============================================================================="
+echo " - FOR ARCHITECTURE : ${ARCH}"
+echo " - USING COMPILER : ${CC}"
+echo " - USING CROSS PREFIX : ${CROSS_PREFIX}"
+echo "-----------------------------------------------------------------------------"
+echo
+
+# ------------------------------------------------------
+# BUILD LIBPIGPIO DEPENDENCY LIBRARY
+# ------------------------------------------------------
+
+# determine if the pigpio library has already been cloned and compiled on this system
+if [[ -d "pigpio" ]] && [[ -f "lib/$ARCH/libpigpio.so" ]] ; then
+ echo "The 'pigpio' library already exists; if you wish to rebuild, run a CLEAN build."
+else
+ ./build-libpigpio.sh $@
+fi
+
+# ------------------------------------------------------
+# BUILD LIBPI4J-PIGPIO
+# ------------------------------------------------------
+echo
+echo "====================================="
+echo "BUILDING: ${ARCH}/libpi4j-pigpio"
+echo "====================================="
+
+# perform compile
+make clean all \
+ --always-make \
+ CROSS_PREFIX=${CROSS_PREFIX} \
+ CC=${CC} \
+ ARCH=${ARCH} \
+ TARGET=lib/${ARCH}/libpi4j-pigpio.so $@
+
+echo
+echo "-----------------------------------------------------------------------------"
+echo " FINISHED BUILDING Pi4J-PIGPIO JNI NATIVE LIBRARY: ('${ARCH}/libpi4j-pigpio')"
+echo "-----------------------------------------------------------------------------"
+echo
\ No newline at end of file
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build-pigpio.sh b/libraries/pi4j-library-pigpio/src/main/native/build-libpigpio.sh
similarity index 61%
rename from libraries/pi4j-library-pigpio/src/main/native/build-pigpio.sh
rename to libraries/pi4j-library-pigpio/src/main/native/build-libpigpio.sh
index def6c1a6..c0e73633 100755
--- a/libraries/pi4j-library-pigpio/src/main/native/build-pigpio.sh
+++ b/libraries/pi4j-library-pigpio/src/main/native/build-libpigpio.sh
@@ -4,7 +4,7 @@
# **********************************************************************
# ORGANIZATION : Pi4J
# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
-# FILENAME : build.sh
+# FILENAME : build-libpigpio.sh
#
# This file is part of the Pi4J project. More information about
# this project can be found here: https://pi4j.com/
@@ -42,10 +42,9 @@ if [ -z $PIGPIO_DIRECTORY ]; then
PIGPIO_DIRECTORY=pigpio
fi
-
-echo "============================"
-echo "Building PIGPIO Library "
-echo "============================"
+echo "====================================="
+echo "BUILDING: ${ARCH}/libpigpio"
+echo "====================================="
echo "REPOSITORY : $PIGPIO_REPO"
echo "BRANCH : $PIGPIO_BRANCH"
echo "DIRECTORY : $PIGPIO_DIRECTORY"
@@ -54,35 +53,23 @@ echo "DIRECTORY : $PIGPIO_DIRECTORY"
# clone PIGPIO from github
# ----------------------------------
rm -rf $PIGPIO_DIRECTORY
-git clone $PIGPIO_REPO -b $PIGPIO_BRANCH $PIGPIO_DIRECTORY
+git clone $PIGPIO_REPO -b $PIGPIO_BRANCH $PIGPIO_DIRECTORY --single-branch --depth 1
#rm -f pigpio.tar
#wget abyz.me.uk/rpi/pigpio/pigpio.tar
#tar xf pigpio.tar
-
# ----------------------------------
# build latest PIGPIO
# ----------------------------------
-echo
-echo "============================"
-echo "PIGPIO Build script"
-echo "============================"
-echo
-echo "Compiling PIGPIO library"
-
-echo "-----------------------------------------------------------"
-echo "Compiling 'libpigpio' library "
-echo "PI4J NATIVE COMPILER: $PI4J_NATIVE_COMPILER"
-echo "-----------------------------------------------------------"
cd $PIGPIO_DIRECTORY
-if [[ "$PI4J_NATIVE_COMPILER" == "DOCKER-COMPILER" || "$PI4J_NATIVE_COMPILER" == "docker-compiler" ]]; then
- docker run --env BUILD_TARGET=lib -v $(PWD):/build pi4j/raspberrypi-compiler
-elif [[ "$PI4J_NATIVE_COMPILER" == "CROSS-COMPILER" || "$PI4J_NATIVE_COMPILER" == "cross-compiler" ]]; then
- make clean lib --always-make CROSS_PREFIX=${CROSS_PREFIX}
-else
- make clean lib --always-make
-fi
-echo "-----------------------------------------------------------"
-echo "Compiling 'libpigpio' "
-echo "-----------------------------------------------------------"
+make clean lib --always-make \
+ CROSS_PREFIX=${CROSS_PREFIX} \
+ CC=$CC \
+ ARCH=$ARCH
+
+#echo "Copying PIGPIO library files to parent 'lib' folder"
+mkdir -p ../lib/${ARCH}
+cp libpigpio.so ../lib/${ARCH}/libpigpio.so
+cp libpigpiod_if.so ../lib/${ARCH}/libpigpiod_if.so
+cp libpigpiod_if2.so ../lib/${ARCH}/libpigpiod_if2.so
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build-pi4j.sh b/libraries/pi4j-library-pigpio/src/main/native/build-pi4j.sh
deleted file mode 100644
index 01c4b022..00000000
--- a/libraries/pi4j-library-pigpio/src/main/native/build-pi4j.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/bash -e
-###
-# #%L
-# **********************************************************************
-# ORGANIZATION : Pi4J
-# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
-# FILENAME : build.sh
-#
-# This file is part of the Pi4J project. More information about
-# this project can be found here: https://pi4j.com/
-# **********************************************************************
-# %%
-# Copyright (C) 2012 - 2020 Pi4J
-# %%
-#
-# Licensed 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.
-#
-# #L%
-###
-
-# ----------------------------------
-# build latest Pi4J JNI Library
-# ----------------------------------
-echo
-echo "============================"
-echo "Pi4J JNI Build script"
-echo "============================"
-echo
-echo "-----------------------------------------------------------"
-echo "Compiling 'pi4j-pigpio' JNI library "
-echo "PI4J NATIVE COMPILER: $PI4J_NATIVE_COMPILER"
-echo "-----------------------------------------------------------"
-if [[ "$PI4J_NATIVE_COMPILER" == "DOCKER-COMPILER" || "$PI4J_NATIVE_COMPILER" == "docker-compiler" ]]; then
- docker run -v $(PWD):/build pi4j/raspberrypi-compiler
-elif [[ "$PI4J_NATIVE_COMPILER" == "CROSS-COMPILER" || "$PI4J_NATIVE_COMPILER" == "cross-compiler" ]]; then
- make clean all --always-make CROSS_PREFIX=${CROSS_PREFIX}
-else
- make clean all --always-make
-fi
-echo "-----------------------------------------------------------"
-echo "Compiling 'pi4j-pigpio' "
-echo "-----------------------------------------------------------"
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build-prerequisites.sh b/libraries/pi4j-library-pigpio/src/main/native/build-prerequisites.sh
index bc75c0d4..50c757d3 100755
--- a/libraries/pi4j-library-pigpio/src/main/native/build-prerequisites.sh
+++ b/libraries/pi4j-library-pigpio/src/main/native/build-prerequisites.sh
@@ -3,8 +3,8 @@
# #%L
# **********************************************************************
# ORGANIZATION : Pi4J
-# PROJECT : Pi4J :: JNI Native Library
-# FILENAME : install-prerequisites.sh
+# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
+# FILENAME : build-prerequisites.sh
#
# This file is part of the Pi4J project. More information about
# this project can be found here: https://pi4j.com/
@@ -55,4 +55,22 @@ if [ ! -z "`type apt-get 2>/dev/null;`" ]; then
else
echo " [PREREQUISITE] 'tree' already installed.";
fi
+
+ # gcc-arm-linux-gnueabihf
+ GCC_ARMHF_INSTALLED=$(dpkg-query -W --showformat='${Status}\n' gcc-arm-linux-gnueabihf)
+ if [[ "$?" == "1" ]] ; then
+ echo " [PREREQUISITE] installing 'gcc-arm-linux-gnueabihf'...";
+ sudo apt-get --force-yes --yes install gcc-arm-linux-gnueabihf
+ else
+ echo " [PREREQUISITE] 'gcc-arm-linux-gnueabihf' already installed.";
+ fi
+
+ # gcc-aarch64-linux-gnu
+ GCC_AARCH64_INSTALLED=$(dpkg-query -W --showformat='${Status}\n' gcc-aarch64-linux-gnu)
+ if [[ "$?" == "1" ]] ; then
+ echo " [PREREQUISITE] installing 'gcc-aarch64-linux-gnu'...";
+ sudo apt-get --force-yes --yes install gcc-aarch64-linux-gnu
+ else
+ echo " [PREREQUISITE] 'gcc-aarch64-linux-gnu' already installed.";
+ fi
fi
diff --git a/libraries/pi4j-library-pigpio/src/main/native/build.sh b/libraries/pi4j-library-pigpio/src/main/native/build.sh
index 5d12ec94..a314afd2 100755
--- a/libraries/pi4j-library-pigpio/src/main/native/build.sh
+++ b/libraries/pi4j-library-pigpio/src/main/native/build.sh
@@ -3,7 +3,7 @@
# #%L
# **********************************************************************
# ORGANIZATION : Pi4J
-# PROJECT : Pi4J :: JNI Native Library
+# PROJECT : Pi4J :: JNI Native Binding Library for PIGPIO
# FILENAME : build.sh
#
# This file is part of the Pi4J project. More information about
@@ -28,24 +28,58 @@
# #L%
###
+echo
+echo "**********************************************************************"
+echo "* *"
+echo "* Pi4J PIGPIO LIBRARY NATIVE BUILD *"
+echo "* *"
+echo "**********************************************************************"
+echo
+
+# ------------------------------------------------------
+# VALIDATE BUILD PLATFORM; PRECONDITIONS
+# ------------------------------------------------------
+
+# validate compatible OS/Kernel
+KERNEL=$(uname -s)
+if [[ ("$KERNEL" != "Linux") ]]; then
+ echo "This native build is only supported on Linux-based systems running on an Intel/AMD or ARM 64-bit platform."
+ echo "BUILD ABORTED; REASON: KERNEL='$KERNEL'; EXPECTED='Linux'"
+ echo "(NOTE: You can run this build using the Pi4J Docker Builder images from OSX, Windows, Linux.)"
+ exit
+fi
+
+# validate compatible CPU architecture
+ARCHITECTURE=$(uname -m)
+if [[ (("$ARCHITECTURE" != "aarch64") && ("$ARCHITECTURE" != "amd64") && ("$ARCHITECTURE" != "x86_64")) ]]; then
+ echo "This native build is only supported on Linux-based systems running on an Intel/AMD or ARM 64-bit platform."
+ echo "BUILD ABORTED; REASON: ARCHITECTURE='$ARCHITECTURE'; EXPECTED='aarch64|amd64|x86_64'"
+ exit
+fi
+
+# ------------------------------------------------------
+# ENSURE DEPENDENCY SCRIPTS ARE EXECUTABLE
+# ------------------------------------------------------
# set executable permissions on build scripts
chmod +x build-prerequisites.sh
-chmod +x build-pigpio.sh
-chmod +x build-pi4j.sh
+chmod +x build-libpigpio.sh
+chmod +x build-libpi4j.sh
# ------------------------------------------------------
# INSTALL BUILD PREREQUISITES
# ------------------------------------------------------
-ARCHITECTURE=$(uname -m)
-echo "PLATFORM ARCH: $ARCHITECTURE"
-if [[ ( "$ARCHITECTURE" = "armv7l") || ("$ARCHITECTURE" = "armv6l") ]]; then
- echo
- echo "**********************************************************************"
- echo "* *"
- echo "* INSTALLING Pi4J BUILD PREREQUISITES *"
- echo "* *"
- echo "**********************************************************************"
- echo
+echo
+echo "====================================="
+echo " INSTALLING Pi4J BUILD PREREQUISITES "
+echo "====================================="
+echo
+
+# if running inside a Pi4J Docker Builder image, then there is no need to install prerequisites
+if [[ "${PI4J_BUILDER}" != "" ]]; then
+ echo "Running inside a Pi4J Docker Builder image; [version=${PI4J_BUILDER}; arch=${PI4J_BUILDER_ARCH}]"
+ echo "No need to check or install build environment prerequisites."
+else
+ # if this is a Linux-based system and a 64-bit Intel/AMD or ARM platform, then we can install the prerequisites
# download and install development prerequisites
./build-prerequisites.sh
fi
@@ -54,11 +88,9 @@ fi
# JAVA_HOME ENVIRONMENT VARIABLE
# ------------------------------------------------------
echo
-echo "**********************************************************************"
-echo "* *"
-echo "* CHECKING JAVA_HOME ENVIRONMENT VARIABLE *"
-echo "* *"
-echo "**********************************************************************"
+echo "========================================="
+echo " CHECKING JAVA_HOME ENVIRONMENT VARIABLE "
+echo "========================================="
echo
if [[ -n "$JAVA_HOME" ]]; then
echo "'JAVA_HOME' already defined as: $JAVA_HOME";
@@ -68,39 +100,32 @@ else
fi
# ------------------------------------------------------
-# PIGPIO
+# BUILD NATIVE LIBRARIES FOR ARMv6,ARMv7,ARMv8 32-BIT (ARMHF)
+# USING THE LOCALLY INSTALLED ARM CROSS-COMPILER
# ------------------------------------------------------
-echo
-echo "**********************************************************************"
-echo "* *"
-echo "* BUILDING PIGPIO LIBRARY (DEPENDENCY) *"
-echo "* *"
-echo "**********************************************************************"
-echo
-if [[ -d "pigpio" ]] ; then
- echo "The 'pigpio' library already exists; if you wish to rebuild, run a CLEAN build."
-else
- ./build-pigpio.sh $@
-fi
-
+export CROSS_PREFIX=arm-linux-gnueabihf-
+export CC=arm-linux-gnueabihf-gcc
+export ARCH=armhf
+./build-libpi4j.sh $@
# ------------------------------------------------------
-# Pi4J JNI Native Library
+# BUILD NATIVE LIBRARIES FOR ARMv8 64-BIT (ARM64)
+# USING THE LOCALLY INSTALLED ARM64 CROSS-COMPILER
# ------------------------------------------------------
-echo
-echo "**********************************************************************"
-echo "* *"
-echo "* BUILDING Pi4J JNI -> PIGPIO LIBRARY *"
-echo "* *"
-echo "**********************************************************************"
-echo
-./build-pi4j.sh $@
+export CROSS_PREFIX=aarch64-linux-gnu-
+export CC=aarch64-linux-gnu-gcc
+export ARCH=aarch64
+./build-libpi4j.sh $@
+
+echo "======================================"
+echo " Pi4J PIGPIO LIBRARY NATIVE ARTIFACTS "
+echo "======================================"
+tree -R lib
echo
echo "**********************************************************************"
echo "* *"
-echo "* Pi4J JNI BUILD COMPLETE *"
+echo "* Pi4J PIGPIO LIBRARY NATIVE BUILD *"
echo "* *"
echo "**********************************************************************"
-echo
-ls -la lib*
+echo
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index e664acf0..85394c1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,7 +146,6 @@
- docker/pi4j-docker
libraries/pi4j-library
pi4j-core
plugins/pi4j-plugin
@@ -158,16 +157,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- HOST-COMPILER
-
+ CROSS-COMPILER
@@ -244,7 +255,6 @@
3.0.0
1.4
1.0.0
- 1.4.13
3.1.0
@@ -618,14 +628,6 @@
maven-enforcer-plugin
3.0.0-M2
-
-
-
- com.spotify
- dockerfile-maven-plugin
- ${dockerfile-maven-plugin.version}
-
-
@@ -900,16 +902,6 @@
-
-
- docker
-
-
- release-build
-
-
-
-
native