Skip to content

Instantly share code, notes, and snippets.

@feryardiant
Last active June 26, 2021 20:09
Show Gist options
  • Save feryardiant/0ea91656beb726c0cb6f to your computer and use it in GitHub Desktop.
Save feryardiant/0ea91656beb726c0cb6f to your computer and use it in GitHub Desktop.
Easy way to Install libsass & sassc in Ubuntu, `curl -sSL http://git.io/vnxQ4 | sudo bash`
#!/bin/bash
# Based on https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87
set -e
# Installing dependencies
apt-get -q -y install build-essential automake libtool git
buildDir="/tmp/sass-build"
version="3.2.5"
prefix="/usr/local"
sources=(libsass sassc)
export SASS_LIBSASS_PATH="$buildDir/libsass"
if [ -d "$buildDir" ]; then
rm -rf "$buildDir";
fi
# Create build dir inside /tmp
echo "Creating build directory ($buildDir)"
mkdir "$buildDir"
cd $buildDir
for src in "${sources[@]}"; do
echo "[$src] Cloning repository"
git clone -q https://github.com/sass/$src --branch $version --depth 1 > /dev/null 2>&1 && cd $src
echo "[$src] Creating configuration"
autoreconf --force --install > /dev/null 2>&1
echo "[$src] Configuring compiler"
./configure --enable-shared --prefix=$prefix > /dev/null 2>&1
echo "[$src] Compiling installer"
make > /dev/null 2>&1
echo "[$src] Installing "
make install > /dev/null 2>&1
echo "[$src] Done"
cd ..
done
rm -rf "$buildDir"
echo "Everything is done"
@MrBenGriffin
Copy link

Pass the version required as a parameter.
Possibly use /usr/local/share for the source - it can speed up subsequent builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment