89 lines
2.8 KiB
Bash
89 lines
2.8 KiB
Bash
# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
|
|
# you also find the URL of a binary repository.
|
|
|
|
_name=mpv
|
|
pkgname=mingw-w64-mpv
|
|
pkgver=0.29.1
|
|
pkgrel=1
|
|
epoch=1
|
|
pkgdesc="Video player based on MPlayer/mplayer2 (mingw-w64)"
|
|
arch=('any')
|
|
url="https://mpv.io"
|
|
license=('GPL3')
|
|
depends=(
|
|
'mingw-w64-crt' 'mingw-w64-lcms2' 'mingw-w64-enca'
|
|
'mingw-w64-libjpeg-turbo' 'mingw-w64-ffmpeg' 'mingw-w64-libass'
|
|
'mingw-w64-angleproject' 'mingw-w64-lua' 'mingw-w64-zlib'
|
|
)
|
|
options=(!strip !buildflags staticlibs)
|
|
makedepends=('mingw-w64-gcc' 'mingw-w64-pkg-config' 'python')
|
|
source=("$_name-$pkgver.tar.gz::https://github.com/mpv-player/$_name/archive/v$pkgver.tar.gz")
|
|
sha256sums=('f9f9d461d1990f9728660b4ccb0e8cb5dce29ccaa6af567bec481b79291ca623')
|
|
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
|
|
|
|
prepare() {
|
|
cd "$srcdir/${_name}-${pkgver}"
|
|
|
|
./bootstrap.py
|
|
}
|
|
|
|
build() {
|
|
cd "$srcdir/${_name}-${pkgver}"
|
|
|
|
local mingw_flags="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
|
|
local mingw_c_flags="$mingw_flags $CFLAGS"
|
|
local mingw_cxx_flags="$mingw-flags $CXXFLAGS"
|
|
export DEST_OS=win32
|
|
|
|
for _arch in ${_architectures}; do
|
|
export TARGET=$_arch
|
|
export CFLAGS="$mingw_c_flags -I$PWD/build"
|
|
export CXXFLAGS="$mingw_cxx_flags -I$PWD/build"
|
|
|
|
# build static libmpv
|
|
mkdir -p build
|
|
for header in gmp{,xx}; do
|
|
cp "/usr/$_arch/include/$header-static.h" "build/$header.h"
|
|
done
|
|
./waf configure \
|
|
--prefix=/usr/$_arch \
|
|
--confdir=../etc/mpv \
|
|
--enable-libmpv-static --enable-static \
|
|
-v
|
|
export LDFLAGS="-Wl,-Bstatic -lavfilter -lavcodec -lavformat -lavutil -lass -lfribidi -lbluray -lxml -lvidstab -lsoxr -lomp -lgnutls -lnettle -lunistring -ltasn -lgmp -lp11kit -lssh -lcrypto -lSDL2 -lhid -lsetupapi -limm32 -lcrypt32"
|
|
./waf build -v
|
|
|
|
# don't override static mpv.exe
|
|
mv build/mpv{,-static}.exe
|
|
|
|
# build shared libmpv
|
|
export LDFLAGS=""
|
|
./waf configure \
|
|
--prefix=/usr/$_arch \
|
|
--confdir=../etc/mpv \
|
|
--enable-libmpv-shared \
|
|
-v
|
|
./waf build -v
|
|
|
|
# I don't know how to do an out-of-source tree build with waf
|
|
# since waf creates a dir called build I use this workaround
|
|
mv build build-${_arch}
|
|
done
|
|
}
|
|
|
|
package() {
|
|
for _arch in ${_architectures}; do
|
|
cd "$srcdir/${_name}-${pkgver}/build-${_arch}"
|
|
|
|
mkdir -p "$pkgdir/usr/$_arch/"{bin,lib/pkgconfig/mpv,include/mpv}
|
|
cp *.exe *.dll "$pkgdir/usr/$_arch/bin/"
|
|
cp *.a "$pkgdir/usr/$_arch/lib/"
|
|
cp libmpv/*.pc "$pkgdir/usr/$_arch/lib/pkgconfig/mpv/"
|
|
cp ../libmpv/*.h ../libmpv/*.hpp "$pkgdir/usr/$_arch/include/mpv/"
|
|
${_arch}-strip --strip-all "${pkgdir}/usr/${_arch}/bin/"*.exe
|
|
${_arch}-strip --strip-unneeded "${pkgdir}/usr/${_arch}/bin/"*.dll
|
|
${_arch}-strip -g "${pkgdir}/usr/${_arch}/lib/"*.a
|
|
|
|
done
|
|
}
|