Skip to content

Commit

Permalink
[build/setup.sh] Add libsodium setup to install flow.
Browse files Browse the repository at this point in the history
Summary:
Workaround for the "error: sodium.h: No such file or directory" bug in
pynacl and/or cffi: pyca/pynacl#79

Fixes #95

Test Plan: `vagrant up --provision` from scratch

Reviewers: charles

Reviewed By: charles

Subscribers: mg

Differential Revision: https://review.inboxapp.com/D635
  • Loading branch information
dlitz committed Oct 22, 2014
1 parent 5c32879 commit b0c925a
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,58 @@ apt-get -y install git \
libxslt-dev \
lib32z1-dev \
libffi-dev \
pkg-config \
python-lxml \
tmux \
curl \
tnef \
stow \

# Workaround for "error: sodium.h: No such file or directory" bug
# https://github.com/pyca/pynacl/issues/79
libsodium_ver=1.0.0
color '35;1' 'Ensuring libsodium version...'
if ! pkg-config --atleast-version="${libsodium_ver}" libsodium; then
# Ubuntu precise doesn't have a libsodium-dev package, so we build it
# ourselves and install it to /usr/local (using GNU stow so that we can
# uninstall it later).

# Uninstall old version
if pkg-config --exists libsodium; then
libsodium_oldver=`pkg-config --modversion libsodium`
color '35;1' " > Uninstalling libsodium-${libsodium_oldver}..."
stow -d /usr/local/stow -D "libsodium-${libsodium_oldver}"
ldconfig
if pkg-config --exists libsodium; then
color '31;1' " > Unable to uninstall libsodium-${libsodium_oldver}"
exit 1
fi
fi

color '35;1' " > Downloading and installing libsodium-${libsodium_ver}..."
mkdir -p setup
cd setup
curl -L -O https://github.com/jedisct1/libsodium/releases/download/${libsodium_ver}/libsodium-${libsodium_ver}.tar.gz
echo 'ced1fe3d2066953fea94f307a92f8ae41bf0643739a44309cbe43aa881dbc9a5 *libsodium-1.0.0.tar.gz' | sha256sum -c || exit 1
tar -xzf libsodium-${libsodium_ver}.tar.gz
cd libsodium-${libsodium_ver}
./configure --prefix=/usr/local/stow/libsodium-${libsodium_ver}
make -j4
rm -rf /usr/local/stow/libsodium-${libsodium_ver}
mkdir -p /usr/local/stow/libsodium-${libsodium_ver}
make install
stow -d /usr/local/stow -R libsodium-${libsodium_ver}
ldconfig
cd ../..
rm -rf setup

if pkg-config --exists libsodium; then
color '34;1' " > libsodium-${libsodium_ver} installed."
else
color '31;1' " > Unable to install libsodium-${libsodium_ver}"
exit 1
fi
fi

color '35;1' 'Removing .pyc files...' # they might be stale
find . -name \*.pyc -delete
Expand All @@ -82,7 +130,7 @@ hash pip # /usr/bin/pip might now be /usr/local/bin/pip
pip install 'pip>=1.5.6' 'setuptools>=5.3'

color '35;1' 'Installing dependencies from pip...'
pip install -r requirements.txt
SODIUM_INSTALL=system pip install -r requirements.txt

pip install -e .
if [ -d "../inbox-eas" ]; then
Expand Down

0 comments on commit b0c925a

Please sign in to comment.