Skip to content

Building mpv and libmpv using wsl2 and Ubuntu

stax76 edited this page Jul 26, 2022 · 3 revisions

Regular Builds

https://sourceforge.net/projects/mpv-player-windows/files/

https://github.com/shinchiro/mpv-winbuild-cmake/releases

https://github.com/zhongfly/mpv-winbuild/releases

Debug build 2022-07-26

https://www.mediafire.com/file/6x3sba12x7y7dq6/mpv-debug-2022-07-26.7z/file

Guide

The guide below is for making limited builds, for instance, in order to try a pull request.

# Installing MXE requirements for Debian and derivates,
# for other distros see here: https://mxe.cc/#requirements

sudo apt install \
    autoconf \
    automake \
    autopoint \
    bash \
    bison \
    bzip2 \
    flex \
    g++ \
    g++-multilib \
    gettext \
    git \
    gperf \
    intltool \
    libc6-dev-i386 \
    libgdk-pixbuf2.0-dev \
    libltdl-dev \
    libssl-dev \
    libtool-bin \
    libxml-parser-perl \
    lzip \
    make \
    openssl \
    p7zip-full \
    patch \
    perl \
    python3 \
    python3-mako \
    ruby \
    sed \
    unzip \
    wget \
    xz-utils

# Change dir to home
cd ~

# Clone MXE
git clone https://github.com/mxe/mxe.git

# Change dir to mxe dir
cd mxe

# The JOBS environment variable controls threads to use
echo "JOBS := 4" >> settings.mk

# The MXE_TARGET environment variable
echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk

# Make basic tools
make cc

# Build required packages
make gcc ffmpeg libass jpeg lua luajit

# Add MXE binaries to $PATH
PATH=~/mxe/usr/bin/:$PATH

# Change dir to home
cd ~

# Clone mpv
git clone https://github.com/mpv-player/mpv.git

# Change dir to mpv
cd mpv

# Checkout particular pull request:
# git fetch origin pull/123/head:pr/123 && git checkout pr/123

# Download waf
python3 ./bootstrap.py

# For mpv
DEST_OS=win32 TARGET=x86_64-w64-mingw32.static ./waf configure

# For libmpv
# DEST_OS=win32 TARGET=x86_64-w64-mingw32.static ./waf configure --enable-static-build --enable-libmpv-shared

# Debug instead of release build
# CFLAGS="-g2 -O0"

./waf build

# Compiled files are here: ./build