]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unbound/contrib/android/install_expat.sh
MFV 364468:
[FreeBSD/FreeBSD.git] / contrib / unbound / contrib / android / 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 echo "Configuring Expat"
21 if ! ./configure --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" --prefix="$ANDROID_PREFIX"; then
22     echo "Error: Failed to configure Expat"
23     exit 1
24 fi
25
26 # Cleanup warnings, https://github.com/libexpat/libexpat/issues/383
27 echo "Fixing Makefiles"
28 (IFS="" find "$PWD" -name 'Makefile' -print | while read -r file
29 do
30     cp -p "$file" "$file.fixed"
31     sed 's|-Wduplicated-cond ||g; s|-Wduplicated-branches ||g; s|-Wlogical-op ||g' "$file" > "$file.fixed"
32     mv "$file.fixed" "$file"
33
34     cp -p "$file" "$file.fixed"
35     sed 's|-Wrestrict ||g; s|-Wjump-misses-init ||g; s|-Wmisleading-indentation ||g' "$file" > "$file.fixed"
36     mv "$file.fixed" "$file"
37 done)
38
39 echo "Building Expat"
40 if ! make; then
41     echo "Failed to build Expat"
42     exit 1
43 fi
44
45 echo "Installing Expat"
46 if ! make install; then
47     echo "Failed to install Expat"
48     exit 1
49 fi
50
51 exit 0