Commit 1e46e023 authored by Maciej Mis's avatar Maciej Mis Committed by Tomasz Zawadzki
Browse files

go/rpc: Build configuration for go-rpc folder



Introduces new flags in configuration:
--with-golang
--without-golang

Change-Id: I5783b4ddfa53fc34ef7e921a6ee2aae0f4aadd44
Signed-off-by: default avatarMaciej Mis <maciej.mis@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19774


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent a5ea50e7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -226,3 +226,6 @@ CONFIG_AVAHI=n

# Setup DPDK's RTE_MAX_LCORES
CONFIG_MAX_LCORES=

# Build all Go components
CONFIG_GOLANG=n
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ DIRS-$(CONFIG_ISAL_CRYPTO) += isalcryptobuild
DIRS-$(CONFIG_VFIO_USER) += vfiouserbuild
DIRS-$(CONFIG_SMA) += proto
DIRS-$(CONFIG_XNVME) += xnvmebuild
DIRS-$(CONFIG_GOLANG) += go/rpc
DIRS-y += python

.PHONY: all clean $(DIRS-y) include/spdk/config.h mk/config.mk \
+16 −0
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ function usage() {
	echo " --without-sma             No path required."
	echo " --with-avahi              Build with Avahi mDNS discovery client service enabled in bdev-nvme module."
	echo " --without-avahi           No path required."
	echo " --with-golang             Build with components written in Go"
	echo " --without-golang          No path required."
	echo ""
	echo "Environment variables:"
	echo ""
@@ -658,6 +660,12 @@ for i in "$@"; do
		--without-avahi)
			CONFIG[AVAHI]=n
			;;
		--with-golang)
			CONFIG[GOLANG]=y
			;;
		--without-golang)
			CONFIG[GOLANG]=n
			;;
		--max-lcores='')
			echo "Must specify max number of lcores for --max-lcores"
			usage
@@ -1270,6 +1278,14 @@ if [[ "${CONFIG[AVAHI]}" = "y" ]]; then
	fi
fi

if [[ "${CONFIG[GOLANG]}" = "y" ]]; then
	if ! go version 2> /dev/null; then
		echo "--with-golang requires Go installation."
		echo "Please install then re-run this script."
		exit 1
	fi
fi

if [[ -n ${CONFIG[MAX_LCORES]} ]]; then
	if [[ ! ${CONFIG[MAX_LCORES]} =~ ^([1-9][0-9]*|detect)$ ]] || ((CONFIG[MAX_LCORES] > 1024)); then
		echo "ERROR: Max number of lcores must be a decimal number in range [1..1024] or 'detect' (given: ${CONFIG[MAX_LCORES]})"

go/rpc/Makefile

0 → 100644
+19 −0
Original line number Diff line number Diff line
#  SPDX-License-Identifier: BSD-3-Clause
#  Copyright (C) 2023 Intel Corporation.
#  All rights reserved.
#

SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CLIENT_BUILD_DIR = $(SPDK_ROOT_DIR)/build/go/rpc
CLIENT_SRC := $(wildcard $(CURDIR)/*.go $(CURDIR)/client/*.go)

.PHONY: all clean

CGOFLAGS=-trimpath -mod=readonly -gcflags="all=-spectre=all -N -l" -asmflags="all=-spectre=all" -buildmode=c-shared -ldflags="all=-s -w"

all: $(CLIENT_SRC)
	$(Q)go build $(CGOFLAGS) -o $(CLIENT_BUILD_DIR)/libspdk_gorpc.so clientIntegration.go

clean:
	$(Q)rm -rf $(CLIENT_BUILD_DIR)
+5 −0
Original line number Diff line number Diff line
@@ -395,3 +395,8 @@ if [[ -e "$CONFIG_WPDK_DIR/bin/wpdk_common.sh" ]]; then
	# handler before causing a hard stop with TerminateProcess.
	source "$CONFIG_WPDK_DIR/bin/wpdk_common.sh"
fi

# Make sure we have access to proper binaries installed in pkgdep/common.sh
if [[ -e /etc/opt/spdk-pkgdep/paths/export.sh ]]; then
	source /etc/opt/spdk-pkgdep/paths/export.sh
fi > /dev/null
Loading