Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pkg-config for Python linking and use OpenSSL #133

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions CLI/klish/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ SHELL = /bin/bash
.SHELLFLAGS += -e

KLISH_VERSION = 2.1.4
PYTHONVER=3.7

KLISH_SRC = $(SONIC_CLI_ROOT)/klish-$(KLISH_VERSION)

# Python changed how to link against Python for embedding purposes in 3.8
# which means that in order to support both Debian 10 and Debian >=11
# we need to try two alternatives.
CFLAGS_PYTHON := $(shell pkg-config --silence-errors --cflags python3-embed || pkg-config --cflags python3)
LDFLAGS_PYTHON := $(shell pkg-config --silence-errors --libs python3-embed || pkg-config --libs python3)
LDFLAGS_CURL := $(shell pkg-config --libs libcurl)

ifeq ($(CROSS_BUILD_ENVIRON),y)
CROSS_CONFIGURE_OPTS = --host=$(CROSS_HOST_TYPE)
LIB_PATH = $(CROSS_PKGS_LIB_PATH)
Expand All @@ -19,7 +25,16 @@ all : $(SRC_REPLACEMENTS)
tar xzvf klish-$(KLISH_VERSION).tgz -C $(SONIC_CLI_ROOT)
./patches/scripts/patchmake.sh -p VER=${KLISH_VERSION} TSP=${SONIC_CLI_ROOT} DSP=${CURDIR}/patches TWP=${SONIC_CLI_ROOT}

cd ${KLISH_SRC} && sh autogen.sh && ./configure --with-libxml2=/usr $(CROSS_CONFIGURE_OPTS) --enable-debug=no LIBS='-l:libcurl-gnutls.so.4 -L$(LIB_PATH) -lpython3.7m -Wl,-rpath=$(LIB_PATH) -lcjson' CFLAGS='${CFLAGS} -g -I/usr/include/python3.7m' CPPFLAGS='${CPPFLAGS} -I/usr/include/cjson' && make
cd ${KLISH_SRC} && \
sh autogen.sh && \
./configure \
--with-libxml2=/usr \
$(CROSS_CONFIGURE_OPTS) \
--enable-debug=no \
LIBS='$(LDFLAGS_CURL) -L$(LIB_PATH) $(LDFLAGS_PYTHON) -Wl,-rpath=$(LIB_PATH) -lcjson' \
CFLAGS='${CFLAGS} -g $(CFLAGS_PYTHON)' \
CPPFLAGS='${CPPFLAGS} -I/usr/include/cjson' && \
make

mkdir -p $(SONIC_CLI_ROOT)/target/.libs
cp $(CURDIR)/clish_start $(SONIC_CLI_ROOT)/target/.
Expand Down
2 changes: 1 addition & 1 deletion tools/test/apt_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
libcurl3-gnutls
libcurl4-openssl-dev
libcjson-dev
2 changes: 0 additions & 2 deletions tools/test/cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export SHOW_CONFIG_TOOLS=$CLIBUILD/render-templates
#export CLISH_PATH=$CLISOURCE/clitree/cli-xml
export CLISH_PATH=$CLIBUILD/command-tree

export PYTHONVER=3.7

# KLISH_BIN can be set to use klish exe and libs from other directory.
if [[ -z ${KLISH_BIN} ]]; then
if [[ -f ${CLIBUILD}/clish ]]; then
Expand Down
Loading