Updated to version 1.0

master
Daniel Bermond 7 years ago committed by Peter Babič
parent 5ab9fe547e
commit 471afb9b68
  1. 49
      .SRCINFO
  2. 145
      PKGBUILD

@ -1,12 +1,13 @@
# Generated by mksrcinfo v8 # Generated by mksrcinfo v8
# Sun Apr 30 12:43:49 UTC 2017 # Sun Apr 30 16:44:02 UTC 2017
pkgbase = caffe pkgbase = caffe
pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (gpu enabled) pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (gpu enabled)
pkgver = rc5 pkgver = 1.0
pkgrel = 3 pkgrel = 1
url = http://caffe.berkeleyvision.org/ url = http://caffe.berkeleyvision.org/
arch = x86_64 arch = x86_64
license = BSD license = BSD
makedepends = gcc5
makedepends = doxygen makedepends = doxygen
makedepends = texlive-core makedepends = texlive-core
depends = boost-libs depends = boost-libs
@ -18,24 +19,29 @@ pkgbase = caffe
depends = leveldb depends = leveldb
depends = lmdb depends = lmdb
depends = cuda depends = cuda
depends = python2 depends = python
depends = boost depends = boost
depends = cython2 depends = cython
depends = python2-h5py depends = python-numpy
depends = ipython2 depends = python-scipy
depends = python2-matplotlib depends = python-matplotlib
depends = python2-networkx depends = ipython
depends = python2-nose depends = python-h5py
depends = python2-numpy depends = python-networkx
depends = python2-pandas depends = python-nose
depends = python2-protobuf depends = python-pandas
depends = python2-gflags depends = python-dateutil
depends = python2-scikit-learn depends = python-protobuf
depends = python2-scipy depends = python-gflags
depends = python2-pydot depends = python-yaml
depends = python-pillow
depends = python-six
depends = openblas-lapack depends = openblas-lapack
depends = python2-leveldb depends = cudnn
depends = python2-scikit-image depends = nccl
depends = python-leveldb
depends = python-scikit-image
depends = python-pydotplus
conflicts = caffe-git conflicts = caffe-git
conflicts = caffe-cpu conflicts = caffe-cpu
conflicts = caffe-cpu-git conflicts = caffe-cpu-git
@ -45,9 +51,8 @@ pkgbase = caffe
conflicts = caffe2-git conflicts = caffe2-git
conflicts = caffe2-cpu conflicts = caffe2-cpu
conflicts = caffe2-cpu-git conflicts = caffe2-cpu-git
noextract = caffe-rc5.tar.gz source = caffe-1.0.tar.gz::https://github.com/BVLC/caffe/archive/1.0.tar.gz
source = caffe-rc5.tar.gz::https://github.com/BVLC/caffe/archive/rc.tar.gz sha256sums = 71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f
sha256sums = 7da46e2802c5d85e41aeda79bf27e907fc317fb1ecf96800403f4a57f1cd0dfb
pkgname = caffe pkgname = caffe

@ -2,66 +2,91 @@
# Contributor: Micah Chambers <micahc.vt@gmail.com> # Contributor: Micah Chambers <micahc.vt@gmail.com>
pkgname=caffe pkgname=caffe
pkgver=rc5 pkgver=1.0
pkgrel=3 pkgrel=1
pkgdesc="A deep learning framework made with expression, speed, and modularity in mind (gpu enabled)" pkgdesc="A deep learning framework made with expression, speed, and modularity in mind (gpu enabled)"
arch=('x86_64') arch=('x86_64')
url="http://caffe.berkeleyvision.org/" url="http://caffe.berkeleyvision.org/"
license=('BSD') license=('BSD')
depends=( # binary repositories: depends=(
'boost-libs' 'protobuf' 'google-glog' 'gflags' 'hdf5' 'opencv' 'leveldb' # binary repositories:
'lmdb' 'cuda' 'python2' 'boost' 'cython2' 'python2-h5py' 'ipython2' 'boost-libs' 'protobuf' 'google-glog' 'gflags' 'hdf5' 'opencv' 'leveldb'
'python2-matplotlib' 'python2-networkx' 'python2-nose' 'python2-numpy' 'lmdb' 'cuda' 'python' 'boost' 'cython' 'python-numpy' 'python-scipy'
'python2-pandas' 'python2-protobuf' 'python2-gflags' 'python2-scikit-learn' 'python-matplotlib' 'ipython' 'python-h5py' 'python-networkx' 'python-nose'
'python2-scipy' 'python2-pydot' 'python-pandas' 'python-dateutil' 'python-protobuf' 'python-gflags'
# AUR: 'python-yaml' 'python-pillow' 'python-six'
'openblas-lapack' 'python2-leveldb' 'python2-scikit-image') # AUR:
makedepends=('doxygen' 'texlive-core') # required:
'openblas-lapack'
# not required but enabled in build:
'cudnn' '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/eeebdab16155d34ff8f5f42137da7df4d1c7eab0/python/caffe/draw.py#L7-L22
)
makedepends=('gcc5' 'doxygen' 'texlive-core')
conflicts=('caffe-git' 'caffe-cpu' 'caffe-cpu-git' 'caffe-dr-git' 'caffe-mnc-dr-git' conflicts=('caffe-git' 'caffe-cpu' 'caffe-cpu-git' 'caffe-dr-git' 'caffe-mnc-dr-git'
'caffe2' 'caffe2-git' 'caffe2-cpu' 'caffe2-cpu-git') 'caffe2' 'caffe2-git' 'caffe2-cpu' 'caffe2-cpu-git')
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/BVLC/${pkgname}/archive/rc.tar.gz") source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/BVLC/${pkgname}/archive/${pkgver}.tar.gz")
noextract=("${pkgname}-${pkgver}.tar.gz") sha256sums=('71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f')
sha256sums=('7da46e2802c5d85e41aeda79bf27e907fc317fb1ecf96800403f4a57f1cd0dfb')
prepare() { prepare() {
# extract source file to a directory in the format $pkgname-$pkgver
mkdir -p "${pkgname}-${pkgver}"
cd "${pkgname}-${pkgver}" cd "${pkgname}-${pkgver}"
tar xf ../"${pkgname}-${pkgver}.tar.gz" --strip 1
# compile fix: add 'opencv_imgcodecs' library to Makefile
sed -i '/opencv_imgproc/s/$/ opencv_imgcodecs/' Makefile
# prepare to configure options in Makefile.config # prepare to configure options in Makefile.config
cp -f Makefile.config.example Makefile.config cp -f Makefile.config.example Makefile.config
# use gcc5 (gcc6 do not work) # enable cuDNN acceleration switch
sed -i '/USE_CUDNN/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
# use gcc5 (CUDA code requires gcc5)
sed -i '/CUSTOM_CXX/s/^#[[:space:]]//;/CUSTOM_CXX/s/$/-5/' Makefile.config sed -i '/CUSTOM_CXX/s/^#[[:space:]]//;/CUSTOM_CXX/s/$/-5/' Makefile.config
# set CUDA directory # set CUDA directory
sed -i '/CUDA_DIR/s/\/usr\/local\/cuda/\/opt\/cuda/' Makefile.config sed -i '/CUDA_DIR/s/\/usr\/local\/cuda/\/opt\/cuda/' Makefile.config
# use newer CUDA version
sed -i '/#-gencode arch=compute_50/s/#//g' Makefile.config
# set OpenBLAS as the BLAS provider and adjust its directories # set OpenBLAS as the BLAS provider and adjust its directories
sed -i '/BLAS[[:space:]]\:=[[:space:]]atlas/s/atlas/open/' Makefile.config sed -i '/BLAS[[:space:]]\:=[[:space:]]atlas/s/atlas/open/' Makefile.config
sed -i 's/.*BLAS_INCLUDE[[:space:]]\:=.*/BLAS_INCLUDE := \/usr\/include/' Makefile.config sed -i 's/.*BLAS_INCLUDE[[:space:]]\:=[[:space:]]\/path.*/BLAS_INCLUDE := \/usr\/include/' Makefile.config
sed -i 's/.*BLAS_LIB[[:space:]]\:=.*/BLAS_LIB := \/usr\/lib/' Makefile.config sed -i 's/.*BLAS_LIB[[:space:]]\:=[[:space:]]\/path.*/BLAS_LIB := \/usr\/lib/' Makefile.config
# python2 settings
_pyinc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr/=' Makefile.config)"
sed -i "$((_pyinc_line+1))s/dist/site/" Makefile.config
# python3 settings # python3 settings
# if you want to try python3 _instead_ of python2 (currently not working): _py2inc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr\/include\/python2\.7/=' Makefile.config)"
# - uncomment this block _py3inc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr\/include\/python3\.5m/=' Makefile.config)"
# - comment the python2 block _py3libs_line="$(sed -n '/PYTHON_LIBRARIES/=' Makefile.config)"
# - change python2 depends and optdepends to python3 sed -i "$((_py2inc_line))s/^/# /" Makefile.config # comment python2 lines
# - NOTE: do not enable both python2 and python3 blocks. choose only one. sed -i "$((_py2inc_line+1))s/^/#/" Makefile.config
#_pyinc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr/=' Makefile.config)" sed -i "$((_py3inc_line))s/^#[[:space:]]//" Makefile.config # uncomment python3 PYTHON_INCLUDE lines
#sed -i "$((_pyinc_line))s/2\.7/3.6m/" Makefile.config sed -i "$((_py3inc_line+1))s/^#//" Makefile.config
#sed -i "$((_pyinc_line+1))s/2\.7/3.6/;$((_pyinc_line+1))s/dist/site/" Makefile.config sed -i "$((_py3libs_line))s/^#[[:space:]]//" Makefile.config # uncomment PYTHON_LIBRARIES line
sed -i "$((_py3libs_line))s/5/6/" Makefile.config # change version in PYTHON_LIBRARIES
sed -i "$((_py3inc_line))s/5/6/" Makefile.config # change version in python3 PYTHON_INCLUDE
sed -i "$((_py3inc_line+1))s/5/6/;$((_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
} }
build() { build() {
@ -76,57 +101,67 @@ build() {
make distribute make distribute
} }
# uncomment this block if you want to run the checks/tests
#check() {
# cd "${pkgname}-${pkgver}"
# msg2 "Building target 'test'..."
# make test
# msg2 "Making target 'runtest'..."
# make runtest
#}
package() { package() {
# directories creation # directories creation
mkdir -p "${pkgdir}/usr/bin" mkdir -p "${pkgdir}/usr/bin"
mkdir -p "${pkgdir}/usr/include/caffe/"{proto,test,util} mkdir -p "${pkgdir}/usr/include/caffe/"{layers,proto,test,util}
mkdir -p "${pkgdir}/usr/lib/python2.7/site-packages/caffe/"{imagenet,proto} mkdir -p "${pkgdir}/usr/lib/python3.6/site-packages/caffe/"{imagenet,proto,test}
mkdir -p "${pkgdir}/usr/share/"{doc/"${pkgname}"/search,licenses/"${pkgname}"} mkdir -p "${pkgdir}/usr/share/"{caffe,doc/"${pkgname}"/search,licenses/"${pkgname}"}
cd "${pkgname}-${pkgver}/distribute"
# binaries # binaries
cd bin cd "${srcdir}/${pkgname}-${pkgver}/distribute/bin"
install -D -m755 * "${pkgdir}/usr/bin" install -D -m755 * "${pkgdir}/usr/bin"
# libraries # libraries
cd ../lib cd "${srcdir}/${pkgname}-${pkgver}/distribute/lib"
install -D -m755 *.so "${pkgdir}/usr/lib" install -D -m755 *.so "${pkgdir}/usr/lib"
# includes # includes
cd ../include/caffe cd "${srcdir}/${pkgname}-${pkgver}/distribute/include/caffe"
install -D -m644 *.hpp "${pkgdir}/usr/include/caffe" install -D -m644 *.hpp "${pkgdir}/usr/include/caffe"
for _dir in proto test util for _dir in layers proto test util
do do
cd "${srcdir}/${pkgname}-${pkgver}/distribute/include/caffe/${_dir}" cd "${srcdir}/${pkgname}-${pkgver}/distribute/include/caffe/${_dir}"
install -D -m644 * "${pkgdir}/usr/include/caffe/${_dir}" install -D -m644 * "${pkgdir}/usr/include/caffe/${_dir}"
done done
# python # python
cd ../../../python cd "${srcdir}/${pkgname}-${pkgver}/distribute/python"
install -D -m755 *.py "${pkgdir}/usr/bin" install -D -m755 *.py "${pkgdir}/usr/bin"
rm -rf python # remove duplicated 'python' folder
cd caffe cd caffe
for _file in * for _file in *
do do
[ -d "$_file" ] && continue # skip directories [ -d "$_file" ] && continue # skip directories
_mode="$(stat --format '%a' "$_file")" _mode="$(stat --format '%a' "$_file")"
install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python2.7/site-packages/caffe" install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python3.6/site-packages/caffe"
done done
for _dir in imagenet proto for _dir in imagenet proto test
do do
cd "${srcdir}/${pkgname}-${pkgver}/distribute/python/caffe/$_dir" cd "${srcdir}/${pkgname}-${pkgver}/distribute/python/caffe/${_dir}"
for _file in * for _file in *
do do
_mode="$(stat --format '%a' "$_file")" _mode="$(stat --format '%a' "$_file")"
install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python2.7/site-packages/caffe/${_dir}" install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python3.6/site-packages/caffe/${_dir}"
done done
done done
# proto
cd "${srcdir}/${pkgname}-${pkgver}/distribute/proto"
install -D -m644 * "${pkgdir}/usr/share/caffe"
# docs # docs
cd ../../../../doxygen/html cd "${srcdir}/${pkgname}-${pkgver}/doxygen/html"
for _file in * for _file in *
do do
[ -d "$_file" ] && continue # skip directories [ -d "$_file" ] && continue # skip directories

Loading…
Cancel
Save