Provide DEB or RPM
For Linux, we can consider to provide DEB or RPM.
Working on it
@seladb @tigercosmos How to provide the deb file?
@seladb @tigercosmos I have made the deb file. The name of the deb file is pcapplusplus_25.05_amd64.deb I have written a small test:
// file: test.cpp
#include <PcapLiveDeviceList.h>
#include
int main() { auto devList = pcpp::PcapLiveDeviceList::getInstance().getPcapLiveDevicesList(); std::cout << "Found " << devList.size() << " network devices.\n"; }
Compilation:
g++ test.cpp -o test_app
-lPcap++ -lPacket++ -lCommon++ -lpcap
-I/usr/local/include/pcapplusplus -L/usr/local/lib
Ouput:
Thank you @bhaskarbhar for working on it! 🙏
Where is your DEB file hosted? I think we'd like to add it to every release from now on, so we need to add building the DEB/RPM to our CI (probably to package.yml), and make sure they are included in the release.
Please let me know what you think.
@seladb We can also think about how we can put PCPP into the apt source list.
@seladb @tigercosmos
https://github.com/bhaskarbhar/PcapPlusPlus/releases/tag/v25.05-deb
@seladb @tigercosmos I created the .deb using the following steps:
cd PcapPlusPlus
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make install DESTDIR=$PWD/install-root
cd install-root
mkdir -p DEBIAN
cat <<EOF > DEBIAN/control
Package: pcapplusplus
Version: 25.05
Section: libs
Architecture: amd64
Maintainer: Bhaskar Bhar <[email protected]>
Description: PcapPlusPlus - C++ library for packet parsing and crafting
EOF
dpkg-deb --build install-root pcapplusplus_25.05_amd64.deb
For CI, I we can automate this in package.yml using the same steps to build .deb.
@seladb For CI I have written a package.yml, I dont know, this is correct or not. Need your support:
name: Build and Release DEB Package
on:
release:
types: [published]
jobs:
build-deb:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends cmake make g++ libpcap-dev
- name: Build project
run: |
mkdir build
cd build
cmake ..
make -j$(nproc)
make install DESTDIR=$PWD/install-root
- name: Create DEB control file
run: |
cd build/install-root
mkdir -p DEBIAN
cat <<EOF > DEBIAN/control
Package: pcapplusplus
Version: ${{ github.event.release.tag_name }}
Section: libs
Architecture: amd64
Maintainer: Bhaskar Bhar <[email protected]>
Description: PcapPlusPlus - C++ library for packet parsing and crafting
EOF
- name: Build DEB package
run: |
cd build
dpkg-deb --build install-root pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb
- name: Upload DEB to release
uses: softprops/action-gh-release@v1
with:
files: build/pcapplusplus_${{ github.event.release.tag_name }}_amd64.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@bhaskarbhar Could you open a PR? We will go through the code review.
Opened a PR. PR failed due to pre-commit.