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

pkgbase=tlp
pkgname=(
  tlp
  tlp-rdw
)
pkgver=1.2.2
pkgrel=1
arch=(any)
url=https://linrunner.de/en/tlp/tlp.html
license=(GPL2)
makedepends=(git)
source=(git+https://github.com/linrunner/TLP.git#tag=${pkgver})
sha256sums=(SKIP)

package_tlp() {
  pkgdesc='Linux Advanced Power Management'
  depends=(
    hdparm
    iw
    pciutils
    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/default/tlp)

  cd TLP

  export TLP_NO_INIT=1
  export TLP_SBIN=/usr/bin
  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}" install-tlp install-man
}

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

  cd TLP

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

# vim: ts=2 sw=2 et:
