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