1
0

49 lines
997 B
Bash
Raw Normal View History

#!/bin/bash -e
. sdk.sh
JPEG_VERSION=2.1.4
if [ ! -d libjpeg-src ]; then
wget https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzvf libjpeg-turbo-$JPEG_VERSION.tar.gz
mv libjpeg-turbo-$JPEG_VERSION libjpeg-src
rm libjpeg-turbo-$JPEG_VERSION.tar.gz
fi
rm -rf libjpeg
2022-11-13 17:35:33 +01:00
mkdir -p libjpeg/include
cd libjpeg-src
for ARCH in x86_64 arm64
do
echo "Building libjpeg for $ARCH"
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$OSX_FLAGS -arch $ARCH" \
2022-11-13 17:35:33 +01:00
-DCMAKE_INSTALL_PREFIX="." \
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
-DENABLE_SHARED=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 ../../libjpeg
cp -v lib/libjpeg.a ../../libjpeg/templib_$ARCH.a
else
2022-11-13 17:35:33 +01:00
cp -v lib/libjpeg.a ../../libjpeg/templib_$ARCH.a
fi
2022-11-13 17:35:33 +01:00
cd ..; rm -rf build
done
# repack into one .a
2022-11-13 17:35:33 +01:00
cd ../libjpeg
lipo -create templib_*.a -output libjpeg.a
rm templib_*.a
echo "libjpeg build successful"