Skip to content

Instantly share code, notes, and snippets.

@Akczht
Last active December 30, 2024 22:01
Show Gist options
  • Save Akczht/4fe22774d52c1d965de150650449ab49 to your computer and use it in GitHub Desktop.
Save Akczht/4fe22774d52c1d965de150650449ab49 to your computer and use it in GitHub Desktop.
How to compile mpv.app on macOS
#!/bin/bash
set -e
findcd() {
local search_string="$1"
target_dir=$(find . -maxdepth 1 -type d -name "$search_string*" -print -quit)
if [ -n "$target_dir" ]; then
cd "$target_dir"
else
echo "Directory not found in current directory"
fi
}
# Compiling pkg-config
findcd "pkg-config"
CFLAGS="-g -O2 -Wno-int-conversion" ./configure --with-internal-glib --disable-debug
make -j 10
sudo make install
cd ..
# Compiling m4
findcd "m4"
./configure
make -j 10
sudo make install
cd ..
# Compiling gettext
findcd "gettext"
./configure --with-included-glib --with-included-libcroco --with-included-libunistring --with-included-libxml --with-included-gettext --with-emacs --disable-silent-rules --disable-java --disable-csharp --without-xz --without-git --without-cvs
make -j 10
sudo make install
cd ..
# Compiling libtool
findcd "libtool"
./configure --enable-ltdl-install
make -j 10
sudo make install
cd ..
# Compiling autoconf
findcd "autoconf"
./configure
make -j 10
sudo make install
cd ..
# Compiling automake
findcd "automake"
./configure
make -j 10
sudo make install
cd ..
# Compiling zimg
findcd "zimg"
./autogen.sh
./configure
make -j 10
sudo make install
cd ..
# Compiling zlib
findcd "zlib"
./configure --static
make -j 10
sudo make install
cd ..
# Compiling lua
findcd "lua"
make macosx -j 10
sudo make install
cd ..
# Compiling cmake
findcd "cmake"
./configure
make -j 10
sudo make install
cd ..
# Compiling uchardet
findcd "uchardet"
cmake . -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install
cd ..
# Compiling pcre2
findcd "pcre2"
cmake . -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install
cd ..
# Compiling libiconv
findcd "libiconv"
./configure --enable-static --disable-shared --enable-relocatable
make -j 10
sudo make install
cd ..
# Compiling libunibreak
findcd "libunibreak"
./configure
make -j 10
sudo make install
cd ..
# Compiling brotli
findcd "brotli"
cmake . -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install
cd ..
# Compiling libpng
findcd "libpng"
cmake . -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install
cd ..
# Compiling fribidi
findcd "fribidi"
meson setup build --prefer-static
meson compile -C build
meson install -C build
cd ..
# Compiling harfbuzz
findcd "harfbuzz"
meson setup build --prefer-static
meson compile -C build
meson install -C build
cd ..
# Compiling freetype
findcd "freetype"
meson setup build
meson compile -C build
meson install -C build
cd ..
# Compiling libass
findcd "libass"
meson setup build --prefer-static
meson compile -C build
meson install -C build
cd ..
# Compiling lcms2
findcd "lcms"
meson setup build --prefer-static
meson compile -C build
meson install -C build
cd ..
# Compiling shaderc
findcd "shaderc"
./utils/git-sync-deps
./utils/add_copyright.py
cmake -GNinja -DCMAKE_BUILD_TYPE=Release .
ninja
sudo cmake --install .
cd ..
# Compiling libplacebo
findcd "libplacebo"
git clone --recursive https://code.videolan.org/videolan/libplacebo
git submodule update --init
meson setup build --prefer-static
meson compile -C build
meson install -C build
cd ..
# Compiling ffmpeg
findcd "ffmpeg"
./configure --enable-static --disable-shared --enable-neon --enable-gpl --enable-version3 --enable-securetransport --enable-videotoolbox --enable-audiotoolbox --enable-coreimage --enable-metal --enable-avfoundation --enable-opencl
make -j 10
sudo make install
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment