xref: /spdk/test/common/config/pkgdep/git (revision 57eee18288f8ed8a6aa8cf51e6eeba32d1b4231f)
1function install_spdk() {
2	mkdir -p "$GIT_REPOS/spdk_repo/output" || echo "Can not create spdk_repo/output directory."
3
4	if [[ -d $GIT_REPOS/spdk_repo/spdk ]]; then
5		echo "spdk source already present, not cloning"
6	else
7		git -C "$GIT_REPOS/spdk_repo" clone "${GIT_REPO_SPDK}"
8	fi
9	git -C "$GIT_REPOS/spdk_repo/spdk" config submodule.dpdk.url "${GIT_REPO_DPDK}"
10	git -C "$GIT_REPOS/spdk_repo/spdk" config submodule.intel-ipsec-mb.url "${GIT_REPO_INTEL_IPSEC_MB}"
11	git -C "$GIT_REPOS/spdk_repo/spdk" submodule update --init --recursive
12}
13
14function install_refspdk() {
15	local release
16	local output_dir
17	local config_params
18	local rootdir
19	local version
20
21	version=$1
22
23	# Create a reference SPDK build for ABI tests
24	git -C "$GIT_REPOS/spdk_repo/spdk" fetch --tags --force
25
26	if [[ "$version" == "latest" ]]; then
27		release=${REFSPDK_TAG:-$(git -C "$GIT_REPOS/spdk_repo/spdk" tag | sort --version-sort | grep -v rc | tail -n 1)}
28		output_dir="$GIT_REPOS/spdk_abi_latest"
29	elif [[ "$version" == "LTS" ]]; then
30		release=$(git -C "$GIT_REPOS/spdk_repo/spdk" describe --tags --exclude=LTS LTS)
31		output_dir="$GIT_REPOS/spdk_abi_lts"
32	fi
33
34	rm -rf "$output_dir"
35
36	if [[ ! -d $output_dir ]]; then
37		cp -R "$GIT_REPOS/spdk_repo/spdk" "$output_dir"
38	fi
39
40	git -C "$output_dir" checkout "$release"
41	git -C "$output_dir" submodule update --init
42
43	if ((gcc_version >= 11)) && le "${release#v}" 21.04; then
44		git -C "$output_dir" config --global user.name "spdk"
45		git -C "$output_dir" config --global user.email "hotpatch@spdk.io"
46		git -C "$output_dir" cherry-pick 36b5a69bb0699694b53a2f08a13cc0de620450a9
47		git -C "$output_dir" cherry-pick 2ac152158116a17b863270a4731977d9ddedf50d
48	fi
49
50	cat > $HOME/autorun-spdk.conf <<- EOF
51		SPDK_BUILD_SHARED_OBJECT=1
52		SPDK_TEST_AUTOBUILD=1
53		SPDK_TEST_UNITTEST=1
54		SPDK_TEST_BLOCKDEV=1
55		SPDK_TEST_PMDK=1
56		SPDK_TEST_ISAL=1
57		SPDK_TEST_REDUCE=1
58		SPDK_TEST_CRYPTO=1
59		SPDK_TEST_FTL=1
60		SPDK_TEST_OCF=1
61		SPDK_TEST_RAID5=1
62		SPDK_TEST_RBD=1
63		SPDK_RUN_ASAN=1
64		SPDK_RUN_UBSAN=1
65		SPDK_TEST_NVME_PMR=1
66		SPDK_TEST_NVME_SCC=1
67		SPDK_TEST_NVME_BP=1
68		SPDK_TEST_NVME_CUSE=1
69		SPDK_TEST_BLOBFS=1
70		SPDK_TEST_URING=1
71		SPDK_TEST_VFIOUSER=1
72	EOF
73
74	mkdir -p $HOME/output
75
76	(
77		rootdir="$output_dir"
78		source $HOME/autorun-spdk.conf
79		source $output_dir/test/common/autotest_common.sh
80
81		# Prepare separate, fixed, cmdline for the FreeBSD, Issue #1397.
82		if [[ $OSID == freebsd ]]; then
83			config_params="--enable-debug"
84			config_params+=" --without-isal"
85			config_params+=" --with-idxd --disable-unit-tests"
86
87			MAKE=gmake
88		else
89			config_params="$(get_config_params)"
90		fi
91		$output_dir/configure $(echo $config_params | sed 's/--enable-coverage//g') --without-fio
92		if [[ $OSID != freebsd ]]; then
93			$MAKE -C $output_dir $MAKEFLAGS include/spdk/config.h
94			CONFIG_OCF_PATH="$output_dir/ocf" $MAKE -C $output_dir/lib/env_ocf $MAKEFLAGS exportlib O=$output_dir/ocf.a
95			$output_dir/configure $config_params --with-ocf=$output_dir/ocf.a --with-shared --without-fio
96		fi
97		$MAKE -C $output_dir $MAKEFLAGS
98	)
99}
100
101function install_qat() {
102	# Dissect the kernel version into maj, min, release and local version
103	local kernel_maj kernel_min kernel_rel kernel_loc
104	local kernel_ver
105
106	in_syms() {
107		local syms
108		if [[ -e /proc/kallsyms ]]; then
109			syms=/proc/kallsyms
110		elif [[ -e /boot/System.map-$(< /proc/sys/kernel/osrelease) ]]; then
111			syms=/boot/System.map-$(< /proc/sys/kernel/osrelease)
112		else
113			return 0
114		fi
115
116		grep -q "$1" "$syms"
117	}
118
119	IFS=".-" read -r kernel_{maj,min,rel,loc} < /proc/sys/kernel/osrelease
120	kernel_ver=$((kernel_maj << 16 | kernel_min << 8 | kernel_rel))
121
122	if [[ -e /sys/module/qat_c62x ]]; then
123		sudo modprobe -r qat_c62x || :
124	fi
125	if [[ -d $GIT_REPOS/QAT ]]; then
126		sudo rm -rf "$GIT_REPOS/QAT"
127	fi
128
129	mkdir "$GIT_REPOS/QAT"
130
131	tar -C "$GIT_REPOS/QAT" -xzof - < <(wget -O- "$DRIVER_LOCATION_QAT")
132
133	# Patch use of hidden types in kernels >= 5.6.3. See .patch for details
134	if ((kernel_ver >= 0x050603)); then
135		# Patch only the driver version that was tested
136		[[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.9.0-00008.tar.gz ]] && patch --dir="$GIT_REPOS/QAT" -p1
137	fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-timespec.patch"
138
139	# Patch name of the pci_aer function which was renamed in kernels >= 5.7.1. See .patch for details
140	if ((kernel_ver >= 0x050701)) || ! in_syms pci_cleanup_aer_uncorrect_error_status; then
141		# Patch only the driver version that was tested
142		if [[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.9.0-00008.tar.gz ]]; then
143			patch --dir="$GIT_REPOS/QAT" -p1
144		fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-pci_aer.patch"
145		if ((kernel_ver < 0x050701)); then
146			# Older kernel build without pci_cleanup_aer_uncorrect_error_status()? This might be
147			# centos8's build.
148			if [[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.12.0-00011.tar.gz ]]; then
149				patch --dir="$GIT_REPOS/QAT" -p1
150			fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-pci_aer_centos.patch"
151		fi
152	fi
153
154	# Patch use of cryptohash.h which was removed in favor of crypto/sha.h in kernels >= 5.8. See .patch for details
155	if ((kernel_ver >= 0x050800)); then
156		# Patch only the driver version that was tested
157		[[ ${DRIVER_LOCATION_QAT##*/} == qat1.7.l.4.9.0-00008.tar.gz ]] && patch --dir="$GIT_REPOS/QAT" -p1
158	fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-cryptohash.patch"
159
160	# Object files need to be passed via obj-m otherwise they won't be built with kernels >= 5.10
161	if ((kernel_ver >= 0x050a01)); then
162		patch --dir="$GIT_REPOS/QAT" -p1
163	fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-set-obj-m.patch"
164
165	# sha.h was split into two separate files, sha1.h and sha2.h in kernels >= 5.11
166	if ((kernel_ver >= 0x050b01)); then
167		# qat_algs_ablkcipher.c doesn't exist in older versions of the driver so simply force the patch
168		patch --force --dir="$GIT_REPOS/QAT" -p1
169	fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-sha.patch" || :
170
171	# cipher routines were moved from crypto.h to crypto/internal/cipher.h in kernels >= 5.12
172	if ((kernel_ver >= 0x050c00)); then
173		patch --dir="$GIT_REPOS/QAT" -p1
174	fi < "$rootdir/test/common/config/pkgdep/patches/qat/0001-cipher-ns.patch"
175
176	(cd "$GIT_REPOS/QAT" && sudo ./configure --enable-icp-sriov=host && sudo make install)
177
178	if ! sudo service qat_service start; then
179		echo "failed to start the qat service. Something may be wrong with your device or package."
180	fi
181}
182
183function install_rocksdb() {
184	# Rocksdb is installed for use with the blobfs tests.
185	if [ ! -d /usr/src/rocksdb ]; then
186		git clone "${GIT_REPO_ROCKSDB}" "$GIT_REPOS/rocksdb"
187		git -C "$GIT_REPOS/rocksdb" checkout 6.15.fb
188		sudo mv "$GIT_REPOS/rocksdb" /usr/src/
189	else
190		sudo git -C /usr/src/rocksdb checkout 6.15.fb
191		echo "rocksdb already in /usr/src. Not checking out again"
192	fi
193}
194
195function install_fio() {
196	# This version of fio is installed in /usr/src/fio to enable
197	# building the spdk fio plugin.
198	local fio_version="fio-3.28"
199
200	if [ ! -d /usr/src/fio ]; then
201		if [ ! -d fio ]; then
202			git clone "${GIT_REPO_FIO}" "$GIT_REPOS/fio"
203			sudo mv "$GIT_REPOS/fio" /usr/src/
204		else
205			sudo mv "$GIT_REPOS/fio" /usr/src/
206		fi
207		(
208			git -C /usr/src/fio checkout master \
209				&& git -C /usr/src/fio pull \
210				&& git -C /usr/src/fio checkout $fio_version \
211				&& if [ $OSID == 'freebsd' ]; then
212					gmake -C /usr/src/fio -j${jobs} \
213						&& sudo gmake -C /usr/src/fio install
214				else
215					make -C /usr/src/fio -j${jobs} \
216						&& sudo make -C /usr/src/fio install
217				fi
218		)
219	else
220		echo "fio already in /usr/src/fio. Not installing"
221	fi
222}
223
224function install_flamegraph() {
225	# Flamegraph is used when printing out timing graphs for the tests.
226	if [ ! -d /usr/local/FlameGraph ]; then
227		git clone "${GIT_REPO_FLAMEGRAPH}" "$GIT_REPOS/FlameGraph"
228		mkdir -p /usr/local
229		sudo mv "$GIT_REPOS/FlameGraph" /usr/local/FlameGraph
230	else
231		echo "flamegraph already installed. Skipping"
232	fi
233}
234
235function _install_qemu() {
236	local repo=$1
237	local branch=$2
238	local prefix=${3:-}
239
240	mkdir -p "$GIT_REPOS/qemu"
241
242	local repo_dir=$GIT_REPOS/qemu/$branch
243	if [[ -n $prefix ]]; then
244		repo_dir=$GIT_REPOS/qemu/$prefix-$branch
245	fi
246
247	if [[ ! -d $repo_dir ]]; then
248		git clone "$repo" -b "$branch" "$repo_dir"
249	else
250		echo "qemu already checked out. Skipping"
251	fi
252
253	declare -a opt_params=("--prefix=/usr/local/qemu/${repo_dir##*/}")
254	declare -a extra_cflags=()
255
256	opt_params+=("--disable-docs")
257	if ((gcc_version >= 9)); then
258		# GCC 9 fails to compile Qemu due to some old warnings which were not detected by older versions.
259		extra_cflags+=("-Wno-error=stringop-truncation" "-Wno-error=deprecated-declarations")
260		extra_cflags+=("-Wno-error=incompatible-pointer-types" "-Wno-error=format-truncation")
261		extra_cflags+=("-Wno-error=address-of-packed-member")
262		opt_params+=("--disable-glusterfs")
263	fi
264
265	if ((gcc_version >= 11)); then
266		extra_cflags+=("-Wno-error=array-bounds")
267	fi
268
269	# Most tsocks proxies rely on a configuration file in /etc/tsocks.conf.
270	# If using tsocks, please make sure to complete this config before trying to build qemu.
271	if [[ $INSTALL_TSOCKS == true && $NO_TSOCKS != true ]]; then
272		if hash tsocks 2> /dev/null; then
273			opt_params+=("--with-git='tsocks git'")
274		fi
275	fi
276	opt_params+=("--extra-cflags=${extra_cflags[*]}")
277
278	if [[ $prefix == vanilla ]]; then
279		# Latest qemu seems to take sysconfdir from the prefix and instead of checking /etc
280		# it looks under /usr/local/qemu/vanilla*/bin/../etc which is a bit peculiar. Fix it.
281		opt_params+=("--sysconfdir=/etc/")
282	fi
283
284	# The qemu configure script places several output files in the CWD.
285	(cd "$repo_dir" && ./configure "${opt_params[@]}" --target-list="x86_64-softmmu" --enable-kvm --enable-linux-aio --enable-numa)
286
287	make -C "$repo_dir" -j${jobs}
288	sudo make -C "$repo_dir" install
289}
290
291function install_qemu() {
292	# Four versions of QEMU are used in the tests, three are installed
293	# directly from the source. Each QEMU is dedicated for different
294	# use-cases:
295	#  - Packed QEMU: version provided by given distro. Used to boot VMs
296	#    from within vhost tests.
297	#  - vfio-user QEMU: A special fork to test libvfio-user components.
298	#  - Vanilla QEMU: Used by the CI to boot the testing VMs.
299
300	_install_qemu $GIT_REPO_QEMU_VFIO $VFIO_QEMU_BRANCH
301	_install_qemu "$GIT_REPO_QEMU" "$VANILLA_QEMU_BRANCH" vanilla
302}
303
304function install_nvmecli() {
305	# nvme-cli >1.11.1 should be used.
306	if [[ ! -d $GIT_REPOS/nvme-cli-cuse ]]; then
307		git clone "https://github.com/linux-nvme/nvme-cli.git" "$GIT_REPOS/nvme-cli-cuse"
308	fi
309	git -C "$GIT_REPOS/nvme-cli-cuse" checkout v1.16
310	make -C "$GIT_REPOS/nvme-cli-cuse" CPPFLAGS="-Wno-error=maybe-uninitialized"
311	if [ -d "/usr/local/src/nvme-cli" ]; then
312		sudo rm -rf /usr/local/src/nvme-cli
313	fi
314	sudo mv "$GIT_REPOS/nvme-cli-cuse" /usr/local/src/nvme-cli
315}
316
317function install_libiscsi() {
318	# We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need
319	# to later. Cloning from git is just future proofing the machines.
320	if [[ ! -d $GIT_REPOS/libiscsi ]]; then
321		git clone "${GIT_REPO_LIBISCSI}" "$GIT_REPOS/libiscsi"
322	else
323		echo "libiscsi already checked out. Skipping"
324	fi
325	(cd "$GIT_REPOS/libiscsi" && ./autogen.sh && ./configure --prefix=/usr/local/libiscsi)
326	make -C "$GIT_REPOS/libiscsi" -j${jobs} WARN_CFLAGS=
327	sudo make -C "$GIT_REPOS/libiscsi" install
328}
329
330function install_git() {
331	if type -P git; then
332		if ge "$(git --version | awk '{print $3}')" "$GIT_VERSION"; then
333			return 0
334		fi
335	fi >/dev/null
336
337	install zlib-devel curl-devel
338	tar -C "$GIT_REPOS" -xzof <(wget -qO- "$GIT_REPO_GIT")
339	(cd "$GIT_REPOS/git-$GIT_VERSION" \
340		&& make configure \
341		&& ./configure --prefix=/usr/local/git \
342		&& sudo make -j${jobs} install)
343	sudo sh -c "echo 'export PATH=/usr/local/git/bin:$PATH' >> /etc/bashrc"
344	export "PATH=/usr/local/git/bin:$PATH"
345	# Be nice for vagrant-proxyconf setup
346	mkdir -p "/usr/local/git/etc"
347}
348
349function install_extra_pkgs() {
350	if [[ $INSTALL_QAT == true ]]; then
351		install libudev-devel || install libudev-dev || :
352	fi
353
354	if [[ $INSTALL_QEMU == true ]]; then
355		install qemu-system-x86 qemu-img \
356			|| install qemu-system-x86 qemu-utils \
357			|| install qemu \
358			|| :
359	fi
360}
361
362function install_vagrant() {
363	local vagrant_version="2.2.7"
364	local vagrant_installer="vagrant_${vagrant_version}_x86_64.deb"
365	local vagrant_plugins=(vagrant-libvirt vagrant-sshfs vagrant-cachier vagrant-proxyconf)
366
367	if [[ $OSID != ubuntu ]]; then
368		echo "Currently, Vagrant installation is supported only on ubuntu"
369		return 0
370	fi
371
372	# Install vagrant and it's plugins dependencies
373	# function should be defined in pkgdep/$package_manager file
374	install_vagrant_dependencies
375
376	# Download and install vagrant
377	if hash vagrant &> /dev/null; then
378		echo "Vagrant is already installed"
379	else
380		wget "https://releases.hashicorp.com/vagrant/${vagrant_version}/${vagrant_installer}"
381		sudo dpkg -i "${vagrant_installer}"
382	fi
383	vagrant --version
384
385	# Install vagrant plugins
386	local vagrant_plugin_list
387	vagrant_plugin_list=$(vagrant plugin list)
388
389	local plugin
390	for plugin in "${vagrant_plugins[@]}"; do
391		if grep -Fq "$plugin" <<< "$vagrant_plugin_list"; then
392			echo "$plugin already installed"
393		else
394			vagrant plugin install "$plugin"
395		fi
396	done
397}
398
399function install_igb_uio() {
400	git clone "${GIT_REPO_DPDK_KMODS}" "$GIT_REPOS/dpdk-kmods"
401	(cd "$GIT_REPOS/dpdk-kmods/linux/igb_uio" && make -j ${jobs})
402	sudo mkdir -p "/lib/modules/$(uname -r)/extra/dpdk"
403	sudo cp "$GIT_REPOS/dpdk-kmods/linux/igb_uio/igb_uio.ko" "/lib/modules/$(uname -r)/extra/dpdk"
404	sudo depmod
405}
406
407function install_irdma() {
408	local RDMA_CORE_VERSION=35.0
409	local RDMA_CORE=https://github.com/linux-rdma/rdma-core/releases/download/v$RDMA_CORE_VERSION/rdma-core-$RDMA_CORE_VERSION.tar.gz
410
411	if [[ $ID != fedora ]]; then
412		echo "Installation of the irdma can be attempted only on Fedora"
413		return 0
414	fi
415
416	# Install extra dependencies needed by the rdma-core-35.0
417	install ninja-build pandoc perl-generators valgrind-devel python-docutils libnl3 libnl3-devel python3-Cython
418
419	rm -rf "$GIT_REPOS/irdma-$IRDMA_VERSION"
420	rm -rf "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION"
421
422	curl -L -o- "$IRDMA_DRIVER" | tar -C "$GIT_REPOS" -xzf -
423	[[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/build.sh ]]
424
425	(
426		cd "$GIT_REPOS/irdma-$IRDMA_VERSION"
427		sed -i "s/IRDMA_FLUSH_DELAY_MS 1500/IRDMA_FLUSH_DELAY_MS 50/" \
428			"$GIT_REPOS/irdma-$IRDMA_VERSION/src/irdma/verbs.h"
429		"$GIT_REPOS/irdma-$IRDMA_VERSION/build.sh"
430	)
431
432	# Fetch and build the rdma-core irdma depends on
433	curl -L -o- "$RDMA_CORE" | tar -C "$GIT_REPOS" -xzf -
434	[[ -e $GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch ]]
435
436	patch --dir="$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION" -p2 \
437		< "$GIT_REPOS/irdma-$IRDMA_VERSION/libirdma-$RDMA_CORE_VERSION.patch"
438
439	# Note that paths and the name of the package are hardcoded into .spec, hence they need to stay like this.
440	[[ -e $GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec ]]
441	mkdir -p "$HOME/rpmbuild/"{SOURCES,SPECS}
442	cp "$GIT_REPOS/rdma-core-$RDMA_CORE_VERSION/redhat/rdma-core.spec" "$HOME/rpmbuild/SPECS"
443
444	# Re-package the source
445	tar -czf "$HOME/rpmbuild/SOURCES/rdma-core-$RDMA_CORE_VERSION.tgz" -C "$GIT_REPOS" "rdma-core-$RDMA_CORE_VERSION"
446
447	# Build the rpms
448	(
449		cd "$HOME/rpmbuild/SPECS"
450		# Make sure stock ninja-build is used
451		PATH="/usr/bin:$PATH" rpmbuild -ba rdma-core.spec
452	)
453
454	# Now, don't install the packages since this will, most likely, conflict with packages already installed
455	# in the system. Instead, simply inform user what the next step is and note what potential issues it may
456	# have with the installation.
457
458	shopt -s nullglob
459	local rpms=("$HOME/rpmbuild/RPMS/x86_64/"*.rpm)
460	shopt -u nullglob
461	((${#rpms[@]} > 0))
462
463	cat <<-EOF
464
465		INFO: rdma-core-$RDMA_CORE_VERSION was successfully built, following packages are
466		available for installation:
467
468		$(printf '  - %s\n' "${rpms[@]##*/}")
469
470		Note that installing the above packages may raise conflicts with their
471		potentially newer versions already installed on the system. Dependent
472		packages may be uninstalled during the process as well. Please, run the
473		following command to finish the installation:
474
475		  $package_manager install [--allowerasing] $HOME/rpmbuild/RPMS/x86_64/*.rpm
476
477	EOF
478}
479
480function install_ice() {
481	rm -rf "$GIT_REPOS/ice-$ICE_VERSION"
482
483	curl -L -o- "$ICE_DRIVER" | tar -C "$GIT_REPOS" -xzf -
484
485	if [[ $OSID == ubuntu && $OSVERSION == 18.04 ]]; then
486		if ge "$(< /proc/sys/kernel/osrelease)" 4.15.0-159; then
487			patch --dir="$GIT_REPOS/ice-$ICE_VERSION" -p1
488		fi < "$rootdir/test/common/config/pkgdep/patches/ice/0001-undef-skb-frag-off.patch"
489	fi
490
491	if ge "$(< /proc/sys/kernel/osrelease)" 5.15.0; then
492		patch --dir="$GIT_REPOS/ice-$ICE_VERSION" -p1
493	fi < "$rootdir/test/common/config/pkgdep/patches/ice/0001-devlink.patch"
494
495	(
496		cd "$GIT_REPOS/ice-$ICE_VERSION/src"
497		sudo make -j"$(nproc)" install
498	)
499}
500
501function install_lcov() {
502	local lcov_version=v1.15
503
504	rm -rf /usr/src/lcov
505	sudo git clone "$GIT_REPO_LCOV" --branch "$lcov_version" /usr/src/lcov
506	(cd /usr/src/lcov; sudo make install)
507}
508
509function install_sources() {
510	if [[ $ID == centos ]] && (( VERSION_ID == 7 )); then
511		# install proper version of the git first
512		install_git
513	fi
514
515	IFS="," read -ra conf_env <<< "$CONF"
516	for conf in "${conf_env[@]}"; do
517		export "INSTALL_${conf^^}=true"
518	done
519
520	if [[ $OSID == freebsd ]]; then
521		jobs=$(($(sysctl -n hw.ncpu) * 2))
522	else
523		jobs=$(($(nproc) * 2))
524		sources+=(
525			install_irdma
526			install_libiscsi
527			install_nvmecli
528			install_qat
529			install_rocksdb
530			install_flamegraph
531			install_qemu
532			install_igb_uio
533			install_ice
534			install_lcov
535		)
536		install_extra_pkgs
537	fi
538	sources+=(install_fio)
539	sources+=(install_vagrant)
540	sources+=(install_spdk)
541
542	sudo mkdir -p /usr/{,local}/src
543	sudo mkdir -p "$GIT_REPOS"
544
545	for source in "${sources[@]}"; do
546		source_conf=${source^^}
547		if [[ ${!source_conf} == true ]]; then
548			"$source"
549		fi
550	done
551
552	if [[ $INSTALL_REFSPDK == true ]]; then
553		# Serialize builds as refspdk depends on spdk
554		[[ $INSTALL_SPDK != true ]] && install_spdk
555		install_refspdk latest
556		install_refspdk LTS
557	fi
558}
559
560GIT_VERSION=2.25.1
561IRDMA_VERSION=1.7.72
562ICE_VERSION=1.7.16
563VFIO_QEMU_BRANCH=${VFIO_QEMU_BRANCH:-vfio-user-v0.93}
564VANILLA_QEMU_BRANCH=${VANILLA_QEMU_BRANCH:-v6.0.0}
565
566: ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git}
567export GIT_REPO_SPDK
568: ${GIT_REPO_DPDK=https://github.com/spdk/dpdk.git}
569export GIT_REPO_DPDK
570: ${GIT_REPO_ROCKSDB=https://review.spdk.io/spdk/rocksdb}
571export GIT_REPO_ROCKSDB
572: ${GIT_REPO_FIO=https://github.com/axboe/fio.git}
573export GIT_REPO_FIO
574: ${GIT_REPO_FLAMEGRAPH=https://github.com/brendangregg/FlameGraph.git}
575export GIT_REPO_FLAMEGRAPH
576: ${GIT_REPO_QEMU=https://github.com/qemu/qemu}
577export GIT_REPO_QEMU
578: ${GIT_REPO_QEMU_VFIO=https://github.com/oracle/qemu}
579export GIT_REPO_QEMU_VFIO
580: ${GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi}
581export GIT_REPO_LIBISCSI
582: ${GIT_REPO_INTEL_IPSEC_MB=https://github.com/spdk/intel-ipsec-mb.git}
583export GIT_REPO_INTEL_IPSEC_MB
584: ${DRIVER_LOCATION_QAT=https://01.org/sites/default/files/downloads//qat1.7.l.4.12.0-00011.tar.gz}
585export DRIVER_LOCATION_QAT
586: ${GIT_REPO_GIT=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz}
587export GIT_REPO_GIT
588: ${GIT_REPO_DPDK_KMODS=http://dpdk.org/git/dpdk-kmods}
589export GIT_REPO_DPDK_KMODS
590: ${IRDMA_DRIVER=https://downloadmirror.intel.com/709709/irdma-$IRDMA_VERSION.tgz}
591export IRDMA_DRIVER
592: ${ICE_DRIVER="https://sourceforge.net/projects/e1000/files/ice%20stable/$ICE_VERSION/ice-$ICE_VERSION.tar.gz"}
593export ICE_DRIVER
594: ${GIT_REPO_LCOV=https://github.com/linux-test-project/lcov}
595export GIT_REPO_LCOV
596GIT_REPOS=${GIT_REPOS:-$HOME}
597
598gcc_version=$(gcc -dumpversion) gcc_version=${gcc_version%%.*}
599