summaryrefslogtreecommitdiff
path: root/sci-misc/mendeleydesktop/mendeleydesktop-1.3-r1.ebuild
blob: 7134b2c4e72e893e71c24bcd003e4cac8bdc99bc (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# http://bugs.gentoo.org/show_bug.cgi?id=308509

EAPI=4

inherit eutils

ARCHIVE_BASE="${P}-linux-BASE.tar.bz2"
ARCHIVE_X86="${ARCHIVE_BASE/BASE/i486}"
ARCHIVE_AMD64="${ARCHIVE_BASE/BASE/x86_64}"

DESCRIPTION="A free research management tool for desktop & web"
HOMEPAGE="http://www.mendeley.com/"

SRC_URI="
    x86?   ( http://download.mendeley.com/linux/${ARCHIVE_X86}   )
    amd64? ( http://download.mendeley.com/linux/${ARCHIVE_AMD64} )
"

LICENSE="Mendelay-EULA"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="qt-bundled"
RESTRICT="mirror strip"

RDEPEND="
    !qt-bundled? (
        <x11-libs/qt-core-4.8
        <x11-libs/qt-gui-4.8
        <x11-libs/qt-svg-4.8
        <x11-libs/qt-webkit-4.8
        <x11-libs/qt-xmlpatterns-4.8
    )
    qt-bundled? (
        media-libs/libpng:1.2
    )
    dev-lang/python:2.7
    dev-libs/openssl:0.9.8"
DEPEND="${RDEPEND}"

if   [[ "${ARCH}" == "x86" ]]; then
    S=${WORKDIR}/${ARCHIVE_X86/.tar.bz2/}
elif [[ "${ARCH}" == "amd64" ]]; then
    S=${WORKDIR}/${ARCHIVE_AMD64/.tar.bz2/}
fi

MENDELEY_INSTALL_DIR="/opt/${PN}"

src_install() {
    # install menu
    domenu "share/applications/${PN}.desktop"
    # Install commonly used icon sizes
    for res in 16x16 22x22 32x32 48x48 64x64 128x128 ; do
        insinto "/usr/share/icons/hicolor/${res}/apps"
        doins "share/icons/hicolor/${res}/apps/${PN}.png"
    done
    insinto "/usr/share/pixmaps"
    doins "share/icons/hicolor/48x48/apps/${PN}.png"

    # dodoc
    dodoc "share/doc/${PN}/"*

    # create directories for installation
    dodir ${MENDELEY_INSTALL_DIR}
    dodir "${MENDELEY_INSTALL_DIR}/lib"
    dodir "${MENDELEY_INSTALL_DIR}/share"

    # install binaries
    cp -r "bin" "${D}${MENDELEY_INSTALL_DIR}" || die "Can't copy bin directory"
    cp -r "lib" "${D}${MENDELEY_INSTALL_DIR}" || die "Can't copy lib directory"
    cp -r "share/${PN}" "${D}${MENDELEY_INSTALL_DIR}/share" || die "Can't copy share/${PN} directory"
    dosym "${MENDELEY_INSTALL_DIR}/bin/${PN}" "/usr/bin/${PN}"
    sed -i '1s@^#!/usr/bin/python$@&2@' ${D}${MENDELEY_INSTALL_DIR}/bin/${PN} || die "Can't sed for python2"

    if use qt-bundled; then
        sed -i 's/^Exec.*$/& --force-bundled-qt/' "${D}/usr/share/applications/${PN}.desktop" || die "Can't sed"
    else
        # Delete bundled Qt
        rm -fr ${D}${MENDELEY_INSTALL_DIR}/lib/qt || die "Can't delete qt folder"
    fi

    # Delete bundled OpenSSL 0.9.8
    rm -fr ${D}${MENDELEY_INSTALL_DIR}/lib/ssl || die "Can't delete ssl folder"
}