diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf8ff50..ddbbd12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,34 +8,58 @@ on: jobs: build_and_deploy: - # Using standard x86-64 runner for cross-compilation - runs-on: ubuntu-latest - + # Use the standard runner, the container handles the x86-64 to cross-compile setup + runs-on: ubuntu-latest + + # --- JOB-LEVEL CONTAINER DEFINITION --- + # This runs the entire job inside the Debian environment, making all 'run' steps clean. + container: + image: debian:bullseye + steps: + # 1. Checkout the source code (this runs INSIDE the container and populates /github/workspace) - uses: actions/checkout@v4 - # CONSOLIDATED STEP FOR DUAL-ARCH BUILD (ARM64 & ARMHF) - - name: Compile AqualinkD for ARM64 and ARMHF inside Debian Container - # Using the official x86 Debian image - uses: docker://debian:bookworm - with: - entrypoint: /bin/bash - # Using the standard multi-arch Debian image. Adding arm64 and armhf toolchain - run: | - dpkg --add-architecture armhf - dpkg --add-architecture arm64 + # 2. Optimized Cross-Compile step + - name: Setup build environment for ARM64 and ARMHF + # Using a standard 'run' block as we are already inside the container + run: | + # Enable cross-architectures + dpkg --add-architecture armhf && dpkg --add-architecture arm64 && \ + + # Update and Install ALL dependencies (APT requires update after add-architecture) + apt-get update -y && \ + apt-get install -y build-essential crossbuild-essential-armhf crossbuild-essential-arm64 libsystemd-dev libsystemd-dev:arm64 libsystemd-dev:armhf - apt-get update -y - apt-get install -y build-essential crossbuild-essential-armhf crossbuild-essential-arm64 libsystemd-dev libsystemd-dev:arm64 libsystemd-dev:armhf - - echo '--- Building AqualinkD (ARM64 & ARMHF) ---' - make clean - make buildrelease - + SYSR_ROOT=/glibc224_sysroot + mkdir -p $SYSR_ROOT + + # --- ARMHF (32-bit) Setup --- + echo "Setting up ARMHF sysroot..." + # Download and extract the development and runtime packages + wget ${STRETCH_MIRROR}libc6-dev_2.24-11+deb9u4_armhf.deb -O /tmp/libc6-dev-armhf.deb + wget ${STRETCH_MIRROR}libc6_2.24-11+deb9u4_armhf.deb -O /tmp/libc6-armhf.deb + # Extract files into the cross-compiler's default path for its sysroot + dpkg-deb -x /tmp/libc6-dev-armhf.deb $SYSR_ROOT/arm-linux-gnueabihf + dpkg-deb -x /tmp/libc6-armhf.deb $SYSR_ROOT/arm-linux-gnueabihf + + # 2.4. Cleanup downloads and set environment variables + rm /tmp/libc6-*.deb + + # These variables are CRITICAL for the next step: + echo "GLIBC_SYSR_ARMHF=$SYSR_ROOT/arm-linux-gnueabihf" >> $GITHUB_ENV + + - name: Compile AqualinkD + # Using a standard 'run' block as we are already inside the container + run: | + make clean && \ + make SYSR_ARMHF=${{ env.GLIBC_SYSR_ARMHF }} buildrelease + + # The remaining steps automatically run inside the container as well - name: Create release archive # This step correctly archives both resulting binaries from the workspace - run: tar -czvf aqualinkd-build.tar.gz web/ release/aqualinkd_arm64 release/aqualinkd_armhf + run: tar -czvf aqualinkd-build.tar.gz web/ release/ # --- Step 1: Create/Update the Draft Development Release --- - name: Create or Update GitHub Draft Release diff --git a/.github/workflows/docker-workflow.yml b/.github/workflows/docker-workflow.yml deleted file mode 100644 index 30243e5..0000000 --- a/.github/workflows/docker-workflow.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: TEST AqualinkD build Workflow -on: - push: - branches: [ main ] - tags: - - 'v*.*.*' - workflow_dispatch: # Allow manual run - -jobs: - build_and_deploy: - # Use the standard runner, the container handles the x86-64 to cross-compile setup - runs-on: ubuntu-latest - - # --- JOB-LEVEL CONTAINER DEFINITION --- - # This runs the entire job inside the Debian environment, making all 'run' steps clean. - container: - image: debian:bullseye - - steps: - # 1. Checkout the source code (this runs INSIDE the container and populates /github/workspace) - - uses: actions/checkout@v4 - - # 2. Optimized Cross-Compile step - - name: Setup build environment for ARM64 and ARMHF - # Using a standard 'run' block as we are already inside the container - run: | - # Enable cross-architectures - dpkg --add-architecture armhf && dpkg --add-architecture arm64 && \ - - # Update and Install ALL dependencies (APT requires update after add-architecture) - apt-get update -y && \ - apt-get install -y build-essential crossbuild-essential-armhf crossbuild-essential-arm64 libsystemd-dev libsystemd-dev:arm64 libsystemd-dev:armhf - - - name: Compile AqualinkD - # Using a standard 'run' block as we are already inside the container - run: | - make clean && \ - make buildrelease && \ - ls -alR && \ - pwd - - # The remaining steps automatically run inside the container as well - - - name: Create release archive - # This step correctly archives both resulting binaries from the workspace - run: tar -czvf aqualinkd-build.tar.gz web/ release/ - - # --- Step 1: Create/Update the Draft Development Release --- - - name: Create or Update GitHub Draft Release - if: | - ${{ - github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') - || github.event_name == 'workflow_dispatch' - }} - uses: softprops/action-gh-release@v2 - with: - files: aqualinkd-build.tar.gz - overwrite: true - tag_name: development-latest - name: Development Build (Latest Main/Manual) - draft: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # --- Step 2: Create the Formal Versioned Release --- - - name: Create Final GitHub Release - if: ${{ startsWith(github.ref, 'refs/tags/') }} - uses: softprops/action-gh-release@v2 - with: - files: aqualinkd-build.tar.gz - overwrite: true - tag_name: ${{ github.ref_name }} - name: AqualinkD Release ${{ github.ref_name }} - draft: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index 71c72ae..0c2f016 100755 --- a/Makefile +++ b/Makefile @@ -13,6 +13,14 @@ AQ_PDA = true AQ_MANAGER = true + +# The value is empty if not passed via the command line. +SYSR_ARMHF ?= +SYSR_ARM64 ?= +# If SYSR_ARMHF is empty, the --sysroot flag will be empty, +SYSR_ARMHF_FLAG = $(if $(SYSR_ARMHF), --sysroot=$(SYSR_ARMHF),) +SYSR_ARM64_FLAG = $(if $(SYSR_ARM64), --sysroot=$(SYSR_ARM64),) + #AQ_CONTAINER = false // this is for compiling for containers # define the C compiler(s) to use @@ -332,10 +340,10 @@ $(MAIN_ARM64): $(OBJ_FILES_ARM64) $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS) $(MAIN_ARMHF): $(OBJ_FILES_ARMHF) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS) + $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS) $(SYSR_ARMHF_FLAG) $(MAIN_AMD64): $(OBJ_FILES_AMD64) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS) + $(CC) $(CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS) $(SYSR_ARM64_FLAG) $(DEBG): $(DBG_OBJ_FILES) $(CC) $(DBG_CFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)