diff options
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | PKGBUILD | 199 | ||||
-rw-r--r-- | python_no_libs.patch | 42 |
3 files changed, 111 insertions, 155 deletions
@@ -1,17 +1,22 @@ +# Generated by makepkg 5.0.0 +# Sun Feb 14 17:04:13 UTC 2016 pkgbase = xgboost-git - pkgver = r1639.00a8076 - pkgrel = 2 - url = https://github.com/tqchen/xgboost + pkgver = r2367.70d9732 + pkgrel = 1 + url = https://github.com/dmlc/xgboost arch = x86_64 license = APACHE - makedepends = git - source = git+https://github.com/tqchen/xgboost.git + source = git+https://github.com/dmlc/xgboost.git + source = git+https://github.com/dmlc/dmlc-core + source = git+https://github.com/dmlc/rabit + source = python_no_libs.patch sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = bf7dddaaf6f6074a0d089c987876bd71961a637e40dae658fc04324153dfa568 pkgname = xgboost-git - pkgdesc = An optimized general purpose gradient boosting library. Which is parallelized using OpenMP. It implements machine learning algorithm under gradient boosting framework, including generalized linear model and gradient boosted regression tree - depends = python - depends = bash + pkgdesc = An optimized distributed gradient boosting library designed to be highly efficient, flexible and portable optdepends = python-xgboost-git: Python 3 Wrapper optdepends = python2-xgboost-git: Python 2 Wrapper provides = xgboost @@ -23,8 +28,6 @@ pkgname = python-xgboost-git depends = python depends = python-numpy depends = python-scipy - depends = python-setuptools - depends = bash provides = python-xgboost conflicts = python-xgboost @@ -34,8 +37,6 @@ pkgname = python2-xgboost-git depends = python2 depends = python2-numpy depends = python2-scipy - depends = python2-setuptools - depends = bash provides = python2-xgboost conflicts = python2-xgboost @@ -1,40 +1,51 @@ -# Maintainer: yantis@yantis.net - -# R package isn't compiling anymore so temp removed. -# Python packages are not working any more either and will need some work. +# Maintainer: Dmitry Popov <ixaphire@gmail.com> +_name=xgboost pkgbase=xgboost-git pkgname=('xgboost-git' 'python-xgboost-git' - 'python2-xgboost-git' - ) - # 'r-xgboost-git' -pkgver=r1826.19eef1d + 'python2-xgboost-git') +pkgver=r2367.70d9732 pkgrel=1 url='https://github.com/dmlc/xgboost' license=('APACHE') -source=('git+https://github.com/dmlc/xgboost.git') -sha256sums=('SKIP') -makedepends=('git') +source=('git+https://github.com/dmlc/xgboost.git' + 'git+https://github.com/dmlc/dmlc-core' + 'git+https://github.com/dmlc/rabit' + 'python_no_libs.patch') arch=('x86_64') +sha256sums=('SKIP' + 'SKIP' + 'SKIP' + 'bf7dddaaf6f6074a0d089c987876bd71961a637e40dae658fc04324153dfa568') + pkgver() { - cd xgboost - set -o pipefail - git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g' || + cd "${_name}" printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } +prepare() { + cd "${_name}" + git submodule init + git config submodule.dmlc-core.url "${srcdir}/dmlc-core" + git config submodule.rabit.url "${srcdir}/rabit" + git submodule update + patch -p1 < "${srcdir}/python_no_libs.patch" +} + +build() { + cd "${_name}" + make +} + package_xgboost-git() { - pkgdesc='An optimized general purpose gradient boosting library. Which is parallelized using OpenMP. It implements machine learning algorithm under gradient boosting framework, including generalized linear model and gradient boosted regression tree' + pkgdesc='An optimized distributed gradient boosting library designed to be highly efficient, flexible and portable' provides=('xgboost') conflicts=('xgboost') - depends=('python' 'bash') optdepends=('python-xgboost-git: Python 3 Wrapper' 'python2-xgboost-git: Python 2 Wrapper') - # 'r-xgboost-git: R Wrapper' - cd xgboost - make + cd "${_name}" # Install License install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" @@ -43,151 +54,53 @@ package_xgboost-git() { install -D -m644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md" # Install main executable - install -Dm755 "xgboost" "$pkgdir/usr/bin/xgboost" + install -Dm755 "xgboost" "${pkgdir}/usr/bin/xgboost" # Install shared libraries - mkdir -p $pkgdir/usr/lib/ - install -Dm644 wrapper/*.so "${pkgdir}/usr/lib/" - - mkdir -p $pkgdir/opt/xgboost + mkdir -p "${pkgdir}/usr/lib" + install -Dm644 lib/*.a "${pkgdir}/usr/lib" + install -Dm644 lib/*.so "${pkgdir}/usr/lib" - # Copy the python wrapper to opt/xgboost - cp -r wrapper $pkgdir/opt/xgboost + # Install includes + mkdir -p "${pkgdir}/usr/include" + cp -r include/xgboost "${pkgdir}/usr/include" + cp -r dmlc-core/include/dmlc "${pkgdir}/usr/include" + cp -r rabit/include/rabit "${pkgdir}/usr/include" + cp rabit/include/{rabit.h,rabit_serializable.h} "${pkgdir}/usr/include" # Copy the demos to opt/xgboost - cp -r demo $pkgdir/opt/xgboost + mkdir -p "${pkgdir}"/opt/xgboost + cp -r demo "${pkgdir}"/opt/xgboost } -# package_r-xgboost-git() { -# msg "You will need to have these R packages installed to use this" -# msg "Type this in R:" -# msg "install.packages(\"data.table\", repos=\"http://cran.rstudio.com/\")" -# msg "install.packages(\"magrittr\", repos=\"http://cran.rstudio.com/\")" -# msg "install.packages(\"DiagrammeR\", repos=\"http://cran.rstudio.com/\")" -# msg "install.packages(\"vcd\", repos=\"http://cran.rstudio.com/\")" - -# pkgdesc="XGBoost R wrapper" -# depends=('xgboost' 'r') -# conflicts=('r-xgboost') -# provides=('r-xgboost') -# makedepends=('xgboost') - -# cd xgboost - -# # Hotpatch Error: T used instead of TRUE -# for file in $(find . -name '*.R' -print); do -# sed -i 's/ = T)/ = TRUE)/' $file -# done - -# for file in $(find . -name '*.Rd' -print); do -# sed -i 's/ = T)/ = TRUE)/' $file -# done - -# make clean -# rm -rf xgboost xgboost*.tar.gz -# cp -r R-package xgboost -# rm -rf xgboost/inst/examples/*.buffer -# rm -rf xgboost/inst/examples/*.model -# rm -rf xgboost/inst/examples/dump* -# rm -rf xgboost/src/*.o xgboost/src/*.so xgboost/src/*.dll -# rm -rf xgboost/demo/*.model xgboost/demo/*.buffer xgboost/demo/*.txt -# rm -rf xgboost/demo/runall.R -# cp -r src xgboost/src/src -# mkdir xgboost/src/wrapper -# cp wrapper/xgboost_wrapper.h xgboost/src/wrapper -# cp wrapper/xgboost_wrapper.cpp xgboost/src/wrapper -# cp ./LICENSE xgboost -# cat R-package/src/Makevars|sed '2s/.*/PKGROOT=./' > xgboost/src/Makevars -# cat R-package/src/Makevars.win|sed '2s/.*/PKGROOT=./' > xgboost/src/Makevars.win -# R CMD build xgboost -# rm -rf xgboost -# R CMD INSTALL --as-cran xgboost*.tar.gz -# } - package_python2-xgboost-git() { - pkgdesc="XGBoost Python 2 wrapper" + pkgdesc='XGBoost Python 2 wrapper' depends=('xgboost' 'python2' 'python2-numpy' - 'python2-scipy' - 'python2-setuptools' - 'bash') + 'python2-scipy') + makedepends=('python2-setuptools') conflicts=('python2-xgboost') provides=('python2-xgboost') - makedepends=('xgboost') - - cd xgboost - - msg "Patching any #!/usr/bin/python to #!/usr/bin/python2" - for file in $(find . -name '*.py' -print); do - sed -r -i 's_^#!.*/usr/bin/python(\s|$)_#!/usr/bin/python2_' $file - sed -r -i 's_^#!.*/usr/bin/env(\s)*python(\s|$)_#!/usr/bin/env python2_' $file - done - - msg "Patching it so it can find the shared library" - for file in $(find . -name '*.py' -print); do - sed -i 's/os.path.dirname(__file__)/"\/usr\/lib" /' $file - done - - msg "Patching out the sys path usage since we don't use it anymore" - for file in $(find . -name '*.py' -print); do - sed -i 's/sys.path.append/# sys.path.append/' $file - done - - msg "Patching in our module" - for file in $(find . -name '*.py' -print); do - sed -i 's/import xgboost/from xgboost import xgboost/' $file - done - - msg "Since no setup.py lets set it up by hand" - pydir=`python2 -c "from distutils.sysconfig import get_python_lib; \ - print get_python_lib()"` - mkdir -p "${pkgdir}/${pydir}" - mkdir -p "${pkgdir}/${pydir}/xgboost" - touch "${pkgdir}/${pydir}/xgboost/__init__.py" - - cp wrapper/xgboost.py "${pkgdir}/${pydir}/xgboost" - cp -R demo "${pkgdir}/${pydir}/xgboost" + + cd "${_name}/python-package" + + python2 setup.py install --root="${pkgdir}" --optimize=1 } package_python-xgboost-git() { - pkgdesc="XGBoost Python 3 wrapper" + pkgdesc='XGBoost Python 3 wrapper' depends=('xgboost' 'python' 'python-numpy' - 'python-scipy' - 'python-setuptools' - 'bash') + 'python-scipy') + makedepends=('python-setuptools') conflicts=('python-xgboost') provides=('python-xgboost') - makedepends=('xgboost') - - cd xgboost - - msg "Patching it so it can find the shared library" - for file in $(find . -name '*.py' -print); do - sed -i 's/os.path.dirname(__file__)/"\/usr\/lib" /' $file - done - - msg "Patching out the sys path usage since we don't use it anymore" - for file in $(find . -name '*.py' -print); do - sed -i 's/sys.path.append/# sys.path.append/' $file - done - - msg "Patching in our module" - for file in $(find . -name '*.py' -print); do - sed -i 's/import xgboost/from xgboost import xgboost/' $file - done - - msg "Since no setup.py lets set it up by hand" - pydir=`python -c "from distutils.sysconfig import get_python_lib; \ - print(get_python_lib())"` - mkdir -p "${pkgdir}/${pydir}" - mkdir -p "${pkgdir}/${pydir}/xgboost" - touch "${pkgdir}/${pydir}/xgboost/__init__.py" - - cp wrapper/xgboost.py "${pkgdir}/${pydir}/xgboost" - cp -R demo "${pkgdir}/${pydir}/xgboost" + + cd "${_name}/python-package" + + python setup.py install --root="${pkgdir}" --optimize=1 } # vim:set ts=2 sw=2 et: diff --git a/python_no_libs.patch b/python_no_libs.patch new file mode 100644 index 000000000000..fbd584c8544e --- /dev/null +++ b/python_no_libs.patch @@ -0,0 +1,42 @@ +diff -ur a/python-package/setup.py b/python-package/setup.py +--- a/python-package/setup.py 2016-02-14 19:00:06.781604229 +0300 ++++ b/python-package/setup.py 2016-02-14 19:17:42.078239558 +0300 +@@ -5,19 +5,9 @@ + import os + from setuptools import setup, find_packages + #import subprocess +-sys.path.insert(0, '.') + + CURRENT_DIR = os.path.dirname(__file__) + +-# We can not import `xgboost.libpath` in setup.py directly since xgboost/__init__.py +-# import `xgboost.core` and finally will import `numpy` and `scipy` which are setup +-# `install_requires`. That's why we're using `exec` here. +-libpath_py = os.path.join(CURRENT_DIR, 'xgboost/libpath.py') +-libpath = {'__file__': libpath_py} +-exec(compile(open(libpath_py, "rb").read(), libpath_py, 'exec'), libpath, libpath) +- +-LIB_PATH = libpath['find_lib_path']() +-print("Install libxgboost from: %s" % LIB_PATH) + #Please use setup_pip.py for generating and deploying pip installation + #detailed instruction in setup_pip.py + setup(name='xgboost', +@@ -35,5 +25,4 @@ + #this will use MANIFEST.in during install where we specify additional files, + #this is the golden line + include_package_data=True, +- data_files=[('xgboost', LIB_PATH)], + url='https://github.com/dmlc/xgboost') +diff -ur a/python-package/xgboost/libpath.py b/python-package/xgboost/libpath.py +--- a/python-package/xgboost/libpath.py 2016-02-14 15:42:15.705290125 +0300 ++++ b/python-package/xgboost/libpath.py 2016-02-14 19:18:32.578238059 +0300 +@@ -20,7 +20,8 @@ + """ + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + # make pythonpack hack: copy this directory one level upper for setup.py +- dll_path = [curr_path, os.path.join(curr_path, '../../lib/'), ++ dll_path = ["/usr/lib", curr_path, ++ os.path.join(curr_path, '../../lib/'), + os.path.join(curr_path, './lib/')] + if os.name == 'nt': + if platform.architecture()[0] == '64bit': |