Forked from allangarcia/aseprite-build-and-install-on-macos.sh
Last active
September 13, 2024 18:39
-
-
Save rkmax/ca5892c1d44bf3fdbe081784d67d5d5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
target_osx=$(sw_vers -productVersion) | |
project_dir=/Users/rkmax/development/aseprite | |
skia_dir=/Users/rkmax/development/skia | |
arch="$(uname -m)" | |
bundle_trial_url=https://www.aseprite.org/downloads/trial/Aseprite-v1.2.40-trial-macOS.dmg | |
install_update_deps() { | |
macos_deps | |
dep_skia | |
dep_aseprite | |
} | |
macos_deps() { | |
brew update | |
brew install cmake ninja | |
} | |
dep_skia() { | |
rm -rf $skia_dir | |
mkdir -p $skia_dir | |
cd $skia_dir | |
latest_url=$(curl -s https://api.github.com/repos/aseprite/skia/releases/latest | grep "browser_download_url.*-macOS.*${arch}.zip" | cut -d : -f 2,3 | tr -d \") | |
name=$(basename "${latest_url}") | |
if [ ! -f "${name}" ]; then | |
echo "Downloading ${name}" | |
# the value already include '"' | |
# shellcheck disable=SC1073 | |
wget ${latest_url} | |
fi | |
unzip "${name}" | |
} | |
dep_aseprite() { | |
if [ ! -d $project_dir ]; then | |
git clone --recursive https://github.com/aseprite/aseprite.git $project_dir | |
fi | |
cd $project_dir | |
git pull | |
} | |
build_bin() { | |
cd $project_dir | |
mkdir -p build | |
cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
-DCMAKE_OSX_ARCHITECTURES="${arch}" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="${target_osx}" \ | |
-DCMAKE_MACOSX_RPATH=ON \ | |
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \ | |
-DLAF_BACKEND=skia \ | |
-DSKIA_DIR="${skia_dir}" \ | |
-DSKIA_LIBRARY_DIR="${skia_dir}/out/Release-${arch}" \ | |
-DSKIA_LIBRARY="${skia_dir}/out/Release-${arch}/libskia.a" \ | |
-DPNG_ARM_NEON:STRING=on \ | |
-G Ninja .. | |
ninja aseprite | |
} | |
package_app() { | |
mkdir -p "${project_dir}/bundle" | |
cd "${project_dir}/bundle" | |
name=$(basename "${bundle_trial_url}") | |
if [ ! -f "${name}" ]; then | |
echo "Downloading bundle assets" | |
wget "${bundle_trial_url}" | |
fi | |
mkdir -p mount | |
yes qy | hdiutil attach -quiet -nobrowse -noverify -noautoopen -mountpoint mount "${name}" | |
cp -r mount/Aseprite.app . | |
hdiutil detach -quiet mount | |
rm -rf Aseprite.app/Contents/MacOS/aseprite | |
rm -rf Aseprite.app/Contents/Resources/data | |
cp -r "${project_dir}/build/bin/aseprite" Aseprite.app/Contents/MacOS/aseprite | |
cp -r "${project_dir}/build/bin/data" Aseprite.app/Contents/Resources/data | |
} | |
install_app() { | |
sudo cp -r "${project_dir}/bundle/Aseprite.app" /Applications/ | |
} | |
install_update_deps | |
build_bin | |
package_app | |
install_app |
mkdir: /Users/rkmax: Permission denied
Ideally those lines should be updated from
project_dir=/Users/rkmax/development/aseprite
skia_dir=/Users/rkmax/development/skia
to
project_dir=/Users/$(whoami)/development/aseprite
skia_dir=/Users/$(whoami)/development/skia
But at a minimum just replace rkmax
on lines 6 & 7 with your own username
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mkdir: /Users/rkmax: Permission denied