summaryrefslogtreecommitdiff
path: root/community/luasocket/PKGBUILD
blob: f77bfaab3d1f20f5899811e9b11f2b136f464b0b (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
38
39
40
41
42
43
44
45
46
47
48
49
# $Id: PKGBUILD 99083 2013-10-24 09:31:56Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Anders Bergh <anders1@gmail.com>

pkgbase=luasocket
pkgname=(lua-socket lua51-socket)
pkgver=3.0rc1
pkgrel=3
pkgdesc='Networking support library for the Lua language'
arch=('i686' 'x86_64')
url='https://github.com/diegonehab/luasocket'
license=('MIT')
makedepends=('lua' 'lua51')
source=("$pkgname-$pkgver.tar.gz::https://github.com/diegonehab/luasocket/archive/v${pkgver/rc/-rc}.tar.gz")
md5sums=('08bd2f265b244eb4bf5c2c36bf89b759')

build() {
  cp -a luasocket-${pkgver/rc/-rc} luasocket-${pkgver/rc/-rc}-52
  msg2 'Building with lua 5.2'
  pushd luasocket-${pkgver/rc/-rc}-52
  make LUAV=5.2
  popd
  msg2 'Building with lua 5.1'
  cd luasocket-${pkgver/rc/-rc}
  find . -type f -name \*.[ch] -exec sed -i \
    -e 's|include "lua.h|include "lua5.1/lua.h|g' \
    -e 's|include "lualib.h|include "lua5.1/lualib.h|g' \
    -e 's|include "luaconf.h|include "lua5.1/luaconf.h|g' \
    -e 's|include "lauxlib.h|include "lua5.1/lauxlib.h|g' \
    {} \;
  make LUAV=5.1
}

package_lua-socket() {
  depends=('lua')
  cd luasocket-${pkgver/rc/-rc}-52
  make DESTDIR="$pkgdir/" LUAV=5.2 prefix=/usr install-unix
  install -D -m0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_lua51-socket() {
  depends=('lua51')
  replaces=('luasocket')
  conflicts=('luasocket')

  cd luasocket-${pkgver/rc/-rc}
  make DESTDIR="$pkgdir/" LUAV=5.1 prefix=/usr install-unix
  install -D -m0644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}