lua 5.3.5, awesome & company

This commit is contained in:
Gwenhael Le Moine 2020-07-12 13:43:05 +02:00
parent afe7da1cc8
commit a2cb385b70
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
5 changed files with 187 additions and 156 deletions

View file

@ -1,29 +1,41 @@
#!/bin/sh #!/bin/sh
# Slackware build script for Lua # Slackware build script for lua53
# Written by Menno Duursma # Copyright 2018 Azure Zanculmarktum <zanculmarktum@gmail.com>
# Modified by the SlackBuilds.org project # All rights reserved.
# Modified by Aaron W. Hsu #
# Updated by Matteo Bernardini # Redistribution and use of this script, with or without modification, is
# Updated by Gwenhael Le Moine, inspired by https://git.archlinux.org/svntogit/packages.git/tree/lua/trunk/PKGBUILD # permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This program is free software. It comes without any warranty. # Some of the codes were taken from development/lua/lua.SlackBuild
# Granted WTFPL, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
PRGNAM=lua CWD=${CWD:-$(pwd)}
VERSION=${VERSION:-5.3.4} PRGNAM=$(basename $CWD)
MAJOR_VERSION=${VERSION%.*} VERSION=${VERSION:-5.4.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-gwh} TAG=${TAG:-gwh}
if [ -z "$ARCH" ]; then if [ -z "$ARCH" ]; then
case "$( uname -m )" in case "$( uname -m )" in
i?86) ARCH=i486 ;; i?86) ARCH=i586 ;;
arm*) ARCH=arm ;; arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;; *) ARCH=$( uname -m ) ;;
esac esac
fi fi
CWD=$(pwd) CWD=$(pwd)
@ -31,15 +43,21 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i486" ]; then if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX="" LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686" SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX="" LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC" SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64" LIBDIRSUFFIX="64"
elif [ "$ARCH" = "aarch64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
fi fi
set -e set -e
@ -47,67 +65,77 @@ set -e
rm -rf $PKG rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT mkdir -p $TMP $PKG $OUTPUT
cd $TMP cd $TMP
rm -rf $PRGNAM-$VERSION rm -rf lua-$VERSION
[ ! -e $CWD/$PRGNAM-${VERSION}.tar.gz ] && wget -c http://www.lua.org/ftp/$PRGNAM-${VERSION}.tar.gz -O $CWD/$PRGNAM-${VERSION}.tar.gz [ ! -e $CWD/lua-$VERSION.tar.gz ] && wget -c https://www.lua.org/ftp/lua-$VERSION.tar.gz -O $CWD/lua-$VERSION.tar.gz
tar xvf $CWD/$PRGNAM-${VERSION}.tar.gz tar xvf $CWD/lua-$VERSION.tar.gz
cd $PRGNAM-$VERSION cd lua-$VERSION
chown -R root:root . chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
[ ! -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 eval $(sed -ne '/^\(V\|R\)= /s, ,,p' Makefile)
patch -p1 -i $CWD/liblua.so.patch
make MYCFLAGS="$CFLAGS -fPIC -DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" MYLDFLAGS="$LDFLAGS" linux sed -i \
-e '/^INSTALL_TOP= /s,\(/usr\).*,\$(DESTDIR)\1,' \
-e '/^INSTALL_LIB= /s,lib,&'"${LIBDIRSUFFIX}"',' \
-e '/^INSTALL_CMOD= /s,lib,&'"${LIBDIRSUFFIX}"',' \
Makefile
make \ sed -i \
TO_LIB="liblua.a liblua.so liblua.so.$MAJOR_VERSION liblua.so.$VERSION" \ -e '/^CFLAGS= /s,-O2,'"$SLKCFLAGS"',' \
INSTALL_DATA='cp -d' \ -e '/-DLUA_USE_LINUX.*-Wl,-E -ldl -lreadline/s|-lreadline|& -lncurses|' \
INSTALL_TOP="$PKG"/usr \ src/Makefile
INSTALL_MAN="$PKG"/usr/man/man1 \
install
cat <<EOF > lua.pc sed -i \
V=$MAJOR_VERSION -e '/^#define LUA_ROOT/s,".*,"/usr/",' \
R=$VERSION -e '/^#define LUA_CDIR/s,"lib,&'"${LIBDIRSUFFIX}"',' \
src/luaconf.h
prefix=/usr make linux
INSTALL_BIN=\${prefix}/bin make install DESTDIR=$PKG
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 # Now let's build the shared library
Description: An Extensible Extension Language mkdir -p shared
Version: \${R} cd shared
Requires: ar -x $PKG/usr/lib${LIBDIRSUFFIX}/liblua.a
Libs: -L\${libdir} -llua -lm gcc -ldl -lreadline -lncurses -lm -shared *.o -o liblua.so.$R
Cflags: -I\${includedir} cp -a liblua.so.$R $PKG/usr/lib${LIBDIRSUFFIX}
EOF ( cd $PKG/usr/lib${LIBDIRSUFFIX}
ln -s liblua.so.$R liblua.so.$V
ln -s liblua.so.$R liblua.so.${V%??}
ln -s liblua.so.$R liblua.so
)
cd - >/dev/null
install -Dm644 lua.pc "$PKG"/usr/lib/pkgconfig/${PRGNAM}53.pc mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
sed \
-e '/^V= /s, .*, '"$V"',' \
-e '/^R= /s, .*, '"$R"',' \
-e '/^prefix= /s,\(/usr\).*,\1,' \
-e '/^INSTALL_LIB= /s,lib,&'"${LIBDIRSUFFIX}"',' \
-e '/^INSTALL_CMOD= /s,lib,&'"${LIBDIRSUFFIX}"',' \
-e '/^libdir=/s,/lib,&'"${LIBDIRSUFFIX}"',' \
$CWD/lua.pc.in > lua.pc
ln -sf /usr/bin/lua "$PKG"/usr/bin/lua$MAJOR_VERSION ln -s lua.pc lua-$V.pc
ln -sf /usr/bin/luac "$PKG"/usr/bin/luac$MAJOR_VERSION ln -s lua.pc lua${V%.?}${V#?.}.pc
ln -sf /usr/lib/liblua.so.$VERSION "$PKG"/usr/lib/liblua$MAJOR_VERSION.so cd - >/dev/null
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 \ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \; 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 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 mkdir -p $PKG/usr/doc/$PRGNAM
cp -a README $PKG/usr/doc/$PRGNAM-$VERSION cp -a README doc/* $PKG/usr/doc/$PRGNAM
cp -a doc/*.html doc/logo.gif doc/lua.css $PKG/usr/doc/$PRGNAM-$VERSION/html cat $CWD/SlackBuild > $PKG/usr/doc/$PRGNAM/SlackBuild
cat $CWD/SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/SlackBuild
mkdir -p $PKG/install mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc cat <<EOF > $PKG/install/slack-desc
@ -133,5 +161,4 @@ lua:
EOF EOF
cd $PKG 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} /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

View file

@ -1,60 +0,0 @@
diff --git a/Makefile b/Makefile
index 7fa91c8..dccf485 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ R= $V.0
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$(V) R=$(R)
test: dummy
src/lua -v
diff --git a/src/Makefile b/src/Makefile
index 2e7a412..fa5769f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -29,6 +29,7 @@ MYOBJS=
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -43,7 +44,7 @@ LUAC_T= luac
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_A= $(LUA_A)
# Targets start here.
@@ -59,6 +60,12 @@ $(LUA_A): $(BASE_O)
$(AR) $@ $(BASE_O)
$(RANLIB) $@
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+ ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
+
$(LUA_T): $(LUA_O) $(LUA_A)
$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
diff --git a/src/luaconf.h b/src/luaconf.h
index fd28d21..e2662cc 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -175,7 +175,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "/usr/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#define LUA_PATH_DEFAULT \

31
d/lua/lua.pc.in Normal file
View file

@ -0,0 +1,31 @@
# lua.pc -- pkg-config data for Lua
# vars from install Makefile
# grep '^V=' ../Makefile
V= 5.1
# grep '^R=' ../Makefile
R= 5.1.5
# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
prefix= /usr/local
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}
# canonical vars
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua${V} -lm
Cflags: -I${includedir}
# (end of lua.pc)

View file

@ -7,14 +7,11 @@ TMP=/tmp/$TAG
OUTPUT=/tmp OUTPUT=/tmp
CWD=$(pwd) CWD=$(pwd)
REPOSITORIES=/home/installs/SlackBuilds/repositories REPOSITORIES=/home/installs/SlackBuilds/repositories
REPOSITORY=$REPOSITORIES/$PRGNAM
PRGNAM=$(basename $CWD) PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM PKG=$TMP/pkg-$PRGNAM
VERSION=$(date +%Y.%m%d_%H.%M)
EXT=tar.gz
DOCS="COPYING* README*" DOCS="COPYING* README*"
ARCH=$(uname -m) ARCH=$(uname -m)
@ -25,26 +22,22 @@ PREFIX=/usr
SLCKFLAGS="-fPIC -O2" SLCKFLAGS="-fPIC -O2"
# nettoyage préalable # nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION rm -fr $PKG $TMP/$PRGNAM
mkdir -p $PKG mkdir -p $PKG
# mise en place # mise en place
cd $TMP cd $TMP
if [ -e $CWD/$PRGNAM-$VERSION.$EXT ]; then #[ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES
tar xf $CWD/$PRGNAM-$VERSION.$EXT [ ! -e $REPOSITORIES/$PRGNAM ] && git clone http://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM
else ( cd $REPOSITORIES/$PRGNAM;
[ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES git pull
if [ ! -e $REPOSITORIES/$PRGNAM ]; then )
git clone http://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
else
( cd $REPOSITORIES/$PRGNAM cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM
git pull
) cd $PRGNAM
fi
cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM-$VERSION
fi
cd $PRGNAM-$VERSION
# configuration # configuration
CFLAGS=$SLCKFLAGS \ CFLAGS=$SLCKFLAGS \
@ -75,9 +68,9 @@ chmod +x $PKG/etc/profile.d/*
cd $PKG cd $PKG
chown -R root:root * chown -R root:root *
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKG/usr/doc/$PRGNAM
cd $TMP/$PRGNAM-$VERSION cd $TMP/$PRGNAM
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION cp -R *.md COPYING $PKG/usr/doc/$PRGNAM
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \; [ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
@ -107,4 +100,4 @@ EOF
# empaquetage # empaquetage
cd $PKG cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz

View file

@ -18,6 +18,31 @@ REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
DOCS="ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README TODO" DOCS="ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README TODO"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
elif [ "$ARCH" = "aarch64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
fi
rm -rf $PKG $TMP/$PRGNAM rm -rf $PKG $TMP/$PRGNAM
mkdir -p $PKG mkdir -p $PKG
cd $TMP cd $TMP
@ -33,8 +58,23 @@ else
fi fi
cd $PRGNAM cd $PRGNAM
mkdir -p $PKG/usr/share/lua/5.1/ LUA_VERSION=$(lua -v 2>&1 | grep -o "5\..")
cp -R lua/pl $PKG/usr/share/lua/5.1/
sed -i \
-e '/^CFLAGS= /s,-O2,'"$SLKCFLAGS"',' \
-e "s|/usr/local|/usr|" \
-e "s|/lib/lua/|/share/lua/|" \
-e "s|LUA_VERSION=5.1|LUA_VERSION=$LUA_VERSION|" \
Makefile
LIBDIRSUFFIX=$( uname -m | grep -o 64 )
make LUA_LIBDIR=/usr/lib$LIBDIRSUFFIX/lua/$LUA_VERSION \
LUA_SHAREDIR=/usr/share/lua/$LUA_VERSION \
PREFIX=/usr CFLAGS="$SLKCFLAGS"
make LUA_LIBDIR=/usr/lib$LIBDIRSUFFIX/lua/$LUA_VERSION \
LUA_SHAREDIR=/usr/share/lua/$LUA_VERSION \
DESTDIR=$PKG install
cd $PKG cd $PKG
@ -52,7 +92,7 @@ cat << EOF > install/slack-desc
# customary to leave one space after the ':'. # customary to leave one space after the ':'.
|-----handy-ruler-----------------------------------------------------| |-----handy-ruler-----------------------------------------------------|
$PRGNAM: $PRGNAM (Lua libs) $PRGNAM: $PRGNAM (Lua Filesystem libraries)
$PRGNAM: $PRGNAM:
$PRGNAM: A set of pure Lua libraries focusing on input data handling (such as $PRGNAM: A set of pure Lua libraries focusing on input data handling (such as
$PRGNAM: reading configuration files), functional programming (such as map, $PRGNAM: reading configuration files), functional programming (such as map,
@ -61,7 +101,7 @@ $PRGNAM: the functionality is inspired by the Python standard libraries.
$PRGNAM: $PRGNAM:
$PRGNAM: $PRGNAM:
$PRGNAM: $PRGNAM:
$PRGNAM: http://stevedonovan.github.com/Penlight/ $PRGNAM: https://github.com/keplerproject/luafilesystem
$PRGNAM: $PRGNAM:
EOF EOF