3 # This script executes the install step when running under travis-ci
7 *cygwin*) OPJ_CI_IS_CYGWIN=1;;
11 if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then
12 # PATH is not yet set up
13 export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
16 # Set-up some error handling
17 set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
18 set -o errexit ## set -e : exit the script if any statement returns a non-true return value
19 set -o pipefail ## Fail on error in pipe
21 function exit_handler ()
25 test ${exit_code} == 0 && return;
27 echo -e "\nInstall failed !!!\nLast command at line ${BASH_LINENO}: ${BASH_COMMAND}";
30 trap exit_handler EXIT
33 # We don't need anything for coverity scan builds. ABI check is managed in abi-check.sh
34 if [ "${COVERITY_SCAN_BRANCH:-}" == "1" ] || [ "${OPJ_CI_ABI_CHECK:-}" == "1" ]; then
38 if [ "${OPJ_CI_ASAN:-}" == "1" ]; then
39 # We need a new version of cmake than travis-ci provides
40 wget --no-check-certificate -qO - https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | tar -xz
41 # copy to a directory that will not changed every version
42 mv cmake-3.5.2-Linux-x86_64 cmake-install
45 if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
47 OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
50 if [ "${GITHUB_HEAD_REF:-}" != "" ]; then
51 OPJ_DATA_BRANCH=${GITHUB_HEAD_REF}
52 elif [ "${TRAVIS_BRANCH:-}" != "" ]; then
53 OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
54 elif [ "${APPVEYOR_REPO_BRANCH:-}" != "" ]; then
55 OPJ_DATA_BRANCH=${APPVEYOR_REPO_BRANCH}
57 OPJ_DATA_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
59 OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads https://github.com/uclouvain/openjpeg-data ${OPJ_DATA_BRANCH} | wc -l)
60 if [ ${OPJ_DATA_HAS_BRANCH} -eq 0 ]; then
61 OPJ_DATA_BRANCH=master #default to master
63 echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
64 git clone -v --depth=1 --branch=${OPJ_DATA_BRANCH} https://github.com/uclouvain/openjpeg-data data
66 # We need jpylyzer for the test suite
67 JPYLYZER_VERSION="1.17.0"
68 echo "Retrieving jpylyzer"
69 if [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows" ]; then
70 wget -q https://github.com/openpreserve/jpylyzer/releases/download/${JPYLYZER_VERSION}/jpylyzer_${JPYLYZER_VERSION}_win32.zip
73 cmake -E tar -xf ../jpylyzer_${JPYLYZER_VERSION}_win32.zip
76 wget -qO - https://github.com/openpreserve/jpylyzer/archive/${JPYLYZER_VERSION}.tar.gz | tar -xz
77 mv jpylyzer-${JPYLYZER_VERSION}/jpylyzer ./
78 chmod +x jpylyzer/jpylyzer.py
81 # When OPJ_NONCOMMERCIAL=1, kakadu trial binaries are used for testing. Here's the copyright notice from kakadu:
82 # Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
83 # You are free to trial these executables and even to re-distribute them,
84 # so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
85 # Note: Binaries can only be used for non-commercial purposes.
86 if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ]; then
87 if [ "${TRAVIS_OS_NAME:-}" == "linux" -o "${RUNNER_OS:-}" == "Linux" ] || uname -s | grep -i Linux &> /dev/null; then
88 echo "Retrieving Kakadu"
89 wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
90 cmake -E tar -xf KDU805_Demo_Apps_for_Linux-x86-64_200602.zip
91 mv KDU805_Demo_Apps_for_Linux-x86-64_200602 kdu
92 elif [ "${TRAVIS_OS_NAME:-}" == "osx" -o "${RUNNER_OS:-}" == "macOS" ] || uname -s | grep -i Darwin &> /dev/null; then
93 echo "Retrieving Kakadu"
94 wget -v http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
95 cmake -E tar -xf KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
96 wget -q http://downloads.sourceforge.net/project/catacombae/HFSExplorer/0.23/hfsexplorer-0.23-bin.zip
97 mkdir hfsexplorer && cmake -E chdir hfsexplorer tar -xf ../hfsexplorer-0.23-bin.zip
98 ./hfsexplorer/bin/unhfs.sh -o ./ -fsroot Kakadu-demo-apps.pkg KDU805_Demo_Apps_for_MacOS_200602.dmg
99 pkgutil --expand Kakadu-demo-apps.pkg ./kdu
101 cat libkduv80r.pkg/Payload | gzip -d | cpio -id
102 cat kduexpand.pkg/Payload | gzip -d | cpio -id
103 cat kducompress.pkg/Payload | gzip -d | cpio -id
104 install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib
105 install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
106 install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
107 elif [ "${APPVEYOR:-}" == "True" -o "${RUNNER_OS:-}" == "Windows" ] || uname -s | grep -i MINGW &> /dev/null || uname -s | grep -i CYGWIN &> /dev/null; then
108 echo "Retrieving Kakadu"
109 wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_Win64_200602.msi_.zip
110 cmake -E tar -xf KDU805_Demo_Apps_for_Win64_200602.msi_.zip
111 msiexec /i KDU805_Demo_Apps_for_Win64_200602.msi /quiet /qn /norestart
112 if [ -d "C:/Program Files/Kakadu" ]; then
113 cp -r "C:/Program Files/Kakadu" ./kdu
115 cp -r "C:/Program Files (x86)/Kakadu" ./kdu
121 if [ "${OPJ_CI_CHECK_STYLE:-}" == "1" ]; then
122 pip install --user autopep8