diff --git a/.gitignore b/.gitignore
index 66acf991a792ea9218d15193f73a9fdb426dbb7e..1a4374edc189ac0f4237931c955c4ec2a78da888 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,6 +81,9 @@ src/libknot/libknot.h
 # Generated tarballs
 /knot-*.tar.xz
 
+# Packaging output
+/pkg
+
 # Code coverage
 *.gcda
 *.gcno
diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml
new file mode 100644
index 0000000000000000000000000000000000000000..abb8cbcd37e35202b5bacb90c5407f7b7ea68383
--- /dev/null
+++ b/distro/config/apkg.toml
@@ -0,0 +1,12 @@
+[project]
+name = "knot-dns"
+# needed for make-archive
+make_archive_script = "scripts/make-dev-archive.sh"
+
+[upstream]
+# needed for get-archive
+archive_url = "https://secure.nic.cz/files/knot-dns/knot-{{ version }}.tar.xz"
+signature_url = "https://secure.nic.cz/files/knot-dns/knot-{{ version }}.tar.xz.asc"
+
+[apkg]
+compat = 1
diff --git a/distro/pkg/arch/PKGBUILD b/distro/pkg/arch/PKGBUILD
index eccde30ae7b10e422d7581a7932bb860fe4b384f..f8d68eaefe2da067df43512b1ecb95b6bf3076bb 100644
--- a/distro/pkg/arch/PKGBUILD
+++ b/distro/pkg/arch/PKGBUILD
@@ -6,7 +6,7 @@
 # Contributor: Otto Sabart <seberm[at]gmail[dot]com>
 
 pkgname=knot
-pkgver=__VERSION__
+pkgver={{ version }}
 pkgrel=1
 pkgdesc="High-performance authoritative-only DNS server"
 arch=('x86_64')
@@ -23,7 +23,7 @@ depends=('fstrm'
          'protobuf-c'
          'systemd')
 backup=('etc/knot/knot.conf')
-source=("${pkgname}_${pkgver}.orig.tar.xz")
+source=("${pkgname}-${pkgver}.tar.xz")
 sha256sums=('SKIP')
 validpgpkeys=('742FA4E95829B6C5EAC6B85710BB7AF6FEBBD6AB') # Daniel Salzman <daniel.salzman@nic.cz>
 
diff --git a/distro/pkg/deb/changelog b/distro/pkg/deb/changelog
index 285b69e2c495d11c8f5ccc1532a1e8315d7c2213..5538ae1e3bae1287cf97cc2672c3acdf2e66006f 100644
--- a/distro/pkg/deb/changelog
+++ b/distro/pkg/deb/changelog
@@ -1,4 +1,4 @@
-knot (__VERSION__-cznic.1) unstable; urgency=medium
+knot ({{ version }}-cznic.{{ release }}) unstable; urgency=medium
 
   * move changelog to OBS
   * see NEWS or https://knot-dns.cz
diff --git a/distro/pkg/rpm/knot.spec b/distro/pkg/rpm/knot.spec
index 8ee8ff8a8286692c4a2e8307fb104e82265ad85d..254d6805d3aedf9c3b17349d225943c3a39b5766 100644
--- a/distro/pkg/rpm/knot.spec
+++ b/distro/pkg/rpm/knot.spec
@@ -2,17 +2,16 @@
 %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}}
 
 %define GPG_CHECK 0
-%define VERSION __VERSION__
 %define BASE_VERSION %(echo "%{version}" | sed 's/^\\([^.]\\+\\.[^.]\\+\\).*/\\1/')
 %define repodir %{_builddir}/%{name}-%{version}
 
 Summary:	High-performance authoritative DNS server
 Name:		knot
-Version:	%{VERSION}
-Release:	cznic.1%{?dist}
+Version:	{{ version }}
+Release:	cznic.{{ release }}%{?dist}
 License:	GPL-3.0-or-later
 URL:		https://www.knot-dns.cz
-Source0:	%{name}_%{version}.orig.tar.xz
+Source0:	%{name}-%{version}.tar.xz
 
 %if 0%{?GPG_CHECK}
 Source1:	https://secure.nic.cz/files/knot-dns/%{name}-%{version}.tar.xz.asc
diff --git a/scripts/make-dev-archive.sh b/scripts/make-dev-archive.sh
new file mode 100755
index 0000000000000000000000000000000000000000..693ca506efece743c0cb68c60baecbbc330c16e5
--- /dev/null
+++ b/scripts/make-dev-archive.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Create a develpoment tarball
+set -o errexit -o nounset -o xtrace
+
+cd "$(dirname ${0})/.."
+
+# configure Knot DNS in order to create archive
+autoreconf -if
+./configure
+# create archive and parse output for archive name
+TARDIR=$(make dist 2>&1 | sed -n 's/tardir=\([^ ]\+\).*/\1/p')
+# print created archive name
+ls -1 $TARDIR.tar.*