/[gentoo-x86]/sci-libs/acml/acml-4.1.0-r1.ebuild
Gentoo

Contents of /sci-libs/acml/acml-4.1.0-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Fri Feb 20 14:46:15 2015 UTC (5 years, 4 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
FILE REMOVED
Drop old; move to EAPI=5, fixes #478598

(Portage version: 2.2.17/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-libs/acml/acml-4.1.0-r1.ebuild,v 1.13 2015/02/15 06:46:42 vapier Exp $
4
5 EAPI=1
6
7 inherit eutils fortran-2 multilib toolchain-funcs versionator
8
9 MY_P=${PN}-$(replace_all_version_separators -)
10
11 DESCRIPTION="AMD Core Math Library for x86 and amd64 CPUs"
12 HOMEPAGE="http://developer.amd.com/acml.jsp"
13 SRC_URI="
14 amd64? (
15 ifc? ( ${MY_P}-ifort-64bit.tgz
16 int64? ( ${MY_P}-ifort-64bit-int64.tgz ) )
17 gfortran? ( ${MY_P}-gfortran-64bit.tgz
18 int64? ( ${MY_P}-gfortran-64bit-int64.tgz ) )
19 !ifc? (
20 !gfortran? ( ${MY_P}-gfortran-64bit.tgz
21 int64? ( ${MY_P}-gfortran-64bit-int64.tgz ) ) ) )
22 x86? (
23 ifc? ( ${MY_P}-ifort-32bit.tgz )
24 gfortran? ( ${MY_P}-gfortran-32bit.tgz )
25 !ifc? ( !gfortran? ( ${MY_P}-gfortran-32bit.tgz ) ) )"
26
27 SLOT="0"
28 LICENSE="ACML"
29 KEYWORDS="-* ~amd64 ~x86"
30 IUSE="doc examples gfortran ifc int64 openmp test"
31
32 RESTRICT="strip fetch"
33
34 CDEPEND="
35 ifc? ( dev-lang/ifc )
36 gfortran? ( =sys-devel/gcc-4.2* )
37 !gfortran? ( !ifc? ( =sys-devel/gcc-4.2* ) )"
38
39 DEPEND="test? ( ${CDEPEND} )
40 app-admin/eselect-blas
41 app-admin/eselect-lapack"
42
43 RDEPEND="${CDEPEND}
44 app-admin/eselect-blas
45 app-admin/eselect-lapack
46 doc? ( app-doc/blas-docs app-doc/lapack-docs )"
47
48 S="${WORKDIR}"
49
50 pkg_nofetch() {
51 einfo "Please download the ACML from:"
52 einfo "${HOMEPAGE}"
53 einfo "and place it in ${DISTDIR}."
54 einfo "The previous versions could be found at"
55 einfo "http://developer.amd.com/acmlarchive.jsp"
56 einfo "SRC=${A} $SRC_URI"
57 }
58
59 get_fcomp() {
60 case $(tc-getFC) in
61 *gfortran* )
62 FCOMP="gfortran" ;;
63 ifort )
64 FCOMP="ifc" ;;
65 * )
66 FCOMP=$(tc-getFC) ;;
67 esac
68 }
69
70 pkg_setup() {
71
72 if use test; then
73 # work around incomplete fortran eclass
74 if use gfortran &&
75 [[ $(tc-getFC) =~ gfortran ]] &&
76 [[ $(gcc-version) != 4.2 ]]
77 then
78 eerror "You need gfortran-4.2 to test acml"
79 eerror "Please use gcc-config to switch gcc version 4.2"
80 die "gfortran check failed"
81 fi
82 fi
83 if use openmp; then
84 tc-has-openmp || die "Please ensure your compiler has openmp support"
85 FORTRAN_NEED_OPENMP=1
86 fi
87 fortran-2_pkg_setup
88 get_fcomp
89 # construct default profile dprof from default ddir
90 local ddir=gfortran
91 use ifc && ddir=ifort
92 use x86 && ddir=${ddir}32 || ddir=${ddir}64
93 use openmp && ddir=${ddir}_mp
94 use int64 && ddir=${ddir}_int64
95 ACML_DEFAULT_DIR=${ddir}
96 }
97
98 src_unpack() {
99 unpack ${A}
100 unpack ./contents-acml-*.tgz
101 use openmp || rm -rf *_mp*
102 }
103
104 src_test() {
105 # only testing with current chosen compiler
106 for fdir in ${ACML_DEFAULT_DIR/_mp}*; do
107 einfo "Testing acml in ${fdir}"
108 for d in . acml_mv; do
109 cd "${S}"/${fdir}/examples/${d}
110 emake \
111 ACMLDIR="${S}"/${fdir} \
112 F77=$(tc-getFC) \
113 CC="$(tc-getCC)" \
114 CPLUSPLUS="$(tc-getCXX)" \
115 || die "emake test in ${fdir}/examples/${d} failed"
116 emake clean
117 done
118 done
119 }
120
121 make_acml_profile_name() {
122 local fort=${1%%[[:digit:]]*}
123 local opt=${1#*[0-9][0-9]}
124 echo ${PN}-${fort}${opt/mp/openmp} | tr '_' '-'
125 }
126
127 src_install() {
128 # respect acml default install dir (and FHS)
129 local instdir=/opt/${PN}${PV}
130 dodir ${instdir}
131
132 for lib in */lib; do
133 local fdir=${lib%/*}
134 # install acml
135 use examples || rm -rf "${S}"/${fdir}/examples
136 cp -pPR "${S}"/${fdir} "${D}"${instdir} || die "copy ${fdir} failed"
137
138 # install profiles
139 local prof=$(make_acml_profile_name ${fdir})
140 local acmldir=${instdir}/${fdir}
141 local acmllibs="-lacml"
142 local libname=${acmldir}/lib/libacml
143 local extlibs
144 local extflags
145 [[ ${fdir} =~ int64 ]] && extflags="${extflags} -fdefault-integer-8"
146 [[ ${fdir} =~ gfortran ]] && extlibs="${extlibs} -lgfortran"
147 if [[ ${fdir} =~ _mp ]]; then
148 [[ ${fdir} =~ ifort ]] && extlibs="${extlibs} -lguide"
149 extlibs="${extlibs} -lpthread"
150 extflags="${extflags} -fopenmp"
151 acmllibs="-lacml_mp"
152 libname=${libname}_mp
153 fi
154 use amd64 && acmllibs="${acmllibs} -lacml_mv"
155 for x in blas lapack; do
156 # pkgconfig files
157 sed -e "s:@LIBDIR@:$(get_libdir):" \
158 -e "s:@PV@:${PV}:" \
159 -e "s:@ACMLDIR@:${acmldir}:g" \
160 -e "s:@ACMLLIBS@:${acmllibs}:g" \
161 -e "s:@EXTLIBS@:${extlibs}:g" \
162 -e "s:@EXTFLAGS@:${extflags}:g" \
163 "${FILESDIR}"/${x}.pc.in > ${x}.pc \
164 || die "sed ${x}.pc failed"
165 insinto ${acmldir}/lib
166 doins ${x}.pc || die "doins ${x}.pc failed"
167
168 # eselect files
169 cat > eselect.${prof}.${x} <<-EOF
170 ${libname}.so /usr/@LIBDIR@/lib${x}.so.0
171 ${libname}.so /usr/@LIBDIR@/lib${x}.so
172 ${libname}.a /usr/@LIBDIR@/lib${x}.a
173 ${acmldir}/lib/${x}.pc /usr/@LIBDIR@/pkgconfig/${x}.pc
174 EOF
175 eselect ${x} add $(get_libdir) eselect.${prof}.${x} ${prof}
176 done
177 done
178
179 echo "LDPATH=${instdir}/${ACML_DEFAULT_DIR}/lib" > 35acml
180 doenvd "${S}"/35acml || die "doenvd failed"
181 use doc || rm -rf "${S}"/Doc/acml.pdf "${S}"/Doc/html
182 cp -pPR "${S}"/Doc "${D}"${instdir} || die "copy doc failed"
183 }
184
185 pkg_postinst() {
186 local dprof="$(make_acml_profile_name ${ACML_DEFAULT_DIR})"
187 for x in blas lapack; do
188 local cprof=$(eselect ${x} show | cut -d' ' -f2)
189 if [[ ${cprof} == ${dprof} || -z ${cprof} ]]; then
190 # work around eselect bug #189942
191 local configfile="${ROOT}"/etc/env.d/${x}/$(get_libdir)/config
192 [[ -e ${configfile} ]] && rm -f ${configfile}
193 eselect ${x} set ${dprof}
194 elog "${x} has been eselected to ${dprof}"
195 else
196 elog "Current eselected ${x} implementation is ${cprof}"
197 elog "To use you have one of ${PN}, issue (as root):"
198 elog "\t eselect ${x} set <profile>"
199 fi
200 done
201 }

  ViewVC Help
Powered by ViewVC 1.1.20