packaging: add vcgencmd tool for raspberry pi
[platform/adaptation/broadcom/libomxil-vc4.git] / packaging / libomxil-vc4.spec
1 Name:          libomxil-vc4
2 Version:       0.0.1
3 Release:       4
4 Summary:       Libraries for interfacing to Raspberry Pi GPU
5 Group:         System/Libraries
6 URL:           https://github.com/raspberrypi/userland
7 Source:         %{name}-%{version}.tar.gz
8 License:       BSD-3-Clause
9 BuildRequires: cmake
10 BuildRequires: gcc-c++
11 BuildRequires: pkgconfig(libtbm)
12 BuildRequires: hal-api-common-devel
13 ExclusiveArch: %{arm}
14
15 %description
16 Libraries for interfacing to Raspberry Pi GPU.
17
18 %package       utils
19 Group:         System/Tools
20 Summary:       System tools for the Raspberry Pi
21
22 %description   utils
23 This package contains some system tools for the Raspberry Pi.
24 Source: https://github.com/raspberrypi/userland.git
25
26 %package       devel
27 Group:         Development/Libraries
28 Summary:       Development files for the Raspberry Pi GPU
29 Requires:      %{name} = %{version}
30
31 %description   devel
32 This package contains libraries and header files for developing applications that use Raspberry Pi GPU.
33
34 %package -n    vcgencmd
35 Group:         System/Tools
36 Summary:       vcgencmd tools for the Raspberry Pi
37
38 %description -n vcgencmd
39 This package contains vcgencmd system tools for the Raspberry Pi.
40 Source: https://github.com/raspberrypi/userland.git
41
42 %prep
43 %setup -q
44
45 %build
46 BUILDTYPE=Release
47 BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
48 mkdir -p build/armv7l-linux/$BUILDSUBDIR
49 pushd build/armv7l-linux/$BUILDSUBDIR
50 cmake -DCMAKE_BUILD_TYPE=Release ../../../ \
51         -DCMAKE_INSTALL_RPATH=%{_hal_libdir}/vc
52 make %{?_smp_mflags}
53 popd
54
55 %post
56 /sbin/ldconfig
57
58 %postun
59 /sbin/ldconfig
60
61 %install
62 mkdir -p %{buildroot}/etc/ld.so.conf.d/
63 cp %{_builddir}/%{name}-%{version}/packaging/libomxil-vc4.conf %{buildroot}/etc/ld.so.conf.d
64 mkdir -p %{buildroot}/opt/vc/lib/plugins
65 mkdir %{buildroot}/opt/vc/lib/pkgconfig
66 mkdir %{buildroot}/opt/vc/bin
67 mkdir -p %{buildroot}/opt/vc/include/interface
68 pushd %{buildroot}/opt/vc/lib
69 cp %{_builddir}/%{name}-%{version}/build/lib/lib*.so ./
70 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/bcm_host.pc ./pkgconfig
71 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/brcmegl.pc ./pkgconfig
72 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/brcmglesv2.pc ./pkgconfig
73 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/brcmvg.pc ./pkgconfig
74 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/mmal.pc ./pkgconfig
75 cp %{_builddir}/%{name}-%{version}/build/armv7l-linux/release/vcsm.pc ./pkgconfig
76 cd ./plugins
77 cp %{_builddir}/%{name}-%{version}/build/lib/reader_*.so ./
78 cp %{_builddir}/%{name}-%{version}/build/lib/writer_*.so ./
79 cd ../../bin
80 cp %{_builddir}/%{name}-%{version}/build/bin/* ./
81
82 cd ../lib
83 cp %{_builddir}/%{name}-%{version}/build/lib/lib*.a ./
84 cd ../include
85 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/EGL ./
86 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/GLES ./
87 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/GLES2 ./
88 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/KHR ./
89 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/VG ./
90 cp -a %{_builddir}/%{name}-%{version}/interface/khronos/include/WF ./
91 cp -a %{_builddir}/%{name}-%{version}/interface/vmcs_host/khronos/IL ./
92 cp -a %{_builddir}/%{name}-%{version}/interface/mmal ./interface/
93 cp -a %{_builddir}/%{name}-%{version}/interface/vchi ./interface/
94 cp -a %{_builddir}/%{name}-%{version}/interface/vchiq_arm ./interface/
95 cp -a %{_builddir}/%{name}-%{version}/interface/vcos ./interface/
96 cp -a %{_builddir}/%{name}-%{version}/interface/vctypes ./interface/
97 cp -a %{_builddir}/%{name}-%{version}/interface/vmcs_host ./interface/
98 cp -a %{_builddir}/%{name}-%{version}/vcinclude ./
99 cp %{_builddir}/%{name}-%{version}/host_applications/linux/libs/bcm_host/include/bcm_host.h ./
100 popd
101
102 # install and package vcgencmd to /hal with RPATH
103 BUILDTYPE=Release
104 BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
105 pushd build/armv7l-linux/$BUILDSUBDIR
106 make install \
107         DESTDIR=%{_builddir}/%{name}-%{version}/build/armv7l-linux/install \
108         INSTALL_ROOT=%{_builddir}/%{name}-%{version}/build/armv7l-linux/install
109 popd
110
111 mkdir -p %{buildroot}/%{_hal_bindir}
112 mkdir -p %{buildroot}/%{_hal_libdir}/vc
113 mkdir -p %{buildroot}/%{_hal_licensedir}/vcgencmd
114 cp build/armv7l-linux/install/opt/vc/bin/vcgencmd %{buildroot}/%{_hal_bindir}
115 cp build/armv7l-linux/install/opt/vc/lib/libvchiq_arm.so %{buildroot}/%{_hal_libdir}/vc
116 cp build/armv7l-linux/install/opt/vc/lib/libvcos.so %{buildroot}/%{_hal_libdir}/vc
117 cp LICENSE %{buildroot}/%{_hal_licensedir}/vcgencmd
118
119 %clean
120 [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
121
122 %files
123 %manifest packaging/%{name}.manifest
124 %defattr(-,root,root)
125 %license LICENSE
126 /opt/vc/lib/lib*.so
127 /opt/vc/lib/plugins/*.so
128 /etc/ld.so.conf.d/libomxil-vc4.conf
129
130 %files utils
131 /opt/vc/bin/*
132 %doc LICENSE
133
134 %files devel
135 /opt/vc/lib/lib*.a
136 /opt/vc/include/EGL
137 /opt/vc/include/GLES
138 /opt/vc/include/GLES2
139 /opt/vc/include/IL
140 /opt/vc/include/KHR
141 /opt/vc/include/VG
142 /opt/vc/include/WF
143 /opt/vc/include/interface
144 /opt/vc/include/vcinclude
145 /opt/vc/include/*.h
146 /opt/vc/lib/pkgconfig/*.pc
147
148 %files -n vcgencmd
149 %manifest packaging/%{name}.manifest
150 %{_hal_licensedir}/vcgencmd/LICENSE
151 %{_hal_bindir}/vcgencmd
152 %{_hal_libdir}/vc/*.so