if ! [ -e sage ]; then1echo "The sage directory is not where we expect to find it."2echo "This script must be run from the Sage_base directory."3exit 14fi56# CI can't check the version without a Sage repo.7VERSION=10.78SAGE_SYMLINK="/var/tmp/sage-$VERSION-current"910# By default, a sage build cannot be relocated. Sage_macOS is11# relocatable. This is done by using a symlink in /var/tmp which12# points to the current location of the sage root.13#14# To make this work, we relocate the sage source tree to the location15# where the sage symlink will be when sage is actually being run. This16# tricks the sage build system into generating appropriate shebangs17# for installed scripts and deals with any other random places where18# sage may use a hardwired path to the sage root.19#2021if [ -L ${SAGE_SYMLINK} ]; then22rm ${SAGE_SYMLINK}23elif [ -e ${SAGE_SYMLINK} ]; then24echo ${SAGE_SYMLINK} is not a symlink !!!25exit 126fi2728mv sage ${SAGE_SYMLINK}29pushd ${SAGE_SYMLINK}30gmake31popd32mv /var/tmp/sage-$VERSION-current sage333435