# Description: Library for YUV scaling
# URL: https://chromium.googlesource.com/libyuv/libyuv/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: libjpeg-turbo

name=libyuv
version=1813
release=1
_commit=3aebf69d668177e7ee6dbbe0025e5c3dbb525ff2
source=(https://chromium.googlesource.com/libyuv/libyuv/+archive/$_commit.tar.gz)
renames=($name-$version.tar.gz)

build() {
  sed -i 's|yuvconvert ${JPEG_LIBRARY}|${ly_lib_shared} ${JPEG_LIBRARY}|' CMakeLists.txt
  cmake -S . -B build -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_INSTALL_LIBDIR=lib \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
    -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
    -Wno-dev

  cmake --build build
  DESTDIR=$PKG cmake --install build
}