Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Added support for Mac OS X and Racket 7.0 #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 67 additions & 44 deletions install-racket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,40 @@ fi

DL_BASE="https://mirror.racket-lang.org/installers"

if [[ "$RACKET_VERSION" = "HEAD" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="http://plt.eecs.northwestern.edu/snapshots/current/installers/min-racket-current-x86_64-linux-precise.sh"
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ "$RACKET_VERSION" = 7.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-macosx.dmg"
else
URL="http://plt.eecs.northwestern.edu/snapshots/current/installers/racket-test-current-x86_64-linux-precise.sh"
echo "ERROR: Unsupported version ${RACKET_VERSION} on Mac OS X"
exit 1
fi
elif [[ "$RACKET_VERSION" = 5.3* ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-textual/racket-textual-${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
else
if [[ "$RACKET_VERSION" = "HEAD" ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="http://plt.eecs.northwestern.edu/snapshots/current/installers/min-racket-current-x86_64-linux-precise.sh"
else
URL="http://plt.eecs.northwestern.edu/snapshots/current/installers/racket-test-current-x86_64-linux-precise.sh"
fi
elif [[ "$RACKET_VERSION" = 5.3* ]]; then
if [[ "$RACKET_MINIMAL" = "1" ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-textual/racket-textual-${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
else
URL="${DL_BASE}/${RACKET_VERSION}/racket/racket-${MIN}${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
fi
elif [[ "$RACKET_VERSION" = "RELEASE" ]]; then
URL="http://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux.sh"
elif [[ "$RACKET_VERSION" = 5.9* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-quantal.sh"
elif [[ "$RACKET_VERSION" = 6.[0-4] ]] || [[ "$RACKET_VERSION" = 6.[0-4].[0-9] ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-precise.sh"
elif [[ "$RACKET_VERSION" = 6.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux.sh"
elif [[ "$RACKET_VERSION" = 7.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux.sh"
else
URL="${DL_BASE}/${RACKET_VERSION}/racket/racket-${MIN}${RACKET_VERSION}-bin-x86_64-linux-debian-squeeze.sh"
echo "ERROR: Unsupported version ${RACKET_VERSION}"
exit 1
fi
elif [[ "$RACKET_VERSION" = "RELEASE" ]]; then
URL="http://pre-release.racket-lang.org/installers/racket-${MIN}current-x86_64-linux.sh"
elif [[ "$RACKET_VERSION" = 5.9* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-quantal.sh"
elif [[ "$RACKET_VERSION" = 6.[0-4] ]] || [[ "$RACKET_VERSION" = 6.[0-4].[0-9] ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux-ubuntu-precise.sh"
elif [[ "$RACKET_VERSION" = 6.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux.sh"
elif [[ "$RACKET_VERSION" = 7.* ]]; then
URL="${DL_BASE}/${RACKET_VERSION}/racket-${MIN}${RACKET_VERSION}-x86_64-linux.sh"
else
echo "ERROR: Unsupported version ${RACKET_VERSION}"
exit 1
fi

if [ -n "$TEST" ]; then
Expand All @@ -56,38 +65,52 @@ if [ -n "$TEST" ]; then
exit 0
fi

# Older .travis.yml files don't set $RACKET_DIR (the Racket install
# directory) explicitly and expect it to be /usr/racket.
if [[ "$RACKET_DIR" = "" ]]; then
RACKET_DIR=/usr/racket
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
INSTALLER="./racket.dmg"

INSTALLER="./racket-${MIN}${RACKET_VERSION}.sh"
echo "Downloading $URL to $INSTALLER:"
curl -L -o $INSTALLER $URL

echo "Downloading $URL to $INSTALLER:"
curl -L -o $INSTALLER $URL
echo "Mounting installer"
MOUNT=$(hdiutil attach "$INSTALLER" | grep Volumes | cut -f 3)
echo "Copying racket to ${RACKET_DIR}"
cp -a "${MOUNT}/Racket v${RACKET_VERSION}" "${RACKET_DIR}"
echo "Racket installed"
else

echo "Making $INSTALLER executable:"
chmod u+rx "$INSTALLER"
# Older .travis.yml files don't set $RACKET_DIR (the Racket install
# directory) explicitly and expect it to be /usr/racket.
if [[ "$RACKET_DIR" = "" ]]; then
RACKET_DIR=/usr/racket
fi

# Only use sudo if installing to /usr
if [[ "$RACKET_DIR" = /usr* ]]; then
RUN_INSTALLER="sudo ${INSTALLER}"
else
RUN_INSTALLER="${INSTALLER}"
fi
INSTALLER="./racket-${MIN}${RACKET_VERSION}.sh"

echo "Downloading $URL to $INSTALLER:"
curl -L -o $INSTALLER $URL

echo "Making $INSTALLER executable:"
chmod u+rx "$INSTALLER"

echo "Running $RUN_INSTALLER to install Racket:"
# Only use sudo if installing to /usr
if [[ "$RACKET_DIR" = /usr* ]]; then
RUN_INSTALLER="sudo ${INSTALLER}"
else
RUN_INSTALLER="${INSTALLER}"
fi

$RUN_INSTALLER <<EOF
no
"$RACKET_DIR"
echo "Running $RUN_INSTALLER to install Racket:"

$RUN_INSTALLER <<EOF
no
"$RACKET_DIR"

EOF

if [[ "$RACKET_MINIMAL" = "1" ]]; then
echo "Minimal Racket: Installing packages for raco test..."
${RACKET_DIR}/bin/raco pkg install --auto --scope installation rackunit-lib compiler-lib
if [[ "$RACKET_MINIMAL" = "1" ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have this nested under the non-Darwin else branch. But, should this be moved out to be done for Darwin, too?

I ask because it looks like you are including the minimal-racket scenario, up above. So, wouldn't you want this for minimal-Racket on Darwin, too? (Apologies if I'm misunderstanding.)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry to be slow to follow up and review this. Partly I've been super busy. But also, I feel like adding the macOS "dimension" means the conditionals and permutations is getting to be a slightly heavy cognitive load.

I don't mean to sound like I'm complaining -- I really appreciate you taking the time to do and submit this PR. Thanks for that!!

echo "Minimal Racket: Installing packages for raco test..."
${RACKET_DIR}/bin/raco pkg install --auto --scope installation rackunit-lib compiler-lib
fi
fi

exit 0