Skip to content

Commit

Permalink
Add packaging for syncd-rpc (sonic-net#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-shirshov authored Apr 19, 2017
1 parent e28e4c0 commit 230f322
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 17 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
sonic (1.0.0) stable; urgency=medium

* syncd-rpc is added

-- Pavel Shirshov <pavelsh@microsoft.com> Wed, 12 Apr 2017 12:00:00 -0800

sonic (1.0.0) stable; urgency=medium

* Initial release.
Expand Down
6 changes: 6 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Architecture: any
Description: This package contains sync daemon for SONiC project.
This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI.

Package: syncd-rpc
Architecture: any
Description: This package contains sync daemon with rpc for SONiC project.
This sync daemon syncs the ASIC_DB in Redis database and the real ASIC via SAI.
This daemon contains saithrift rpc library for remote control of an ASIC.

Package: libsairedis
Architecture: any
Section: libs
Expand Down
39 changes: 26 additions & 13 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,43 @@ include /usr/share/dpkg/default.mk
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# main packaging script based on dh7 syntax
%:
dh $@ --with autotools-dev
clean:
dh $@ --with autotools-dev

build:
echo build stage is skipped. Please use binary to generate debian packages

binary: binary-syncd binary-syncd-rpc

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

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

# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

ifeq ($(findstring --enable-rpcserver=yes,${CONFIGURE_ARGS}),--enable-rpcserver=yes)
saithrift = yes
else
saithrift = no
endif

override_dh_auto_configure:
dh_auto_configure -- ${CONFIGURE_ARGS}
./autogen.sh
dh_auto_configure -- $(shell cat /tmp/syncd-build)

override_dh_installinit:
ifeq ($(saithrift), yes)
sed -i 's/ENABLE_SAITHRIFT=0/ENABLE_SAITHRIFT=1/' debian/syncd.init
ifeq ($(shell cat /tmp/syncd-build), --enable-rpcserver=yes)
sed -i 's/ENABLE_SAITHRIFT=0/ENABLE_SAITHRIFT=1/' debian/syncd-rpc.init
else
sed -i 's/ENABLE_SAITHRIFT=1/ENABLE_SAITHRIFT=0/' debian/syncd.init
endif
dh_installinit
dh_installinit --init-script=syncd

override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
1 change: 1 addition & 0 deletions debian/syncd-rpc.dirs
1 change: 1 addition & 0 deletions debian/syncd-rpc.init
1 change: 1 addition & 0 deletions debian/syncd-rpc.install
6 changes: 2 additions & 4 deletions syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ syncd_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) $(SAIFLAGS)
syncd_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata

if SAITHRIFT
SAI_RPC_INCLUDE_DIR = ../libsaiserver/include
SAI_RPC_LIB_DIR = ../libsaiserver/lib
syncd_CPPFLAGS += -I$(SAI_RPC_INCLUDE_DIR) -DSAITHRIFT=yes
syncd_LDADD += -L$(SAI_RPC_LIB_DIR) -lrpcserver -lthrift
syncd_CPPFLAGS += -DSAITHRIFT=yes
syncd_LDADD += -lrpcserver -lthrift
endif

syncd_request_shutdown_SOURCES = syncd_request_shutdown.cpp
Expand Down

0 comments on commit 230f322

Please sign in to comment.