summaryrefslogtreecommitdiff
blob: cc8c585fb79597538d857f35ff1c24bebab2b55f (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils java-pkg-2 java-ant-2

MY_P="gt${PV}-all-source-installer"

DESCRIPTION="The Globus Toolkit - grid middleware package"
HOMEPAGE="http://www.globus.org/toolkit/"

SRC_URI="http://www-unix.globus.org/ftppub/gt${PV:0:1}/${PV}/installers/src/${MY_P}.tar.bz2"

LICENSE="GTPL"

SLOT="4"
KEYWORDS="~x86"

# The original build system does not build the following USE
# controlled components by default (i18n prews wsjava wsc wsdel wsrft
# wscas wsctests).  You may turn them off as you wish...
IUSE="condor +gridftp +gridway i18n iodbc lsf odbc pbs prews
	  +prews-test +prewsgram +rls wsc wscas wsctests wsdel
	  +wsgram wsjava +wsmds wsrft +wstests"

COMMON_DEP="
	dev-java/ant
	sys-libs/zlib
	dev-lang/perl
	app-admin/sudo
	dev-libs/openssl
	dev-db/postgresql
	dev-perl/XML-Parser
	virtual/mpi
	=sys-cluster/globus-build-${PV}
	iodbc? ( dev-db/libiodbc )
	odbc? ( !iodbc? ( dev-db/unixODBC ) )"

DEPEND=">=virtual/jdk-1.5
	${COMMON_DEP}"

RDEPEND=">=virtual/jre-1.5
	${COMMON_DEP}"

S="${WORKDIR}/${MY_P}"

GLOBUS="/opt/globus${PV:0:1}"

src_prepare() {
	mkdir "${S}"/build || die "making build directory failed"

	# Do not build the globus-build tools by default (in this case it is
	# supplied with sci-physics/globus-build)
	sed -e "s|: gpt|:|" \
		-i Makefile.in || die "sed Makefile.in failed"

	# Fixing RLS so it can find sql.h etc..."
	sed -e 's?DEFAULT_INCLUDES = -I.?& -I/usr/include/iodbc?' \
		-i source-trees/replica/rls/server/Makefile.in \
				|| die "sed RLS Makefile.in failed"

	# apply patches
	epatch "${FILESDIR}"/gwd_open.patch
	epatch "${FILESDIR}"/gaa_test.patch

	sed -e "s|%%GLOBUS%%|${GLOBUS}|" \
		"${FILESDIR}"/22globus > "${T}"/22globus \
			|| die "sed envfile failed"
}

src_configure() {
	local myconfig

	# should we use odbc with iodbc or unixodbc
	if use iodbc ; then
		myconfig="--with-iodbc-libs=$(iodbc-config --prefix)/lib"
		myconfig="${myconfig} --with-iodbc-includes=$(iodbc-config --prefix)/include/iodbc"
	elif use odbc ; then
		myconfig="--with-unixodbc-libs=/usr/lib"
		myconfig="${myconfig} --with-unixodbc-includes=/usr/include/unixodbc"
	fi

	java-pkg_switch-vm

	econf --prefix="${S}/build/${GLOBUS}" \
		  --with-gptlocation=${GLOBUS} \
		  $(use_enable condor wsgram-condor) \
		  $(use_enable lsf wsgram-lsf) \
		  $(use_enable pbs wsgram-pbs) ${myconfig}
}

src_compile() {
	# Build these basic components always, then the individual
	# components can be built as desired (controlled by the USE flags
	# above).  The initial components must always be built in order
	# to build some of the optional ones (ORDER MATTERS).
	local mycomponents="gsi-myproxy gsi-openssh gt4-java-ws-core gt4-java-admin gt4-mds gt4-delegation gt4-rft gt4-cas gt4-c-ws-core prews-test globus-gsi-test gt4-replicator gt4-replication-client globus_rendezvous"

	# These components are built as part of the original "all:"
	# target.  The project INSTALL file specifies that the desired
	# behaviour is to allow building of individual components without
	# building the entire system.  Therefore, these should be
	# optional, but ON by default.
	mycomponents="${mycomponents} $(use gridftp    && echo gridftp)"
	mycomponents="${mycomponents} $(use prewsgram  && echo prewsgram)"
	mycomponents="${mycomponents} $(use rls        && echo rls)"
	mycomponents="${mycomponents} $(use wsgram     && echo wsgram)"
	mycomponents="${mycomponents} $(use wsmds      && echo wsmds)"
	mycomponents="${mycomponents} $(use prews-test && echo prews-test)"
	mycomponents="${mycomponents} $(use wstests    && echo wstests)"
	mycomponents="${mycomponents} $(use gridway    && echo gridway)"

	# These components are strictly optional, and are turned OFF
	# default in the IUSE flags.
	mycomponents="${mycomponents} $(use i18n       && echo i18n)"
	mycomponents="${mycomponents} $(use prews      && echo prews)"
	mycomponents="${mycomponents} $(use wsjava     && echo wsjava)"
	mycomponents="${mycomponents} $(use wsc        && echo wsc)"
	mycomponents="${mycomponents} $(use wsdel      && echo wsdel)"
	mycomponents="${mycomponents} $(use wsrft      && echo wsrft)"
	mycomponents="${mycomponents} $(use wscas      && echo wscas)"
	mycomponents="${mycomponents} $(use wsctests   && echo wsctests)"

	einfo
	einfo "Making components = ${mycomponents}"
	einfo
	emake -j1 ${mycomponents} || die "make failed!"
}

src_install() {
	einfo "Hand installing..."
	# The supplied Makefile install violates standard practices.  The
	# following simulates a "make DESTDIR=${D}" and moves the built
	# programs/files into ${D}
	mv build/* "${D}/" || die "mv failed"

	doenvd "${T}"/22globus || die "install env.d/globus died"
	newinitd "${FILESDIR}"/${PN}-init.d globus \
		|| die "install env.d/globus died"

	insinto "${GLOBUS}/share/extras"
	doins quickstart.html || die "install quickstart.html died"

	einfo "linking globus_packages directory"
	dosym gpt/packages ${GLOBUS}/etc/globus_packages \
			|| die "generating symbolic link died"

	einfo "Updating ownership and permissions..."
	fowners -R globus:globus ${GLOBUS} || die "fowners failed"
}

pkg_postinst() {
	# The Makefile provided with the package does not respect
	# DESTDIR=${D}, or conventional installs for that matter, and
	# builds directly into the installation directories
	# (i.e. /${GLOBUS}) thus generating access violations.  In
	# addition, pkg_postinst assumes that you are done with ${S} so
	# we (re)implement the postinstall phase of the package here so
	# that any assumptions inherent in the Makefile are ignored.
	einfo "running gpt-postinstall"
	GLOBUS_LOCATION="${ROOT}${GLOBUS}" GPT_LOCATION="${ROOT}${GLOBUS}" \
		"${ROOT}${GLOBUS}"/sbin/gpt-postinstall || die "gpt-postinstall failed"

	elog "If you wish to configure the optional GAA-based Globus"
	elog "Authorization callouts, run thesetup-globus-gaa-authz-callout"
	elog "setup script."
	elog
	elog "You will have to install a cert file (eg. /etc/grid-security/hostcert.pem)"
	elog "and then re-run setup-globus-gram-job-manager."
}

pkg_postrm() {
	if ! [[ -e "${ROOT}${GLOBUS}"/bin/globus-start-container ]] && ! has_version sys-cluster/globus-build ; then
		ewarn "Globus builds and installs files into ${GLOBUS}"
		ewarn "after package installation.  After uninstalling"
		ewarn "you may want to manually remove all or part of the Globus"
		ewarn "installation directory ${GLOBUS}."
	fi
}