packaging: add vcgencmd tool for raspberry pi 16/254616/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 5 Mar 2021 09:06:09 +0000 (18:06 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 5 Mar 2021 09:06:09 +0000 (18:06 +0900)
There is vcgencmd usage for rasberry pi, so add package only with
vcgencmd and dependent libraries into /hal and set exact RUNPATH
to find library in sub-directory in the /hal.

Change-Id: I3177ba1cadbc830b1637efc4d7a931524bfa8ba5
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
packaging/libomxil-vc4.spec

index 05627b0..936ea6c 100755 (executable)
@@ -9,6 +9,7 @@ License:       BSD-3-Clause
 BuildRequires: cmake
 BuildRequires: gcc-c++
 BuildRequires: pkgconfig(libtbm)
+BuildRequires: hal-api-common-devel
 ExclusiveArch: %{arm}
 
 %description
@@ -30,6 +31,14 @@ Requires:      %{name} = %{version}
 %description   devel
 This package contains libraries and header files for developing applications that use Raspberry Pi GPU.
 
+%package -n    vcgencmd
+Group:         System/Tools
+Summary:       vcgencmd tools for the Raspberry Pi
+
+%description -n vcgencmd
+This package contains vcgencmd system tools for the Raspberry Pi.
+Source: https://github.com/raspberrypi/userland.git
+
 %prep
 %setup -q
 
@@ -38,7 +47,8 @@ BUILDTYPE=Release
 BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
 mkdir -p build/armv7l-linux/$BUILDSUBDIR
 pushd build/armv7l-linux/$BUILDSUBDIR
-cmake -DCMAKE_BUILD_TYPE=Release ../../../
+cmake -DCMAKE_BUILD_TYPE=Release ../../../ \
+       -DCMAKE_INSTALL_RPATH=%{_hal_libdir}/vc
 make %{?_smp_mflags}
 popd
 
@@ -89,6 +99,23 @@ cp -a %{_builddir}/%{name}-%{version}/vcinclude ./
 cp %{_builddir}/%{name}-%{version}/host_applications/linux/libs/bcm_host/include/bcm_host.h ./
 popd
 
+# install and package vcgencmd to /hal with RPATH
+BUILDTYPE=Release
+BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
+pushd build/armv7l-linux/$BUILDSUBDIR
+make install \
+       DESTDIR=%{_builddir}/%{name}-%{version}/build/armv7l-linux/install \
+       INSTALL_ROOT=%{_builddir}/%{name}-%{version}/build/armv7l-linux/install
+popd
+
+mkdir -p %{buildroot}/%{_hal_bindir}
+mkdir -p %{buildroot}/%{_hal_libdir}/vc
+mkdir -p %{buildroot}/%{_hal_licensedir}/vcgencmd
+cp build/armv7l-linux/install/opt/vc/bin/vcgencmd %{buildroot}/%{_hal_bindir}
+cp build/armv7l-linux/install/opt/vc/lib/libvchiq_arm.so %{buildroot}/%{_hal_libdir}/vc
+cp build/armv7l-linux/install/opt/vc/lib/libvcos.so %{buildroot}/%{_hal_libdir}/vc
+cp LICENSE %{buildroot}/%{_hal_licensedir}/vcgencmd
+
 %clean
 [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
 
@@ -118,3 +145,8 @@ popd
 /opt/vc/include/*.h
 /opt/vc/lib/pkgconfig/*.pc
 
+%files -n vcgencmd
+%manifest packaging/%{name}.manifest
+%{_hal_licensedir}/vcgencmd/LICENSE
+%{_hal_bindir}/vcgencmd
+%{_hal_libdir}/vc/*.so