#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgbase=lxsession
pkgname=(lxsession lxsession-gtk3)
pkgver=0.5.5
pkgrel=01
epoch=1
pkgdesc='Lightweight X11 session manager'
arch=('x86_64')
url="https://lxde.org/"
depends=('gtk2' 'gtk3' 'polkit')
makedepends=('intltool' 'docbook-xsl' 'vala' 'autoconf')
conflicts=('lxpolkit')
source=(https://downloads.sourceforge.net/lxde/$pkgbase-$pkgver.tar.xz)

prepare() {
  cd $pkgbase-$pkgver

  # Regenerate C sources from Vala code
  rm *.stamp
  autoreconf -fi
}

build() {
  # GTK+ 2 version
  [ -d gtk2 ] || cp -r $pkgbase-$pkgver gtk2
  cd gtk2
  ./configure \
	--sysconfdir=/etc \
	--prefix=/usr \
	--libexecdir=/usr/lib
  make

  cd "$srcdir"
  # GTK+ 3 version
  [ -d gtk3 ] || cp -r $pkgbase-$pkgver gtk3
  cd gtk3
  ./configure \
	--sysconfdir=/etc \
	--prefix=/usr \
	--libexecdir=/usr/lib \
	--enable-gtk3
  make
}

package_lxsession() {
  groups=('lxde')
  depends=('gtk2' 'polkit')
  conflicts=('lxpolkit')

  cd gtk2
  make DESTDIR="$pkgdir" install
}

package_lxsession-gtk3() {
  groups=('lxde-gtk3')
  pkgdesc+=' (GTK+ 3 version)'
  depends=('gtk3' 'polkit')
  conflicts+=('lxsession')

  cd gtk3
  make DESTDIR="$pkgdir" install

  # Ignore package by AppStream to avoid duplicated IDs
  echo 'X-AppStream-Ignore=true' >> "$pkgdir/usr/share/applications/lxsession-default-apps.desktop"
  echo 'X-AppStream-Ignore=true' >> "$pkgdir/usr/share/applications/lxsession-edit.desktop"
}

#---- license gpg-key sha256sums ----

license=('GPL2')

sha256sums=(e43e0d9c033095559ab57c8821c2b84fea58009d267db1324d32dca8bd4dbb46) # lxsession-0.5.5.tar.xz



