From 2d791f8a8570c100c114e8dc72b0cf4a32d7f826 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <rubberduckie3554@gmail.com>
Date: Thu, 20 Oct 2022 21:18:09 -0400
Subject: [PATCH 01/19] Cirrus build for Apple Silicon - maybe

---
 .ci/macos/notarize.sh | 12 +++++++----
 .cirrus.yml           | 23 +++++++++++++++++++++
 .gitlab-ci.yml        | 47 ++++++++++++++++++++++++++-----------------
 3 files changed, 60 insertions(+), 22 deletions(-)
 create mode 100644 .cirrus.yml

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index af62a6d2d..d0ff50c53 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -10,10 +10,14 @@ PATH="/usr/local/opt/qt@5/bin/:${PATH}"
 
 security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
 
+if [ "${CI_PIPELINE_TRIGGERED}" ]; then
+  cat "${TRIGGER_PAYLOAD}"
+fi
+
 ( cd build || exit
   # macdeployqt does not copy symlinks over.
   # this specifically addresses icu4c issues but nothing else.
-  # We might not even need this any longer... 
+  # We might not even need this any longer...
   # ICU_LIB="$(brew --prefix icu4c)/lib"
   # export ICU_LIB
   # mkdir -p nheko.app/Contents/Frameworks
@@ -72,7 +76,7 @@ while sleep 60 && date; do
   #isSuccess=$(grep "success" "$NOTARIZE_STATUS_LOG")
   #isFailure=$(grep "invalid" "$NOTARIZE_STATUS_LOG")
 
-  echo "Status for submission \"${requestUUID}\": \"${sub_status}\"" 
+  echo "Status for submission \"${requestUUID}\": \"${sub_status}\""
 
   if [ "${sub_status}" = "Accepted" ]; then
       echo "Notarization done!"
@@ -91,7 +95,7 @@ done
 VERSION=${CI_COMMIT_SHORT_SHA}
 
 if [ -n "$VERSION" ]; then
-    mv nheko.dmg "nheko-${VERSION}.dmg"
+    mv nheko.dmg "nheko-${VERSION}_${PLAT}.dmg"
     mkdir artifacts
-    cp "nheko-${VERSION}.dmg" artifacts/
+    cp "nheko-${VERSION}_${PLAT}.dmg" artifacts/
 fi
\ No newline at end of file
diff --git a/.cirrus.yml b/.cirrus.yml
new file mode 100644
index 000000000..c607654ff
--- /dev/null
+++ b/.cirrus.yml
@@ -0,0 +1,23 @@
+task:
+  macos_instance:
+    image: ghcr.io/cirruslabs/macos-monterey-xcode:13
+  name: Build - macOS Apple Silicon
+  homebrew_script:
+    - brew bundle --file .ci/macos/Brewfile
+  build_script:
+    - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
+    - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
+    - cmake -GNinja -H. -Bbuild
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo
+        -DCMAKE_INSTALL_PREFIX=.deps/usr
+        -DHUNTER_ROOT="../.hunter"
+        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
+        -DUSE_BUNDLED_OPENSSL=ON
+        -DUSE_BUNDLED_BOOST=ON
+        -DCI_BUILD=ON
+        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
+    - cmake --build build
+    - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
+  binaries_artifacts:
+    path: build/nheko.app
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 197cc7ac3..877e39042 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,6 +4,11 @@ variables:
   # prevent configure tzdata hanging apt install commands
   DEBIAN_FRONTEND: noninteractive
 
+# default to not running jobs when pipeline is triggered from a webhook.
+default:
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
+
 build-clazy:
   stage: build
   image: ubuntu:22.04
@@ -14,10 +19,10 @@ build-clazy:
   before_script:
     - apt-get update
     - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake liblmdb-dev libre2-dev
-        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
-        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
-        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
-        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
+        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
+        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
+        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform
+        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev
   script:
     - export PATH="/usr/local/bin/:/usr/lib/ccache:${PATH}"
     - export CMAKE_BUILD_PARALLEL_LEVEL=$(cat /proc/cpuinfo | awk '/^processor/{print $3}' | wc -l)
@@ -41,11 +46,11 @@ build-gcc11:
     TRAVIS_OS_NAME: linux
   before_script:
     - apt-get update
-    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev 
-        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
-        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
-        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
-        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
+    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
+        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
+        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
+        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform
+        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev
     # need recommended deps for wget
     - apt-get -y install wget
     - /usr/sbin/update-ccache-symlinks
@@ -77,11 +82,11 @@ build-gcc10:
     TRAVIS_OS_NAME: linux
   before_script:
     - apt-get update
-    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev 
-        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev 
-        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev 
-        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform 
-        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev 
+    - apt-get -y install --no-install-suggests --no-install-recommends ca-certificates build-essential ninja-build cmake gcc make automake ccache liblmdb-dev
+        libssl-dev libqt5multimedia5-plugins libqt5multimediagsttools5 libqt5multimediaquick5 libqt5svg5-dev
+        qtmultimedia5-dev qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools qtdeclarative5-dev
+        qml-module-qtmultimedia qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qt-labs-platform
+        qt5keychain-dev ccache clazy libcurl4-openssl-dev libevent-dev libspdlog-dev git nlohmann-json3-dev libcmark-dev asciidoc # libolm-dev
     # need recommended deps for wget
     - apt-get -y install wget
     - /usr/sbin/update-ccache-symlinks
@@ -143,6 +148,8 @@ build-macos:
 codesign-macos:
   stage: deploy
   tags: [macos]
+  variables:
+    PLAT: "intel"
   before_script:
     - 'brew upgrade qt@5'
     - pip3 install dmgbuild
@@ -150,15 +157,19 @@ codesign-macos:
     - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
     - ./.ci/macos/notarize.sh
   after_script:
-    - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
+    - ./.ci/upload-nightly-gitlab.sh artifacts/nheko-${CI_COMMIT_SHORT_SHA}_${PLAT}.dmg
   needs:
-    - build-macos
+    - job: build-macos
+      optional: true # optional since we want to be able to also trigger this job from cirrus ci for apple silicon builds.
   rules:
-    - if: '$CI_COMMIT_BRANCH == "master"'
+    - if : '$CI_COMMIT_BRANCH == "master"'
     - if : $CI_COMMIT_TAG
+    - if : $CI_PIPELINE_TRIGGERED
+      variables:
+        PLAT: "m1"
   artifacts:
     paths:
-      - artifacts/nheko-${CI_COMMIT_SHORT_SHA}.dmg
+      - artifacts/nheko-${CI_COMMIT_SHORT_SHA}_${PLAT}.dmg
       - /tmp/notarize*
     name: nheko-${CI_COMMIT_SHORT_SHA}-macos
 
-- 
GitLab


From f615f6a71fa9bcb811c604cc0422a3799a7c66ba Mon Sep 17 00:00:00 2001
From: Joseph Donofry <rubberduckie3554@gmail.com>
Date: Thu, 20 Oct 2022 21:21:40 -0400
Subject: [PATCH 02/19] Gitlab doesn't allow default rules

---
 .gitlab-ci.yml | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 877e39042..2b0ef4a58 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,11 +4,6 @@ variables:
   # prevent configure tzdata hanging apt install commands
   DEBIAN_FRONTEND: noninteractive
 
-# default to not running jobs when pipeline is triggered from a webhook.
-default:
-  rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
-
 build-clazy:
   stage: build
   image: ubuntu:22.04
@@ -33,6 +28,8 @@ build-clazy:
         -DCMAKE_BUILD_TYPE=Release
         -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
     - cmake --build build
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -68,6 +65,8 @@ build-gcc11:
     - cmake --build build
   after_script:
     - mv ../.hunter .hunter
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -105,6 +104,8 @@ build-gcc10:
     - cmake --build build
   after_script:
     - mv ../.hunter .hunter
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -133,6 +134,8 @@ build-macos:
     - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
   after_script:
     - mv ../.hunter .hunter
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   artifacts:
     paths:
       - build/nheko.app
@@ -192,6 +195,8 @@ build-flatpak-amd64:
   after_script:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -220,6 +225,8 @@ build-flatpak-arm64:
   after_script:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -241,4 +248,6 @@ linting:
   script:
     - make lint
     - make license
+  rules:
+  - if : '!$CI_PIPELINE_TRIGGERED'
 
-- 
GitLab


From 9e5457f374182b9721345593d5d382894c8453a3 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <rubberduckie3554@gmail.com>
Date: Thu, 20 Oct 2022 21:23:32 -0400
Subject: [PATCH 03/19] bad spacing

---
 .gitlab-ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2b0ef4a58..d3135565b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,7 +29,7 @@ build-clazy:
         -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
     - cmake --build build
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -66,7 +66,7 @@ build-gcc11:
   after_script:
     - mv ../.hunter .hunter
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -105,7 +105,7 @@ build-gcc10:
   after_script:
     - mv ../.hunter .hunter
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -135,7 +135,7 @@ build-macos:
   after_script:
     - mv ../.hunter .hunter
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   artifacts:
     paths:
       - build/nheko.app
@@ -196,7 +196,7 @@ build-flatpak-amd64:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -226,7 +226,7 @@ build-flatpak-arm64:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -249,5 +249,5 @@ linting:
     - make lint
     - make license
   rules:
-  - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '!$CI_PIPELINE_TRIGGERED'
 
-- 
GitLab


From ba8ed0703be0abb90e04b63ed3b3b8cec8a40c91 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <rubberduckie3554@gmail.com>
Date: Thu, 20 Oct 2022 21:29:45 -0400
Subject: [PATCH 04/19] Fix null variable checks in ci syntax

---
 .gitlab-ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d3135565b..6705d03d8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,7 +29,7 @@ build-clazy:
         -DCI_BUILD=ON -DFETCHCONTENT_QUIET=OFF -DCMAKE_CXX_COMPILER=clazy
     - cmake --build build
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -66,7 +66,7 @@ build-gcc11:
   after_script:
     - mv ../.hunter .hunter
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -105,7 +105,7 @@ build-gcc10:
   after_script:
     - mv ../.hunter .hunter
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -135,7 +135,7 @@ build-macos:
   after_script:
     - mv ../.hunter .hunter
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   artifacts:
     paths:
       - build/nheko.app
@@ -196,7 +196,7 @@ build-flatpak-amd64:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-amd64.flatpak
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -226,7 +226,7 @@ build-flatpak-arm64:
     - (cd ./scripts && ./upload-to-flatpak-repo.sh ../build-flatpak/repo) || true
     - bash ./.ci/upload-nightly-gitlab.sh build-flatpak/nheko-arm64.flatpak
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
   cache:
     key: "$CI_JOB_NAME"
     paths:
@@ -249,5 +249,5 @@ linting:
     - make lint
     - make license
   rules:
-    - if : '!$CI_PIPELINE_TRIGGERED'
+    - if : '$CI_PIPELINE_TRIGGERED == null'
 
-- 
GitLab


From 443ad4e0a0d85c71807a47d60659154a58727aeb Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 20 Oct 2022 21:49:54 -0400
Subject: [PATCH 05/19] Maybe fix Qt5 issues in cirrus build

---
 .cirrus.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index c607654ff..f4f4fed2d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,14 +7,18 @@ task:
   build_script:
     - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
     - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
-    - cmake -GNinja -H. -Bbuild
+    - cmake -GNinja -S. -Bbuild
         -DCMAKE_BUILD_TYPE=RelWithDebInfo
         -DCMAKE_INSTALL_PREFIX=.deps/usr
         -DHUNTER_ROOT="../.hunter"
         -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
         -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
         -DUSE_BUNDLED_OPENSSL=ON
-        -DUSE_BUNDLED_BOOST=ON
+        -DQT_PATH=/usr/local/opt/qt@5/,
+        -DQt5_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5,
+        -DQt5MacExtras_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5MacExtras,
+        -DQt5DBus_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5DBus,
+        -DQt5QuickCompiler_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5QuickCompiler,
         -DCI_BUILD=ON
         -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
     - cmake --build build
-- 
GitLab


From c3fd2501032b15f6668370060a7b39b58c937b95 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 20 Oct 2022 22:12:23 -0400
Subject: [PATCH 06/19] Maybe brew prefix will help

---
 .cirrus.yml | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index f4f4fed2d..b0ef50bc4 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -5,8 +5,9 @@ task:
   homebrew_script:
     - brew bundle --file .ci/macos/Brewfile
   build_script:
-    - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
-    - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
+    - export PATH="$(brew --prefix qt5)/bin/:${PATH}"
+    - export CMAKE_PREFIX_PATH="$(brew --prefix qt5)"
+    - echo "$(brew --prefix qt5)"
     - cmake -GNinja -S. -Bbuild
         -DCMAKE_BUILD_TYPE=RelWithDebInfo
         -DCMAKE_INSTALL_PREFIX=.deps/usr
@@ -14,11 +15,11 @@ task:
         -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
         -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
         -DUSE_BUNDLED_OPENSSL=ON
-        -DQT_PATH=/usr/local/opt/qt@5/,
-        -DQt5_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5,
-        -DQt5MacExtras_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5MacExtras,
-        -DQt5DBus_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5DBus,
-        -DQt5QuickCompiler_DIR:PATH=/usr/local/opt/qt@5/lib/cmake/Qt5QuickCompiler,
+        -DQT_PATH="$(brew --prefix qt5)",
+        -DQt5_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5",
+        -DQt5MacExtras_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5MacExtras",
+        -DQt5DBus_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5DBus",
+        -DQt5QuickCompiler_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5QuickCompiler",
         -DCI_BUILD=ON
         -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
     - cmake --build build
-- 
GitLab


From 5ca177b92fb1b466effb7f789a3605fb083755a9 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 20 Oct 2022 22:44:29 -0400
Subject: [PATCH 07/19] Invoke gitlab pipeline trigger

---
 .ci/macos/notarize.sh |  1 +
 .cirrus.yml           | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index d0ff50c53..2a62e9282 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -11,6 +11,7 @@ PATH="/usr/local/opt/qt@5/bin/:${PATH}"
 security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
 
 if [ "${CI_PIPELINE_TRIGGERED}" ]; then
+  echo "cirrus build id: ${TRIGGER_BUILD_ID}"
   cat "${TRIGGER_PAYLOAD}"
 fi
 
diff --git a/.cirrus.yml b/.cirrus.yml
index b0ef50bc4..c46c3ff77 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -2,6 +2,9 @@ task:
   macos_instance:
     image: ghcr.io/cirruslabs/macos-monterey-xcode:13
   name: Build - macOS Apple Silicon
+  only_if: $CIRRUS_REPO_OWNER == 'Nheko-Reborn'
+  environment:
+    GITLAB_TRIGGER_TOKEN: ENCRYPTED[!5fb4bbdecbde3b2c766ac7383dca573cd5ec8b815c5ac9bede0cadfe9ad70ecd3e64b1728f7840da087099f3fc1fd4f7!]
   homebrew_script:
     - brew bundle --file .ci/macos/Brewfile
   build_script:
@@ -24,5 +27,14 @@ task:
         -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
     - cmake --build build
     - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
+  zip_script:
+    - zip -r build/nheko.app build/nheko.zip
+  gitlab_script:
+    - curl -X POST
+        --fail
+        -F token="${GITLAB_TRIGGER_TOKEN}"
+        -F ref="${CIRRUS_BRANCH}"
+        -F "variables[TRIGGER_BUILD_ID]=${CIRRUS_BUILD_ID}"
+        "https://nheko.im/api/v4/projects/2/trigger/pipeline"
   binaries_artifacts:
-    path: build/nheko.app
\ No newline at end of file
+    path: build/nheko.zip
\ No newline at end of file
-- 
GitLab


From 3de967fbc0af96d582ef4901ea909360d4da9871 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 20 Oct 2022 22:57:26 -0400
Subject: [PATCH 08/19] Got zip args mixed up

---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index c46c3ff77..b92fc36e6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -28,7 +28,7 @@ task:
     - cmake --build build
     - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
   zip_script:
-    - zip -r build/nheko.app build/nheko.zip
+    - zip -r build/nheko.zip build/nheko.app
   gitlab_script:
     - curl -X POST
         --fail
-- 
GitLab


From de1ba8b577ced20a878152ff2e512396504ddf90 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 20 Oct 2022 23:36:19 -0400
Subject: [PATCH 09/19] Download cirrus ci artifacts in codesign job

---
 .ci/macos/notarize.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index 2a62e9282..b3347a837 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -13,6 +13,15 @@ security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
 if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   echo "cirrus build id: ${TRIGGER_BUILD_ID}"
   cat "${TRIGGER_PAYLOAD}"
+  # download the build artifacts from cirrus api
+  wget "https://api.cirrus-ci.com/v1/artifact/build/${TRIGGER_BUILD_ID}/binaries.zip"
+  # cirrus ci artifacts task name is 'binaries' so that's the zip name.
+  unzip binaries.zip
+  # we zip 'build/nheko.app' in cirrus ci, cirrus itself puts it in a 'build' directory
+  # so move it to the right place for the rest of the process.
+  mv build/build/nheko.app build
+  # get rid of the extra build directory
+  rm -r build/build
 fi
 
 ( cd build || exit
-- 
GitLab


From 8e934e1b9bb37767ddd082636710e20d864b7c8d Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Fri, 21 Oct 2022 00:04:27 -0400
Subject: [PATCH 10/19] use curl instead of wget

---
 .ci/macos/notarize.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index b3347a837..0b1e07e19 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -14,7 +14,7 @@ if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   echo "cirrus build id: ${TRIGGER_BUILD_ID}"
   cat "${TRIGGER_PAYLOAD}"
   # download the build artifacts from cirrus api
-  wget "https://api.cirrus-ci.com/v1/artifact/build/${TRIGGER_BUILD_ID}/binaries.zip"
+  curl "https://api.cirrus-ci.com/v1/artifact/build/${TRIGGER_BUILD_ID}/binaries.zip" -o binaries.zip
   # cirrus ci artifacts task name is 'binaries' so that's the zip name.
   unzip binaries.zip
   # we zip 'build/nheko.app' in cirrus ci, cirrus itself puts it in a 'build' directory
@@ -24,6 +24,11 @@ if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   rm -r build/build
 fi
 
+if [ -d "build/nheko.app" ]; then
+  echo "nheko.app is missing, you did something wrong!"
+  exit 1
+fi
+
 ( cd build || exit
   # macdeployqt does not copy symlinks over.
   # this specifically addresses icu4c issues but nothing else.
-- 
GitLab


From 35357601635ad82cac298fe3f3d5c566a017a779 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Fri, 21 Oct 2022 00:27:02 -0400
Subject: [PATCH 11/19] Hopefully unzip to the right place

---
 .ci/macos/notarize.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index 0b1e07e19..b4ca31e69 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -19,12 +19,12 @@ if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   unzip binaries.zip
   # we zip 'build/nheko.app' in cirrus ci, cirrus itself puts it in a 'build' directory
   # so move it to the right place for the rest of the process.
-  mv build/build/nheko.app build
-  # get rid of the extra build directory
-  rm -r build/build
+  ( cd build || exit
+    unzip nheko.zip
+  )
 fi
 
-if [ -d "build/nheko.app" ]; then
+if [ ! -d "build/nheko.app" ]; then
   echo "nheko.app is missing, you did something wrong!"
   exit 1
 fi
-- 
GitLab


From e184f6372d1d0d054f991717f460b941da3f0f30 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Fri, 21 Oct 2022 00:42:59 -0400
Subject: [PATCH 12/19] One more time for the unzip

---
 .ci/macos/notarize.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index b4ca31e69..81158ed2f 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -21,6 +21,8 @@ if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   # so move it to the right place for the rest of the process.
   ( cd build || exit
     unzip nheko.zip
+    mv build/nheko.app .
+    rm -rf build
   )
 fi
 
-- 
GitLab


From 9ed87ef3f41b4ad5cb4b1a5d6005b56748dc1b14 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Mon, 24 Oct 2022 19:28:52 -0400
Subject: [PATCH 13/19] Run macdeployqt on the correct platform for each build

---
 .ci/macos/build.sh    | 32 ++++++++++++++++++++++++++++++++
 .ci/macos/deploy.sh   | 34 ----------------------------------
 .ci/macos/notarize.sh | 17 +----------------
 .cirrus.yml           | 19 +------------------
 .gitlab-ci.yml        | 16 +---------------
 5 files changed, 35 insertions(+), 83 deletions(-)
 create mode 100755 .ci/macos/build.sh
 delete mode 100755 .ci/macos/deploy.sh

diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh
new file mode 100755
index 000000000..6a883678d
--- /dev/null
+++ b/.ci/macos/build.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env sh
+
+set -u
+
+# unused
+#TAG=$(git tag -l --points-at HEAD)
+
+# Add Qt binaries to path
+PATH="$(brew --prefix qt5):${PATH}"
+export PATH
+
+CMAKE_PREFIX_PATH="$(brew --prefix qt5)"
+export CMAKE_PREFIX_PATH
+
+cmake -GNinja -S. -Bbuild \
+      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+      -DCMAKE_INSTALL_PREFIX=.deps/usr \
+      -DHUNTER_ROOT="../.hunter" \
+      -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \
+      -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \
+      -DUSE_BUNDLED_OPENSSL=ON \
+      -DUSE_BUNDLED_BOOST=ON \
+      -DCI_BUILD=ON \
+      -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
+cmake --build build
+( cd build || exit 
+  git clone https://github.com/Nheko-Reborn/qt-jdenticon.git
+  cd qt-jdenticon && qmake && make -j 4
+  cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS
+)
+
+macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/
\ No newline at end of file
diff --git a/.ci/macos/deploy.sh b/.ci/macos/deploy.sh
deleted file mode 100755
index 56a1f23a9..000000000
--- a/.ci/macos/deploy.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env sh
-
-set -eux
-
-# unused
-#TAG=$(git tag -l --points-at HEAD)
-
-# Add Qt binaries to path
-PATH=/usr/local/opt/qt@5/bin/:${PATH}
-
-( cd build
-  # macdeployqt does not copy symlinks over.
-  # this specifically addresses icu4c issues but nothing else.
-  ICU_LIB="$(brew --prefix icu4c)/lib"
-  export ICU_LIB
-  mkdir -p nheko.app/Contents/Frameworks
-  find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
-
-  macdeployqt nheko.app -dmg -always-overwrite -qmldir=../resources/qml/
-
-  user=$(id -nu)
-  chown "${user}" nheko.dmg
-  mv nheko.dmg ..
-)
-
-dmgbuild -s ./.ci/macos/settings.json "Nheko" nheko.dmg
-
-VERSION=${CI_COMMIT_SHORT_SHA}
-
-if [ -n "$VERSION" ]; then
-    mv nheko.dmg "nheko-${VERSION}.dmg"
-    mkdir artifacts
-    cp "nheko-${VERSION}.dmg" artifacts/
-fi
diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index 81158ed2f..a66777b8a 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -7,6 +7,7 @@ set -u
 
 # Add Qt binaries to path
 PATH="/usr/local/opt/qt@5/bin/:${PATH}"
+export PATH
 
 security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
 
@@ -31,22 +32,6 @@ if [ ! -d "build/nheko.app" ]; then
   exit 1
 fi
 
-( cd build || exit
-  # macdeployqt does not copy symlinks over.
-  # this specifically addresses icu4c issues but nothing else.
-  # We might not even need this any longer...
-  # ICU_LIB="$(brew --prefix icu4c)/lib"
-  # export ICU_LIB
-  # mkdir -p nheko.app/Contents/Frameworks
-  # find "${ICU_LIB}" -type l -name "*.dylib" -exec cp -a -n {} nheko.app/Contents/Frameworks/ \; || true
-
-  #macdeployqt nheko.app -dmg -always-overwrite -qmldir=../resources/qml/ -sign-for-notarization="${APPLE_DEV_IDENTITY}"
-  macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/
-
-  # user=$(id -nu)
-  # chown "${user}" nheko.dmg
-)
-
 echo "[INFO] Signing app contents"
 find "build/nheko.app/Contents"|while read -r fname; do
     if [ -f "$fname" ]; then
diff --git a/.cirrus.yml b/.cirrus.yml
index b92fc36e6..03f7b1a6b 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -9,24 +9,7 @@ task:
     - brew bundle --file .ci/macos/Brewfile
   build_script:
     - export PATH="$(brew --prefix qt5)/bin/:${PATH}"
-    - export CMAKE_PREFIX_PATH="$(brew --prefix qt5)"
-    - echo "$(brew --prefix qt5)"
-    - cmake -GNinja -S. -Bbuild
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo
-        -DCMAKE_INSTALL_PREFIX=.deps/usr
-        -DHUNTER_ROOT="../.hunter"
-        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
-        -DUSE_BUNDLED_OPENSSL=ON
-        -DQT_PATH="$(brew --prefix qt5)",
-        -DQt5_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5",
-        -DQt5MacExtras_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5MacExtras",
-        -DQt5DBus_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5DBus",
-        -DQt5QuickCompiler_DIR:PATH="$(brew --prefix qt5)/lib/cmake/Qt5QuickCompiler",
-        -DCI_BUILD=ON
-        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
-    - cmake --build build
-    - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
+    - ./.ci/macos/build.sh
   zip_script:
     - zip -r build/nheko.zip build/nheko.app
   gitlab_script:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6705d03d8..732e7cac0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -118,20 +118,7 @@ build-macos:
   before_script:
     - rm -rf ../.hunter &&  mv .hunter ../.hunter || true
   script:
-    - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
-    - export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5
-    - cmake -GNinja -H. -Bbuild
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo
-        -DCMAKE_INSTALL_PREFIX=.deps/usr
-        -DHUNTER_ROOT="../.hunter"
-        -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo
-        -DUSE_BUNDLED_OPENSSL=ON
-        -DUSE_BUNDLED_BOOST=ON
-        -DCI_BUILD=ON
-        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
-    - cmake --build build
-    - (cd build && git clone https://github.com/Nheko-Reborn/qt-jdenticon.git && cd qt-jdenticon && qmake && make -j 4 && cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS)
+    - ./.ci/macos/build.sh
   after_script:
     - mv ../.hunter .hunter
   rules:
@@ -154,7 +141,6 @@ codesign-macos:
   variables:
     PLAT: "intel"
   before_script:
-    - 'brew upgrade qt@5'
     - pip3 install dmgbuild
   script:
     - export PATH=/usr/local/opt/qt@5/bin/:${PATH}
-- 
GitLab


From b95c13f3a2c5417e1dbc8da3e3f768873a33c441 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Mon, 24 Oct 2022 19:47:20 -0400
Subject: [PATCH 14/19] run the macdeployqt command from the build dir

---
 .ci/macos/build.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh
index 6a883678d..bfeaef89d 100755
--- a/.ci/macos/build.sh
+++ b/.ci/macos/build.sh
@@ -27,6 +27,5 @@ cmake --build build
   git clone https://github.com/Nheko-Reborn/qt-jdenticon.git
   cd qt-jdenticon && qmake && make -j 4
   cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS
+  macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/
 )
-
-macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/
\ No newline at end of file
-- 
GitLab


From 5244952b835042e401bc2a6d4d367ffc2b7c7b20 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Mon, 24 Oct 2022 20:32:43 -0400
Subject: [PATCH 15/19] Fix path issue again

---
 .ci/macos/build.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh
index bfeaef89d..56fb892bf 100755
--- a/.ci/macos/build.sh
+++ b/.ci/macos/build.sh
@@ -19,13 +19,15 @@ cmake -GNinja -S. -Bbuild \
       -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \
       -DUSE_BUNDLED_OPENSSL=ON \
-      -DUSE_BUNDLED_BOOST=ON \
       -DCI_BUILD=ON \
       -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
 cmake --build build
 ( cd build || exit 
   git clone https://github.com/Nheko-Reborn/qt-jdenticon.git
-  cd qt-jdenticon && qmake && make -j 4
-  cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS
+  ( cd qt-jdenticon || exit 
+    qmake
+    make -j 4
+    cp libqtjdenticon.dylib ../nheko.app/Contents/MacOS
+  )
   macdeployqt nheko.app -always-overwrite -qmldir=../resources/qml/
 )
-- 
GitLab


From 1fa21af38ec154503dfd5e98034586fcdcd5b5d5 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Mon, 24 Oct 2022 21:04:36 -0400
Subject: [PATCH 16/19] Move OSX deployment target to toolchain file for
 hunter; add codesign debug

---
 .ci/macos/build.sh    | 3 +--
 .ci/macos/notarize.sh | 3 +++
 toolchain.cmake       | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh
index 56fb892bf..ef95181c3 100755
--- a/.ci/macos/build.sh
+++ b/.ci/macos/build.sh
@@ -19,8 +19,7 @@ cmake -GNinja -S. -Bbuild \
       -DHUNTER_ENABLED=ON -DBUILD_SHARED_LIBS=OFF \
       -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHUNTER_CONFIGURATION_TYPES=RelWithDebInfo \
       -DUSE_BUNDLED_OPENSSL=ON \
-      -DCI_BUILD=ON \
-      -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
+      -DCI_BUILD=ON
 cmake --build build
 ( cd build || exit 
   git clone https://github.com/Nheko-Reborn/qt-jdenticon.git
diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index a66777b8a..a397c1c32 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -41,6 +41,7 @@ find "build/nheko.app/Contents"|while read -r fname; do
 done
 
 codesign --force --timestamp --options=runtime --sign "${APPLE_DEV_IDENTITY}" "build/nheko.app"
+codesign -vvv --deep --strict "build/nheko.app"
 
 NOTARIZE_SUBMIT_LOG=$(mktemp /tmp/notarize-submit.XXXXXX)
 NOTARIZE_STATUS_LOG=$(mktemp /tmp/notarize-status.XXXXXX)
@@ -52,6 +53,8 @@ trap finish EXIT
 
 dmgbuild -s .ci/macos/settings.json "Nheko" nheko.dmg
 codesign -s "${APPLE_DEV_IDENTITY}" nheko.dmg
+codesign -vvv --deep --strict nheko.dmg
+
 user=$(id -nu)
 chown "${user}" nheko.dmg
 
diff --git a/toolchain.cmake b/toolchain.cmake
index 90f058688..3e80767f6 100644
--- a/toolchain.cmake
+++ b/toolchain.cmake
@@ -1,3 +1,4 @@
 set(CMAKE_CXX_STANDARD 20)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
\ No newline at end of file
-- 
GitLab


From 1903b597eda6a9abed3e2dff193e3df0efa9de2b Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Mon, 24 Oct 2022 21:37:50 -0400
Subject: [PATCH 17/19] Use ditto vs zip to ensure symlink preservation and
 maybe other things I missed

---
 .ci/macos/notarize.sh | 2 --
 .cirrus.yml           | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index a397c1c32..0505dcd20 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -22,8 +22,6 @@ if [ "${CI_PIPELINE_TRIGGERED}" ]; then
   # so move it to the right place for the rest of the process.
   ( cd build || exit
     unzip nheko.zip
-    mv build/nheko.app .
-    rm -rf build
   )
 fi
 
diff --git a/.cirrus.yml b/.cirrus.yml
index 03f7b1a6b..a44c2e587 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -11,7 +11,7 @@ task:
     - export PATH="$(brew --prefix qt5)/bin/:${PATH}"
     - ./.ci/macos/build.sh
   zip_script:
-    - zip -r build/nheko.zip build/nheko.app
+    - ditto -c -k --sequesterRsrc --keepParent build/nheko.app build/nheko.zip
   gitlab_script:
     - curl -X POST
         --fail
-- 
GitLab


From a9424e6bcffd2aa8c6c74ba292a731376b3ff0b0 Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 27 Oct 2022 16:21:20 -0400
Subject: [PATCH 18/19] Some minor cleanup

---
 .ci/macos/notarize.sh | 5 ++---
 .cirrus.yml           | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.ci/macos/notarize.sh b/.ci/macos/notarize.sh
index 0505dcd20..7a67306dd 100755
--- a/.ci/macos/notarize.sh
+++ b/.ci/macos/notarize.sh
@@ -11,7 +11,7 @@ export PATH
 
 security unlock-keychain -p "${RUNNER_USER_PW}" login.keychain
 
-if [ "${CI_PIPELINE_TRIGGERED}" ]; then
+if [ "${CI_PIPELINE_TRIGGERED}" ] && [ "${TRIGGERED_BY}" = "cirrus" ]; then
   echo "cirrus build id: ${TRIGGER_BUILD_ID}"
   cat "${TRIGGER_PAYLOAD}"
   # download the build artifacts from cirrus api
@@ -39,7 +39,6 @@ find "build/nheko.app/Contents"|while read -r fname; do
 done
 
 codesign --force --timestamp --options=runtime --sign "${APPLE_DEV_IDENTITY}" "build/nheko.app"
-codesign -vvv --deep --strict "build/nheko.app"
 
 NOTARIZE_SUBMIT_LOG=$(mktemp /tmp/notarize-submit.XXXXXX)
 NOTARIZE_STATUS_LOG=$(mktemp /tmp/notarize-status.XXXXXX)
@@ -51,7 +50,6 @@ trap finish EXIT
 
 dmgbuild -s .ci/macos/settings.json "Nheko" nheko.dmg
 codesign -s "${APPLE_DEV_IDENTITY}" nheko.dmg
-codesign -vvv --deep --strict nheko.dmg
 
 user=$(id -nu)
 chown "${user}" nheko.dmg
@@ -89,6 +87,7 @@ while sleep 60 && date; do
   fi
   if [ "${sub_status}" = "Invalid" ] || [ "${sub_status}" = "Rejected" ]; then
       echo "Notarization failed"
+      xcrun notarytool log "${requestUUID}" --apple-id "${APPLE_DEV_USER}" --password "${APPLE_DEV_PASS}" --team-id "${APPLE_TEAM_ID}" > "$NOTARIZE_STATUS_LOG" 2>&1
       cat "$NOTARIZE_STATUS_LOG" 1>&2
       exit 1
   fi
diff --git a/.cirrus.yml b/.cirrus.yml
index a44c2e587..2658b4b3f 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -18,6 +18,7 @@ task:
         -F token="${GITLAB_TRIGGER_TOKEN}"
         -F ref="${CIRRUS_BRANCH}"
         -F "variables[TRIGGER_BUILD_ID]=${CIRRUS_BUILD_ID}"
+        -F "variables[TRIGGERED_BY]=cirrus"
         "https://nheko.im/api/v4/projects/2/trigger/pipeline"
   binaries_artifacts:
     path: build/nheko.zip
\ No newline at end of file
-- 
GitLab


From ddb3705c5036eb63666efd99aa8a7b790763375d Mon Sep 17 00:00:00 2001
From: Joseph Donofry <joedonofry@gmail.com>
Date: Thu, 27 Oct 2022 17:03:51 -0400
Subject: [PATCH 19/19] Only run codesign macos from protected triggered
 pipelines

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 732e7cac0..0e172d5cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -153,7 +153,7 @@ codesign-macos:
   rules:
     - if : '$CI_COMMIT_BRANCH == "master"'
     - if : $CI_COMMIT_TAG
-    - if : $CI_PIPELINE_TRIGGERED
+    - if : '$CI_PIPELINE_TRIGGERED && $CI_COMMIT_REF_PROTECTED'
       variables:
         PLAT: "m1"
   artifacts:
-- 
GitLab