111 lines
3.2 KiB
Bash
Executable file
111 lines
3.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
CWD=$(pwd)
|
|
|
|
# default settings
|
|
PRGNAM=$(basename $CWD)
|
|
ARCH=$(uname -m)
|
|
VERSION=${VERSION:-$(date +%Y.%m.%d_%H.%M)}
|
|
BUILD=1
|
|
|
|
|
|
TAG=gwh
|
|
TMP=/tmp/$TAG
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
OUTPUT=/tmp
|
|
|
|
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
|
|
|
|
if [ -e $CWD/$PRGNAM-$VERSION.tar.xz ] ; then
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
|
|
else
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/keplerproject/luafilesystem.git $REPOSITORY
|
|
( cd $REPOSITORY && git pull )
|
|
VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
|
|
|
|
cp -R $REPOSITORY $PRGNAM
|
|
fi
|
|
cd $PRGNAM
|
|
|
|
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
|
|
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
|
|
|
|
mkdir -p install
|
|
cat << EOF > 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 ':'.
|
|
|
|
|-----handy-ruler-----------------------------------------------------|
|
|
$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,
|
|
$PRGNAM: reduce, placeholder expressions,etc), and OS path management. Much of
|
|
$PRGNAM: the functionality is inspired by the Python standard libraries.
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM:
|
|
$PRGNAM: https://github.com/keplerproject/luafilesystem
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
chown -R root:root $PKG
|
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
/sbin/makepkg -c n -l y $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz
|