c4d08067a065a2d7ce5c242765b377203f1454b5
[glsdk/meta-ti-glsdk.git] / recipes-graphics / libgles / libgles-omap3-x11.inc
1 DESCRIPTION = "libGLES for the omap3 (X11)"
2 LICENSE = "proprietary-binary"
3 # 'TSPA.txt' might not be the best file to md5sum
4 LIC_FILES_CHKSUM = "file://TSPA.txt;md5=c0d5d9c1e38b41677144c4e24d6ddee1"
6 PR = "r35"
8 COMPATIBLE_MACHINE = "(omap3|ti814x|ti816x|ti33x)"
10 X11DEPENDS = "virtual/libx11 libxau libxdmcp libdrm"
11 DEPENDS = "x11"
13 export SUPPORT_XORG ?= "1"
14 PVR_INIT ?= "pvrsrvinit"
16 PROVIDES += "virtual/egl virtual/libgles1 virtual/libgles2"
18 RREPLACES_${PN} = "libegl libgles1 libgles2 libgles-omap3"
19 RREPLACES_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev libgles-omap3-dev"
20 RREPLACES_${PN}-dbg = "libegl-dbg libgles-omap3-dbg"
22 RPROVIDES_${PN} = "libegl libgles1 libgles2 libgles-omap3"
23 RPROVIDES_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev libgles-omap3-dev"
24 RPROVIDES_${PN}-dbg = "libegl-dbg libgles-omap3-dbg"
26 RCONFLICTS_${PN} = "libegl libgles1 libgles2"
27 RCONFLICTS_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev libgles-omap3-dev"
28 RCONFLICTS_${PN}-dbg = "libegl-dbg libgles-omap3-dbg"
32 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/${SGXPV}/exports/${BINFILE} \
33                    file://cputype \
34                    file://rc_dri.pvr \
35                    file://sample.desktop \
36                    file://99-bufferclass.rules  \
37 "
39 S = "${WORKDIR}/OMAP35x_Graphics_SDK_${SGXPV}"
41 # Logic to unpack installjammer file
42 TI_BIN_UNPK_CMDS="Y: qY:workdir:Y"
43 require ../../recipes-ti/includes/ti-eula-unpack.inc
45 export BINLOCATION ?= "${S}/gfx_rel"
46 export ES3LOCATION ?= "${S}/gfx_rel_es3.x"
47 export ES5LOCATION ?= "${S}/gfx_rel_es5.x"
48 export ES6LOCATION ?= "${S}/gfx_rel_es6.x"
49 export ES8LOCATION ?= "${S}/gfx_rel_es8.x"
51 LIBGLESWINDOWSYSTEM ?= "libpvrPVR2D_DRIWSEGL.so"
53 do_configure() {
54         # Attempt to fix up the worst offenders for file permissions
55         for i in $(find ${S} -name "*.h") $(find ${S} -name "*.c") $(find ${S} -name "Make*") ; do
56                 chmod 0644 $i
57         done
59         # Attempt to create proper library softlinks
60         for sofile in $(find ${S} -name "lib*Open*.so") $(find ${S} -name "lib*srv*.so") $(find ${S} -name "lib*gl*.so") $(find ${S} -name "libpvr*.so") $(find ${S} -name "lib*GL*.so"); do
61                 if [ "$(readlink -n ${sofile})" = "" ] ; then
62                         mv $sofile ${sofile}.${IMGPV}
63                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}
64                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1}')
65                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1 "." $2}')
66                 fi
67         done
69         # Due to recursive make PLAT_* isn't always passed down correctly, so use sed to fix those
70         for mak in $(find ${S} -name "*.mak") ; do
71                 sed -i -e s:arm-none-linux-gnueabi-:${TARGET_PREFIX}:g $mak
72         done
74         # clear out old stuff
75         find Binaries/ | xargs rm -f || true
76 }
78 # Force in GNU_HASH and paths to libs
79 TARGET_CC_ARCH += " ${TARGET_LINK_HASH_STYLE} -Wl,-rpath-link,${BINLOCATION} -L${BINLOCATION} \
80 -L${STAGING_DIR_TARGET}${libdir} -Wl,-rpath-link,${STAGING_DIR_TARGET}${libdir}"
81 PARALLEL_MAKE = ""
83 PLATFORM ?= "LinuxOMAP3"
85 do_compile() {
86         export TOOLCHAIN="${TOOLCHAIN_PATH}"
87         export PLAT_CC="${CC}"
88         export PLAT_CPP="${CXX}"
89         export PLAR_AR="${AR}"
91         export X11ROOT="${STAGING_DIR_HOST}/usr"
92         mkdir -p ${S}/demos/x11
93         mkdir -p ${S}/trainingcourses/x11
95         mkdir -p ${S}/demos/raw
96         mkdir -p ${S}/trainingcourses/raw
98         # Rebuild demos
99                 for demo in ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Demos/* ; do
100                         cd $demo/OGLES/Build/LinuxGeneric
101                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
102                         rm $demo/OGLES/Build/${PLATFORM}/Release*/*.o
104                         install -m 0755 $demo/OGLES/Build/${PLATFORM}/ReleaseX11/* ${S}/demos/x11 || true
105                         sed -e s:NAME:$(basename $demo): \
106                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES/Build/${PLATFORM}/ReleaseX11/*): \
107                             ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
108                 done
110                 for demo in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Demos/* ; do
111                         cd $demo/OGLES2/Build/LinuxGeneric
112                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
113                         rm -f $demo/OGLES2/Build/${PLATFORM}/Release*/*.o
115                         install -m 0755 $demo/OGLES2/Build/${PLATFORM}/ReleaseX11/* ${S}/demos/x11 || true
116                         sed -e s:NAME:$(basename $demo): \
117                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES2/Build/${PLATFORM}/ReleaseX11/*): \
118                             ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
119                 done
122         find ${S} -name "*_org" -delete
124         # Build OGLES2 Trainingcourses
125                 for training in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/TrainingCourse/* ; do
126                         if [ -e $training/OGLES2/Build/LinuxGeneric/Makefile ] ; then
127                                 cd $training/OGLES2/Build/LinuxGeneric
128                         fi
130                         if [ -e $training/OGLES2/Build/${PLATFORM}/Makefile ] ; then
131                                 cd $training/OGLES2/Build/${PLATFORM}
132                         fi
134                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
135                         rm -f $training/OGLES2/Build/${PLATFORM}/Release*/*.o
137                         install -m 0755 $training/OGLES2/Build/${PLATFORM}/ReleaseX11/* ${S}/trainingcourses/x11 || true
138                 done
141 do_install () {
142         install -d ${D}${libdir}
143         cp -pPR ${BINLOCATION}/*.so* ${D}${libdir}
144         install -m 0644 ${BINLOCATION}/*.a ${D}${libdir}
146         install -d ${D}${bindir}/
147         install -m 0755 ${WORKDIR}/cputype ${D}${bindir}/
149         install -m 0755 ${BINLOCATION}/*_test ${D}${bindir}/
150         install -m 0755 ${BINLOCATION}/gl* ${D}${bindir}/
151         install -m 0755 ${BINLOCATION}/${PVR_INIT} ${D}${bindir}/
153         install -m 0755 ${BINLOCATION}/xgles1test1 ${D}${bindir}/
155         install -d ${D}${includedir}
156         cp -pPR ${S}/GFX_Linux_KM/include4 ${D}${includedir}/
157         cp -pPR ${S}/GFX_Linux_KM/services4 ${D}${includedir}/
159         cp -pPR ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include/* ${D}${includedir}/
160         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/* ${D}${includedir}/
161         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/${PLATFORM}/Include/GLES/* ${D}${includedir}/GLES/ 2>/dev/null || true
162         cp -pPr ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/${PLATFORM}/Include/GLES/* ${D}${includedir}/GLES2/ 2>/dev/null || true
163         cp -pPr ${S}/include/wsegl/*.h ${D}${includedir} || true
164         
165         install -d ${D}${sysconfdir}/init.d/
167         install -d ${D}${sysconfdir}
168         echo "[default]" > ${D}${sysconfdir}/powervr.ini
169         echo "WindowSystem=${LIBGLESWINDOWSYSTEM}" >> ${D}${sysconfdir}/powervr.ini
171         # The ES3.x, ES5.x and ES6.x CPUs have different SGX hardware, so we need to install multiple sets of userspace
173         install -d ${D}${libdir}/ES8.0
174         install -d ${D}${libdir}/ES6.0
175         install -d ${D}${libdir}/ES5.0
176         install -d ${D}${libdir}/ES3.0
178         install -d ${D}${bindir}/ES8.0
179         install -d ${D}${bindir}/ES6.0
180         install -d ${D}${bindir}/ES5.0
181         install -d ${D}${bindir}/ES3.0
183         x11_prog="eglinfo_x xgles1test1 xgles2test1 xmultiegltest"
185         for esrev in 3 5 6 8 ; do
186                 ESLOCATION=$(eval echo $(echo \$\{ES${esrev}LOCATION\}))
187                 if [ -e ${ESLOCATION} ] ; then
188                         cp -pPR ${ESLOCATION}/lib*${IMGPV} ${ESLOCATION}/pvr_drv.so ${ESLOCATION}/*.a ${D}${libdir}/ES${esrev}.0/
189                         for esprog in $x11_prog ; do
190                                 install -m 0755 ${ESLOCATION}/$esprog ${D}${bindir}/ES${esrev}.0/ 2>/dev/null || true
191                         done
192                 fi
193         done
195         rm ${D}${bindir}/ES*/*.h ${D}${bindir}/ES*/pdsasm ${D}${bindir}/pdsasm -f || true
197         install -d ${D}${prefix}/share/applications
198         cp ${WORKDIR}/*.desktop ${D}${prefix}/share/applications
199         rm ${D}${prefix}/share/applications/sample.desktop
201         install -d ${D}${bindir}/SGX/demos/X11/
202         install -m 0755 ${S}/demos/x11/* ${D}${bindir}/SGX/demos/X11/
203         install -d ${D}${bindir}/SGX/trainingcourses/X11  2>/dev/null || true
204         install -m 0755 ${S}/trainingcourses/x11/* ${D}${bindir}/SGX/trainingcourses/X11/ 2>/dev/null || true
206         # Delete objects and linker scripts hidden between the headers
207         find ${D} -name "*.o" -delete
208         find ${D} -name "*.o.cmd" -delete
210         install -d ${D}${sysconfdir}/udev/rules.d
211         install -m 0644 ${WORKDIR}/99-bufferclass.rules ${D}${sysconfdir}/udev/rules.d/
215 PACKAGES =+ "${PN}-x11demos ${PN}-x11trainingcourses xserver-kdrive-powervrsgx"
217 # Package the base libraries per silicon revision
218 PACKAGES =+ "${PN}-es3 ${PN}-es5 ${PN}-es6 ${PN}-es8"
219 RRECOMMENDS_${PN} += "${PN}-es3 ${PN}-es5 ${PN}-es6 ${PN}-es8"
220 FILES_${PN}-es3 = "${libdir}/ES3*/* ${bindir}/ES3*/*"
221 FILES_${PN}-es5 = "${libdir}/ES5*/* ${bindir}/ES5*/*"
222 FILES_${PN}-es6 = "${libdir}/ES6*/* ${bindir}/ES6*/*"
223 FILES_${PN}-es8 = "${libdir}/ES8*/* ${bindir}/ES8*/*"
225 # Stop shlib code from picking a subpackage
226 PRIVATE_LIBS_${PN}-es3 = "libGLESv2.so libIMGegl.so libsrv_um.so libOpenVG.so libpvr2d.so libsrv_init.so libEGL.so libsrv_um_dri.so libOpenVGU.so libglslcompiler.so libGLES_CM.so"
227 PRIVATE_LIBS_${PN}-es5 = "libGLESv2.so libIMGegl.so libsrv_um.so libOpenVG.so libpvr2d.so libsrv_init.so libEGL.so libsrv_um_dri.so libOpenVGU.so libglslcompiler.so libGLES_CM.so"
228 PRIVATE_LIBS_${PN}-es6 = "libGLESv2.so libIMGegl.so libsrv_um.so libOpenVG.so libpvr2d.so libsrv_init.so libEGL.so libsrv_um_dri.so libOpenVGU.so libglslcompiler.so libGLES_CM.so"
229 PRIVATE_LIBS_${PN}-es8 = "libGLESv2.so libIMGegl.so libsrv_um.so libOpenVG.so libpvr2d.so libsrv_init.so libEGL.so libsrv_um_dri.so libOpenVGU.so libglslcompiler.so libGLES_CM.so"
231 PACKAGES =+ "${PN}-x11wsegl ${PN}-driwsegl"
232 FILES_${PN}-x11wsegl = "${libdir}/libpvrPVR2D_X11WSEGL.so* ${bindir}/x* ${bindir}/*x"
233 FILES_${PN}-driwsegl = "${libdir}/libpvrPVR2D_DRIWSEGL.so* ${libdir}/libsrv_um_dri*"
235 X11_SEGL = " ${PN}-x11wsegl-es2 ${PN}-x11wsegl-es3 ${PN}-x11wsegl-es5 ${PN}-x11wsegl-es6 ${PN}-x11wsegl-es8 ${PN}-driwsegl-es2 ${PN}-driwsegl-es3 ${PN}-driwsegl-es5 ${PN}-driwsegl-es6 ${PN}-driwsegl-es8 "
236 PACKAGES =+ "${X11_SEGL}"
237 FILES_${PN}-x11wsegl-es2 = "${libdir}/ES2*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES2*/x* ${bindir}/ES2*/*x"
238 FILES_${PN}-x11wsegl-es3 = "${libdir}/ES3*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES3*/x* ${bindir}/ES3*/*x"
239 FILES_${PN}-x11wsegl-es5 = "${libdir}/ES5*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES5*/x* ${bindir}/ES5*/*x"
240 FILES_${PN}-x11wsegl-es6 = "${libdir}/ES6*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES6*/x* ${bindir}/ES6*/*x"
241 FILES_${PN}-x11wsegl-es8 = "${libdir}/ES8*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES8*/x* ${bindir}/ES8*/*x"
242 RRECOMMENDS_${PN}-x11wsegl = " ${PN}-x11wsegl-es2 ${PN}-x11wsegl-es3 ${PN}-x11wsegl-es5 ${PN}-x11wsegl-es6 ${PN}-x11wsegl-es8"
244 FILES_${PN}-driwsegl-es2 = "${libdir}/ES2*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES2*/libsrv_um_dri*"
245 FILES_${PN}-driwsegl-es3 = "${libdir}/ES3*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES3*/libsrv_um_dri*"
246 FILES_${PN}-driwsegl-es5 = "${libdir}/ES5*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES5*/libsrv_um_dri*"
247 FILES_${PN}-driwsegl-es6 = "${libdir}/ES6*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES6*/libsrv_um_dri*"
248 FILES_${PN}-driwsegl-es8 = "${libdir}/ES8*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES8*/libsrv_um_dri*"
249 RRECOMMENDS_${PN}-driwsegl = " ${PN}-driwsegl-es2 ${PN}-driwsegl-es3 ${PN}-driwsegl-es5 ${PN}-driwsegl-es6 ${PN}-driwsegl-es8"
251 CONFFILES_${PN} = "${sysconfdir}/powervr.ini"
253 FILES_${PN} = "${sysconfdir} ${libdir}/*.so* ${bindir}/${PVR_INIT} ${bindir}/cputype ${bindir}/*"
255 FILES_xserver-kdrive-powervrsgx = "${bindir}/Xsgx"
256 FILES_${PN}-tests = "${bindir}/*test*"
257 FILES_${PN}-dbg = "${libdir}/.debug/* ${bindir}/.debug/* \
258                    ${libdir}/ES*/.debug ${bindir}/*/.debug\
259                    ${bindir}/SGX/demos/*/.debug/* \
260                    ${bindir}/SGX/trainingcourses/*/.debug/* \
263 FILES_${PN}-x11demos = "${bindir}/SGX/demos/X11/* ${prefix}/share/applications "
264 RRECOMMENDS_${PN}-x11demos = "${PN}-x11wsegl"
266 FILES_${PN}-x11trainingcourses = "${bindir}/SGX/trainingcourses/X11/*"
267 RRECOMMENDS_${PN}-x11trainingcourses = "${PN}-x11wsegl"
269 # The libs need the kernel-modules
270 RRECOMMENDS_${PN} += "omap3-sgx-modules-x11"
272 # The initscript calls fbset, cputype calls devmem2
273 RDEPENDS_${PN} += "fbset devmem2"
275 #HACK! These are binaries, so we can't guarantee that LDFLAGS match :(
276 INSANE_SKIP_${PN} = "ldflags dev-so"
277 INSANE_SKIP_${PN}-es3 = "ldflags dev-so staticdev"
278 INSANE_SKIP_${PN}-es5 = "ldflags dev-so staticdev"
279 INSANE_SKIP_${PN}-es6 = "ldflags dev-so staticdev"
280 INSANE_SKIP_${PN}-es8 = "ldflags dev-so staticdev"
281 INSANE_SKIP_${PN}-x11demos = "ldflags dev-so useless-rpaths"
282 INSANE_SKIP_${PN}-x11wsegl = "ldflags dev-so"
283 INSANE_SKIP_${PN}-x11wsegl-es3 = "ldflags dev-so"
284 INSANE_SKIP_${PN}-x11wsegl-es5 = "ldflags dev-so"
285 INSANE_SKIP_${PN}-x11wsegl-es6 = "ldflags dev-so"
286 INSANE_SKIP_${PN}-x11wsegl-es8 = "ldflags dev-so"
287 INSANE_SKIP_${PN}-driwsegl = "ldflags dev-so"
288 INSANE_SKIP_${PN}-driwsegl-es3 = "ldflags dev-so"
289 INSANE_SKIP_${PN}-driwsegl-es5 = "ldflags dev-so"
290 INSANE_SKIP_${PN}-driwsegl-es6 = "ldflags dev-so"
291 INSANE_SKIP_${PN}-driwsegl-es8 = "ldflags dev-so"
292 INSANE_SKIP_${PN}-tests = "ldflags"
293 INSANE_SKIP_xserver-kdrive-powervrsgx = "ldflags"
294 INSANE_SKIP_${PN}-dev = "ldflags dev-so"
296 inherit update-rc.d
298 INITSCRIPT_NAME = "pvr-init"
299 INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."
301 # Append to update-rc.d postinst
302 pkg_postinst_${PN}_append() {
303 rm -f $D${sysconfdir}/powervr-esrev
305 ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0
306 ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0
310 pkg_postinst_${PN}-x11wsegl() {
311 rm -f $D${sysconfdir}/powervr-esrev
313 echo "[default]" > $D${sysconfdir}/powervr.ini
314 echo "WindowSystem=libpvrPVR2D_X11WSEGL.so.1" >> $D${sysconfdir}/powervr.ini
317 pkg_postinst_${PN}-driwsegl() {
318 rm -f $D${sysconfdir}/powervr-esrev