diff --git a/dev-libs/caffe/caffe-1.0.recipe b/dev-libs/caffe/caffe-1.0.recipe new file mode 100644 index 000000000..2232da9dc --- /dev/null +++ b/dev-libs/caffe/caffe-1.0.recipe @@ -0,0 +1,141 @@ +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="1" +SOURCE_URI="https://github.com/BVLC/caffe/archive/$portVersion.tar.gz" +CHECKSUM_SHA256="71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f" +PATCHES="caffe-$portVersion.patchset" + +ARCHITECTURES="!x86_gcc2 ?x86 x86_64" +SECONDARY_ARCHITECTURES="?x86" + +# On x86_gcc2 we don't want to install the commands in bin//, but in bin/. +commandSuffix=$secondaryArchSuffix +if [ "$targetArchitecture" = x86_gcc2 ]; then + commandSuffix= +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 = $portVersion + " +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:libprotobuf$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PROVIDES_devel=" + caffe${secondaryArchSuffix}_devel = $portVersion + devel:libcaffe$secondaryArchSuffix + devel:libproto$secondaryArchSuffix + " +REQUIRES_devel=" + caffe$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libboost_atomic$secondaryArchSuffix + devel:libboost_chrono$secondaryArchSuffix + devel:libboost_date_time$secondaryArchSuffix + devel:libboost_filesystem$secondaryArchSuffix + devel:libboost_system$secondaryArchSuffix + devel:libboost_thread$secondaryArchSuffix + devel:libgflags$secondaryArchSuffix + devel:libglog$secondaryArchSuffix + devel:libhdf5$secondaryArchSuffix + devel:liblmdb$secondaryArchSuffix + devel:libopenblas$secondaryArchSuffix + devel:libprotobuf$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:cmake + cmd:gcc$secondaryArchSuffix +# cmd:f2py2 +# cmd:f2py3 + cmd:ld$secondaryArchSuffix + cmd:make +# cmd:python2 +# 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 + + mkdir -p build && cd build + + cmake -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_BUILD_TYPE='Release' \ + -DUSE_LEVELDB:BOOL=OFF \ + -DUSE_OPENCV:BOOL=OFF \ + -DCPU_ONLY:BOOL=ON \ + -DBUILD_python:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ + .. + make $jobArgs +} + +INSTALL() +{ + cd build + make install + + mkdir -p $includeDir + mv $prefix/include/* $includeDir + rmdir $prefix/include/ + + mkdir -p $libDir/cmake + mv $prefix/share/* $libDir/cmake + rmdir $prefix/share/ + + # Python supporte disabled for now. + rm -rf $prefix/python + + prepareInstalledDevelLibs libcaffe libproto + + # devel package + packageEntries devel \ + $developDir \ + $libDir/cmake +} diff --git a/dev-libs/caffe/patches/caffe-1.0.patchset b/dev-libs/caffe/patches/caffe-1.0.patchset new file mode 100644 index 000000000..aa3825d46 --- /dev/null +++ b/dev-libs/caffe/patches/caffe-1.0.patchset @@ -0,0 +1,33 @@ +From f8f149fd4999b6c77901f2ff8a9cef36ef35148c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= +Date: Sun, 21 May 2017 11:13:02 +0200 +Subject: caffe: BLAS fix for Haiku + + +diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake +index 4a5bac4..81d5e83 100644 +--- a/cmake/Dependencies.cmake ++++ b/cmake/Dependencies.cmake +@@ -105,6 +105,7 @@ if(USE_OPENCV) + endif() + + # ---[ BLAS ++if(NOT HAIKU) + if(NOT APPLE) + set(BLAS "Atlas" CACHE STRING "Selected BLAS library") + set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL") +@@ -134,6 +135,11 @@ elseif(APPLE) + endif() + endif() + endif() ++elseif(HAIKU) ++ find_package(OpenBLAS REQUIRED) ++ list(APPEND Caffe_INCLUDE_DIRS PUBLIC ${OpenBLAS_INCLUDE_DIR}) ++ list(APPEND Caffe_LINKER_LIBS PUBLIC ${OpenBLAS_LIB}) ++endif() + + # ---[ Python + if(BUILD_python) +-- +2.12.2 +