2022-09-25 12:10:27 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2024-06-02 04:35:48 -04:00
|
|
|
JPEG_VERSION=3.0.1
|
2022-09-25 12:10:27 +02:00
|
|
|
|
2022-12-02 11:40:55 +01:00
|
|
|
. scripts/sdk.sh
|
|
|
|
mkdir -p deps; cd deps
|
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
if [ ! -d libjpeg-src ]; then
|
2024-06-02 04:35:48 -04:00
|
|
|
git clone -b $JPEG_VERSION --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo libjpeg-src
|
|
|
|
mkdir libjpeg-src/build
|
2022-09-25 12:10:27 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf libjpeg
|
|
|
|
|
2022-11-13 17:35:33 +01:00
|
|
|
mkdir -p libjpeg/include
|
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
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
|
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
cmake --build . -j
|
2022-11-13 17:35:33 +01:00
|
|
|
make install -s
|
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
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
|
2022-09-25 12:10:27 +02:00
|
|
|
else
|
2022-11-13 17:35:33 +01:00
|
|
|
cp -v lib/libjpeg.a ../../libjpeg/templib_$ARCH.a
|
2022-09-25 12:10:27 +02:00
|
|
|
fi
|
2022-11-13 17:35:33 +01:00
|
|
|
|
2022-09-25 12:10:27 +02:00
|
|
|
cd ..; rm -rf build
|
|
|
|
done
|
|
|
|
|
|
|
|
# repack into one .a
|
2022-11-13 17:35:33 +01:00
|
|
|
cd ../libjpeg
|
2022-09-25 12:10:27 +02:00
|
|
|
lipo -create templib_*.a -output libjpeg.a
|
|
|
|
rm templib_*.a
|
|
|
|
|
|
|
|
echo "libjpeg build successful"
|