[caffe-contrib] 02/02: rules: sync rules with cpu version
Zhou Mo
cdluminate-guest at moszumanska.debian.org
Mon Jul 4 13:55:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
cdluminate-guest pushed a commit to branch master
in repository caffe-contrib.
commit d59d7661d98a8edc439327344c49ccebc1c96f61
Author: Zhou Mo <cdluminate at gmail.com>
Date: Mon Jul 4 13:55:23 2016 +0000
rules: sync rules with cpu version
---
debian/rules | 121 ++++++++++++++++++++---------------------------------------
1 file changed, 41 insertions(+), 80 deletions(-)
diff --git a/debian/rules b/debian/rules
index e87fe80..ef6bbd5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,45 +2,32 @@
#export DH_VERBOSE = 1
# Hardening Caffe according to https://wiki.debian.org/Hardening
-export DPKG_EXPORT_BUILDFLAGS=1
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
-export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-include /usr/share/dpkg/buildflags.mk
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+export DEB_CXXFLAGS_MAINT_APPEND = -Wall -pedantic
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
RULES := debian/rules
ORIG_SOURCE := "https://github.com/BVLC/caffe/archive/rc3.tar.gz"
-CAFFE_SOVER := "1.0.0-rc3"
+CAFFE_SOVER := 1.0.0-rc3
+BUILDDIR := "caffe_cuda_build"
-CAFFE_CPU_BUILDDIR := "caffe_cpu_build"
-CAFFE_CUDA_BUILDDIR := "caffe_cuda_build"
-SUITE_CPU := caffe-cpu libcaffe-cpu1 libcaffe-cpu-dev python-caffe-cpu
-SUITE_CUDA := caffe-cuda libcaffe-cuda1 libcaffe-cuda-dev python-caffe-cuda
-SUITE_CPU_P := $(foreach PKG, $(SUITE_CPU), --package=$(PKG))
-SUITE_CUDA_P := $(foreach PKG, $(SUITE_CUDA), --package=$(PKG))
-
-# CUDA 7.5 is available for AMD64 and PPC64EL
-ifeq (installed, $(shell dpkg -s nvidia-cuda-toolkit | grep -o installed))
- flag_build_caffe_cuda := y
-endif
+TEMPLATES := $(wildcard debian/*.in)
+AUTOGEN := $(patsubst %.in,%,$(TEMPLATES))
## CMake Configuration Template.
-## Include template and override the blank options in later configs.
-### NOTE
-## * specifying compiler version to GCC-5 because of NVCC campatibility.
-## * we build docs indeed, but we don't build ALL docs, so BUILD_docs is disabled.
-## * python3 dependency not satisfied yet, can't build python3-caffe*.
-## * lock compiler on GCC-5 to prevent NVCC failure.
+## Should sync this with the caffe CPU_ONLY version.
CMAKE_CONFIGURE_TEMPLATE = \
-DALLOW_LMDB_NOLOCK=OFF \
- -DBLAS="Open" \
+ -DBLAS="Generic" \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_docs=OFF \
-DBUILD_matlab=OFF \
-DBUILD_python=ON \
-DBUILD_python_layer=ON \
- -Dpython_version="2" \
+ -Dpython_version="3" \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_C_FLAGS="$(CFLAGS) $(CPPFLAGS)" \
-DCMAKE_CXX_FLAGS="$(CXXFLAGS) $(CPPFLAGS)" \
@@ -50,90 +37,64 @@ CMAKE_CONFIGURE_TEMPLATE = \
-DUSE_LEVELDB=ON \
-DUSE_LMDB=ON \
-DUSE_OPENCV=ON \
- -DCMAKE_CXX_COMPILER=g++-5 \
- -DCMAKE_C_COMPILER=gcc-5 \
- -DCMAKE_INSTALL_PREFIX=$(FILL_THIS_BLANK) \
-DCPU_ONLY=$(FILL_THIS_BLANK) \
- -DCUDA_ARCH_NAME="All"
+ -DCMAKE_INSTALL_PREFIX="/usr"
+# TODO: use CUDA arches suggested by nvidia people
-CONFFLAG_CPU = \
- $(CMAKE_CONFIGURE_TEMPLATE) \
- -DCMAKE_INSTALL_PREFIX="/caffe_cpu" \
- -DCPU_ONLY=ON
CONFFLAG_CUDA = \
$(CMAKE_CONFIGURE_TEMPLATE) \
- -DCMAKE_INSTALL_PREFIX="/caffe_cuda" \
- -DCPU_ONLY=OFF
+ -DCPU_ONLY=OFF \
+ -DCUDA_ARCH_NAME="All" \
+ -DCMAKE_CXX_COMPILER=g++-5 \
+ -DCMAKE_C_COMPILER=gcc-5
+
+%:: %.in
+ perl -p \
+ -e 's{#CAFFE_CONFIGURE#}{caffe_cuda}g;' \
+ -e 's{#CAFFE_SOVER#}{$(CAFFE_SOVER)}g;' \
+ -e 's{#DEB_HOST_MULTIARCH#}{$(DEB_HOST_MULTIARCH)}g;' \
+ < $< > $@
%:
dh $@ \
--parallel \
--buildsystem=cmake \
- --with python2,bash-completion
+ --with python3,bash-completion
-autogen:
- python3 debian/template_autogen.py $(CAFFE_SOVER)
+.PHONY: autogen
+autogen: $(AUTOGEN)
override_dh_auto_configure: autogen
- dh_auto_configure \
- --builddirectory=$(CAFFE_CPU_BUILDDIR) -- $(CONFFLAG_CPU)
-ifeq (y, $(flag_build_caffe_cuda))
- dh_auto_configure \
- --builddirectory=$(CAFFE_CUDA_BUILDDIR) -- $(CONFFLAG_CUDA)
-endif
+ dh_auto_configure --builddirectory=$(BUILDDIR) \
+ -- $(CONFFLAG_CUDA)
override_dh_auto_clean:
- dh_auto_clean --builddirectory=$(CAFFE_CPU_BUILDDIR)
- dh_auto_clean --builddirectory=$(CAFFE_CUDA_BUILDDIR)
- #-$(RM) -rf $(CAFFE_CPU_BUILDDIR) $(CAFFE_CUDA_BUILDDIR)
- -$(RM) -rf python/caffe/proto/
+ dh_auto_clean --builddirectory=$(BUILDDIR)
+ -$(RM) -rf python/caffe/proto/ doxygen
-$(RM) python/caffe/_caffe.so
override_dh_auto_build:
- dh_auto_build --builddirectory=$(CAFFE_CPU_BUILDDIR) \
- -- all caffe pycaffe test.testbin
-ifeq (y, $(flag_build_caffe_cuda))
- dh_auto_build --builddirectory=$(CAFFE_CUDA_BUILDDIR) \
- -- all caffe pycaffe test.testbin
-endif
+ dh_auto_build --builddirectory=$(BUILDDIR) \
+ -- caffe pycaffe test.testbin all
# In the test phase, we need to set LD_LIBRARY_PATH properly
# for those test ELFs linked with libcaffe.so.X
override_dh_auto_test:
- dh_auto_test --builddirectory=$(CAFFE_CPU_BUILDDIR) \
- -- runtest LD_LIBRARY_PATH=$(CAFFE_CPU_BUILDDIR)/lib/
-ifeq (y, $(flag_build_caffe_cuda))
# the i386/amd64 build machine may have no CUDA-capable
# video card. Hence heading with a dash.
- -dh_auto_test --builddirectory=$(CAFFE_CUDA_BUILDDIR) \
- -- runtest LD_LIBRARY_PATH=$(CAFFE_CUDA_BUILDDIR)/lib/
-endif
-
-override_dh_python2:
- dh_python2 --requires=python/requirements.txt
- dh_numpy
+ -dh_auto_test --builddirectory=$(BUILDDIR) \
+ -- runtest LD_LIBRARY_PATH=$(BUILDDIR)/lib/
-override_dh_install:
- dh_install --list-missing
+override_dh_python3:
+ dh_python3 --requires=python/requirements.txt
+ dh_numpy3
override_dh_auto_install:
- dh_auto_install --builddirectory=$(CAFFE_CPU_BUILDDIR) -- install
-ifeq (y, $(flag_build_caffe_cuda))
- dh_auto_install --builddirectory=$(CAFFE_CUDA_BUILDDIR) -- install
-endif
+ dh_auto_install --builddirectory=$(BUILDDIR) -- install
override_dh_makeshlibs:
- dh_makeshlibs --package=python-caffe-cpu -X/usr/lib/python
-ifeq (y, $(flag_build_caffe_cuda))
- dh_makeshlibs --package=python-caffe-cuda -X/usr/lib/python
-endif
+ dh_makeshlibs --package=python3-caffe-cuda -X/usr/lib/python
dh_makeshlibs --remaining-packages
-override_dh_shlibdeps:
- dh_shlibdeps $(SUITE_CPU_P) -- -xlibcaffe-cuda1
-ifeq (y, $(flag_build_caffe_cuda))
- dh_shlibdeps $(SUITE_CUDA_P) -- -xlibcaffe-cpu1
-endif
-
get-orig-source:
wget -c $(ORIG_SOURCE) -O caffe_1.0.0~rc3.orig.tar.gz
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/caffe-contrib.git
More information about the debian-science-commits
mailing list