aboutsummaryrefslogtreecommitdiff
path: root/community/lua/build
blob: bd2045fbb074ad9d3061e1abf363181ec7c638e4 (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
#!/bin/sh -e

export DESTDIR="$1"

# Make LUA_ROOT "/usr" instead of "/usr/local"
clsed '/define LUA_ROOT/c#define LUA_ROOT "/usr/"' src/luaconf.h

# Optionally link with readline if available
r=$(cpt l -C readline 1 "")

mk() {
    make \
        MYCFLAGS="$CFLAGS -fPIC" \
        MYLDFLAGS="$LDFLAGS" \
        INSTALL_TOP="$DESTDIR/usr" \
        INSTALL_MAN="$DESTDIR/usr/share/man/man1" \
        INSTALL_DATA="cp -d" \
        "$@"
}

mk "linux${r:+-readline}"
mk install

clinst -Dm644 -s "s|@V@|${2%.*}|;s|@R@|$2|" lua.pc.in "$1/usr/lib/pkgconfig/lua.pc"