I've been faffing with the PKGBUILD to try some things & have made a few modifications:
- - Bump in package release.
- - Added 'openmp' to the "depends" array, as it's listed as an option the "make" step.
- - Removed 'perl' from the "makedepends" array. I presume 'perl' was added by accident for the 'sed' commands.
- - Altered the "arch" array to reflect the ARM build targets.
- - Moved the makefile erasure and "TARGET" detection steps to the prepare() function.
- - Refactored the "TARGET" detection sequence to use if else. The previous sequence would trigger errors where it formed the last call of a function. There's probably an obvious reason for this, but I lack the bash skills to fix it, so I changed it.
- - Added the 'DYNAMIC_ARCH=1' option for aarch64 architecture. When the TARGET is set to ARMV8, this seems to result in openblas being compiled for all ARMv8 cortex targets, which does increase the build time somewhat, but may have performance benefits. I haven't been able to test this, but welcome feedback.
- - Restructured the package() function to more strictly adhere to library naming conventions, and to deal with issues arising from build targets being shoved in the middle of the library names for some combinations of build parameters (but not others).
- - Removed some unnecessary options from the 'make install' line as they weren't doing anything.
- - Removed the '-e' option from all 'sed' commands, as it's not required here (no multiple expression 'sed' calls.)
- - Restructured the package() function.
- - Added comments.
- - Added myself to the Contributors section (as I think I've now spend enough time on this).
$this->bbcode_second_pass_code('', '
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Giuseppe Borzi <gborzi _AT_ ieee _DOT_ org>
# Contributor: Feakster <feakster at posteo dot eu>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - set build targets
# - clear Makefile.arm (bad cflags overrides)
pkgname=openblas
_pkgname=OpenBLAS
pkgver=0.3.13
pkgrel=2.2
pkgdesc='An optimized BLAS library based on GotoBLAS2 1.13 BSD'
arch=('arm' 'armv6h' 'armv7h' 'aarch64')
url='https://www.openblas.net/'
license=('BSD') # BSD 3-clause license
depends=('gcc-libs' 'openmp')
makedepends=('gcc-fortran')
provides=('blas=3.8.0') # 3.9.0? Does the version even need to be set?
conflicts=('blas')
source=("${_pkgname}-v${pkgver}.tar.gz::https://github.com/xianyi/${_pkgname}/archive/v${pkgver}.tar.gz")
sha512sums=('86e7f496587cc35d7feede99cbe3cf627ef690dd7489bb03b95f7d15ed758e32baf17d79f17b1de187184394233f60a8249a64dd53c3d59a9540db92269b7ee4')
prepare() {
# Change Directory
cd "$srcdir"/$_pkgname-$pkgver
# Wipe 32-Bit ARM Makefile Contents
truncate -s 0 Makefile.arm # See 'ALARM'.
# Manually Set CONFIG Target & Opts
if [ $CARCH = arm ]; then
_CONFIG='TARGET=ARMV5'
elif [ $CARCH = armv6h ]; then
_CONFIG='TARGET=ARMV6'
elif [ $CARCH = armv7h ]; then
_CONFIG='TARGET=ARMV7'
CFLAGS=`echo $CFLAGS | sed 's/vfpv3-d16/neon/'` # See 'ALARM'.
CXXFLAGS="$CFLAGS" # See 'ALARM'. Used?
elif [ $CARCH = aarch64 ]; then
_CONFIG='TARGET=ARMV8 DYNAMIC_ARCH=1'
else
echo 'CPU architecture not supported'
exit 1
fi
}
build() {
# Change Directory
cd "$srcdir"/$_pkgname-$pkgver
# Build Libs
make \
NO_STATIC=1 NO_LAPACK=1 NO_LAPACKE=1 NO_CBLAS=1 NO_AFFINITY=1 USE_OPENMP=1 \
CFLAGS="$CPPFLAGS $CFLAGS" $_CONFIG \
NUM_THREADS=64 MAJOR_VERSION=3 \
libs shared
}
package() {
# Change Directory
cd "$srcdir"/$_pkgname-$pkgver
# Install
make install \
PREFIX="$pkgdir"/usr
# Remove Crud
rm -f "$pkgdir"/usr/include/cblas.h "$pkgdir"/usr/include/lapack*
rmdir "$pkgdir"/usr/bin
# Install License
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
# Change Directory
cd "$pkgdir"/usr/lib
# Fix File Naming
find . -maxdepth 1 -type f -name 'libopenblas*.so*' -exec mv {} libopenblas.so.${pkgver} \;
find . -maxdepth 1 -type f -name 'libopenblas*.a' -exec mv {} libopenblas.${pkgver}.a \;
# Relink Symlinks
find . -maxdepth 1 -type l -name 'lib*.so*' -delete
ln -frs libopenblas.${pkgver}.a libopenblas.a
for LIB in libblas.so libblas.so.3 libopenblas.so libopenblas.so.3
do
ln -frs libopenblas.so.${pkgver} $LIB
done
# Mod Ancillary Files
ln -rs "$pkgdir"/usr/lib/pkgconfig/openblas.pc "$pkgdir"/usr/lib/pkgconfig/blas.pc
sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/pkgconfig/openblas.pc
sed -i "s|$pkgdir||" "$pkgdir"/usr/lib/cmake/openblas/OpenBLASConfig.cmake
}
# vim:set ts=2 sw=2 et:
')
Looking over the PKGBUILD, I also have a few queries:
- - Is 'CXXFLAGS' being referenced in any way on armv7h? I've left the code in there, just in case.
- - Should the 'provides' array not reference the latest version of blas (3.9.0)?