# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: unikum <unikum.pm@gmail.com>
# Contributor: speed145a <jonathan@tagchapter.com>

pkgname=firewalld
pkgver=1.0.1
pkgrel=1
pkgdesc='Firewall daemon with D-Bus interface'
arch=(any)
url=https://firewalld.org/
license=(GPL2)
depends=(
  dbus-python
  dconf
  glib2
  hicolor-icon-theme
  nftables
  python-gobject
)
makedepends=(
  docbook-xsl
  git
  intltool
  podman
)
optdepends=(
  'bash-completion: bash completion'
  'gtk3: firewall-config'
  'libnotify: firewall-applet'
  'nm-connection-editor: firewalld-applet'
  'python-pyqt5: firewall-applet'
)
backup=(
  etc/conf.d/firewalld
  etc/firewalld/firewalld.conf
)
_tag=1fc801a2c3e1297bf45db09df0788ab3de80c396
source=(
  git+https://github.com/firewalld/firewalld.git#tag=${_tag}
  firewalld-sysconfigdir.patch
)
sha256sums=(
  SKIP
  cf7d655230c43acf10a0f97dffdbcba136729967c8b9a25a930871d54a589834
)

prepare() {
  cd firewalld
  git cherry-pick -n 3337c9a4e63bd42535b6b3e97a91f4b502c063ce
  patch -Np1 -i ../firewalld-sysconfigdir.patch
  NOCONFIGURE=true ./autogen.sh
}

pkgver() {
  cd firewalld
  git describe --tags | sed 's/^v//'
}

build() {
  cd firewalld
  ./configure \
    --prefix=/usr \
    --localstatedir=/var \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --disable-schemas-compile \
    --disable-sysconfig
  make
}

package() {
  make DESTDIR="${pkgdir}" -C firewalld install
  export PYTHONHASHSEED=0
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}

# vim: ts=2 sw=2 et:
