%global debug_package %{nil}
Name: uke-video-integration
Version: 1.0.0
Release: 1%{?dist}
Summary: Uke video-integration package selection and source family
License: MIT
URL: https://github.com/MCC45TR/uke-linux-hardware-support
Source0: uke-video-integration-1.0.0.tar.xz
ExclusiveArch: aarch64
SourceLicense: MIT AND (MIT)
BuildRequires:  dbus-daemon
BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  meson >= 0.61
BuildRequires:  ninja-build
BuildRequires:  pkgconfig(egl)
BuildRequires:  pkgconfig(gbm)
BuildRequires:  pkgconfig(glesv2) >= 3.2
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(libva) >= 1.10
BuildRequires:  systemd
BuildRequires:  systemd-rpm-macros

%description
Reviewed component sources with independent binary package identities.
The source package adds no runtime selection RPM or service.
%package -n uke-vaapi-v4l2
Version: 1.0.0
Release: 11.fc46
License:        MIT




Summary:        Experimental stateful Iris VA-API backend
Requires:       uke-video-session >= 1.1.0


%description -n uke-vaapi-v4l2
Experimental VA-API backend for the Qualcomm Iris stateful V4L2 API. Profiles and
entrypoints are intersected with kernel format and profile-menu queries.
Requires a separately qualified Iris platform and firmware. Installation
does not establish working Uke codecs. FastCV VPP is disabled. The MSM alias
selects the same backend for default libva discovery on MSM DRM devices;
native codec and application acceptance remain separate requirements.


%package -n uke-video-session
Version: 1.1.0
Release: 2.fc46
License:        MIT

Summary:        Automatic per-user policy for native UHD video decoding
Requires:       systemd
Requires:       dbus
Requires:       /usr/libexec/power-profiles-daemon


%description -n uke-video-session
Activate through the user's standard D-Bus session when the native VA backend
reports UHD decode activity. Authenticate the original Chrome GPU sender, apply
reversible CPU hints and request the standard performance profile. Expire idle
activity, respect manual profile changes and restore affinity after service
failure. No browser wrapper, profile name, URL or always-running login service
is required. No frame interpolation or clock/thermal override is included.



%prep
%setup -q
(
mkdir -p "%{_builddir}/uke-video-integration-1.0.0/work/uke-vaapi-v4l2"
echo 'e8756bf642eb3fc458209b8dd2380571dcb52ec4b2201e9d09db208b7e995d52  %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/libva-v4l2-6d03c3f8fb19b86f84b2b6c60ff20d1402f0ac41.tar.gz' | sha256sum --check --status
cd '%{_builddir}/uke-video-integration-1.0.0/work/uke-vaapi-v4l2'
rm -rf 'radxa-pkg-libva-v4l2-6d03c3f'
/usr/bin/rpmuncompress -x '%{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/libva-v4l2-6d03c3f8fb19b86f84b2b6c60ff20d1402f0ac41.tar.gz'
STATUS=$?
if [ $STATUS -ne 0 ]; then
  exit $STATUS
fi
cd 'radxa-pkg-libva-v4l2-6d03c3f'
/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

echo "Patch #0 (0001-runtime-capability-intersection.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0001-runtime-capability-intersection.patch


echo "Patch #1 (0002-main10-p010-encode.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0002-main10-p010-encode.patch


echo "Patch #2 (0003-runtime-encode-rate-limits.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0003-runtime-encode-rate-limits.patch


echo "Patch #3 (0004-runtime-frame-dimensions.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0004-runtime-frame-dimensions.patch


echo "Patch #4 (0005-preserve-decode-error-status.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0005-preserve-decode-error-status.patch


echo "Patch #5 (0006-shared-surface-write-combined.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0006-shared-surface-write-combined.patch


echo "Patch #6 (0007-automatic-user-video-policy.patch):"
/usr/bin/patch --no-backup-if-mismatch -f -p1  --fuzz=0 < %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/0007-automatic-user-video-policy.patch


install -m644 %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/uke-video-activity.cpp %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/uke-video-activity.hpp %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/uke-video-protocol.hpp src/


)
(
mkdir -p "%{_builddir}/uke-video-integration-1.0.0/work/uke-video-session"
cd '%{_builddir}/uke-video-integration-1.0.0/work/uke-video-session'
rm -rf 'uke-video-session-1.1.0'
/usr/bin/rpmuncompress -x '%{_builddir}/uke-video-integration-1.0.0/inputs/uke-video-session/uke-video-session-1.1.0.tar.gz'
STATUS=$?
if [ $STATUS -ne 0 ]; then
  exit $STATUS
fi
cd 'uke-video-session-1.1.0'
/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .



)

%build
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-vaapi-v4l2/radxa-pkg-libva-v4l2-6d03c3f"

    
  CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FCFLAGS ; 
  VALAFLAGS="${VALAFLAGS:--g}" ; export VALAFLAGS ;
  RUSTFLAGS="${RUSTFLAGS:--Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn}" ; export RUSTFLAGS ; 
  LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  }" ; export LDFLAGS ; 
  LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; 
  CC="${CC:-gcc}" ; export CC ; 
  CXX="${CXX:-g++}" ; export CXX 
    /usr/bin/meson setup --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/bin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . redhat-linux-build -Dgpu_copy=enabled -Dfastcv=disabled

    /usr/bin/meson compile -C redhat-linux-build -j${RPM_BUILD_NCPUS} --verbose


)
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-video-session/uke-video-session-1.1.0"

  CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FCFLAGS ; 
  VALAFLAGS="${VALAFLAGS:--g}" ; export VALAFLAGS ;
  RUSTFLAGS="${RUSTFLAGS:--Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn}" ; export RUSTFLAGS ; 
  LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  }" ; export LDFLAGS ; 
  LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; 
  CC="${CC:-gcc}" ; export CC ; 
  CXX="${CXX:-g++}" ; export CXX
/usr/bin/make -O -j${RPM_BUILD_NCPUS} V=1 VERBOSE=1


)

%install
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-vaapi-v4l2/radxa-pkg-libva-v4l2-6d03c3f"

    DESTDIR=%{buildroot} /usr/bin/meson install -C redhat-linux-build --no-rebuild
rm -r %{buildroot}/usr/share/doc/libva-v4l2
rm -r %{buildroot}/usr/share/licenses/libva-v4l2
install -m 0644 %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/README.md UKE-README.md


)
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-video-session/uke-video-session-1.1.0"
/usr/bin/make install DESTDIR=%{buildroot} INSTALL="/usr/bin/install -p" PREFIX=/usr


)

%check
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-vaapi-v4l2/radxa-pkg-libva-v4l2-6d03c3f"
g++ -std=c++17 -O2 -Wall -Wextra -Werror $(pkg-config --cflags libva) \
    -Isrc src/runtime-caps.cpp %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/runtime-caps.cpp \
    -Wl,--wrap=open,--wrap=ioctl,--wrap=close -o runtime-caps-test
./runtime-caps-test
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/main10-contract.sh "$PWD"
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/rate-negotiation.sh "$PWD"
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/dimension-contract.sh "$PWD"
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/decode-error-contract.sh "$PWD"
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/shared-surface-cache-contract.sh "$PWD"
bash %{_builddir}/uke-video-integration-1.0.0/inputs/uke-vaapi-v4l2/activity-client-contract.sh "$PWD"


)
(
cd "%{_builddir}/uke-video-integration-1.0.0/work/uke-video-session/uke-video-session-1.1.0"

  CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CFLAGS ; 
  CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer  }" ; export CXXFLAGS ; 
  FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FFLAGS ; 
  FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -I/usr/lib64/gfortran/modules  }" ; export FCFLAGS ; 
  VALAFLAGS="${VALAFLAGS:--g}" ; export VALAFLAGS ;
  RUSTFLAGS="${RUSTFLAGS:--Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Cstrip=none -Cforce-frame-pointers=yes -Clink-arg=-specs=/usr/lib/rpm/redhat/redhat-package-notes --cap-lints=warn}" ; export RUSTFLAGS ; 
  LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  }" ; export LDFLAGS ; 
  LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; 
  CC="${CC:-gcc}" ; export CC ; 
  CXX="${CXX:-g++}" ; export CXX
make check


)
%files -n uke-vaapi-v4l2
%license work/uke-vaapi-v4l2/radxa-pkg-libva-v4l2-6d03c3f/LICENSE
%doc work/uke-vaapi-v4l2/radxa-pkg-libva-v4l2-6d03c3f/UKE-README.md
/usr/lib64/dri/v4l2_drv_video.so
/usr/lib64/dri/msm_drv_video.so

%post -n uke-video-session

 
if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then 
    # Initial installation 
    /usr/lib/systemd/systemd-update-helper install-user-units uke-video-session.service || : 
fi 


%preun -n uke-video-session

 
if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then 
    # Package removal, not upgrade 
    /usr/lib/systemd/systemd-update-helper remove-user-units uke-video-session.service || : 
fi 


%postun -n uke-video-session

 
if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then 
    # Package upgrade, not uninstall 
    /usr/lib/systemd/systemd-update-helper mark-restart-user-units uke-video-session.service || : 
fi 


%files -n uke-video-session
%license work/uke-video-session/uke-video-session-1.1.0/LICENSE
%doc work/uke-video-session/uke-video-session-1.1.0/README.md
/usr/libexec/uke-video-session
/usr/lib/systemd/user/uke-video-session.service
/usr/share/dbus-1/services/org.uke.VideoSession1.service
/usr/share/dbus-1/interfaces/org.uke.VideoSession1.xml


%changelog
* Tue Oct 20 2026 Senemos Maintainers <75160848+MCC45TR@users.noreply.github.com> - 1.0.0-1
- Build reviewed child recipes under one source family without binary repackaging.
