##
##  dav1d.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_opkg 1.5.1
%define       V_snap 20250120

#   package information
Name:         dav1d
Summary:      AV1 Video Codec Library
URL:          https://code.videolan.org/videolan/dav1d
Vendor:       VideoLAN
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Video
License:      BSD
Version:      %{V_opkg}.%{V_snap}
Release:      20250120

#   list of sources
Source0:      http://download.openpkg.org/components/versioned/dav1d/dav1d-%{V_snap}.tar.xz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, gcc, meson, ninja, nasm
PreReq:       OpenPKG, openpkg >= 20160101

%description
    DAV1D is clean-room implementation of an AOMedia Video 1 (AV1)
    decoder library.

%track
    prog dav1d:base = {
        version   = %{V_opkg}
        url       = https://code.videolan.org/videolan/dav1d/-/tags
        regex     = tags/(\d+\.\d+\.\d+)
    }
    prog dav1d:snap = {
        version   = %{V_snap}
        url       = http://download.openpkg.org/components/versioned/dav1d/
        regex     = dav1d-(__VER__)\.tar\.xz
    }

%prep
    %setup -q -n dav1d

%build
    meson build \
        --prefix %{l_prefix} \
        --buildtype release \
        --default-library static \
        --backend ninja \
        -Denable_tests=false
    ninja -C build

%install
    DESTDIR=$RPM_BUILD_ROOT ninja -C build install
    mv  $RPM_BUILD_ROOT%{l_prefix}/libdata/pkgconfig \
        $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
    rmdir $RPM_BUILD_ROOT%{l_prefix}/libdata
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

