Skip to content

Commit

Permalink
[dash] Add libsai-debs target to create libsai debian packages (#444)
Browse files Browse the repository at this point in the history
Will create libsai and libsai-dev packages for usage in other projects
  • Loading branch information
kcudnik authored Sep 23, 2023
1 parent b63705c commit a3dd8f4
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dash-pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ SAI/lib/libsai.so: sai-headers sai-meta
libsai-clean:
rm -rf SAI/lib/*

libsai-debs: libsai
@echo "build dash libsai debian packages ..."
cd SAI/debian && make

.PHONY: libsai-debs-clean
libsai-debs-clean:
cd SAI/debian && make clean

.PHONY:sai-clean
sai-clean: SAI/SAI libsai-clean saithrift-server-clean
@echo "Restoring SAI subdirectories to baseline..."
Expand Down
3 changes: 3 additions & 0 deletions dash-pipeline/SAI/debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.deb
**/usr
**/DEBIAN/md5sums
29 changes: 29 additions & 0 deletions dash-pipeline/SAI/debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# TODO lib directory could be changed to /usr/local/lib

VERSION=1.0.0

all: debs

debs: libsai-dev_$(VERSION)_amd64.deb libsai_$(VERSION)_amd64.deb

libsai-dev_$(VERSION)_amd64.deb: ../SAI/inc/*.h ../SAI/experimental/*.h
mkdir -p -m 755 libsai-dev_$(VERSION)_amd64/usr/include/sai
find -type d |xargs chmod go-w
install -vCD -m 644 ../SAI/inc/*.h libsai-dev_$(VERSION)_amd64/usr/include/sai/
install -vCD -m 644 ../SAI/experimental/*.h libsai-dev_$(VERSION)_amd64/usr/include/sai/
cd libsai-dev_$(VERSION)_amd64 && find usr -type f | xargs md5sum > DEBIAN/md5sums
dpkg-deb --build --root-owner-group libsai-dev_$(VERSION)_amd64

libsai_$(VERSION)_amd64.deb: ../lib/libsai.so
mkdir -p -m 755 libsai_$(VERSION)_amd64/usr/lib/x86_64-linux-gnu/
find -type d |xargs chmod go-w
install -vCD ../lib/libsai.so libsai_$(VERSION)_amd64/usr/lib/x86_64-linux-gnu/libsai.so
cd libsai_$(VERSION)_amd64 && find usr -type f | xargs md5sum > DEBIAN/md5sums
dpkg-deb --build --root-owner-group libsai_$(VERSION)_amd64

.PHONY: clean

clean:
rm -f *.deb */DEBIAN/md5sums
rm -rf libsai_$(VERSION)_amd64/usr libsai-dev_$(VERSION)_amd64/usr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: libsai-dev
Source: dash
Version: 1.0.0
Architecture: amd64
Maintainer: Kamil Cudnik <[email protected]>
Section: libdevel
Priority: optional
Description: This package contains development files for DASH libsai
8 changes: 8 additions & 0 deletions dash-pipeline/SAI/debian/libsai_1.0.0_amd64/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Package: libsai
Source: dash
Version: 1.0.0
Architecture: amd64
Maintainer: Kamil Cudnik <[email protected]>
Section: libs
Priority: optional
Description: This package contains DASH libsai
1 change: 1 addition & 0 deletions dash-pipeline/SAI/debian/libsai_1.0.0_amd64/DEBIAN/shlibs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libsai 0 libsai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
activate-noawait ldconfig

0 comments on commit a3dd8f4

Please sign in to comment.