README: refer to toolchain-layer in meta-openembedded
[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 = "r85+${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 MEMARGS_omap3         = "99M@0x80000000"
56 MEMARGS              ?= "UNDEFINED_MEM_ARGS"
58 export MEMARGS
59 export PLATFORM
60 export GST_TI_PLATFORM
61 export XDC_PLATFORM
62 export XDC_TARGET      = "gnu.targets.arm.GCArmv5T"
63 export PLATFORM_XDC    = "${XDC_PLATFORM}"
64 export CSTOOL_DIR      = "${TOOLCHAIN_PATH}"
65 export MVTOOL_DIR      = "${TOOLCHAIN_PATH}"
66 export MVTOOL_PREFIX   = "${TARGET_PREFIX}"
67 export CROSS_COMPILE   = "${TOOLCHAIN_PATH}/${TARGET_PREFIX}"
68 export LINK_XDC_ROOT   = "${LINK_INSTALL_DIR}"
70 # export codec combo (or server) locations
71 # Why do we need to do this?? - These will get picked up from CODEC_INSTALL_DIR?
72 # Sould only need this if we change from default server
74 export CODEC_SERVER  = "${installdir}/ti-codecs-server/cs.x64P"
75 CPPFLAGS_append = " -DPlatform_${PLATFORM}"
77 # We are still using encode/decode combo for DM6446
78 export ENCODE_COMBO    = "${installdir}/ti-codecs-server/encodeCombo.x64P"
79 export DECODE_COMBO    = "${installdir}/ti-codecs-server/decodeCombo.x64P"
80 # Makefile also expects to be able to find the kernel headers from the envirionment
81 export LINUXKERNEL_INSTALL_DIR = "${STAGING_KERNEL_DIR}"
83 do_configure_prepend() {
84         # PSP kernel is based on older DSS. we need to replace linux/omapfb.h with mach/omapfb.h
85         if ! [ -e ${STAGING_KERNEL_DIR}/include/linux/omapfb.h ] ; then
86                 sed -i -e s:linux/omapfb:mach/omapfb:g ${S}/src/omapfb.h || true
87         fi
89         # Angstrom 2008 breaks with -Wl,-T, while angstrom 2010 needs it
90         if [ $(${TARGET_PREFIX}gcc -dumpversion | awk -F. '{print $2}') -gt 3 ] ; then
91                 # Fix up linkerscripts, recent toolchains need -T to prepend the default script to the custom one 
92                 for makefile in $(find ${S} -name "Makefile.am") ; do
93                         sed -i -e 's:-Wl,$(XDC_CONFIG_BASENAME)/linker.cmd:-Wl,-T,$(XDC_CONFIG_BASENAME)/linker.cmd:g' $makefile
94                 done
95         fi
96 }
98 do_compile() {
99         # Recent kernel headers warn against inclusion from userspace
100         for makefile in $(find ${S} -name "Makefile") ; do
101                 sed -i -e s:-Werror::g $makefile
102         done
104     oe_runmake
107 do_install_prepend () {
109     install -d ${D}/${installdir}/gst/${PLATFORM}
111     # copy gstreamer demo scripts
112     cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/shared ${D}/${installdir}/gst
114     # If we have loadmodules.sh in WORKDIR then give preference to this over
115     # the default gst-ti loadmdules.sh
116     if [ -f ${WORKDIR}/loadmodules.sh ]; then
117        cp ${WORKDIR}/loadmodules.sh ${D}/${installdir}/gst/${PLATFORM}
118     else
119        cp -R ${WORKDIR}/gstreamer_ti/gstreamer_demo/${PLATFORM} ${D}/${installdir}/gst
120     fi   
122     # delete .svn files
123     find ${D}/${installdir}/gst -name .svn -type d | xargs rm -rf
124     chmod 0755 ${D}/${installdir}/gst -R
126     install -d ${D}${sysconfdir}/init.d/
127     install -m 0755  ${WORKDIR}/gstreamer-ti-rc.sh ${D}${sysconfdir}/init.d/gstti-init
128     sed -i -e 's|<platform>|${PLATFORM}|g' ${D}${sysconfdir}/init.d/gstti-init
130         install -d ${D}${base_libdir}/systemd/system
131         install -m 0644 ${WORKDIR}/gstti-init.service ${D}${base_libdir}/systemd/system/
132         sed -i -e 's|<platform>|${PLATFORM}|g' -e 's|MEMARGS|${MEMARGS}|' ${D}${base_libdir}/systemd/system/gstti-init.service
135 RRECOMMENDS_${PN}_append_dm6446    += "ti-codecs-dm6446-server   ti-cmem-module ti-dsplink-module"
136 RRECOMMENDS_${PN}_append_dm6467    += "ti-codecs-dm6467          ti-cmem-module ti-dsplink-module"
137 RRECOMMENDS_${PN}_append_omap3     += "ti-codecs-omap3530-server ti-cmem-module ti-dsplink-module ti-lpm-module ti-sdma-module"
138 RRECOMMENDS_${PN}_append_dm355     += "ti-codecs-dm355           ti-cmem-module ti-dm355mm-module"
139 RRECOMMENDS_${PN}_append_dm365     += "ti-codecs-dm365           ti-cmem-module ti-dm365mm-module ti-edma-module ti-irq-module"
140 RRECOMMENDS_${PN}_append_omapl137  += "ti-codecs-omapl137-server ti-cmem-module ti-dsplink-module"
141 RRECOMMENDS_${PN}_append_omapl138  += "ti-codecs-omapl138-server ti-cmem-module ti-dsplink-module"
143 FILES_${PN}     += "${libdir}/gstreamer-0.10/*.so ${sysconfdir} ${installdir} ${base_libdir}/systemd"
144 FILES_${PN}-dev += "${libdir}/gstreamer-0.10/*.a ${libdir}/gstreamer-0.10/*.la"
145 FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
147 pkg_postinst_${PN} () {
148 if test "x$D" != "x"; then
149         echo "Can't run gstreamer-ti postinst offline"
150     exit 1
151 fi
152         if [ -e ${base_bindir}/systemctl ] ; then
153                 systemctl enable gstti-init.service
154         fi
156         if [ -d ${installdir}/ti-codecs-server/ ]; then
157         ln -sf ${installdir}/ti-codecs-server/* ${installdir}/gst/${PLATFORM}/
158         fi
161 PACKAGE_ARCH = "${MACHINE_ARCH}"
163 INITSCRIPT_NAME = "gstti-init"
164 INITSCRIPT_PARAMS = "start 30 5 2 . stop 40 0 1 6 ."