Skip to content

Possibility to use [gtest, eigen, blaze, etc] from system-wide if they are installed in compilation time and not duplicate after installation #68

@carlosal1015

Description

@carlosal1015

Hi, I would like to ask if is possible to change the following behavior. In Linux many dependencies are are available in the repositories, for instance,

I am trying to package, but I noticed that FetchContent download and later will install together fast_matrix_market.

pkgname=fast_matrix_market
pkgdesc="Fast and full-featured Matrix Market I/O library"
pkgver=1.7.6
pkgrel=1
arch=(x86_64)
url="https://github.com/alugowski/${pkgname}"
license=(BSD-2-Clause)
depends=(python)
makedepends=(python-build python-installer pybind11 python-scikit-build-core cmake)
checkdepends=(gtest suitesparse eigen blaze armadillo python-scipy python-threadpoolctl python-pytest)
optdepends=('eigen: '
  'blaze: '
  'armadillo: '
  'python-scipy: ') # 'fastmatmr'
source=(${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('e97da2daf76770502e862a13b7b61aaf8797d9bec9d33f182ff28c2a0b3f8e8b078b559643d980d6c7f3ff57da9cf52bde8807120b9373e61851fd57373d51aa')

build() {
  cmake \
    -S ${pkgname}-${pkgver} \
    -B build \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=TRUE \
    -DCMAKE_CXX_STANDARD=23 \
    -DFAST_MATRIX_MARKET_BENCH=ON \
    -DFAST_MATRIX_MARKET_TEST=ON \
    -DFMM_USE_DRAGONBOX=ON \
    -DFMM_USE_FAST_FLOAT=ON \
    -DFMM_USE_RYU=ON \
    -Wno-dev
  cmake --build build --target all

  cd ${pkgname}-${pkgver}/python
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  ctest --verbose --output-on-failure --test-dir build
  cd ${pkgname}-${pkgver}/python
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest
}

package() {
  DESTDIR="${pkgdir}" cmake --build build --target install
  install -Dm 644 ${pkgname}-${pkgver}/LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  cd ${pkgname}-${pkgver}/python
  PYTHONPYCACHEPREFIX="${PWD}/.cache/cpython/" python -m installer --destdir="${pkgdir}" dist/*.whl
  rm -r ${pkgdir}/usr/include/{blaze,eigen3,gtest,gmock}
  rm -r ${pkgdir}/usr/lib/cmake/GTest
  rm -r ${pkgdir}/usr/share/{blaze,eigen3}
  rm -r ${pkgdir}/usr/lib/lib{gmock*,gtest*}
  rm -r ${pkgdir}/usr/lib/pkgconfig{gmock*,gtest*}
}

The solution could be manually delete files in order to avoid duplication for gtest, blaze, eigen, and so on post cmake installation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions