diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 95 |
1 files changed, 72 insertions, 23 deletions
@@ -1,11 +1,16 @@ # Maintainer: Dmitry Popov <ixaphire@gmail.com> +_with_r=false +_with_cuda=false + _name=xgboost pkgbase=xgboost-git pkgname=('xgboost-git' - 'python-xgboost-git' - 'python2-xgboost-git') -pkgver=r3762.a2042b68 + 'python-xgboost-git') +if $_with_r; then + pkgname+=('r-xgboost-git') +fi +pkgver=r6119.b05abfc49 pkgrel=1 url='https://github.com/dmlc/xgboost' license=('APACHE') @@ -14,13 +19,19 @@ source=('git+https://github.com/dmlc/xgboost.git' 'git+https://github.com/dmlc/rabit' 'git+https://github.com/NVlabs/cub' 'python_no_libs.patch') -makedepends=('python2-setuptools' 'python-setuptools') +makedepends=('python-setuptools') +if $_with_r; then + makedepends+=('r' 'r-stringi' 'r-magrittr' 'r-data.table') +fi +if $_with_cuda; then + makedepends+=('cuda') +fi arch=('x86_64') sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' - 'e36d89ed5afab7af2ef4c36393bbce4fdbae0dcc739724fe9df8cfece71c59a2') + 'SKIP') pkgver() { cd "${_name}" @@ -33,21 +44,54 @@ prepare() { git config submodule.dmlc-core.url "${srcdir}/dmlc-core" git config submodule.rabit.url "${srcdir}/rabit" git config submodule.cub.url "${srcdir}/cub" - git submodule update + git -c protocol.file.allow=always submodule update patch -p1 < "${srcdir}/python_no_libs.patch" } build() { + local cmake_args=() + cd "${_name}" + mkdir build && cd build + + if $_with_r; then + cmake_args+=('-DR_LIB=ON') + fi + if $_with_cuda; then + cmake_args+=('-DUSE_CUDA=ON' '-DBUILD_WITH_CUDA_CUB=ON') + if [ -n "$_compute_ver" ]; then + cmake_args+=("-DGPU_COMPUTE_VER=$_compute_ver") + fi + fi + + if $_with_cuda; then + CC=/opt/cuda/bin/gcc CXX=/opt/cuda/bin/g++ cmake .. ${cmake_args[@]} + else + cmake .. ${cmake_args[@]} + fi + make + + if $_with_r; then + mv ../lib/{,lib}xgboost.so + # based on xgboost/cmake/Utils.cmake:setup_rpackage_install_target: + rm -r R-package + cp -r ../R-package . + rm -r R-package/{src,configure} + mkdir R-package/src + cp ../lib/libxgboost.so R-package/src/xgboost.so + echo "all:" > R-package/src/Makevars + + mkdir "${srcdir}/R-${_name}" + R CMD INSTALL --no-multiarch --build R-package -l "${srcdir}/R-${_name}" + fi } package_xgboost-git() { pkgdesc='An optimized distributed gradient boosting library designed to be highly efficient, flexible and portable' provides=('xgboost') conflicts=('xgboost') - optdepends=('python-xgboost-git: Python 3 Wrapper' - 'python2-xgboost-git: Python 2 Wrapper') + optdepends=('python-xgboost-git: Python 3 Wrapper') cd "${_name}" @@ -62,7 +106,6 @@ package_xgboost-git() { # Install shared libraries mkdir -p "${pkgdir}/usr/lib" - install -Dm644 lib/*.a "${pkgdir}/usr/lib" install -Dm644 lib/*.so "${pkgdir}/usr/lib" # Install includes @@ -76,20 +119,6 @@ package_xgboost-git() { cp -r demo "${pkgdir}"/opt/xgboost } -package_python2-xgboost-git() { - pkgdesc='XGBoost Python 2 wrapper' - depends=('xgboost' - 'python2' - 'python2-numpy' - 'python2-scipy') - conflicts=('python2-xgboost') - provides=('python2-xgboost') - - cd "${_name}/python-package" - - python2 setup.py install --root="${pkgdir}" --optimize=1 -} - package_python-xgboost-git() { pkgdesc='XGBoost Python 3 wrapper' depends=('xgboost' @@ -104,4 +133,24 @@ package_python-xgboost-git() { python setup.py install --root="${pkgdir}" --optimize=1 } +if $_with_r; then + +package_r-xgboost-git() { + pkgdesc='XGBoost R wrapper' + depends=('r' + 'r-stringi' + 'r-magrittr' + 'r-data.table') + conflicts=('r-xgboost') + provides=('r-xgboost') + + cd "${_name}/build" + + install -dm0755 "${pkgdir}/usr/lib/R/library" + + cp -a --no-preserve=ownership "${srcdir}/R-${_name}/${_name}" "${pkgdir}/usr/lib/R/library" +} + +fi + # vim:set ts=2 sw=2 et: |