updated on Tue Jan 17 00:10:10 UTC 2012
[aur-mirror.git] / atlas-lapack / PKGBUILD
blob7ecaefe10393be7daabcd0adfa8f3fecf5e0c570
1 # Maintainer: Giuseppe Borzi <gborzi___AT___ieee___DOT___org>
2 # Contributor: mickele <mimocciola___AT___yahoo___DOT___ com>
3 # Contributor: iztok pizorn <pizorn___AT___gmail___DOT___com>
4 # Contributor: olivier medoc <o_medoc___AT___yahoo___DOT___fr>
5 pkgname=atlas-lapack
6 pkgver=3.8.4
7 _lapackver=3.4.0
8 pkgrel=3
9 pkgdesc="Complete LAPACK and BLAS implementation using optimised ATLAS routines"
10 url="http://math-atlas.sourceforge.net/"
11 depends=('gcc-libs')
12 makedepends=('binutils' 'sed' 'gcc-fortran')
13 arch=('i686' 'x86_64')
14 conflicts=('blas' 'lapack' 'cblas')
15 provides=("blas" "lapack=$_lapackver" 'cblas')
16 license=('custom:blas' 'custom:lapack' 'custom:atlas')
17 source=(http://www.netlib.org/lapack/lapack-$_lapackver.tgz http://downloads.sourceforge.net/math-atlas/atlas${pkgver}.tar.bz2 blas-license.txt atlas-license.txt lapack.patch makefile.shared.mt makefile.shared.st misdetects_i1_as_i2.patch)
18 md5sums=('02d5706ec03ba885fc246e5fa10d8c70'
19          '1bb3abde499b492b4be1f1a0759fbfa2'
20          '38b6acb8ed5691d25863319d30a8b365'
21          '4903eb06072dfbf94710691ccb6660bf'
22          'c681f11a9e17d31247570a26e266a506'
23          '235db0272fc5a17100115d5c45f29700'
24          '16691a5b602dcb5a20abc525b2ae9cfc'
25          '628b8f61b0403f23558ce6bf4c723bbc')
27 build() {
29    NCPU=`grep "^processor" /proc/cpuinfo | wc -l`
30    #USE_ARCH_DEFAULTS="yes"
31    [ -x /usr/bin/cpufreq-info ] && [ $(cpufreq-info -d) != '' ] && {
32        ICPU=0
33        while [ $ICPU -lt $NCPU ]; do
34           STATUS=`cpufreq-info -c $ICPU -p | cut -d' ' -f3`
35           [ "$STATUS" != "performance" ] && {
36              msg 'Before building this package, as root you must run'
37              msg '"cpufreq-set -g performance -c <CPU nr>" for each CPU (<CPU'
38              msg 'nr> is 0, 1, 2 up to the number of your CPUS.'
39              return 1
40           }
41           let ICPU=ICPU+1
42        done
43    }
44    if [ "$CARCH" = "x86_64" ]; then
45       ARCHITECTURE_BUILD_OPTS="-b 64" # for x86_64
46    else
47       ARCHITECTURE_BUILD_OPTS="-b 32" # for i686
48    fi
50    mkdir -p "$srcdir/ATLAS/build"
51    cd "$srcdir/ATLAS"
52    patch -Np0 -i "$srcdir/misdetects_i1_as_i2.patch"
53    cd "$srcdir/ATLAS/build"
55    msg 'Determine compiler and options for LAPACK'
56    ../configure --prefix=/usr/ $ARCHITECTURE_BUILD_OPTS -Fa alg -fPIC
57    FORTRAN=`grep "F77 =" Make.inc|sed -e 's/ *F77 = //'`
58    FORTRANOPS=`grep "F77FLAGS =" Make.inc|sed -e 's/ *F77FLAGS = //'`
59    NOPTS=`echo $FORTRANOPS|sed -e 's/-O[0-9]/-O0/'`
61    msg 'Build LAPACK'
62    cd "$srcdir/lapack-$_lapackver"
63    cp INSTALL/make.inc.gfortran make.inc
64    patch -Np0 -i "$srcdir/lapack.patch"
65    make FORTRAN=$FORTRAN OPTS="$FORTRANOPS" NOOPT="$NOPTS" lib
66    LAPACKLIB="$srcdir/lapack-$_lapackver/liblapack.a"
68    msg 'Build ATLAS'
69    cd "$srcdir/ATLAS/build"
70    rm -rf *
71    ../configure --prefix=/usr/ $ARCHITECTURE_BUILD_OPTS -Fa alg -fPIC \
72       --with-netlib-lapack="$LAPACKLIB"
73    make -j1 build
74    make -j1 check
75    make -j1 time
76    msg 'Build shared libraries'
77    cd lib
78    if [ 1 -lt $NCPU ]; then
79       cp "$srcdir/makefile.shared.mt" makefile
80    else
81       cp "$srcdir/makefile.shared.st" makefile
82    fi
83    make -f makefile
86 package() {
88    NCPU=`grep "^processor" /proc/cpuinfo | wc -l`
90    cd "$srcdir/ATLAS/build"
91    make DESTDIR="$pkgdir/usr" install
92    cp -d lib/*.so* "$pkgdir/usr/lib"
93    cd "$pkgdir/usr/lib"
94    if [ 1 -lt $NCPU ]; then
95       mv -f libptcblas.a libcblas.a
96       mv -f libptf77blas.a libf77blas.a
97    else
98       rm -f *pt*
99    fi
100    ln -s libf77blas.so libblas.so.3
101    ln -s liblapack.so.$_lapackver liblapack.so.3
102    ln -s liblapack.so.3 liblapack.so
104    install -Dm644 "${srcdir}/blas-license.txt" \
105       "${pkgdir}/usr/share/licenses/$pkgname/blas-license.txt"
106    install -Dm644 "${srcdir}/lapack-$_lapackver/LICENSE" \
107       "${pkgdir}/usr/share/licenses/$pkgname/lapack-license.txt"
108    install -Dm644 "${srcdir}/atlas-license.txt" \
109       "${pkgdir}/usr/share/licenses/$pkgname/atlas-license.txt"
112 # dgeev_ dgesvd_