1SUMMARY="A deep learning framework"
2DESCRIPTION="Caffe is a deep learning framework made with expression, speed, \
3and modularity in mind. It is developed by Berkeley AI Research (BAIR)/The \
4Berkeley Vision and Learning Center (BVLC) and community contributors."
5HOMEPAGE="http://caffe.berkeleyvision.org/"
6COPYRIGHT="2014 Randolph Voorhies, Shane Grant"
7LICENSE="BSD (2-clause)"
8REVISION="11"
9SOURCE_URI="https://github.com/BVLC/caffe/archive/$portVersion.tar.gz"
10CHECKSUM_SHA256="71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f"
11PATCHES="caffe-$portVersion.patchset
12	1b317bab3f6413a1b5d87c9d3a300d785a4173f9.patch
13	7f503bd9a19758a173064e299ab9d4cac65ed60f.patch"
14	# Patches found at: https://aur.archlinux.org/packages/caffe
15	# https://github.com/BVLC/caffe/pull/6625
16	# https://github.com/BVLC/caffe/pull/7044
17
18ARCHITECTURES="all !x86_gcc2 ?x86"
19SECONDARY_ARCHITECTURES="x86"
20
21# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
22commandBinDir=$binDir
23commandSuffix=$secondaryArchSuffix
24if [ "$targetArchitecture" = x86_gcc2 ]; then
25	commandSuffix=
26	commandBinDir=$prefix/bin
27fi
28
29PROVIDES="
30	caffe$secondaryArchSuffix = $portVersion
31	cmd:caffe$commandSuffix
32	cmd:classification$commandSuffix
33	cmd:compute_image_mean$commandSuffix
34	cmd:convert_cifar_data$commandSuffix
35	cmd:convert_imageset$commandSuffix
36	cmd:convert_mnist_data$commandSuffix
37	cmd:convert_mnist_siamese_data$commandSuffix
38	cmd:device_query$commandSuffix
39	cmd:extract_features$commandSuffix
40	cmd:finetune_net$commandSuffix
41	cmd:net_speed_benchmark$commandSuffix
42	cmd:test_net$commandSuffix
43	cmd:train_net$commandSuffix
44	cmd:upgrade_net_proto_binary$commandSuffix
45	cmd:upgrade_net_proto_text$commandSuffix
46	cmd:upgrade_solver_proto_text$commandSuffix
47	lib:libcaffe$secondaryArchSuffix = 1.0.0
48	"
49REQUIRES="
50	haiku$secondaryArchSuffix
51	lib:libboost_atomic$secondaryArchSuffix
52	lib:libboost_chrono$secondaryArchSuffix
53	lib:libboost_date_time$secondaryArchSuffix
54	lib:libboost_filesystem$secondaryArchSuffix
55	lib:libboost_system$secondaryArchSuffix
56	lib:libboost_thread$secondaryArchSuffix
57	lib:libgflags$secondaryArchSuffix
58	lib:libglog$secondaryArchSuffix
59	lib:libhdf5$secondaryArchSuffix
60	lib:liblmdb$secondaryArchSuffix
61	lib:libopenblas$secondaryArchSuffix
62	lib:libopencv_core$secondaryArchSuffix
63	lib:libopencv_highgui$secondaryArchSuffix
64	lib:libopencv_imgcodecs$secondaryArchSuffix
65	lib:libopencv_imgproc$secondaryArchSuffix
66	lib:libprotobuf$secondaryArchSuffix
67	lib:libz$secondaryArchSuffix
68	"
69
70PROVIDES_devel="
71	caffe${secondaryArchSuffix}_devel = $portVersion
72	devel:libcaffe$secondaryArchSuffix = 1.0.0
73	devel:libproto$secondaryArchSuffix
74	"
75REQUIRES_devel="
76	caffe$secondaryArchSuffix == $portVersion base
77	"
78
79BUILD_REQUIRES="
80	haiku${secondaryArchSuffix}_devel
81	devel:libboost_atomic$secondaryArchSuffix >= 1.69.0
82	devel:libboost_chrono$secondaryArchSuffix >= 1.69.0
83	devel:libboost_date_time$secondaryArchSuffix >= 1.69.0
84	devel:libboost_filesystem$secondaryArchSuffix >= 1.69.0
85	devel:libboost_system$secondaryArchSuffix >= 1.69.0
86	devel:libboost_thread$secondaryArchSuffix >= 1.69.0
87	devel:libgflags$secondaryArchSuffix
88	devel:libglog$secondaryArchSuffix
89	devel:libhdf5$secondaryArchSuffix
90	devel:liblmdb$secondaryArchSuffix
91	devel:libopenblas$secondaryArchSuffix
92	devel:libopencv_core$secondaryArchSuffix
93	devel:libopencv_highgui$secondaryArchSuffix
94	devel:libopencv_imgcodecs$secondaryArchSuffix
95	devel:libopencv_imgproc$secondaryArchSuffix
96	devel:libprotobuf$secondaryArchSuffix
97	devel:libz$secondaryArchSuffix
98	"
99BUILD_PREREQUIRES="
100	cmd:cmake
101	cmd:gcc$secondaryArchSuffix
102#	cmd:f2py3
103	cmd:ld$secondaryArchSuffix
104	cmd:make
105#	cmd:python3
106	"
107
108BUILD()
109{
110#Main settings
111cat > Makefile.config << EOF
112CPU_ONLY := 1
113BLAS := open
114BUILD_DIR := build
115DISTRIBUTE_DIR := distribute
116USE_PKG_CONFIG := 1
117EOF
118
119	cmake -B build -S . \
120		$cmakeDirArgs \
121		-DCMAKE_INSTALL_BINDIR=$commandBinDir \
122		-DCMAKE_BUILD_TYPE='Release' \
123		-DUSE_LEVELDB:BOOL=OFF \
124		-DUSE_OPENCV:BOOL=ON \
125		-DCPU_ONLY:BOOL=ON \
126		-DBUILD_python:BOOL=OFF \
127		-DBUILD_SHARED_LIBS:BOOL=ON
128	make -C build $jobArgs
129}
130
131INSTALL()
132{
133	make -C build install
134
135	# Python support disabled for now.
136	rm -rf $prefix/python
137
138	prepareInstalledDevelLibs libcaffe libproto
139
140	# devel package
141	packageEntries devel \
142		$developDir \
143		$libDir/cmake
144}
145
146TEST()
147{
148	make -C build test
149	make -C build runtest
150}
151