Merge remote-tracking branch 'remotes/operatornormal/gentoo_bug_568874'
[gentoo.git] / net-p2p / classified-ads / classified-ads-0.07.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 PLOCALES="en fi sv"
7 PLOCALE_BACKUP="en"
8 inherit qt4-r2
9
10 DESCRIPTION="Program for displaying classified advertisement items"
11 HOMEPAGE="http://katiska.org/classified-ads/"
12 SRC_URI="https://github.com/operatornormal/classified-ads/archive/${PV}.tar.gz \
13                 -> classified-ads-${PV}.tar.gz \
14         https://github.com/operatornormal/classified-ads/blob/graphics/preprocessed.tar.gz?raw=true \
15                 -> classified-ads-graphics-${PV}.tar.gz"
16
17 LICENSE="LGPL-2.1"
18 SLOT="0"
19 KEYWORDS="~amd64 ~x86"
20
21 IUSE="debug doc test"
22
23 DEPEND="dev-libs/openssl:0
24         dev-libs/qjson
25         >=net-libs/libnatpmp-20130911
26         <=net-libs/libnatpmp-20140401-r1
27         >=net-libs/miniupnpc-1.8
28         sys-apps/file
29         dev-qt/qtgui:4[debug?]
30         test? ( dev-libs/libgcrypt:0
31                 dev-qt/qttest:4
32                 sys-devel/gdb:0 )
33         doc? ( app-doc/doxygen[dot] )"
34 RDEPEND="dev-libs/openssl:0
35         dev-libs/qjson
36         >=net-libs/libnatpmp-20130911
37         <=net-libs/libnatpmp-20140401-r1
38         >=net-libs/miniupnpc-1.8
39         sys-apps/file
40         dev-qt/qtgui:4[debug?]"
41
42 src_prepare() {
43         # preprocessed graphics are unpacked into wrong directory
44         # so lets move them into correct location:
45         mv ../ui/* ui/ || die
46         # then just run qmake
47         qt4-r2_src_prepare
48 }
49
50 src_compile() {
51         qt4-r2_src_compile
52         if use doc; then
53                 cd doc || die
54                 doxygen || die
55         fi
56 }
57
58 src_test() {
59         cd test || die "test suite missing"
60         qmake || die "test suite configure failed"
61         make
62
63         if [ -e $HOME/.classified_ads/sqlite_db ]; then
64                 mv $HOME/.classified_ads/sqlite_db $HOME/.classified_ads/sqlite_db.backup \
65                 || die "datafile backup failed"
66         fi
67         ./testca
68         result=$?
69         rm $HOME/.classified_ads/sqlite_db || true
70
71         if [ -e $HOME/.classified_ads/sqlite_db.backup ]; then
72                 mv $HOME/.classified_ads/sqlite_db.backup $HOME/.classified_ads/sqlite_db \
73                 || die "datafile restore failed"
74         fi
75
76         if [ $result != "0" ]; then
77                 die "test failed with code $result"
78         fi
79
80         return $result
81 }
82
83 src_install() {
84         emake install INSTALL_ROOT="${D}"
85         use doc && dodoc -r doc/doxygen.generated/html/
86 }