2020-03-04 12:03:20 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2025-03-26 11:51:46 -04:00
|
|
|
LIBEXPAT_FNAME=expat-2.7.0
|
|
|
|
|
LIBEXPAT_VERSION_DIR=R_2_7_0
|
2025-03-26 09:58:54 -04:00
|
|
|
|
2020-03-04 12:03:20 -05:00
|
|
|
echo "Downloading Expat"
|
2025-03-26 09:58:54 -04:00
|
|
|
if ! curl -L -k -s -o $LIBEXPAT_FNAME.tar.gz https://github.com/libexpat/libexpat/releases/download/$LIBEXPAT_VERSION_DIR/$LIBEXPAT_FNAME.tar.gz;
|
2020-03-04 12:03:20 -05:00
|
|
|
then
|
|
|
|
|
echo "Failed to download Expat"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Unpacking Expat"
|
2025-03-26 09:58:54 -04:00
|
|
|
rm -rf ./$LIBEXPAT_FNAME
|
|
|
|
|
if ! tar -xf $LIBEXPAT_FNAME.tar.gz;
|
2020-03-04 12:03:20 -05:00
|
|
|
then
|
|
|
|
|
echo "Failed to unpack Expat"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2025-03-26 09:58:54 -04:00
|
|
|
cd $LIBEXPAT_FNAME || exit 1
|
2020-03-04 12:03:20 -05:00
|
|
|
|
|
|
|
|
export PKG_CONFIG_PATH="$IOS_PREFIX/lib/pkgconfig"
|
|
|
|
|
|
|
|
|
|
echo "Configuring Expat"
|
2025-03-26 11:40:10 -04:00
|
|
|
if ! ./configure --without-tests \
|
|
|
|
|
--build="$AUTOTOOLS_BUILD" --host="$AUTOTOOLS_HOST" \
|
|
|
|
|
--prefix="$IOS_PREFIX" ;
|
|
|
|
|
then
|
2020-03-04 12:03:20 -05:00
|
|
|
echo "Error: Failed to configure Expat"
|
|
|
|
|
cat config.log
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Cleanup warnings, https://github.com/libexpat/libexpat/issues/383
|
|
|
|
|
echo "Fixing Makefiles"
|
|
|
|
|
(IFS="" find "$PWD" -name 'Makefile' -print | while read -r file
|
|
|
|
|
do
|
|
|
|
|
cp -p "$file" "$file.fixed"
|
|
|
|
|
sed 's|-Wduplicated-cond ||g; s|-Wduplicated-branches ||g; s|-Wlogical-op ||g' "$file" > "$file.fixed"
|
|
|
|
|
mv "$file.fixed" "$file"
|
|
|
|
|
|
|
|
|
|
cp -p "$file" "$file.fixed"
|
|
|
|
|
sed 's|-Wrestrict ||g; s|-Wjump-misses-init ||g; s|-Wmisleading-indentation ||g' "$file" > "$file.fixed"
|
|
|
|
|
mv "$file.fixed" "$file"
|
|
|
|
|
done)
|
|
|
|
|
|
|
|
|
|
echo "Building Expat"
|
|
|
|
|
if ! make; then
|
|
|
|
|
echo "Failed to build Expat"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "Installing Expat"
|
|
|
|
|
if ! make install; then
|
|
|
|
|
echo "Failed to install Expat"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exit 0
|