Skip to content

Commit

Permalink
goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
matteriot committed Oct 29, 2023
1 parent e198137 commit a0a92dd
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 24 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ jobs:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: build ios xcframework
run: gomobile bind -ldflags '-w -s -extldflags "-lresolve"' --target=ios,macos,iossimulator -o OpenIoTHubGateway.xcframework ./client
- name: Upload the installer as an artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name != 'pull_request' }}
- name: Release windows setup
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: OpenIoTHubGateway.xcframework
path: OpenIoTHubGateway.xcframework
files: |
OpenIoTHubGateway.xcframework
- name: build android aar
run: gomobile bind -target=android -o gateway.aar ./client
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
- name: Upload the installer as an artifact
uses: actions/upload-artifact@v3
if: ${{ github.event_name != 'pull_request' }}
- name: Release windows setup
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: gateway.aar
path: gateway.aar
files: |
gateway.aar
2 changes: 1 addition & 1 deletion lib/builddll.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ SET CC=x86_64-w64-mingw32-gcc
SET CXX=x86_64-w64-mingw32-g++
SET GOOS=windows
SET GOARCH=amd64
go build -tags windows -ldflags=-w -trimpath -o ./build/windows/gateway_amd64.dll -buildmode=c-shared
go build -tags windows -ldflags=-w -trimpath -o ./build/windows/gateway_amd64.dll -buildmode=c-shared lib/lib.go
2 changes: 1 addition & 1 deletion lib/builddll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export CGO_ENABLED=1
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export GOOS=windows GOARCH=amd64
go build -tags windows -ldflags=-w -trimpath -o ./build/windows/gateway_amd64.dll -buildmode=c-shared
go build -tags windows -ldflags=-w -trimpath -o ./build/windows/gateway_amd64.dll -buildmode=c-shared lib/lib.go
8 changes: 4 additions & 4 deletions lib/builddylib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ echo "building MacOS/iOS dylib"
export CFLAGS="-arch arm64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path)
# shellcheck disable=SC2155
export CGO_LDFLAGS="-arch arm64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphoneos --show-sdk-path)
CGO_ENABLED=1 GOARCH=arm64 GOOS=ios CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags ios -ldflags=-w -trimpath -o "./build/ios/gateway_arm64.a" -buildmode c-archive
CGO_ENABLED=1 GOARCH=arm64 GOOS=ios CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags ios -ldflags=-w -trimpath -o "./build/ios/gateway_arm64.a" -buildmode c-archive lib/lib.go

# shellcheck disable=SC2155
export CFLAGS="-arch x86_64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphonesimulator --show-sdk-path)
# shellcheck disable=SC2155
export CGO_LDFLAGS="-arch x86_64 -miphoneos-version-min=9.0 -isysroot "$(xcrun -sdk iphonesimulator --show-sdk-path)
CGO_ENABLED=1 GOARCH=amd64 GOOS=ios CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags ios -ldflags=-w -trimpath -o "./build/ios/gateway_simulator_amd64.a" -buildmode c-archive
CGO_ENABLED=1 GOARCH=amd64 GOOS=ios CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags ios -ldflags=-w -trimpath -o "./build/ios/gateway_simulator_amd64.a" -buildmode c-archive lib/lib.go

lipo -create ./build/ios/gateway_arm64.a ./build/ios/gateway_simulator_amd64.a -output ./build/ios/libgateway_amd64_arm64.a

Expand All @@ -21,7 +21,7 @@ export CFLAGS="-mmacosx-version-min=10.9 -isysroot "$(xcrun -sdk macosx --show-s
# shellcheck disable=SC2155
export CGO_LDFLAGS="-mmacosx-version-min=10.9 -isysroot "$(xcrun -sdk macosx --show-sdk-path)
#CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags macosx -ldflags=-w -trimpath -o "test.a" -buildmode c-archive
CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags macosx -ldflags=-w -trimpath -o "./build/macos/gateway_amd64.a" -buildmode c-archive
CGO_ENABLED=1 GOARCH=arm64 GOOS=darwin CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags macosx -ldflags=-w -trimpath -o "./build/macos/gateway_arm64.a" -buildmode c-archive
CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags macosx -ldflags=-w -trimpath -o "./build/macos/gateway_amd64.a" -buildmode c-archive lib/lib.go
CGO_ENABLED=1 GOARCH=arm64 GOOS=darwin CC="clang $CFLAGS $CGO_LDFLAGS" go build -tags macosx -ldflags=-w -trimpath -o "./build/macos/gateway_arm64.a" -buildmode c-archive lib/lib.go

lipo -create ./build/macos/gateway_amd64.a ./build/macos/gateway_arm64.a -output ./build/macos/libgateway_amd64_arm64.a
12 changes: 6 additions & 6 deletions lib/buildso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "building linux/android so file"
export CGO_ENABLED=1
export GOARCH=amd64
export GOOS=linux
go build -tags linux -ldflags=-w -trimpath -o build/linux/libgateway_amd64.so -buildmode c-shared
go build -tags linux -ldflags=-w -trimpath -o build/linux/libgateway_amd64.so -buildmode c-shared lib/lib.go
# shellcheck disable=SC2034
export CGO_ENABLED=1
export GOARCH=arm64
Expand All @@ -15,7 +15,7 @@ export CC=aarch64-linux-gnu-gcc
#export CXX=aarch64-linux-gnu-g++
##sudo apt-get install binutils-aarch64-linux-gnu
#export AR=aarch64-linux-gnu-ar
go build -tags linux -ldflags=-w -trimpath -o build/linux/libgateway_arm64.so -buildmode c-shared
go build -tags linux -ldflags=-w -trimpath -o build/linux/libgateway_arm64.so -buildmode c-shared lib/lib.go

#export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:~/Android/Sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
##android/app/src/main/jniLibs/armeabi-v7a
Expand All @@ -24,25 +24,25 @@ go build -tags linux -ldflags=-w -trimpath -o build/linux/libgateway_arm64.so -b
#export GOARCH=arm
#export GOOS=android
#export CC=armv7a-linux-androideabi33-clang
#go build -tags android -ldflags=-w -trimpath -o build/android/armeabi-v7a/libgateway.so -buildmode c-shared
#go build -tags android -ldflags=-w -trimpath -o build/android/armeabi-v7a/libgateway.so -buildmode c-shared lib/lib.go
##android/app/src/main/jniLibs/arm64-v8a
## shellcheck disable=SC2034
#export CGO_ENABLED=1
#export GOARCH=arm64
#export GOOS=android
#export CC=aarch64-linux-android33-clang
#go build -tags android -ldflags=-w -trimpath -o build/android/arm64-v8a/libgateway.so -buildmode c-shared
#go build -tags android -ldflags=-w -trimpath -o build/android/arm64-v8a/libgateway.so -buildmode c-shared lib/lib.go
##android/app/src/main/jniLibs/x86
## shellcheck disable=SC2034
#export CGO_ENABLED=1
#export GOARCH=386
#export GOOS=android
#export CC=i686-linux-android33-clang
#go build -tags android -ldflags=-w -trimpath -o build/android/x86/libgateway.so -buildmode c-shared
#go build -tags android -ldflags=-w -trimpath -o build/android/x86/libgateway.so -buildmode c-shared lib/lib.go
##android/app/src/main/jniLibs/x86_64
## shellcheck disable=SC2034
#export CGO_ENABLED=1
#export GOARCH=amd64
#export GOOS=android
#export CC=x86_64-linux-android33-clang
#go build -tags android -ldflags=-w -trimpath -o build/android/x86_64/libgateway.so -buildmode c-shared
#go build -tags android -ldflags=-w -trimpath -o build/android/x86_64/libgateway.so -buildmode c-shared lib/lib.go
23 changes: 23 additions & 0 deletions lib/lib.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import "C"

import (
client "github.com/OpenIoTHub/gateway-go/client"
)

var (
version = "dev"
commit = ""
date = "time"
builtBy = ""
)

func main() {

}

//export Run
func Run() {
go client.Run()
}
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package main

import "C"

import (
"fmt"
client "github.com/OpenIoTHub/gateway-go/client"
Expand Down

0 comments on commit a0a92dd

Please sign in to comment.