diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b568ae3..590b755 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,10 +72,35 @@ jobs: fetch-depth: 0 - name: Run build script - run: vcvarsx86_amd64 & ./build_windows.bat + shell: cmd + run: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" & build_windows.bat - name: Upload ZIP package uses: actions/upload-artifact@v3 with: name: ZIP package (MSVC) path: winbuild/aptdec_*.zip + + build_linux_armhf: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + + - name: Run build script + run: docker run -v $(pwd):/aptdec:z -w /aptdec debian:11 ./build_arm.sh + + - name: Upload DEB package + uses: actions/upload-artifact@v3 + with: + name: DEB package (ARM) + path: build/aptdec_*.deb + + - name: Upload TGZ package + uses: actions/upload-artifact@v3 + with: + name: TGZ package (ARM) + path: build/aptdec_*.tar.gz diff --git a/.gitignore b/.gitignore index d4e410a..0febd33 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,4 @@ zlib/ libpng/ libsndfile-*-win64.zip libsndfile-*-win64/ +root/ diff --git a/CMakeLists.txt b/CMakeLists.txt index e5f3a09..4c99a00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,13 +79,14 @@ endif() install(TARGETS aptdec PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/aptdec LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) # Packaging -set(CPACK_PACKAGE_VERSION "${VERSION}") +string(REPLACE v "" CPACK_PACKAGE_VERSION ${VERSION}) +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) set(CPACK_PACKAGE_NAME "aptdec") set(CPACK_PACKAGE_CONTACT "Xerbo (xerbo@protonmail.com)") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NOAA APT satellite imagery decoder") set(CPACK_PACKAGE_DESCRIPTION "Aptdec is a FOSS library/program that decodes images transmitted by the NOAA POES weather satellites. These satellites transmit constantly (among other things) medium resolution (4km/px) images of the earth over a analog mode called APT.") set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}") -set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libsndfile1, libpng16-16") if(WIN32) file(GLOB DLLS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/*.dll) diff --git a/build_arm.sh b/build_arm.sh new file mode 100755 index 0000000..7c44c9c --- /dev/null +++ b/build_arm.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# This script only works on Debian Bullseye +# If you have docker this is trivially easy: +# docker run -v $(pwd):/aptdec:z -w /aptdec debian:11 ./build_arm.sh + +apt-get update +apt-get install -y debootstrap cmake gcc-arm-linux-gnueabihf + +# Prepare armhf root environment +if [ ! -d root ]; then + debootstrap --keyring=/usr/share/keyrings/debian-archive-keyring.gpg --arch=armhf --include=libsndfile1-dev,libpng-dev --download-only bullseye root http://deb.debian.org/debian/ + for i in root/var/cache/apt/archives/*.deb; do dpkg -x "$i" root; done +fi + +# Build aptdec +cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-armhf.cmake -DCMAKE_INSTALL_PREFIX=/aptdec/root +cmake --build build -j$(nproc) +cmake --build build --target package diff --git a/cmake/toolchain-armhf.cmake b/cmake/toolchain-armhf.cmake new file mode 100644 index 0000000..6e5a70a --- /dev/null +++ b/cmake/toolchain-armhf.cmake @@ -0,0 +1,19 @@ +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_PROCESSOR armhf) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) +SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/arm-linux-gnueabihf/ ${CMAKE_INSTALL_PREFIX}) +# Hack +link_directories(${CMAKE_INSTALL_PREFIX}/lib/arm-linux-gnueabihf) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)