From 1f6446b6f59f7f40ce74b4e14ea773a108734c50 Mon Sep 17 00:00:00 2001 From: Didactic Drunk <1479616+didactic-drunk@users.noreply.github.com> Date: Tue, 25 Jun 2019 13:35:15 -0700 Subject: [PATCH] Cache compiled packages on travis. --- .travis.yml | 23 ++++++++++++++++++++++- travis-install-lib-sodium.sh | 24 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a283e5..379acf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,27 @@ sudo: true language: crystal +os: + - linux +# - osx + install: - ./travis-install-lib-sodium.sh before_script: - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib + - export C_INCLUDE_PATH=$LD_LIBRARY_PATH:`pwd`/sodium/include + - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/sodium/lib + - env | egrep PKG + - export PKG_CONFIG_PATH=`pwd`/sodium/lib/pkgconfig + - env | egrep LD_ + - env | egrep PKG + - pwd +cache: + directories: + - sodium + +#addons: +# apt: +# packages: +# - libsodium-dev # old +# homebrew: +# packages: +# - libsodium # takes forever diff --git a/travis-install-lib-sodium.sh b/travis-install-lib-sodium.sh index 784d02c..146b780 100755 --- a/travis-install-lib-sodium.sh +++ b/travis-install-lib-sodium.sh @@ -5,9 +5,21 @@ set -e -wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz -tar xvfz LATEST.tar.gz -cd libsodium-stable -sudo ./configure -sudo make -sudo make install +LIBSODIUM_INSTALL_PATH=`pwd`/sodium + +if [ ! -f "sodium/include/sodium.h" ]; then + set -x + + mkdir -p "$LIBSODIUM_INSTALL_PATH" + find "$LIBSODIUM_INSTALL_PATH" + + wget https://download.libsodium.org/libsodium/releases/LATEST.tar.gz + tar xfz LATEST.tar.gz + cd libsodium-stable + ./configure --prefix="$LIBSODIUM_INSTALL_PATH" + make + make install +else + echo "using cached libsodium build" + find "$LIBSODIUM_INSTALL_PATH" +fi