Solo4K Support.
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-multimedia / libav / libav.inc
1 SUMMARY = "Open source audio and video processing tools and librairies"
2 DESCRIPTION = "Libav is a friendly and community-driven effort to provide its users \
3                with a set of portable, functional and high-performance libraries for \
4                dealing with multimedia formats of all sorts. It originates from the \
5                FFmpeg codebase, but goes its own way these days, providing its users \
6                with reliable releases and a clear vision how to go forward."
7 HOMEPAGE = "http://libav.org/"
8 SECTION = "libs"
9
10 LICENSE = "GPLv2+"
11 LICENSE_FLAGS = "commercial"
12
13 # Provides ffmpeg compat, see http://libav.org/about.html
14 PROVIDES = "ffmpeg"
15
16 ARM_INSTRUCTION_SET = "arm"
17
18 DEPENDS = "zlib libogg yasm-native libsdl"
19
20 INC_PR = "r9"
21
22 inherit autotools pkgconfig
23
24 B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
25
26 FULL_OPTIMIZATION_armv7a = "-fexpensive-optimizations -fomit-frame-pointer -O4 -ffast-math"
27 BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}"
28
29 EXTRA_FFCONF_armv7a = "--cpu=cortex-a8"
30 EXTRA_FFCONF ?= ""
31
32 PACKAGECONFIG ??= "bzip2 x264 theora ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
33 PACKAGECONFIG[bzip2] = "--enable-bzlib,--disable-bzlib,bzip2"
34 PACKAGECONFIG[faac] = "--enable-libfaac,--disable-libfaac,faac"
35 PACKAGECONFIG[gsm] = "--enable-libgsm,--disable-libgsm,libgsm"
36 PACKAGECONFIG[jack] = "--enable-indev=jack,--disable-indev=jack,jack"
37 PACKAGECONFIG[libvorbis] = "--enable-libvorbis,--disable-libvorbis,libvorbis"
38 PACKAGECONFIG[mp3lame] = "--enable-libmp3lame,--disable-libmp3lame,lame"
39 PACKAGECONFIG[openssl] = "--enable-openssl,--disable-openssl,openssl"
40 PACKAGECONFIG[schroedinger] = "--enable-libschroedinger,--disable-libschroedinger,schroedinger"
41 PACKAGECONFIG[speex] = "--enable-libspeex,--disable-libspeex,speex"
42 PACKAGECONFIG[theora] = "--enable-libtheora,--disable-libtheora,libtheora"
43 PACKAGECONFIG[vpx] = "--enable-libvpx,--disable-libvpx,libvpx"
44 PACKAGECONFIG[x11] = "--enable-x11grab,--disable-x11grab,virtual/libx11 libxfixes libxext xproto virtual/libsdl"
45 PACKAGECONFIG[x264] = "--enable-libx264,--disable-libx264,x264"
46
47 # Check codecs that require --enable-nonfree
48 USE_NONFREE = "${@bb.utils.contains_any('PACKAGECONFIG', [ 'faac', 'openssl' ], 'yes', '', d)}"
49
50 EXTRA_OECONF = " \
51     --enable-shared \
52     --enable-pthreads \
53     --enable-gpl \
54     ${@bb.utils.contains('USE_NONFREE', 'yes', '--enable-nonfree', '', d)} \
55     --enable-avfilter \
56     \
57     --cross-prefix=${TARGET_PREFIX} \
58     --prefix=${prefix} \
59     \
60     --enable-avserver \
61     --enable-avplay \
62     --ld="${CCLD}" \
63     --arch=${TARGET_ARCH} \
64     --target-os="linux" \
65     --enable-cross-compile \
66     --extra-cflags="${TARGET_CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \
67     --extra-ldflags="${TARGET_LDFLAGS}" \
68     --sysroot="${STAGING_DIR_TARGET}" \
69     --enable-hardcoded-tables \
70     ${EXTRA_FFCONF} \
71     --libdir=${libdir} \
72     --shlibdir=${libdir} \
73 "
74
75 do_configure() {
76     # We don't have TARGET_PREFIX-pkgconfig
77     sed -i '/pkg_config_default="${cross_prefix}${pkg_config_default}"/d' ${S}/configure
78     mkdir -p ${B}
79     cd ${B}
80     ${S}/configure ${EXTRA_OECONF}
81     sed -i -e s:Os:O4:g ${B}/config.h
82 }
83
84 do_install_append() {
85     install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/
86 }
87
88 PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets"
89
90 RSUGGESTS_${PN} = "mplayer"
91 FILES_${PN} = "${bindir}"
92 FILES_${PN}-dev = "${includedir}/${PN}"
93
94 FILES_${PN}-vhook = "${libdir}/vhook"
95 FILES_${PN}-vhook-dbg += "${libdir}/vhook/.debug"
96
97 FILES_ffmpeg-x264-presets = "${datadir}/*.avpreset"
98
99 LEAD_SONAME = "libavcodec.so"
100
101 FILES_${PN}-dev = "${includedir}"
102
103 python populate_packages_prepend() {
104     av_libdir = d.expand('${libdir}')
105     av_pkgconfig = d.expand('${libdir}/pkgconfig')
106
107     # Runtime package
108     do_split_packages(d, av_libdir, '^lib(.*)\.so\..*',
109                       output_pattern='lib%s',
110                       description='libav %s library',
111                       extra_depends='',
112                       prepend=True,
113                       allow_links=True)
114
115     # Development packages (-dev, -staticdev)
116     do_split_packages(d, av_libdir, '^lib(.*)\.so$',
117                       output_pattern='lib%s-dev',
118                       description='libav %s development package',
119                       extra_depends='${PN}-dev',
120                       prepend=True,
121                       allow_links=True)
122     do_split_packages(d, av_pkgconfig, '^lib(.*)\.pc$',
123                       output_pattern='lib%s-dev',
124                       description='libav %s development package',
125                       extra_depends='${PN}-dev',
126                       prepend=True)
127     do_split_packages(d, av_libdir, '^lib(.*)\.a$',
128                       output_pattern='lib%s-staticdev',
129                       description='libav %s development package - static library',
130                       extra_depends='${PN}-dev',
131                       prepend=True,
132                       allow_links=True)
133
134     if d.getVar('TARGET_ARCH', True) == 'i586':
135         # libav can't be build with -fPIC for 32-bit x86
136         pkgs = d.getVar('PACKAGES', True).split()
137         for pkg in pkgs:
138             d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel')
139 }