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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Mar 31 20:09:31 2015 UTC (5 years, 3 months ago) by ulm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +5 -5 lines
Update dependency after package move of eselect modules to app-eselect.

(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 9433907D693FB5B8!)

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-r2.ebuild,v 1.1 2015/02/20 14:46:15 jlec Exp $
4
5 EAPI=5
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="
40 app-eselect/eselect-blas
41 app-eselect/eselect-lapack
42 test? ( ${CDEPEND} )"
43
44 RDEPEND="${CDEPEND}
45 app-eselect/eselect-blas
46 app-eselect/eselect-lapack
47 doc? ( app-doc/blas-docs app-doc/lapack-docs )"
48
49 S="${WORKDIR}"
50
51 pkg_nofetch() {
52 einfo "Please download the ACML from:"
53 einfo "${HOMEPAGE}"
54 einfo "and place it in ${DISTDIR}."
55 einfo "The previous versions could be found at"
56 einfo "http://developer.amd.com/acmlarchive.jsp"
57 einfo "SRC=${A} $SRC_URI"
58 }
59
60 get_fcomp() {
61 case $(tc-getFC) in
62 *gfortran* )
63 FCOMP="gfortran" ;;
64 ifort )
65 FCOMP="ifc" ;;
66 * )
67 FCOMP=$(tc-getFC) ;;
68 esac
69 }
70
71 pkg_setup() {
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 emake clean
116 done
117 done
118 }
119
120 make_acml_profile_name() {
121 local fort=${1%%[[:digit:]]*}
122 local opt=${1#*[0-9][0-9]}
123 echo ${PN}-${fort}${opt/mp/openmp} | tr '_' '-'
124 }
125
126 src_install() {
127 # respect acml default install dir (and FHS)
128 local instdir=/opt/${PN}${PV}
129 dodir ${instdir}
130
131 for lib in */lib; do
132 local fdir=${lib%/*}
133 # install acml
134 use examples || rm -rf "${S}"/${fdir}/examples
135 cp -pPR "${S}"/${fdir} "${D}"${instdir} || die "copy ${fdir} failed"
136
137 # install profiles
138 local prof=$(make_acml_profile_name ${fdir})
139 local acmldir=${instdir}/${fdir}
140 local acmllibs="-lacml"
141 local libname=${acmldir}/lib/libacml
142 local extlibs
143 local extflags
144 [[ ${fdir} =~ int64 ]] && extflags="${extflags} -fdefault-integer-8"
145 [[ ${fdir} =~ gfortran ]] && extlibs="${extlibs} -lgfortran"
146 if [[ ${fdir} =~ _mp ]]; then
147 [[ ${fdir} =~ ifort ]] && extlibs="${extlibs} -lguide"
148 extlibs="${extlibs} -lpthread"
149 extflags="${extflags} -fopenmp"
150 acmllibs="-lacml_mp"
151 libname=${libname}_mp
152 fi
153 use amd64 && acmllibs="${acmllibs} -lacml_mv"
154 for x in blas lapack; do
155 # pkgconfig files
156 sed -e "s:@LIBDIR@:$(get_libdir):" \
157 -e "s:@PV@:${PV}:" \
158 -e "s:@ACMLDIR@:${acmldir}:g" \
159 -e "s:@ACMLLIBS@:${acmllibs}:g" \
160 -e "s:@EXTLIBS@:${extlibs}:g" \
161 -e "s:@EXTFLAGS@:${extflags}:g" \
162 "${FILESDIR}"/${x}.pc.in > ${x}.pc \
163 || die "sed ${x}.pc failed"
164 insinto ${acmldir}/lib
165 doins ${x}.pc
166
167 # eselect files
168 cat > eselect.${prof}.${x} <<-EOF
169 ${libname}.so /usr/@LIBDIR@/lib${x}.so.0
170 ${libname}.so /usr/@LIBDIR@/lib${x}.so
171 ${libname}.a /usr/@LIBDIR@/lib${x}.a
172 ${acmldir}/lib/${x}.pc /usr/@LIBDIR@/pkgconfig/${x}.pc
173 EOF
174 eselect ${x} add $(get_libdir) eselect.${prof}.${x} ${prof}
175 done
176 done
177
178 echo "LDPATH=${instdir}/${ACML_DEFAULT_DIR}/lib" > 35acml
179 doenvd "${S}"/35acml
180 use doc || rm -rf "${S}"/Doc/acml.pdf "${S}"/Doc/html
181 cp -pPR "${S}"/Doc "${D}"${instdir} || die "copy doc failed"
182 }
183
184 pkg_postinst() {
185 local dprof="$(make_acml_profile_name ${ACML_DEFAULT_DIR})"
186 for x in blas lapack; do
187 local cprof=$(eselect ${x} show | cut -d' ' -f2)
188 if [[ ${cprof} == ${dprof} || -z ${cprof} ]]; then
189 # work around eselect bug #189942
190 local configfile="${ROOT}"/etc/env.d/${x}/$(get_libdir)/config
191 [[ -e ${configfile} ]] && rm -f ${configfile}
192 eselect ${x} set ${dprof}
193 elog "${x} has been eselected to ${dprof}"
194 else
195 elog "Current eselected ${x} implementation is ${cprof}"
196 elog "To use you have one of ${PN}, issue (as root):"
197 elog "\t eselect ${x} set <profile>"
198 fi
199 done
200 }

  ViewVC Help
Powered by ViewVC 1.1.20