(macOS) All dependencies are now built in-tree.

This commit is contained in:
Leon Styhre 2021-11-30 22:14:18 +01:00
parent a5820e4bd5
commit 8373d59e29
7 changed files with 385 additions and 122 deletions

View file

@ -101,7 +101,12 @@ else()
endif()
# Skip package dependency checks if we're on Windows.
if(NOT WIN32)
if(APPLE)
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/external/FFmpeg)
message(FATAL_ERROR "-- You need to build the dependencies in ./external first")
endif()
find_package(CURL REQUIRED)
elseif(NOT WIN32)
find_package(CURL REQUIRED)
find_package(FFmpeg REQUIRED)
find_package(FreeImage REQUIRED)
@ -301,19 +306,28 @@ endif()
# Include files.
set(COMMON_INCLUDE_DIRS ${CURL_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS}
${FreeImage_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
${PUGIXML_INCLUDE_DIRS}
${SDL2_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/CImg
${CMAKE_CURRENT_SOURCE_DIR}/external/glm
${CMAKE_CURRENT_SOURCE_DIR}/external/nanosvg/src
${CMAKE_CURRENT_SOURCE_DIR}/external/rapidjson/include
${CMAKE_CURRENT_SOURCE_DIR}/es-core/src)
if(VLC_PLAYER)
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} ${VLC_INCLUDE_DIR})
if(APPLE)
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/external/FFmpeg
${CMAKE_CURRENT_SOURCE_DIR}/external/freeimage/FreeImage/Source
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include
${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src
${CMAKE_CURRENT_SOURCE_DIR}/external/SDL)
else()
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS}
${FFMPEG_INCLUDE_DIRS}
${FreeImage_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
${PUGIXML_INCLUDE_DIRS})
if(VLC_PLAYER)
set(COMMON_INCLUDE_DIRS ${COMMON_INCLUDE_DIRS} ${VLC_INCLUDE_DIR})
endif()
endif()
# For Windows we need to add local include files for the dependency packages.
@ -353,16 +367,19 @@ endif()
#---------------------------------------------------------------------------------------------------
# Dependency libraries.
if(NOT WIN32)
set(COMMON_LIBRARIES ${CURL_LIBRARIES}
${FFMPEG_LIBRARIES}
${FreeImage_LIBRARIES}
${FREETYPE_LIBRARIES}
${PUGIXML_LIBRARIES}
${SDL2_LIBRARY})
if(VLC_PLAYER)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${VLC_LIBRARIES})
endif()
if(APPLE)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES}
${CURL_LIBRARIES}
${PROJECT_SOURCE_DIR}/libavcodec.58.dylib
${PROJECT_SOURCE_DIR}/libavfilter.7.dylib
${PROJECT_SOURCE_DIR}/libavformat.58.dylib
${PROJECT_SOURCE_DIR}/libavutil.56.dylib
${PROJECT_SOURCE_DIR}/libswresample.3.dylib
${PROJECT_SOURCE_DIR}/libswscale.5.dylib
${PROJECT_SOURCE_DIR}/libfreeimage.a
${PROJECT_SOURCE_DIR}/libfreetype.6.dylib
${PROJECT_SOURCE_DIR}/libpugixml.a
${PROJECT_SOURCE_DIR}/libSDL2-2.0.dylib)
elseif(WIN32)
if(DEFINED MSVC)
set(COMMON_LIBRARIES "${PROJECT_SOURCE_DIR}/avcodec.lib"
@ -402,6 +419,16 @@ elseif(WIN32)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} "${PROJECT_SOURCE_DIR}/libvlc.dll")
endif()
endif()
else()
set(COMMON_LIBRARIES ${CURL_LIBRARIES}
${FFMPEG_LIBRARIES}
${FreeImage_LIBRARIES}
${FREETYPE_LIBRARIES}
${PUGIXML_LIBRARIES}
${SDL2_LIBRARY})
if(VLC_PLAYER)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${VLC_LIBRARIES})
endif()
endif()
if(APPLE)

View file

@ -196,26 +196,6 @@ elseif(APPLE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE.icns DESTINATION ../Resources)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/EmulationStation-DE_Info.plist DESTINATION .. RENAME Info.plist)
# Another hack/workaround. I have not been able to find any way whatsover to force the
# linker to use rpaths for all shared libraries instead of absolute paths. So instead
# we're running install_name_tool as a post-build command to manually change the absolute
# paths to the rpaths for these libraries. The worst thing about this approach is that
# the library version needs to be manually changed here depending on what's installed
# on your system (e.g. if using libSDL2-2.1.0.dylib instead of libSDL2-2.0.0.dylib).
# This problem definitely needs to be resolved properly at a later date.
add_custom_command(TARGET EmulationStation POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL}
-change /usr/local/lib/libavcodec.58.dylib @rpath/libavcodec.58.dylib
-change /usr/local/lib/libavfilter.7.dylib @rpath/libavfilter.7.dylib
-change /usr/local/lib/libavformat.58.dylib @rpath/libavformat.58.dylib
-change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib
-change /usr/local/lib/libswresample.3.dylib @rpath/libswresample.3.dylib
-change /usr/local/lib/libswscale.5.dylib @rpath/libswscale.5.dylib
-change /usr/local/opt/freeimage/lib/libfreeimage.dylib @rpath/libfreeimage.dylib
-change /usr/local/opt/freetype/lib/libfreetype.6.dylib @rpath/libfreetype.6.dylib
-change /usr/local/opt/libpng/lib/libpng16.16.dylib @rpath/libpng16.16.dylib
-change /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib @rpath/libSDL2-2.0.0.dylib
$<TARGET_FILE:EmulationStation>)
set(APPLE_DYLIB_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
@ -236,13 +216,13 @@ elseif(APPLE)
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libfdk-aac.2.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libfreeimage.dylib
install(FILES ${CMAKE_SOURCE_DIR}/libvorbis.0.4.9.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libvorbisenc.2.0.12.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libfreetype.6.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libpng16.16.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libSDL2-2.0.0.dylib
install(FILES ${CMAKE_SOURCE_DIR}/libSDL2-2.0.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
if(VLC_PLAYER)

View file

@ -13,7 +13,7 @@
#include <SDL2/SDL.h>
#if defined(__linux__) || defined(_WIN64)
#if defined(__linux__) || defined(_WIN64) || defined(__APPLE__)
#include <SDL2/SDL_joystick.h>
#else
#include "SDL_joystick.h"

12
external/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
# macOS in-tree build of dependencies
FFmpeg
SDL
fdk-aac
freeimage
freetype
libpng
libvpx
ogg
opus
pugixml
vorbis

View file

@ -1,79 +0,0 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# EmulationStation Desktop Edition
# macOS_change_dylib_rpaths.sh
#
# Updates the dylib paths to use rpaths instead of absolute paths.
# This script does not do much error checking so the results should be verified manually
# afterwards using the "otool -L" command.
# Changes are needed to this script when moving to a new version for any of the libraries.
#
export FREETYPE_FILENAME=libfreetype.6.dylib
export AVCODEC_FILENAME=libavcodec.58.dylib
export AVFILTER_FILENAME=libavfilter.7.dylib
export AVFORMAT_FILENAME=libavformat.58.dylib
export POSTPROC_FILENAME=libpostproc.55.dylib
export SWRESAMPLE_FILENAME=libswresample.3.dylib
export SWSCALE_FILENAME=libswscale.5.dylib
if [ -f $FREETYPE_FILENAME ]; then
echo Found file $FREETYPE_FILENAME - changing to rpaths
chmod 755 $FREETYPE_FILENAME
install_name_tool -change /usr/local/opt/libpng/lib/libpng16.16.dylib @rpath/libpng16.16.dylib $FREETYPE_FILENAME
install_name_tool -add_rpath @executable_path $FREETYPE_FILENAME
fi
if [ -f $AVCODEC_FILENAME ]; then
echo Found file $AVCODEC_FILENAME - changing to rpaths
chmod 755 $AVCODEC_FILENAME
install_name_tool -change /usr/local/lib/libswresample.3.dylib @rpath/libswresample.3.dylib $AVCODEC_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $AVCODEC_FILENAME
install_name_tool -change /usr/local/opt/fdk-aac/lib/libfdk-aac.2.dylib @rpath/libfdk-aac.2.dylib $AVCODEC_FILENAME
install_name_tool -add_rpath @executable_path $AVCODEC_FILENAME
fi
if [ -f $AVFILTER_FILENAME ]; then
echo Found file $AVFILTER_FILENAME - changing to rpaths
chmod 755 $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libavformat.58.dylib @rpath/libavformat.58.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libavcodec.58.dylib @rpath/libavcodec.58.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libpostproc.55.dylib @rpath/libpostproc.55.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libswscale.5.dylib @rpath/libswscale.5.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libswresample.3.dylib @rpath/libswresample.3.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $AVFILTER_FILENAME
install_name_tool -change /usr/local/opt/fdk-aac/lib/libfdk-aac.2.dylib @rpath/libfdk-aac.2.dylib $AVFILTER_FILENAME
install_name_tool -add_rpath @executable_path $AVFILTER_FILENAME
fi
if [ -f $AVFORMAT_FILENAME ]; then
echo Found file $AVFORMAT_FILENAME - changing to rpaths
chmod 755 $AVFORMAT_FILENAME
install_name_tool -change /usr/local/lib/libavcodec.58.dylib @rpath/libavcodec.58.dylib $AVFORMAT_FILENAME
install_name_tool -change /usr/local/lib/libswresample.3.dylib @rpath/libswresample.3.dylib $AVFORMAT_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $AVFORMAT_FILENAME
install_name_tool -change /usr/local/opt/fdk-aac/lib/libfdk-aac.2.dylib @rpath/libfdk-aac.2.dylib $AVFORMAT_FILENAME
install_name_tool -add_rpath @executable_path $AVFORMAT_FILENAME
fi
if [ -f $POSTPROC_FILENAME ]; then
echo Found file $POSTPROC_FILENAME - changing to rpaths
chmod 755 $POSTPROC_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $POSTPROC_FILENAME
install_name_tool -add_rpath @executable_path $POSTPROC_FILENAME
fi
if [ -f $SWRESAMPLE_FILENAME ]; then
echo Found file $SWRESAMPLE_FILENAME - changing to rpaths
chmod 755 $SWRESAMPLE_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $SWRESAMPLE_FILENAME
install_name_tool -add_rpath @executable_path $SWRESAMPLE_FILENAME
fi
if [ -f $SWSCALE_FILENAME ]; then
echo Found file $SWSCALE_FILENAME - changing to rpaths
chmod 755 $SWSCALE_FILENAME
install_name_tool -change /usr/local/lib/libavutil.56.dylib @rpath/libavutil.56.dylib $SWSCALE_FILENAME
install_name_tool -add_rpath @executable_path $SWSCALE_FILENAME
fi

142
tools/macOS_dependencies_build.sh Executable file
View file

@ -0,0 +1,142 @@
#!/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"
echo "Building libpng"
cd libpng
rm -f CMakeCache.txt
cmake -DPNG_SHARED=off .
make clean
make -j${JOBS}
make install
cd ..
echo "\nBuilding FreeType"
cd freetype/build
rm -f CMakeCache.txt
cmake -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=on -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on -S .. -B .
make clean
make -j${JOBS}
cp libfreetype.6.18.0.dylib ../../../libfreetype.6.dylib
cd ../..
echo "\nBuilding FreeImage"
cd freeimage/FreeImage
make clean
make -j${JOBS}
cp libfreeimage.a ../../..
cd ../..
echo "\nBuilding pugixml"
cd pugixml
rm -f CMakeCache.txt
cmake .
make clean
make -j${JOBS}
cp libpugixml.a ../..
cd ..
echo "\nBuilding SDL"
cd SDL/build
rm -f CMakeCache.txt
cmake -S .. -B .
make clean
make -j${JOBS}
cp libSDL2-2.0.dylib ../../..
cd ../..
echo "\nBuilding FDK AAC"
cd fdk-aac
rm -f CMakeCache.txt
cmake .
make clean
make -j${JOBS}
make install
cp libfdk-aac.2.0.2.dylib ../../libfdk-aac.2.dylib
cd ..
echo "\nBuilding libvpx"
cd libvpx
./configure --disable-examples --disable-docs --enable-pic --enable-vp9-highbitdepth
make clean
make -j${JOBS}
make install
cd ..
echo "\nBuilding Ogg"
cd ogg
rm -f CMakeCache.txt
cmake .
make clean
make -j${JOBS}
make install
cd ..
echo "\nBuilding Vorbis"
cd vorbis
rm -f CMakeCache.txt
cmake -DBUILD_SHARED_LIBS=on -DCMAKE_MACOSX_RPATH=on .
make clean
make -j${JOBS}
make install
cp /usr/local/lib/libvorbisenc.2.0.12.dylib ../..
cp /usr/local/lib/libvorbis.0.4.9.dylib ../..
cd ..
echo "\nBuilding Opus"
cd opus
rm -f CMakeCache.txt
cmake .
make clean
make -j${JOBS}
make install
cd ..
echo "\nBuilding FFmpeg"
cd FFmpeg
./configure --prefix=/usr/local --enable-rpath --install-name-dir=@rpath --disable-doc --enable-gpl --enable-nonfree --enable-shared --enable-libvorbis --enable-libopus --enable-libfdk-aac --enable-libvpx --enable-postproc
make clean
make -j${JOBS}
install_name_tool -rpath /usr/local/lib @executable_path libavcodec/libavcodec.58.dylib
cp libavcodec/libavcodec.58.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libavfilter/libavfilter.7.dylib
cp libavfilter/libavfilter.7.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libavformat/libavformat.58.dylib
cp libavformat/libavformat.58.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libavutil/libavutil.56.dylib
cp libavutil/libavutil.56.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libpostproc/libpostproc.55.dylib
cp libpostproc/libpostproc.55.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libswresample/libswresample.3.dylib
cp libswresample/libswresample.3.dylib ../..
install_name_tool -rpath /usr/local/lib @executable_path libswscale/libswscale.5.dylib
cp libswscale/libswscale.5.dylib ../..

181
tools/macOS_dependencies_setup.sh Executable file
View file

@ -0,0 +1,181 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
#
# EmulationStation Desktop Edition
# macOS_dependencies_setup.sh
#
# Downloads and prepares the external dependencies for building in-tree.
# If the directories already exist they will be removed and the source code will be downloaded again.
#
# This script needs to run from the root of the repository.
#
if [ ! -f .clang-format ]; then
echo "You need to run this script from the root of the repository."
exit
fi
echo "Setting up dependencies in the ./external directory...\n"
cd external
echo "Setting up libpng"
rm -rf libpng
git clone https://git.code.sf.net/p/libpng/code.git
mv code libpng
cd libpng
git checkout v1.6.37
cd ..
echo "\nSetting up FreeType"
rm -rf freetype
git clone https://github.com/freetype/freetype.git
cd freetype
git checkout VER-2-11-0
mkdir build
cd ..
echo "\nSetting up FreeImage"
rm -rf freeimage
mkdir freeimage
cd freeimage
curl -O http://deac-ams.dl.sourceforge.net/project/freeimage/Source%20Distribution/3.18.0/FreeImage3180.zip
unzip FreeImage3180.zip
cd FreeImage
# We need to set the LC_CTYPE variable to C or we won't be able to strip out multi-byte characters using "tr".
export LC_CTYPE=C
tr -d '\r' < Source/LibJXR/jxrgluelib/JXRGlueJxr.c > Source/LibJXR/jxrgluelib/JXRGlueJxr.c_PATCH
mv Source/LibJXR/jxrgluelib/JXRGlueJxr.c_PATCH Source/LibJXR/jxrgluelib/JXRGlueJxr.c
cat << EOF | patch Source/LibJXR/jxrgluelib/JXRGlueJxr.c
--- JXRGlueJxr.c 2021-11-28 10:31:52.000000000 +0100
+++ JXRGlueJxr.c_macOS 2021-11-30 16:56:40.000000000 +0100
@@ -28,7 +28,7 @@
//*@@@---@@@@******************************************************************
#include <limits.h>
#include <JXRGlue.h>
-
+#include <wchar.h>
static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
const U32 IFDEntryTypeSizes[] = { 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8 };
EOF
tr -d '\r' < Source/LibJXR/image/decode/segdec.c > Source/LibJXR/image/decode/segdec.c_PATCH
mv Source/LibJXR/image/decode/segdec.c_PATCH Source/LibJXR/image/decode/segdec.c
cat << EOF | patch Source/LibJXR/image/decode/segdec.c
--- segdec.c 2021-11-30 15:52:10.000000000 +0100
+++ segdec.c_macOS 2021-11-30 15:46:06.000000000 +0100
@@ -52,6 +52,25 @@
//================================================================
// Memory access functions
//================================================================
+#if (defined(WIN32) && !defined(UNDER_CE) && (!defined(__MINGW32__) || defined(__MINGW64_TOOLCHAIN__))) || (defined(UNDER_CE) && defined(_ARM_))
+// WinCE ARM and Desktop x86
+#else
+// other platform
+#ifdef _BIG__ENDIAN_
+#define _byteswap_ulong2(x) (x)
+#else // _BIG__ENDIAN_
+U32 _byteswap_ulong2(U32 bits)
+{
+ U32 r = (bits & 0xffu) << 24;
+ r |= (bits << 8) & 0xff0000u;
+ r |= ((bits >> 8) & 0xff00u);
+ r |= ((bits >> 24) & 0xffu);
+
+ return r;
+}
+#endif // _BIG__ENDIAN_
+#endif
+
static U32 _FORCEINLINE _load4(void* pv)
{
#ifdef _BIG__ENDIAN_
@@ -61,9 +80,9 @@
U32 v;
v = ((U16 *) pv)[0];
v |= ((U32)((U16 *) pv)[1]) << 16;
- return _byteswap_ulong(v);
+ return _byteswap_ulong2(v);
#else // _M_IA64
- return _byteswap_ulong(*(U32*)pv);
+ return _byteswap_ulong2(*(U32*)pv);
#endif // _M_IA64
#endif // _BIG__ENDIAN_
}
EOF
cat << EOF | patch Makefile.osx -
--- Makefile.osx 2021-11-30 15:06:53.000000000 +0100
+++ Makefile.osx_macOS 2021-11-30 15:07:23.000000000 +0100
@@ -15,7 +15,7 @@
CPP_I386 = \$(shell xcrun -find clang++)
CPP_X86_64 = \$(shell xcrun -find clang++)
MACOSX_DEPLOY = -mmacosx-version-min=\$(MACOSX_DEPLOYMENT_TARGET)
-COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__
+COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__ -DHAVE_UNISTD_H -DDISABLE_PERF_MEASUREMENT
COMPILERFLAGS_I386 = -arch i386
COMPILERFLAGS_X86_64 = -arch x86_64
COMPILERPPFLAGS = -Wno-ctor-dtor-privacy -D__ANSI__ -std=c++11 -stdlib=libc++ -Wc++11-narrowing
EOF
cd ../..
echo "\nSetting up pugixml"
rm -rf pugixml
git clone git://github.com/zeux/pugixml.git
cd pugixml
git checkout v1.11.4
cd ..
echo "\nSetting up SDL"
rm -rf SDL
git clone https://github.com/libsdl-org/SDL.git
cd SDL
git checkout release-2.0.16
ln -s include SDL2
mkdir build
cd ..
echo "\nSetting up FDK AAC"
rm -rf fdk-aac
git clone https://git.code.sf.net/p/opencore-amr/fdk-aac.git
cd fdk-aac
git checkout v2.0.2
cd ..
echo "\nSetting up libvpx"
rm -rf libvpx
git clone https://github.com/webmproject/libvpx.git
cd libvpx
git checkout v1.11.0
cd ..
echo "\nSetting up Ogg"
rm -rf ogg
git clone https://github.com/xiph/ogg.git
cd ogg
git checkout v1.3.5
cd ..
echo "\nSetting up Vorbis"
rm -rf vorbis
git clone https://gitlab.xiph.org/xiph/vorbis.git
cd vorbis
git checkout v1.3.7
cd ..
echo "\nSetting up Opus"
rm -rf opus
git clone https://gitlab.xiph.org/xiph/opus.git
cd opus
git checkout v1.3.1
cd ..
echo "\nSetting up FFmpeg"
rm -rf FFmpeg
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
git checkout n4.4.1