diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 3fa53b5..5b52175 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -55,11 +55,12 @@ jobs: git clone http://oauth2:$GITHUB_TOKEN@git.such.software:3000/${{ github.repository }}.git . git submodule update --init --recursive - # --- FIX 1: Robust 'final' removal using Perl (Handles whitespace better than sed) --- + # --- FIX 1: Robust Regex Patch (Handles any whitespace) --- - name: Patch Source Code run: | echo "Patching src/rest_server.cpp..." - perl -pi -e 's/struct rest_server::handler_loop final/struct rest_server::handler_loop/g' src/rest_server.cpp + # \s+ matches one or more spaces/tabs. This guarantees the match. + perl -pi -e 's/struct\s+rest_server::handler_loop\s+final/struct rest_server::handler_loop/g' src/rest_server.cpp - name: Download Static SDK run: | @@ -75,15 +76,19 @@ jobs: mkdir -p /opt/wownero-sdk tar -xf sdk.tar.gz -C /opt/wownero-sdk - # --- FIX 2: Normalize SDK Libraries (Fixes missing libhidapi.a) --- + # --- FIX 2: Create Aliases for Missing Libraries --- - name: Fix SDK Libraries run: | - echo "Fixing missing library names..." - # If libhidapi-libusb.a exists but libhidapi.a doesn't, copy it. - if [ -f /opt/wownero-sdk/lib/libhidapi-libusb.a ] && [ ! -f /opt/wownero-sdk/lib/libhidapi.a ]; then - echo "Found libhidapi-libusb.a, creating libhidapi.a alias..." - cp /opt/wownero-sdk/lib/libhidapi-libusb.a /opt/wownero-sdk/lib/libhidapi.a + echo "Fixing library aliases..." + cd /opt/wownero-sdk/lib + + # Fix hidapi (LWS expects libhidapi.a, we built libhidapi-libusb.a) + if [ -f libhidapi-libusb.a ] && [ ! -f libhidapi.a ]; then + cp libhidapi-libusb.a libhidapi.a fi + + # Ensure zstd/event exist for Windows (optional check) + ls -lh *.a - name: Install Modern CMake run: | @@ -99,7 +104,7 @@ jobs: PLATFORM_FLAGS="" if [ "${{ matrix.target }}" == "x86_64-w64-mingw32" ]; then - # WINDOWS: Force static, allow duplicates, fix lib paths + # WINDOWS: Force static, allow duplicates, explicit lib paths PLATFORM_FLAGS="-DCMAKE_SYSTEM_NAME=Windows \ -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \ -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \ @@ -111,20 +116,21 @@ jobs: -DLIBEVENT_INCLUDE_DIR=$SDK_DIR/include" elif [ "${{ matrix.target }}" == "aarch64-linux-gnu" ]; then + # FIX 3: REMOVE CMAKE_LINKER. Let g++ find the right ld. PLATFORM_FLAGS="-DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_SYSTEM_PROCESSOR=aarch64 \ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ - -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ - -DCMAKE_LINKER=/usr/bin/aarch64-linux-gnu-ld" + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++" elif [ "${{ matrix.target }}" == "riscv64-linux-gnu" ]; then + # FIX 3: REMOVE CMAKE_LINKER. Let g++ find the right ld. PLATFORM_FLAGS="-DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_SYSTEM_PROCESSOR=riscv64 \ -DCMAKE_C_COMPILER=riscv64-linux-gnu-gcc \ - -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++ \ - -DCMAKE_LINKER=/usr/bin/riscv64-linux-gnu-ld" + -DCMAKE_CXX_COMPILER=riscv64-linux-gnu-g++" fi + # NOTE: Removed manual HIDAPI_LIBRARY defs because we aliased the file in step "Fix SDK Libraries" cmake .. $PLATFORM_FLAGS \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_STATIC=ON \ @@ -191,11 +197,11 @@ jobs: find . -name "CMakeLists.txt" -print0 | xargs -0 perl -pi -e 's/\brt\b//g' - # --- FIX 1: Robust 'final' removal using Perl on macOS too --- + # --- FIX 1: Robust Regex Patch for macOS --- - name: Patch Source Code run: | echo "Patching src/rest_server.cpp..." - perl -pi -e 's/struct rest_server::handler_loop final/struct rest_server::handler_loop/g' src/rest_server.cpp + perl -pi -e 's/struct\s+rest_server::handler_loop\s+final/struct rest_server::handler_loop/g' src/rest_server.cpp - name: Install CMake Only run: brew install cmake