aboutsummaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-10-25 04:18:16 -0400
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-11-02 19:28:41 +0700
commitc913c971a25016146f619f9fcbfd9920693dc3c7 (patch)
tree09d25cefa5909b8b9b5d6bb0d03773c664c72043 /libraries
parentf82225552e5c352a7b0c25f166ac5754cd6300bf (diff)
libraries/LuaBitOp: Added (re-added) w/lua 5.4 and lua51 support.
Signed-off-by: B. Watson <urchlay@slackware.uk> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'libraries')
-rw-r--r--libraries/LuaBitOp/LuaBitOp.SlackBuild106
-rw-r--r--libraries/LuaBitOp/LuaBitOp.info10
-rw-r--r--libraries/LuaBitOp/README22
-rw-r--r--libraries/LuaBitOp/port-to-lua5.3.patch88
-rw-r--r--libraries/LuaBitOp/slack-desc19
5 files changed, 245 insertions, 0 deletions
diff --git a/libraries/LuaBitOp/LuaBitOp.SlackBuild b/libraries/LuaBitOp/LuaBitOp.SlackBuild
new file mode 100644
index 0000000000000..cb2494f8a9eef
--- /dev/null
+++ b/libraries/LuaBitOp/LuaBitOp.SlackBuild
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+# Slackware build script for LuaBitOp
+
+# Copyright 2017 Gerardo Zamudio <gerardo.zamudio@linux.com> Mexico City
+# 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.
+
+# 20241023 bkw: Modified by SlackBuilds.org, BUILD=2:
+# - build for lua 5.4 and lua51.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=LuaBitOp
+VERSION=${VERSION:-1.0.2}
+BUILD=${BUILD:-2}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+SLKCFLAGS="-O2 -fPIC" # on all platforms we need PIC
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS+=" -march=i586 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS+=" -march=i686 -mtune=i686"
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
+
+# 20241025 bkw: patch comes from Debian:
+# https://packages.debian.org/sid/lua-bitop
+# it supports lua 5.4 as well as 5.3.
+patch -p1 < $CWD/port-to-lua5.3.patch
+
+# 20241025 bkw: the "test" below will kill the script if it fails.
+runmake() {
+ local cmod=$( pkg-config $1 --variable INSTALL_CMOD )
+ local incs=$( pkg-config $1 --variable INSTALL_INC )
+
+ make clean
+
+ make \
+ INCLUDES=-I$incs \
+ CCOPT="$SLKCFLAGS" \
+ LDFLAGS="-Wl,-s" \
+ LUA=$1 all test
+
+ # 'make install' is broken but all frigging does is copy one file...
+ install -D -s -m0755 bit.so $PKG/$cmod/bit.so
+}
+
+runmake lua
+pkg-config --exists lua51 && runmake lua51
+
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -aR doc/* $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/libraries/LuaBitOp/LuaBitOp.info b/libraries/LuaBitOp/LuaBitOp.info
new file mode 100644
index 0000000000000..d8e3d2a3d9ede
--- /dev/null
+++ b/libraries/LuaBitOp/LuaBitOp.info
@@ -0,0 +1,10 @@
+PRGNAM="LuaBitOp"
+VERSION="1.0.2"
+HOMEPAGE="http://bitop.luajit.org/"
+DOWNLOAD="http://bitop.luajit.org/download/LuaBitOp-1.0.2.tar.gz"
+MD5SUM="d0c1080fe0c844e8477279668e2d0d06"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="lua"
+MAINTAINER="Gerardo Zamudio"
+EMAIL="gerardo.zamudio@linux.com"
diff --git a/libraries/LuaBitOp/README b/libraries/LuaBitOp/README
new file mode 100644
index 0000000000000..8307782079324
--- /dev/null
+++ b/libraries/LuaBitOp/README
@@ -0,0 +1,22 @@
+Lua BitOp is a C extension module for Lua 5.1/5.2 which adds bitwise
+operations on numbers.
+
+Features
+
+* Supported functions: bit.tobit, bit.tohex, bit.bnot, bit.band,
+ bit.bor, bit.bxor, bit.lshift, bit.rshift, bit.arshift, bit.rol,
+ bit.ror, bit.bswap
+* Consistent semantics across 16, 32 and 64 bit platforms.
+* Supports different lua_Number types: either IEEE 754 doubles, int32_t
+ or int64_t.
+* Runs on Linux, *BSD, Mac OS X, Windows and probably anything else you
+ can find.
+* Simple installation on all systems. No bulky configure scripts.
+ Embedded-systems-friendly.
+* Internal self-test on startup to detect miscompiles. Includes a
+ comprehensive test and benchmark suite.
+* Compatible with the built-in bitwise operations in LuaJIT 2.0.
+* It's as fast as you can get with the standard Lua/C API.
+
+Optional dependency: lua51. If lua51 is installed at build time, this
+package will contain a module for Lua 5.1.
diff --git a/libraries/LuaBitOp/port-to-lua5.3.patch b/libraries/LuaBitOp/port-to-lua5.3.patch
new file mode 100644
index 0000000000000..5ff846422bbab
--- /dev/null
+++ b/libraries/LuaBitOp/port-to-lua5.3.patch
@@ -0,0 +1,88 @@
+Author: Andrew Engelbrecht
+Description: Port to Lua 5.3 and 5.4
+ See https://github.com/LuaJIT/LuaJIT/issues/384 for details.
+Last-Modified: Fri, 27 Jan 2023 15:40:02 +0300
+
+--- a/bit.c
++++ b/bit.c
+@@ -32,8 +32,8 @@
+ #include "lua.h"
+ #include "lauxlib.h"
+
+-#ifdef _MSC_VER
+-/* MSVC is stuck in the last century and doesn't have C99's stdint.h. */
++#if defined(_MSC_VER) && (_MSC_VER < 1700)
++/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
+ typedef __int32 int32_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int64 uint64_t;
+@@ -46,7 +46,7 @@
+
+ typedef union {
+ lua_Number n;
+-#ifdef LUA_NUMBER_DOUBLE
++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE)
+ uint64_t b;
+ #else
+ UBits b;
+@@ -63,24 +63,25 @@
+ #else
+ bn.n = luaL_checknumber(L, idx);
+ #endif
+-#if defined(LUA_NUMBER_DOUBLE)
++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE)
+ bn.n += 6755399441055744.0; /* 2^52+2^51 */
+ #ifdef SWAPPED_DOUBLE
+ b = (UBits)(bn.b >> 32);
+ #else
+ b = (UBits)bn.b;
+ #endif
+-#elif defined(LUA_NUMBER_INT) || defined(LUA_NUMBER_LONG) || \
+- defined(LUA_NUMBER_LONGLONG) || defined(LUA_NUMBER_LONG_LONG) || \
+- defined(LUA_NUMBER_LLONG)
++#elif defined(LUA_NUMBER_INT) || defined(LUA_INT_INT) || \
++ defined(LUA_NUMBER_LONG) || defined(LUA_INT_LONG) || \
++ defined(LUA_NUMBER_LONGLONG) || defined(LUA_INT_LONGLONG) || \
++ defined(LUA_NUMBER_LONG_LONG) || defined(LUA_NUMBER_LLONG)
+ if (sizeof(UBits) == sizeof(lua_Number))
+ b = bn.b;
+ else
+ b = (UBits)(SBits)bn.n;
+-#elif defined(LUA_NUMBER_FLOAT)
++#elif defined(LUA_NUMBER_FLOAT) || defined(LUA_FLOAT_FLOAT)
+ #error "A 'float' lua_Number type is incompatible with this library"
+ #else
+-#error "Unknown number type, check LUA_NUMBER_* in luaconf.h"
++#error "Unknown number type, check LUA_NUMBER_*, LUA_FLOAT_*, LUA_INT_* in luaconf.h"
+ #endif
+ #if LUA_VERSION_NUM < 502
+ if (b == 0 && !lua_isnumber(L, idx)) {
+@@ -91,7 +92,11 @@
+ }
+
+ /* Return bit type. */
++#if LUA_VERSION_NUM < 503
+ #define BRET(b) lua_pushnumber(L, (lua_Number)(SBits)(b)); return 1;
++#else
++#define BRET(b) lua_pushinteger(L, (lua_Integer)(SBits)(b)); return 1;
++#endif
+
+ static int bit_tobit(lua_State *L) { BRET(barg(L, 1)) }
+ static int bit_bnot(lua_State *L) { BRET(~barg(L, 1)) }
+@@ -163,11 +168,15 @@
+ LUALIB_API int luaopen_bit(lua_State *L)
+ {
+ UBits b;
++#if LUA_VERSION_NUM < 503
+ lua_pushnumber(L, (lua_Number)1437217655L);
++#else
++ lua_pushinteger(L, (lua_Integer)1437217655L);
++#endif
+ b = barg(L, -1);
+ if (b != (UBits)1437217655L || BAD_SAR) { /* Perform a simple self-test. */
+ const char *msg = "compiled with incompatible luaconf.h";
+-#ifdef LUA_NUMBER_DOUBLE
++#if defined(LUA_NUMBER_DOUBLE) || defined(LUA_FLOAT_DOUBLE)
+ #ifdef _WIN32
+ if (b == (UBits)1610612736L)
+ msg = "use D3DCREATE_FPU_PRESERVE with DirectX";
diff --git a/libraries/LuaBitOp/slack-desc b/libraries/LuaBitOp/slack-desc
new file mode 100644
index 0000000000000..508fc96e99fae
--- /dev/null
+++ b/libraries/LuaBitOp/slack-desc
@@ -0,0 +1,19 @@
+# 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------------------------------------------------------|
+LuaBitOp: LuaBitOp (bitwise operations on numbers for Lua)
+LuaBitOp:
+LuaBitOp: Lua BitOp is a C extension module for Lua 5.1 which adds bitwise
+LuaBitOp: operations on numbers.
+LuaBitOp:
+LuaBitOp:
+LuaBitOp:
+LuaBitOp:
+LuaBitOp:
+LuaBitOp: Homepage: http://bitop.luajit.org/
+LuaBitOp: