Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

cloned fromhttps://github.com/shinchiro/mpv-winbuild-cmake with custom patches and smaller binaries

NotificationsYou must be signed in to change notification settings

myfreeer/mpv-build-lite

Repository files navigation

This thing’s primary use is to build Windows binaries of mpv.

Alternatively, you can download the builds fromhere.

Prerequisites

  • You should also install Ninja and use CMake’s Ninja build file generator.It’s not only much faster than GNU Make, but also far less error-prone,which is important for this project because CMake’s ExternalProject moduletends to generate makefiles which confuse GNU Make’s jobserver thingy.

  • As a build environment, any modern Linux distributionshould work.

  • Compiling on Cygwin / MSYS2 is supported, but it tends to be slowerthan compiling on Linux.

Setup Build Environment

Manjaro / Arch Linux

These packages need to be installed first before compiling mpv:

pacman -S git gyp mercurial subversion ninja cmake meson ragel yasm nasm asciidoc enca gperf unzip p7zip gcc-multilib clang lld libc++ libc++abi python-pip curl lib32-gcc-libs lib32-glib2 mimalloc ccachepip3 install rst2pdf mako jsonschemapacman -S llvm # needed for building LLVM PGO

Ubuntu Linux / WSL (Windows 10)

apt-get install build-essential checkinstall bison flex gettext git mercurial subversion ninja-build gyp cmake yasm nasm automake pkgconf libtool libtool-bin gcc-multilib g++-multilib clang lld libc++1 libc++abi1 libgmp-dev libmpfr-dev libmpc-dev libgcrypt-dev gperf ragel texinfo autopoint re2c asciidoc python3-pip docbook2x unzip p7zip-full curl mimalloc ccachepip3 install rst2pdf meson mako jsonschema

Note:

  • Useapt-fast if apt-get is too slow.
  • It is advised to use bash over dash. Setsudo ln -sf /bin/bash /bin/sh. Revert back bysudo ln -sf /bin/dash /bin/sh.
  • On WSL platform, compiling 32bit requires qemu. Refer tothis.
  • To update package installed by pip, runpip3 install <package> --upgrade.

Cygwin

Download Cygwin installer and run:

setup-x86_64.exe -R "C:\cygwin64" -q --packages="bash,binutils,bzip2,cygwin,gcc-core,gcc-g++,cygwin32-gcc-core,cygwin32-gcc-g++,gzip,m4,pkgconf,make,unzip,zip,diffutils,wget,git,patch,cmake,gperf,yasm,enca,asciidoc,bison,flex,gettext-devel,mercurial,python-devel,python-docutils,docbook2X,texinfo,libmpfr-devel,libgmp-devel,libmpc-devel,libtool,autoconf2.5,automake,automake1.9,libxml2-devel,libxslt-devel,meson,libunistring5"

Additionally, some packages,re2c,ninja,ragel,gyp,rst2pdf,nasm need to beinstalled manually.

MSYS2

Install MSYS2 and run it viaMSYS2 MSYS shortcut.Don't useMSYS2 MinGW 32-bit orMSYS2 MinGW 64-bit shortcuts, that's important!

These packages need to be installed first before compiling mpv:

pacman -S base-devel cmake gcc yasm nasm git mercurial subversion gyp tar gmp-devel mpc-devel mpfr-devel python zlib-devel unzip zip p7zip meson libunistring5

Don't install anything from themingw32 andmingw64 repositories,it's better to completely disable them in/etc/pacman.conf just to be safe.

Additionally, some packages,re2c,ninja,ragel,libjpeg,rst2pdf,jinja2 need to beinstalled manually.

Compiling with GCC

Example:

cmake -DTARGET_ARCH=x86_64-w64-mingw32 \-DGCC_ARCH=x86-64-v3 \-DSINGLE_SOURCE_LOCATION="/home/user/packages" \-DRUSTUP_LOCATION="/home/user/install_rustup" \-G Ninja -B build64 -S mpv-winbuild-cmake

This cmake command will createbuild64 folder forx86_64-w64-mingw32. Set-DTARGET_ARCH=i686-w64-mingw32 for compiling 32-bit.

-DGCC_ARCH=x86-64-v3 will set-march option when compiling gcc withx86-64-v3 instructions. Other value likenative,znver3 should work too.

Enterbuild64 folder and build toolchain once. By default, it will be installed ininstall folder.

ninja download # download all packages at once (optional)ninja gcc      # build gcc only once (take around ~20 minutes)ninja mpv      # build mpv and all its dependencies

OnWSL2, you might see it stuck with 100% disk usage and never finished. Seebelow.

The finalbuild64 folder's size will be around ~3GB.

Building Software (Second Time)

To build mpv for a second time:

ninja update # perform git pull on all packages that used git

After that, build mpv as usual:

ninja mpv

Compiling with Clang

Supported target architecture (TARGET_ARCH) with clang is:x86_64-w64-mingw32 ,i686-w64-mingw32 ,aarch64-w64-mingw32. Theaarch64 are untested.

Example:

cmake -DTARGET_ARCH=x86_64-w64-mingw32 \-DCMAKE_INSTALL_PREFIX="/home/user/clang_root" \-DCOMPILER_TOOLCHAIN=clang \-DGCC_ARCH=x86-64-v3 \-DSINGLE_SOURCE_LOCATION="/home/user/packages" \-DRUSTUP_LOCATION="/home/user/install_rustup" \-DMINGW_INSTALL_PREFIX="/home/user/build_x86_64_v3/x86_64_v3-w64-mingw32" \-G Ninja -B build_x86_64_v3 -S mpv-winbuild-cmake

The cmake command will createclang_root as clang sysroot where llvm tools installed.build_x86_64 is build directory to compiling packages.

cd build_x86_64ninja llvm       # build LLVM (take around ~2 hours)ninja rustup     # build rust toolchainninja llvm-clang # build clang on specified targetninja mpv        # build mpv and all its dependencies

If you want add another target (ex.i686-w64-mingw32), changeTARGET_ARCH and build folder.

cmake -DTARGET_ARCH=i686-w64-mingw32 \-DCMAKE_INSTALL_PREFIX="/home/user/clang_root" \-DCOMPILER_TOOLCHAIN=clang \-DSINGLE_SOURCE_LOCATION="/home/user/packages" \-DRUSTUP_LOCATION="/home/user/install_rustup" \-DMINGW_INSTALL_PREFIX="/home/user/build_i686/i686-w64-mingw32" \-G Ninja -B build_i686 -S mpv-winbuild-cmakecd build_i686ninja llvm-clang # same as above

If you've changedGCC_ARCH option, you need to run:

ninja rebuild_cache

to update flags which will pass on gcc, g++ and etc.

Available Commands

CommandsDescription
ninja packagecompile a package
ninja cleanremove all stamp files in all packages.
ninja downloadDownload all packages' sources at once without compiling.
ninja updateUpdate all git repos. When a package pulls new changes, all of its stamp files will be deleted and will be forced rebuild. If there is no change, it will not remove the stamp files and no rebuild occur. Use this instead ofninja clean if you don't want to rebuild everything in the next run.
ninja package-fullcleanRemove all stamp files of a package.
ninja package-litecleanRemove build, clean stamp files only. This will skip re-configure in the next runningninja package (after the first compile). Updating repo or patching need to do manually. Ideally, allDEPENDS targets inpackage.cmake should be temporarily commented or deleted. Might be useful in some cases.
ninja package-removebuildRemove 'build' directory of a package.
ninja package-removeprefixRemove 'prefix' directory.
ninja package-force-updateUpdate a package. Only git repo will be updated.

package is package's name found inpackages folder.

Information about packages

  • Git/Hg

    • ANGLE
    • FFmpeg
    • xz
    • x264
    • x265 (multilib)
    • uchardet
    • rubberband (with libsamplerate)
    • opus
    • openal-soft
    • mpv
    • luajit
    • libvpx
    • libwebp
    • libpng
    • libsoxr
    • libzimg (with graphengine)
    • libdvdread
    • libdvdnav
    • libdvdcss
    • libudfread
    • libbluray
    • libunibreak
    • libass
    • libmysofa
    • lcms2
    • lame
    • harfbuzz
    • game-music-emu
    • freetype2
    • flac
    • opus-tools
    • mujs
    • libarchive
    • libjpeg
    • shaderc (with spirv-headers, spirv-tools, glslang)
    • vulkan-header
    • vulkan
    • spirv-cross
    • fribidi
    • nettle
    • curl
    • libxml2
    • amf-headers
    • avisynth-headers
    • nvcodec-headers
    • libvpl
    • megasdk (with termcap, readline, cryptopp, sqlite, libuv, libsodium)
    • aom
    • dav1d
    • libplacebo (with glad, fast_float, xxhash)
    • fontconfig
    • libbs2b
    • libssh
    • libsrt
    • libjxl (with brotli, highway)
    • libmodplug
    • uavs3d
    • davs2
    • libsixel
    • libdovi
    • libva
    • libzvbi
    • svtav1
    • libaribcaption
    • zlib (zlib-ng)
    • zstd
    • expat
    • openssl
    • libsdl2
    • speex
    • vorbis
    • ogg
    • bzip2
  • Zip

    • xvidcore (1.3.7)
    • lzo (2.10)
    • libopenmpt (0.7.12)
    • libiconv (1.18)
    • gmp (6.3.0)
    • vapoursynth (R65/R63)
    • mbedtls (3.5.0)
    • libressl (3.1.5)

WSL workaround

Place the file on specified location to limit ram & cpu usage to avoid getting stuck while building mpv.

# /etc/wsl.conf[interop]#enabled=falseappendWindowsPath=false[automount]enabled = trueoptions = "metadata"mountFsTab = false[user]default=<user>---------------------------------------# C:\Users\<UserName>\.wslconfig[wsl2]memory=4GBswap=0pageReporting=false

Acknowledgements

This project was originally created and maintainedlachs0r. Since then, it heavily modified to suit my own need.

Removed

  • video encoders:
    • libvpx
    • x265
    • aom
    • xvidcore
  • vapoursynth
  • libjxl
  • libwebp
  • libsdl2
  • libvorbis
  • openal-soft
  • libmodplug
  • mbedtls
  • libssh
  • libsrt
  • nettle
  • fontconfig
  • uavs3d
  • davs2
  • libopenmpt

[8]ページ先頭

©2009-2025 Movatter.jp