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