summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b769a213a11e2648174f2abb56b2711347e580b2 (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
129
130
131
132
133
134
135
136
137
138
139
# Maintainer: Maurizio D'Addona <mauritiusdadd@gmail.com>
# Contributor: Sven Niese <Fd3querm@yahoo.de>
# Contributor: Daniel Murphy <mosquitogang201@gmail.com>

# NOTE: the option "!makeflag" is needed because the compilation
#       may fail if make uses more than one job.

pkgname=calculix
pkgver=2.15
pkgrel=1
pkgdesc="CalculiX: 3D finite element solver and post-processor (executables)"
arch=('i686' 'x86_64')
options=(!makeflags !buildflags)
url="http://www.calculix.de/"
license=('GPL2')
depends=('arpack' 'spooles' 'libsnl-svn' 'blas' 'mesa' 'glu' 'libxmu')
optdepends=('calculix-doc: documentation and examples')
makedepends=('gcc-fortran' 'perl')
checkdepends=('perl')

# NOTE: in the current version of the source tarball, the file lbfgsd.f is
#       missing. I took the file from the previus version. To be removed
#       when upstream fixes the issue
source=("http://www.dhondt.de/ccx_${pkgver}.src.tar.bz2"
        "http://www.dhondt.de/ccx_${pkgver}.test.tar.bz2"
      	"http://www.dhondt.de/cgx_${pkgver}.all.tar.bz2"
        "ccx_2.14_lbfgsb.f"
        "ccx_2.14_linpack.f"
        "ccx_2.14_timer.f"
        "calculix_${pkgver}_archlinux.patch")

sha256sums=('5f112598a5f1c1d65a9d213c30fece2481f22987f39e8b36c67aa7bd2d764cbe'
            'ee17e477aeae944c35853a663ac245c33b405c3750308c5d77e5ee9a4e609dd5'
            'ce589e777249181e3c15bba6a42ec22ca305ef4e1cfba478d86ae6c775f1712b'
            'b528f595f6b0969ed7e58339d1be0f09f65bd52a62b449d9d0066c367676bdb9'
            '58c9131af4bce6649cb4fd19525311df3df52364bd1fe4908be3b770b5b076f6'
            '8ad2be66b9dc491d20eeb9801aadfd8451439372179ca41cc95bf5acb0de6aac'
            '7cd1b478aab2886b2a2eb590a165f25d6ddade1076ebbe0d3d5f8c4acc120a22')

prepare()
{
    cd "${srcdir}"

    cp -n ccx_2.14_lbfgsb.f "${srcdir}/CalculiX/ccx_${pkgver}/src/lbfgsb.f"
    cp -n ccx_2.14_linpack.f "${srcdir}/CalculiX/ccx_${pkgver}/src/linpack.f"
    cp -n ccx_2.14_timer.f "${srcdir}/CalculiX/ccx_${pkgver}/src/timer.f"

    msg "Patching makefiles..."
    rm -rf CalculiX/libSNL
    patch -p0 -f -l -s -i calculix_${pkgver}_archlinux.patch
    msg2 "Done"
}

build()
{   
    msg "Building..."
    
    msg2 "Building solver..."
    cd "${srcdir}/CalculiX/ccx_${pkgver}/src"
    make
    
    msg2 "Building gui..."
    cd "${srcdir}/CalculiX/cgx_${pkgver}/src"
    make

    msg2 "Build complete"
}

check()
{
  tests=('beamp' 'ball' 'pipe' 'pipe2' 'planestress'
         'gap' 'gap2' 'capacitor' 'carbonseal' 'beamptied1'
         'beamp1rotate' 'beamp2' 'beamp2rotate' 'beamf' 'beamhf'
         'cou' 'furnace' 'gaspipe1' 'gaspipe1-oil' 'gaspipe2'
         'gaspipe3' 'gaspipe4' 'gaspipe5' 'gaspipe6' 'gaspipe7'
         'gaspipe8' 'gaspipe-cfd-pressure' 'gaspipe8-cfd-pressure'
         'gaspipe8-cfd-massflow' 'gaspipe8-cfd-pressure'
         'gaspipe8-cfd-pressure-split' 'green1' 'green2' 'green3'
         'green4' 'hinge' 'hueeber1' 'hueeber2' 'induction' 'induction2'
         'inistrain' 'largerot1' 'linearnet' 'mass1' 'mass2' 'mass3'
         'massflow_percent_ccx' 'membrane1' 'metalforming' 'modelchel'
         'multistage' 'networkmpc' 'oneel' 'pendel' 'resstress1'
         'restrictor' 'segment' 'sensitivity_I' 'shell1'
         'shellbeam' 'shellf' 'simplebeam' 'slant' 'spring1' 'spring2'
         'small_pressure_gradient' 'square' 'substructure' 'swing'
         'thermomech' 'thread' 'transition' 'truss' 'twobeam' 'vortex1'
         'wire')

  msg "Testing solver..."
  cd ${srcdir}/CalculiX/ccx_${pkgver}/test

  for test_name in "${tests[@]}" ; do
    ref_file=${test_name}.dat.ref
    dat_file=${test_name}.dat
    frd_file=${test_name}.frd
    log_file=${test_name}.log

    msg2 "testing ${test_name}"
    rm -f ${dat_file}
    rm -f ${frd_file}

    ../src/ccx_${pkgver} ${test_name} &> ${log_file} ||\
        warning "check $(pwd)/${log_file}"

    if [ ! -f ${dat_file} ]; then
	    warning "${dat_file} does not exist"
      false
    fi

    sum1="$(wc -l ${dat_file})"
    sum2="$(wc -l ${ref_file})"
    if [ ${sum1%* *} != ${sum2%* *} ]; then
	    warning "The data file generated by ccx is not valid"
      false
    fi

    if grep "NaN" ${dat_file} ; then
      warning "${dat_file} contains NaN!"
      false
    fi

    if ! ./datcheck.pl ${test_name} ; then
      warning "Result is inconsistent with reference data!"
      false
    fi
  done
}

package() 
{
    msg "Copying files"

    install -d  ${pkgdir}/usr/bin

    install -Dm755 ${srcdir}/CalculiX/ccx_${pkgver}/src/ccx_${pkgver} ${pkgdir}/usr/bin/ccx
    install -Dm755 ${srcdir}/CalculiX/cgx_${pkgver}/src/cgx ${pkgdir}/usr/bin/cgx

    msg2 "Done"  
}