forked from Imagick/imagick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure-cflags.sh
56 lines (43 loc) · 1.36 KB
/
configure-cflags.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Set CFLAGS to be strict for supported versions on Travis
#containsElement () {
# local e
# for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
# return 1
#}
# Bash return statements are not useful. You have to echo the value
# and then capture it by calling the function with $( foo )
function contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "1"
return 0
fi
}
echo "0"
return 0
}
strictPHPVersions=()
strictPHPVersions+=("5.6")
strictPHPVersions+=("7")
strictImageMagickVersions=()
strictImageMagickVersions+=("dev")
strictImageMagickVersions+=("6.8.7-0")
strictImageMagickVersions+=("6.7.5-3")
strictImageMagickVersions+=("6.6.0-9")
echo "TRAVIS_PHP_VERSION is ${TRAVIS_PHP_VERSION}"
echo "IMAGEMAGICK_VERSION is ${IMAGEMAGICK_VERSION}"
strictImageMagick=$(contains "${strictImageMagickVersions[@]}" "${IMAGEMAGICK_VERSION}" )
strictPHP=$(contains "${strictPHPVersions[@]}" "${TRAVIS_PHP_VERSION}" )
echo "strictImageMagick is ${strictImageMagick}"
echo "strictPHP is ${strictPHP}"
if [[ $strictPHP = '1' ]] && [[ $strictImageMagick = '1' ]]; then
CFLAGS="-Wno-deprecated-declarations -Wdeclaration-after-statement -Werror";
else
CFLAGS="-Wno-deprecated-declarations";
fi
echo "Setting CFLAGS to ${CFLAGS}"
export CFLAGS=$CFLAGS