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

Add a debian package symcrypt-openssl-dbg #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion rules/symcrypt-openssl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
SYMCRYPT_OPENSSL_VERSION = 0.1
SYMCRYPT_OPENSSL = symcrypt-openssl_$(SYMCRYPT_OPENSSL_VERSION)_$(ARCH).deb
$(SYMCRYPT_OPENSSL)_SRC_PATH = $(SRC_PATH)/SymCrypt-OpenSSL-Debian
$(SYMCRYPT_OPENSSL)_MAKEFILE = Makefile

MAIN_TARGETS += $(SYMCRYPT_OPENSSL)
$(SYMCRYPT_OPENSSL)_DERIVED_DEBS += symcrypt-openssl-dbg_$(SYMCRYPT_OPENSSL_VERSION)_$(ARCH).deb
1 change: 1 addition & 0 deletions src/SymCrypt-OpenSSL-Debian/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp
bin_*
66 changes: 0 additions & 66 deletions src/SymCrypt-OpenSSL-Debian/Makefile

This file was deleted.

8 changes: 8 additions & 0 deletions src/SymCrypt-OpenSSL-Debian/debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*.debhelper*
/*substvars
/build-deb
/build-udeb
/files
/tmp
/symcrypt-openssl
/symcrypt-openssl-dbg
5 changes: 5 additions & 0 deletions src/SymCrypt-OpenSSL-Debian/debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
symcrypt-openssl (0.1) bullseye; urgency=medium

* Init the SymCrypt-OpenSSL package

-- Xuhui Miao <[email protected]> Mon, 27 Dec 2021 17:43:39 +0100
1 change: 1 addition & 0 deletions src/SymCrypt-OpenSSL-Debian/debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
21 changes: 18 additions & 3 deletions src/SymCrypt-OpenSSL-Debian/debian/control
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
Source: symcrypt-openssl
Section: libdevel
Priority: optional
Maintainer: SONiC <[email protected]>
Build-Depends: debhelper (>= 9)

Package: symcrypt-openssl
Version: 0.1
Section: devel
Section: libdevel
Priority: optional
Architecture: all
Architecture: any
Depends:
Maintainer: SONiC <[email protected]>
Description: symcrypt openssl
Symcrypt Openssl Engine.

Package: symcrypt-openssl-dbg
Section: libdevel
Architecture: any
Priority: extra
Depends:
Maintainer: SONiC <[email protected]>
Build-Depends: debhelper (>= 9)
Description: symcrypt openssl
Symcrypt Openssl Engine.
64 changes: 64 additions & 0 deletions src/SymCrypt-OpenSSL-Debian/debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/make -f

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

ARCH ?= amd64
CMAKE_ARCH = AMD64
LIB_INSTALL_NAME = x86_64-linux-gnu
ifeq ($(ARCH), arm64)
CMAKE_ARCH = ARM64
LIB_INSTALL_NAME = aarch64-linux-gnu
else ifeq ($(ARCH), armhf)
CMAKE_ARCH = ARMHF
LIB_INSTALL_NAME = arm-linux-gnueabihf
endif

pn = symcrypt-openssl
pn_dbg = $(pn)-dbg


DEST ?= ../../target
#LIBSYMCRYPT = $(DEST)/libsymcrypt.so
#LIBSYMCRYPTENGINE = $(DEST)/libsymcryptengine.so

LIBSYMCRYPT = bin_sym/module/$(CMAKE_ARCH)/LinuxUserMode/generic_linux/libsymcrypt.so
LIBSYMCRYPTENGINE = bin_eng/SymCryptEngine/dynamic/libsymcryptengine.so

clean:
rm bin_* -rf
rm debian/symcrypt-openssl -rf
rm debian/symcrypt-openssl-dbg -rf

$(LIBSYMCRYPT):
mkdir -p bin_sym
cd bin_sym
cmake -DCMAKE_BUILD_TYPE=Release ../../SymCrypt -DCMAKE_TOOLCHAIN_FILE=../../SymCrypt/cmake-toolchain/LinuxUserMode-$(CMAKE_ARCH).cmake
cmake --build .

$(LIBSYMCRYPTENGINE): $(LIBSYMCRYPT)
cp $(LIBSYMCRYPT) ../SymCrypt-OpenSSL/
ln -sf $(shell pwd)/../SymCrypt ~/SymCrypt
mkdir -p bin_eng
cd bin_eng
cmake ../../SymCrypt-OpenSSL -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../../SymCrypt-OpenSSL/cmake-toolchain/LinuxUserMode-$(CMAKE_ARCH).cmake
cmake --build .

build: $(LIBSYMCRYPTENGINE)
mkdir -p debian/symcrypt-openssl/usr/lib/$(LIB_INSTALL_NAME)
mkdir -p debian/symcrypt-openssl/usr/lib/ssl
cp $(LIBSYMCRYPT) $(LIBSYMCRYPTENGINE) debian/symcrypt-openssl/usr/lib/$(LIB_INSTALL_NAME)/
chmod 644 debian/symcrypt-openssl/usr/lib/$(LIB_INSTALL_NAME)/*
cp openssl.cnf debian/symcrypt-openssl/usr/lib/ssl/symcrypt-openssl.cnf

install: build
dh_installdeb

binary-arch: build install
# Exclude to strip the libsymcrypt.so, core dump error if stripped
dh_strip -a -N$(pn_dbg) -Xlibsymcrypt.so -Xdebug -Xdbg --dbg-package=$(pn_dbg)

binary: binary-arch
dh_gencontrol
dh_builddeb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ case "$1" in
;;
esac

if [ -f "/usr/lib/ssl/openssl.cnf" ]; then
if [ -f "/usr/lib/ssl/openssl.cnf" ] && ! grep -q symcryptengine /usr/lib/ssl/openssl.cnf; then
echo "Move to the old /usr/lib/ssl/openssl.cnf to /usr/lib/ssl/openssl.cnf.bk"
mv -f /usr/lib/ssl/openssl.cnf /usr/lib/ssl/openssl.cnf.bk
fi

mv -f /usr/lib/ssl/openssl-fips.cnf /usr/lib/ssl/openssl.cnf
mv -f /usr/lib/ssl/symcrypt-openssl.cnf /usr/lib/ssl/openssl.cnf