create_release.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # The new package will be saved here
  3. PACK_DIR=$PWD/doublecmd-release
  4. # Temp dir for creating *.dmg package
  5. BUILD_PACK_DIR=/var/tmp/doublecmd-$(date +%y.%m.%d)
  6. # Save revision number
  7. DC_REVISION=$(install/linux/update-revision.sh ./ ./)
  8. # Read version number
  9. DC_MAJOR=$(grep 'MajorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+')
  10. DC_MINOR=$(grep 'MinorVersionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
  11. DC_MICRO=$(grep 'RevisionNr' src/doublecmd.lpi | grep -o '[0-9.]\+' || echo 0)
  12. DC_VER=$DC_MAJOR.$DC_MINOR.$DC_MICRO
  13. # Set widgetset
  14. export lcl=cocoa
  15. mkdir -p $PACK_DIR
  16. # Update application bundle version
  17. defaults write $(pwd)/doublecmd.app/Contents/Info CFBundleVersion $DC_REVISION
  18. defaults write $(pwd)/doublecmd.app/Contents/Info CFBundleShortVersionString $DC_VER
  19. plutil -convert xml1 $(pwd)/doublecmd.app/Contents/Info.plist
  20. chmod 644 $(pwd)/doublecmd.app/Contents/Info.plist
  21. build_unrar()
  22. {
  23. DEST_DIR=$(pwd)/install/darwin/lib/$CPU_TARGET
  24. pushd /tmp/unrar
  25. make clean lib CXXFLAGS+="-std=c++14 -DSILENT --target=$TARGET" LDFLAGS+="-dylib --target=$TARGET"
  26. mkdir -p $DEST_DIR && mv libunrar.so $DEST_DIR/libunrar.dylib
  27. popd
  28. }
  29. build_doublecmd()
  30. {
  31. # Build all components of Double Commander
  32. ./build.sh release
  33. # Copy libraries
  34. cp -a install/darwin/lib/$CPU_TARGET/*.dylib ./
  35. # Prepare *.dmg package
  36. mkdir -p $BUILD_PACK_DIR
  37. install/darwin/install.sh $BUILD_PACK_DIR
  38. pushd $BUILD_PACK_DIR
  39. mv doublecmd.app 'Double Commander.app'
  40. codesign --deep --force --verify --verbose --sign '-' 'Double Commander.app'
  41. popd
  42. # Create *.dmg package
  43. HDI_TRY=1
  44. while [ $HDI_TRY -le 5 ]; do
  45. echo "Try to create a package $HDI_TRY ..."
  46. # Bug: https://github.com/actions/runner-images/issues/7522
  47. echo Killing XProtect...; sudo pkill -9 XProtect >/dev/null || true;
  48. echo Waiting for XProtect process...; while pgrep XProtect; do sleep 3; done;
  49. install/darwin/create-dmg/create-dmg \
  50. --volname "Double Commander" \
  51. --volicon "$BUILD_PACK_DIR/.VolumeIcon.icns" \
  52. --background "$BUILD_PACK_DIR/.background/bg.jpg" \
  53. --window-pos 200 200 \
  54. --window-size 680 366 \
  55. --text-size 16 \
  56. --icon-size 128 \
  57. --icon "Double Commander.app" 110 120 \
  58. --app-drop-link 360 120 \
  59. --icon "install.txt" 566 123 \
  60. --icon ".background" 100 500 \
  61. "$PACK_DIR/doublecmd-$DC_VER.$lcl.$CPU_TARGET.dmg" \
  62. "$BUILD_PACK_DIR/"
  63. if [ $? -eq 0 ]; then
  64. break
  65. fi
  66. HDI_TRY=$((HDI_TRY+1))
  67. sleep 10
  68. done
  69. # Clean DC build dir
  70. ./clean.sh
  71. rm -f *.dylib
  72. rm -rf $BUILD_PACK_DIR
  73. }
  74. # Set processor architecture
  75. export CPU_TARGET=aarch64
  76. export TARGET=arm64-apple-darwin
  77. # Set minimal Mac OS X target version
  78. export MACOSX_DEPLOYMENT_TARGET=11.0
  79. build_unrar
  80. build_doublecmd
  81. # Set processor architecture
  82. export CPU_TARGET=x86_64
  83. export TARGET=x86_64-apple-darwin
  84. # Set minimal Mac OS X target version
  85. export MACOSX_DEPLOYMENT_TARGET=11.0
  86. build_unrar
  87. build_doublecmd