1#!/usr/bin/env bash 2 3echo "Downloading Expat" 4if ! 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; 5then 6 echo "Failed to download Expat" 7 exit 1 8fi 9 10echo "Unpacking Expat" 11rm -rf ./expat-2.2.9 12if ! tar -xf expat-2.2.9.tar.gz; 13then 14 echo "Failed to unpack Expat" 15 exit 1 16fi 17 18cd expat-2.2.9 || exit 1 19 20export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig" 21 22echo "Configuring Expat" 23if ! ./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 29fi 30 31# Cleanup warnings, https://github.com/libexpat/libexpat/issues/383 32echo "Fixing Makefiles" 33(IFS="" find "$PWD" -name 'Makefile' -print | while read -r file 34do 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" 42done) 43 44echo "Building Expat" 45if ! make; then 46 echo "Failed to build Expat" 47 exit 1 48fi 49 50echo "Installing Expat" 51if ! make install; then 52 echo "Failed to install Expat" 53 exit 1 54fi 55 56exit 0 57