From 04bfcb5ae38ffb85e14f23bd7017760d68c89632 Mon Sep 17 00:00:00 2001 From: such-gitea Date: Mon, 9 Feb 2026 10:26:11 -0500 Subject: [PATCH] Update .gitea/workflows/build.yaml --- .gitea/workflows/build.yaml | 185 ++++++++++++++++++++++-------------- 1 file changed, 115 insertions(+), 70 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 2d81e2e85..5f1820da3 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,4 +1,4 @@ -name: Build Wownero Core (Hybrid Fix) +name: Build Wownero Core (Portable + FailSafe) on: push: branches: [ master, main ] @@ -52,19 +52,59 @@ jobs: tar -xf cmake.tar.gz echo "$(pwd)/cmake-3.28.1-linux-x86_64/bin" >> $GITHUB_PATH - # ------------------------------------------------------------------ - # STEP 1: Overwrite Boost 1.90 using CAT (The Method That Worked) - # ------------------------------------------------------------------ - - name: Patch Boost 1.90 (Clean Overwrite) + # ----------------------------------------------------------------------- + # KNOWN GOOD CONFIGURATION (From Portable Mac Fix) + # ----------------------------------------------------------------------- + - name: Sanitize Makefiles (Stable + Mac Compat) run: | - cd contrib/depends + # 1. RESTORE UPSTREAM FILES + curl -L -o contrib/depends/funcs.mk https://codeberg.org/wownero/wownero/raw/branch/master/contrib/depends/funcs.mk + curl -L -o contrib/depends/packages/packages.mk https://codeberg.org/wownero/wownero/raw/branch/master/contrib/depends/packages/packages.mk - # Clean slate to avoid any lingering corruption - git checkout packages/packages.mk packages/boost.mk funcs.mk - - # Overwrite boost.mk with valid content (Boost 1.90 + Context/Coroutine) - # We use sed ONLY to fix indentation after writing, which is safer than editing code. - cat <<'EOF' > packages/boost.mk + # 2. INJECT ZLIB/ZSTD (Safe Append) + sed -i 's/^packages :=.*/packages := boost openssl expat libusb hidapi protobuf libiconv sodium zeromq unbound zlib zstd/' contrib/depends/packages/packages.mk + + # 3. GENERATE ZLIB.MK + cat <<'EOF' > contrib/depends/packages/zlib.mk + package=zlib + $(package)_version=1.3.1 + $(package)_download_path=https://zlib.net/ + $(package)_file_name=$(package)-$($(package)_version).tar.gz + $(package)_sha256_hash=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 + define $(package)_set_vars + $(package)_config_opts=--static + endef + define $(package)_config_cmds + CHOST=${host} ./configure $($(package)_config_opts) --prefix=$($(package)_staging_prefix_dir) + endef + define $(package)_build_cmds + $(MAKE) libz.a + endef + define $(package)_stage_cmds + $(MAKE) install + endef + EOF + sed -i 's/^ /\t/' contrib/depends/packages/zlib.mk + + # 4. GENERATE ZSTD.MK + cat <<'EOF' > contrib/depends/packages/zstd.mk + package=zstd + $(package)_version=1.5.5 + $(package)_download_path=https://github.com/facebook/zstd/releases/download/v$($(package)_version)/ + $(package)_file_name=$(package)-$($(package)_version).tar.gz + $(package)_sha256_hash=9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4 + define $(package)_build_cmds + $(MAKE) -C lib libzstd.a + endef + define $(package)_stage_cmds + cp lib/libzstd.a $($(package)_staging_prefix_dir)/lib/ + cp lib/zstd.h $($(package)_staging_prefix_dir)/include/ + endef + EOF + sed -i 's/^ /\t/' contrib/depends/packages/zstd.mk + + # 5. GENERATE BOOST.MK + cat <<'EOF' > contrib/depends/packages/boost.mk package=boost $(package)_version=1.90.0 $(package)_download_path=https://archives.boost.io/release/$($(package)_version)/source/ @@ -76,18 +116,26 @@ jobs: $(package)_config_opts_debug=variant=debug $(package)_config_opts+=--layout=system --user-config=user-config.jam $(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 + $(package)_config_opts_linux=threadapi=pthread runtime-link=static + + # Darwin uses shared runtime (system libc++). This is standard for portable static libs. $(package)_config_opts_darwin=target-os=darwin runtime-link=shared + $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static $(package)_config_opts_x86_64_mingw32=address-model=64 $(package)_config_opts_i686_mingw32=address-model=32 $(package)_config_opts_i686_linux=address-model=32 architecture=x86 $(package)_config_opts_x86_64_darwin=address-model=64 + + # MACOS ARM FIX $(package)_config_opts_aarch64_darwin=address-model=64 architecture=arm binary-format=mach-o abi=aapcs + $(package)_toolset_$(host_os)=gcc $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin $(package)_archiver_darwin=$($(package)_libtool) + $(package)_config_libraries=atomic,chrono,date_time,filesystem,program_options,regex,serialization,system,thread,locale,context,coroutine $(package)_cxxflags=-std=c++17 -fPIC endef @@ -104,71 +152,26 @@ jobs: ./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install endef EOF - sed -i 's/^ /\t/' packages/boost.mk + sed -i 's/^ /\t/' contrib/depends/packages/boost.mk - - name: Build Standard Dependencies + - name: Build Dependencies run: | cd contrib/depends - # This generates the TOOLCHAIN FILE which we need for the next step! make HOST=${{ matrix.target }} -j$(nproc) - # ------------------------------------------------------------------ - # STEP 2: Manually Build Zlib/Zstd (Sidecar Method) - # This fixes "FATAL: libzstd.a missing" by building it explicitly. - # ------------------------------------------------------------------ - - name: Sidecar Build Zlib & Zstd - run: | - DEPENDS_DIR="$(pwd)/contrib/depends/${{ matrix.target }}" - TOOLCHAIN="$DEPENDS_DIR/share/toolchain.cmake" - - mkdir -p temp_libs - cd temp_libs - - # 1. ZSTD - curl -L -o zstd.tar.gz https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz - tar -xf zstd.tar.gz - cd zstd-1.5.5/build/cmake - - cmake . -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \ - -DCMAKE_INSTALL_PREFIX="$DEPENDS_DIR" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZSTD_BUILD_STATIC=ON \ - -DZSTD_BUILD_SHARED=OFF \ - -DZSTD_BUILD_PROGRAMS=OFF \ - -DZSTD_BUILD_TESTS=OFF - make -j$(nproc) - make install - cd ../../.. - - # 2. ZLIB - curl -L -o zlib.tar.gz https://zlib.net/zlib-1.3.1.tar.gz - tar -xf zlib.tar.gz - cd zlib-1.3.1 - - cmake . -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \ - -DCMAKE_INSTALL_PREFIX="$DEPENDS_DIR" \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_SHARED_LIBS=OFF - make -j$(nproc) - make install - cd .. - - # Verify - echo "Verifying libs in $DEPENDS_DIR/lib" - ls -l $DEPENDS_DIR/lib/libz*.a - - # ------------------------------------------------------------------ - # STEP 3: Build Core - # ------------------------------------------------------------------ - name: Build Wownero Core run: | PREFIX=$(pwd)/contrib/depends/${{ matrix.target }} mkdir build && cd build + # Fix strptime export CXXFLAGS="-D_GNU_SOURCE" export CFLAGS="-D_GNU_SOURCE" + # DEFAULT FLAGS STATIC_RUNTIME="ON" + + # MAC SPECIFIC FIX if [[ "${{ matrix.target }}" == *"apple"* ]]; then STATIC_RUNTIME="OFF" perl -pi -e 's/locale//g' ../CMakeLists.txt @@ -183,9 +186,52 @@ jobs: make -j$(nproc) - # ------------------------------------------------------------------ - # STEP 4: Package & Upload - # ------------------------------------------------------------------ + # ----------------------------------------------------------------------- + # THE FAIL-SAFE: If 'depends' lost the libs, we build them manually here + # using the exact toolchain we just generated. + # ----------------------------------------------------------------------- + - name: Ensure Static Libs Exist + run: | + LIB_DIR="contrib/depends/${{ matrix.target }}/lib" + INC_DIR="contrib/depends/${{ matrix.target }}/include" + TOOLCHAIN="$(pwd)/contrib/depends/${{ matrix.target }}/share/toolchain.cmake" + + # 1. CHECK ZSTD + if [ ! -f "$LIB_DIR/libzstd.a" ]; then + echo "Zstd missing! Activating Fail-Safe Build..." + mkdir -p temp_zstd && cd temp_zstd + curl -L -o zstd.tar.gz https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-1.5.5.tar.gz + tar -xf zstd.tar.gz && cd zstd-1.5.5/build/cmake + + cmake . -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \ + -DCMAKE_INSTALL_PREFIX="$(pwd)/../../inst" \ + -DCMAKE_BUILD_TYPE=Release \ + -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF \ + -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_TESTS=OFF + make -j$(nproc) + cp lib/libzstd.a $LIB_DIR/ + cp ../../lib/zstd.h $INC_DIR/ + cd ../../.. + fi + + # 2. CHECK ZLIB + if [ ! -f "$LIB_DIR/libz.a" ]; then + echo "Zlib missing! Activating Fail-Safe Build..." + mkdir -p temp_zlib && cd temp_zlib + curl -L -o zlib.tar.gz https://zlib.net/zlib-1.3.1.tar.gz + tar -xf zlib.tar.gz && cd zlib-1.3.1 + + cmake . -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \ + -DCMAKE_INSTALL_PREFIX="$(pwd)/inst" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF + make -j$(nproc) + cp libz.a $LIB_DIR/ + cp zlib.h $INC_DIR/ + cp zconf.h $INC_DIR/ + cd ../.. + fi + - name: Package Artifacts run: | LIB_DIR="contrib/depends/${{ matrix.target }}/lib" @@ -193,13 +239,12 @@ jobs: mkdir -p output/lib output/include output/bin find build/bin -type f -exec cp -v {} output/bin/ \; - - # Force copy everything in the lib dir (which now includes our sidecar libs) cp -v $LIB_DIR/*.a output/lib/ - # Safety Check + # Final Verification + ls -l output/lib/libz*.a if [ ! -f output/lib/libzstd.a ]; then echo "FATAL: libzstd.a missing"; exit 1; fi - if [ ! -f output/lib/libz.a ] && [ ! -f output/lib/libz_static.a ]; then echo "FATAL: libz.a missing"; exit 1; fi + if [ ! -f output/lib/libz.a ]; then echo "FATAL: libz.a missing"; exit 1; fi cp -r src output/include/wownero-src cp -r $INC_DIR/* output/include/