From 0b3c6d7b31d1c3ee30a3f43988912586507cf2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20K=C3=BCthe?= Date: Thu, 21 Dec 2023 20:45:54 +0100 Subject: [PATCH] Add script to build Debian package --- .gitignore | 6 ++++++ deb/build.sh | 32 ++++++++++++++++++++++++++++++++ deb/control.template | 25 +++++++++++++++++++++++++ deb/copyright | 13 +++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 .gitignore create mode 100755 deb/build.sh create mode 100644 deb/control.template create mode 100644 deb/copyright diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78a94cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# cmake +build/ + +# Debian package +deb/package/ +deb/libtuntap-dev.deb diff --git a/deb/build.sh b/deb/build.sh new file mode 100755 index 0000000..081f384 --- /dev/null +++ b/deb/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +die () { + >&2 echo "$1" + exit 1 +} + + +( + rm -rf package || die "Failed to remove old packages" +) + +( + mkdir ../build + cd ../build + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. || die "Failed to configure project" + make -j "$(nproc)" || die "Failed to build project" + make DESTDIR="../deb/package/" install || die "Failed to install project into package directory" +) + +mkdir -p package/DEBIAN/ +VERSION="$(git describe --long | sed 's/^libtuntap-//')" +sed "s/%VERSION%/$VERSION/" control.template >> package/DEBIAN/control + +mkdir -p package/usr/share/doc/libtuntap-dev/ +cp copyright package/usr/share/doc/libtuntap-dev/copyright + +echo "Building package..." +dpkg-deb --root-owner-group --build package libtuntap-dev.deb || die "Failed to build package" + +echo "Package $(dpkg-deb --show libtuntap-dev.deb | sed "s/\t/ /") successful builded!" + diff --git a/deb/control.template b/deb/control.template new file mode 100644 index 0000000..eedd38c --- /dev/null +++ b/deb/control.template @@ -0,0 +1,25 @@ +Package: libtuntap-dev +Version: %VERSION% +Architecture: any +Section: libdevel +Priority: optional +Homepage: https://github.com/LaKabane/libtuntap +Maintainer: LaKabane +Description: Portable Tun/Tap devices configuration utility/library + TUN and TAP are virtual networking devices which allow userland applications + to receive packets sent to it. The userland applications can also send their + own packets to the devices and they will be forwarded to the kernel. + This is useful for developping tunnels, private networks or virtualisation + systems. + Supported Features + - Creation of TUN and TAP devices; + - Autodetection of available TUN or TAP devices; + - Setting and getting the MAC address of the device; + - Setting and getting the MTU of the device; + - Setting the status of the device (up/down); + - Setting the IPv4 address and netmask of the device; + - Setting the persistence mode of the device; + - Setting the name of the device (Linux only); + - Setting the description of the device (OpenBSD and FreeBSD only); + - Wrapper libraries for C++. + diff --git a/deb/copyright b/deb/copyright new file mode 100644 index 0000000..08d876a --- /dev/null +++ b/deb/copyright @@ -0,0 +1,13 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Source: https://github.com/LaKabane/libtuntap#license +Upstream-Name: libtuntap +Upstream-Contact: LaKabane + +Files: * +Copyright: LaKabane +License: ISC + +License: ISC + Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED “AS IS” AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.