From 62b21dda0df8a31fe58e4ca7fa1bcef0f32c96f4 Mon Sep 17 00:00:00 2001 From: Hiddify <114227601+hiddify1@users.noreply.github.com> Date: Sun, 20 Aug 2023 08:21:08 +0000 Subject: [PATCH] new: add macos, x86 build --- .github/workflows/release.yml | 14 +++++++++++--- Makefile | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 304f3a1..b44990e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,9 +14,12 @@ jobs: fail-fast: false matrix: job: - - { os: "ubuntu-latest", target: "android" } - - { os: "ubuntu-latest", target: "windows-amd64", aarch: "x64" } - - { os: "ubuntu-latest", target: "linux-amd64", aarch: "x64" } + - { os: "ubuntu-latest", target: "android"} + - { os: "ubuntu-latest", target: "linux-386", aarch: 'x86'} + - { os: "ubuntu-latest", target: "linux-amd64", aarch: 'x64'} + - { os: "ubuntu-latest", target: "windows-386", aarch: 'x86'} + - { os: "ubuntu-latest", target: "windows-amd64", aarch: 'x64' } + - { os: "macos-11", target: "macos-universal" } runs-on: ${{ matrix.job.os }} steps: - name: Checkout @@ -62,6 +65,11 @@ jobs: uses: egor-tensin/setup-mingw@v2 with: platform: ${{ matrix.job.aarch }} + + - name: Set up macos + if: startsWith(matrix.job.target,'macos') + run: | + brew install create-dmg tree coreutils - name: Build run: make -j$(($(nproc) + 1)) ${{ matrix.job.target }} diff --git a/Makefile b/Makefile index 1ced2b8..b53d667 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,24 @@ android: windows-amd64: env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.dll ./custom +windows-386: + env GOOS=windows GOARCH=386 CC=i686-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.dll ./custom + linux-amd64: env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.so ./custom +linux-386: + env GOOS=linux GOARCH=386 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.so ./custom + +macos-amd64: + env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags with_gvisor,with_lwip -buildmode=c-shared -o $(BINDIR)/$(NAME)-$@.dylib ./custom +macos-arm64: + env GOOS=darwin GOARCH=arm64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_ENABLED=1 go build -trimpath -tags with_gvisor,with_lwip -buildmode=c-shared -o $(BINDIR)/$(NAME)-$@.dylib ./custom +macos-combine: + lipo -create $(BINDIR)/$(NAME)-macos-amd64.dylib $(BINDIR)/$(NAME)-macos-arm64.dylib -output $(BINDIR)/$(NAME)-$@.dylib + +macos-universal: macos-amd64 macos-arm64 macos-combine + + clean: rm $(BINDIR)/* \ No newline at end of file