fix: release bug
This commit is contained in:
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -59,7 +59,6 @@ jobs:
|
||||
uses: egor-tensin/setup-mingw@v2
|
||||
with:
|
||||
platform: ${{ matrix.job.aarch }}
|
||||
|
||||
- name: Setup macos
|
||||
if: startsWith(matrix.job.target,'macos') || startsWith(matrix.job.target,'ios')
|
||||
run: |
|
||||
@@ -113,7 +112,7 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: ./bin/*
|
||||
files: ./bin/*.tar.gz
|
||||
name: 'draft'
|
||||
tag_name: 'draft'
|
||||
prerelease: true
|
||||
@@ -140,4 +139,4 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: bin/*
|
||||
files: bin/*.tar.gz
|
||||
|
||||
45
Makefile
45
Makefile
@@ -1,55 +1,62 @@
|
||||
PRODUCT_NAME=libcore
|
||||
BASENAME=hiddify-$(PRODUCT_NAME)
|
||||
BASENAME=$(PRODUCT_NAME)
|
||||
BINDIR=bin
|
||||
LIBNAME=$(PRODUCT_NAME)
|
||||
SRVNAME=hiddify-service
|
||||
|
||||
BRANCH=$(shell git branch --show-current)
|
||||
VERSION=$(shell git describe --tags || echo "unknown version")
|
||||
NAME=$(BASENAME)-$@
|
||||
|
||||
|
||||
TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc
|
||||
IOS_TAGS=with_dhcp,with_low_memory,with_conntrack
|
||||
GOBUILD=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
||||
GOBUILDLIB=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
||||
GOBUILDSRV=CGO_ENABLED=1 go build -trimpath
|
||||
|
||||
lib_install:
|
||||
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.1
|
||||
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.1
|
||||
|
||||
headers:
|
||||
go build -buildmode=c-archive -o $(BINDIR)/$(NAME).h ./custom
|
||||
go build -buildmode=c-archive -o $(BINDIR)/$(LIBNAME).h ./custom
|
||||
|
||||
android: lib_install
|
||||
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -target=android -o $(BINDIR)/$(NAME).aar github.com/sagernet/sing-box/experimental/libbox ./mobile
|
||||
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -target=android -o $(BINDIR)/$(LIBNAME).aar github.com/sagernet/sing-box/experimental/libbox ./mobile
|
||||
|
||||
ios-full: lib_install
|
||||
gomobile bind -v -target ios,iossimulator,tvos,tvossimulator,macos -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(PRODUCT_NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile &&\
|
||||
mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(NAME).xcframework &&\
|
||||
cp Libcore.podspec $(BINDIR)/$(NAME).xcframework/
|
||||
mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(LIBNAME).xcframework &&\
|
||||
cp Libcore.podspec $(BINDIR)/$(LIBNAME).xcframework/
|
||||
|
||||
ios: lib_install
|
||||
gomobile bind -v -target ios -libname=box -tags=$(TAGS),with_dhcp,with_low_memory,with_conntrack -trimpath -ldflags="-w -s" -o $(BINDIR)/$(PRODUCT_NAME).xcframework github.com/sagernet/sing-box/experimental/libbox ./mobile &&\
|
||||
mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(NAME).xcframework &&\
|
||||
cp Info.plist $(BINDIR)/$(NAME).xcframework/
|
||||
mv $(BINDIR)/$(PRODUCT_NAME).xcframework $(BINDIR)/$(LIBNAME).xcframework &&\
|
||||
cp Info.plist $(BINDIR)/$(LIBNAME).xcframework/
|
||||
|
||||
|
||||
|
||||
windows-amd64:
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME).dll ./custom
|
||||
rsrc -manifest admin_service\cmd\admin_service.manifest -ico ..\assets\images\tray_icon_connected.ico -o admin_service\cmd\admin_service.syso
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/hiddify-service.exe ./admin_service/cmd
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILDLIB) -o $(BINDIR)/$(LIBNAME).dll ./custom
|
||||
go get github.com/akavel/rsrc
|
||||
go install github.com/akavel/rsrc
|
||||
|
||||
$$(go env GOPATH)/bin/rsrc -manifest admin_service/cmd/admin_service.manifest -ico ../assets/images/tray_icon_connected.ico -o admin_service/cmd/admin_service.syso
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="bin/$(LIBNAME).dll" $(GOBUILDSRV) -o $(BINDIR)/$(SRVNAME).exe ./admin_service/cmd
|
||||
|
||||
linux-amd64:
|
||||
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/$(NAME).so ./custom
|
||||
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/hiddify-service ./admin_service/cmd
|
||||
chmod +x $(BINDIR)/hiddify-service
|
||||
env GOOS=linux GOARCH=amd64 $(GOBUILDLIB) -o $(BINDIR)/$(LIBNAME).so ./custom
|
||||
env GOOS=linux GOARCH=amd64 CGO_LDFLAGS="bin/$(LIBNAME).so" $(GOBUILDSRV) -o $(BINDIR)/$(SRVNAME) ./admin_service/cmd
|
||||
chmod +x $(BINDIR)/$(SRVNAME)
|
||||
|
||||
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 $(TAGS),$(IOS_TAGS) -buildmode=c-shared -o $(BINDIR)/$(NAME).dylib ./custom
|
||||
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 $(TAGS),$(IOS_TAGS) -o $(BINDIR)/hiddify-service ./admin_service/cmd
|
||||
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 $(TAGS),$(IOS_TAGS) -buildmode=c-shared -o $(BINDIR)/$(LIBNAME).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 $(TAGS),$(IOS_TAGS) -buildmode=c-shared -o $(BINDIR)/$(NAME).dylib ./custom
|
||||
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 $(TAGS),$(IOS_TAGS) -buildmode=c-shared -o $(BINDIR)/$(LIBNAME).dylib ./custom
|
||||
|
||||
macos-universal: macos-amd64 macos-arm64
|
||||
lipo -create $(BINDIR)/$(BASENAME)-macos-amd64.dylib $(BINDIR)/$(BASENAME)-macos-arm64.dylib -output $(BINDIR)/$(NAME).dylib
|
||||
lipo -create $(BINDIR)/$(BASENAME)-macos-amd64.dylib $(BINDIR)/$(BASENAME)-macos-arm64.dylib -output $(BINDIR)/$(LIBNAME).dylib
|
||||
env GOOS=darwin GOARCH=amd64 CGO_CFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="-mmacosx-version-min=10.11" CGO_LDFLAGS="bin/$(LIBNAME).dylib" CGO_ENABLED=1 $(GOBUILDSRV) -o $(BINDIR)/$(SRVNAME) ./admin_service/cmd
|
||||
chmod +x $(BINDIR)/$(SRVNAME)
|
||||
|
||||
clean:
|
||||
rm $(BINDIR)/*
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: bin/libcore.dll
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -20,24 +19,21 @@ import (
|
||||
|
||||
func main() {
|
||||
args := os.Args
|
||||
// Check if there is at least one command-line argument
|
||||
if len(args) < 2 {
|
||||
println("Usage: hiddify-service.exe empty/start/stop/uninstall/install")
|
||||
// os.Exit(1)
|
||||
fmt.Println("Usage: hiddify-service.exe empty/start/stop/uninstall/install")
|
||||
args = append(args, "")
|
||||
}
|
||||
// fmt.Printf("os.Args: %+v", args)
|
||||
os.Chdir(os.Args[0])
|
||||
// Convert the Go string to a C string
|
||||
arg := C.CString(args[1])
|
||||
// defer C.free(unsafe.Pointer(arg))
|
||||
|
||||
// Call AdminServiceStart with the C string
|
||||
os.Chdir(os.Args[0])
|
||||
|
||||
arg := C.CString(args[1])
|
||||
defer C.free(unsafe.Pointer(arg))
|
||||
|
||||
result := C.AdminServiceStart(arg)
|
||||
goRes := C.GoString(result)
|
||||
defer C.free(unsafe.Pointer(result))
|
||||
|
||||
goRes := C.GoString(result)
|
||||
|
||||
parts := strings.SplitN(goRes, " ", 2)
|
||||
|
||||
var parsedExitCode int
|
||||
@@ -47,10 +43,10 @@ func main() {
|
||||
fmt.Println("Error parsing the string:", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("%d %s", parsedExitCode, parsedOutMessage)
|
||||
|
||||
if parsedExitCode != 0 {
|
||||
os.Exit(int(parsedExitCode))
|
||||
os.Exit(parsedExitCode)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user