Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved setting CFLAGS out of travis script, to allow it to be more fle…
…xible and not forced onto a single line.
- Loading branch information
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |