summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 19c53fa45005439b0a0ed9679fa0fa148c52318d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Maintainer: Aaron McDaniel (mcd1992) <'aur' at the domain 'fgthou.se'>

pkgname=lua-penlight-git
pkgver=1.5.4.r6.g2fb9b30
pkgrel=1
pkgdesc='A set of pure Lua libraries focusing on input data handling, functional programming, and OS path management'
url='https://github.com/stevedonovan/Penlight'
arch=('any')
license=('MIT')
conflicts=('lua-penlight')
provides=('lua-penlight')
depends=('bash' 'lua' 'lua-filesystem')
source=("${pkgname}::git+https://github.com/stevedonovan/Penlight.git")
md5sums=('SKIP')

pkgver() {
  cd ${pkgname}
  # Prefix revision with 'r'; replace all '-' with '.'
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

package() {
  cd ${pkgname}
  install -dm644              "${pkgdir}/usr/share/doc/${pkgname}/" # Create doc directory
  cp -a doc/manual examples   "${pkgdir}/usr/share/doc/${pkgname}/" # Copy documentation and examples into doc/
  cp -a doc/config.ld         "${pkgdir}/usr/share/doc/${pkgname}/examples" # Copy example config.ld to examples
  install -DTpm644 LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md" # Copy license file and create directory

  # Find which 5.x lua versions are installed on this system
  INSTALLED_LUA_VERSIONS=`find /usr/share/lua -maxdepth 1 -type d -iname "5.*" -printf "%f\n"`

  # Install the actual libraries into any 5.x version path
  while read -r luaversion; do
      mkdir -p       "${pkgdir}/usr/share/lua/${luaversion}/pl"
      cp -a lua/pl/* "${pkgdir}/usr/share/lua/${luaversion}/pl"
  done <<< $INSTALLED_LUA_VERSIONS
}