Correct unbound variable
[openjpeg.git] / tools / travis-ci / install.sh
index 2def910be2f51e239d973c969082172394cb0768..61debd9509cebd313483ee1289333cbb1e07e377 100755 (executable)
@@ -9,10 +9,8 @@ case ${MACHTYPE} in
 esac
 
 if [ "${OPJ_CI_IS_CYGWIN:-}" == "1" ]; then
-       if ! which which; then
-               # PATH is not yet set up
-               export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
-       fi
+       # PATH is not yet set up
+       export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
 fi
 
 # Set-up some error handling
@@ -57,9 +55,7 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
                OPJ_DATA_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to same branch as we're setting up
        fi
        OPJ_DATA_HAS_BRANCH=$(git ls-remote --heads git://github.com/uclouvain/openjpeg-data.git ${OPJ_DATA_BRANCH} | wc -l)
-       if [ ${OPJ_DATA_HAS_BRANCH} -ne 0 ]; then
-               OPJ_DATA_BRANCH=${TRAVIS_BRANCH}
-       else
+       if [ ${OPJ_DATA_HAS_BRANCH} -eq 0 ]; then
                OPJ_DATA_BRANCH=master #default to master
        fi
        echo "Cloning openjpeg-data from ${OPJ_DATA_BRANCH} branch"
@@ -67,9 +63,17 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
 
        # We need jpylyzer for the test suite
        echo "Retrieving jpylyzer"
-       wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xz
-       mv jpylyzer-1.14.2 jpylyzer
-       chmod +x jpylyzer/jpylyzer/jpylyzer.py
+       if [ "${APPVEYOR:-}" == "True" ]; then
+               wget --local-encoding=UTF-8 -q http://dl.bintray.com/openplanets/opf-windows/jpylyzer_1.14.2_win32.zip
+               mkdir jpylyzer
+               cd jpylyzer
+               cmake -E tar -xf ../jpylyzer_1.14.2_win32.zip
+               cd ..
+       else
+               wget -qO - https://github.com/openpreserve/jpylyzer/archive/1.14.2.tar.gz | tar -xz
+               mv jpylyzer-1.14.2/jpylyzer ./
+               chmod +x jpylyzer/jpylyzer.py
+       fi
 
        # 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.
@@ -97,10 +101,16 @@ if [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
                        install_name_tool -id ${PWD}/libkdu_v77R.dylib libkdu_v77R.dylib 
                        install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_compress
                        install_name_tool -change /usr/local/lib/libkdu_v77R.dylib ${PWD}/libkdu_v77R.dylib kdu_expand
-               elif [ "${APPVEYOR:-}" == "True" ]; then
+               elif [ "${APPVEYOR:-}" == "True" ] || uname -s | grep -i MINGW &> /dev/null || uname -s | grep -i CYGWIN &> /dev/null; then
+                       echo "Retrieving Kakadu"
                        wget -q http://kakadusoftware.com/wp-content/uploads/2014/06/KDU77_Demo_Apps_for_Win32_150710.msi_.zip
                        cmake -E tar -xf KDU77_Demo_Apps_for_Win32_150710.msi_.zip
                        msiexec /i KDU77_Demo_Apps_for_Win32_150710.msi /quiet /qn /norestart
+                       if [ -d "C:/Program Files/Kakadu" ]; then
+                               cp -r "C:/Program Files/Kakadu" ./kdu
+                       else
+                               cp -r "C:/Program Files (x86)/Kakadu" ./kdu
+                       fi
                fi
        fi
 fi