check_jb tar xfz ${SOURCE_DIR}/Numeric-23.7.tar.gz -C ${INSTALL_WORK}
cd ${PRODUCT_WORK}
-# check existence of lapack, f77blas, cblas, atlas libraries
-found=1
-check_lib_version liblapack.so
-if [ "$?" -ne "0" ] ; then
- found=0
-fi
-if [ "$found" -eq "1" ] ; then
- check_lib_version libf77blas.so
- if [ "$?" -ne "0" ] ; then
- found=0
+# check existence of lapack, f77blas, cblas, atlas, g2c libraries
+check_lib_version liblapack.so $LD_LIBRARY_PATH:/usr/lib
+lapack_nf=$?
+check_lib_version libf77blas.so $LD_LIBRARY_PATH:/usr/lib
+f77blas_nf=$?
+check_lib_version libcblas.so $LD_LIBRARY_PATH:/usr/lib
+cblas_nf=$?
+check_lib_version libatlas.so $LD_LIBRARY_PATH:/usr/lib
+atlas_nf=$?
+check_lib_version libg2c.so $LD_LIBRARY_PATH:/usr/lib
+g2c_nf=$?
+let nfound=$lapack_nf+$f77blas_nf+$cblas_nf+$atlas_nf+$g2c_nf
+# modify build procedure according to the libraries found
+if [ $nfound -gt 0 ] ; then
+ cp setup.py setup.py.orig
+ if [ "$lapack_nf" -eq "1" ] ; then
+ sed -e "s%\(^libraries_list = \[\)\('lapack', \)\(.*\)$%\1\3%g" setup.py > _setup.py
+ mv _setup.py setup.py
fi
-fi
-if [ "$found" -eq "1" ] ; then
- check_lib_version libcblas.so
- if [ "$?" -ne "0" ] ; then
- found=0
+ if [ "$f77blas_nf" -eq "1" ] ; then
+ sed -e "s%\(^libraries_list = \[.*\)\('f77blas', \)\(.*\)$%\1\3%g" setup.py > _setup.py
+ mv _setup.py setup.py
fi
-fi
-if [ "$found" -eq "1" ] ; then
- check_lib_version libatlas.so
- if [ "$?" -ne "0" ] ; then
- found=0
+ if [ "$cblas_nf" -eq "1" ] ; then
+ sed -e "s%\(^libraries_list = \[.*\)\('cblas', \)\(.*\)$%\1\3%g" setup.py > _setup.py
+ mv _setup.py setup.py
fi
-fi
-# if any library is not found modify build procedure
-if [ "$found" -eq "0" ] ; then
- cp setup.py setup.py.orig
- sed -e "s%^use_dotblas = 1%use_dotblas = 0%g" -e "s%^libraries_list = \['lapack', 'cblas', 'f77blas', 'atlas', 'g2c'\]%libraries_list = \['g2c'\]%g" setup.py.orig > setup.py
+ if [ "$atlas_nf" -eq "1" ] ; then
+ sed -e "s%\(^libraries_list = \[.*\)\('atlas', \)\(.*\)$%\1\3%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ fi
+ if [ "$g2c_nf" -eq "1" ] ; then
+ sed -e "s%\(^libraries_list = \[.*\)\('g2c'\)\(.*\)$%\1\3%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ fi
+ sed -e "s%^use_dotblas = 1%use_dotblas = 0%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ sed -e "s%#\(os.path.join('Src', 'blas_lite.c'),\)%\1%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ sed -e "s%#\(os.path.join('Src', 'f2c_lite.c'),\)%\1%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ sed -e "s%#\(os.path.join('Src', 'zlapack_lite.c'),\)%\1%g" setup.py > _setup.py
+ mv _setup.py setup.py
+ sed -e "s%#\(os.path.join('Src', 'dlapack_lite.c')\)%\1%g" setup.py > _setup.py
+ mv _setup.py setup.py
chmod a+x setup.py
fi