openjpeg/tools/travis-ci/install.sh

124 lines
5.3 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# This script executes the install step when running under travis-ci
2015-10-10 18:01:43 +02:00
#if cygwin, check path
case ${MACHTYPE} in
*cygwin*) OPJ_CI_IS_CYGWIN=1;;
*) ;;
esac
if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then
2015-10-10 19:26:42 +02:00
# PATH is not yet set up
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
2015-10-10 18:01:43 +02:00
fi
# Set-up some error handling
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
set -o pipefail ## Fail on error in pipe
function exit_handler ()
{
local exit_code="$?"
test ${exit_code} == 0 && return;
echo -e "\nInstall failed !!!\nLast command at line ${BASH_LINENO}: ${BASH_COMMAND}";
exit "${exit_code}"
}
trap exit_handler EXIT
2015-09-12 15:48:23 +02:00
trap exit ERR
2015-10-08 20:06:59 +02:00
# We don't need anything for coverity scan builds. ABI check is managed in abi-check.sh
if [ "${COVERITY_SCAN_BRANCH:-}" == "1" ] || [ "${OPJ_CI_ABI_CHECK:-}" == "1" ]; then
exit 0
fi
2015-09-12 13:03:50 +02:00
2015-10-08 20:06:59 +02:00
if [ "${OPJ_CI_ASAN:-}" == "1" ]; then
# We need a new version of cmake than travis-ci provides
2016-04-19 15:22:49 +02:00
wget --no-check-certificate -qO - https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar -xz
2015-10-08 20:06:59 +02:00
# copy to a directory that will not changed every version
2016-04-19 15:22:49 +02:00
mv cmake-3.5.2-Linux-x86_64 cmake-install
2015-10-08 20:06:59 +02:00
fi
2015-09-12 13:03:50 +02:00
2015-10-08 20:06:59 +02:00
if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
2015-09-12 16:36:19 +02:00
2015-10-08 20:06:59 +02:00
OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
2015-09-12 16:36:19 +02:00
2015-10-08 20:06:59 +02:00
# We need test data
2021-09-10 16:05:04 +02:00
if [ "${GITHUB_HEAD_REF:-}" != "" ]; then
OPJ_DATA_BRANCH=${GITHUB_HEAD_REF}
elif [ "${TRAVIS_BRANCH:-}" != "" ]; then
2015-10-10 14:19:57 +02:00
OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
elif [ "${APPVEYOR_REPO_BRANCH:-}" != "" ]; then
OPJ_DATA_BRANCH=${APPVEYOR_REPO_BRANCH}
else
OPJ_DATA_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
2015-10-08 20:06:59 +02:00
fi
OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads https://github.com/uclouvain/openjpeg-data ${OPJ_DATA_BRANCH} | wc -l)
2015-10-13 21:37:11 +02:00
if [ ${OPJ_DATA_HAS_BRANCH} -eq 0 ]; then
2015-10-08 20:06:59 +02:00
OPJ_DATA_BRANCH=master #default to master
fi
echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
git clone -v --depth=1 --branch=${OPJ_DATA_BRANCH} https://github.com/uclouvain/openjpeg-data data
2015-09-12 13:03:50 +02:00
2015-10-08 20:06:59 +02:00
# We need jpylyzer for the test suite
2016-04-19 15:25:42 +02:00
JPYLYZER_VERSION="1.17.0"
2015-10-08 20:06:59 +02:00
echo "Retrieving jpylyzer"
2021-09-10 16:05:04 +02:00
if [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows" ]; then
wget -q https://github.com/openpreserve/jpylyzer/releases/download/${JPYLYZER_VERSION}/jpylyzer_${JPYLYZER_VERSION}_win32.zip
2015-10-10 15:18:12 +02:00
mkdir jpylyzer
cd jpylyzer
2016-04-19 15:25:42 +02:00
cmake -E tar -xf ../jpylyzer_${JPYLYZER_VERSION}_win32.zip
2015-10-10 15:18:12 +02:00
cd ..
2015-10-10 14:51:30 +02:00
else
2016-04-19 15:25:42 +02:00
wget -qO - https://github.com/openpreserve/jpylyzer/archive/${JPYLYZER_VERSION}.tar.gz | tar -xz
mv jpylyzer-${JPYLYZER_VERSION}/jpylyzer ./
2015-10-10 14:51:30 +02:00
chmod +x jpylyzer/jpylyzer.py
fi
2015-09-12 16:36:19 +02:00
2015-10-08 20:06:59 +02:00
# When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu:
# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
# You are free to trial these executables and even to re-distribute them,
# so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
# Note: Binaries can only be used for non-commercial purposes.
if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then
2021-09-10 16:05:04 +02:00
if [ "${TRAVIS_OS_NAME:-}" == "linux" -o "${RUNNER_OS:-}" == "Linux" ] || uname -s | grep -i Linux &> /dev/null; then
2015-10-08 20:06:59 +02:00
echo "Retrieving Kakadu"
wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
cmake -E tar -xf KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kdu
2021-09-10 16:05:04 +02:00
elif [ "${TRAVIS_OS_NAME:-}" == "osx" -o "${RUNNER_OS:-}" == "macOS" ] || uname -s | grep -i Darwin &> /dev/null; then
2015-10-08 20:06:59 +02:00
echo "Retrieving Kakadu"
wget -v http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
cmake -E tar -xf KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
2015-10-08 20:06:59 +02:00
wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip
./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg KDU805_Demo_Apps_for_MacOS_200602.dmg
2015-10-08 20:06:59 +02:00
pkgutil --expand Kakadu-demo-apps.pkg ./kdu
cd kdu
cat libkduv80r.pkg/Payload | gzip -d | cpio -id
2015-10-08 20:06:59 +02:00
cat kduexpand.pkg/Payload | gzip -d | cpio -id
cat kducompress.pkg/Payload | gzip -d | cpio -id
install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
2021-09-10 16:05:04 +02:00
elif [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows" ] || uname -s | grep -i MINGW &> /dev/null || uname -s | grep -i CYGWIN &> /dev/null; then
2015-10-10 18:15:28 +02:00
echo "Retrieving Kakadu"
wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Win64_200602.msi_.zip
cmake -E tar -xf KDU805_Demo_Apps_for_Win64_200602.msi_.zip
msiexec /i KDU805_Demo_Apps_for_Win64_200602.msi /quiet /qn /norestart
2015-10-10 19:26:42 +02:00
if [ -d "C:/Program Files/Kakadu" ]; then
cp -r "C:/Program Files/Kakadu" ./kdu
else
cp -r "C:/Program Files (x86)/Kakadu" ./kdu
2015-10-10 19:29:53 +02:00
fi
2015-09-12 13:03:50 +02:00
fi
fi
fi
if [ "${OPJ_CI_CHECK_STYLE:-}" == "1" ]; then
pip install --user autopep8
fi