137 lines
4.2 KiB
Bash
Executable file
137 lines
4.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Slackware build script for Lua
|
|
|
|
# Written by Menno Duursma
|
|
# Modified by the SlackBuilds.org project
|
|
# Modified by Aaron W. Hsu
|
|
# Updated by Matteo Bernardini
|
|
# Updated by Gwenhael Le Moine, inspired by https://git.archlinux.org/svntogit/packages.git/tree/lua/trunk/PKGBUILD
|
|
|
|
# This program is free software. It comes without any warranty.
|
|
# Granted WTFPL, Version 2, as published by Sam Hocevar. See
|
|
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
PRGNAM=lua
|
|
VERSION=${VERSION:-5.3.4}
|
|
MAJOR_VERSION=${VERSION%.*}
|
|
BUILD=${BUILD:-1}
|
|
TAG=${TAG:-cyco}
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
case "$( uname -m )" in
|
|
i?86) ARCH=i486 ;;
|
|
arm*) ARCH=arm ;;
|
|
*) ARCH=$( uname -m ) ;;
|
|
esac
|
|
fi
|
|
|
|
CWD=$(pwd)
|
|
TMP=${TMP:-/tmp/SBo}
|
|
PKG=$TMP/package-$PRGNAM
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
|
LIBDIRSUFFIX=""
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
LIBDIRSUFFIX="64"
|
|
fi
|
|
|
|
set -e
|
|
|
|
rm -rf $PKG
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
cd $TMP
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
[ ! -e $CWD/$PRGNAM-${VERSION}.tar.gz ] && wget -c http://www.lua.org/ftp/$PRGNAM-${VERSION}.tar.gz -O $CWD/$PRGNAM-${VERSION}.tar.gz
|
|
|
|
tar xvf $CWD/$PRGNAM-${VERSION}.tar.gz
|
|
cd $PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
|
|
[ ! -e $CWD/liblua.so.patch ] && wget -c https://git.archlinux.org/svntogit/packages.git/plain/lua/trunk/liblua.so.patch -O $CWD/liblua.so.patch
|
|
patch -p1 -i $CWD/liblua.so.patch
|
|
|
|
make MYCFLAGS="$CFLAGS -fPIC -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" MYLDFLAGS="$LDFLAGS" linux
|
|
|
|
make \
|
|
TO_LIB="liblua.a liblua.so liblua.so.$MAJOR_VERSION liblua.so.$VERSION" \
|
|
INSTALL_DATA='cp -d' \
|
|
INSTALL_TOP="$PKG"/usr \
|
|
INSTALL_MAN="$PKG"/usr/man/man1 \
|
|
install
|
|
|
|
cat <<EOF > lua.pc
|
|
V=$MAJOR_VERSION
|
|
R=$VERSION
|
|
|
|
prefix=/usr
|
|
INSTALL_BIN=\${prefix}/bin
|
|
INSTALL_INC=\${prefix}/include
|
|
INSTALL_LIB=\${prefix}/lib
|
|
INSTALL_MAN=\${prefix}/man/man1
|
|
INSTALL_LMOD=\${prefix}/share/lua/\${V}
|
|
INSTALL_CMOD=\${prefix}/lib/lua/\${V}
|
|
exec_prefix=\${prefix}
|
|
libdir=\${exec_prefix}/lib
|
|
includedir=\${prefix}/include
|
|
|
|
Name: Lua
|
|
Description: An Extensible Extension Language
|
|
Version: \${R}
|
|
Requires:
|
|
Libs: -L\${libdir} -llua -lm
|
|
Cflags: -I\${includedir}
|
|
EOF
|
|
|
|
install -Dm644 lua.pc "$PKG"/usr/lib/pkgconfig/${PRGNAM}53.pc
|
|
|
|
ln -sf /usr/bin/lua "$PKG"/usr/bin/lua$MAJOR_VERSION
|
|
ln -sf /usr/bin/luac "$PKG"/usr/bin/luac$MAJOR_VERSION
|
|
ln -sf /usr/lib/liblua.so.$VERSION "$PKG"/usr/lib/liblua$MAJOR_VERSION.so
|
|
ln -sf /usr/lib/pkgconfig/${PRGNAM}53.pc "$PKG"/usr/lib/pkgconfig/$PRGNAM.pc
|
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/html
|
|
cp -a README $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cp -a doc/*.html doc/logo.gif doc/lua.css $PKG/usr/doc/$PRGNAM-$VERSION/html
|
|
|
|
cat $CWD/SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/SlackBuild
|
|
|
|
mkdir -p $PKG/install
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
# HOW TO EDIT THIS FILE:
|
|
# The "handy ruler" below makes it easier to edit a package description.
|
|
# Line up the first '|' above the ':' following the base package name, and
|
|
# the '|' on the right side marks the last column you can put a character in.
|
|
# You must make exactly 11 lines for the formatting to be correct. It's also
|
|
# customary to leave one space after the ':' except on otherwise blank lines.
|
|
|
|
|-----handy-ruler------------------------------------------------------|
|
|
lua: lua (a powerful, fast, light-weight, embeddable scripting language)
|
|
lua:
|
|
lua: Lua combines simple procedural syntax with powerful data description
|
|
lua: constructs based on associative arrays and extensible semantics.
|
|
lua: Lua is dynamically typed, runs by interpreting bytecode for a
|
|
lua: register-based virtual machine, and has automatic memory management
|
|
lua: with incremental garbage collection, making it ideal for
|
|
lua: configuration, scripting, and rapid prototyping.
|
|
lua:
|
|
lua:
|
|
lua:
|
|
EOF
|
|
|
|
cd $PKG
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|