# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Marc Schulte <bomba@nerdstube.de>

pkgbase=tlp
pkgname=(
  tlp
  tlp-rdw
)
pkgver=1.3.1
pkgrel=2
arch=(any)
url=https://linrunner.de/en/tlp/tlp.html
license=(GPL2)
makedepends=(git)
source=(git+https://github.com/linrunner/TLP.git#tag=ab788abf4936dfb44fbb408afc34af834230a64d)
sha256sums=(SKIP)
install=tlp.install

pkgver() {
  cd TLP

  git describe --tags
}

package_tlp() {
  pkgdesc='Linux Advanced Power Management'
  depends=(
    hdparm
    iw
    pciutils
    perl
    rfkill
    usbutils
    util-linux
  )
  optdepends=(
    'acpi_call: ThinkPad battery functions, Sandy Bridge and newer'
    'bash-completion: Bash completion'
    'ethtool: Disable Wake On Lan'
    'lsb-release: Display LSB release version in tlp-stat'
    'smartmontools: Display S.M.A.R.T. data in tlp-stat'
    'tp_smapi: ThinkPad battery functions'
    'x86_energy_perf_policy: Set energy versus performance policy on x86 processors'
  )
  conflicts=(
    laptop-mode-tools
    pm-utils
  )
  backup=(etc/tlp.conf)

  export TLP_NO_INIT=1
  export TLP_SBIN=/usr/bin
  export TLP_SDSL=/usr/lib/systemd/system-sleep
  export TLP_SYSD=/usr/lib/systemd/system
  export TLP_ULIB=/usr/lib/udev
  export TLP_WITH_ELOGIND=0
  export TLP_WITH_SYSTEMD=1

  make DESTDIR="${pkgdir}" -C TLP install-tlp install-man-tlp
}

package_tlp-rdw() {
  pkgdesc='Linux Advanced Power Management - Radio Device Wizard'
  depends=(
    networkmanager
    tlp
  )

  make DESTDIR="${pkgdir}" -C TLP install-rdw install-man-rdw
}

# vim: ts=2 sw=2 et:
