28dda0076f447d79d4d335bf453179dbc8dcc28f
[dweezil.git] / media-video / smplayer / smplayer-9999.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6
7 PLOCALES="am ar ar_SY bg ca cs da de el_GR en_GB en_US es et eu fa fi fr gl he_IL hr 
8         hu id it ja ka ko ku lt mk ms_MY nl nn_NO pl pt pt_BR ro_RO ru_RU sk sl_SI 
9         sq_AL sr sv th tr uk_UA uz vi_VN zh_CN zh_TW"
10 PLOCALE_BACKUP="en_US"
11 inherit l10n qmake-utils subversion
12
13 DESCRIPTION="Great Qt GUI front-end for mplayer/mpv"
14 HOMEPAGE="http://smplayer.info/"
15 ESVN_REPO_URI="https://subversion.assembla.com/svn/smplayer/smplayer/trunk"
16
17 LICENSE="GPL-2+ BSD-2"
18 SLOT="0"
19 KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux"
20 IUSE="autoshutdown bidi debug mpris +qt4 qt5 streaming"
21
22 REQUIRED_USE="^^ ( qt4 qt5 )"
23
24 COMMON_DEPEND="
25         sys-libs/zlib
26         qt4? (
27                 dev-qt/qtcore:4
28                 dev-qt/qtgui:4
29                 dev-qt/qtsingleapplication[X,qt4]
30                 autoshutdown? ( dev-qt/qtdbus:4 )
31                 mpris? ( dev-qt/qtdbus:4 )
32                 streaming? ( dev-qt/qtcore:4[ssl] )
33         )
34         qt5? (
35                 dev-qt/qtcore:5
36                 dev-qt/qtgui:5
37                 dev-qt/qtnetwork:5
38                 >=dev-qt/qtsingleapplication-2.6.1_p20150629[X,qt5]
39                 dev-qt/qtwidgets:5
40                 dev-qt/qtxml:5
41                 autoshutdown? ( dev-qt/qtdbus:5 )
42                 mpris? ( dev-qt/qtdbus:5 )
43                 streaming? (
44                         dev-qt/qtnetwork:5[ssl]
45                         dev-qt/qtscript:5
46                 )
47         )
48 "
49 DEPEND="${COMMON_DEPEND}
50         qt5? ( dev-qt/linguist-tools:5 )
51 "
52 RDEPEND="${COMMON_DEPEND}
53         || (
54                 media-video/mplayer[bidi?,libass,png,X]
55                 (
56                         >=media-video/mpv-0.6.2[libass,X]
57                         streaming? ( >=net-misc/youtube-dl-2014.11.26 )
58                 )
59         )
60 "
61
62 src_prepare() {
63         default
64
65         eapply "${FILESDIR}"/${PN}-14.9.0.6966-unbundle-qtsingleapplication.patch # bug 487544
66         #use bidi || eapply "${FILESDIR}"/${PN}-14.9.0.6690-zero-bidi.patch
67
68         # Upstream Makefile sucks
69         sed -i -e "/^PREFIX=/s:${EPREFIX}/usr/local:${EPREFIX}/usr:" \
70                 -e "/^DOC_PATH=/s:packages/smplayer:${PF}:" \
71                 -e '/\.\/get_svn_revision\.sh/,+2c\
72         cd src && $(DEFS) $(MAKE)' \
73                 "${S}"/Makefile || die "sed failed"
74
75         # Toggle autoshutdown option which pulls in dbus, bug #524392
76         if ! use autoshutdown ; then
77                 sed -e 's:DEFINES += AUTO_SHUTDOWN_PC:#DEFINES += AUTO_SHUTDOWN_PC:' \
78                         -i "${S}"/src/smplayer.pro || die "sed failed"
79         fi
80
81         # Turn debug message flooding off
82         if ! use debug ; then
83                 sed -i 's:#\(DEFINES += NO_DEBUG_ON_CONSOLE\):\1:' \
84                         "${S}"/src/smplayer.pro || die "sed failed"
85         fi
86
87         # MPRIS2 pulls in dbus, bug #553710
88         if ! use mpris ; then
89                 sed -e 's:DEFINES += MPRIS2:#DEFINES += MPRIS2:' \
90                         -i "${S}"/src/smplayer.pro || die "sed failed"
91         fi
92
93         # Turn off online update checker, bug #479902
94         sed -e 's:DEFINES += UPDATE_CHECKER:#DEFINES += UPDATE_CHECKER:' \
95                 -e 's:DEFINES += CHECK_UPGRADED:#DEFINES += CHECK_UPGRADED:' \
96                 -i "${S}"/src/smplayer.pro || die "sed failed"
97
98         # Turn off nasty share widget
99         sed -e 's:DEFINES += SHAREWIDGET:#DEFINES += SHAREWIDGET:' \
100                 -i "${S}"/src/smplayer.pro || die "sed failed"
101
102         # Turn off youtube support (which pulls in extra dependencies) if unwanted
103         if ! use streaming ; then
104                 sed -e 's:DEFINES += YOUTUBE_SUPPORT:#DEFINES += YOUTUBE_SUPPORT:' \
105                 -i "${S}"/src/smplayer.pro || die "sed failed"
106         fi
107
108         l10n_find_plocales_changes "${S}/src/translations" "${PN}_" '.ts'
109 }
110
111 src_configure() {
112         pushd src > /dev/null || die
113         echo "#define SVN_REVISION \"${PV} (Gentoo)\"" > svn_revision.h
114         use qt4 && eqmake4
115         use qt5 && eqmake5
116         popd > /dev/null || die
117 }
118
119 gen_translation() {
120         local mydir
121         if use qt4; then
122                 mydir="$(qt4_get_bindir)"
123         elif use qt5; then
124                 mydir="$(qt5_get_bindir)"
125         fi
126         ebegin "Generating $1 translation"
127         "${mydir}"/lrelease ${PN}_${1}.ts
128         eend $? || die "failed to generate $1 translation"
129 }
130
131 src_compile() {
132         emake
133
134         cd "${S}"/src/translations
135         l10n_for_each_locale_do gen_translation
136 }
137
138 src_install() {
139         # remove unneeded copies of licenses
140         rm Copying* docs/{cs,en,hu,it,ja,ru,zh_CN}/gpl.html || die
141         rm -r docs/{de,es,fr,nl,ro} || die
142
143         emake DESTDIR="${D}" install
144 }