Date: Tuesday, May 7, 2019 @ 20:35:48 Author: kgizdov Revision: 462496
use system protobuf Added: python-pytorch/trunk/change_default_config.patch Modified: python-pytorch/trunk/PKGBUILD -----------------------------+ PKGBUILD | 18 +++++++++--------- change_default_config.patch | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2019-05-07 20:33:29 UTC (rev 462495) +++ PKGBUILD 2019-05-07 20:35:48 UTC (rev 462496) @@ -10,10 +10,12 @@ arch=('x86_64') url="https://pytorch.org" license=('BSD') -depends=('opencv' 'openmp' 'nccl' 'pybind11' 'python' 'python-yaml' 'python-numpy') +depends=('google-glog' 'gflags' 'opencv' 'openmp' 'nccl' 'pybind11' 'python' 'python-yaml' 'python-numpy' 'protobuf') makedepends=('python' 'python-setuptools' 'python-yaml' 'python-numpy' 'cmake' 'cuda' 'cudnn' 'git') -source=("${_pkgname}-${pkgver}::git+https://github.com/pytorch/pytorch.git#tag=v$pkgver") -sha256sums=('SKIP') +source=("${_pkgname}-${pkgver}::git+https://github.com/pytorch/pytorch.git#tag=v$pkgver" + 'change_default_config.patch') +sha256sums=('SKIP' + '36fa08167c5a54c2ae7e5b67b750d35f7a1b3812fa90153d66f6aa2fce71f2b4') get_pyver () { python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))' @@ -22,6 +24,9 @@ prepare() { cd "${_pkgname}-${pkgver}" + # Change default config manually, as setup.py filters some flags + patch -Np1 -i "${srcdir}/change_default_config.patch" + # This is the lazy way since pytorch has sooo many submodules and they keep # changing them around but we've run into more problems so far doing it the # manual than the lazy way. This lazy way (not explicitly specifying all @@ -39,6 +44,7 @@ export CXX=g++ export PYTORCH_BUILD_VERSION="${pkgver}" export PYTORCH_BUILD_NUMBER=1 + export USE_MKLDNN=0 echo "Building without cuda" export NO_CUDA=1 @@ -77,7 +83,6 @@ # put C++ API in correct place install -d "${pkgdir}/usr/include" install -d "${pkgdir}/usr/lib/pytorch" - mv "${pkgdir}/${pytorchpath}/bin"/* "${pkgdir}/usr/bin/" mv "${pkgdir}/${pytorchpath}/include"/* "${pkgdir}/usr/include/" mv "${pkgdir}/${pytorchpath}/lib"/*.so* "${pkgdir}/usr/lib/pytorch/" # clean up duplicates @@ -86,10 +91,8 @@ # NVRTC, ONNX, protobuf, libthreadpool, QNNPACK rm -rf "${pkgdir}/${pytorchpath}/share/cmake" rm -rf "${pkgdir}/${pytorchpath}/include" - rm -rf "${pkgdir}/${pytorchpath}/bin" rm -rf "${pkgdir}/usr/include/pybind11" # python module is hardcoded to look there at runtime - ln -s /usr/bin "${pkgdir}/${pytorchpath}/bin" ln -s /usr/include "${pkgdir}/${pytorchpath}/include" find "${pkgdir}"/usr/lib/pytorch -type f -name "*.so*" -print0 | while read -rd $'\0' _lib; do ln -s ${_lib#"$pkgdir"} "${pkgdir}/${pytorchpath}/lib/" @@ -116,7 +119,6 @@ # put C++ API in correct place install -d "${pkgdir}/usr/include" install -d "${pkgdir}/usr/lib/pytorch" - mv "${pkgdir}/${pytorchpath}/bin"/* "${pkgdir}/usr/bin/" mv "${pkgdir}/${pytorchpath}/include"/* "${pkgdir}/usr/include/" mv "${pkgdir}/${pytorchpath}/lib"/*.so* "${pkgdir}/usr/lib/pytorch/" # clean up duplicates @@ -125,10 +127,8 @@ # NVRTC, ONNX, protobuf, libthreadpool, QNNPACK rm -rf "${pkgdir}/${pytorchpath}/share/cmake" rm -rf "${pkgdir}/${pytorchpath}/include" - rm -rf "${pkgdir}/${pytorchpath}/bin" rm -rf "${pkgdir}/usr/include/pybind11" # python module is hardcoded to look there at runtime - ln -s /usr/bin "${pkgdir}/${pytorchpath}/bin" ln -s /usr/include "${pkgdir}/${pytorchpath}/include" find "${pkgdir}"/usr/lib/pytorch -type f -name "*.so*" -print0 | while read -rd $'\0' _lib; do ln -s ${_lib#"$pkgdir"} "${pkgdir}/${pytorchpath}/lib/" Added: change_default_config.patch =================================================================== --- change_default_config.patch (rev 0) +++ change_default_config.patch 2019-05-07 20:35:48 UTC (rev 462496) @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 71f8b693a..07e564919 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,10 +67,10 @@ option(BUILD_ATEN_MOBILE "Build ATen for Android and iOS" OFF) + option(BUILD_ATEN_ONLY "Build only a subset focused on ATen only" OFF) + option(BUILD_BINARY "Build C++ binaries" OFF) + option(BUILD_DOCS "Build Caffe2 documentation" OFF) +-option(BUILD_CUSTOM_PROTOBUF "Build and use Caffe2's own protobuf under third_party" ON) ++option(BUILD_CUSTOM_PROTOBUF "Build and use Caffe2's own protobuf under third_party" OFF) + option(BUILD_PYTHON "Build Python binaries" ON) + option(BUILD_CAFFE2_OPS "Build Caffe2 operators" ON) +-option(BUILD_SHARED_LIBS "Build libcaffe2.so" ON) ++option(BUILD_SHARED_LIBS "Build libcaffe2.so" OFF) + cmake_dependent_option( + CAFFE2_LINK_LOCAL_PROTOBUF "If set, build protobuf inside libcaffe2.so." ON + "BUILD_SHARED_LIBS AND BUILD_CUSTOM_PROTOBUF" OFF) +@@ -90,8 +90,8 @@ cmake_dependent_option( + "USE_CUDA" OFF) + option(USE_FBGEMM "Use FBGEMM (quantized 8-bit server operators)" OFF) + option(USE_FFMPEG "Use ffmpeg" OFF) +-option(USE_GFLAGS "Use GFLAGS" OFF) +-option(USE_GLOG "Use GLOG" OFF) ++option(USE_GFLAGS "Use GFLAGS" ON) ++option(USE_GLOG "Use GLOG" ON) + option(USE_LEVELDB "Use LEVELDB" OFF) + option(USE_LITE_PROTO "Use lite protobuf instead of full." OFF) + option(USE_LMDB "Use LMDB" OFF)