# SPDX-FileCopyrightText: 2022 George Florea Bănuș <georgefb899@gmail.com>
# SPDX-License-Identifier: CC0-1.0
app-id: org.kde.haruna
runtime: org.kde.Platform
runtime-version: 5.15-22.08
sdk: org.kde.Sdk
command: haruna
rename-icon: haruna
copy-icon: true
finish-args:
  - --share=ipc
  - --share=network
  - --socket=fallback-x11
  - --socket=wayland
  - --socket=pulseaudio
  - --device=dri
  - --filesystem=host:ro
  - --filesystem=home
  - --filesystem=xdg-run/pipewire-0:ro
  - --talk-name=org.freedesktop.ScreenSaver
  - --own-name=org.mpris.MediaPlayer2.haruna
  - --env=LC_NUMERIC=C
cleanup:
  - '*.a'
  - '*.la'
  - /include
  - /lib/cmake
  - /lib/pkgconfig
  - /share/man
modules:
  - name: haruna
    buildsystem: cmake-ninja
    sources:
      - type: dir
        path: '.'
    modules:
      - name: libmpv
        cleanup:
          - /share/bash-completion
          - /share/zsh
          - /share/doc
          - /share/icons
          - /share/applications
        buildsystem: meson
        config-opts:
          - -Dlibmpv=true
          - -Dlua=enabled
          - -Ddebug=false
          - -Dbuild-date=false
          - -Dalsa=disabled
          - -Dmanpage-build=disabled
        sources:
          - type: archive
            url: https://github.com/mpv-player/mpv/archive/refs/tags/v0.36.0.tar.gz
            sha256: 29abc44f8ebee013bb2f9fe14d80b30db19b534c679056e4851ceadf5a5e8bf6
            x-checker-data:
              type: anitya
              project-id: 5348
              stable-only: true
              url-template: https://github.com/mpv-player/mpv/archive/refs/tags/v$version.tar.gz
        modules:
          - name: luajit
            no-autogen: true
            cleanup:
              - /bin
              - /lib/*.a
              - /include
              - /lib/pkgconfig
              - /share/man
            sources:
              - type: archive
                url: https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
                sha256: 1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3
              - type: shell
                commands:
                  - sed -i 's|/usr/local|/app|' ./Makefile

          - name: libXpresent
            buildsystem: autotools
            sources:
              - type: archive
                url: https://xorg.freedesktop.org/archive/individual/lib/libXpresent-1.0.1.tar.xz
                sha256: b964df9e5a066daa5e08d2dc82692c57ca27d00b8cc257e8e960c9f1cf26231b
                x-checker-data:
                  type: anitya
                  project-id: 17166
                  stable-only: true
                  url-template: https://xorg.freedesktop.org/archive/individual/lib/libXpresent-$version.tar.xz

          - name: libv4l2
            cleanup:
              - /sbin
              - /bin
            config-opts:
              - --disable-static
              - --disable-bpf
              - --with-udevdir=/app/lib/udev
            sources:
              - type: archive
                url: https://linuxtv.org/downloads/v4l-utils/v4l-utils-1.24.1.tar.bz2
                sha256: cbb7fe8a6307f5ce533a05cded70bb93c3ba06395ab9b6d007eb53b75d805f5b
                x-checker-data:
                  type: anitya
                  project-id: 9998
                  stable-only: true
                  url-template: https://linuxtv.org/downloads/v4l-utils/v4l-utils-$version.tar.bz2

          - name: nv-codec-headers
            cleanup:
              - '*'
            no-autogen: true
            make-install-args:
              - PREFIX=/app
            sources:
              - type: archive
                url: https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n12.0.16.0.tar.gz
                sha256: 2a1533b65f55f9da52956faf0627ed3b74868ac0c7f269990edd21369113b48f
                x-checker-data:
                  type: anitya
                  project-id: 223796
                  stable-only: true
                  url-template: https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n$version.tar.gz

          - name: ffmpeg
            cleanup:
              - /share/ffmpeg/examples
            config-opts:
              - --disable-debug
              - --disable-doc
              - --disable-programs
              - --disable-static
              - --disable-encoders
              - --disable-muxers
              - --enable-shared
              - --enable-gnutls
              - --enable-gpl
              - --enable-version3
              - --enable-encoder=png,libwebp,libjxl
              - --enable-libv4l2
              - --enable-libdav1d
              - --enable-libfontconfig
              - --enable-libfreetype
              - --enable-libopus
              - --enable-librsvg
              - --enable-libvpx
              - --enable-libmp3lame
              - --enable-libwebp
              - --enable-libjxl
            sources:
              - type: archive
                url: https://ffmpeg.org/releases/ffmpeg-6.0.tar.gz
                sha256: f4ccf961403752c93961927715f524576d1f4dd02cd76d8c76aed3bbe6686656
                x-checker-data:
                  type: anitya
                  project-id: 5405
                  stable-only: true
                  url-template: https://ffmpeg.org/releases/ffmpeg-$version.tar.gz
            modules:
              - name: libjxl
                buildsystem: cmake-ninja
                config-opts:
                  - -DBUILD_TESTING=OFF
                  - -DJPEGXL_ENABLE_BENCHMARK=OFF
                  - -DJPEGXL_ENABLE_COVERAGE=OFF
                  - -DJPEGXL_ENABLE_EXAMPLES=OFF
                  - -DJPEGXL_ENABLE_FUZZERS=OFF
                  - -DJPEGXL_ENABLE_JNI=OFF
                  - -DJPEGXL_ENABLE_SJPEG=OFF
                  - -DJPEGXL_ENABLE_SKCMS=OFF
                  - -DJPEGXL_ENABLE_TOOLS=OFF
                  - -DJPEGXL_ENABLE_VIEWERS=OFF
                sources:
                  - type: archive
                    url: https://github.com/libjxl/libjxl/archive/refs/tags/v0.9-snapshot.tar.gz
                    sha256: 2177f72fb141dce69d071c24864fbebc9aa7133e8dda212783609e1996024078
                    x-checker-data:
                      type: anitya
                      project-id: 232764
                      stable-only: true
                      url-template: https://github.com/libjxl/libjxl/archive/refs/tags/v$version.tar.gz
                modules:
                  - name: highway
                    buildsystem: cmake-ninja
                    config-opts:
                      - -DCMAKE_BUILD_TYPE=RelWithDebInfo
                      - -DBUILD_TESTING=OFF
                      - -DBUILD_SHARED_LIBS=ON
                    sources:
                      - type: archive
                        url: https://github.com/google/highway/archive/refs/tags/1.0.7.tar.gz
                        sha256: 5434488108186c170a5e2fca5e3c9b6ef59a1caa4d520b008a9b8be6b8abe6c5
                        x-checker-data:
                          type: anitya
                          project-id: 205809
                          stable-only: true
                          url-template: https://github.com/google/highway/archive/refs/tags/$version.tar.gz

          - name: libass
            config-opts:
              - --disable-static
            sources:
              - type: archive
                url: https://github.com/libass/libass/releases/download/0.17.1/libass-0.17.1.tar.gz
                sha256: d653be97198a0543c69111122173c41a99e0b91426f9e17f06a858982c2fb03d
                x-checker-data:
                  type: anitya
                  project-id: 1560
                  stable-only: true
                  url-template: https://github.com/libass/libass/releases/download/$version/libass-$version.tar.gz

          - name: uchardet
            buildsystem: cmake-ninja
            config-opts:
              - -DCMAKE_BUILD_TYPE=Release
              - -DBUILD_STATIC=0
            cleanup:
              - /bin
            sources:
              - type: archive
                url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz
                sha256: e97a60cfc00a1c147a674b097bb1422abd9fa78a2d9ce3f3fdcc2e78a34ac5f0
                x-checker-data:
                  type: anitya
                  project-id: 9265
                  stable-only: true
                  url-template: https://www.freedesktop.org/software/uchardet/releases/uchardet-$version.tar.xz

      - name: yt-dlp
        no-autogen: true
        no-make-install: true
        make-args:
          - yt-dlp
          - PYTHON=/usr/bin/python3
        post-install:
          - install yt-dlp /app/bin
        sources:
          - type: archive
            url: https://github.com/yt-dlp/yt-dlp/archive/refs/tags/2023.07.06.tar.gz
            sha256: dcb9dd73745b647756d3b23b705514affe456253e482f0f0a1b5be84e9e29208
            x-checker-data:
              type: anitya
              project-id: 143399
              stable-only: true
              url-template: https://github.com/yt-dlp/yt-dlp/archive/refs/tags/$version.tar.gz
