Use https by default
[gentoo.git] / media-libs / openh264 / openh264-1.4.0.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit nsplugins multilib-minimal
8
9 MOZVER=38
10 DESCRIPTION="Cisco OpenH264 library and Gecko Media Plugin for Mozilla packages"
11 HOMEPAGE="http://www.openh264.org/"
12 SRC_URI="https://github.com/cisco/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
13         https://github.com/mozilla/gmp-api/archive/Firefox${MOZVER}.tar.gz -> gmp-api-Firefox${MOZVER}.tar.gz"
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="+plugin utils"
18
19 RESTRICT="bindist"
20
21 RDEPEND="!<www-client/firefox-${MOZVER}"
22 DEPEND="dev-lang/nasm"
23
24 DOCS=( LICENSE CONTRIBUTORS README.md )
25
26 src_prepare() {
27         epatch "${FILESDIR}"/pkgconfig-pathfix.patch
28         multilib_copy_sources
29 }
30
31 multilib_src_configure() {
32         ln -s "${WORKDIR}"/gmp-api-Firefox${MOZVER} gmp-api || die
33 }
34
35 emakecmd() {
36         CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
37         emake V=Yes CFLAGS_M32="" CFLAGS_M64="" CFLAGS_OPT="" \
38                 PREFIX="${EPREFIX}/usr" \
39                 SHAREDLIB_DIR="${EPREFIX}/usr/$(get_libdir)" \
40                 INCLUDES_DIR="${EPREFIX}/usr/include/${PN}" \
41                 $@
42 }
43
44 multilib_src_compile() {
45         local mybits="ENABLE64BIT=No"
46         case "${ABI}" in
47                 s390x|alpha|*64) mybits="ENABLE64BIT=Yes";;
48         esac
49
50         emakecmd ${mybits} ${tgt}
51         use plugin && emakecmd ${mybits} plugin
52 }
53
54 multilib_src_install() {
55         emakecmd DESTDIR="${D}" install-shared
56
57         use utils && dobin h264{enc,dec}
58
59         if use plugin; then
60                 local plugpath="usr/$(get_libdir)/${PLUGINS_DIR}/gmp-gmp${PN}/system-installed"
61                 insinto "/${plugpath}"
62                 doins libgmpopenh264.so* gmpopenh264.info
63                 echo "MOZ_GMP_PATH=\"${EROOT}${plugpath}\"" >"${T}"/98-moz-gmp-${PN}
64                 doenvd "${T}"/98-moz-gmp-${PN}
65
66                 cat <<PREFEOF >"${T}"/${P}.js
67 pref("media.gmp-gmp${PN}.autoupdate", false);
68 pref("media.gmp-gmp${PN}.version", "system-installed");
69 PREFEOF
70
71                 insinto /usr/$(get_libdir)/firefox/defaults/pref
72                 doins "${T}"/${P}.js
73
74                 insinto /usr/$(get_libdir)/seamonkey/defaults/pref
75                 doins "${T}"/${P}.js
76         fi
77 }
78
79 pkg_postinst() {
80         if use plugin; then
81                 if [[ -z ${REPLACING_VERSIONS} ]]; then
82                         elog "Please restart your login session, in order for the session's environment"
83                         elog "to include the new MOZ_GMP_PATH variable."
84                         elog ""
85                 fi
86                 elog "This package attempts to override the Mozilla GMPInstaller auto-update process,"
87                 elog "however even if it is not successful in doing so the profile-installed plugin"
88                 elog "will not be used unless this package is removed.  This package will take precedence"
89                 elog "over any gmp-gmpopenh264 that may be installed in a user's profile."
90                 elog ""
91         fi
92 }