summaryrefslogtreecommitdiff
blob: 1420580f90ed807338b4d80a5a94be1bb30f36b5 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit fdo-mime eutils

DESCRIPTION="Tlen IM client"
HOMEPAGE="http://tlen.pl"
SRC_URI="
	amd64? ( http://j.o2.pl/idi/${PN}64-${PV}.bin )
	x86? ( http://j.o2.pl/idi/${P}.bin )"

LICENSE="tlen"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="qt-static"
PROPERTIES="interactive"
RESTRICT="strip"

RDEPEND="x11-misc/xdg-utils
	!qt-static? ( x11-libs/qt-gui:4
		x11-libs/qt-phonon:4 )"
DEPEND="${RDEPEND}"

S=${WORKDIR}

TLEN_DIR="/opt/tlen"
STATIC_FILES="designer/* imageformats/* phonon_backend/* qt_libs/*"
SHARED_FILES="plugins/* tlen_libs/* tlen-bin updater"

src_unpack() {
	unpack_makeself
}

src_prepare() {
	cd data
	# Fix RPATH
	if use qt-static; then
		# Change RPATH
                ./chrpath -r ${TLEN_DIR}/qt_libs:${TLEN_DIR}/tlen_libs ${SHARED_FILES} > /dev/null
                ./chrpath -r ${TLEN_DIR}/qt_libs ${STATIC_FILES} > /dev/null
	else
		# Change RPATH
		./chrpath -r ${TLEN_DIR}/tlen_libs ${SHARED_FILES} > /dev/null
		# Disable LD and QT unsets
		sed -i "s:unset:# unset:" tlen
		# Remove unneeded libs
		rm -rf qt_libs imageformats phonon_backend
	fi
	# Desktop icon fix
	sed -i "s:.jpg:.png:" ${S}/tlen.desktop
}

src_install() {
	# Prepare directory
	dodir ${TLEN_DIR}
	# Copy data
	cp -r data/* ${D}/${TLEN_DIR} || die "cp failed"
	# Install desktop file
	insinto /usr/share/applications/
	doins tlen.desktop
	# Install mime type
	insinto /usr/share/mime/packages/
	doins tlen.pl-extension.xml
	# Install symlink
	dodir /usr/bin
	dosym ${TLEN_DIR}/tlen /usr/bin/tlen
}

pkg_preinst() {
	check_license
}

pkg_postinst() {
	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update
	### @todo deactivate auto-update by default
	elog
	elog "It is not recommended to use Updater plugin."
	elog "You should deselect Updater in:"
	elog "\"Tlen\" -> \"Preferences\" -> \"Plugins\"."
	elog
}

pkg_postrm() {
	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update
}