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;
6 echo "Failed to download Expat"
10 echo "Unpacking Expat"
12 if ! tar -xf expat-2.2.9.tar.gz;
14 echo "Failed to unpack Expat"
18 cd expat-2.2.9 || exit 1
20 echo "Configuring Expat"
21 if ! ./configure --build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" --prefix="$ANDROID_PREFIX"; then
22 echo "Error: Failed to configure Expat"
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
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"
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"
41 echo "Failed to build Expat"
45 echo "Installing Expat"
46 if ! make install; then
47 echo "Failed to install Expat"