Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
3-manifolds
GitHub Repository: 3-manifolds/Sage_macOS
Path: blob/main/bin/build_dist
170 views
#!/bin/bash
# Construct the SageMath distribution form the current state
# of the repo.
set -e
SAGE_VERSION=`bin/get_sage_version`
SAGE_DASH_VERSION=$(echo $SAGE_VERSION | sed s/\\\./\\\-/g)
SAGE_SCORE_VERSION=$(echo $SAGE_VERSION | sed s/\\\./\\\_/g)
DIST=SageMath-$SAGE_VERSION
APP=$DIST/SageMath-$SAGE_DASH_VERSION.app
PKG=Recommended_$SAGE_SCORE_VERSION.pkg
PYTHON3=../Frameworks/Sage.framework/Versions/Current/venv/bin/python3
mkdir $DIST
# Render templates and install the package
cd package
. build_package.sh
cd ..
mv package/$PKG $DIST
# Build the app bundle directory structure
mkdir -p $APP/Contents/{MacOS,Frameworks,Resources}
# Install the main executable and the Python link
cd main_ex
make
cd ..
# Populate MacOS
mv main_ex/SageMath $APP/Contents/MacOS
ln -s $PYTHON3 $APP/Contents/MacOS/Python
# Populate Resources
cp jinja/output/Info.plist $APP/Contents
cp icon/{Sage.icns,sage_icon_1024.png} $APP/Contents/Resources
cp logos/{sage_logo_512.png,sage_logo_256.png} $APP/Contents/Resources
cp main.py $APP/Contents/Resources
# Build Tcl and Tk frameworks
cd TclTk_frameworks
make
cd ..
# Build Sage framework
cd Sage_framework
bash build_sage_framework.sh
cd ..
# Add the frameworks
mv TclTk_frameworks/Frameworks/{Tcl,Tk}.framework $APP/Contents/Frameworks
mv Sage_framework/build/Sage.framework $APP/Contents/Frameworks
# Add the documentation
cp -R Sage_framework/repo/documentation $APP/Contents/Resources
# Sign the app
bin/sign_app