libgles-omap3: don't RCONFLICT/RREPLACE no-x version with x11 as it breaks non-X...
[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 DEPENDS = "virtual/libx11 libxau libxdmcp libdrm"
12 export SUPPORT_XORG ?= "1"
13 PVR_INIT ?= "pvrsrvinit"
15 PROVIDES += "virtual/egl virtual/libgles1 virtual/libgles2"
17 RREPLACES_${PN} = "libegl libgles1 libgles2"
18 RREPLACES_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev"
19 RREPLACES_${PN}-dbg = "libegl-dbg"
21 RPROVIDES_${PN} = "libegl libgles1 libgles2"
22 RPROVIDES_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev"
23 RPROVIDES_${PN}-dbg = "libegl-dbg"
25 RCONFLICTS_${PN} = "libegl libgles1 libgles2"
26 RCONFLICTS_${PN}-dev = "libegl-dev libgles1-dev libgles2-dev"
27 RCONFLICTS_${PN}-dbg = "libegl-dbg"
29 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/${SGXPV}/exports/${BINFILE} \
30                    file://cputype \
31                    file://rc_dri.pvr \
32                    file://sample.desktop \
33                    file://99-bufferclass.rules  \
34 "
36 S = "${WORKDIR}/OMAP35x_Graphics_SDK_${SGXPV}"
38 # Logic to unpack installjammer file
39 TI_BIN_UNPK_CMDS="Y: qY:workdir:Y"
40 require ../../recipes-ti/includes/ti-eula-unpack.inc
42 export BINLOCATION ?= "${S}/gfx_rel"
43 export ES3LOCATION ?= "${S}/gfx_rel_es3.x"
44 export ES5LOCATION ?= "${S}/gfx_rel_es5.x"
45 export ES6LOCATION ?= "${S}/gfx_rel_es6.x"
46 export ES8LOCATION ?= "${S}/gfx_rel_es8.x"
48 LIBGLESWINDOWSYSTEM ?= "libpvrPVR2D_DRIWSEGL.so"
50 do_configure() {
51         # Attempt to fix up the worst offenders for file permissions
52         for i in $(find ${S} -name "*.h") $(find ${S} -name "*.c") $(find ${S} -name "Make*") ; do
53                 chmod 0644 $i
54         done
56         # Attempt to create proper library softlinks
57         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
58                 if [ "$(readlink -n ${sofile})" = "" ] ; then
59                         mv $sofile ${sofile}.${IMGPV}
60                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}
61                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1}')
62                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1 "." $2}')
63                 fi
64         done
66         # Due to recursive make PLAT_* isn't always passed down correctly, so use sed to fix those
67         for mak in $(find ${S} -name "*.mak") ; do
68                 sed -i -e s:arm-none-linux-gnueabi-:${TARGET_PREFIX}:g $mak
69         done
71         # clear out old stuff
72         find Binaries/ | xargs rm -f || true
73 }
75 # Force in GNU_HASH and paths to libs
76 TARGET_CC_ARCH += " ${TARGET_LINK_HASH_STYLE} -Wl,-rpath-link,${BINLOCATION} -L${BINLOCATION} \
77 -L${STAGING_DIR_TARGET}${libdir} -Wl,-rpath-link,${STAGING_DIR_TARGET}${libdir}"
78 PARALLEL_MAKE = ""
80 PLATFORM ?= "LinuxOMAP3"
82 do_compile() {
83         export TOOLCHAIN="${TOOLCHAIN_PATH}"
84         export PLAT_CC="${CC}"
85         export PLAT_CPP="${CXX}"
86         export PLAR_AR="${AR}"
88         export X11ROOT="${STAGING_DIR_HOST}/usr"
89         mkdir -p ${S}/demos/x11
90         mkdir -p ${S}/trainingcourses/x11
92         mkdir -p ${S}/demos/raw
93         mkdir -p ${S}/trainingcourses/raw
95         # Rebuild demos
96                 for demo in ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Demos/* ; do
97                         cd $demo/OGLES/Build/LinuxGeneric
98                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
99                         rm $demo/OGLES/Build/${PLATFORM}/Release*/*.o
101                         install -m 0755 $demo/OGLES/Build/${PLATFORM}/ReleaseX11/* ${S}/demos/x11 || true
102                         sed -e s:NAME:$(basename $demo): \
103                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES/Build/${PLATFORM}/ReleaseX11/*): \
104                             ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
105                 done
107                 for demo in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Demos/* ; do
108                         cd $demo/OGLES2/Build/LinuxGeneric
109                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
110                         rm -f $demo/OGLES2/Build/${PLATFORM}/Release*/*.o
112                         install -m 0755 $demo/OGLES2/Build/${PLATFORM}/ReleaseX11/* ${S}/demos/x11 || true
113                         sed -e s:NAME:$(basename $demo): \
114                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES2/Build/${PLATFORM}/ReleaseX11/*): \
115                             ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
116                 done
119         find ${S} -name "*_org" -delete
121         # Build OGLES2 Trainingcourses
122                 for training in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/TrainingCourse/* ; do
123                         if [ -e $training/OGLES2/Build/LinuxGeneric/Makefile ] ; then
124                                 cd $training/OGLES2/Build/LinuxGeneric
125                         fi
127                         if [ -e $training/OGLES2/Build/${PLATFORM}/Makefile ] ; then
128                                 cd $training/OGLES2/Build/${PLATFORM}
129                         fi
131                         oe_runmake Common=1 PLATFORM=${PLATFORM} X11BUILD=1
132                         rm -f $training/OGLES2/Build/${PLATFORM}/Release*/*.o
134                         install -m 0755 $training/OGLES2/Build/${PLATFORM}/ReleaseX11/* ${S}/trainingcourses/x11 || true
135                 done
138 do_install () {
139         install -d ${D}${libdir}
140         cp -pPR ${BINLOCATION}/*.so* ${D}${libdir}
141         install -m 0644 ${BINLOCATION}/*.a ${D}${libdir}
143         install -d ${D}${bindir}/
144         install -m 0755 ${WORKDIR}/cputype ${D}${bindir}/
146         install -m 0755 ${BINLOCATION}/*_test ${D}${bindir}/
147         install -m 0755 ${BINLOCATION}/gl* ${D}${bindir}/
148         install -m 0755 ${BINLOCATION}/${PVR_INIT} ${D}${bindir}/
150         install -m 0755 ${BINLOCATION}/xgles1test1 ${D}${bindir}/
152         install -d ${D}${includedir}
153         cp -pPR ${S}/GFX_Linux_KM/include4 ${D}${includedir}/
154         cp -pPR ${S}/GFX_Linux_KM/services4 ${D}${includedir}/
156         cp -pPR ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include/* ${D}${includedir}/
157         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/* ${D}${includedir}/
158         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/${PLATFORM}/Include/GLES/* ${D}${includedir}/GLES/ 2>/dev/null || true
159         cp -pPr ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/${PLATFORM}/Include/GLES/* ${D}${includedir}/GLES2/ 2>/dev/null || true
160         cp -pPr ${S}/include/wsegl/*.h ${D}${includedir} || true
161         
162         install -d ${D}${sysconfdir}/init.d/
164         install -d ${D}${sysconfdir}
165         echo "[default]" > ${D}${sysconfdir}/powervr.ini
166         echo "WindowSystem=${LIBGLESWINDOWSYSTEM}" >> ${D}${sysconfdir}/powervr.ini
168         # The ES3.x, ES5.x and ES6.x CPUs have different SGX hardware, so we need to install multiple sets of userspace
170         install -d ${D}${libdir}/ES8.0
171         install -d ${D}${libdir}/ES6.0
172         install -d ${D}${libdir}/ES5.0
173         install -d ${D}${libdir}/ES3.0
175         install -d ${D}${bindir}/ES8.0
176         install -d ${D}${bindir}/ES6.0
177         install -d ${D}${bindir}/ES5.0
178         install -d ${D}${bindir}/ES3.0
180         x11_prog="eglinfo_x xgles1test1 xgles2test1 xmultiegltest"
182         for esrev in 3 5 6 8 ; do
183                 ESLOCATION=$(eval echo $(echo \$\{ES${esrev}LOCATION\}))
184                 if [ -e ${ESLOCATION} ] ; then
185                         cp -pPR ${ESLOCATION}/lib*${IMGPV} ${ESLOCATION}/pvr_drv.so ${ESLOCATION}/*.a ${D}${libdir}/ES${esrev}.0/
186                         for esprog in $x11_prog ; do
187                                 install -m 0755 ${ESLOCATION}/$esprog ${D}${bindir}/ES${esrev}.0/ 2>/dev/null || true
188                         done
189                 fi
190         done
192         rm ${D}${bindir}/ES*/*.h ${D}${bindir}/ES*/pdsasm ${D}${bindir}/pdsasm -f || true
194         install -d ${D}${prefix}/share/applications
195         cp ${WORKDIR}/*.desktop ${D}${prefix}/share/applications
196         rm ${D}${prefix}/share/applications/sample.desktop
198         install -d ${D}${bindir}/SGX/demos/X11/
199         install -m 0755 ${S}/demos/x11/* ${D}${bindir}/SGX/demos/X11/
200         install -d ${D}${bindir}/SGX/trainingcourses/X11  2>/dev/null || true
201         install -m 0755 ${S}/trainingcourses/x11/* ${D}${bindir}/SGX/trainingcourses/X11/ 2>/dev/null || true
203         # Delete objects and linker scripts hidden between the headers
204         find ${D} -name "*.o" -delete
205         find ${D} -name "*.o.cmd" -delete
207         install -d ${D}${sysconfdir}/udev/rules.d
208         install -m 0644 ${WORKDIR}/99-bufferclass.rules ${D}${sysconfdir}/udev/rules.d/
212 PACKAGES =+ "${PN}-x11demos ${PN}-x11trainingcourses xserver-kdrive-powervrsgx"
214 # Package the base libraries per silicon revision
215 PACKAGES =+ "${PN}-es3 ${PN}-es5 ${PN}-es6 ${PN}-es8"
216 RRECOMMENDS_${PN} += "${PN}-es3 ${PN}-es5 ${PN}-es6 ${PN}-es8"
217 FILES_${PN}-es3 = "${libdir}/ES3*/* ${bindir}/ES3*/*"
218 FILES_${PN}-es5 = "${libdir}/ES5*/* ${bindir}/ES5*/*"
219 FILES_${PN}-es6 = "${libdir}/ES6*/* ${bindir}/ES6*/*"
220 FILES_${PN}-es8 = "${libdir}/ES8*/* ${bindir}/ES8*/*"
222 # Stop shlib code from picking a subpackage
223 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"
224 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"
225 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"
226 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"
228 PACKAGES =+ "${PN}-x11wsegl ${PN}-driwsegl"
229 FILES_${PN}-x11wsegl = "${libdir}/libpvrPVR2D_X11WSEGL.so* ${bindir}/x* ${bindir}/*x"
230 FILES_${PN}-driwsegl = "${libdir}/libpvrPVR2D_DRIWSEGL.so* ${libdir}/libsrv_um_dri*"
232 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 "
233 PACKAGES =+ "${X11_SEGL}"
234 FILES_${PN}-x11wsegl-es2 = "${libdir}/ES2*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES2*/x* ${bindir}/ES2*/*x"
235 FILES_${PN}-x11wsegl-es3 = "${libdir}/ES3*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES3*/x* ${bindir}/ES3*/*x"
236 FILES_${PN}-x11wsegl-es5 = "${libdir}/ES5*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES5*/x* ${bindir}/ES5*/*x"
237 FILES_${PN}-x11wsegl-es6 = "${libdir}/ES6*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES6*/x* ${bindir}/ES6*/*x"
238 FILES_${PN}-x11wsegl-es8 = "${libdir}/ES8*/libpvrPVR2D_X11WSEGL.so.* ${bindir}/ES8*/x* ${bindir}/ES8*/*x"
239 RRECOMMENDS_${PN}-x11wsegl = " ${PN}-x11wsegl-es2 ${PN}-x11wsegl-es3 ${PN}-x11wsegl-es5 ${PN}-x11wsegl-es6 ${PN}-x11wsegl-es8"
241 FILES_${PN}-driwsegl-es2 = "${libdir}/ES2*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES2*/libsrv_um_dri*"
242 FILES_${PN}-driwsegl-es3 = "${libdir}/ES3*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES3*/libsrv_um_dri*"
243 FILES_${PN}-driwsegl-es5 = "${libdir}/ES5*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES5*/libsrv_um_dri*"
244 FILES_${PN}-driwsegl-es6 = "${libdir}/ES6*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES6*/libsrv_um_dri*"
245 FILES_${PN}-driwsegl-es8 = "${libdir}/ES8*/libpvrPVR2D_DRIWSEGL.so.* ${libdir}/ES8*/libsrv_um_dri*"
246 RRECOMMENDS_${PN}-driwsegl = " ${PN}-driwsegl-es2 ${PN}-driwsegl-es3 ${PN}-driwsegl-es5 ${PN}-driwsegl-es6 ${PN}-driwsegl-es8"
248 CONFFILES_${PN} = "${sysconfdir}/powervr.ini"
250 FILES_${PN} = "${sysconfdir} ${libdir}/*.so* ${bindir}/${PVR_INIT} ${bindir}/cputype ${bindir}/*"
252 FILES_xserver-kdrive-powervrsgx = "${bindir}/Xsgx"
253 FILES_${PN}-tests = "${bindir}/*test*"
254 FILES_${PN}-dbg = "${libdir}/.debug/* ${bindir}/.debug/* \
255                    ${libdir}/ES*/.debug ${bindir}/*/.debug\
256                    ${bindir}/SGX/demos/*/.debug/* \
257                    ${bindir}/SGX/trainingcourses/*/.debug/* \
260 FILES_${PN}-x11demos = "${bindir}/SGX/demos/X11/* ${prefix}/share/applications "
261 RRECOMMENDS_${PN}-x11demos = "${PN}-x11wsegl"
263 FILES_${PN}-x11trainingcourses = "${bindir}/SGX/trainingcourses/X11/*"
264 RRECOMMENDS_${PN}-x11trainingcourses = "${PN}-x11wsegl"
266 # The libs need the kernel-modules
267 RRECOMMENDS_${PN} += "omap3-sgx-modules-x11"
269 # The initscript calls fbset, cputype calls devmem2
270 RDEPENDS_${PN} += "fbset devmem2"
272 #HACK! These are binaries, so we can't guarantee that LDFLAGS match :(
273 INSANE_SKIP_${PN} = "ldflags dev-so"
274 INSANE_SKIP_${PN}-es3 = "ldflags dev-so staticdev"
275 INSANE_SKIP_${PN}-es5 = "ldflags dev-so staticdev"
276 INSANE_SKIP_${PN}-es6 = "ldflags dev-so staticdev"
277 INSANE_SKIP_${PN}-es8 = "ldflags dev-so staticdev"
278 INSANE_SKIP_${PN}-x11demos = "ldflags dev-so useless-rpaths"
279 INSANE_SKIP_${PN}-x11wsegl = "ldflags dev-so"
280 INSANE_SKIP_${PN}-x11wsegl-es3 = "ldflags dev-so"
281 INSANE_SKIP_${PN}-x11wsegl-es5 = "ldflags dev-so"
282 INSANE_SKIP_${PN}-x11wsegl-es6 = "ldflags dev-so"
283 INSANE_SKIP_${PN}-x11wsegl-es8 = "ldflags dev-so"
284 INSANE_SKIP_${PN}-driwsegl = "ldflags dev-so"
285 INSANE_SKIP_${PN}-driwsegl-es3 = "ldflags dev-so"
286 INSANE_SKIP_${PN}-driwsegl-es5 = "ldflags dev-so"
287 INSANE_SKIP_${PN}-driwsegl-es6 = "ldflags dev-so"
288 INSANE_SKIP_${PN}-driwsegl-es8 = "ldflags dev-so"
289 INSANE_SKIP_${PN}-tests = "ldflags"
290 INSANE_SKIP_xserver-kdrive-powervrsgx = "ldflags"
291 INSANE_SKIP_${PN}-dev = "ldflags dev-so"
293 inherit update-rc.d
295 INITSCRIPT_NAME = "pvr-init"
296 INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."
298 # Append to update-rc.d postinst
299 pkg_postinst_${PN}_append() {
300 rm -f $D${sysconfdir}/powervr-esrev
302 ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0
303 ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0
307 pkg_postinst_${PN}-x11wsegl() {
308 rm -f $D${sysconfdir}/powervr-esrev
310 echo "[default]" > $D${sysconfdir}/powervr.ini
311 echo "WindowSystem=libpvrPVR2D_X11WSEGL.so.1" >> $D${sysconfdir}/powervr.ini
314 pkg_postinst_${PN}-driwsegl() {
315 rm -f $D${sysconfdir}/powervr-esrev