diff options
author | Daniel Bermond | 2022-03-01 11:10:02 -0300 |
---|---|---|
committer | Daniel Bermond | 2022-03-01 11:10:02 -0300 |
commit | bf43bc478c7389ad89e0a7c51ed1c9a0ba9ae51a (patch) | |
tree | f44f0bae199cd540775da64891904e2c3dcf03c5 | |
parent | a24ece35eae2340e5b825f8f412a2cf3285b595d (diff) | |
download | aur-bf43bc478c7389ad89e0a7c51ed1c9a0ba9ae51a.tar.gz |
Fix build with protobuf 3.19.4. Split package.
-rw-r--r-- | .SRCINFO | 40 | ||||
-rw-r--r-- | PKGBUILD | 102 | ||||
-rw-r--r-- | caffe-git-opencv4-fix.patch | 116 |
3 files changed, 88 insertions, 170 deletions
@@ -1,16 +1,39 @@ pkgbase = caffe-git pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (cpu only, git version) - pkgver = 1.0.r134.g04ab089db - pkgrel = 2 + pkgver = 1.0.r136.g9b8915401 + pkgrel = 1 url = https://caffe.berkeleyvision.org/ arch = x86_64 license = BSD + makedepends = openblas + makedepends = lapack + makedepends = boost-libs + makedepends = protobuf + makedepends = google-glog + makedepends = gflags + makedepends = hdf5 + makedepends = opencv + makedepends = leveldb + makedepends = lmdb + makedepends = python + makedepends = python-numpy + makedepends = python-pandas makedepends = git makedepends = boost makedepends = doxygen makedepends = texlive-core makedepends = texlive-latexextra makedepends = ghostscript + source = git+https://github.com/BVLC/caffe.git + source = Makefile.config + source = 010-caffe-opencv4-fix.patch::https://github.com/BVLC/caffe/commit/7f503bd9a19758a173064e299ab9d4cac65ed60f.patch + source = 020-caffe-protobuf3.19.4-fix.patch::https://github.com/BVLC/caffe/commit/1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch + sha256sums = SKIP + sha256sums = d2a96f1cc984a2258b9f44a9dec8ec994796bd80f5f29b8f7bbb9a9de9f2f19b + sha256sums = 2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9 + sha256sums = 65be5a646ab32e9b277b4352b702a57ac6c79af5258e12e33b9751f07d1031aa + +pkgname = caffe-git depends = openblas depends = lapack depends = boost-libs @@ -45,12 +68,9 @@ pkgbase = caffe-git conflicts = caffe conflicts = caffe-cpu-git replaces = caffe-cpu-git - source = git+https://github.com/BVLC/caffe.git - source = Makefile.config - source = caffe-git-opencv4-fix.patch - sha256sums = SKIP - sha256sums = d2a96f1cc984a2258b9f44a9dec8ec994796bd80f5f29b8f7bbb9a9de9f2f19b - sha256sums = 2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9 - -pkgname = caffe-git +pkgname = caffe-doc-git + pkgdesc = A deep learning framework made with expression, speed, and modularity in mind (cpu only, documentation, git version) + arch = any + provides = caffe-doc + conflicts = caffe-doc @@ -2,50 +2,38 @@ # Contributor: Drew Noel <drewmnoel@gmail.com> # Contributor: Jonathan Yantis -pkgname=caffe-git -pkgver=1.0.r134.g04ab089db -pkgrel=2 +pkgbase=caffe-git +pkgname=('caffe-git' 'caffe-doc-git') +pkgver=1.0.r136.g9b8915401 +pkgrel=1 pkgdesc='A deep learning framework made with expression, speed, and modularity in mind (cpu only, git version)' arch=('x86_64') url='https://caffe.berkeleyvision.org/' license=('BSD') -depends=('openblas' 'lapack' 'boost-libs' 'protobuf' 'google-glog' 'gflags' - 'hdf5' 'opencv' 'leveldb' 'lmdb' 'python' 'python-numpy' 'python-pandas') -optdepends=( - # official repositories: - 'cython' 'python-scipy' 'python-matplotlib' 'ipython' 'python-h5py' - 'python-networkx' 'python-nose' 'python-dateutil' 'python-protobuf' - 'python-gflags' 'python-yaml' 'python-pillow' 'python-six' - # AUR: - '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/04ab089db018a292ae48d51732dd6c66766b36b6/python/caffe/draw.py#L7-L22 -) -makedepends=('git' 'boost' 'doxygen' 'texlive-core' 'texlive-latexextra' 'ghostscript') -provides=('caffe' 'caffe-cpu-git') -conflicts=('caffe' 'caffe-cpu-git') -replaces=('caffe-cpu-git') +makedepends=('openblas' 'lapack' 'boost-libs' 'protobuf' 'google-glog' 'gflags' + 'hdf5' 'opencv' 'leveldb' 'lmdb' 'python' 'python-numpy' 'python-pandas' + 'git' 'boost' 'doxygen' 'texlive-core' 'texlive-latexextra' 'ghostscript') source=('git+https://github.com/BVLC/caffe.git' 'Makefile.config' - 'caffe-git-opencv4-fix.patch') + '010-caffe-opencv4-fix.patch'::'https://github.com/BVLC/caffe/commit/7f503bd9a19758a173064e299ab9d4cac65ed60f.patch' + '020-caffe-protobuf3.19.4-fix.patch'::'https://github.com/BVLC/caffe/commit/1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch') sha256sums=('SKIP' 'd2a96f1cc984a2258b9f44a9dec8ec994796bd80f5f29b8f7bbb9a9de9f2f19b' - '2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9') + '2072c8ca1393b53ef280a15c43af940cc9bf1419ae32b3d8a6541b10b8cb50e9' + '65be5a646ab32e9b277b4352b702a57ac6c79af5258e12e33b9751f07d1031aa') prepare() { cp -af Makefile.config caffe - # fix build with opencv 4 # https://github.com/BVLC/caffe/pull/6625 - patch -d caffe -Np1 -i "${srcdir}/caffe-git-opencv4-fix.patch" + patch -d caffe -Np1 -i "${srcdir}/010-caffe-opencv4-fix.patch" + + # https://github.com/BVLC/caffe/pull/7044 + patch -d caffe -Np1 -i "${srcdir}/020-caffe-protobuf3.19.4-fix.patch" } pkgver() { - cd caffe - - # git, tags available - git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' + git -C caffe describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' } build() { @@ -58,36 +46,62 @@ check() { make -C caffe runtest } -package() { - cd caffe/distribute - +package_caffe-git() { + depends=('openblas' 'lapack' 'boost-libs' 'protobuf' 'google-glog' 'gflags' + 'hdf5' 'opencv' 'leveldb' 'lmdb' 'python' 'python-numpy' 'python-pandas') + optdepends=( + # official repositories: + 'cython' 'python-scipy' 'python-matplotlib' 'ipython' 'python-h5py' + 'python-networkx' 'python-nose' 'python-dateutil' 'python-protobuf' + 'python-gflags' 'python-yaml' 'python-pillow' 'python-six' + # AUR: + '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/04ab089db018a292ae48d51732dd6c66766b36b6/python/caffe/draw.py#L7-L22 + ) + provides=('caffe' 'caffe-cpu-git') + conflicts=('caffe' 'caffe-cpu-git') + replaces=('caffe-cpu-git') + local _pyver _pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')" - mkdir -p "$pkgdir"/usr/{bin,include,lib/python"$_pyver"/site-packages,share/doc} + install -d -m755 "${pkgdir}/usr"/{bin,include,lib/python"$_pyver"/site-packages} # binaries - install -m755 bin/* "${pkgdir}/usr/bin" + install -m755 caffe/distribute/bin/* "${pkgdir}/usr/bin" # library - cp -a lib/libcaffe.so* "${pkgdir}/usr/lib" + local _sover + local _sover_full + _sover="$(find caffe/distribute/lib -type f -name "libcaffe.so.*.*.*" | sed 's|.*\.so\.||;s|\..*||')" + _sover_full="$(find caffe/distribute/lib -type f -name "libcaffe.so.*.*.*" | sed 's|.*\.so\.||')" + cp -dr --no-preserve='ownership' caffe/distribute/lib/libcaffe.so* "${pkgdir}/usr/lib" + ln -s "libcaffe.so.${_sover_full}" "${pkgdir}/usr/lib/libcaffe.so.${_sover}" chmod 755 "${pkgdir}/usr/lib"/libcaffe.so.*.*.* # headers - cp -a include "${pkgdir}/usr" + cp -dr --no-preserve='ownership' caffe/distribute/include "${pkgdir}/usr" # python - install -m755 python/*.py "${pkgdir}/usr/bin" - cp -a python/caffe "${pkgdir}/usr/lib/python${_pyver}/site-packages" + install -D -m755 caffe/distribute/python/*.py "${pkgdir}/usr/bin" + cp -dr --no-preserve='ownership' caffe/distribute/python/caffe "${pkgdir}/usr/lib/python${_pyver}/site-packages" # proto - install -D -m644 proto/caffe.proto -t "${pkgdir}/usr/share/caffe" - - cd "${srcdir}/caffe" - - # docs - cp -a doxygen/html "${pkgdir}/usr/share/doc/${pkgname}" + install -D -m644 caffe/distribute/proto/caffe.proto -t "${pkgdir}/usr/share/caffe" # license - install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" + install -D -m644 caffe/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" +} + +package_caffe-doc-git() { + pkgdesc="$(sed 's/\(git[[:space:]]version\)/documentation, \1/' <<< "$pkgdesc")" + arch=('any') + provides=('caffe-doc') + conflicts=('caffe-doc') + + install -d -m755 "${pkgdir}/usr/share/doc" + cp -dr --no-preserve='ownership' caffe/doxygen/html "${pkgdir}/usr/share/doc/caffe" + install -D -m644 caffe/LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" } diff --git a/caffe-git-opencv4-fix.patch b/caffe-git-opencv4-fix.patch deleted file mode 100644 index 1aef32f2eabc..000000000000 --- a/caffe-git-opencv4-fix.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 7f503bd9a19758a173064e299ab9d4cac65ed60f Mon Sep 17 00:00:00 2001 -From: Daniel Bermond <danielbermond@gmail.com> -Date: Mon, 26 Nov 2018 13:11:23 +0000 -Subject: [PATCH] Fix build with OpenCV 4.0 - ---- - Makefile | 16 ++++++++++++++-- - Makefile.config.example | 2 +- - src/caffe/layers/window_data_layer.cpp | 2 +- - src/caffe/test/test_io.cpp | 4 ++-- - src/caffe/util/io.cpp | 8 ++++---- - 5 files changed, 22 insertions(+), 10 deletions(-) - -diff --git a/Makefile b/Makefile -index b7660e852d6..95f3443adab 100644 ---- a/Makefile -+++ b/Makefile -@@ -200,9 +200,17 @@ endif - ifeq ($(USE_OPENCV), 1) - LIBRARIES += opencv_core opencv_highgui opencv_imgproc - -- ifeq ($(OPENCV_VERSION), 3) -+ ifeq ($(OPENCV_VERSION), $(filter $(OPENCV_VERSION), 3 4)) - LIBRARIES += opencv_imgcodecs - endif -+ ifeq ($(OPENCV_VERSION), 4) -+ ifeq ($(USE_PKG_CONFIG), 1) -+ INCLUDE_DIRS += $(shell pkg-config opencv4 --cflags-only-I | sed 's/-I//g') -+ else -+ INCLUDE_DIRS += /usr/include/opencv4 /usr/local/include/opencv4 -+ INCLUDE_DIRS += /usr/include/opencv4/opencv /usr/local/include/opencv4/opencv -+ endif -+ endif - - endif - PYTHON_LIBRARIES ?= boost_python python2.7 -@@ -429,7 +437,11 @@ LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) - - USE_PKG_CONFIG ?= 0 - ifeq ($(USE_PKG_CONFIG), 1) -- PKG_CONFIG := $(shell pkg-config opencv --libs) -+ ifeq ($(OPENCV_VERSION), 4) -+ PKG_CONFIG := $(shell pkg-config opencv4 --libs) -+ else -+ PKG_CONFIG := $(shell pkg-config opencv --libs) -+ endif - else - PKG_CONFIG := - endif -diff --git a/Makefile.config.example b/Makefile.config.example -index 24ca632783a..24802e91534 100644 ---- a/Makefile.config.example -+++ b/Makefile.config.example -@@ -19,7 +19,7 @@ - # possibility of simultaneous read and write - # ALLOW_LMDB_NOLOCK := 1 - --# Uncomment if you're using OpenCV 3 -+# Uncomment and set accordingly if you're using OpenCV 3/4 - # OPENCV_VERSION := 3 - - # To customize your choice of compiler, uncomment and set the following. -diff --git a/src/caffe/layers/window_data_layer.cpp b/src/caffe/layers/window_data_layer.cpp -index 1bf3760e9fd..f41169debe4 100644 ---- a/src/caffe/layers/window_data_layer.cpp -+++ b/src/caffe/layers/window_data_layer.cpp -@@ -290,7 +290,7 @@ void WindowDataLayer<Dtype>::load_batch(Batch<Dtype>* batch) { - image_database_cache_[window[WindowDataLayer<Dtype>::IMAGE_INDEX]]; - cv_img = DecodeDatumToCVMat(image_cached.second, true); - } else { -- cv_img = cv::imread(image.first, CV_LOAD_IMAGE_COLOR); -+ cv_img = cv::imread(image.first, cv::IMREAD_COLOR); - if (!cv_img.data) { - LOG(ERROR) << "Could not open or find file " << image.first; - return; -diff --git a/src/caffe/test/test_io.cpp b/src/caffe/test/test_io.cpp -index c2c919e90dc..b80df287fba 100644 ---- a/src/caffe/test/test_io.cpp -+++ b/src/caffe/test/test_io.cpp -@@ -20,8 +20,8 @@ class IOTest : public ::testing::Test {}; - bool ReadImageToDatumReference(const string& filename, const int label, - const int height, const int width, const bool is_color, Datum* datum) { - cv::Mat cv_img; -- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : -- CV_LOAD_IMAGE_GRAYSCALE); -+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : -+ cv::IMREAD_GRAYSCALE); - - cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag); - if (!cv_img_origin.data) { -diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp -index 5295d9dddb9..1f9167a114f 100644 ---- a/src/caffe/util/io.cpp -+++ b/src/caffe/util/io.cpp -@@ -73,8 +73,8 @@ void WriteProtoToBinaryFile(const Message& proto, const char* filename) { - cv::Mat ReadImageToCVMat(const string& filename, - const int height, const int width, const bool is_color) { - cv::Mat cv_img; -- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : -- CV_LOAD_IMAGE_GRAYSCALE); -+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : -+ cv::IMREAD_GRAYSCALE); - cv::Mat cv_img_origin = cv::imread(filename, cv_read_flag); - if (!cv_img_origin.data) { - LOG(ERROR) << "Could not open or find file " << filename; -@@ -179,8 +179,8 @@ cv::Mat DecodeDatumToCVMat(const Datum& datum, bool is_color) { - CHECK(datum.encoded()) << "Datum not encoded"; - const string& data = datum.data(); - std::vector<char> vec_data(data.c_str(), data.c_str() + data.size()); -- int cv_read_flag = (is_color ? CV_LOAD_IMAGE_COLOR : -- CV_LOAD_IMAGE_GRAYSCALE); -+ int cv_read_flag = (is_color ? cv::IMREAD_COLOR : -+ cv::IMREAD_GRAYSCALE); - cv_img = cv::imdecode(vec_data, cv_read_flag); - if (!cv_img.data) { - LOG(ERROR) << "Could not decode datum "; |