gstreamer-ti: import from oe classic and fix build
[glsdk/meta-ti-glsdk.git] / recipes-ti / gstreamer-ti / gstreamer-ti.inc
1 DESCRIPTION = "GSTREAMER Plugin (gstreamer-ti) for TI ARM/DSP processors"
2 HOMEPAGE = "https://gforge.ti.com/gf/project/gstreamer_ti/"
3 SECTION = "multimedia"
4 LICENSE = "LGPL"
6 # TODO :: Replace omapl137 with official support in GST (currently linking to omapl138)
7 # TODO :: Codec Server Environment Variables shouldn't be required
8 # TODO :: Add (and check) rc scripts for all targets (just copied for now) (365,6467,omapl137)
9 # TODO :: Check if CPPFLAGS_append is still required
10 # TODO :: Remove ENCODE/DECODE combo exports - these are not used anymore (check?)
12 inherit autotools
13 inherit update-rc.d
14 require recipes-ti/includes/ti-paths.inc
15 require recipes-ti/includes/ti-staging.inc
17 # Rebuild on kernel change since it links statically to ti-dmai, ti-codec-engine, etc
18 PR = "r83+${MACHINE_KERNEL_PR}"
20 DEPENDS = "ti-dmai gstreamer gst-plugins-base"
22 # enable c6accel elements on omapl138 and omap3
23 #DEPENDS_append_omapl138 = " ti-c6accel "
24 #EXTRA_OECONF_omapl138 = "--enable-c6accel"
25 #DEPENDS_append_omap3 = " ti-c6accel "
26 #EXTRA_OECONF_omap3 = "--enable-c6accel"
27 export C6ACCEL_INSTALL_DIR
29 # gstreamer_ti picks up some config variables from the environment
30 # - variables are used in the gstreamer makefile
31 #   - PLATFORM, XDC_PLATFORM, XDC_TARGET, MVTOOL_DIR  
32 # - others used by config.bld (which it gets from the dmai config.bld)
33 #   - CROSS_COMPILE, PLATFORM_XDC
35 PLATFORM_dm6446        = "dm6446"
36 PLATFORM_dm6467        = "dm6467"
37 PLATFORM_dm6467t       = "dm6467t"
38 PLATFORM_omap3         = "omap3530"
39 PLATFORM_dm355         = "dm355"
40 PLATFORM_dm365         = "dm365"
41 PLATFORM_omapl137      = "omapl137"
42 PLATFORM_omapl138      = "omapl138"
43 PLATFORM              ?= "UNDEFINED_PLATFORM"
44 GST_TI_PLATFORM = ${PLATFORM}
46 XDC_PLATFORM_dm6446    = "ti.platforms.evmDM6446"
47 XDC_PLATFORM_dm6467    = "ti.platforms.evmDM6467"
48 XDC_PLATFORM_omap3     = "ti.platforms.evm3530"
49 XDC_PLATFORM_dm355     = "ti.platforms.evmDM355"
50 XDC_PLATFORM_dm365     = "ti.platforms.evmDM365"
51 XDC_PLATFORM_omapl137  = "ti.platforms.evmOMAPL137"
52 XDC_PLATFORM_omapl138  = "ti.platforms.evmOMAPL138"
53 XDC_PLATFORM          ?= "UNDEFINED_XDC_PLATFORM"
55 export PLATFORM
56 export GST_TI_PLATFORM
57 export XDC_PLATFORM
58 export XDC_TARGET      = "gnu.targets.arm.GCArmv5T"
59 export PLATFORM_XDC    = ${XDC_PLATFORM}
60 export CSTOOL_DIR      = "${TOOLCHAIN_PATH}"
61 export MVTOOL_DIR      = "${TOOLCHAIN_PATH}"
62 export MVTOOL_PREFIX   = "${TARGET_PREFIX}"
63 export CROSS_COMPILE   = "${TOOLCHAIN_PATH}/${TARGET_PREFIX}"
64 export LINK_XDC_ROOT   = "${LINK_INSTALL_DIR}"
66 # export codec combo (or server) locations
67 # Why do we need to do this?? - These will get picked up from CODEC_INSTALL_DIR?
68 # Sould only need this if we change from default server
70 export CODEC_SERVER  = "${installdir}/ti-codecs-server/cs.x64P"
71 CPPFLAGS_append = " -DPlatform_${PLATFORM}"
73 # We are still using encode/decode combo for DM6446
74 export ENCODE_COMBO    = "${installdir}/ti-codecs-server/encodeCombo.x64P"
75 export DECODE_COMBO    = "${installdir}/ti-codecs-server/decodeCombo.x64P"
76 # Makefile also expects to be able to find the kernel headers from the envirionment
77 export LINUXKERNEL_INSTALL_DIR = "${STAGING_KERNEL_DIR}"
79 do_configure_prepend() {
80         # PSP kernel is based on older DSS. we need to replace linux/omapfb.h with mach/omapfb.h
81         if ! [ -e ${STAGING_KERNEL_DIR}/include/linux/omapfb.h ] ; then
82                 sed -i -e s:linux/omapfb:mach/omapfb:g ${S}/src/omapfb.h || true
83         fi
85         # Angstrom 2008 breaks with -Wl,-T, while angstrom 2010 needs it
86         if [ $(${TARGET_PREFIX}gcc -dumpversion | awk -F. '{print $2}') -gt 3 ] ; then
87                 # Fix up linkerscripts, recent toolchains need -T to prepend the default script to the custom one 
88                 for makefile in $(find ${S} -name "Makefile.am") ; do
89                         sed -i -e 's:-Wl,$(XDC_CONFIG_BASENAME)/linker.cmd:-Wl,-T,$(XDC_CONFIG_BASENAME)/linker.cmd:g' $makefile
90                 done
91         fi
92 }
94 do_compile() {
95         # Recent kernel headers warn against inclusion from userspace
96         for makefile in $(find ${S} -name "Makefile") ; do
97                 sed -i -e s:-Werror::g $makefile
98         done
100     oe_runmake
103 do_install_prepend () {
105     install -d ${D}/${installdir}/gst/${PLATFORM}
107     # copy gstreamer demo scripts
108     cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/shared ${D}/${installdir}/gst
110     # If we have loadmodules.sh in WORKDIR then give preference to this over
111     # the default gst-ti loadmdules.sh
112     if [ -f ${WORKDIR}/loadmodules.sh ]; then
113        cp ${WORKDIR}/loadmodules.sh ${D}/${installdir}/gst/${PLATFORM}
114     else
115        cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/${PLATFORM} ${D}/${installdir}/gst
116     fi   
118     # delete .svn files
119     find ${D}/${installdir}/gst -name .svn -type d | xargs rm -rf
120     chmod 0755 ${D}/${installdir}/gst -R
122     install -d ${D}${sysconfdir}/init.d/
123     install -m 0755  ${WORKDIR}/gstreamer-ti-rc.sh ${D}${sysconfdir}/init.d/gstti-init
125     sed -i -e 's|<platform>|${PLATFORM}|g' ${D}${sysconfdir}/init.d/gstti-init
128 RRECOMMENDS_${PN}_append_dm6446    += "ti-codecs-dm6446-server   ti-cmem-module ti-dsplink-module"
129 RRECOMMENDS_${PN}_append_dm6467    += "ti-codecs-dm6467          ti-cmem-module ti-dsplink-module"
130 RRECOMMENDS_${PN}_append_omap3     += "ti-codecs-omap3530-server ti-cmem-module ti-dsplink-module ti-lpm-module ti-sdma-module"
131 RRECOMMENDS_${PN}_append_dm355     += "ti-codecs-dm355           ti-cmem-module ti-dm355mm-module"
132 RRECOMMENDS_${PN}_append_dm365     += "ti-codecs-dm365           ti-cmem-module ti-dm365mm-module ti-edma-module ti-irq-module"
133 RRECOMMENDS_${PN}_append_omapl137  += "ti-codecs-omapl137-server ti-cmem-module ti-dsplink-module"
134 RRECOMMENDS_${PN}_append_omapl138  += "ti-codecs-omapl138-server ti-cmem-module ti-dsplink-module"
136 FILES_${PN}     += "${libdir}/gstreamer-0.10/*.so ${sysconfdir} ${installdir}"
137 FILES_${PN}-dev += "${libdir}/gstreamer-0.10/*.a ${libdir}/gstreamer-0.10/*.la"
138 FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
140 pkg_postinst_${PN} () {
141         if [ -d ${installdir}/ti-codecs-server/ ]; then
142         ln -sf ${installdir}/ti-codecs-server/* ${installdir}/gst/${PLATFORM}/
143         fi
146 INITSCRIPT_NAME = "gstti-init"
147 INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."