development/urn: Support for lua 5.4, lua51, luajit.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-10-21 18:05:31 -04:00 committed by Willy Sudiarto Raharjo
parent 7e2f9f95f4
commit 60b9a232b4
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 28 additions and 39 deletions

View file

@ -13,11 +13,11 @@ What?
[1]: Minimalism is an implementation detail.
Default urn works with lua 5.1.
Default urn works with lua 5.4.
You can set "URN_LUAVER" environment variable to change the lua version.
Example:
URN_LUAVER=5.3 for lua 5.3
URN_LUAVER=5.1 for lua51
URN_LUAVER=jit for luajit
Optional Dependency:

View file

@ -21,25 +21,20 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 20241021 bkw: Modified by SlackBuilds.org, BUILD=2:
# - update README for lua 5.4.
# - noarch.
# - properly support URN_LUAVER.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=urn
VERSION=${VERSION:-0.7.2}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
ARCH=noarch
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
@ -49,22 +44,23 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
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"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
LUACMD=/usr/bin/lua$URN_LUAVER
if [ ! -x "$LUACMD" ]; then
echo "**************************************"
echo "Can't find lua$URN_LUAVER command."
case "$URN_LUAVER" in
""|jit|5.1)
echo "Install lua$( echo $URN_LUAVER | sed 's,\.,,g' ) and try again." ;;
*) echo "Unsupported lua version '$URN_LUAVER', see README." ;;
esac
echo "**************************************"
echo
exit 1
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
@ -72,14 +68,10 @@ rm -rf $PRGNAM-v$VERSION
tar xvf $CWD/$PRGNAM-v$VERSION.tar.gz
cd $PRGNAM-v$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 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
make all
make all
make all LUA=$LUACMD
install -m 755 -d $PKG/usr/bin
install -m 755 -d $PKG/usr/share/$PRGNAM
@ -90,13 +82,10 @@ find bin -type f -exec install -m 755 {} $PKG/usr/share/$PRGNAM/{} \;
cat << EOF > $PKG/usr/bin/urn
#!/usr/bin/env sh
exec lua\$URN_LUAVER /usr/share/urn/bin/urn.lua \$@
exec $LUACMD /usr/share/urn/bin/urn.lua \$@
EOF
chmod 755 $PKG/usr/bin/urn
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
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LICENCE README.md $PKG/usr/doc/$PRGNAM-$VERSION