Skip to content
Draft
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
112 changes: 112 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Packaging

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
# Build and validate DEB package on Ubuntu
build-deb-package:
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y nasm cmake

- name: Checkout repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRARY_ONLY=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release --parallel

- name: Create DEB package
working-directory: ${{github.workspace}}/build
run: cpack -G DEB

- name: Validate DEB package
working-directory: ${{github.workspace}}/build
run: |
# List generated packages
ls -la *.deb
# Get package info
dpkg-deb --info *.deb
# List package contents
dpkg-deb --contents *.deb

- name: Test DEB package installation
working-directory: ${{github.workspace}}/build
run: |
# Install the package
sudo dpkg -i *.deb
# Verify library is installed
sudo ldconfig -p | grep -i ipsec || true
ls -la /usr/local/lib*/libIPSec* || ls -la /usr/lib*/libIPSec* || true

- name: Test building against installed library
working-directory: ${{github.workspace}}/examples/burst-app
run: |
gcc main.c -lIPSec_MB

- name: Test package removal
run: |
# Remove the package
sudo dpkg -r intel-ipsec-mb

- name: Upload DEB package artifact
if: ${{ github.repository == 'intel/intel-ipsec-mb' }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: deb-package
path: ${{github.workspace}}/build/*.deb
retention-days: 7

# Build and validate RPM package on Ubuntu (using alien or building on Fedora)
build-rpm-package:
runs-on: ubuntu-latest

steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y nasm cmake rpm

- name: Checkout repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRARY_ONLY=ON

- name: Build
run: cmake --build ${{github.workspace}}/build --config Release --parallel

- name: Create RPM package
working-directory: ${{github.workspace}}/build
run: cpack -G RPM

- name: Validate RPM package
working-directory: ${{github.workspace}}/build
run: |
# List generated packages
ls -la *.rpm
# Get package info
rpm -qip *.rpm
# List package contents
rpm -qlp *.rpm

- name: Upload RPM package artifact
if: ${{ github.repository == 'intel/intel-ipsec-mb' }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: rpm-package
path: ${{github.workspace}}/build/*.rpm
retention-days: 7
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ endif()

# add custom target to print help information
imb_add_target_print_help("${IPSEC_MB_OPTIONS}")

# ##############################################################################
# configure CPack for package generation
# ##############################################################################

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack.cmake")
87 changes: 87 additions & 0 deletions cmake/cpack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# cmake-format: off
# Copyright (c) 2025, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Intel Corporation nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# cmake-format: on

# ##############################################################################
# CPack configuration for intel-ipsec-mb
# ##############################################################################

# Common package settings
set(CPACK_PACKAGE_NAME "intel-ipsec-mb")
set(CPACK_PACKAGE_VENDOR "Intel Corporation")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Intel(R) Multi-Buffer Crypto for IPsec Library")
set(CPACK_PACKAGE_DESCRIPTION
"Intel(R) Multi-Buffer Crypto for IPsec Library is highly-optimized \
software implementations of the core cryptographic processing for IPsec, \
which provides industry-leading performance on a range of Intel(R) Processors.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/intel/intel-ipsec-mb")
set(CPACK_PACKAGE_VERSION ${IPSEC_MB_VERSION_FULL})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_STRIP_FILES ON)
set(CPACK_PACKAGE_RELOCATABLE ON)

# Set package file name
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}"
)

# ##############################################################################
# Linux-specific CPack configuration (DEB and RPM)
# ##############################################################################
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# DEB package configuration
set(CPACK_DEBIAN_PACKAGE_NAME "libipsec-mb${CPACK_PACKAGE_VERSION_MAJOR}")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "nasm (>= 2.14)")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_PACKAGE_HOMEPAGE_URL}")
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)

# RPM package configuration
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set(CPACK_RPM_PACKAGE_REQUIRES "nasm >= 2.14")
set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
set(CPACK_RPM_PACKAGE_URL "${CPACK_PACKAGE_HOMEPAGE_URL}")
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
# Disable debuginfo package
set(CPACK_RPM_DEBUGINFO_PACKAGE OFF)
set(CPACK_RPM_PACKAGE_DEBUG OFF)

# Set generators for Linux
set(CPACK_GENERATOR "DEB;RPM")
endif()

# Include CPack module (must be after all CPACK_* variables are set)
include(CPack)
Loading