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 script to build Debian package #50

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cmake
build/

# Debian package
deb/package/
deb/libtuntap-dev.deb
34 changes: 34 additions & 0 deletions deb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
marek22k marked this conversation as resolved.
Show resolved Hide resolved

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"
marek22k marked this conversation as resolved.
Show resolved Hide resolved
make DESTDIR="../deb/package/" install || die "Failed to install project into package directory"
)

mkdir -p package/DEBIAN/
VERSION="$(git describe --long | sed 's/^libtuntap-//')"
cp control.template package/DEBIAN/control
sed "s/%VERSION%/$VERSION/" -i package/DEBIAN/control
marek22k marked this conversation as resolved.
Show resolved Hide resolved
sed "s/%ARCHITECTURE%/$(dpkg --print-architecture)/" -i 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!"

25 changes: 25 additions & 0 deletions deb/control.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Package: libtuntap-dev
Version: %VERSION%
Architecture: %ARCHITECTURE%
Section: libdevel
Priority: optional
Homepage: https://github.com/LaKabane/libtuntap
Maintainer: LaKabane <[email protected]>
marek22k marked this conversation as resolved.
Show resolved Hide resolved
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++.

13 changes: 13 additions & 0 deletions deb/copyright
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

Files: *
Copyright: LaKabane <[email protected]>
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.