From 99aece277f24f48103dfed3b222f3cb17e8ecbe8 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 18 Jun 2019 17:12:47 -0700 Subject: [PATCH] Add XGBoost `v0.82` --- XGBoost/build_tarballs.jl | 70 ++++++++++++++++++++ XGBoost/bundled/patches/dmlc_windows_h.patch | 26 ++++++++ 2 files changed, 96 insertions(+) create mode 100644 XGBoost/build_tarballs.jl create mode 100644 XGBoost/bundled/patches/dmlc_windows_h.patch diff --git a/XGBoost/build_tarballs.jl b/XGBoost/build_tarballs.jl new file mode 100644 index 00000000000..23bdeab9bbb --- /dev/null +++ b/XGBoost/build_tarballs.jl @@ -0,0 +1,70 @@ +using BinaryBuilder, Pkg + +# Collection of sources required to build Nettle +name = "XGBoost" +version = v"0.82" +sources = [ + "https://github.com/dmlc/xgboost.git"=> + "3f83dcd50286d7c8d22e552942bd6572547c32b9", + "./bundled", +] + +# Bash recipe for building across all platforms +script = raw""" +cd ${WORKSPACE}/srcdir/xgboost + +git submodule init +git submodule update + +# Patch dmlc-core to use case-sensitive windows.h includes +(cd dmlc-core && atomic_patch -p1 "${WORKSPACE}/srcdir/patches/dmlc_windows_h.patch") + +# For Linux, build using CMake +if [[ ${target} == *linux* ]]; then + mkdir build + (cd build; cmake .. -DCMAKE_INSTALL_PREFIX=${prefix}) + make -C build -j ${nproc} +elif [[ ${target} == *mingw* ]]; then + # Windows has a special makefile because of course it does + #cp make/mingw64.mk config.mk + cp make/minimum.mk config.mk + make -j ${nproc} UNAME=Windows USE_OPENMP=1 +else + # Otherwise, build with `make`, and do a minimal build + cp make/minimum.mk config.mk + make -j ${nproc} +fi + +# Install +mkdir -p ${prefix}/{bin,include,lib} +cp -ra include/xgboost ${prefix}/include/ +cp -a xgboost ${prefix}/bin + +# Not every platform has a libxgboost.a +cp -a lib/libxgboost.a ${prefix}/lib || true +if [[ ${target} == *mingw* ]]; then + cp -a lib/xgboost.dll ${prefix}/bin +else + cp -a lib/libxgboost.${dlext} ${prefix}/lib +fi +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = supported_platforms() + +# Disable FreeBSD for now, because freebsd doesn't have backtrace() +platforms = [p for p in platforms if !(typeof(p) <: FreeBSD)] + +# The products that we will ensure are always built +products = [ + LibraryProduct(["libxgboost", "xgboost"], :libxgboost), +] + +# Dependencies that must be installed before this package can be built +dependencies = [ +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies) + diff --git a/XGBoost/bundled/patches/dmlc_windows_h.patch b/XGBoost/bundled/patches/dmlc_windows_h.patch new file mode 100644 index 00000000000..a83964c12c2 --- /dev/null +++ b/XGBoost/bundled/patches/dmlc_windows_h.patch @@ -0,0 +1,26 @@ +diff --git a/src/io/local_filesys.cc b/src/io/local_filesys.cc +index ec738e3..ce90f28 100644 +--- a/src/io/local_filesys.cc ++++ b/src/io/local_filesys.cc +@@ -13,7 +13,7 @@ extern "C" { + } + #define stat_struct stat + #else // _WIN32 +-#include ++#include + #define stat _stat64 + #define stat_struct __stat64 + #endif // _WIN32 +diff --git a/test/unittest/unittest_thread_group.cc b/test/unittest/unittest_thread_group.cc +index 3cb2194..1ef81f9 100644 +--- a/test/unittest/unittest_thread_group.cc ++++ b/test/unittest/unittest_thread_group.cc +@@ -7,7 +7,7 @@ + #if (defined _WIN32) + + #define NOMINMAX +-#include ++#include + static inline void dmlc_usleep(__int64 usec) { + HANDLE timer; + LARGE_INTEGER ft;