File raspberrypi-userland.spec of Package raspberrypi-userland
#
# spec file for package raspberrypi-userland
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: raspberrypi-userland
Version: 0.0~git2023.10.18
Release: 0
Summary: Source for the ARM side code to interface to VideoCore
License: BSD-3-Clause
Group: System/Libraries
Url: https://github.com/raspberrypi/userland/
Source0: raspberrypi-userland-%{version}.tar.bz2
Source10: 10-vchiq.rules
Patch0: raspberrypi-userland-conflicting-types-fixes.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: pkgconfig
# udev owns '/usr/lib/udev/rules.d' dir
BuildRequires: udev
Provides: raspberrypi-gfx
%ifnarch aarch64
Provides: Mesa-libEGL1
Provides: Mesa-libGLESv1_CM1
Provides: Mesa-libGLESv2-2
Obsoletes: Mesa-libEGL1
Obsoletes: Mesa-libGLESv1_CM1
Obsoletes: Mesa-libGLESv2-2
Provides: libEGL.so.1
Provides: libGLESv1_CM.so.1
Provides: libGLESv2.so.2
%endif
ExclusiveArch: %{arm} aarch64
%description
This package contains libraries built from the source code for the ARM
side, used on Raspberry Pi, to interface to: EGL, mmal, GLESv2, vcos,
openmaxil, vchiq_arm, bcm_host, WFC, OpenVG.
%package devel
Summary: Add VideCoreIV support (EGL/GLES/OpenVG, etc) to Raspberry Pi
Group: Development/Libraries/Other
Requires: raspberrypi-userland
Provides: raspberrypi-gfx-devel
Provides: Mesa-libEGL-devel
Provides: Mesa-libGLESv1_CM-devel
Provides: Mesa-libGLESv2-devel
Obsoletes: Mesa-libEGL-devel
Obsoletes: Mesa-libGLESv1_CM-devel
Obsoletes: Mesa-libGLESv2-devel
%description devel
Add VideCoreIV support (EGL/GLES/OpenVG, etc) to Raspberry Pi.
Devel package.
%prep
%setup -q
%autopatch -p1
%build
mkdir build
pushd build
# Some libs are built static and others shared, so do not use cmake macro
cmake \
-DCMAKE_C_FLAGS="%{optflags}" \
-DCMAKE_CXX_FLAGS="%{optflags}" \
-DCMAKE_BUILD_TYPE=RelWithDebinfo \
-DCMAKE_C_FLAGS:STRING="%optflags" \
-DVMCS_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
%ifarch aarch64
-DARM64=ON \
%endif
..
make %{?_smp_mflags}
popd
%install
# Make /opt/vc/* links for compatibility purpose
mkdir -p %{buildroot}/boot %{buildroot}/opt/vc/ %{buildroot}/%{_bindir} %{buildroot}/%{_includedir}
pushd %{buildroot}/opt/vc/
ln -s ../../%{_bindir}
ln -s ../../usr/lib
ln -s ../../%{_includedir}
popd
%cmake_install
# Install udev rules
install -D -p -m 0644 %{_sourcedir}/10-vchiq.rules %{buildroot}%{_udevrulesdir}/10-vchiq.rules
# Remove unneeded hello world source files
rm -rf %{buildroot}%{_prefix}/src/hello_pi/
# Remove *.a
rm -rf %{buildroot}/usr/lib/*.a
%ifarch aarch64
# Move SO libs and pkgconfig/ from /usr/lib/ to /usr/lib64/
mkdir -p %{buildroot}%{_libdir}
mv %{buildroot}/usr/lib/*.so %{buildroot}%{_libdir}
mv %{buildroot}/usr/lib/pkgconfig/ %{buildroot}%{_libdir}
%endif
%ifnarch aarch64
# Add version extensions to libs (help to fix Mesa packages conflicts) and add missing libGLESv1_CM.so
pushd %{buildroot}%{_libdir}
ln -s libGLESv2.so libGLESv1_CM.so
ln -s libEGL.so libEGL.so.1
ln -s libGLESv1_CM.so libGLESv1_CM.so.1
ln -s libGLESv2.so libGLESv2.so.2
popd
%endif
mkdir -p %{buildroot}/%{_mandir}/man{1,7}
mv -v %{buildroot}/usr/man/man1/* %{buildroot}/%{_mandir}/man1/
mv -v %{buildroot}/usr/man/man7/* %{buildroot}/%{_mandir}/man7/
%fdupes -s %{buildroot}%{_prefix}
%post -n raspberrypi-userland
/sbin/ldconfig
%postun -n raspberrypi-userland
/sbin/ldconfig
%files
%defattr(-,root,root)
%dir /opt/vc
/opt/vc/bin
/opt/vc/lib
%ifnarch aarch64
%{_bindir}/containers_*
%endif
%{_bindir}/dtmerge
%{_bindir}/dtoverlay*
%{_bindir}/dtparam
%ifnarch aarch64
%{_bindir}/mmal_vc_diag
%{_bindir}/raspistill
%{_bindir}/raspivid
%{_bindir}/raspividyuv
%{_bindir}/raspiyuv
%endif
%{_bindir}/tvservice
%{_bindir}/vcgencmd
%{_bindir}/vchiq_test
%{_bindir}/vcmailbox
%ifnarch aarch64
%{_bindir}/vcsmem
%endif
%{_libdir}/*.so
%ifnarch aarch64
%{_libdir}/*.so.*
%dir %{_libdir}/plugins
%{_libdir}/plugins/*.so
%endif
%{_udevrulesdir}/10-vchiq.rules
%{_mandir}/man*/*%{?ext_man}
%doc LICENCE
%files devel
%defattr(-,root,root)
/opt/vc/include
%{_includedir}/*
%{_libdir}/pkgconfig/*.pc
%changelog