Skip to content

Instantly share code, notes, and snippets.

@tmspzz
Last active April 28, 2019 07:00
Show Gist options
  • Save tmspzz/7c4c6e7224e622ee078e5b3320ac951d to your computer and use it in GitHub Desktop.
Save tmspzz/7c4c6e7224e622ee078e5b3320ac951d to your computer and use it in GitHub Desktop.
A scrip to install Haskell Stack and set up things properly on Raspbian
#!/bin/sh
# Update: As of March 24th 2017 this script won't work.
# The script at https://get.haskellstack.org/ is broken
# because the binary of Stack 1.4 for ARM is missing from https://www.stackage.org/stack/ .
# You can still get the binary for Stack 1.3.2 from
# https://github.com/commercialhaskell/stack/releases/download/v1.3.2/stack-1.3.2-linux-arm.tar.gz
# and place it at $USR_LOCAL_BIN/stack in your system.
# Once Stack is installed you can proceed with the Install LLVM step
# Install stack
curl -sSL https://get.haskellstack.org/ | sh
# Install LLVM
sudo apt-get install llvm-3.7
# Add symbolic links to opt and llc
ln -s /usr/bin/opt-3.7 /usr/bin/opt
ln -s /usr/bin/llc-3.7 /usr/bin/llc
# Remove the symbolic link to ghc
rm ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc
# Wrap ghc binary in a shell script
cat > ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc-arm-wrapper.sh << 'END'
#!/bin/sh
ghc-8.0.1 -opta-march=armv7-a $@
END
# Create new symbolic link to ghc
ln ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc-arm-wrapper.sh ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc
# Make it executable
chmod a+x ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc-arm-wrapper.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment