2868fabee3efae52e44f8929b3ba6d1f034bf767
[glsdk/meta-ti-glsdk.git] / recipes-graphics / libgles / libgles-omap3.inc
1 DESCRIPTION = "libGLES for the omap3"
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 = "r15"
8 COMPATIBLE_MACHINE = "(omap3|ti816x)"
10 DEPENDS = "virtual/libx11 libxau libxdmcp"
12 PROVIDES += "virtual/egl"
14 SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/${SGXPV}/exports/OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin \
15                    file://cputype \
16                    file://rc.pvr \
17                    file://sample.desktop \
18                    file://99-bufferclass.rules  \
19 "
21 S = "${WORKDIR}/OMAP35x_Graphics_SDK_${SGXPV}"
23 # Logic to unpack installjammer file
24 TI_BIN_UNPK_CMDS="Y: qY:workdir:Y"
25 require ../../recipes-ti/includes/ti-eula-unpack.inc
27 BINLOCATION ?= "${S}/gfx_rel"
28 ES2LOCATION ?= "${S}/gfx_rel_es2.x"
29 ES3LOCATION ?= "${S}/gfx_rel_es3.x"
30 ES5LOCATION ?= "${S}/gfx_rel_es5.x"
31 ES6LOCATION ?= "${S}/gfx_rel_es6.x"
33 do_configure() {
34         # Attempt to fix up the worst offenders for file permissions
35         for i in $(find ${S} -name "*.h") $(find ${S} -name "*.c") $(find ${S} -name "Make*") ; do
36                 chmod 0644 $i
37         done 
39         # Attempt to create proper library softlinks
40         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
41                 if [ "$(readlink -n ${sofile})" = "" ] ; then
42                         mv $sofile ${sofile}.${IMGPV}
43                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}
44                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1}')
45                         ln -sf $(basename ${sofile}.${IMGPV}) ${sofile}$(echo ${IMGPV} | awk -F. '{print "." $1 "." $2}')
46                 fi
47         done
49         # Due to recursive make PLAT_* isn't always passed down correctly, so use sed to fix those
50         for mak in $(find ${S} -name "*.mak") ; do
51                 sed -i -e s:arm-none-linux-gnueabi-:${TARGET_PREFIX}:g $mak
52         done
54         # clear out old stuff
55         find Binaries/ | xargs rm -f || true
56 }
58 # Force in GNU_HASH and paths to libs
59 TARGET_CC_ARCH += " ${TARGET_LINK_HASH_STYLE} -Wl,-rpath-link,${BINLOCATION} -L${BINLOCATION} \
60 -L${STAGING_DIR_TARGET}${libdir} -Wl,-rpath-link,${STAGING_DIR_TARGET}${libdir}"
61 PARALLEL_MAKE = ""
63 do_compile() {
64         export X11ROOT="${STAGING_DIR_HOST}/usr"
65         export TOOLCHAIN="${TOOLCHAIN_PATH}"
66         export PLATFORM="LinuxOMAP3"
68         export PLAT_CC="${CC}"
69         export PLAT_CPP="${CXX}"
70         export PLAR_AR="${AR}"
72         mkdir -p ${S}/demos/raw
73         mkdir -p ${S}/demos/x11
75         # Rebuild demos for both Raw and X11
76         for X11BUILD in 0 1 ; do
77                 for demo in ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Demos/* ; do
78                         cd $demo/OGLES/Build/LinuxGeneric
79                         oe_runmake Common=1 PLATFORM=$PLATFORM X11BUILD=$X11BUILD  
80                         rm $demo/OGLES/Build/LinuxOMAP3/Release*/*.o
81                         install -m 0755 $demo/OGLES/Build/LinuxOMAP3/ReleaseX11/* ${S}/demos/x11 || true
82                         sed -e s:NAME:$(basename $demo): \
83                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES/Build/LinuxOMAP3/ReleaseX11/*): \
84                              ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
85                         install -m 0755 $demo/OGLES/Build/LinuxOMAP3/ReleaseRaw/* ${S}/demos/raw || true        
86                 done
87                 for demo in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Demos/* ; do
88                         cd $demo/OGLES2/Build/LinuxGeneric
89                         oe_runmake Common=1 PLATFORM=$PLATFORM X11BUILD=$X11BUILD  
90                         rm -f $demo/OGLES2/Build/LinuxOMAP3/Release*/*.o
91                         install -m 0755 $demo/OGLES2/Build/LinuxOMAP3/ReleaseX11/* ${S}/demos/x11 || true
92                         sed -e s:NAME:$(basename $demo): \
93                             -e s:EXEC:${bindir}/SGX/demos/X11/$(basename $demo/OGLES2/Build/LinuxOMAP3/ReleaseX11/*): \
94                              ${WORKDIR}/sample.desktop > ${WORKDIR}/$(basename $demo).desktop
95                         install -m 0755 $demo/OGLES2/Build/LinuxOMAP3/ReleaseRaw/* ${S}/demos/raw || true       
96                 done
97         done
99         mkdir -p ${S}/trainingcourses/raw
100         mkdir -p ${S}/trainingcourses/x11
102         find ${S} -name "*_org" -delete
104         # Build OGLES2 Trainingcourses for both Raw and X11
105         for X11BUILD in 0 1 ; do
106                 for training in ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/TrainingCourse/* ; do
107                         if [ -e $training/OGLES2/Build/LinuxGeneric/Makefile ] ; then
108                                 cd $training/OGLES2/Build/LinuxGeneric
109                         fi
111                         if [ -e $training/OGLES2/Build/LinuxOMAP3/Makefile ] ; then
112                                 cd $training/OGLES2/Build/LinuxOMAP3
113                         fi                      
115                         oe_runmake Common=1 PLATFORM=$PLATFORM X11BUILD=$X11BUILD  
116                         rm -f $training/OGLES2/Build/LinuxOMAP3/Release*/*.o
117                         install -m 0755 $training/OGLES2/Build/LinuxOMAP3/ReleaseX11/* ${S}/trainingcourses/x11 || true
118                         install -m 0755 $training/OGLES2/Build/LinuxOMAP3/ReleaseRaw/* ${S}/trainingcourses/raw || true 
119                 done
120         done
124 do_install () {
125         install -d ${D}${libdir}
126         cp -pPR ${BINLOCATION}/*.so* ${D}${libdir}
127         install -m 0644 ${BINLOCATION}/*.a ${D}${libdir}
129         install -d ${D}${bindir}/
130         install -m 0755 ${WORKDIR}/cputype ${D}${bindir}/
132         install -m 0755 ${BINLOCATION}/*_test ${D}${bindir}/
133         install -m 0755 ${BINLOCATION}/gl* ${D}${bindir}/
134         install -m 0755 ${BINLOCATION}/p[dv]* ${D}${bindir}/
135         install -m 0755 ${BINLOCATION}/xgles1test1 ${D}${bindir}/
137         install -m 0755 ${BINLOCATION}/freedesktop/kdrive/usr/X11R6_SGX/bin/Xsgx ${D}${bindir}/|| true
139         install -d ${D}${includedir}
140         cp -pPR ${S}/GFX_Linux_KM/include4 ${D}${includedir}/
141         cp -pPR ${S}/GFX_Linux_KM/services4 ${D}${includedir}/
143         cp -pPR ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include/* ${D}${includedir}/
144         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/* ${D}${includedir}/
145         cp -pPR ${S}/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/LinuxOMAP3/Include/GLES/* ${D}${includedir}/GLES/ || true
146         cp -pPr ${S}/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/LinuxOMAP3/Include/GLES/* ${D}${includedir}/GLES2/ || true
147         cp -pPr ${S}/GFX_Linux_SDK/OVG/SDKPackage/Builds/OVG/Include/v* ${D}${includedir}/ || true
148         cp -pPr ${S}/GFX_Linux_SDK/OVG/SDKPackage/Builds/OVG/Include/V* ${D}${includedir}/ || true
149         cp -pPr ${S}/include/*.h ${D}${includedir} || true
150         cp -pPr ${S}/include/wsegl/*.h ${D}${includedir} || true
151         
152         install -d ${D}${sysconfdir}/init.d/
153         cp -pP ${WORKDIR}/rc.pvr ${D}${sysconfdir}/init.d/pvr-init
155         install -d ${D}${sysconfdir}
156         echo "[default]" > ${D}${sysconfdir}/powervr.ini
157         echo "WindowSystem=libpvrPVR2D_FRONTWSEGL.so.1" >> ${D}${sysconfdir}/powervr.ini
159         # The ES2.x, ES3.x, ES5.x and ES6.x CPUs have different SGX hardware, so we need to install multiple sets of userspace
161         install -d ${D}${libdir}/ES6.0
162         install -d ${D}${libdir}/ES5.0
163         install -d ${D}${libdir}/ES3.0
164         install -d ${D}${libdir}/ES2.0
166         install -d ${D}${bindir}/ES6.0
167         install -d ${D}${bindir}/ES5.0
168         install -d ${D}${bindir}/ES3.0
169         install -d ${D}${bindir}/ES2.0
172         cp -pPR ${ES2LOCATION}/lib*${IMGPV} ${D}${libdir}/ES2.0/
173         cp ${ES2LOCATION}/p[dv]* ${D}${bindir}/ES2.0/
175         cp -pPR ${D}${libdir}/lib*${IMGPV} ${D}${libdir}/ES3.0/
176         cp ${D}${bindir}/p[dv]* ${D}${bindir}/ES3.0
178         if [ -e ${ES5LOCATION} ] ; then 
179                 cp -pPR ${ES5LOCATION}/lib*${IMGPV} ${D}${libdir}/ES5.0/
180                 cp ${ES5LOCATION}/p[dv]* ${D}${bindir}/ES5.0/
181         fi
183         if [ -e ${ES6LOCATION} ] ; then
184                 cp -pPR ${ES6LOCATION}/lib*${IMGPV} ${D}${libdir}/ES6.0/
185                 cp ${ES6LOCATION}/p[dv]* ${D}${bindir}/ES6.0/
186         fi
188         rm ${D}${bindir}/ES*/*.h ${D}${bindir}/ES*/pdsasm ${D}${bindir}/pdsasm -f || true
190         install -d ${D}${prefix}/share/applications
191         cp ${WORKDIR}/*.desktop ${D}${prefix}/share/applications
192         rm ${D}${prefix}/share/applications/sample.desktop
194         install -d ${D}${bindir}/SGX/demos/X11/
195         install -d ${D}${bindir}/SGX/demos/Raw/
196         install -m 0755 ${S}/demos/x11/* ${D}${bindir}/SGX/demos/X11/
197         install -m 0755 ${S}/demos/raw/* ${D}${bindir}/SGX/demos/Raw/
199         install -d ${D}${bindir}/SGX/trainingcourses/Raw
200         install -d ${D}${bindir}/SGX/trainingcourses/X11
201         install -m 0755 ${S}/trainingcourses/x11/* ${D}${bindir}/SGX/trainingcourses/X11/
202         install -m 0755 ${S}/trainingcourses/raw/* ${D}${bindir}/SGX/trainingcourses/Raw/
204         # Delete objects and linker scripts hidden between the headers
205         find ${D} -name "*.o" -delete
206         find ${D} -name "*.o.cmd" -delete
208         install -d ${D}${sysconfdir}/udev/rules.d
209         install -m 0644 ${WORKDIR}/99-bufferclass.rules ${D}${sysconfdir}/udev/rules.d/
213 PACKAGES =+ "${PN}-rawdemos \
214              ${PN}-x11demos \
215              ${PN}-rawtrainingcourses \
216              ${PN}-x11trainingcourses \
219 PACKAGES += "xserver-kdrive-powervrsgx \
220              ${PN}-tests "
222 PACKAGES =+ "${PN}-blitwsegl ${PN}-flipwsegl ${PN}-frontwsegl ${PN}-linuxfbwsegl ${PN}-x11wsegl"
224 FILES_${PN}-blitwsegl = "${libdir}/libpvrPVR2D_BLITWSEGL.so.* ${libdir}/*/libpvrPVR2D_BLITWSEGL.so.*"
225 FILES_${PN}-flipwsegl = "${libdir}/libpvrPVR2D_FLIPWSEGL.so.* ${libdir}/*/libpvrPVR2D_FLIPWSEGL.so.*"
226 FILES_${PN}-frontwsegl = "${libdir}/libpvrPVR2D_FRONTWSEGL.so.* ${libdir}/*/libpvrPVR2D_FRONTWSEGL.so.*"
227 FILES_${PN}-linuxfbwsegl = "${libdir}/libpvrPVR2D_LINUXFBWSEGL.so.* ${libdir}/*/libpvrPVR2D_LINUXFBWSEGL.so.*"
228 FILES_${PN}-x11wsegl = "${libdir}/libpvrPVR2D_X11WSEGL.so* ${libdir}/*/libpvrPVR2D_X11WSEGL.so*"
230 CONFFILES_${PN} = "${sysconfdir}/powervr.ini"
232 FILES_${PN} = "${sysconfdir} ${libdir}/lib*.so.* ${libdir}/ES*/* ${bindir}/pvrsrvinit ${bindir}/cputype ${bindir}/*/*"
233 FILES_xserver-kdrive-powervrsgx = "${bindir}/Xsgx"
234 FILES_${PN}-tests = "${bindir}/*"
235 FILES_${PN}-dbg = "${libdir}/.debug/* ${bindir}/.debug/* \
236                    ${libdir}/ES*/.debug ${bindir}/*/.debug\
237                    ${bindir}/SGX/demos/*/.debug/* \
238                    ${bindir}/SGX/trainingcourses/*/.debug/* \
239         "
241 FILES_${PN}-rawdemos = "${bindir}/SGX/demos/Raw/*"
242 FILES_${PN}-x11demos = "${bindir}/SGX/demos/X11/* ${prefix}/share/applications "
243 RRECOMMENDS_${PN}-x11demos = "${PN}-x11wsegl"
245 FILES_${PN}-rawtrainingcourses = "${bindir}/SGX/trainingcourses/Raw/*"
246 FILES_${PN}-x11trainingcourses = "${bindir}/SGX/trainingcourses/X11/*"
247 RRECOMMENDS_${PN}-x11trainingcourses = "${PN}-x11wsegl"
249 # The libs need the kernel-modules
250 RRECOMMENDS_${PN} = "omap3-sgx-modules"
252 # The initscript calls fbset, cputype calls devmem2
253 RDEPENDS_${PN} += "fbset devmem2"
255 #HACK! These are binaries, so we can't guarantee that LDFLAGS match :(
256 INSANE_SKIP_${PN} = True
257 INSANE_SKIP_${PN}-blitwsegl = True
258 INSANE_SKIP_${PN}-flipwsegl = True
259 INSANE_SKIP_${PN}-frontwsegl = True
260 INSANE_SKIP_${PN}-linuxfbwsegl = True
261 INSANE_SKIP_${PN}-x11wsegl = True
262 INSANE_SKIP_${PN}-tests = True
263 INSANE_SKIP_xserver-kdrive-powervrsgx = True
265 # Quality control is really poor on these SDKs, so hack around the latest madness:
266 FILES_${PN} += "${libdir}/*.so "
267 FILES_${PN}-dev = "${includedir}"
269 inherit update-rc.d
271 INITSCRIPT_NAME = "pvr-init"
272 INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."
274 # Append to update-rc.d postinst
275 pkg_postinst_${PN}_append() {
276 rm -f /etc/powervr-esrev
278 ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0 
279 ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0