install.sh 5.1 KB

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