From d81e3494c68969a4a9809a9a4d0e51598aceb820 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@uliege.be>
Date: Fri, 9 Sep 2022 16:32:35 +0200
Subject: [PATCH] arm

---
 bundle_onelab.sh | 66 +++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 57 insertions(+), 9 deletions(-)

diff --git a/bundle_onelab.sh b/bundle_onelab.sh
index e6cf3fd..176aba6 100755
--- a/bundle_onelab.sh
+++ b/bundle_onelab.sh
@@ -19,6 +19,8 @@ contains a selection of other ready-to-use models from https://onelab.info. The
 See https://onelab.info for additional examples, up-to-date versions and
 documentation." > /tmp/README.txt
 
+KEYCHAIN="FIXME"
+
 GMSH=git
 GETDP=git
 CONVEKS=git
@@ -101,7 +103,7 @@ if [ $# -lt 1 ] || [ $1 == "source" ]; then
   scp onelab-source.zip geuzaine@onelab.info:/onelab_files/
 fi
 
-if [ $# -lt 1 ] || [ $1 == "win64" ]; then
+if [ $# -lt 1 ] || [ $1 == "windows" ]; then
   rm -rf onelab-Windows64*
   mkdir onelab-Windows64
   curl -O https://gmsh.info/bin/Windows/gmsh-${GMSH}-Windows64.zip
@@ -141,7 +143,7 @@ if [ $# -lt 1 ] || [ $1 == "win64" ]; then
   scp onelab-Windows64.zip geuzaine@onelab.info:/onelab_files/
 fi
 
-if [ $# -lt 1 ] || [ $1 == "linux64" ]; then
+if [ $# -lt 1 ] || [ $1 == "linux" ]; then
   rm -rf onelab-Linux64*
   mkdir onelab-Linux64
   curl -O https://gmsh.info/bin/Linux/gmsh-${GMSH}-Linux64.tgz
@@ -180,17 +182,17 @@ if [ $# -lt 1 ] || [ $1 == "linux64" ]; then
   scp onelab-Linux64.zip geuzaine@onelab.info:/onelab_files/
 fi
 
-if [ $# -lt 1 ] || [ $1 == "mac" ]; then
+if [ $# -lt 1 ] || [ $1 == "macosx" ]; then
   rm -rf onelab-MacOSX*
   mkdir onelab-MacOSX
-  curl -O https://gmsh.info/bin/MacOSX/gmsh-${GMSH}-MacOSX.dmg
-  curl -O https://getdp.info/bin/MacOSX/getdp-${GETDP}-MacOSXc.tgz
-  ##curl -O https://getdp.info/bin/MacOSX/getdp-${GETDP}-MacOSXr.tgz
+  curl -O https://gmsh.info/bin/macOS/gmsh-${GMSH}-MacOSX.dmg
+  curl -O https://getdp.info/bin/macOS/getdp-${GETDP}-MacOSXc.tgz
+  ##curl -O https://getdp.info/bin/macOS/getdp-${GETDP}-MacOSXr.tgz
   curl -O https://onelab.info/conveks/bin/conveks-${CONVEKS}-MacOSX.zip
   curl -O https://gitlab.onelab.info/gmsh/gmsh/-/raw/master/utils/misc/notarize.py
   mv gmsh-${GMSH}-MacOSX.dmg /tmp
-  ##mv getdp-${GETDP}-MacOSXc.tgz /tmp
-  mv getdp-${GETDP}-MacOSXr.tgz /tmp
+  mv getdp-${GETDP}-MacOSXc.tgz /tmp
+  ##mv getdp-${GETDP}-MacOSXr.tgz /tmp
   mv conveks-${CONVEKS}-MacOSX.zip /tmp
   mv notarize.py /tmp
   hdiutil convert /tmp/gmsh-${GMSH}-MacOSX.dmg -format UDTO -o /tmp/gmsh-tmp.cdr
@@ -203,7 +205,7 @@ if [ $# -lt 1 ] || [ $1 == "mac" ]; then
   mv /tmp/getdp-*${GETDP}-MacOSX/bin/getdp onelab-MacOSX/Gmsh.app/Contents/MacOS/
   mv /tmp/conveks-*${CONVEKS}-MacOSX/lib/conveks.py onelab-MacOSX/Gmsh.app/Contents/MacOS/
   cp /tmp/conveks-*${CONVEKS}-MacOSX/lib/libconveks*.dylib onelab-MacOSX/Gmsh.app/Contents/MacOS/
-  security unlock-keychain -p "FIXME" ${HOME}/Library/Keychains/login.keychain
+  security unlock-keychain -p ${KEYCHAIN} ${HOME}/Library/Keychains/login.keychain
   codesign -v --force --deep --options runtime --sign "Developer ID Application: Christophe Geuzaine" onelab-MacOSX/Gmsh.app
   cp gmsh_mount/LICENSE.txt onelab-MacOSX/LICENSE.txt
   echo "\n\n" >> onelab-MacOSX/LICENSE.txt
@@ -225,3 +227,49 @@ if [ $# -lt 1 ] || [ $1 == "mac" ]; then
   rm -rf onelab-MacOSX
   scp onelab-MacOSX.dmg geuzaine@onelab.info:/onelab_files/
 fi
+
+if [ $# -lt 1 ] || [ $1 == "macosarm" ]; then
+  rm -rf onelab-MacOSARM*
+  mkdir onelab-MacOSARM
+  curl -O https://gmsh.info/bin/macOS/gmsh-${GMSH}-MacOSARM.dmg
+  curl -O https://getdp.info/bin/macOS/getdp-${GETDP}-MacOSARMc.tgz
+  ##curl -O https://getdp.info/bin/macOS/getdp-${GETDP}-MacOSARMr.tgz
+  curl -O https://onelab.info/conveks/bin/conveks-${CONVEKS}-MacOSARM.zip
+  curl -O https://gitlab.onelab.info/gmsh/gmsh/-/raw/master/utils/misc/notarize.py
+  mv gmsh-${GMSH}-MacOSARM.dmg /tmp
+  mv getdp-${GETDP}-MacOSARMc.tgz /tmp
+  ##mv getdp-${GETDP}-MacOSARMr.tgz /tmp
+  mv conveks-${CONVEKS}-MacOSARM.zip /tmp
+  mv notarize.py /tmp
+  hdiutil convert /tmp/gmsh-${GMSH}-MacOSARM.dmg -format UDTO -o /tmp/gmsh-tmp.cdr
+  hdiutil attach -nobrowse -noverify -noautoopen -mountpoint gmsh_mount /tmp/gmsh-tmp.cdr
+  tar zxvf /tmp/getdp-${GETDP}-MacOSARMc.tgz -C /tmp
+  ##tar zxvf /tmp/getdp-${GETDP}-MacOSARMr.tgz -C /tmp
+  unzip -q -o /tmp/conveks-${CONVEKS}-MacOSARM.zip -d /tmp
+  cp /tmp/README.txt onelab-MacOSARM
+  cp -R gmsh_mount/Gmsh.app onelab-MacOSARM/
+  mv /tmp/getdp-*${GETDP}-MacOSARM/bin/getdp onelab-MacOSARM/Gmsh.app/Contents/MacOS/
+  mv /tmp/conveks-*${CONVEKS}-MacOSARM/lib/conveks.py onelab-MacOSARM/Gmsh.app/Contents/MacOS/
+  cp /tmp/conveks-*${CONVEKS}-MacOSARM/lib/libconveks*.dylib onelab-MacOSARM/Gmsh.app/Contents/MacOS/
+  security unlock-keychain -p ${KEYCHAIN} ${HOME}/Library/Keychains/login.keychain
+  codesign -v --force --deep --options runtime --sign "Developer ID Application: Christophe Geuzaine" onelab-MacOSARM/Gmsh.app
+  cp gmsh_mount/LICENSE.txt onelab-MacOSARM/LICENSE.txt
+  echo "\n\n" >> onelab-MacOSARM/LICENSE.txt
+  cat /tmp/getdp-*${GETDP}-MacOSARM/share/doc/getdp/LICENSE.txt >> onelab-MacOSARM/LICENSE.txt
+  cp gmsh_mount/CREDITS.txt onelab-MacOSARM/CREDITS.txt
+  echo "\n\n" >> onelab-MacOSARM/CREDITS.txt
+  cat /tmp/getdp-*${GETDP}-MacOSARM/share/doc/getdp/CREDITS.txt >> onelab-MacOSARM/CREDITS.txt
+  cp -R /tmp/models onelab-MacOSARM/
+  cp -R /tmp/tutorials onelab-MacOSARM/
+  cp -R gmsh_mount/tutorials/* onelab-MacOSARM/tutorials/gmsh/
+  cp -R /tmp/getdp-*${GETDP}-MacOSARM/share/doc/getdp/templates onelab-MacOSARM/
+  hdiutil eject gmsh_mount
+  rm -rf /tmp/gmsh-*
+  rm -rf /tmp/getdp-*
+  rm -rf /tmp/conveks-*
+  # cannot use zip file: it destroys the signature for onelab.py
+  hdiutil create -srcfolder onelab-MacOSARM onelab-MacOSARM.dmg
+  python3 /tmp/notarize.py --package onelab-MacOSARM.dmg --username cgeuzaine@ulg.ac.be --primary-bundle-id org.geuz.Gmsh --password "@keychain:Gmsh Notarization"
+  rm -rf onelab-MacOSARM
+  scp onelab-MacOSARM.dmg geuzaine@onelab.info:/onelab_files/
+fi
-- 
GitLab