summaryrefslogtreecommitdiff
blob: f0093004bec502b4a8bc99e7e36991ad714cbb33 (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
129
130
131
132
133
134
135
136
137
138
139
140
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/icm/icm-3.7.2c.ebuild,v 1.2 2012/10/19 09:09:23 alexxy Exp $

EAPI="4"

inherit eutils unpacker versionator

MY_PV=$(replace_version_separator 2 '-' )
MY_P="$PN-${MY_PV}"

DESCRIPTION="MolSoft LCC ICM Pro"
HOMEPAGE="http://www.molsoft.com/icm_pro.html"
SRC_URI="${MY_P}-linux.sh"

LICENSE="MolSoft"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="32bit 64bit vim-syntax"

REQUIRED_USE="^^ (
					( !32bit 64bit )
					( 32bit !64bit )
					( 32bit 64bit )
		)"

RESTRICT="fetch"

DEPEND="!sci-chemistry/icm-browser
		app-arch/unzip
		vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
		amd64? (
			64bit? (
					=media-libs/tiff-3*
					media-libs/libmng
					app-crypt/mit-krb5
					app-arch/bzip2
					media-libs/libpng:1.2
					media-libs/jpeg:62
					x11-libs/libdrm
					x11-libs/libX11
					sys-apps/keyutils
			)
			32bit? (
					app-emulation/emul-linux-x86-compat
					app-emulation/emul-linux-x86-xlibs
			)
		)
		x86? (
				=media-libs/tiff-3*
				media-libs/libpng:1.2
				media-libs/libmng
				app-crypt/mit-krb5
				app-arch/bzip2
				x11-libs/libdrm
				x11-libs/libX11
				sys-apps/keyutils
		)"
RDEPEND="$DEPEND"

S="${WORKDIR}"

pkg_nofetch() {
	einfo "Please download ${SRC_URI} from "
	einfo "${HOMEPAGE}"
	einfo "and move it to ${DISTDIR}"
}

src_unpack() {
	unpack_makeself
	unpack ./data.tgz
	rm ./data.tgz
}

src_install () {
	instdir=/opt/icm
	dodir "${instdir}"
	dodir "${instdir}/licenses"
	cp -pPR * "${D}/${instdir}"
	rm "${D}/${instdir}/unzip"
	doenvd "${FILESDIR}/90icm" || die
	if use x86; then
		dosym "${instdir}/icm"  /opt/bin/icm || die
		dosym "${instdir}/icmng" /opt/bin/icmng || die
		rm  "${D}/${instdir}/icm64" || die
		rm  "${D}/${instdir}/icmng64" || die
		rm "${D}/${instdir}/icmora64" || die
		rm "${D}/${instdir}/icmora64.bin" || die
		rm -rf "${D}/${instdir}/lib64" || die
	elif use amd64; then
		if use 32bit; then
			dosym "${instdir}/icm"  /opt/bin/icm || die
			dosym "${instdir}/icmng" /opt/bin/icmng || die
		fi
		if use 64bit; then
			dosym "${instdir}/icm64" /opt/bin/icm64 || die
			dosym "${instdir}/icmng64" /opt/bin/icmng64 || die
		fi
		if ! use 64bit; then
			rm  "${D}/${instdir}/icm64" || die
			rm  "${D}/${instdir}/icmng64" || die
			rm "${D}/${instdir}/icmora64{,.bin}" || die
			rm -rf "${D}/${instdir}/lib64" || die
		fi
		if ! use 32bit; then
			rm "${D}/${instdir}/icm" || die
			rm "${D}/${instdir}/icmng" || die
			rm "${D}/${instdir}/icmora" || die
			rm "${D}/${instdir}/icmora.bin" || die
			rm -rf "${D}/${instdir}/lib32" || die
		fi
	fi
	dosym "${instdir}/txdoc"  /opt/bin/txdoc || die
	dosym "${instdir}/lmhostid"  /opt/bin/lmhostid || die
	# install vim files
	if use vim-syntax ; then
		insinto /usr/share/vim/vimfiles/ftdetect
		doins  "${WORKDIR}/icm.vim"
		insinto /usr/share/vim/vimfiles/syntax
		doins  "${WORKDIR}/icm.vim"
		rm "${D}/${instdir}/icm.vim" || die
	fi
	# make desktop entry
	doicon "${FILESDIR}/${PN}.xpm"
	if use x86; then
		make_desktop_entry "icm -g" "ICM Pro" ${PN} Chemistry
	elif use amd64; then
		use 32bit && make_desktop_entry "icm -g" "ICM Pro (32bit)" ${PN} Chemistry
		use 64bit && make_desktop_entry "icm64 -g" "ICM Pro (64bit)" ${PN} Chemistry
	fi
}

pkg_postinst () {
	einfo
	einfo "Documentation can be found in ${instdir}/man/"
	einfo
	einfo "You will need to place your license in ${instdir}/licenses/"
	einfo

}