diff --git a/.github/workflows/pirate_build_all.yml b/.github/workflows/pirate_build_all.yml index ff05affa6..24169b8ea 100644 --- a/.github/workflows/pirate_build_all.yml +++ b/.github/workflows/pirate_build_all.yml @@ -140,16 +140,6 @@ jobs: gcc-mingw-w64-x86-64-posix \ g++-mingw-w64-x86-64-posix \ binutils-mingw-w64-x86-64 - - name: Ensure mingw-w64 tool aliases - shell: bash - run: | - for tool in ar ranlib strip nm gcc g++ windres dlltool objcopy; do - if ! command -v x86_64-w64-mingw64-$tool >/dev/null 2>&1; then - if command -v x86_64-w64-mingw32-$tool >/dev/null 2>&1; then - sudo ln -sf "$(command -v x86_64-w64-mingw32-$tool)" "/usr/bin/x86_64-w64-mingw64-$tool" - fi - fi - done - name: Build daemon (cross) run: | chmod +x zcutil/build-win.sh @@ -258,6 +248,8 @@ jobs: env: HOMEBREW_NO_AUTO_UPDATE: 1 run: | + brew untap aws/tap 2>/dev/null || true + install_brew_formulae() { missing=() for formula in "$@"; do @@ -420,16 +412,6 @@ jobs: gcc-mingw-w64-x86-64-posix \ g++-mingw-w64-x86-64-posix \ binutils-mingw-w64-x86-64 - - name: Ensure mingw-w64 tool aliases - shell: bash - run: | - for tool in ar ranlib strip nm gcc g++ windres dlltool objcopy; do - if ! command -v x86_64-w64-mingw64-$tool >/dev/null 2>&1; then - if command -v x86_64-w64-mingw32-$tool >/dev/null 2>&1; then - sudo ln -sf "$(command -v x86_64-w64-mingw32-$tool)" "/usr/bin/x86_64-w64-mingw64-$tool" - fi - fi - done - name: Build QT (Windows cross) run: | chmod +x zcutil/build-qt-win.sh @@ -543,6 +525,8 @@ jobs: env: HOMEBREW_NO_AUTO_UPDATE: 1 run: | + brew untap aws/tap 2>/dev/null || true + install_brew_formulae() { missing=() for formula in "$@"; do diff --git a/README.md b/README.md index a2a67ef87..826646a08 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ | Target | CLI | QT | | --- | --- | --- | -| Linux x86_64 | [![CLI Linux x86_64](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Linux%20x86_64%29&label=CLI)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Linux x86_64](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Linux%20x86_64%29&label=QT)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | -| Windows x86_64 cross | [![CLI Windows x86_64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Windows%20x86_64%20cross%29&label=CLI)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Windows x86_64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Windows%20x86_64%20cross%29&label=QT)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | -| Linux AArch64 cross | [![CLI Linux AArch64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Linux%20AArch64%20cross%29&label=CLI)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Linux AArch64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Linux%20AArch64%20cross%29&label=QT)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | -| macOS | [![CLI macOS](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28macOS%29&label=CLI)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT macOS](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28macOS%29&label=QT)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | +| Linux x86_64 | [![CLI Linux x86_64](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Linux%20x86_64%29&label=CLI&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Linux x86_64](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Linux%20x86_64%29&label=QT&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | +| Windows x86_64 cross | [![CLI Windows x86_64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Windows%20x86_64%20cross%29&label=CLI&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Windows x86_64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Windows%20x86_64%20cross%29&label=QT&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | +| Linux AArch64 cross | [![CLI Linux AArch64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28Linux%20AArch64%20cross%29&label=CLI&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT Linux AArch64 cross](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28Linux%20AArch64%20cross%29&label=QT&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | +| macOS | [![CLI macOS](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=CLI%20%28macOS%29&label=CLI&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | [![QT macOS](https://img.shields.io/github/check-runs/PirateNetwork/pirate/dev?nameFilter=QT%20%28macOS%29&label=QT&cacheSeconds=30)](https://github.com/PirateNetwork/pirate/actions/workflows/pirate_build_all.yml) | ![Pirate Logo](https://i.ibb.co/F7Dgnxy/Pirate-Logo-Wordmark-Gold.png "Pirate Chain Logo") diff --git a/depends/config.site.in b/depends/config.site.in index d9c86b073..a44141688 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -7,11 +7,21 @@ ac_tool_prefix=${host_alias}- if test -z $with_boost; then with_boost=$depends_prefix fi + +case @host_os@ in + mingw32|mingw64) + embedded_bin_suffix=.exe + ;; + *) + embedded_bin_suffix= + ;; +esac + if test -z $with_tor_bin; then - with_tor_bin=$depends_prefix/bin/tor + with_tor_bin=$depends_prefix/bin/tor$embedded_bin_suffix fi if test -z $with_i2pd_bin; then - with_i2pd_bin=$depends_prefix/bin/i2pd + with_i2pd_bin=$depends_prefix/bin/i2pd$embedded_bin_suffix fi if test -z $with_qt_plugindir; then with_qt_plugindir=$depends_prefix/plugins diff --git a/depends/packages/i2pd.mk b/depends/packages/i2pd.mk index 76ef30d94..a2e76bf8e 100644 --- a/depends/packages/i2pd.mk +++ b/depends/packages/i2pd.mk @@ -5,6 +5,15 @@ $(package)_download_file=$($(package)_version).tar.gz $(package)_file_name=i2pd-$($(package)_version).tar.gz $(package)_sha256_hash=ef32100c5ffdf4d23dfe78a2f6c08f65574fd79f992eb2ac8cfea0b6440deabd $(package)_dependencies=boost openssl zlib +$(package)_patches=platform-linking.patch + +define $(package)_set_vars + $(package)_config_opts_mingw32=-DCMAKE_SYSTEM_NAME=Windows +endef + +define $(package)_preprocess_cmds + patch -p1 < $($(package)_patch_dir)/platform-linking.patch +endef # i2pd's CMakeLists.txt lives under build/, with the project's own source tree # as a sibling directory, so it must be pointed at explicitly. Building with @@ -35,7 +44,8 @@ define $(package)_config_cmds -DWITH_STATIC=ON \ -DWITH_UPNP=OFF \ -DWITH_HARDENING=ON \ - -DWITH_GIT_VERSION=OFF + -DWITH_GIT_VERSION=OFF \ + $($(package)_config_opts) endef define $(package)_build_cmds diff --git a/depends/packages/tor.mk b/depends/packages/tor.mk index b14613ddf..0ee0333ce 100644 --- a/depends/packages/tor.mk +++ b/depends/packages/tor.mk @@ -10,6 +10,7 @@ define $(package)_set_vars $(package)_config_opts=--disable-unittests --disable-system-torrc --disable-asciidoc $(package)_config_opts+=--disable-tool-name-check --disable-dependency-tracking --enable-option-checking $(package)_config_opts+=--enable-static-tor + $(package)_config_opts_darwin=--disable-static-tor --enable-static-openssl --enable-static-libevent --enable-static-zlib $(package)_config_opts+=--with-openssl-dir=$(host_prefix) $(package)_config_opts+=--with-libevent-dir=$(host_prefix) $(package)_config_opts+=--with-zlib-dir=$(host_prefix) diff --git a/depends/patches/i2pd/platform-linking.patch b/depends/patches/i2pd/platform-linking.patch new file mode 100644 index 000000000..9b4307c79 --- /dev/null +++ b/depends/patches/i2pd/platform-linking.patch @@ -0,0 +1,28 @@ +diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt +index 156e54a..36b745e 100644 +--- a/build/CMakeLists.txt ++++ b/build/CMakeLists.txt +@@ -236,7 +236,7 @@ if(WITH_STATIC) + endif() + + set(Boost_USE_STATIC_LIBS ON) +- if(MSVC) ++ if(MSVC OR MINGW) + set(Boost_USE_STATIC_RUNTIME ON) + else() + set(Boost_USE_STATIC_RUNTIME OFF) +@@ -374,12 +374,12 @@ if(WITH_BINARY) + endif() + + if(WITH_STATIC) +- if(NOT MSVC) ++ if(NOT MSVC AND NOT APPLE) + set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-static") + endif() + endif() + +- if(WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ++ if(WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT MINGW) + set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-z relro -z now") + endif() + diff --git a/src/Makefile.am b/src/Makefile.am index b2b3947d9..efbb6a1c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1006,8 +1006,8 @@ install-exec-hook: if ENABLE_EMBEDDED_TOR @if test -f "$(TOR_BINARY_PATH)"; then \ $(MKDIR_P) "$(DESTDIR)$(bindir)"; \ - $(INSTALL_PROGRAM) "$(TOR_BINARY_PATH)" "$(DESTDIR)$(bindir)/tor"; \ - $(STRIP) "$(DESTDIR)$(bindir)/tor" 2>/dev/null || true; \ + $(INSTALL_PROGRAM) "$(TOR_BINARY_PATH)" "$(DESTDIR)$(bindir)/tor$(EXEEXT)"; \ + $(STRIP) "$(DESTDIR)$(bindir)/tor$(EXEEXT)" 2>/dev/null || true; \ else \ echo "warning: embedded Tor enabled but no tor binary found at '$(TOR_BINARY_PATH)', skipping bundling"; \ fi @@ -1015,8 +1015,8 @@ endif if ENABLE_EMBEDDED_I2PD @if test -f "$(I2PD_BINARY_PATH)"; then \ $(MKDIR_P) "$(DESTDIR)$(bindir)"; \ - $(INSTALL_PROGRAM) "$(I2PD_BINARY_PATH)" "$(DESTDIR)$(bindir)/i2pd"; \ - $(STRIP) "$(DESTDIR)$(bindir)/i2pd" 2>/dev/null || true; \ + $(INSTALL_PROGRAM) "$(I2PD_BINARY_PATH)" "$(DESTDIR)$(bindir)/i2pd$(EXEEXT)"; \ + $(STRIP) "$(DESTDIR)$(bindir)/i2pd$(EXEEXT)" 2>/dev/null || true; \ else \ echo "warning: embedded I2P enabled but no i2pd binary found at '$(I2PD_BINARY_PATH)', skipping bundling"; \ fi diff --git a/zcutil/build-qt-mac.sh b/zcutil/build-qt-mac.sh index 2e6e647d3..bca443c2e 100755 --- a/zcutil/build-qt-mac.sh +++ b/zcutil/build-qt-mac.sh @@ -49,15 +49,8 @@ make "$@" -C ./depends/ V=1 ./autogen.sh -# Detect architecture and set appropriate flags +# Detect architecture for the Rust target. ARCH=$(uname -m) -if [ "$ARCH" = "arm64" ]; then - # Apple Silicon (M1/M2) - ARCH_FLAGS="-arch arm64" -else - # Intel x86_64 - ARCH_FLAGS="-arch x86_64" -fi if command -v rustup >/dev/null 2>&1; then if [ "$ARCH" = "arm64" ]; then @@ -67,10 +60,10 @@ if command -v rustup >/dev/null 2>&1; then export CARGO="$(rustup which cargo)" fi -CPPFLAGS="-I$PREFIX/include $ARCH_FLAGS" LDFLAGS="-L$PREFIX/lib $ARCH_FLAGS -Wl,-no_pie" \ -CXXFLAGS="$ARCH_FLAGS -I$PREFIX/include -fwrapv -fno-strict-aliasing \ +CONFIG_SITE="$PREFIX/share/config.site" \ +CXXFLAGS="-fwrapv -fno-strict-aliasing \ -Wno-deprecated-declarations -Wno-deprecated-builtins -Wno-enum-constexpr-conversion \ --Wno-unknown-warning-option -Werror -Wno-error=attributes -g" \ +-Wno-unknown-warning-option -Wno-error=attributes -g" \ ./configure --prefix="${PREFIX}" --disable-bip70 --with-gui=qt5 --enable-tests=no "$HARDENING_ARG" "$LCOV_ARG" "$DEBUGGING_ARG" make "$@" NO_GTEST=0 STATIC=1 diff --git a/zcutil/build-qt-win64.sh b/zcutil/build-qt-win64.sh index 57b4e2721..c3be32173 100755 --- a/zcutil/build-qt-win64.sh +++ b/zcutil/build-qt-win64.sh @@ -1,5 +1,5 @@ #!/bin/bash -HOST=x86_64-w64-mingw64 +HOST=x86_64-w64-mingw32 CXX=x86_64-w64-mingw32-g++-posix CC=x86_64-w64-mingw32-gcc-posix PREFIX="$(pwd)/depends/$HOST" @@ -15,9 +15,9 @@ cd ../ ./autogen.sh -CONFIG_SITE=$PWD/depends/x86_64-w64-mingw64/share/config.site \ +CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site \ CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -DCURVE_ALT_BN128 -pthread" \ - ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw64 --enable-static --disable-shared \ + ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared \ --with-gui=qt5 --disable-bip70 --enable-tests=no sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure diff --git a/zcutil/build-win-dtest.sh b/zcutil/build-win-dtest.sh index d39450215..9f6db38ee 100755 --- a/zcutil/build-win-dtest.sh +++ b/zcutil/build-win-dtest.sh @@ -1,5 +1,5 @@ #!/bin/bash -export HOST=x86_64-w64-mingw64 +export HOST=x86_64-w64-mingw32 CXX=x86_64-w64-mingw32-g++-posix CC=x86_64-w64-mingw32-gcc-posix @@ -15,7 +15,7 @@ make HOST=$HOST NO_QT=1 "$@" cd $BASE_DIR ./autogen.sh -CONFIG_SITE=$PWD/depends/x86_64-w64-mingw64/share/config.site CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -DCURVE_ALT_BN128 -pthread" CPPFLAGS=-DTESTMODE ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw64 --enable-static --disable-shared +CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -DCURVE_ALT_BN128 -pthread" CPPFLAGS=-DTESTMODE ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure cd src/ CC="${CC} -g " CXX="${CXX} -g " make V=1 pirated.exe pirate-cli.exe pirate-tx.exe diff --git a/zcutil/build-win.sh b/zcutil/build-win.sh index b48fef4e7..22080e6f3 100755 --- a/zcutil/build-win.sh +++ b/zcutil/build-win.sh @@ -1,5 +1,5 @@ #!/bin/bash -HOST=x86_64-w64-mingw64 +HOST=x86_64-w64-mingw32 CXX=x86_64-w64-mingw32-g++-posix CC=x86_64-w64-mingw32-gcc-posix PREFIX="$(pwd)/depends/$HOST" @@ -14,9 +14,9 @@ cd ../ ./autogen.sh -CONFIG_SITE=$PWD/depends/x86_64-w64-mingw64/share/config.site \ +CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site \ CXXFLAGS="-DPTW32_STATIC_LIB -DCURL_STATICLIB -DCURVE_ALT_BN128 -pthread" \ - ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw64 --enable-static --disable-shared \ + ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared \ --with-gui=no --disable-bip70 --enable-tests=yes sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure