forked from alibaba/GraphScope
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgs
executable file
·2674 lines (2233 loc) · 71 KB
/
gs
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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# This script was generated by bashly 1.0.4 (https://bashly.dannyb.co)
# Modifying it manually is not recommended
# :wrapper.bash3_bouncer
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
printf "bash version 4 or higher is required. If you are using macOS, please run 'brew install bash && bash' to upgrade bash.\n" >&2
exit 1
fi
# :command.master_script
# :command.version_command
version_command() {
echo "$version"
}
# :command.usage
gs_usage() {
if [[ -n $long_usage ]]; then
printf "gs - A bash utility for GraphScope\n"
echo
else
printf "gs - A bash utility for GraphScope\n"
echo
fi
printf "%s\n" "Usage:"
printf " gs COMMAND\n"
printf " gs [COMMAND] --help | -h\n"
printf " gs --version | -v\n"
echo
# :command.usage_commands
printf "%s\n" "Commands:"
printf " %s Build GraphScope on local.\n" "make "
printf " %s Build GraphScope docker images.\n" "make-image "
printf " %s Open a develop environment with docker.\n" "dev "
printf " %s Run tests of graphscope\n" "test "
printf " %s Install dependencies on local machine.\n" "install-deps"
printf " %s \n" "format "
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
printf " %s\n" "--version, -v"
printf " Show version number\n"
echo
# :command.usage_environment_variables
printf "%s\n" "Environment Variables:"
# :environment_variable.usage
printf " %s\n" "GRAPHSCOPE_HOME (required)"
printf " Installed HOME for GraphScope.\n"
echo
# :environment_variable.usage
printf " %s\n" "GRAPHSCOPE_ENV"
printf " One of dev, prod.\n"
printf " Default: dev\n"
echo
# :command.footer
printf "GraphScope is open sourced at https://github.com/alibaba/GraphScope\nby DAMO Academy, Alibaba Group.\n\n"
echo
fi
}
# :command.usage
gs_make_usage() {
if [[ -n $long_usage ]]; then
printf "gs make - Build GraphScope on local.\n"
echo
else
printf "gs make - Build GraphScope on local.\n"
echo
fi
printf "%s\n" "Usage:"
printf " gs make [COMPONENT] [OPTIONS]\n"
printf " gs make --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--install-prefix PREFIX"
printf " Install dependency files to [prefix]. By default, './gs make install' will\n install all the files in '/opt/graphscope/bin', '/opt/graphscope/lib' etc.\n You can specify an installation prefix other than '/opt/graphscope' using\n '--install-prefix', for instance '--install-prefix=\$HOME'.\n"
printf " Default: /opt/graphscope\n"
echo
# :flag.usage
printf " %s\n" "--storage-type STORAGE_TYPE"
printf " make gie with specified storage type\n"
printf " Default: default\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "COMPONENT"
printf " component to build.\n"
printf " Allowed: all, install, analytical, analytical-java, interactive, learning, analytical-install, analytical-java-install, interactive-install, learning-install, client, coordinator, clean\n"
printf " Default: all\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " gs make analytical\n"
printf " gs make interactive -DskipTests\n"
printf " gs make install\n"
echo
fi
}
# :command.usage
gs_make_image_usage() {
if [[ -n $long_usage ]]; then
printf "gs make-image - Build GraphScope docker images.\n"
echo
else
printf "gs make-image - Build GraphScope docker images.\n"
echo
fi
printf "Alias: mi\n"
echo
printf "%s\n" "Usage:"
printf " gs make-image IMAGE [OPTIONS]\n"
printf " gs make-image --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--registry REGISTRY"
printf " registry name\n"
printf " Default: registry.cn-hongkong.aliyuncs.com\n"
echo
# :flag.usage
printf " %s\n" "--tag TAG"
printf " image tag name to build\n"
printf " Default: latest\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "IMAGE"
printf " Images to build.\n"
printf " Allowed: all, graphscope-dev, coordinator, analytical, analytical-java, interactive, interactive-frontend, interactive-executor, learning, vineyard-dev, vineyard-runtime\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " gs make-image graphscope-dev\n"
printf " gs make-image analytical --registry registry.cn-hongkong.aliyuncs.com\n"
printf " gs make-image analytical --registry docker.io\n"
echo
fi
}
# :command.usage
gs_dev_usage() {
if [[ -n $long_usage ]]; then
printf "gs dev - Open a develop environment with docker.\n"
echo
else
printf "gs dev - Open a develop environment with docker.\n"
echo
fi
printf "Alias: d\n"
echo
printf "%s\n" "Usage:"
printf " gs dev [OPTIONS]\n"
printf " gs dev --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--local, -l LOCAL"
printf " Local path to the source code of GraphScope.\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " gs dev\n"
printf " gs dev --local ~/graphscope\n"
echo
fi
}
# :command.usage
gs_test_usage() {
if [[ -n $long_usage ]]; then
printf "gs test - Run tests of graphscope\n"
echo
else
printf "gs test - Run tests of graphscope\n"
echo
fi
printf "Alias: t\n"
echo
printf "%s\n" "Usage:"
printf " gs test [TYPE] [OPTIONS]\n"
printf " gs test --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--local"
printf " Run local tests\n"
echo
# :flag.usage
printf " %s\n" "--storage-type STORAGE_TYPE"
printf " test gie with specified storage type\n"
printf " Default: default\n"
echo
# :flag.usage
printf " %s\n" "--k8s"
printf " Run k8s tests\n"
echo
# :flag.usage
printf " %s\n" "--nx"
printf " Run nx tests\n"
echo
# :flag.usage
printf " %s\n" "--testdata DIRECTORY"
printf " assign a custom test data location. This could be cloned from\n https://github.com/graphscope/gstest\n"
printf " Default: /tmp/gstest\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "TYPE"
printf " test a subset of the codebase, organized by components.\n"
printf " Allowed: analytical, analytical-java, interactive, learning, local-e2e, k8s-e2e, groot\n"
echo
fi
}
# :command.usage
gs_install_deps_usage() {
if [[ -n $long_usage ]]; then
printf "gs install-deps - Install dependencies on local machine.\n"
echo
else
printf "gs install-deps - Install dependencies on local machine.\n"
echo
fi
printf "Alias: i\n"
echo
printf "%s\n" "Usage:"
printf " gs install-deps TYPE [OPTIONS]\n"
printf " gs install-deps --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_flags
# :flag.usage
printf " %s\n" "--cn"
printf " Whether to use CN located mirrors to speed up download.\n"
echo
# :flag.usage
printf " %s\n" "--from-local, -l DIRECTORY"
printf " Find raw dependencies of GraphScope from a local directory. The raw\n dependencies would then be built and installed to [prefix]. If the directory\n is empty or not exists, dependency files would be downloaded to [directory].\n"
printf " Default: /tmp/gs-local-deps\n"
echo
# :flag.usage
printf " %s\n" "--install-prefix PREFIX"
printf " Install dependency files to [prefix]. By default, './gs install-deps dev'\n will install all the files in '/opt/graphscope/bin', '/opt/graphscope/lib'\n etc. You can specify an installation prefix other than '/opt/graphscope'\n using '--install-prefix', for instance '--install-prefix=\$HOME'.\n"
printf " Default: /opt/graphscope\n"
echo
# :flag.usage
printf " %s\n" "--v6d-version V6D-VERSION"
printf " v6d version to clone\n"
printf " Default: main\n"
echo
# :flag.usage
printf " %s\n" "--jobs, -j JOBS"
printf " Concurrent jobs in building, i.e., -j argument passed to make.\n"
echo
# :flag.usage
printf " %s\n" "--for-analytical"
printf " Only install analytical engine dependencies\n"
echo
# :flag.usage
printf " %s\n" "--no-v6d"
printf " Do not install v6d, for build base docker images, could only be used with\n '--for-analytical'\n"
echo
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "TYPE"
printf " dependencies for development or client\n"
printf " Allowed: dev, client\n"
echo
# :command.usage_examples
printf "%s\n" "Examples:"
printf " gs install-deps client\n"
printf " gs install-deps dev\n"
printf " gs install-deps dev --cn\n"
printf " gs install-deps dev --cn -j 6\n"
printf " gs install-deps dev --from-local ~/Downloads/gs-all-deps\n"
printf " gs install-deps dev --install-prefix ~/gs\n"
echo
fi
}
# :command.usage
gs_format_usage() {
if [[ -n $long_usage ]]; then
printf "gs format\n"
echo
else
printf "gs format\n"
echo
fi
printf "%s\n" "Usage:"
printf " gs format LANG\n"
printf " gs format --help | -h\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "%s\n" "Options:"
# :command.usage_fixed_flags
printf " %s\n" "--help, -h"
printf " Show this help\n"
echo
# :command.usage_args
printf "%s\n" "Arguments:"
# :argument.usage
printf " %s\n" "LANG"
printf " format which part of languages\n"
printf " Allowed: cpp, java, python, rust\n"
echo
fi
}
# :command.normalize_input
normalize_input() {
local arg flags
while [[ $# -gt 0 ]]; do
arg="$1"
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
input+=("${BASH_REMATCH[1]}")
input+=("${BASH_REMATCH[2]}")
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
input+=("${BASH_REMATCH[1]}")
input+=("${BASH_REMATCH[2]}")
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
flags="${BASH_REMATCH[1]}"
for ((i = 0; i < ${#flags}; i++)); do
input+=("-${flags:i:1}")
done
else
input+=("$arg")
fi
shift
done
}
# :command.inspect_args
inspect_args() {
if ((${#args[@]})); then
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
echo args:
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
else
echo args: none
fi
if ((${#other_args[@]})); then
echo
echo other_args:
echo "- \${other_args[*]} = ${other_args[*]}"
for i in "${!other_args[@]}"; do
echo "- \${other_args[$i]} = ${other_args[$i]}"
done
fi
if ((${#deps[@]})); then
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
echo
echo deps:
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
fi
}
# :command.user_lib
# src/lib/colors.sh
print_in_color() {
local color="$1"
shift
if [[ -z ${NO_COLOR+x} ]]; then
printf "$color%b\e[0m\n" "$*";
else
printf "%b\n" "$*";
fi
}
red() { print_in_color "\e[31m" "$*"; }
green() { print_in_color "\e[32m" "$*"; }
yellow() { print_in_color "\e[33m" "$*"; }
blue() { print_in_color "\e[34m" "$*"; }
magenta() { print_in_color "\e[35m" "$*"; }
cyan() { print_in_color "\e[36m" "$*"; }
bold() { print_in_color "\e[1m" "$*"; }
underlined() { print_in_color "\e[4m" "$*"; }
red_bold() { print_in_color "\e[1;31m" "$*"; }
green_bold() { print_in_color "\e[1;32m" "$*"; }
yellow_bold() { print_in_color "\e[1;33m" "$*"; }
blue_bold() { print_in_color "\e[1;34m" "$*"; }
magenta_bold() { print_in_color "\e[1;35m" "$*"; }
cyan_bold() { print_in_color "\e[1;36m" "$*"; }
red_underlined() { print_in_color "\e[4;31m" "$*"; }
green_underlined() { print_in_color "\e[4;32m" "$*"; }
yellow_underlined() { print_in_color "\e[4;33m" "$*"; }
blue_underlined() { print_in_color "\e[4;34m" "$*"; }
magenta_underlined() { print_in_color "\e[4;35m" "$*"; }
cyan_underlined() { print_in_color "\e[4;36m" "$*"; }
# src/lib/get_os_version.sh
get_os_version() {
if [ -f /etc/centos-release ]; then
# Older Red Hat, CentOS, Alibaba Cloud Linux etc.
PLATFORM=CentOS
OS_VERSION=$(sed 's/.* \([0-9]\).*/\1/' < /etc/centos-release)
if grep -q "Alibaba Cloud Linux" /etc/centos-release; then
PLATFORM="Aliyun_based_on_CentOS"
OS_VERSION=$(rpm -E %{rhel})
fi
elif [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
PLATFORM="${NAME}"
OS_VERSION="${VERSION_ID}"
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
PLATFORM=$(lsb_release -si)
OS_VERSION=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
PLATFORM="${DISTRIB_ID}"
OS_VERSION="${DISTRIB_RELEASE}"
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
PLATFORM=Debian
OS_VERSION=$(cat /etc/debian_version)
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, Darwin, etc.
PLATFORM=$(uname -s)
OS_VERSION=$(uname -r)
fi
echo "$PLATFORM-$OS_VERSION"
}
# src/lib/install_thirdparty_dependencies.sh
install_cmake() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/bin/cmake" ]]; then
log "cmake already installed, skip."
return 0
fi
ARCH=$(uname -m)
file="cmake-3.24.3-linux-${ARCH}.sh"
log "Building and installing ${file}."
pushd "${workdir}" || exit
url="https://github.com/Kitware/CMake/releases/download/v3.24.3"
url=$(maybe_set_to_cn_url ${url})
[ ! -f "${file}" ] &&
fetch_source "${file}" "${url}"
bash "${file}" --prefix="${install_prefix}" --skip-license
popd || exit
cleanup_files "${workdir}/${file}"
}
install_open_mpi() {
workdir=$1
install_prefix=$2
MPI_PREFIX="/opt/openmpi" # fixed, related to coordinator/setup.py
if [[ -f "${install_prefix}/include/mpi.h" ]]; then
log "openmpi already installed, skip."
return 0
fi
directory="openmpi-4.0.5"
file="openmpi-4.0.5.tar.gz"
url="https://download.open-mpi.org/release/open-mpi/v4.0"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
./configure --enable-mpi-cxx --disable-dlopen --prefix=${MPI_PREFIX}
make -j$(nproc)
make install
popd || exit
popd || exit
cp -rs ${MPI_PREFIX}/* "${install_prefix}"
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_gflags() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/gflags/gflags.h" ]]; then
log "gflags already installed, skip."
return 0
fi
directory="gflags-2.2.2"
file="v2.2.2.tar.gz"
url="https://github.com/gflags/gflags/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing gflags-2.2.2."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
cmake . -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DBUILD_SHARED_LIBS=ON
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_glog() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/glog/logging.h" ]]; then
log "glog already installed, skip."
return 0
fi
directory="glog-0.6.0"
file="v0.6.0.tar.gz"
url="https://github.com/google/glog/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
cmake . -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DBUILD_SHARED_LIBS=ON
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_apache_arrow() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/arrow/api.h" ]]; then
log "apache-arrow already installed, skip."
return 0
fi
directory="arrow-apache-arrow-10.0.1"
file="apache-arrow-10.0.1.tar.gz"
url="https://github.com/apache/arrow/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
cmake ./cpp \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DARROW_COMPUTE=ON \
-DARROW_WITH_UTF8PROC=OFF \
-DARROW_CSV=ON \
-DARROW_CUDA=OFF \
-DARROW_DATASET=OFF \
-DARROW_FILESYSTEM=ON \
-DARROW_FLIGHT=OFF \
-DARROW_GANDIVA=OFF \
-DARROW_HDFS=OFF \
-DARROW_JSON=OFF \
-DARROW_ORC=OFF \
-DARROW_PARQUET=OFF \
-DARROW_PLASMA=OFF \
-DARROW_PYTHON=OFF \
-DARROW_S3=OFF \
-DARROW_WITH_BZ2=OFF \
-DARROW_WITH_ZLIB=OFF \
-DARROW_WITH_LZ4=OFF \
-DARROW_WITH_SNAPPY=OFF \
-DARROW_WITH_ZSTD=OFF \
-DARROW_WITH_BROTLI=OFF \
-DARROW_IPC=ON \
-DARROW_BUILD_BENCHMARKS=OFF \
-DARROW_BUILD_EXAMPLES=OFF \
-DARROW_BUILD_INTEGRATION=OFF \
-DARROW_BUILD_UTILITIES=OFF \
-DARROW_BUILD_TESTS=OFF \
-DARROW_ENABLE_TIMING_TESTS=OFF \
-DARROW_FUZZING=OFF \
-DARROW_USE_ASAN=OFF \
-DARROW_USE_TSAN=OFF \
-DARROW_USE_UBSAN=OFF \
-DARROW_JEMALLOC=OFF \
-DARROW_BUILD_SHARED=ON \
-DARROW_BUILD_STATIC=OFF
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_boost() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/boost/version.hpp" ]]; then
log "boost already installed, skip."
return 0
fi
directory="boost_1_74_0"
file="${directory}.tar.gz"
url="https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
./bootstrap.sh --prefix="${install_prefix}" \
--with-libraries=system,filesystem,context,program_options,regex,thread,random,chrono,atomic,date_time
./b2 install link=shared runtime-link=shared variant=release threading=multi
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_openssl() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/openssl/ssl.h" ]]; then
log "openssl already installed, skip."
return 0
fi
directory="openssl-OpenSSL_1_1_1k"
file="OpenSSL_1_1_1k.tar.gz"
url="https://github.com/openssl/openssl/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
./config --prefix="${install_prefix}" -fPIC -shared
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_openssl_static() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/openssl/ssl.h" ]]; then
log "openssl already installed, skip."
return 0
fi
directory="openssl-OpenSSL_1_1_1k"
file="OpenSSL_1_1_1k.tar.gz"
url="https://github.com/openssl/openssl/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
./config --prefix="${install_prefix}" no-shared -fPIC
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_zlib() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/zlib.h" ]]; then
log "zlib already installed, skip."
return 0
fi
directory="zlib-1.2.11"
file="v1.2.11.tar.gz"
url="https://github.com/madler/zlib/archive"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
cmake . -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DBUILD_SHARED_LIBS=ON
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_protobuf() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/google/protobuf/port.h" ]]; then
log "protobuf already installed, skip."
return 0
fi
directory="protobuf-21.9"
file="protobuf-all-21.9.tar.gz"
url="https://github.com/protocolbuffers/protobuf/releases/download/v21.9"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
./configure --prefix="${install_prefix}" --enable-shared --disable-static
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_grpc() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/grpcpp/grpcpp.h" ]]; then
log "grpc already installed, skip."
return 0
fi
directory="grpc"
branch="v1.49.1"
file="${directory}-${branch}.tar.gz"
url="https://github.com/grpc/grpc.git"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
if [[ ${url} == *.git ]]; then
clone_if_not_exists ${directory} ${file} "${url}" ${branch}
else
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
fi
pushd ${directory} || exit
cmake . -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DBUILD_SHARED_LIBS=ON \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_BUILD_CSHARP_EXT=OFF \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
-DgRPC_BACKWARDS_COMPATIBILITY_MODE=ON \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DOPENSSL_ROOT_DIR="${install_prefix}" \
-DCMAKE_CXX_FLAGS="-fpermissive" \
-DPNG_ARM_NEON_OPT=0
make -j$(nproc)
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_patchelf() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/bin/patchelf" ]]; then
log "patchelf already installed, skip."
return 0
fi
ARCH=$(uname -m)
directory="patchelf" # patchelf doesn't have a folder
file="patchelf-0.14.5-${ARCH}.tar.gz"
url="https://github.com/NixOS/patchelf/releases/download/0.14.5"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
mkdir -p "${directory}"
pushd "${directory}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
mkdir -p ${install_prefix}/bin
mv bin/patchelf ${install_prefix}/bin/patchelf
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_cppkafka() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/include/cppkafka/cppkafka.h" ]]; then
log "cppkafka already installed, skip."
return 0
fi
directory="cppkafka-0.4.0"
file="0.4.0.tar.gz"
url="https://github.com/mfontanini/cppkafka/archive/refs/tags"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
pushd ${directory} || exit
# cppkafka may not find the lib64 directory
export LIBRARY_PATH=${LIBRARY_PATH}:${install_prefix}/lib:${install_prefix}/lib64
cmake . -DCMAKE_INSTALL_PREFIX="${install_prefix}" \
-DCMAKE_PREFIX_PATH="${install_prefix}" \
-DCPPKAFKA_DISABLE_TESTS=ON \
-DCPPKAFKA_DISABLE_EXAMPLES=ON
make -j4
make install
popd || exit
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
install_maven() {
workdir=$1
install_prefix=$2
if [[ -f "${install_prefix}/bin/mvn" ]]; then
log "maven already installed, skip."
return 0
fi
directory="apache-maven-3.8.6"
file="apache-maven-3.8.6-bin.tar.gz"
url="https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries"
url=$(maybe_set_to_cn_url ${url})
log "Building and installing ${directory}."
pushd "${workdir}" || exit
download_tar_and_untar_if_not_exists ${directory} ${file} "${url}"
cp -r ${directory} "${install_prefix}"/
mkdir -p "${install_prefix}"/bin
ln -s "${install_prefix}/${directory}/bin/mvn" "${install_prefix}/bin/mvn"
popd || exit
cleanup_files "${workdir}/${directory}" "${workdir}/${file}"
}
# src/lib/install_vineyard.sh
install_vineyard() {
workdir=$1
install_prefix=$2
v6d_version=$3
jobs=${4:-4} # $4:default=4