]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unbound/contrib/ios/install_expat.sh
MFV 364468:
[FreeBSD/FreeBSD.git] / contrib / unbound / contrib / ios / install_expat.sh
1 #!/usr/bin/env bash
2
3 echo "Downloading Expat"
4 if ! curl -L -k -s -o expat-2.2.9.tar.gz https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz;
5 then
6     echo "Failed to download Expat"
7     exit 1
8 fi
9
10 echo "Unpacking Expat"
11 rm -rf ./expat-2.2.9
12 if ! tar -xf expat-2.2.9.tar.gz;
13 then
14     echo "Failed to unpack Expat"
15     exit 1
16 fi
17
18 cd expat-2.2.9 || exit 1
19
20 export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig"
21
22 echo "Configuring Expat"
23 if ! ./configure \
24        --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \
25        --prefix="$IOS_PREFIX" ; then
26     echo "Error: Failed to configure Expat"
27     cat config.log
28     exit 1
29 fi
30
31 # Cleanup warnings, https://github.com/libexpat/libexpat/issues/383
32 echo "Fixing Makefiles"
33 (IFS="" find "$PWD" -name 'Makefile' -print | while read -r file
34 do
35     cp -p "$file" "$file.fixed"
36     sed 's|-Wduplicated-cond ||g; s|-Wduplicated-branches ||g; s|-Wlogical-op ||g' "$file" > "$file.fixed"
37     mv "$file.fixed" "$file"
38
39     cp -p "$file" "$file.fixed"
40     sed 's|-Wrestrict ||g; s|-Wjump-misses-init ||g; s|-Wmisleading-indentation ||g' "$file" > "$file.fixed"
41     mv "$file.fixed" "$file"
42 done)
43
44 echo "Building Expat"
45 if ! make; then
46     echo "Failed to build Expat"
47     exit 1
48 fi
49
50 echo "Installing Expat"
51 if ! make install; then
52     echo "Failed to install Expat"
53     exit 1
54 fi
55
56 exit 0