First commit after package adoption. Major rewrite.

master
Daniel Bermond 7 years ago committed by Peter Babič
parent 3f736d0b94
commit 3fbd72e617
  1. 55
      .SRCINFO
  2. 160
      PKGBUILD

@ -1,27 +1,50 @@
# Generated by mksrcinfo v8
# Sun Mar 19 06:44:15 UTC 2017
pkgbase = caffe pkgbase = caffe
pkgdesc = Neural network toolkit pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (gpu enabled)
pkgver = rc2 pkgver = rc5
pkgrel = 3 pkgrel = 1
url = https://github.com/BVLC/caffe url = http://caffe.berkeleyvision.org/
arch = i686
arch = x86_64 arch = x86_64
groups = base-devel
license = BSD license = BSD
makedepends = git makedepends = doxygen
makedepends = cmake makedepends = texlive-core
depends = atlas-lapack-base depends = boost-libs
depends = hdf5
depends = opencv
depends = boost
depends = protobuf depends = protobuf
depends = google-glog depends = google-glog
depends = gflags depends = gflags
depends = hdf5
depends = opencv
depends = leveldb depends = leveldb
depends = snappy
depends = lmdb depends = lmdb
optdepends = cuda: for GPU support depends = cuda
source = https://github.com/BVLC/caffe/archive/rc2.tar.gz depends = python2
sha256sums = 55c9c20870b30ce398e19e4f1a62ade1eff08fce51e28fa5604035b711978eec depends = boost
depends = cython2
depends = python2-h5py
depends = ipython2
depends = python2-matplotlib
depends = python2-networkx
depends = python2-nose
depends = python2-numpy
depends = python2-pandas
depends = python2-protobuf
depends = python2-gflags
depends = python2-scikit-learn
depends = python2-scipy
depends = python2-pydot
depends = openblas-lapack
depends = python2-leveldb
depends = python2-scikit-image
provides = caffe-cpu
conflicts = caffe-git
conflicts = caffe-cpu
conflicts = caffe-cpu-git
conflicts = caffe-dr-git
conflicts = caffe-mnc-dr-git
noextract = caffe-rc5.tar.gz
source = caffe-rc5.tar.gz::https://github.com/BVLC/caffe/archive/rc.tar.gz
sha256sums = 7da46e2802c5d85e41aeda79bf27e907fc317fb1ecf96800403f4a57f1cd0dfb
pkgname = caffe pkgname = caffe

@ -1,39 +1,141 @@
# Maintainer: Micah Chambers <micahc.vt@gmail.com> # Maintainer : Daniel Bermond < yahoo-com: danielbermond >
# Contributor: Micah Chambers <micahc.vt@gmail.com>
pkgname=caffe pkgname=caffe
pkgver=rc3 pkgver=rc5
pkgrel=1 pkgrel=1
pkgdesc="Neural network toolkit" pkgdesc="A deep learning framework made with expression, speed, and modularity in mind (gpu enabled)"
arch=('i686' 'x86_64') arch=('x86_64')
url="https://github.com/BVLC/caffe" url="http://caffe.berkeleyvision.org/"
license=('BSD') license=('BSD')
groups=('base-devel') depends=( # binary repositories:
depends=('atlas-lapack-base' 'hdf5' 'opencv' 'boost' 'protobuf' 'google-glog' 'boost-libs' 'protobuf' 'google-glog' 'gflags' 'hdf5' 'opencv' 'leveldb'
'gflags' 'leveldb' 'snappy' 'lmdb' 'xz>=5') 'lmdb' 'cuda' 'python2' 'boost' 'cython2' 'python2-h5py' 'ipython2'
makedepends=('git' 'cmake') 'python2-matplotlib' 'python2-networkx' 'python2-nose' 'python2-numpy'
optdepends=('cuda: for GPU support') 'python2-pandas' 'python2-protobuf' 'python2-gflags' 'python2-scikit-learn'
source=("https://github.com/BVLC/$pkgname/archive/$pkgver.tar.gz") 'python2-scipy' 'python2-pydot'
sha256sums=('0884207bfba0fbc8b263b87d30f9304f7094eec3a48f975177d142f8c72b6e3b') # AUR:
'openblas-lapack' 'python2-leveldb' 'python2-scikit-image')
makedepends=('doxygen' 'texlive-core')
provides=('caffe-cpu')
conflicts=('caffe-git' 'caffe-cpu' 'caffe-cpu-git' 'caffe-dr-git' 'caffe-mnc-dr-git')
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/BVLC/${pkgname}/archive/rc.tar.gz")
noextract=("${pkgname}-${pkgver}.tar.gz")
sha256sums=('7da46e2802c5d85e41aeda79bf27e907fc317fb1ecf96800403f4a57f1cd0dfb')
build() { prepare() {
if [ $CARCH = "i686" ]; then # extract source file to a directory in the format $pkgname-$pkgver
lib="lib" mkdir -p "${pkgname}-${pkgver}"
else cd "${pkgname}-${pkgver}"
lib="lib64" tar xf ../"${pkgname}-${pkgver}.tar.gz" --strip 1
fi
# compile fix: add 'opencv_imgcodecs' library to Makefile
cd "$srcdir/$pkgname-$pkgver" sed -i '/opencv_imgproc/s/$/ opencv_imgcodecs/' Makefile
rm -fr build
mkdir build # prepare to configure options in Makefile.config
cd build cp -f Makefile.config.example Makefile.config
cmake ../ -DAtlas_LAPACK_LIBRARY=/usr/${lib}/libatlas.so \
-DAtlas_BLAS_LIBRARY=/usr/${lib}/libatlas.so \ # use gcc5 (gcc6 do not work)
-DCMAKE_INSTALL_PREFIX=$pkgdir/usr/ sed -i '/CUSTOM_CXX/s/^#[[:space:]]//;/CUSTOM_CXX/s/$/-5/' Makefile.config
# set CUDA directory
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
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_LIB[[:space:]]\:=.*/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
# if you want to try python3 _instead_ of python2 (currently not working):
# - uncomment this block
# - comment the python2 block
# - change python2 depends and optdepends to python3
# - NOTE: do not enable both python2 and python3 blocks. choose only one.
#_pyinc_line="$(sed -n '/PYTHON_INCLUDE[[:space:]]\:=[[:space:]]\/usr/=' Makefile.config)"
#sed -i "$((_pyinc_line))s/2\.7/3.6m/" Makefile.config
#sed -i "$((_pyinc_line+1))s/2\.7/3.6/;$((_pyinc_line+1))s/dist/site/" Makefile.config
}
make build() {
cd "${pkgname}-${pkgver}"
msg2 "Building target 'all'..."
make all
msg2 "Building target 'pycaffe'..."
make pycaffe
msg2 "Building target 'docs'..."
make docs
msg2 "Building target 'distribute'..."
make distribute
} }
package() { package() {
cd "$srcdir/$pkgname-$pkgver/build" # directories creation
make install mkdir -p "${pkgdir}/usr/bin"
mkdir -p "${pkgdir}/usr/include/caffe/"{proto,test,util}
mkdir -p "${pkgdir}/usr/lib/python2.7/site-packages/caffe/"{imagenet,proto}
mkdir -p "${pkgdir}/usr/share/"{doc/"${pkgname}"/search,licenses/"${pkgname}"}
cd "${pkgname}-${pkgver}/distribute"
# binaries
cd bin
install -D -m755 * "${pkgdir}/usr/bin"
# libraries
cd ../lib
install -D -m755 *.so "${pkgdir}/usr/lib"
# includes
cd ../include/caffe
install -D -m644 *.hpp "${pkgdir}/usr/include/caffe"
for _dir in proto test util
do
cd "${srcdir}/${pkgname}-${pkgver}/distribute/include/caffe/${_dir}"
install -D -m644 * "${pkgdir}/usr/include/caffe/${_dir}"
done
# python
cd ../../../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/python2.7/site-packages/caffe"
done
for _dir in imagenet proto
do
cd "${srcdir}/${pkgname}-${pkgver}/distribute/python/caffe/$_dir"
for _file in *
do
_mode="$(stat --format '%a' "$_file")"
install -D -m"$_mode" "$_file" "${pkgdir}/usr/lib/python2.7/site-packages/caffe/${_dir}"
done
done
# docs
cd ../../../../doxygen/html
for _file in *
do
[ -d "$_file" ] && continue # skip directories
install -D -m644 "$_file" "${pkgdir}/usr/share/doc/${pkgname}"
done
cd search
install -D -m644 * "${pkgdir}/usr/share/doc/${pkgname}/search"
# license
cd "${srcdir}/${pkgname}-${pkgver}"
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}"
} }

Loading…
Cancel
Save