Skip to content

Fix debian/rules makefile: use shell commands instead of dollar replacements #621

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

Merged
merged 4 commits into from
Jun 6, 2020
Merged
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
17 changes: 11 additions & 6 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -x

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
Expand Down Expand Up @@ -34,19 +38,19 @@ build:
binary: binary-syncd-rpc binary-syncd

binary-syncd:
$(shell echo > /tmp/syncd-build)
echo > /tmp/syncd-build
dh clean --with autotools-dev
dh build -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
dh binary -N syncd-rpc -N syncd-rpc-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

binary-syncd-rpc: | binary-syncd
$(shell echo '--enable-rpcserver=yes' > /tmp/syncd-build)
echo '--enable-rpcserver=yes' > /tmp/syncd-build
dh clean --with autotools-dev
dh build -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev
dh binary -N syncd -N syncd-dbg -N syncd-vs -N syncd-vs-dbg --with autotools-dev

binary-syncd-vs:
$(shell echo '--with-sai=vs' > /tmp/syncd-build)
echo '--with-sai=vs' > /tmp/syncd-build
dh clean --with autotools-dev
dh build -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev
dh binary -N syncd -N syncd-dbg -N syncd-rpc -N syncd-rpc-dbg --with autotools-dev
Expand All @@ -63,9 +67,10 @@ override_dh_auto_configure:

override_dh_install:
dh_install
ifeq ($(shell cat /tmp/syncd-build), --enable-rpcserver=yes)
sed -i 's|ENABLE_SAITHRIFT=0|ENABLE_SAITHRIFT=1 # Add a comment to fix https://github.com/Azure/sonic-buildimage/issues/2694 |' debian/syncd-rpc/usr/bin/syncd_init_common.sh
endif
# Note: escape $ with an extra $ symbol
if egrep -q '(^| )--enable-rpcserver=yes( |$$)' /tmp/syncd-build && [ -f debian/syncd-rpc/usr/bin/syncd_init_common.sh ] ; then
sed -i 's|ENABLE_SAITHRIFT=0|ENABLE_SAITHRIFT=1 # Add a comment to fix https://github.com/Azure/sonic-buildimage/issues/2694 |' debian/syncd-rpc/usr/bin/syncd_init_common.sh
fi

override_dh_installinit:
dh_installinit --init-script=syncd
Expand Down