Skip to content

Commit

Permalink
merge(gui): Merge pull request #16 from genshen/feature-fyne-based-cl…
Browse files Browse the repository at this point in the history
…ient-mac-arm64-support

Feature: add mac arm64 support (universal app) for the fyne-based client
  • Loading branch information
genshen authored Feb 3, 2024
2 parents 2e18fca + f4ba8e9 commit df3d4f3
Show file tree
Hide file tree
Showing 5 changed files with 699 additions and 86 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-22.04, macos-12, windows-2022]
include:
- os: ubuntu-latest
- os: ubuntu-22.04
artifact_files: wssocks-ustb-*
- os: macos-latest
- os: macos-12
artifact_files: |
wssocks-ustb-client-macOS-amd64.app.zip
client-ui-macOS-amd64.app.zip
- os: windows-latest
wssocks-ustb-client-macOS-universal.app.zip
client-ui-macOS-universal.app.zip
- os: windows-2022
artifact_files: client-ui-windows-amd64.exe
steps:
- name: Checkout code
Expand All @@ -30,21 +30,21 @@ jobs:
with:
go-version: 1.17.13
- run: |
go get fyne.io/fyne/v2/cmd/fyne@v2.1.2
go get fyne.io/fyne/v2/cmd/fyne@v2.4.3
go mod download
- name: Build Cli
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-22.04'
run: |
make
- name: Build macOS
if: matrix.os == 'macos-latest'
if: matrix.os == 'macos-12'
run: |
cd client-ui
make client-ui-macOS-amd64.app -f Makefile-ci
zip -r client-ui-macOS-amd64.app.zip client-ui-macOS-amd64.app
mv client-ui-macOS-amd64.app.zip ../
make client-ui-macOS-universal.app -f Makefile-ci
zip -r client-ui-macOS-universal.app.zip client-ui-macOS-universal.app
mv client-ui-macOS-universal.app.zip ../
cd ../
echo "building swiftui-client"
cd extra/go-api && make && cd ../../
Expand All @@ -53,7 +53,7 @@ jobs:
mv swiftui-client/build/Release/wssocks-ustb-client-macOS-universal.app.zip ./
- name: Build Windows
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2022'
run: |
cd client-ui
make client-ui-windows-amd64.exe -f Makefile-ci
Expand All @@ -68,17 +68,17 @@ jobs:
release:
name: On Release
needs: build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v2
with:
name: build-artifact-ubuntu-latest
name: build-artifact-ubuntu-22.04
- uses: actions/download-artifact@v2
with:
name: build-artifact-windows-latest
name: build-artifact-windows-2022
- uses: actions/download-artifact@v2
with:
name: build-artifact-macos-latest
name: build-artifact-macos-12
- run: ls -R

- name: Release
Expand All @@ -87,7 +87,7 @@ jobs:
with:
files: |
client-ui-windows-amd64.exe
client-ui-macOS-amd64.app.zip
client-ui-macOS-universal.app.zip
wssocks-ustb-client-macOS-universal.app.zip
wssocks-ustb-darwin-amd64
wssocks-ustb-linux-arm64
Expand Down
21 changes: 13 additions & 8 deletions client-ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,38 @@ appName="wssocks-ustb client"
APP_VERSION=0.6.0
PACKAGE_FLAG=-icon app-512.png -appID ${appID} --appVersion ${APP_VERSION} -release -appBuild 4

all: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-windows-amd64.exe # wssocks-ustb-ui-linux-amd64
all: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 wssocks-ustb-ui-windows-amd64.exe # wssocks-ustb-ui-linux-amd64

wssocks-ustb-ui-macOS-amd64:
CC=clang CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build ${FLAGS} -o wssocks-ustb-ui-macOS-amd64 ${PACKAGE}

wssocks-ustb-ui-macOS-arm64:
CC=clang CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build ${FLAGS} -o wssocks-ustb-ui-macOS-arm64 ${PACKAGE}

wssocks-ustb-ui-windows-amd64.exe:
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build ${FLAGS} -ldflags -H=windowsgui -o wssocks-ustb-ui-windows-amd64.exe ${PACKAGE}

wssocks-ustb-ui-macOS-universal: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64
lipo wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 -create -output wssocks-ustb-ui-macOS-universal

# wssocks-ustb-ui-linux-amd64:
# CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o wssocks-ustb-ui-linux-amd64 ${PACKAGE}

# packaging
package: client-ui-macOS-amd64.app client-ui-windows-amd64.exe # client-ui-linux-amd64
package: client-ui-macOS-universal.app client-ui-windows-amd64.exe # client-ui-linux-amd64

client-ui-macOS-amd64.app: wssocks-ustb-ui-macOS-amd64
cp -r wssocks-ustb-ui-macOS-amd64 wssocks-ustb-client
CC=clang CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 fyne package -os darwin ${PACKAGE_FLAG} -executable wssocks-ustb-client -name ${appName}
rm -rf client-ui-macOS-amd64.app; mv ${appName}.app client-ui-macOS-amd64.app
client-ui-macOS-universal.app: wssocks-ustb-ui-macOS-universal
CC=clang CGO_ENABLED=1 GOOS=darwin fyne package -os darwin ${PACKAGE_FLAG} -executable wssocks-ustb-ui-macOS-universal -name ${appName}
rm -rf client-ui-macOS-universal.app; mv ${appName}.app client-ui-macOS-universal.app

client-ui-windows-amd64.exe: wssocks-ustb-ui-windows-amd64.exe
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 fyne package -os windows ${PACKAGE_FLAG} -executable wssocks-ustb-ui-windows-amd64.exe -name ${appName}.exe
mv client-ui.exe client-ui-windows-amd64.exe
mv ${appName}.exe client-ui-windows-amd64.exe

# export CGO_CFLAGS='-D _POSIX'

# client-ui-linux-amd64:

clean:
rm -rf wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-windows-amd64.exe client-ui-macOS-amd64.app client-ui-windows-amd64.exe
rm -rf wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 wssocks-ustb-ui-macOS-universal wssocks-ustb-ui-windows-amd64.exe client-ui-macOS-universal.app client-ui-windows-amd64.exe
rm -rf wssocks-ustb-client fyne.syso
27 changes: 16 additions & 11 deletions client-ui/Makefile-ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,38 @@ appName="wssocks-ustb client"
APP_VERSION=0.6.0
PACKAGE_FLAG=-icon app-512.png -appID ${appID} --appVersion ${APP_VERSION} -release -appBuild 4

all: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-windows-amd64.exe # wssocks-ustb-ui-linux-amd64
all: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 wssocks-ustb-ui-windows-amd64.exe # wssocks-ustb-ui-linux-amd64

wssocks-ustb-ui-macOS-amd64:
CGO_ENABLED=1 go build ${FLAGS} -o wssocks-ustb-ui-macOS-amd64 ${PACKAGE}
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build ${FLAGS} -o wssocks-ustb-ui-macOS-amd64 ${PACKAGE}

wssocks-ustb-ui-macOS-arm64:
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build ${FLAGS} -o wssocks-ustb-ui-macOS-arm64 ${PACKAGE}

wssocks-ustb-ui-windows-amd64.exe:
CGO_ENABLED=1 go build ${FLAGS} -ldflags -H=windowsgui -o wssocks-ustb-ui-windows-amd64.exe ${PACKAGE}
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build ${FLAGS} -ldflags -H=windowsgui -o wssocks-ustb-ui-windows-amd64.exe ${PACKAGE}

wssocks-ustb-ui-macOS-universal: wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64
lipo wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 -create -output wssocks-ustb-ui-macOS-universal

# wssocks-ustb-ui-linux-amd64:
# CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o wssocks-ustb-ui-linux-amd64 ${PACKAGE}

# packaging
package: client-ui-macOS-amd64.app client-ui-windows-amd64.exe # client-ui-linux-amd64
package: client-ui-macOS-universal.app client-ui-windows-amd64.exe # client-ui-linux-amd64

client-ui-macOS-amd64.app: wssocks-ustb-ui-macOS-amd64
cp -r wssocks-ustb-ui-macOS-amd64 wssocks-ustb-client
CGO_ENABLED=1 fyne package -os darwin ${PACKAGE_FLAG} -executable wssocks-ustb-client -name ${appName}
rm -rf client-ui-macOS-amd64.app; mv ${appName}.app client-ui-macOS-amd64.app
client-ui-macOS-universal.app: wssocks-ustb-ui-macOS-universal
CGO_ENABLED=1 GOOS=darwin fyne package -os darwin ${PACKAGE_FLAG} -executable wssocks-ustb-ui-macOS-universal -name ${appName}
rm -rf client-ui-macOS-universal.app; mv ${appName}.app client-ui-macOS-universal.app

client-ui-windows-amd64.exe: wssocks-ustb-ui-windows-amd64.exe
CGO_ENABLED=1 fyne package -os windows ${PACKAGE_FLAG} -executable wssocks-ustb-ui-windows-amd64.exe -name ${appName}.exe
mv client-ui.exe client-ui-windows-amd64.exe
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 fyne package -os windows ${PACKAGE_FLAG} -executable wssocks-ustb-ui-windows-amd64.exe -name ${appName}.exe
mv ${appName}.exe client-ui-windows-amd64.exe

# export CGO_CFLAGS='-D _POSIX'

# client-ui-linux-amd64:

clean:
rm -rf wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-windows-amd64.exe client-ui-macOS-amd64.app client-ui-windows-amd64.exe
rm -rf wssocks-ustb-ui-macOS-amd64 wssocks-ustb-ui-macOS-arm64 wssocks-ustb-ui-macOS-universal wssocks-ustb-ui-windows-amd64.exe client-ui-macOS-universal.app client-ui-windows-amd64.exe
rm -rf wssocks-ustb-client fyne.syso
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/genshen/wssocks-plugin-ustb
go 1.13

require (
fyne.io/fyne/v2 v2.1.2
fyne.io/fyne/v2 v2.4.3
github.com/genshen/cmds v0.0.0-20200505065256-d4c52690e15b
github.com/genshen/wssocks v0.6.1
github.com/sirupsen/logrus v1.9.3
golang.org/x/crypto v0.11.0
golang.org/x/crypto v0.18.0
)
Loading

0 comments on commit df3d4f3

Please sign in to comment.