updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / aster / PKGBUILD
blob8c032ed71d90baa693d5f263b57706704d701564
1 # Maintainer: Michele Mocciola <mickele>
2 # Contributor: Brice Méalier <mealier_brice@yahoo.fr>
4 pkgname=aster
5 pkgver=10.1.0
6 pkgrel=4
7 pkgdesc="Code-Aster provides a complete serie of analysis and multiphysics modelling methods"
8 url="http://www.code-aster.org/index.php"
9 license="GPL"
10 depends=('python' 'python-numeric' 'blas' 'lapack' 'tcl' 'tk' 'scotch>5.1.7' 'hdf5>=1.8.0' 'med>=2.3.6' 'metis-edf>=4.1' 'astk>=1.8.0-3')
11 makedepends=('sed' 'coreutils' 'patch' 'binutils' 'libarchive')
12 optdepends=('homard>=9.5: to refine and de-refine meshes')
13 conflicts=()
14 replaces=()
15 backup=()
16 arch=('i686' 'x86_64')
17 install=(aster.install)
18 source=(http://www.code-aster.org/V2/UPLOAD/DOC/Telechargement/$pkgname-full-src-$pkgver-4.noarch.tar.gz)
19 option=('!strip')
21 _pkgvershort=${pkgver:0:4}
22 _installdir=/opt/aster
23 _astkdir=${_installdir}/ASTK
24 _pythonver=2.6
26 build() {
28   cd ${srcdir}/${pkgname}-full-src-${pkgver}/SRC || return 1
29   
30   cp -rf /opt/metis-edf/ ${srcdir} || return 1
31   rm -rf ${srcdir}/metis-edf/lib/*.so* || return 1
32   
33   # Modify aster source because of an issue in the last scotch
34   bsdtar -xf aster-src-10.1.0-1.noarch.tar.gz
35   rm -rf aster-src-10.1.0-1.noarch.tar.gz || return 1
36   sed -e "s|#include \"common.h\"|/\*#include \"common.h\"\*/|" \
37       -i STA${pkgver:0:4}/bibc/scotch/fetsco.c
38   tar czf aster-src-10.1.0-1.noarch.tar.gz STA${pkgver:0:4}
40   msg "-- Sets configuration variables --"
42   cd ${srcdir}/${pkgname}-full-src-${pkgver} || return 1
44   # *** Modifies setup.py and check_compilers.py: no question to stop compilation ***
45   sed -e "s|should_continue()|#should_continue()|g" \
46       -i setup.py
47   sed -e "s|rep = should_continue()|#rep = should_continue()|" \
48       -i check_compilers.py
50   # *** Modifies products.py because version of scotch on AUR is more recent than the one code-aster expects ***
51   sed -e "s|, 'scotcherrcom'||" \
52       -e "s|'common',||" \
53       -e "s|?ASTER_ROOT?|${pkgdir}${_installdir}|" \
54       -i products.py
56   # *** Modifies setup.cfg ***
57   sed -e "s|/opt/aster|${pkgdir}${_installdir}|" \
58       -e "s|#CC='/usr/bin/gcc'|CC='/usr/bin/gcc'|" \
59       -e "s|#CXX='/usr/bin/g++'|CXX='/usr/bin/g++'|" \
60       -e "s|#F77='/usr/bin/g77'|F77='/usr/bin/gfortran'|" \
61       -e "s|#F90='/usr/bin/gfortran'|F90='/usr/bin/gfortran'|" \
62       -e "s|#LD=F77|LD='LD=F77'|" \
63       -e "s|PREFER_SHARED_LIBS=False|PREFER_SHARED_LIBS=True|" \
64       -e "s|_install_omniORB   = True|#_install_omniORB   = True|" \
65       -e "s|_install_omniORBpy = True|#_install_omniORBpy = True|" \
66       -e "s|_install_pylotage  = True|#_install_pylotage  = True|" \
67       -i setup.cfg
69   echo "_install_hdf5 = False" >> setup.cfg
70   echo "HOME_HDF='/usr'" >> setup.cfg
71   echo "_install_med = False" >> setup.cfg
72   echo "HOME_MED='/usr'" >> setup.cfg
73   echo "_install_tcl = False" >> setup.cfg
74   echo "_install_tk  = False" >> setup.cfg
75   echo "HOME_TCL_TK='/usr'" >> setup.cfg
76   echo "_install_Pmw = False" >> setup.cfg
77   echo "_install_Numeric = False" >> setup.cfg
78   echo "HOME_NUMERIC='/usr'" >> setup.cfg
79   echo "_install_gmsh = False" >> setup.cfg
80   echo "_install_gmsh2 = False" >> setup.cfg
81   echo "_install_gibi = False" >> setup.cfg
82   echo "_install_grace = False" >> setup.cfg
83   echo "XMGRACE = 'xmgrace'" >> setup.cfg
84   echo "_install_homard = False" >> setup.cfg
85   echo "_install_eficas = False" >> setup.cfg
86   echo "_install_astk = False" >> setup.cfg
87   echo "_install_astk_serv = False" >> setup.cfg
88   echo "_install_metis = False" >> setup.cfg
89   echo "HOME_METIS='${srcdir}/metis-edf'" >> setup.cfg
90   echo "_install_mumps = False" >> setup.cfg
91   echo "HOME_MUMPS = ''" >> setup.cfg
92   echo "_install_omniORB = False" >> setup.cfg
93   echo "_install_omniORBpy = False" >> setup.cfg
94   echo "_install_pylotage = False" >> setup.cfg
95   echo "_install_crpcrs = False" >> setup.cfg
96   echo "_install_aster_Linux = False" >> setup.cfg
97   echo "_install_scotch  = False" >> setup.cfg
98   echo "OPT_ENV = 'verbose=True'" >> setup.cfg
99   echo "HOME_SCOTCH = '/usr'" >> setup.cfg
100   echo "HOME_ZMAT = ''" >> setup.cfg
101   echo "HOME_MPI = ''" >> setup.cfg
102   echo "BLASLIB='/usr'" >> setup.cfg
103   echo "LAPACKLIB='/usr'" >> setup.cfg
104   echo "GZIP='/bin/gzip'" >> setup.cfg
105   echo "SHELL_EXECUTION='/bin/sh'" >> setup.cfg
106   echo "TERMINAL='xterm'" 
107   echo "LDFLAGS='-lstdc++ $LDFLAGS'" >> setup.cfg
108   if [ "$CARCH" = "x86_64" ]; then
109     echo "FFLAGS='-ffixed-line-length-0 -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 $FFLAGS'" >> setup.cfg
110     echo "FFLAGS_DBG='-g -ffixed-line-length-0 -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 $FFLAGS'" >> setup.cfg
111     echo "F90FLAGS='-ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 $FFLAGS'" >> setup.cfg
112     echo "F90FLAGS_DBG='-g -ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 $FFLAGS'" >> setup.cfg
113   else # i686
114     echo "FFLAGS='-ffixed-line-length-0 $FFLAGS'" >> setup.cfg
115     echo "FFLAGS_DBG='-g -ffixed-line-length-0 $FFLAGS'" >> setup.cfg
116     echo "F90FLAGS='-ffixed-line-length-0 -x f77-cpp-input -I/usr/include $FFLAGS'" >> setup.cfg
117     echo "F90FLAGS_DBG='-g -ffixed-line-length-0  -x f77-cpp-input -I/usr/include $FFLAGS'" >> setup.cfg
118   fi
119   echo "CFLAGS='-fno-stack-protector -DH5_USE_16_API $CFLAGS'" >> setup.cfg
120   echo "CFLAGS_DBG='-g -fno-stack-protector -DH5_USE_16_API $CFLAGS'" >> setup.cfg
121   echo "CPPFLAGS='-DH5_USE_16_API $CPPFLAGS'" >> setup.cfg
122   echo "CXXFLAGS='-DH5_USE_16_API $CXXFLAGS'" >> setup.cfg
123   echo "MATH_LIST = ['blas', 'lapack', 'gfortran']">> setup.cfg
125   # *** Compiles .py files to improve compilation speed ***
126   /usr/bin/python /usr/lib/python$_pythonver/compileall.py ./
127   /usr/bin/python -O /usr/lib/python$_pythonver/compileall.py ./
129   # *** copies and modifies some files from astk necessary to build code-aster ***
130   mkdir -p ${pkgdir}${_installdir}/etc/codeaster || return 1
131   cp -rf ${_installdir}/etc/codeaster/*  ${pkgdir}${_installdir}/etc/codeaster || return 1
132   cp -rf ${_installdir}/bin \
133          ${pkgdir}${_installdir} || return 1
134   mkdir -p ${pkgdir}${_installdir}/lib/python${_pythonver}/site-packages || return 1
135   cp -rf ${_installdir}/lib/python${_pythonver}/site-packages/asrun \
136          ${pkgdir}${_installdir}/lib/python${_pythonver}/site-packages  || return 1
137   sed -e "s|${_installdir}|${pkgdir}${_installdir}|g" \
138       -i ${pkgdir}${_installdir}/bin/as_run
139   for _FILE in etc/codeaster/profile.sh lib/python${_pythonver}/site-packages/asrun/installation.py
140   do
141         sed -e "s|${_installdir}|${pkgdir}${_installdir}|g" \
142             -e "s|/ASTK/ASTK_SERV||" \
143             -i ${pkgdir}${_installdir}/${_FILE}
144   done
147   msg "--- Builds Code_Aster ---"
149   python setup.pyo --prefix=${pkgdir}${_installdir} install aster | tee ${srcdir}/build.log
152 package() {
154   msg "--- Modifies some files in the installation dir ---"
156   # *** set HDF5_DISABLE_VERSION_CHECK variable because of problem with HDF5 versioning ***
157   echo "" >> ${pkgdir}${_installdir}/STA${_pkgvershort}/profile.sh
158   echo "# Added by Archlinux maintainer" >> ${pkgdir}${_installdir}/STA${_pkgvershort}/profile.sh
159   echo "export HDF5_DISABLE_VERSION_CHECK=2" >> ${pkgdir}${_installdir}/STA${_pkgvershort}/profile.sh
161   # *** removes links to the building dir ***
162   for _FILE in Makefile Makefile.asrun config.txt profile.sh astout.export config.txt forma01a.export
163   do
164     sed -e "s|${pkgdir}||g" \
165         -i ${pkgdir}${_installdir}/STA${_pkgvershort}/${_FILE}
166   done
168   # *** I took these from freebsd maintainer: they should be usefull ;-) ***
169   chmod -x ${pkgdir}${_installdir}/STA${_pkgvershort}/materiau/A42_REF_A.NOMI || return 1
170   for _FILE in astout.export config.txt forma01a.export
171   do
172     sed -e "s|^F list|@F list|" \
173         -e "s|^#F list|F list|" \
174         -e "s|^@F list|#F list|" \
175         -e "s|P mode astout|P mode interactif|" \
176         -e "s|P mode forma01a|P mode interactif|" \
177         -e "s|R resu_test ${_installdir}|R resu_test /tmp|" \
178         -i ${pkgdir}${_installdir}/STA${_pkgvershort}/${_FILE}
179   done
180   sed -e "s|cat ./fort.15 ./ficode|cat ./ficode|"       \
181       -i ${pkgdir}${_installdir}/STA${_pkgvershort}/bibpyt/Execution/E_SUPERV.py
183   # *** Compiles .py files to improve execution speed ***
184   for _FILE in bibpyt commande
185   do
186     python /usr/lib/python$_pythonver/compileall.py -f ${pkgdir}${_installdir}/STA${_pkgvershort}/${_FILE}
187     python -O /usr/lib/python$_pythonver/compileall.py -f ${pkgdir}${_installdir}/STA${_pkgvershort}/${_FILE}
188   done 
190   touch ${pkgdir}${_installdir}/STA${_pkgvershort}/etude/forma01a.17 || return 1
192   
193   msg "--- Removes unnecessary files and symbols ---"
195   # *** Remove unnecessary files ***
196   # Files contained in astk
197   rm -rf ${pkgdir}${_installdir}/{.postinst,bin,etc,lib} || return 1
198   # Object files
199   rm -rf ${pkgdir}${_installdir}/STA${_pkgvershort}/obj || return 1
200   for _FILE in `find $pkgdir -name "*.o"`
201   do
202     rm -f ${_FILE} || return 1
203   done
205   # *** Remove unnecessary symbols ***
206   for _FILE in \
207       ${pkgdir}${_installdir}/STA${_pkgvershort}/asteru \
208       ${pkgdir}${_installdir}/STA${_pkgvershort}/lib/libaster.a \
209       ${pkgdir}${_installdir}/STA${_pkgvershort}/lib/libferm.a; 
210   do
211     strip --strip-debug ${_FILE} || return 1
212   done
213   for _FILE in \
214       ${pkgdir}${_installdir}/STA${_pkgvershort}/asteru;
215   do
216     strip --strip-unneeded ${_FILE} || return 1
217   done
220 md5sums=('49fe55a0a46491124c16965a2db59c5e')