Package request: ceres
Ceres is a constraint solver, used by various projects in computer vision and elsewhere. I’ve tried to package the Ceres library for Alpine Linux, but I’ve not been able to use the resulting package in code that would use the installed cmake file. Perhaps somebody smarter than me can figure out how to package Ceres? Here’s how far I’ve come:
pkgname=ceres
pkgver="1.14.0"
pkgrel=0
pkgdesc="A nonlinear least squares minimizer"
url="http://ceres-solver.org/"
arch="all"
license="BSD-3-Clause"
# Eigen is a C++ library of include headers without any binary artifacts.
# Therefore, we only declare a build-time dependency on package "eigen-dev",
# but no run-time dependency on the (empty) package "eigen".
depends="gflags suitesparse"
makedepends="build-base cmake eigen-dev gflags-dev suitesparse-dev"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://ceres-solver.googlesource.com/ceres-solver/+archive/$pkgver.tar.gz"
build() {
# Setting Eigen3_DIR to work around mis-installed cmake files;
# the line needs to be removed once aport community/eigen is fixed.
# https://gitlab.alpinelinux.org/alpine/aports/issues/11233
Eigen3_DIR=/usr/share/cmake/Modules \
cmake "$srcdir" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DMINIGLOG=ON
cmake --build .
}
check() {
# Excluding evaluation_callback_test because of an apparent Ceres bug.
# https://github.com/ceres-solver/ceres-solver/issues/562
ctest --exclude-regex evaluation_callback_test
}
package() {
# The upstream Ceres project uses different install locations than what is
# customary on Alpine Linux, so we do our own install here.
# Install shared library.
install -m755 -d "$pkgdir"/usr/lib
install -m644 "$srcdir"/lib/libceres.so "$pkgdir"/usr/lib/libceres.so
# Install headers for development.
install -m755 -d "$pkgdir"/usr/include/ceres/internal/miniglog/glog
install -m644 "$srcdir"/internal/ceres/miniglog/glog/logging.h "$pkgdir"/usr/include/ceres/internal/miniglog/glog/logging.h
install -m644 "$srcdir"/config/ceres/internal/config.h "$pkgdir"/usr/include/ceres/internal/config.h
for _f in `ls "$srcdir"/include/ceres/*.h` ; do
install -m644 $_f "$pkgdir"/usr/include/ceres/`basename $_f`
done
for _f in `ls "$srcdir"/include/ceres/internal/*.h` ; do
install -m644 $_f "$pkgdir"/usr/include/ceres/internal/`basename $_f`
done
# Install CMake configuration file for development.
install -m755 -d "$pkgdir"/usr/lib/cmake/ceres
install -m644 "$srcdir"/CeresConfig-install.cmake "$pkgdir"/usr/lib/cmake/ceres/CeresConfig.cmake
}
sha512sums="e05c4ab6a17c8e187f7bcb44663f14e860347c6a720f597e8f03daa4a9e49296629aa591deeefd709c04c087989f663af901e758f15f35dff881c36443a500d6 ceres-1.14.0.tar.gz"