aboutsummaryrefslogtreecommitdiff
blob: fc1d729463c80fd87c5af95cb319fed1ea0c70a0 (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
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7..9} )

inherit autotools python-single-r1

DESCRIPTION="Dynamic modification of a user's environment via modulefiles"
HOMEPAGE="http://modules.sourceforge.net/"
SRC_URI="https://github.com/cea-hpc/modules/releases/download/v${PV}/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="compat test"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="!test? ( test )"

DEPEND="
	${PYTHON_DEPS}
	dev-lang/tcl:0=
	dev-tcltk/tclx
	compat? ( x11-libs/libX11 )
"
RDEPEND="${DEPEND}"
BDEPEND="
	test? ( dev-util/dejagnu )
"

src_prepare() {
	default

	cd "${S}/lib" || die
	eautoreconf

	if use compat; then
		cd "${S}/compat" || die
		eautoreconf
	fi
}

src_configure() {
	local myconf=(
		--disable-versioning
		--with-initconf-in=etcdir
		--enable-multilib-support
		--disable-set-shell-startup
		--prefix="${EPREFIX}/usr/share/Modules"
		--mandir="${EPREFIX}/usr/share/man"
		--docdir="${EPREFIX}/usr/share/doc/${P}"
		--libdir="${EPREFIX}/usr/share/Modules/$(get_libdir)"
		--datarootdir="${EPREFIX}/usr/share"
		--modulefilesdir="${EPREFIX}/etc/modulefiles"
		--with-tcl="${EPREFIX}/usr/$(get_libdir)"
		--with-python="${PYTHON}"
		--with-quarantine-vars="LD_LIBRARY_PATH LD_PRELOAD"
		$(use_enable compat compat-version)
	)
	econf "${myconf[@]}" "${EXTRA_ECONF[@]}" || die "configure failed"
}

src_test() {
	# Remove known-broken tests
	# These test fine, but fail for random differences in the gentoo environment
	rm "${S}"/testsuite/modules.70-maint/210-clear.exp || die "rm failed"
	rm "${S}"/testsuite/modules.00-init/110-quar.exp || die "rm failed"

	RUNTESTARGS=-v emake test
}

src_install() {
	default
	dosym ../../usr/share/Modules/init/profile.sh /etc/profile.d/modules.sh
	dosym ../../usr/share/Modules/init/profile.csh /etc/profile.d/modules.csh
	dodir /etc/modulefiles
}