Use https by default
[gentoo.git] / media-plugins / vdr-live / vdr-live-0.3.0_p20130504-r2.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 vdr-plugin-2 ssl-cert
8
9 DESCRIPTION="VDR Plugin: Web Access To Settings"
10 HOMEPAGE="http://live.vdr-developer.org"
11 SRC_URI="mirror://gentoo/${P}.tar.bz2
12                 https://dev.gentoo.org/~hd_brummy/distfiles/${P}.tar.bz2"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="~amd64 ~x86"
17 IUSE="pcre ssl"
18
19 DEPEND="media-video/vdr
20         >=dev-libs/tntnet-2.2.1[ssl=]
21         >=dev-libs/cxxtools-2.2.1
22         pcre? ( >=dev-libs/libpcre-8.12[cxx] )"
23 RDEPEND="${DEPEND}"
24
25 S="${WORKDIR}/${P}"
26
27 VDR_CONFD_FILE="${FILESDIR}/confd-0.3"
28 VDR_RCADDON_FILE="${FILESDIR}/rc-addon-0.3.sh"
29
30 KEEP_I18NOBJECT="yes"
31
32 make_live_cert() {
33         # TODO: still true?
34         # ssl-cert eclass creates a "invalid" cert, create our own one
35         local base=$(get_base 1)
36         local keydir="/etc/vdr/plugins/live"
37
38         SSL_ORGANIZATION="${SSL_ORGANIZATION:-VDR Plugin Live}"
39         SSL_COMMONNAME="${SSL_COMMONNAME:-`hostname -f`}"
40
41         echo
42         gen_cnf || return 1
43         echo
44         gen_key 1 || return 1
45         gen_csr 1 || return 1
46         gen_crt 1 || return 1
47         echo
48
49         install -d "${ROOT}${keydir}"
50         install -m0400 "${base}.key" "${ROOT}${keydir}/live-key.pem"
51         install -m0444 "${base}.crt" "${ROOT}${keydir}/live.pem"
52         chown vdr:vdr "${ROOT}"/etc/vdr/plugins/live/live{,-key}.pem
53 }
54
55 src_configure() {
56         # tmp. disabled gcc -std=c++11, due massiv compile errors
57         filter-flags -std=c++11
58 }
59
60 src_prepare() {
61         # new Makefile handling ToDp
62 #       cp "${FILESDIR}/live.mk" "${S}/Makefile"
63
64         # remove untranslated language files
65         rm "${S}"/po/{ca_ES,da_DK,el_GR,et_EE,hr_HR,hu_HU,nl_NL,nn_NO,pt_PT,ro_RO,ru_RU,sl_SI,sv_SE,tr_TR}.po
66
67         vdr-plugin-2_src_prepare
68
69         epatch "${FILESDIR}/${P}_vdr-2.1.2.diff"
70
71         if ! use pcre; then
72                 sed -i "s:^HAVE_LIBPCRECPP:#HAVE_LIBPCRECPP:" Makefile || die
73         fi
74 }
75
76 src_install() {
77         vdr-plugin-2_src_install
78
79         insinto /usr/share/vdr/plugins/live
80         doins -r live/*
81
82         fowners -R vdr:vdr /usr/share/vdr/plugins/live
83 }
84
85 pkg_postinst() {
86         vdr-plugin-2_pkg_postinst
87
88         elog "To be able to use all functions of vdr-live"
89         elog "you should emerge and enable"
90         elog "media-plugins/vdr-epgsearch to search the EPG,"
91         elog "media-plugins/vdr-streamdev for Live-TV streaming"
92
93         elog "The default username/password is:"
94         elog "\tadmin:live"
95
96         if use ssl ; then
97                 if path_exists -a "${ROOT}"/etc/vdr/plugins/live/live.pem; then
98                         einfo "found an existing SSL cert, to create a new SSL cert, run:\n"
99                         einfo "emerge --config ${PN}"
100                 else
101                         einfo "No SSL cert found, creating a default one now"
102                         make_live_cert
103                 fi
104         fi
105 }
106
107 pkg_config() {
108         make_live_cert
109 }