diff --git a/d/lua/SlackBuild b/d/lua/SlackBuild index f9a5a04f..9a10a8ed 100755 --- a/d/lua/SlackBuild +++ b/d/lua/SlackBuild @@ -1,29 +1,41 @@ #!/bin/sh -# Slackware build script for Lua +# Slackware build script for lua53 -# 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 +# Copyright 2018 Azure Zanculmarktum +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# 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. -# Granted WTFPL, Version 2, as published by Sam Hocevar. See -# http://sam.zoy.org/wtfpl/COPYING for more details. +# Some of the codes were taken from development/lua/lua.SlackBuild -PRGNAM=lua -VERSION=${VERSION:-5.3.4} -MAJOR_VERSION=${VERSION%.*} +CWD=${CWD:-$(pwd)} +PRGNAM=$(basename $CWD) +VERSION=${VERSION:-5.4.0} BUILD=${BUILD:-1} TAG=${TAG:-gwh} if [ -z "$ARCH" ]; then - case "$( uname -m )" in - i?86) ARCH=i486 ;; - arm*) ARCH=arm ;; - *) ARCH=$( uname -m ) ;; - esac +case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; +esac fi CWD=$(pwd) @@ -31,15 +43,21 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" - LIBDIRSUFFIX="" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then - SLKCFLAGS="-O2 -march=i686 -mtune=i686" - LIBDIRSUFFIX="" + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then - SLKCFLAGS="-O2 -fPIC" - LIBDIRSUFFIX="64" + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" fi set -e @@ -47,67 +65,77 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT 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 -cd $PRGNAM-$VERSION +tar xvf $CWD/lua-$VERSION.tar.gz +cd lua-$VERSION 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 -patch -p1 -i $CWD/liblua.so.patch +eval $(sed -ne '/^\(V\|R\)= /s, ,,p' Makefile) -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 \ - 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 +sed -i \ + -e '/^CFLAGS= /s,-O2,'"$SLKCFLAGS"',' \ + -e '/-DLUA_USE_LINUX.*-Wl,-E -ldl -lreadline/s|-lreadline|& -lncurses|' \ + src/Makefile -cat < lua.pc -V=$MAJOR_VERSION -R=$VERSION +sed -i \ + -e '/^#define LUA_ROOT/s,".*,"/usr/",' \ + -e '/^#define LUA_CDIR/s,"lib,&'"${LIBDIRSUFFIX}"',' \ + src/luaconf.h -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 +make linux +make install DESTDIR=$PKG -Name: Lua -Description: An Extensible Extension Language -Version: \${R} -Requires: -Libs: -L\${libdir} -llua -lm -Cflags: -I\${includedir} -EOF +# Now let's build the shared library +mkdir -p shared +cd shared +ar -x $PKG/usr/lib${LIBDIRSUFFIX}/liblua.a +gcc -ldl -lreadline -lncurses -lm -shared *.o -o liblua.so.$R +cp -a liblua.so.$R $PKG/usr/lib${LIBDIRSUFFIX} +( 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 -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 +ln -s lua.pc lua-$V.pc +ln -s lua.pc lua${V%.?}${V#?.}.pc +cd - >/dev/null -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 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/usr/doc/$PRGNAM +cp -a README doc/* $PKG/usr/doc/$PRGNAM +cat $CWD/SlackBuild > $PKG/usr/doc/$PRGNAM/SlackBuild mkdir -p $PKG/install cat < $PKG/install/slack-desc @@ -133,5 +161,4 @@ 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} diff --git a/d/lua/liblua.so.patch b/d/lua/liblua.so.patch deleted file mode 100644 index f9e24f32..00000000 --- a/d/lua/liblua.so.patch +++ /dev/null @@ -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 \ diff --git a/d/lua/lua.pc.in b/d/lua/lua.pc.in new file mode 100644 index 00000000..579bce3d --- /dev/null +++ b/d/lua/lua.pc.in @@ -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) diff --git a/UNUSED/d/luarocks/SlackBuild b/d/luarocks/SlackBuild similarity index 70% rename from UNUSED/d/luarocks/SlackBuild rename to d/luarocks/SlackBuild index 7d0f6fc5..24afe8e7 100755 --- a/UNUSED/d/luarocks/SlackBuild +++ b/d/luarocks/SlackBuild @@ -7,14 +7,11 @@ TMP=/tmp/$TAG OUTPUT=/tmp CWD=$(pwd) REPOSITORIES=/home/installs/SlackBuilds/repositories +REPOSITORY=$REPOSITORIES/$PRGNAM PRGNAM=$(basename $CWD) PKG=$TMP/pkg-$PRGNAM -VERSION=$(date +%Y.%m%d_%H.%M) - -EXT=tar.gz - DOCS="COPYING* README*" ARCH=$(uname -m) @@ -25,26 +22,22 @@ PREFIX=/usr SLCKFLAGS="-fPIC -O2" # nettoyage préalable -rm -fr $PKG $TMP/$PRGNAM-$VERSION +rm -fr $PKG $TMP/$PRGNAM mkdir -p $PKG # mise en place cd $TMP -if [ -e $CWD/$PRGNAM-$VERSION.$EXT ]; then - tar xf $CWD/$PRGNAM-$VERSION.$EXT -else - [ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES - if [ ! -e $REPOSITORIES/$PRGNAM ]; then - git clone http://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM - else - ( cd $REPOSITORIES/$PRGNAM - git pull - ) - fi - cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM-$VERSION -fi -cd $PRGNAM-$VERSION +#[ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES +[ ! -e $REPOSITORIES/$PRGNAM ] && git clone http://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM +( cd $REPOSITORIES/$PRGNAM; + git pull +) +VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )" + +cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM + +cd $PRGNAM # configuration CFLAGS=$SLCKFLAGS \ @@ -75,9 +68,9 @@ chmod +x $PKG/etc/profile.d/* cd $PKG chown -R root:root * -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cd $TMP/$PRGNAM-$VERSION -cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION +mkdir -p $PKG/usr/doc/$PRGNAM +cd $TMP/$PRGNAM +cp -R *.md COPYING $PKG/usr/doc/$PRGNAM [ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \; @@ -107,4 +100,4 @@ EOF # empaquetage cd $PKG 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 diff --git a/l/luafilesystem/SlackBuild b/l/luafilesystem/SlackBuild index b02d30c7..322fdfb4 100755 --- a/l/luafilesystem/SlackBuild +++ b/l/luafilesystem/SlackBuild @@ -18,6 +18,31 @@ REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM 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 mkdir -p $PKG cd $TMP @@ -33,8 +58,23 @@ else fi cd $PRGNAM -mkdir -p $PKG/usr/share/lua/5.1/ -cp -R lua/pl $PKG/usr/share/lua/5.1/ +LUA_VERSION=$(lua -v 2>&1 | grep -o "5\..") + +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 @@ -52,7 +92,7 @@ cat << EOF > install/slack-desc # customary to leave one space after the ':'. |-----handy-ruler-----------------------------------------------------| -$PRGNAM: $PRGNAM (Lua libs) +$PRGNAM: $PRGNAM (Lua Filesystem libraries) $PRGNAM: $PRGNAM: A set of pure Lua libraries focusing on input data handling (such as $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: http://stevedonovan.github.com/Penlight/ +$PRGNAM: https://github.com/keplerproject/luafilesystem $PRGNAM: EOF