From 0c302a344897183f5ae0b2227245117954ff4a97 Mon Sep 17 00:00:00 2001 From: Some One Date: Thu, 16 Oct 2025 11:36:42 +1000 Subject: [PATCH 1/7] try to fix windows resolve variables manually --- .github/workflows/build.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e0e6e07..63d6cd3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest] #, windows-latest] + os: [ubuntu-latest, windows-latest] compiler: [clang] runs-on: ${{ matrix.os }} @@ -47,6 +47,14 @@ jobs: # Start-Process -Wait -FilePath "msys2-installer.exe" -ArgumentList "/S" # C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm" # C:\msys64\usr\bin\bash.exe -lc "export ARCH=x86_64; export MINGW=mingw64; pacman -S --noconfirm mingw-w64-$ARCH-gcc mingw-w64-$ARCH-boost mingw-w64-$ARCH-openssl git make" + - name: Install MSYS2 (Windows) + uses: msys2/setup-msys2@v2 + if: matrix.os == 'windows-latest' + with: + msystem: CLANG64 + install: base-devel git mingw-w64-x86_64-clang mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-miniupnpc + update: true + - name: Initialize Git Submodules run: git submodule update --init --recursive From fb48cdd9e1c1e664c16a1cb098e81328d41dcbb3 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:04:09 +0300 Subject: [PATCH 2/7] workflows: pre-init macos --- .github/workflows/build.yml | 65 ++++++++++++++++++++++--------------- Makefile | 61 +++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63d6cd3..f652e99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,10 +12,11 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] compiler: [clang] runs-on: ${{ matrix.os }} + steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -31,46 +32,58 @@ jobs: sudo apt update sudo apt install --no-install-recommends -y build-essential libboost-all-dev libssl-dev git - - name: Cache build artifacts (Ubuntu) - if: matrix.os == 'ubuntu-latest' - uses: actions/cache@v3 - with: - path: | - obj - libi2pd.a - key: ubuntu-build-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.h') }} -# -# - name: Install MSYS2 (Windows) -# if: matrix.os == 'windows-latest' -# run: | -# Invoke-WebRequest -Uri "https://github.com/msys2/msys2-installer/releases/download/2025-08-30/msys2-x86_64-20250830.exe" -OutFile "msys2-installer.exe" -# Start-Process -Wait -FilePath "msys2-installer.exe" -ArgumentList "/S" -# C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm" -# C:\msys64\usr\bin\bash.exe -lc "export ARCH=x86_64; export MINGW=mingw64; pacman -S --noconfirm mingw-w64-$ARCH-gcc mingw-w64-$ARCH-boost mingw-w64-$ARCH-openssl git make" + ####################### + # macOS dependencies # + ####################### + - name: Install dependencies (macOS) + if: matrix.os == 'macos-latest' + run: | + brew update + brew install boost openssl@3 cmake make + + ####################### + # Windows dependencies # + ####################### - name: Install MSYS2 (Windows) - uses: msys2/setup-msys2@v2 if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 with: msystem: CLANG64 install: base-devel git mingw-w64-x86_64-clang mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-miniupnpc update: true - - name: Initialize Git Submodules run: git submodule update --init --recursive + ####################### + # Build Project + ####################### - name: Build Project (Ubuntu) if: matrix.os == 'ubuntu-latest' run: | - make -j8 + make -j$(nproc) make stripall make builddir -# -# - name: Build Project (Windows) -# if: matrix.os == 'windows-latest' -# run: | -# C:\msys64\usr\bin\bash.exe -lc "cd /c/runner/work/i2pd-tools/i2pd-tools && make && make stripall && make builddir" -# + + - name: Build Project (macOS) + if: matrix.os == 'macos-latest' + run: | + make HOMEBREW=1 -j8 + make stripall + make builddir + + - name: Build Project (Windows) + if: matrix.os == 'windows-latest' + shell: msys2 {0} + run: | + cd "${GITHUB_WORKSPACE}" + make -j$(nproc) + make stripall + make builddir + + ####################### + # Upload binaries + ####################### - name: Upload binaries uses: actions/upload-artifact@v4 with: diff --git a/Makefile b/Makefile index e8ccd4f..91661e3 100755 --- a/Makefile +++ b/Makefile @@ -11,42 +11,46 @@ CXXFLAGS = -Wall -std=c++17 -O2 INCFLAGS = -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH) DEFINES = -DOPENSSL_SUPPRESS_DEPRECATED -LDFLAGS = -LDLIBS = $(I2PD_PATH)/$(I2PD_LIB) -lboost_system$(BOOST_SUFFIX) -lboost_program_options$(BOOST_SUFFIX) -lssl -lcrypto -lz - +LDFLAGS = +LDLIBS = $(I2PD_PATH)/$(I2PD_LIB) -lboost_system$(BOOST_SUFFIX) -lboost_program_options$(BOOST_SUFFIX) -lssl -lcrypto -lz +# ------------------------- +# Platform-specific flags +# ------------------------- ifeq ($(UNAME),Linux) CXXFLAGS += -g -else ifeq ($(UNAME),Darwin) - CXXFLAGS += -g -else ifeq ($(UNAME),FreeBSD) - CXXFLAGS += -g -else -# Win32 - CXXFLAGS += -Os -fPIC -msse - DEFINES += -DWIN32_LEAN_AND_MEAN - BOOST_SUFFIX = -mt -endif - -ifeq ($(UNAME),Linux) LDLIBS += -lrt -lpthread else ifeq ($(UNAME),Darwin) + CXXFLAGS += -g LDLIBS += -lpthread - LDFLAGS += -L/usr/local/opt/openssl@1.1/lib -L/usr/local/lib - INCFLAGS += -I/usr/local/opt/openssl@1.1/include -I/usr/local/include + ifdef HOMEBREW + BREW_PREFIX := $(shell brew --prefix) + INCFLAGS += -I$(BREW_PREFIX)/include + LDFLAGS += -L$(BREW_PREFIX)/lib + else + INCFLAGS += -I/usr/local/opt/openssl@3/include -I/usr/local/include + LDFLAGS += -L/usr/local/opt/openssl@3/lib -L/usr/local/lib + endif else ifeq ($(UNAME),FreeBSD) + CXXFLAGS += -g LDLIBS += -lthr -lpthread LDFLAGS += -L/usr/local/lib INCFLAGS += -I/usr/local/include else -# Win32 +# Windows (MSYS2 / MinGW) + CXXFLAGS += -Os -fPIC -msse + DEFINES += -DWIN32_LEAN_AND_MEAN + BOOST_SUFFIX = -mt LDLIBS += -lwsock32 -lws2_32 -liphlpapi -lpthread LDFLAGS += -s -static endif - +# ------------------------- +# Build targets +# ------------------------- all: $(I2PD_LIB) vain keygen keyinfo famtool routerinfo regaddr regaddr_3ld i2pbase64 offlinekeys b33address regaddralias x25519 verifyhost autoconf -vain: vain.o $(I2PD_LIB) + +vain: vain.o $(I2PD_LIB) $(CXX) -o vain $(LDFLAGS) vain.o $(LDLIBS) autoconf: autoconf.o $(I2PD_LIB) @@ -88,6 +92,9 @@ x25519: x25519.o $(I2PD_LIB) verifyhost: verifyhost.o $(I2PD_LIB) $(CXX) -o verifyhost $(DEFINES) $(LDFLAGS) verifyhost.o $(LDLIBS) +# ------------------------- +# Object compilation +# ------------------------- .SUFFIXES: .SUFFIXES: .c .cc .C .cpp .o @@ -97,6 +104,9 @@ $(I2PD_LIB): %.o: %.cpp $(I2PD_LIB) $(CXX) $(CXXFLAGS) $(DEFINES) $(INCFLAGS) -c -o $@ $< +# ------------------------- +# Cleanup +# ------------------------- count: wc *.c *.cc *.C *.cpp *.h *.hpp @@ -105,19 +115,18 @@ clean-i2pd: clean-obj: rm -f $(wildcard *.o) + stripall: strip b33address famtool i2pbase64 keygen keyinfo offlinekeys regaddr regaddr_3ld regaddralias routerinfo x25519 verifyhost vain autoconf + builddir: mkdir -p build mv b33address famtool i2pbase64 keygen keyinfo offlinekeys regaddr regaddr_3ld regaddralias routerinfo x25519 verifyhost vain autoconf build/ || true + clean-bin: rm -f b33address famtool i2pbase64 keygen keyinfo offlinekeys regaddr regaddr_3ld regaddralias routerinfo x25519 verifyhost vain autoconf clean: clean-i2pd clean-obj clean-bin -.PHONY: all -.PHONY: count -.PHONY: clean-i2pd -.PHONY: clean-obj -.PHONY: clean-bin -.PHONY: clean +.PHONY: all count clean-i2pd clean-obj clean-bin clean + From ac417c8738da57c601b79c4ee77f1e6de0de983c Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:08:25 +0300 Subject: [PATCH 3/7] workflows: comment windows --- .github/workflows/build.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f652e99..fd325fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] compiler: [clang] runs-on: ${{ matrix.os }} @@ -44,13 +44,13 @@ jobs: ####################### # Windows dependencies # ####################### - - name: Install MSYS2 (Windows) - if: matrix.os == 'windows-latest' - uses: msys2/setup-msys2@v2 - with: - msystem: CLANG64 - install: base-devel git mingw-w64-x86_64-clang mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-miniupnpc - update: true +# - name: Install MSYS2 (Windows) +# if: matrix.os == 'windows-latest' +## uses: msys2/setup-msys2@v2 + # with: + # msystem: CLANG64 + # install: base-devel git mingw-w64-x86_64-clang mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-miniupnpc + # update: true - name: Initialize Git Submodules run: git submodule update --init --recursive @@ -72,14 +72,14 @@ jobs: make stripall make builddir - - name: Build Project (Windows) - if: matrix.os == 'windows-latest' - shell: msys2 {0} - run: | - cd "${GITHUB_WORKSPACE}" - make -j$(nproc) - make stripall - make builddir +# - name: Build Project (Windows) +# if: matrix.os == 'windows-latest' +## shell: msys2 {0} + # run: | + # cd "${GITHUB_WORKSPACE}" + # make -j$(nproc) + # make stripall + # make builddir ####################### # Upload binaries From 21c8041428bd98b8803fe35a055f6fb9c7cfa67c Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:13:45 +0300 Subject: [PATCH 4/7] markflow test macos --- Makefile | 79 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index 91661e3..6147362 100755 --- a/Makefile +++ b/Makefile @@ -1,52 +1,54 @@ -UNAME = $(shell uname -s) +UNAME := $(shell uname -s) -I2PD_PATH = i2pd -I2PD_LIB = libi2pd.a +I2PD_PATH := i2pd +I2PD_LIB := libi2pd.a -LIBI2PD_PATH = $(I2PD_PATH)/libi2pd -LIBI2PD_CLIENT_PATH = $(I2PD_PATH)/libi2pd_client +LIBI2PD_PATH := $(I2PD_PATH)/libi2pd +LIBI2PD_CLIENT_PATH := $(I2PD_PATH)/libi2pd_client CXX ?= g++ -CXXFLAGS = -Wall -std=c++17 -O2 -INCFLAGS = -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH) -DEFINES = -DOPENSSL_SUPPRESS_DEPRECATED +CXXFLAGS := -Wall -std=c++17 -O2 +INCFLAGS := -I$(LIBI2PD_PATH) -I$(LIBI2PD_CLIENT_PATH) +DEFINES := -DOPENSSL_SUPPRESS_DEPRECATED -LDFLAGS = -LDLIBS = $(I2PD_PATH)/$(I2PD_LIB) -lboost_system$(BOOST_SUFFIX) -lboost_program_options$(BOOST_SUFFIX) -lssl -lcrypto -lz +LDFLAGS := +LDLIBS := $(I2PD_PATH)/$(I2PD_LIB) -lboost_program_options$(BOOST_SUFFIX) -lssl -lcrypto -lz -# ------------------------- -# Platform-specific flags -# ------------------------- ifeq ($(UNAME),Linux) - CXXFLAGS += -g - LDLIBS += -lrt -lpthread + CXXFLAGS += -g + LDLIBS += -lrt -lpthread else ifeq ($(UNAME),Darwin) - CXXFLAGS += -g - LDLIBS += -lpthread - ifdef HOMEBREW - BREW_PREFIX := $(shell brew --prefix) - INCFLAGS += -I$(BREW_PREFIX)/include - LDFLAGS += -L$(BREW_PREFIX)/lib - else - INCFLAGS += -I/usr/local/opt/openssl@3/include -I/usr/local/include - LDFLAGS += -L/usr/local/opt/openssl@3/lib -L/usr/local/lib - endif + CXXFLAGS += -g + LDLIBS += -lpthread + + # Определяем путь Homebrew + ifeq ($(shell test -d /opt/homebrew && echo "true"),true) + BREW_PREFIX := /opt/homebrew + else + BREW_PREFIX := /usr/local + endif + + INCFLAGS += -I$(BREW_PREFIX)/include -I$(BREW_PREFIX)/opt/openssl@3/include + LDFLAGS += -L$(BREW_PREFIX)/lib -L$(BREW_PREFIX)/opt/openssl@3/lib + LDLIBS += $(BREW_PREFIX)/lib/libboost_system.a \ + $(BREW_PREFIX)/lib/libboost_program_options.a else ifeq ($(UNAME),FreeBSD) - CXXFLAGS += -g - LDLIBS += -lthr -lpthread - LDFLAGS += -L/usr/local/lib - INCFLAGS += -I/usr/local/include + CXXFLAGS += -g + LDLIBS += -lthr -lpthread + LDFLAGS += -L/usr/local/lib + INCFLAGS += -I/usr/local/include else -# Windows (MSYS2 / MinGW) - CXXFLAGS += -Os -fPIC -msse - DEFINES += -DWIN32_LEAN_AND_MEAN - BOOST_SUFFIX = -mt - LDLIBS += -lwsock32 -lws2_32 -liphlpapi -lpthread - LDFLAGS += -s -static + # Windows + CXXFLAGS += -Os -fPIC -msse + DEFINES += -DWIN32_LEAN_AND_MEAN + LDFLAGS += -L/clang64/lib + INCFLAGS += -I/clang64/include + BOOST_SUFFIX = + LDLIBS += -lwsock32 -lws2_32 -liphlpapi -lpthread endif # ------------------------- -# Build targets +# Targets # ------------------------- all: $(I2PD_LIB) vain keygen keyinfo famtool routerinfo regaddr regaddr_3ld i2pbase64 offlinekeys b33address regaddralias x25519 verifyhost autoconf @@ -57,7 +59,7 @@ autoconf: autoconf.o $(I2PD_LIB) $(CXX) -o autoconf $(DEFINES) $(LDFLAGS) autoconf.o $(LDLIBS) routerinfo: routerinfo.o $(I2PD_LIB) - $(CXX) -o routerinfo $(LDFLAGS) routerinfo.o $(LDLIBS) -latomic + $(CXX) -o routerinfo $(LDFLAGS) routerinfo.o $(LDLIBS) keygen: keygen.o $(I2PD_LIB) $(CXX) -o keygen $(DEFINES) $(LDFLAGS) keygen.o $(LDLIBS) @@ -66,7 +68,7 @@ keyinfo: keyinfo.o $(I2PD_LIB) $(CXX) -o keyinfo $(DEFINES) $(LDFLAGS) keyinfo.o $(LDLIBS) famtool: famtool.o $(I2PD_LIB) - $(CXX) -o famtool $(DEFINES) $(LDFLAGS) famtool.o $(LDLIBS) -latomic + $(CXX) -o famtool $(DEFINES) $(LDFLAGS) famtool.o $(LDLIBS) regaddr: regaddr.o $(I2PD_LIB) $(CXX) -o regaddr $(DEFINES) $(LDFLAGS) regaddr.o $(LDLIBS) @@ -95,7 +97,6 @@ verifyhost: verifyhost.o $(I2PD_LIB) # ------------------------- # Object compilation # ------------------------- -.SUFFIXES: .SUFFIXES: .c .cc .C .cpp .o $(I2PD_LIB): From ed2844f99f1f1e1d774bd79b9931b598352a1374 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:17:54 +0300 Subject: [PATCH 5/7] test workflow --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6147362..2136b87 100755 --- a/Makefile +++ b/Makefile @@ -21,7 +21,6 @@ else ifeq ($(UNAME),Darwin) CXXFLAGS += -g LDLIBS += -lpthread - # Определяем путь Homebrew ifeq ($(shell test -d /opt/homebrew && echo "true"),true) BREW_PREFIX := /opt/homebrew else @@ -30,8 +29,8 @@ else ifeq ($(UNAME),Darwin) INCFLAGS += -I$(BREW_PREFIX)/include -I$(BREW_PREFIX)/opt/openssl@3/include LDFLAGS += -L$(BREW_PREFIX)/lib -L$(BREW_PREFIX)/opt/openssl@3/lib - LDLIBS += $(BREW_PREFIX)/lib/libboost_system.a \ - $(BREW_PREFIX)/lib/libboost_program_options.a + # Используем динамические библиотеки, без указания .a + LDLIBS += -lboost_system -lboost_program_options else ifeq ($(UNAME),FreeBSD) CXXFLAGS += -g LDLIBS += -lthr -lpthread From c03867daa1b42055a35aeb48299183a82f889662 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:21:59 +0300 Subject: [PATCH 6/7] test workflow --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2136b87..ce72543 100755 --- a/Makefile +++ b/Makefile @@ -29,8 +29,8 @@ else ifeq ($(UNAME),Darwin) INCFLAGS += -I$(BREW_PREFIX)/include -I$(BREW_PREFIX)/opt/openssl@3/include LDFLAGS += -L$(BREW_PREFIX)/lib -L$(BREW_PREFIX)/opt/openssl@3/lib - # Используем динамические библиотеки, без указания .a - LDLIBS += -lboost_system -lboost_program_options + + LDLIBS += -lboost_program_options else ifeq ($(UNAME),FreeBSD) CXXFLAGS += -g LDLIBS += -lthr -lpthread From 8ac777d618e82d8f791f1ffa2856ccabfe900784 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Thu, 16 Oct 2025 13:26:49 +0300 Subject: [PATCH 7/7] by vade comment --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd325fa..855dc60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: ####################### # macOS dependencies # + #BY VADE = https://github.com/MetanoicArmor ####################### - name: Install dependencies (macOS) if: matrix.os == 'macos-latest'