2021-11-30 21:14:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
#
|
|
|
|
# EmulationStation Desktop Edition
|
|
|
|
# macOS_dependencies_build.sh
|
|
|
|
#
|
|
|
|
# Builds the external dependencies in-tree.
|
|
|
|
# The macOS_dependencies_setup.sh script must have been executed before this one.
|
|
|
|
# All sources will be recompiled from scratch every time this script is run.
|
|
|
|
# If manually compiling individual libraries, don't forget to set MACOSX_DEPLOYMENT_TARGET.
|
|
|
|
#
|
|
|
|
# This script needs to run from the root of the repository.
|
|
|
|
#
|
|
|
|
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.14
|
|
|
|
|
|
|
|
# How many CPU threads to use for the compilation.
|
|
|
|
JOBS=4
|
|
|
|
|
|
|
|
if [ ! -f .clang-format ]; then
|
|
|
|
echo "You need to run this script from the root of the repository."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd external
|
|
|
|
|
|
|
|
if [ ! -d FFmpeg ]; then
|
|
|
|
echo "You need to first run tools/macOS_dependencies_setup.sh to download and configure the dependencies."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Building all dependencies in the ./external directory...\n"
|
|
|
|
|
2022-02-02 17:05:49 +00:00
|
|
|
export PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
echo "Building libpng"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d libpng ]; then
|
|
|
|
echo "libpng directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd libpng
|
|
|
|
rm -f CMakeCache.txt
|
2022-02-02 17:05:49 +00:00
|
|
|
if [ $(uname -m) == "arm64" ]; then
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DPNG_SHARED=off -DPNG_ARM_NEON=off -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install .
|
2022-02-02 17:05:49 +00:00
|
|
|
else
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DPNG_SHARED=off -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install .
|
2022-02-02 17:05:49 +00:00
|
|
|
fi
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding FreeType"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d freetype/build ]; then
|
|
|
|
echo "FreeType directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd freetype/build
|
|
|
|
rm -f CMakeCache.txt
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=on -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on -DCMAKE_INSTALL_PREFIX=$(pwd)/../../local_install -S .. -B .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
2022-10-30 17:10:20 +00:00
|
|
|
cp libfreetype.6.18.3.dylib ../../../libfreetype.6.dylib
|
2021-11-30 21:14:18 +00:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
echo "\nBuilding FreeImage"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d freeimage/FreeImage ]; then
|
|
|
|
echo "FreeImage directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd freeimage/FreeImage
|
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
cp libfreeimage.a ../../..
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
echo "\nBuilding pugixml"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d pugixml ]; then
|
|
|
|
echo "pugixml directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd pugixml
|
|
|
|
rm -f CMakeCache.txt
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
cp libpugixml.a ../..
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding SDL"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d SDL/build ]; then
|
|
|
|
echo "SDL directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd SDL/build
|
|
|
|
rm -f CMakeCache.txt
|
2022-09-27 15:52:36 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -S .. -B .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
2022-12-15 19:13:37 +00:00
|
|
|
cp libSDL2-2.0.0.dylib ../../..
|
2021-11-30 21:14:18 +00:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
echo "\nBuilding libvpx"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d libvpx ]; then
|
|
|
|
echo "libvpx directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd libvpx
|
2022-02-02 17:05:49 +00:00
|
|
|
./configure --disable-examples --disable-docs --enable-pic --enable-vp9-highbitdepth --prefix=$(pwd)/../local_install
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding Ogg"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d ogg ]; then
|
|
|
|
echo "Ogg directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd ogg
|
|
|
|
rm -f CMakeCache.txt
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding Vorbis"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d vorbis ]; then
|
|
|
|
echo "Vorbis directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd vorbis
|
|
|
|
rm -f CMakeCache.txt
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
2022-02-02 17:05:49 +00:00
|
|
|
cp lib/libvorbisenc.2.0.12.dylib ../..
|
|
|
|
cp lib/libvorbis.0.4.9.dylib ../..
|
2021-11-30 21:14:18 +00:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding Opus"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d opus ]; then
|
|
|
|
echo "Opus directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd opus
|
|
|
|
rm -f CMakeCache.txt
|
2022-10-04 15:33:22 +00:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/../local_install .
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
|
|
|
make install
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "\nBuilding FFmpeg"
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
if [ ! -d FFmpeg ]; then
|
|
|
|
echo "FFmpeg directory is missing, aborting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
cd FFmpeg
|
2022-04-13 17:31:12 +00:00
|
|
|
PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig ./configure --prefix=/usr/local --enable-rpath --install-name-dir=@rpath --disable-doc --enable-gpl --enable-shared --enable-libvorbis --enable-libopus --enable-libvpx --enable-postproc
|
|
|
|
|
2021-11-30 21:14:18 +00:00
|
|
|
make clean
|
|
|
|
make -j${JOBS}
|
2022-04-15 09:30:41 +00:00
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libavcodec/libavcodec.59.dylib
|
|
|
|
cp libavcodec/libavcodec.59.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libavfilter/libavfilter.8.dylib
|
|
|
|
cp libavfilter/libavfilter.8.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libavformat/libavformat.59.dylib
|
|
|
|
cp libavformat/libavformat.59.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libavutil/libavutil.57.dylib
|
|
|
|
cp libavutil/libavutil.57.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libpostproc/libpostproc.56.dylib
|
|
|
|
cp libpostproc/libpostproc.56.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libswresample/libswresample.4.dylib
|
|
|
|
cp libswresample/libswresample.4.dylib ../..
|
|
|
|
install_name_tool -rpath /usr/local/lib @executable_path libswscale/libswscale.6.dylib
|
|
|
|
cp libswscale/libswscale.6.dylib ../..
|
2022-02-02 17:05:49 +00:00
|
|
|
|
|
|
|
unset PKG_CONFIG_PATH
|
2022-10-30 12:01:51 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Done building all dependencies."
|