#!/bin/sh -e

for i in $(find . -name Makefile)
do
    sed -i -e 's/ar rcu/ar -r -o/g' -e 's/-Wl,-E//g' $i
done


make MYCFLAGS="$CFLAGS -fPIC" \
     MYLDFLAGS="$LDFLAGS" \
     posix \
     CC=cc \
     RANLIB=true

make INSTALL_TOP="$1/usr" \
     INSTALL_MAN="$1/usr/share/man/man1" \
     INSTALL_DATA="cp -d" \
     install

install -Dm 644 lua.pc "$1/usr/lib/pkgconfig/lua.pc"
