From a91b67b325800d2248b8599def044cf0d92ff86d Mon Sep 17 00:00:00 2001
From: Denis GERMAIN
Date: Fri, 25 Aug 2023 14:25:07 +0200
Subject: [PATCH] fix: darwin compilation fixes #21
---
.goreleaser.yaml | 1 +
README.md | 2 ++
developpement_diary/2023-08-25.md | 7 ++++
fake-releaser.sh | 57 +++++++++++++++++++++++++++----
4 files changed, 60 insertions(+), 7 deletions(-)
create mode 100644 developpement_diary/2023-08-25.md
diff --git a/.goreleaser.yaml b/.goreleaser.yaml
index 65a7a76..6f60f96 100644
--- a/.goreleaser.yaml
+++ b/.goreleaser.yaml
@@ -10,6 +10,7 @@ builds:
- linux
- windows
- android
+ - darwin
goarch:
- amd64
- arm64
diff --git a/README.md b/README.md
index 75c8ed5..c8c3d8c 100644
--- a/README.md
+++ b/README.md
@@ -44,3 +44,5 @@ Test release (against code not tagged)
```bash
goreleaser --snapshot --clean
```
+
+Note: for darwin compilation, we need fyne-cross which requires having locally the XCode SDK, especially `Command_Line_Tools_for_Xcode_12.4.dmg`. [Download it here](https://developer.apple.com/download/all/?q=Command%20Line%20Tools). See [fyne-cross documentation for more information](https://github.com/fyne-io/fyne-cross/blob/master/README.md).
\ No newline at end of file
diff --git a/developpement_diary/2023-08-25.md b/developpement_diary/2023-08-25.md
new file mode 100644
index 0000000..75b7cf2
--- /dev/null
+++ b/developpement_diary/2023-08-25.md
@@ -0,0 +1,7 @@
+## 2023-08-25
+
+Today, I just concentrated myself on darwin compilation issue with fyne-cross
+* [https://github.com/zwindler/gocastle/issues/21](https://github.com/zwindler/gocastle/issues/21)
+* [https://github.com/fyne-io/fyne-cross/issues/187](https://github.com/fyne-io/fyne-cross/issues/187)
+
+I found out my mistake and made a PR to improve documentation [https://github.com/fyne-io/fyne-cross/pull/202](https://github.com/fyne-io/fyne-cross/pull/202)
\ No newline at end of file
diff --git a/fake-releaser.sh b/fake-releaser.sh
index 9037553..0efa460 100755
--- a/fake-releaser.sh
+++ b/fake-releaser.sh
@@ -8,6 +8,7 @@ build_linux_amd64() {
fyne-cross linux -arch=amd64,arm64 -app-id fr.zwindler.gocastle
fyne-cross android -arch=arm64 -app-id fr.zwindler.gocastle
fyne-cross windows -app-id fr.zwindler.gocastle
+ fyne-cross darwin -arch=amd64,arm64 --macosx-sdk-path /home/zwindler/sources/gocastle/bin/SDKs.12.4/MacOSX.sdk -app-id fr.zwindler.gocastle
mkdir -p dist/gocastle_linux_amd64_v1/
cp fyne-cross/bin/linux-amd64/gocastle dist/gocastle_linux_amd64_v1/gocastle
rm buildlock
@@ -17,14 +18,14 @@ build_linux_arm64() {
sleep 1
# build is done by build_linux_amd64, wait for it to finish
- timeout=180
+ timeout=240
while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
sleep 1
((timeout--))
done
if [[ -e buildlock ]]; then
- echo "Timeout: Lock file not removed after 180 seconds."
+ echo "Timeout: Lock file not removed after 240 seconds."
exit 1
fi
@@ -36,14 +37,14 @@ build_android() {
sleep 1
# build is done by build_linux_amd64, wait for it to finish
- timeout=180
+ timeout=240
while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
sleep 1
((timeout--))
done
if [[ -e buildlock ]]; then
- echo "Timeout: Lock file not removed after 180 seconds."
+ echo "Timeout: Lock file not removed after 240 seconds."
exit 1
fi
@@ -55,14 +56,14 @@ build_windows() {
sleep 1
# build is done by build_linux_amd64, wait for it to finish
- timeout=180
+ timeout=240
while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
sleep 1
((timeout--))
done
if [[ -e buildlock ]]; then
- echo "Timeout: Lock file not removed after 180 seconds."
+ echo "Timeout: Lock file not removed after 240 seconds."
exit 1
fi
@@ -70,6 +71,44 @@ build_windows() {
cp fyne-cross/bin/windows-amd64/gocastle.exe dist/gocastle_windows_amd64_v1/
}
+build_darwin_amd64() {
+ sleep 1
+
+ # build is done by build_linux_amd64, wait for it to finish
+ timeout=240
+ while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
+ sleep 1
+ ((timeout--))
+ done
+
+ if [[ -e buildlock ]]; then
+ echo "Timeout: Lock file not removed after 240 seconds."
+ exit 1
+ fi
+
+ mkdir -p dist/gocastle_darwin_amd64_v1/
+ cp fyne-cross/bin/darwin-amd64/gocastle dist/gocastle_darwin_amd64_v1/
+}
+
+build_darwin_arm64() {
+ sleep 1
+
+ # build is done by build_linux_amd64, wait for it to finish
+ timeout=240
+ while [[ -e buildlock ]] && [[ $timeout -gt 0 ]]; do
+ sleep 1
+ ((timeout--))
+ done
+
+ if [[ -e buildlock ]]; then
+ echo "Timeout: Lock file not removed after 240 seconds."
+ exit 1
+ fi
+
+ mkdir -p dist/gocastle_darwin_arm64/
+ cp fyne-cross/bin/darwin-arm64/gocastle dist/gocastle_darwin_arm64/
+}
+
if [[ "$4" == *"/gocastle_linux_amd64_v1/gocastle" ]]; then
build_linux_amd64
elif [[ "$4" == *"/gocastle_linux_arm64/gocastle" ]]; then
@@ -78,7 +117,11 @@ elif [[ "$4" == *"/gocastle_android_arm64/gocastle" ]]; then
build_android
elif [[ "$4" == *"/gocastle_windows_amd64_v1/gocastle.exe" ]]; then
build_windows
+elif [[ "$4" == *"/gocastle_darwin_amd64_v1/gocastle" ]]; then
+ build_darwin_amd64
+elif [[ "$4" == *"/gocastle_darwin_arm64/gocastle" ]]; then
+ build_darwin_arm64
else
- echo "Invalid or unsupported path argument."
+ echo "Invalid or unsupported path argument '$4'"
exit 1
fi