Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rkmax/ca5892c1d44bf3fdbe081784d67d5d5a to your computer and use it in GitHub Desktop.
Save rkmax/ca5892c1d44bf3fdbe081784d67d5d5a to your computer and use it in GitHub Desktop.
#!/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
@allangarcia
Copy link

Thanks. A little history. I do make this Gist very similar to yours (arch agnostic, for arm64 and x64) and tried to contact David Campelo to ask for authorization to make an "installation" app (electron os something) for the master branch or release (could be chosen) that end up generating the App. And I got a couple of treats if I accomplish this. So my actual gist to compile Aseprite on my M1 is "secret" and not visible.

Another hint. They use GitHub-actions to create their release.zip, if you study a little bit what they do using build containers and GitHub-actions you could do your own fork repository (private) that generate in the GitHub servers (much faster) the final Aseprite.app ;-)

Mine compilation actually is done this way. When I merge the official repo into my forked one, they automatically trigger the compilation process and I got a final .app App.

DISCLAIMER: I'm not a pixel designer, neither a professional game developer, I just a student of those topics and a professor with a couple students (with no money) to buy the product. But if you make money with Aseprite in any way I strongly suggest to buy the license from the OFICIAL website.

@rkmax
Copy link
Author

rkmax commented Nov 28, 2022

i think you dont need to do an electron installer, for macos if I understand correctly (I'm newbie with mac) you can create a folder with a custom background that basically has the Aseprite.app an a link to he applications folder so user can drag n drop (maybe you are think in other stuff)

I bought aseprite sadly I did it via steam (i use it from time to time in linux) and now on the mac I couldn't use it. that's why I make this scripts more intended for my personal use. but I decide to share it as others

Copy link

ghost commented Jan 19, 2024

mkdir: /Users/rkmax: Permission denied

@willvincent
Copy link

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