summaryrefslogtreecommitdiff
blob: c06a9f95e4525b2157b0ea40d84c5c97a3941919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/x11-misc/ifpgui/ifpgui-0.10.8.ebuild,v 1.4 2007/12/07 14:00:28 coldwind Exp $

inherit eutils qt3

DESCRIPTION="A Linux GUI for the iRiver iFP flash portable player based on QT"
HOMEPAGE="http://ifpgui.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"

IUSE="doc"
LANGS="da de ru"
for x in ${LANGS}; do
	IUSE="${IUSE} linguas_${x}"
done

RDEPEND=">=media-libs/libifp-1.0.0.2
	$(qt_min_version 3.3)
	>=dev-libs/libusb-0.1.7"
DEPEND="${RDEPEND}
	doc? ( >=app-doc/doxygen-1.3.7 )"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# some Doxyfile improvements
	if use doc; then
		epatch "${FILESDIR}"/${PN}-doxyfile_fixes.patch
		sed -i -e '/PROJECT_NUMBER/ s/[0..9].*$/'${PV}'/' \
			-e '/OUTPUT/ s/\/home.*$/\.\/doc/' Doxyfile
		mkdir doc
	fi

	# we want to use system libifp
	rm -rf src/libifp src/ifp.h
	epatch "${FILESDIR}"/${PN}-use_system_libifp.patch

	# change path to translation files
	epatch "${FILESDIR}"/${PN}-translation_files_directory.patch

	# fixing locale
	mv src/translations/${PN}_da_DK.ts src/translations/${PN}_da.ts
}

src_compile() {
	cd src
	${QTDIR}/bin/qmake src.pro \
		QMAKE=${QTDIR}/bin/qmake \
		QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
		QMAKE_RPATH= \
		"CONFIG += no_fixpath release thread" \
		|| die "qmake src.pro failed"
	cd "${S}"

	${QTDIR}/bin/qmake ${PN}.pro \
		QMAKE=${QTDIR}/bin/qmake \
		QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
		QMAKE_RPATH= \
		"CONFIG += no_fixpath release thread" \
		|| die "qmake ${PN}.pro failed"

	emake || die "emake failed"

	use doc && doxygen

	# make translation files if there are any chosen
	cd src/translations
	for i in ${LANGS}; do
		use linguas_${i} && [ -f ${PN}_${i}.ts ] && ${QTDIR}/bin/lrelease ${PN}_${i}.ts
	done;
}

src_install() {
	dobin bin/${PN}

	insinto /usr/share/${PN}
	doins nonroot.sh

	dodoc README CHANGELOG
	if use doc; then
		cp -ar doc/* "${D}"/usr/share/doc/${PF}
	fi;

	# install translation files
	cd src/translations
	insinto /usr/share/${PN}/i18n
	for i in ${LANGS}; do
		use linguas_${i} && [ -f ${PN}_${i}.qm ] && doins ${PN}_${i}.qm
	done;
	cd "${S}"

	# desktop file and icon
	domenu "${FILESDIR}"/${PN}.desktop
	doicon "${FILESDIR}"/${PN}.png
}

pkg_postinst() {
	echo
	ewarn "If you want to use ifpgui without root-privileges, you can run"
	ewarn "emerge --config =${CATEGORY}/${PF}"
	ewarn "or manually use the script"
	ewarn "/usr/share/${PN}/nonroot.sh"
	ewarn "to add approprate rules to your hotplug scripts"
	echo
}

pkg_config() {
	"${ROOT}"/usr/share/${PN}/nonroot.sh || die "config failed"
}