summaryrefslogtreecommitdiff
path: root/dev-lang/cxx/cxx-6.5.9.31.ebuild
blob: 42b37693f9bd6a68238ea0d7029cad479a0aadec (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/cxx/cxx-6.5.9.31-r1.ebuild,v 1.13 2007/12/23 05:59:39 halcy0n Exp $
#
# Ebuild contributed by Tavis Ormandy <taviso@sdf.lonestar.org>
# and edited by Aron Griffis <agriffis@gentoo.org>

inherit eutils rpm

IUSE="doc"

DESCRIPTION="Compaq's C++ compiler for the Alpha platform"
HOMEPAGE="ftp://ftp.compaq.com/pub/products/C-Cxx/linux/"

SRC_URI="ftp://ftp.compaq.com/pub/products/linuxdevtools/latest/crypt/cxx-6.5.9.31-1.alpha.rpm"

S=${WORKDIR}
LICENSE="PLDSPv2"
SLOT="0"
KEYWORDS="-* ~alpha"
RESTRICT="fetch strip mirror"

RDEPEND="virtual/libc
	dev-libs/libots
	>=dev-libs/libcpml-5.2.01
	dev-lang/ccc"
DEPEND="${RDEPEND}
	sys-devel/gcc-config
	app-arch/rpm2targz
	>=sys-apps/sed-4
	>=app-shells/bash-2.05b"

cxx_release="${PV}-1"

src_unpack() {
	# convert rpm into tar archive
	local cxx_rpm="cxx-${cxx_release}.alpha.rpm"

	rpm_src_unpack ${cxx_rpm}
}

src_compile() {
	find "${S}"/usr -type d -exec chmod a+rx {} \;

	# patch up config script to sort gcc-lib paths last.  Thanks to
	# Marc Giger for sorting this out
	epatch ${FILESDIR}/create-comp-config.patch
	epatch ${FILESDIR}/probe_linux.patch

	# remove unwanted documentation
	if ! use doc > /dev/null; then
		einfo "Removing unwanted documentation (USE=\"-doc\")..."
		rm -rf usr/doc
	fi
	
	# Patch create-comp-config.sh to work with gcc-3.x
	# (06 Feb 2004 agriffis)
	sed -i -e 's/gcc -v -V \$GCC_VER/gcc -V $GCC_VER -v/' \
		usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/bin/create-comp-config.sh

	# man pages are in the wrong place
	einfo "Reorganising man structure..."
	rm -rf usr/man

	mv usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/man usr/share

	if use doc > /dev/null; then
		einfo "Reorganising documentation..."
		mv usr/doc usr/share
	fi
}

src_install() {
	# move files over
	mv usr "${D}" || die "cxx installation failed"

	# prep docs
	prepalldocs
}

pkg_config () {
	einfo "Attempting configuration of cxx"
	# NOTE: _must_ hide distcc, ccache, etc during this step
	PATH=/bin:/usr/bin:/sbin:/usr/sbin \
		/usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/bin/create-comp-config.sh \
		cxx-${cxx_release} ${gcc_libs_path}
	echo

	# fix up lib paths - bug #15719, comment 6
	einfo "Copying crtbegin/crtend from gcc"
	local gcc_libs_path="`gcc-config --get-lib-path`"
	if [[ $? != 0 || ! -d "${gcc_libs_path}" ]]; then
		die "gcc-config returned an invalid library path (${gcc_libs_path})"
	else
		rm -f /usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/bin/crt{begin,end}.o
		cp ${gcc_libs_path}/crt{begin,end}.o \
			/usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/bin
		assert "Failed to copy crtbegin/crtend.o from ${gcc_libs_path}"
	fi

	# add gcc-lib path to cxx's search path
	# check man cxx for file format info.
#	einfo "Configuring cxx to observe gcc library path and include paths"
#	printf '%s %s %s\n' \
#		"-L${gcc_libs_path}" \
#		" -SysIncDir /usr/lib/compaq/cxx-${cxx_releasei%*-1}/alpha-linux/include" \
#		" -SysIncDir /usr/include/linux" \
#		> /usr/lib/compaq/cxx-${cxx_release%*-1}/alpha-linux/bin/comp.config
#	einfo "Additional paths can be set by users using \$DEC_CXX variable."

	einfo "cxx has been configured, you can now use it as usual."
}

pkg_postinst () {
	elog "cxx has been merged successfully, the EULA"
	elog "is available in"
	elog
	elog "/usr/lib/compaq/cxx-${cxx_release}/alpha-linux/bin/LICENSE.TXT"
	elog
	if use doc >/dev/null; then
		elog "You can also view the compiler documentation"
		elog "in /usr/share/doc/cxx-${PV}"
	fi

	ewarn
	ewarn "You _MUST_ now run:"
	ewarn "emerge --config =${CATEGORY}/${PF}"
	ewarn "to complete the installation"
	ewarn
}