1
0

54 lines
1.1 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash -e
2023-06-27 01:48:52 +03:00
PNG_VERSION=1.6.40
. scripts/sdk.sh
mkdir -p deps; cd deps
if [ ! -d libpng-src ]; then
wget https://download.sourceforge.net/libpng/libpng-$PNG_VERSION.tar.gz
2023-08-11 13:35:54 +03:00
tar -xzf libpng-$PNG_VERSION.tar.gz
mv libpng-$PNG_VERSION libpng-src
rm libpng-$PNG_VERSION.tar.gz
fi
rm -rf libpng
2022-11-13 17:35:33 +01:00
mkdir -p libpng/include
cd libpng-src
for ARCH in x86_64 arm64
do
echo "Building libpng for $ARCH"
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
2022-11-13 17:35:33 +01:00
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_ASM_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
-DCMAKE_INSTALL_PREFIX="." \
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
-DPNG_SHARED=OFF \
-DPNG_TESTS=OFF \
2022-11-13 17:35:33 +01:00
-DPNG_EXECUTABLES=OFF
cmake --build . -j
2022-11-13 17:35:33 +01:00
make install -s
if [ $ARCH = "x86_64" ]; then
2022-11-13 17:35:33 +01:00
cp -rv include ../../libpng
cp -v lib/libpng16.a ../../libpng/templib_$ARCH.a
else
2022-11-13 17:35:33 +01:00
cp -v lib/libpng16.a ../../libpng/templib_$ARCH.a
fi
2022-11-13 17:35:33 +01:00
cd ..; rm -rf build
done
# repack into one .a
cd ../libpng
lipo -create templib_*.a -output libpng.a
rm templib_*.a
echo "libpng build successful"