summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 328011e8ec1e792ffbd0a1f1d55a89536d4cad22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#$
#$ Cloned from armcl-opencl
#$
#
# Maintainer: EndlessEden <eden@rose.place>
#
# Contributor: Andrew Anderson <aanderso@tcd.ie>

pkgname=armcl-opencl-mali
pkgver=20.02.1
pkgrel=1

epoch=
pkgdesc="ARM Computer Vision and Machine Learning Library (x86_64 OpenCL Backend)"
arch=('aarch64')
url="https://github.com/ARM-software/ComputeLibrary"
license=('MIT')
groups=()
depends=()
makedepends=( 'scons>=2.3' 'git' 'doxygen>=1.8.5' )
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=( '!strip' '!emptydirs' 'staticlibs' )
install=
changelog=
source=("git+https://github.com/ARM-software/ComputeLibrary.git")
sha1sums=('SKIP')

build() {

NEON=0
case "$CARCH" in

 armv7h) HARCH='armv7a'
 if [ $(cat /proc/cpuinfo | grep "Features" | grep -c "neon") -gt "0" ]; then
  NEON=1
 else
  NEON=0
 fi
 ;;

 armv8h) HARCH="$CARCH"
  if [ $(cat /proc/cpuinfo | grep "Features" | grep -c "neon") -gt "0" ]; then
   NEON=1
  else
   NEON=0
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8.6' ]; then
   HARCH='armv8.6-a'
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8.2' ]; then
   if [ $(cat /proc/cpuinfo | grep "Features" | grep -c "sve") -gt "0" ]; then
    HARCH='armv8.2-a-sve'
   else
    HARCH='armv8.2-a'
   fi
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8' ]; then
   HARCH='armv8a'
  fi
  if [ $HARCH == $CARCH ]; then
   echo "Incompatible Arm Architecture. Only Arm version 8 is supported, Please verify your Arm Architecture Version is between 8 and 8.6 on $CARCH."
   exit 1
  fi
 ;;

 aarch64)HARCH="$CARCH"
  if [ $(cat /proc/cpuinfo | grep "Features" | grep -c "neon") -gt "0" ]; then
   NEON=1
  else
   NEON=0
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8.6' ]; then
   echo "Incompatible Arm Architecture. Arm64 is not compatible with Arm Archtectures greater than 8.2 at this time."
   exit 1
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8.2' ]; then
   if [ $(cat /proc/cpuinfo | grep "Features" | grep -c "sve") -gt "0" ]; then
    HARCH='arm64-v8.2-a-sve'
   else
    HARCH='arm64-v8.2-a'
   fi
  fi
  if [ $(cat /proc/cpuinfo | grep "CPU architecture" | tail -1 | sed 's/CPU architecture: //g') == '8' ]; then
   HARCH='arm64-v8a'
  fi
  if [ $HARCH == $CARCH ]; then
   echo "Incompatible Arm Architecture. Only Arm version 8 is supported, Please verify your Arm Architecture Version is between 8 and 8.2 on $CARCH."
   exit 1
  fi
 ;;
esac

  cd "${srcdir}/ComputeLibrary"
  git checkout "v$pkgver"
  if [ $NEON = "1" ]; then

   scons -j`cat /proc/cpuinfo | grep -i "processor" | wc -l` \
   os=linux arch=$HARCH build=native \
   Werror=0 debug=0 asserts=0 \
   neon=1 \
   opencl=1 gles_compute=1 embed_kernels=1 \
   examples=0 \
   set_soname=0 \
   openmp=1 cppthreads=1 \
   pmu=1 \
   mali=1 \
   validation_tests=0 \
   benchmark_tests=0 \
   extra_cxx_flags="-fPIC"

  else
 
   scons -j`cat /proc/cpuinfo | grep -i "processor" | wc -l` \
   os=linux arch=$HARCH build=native \
   Werror=0 debug=0 asserts=0 \
   neon=0 \
   opencl=1 gles_compute=1 embed_kernels=1 \
   examples=0 \
   set_soname=0 \
   openmp=1 cppthreads=1 \
   pmu=1 \
   mali=1 \
   validation_tests=0 \
   benchmark_tests=0 \
   extra_cxx_flags="-fPIC"
  fi
}

#check() {}

package() {
  cd "${srcdir}/ComputeLibrary"
  mkdir -p ${pkgdir}/usr/lib/
  cp -r build/*.a ${pkgdir}/usr/lib/
  cp -r build/*.so ${pkgdir}/usr/lib/

  # The Compute Library OpenCL runtime
  mkdir -p ${pkgdir}/usr/lib/arm_compute/
  cp -r build/src/runtime/CL/* ${pkgdir}/usr/lib/arm_compute/

  mkdir -p ${pkgdir}/usr/include/arm_compute/
  cp -r arm_compute/* ${pkgdir}/usr/include/arm_compute/
  cp -r support ${pkgdir}/usr/include/arm_compute/
  cp -r include/* ${pkgdir}/usr/include/arm_compute/
  cp -r utils ${pkgdir}/usr/include/arm_compute/
}