Buid OSX Installer
This commit is contained in:
parent
07d9737f5c
commit
32de6908be
14
.github/workflows/macOS_build.yml
vendored
14
.github/workflows/macOS_build.yml
vendored
|
@ -59,8 +59,12 @@ jobs:
|
|||
run: bash ./ci-scripts/osx/tahoma-buildpkg.sh
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: Tahoma2D-osx.dmg
|
||||
path: toonz/build/Tahoma2D-osx.dmg
|
||||
name: Tahoma2D-portable-osx.dmg
|
||||
path: toonz/build/Tahoma2D-portable-osx.dmg
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: Tahoma2D-install-osx.pkg
|
||||
path: toonz/build/Tahoma2D-install-osx.pkg
|
||||
- name: Get Nightly Release Date
|
||||
if: ${{ github.repository_owner == 'tahoma2d' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||
run: |
|
||||
|
@ -84,7 +88,7 @@ jobs:
|
|||
with:
|
||||
allowUpdates: true
|
||||
artifactErrorsFailBuild: false
|
||||
artifacts: toonz/build/Tahoma2D-osx.dmg
|
||||
artifacts: toonz/build/Tahoma2D-portable-osx.dmg,toonz/build/Tahoma2D-install-osx.pkg
|
||||
artifactContentType: "raw"
|
||||
body: ${{ github.event.head_commit.message }}
|
||||
name: Latest Nightly ${{ env.NIGHTLYDATE }}
|
||||
|
@ -98,13 +102,13 @@ jobs:
|
|||
with:
|
||||
allowUpdates: true
|
||||
artifactErrorsFailBuild: false
|
||||
artifacts: toonz/build/Tahoma2D-osx.dmg
|
||||
artifacts: toonz/build/Tahoma2D-portable-osx.dmg,toonz/build/Tahoma2D-install-osx.pkg
|
||||
artifactContentType: "raw"
|
||||
body: ${{ github.event.head_commit.message }}
|
||||
name: ${{ env.NIGHTLYDATETIME }}
|
||||
omitBodyDuringUpdate: true
|
||||
omitNameDuringUpdate: true
|
||||
owner: tahoma2d
|
||||
owner: tahoma2d
|
||||
prerelease: true
|
||||
replacesArtifacts: true
|
||||
repo: tahoma2d_nightlies
|
||||
|
|
19
ci-scripts/osx/tahoma-buildpkg.sh
Executable file → Normal file
19
ci-scripts/osx/tahoma-buildpkg.sh
Executable file → Normal file
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
export TAHOMA2DVERSION=1.3
|
||||
|
||||
if [ -d /usr/local/Cellar/qt@5 ]
|
||||
then
|
||||
export QTDIR=/usr/local/opt/qt@5
|
||||
|
@ -13,14 +15,11 @@ then
|
|||
export TOONZDIR=$TOONZDIR/Release
|
||||
fi
|
||||
|
||||
echo ">>> Copying stuff to Tahoma2D.app/tahomastuff"
|
||||
if [ -d $TOONZDIR/Tahoma2D.app/tahomastuff ]
|
||||
then
|
||||
# In case of prior builds, replace stuff folder
|
||||
rm -rf $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
fi
|
||||
cp -R stuff $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
chmod -R 777 $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
|
||||
find $TOONZDIR/Tahoma2D.app/tahomastuff -name .gitkeep -exec rm -f {} \;
|
||||
|
||||
|
@ -178,9 +177,17 @@ done
|
|||
echo ">>> Moving DYSM to Tahoma2D.app"
|
||||
mv $TOONZDIR/DSYM $TOONZDIR/Tahoma2D.app
|
||||
|
||||
echo ">>> Creating Tahoma2D-osx.dmg"
|
||||
echo ">>> Creating Tahoma2D-install-osx.pkg"
|
||||
|
||||
toonz/installer/osx/app.rb $TOONZDIR stuff toonz/installer/osx/scripts $TAHOMA2DVERSION
|
||||
|
||||
mv $TOONZDIR/Tahoma2D-install-osx.pkg $TOONZDIR/..
|
||||
|
||||
echo ">>> Creating Tahoma2D-portable-osx.dmg"
|
||||
|
||||
cp -R stuff $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
chmod -R 777 $TOONZDIR/Tahoma2D.app/tahomastuff
|
||||
|
||||
$QTDIR/bin/macdeployqt $TOONZDIR/Tahoma2D.app -dmg -verbose=0
|
||||
|
||||
mv $TOONZDIR/Tahoma2D.dmg $TOONZDIR/../Tahoma2D-osx.dmg
|
||||
|
||||
mv $TOONZDIR/Tahoma2D.dmg $TOONZDIR/../Tahoma2D-portable-osx.dmg
|
||||
|
|
79
toonz/installer/osx/app.rb
Normal file
79
toonz/installer/osx/app.rb
Normal file
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env ruby
|
||||
# -*- coding: utf-8 -*-
|
||||
require 'FileUtils'
|
||||
if ARGV.size != 4 then
|
||||
puts "usage: ./app.rb [BUILD_DIR] [SRC_STUFF_DIR] [SRC_SCRIPTS_DIR] [VERSION(float)]"
|
||||
exit 1
|
||||
end
|
||||
|
||||
def exec_with_assert(cmd)
|
||||
result = `#{cmd}`
|
||||
if $? != 0 then
|
||||
puts "Execution '#{cmd}' failed."
|
||||
exit 1
|
||||
end
|
||||
puts "Execution '#{cmd}' succeed."
|
||||
end
|
||||
|
||||
# Constant group
|
||||
BUILD_DIR = ARGV[0]
|
||||
SRC_STUFF_DIR = ARGV[1]
|
||||
SRC_SCRIPTS_DIR = ARGV[2]
|
||||
VERSION = ARGV[3]
|
||||
VIRTUAL_ROOT = "#{BUILD_DIR}/VirtualRoot"
|
||||
APP_BUNDLE = "#{BUILD_DIR}/Tahoma2D.app"
|
||||
APP = "Applications"
|
||||
|
||||
PKG_ID = "io.github.tahoma2d"
|
||||
PKG_TMP = "Tahoma2DBuild.pkg"
|
||||
FINAL_PKG = "#{BUILD_DIR}/Tahoma2D-install-osx.pkg"
|
||||
|
||||
# Installation in VirtualRoot
|
||||
# Delete existing and install
|
||||
if File.exist? VIRTUAL_ROOT then
|
||||
exec_with_assert "rm -rf #{VIRTUAL_ROOT}"
|
||||
end
|
||||
exec_with_assert "mkdir -p #{VIRTUAL_ROOT}/#{APP}"
|
||||
exec_with_assert "cp -r #{APP_BUNDLE} #{VIRTUAL_ROOT}/#{APP}"
|
||||
|
||||
# Generate the plist if it doesn't exist and apply the required changes
|
||||
PKG_PLIST = "#{BUILD_DIR}/app.plist"
|
||||
unless File.exist? PKG_PLIST then
|
||||
exec_with_assert "pkgbuild --root #{VIRTUAL_ROOT} --analyze #{PKG_PLIST}"
|
||||
exec_with_assert "gsed -i -e \"14i <key>BundlePostInstallScriptPath</key>\" #{PKG_PLIST}"
|
||||
exec_with_assert "gsed -i -e \"15i <string>pkg-script.sh</string>\" #{PKG_PLIST}"
|
||||
end
|
||||
|
||||
# Preparing stuff
|
||||
if File.exist? "#{BUILD_DIR}/scripts" then
|
||||
exec_with_assert "rm -rf #{BUILD_DIR}/scripts"
|
||||
end
|
||||
exec_with_assert "cp -r #{SRC_SCRIPTS_DIR} #{BUILD_DIR}/."
|
||||
|
||||
# Delete the existing one, tar it and put it in scripts
|
||||
if File.exist? "#{BUILD_DIR}/scripts/stuff.tar.bz2" then
|
||||
exec_with_assert "rm #{BUILD_DIR}/scripts/*.tar.bz2"
|
||||
end
|
||||
exec_with_assert "cp -r #{SRC_STUFF_DIR} #{BUILD_DIR}/stuff"
|
||||
exec_with_assert "tar cjvf #{BUILD_DIR}/scripts/stuff.tar.bz2 -C #{BUILD_DIR} stuff"
|
||||
|
||||
# Generating a pkg using a plist
|
||||
exec_with_assert "pkgbuild --root #{VIRTUAL_ROOT} --component-plist #{PKG_PLIST} --scripts #{BUILD_DIR}/scripts --identifier #{PKG_ID} --version #{VERSION} #{PKG_TMP}"
|
||||
|
||||
# Generate if distribution.xml does not exist
|
||||
DIST_XML = "#{BUILD_DIR}/distribution.xml"
|
||||
unless File.exists? DIST_XML then
|
||||
exec_with_assert "productbuild --synthesize --package #{PKG_TMP} #{DIST_XML}"
|
||||
exec_with_assert "gsed -i -e \"3i <title>Tahoma2D</title>\" #{DIST_XML}"
|
||||
end
|
||||
|
||||
# Generate final pkg
|
||||
exec_with_assert "productbuild --distribution #{DIST_XML} --package-path #{PKG_TMP} --resources . #{FINAL_PKG}"
|
||||
|
||||
# Remove temporary product
|
||||
`rm #{PKG_TMP}`
|
||||
`rm -rf #{BUILD_DIR}/stuff`
|
||||
`rm -rf #{BUILD_DIR}/scripts`
|
||||
`rm -rf #{VIRTUAL_ROOT}`
|
||||
`rm #{DIST_XML}`
|
||||
`rm #{PKG_PLIST}`
|
9
toonz/installer/osx/scripts/pkg-script.sh
Normal file
9
toonz/installer/osx/scripts/pkg-script.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
STUFF_DIR="Tahoma2D_stuff"
|
||||
tar xzvf stuff.tar.bz2
|
||||
mv stuff $STUFF_DIR
|
||||
mkdir /Applications/Tahoma2D
|
||||
cp -nr $STUFF_DIR /Applications/Tahoma2D
|
||||
chmod -R 777 /Applications/Tahoma2D
|
||||
rm -rf $STUFF_DIR
|
||||
|
Loading…
Reference in a new issue