r-cytolib: use metadata checks

This commit is contained in:
Pekka Ristola 2023-10-20 19:57:14 +03:00
parent ba82312638
commit 57c8f02a66
No known key found for this signature in database
GPG key ID: 2C20BE716E05213E
4 changed files with 143 additions and 28 deletions

View file

@ -1,37 +1,53 @@
# system requirements: GNU make, C++11
# Maintainer: Guoyi Zhang <guoyizhang at malacology dot net>
# Maintainer: Pekka Ristola <pekkarr [at] protonmail [dot] com>
# Contributor: Guoyi Zhang <guoyizhang at malacology dot net>
_pkgname=cytolib
_pkgver=2.12.1
pkgname=r-${_pkgname,,}
pkgver=2.12.1
pkgver=${_pkgver//-/.}
pkgrel=1
pkgdesc='C++ infrastructure for representing and interacting with the gated cytometry data'
arch=('x86_64')
pkgdesc="C++ infrastructure for representing and interacting with the gated cytometry data"
arch=(x86_64)
url="https://bioconductor.org/packages/${_pkgname}"
license=('custom')
license=(AGPL3)
depends=(
gcc
make
r
boost-libs
hdf5
lapack
protobuf
r-rprotobuflib
)
makedepends=(
boost
r-bh
r-rhdf5lib
r-rprotobuflib
)
optdepends=(
r-knitr
r-rmarkdown
)
source=("https://bioconductor.org/packages/release/bioc/src/contrib/${_pkgname}_${_pkgver}.tar.gz")
sha256sums=('1fcf5c4f45411321fd4fd8b8a0ace9955ab195c8f1a3fdcf037f8b345311db55')
source=("https://bioconductor.org/packages/release/bioc/src/contrib/${_pkgname}_${_pkgver}.tar.gz"
"shared-cytolib.patch")
md5sums=('0d7e3b666779431c8cd3dc79e507cef3'
'0447368b51efaea7ab68b056b4c2b602')
sha256sums=('1fcf5c4f45411321fd4fd8b8a0ace9955ab195c8f1a3fdcf037f8b345311db55'
'3fd80ac3109153df3619d0b481aa5797b9393300b6f82babb721dea8a2c55b45')
prepare() {
# build cytolib as a shared library
patch -Np1 -i shared-cytolib.patch
}
build() {
R CMD INSTALL ${_pkgname}_${_pkgver}.tar.gz -l "${srcdir}"
mkdir -p build
R CMD INSTALL "$_pkgname" -l build
}
package() {
install -dm0755 "${pkgdir}/usr/lib/R/library"
cp -a --no-preserve=ownership "${_pkgname}" "${pkgdir}/usr/lib/R/library"
install -Dm644 "${_pkgname}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
install -d "$pkgdir/usr/lib/R/library"
cp -a --no-preserve=ownership "build/$_pkgname" "$pkgdir/usr/lib/R/library"
# install shared library
install -Dm755 -t "$pkgdir/usr/lib" "$_pkgname/src/libcytolib.so.$_pkgver"
ln -s "libcytolib.so.$_pkgver" "$pkgdir/usr/lib/libcytolib.so"
}
# vim:set ts=2 sw=2 et:

View file

@ -1,12 +1,17 @@
#!/usr/bin/env python3
from lilaclib import *
import os
import sys
sys.path.append(os.path.normpath(f'{__file__}/../../../lilac-extensions'))
from lilac_r_utils import r_pre_build
def pre_build():
for line in edit_file('PKGBUILD'):
if line.startswith('_pkgver='):
line = f'_pkgver={_G.newver}'
print(line)
update_pkgver_and_pkgrel(_G.newver.replace(':', '.').replace('-', '.'))
r_pre_build(
_G,
expect_license = "AGPL-3.0-only",
expect_systemrequirements = "GNU make, C++11",
)
def post_build():
git_pkgbuild_commit()

View file

@ -1,13 +1,39 @@
build_prefix: extra-x86_64
maintainers:
- github: starsareintherose
email: kuoi@bioarchlinux.org
- github: pekkarr
email: pekkarr@protonmail.com
repo_depends:
- r-rprotobuflib
repo_makedepends:
- r-bh
- r-rhdf5lib
- r-rprotobuflib
update_on:
- regex: cytolib_([\d._-]+).tar.gz
source: regex
url: https://bioconductor.org/packages/cytolib
- source: rpkgs
pkgname: cytolib
repo: bioc
md5: true
- alias: r
- source: alpm
alpm: boost-libs
repo: extra
provided: libboost_filesystem.so
strip_release: true
- source: alpmfiles
pkgname: hdf5
filename: usr/lib/libhdf5\.so\.([^.]+)
repo: extra
- source: alpmfiles
pkgname: hdf5
filename: usr/lib/libhdf5_cpp\.so\.([^.]+)
repo: extra
- source: alpmfiles
pkgname: lapack
filename: usr/lib/liblapack\.so\.([^.]+)
repo: extra
- source: alpm
alpm: protobuf
repo: extra
provided: libprotobuf.so
strip_release: true
update_on_build:
- pkgbase: r-rprotobuflib

View file

@ -0,0 +1,68 @@
diff --git a/cytolib/R/build.R b/cytolib/R/build.R
index 779fb83..6e42d7a 100644
--- a/cytolib/R/build.R
+++ b/cytolib/R/build.R
@@ -20,10 +20,7 @@ CxxFlags <- function() {
#' @export
#' @importFrom RProtoBufLib LdFlags
cytolib_LdFlags <- function() {
- libDir <- "lib/"
- if (.Platform$OS.type == "windows")
- libDir <- paste(libDir, .Platform$r_arch, "/", sep="")
- cat(asBuildPath(system.file(paste(libDir, "libcytolib.a", sep = ""), package = "cytolib")))
+ cat("-lcytolib -lboost_filesystem -lboost_system")
}
diff --git a/cytolib/src/Makevars.in b/cytolib/src/Makevars.in
index 6d806e4..5888f8c 100644
--- a/cytolib/src/Makevars.in
+++ b/cytolib/src/Makevars.in
@@ -8,40 +8,25 @@ ifneq (,)
This makefile requires GNU Make.
endif
-
-CXX_STD = CXX11
-boost_sys_src=${wildcard boost/libs/system/src/*.cpp}
-boost_sys_objs=${boost_sys_src:.cpp=.o}
-boost_fs_src=${wildcard boost/libs/filesystem/src/*.cpp}
-boost_fs_objs=${boost_fs_src:.cpp=.o}
+CXX_STD = CXX17
PKG_CPPFLAGS =-DROUT -I../inst/include -DBOOST_NO_AUTO_PTR -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_FILESYSTEM_SINGLE_THREADED #the last to flagsare needed to compile bundled boost file system library 1.78
cytolib_src=${wildcard *.cpp}
cytolib_objs=${cytolib_src:.cpp=.o}
-BOOSTFSLIB = libboost_fs.a
-USERDIR = ${R_PACKAGE_DIR}/lib${R_ARCH}
-USERLIB = ${USERDIR}/libcytolib.a
+USERLIB = libcytolib.so.@CYTOLIB_VERSION@
OBJECTS=dummy.o
-#needs to wrap in $(shell) to strip the quotes returned by rhdf5lib::pkgconfig
-FSLIB = ${boost_fs_objs} ${boost_sys_objs}
+CLINK_CPPFLAGS := -I/usr/lib/R/library/RProtoBufLib/include
+RPROTOBUF_LIBS := $(shell Rscript -e "RProtoBufLib::LdFlags()")
+all: $(SHLIB) $(USERLIB)
-all: $(SHLIB)
-
-$(SHLIB): $(USERLIB)
-
-$(USERLIB): ${boost_fs_objs} ${cytolib_objs}
- mkdir -p "${USERDIR}"
- $(AR) rs "${USERLIB}" ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs}
-
-$(boost_fs_objs): ${boost_sys_objs}
-
+$(USERLIB): $(cytolib_objs)
+ $(CC) -shared $(LDFLAGS) -Wl,-soname=$(USERLIB) -o $@ $^ -lboost_filesystem -lboost_system -lhdf5_cpp -lhdf5 -llapack $(RPROTOBUF_LIBS) $(LIBR)
clean:
rm -f $(OBJECTS) ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs} $(SHLIB)
-