summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bb5e499640a01f8b560ce260afdd2418fa86a83d (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
pkgname=cadna_c
pkgver=3.1.12
pkgrel=1
pkgdesc="Control of Accuracy and Debugging for Numerical Applications"
arch=('i686' 'x86_64')
url="http://cadna.lip6.fr/"
license=('LGPL')
depends=('gcc-libs' 'openmpi' 'gcc-fortran')
makedepends=()
# README says to not build in parallel (and indeed, parallel build fails)
options=(!makeflags)
# Renamed with _half suffix since 3.1.12
_pkgname=cadna_c_half
source=("http://cadna.lip6.fr/Download_Dir/${_pkgname}-${pkgver}.tar.gz")

prepare() {
        cd ${_pkgname}-${pkgver}

        ./configure --prefix=/usr --enable-fortran
}

build() {
        cd ${_pkgname}-${pkgver}
        make
}

check() {
        cd ${_pkgname}-${pkgver}

        # Temporarily install just for building tests
        _test_install=$(realpath _install)
        _test_prefix=$_test_install/usr
        make install DESTDIR=$_test_install

        _examples="examplesC
                   examplesC_mpi
                   examplesC_mpiomp
                   examplesC_omp
                   examplesFortran
                   examplesFortran_mpi"

        _INCFLAGS+="-I$_test_prefix/include"
        _MODFLAGS+="-J$_test_prefix/include"
        _LIBFLAGS+="-L$_test_prefix/lib"

        for ex in $_examples
        do
                case "$ex" in
                  examplesC|examplesFortran)
                        _BINS="ex1 ex1_cad ex2 ex2_cad ex3 ex3_cad ex4 ex4_cad
                               ex5 ex5_cad ex5_cad_opt ex6 ex6_cad"
                        #_BINS+="ex7 ex7_cad" # these are interactive
                        ;;
                  examplesC_mpi)
                        _LAUNCH="mpirun -np 4" # num procs required by tests
                        _BINS="exampleMPI1 exampleMPI1_cad
                               exampleMPI2 exampleMPI2_cad
                               exampleMPI1_float exampleMPI1_float_cad
                               exampleMPI2_float exampleMPI2_float_cad"
                        ;;
                  examplesC_mpiomp)
                        _BINS="exampleMPI_OMP1 exampleMPI_OMP1_cad"
                        ;;
                  examplesC_omp)
                        _BINS="exampleOPENMP1 exampleOPENMP1_cad"
                        ;;
                  examplesFortran_mpi)
                        _LIBS=""
                        _LAUNCH="mpirun -np 4" # num procs required by tests
                        _BINS="exampleMPI1Reduce_cad exampleMPI1Reduce_float_cad
                               exampleMPI1SendRecv exampleMPI1SendRecv_float
                               exampleMPI1SendRecv_cad exampleMPI1SendRecv_float_cad"
                        ;;
                esac

                echo ">>> Building $ex..."

                make -C $ex clean
                make -C $ex CPPFLAGS+=" $_INCFLAGS " FCFLAGS+=" $_MODFLAGS " \
                        CFLAGS+=" $CFLAGS" CXXFLAGS+=" $CXXFLAGS " \
                        LDFLAGS+=" $_LIBFLAGS " LIBS+=" $_LIBS "

                for bin in $_BINS
                do
                        echo ">>> Running $ex/$bin..."
                        $_LAUNCH ./$ex/$bin
                done
        done
}

package() {
        cd ${_pkgname}-${pkgver}
        make install DESTDIR="$pkgdir"
}

sha256sums=('a25f6b7563c865ecc40088880d41756a6b21e4e84a1d217aee1e2894d93e2f1c')