summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerry Lin2018-11-13 17:12:32 +0800
committerJerry Lin2018-11-13 17:12:32 +0800
commitd7bc16383b4dc7de4d5071605284026c67a56831 (patch)
tree3537bd524e05cc67977ea41f3b5fba223a8aeabc
downloadaur-d7bc16383b4dc7de4d5071605284026c67a56831.tar.gz
Initial commit
-rw-r--r--.SRCINFO60
-rw-r--r--PKGBUILD202
-rw-r--r--makefile.patch13
3 files changed, 275 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..28f6b2928eef
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,60 @@
+pkgbase = caffe-ssd-cpu
+ pkgdesc = weiliu89's caffe for CPU only
+ pkgver = ssdv1.0.r0.g4817bf8b
+ pkgrel = 1
+ url = https://github.com/weiliu89/caffe/tree/ssd
+ arch = x86_64
+ license = BSD
+ makedepends = git
+ makedepends = gcc6
+ makedepends = doxygen
+ makedepends = texlive-core
+ depends = boost-libs
+ depends = protobuf
+ depends = google-glog
+ depends = gflags
+ depends = hdf5
+ depends = opencv
+ depends = leveldb
+ depends = lmdb
+ depends = python
+ depends = boost
+ depends = cython
+ depends = python-numpy
+ depends = python-scipy
+ depends = python-matplotlib
+ depends = ipython
+ depends = python-h5py
+ depends = python-networkx
+ depends = python-nose
+ depends = python-pandas
+ depends = python-dateutil
+ depends = python-protobuf
+ depends = python-gflags
+ depends = python-yaml
+ depends = python-pillow
+ depends = python-six
+ depends = openblas-lapack
+ depends = python-leveldb
+ depends = python-scikit-image
+ depends = python-pydotplus
+ provides = caffe
+ provides = caffe-ssd
+ conflicts = caffe
+ conflicts = caffe-cpu
+ conflicts = caffe-cpu-git
+ conflicts = caffe-dr-git
+ conflicts = caffe-mnc-dr-git
+ conflicts = caffe2
+ conflicts = caffe2-git
+ conflicts = caffe2-cpu
+ conflicts = caffe2-cpu-git
+ conflicts = caffe-git
+ conflicts = caffe-ssd
+ source = caffe-ssd-cpu::git+https://github.com/weiliu89/caffe.git#branch=ssd
+ source = makefile.patch
+ sha256sums = SKIP
+ sha256sums = b39cc3e741818d2879fe881143e890c0be023557dd4d9b7f23874cf60cfec7eb
+
+pkgname = caffe-ssd-cpu
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..30058d10d6fc
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,202 @@
+# Maintainer : jerry73204 < jerry73204 at gmail dot com >
+
+# NOTE:
+# In order to build with NCCL support, uncomment the NCCL
+# lines in 'depends' and 'preprare()'.
+
+pkgname=caffe-ssd-cpu
+_srcname=caffe
+pkgver=ssdv1.0.r0.g4817bf8b
+pkgrel=1
+pkgdesc="weiliu89's caffe for CPU only"
+arch=('x86_64')
+url='https://github.com/weiliu89/caffe/tree/ssd'
+license=('BSD')
+depends=(
+ # official repositories:
+ 'boost-libs' 'protobuf' 'google-glog' 'gflags' 'hdf5' 'opencv' 'leveldb'
+ 'lmdb' 'python' 'boost' 'cython' 'python-numpy' 'python-scipy'
+ 'python-matplotlib' 'ipython' 'python-h5py' 'python-networkx' 'python-nose'
+ 'python-pandas' 'python-dateutil' 'python-protobuf' 'python-gflags'
+ 'python-yaml' 'python-pillow' 'python-six'
+ # AUR:
+ # required:
+ 'openblas-lapack'
+ # not required:
+ # 'nccl'
+ #python:
+ 'python-leveldb' 'python-scikit-image' 'python-pydotplus'
+ # NOTE:
+ # python-pydotplus (or python-pydot) is required by python executable draw_net.py
+ # https://github.com/BVLC/caffe/blob/691febcb83d6a3147be8e9583c77aefaac9945f8/python/caffe/draw.py#L7-L22
+)
+makedepends=('git' 'gcc6' 'doxygen' 'texlive-core')
+provides=('caffe' 'caffe-ssd')
+conflicts=('caffe' 'caffe-cpu' 'caffe-cpu-git' 'caffe-dr-git' 'caffe-mnc-dr-git'
+ 'caffe2' 'caffe2-git' 'caffe2-cpu' 'caffe2-cpu-git' 'caffe-git' 'caffe-ssd')
+source=("${pkgname}"::"git+https://github.com/weiliu89/caffe.git#branch=ssd" 'makefile.patch')
+sha256sums=('SKIP'
+ 'b39cc3e741818d2879fe881143e890c0be023557dd4d9b7f23874cf60cfec7eb')
+
+prepare() {
+ cd "$pkgname"
+
+ # prepare to configure options in Makefile.config
+ cp -f Makefile.config.example Makefile.config
+
+ # enable cuDNN acceleration switch
+ # sed -i '/USE_CUDNN/s/^#[[:space:]]//g' Makefile.config
+
+ # use cpu only
+ sed -i '/CPU_ONLY/s/^#[[:space:]]//g' Makefile.config
+
+ # enable NCCL acceleration switch
+ # sed -i '/USE_NCCL/s/^#[[:space:]]//g' Makefile.config
+
+ # strictly enable I/O dependencies
+ sed -i '/USE_OPENCV/s/^#[[:space:]]//;/USE_OPENCV/s/0/1/' Makefile.config
+ sed -i '/USE_LEVELDB/s/^#[[:space:]]//;/USE_LEVELDB/s/0/1/' Makefile.config
+ sed -i '/USE_LMDB/s/^#[[:space:]]//;/USE_LMDB/s/0/1/' Makefile.config
+ sed -i '/OPENCV_VERSION/s/^#[[:space:]]//g' Makefile.config
+
+ # set CUDA directory
+ # sed -i '/CUDA_DIR/s/\/usr\/local\/cuda/\/opt\/cuda/' Makefile.config
+
+ # remove gpu architectures not supported by CUDA 9.0
+ sed -i 's/-gencode[[:space:]]arch=compute_20,code=sm_20//' Makefile.config
+ sed -i 's/-gencode[[:space:]]arch=compute_20,code=sm_21//' Makefile.config
+
+ # set OpenBLAS as the BLAS provider and adjust its directories
+ sed -i '/BLAS[[:space:]]\:=[[:space:]]atlas/s/atlas/open/' Makefile.config
+ sed -i 's/.*BLAS_INCLUDE[[:space:]]\:=[[:space:]]\/path.*/BLAS_INCLUDE := \/usr\/include/' Makefile.config
+ sed -i 's/.*BLAS_LIB[[:space:]]\:=[[:space:]]\/path.*/BLAS_LIB := \/usr\/lib/' Makefile.config
+
+ # python3 settings
+ _py2inc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr\/include\/python2\.7/=' Makefile.config)"
+ _py3inc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr\/include\/python3\.5m/=' Makefile.config)"
+ _py3libs_line="$(sed -n '/PYTHON_LIBRARIES/=' Makefile.config)"
+ sed -i "$((_py2inc_line))s/^/# /" Makefile.config # comment python2 lines
+ sed -i "$((_py2inc_line+1))s/^/#/" Makefile.config
+ sed -i "$((_py3inc_line))s/^#[[:space:]]//" Makefile.config # uncomment python3 PYTHON_INCLUDE lines
+ sed -i "$((_py3inc_line+1))s/^#//" Makefile.config
+ sed -i "$((_py3libs_line))s/^#[[:space:]]//" Makefile.config # uncomment PYTHON_LIBRARIES line
+ sed -i "$((_py3libs_line))s/5/7/" Makefile.config # change version in PYTHON_LIBRARIES
+ sed -i "$((_py3inc_line))s/5/7/" Makefile.config # change version in python3 PYTHON_INCLUDE
+ sed -i "$((_py3inc_line+1))s/5/7/;$((_py3inc_line+1))s/dist/site/" Makefile.config
+
+ # use python layers
+ sed -i '/WITH_PYTHON_LAYER/s/^#[[:space:]]//g' Makefile.config
+
+ # if you want to use python2 _instead_ of python3:
+ # - uncomment this block
+ # - comment the python3 block
+ # - change python3 dependencies to python2
+ # - change python2 directories in package() to python3
+ # - NOTE: do not enable both python2 and python3 blocks. choose only one.
+ # - NOTE: python2 is the Caffe default but this package uses python3 by default
+ # python2 settings
+ #_py2inc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr\/include\/python2\.7/=' Makefile.config)"
+ #sed -i "$((_py2inc_line+1))s/dist/site/" Makefile.config
+
+ # patch Makefile
+ patch -Np1 -i $srcdir/makefile.patch
+}
+
+pkgver() {
+ cd "$pkgname"
+
+ # git, tags available
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+build() {
+ cd "$pkgname"
+
+ msg2 "Building target 'all'..."
+ make all
+
+ msg2 "Building target 'pycaffe'..."
+ make pycaffe
+
+ msg2 "Building target 'docs'..."
+ rm -rf doxygen
+ make docs
+
+ msg2 "Building target 'distribute'..."
+ make distribute
+}
+
+# uncomment this block if you want to run the checks/tests
+#check() {
+# cd "$pkgname"
+# msg2 "Building target 'test'..."
+# make test
+# msg2 "Making target 'runtest'..."
+# make runtest
+#}
+
+package() {
+ # directories creation
+ mkdir -p "${pkgdir}/usr/bin"
+ mkdir -p "${pkgdir}/usr/include/caffe/"{layers,proto,test,util}
+ mkdir -p "${pkgdir}/usr/lib/python3.7/site-packages/caffe/"{imagenet,proto,test}
+ mkdir -p "${pkgdir}/usr/share/"{caffe,doc/"${_srcname}"/search,licenses/"${pkgname}"}
+
+ # binaries
+ cd "${pkgname}/distribute/bin"
+ install -D -m755 * "${pkgdir}/usr/bin"
+
+ # libraries
+ cd "${srcdir}/${pkgname}/distribute/lib"
+ install -D -m755 *.so "${pkgdir}/usr/lib"
+
+ # includes
+ cd "${srcdir}/${pkgname}/distribute/include/caffe"
+ install -D -m644 *.hpp "${pkgdir}/usr/include/caffe"
+ for _dir in layers proto test util
+ do
+ cd "${srcdir}/${pkgname}/distribute/include/caffe/${_dir}"
+ install -D -m644 * "${pkgdir}/usr/include/caffe/${_dir}"
+ done
+
+ # python
+ cd "${srcdir}/${pkgname}/distribute/python"
+ install -D -m755 *.py "${pkgdir}/usr/bin"
+ rm -rf python # remove duplicated 'python' folder
+
+ cd caffe
+ for _file in *
+ do
+ [ -d "$_file" ] && continue # skip directories
+ _mode="$(stat --format '%a' "$_file")"
+ install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python3.7/site-packages/caffe"
+ done
+
+ for _dir in imagenet proto test
+ do
+ cd "${srcdir}/${pkgname}/distribute/python/caffe/${_dir}"
+ for _file in *
+ do
+ _mode="$(stat --format '%a' "$_file")"
+ install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python3.7/site-packages/caffe/${_dir}"
+ done
+ done
+
+ # proto
+ cd "${srcdir}/${pkgname}/distribute/proto"
+ install -D -m644 * "${pkgdir}/usr/share/caffe"
+
+ # docs
+ cd "${srcdir}/${pkgname}/doxygen/html"
+ for _file in *
+ do
+ [ -d "$_file" ] && continue # skip directories
+ install -D -m644 "$_file" "${pkgdir}/usr/share/doc/${_srcname}"
+ done
+ cd search
+ install -D -m644 * "${pkgdir}/usr/share/doc/${_srcname}/search"
+
+ # license
+ cd "${srcdir}/${pkgname}"
+ install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}"
+}
diff --git a/makefile.patch b/makefile.patch
new file mode 100644
index 000000000000..8e76c067989a
--- /dev/null
+++ b/makefile.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 3fd68d1d..cd4afa61 100644
+--- a/Makefile
++++ b/Makefile
+@@ -404,7 +404,7 @@ LIBRARY_DIRS += $(LIB_BUILD_DIR)
+ CXXFLAGS += -MMD -MP
+
+ # Complete build flags.
+-COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-isystem $(includedir))
++COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir))
+ CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
+ NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
+ # mex may invoke an older gcc that is too liberal with -Wuninitalized