-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build_deps_37_intel
executable file
·453 lines (381 loc) · 11.1 KB
/
build_deps_37_intel
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
#!/bin/bash
function begin_stage() {
local stage_name=$1
local distfile_mask=$2
echo -ne "\033]0;${stage_name} stage\007"
echo " * Cleaning and unpacking ${stage_name}"
rm -rf $WORK/*
if echo $distfile_mask | grep -q '\.tgz$' ; then
tar -xzf ${DIST}/$distfile_mask -C $WORK
elif echo $distfile_mask | grep -q '\.tar\.gz$' ; then
tar -xzf ${DIST}/$distfile_mask -C $WORK
elif echo $distfile_mask | grep -q '\.tar\.bz2$' ; then
tar -xjf ${DIST}/$distfile_mask -C $WORK
elif echo $distfile_mask | grep -q '\.tar\.xz$' ; then
tar --xz -xf ${DIST}/$distfile_mask -C $WORK
elif echo $distfile_mask | grep -q '\.zip$' ; then
unzip -d $WORK ${DIST}/$distfile_mask
fi
pushd $WORK/`echo $distfile_mask | sed 's/\*.*//'`*
echo " * Compiling ${stage_name}"
sleep $PAUSE
}
function complete_stage() {
local next=$1
popd
echo -n $next > $TARGET/stage
sleep $PAUSE
}
if [[ ! ${2} ]] ; then
echo
echo "Pass all build options or use build-* wrappers instead."
echo
echo "<1 target path> <2 distfiles dir> [3 stage]"
echo
echo " Stage 0.1 - OpenMP"
echo " Stage 0.2 - lzma"
#echo " Stage 0.3 - zlib"
echo " Stage 1.1 - boost"
echo " Stage 1.2 - jpeg"
echo " Stage 1.3 - tiff"
echo " Stage 1.4 - png"
echo " Stage 1.6 - ilmbase"
echo " Stage 1.7 - OpenEXR"
echo " Stage 2.1 - OpenImageIO"
echo " Stage 4.1 - Embree"
echo " Stage 4.2 - C-blosc"
echo " Stage 4.3 - TBB"
echo " Stage 4.4 - OpenCL"
echo " Stage 5.5 - OpenImageDenoise"
echo " Stage 5.6 - CUDA"
echo
exit 1
fi
ROOT=${PWD}
TARGET="$1"
WORK="/tmp/macdepsbuild"
DIST="$2"
STAGE=$4
PAUSE=5
# platform specs
export CFLAGS="-w -mmmx -mno-sse3 -mno-ssse3 -msse -msse2 -O2 -pipe -mfpmath=sse -fPIC"
export CXXFLAGS="-std=c++1z ${CFLAGS}"
export LDFLAGS="-L${TARGET}/lib"
export MAKEOPTS="-j"$(( `sysctl -n hw.physicalcpu` ))
export TMP="$WORK"
export TEMP="$WORK"
export TMPDIR="$WORK"
#####################################
mkdir -p $WORK 2>/dev/null
# compilation prechecks
echo -ne "\033]0;Preparing\007"
if [[ ! $STAGE ]] ; then
S=`cat $TARGET/stage 2>/dev/null`
if [[ ! $S ]] ; then
STAGE=0
else
STAGE=$S
fi
fi
echo
# STAGE 0.1 -- OpenMP
NEXT=0.2
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage openmp openmp*.tar.xz
mkdir build && cd build
echo " * Preparing OpenMP build"
if cmake -DLIBOMP_ENABLE_SHARED=ON \
-DCMAKE_INSTALL_PREFIX=$TARGET .. ; then
echo " * OpenMP prepared successfully"
else
echo " !!! OpenMP cmake failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install ; then
echo " * OpenMP built successfully"
else
echo " !!! OpenMP build failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 0.2 -- lzma
NEXT=0.3
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage lzma xz*.tar.gz
if ! ./configure --enable-static --disable-shared --disable-scripts --disable-xz \
--disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-lzma-links \
--prefix=$TARGET ; then
echo " !!! lzma configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install ; then
echo " * lzma compiled and installed successfully"
else
echo " !!! lzma compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 0.3 -- zlib
#NEXT=0.4
#if [[ $STAGE && $STAGE < $NEXT ]] ; then
# begin_stage zlib zlib*.tar.gz
# if echo $TARGET | grep -q '\-64' ; then
# ZLIB_PLATFORM="--64"
# else
# ZLIB_PLATFORM=""
# fi
# if ! ./configure --static $ZLIB_PLATFORM --prefix=$TARGET ; then
# echo " !!! zlib configuration failed"
# exit 1
# fi
# sleep $PAUSE
# if make $MAKEOPTS && make install ; then
# echo " * zlib compiled and installed successfully"
# else
# echo " !!! zlib compilation failed"
# exit 1
# fi
# complete_stage $NEXT
#fi
# STAGE 1.1 -- Boost
NEXT=1.2
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage boost boost*.tar.gz
cp -vf $DIST/numpy_patch.cpp libs/python/src/numpy/numpy.cpp
PYVER=`python3 --version 2>&1 | cut -d' ' -f2 | cut -d '.' -f'1 2'`
echo " * Compiling boost for python-${PYVER}"
PYROOT=`python3 -c "import sys; print(sys.prefix)"`
sleep 1
cat <<EOF >>tools/build/src/user-config.jam
using python : ${PYVER}
: python3
: ${PYROOT}/include/python${PYVER}m
: ${PYROOT}/lib ;
EOF
echo tools/build/src/user-config.jam
if ! ./bootstrap.sh --without-icu --prefix=$TARGET/boost \
--with-python=python3 \
--with-python-root=${PYROOT} ;then
echo " !!! Boost bootstrap failed"
exit 1
fi
if ./b2 $MAKEOPTS -aq cflags="$CFLAGS" cxxflags="$CXXFLAGS" \
$CONFIGOPTS --prefix=$TARGET --layout=system --with-date_time --with-filesystem \
--with-iostreams --with-locale --with-program_options --with-python --with-regex \
--with-serialization --with-system --with-thread --with-chrono \
threading=multi link=static python=${PYVER} \
release install ; then
# Fix boost python lib name
#mv $TARGET/lib/libboost_python*.a $TARGET/lib/libboost_python.a
#mv $TARGET/lib/libboost_numpy*.a $TARGET/lib/libboost_numpy.a
echo " * Boost compiled and installed successfully"
else
echo " !!! Boost compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 1.2 -- Jpeg
NEXT=1.3
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage jpeg jpeg*.tar.gz
if ! ./configure --enable-static --disable-shared --prefix=$TARGET ; then
echo " !!! Jpeg configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && cp -vf .libs/libjpeg.a $TARGET/lib && \
cp -vf *.h $TARGET/include ; then
echo " * Jpeg compiled and installed successfully"
else
echo " !!! Jpeg compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 1.3 -- Tiff
NEXT=1.4
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage tiff tiff*.tar.gz
if ! ./configure --disable-static --disable-jbig $CONFIGOPTS --prefix=$TARGET ; then
echo " !!! TIFF configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install ; then
echo " * TIFF compiled and installed successfully"
else
echo " !!! TIFF compilation failed"
exit 1
fi
install_name_tool -id @rpath/libtiff.5.dylib $TARGET/lib/libtiff.5.dylib
complete_stage $NEXT
fi
# STAGE 1.4 -- PNG
NEXT=1.6
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage png libpng*.tar.gz
if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET ; then
echo " !!! PNG configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install && cd $TARGET/include && ln -vs libpng* libpng ; then
echo " * PNG compiled and installed successfully"
else
echo " !!! PNG compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 1.6 -- IlmBase
NEXT=1.7
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage ilmbase ilmbase*.tar.gz
if ! ./bootstrap ;then
echo " !!! IlmBase bootstrap failed"
exit 1
fi
if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET ; then
echo " !!! ilmbase configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install ; then
echo " * ilmbase compiled and installed successfully"
else
echo " !!! ilmbase compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 1.7 -- OpenEXR
NEXT=1.8
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage openexr openexr*.tar.gz
if ! ./bootstrap ;then
echo " !!! OpenEXR bootstrap failed"
exit 1
fi
if ! ./configure --enable-static --disable-shared \
--prefix=$TARGET ; then
echo " !!! openexr configuration failed"
exit 1
fi
sleep $PAUSE
if make $MAKEOPTS && make install ; then
echo " * openexr compiled and installed successfully"
else
echo " !!! openexr compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 2.1 -- OpenImageIO
NEXT=4.1
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage openimageio oiio*.tar.gz
echo " * Building OpenImageIO"
if CMAKE_PREFIX_PATH=$TARGET make $MAKEOPTS BOOST_HOME=$TARGET \
Package_ROOT=$TARGET ILMBASE_HOME=$TARGET VERBOSE=0 USE_FFMPEG=0 \
EMBEDPLUGINS=1 USE_OPENGL=0 USE_QT=0 USE_GIF=0 USE_OPENJPEG=0 USE_OPENSSL=0 \
USE_FIELD3D=0 USE_OCIO=0 USE_OPENCV=0 USE_PYTHON=0 \
BUILDSTATIC=0 LINKSTATIC=1 OIIO_BUILD_TOOLS=0 OIIO_BUILD_TESTS=0 \
STOP_ON_WARNING=0 ; then
echo " * openimageio compiled successfully"
else
echo " !!! openimageio compilation failed"
exit 1
fi
echo " * Installing openimageio library and headers"
sleep $PAUSE
if cp -vr dist/macos*/* $TARGET && cd $TARGET/lib ; then
echo " * openimageio installed successfully"
else
echo " !!! openimageio installation failed"
exit 1
fi
install_name_tool -change $TARGET/lib/libtiff.5.dylib @rpath/libtiff.5.dylib $TARGET/lib/libOpenImageIO.2.2.dylib
complete_stage $NEXT
fi
# STAGE 4.1 -- Embree
NEXT=4.2
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage Embree embree-*.zip
cp -v ${ROOT}/utils/embree-install.sh .
sleep 1
if ./embree-install.sh $TARGET ; then
echo " * Embree library and headers installed successfully"
else
echo " !!! Embree library and headers installation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 4.2 -- C-blosc
NEXT=4.3
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage C-blosc c-blosc-*.tar.gz
mkdir build && cd build
if cmake -DCMAKE_INSTALL_PREFIX=$TARGET -DBUILD_SHARED=OFF -DBUILD_TESTS=OFF -DBUILD_BENCHMARKS=OFF .. && cmake --build . --target install ; then
echo " * C-blosc compiled successfully"
else
echo " !!! C-blosc compilation failed"
exit 1
fi
complete_stage $NEXT
fi
# STAGE 4.3 -- TBB
NEXT=4.4
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage TBB tbb*-mac.tgz
cp -v ${ROOT}/utils/tbb-install.sh .
sleep 1
if ./tbb-install.sh $TARGET ; then
echo " * TBB library and headers installed successfully"
else
echo " !!! TBB library and headers installation failed"
exit 1
fi
complete_stage $NEXT
fi
# Stage 4.4 -- OpenCL
NEXT=5.5
if [[ $STAGE && $STAGE < $NEXT ]] ; then
if cp -R ${DIST}/OpenCL ${TARGET}/include ; then
echo " * OpenCL header installed successfully"
else
echo " !!! OpenCL header installation failed"
exit 1
fi
fi
# STAGE 5.5 -- OpenImageDenoise
NEXT=5.6
if [[ $STAGE && $STAGE < $NEXT ]] ; then
begin_stage OpenImageDenoise oidn*.tar.gz
mkdir build && cd build
if cmake -DCMAKE_INSTALL_PREFIX=$TARGET .. && make $MAKEOPTS && make install ; then
echo " * OpenImageDenoise installed successfully"
else
echo " !!! OpenImageDenoise compilation failed"
exit 1
fi
install_name_tool -id @rpath/libOpenImageDenoise.1.dylib $TARGET/lib/libOpenImageDenoise.1.dylib
install_name_tool -change $TARGET/lib/libOpenImageDenoise.1.dylib @rpath/libOpenImageDenoise.1.4.0.dylib $TARGET/bin/oidnDenoise
complete_stage $NEXT
fi
# STAGE 5.6 -- CUDA
NEXT=5.6
if [[ $STAGE && $STAGE < $NEXT ]] ; then
if cp -R ${DIST}/CUDA/* ${TARGET}/lib ; then
echo " * CUDA libraries installed successfully"
else
echo " !!! CUDA libraries installation failed"
exit 1
fi
fi
#mkdir -p ${TARGET}/lib/Release