diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3c5f3a..cee9946 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,3 +17,28 @@ jobs: run: | make sudo make install + debian: + runs-on: ubuntu-20.04 + container: debian:buster + steps: + - name: install tools + run: | + apt-get update + apt-get install -qq --no-install-recommends devscripts equivs gawk git + - uses: actions/checkout@v2 + - name: install dependencies + run: | + mk-build-deps -ir -t "apt-get -qq --no-install-recommends" + - name: prepare changelog + run: | + debian/nightly-changelog.sh + env: + DISTRO: buster + - name: build package + run: | + debuild -us -uc + mv ../*.deb ~/ + - uses: actions/upload-artifact@v2 + with: + name: deb + path: ~/*.deb diff --git a/.gitignore b/.gitignore index 6399b8d..ebe9d05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ -infoconv -infoedit +/debian/changelog +/debian/*debhelper* +/debian/files +/debian/infoedit +/debian/infoedit.substvars +/infoconv +/infoedit diff --git a/Makefile b/Makefile index f1f580f..56695aa 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +CXX ?= g++ +PREFIX ?= /usr/local +DESTDIR ?= + all: infoconv infoedit infoconv: infoconv.cpp @@ -10,9 +14,10 @@ lint: clang-format-8 -i -style=file *.[hc]pp install: infoconv infoedit - install infoconv /usr/local/bin/infoconv - install infoedit /usr/local/bin/infoedit + install -d $(DESTDIR)$(PREFIX)/bin + install infoconv $(DESTDIR)$(PREFIX)/bin/infoconv + install infoedit $(DESTDIR)$(PREFIX)/bin/infoedit uninstall: - rm /usr/local/bin/infoconv - rm /usr/local/bin/infoedit + rm $(DESTDIR)$(PREFIX)/bin/infoconv + rm $(DESTDIR)$(PREFIX)/bin/infoedit diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1de92c5 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: infoedit +Section: utils +Priority: optional +Maintainer: Junxiao Shi +Build-Depends: debhelper (>= 10), + libboost-dev, + libboost-program-options-dev +Standards-Version: 4.5.1 +Homepage: https://github.com/NDN-Routing/infoedit + +Package: infoedit +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: command line tools for Boost INFO format diff --git a/debian/nightly-changelog.sh b/debian/nightly-changelog.sh new file mode 100755 index 0000000..8b11bf2 --- /dev/null +++ b/debian/nightly-changelog.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -eo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")"/.. + +PKGVER=$(git show -s --format='%ct %H' | gawk '{ printf "0.0.0-%s-%s", strftime("%Y%m%d%H%M%S", $1), substr($2,1,12) }') + +( + echo "infoedit ($PKGVER-nightly~$DISTRO) $DISTRO;" + echo " * Automated build of version $PKGVER" + echo " -- Junxiao Shi $(date -R)" +) > debian/changelog diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e9ea2d4 --- /dev/null +++ b/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f +DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +-include /usr/share/dpkg/buildflags.mk + +export PREFIX=/usr + +%: + dh $@