blob: 8c491e37ebe03190ef84830f9c4eaa60e4ac4236 (
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
|
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/fortran.eclass,v 1.1 2004/10/01 12:08:16 kugelfang Exp $
#
# Author: Danny van Dyk <kugelfang@gentoo.org>
#
ECLASS=fortran
INHERITED="$INHERITED $ECLASS"
DESCRIPTION="Based on the ${ECLASS} eclass"
# need_fortran(<profiles>):
# profiles = <profile> ... <profile>
# profile = [path/to/]<compiler>
#
# compiler:
# * f77 - GCC Fortran 77
# * f2c - Fortran 2 C Translator
# * ifc - Intel Fortran Compiler
#
# Checks if at least one of <profiles> is installed.
# Checks also if F77 (the fortran compiler to use) is available
# on the System.
need_fortran() {
if [ -z "$@" ]; then
eerror "Call need_fortran with at least one argument !"
fi
local AVAILABLE=""
for PROFILE in $@; do
case ${PROFILE} in
f77)
if [ -x "$(which g77 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} f77"
fi
;;
f2c)
if [ -x "$(which f2c 2> /dev/null)" ]; then
AVAILABLE="${AVAILABLE} f2c"
fi
;;
ifc)
case ${ARCH} in
x86|ia64)
if [ -x "$(which if2 2> /dev/null)" ]; then
AVAILABLE="${FORTRAN} ifc"
fi
;;
*)
;;
esac
;;
esac
done
if [ -z "${AVAILABLE}" ]; then
eerror "None of the needed Fortran Compilers ($@) is installed."
eerror "To install one of these, choose one of the following steps:"
i=1
for PROFILE in $@; do
case ${PROFILE} in
f77)
eerror "[${i}] USE=\"f77\" emerge sys-devel/gcc"
;;
f2c)
eerror "[${i}] emerge dev-lang/f2c"
;;
ifc)
case ${ARCH} in
x86|ia64)
eerror "[${i}] emerge dev-lang/ifc"
;;
*)
;;
esac
esac
i=$((i + 1))
done
die "Install a Fortran Compiler !"
else
einfo "You need one of these Fortran Compilers: $@"
einfo "Installed are:${AVAILABLE}"
if [ -n "${F77}" ]; then
MY_F77="$(basename ${F77})"
case ${MY_F77} in
g77)
TEST="${AVAILABLE:-f77}"
;;
ifc|f2c)
TEST="${AVAILABLE:-${MY_F77}}"
esac
if [ "${TEST}" == "${AVAILABLE}" ]; then
warn "F77 is set to ${F77}, which is not available \
on this System !"
F77=${AVAILABLE##\ *}
fi
fi
fi
}
# patch_fortran():
# Apply necessary patches for ${F77}
patch_fortran() {
PATCHES=${FILESDIR}/${P}-$(basename ${F77})*
if [ -n "${PATCHES}" ]; then
for PATCH in ${PATCHES}; do
epatch ${PATCH}
done
fi
}
# fortran_pkg_setup():
# Set FORTRAN to indicate the list of Fortran Compiler that
# can be used for the ebuild.
# If not set in ebuild, FORTRAN will default to:
FORTRAN="f77"
fortran_pkg_setup() {
need_fortran ${FORTRAN}
}
# fortran_src_unpack():
# Run patch_fortran if no new src_unpack() is defined.
fortran_src_unpack() {
unpack ${A}
cd ${S}
patch_fortran
}
EXPORT_FUNCTIONS pkg_setup src_unpack
|