summaryrefslogtreecommitdiff
path: root/app-text/fbreader/fbreader-0.8.15.ebuild
blob: 6b7b0f2e954d0da81553b47e64125672815deb2b (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
 
inherit eutils
 
DESCRIPTION="E-Book Reader. Supports several e-book formats: fb2 (fictionbook), html, chm, plucker, palmdoc, zTxt, tcr, rtf, oeb, openreader, mpbipocket and plain text. Also provides direct reading from tar, zip, gzip and bzip2 archives, including support of multiple books in one archive"
HOMEPAGE="http://www.fbreader.org/"
SRC_URI="http://www.fbreader.org/${PN}-sources-${PV}.tgz"
 
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
 
IUSE="qt3 qt4 gtk debug"
DEPEND="dev-libs/expat
app-arch/bzip2
qt4? ( =x11-libs/qt-4* )
qt3? ( =x11-libs/qt-3* )
gtk? ( >=x11-libs/gtk+-2.4 )
"
RDEPEND="${DEPEND}"
 
pkg_setup() {
local toolkitsnum toolkitstypes="qt3 qt4 gtk" toolkitstype
declare -i toolkitsnum=0
for toolkitstype in ${toolkitstypes}; do
useq ${toolkitstype} && let toolkitsnum++
done
if [ ${toolkitsnum} -gt 1 ]; then
eerror
eerror "You can't use more than one of toolkits."
eerror "Select exactly one toolkits type out of these: ${toolkitstypes}"
eerror
die "Multiple toolkits types selected."
elif [ ${toolkitsnum} -lt 1 ]; then
eerror
eerror "Select exactly one toolkits type out of these: ${toolkitstypes}"
eerror
die "No toolkits type selected."
fi
}
 
src_unpack() {
unpack ${A}
cd ${S}
sed -i -e "s:FBReader.png:fbreader.png:" fbreader/desktop/Makefile
sed -i -e "s:@install -m 0644 desktop \$(DESTDIR)/usr/share/applications/\$(TARGET).desktop::" fbreader/desktop/Makefile
}
 
src_compile () {
cd ${S}
sed -i "s:INSTALLDIR=/usr/local:INSTALLDIR=/usr:" makefiles/arch/desktop.mk || die "updating desktop.mk failed"
echo "TARGET_ARCH = desktop" > makefiles/target.mk
 
if use qt4 ; then
# qt4
echo "UI_TYPE = qt4" >> makefiles/target.mk
 
sed -i "s:MOC = moc-qt4:MOC = /usr/bin/moc:" makefiles/arch/desktop.mk || die "updating desktop.mk failed"
sed -i "s:UILIBS = -lQtGui:UILIBS = -L/usr/lib/qt4 -lQtGui:" makefiles/arch/desktop.mk
fi
 
if use qt3 ; then
# qt3
echo "UI_TYPE = qt" >> makefiles/target.mk
 
sed -i "s:MOC = moc-qt3:MOC = ${QTDIR}/bin/moc:" makefiles/arch/desktop.mk || die "updating desktop.mk failed"
sed -i "s:QTINCLUDE = -I /usr/include/qt3:QTINCLUDE = -I ${QTDIR}/include:" makefiles/arch/desktop.mk || die "updating desktop.mk failed"
sed -i "s:UILIBS = -lqt-mt:UILIBS = -L${QTDIR}/lib -lqt-mt:" makefiles/arch/desktop.mk
 
fi
if use gtk ; then
# gtk
echo "UI_TYPE = gtk" >> makefiles/target.mk
fi
if use debug ; then
echo "TARGET_STATUS = debug" >> makefiles/target.mk
else
echo "TARGET_STATUS = release" >> makefiles/target.mk
fi
 
emake || die "emake failed"
}
 
src_install()
{
emake DESTDIR=${D} install || die "install failed"
for res in 16 32 48; do
insinto /usr/share/icons/hicolor/${res}x${res}/apps/
newins "${S}"/fbreader/icons/application/${res}x${res}.png fbreader.png
done
 
cat > x-fb2.desktop <<-EOF
[Desktop Entry]
Comment=FictionBook file
Icon=fbreader
MimeType=application/x-fb2
Patterns=*.fb2;*.fb2.zip;
Type=MimeType
EOF
 
cat > fbreader.desktop <<-EOF
[Desktop Entry]
Encoding=UTF-8
Name=FBReader
Comment=FictionBook file
Icon=fbreader
Exec=fbreader %f
MimeType=application/x-fb2
Terminal=false
Type=Application
Categories=Application;Office;Viewer;
EOF
insinto /usr/share/mimelnk/application
doins x-fb2.desktop
insinto /usr/share/applications/
doins fbreader.desktop
 
dosym /usr/bin/FBReader /usr/bin/fbreader
}