A new user interface for you! Read more...

File common.spec.inc of Package TI_Graphics_SDK

%prep
%setup -q -n TI_Graphics_SDK-%{version}
%patch2 -p0
#%patch3 -p0
%patch4 -p1

%build
# Remove reference to old cpu.h file by new soc.h file
#cd GFX_Linux_KM
#for file in ./services4/system/ti81xx/.sysutils.o.cmd ./services4/system/ti81xx/.sysconfig.o.cmd #./services4/3rdparty/dc_ti81xx_linux/.omaplfb_linux.o.cmd ./services4/3rdparty/dc_ti81xx_linux/.omaplfb_displayclass.o.cmd #./services4/3rdparty/bufferclass_ti/.bc_cat.o.cmd; do
#	sed -i -e 's!arch/arm/plat-omap/include/plat/cpu.h!arch/arm/mach-omap2/soc.h!g' "$file"
#done
#cd -
# Change rpath from /usr/local/XSGX/lib to /usr/lib for all libs and bins
cd gfx_rel_es%es_version
chrpath --replace %{_libdir} libEGL_eglimage.so
chrpath --replace %{_libdir} libEGL.so
chrpath --replace %{_libdir} libews.so
chrpath --replace %{_libdir} libGLES_CM_eglimage.so
chrpath --replace %{_libdir} libGLES_CM.so
chrpath --replace %{_libdir} libGLESv2_eglimage.so
chrpath --replace %{_libdir} libGLESv2.so
chrpath --replace %{_libdir} libglslcompiler.so
chrpath --replace %{_libdir} libIMGegl_eglimage.so
chrpath --replace %{_libdir} libIMGegl.so
#chrpath --replace %{_libdir} libOpenVG.so
#chrpath --replace %{_libdir} libOpenVGU.so
chrpath --replace %{_libdir} libpvr2d.so
chrpath --replace %{_libdir} libpvrPVR2D_BLITWSEGL.so
chrpath --replace %{_libdir} libpvrPVR2D_DRIWSEGL.so
chrpath --replace %{_libdir} libpvrPVR2D_FLIPWSEGL.so
chrpath --replace %{_libdir} libpvrPVR2D_FRONTWSEGL.so
chrpath --replace %{_libdir} libpvrPVR2D_LINUXFBWSEGL.so
chrpath --replace %{_libdir} libPVRScopeServices.so
chrpath --replace %{_libdir} libsrv_init.so
chrpath --replace %{_libdir} libsrv_um_dri.so
chrpath --replace %{_libdir} libsrv_um.so
chrpath --replace %{_libdir} libusc.so
chrpath --replace %{_libdir} pvr_drv.so
chrpath --replace %{_libdir} eglinfo
chrpath --replace %{_libdir} xeglinfo
chrpath --replace %{_libdir} gles1test1
chrpath --replace %{_libdir} gles2test1
chrpath --replace %{_libdir} gles1_texture_stream
chrpath --replace %{_libdir} gles2_texture_stream
#chrpath --replace %{_libdir} ovg_unit_test
chrpath --replace %{_libdir} pvr2d_test
#chrpath --replace %{_libdir} pvrsrvinit
chrpath --replace %{_libdir} pvrsrvctl
chrpath --replace %{_libdir} services_test
chrpath --replace %{_libdir} sgx_blit_test
chrpath --replace %{_libdir} sgx_clipblit_test
chrpath --replace %{_libdir} sgx_flip_test
chrpath --replace %{_libdir} sgx_init_test
chrpath --replace %{_libdir} sgx_render_flip_test
chrpath --replace %{_libdir} xgles1test1
chrpath --replace %{_libdir} xgles1_texture_stream
chrpath --replace %{_libdir} xgles2test1
chrpath --replace %{_libdir} xgles2_texture_stream
#chrpath --replace %{_libdir} xmultiegltest
#chrpath --replace %{_libdir} xovg_unit_test
cd -
# Build only Kernel Modules since libs are already compiled
mkdir -p /tmp/kernel_dir
cp -r /usr/src/linux/* /tmp/kernel_dir
%if 0%{suse_version} > 123
cp /usr/src/linux-obj/%_target_cpu/default/.config /tmp/kernel_dir
%else
cp /usr/src/linux-obj/%_target_cpu/omap2plus/.config /tmp/kernel_dir
%endif
cd /tmp/kernel_dir
export LINUXKERNEL_INSTALL_DIR="/tmp/kernel_dir"
make ARCH=arm CROSS_COMPILE="" oldconfig
make ARCH=arm CROSS_COMPILE="" prepare
make ARCH=arm CROSS_COMPILE="" %{?_smp_mflags} modules
# uImage is also needed, otherwise *.ko modules have no symbol included!
make ARCH=arm CROSS_COMPILE="" LOADADDR=0x80008000 %{?_smp_mflags} uImage
cd -
make ARCH=arm CROSS_COMPILE="" BUILD=release OMAPES=%es_version FBDEV=yes SUPPORT_XORG=%use_xorg GRAPHICS_INSTALL_DIR="$(pwd)/" DESTDIR=%buildroot all_km

%install
mkdir -p %{buildroot}%{_libdir}/
mkdir -p %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_initrddir}/
cd gfx_rel_es%es_version
# *.so
install -m 0755 libEGL_eglimage.so %buildroot%{_libdir}/libEGL_eglimage.so
install -m 0755 libEGL.so %buildroot%{_libdir}/libEGL.so
install -m 0755 libews.so %buildroot%{_libdir}/libews.so
install -m 0755 libGLES_CM_eglimage.so %buildroot%{_libdir}/libGLES_CM_eglimage.so
install -m 0755 libGLES_CM.so %buildroot%{_libdir}/libGLES_CM.so
install -m 0755 libGLESv2_eglimage.so %buildroot%{_libdir}/libGLESv2_eglimage.so
install -m 0755 libGLESv2.so %buildroot%{_libdir}/libGLESv2.so
install -m 0755 libglslcompiler.so %buildroot%{_libdir}/libglslcompiler.so
install -m 0755 libIMGegl_eglimage.so %buildroot%{_libdir}/libIMGegl_eglimage.so
install -m 0755 libIMGegl.so %buildroot%{_libdir}/libIMGegl.so
#install -m 0755 libOpenVG.so %buildroot%{_libdir}/libOpenVG.so
#install -m 0755 libOpenVGU.so %buildroot%{_libdir}/libOpenVGU.so
install -m 0755 libpvr2d.so %buildroot%{_libdir}/libpvr2d.so
install -m 0755 libpvrPVR2D_BLITWSEGL.so %buildroot%{_libdir}/libpvrPVR2D_BLITWSEGL.so
install -m 0755 libpvrPVR2D_DRIWSEGL.so %buildroot%{_libdir}/libpvrPVR2D_DRIWSEGL.so
install -m 0755 libpvrPVR2D_FLIPWSEGL.so %buildroot%{_libdir}/libpvrPVR2D_FLIPWSEGL.so
install -m 0755 libpvrPVR2D_FRONTWSEGL.so %buildroot%{_libdir}/libpvrPVR2D_FRONTWSEGL.so
install -m 0755 libpvrPVR2D_LINUXFBWSEGL.so %buildroot%{_libdir}/libpvrPVR2D_LINUXFBWSEGL.so
install -m 0755 libPVRScopeServices.so %buildroot%{_libdir}/libPVRScopeServices.so
install -m 0755 libsrv_init.so %buildroot%{_libdir}/libsrv_init.so
%if %use_xorg
install -m 0755 libsrv_um_dri.so %buildroot%{_libdir}/libsrv_um.so
%else
install -m 0755 libsrv_um.so %buildroot%{_libdir}/libsrv_um.so
%endif
install -m 0755 libusc.so %buildroot%{_libdir}/libusc.so
install -D -m 0755 pvr_drv.so %buildroot/usr/lib/xorg/modules/drivers/pvr_drv.so
# bin
install -m 0755 eglinfo %buildroot%{_bindir}/eglinfo
install -m 0755 xeglinfo %buildroot%{_bindir}/xeglinfo
install -m 0755 gles1_texture_stream %buildroot%{_bindir}/gles1_texture_stream
install -m 0755 gles2_texture_stream %buildroot%{_bindir}/gles2_texture_stream
install -m 0755 gles1test1 %buildroot%{_bindir}/gles1test1
install -m 0755 gles2test1 %buildroot%{_bindir}/gles2test1
#install -m 0755 ovg_unit_test %buildroot%{_bindir}/ovg_unit_test
install -m 0755 pvr2d_test %buildroot%{_bindir}/pvr2d_test
#install -m 0755 pvrsrvinit %buildroot%{_bindir}/pvrsrvinit
install -m 0755 pvrsrvctl %buildroot%{_bindir}/pvrsrvctl
install -m 0755 services_test %buildroot%{_bindir}/services_test
install -m 0755 sgx_blit_test %buildroot%{_bindir}/sgx_blit_test
install -m 0755 sgx_clipblit_test %buildroot%{_bindir}/sgx_clipblit_test
install -m 0755 sgx_flip_test %buildroot%{_bindir}/sgx_flip_test
install -m 0755 sgx_init_test %buildroot%{_bindir}/sgx_init_test
install -m 0755 sgx_render_flip_test %buildroot%{_bindir}/sgx_render_flip_test
install -m 0755 xgles1test1 %buildroot%{_bindir}/xgles1test1
install -m 0755 xgles1_texture_stream %buildroot%{_bindir}/xgles1_texture_stream
install -m 0755 xgles2test1 %buildroot%{_bindir}/xgles2test1
install -m 0755 xgles2_texture_stream %buildroot%{_bindir}/xgles2_texture_stream
#install -m 0755 xmultiegltest %buildroot%{_bindir}/xmultiegltest
#install -m 0755 xovg_unit_test %buildroot%{_bindir}/xovg_unit_test
install -m 0755 glsltest1_vertshader.txt %buildroot%{_bindir}/glsltest1_vertshader.txt
install -m 0755 glsltest1_fragshaderA.txt %buildroot%{_bindir}/glsltest1_fragshaderA.txt
install -m 0755 glsltest1_fragshaderB.txt %buildroot%{_bindir}/glsltest1_fragshaderB.txt
cd -
#init.d script
%if %use_xorg
# Used when Xorg is used (TODO: must be patched to match path)
cd -
#install -m 0755 %_sourcedir/rc_dri.pvr %buildroot/etc/init.d/rc.pvr
install -m 0755 rc_dri.pvr %buildroot/etc/init.d/rc.pvr
install -D -p -m 0644 %{_sourcedir}/99-pvr.conf %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/99-pvr.conf
cd -
%else 
# Used when framebuffer is used
cd -
#install -m 0755 %_sourcedir/rc.pvr %buildroot/etc/init.d/rc.pvr
install -m 0755 rc.pvr %buildroot/etc/init.d/rc.pvr
cd -
%endif
# Config file
install -m 0644 %_sourcedir/powervr.ini %buildroot/etc/powervr.ini
# install kernel modules
%define full_kernel_name $(ls /lib/modules | grep omap2plus)
%if %use_xorg
install -D -m 0755 gfx_rel_es%es_version/drm.ko %buildroot/lib/modules/%full_kernel_name/updates/drm.ko
%else
install -D -m 0755 gfx_rel_es%es_version/omaplfb.ko %buildroot/lib/modules/%full_kernel_name/updates/omaplfb.ko
%endif
install -D -m 0755 gfx_rel_es%es_version/pvrsrvkm.ko %buildroot/lib/modules/%full_kernel_name/updates/pvrsrvkm.ko
install -D -m 0755 gfx_rel_es%es_version/bufferclass_ti.ko %buildroot/lib/modules/%full_kernel_name/updates/bufferclass_ti.ko

%post -p /sbin/ldconfig

%preun
%stop_on_removal rc.pvr

%postun
/sbin/ldconfig
%insserv_cleanup
%restart_on_update

%clean
rm -rf %buildroot

%files
%defattr(-,root,root)
/etc/powervr.ini
%{_initrddir}/rc.pvr
%if %use_xorg
config %{_sysconfdir}/X11/xorg.conf.d/99-pvr.conf
#/lib/modules/*/updates/drm.ko
#%else
#/lib/modules/*/updates/omaplfb.ko
%endif
#/lib/modules/*/updates/pvrsrvkm.ko
#/lib/modules/*/updates/bufferclass_ti.ko


%files libs%es_version_major
%defattr(-,root,root)
%{_libdir}/libEGL_eglimage.so
%{_libdir}/libEGL.so
%{_libdir}/libews.so
%{_libdir}/libGLES_CM_eglimage.so
%{_libdir}/libGLES_CM.so
%{_libdir}/libGLESv2_eglimage.so
%{_libdir}/libGLESv2.so
%{_libdir}/libglslcompiler.so
%{_libdir}/libIMGegl_eglimage.so
%{_libdir}/libIMGegl.so
#%{_libdir}/libOpenVG.so
#%{_libdir}/libOpenVGU.so
%{_libdir}/libpvr2d.so
%{_libdir}/libpvrPVR2D_BLITWSEGL.so
%{_libdir}/libpvrPVR2D_DRIWSEGL.so
%{_libdir}/libpvrPVR2D_FLIPWSEGL.so
%{_libdir}/libpvrPVR2D_FRONTWSEGL.so
%{_libdir}/libpvrPVR2D_LINUXFBWSEGL.so
%{_libdir}/libPVRScopeServices.so
%{_libdir}/libsrv_init.so
# %{_libdir}/libsrv_um_dri.so
%{_libdir}/libsrv_um.so
%{_libdir}/libusc.so
%dir /usr/lib/xorg/
%dir /usr/lib/xorg/modules/
%dir /usr/lib/xorg/modules/drivers
/usr/lib/xorg/modules/drivers/pvr_drv.so
#%{_libdir}/pvr_drv.so
# libs .a
#libffgen.a
#libuseasm.a
#libusp.a

%files tests
%defattr(-,root,root)
%{_bindir}/eglinfo
%{_bindir}/xeglinfo
%{_bindir}/gles1test1
%{_bindir}/gles2test1
%{_bindir}/gles1_texture_stream
%{_bindir}/gles2_texture_stream
#%{_bindir}/ovg_unit_test
%{_bindir}/pvr2d_test
#%{_bindir}/pvrsrvinit
%{_bindir}/pvrsrvctl
%{_bindir}/services_test
%{_bindir}/sgx_blit_test
%{_bindir}/sgx_clipblit_test
%{_bindir}/sgx_flip_test
%{_bindir}/sgx_init_test
%{_bindir}/sgx_render_flip_test
%{_bindir}/xgles1test1
%{_bindir}/xgles1_texture_stream
%{_bindir}/xgles2test1
%{_bindir}/xgles2_texture_stream
#%{_bindir}/xmultiegltest
#%{_bindir}/xovg_unit_test
%{_bindir}/glsltest1_vertshader.txt
%{_bindir}/glsltest1_fragshaderA.txt
%{_bindir}/glsltest1_fragshaderB.txt