Files
haikuports/dev-libs/caffe/caffe-1.0.recipe
2024-02-18 15:21:31 +01:00

151 lines
4.3 KiB
Bash

SUMMARY="A deep learning framework"
DESCRIPTION="Caffe is a deep learning framework made with expression, speed, \
and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The \
Berkeley Vision and Learning Center (BVLC) and community contributors."
HOMEPAGE="http://caffe.berkeleyvision.org/"
COPYRIGHT="2014 Randolph Voorhies, Shane Grant"
LICENSE="BSD (2-clause)"
REVISION="11"
SOURCE_URI="https://github.com/BVLC/caffe/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f"
PATCHES="caffe-$portVersion.patchset
1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch
7f503bd9a19758a173064e299ab9d4cac65ed60f.patch"
# Patches found at: https://aur.archlinux.org/packages/caffe
# https://github.com/BVLC/caffe/pull/6625
# https://github.com/BVLC/caffe/pull/7044
ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
caffe$secondaryArchSuffix = $portVersion
cmd:caffe$commandSuffix
cmd:classification$commandSuffix
cmd:compute_image_mean$commandSuffix
cmd:convert_cifar_data$commandSuffix
cmd:convert_imageset$commandSuffix
cmd:convert_mnist_data$commandSuffix
cmd:convert_mnist_siamese_data$commandSuffix
cmd:device_query$commandSuffix
cmd:extract_features$commandSuffix
cmd:finetune_net$commandSuffix
cmd:net_speed_benchmark$commandSuffix
cmd:test_net$commandSuffix
cmd:train_net$commandSuffix
cmd:upgrade_net_proto_binary$commandSuffix
cmd:upgrade_net_proto_text$commandSuffix
cmd:upgrade_solver_proto_text$commandSuffix
lib:libcaffe$secondaryArchSuffix = 1.0.0
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libboost_atomic$secondaryArchSuffix
lib:libboost_chrono$secondaryArchSuffix
lib:libboost_date_time$secondaryArchSuffix
lib:libboost_filesystem$secondaryArchSuffix
lib:libboost_system$secondaryArchSuffix
lib:libboost_thread$secondaryArchSuffix
lib:libgflags$secondaryArchSuffix
lib:libglog$secondaryArchSuffix
lib:libhdf5$secondaryArchSuffix
lib:liblmdb$secondaryArchSuffix
lib:libopenblas$secondaryArchSuffix
lib:libopencv_core$secondaryArchSuffix
lib:libopencv_highgui$secondaryArchSuffix
lib:libopencv_imgcodecs$secondaryArchSuffix
lib:libopencv_imgproc$secondaryArchSuffix
lib:libprotobuf$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
caffe${secondaryArchSuffix}_devel = $portVersion
devel:libcaffe$secondaryArchSuffix = 1.0.0
devel:libproto$secondaryArchSuffix
"
REQUIRES_devel="
caffe$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libboost_atomic$secondaryArchSuffix >= 1.69.0
devel:libboost_chrono$secondaryArchSuffix >= 1.69.0
devel:libboost_date_time$secondaryArchSuffix >= 1.69.0
devel:libboost_filesystem$secondaryArchSuffix >= 1.69.0
devel:libboost_system$secondaryArchSuffix >= 1.69.0
devel:libboost_thread$secondaryArchSuffix >= 1.69.0
devel:libgflags$secondaryArchSuffix
devel:libglog$secondaryArchSuffix
devel:libhdf5$secondaryArchSuffix
devel:liblmdb$secondaryArchSuffix
devel:libopenblas$secondaryArchSuffix
devel:libopencv_core$secondaryArchSuffix
devel:libopencv_highgui$secondaryArchSuffix
devel:libopencv_imgcodecs$secondaryArchSuffix
devel:libopencv_imgproc$secondaryArchSuffix
devel:libprotobuf$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
# cmd:f2py3
cmd:ld$secondaryArchSuffix
cmd:make
# cmd:python3
"
BUILD()
{
#Main settings
cat > Makefile.config << EOF
CPU_ONLY := 1
BLAS := open
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
USE_PKG_CONFIG := 1
EOF
cmake -B build -S . \
$cmakeDirArgs \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DCMAKE_BUILD_TYPE='Release' \
-DUSE_LEVELDB:BOOL=OFF \
-DUSE_OPENCV:BOOL=ON \
-DCPU_ONLY:BOOL=ON \
-DBUILD_python:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=ON
make -C build $jobArgs
}
INSTALL()
{
make -C build install
# Python support disabled for now.
rm -rf $prefix/python
prepareInstalledDevelLibs libcaffe libproto
# devel package
packageEntries devel \
$developDir \
$libDir/cmake
}
TEST()
{
make -C build test
make -C build runtest
}