From 308e807bcb9e858954de8ef32b5de5cd86a0cb6f Mon Sep 17 00:00:00 2001 From: Damian Perticone Date: Sat, 23 Apr 2022 00:16:17 +0100 Subject: libraries/tllist: Added (typed linked list c header file) Signed-off-by: Dave Woodfall Signed-off-by: Willy Sudiarto Raharjo --- libraries/tllist/README | 24 ++++++++ libraries/tllist/slack-desc | 19 ++++++ libraries/tllist/tllist.SlackBuild | 118 +++++++++++++++++++++++++++++++++++++ libraries/tllist/tllist.info | 10 ++++ 4 files changed, 171 insertions(+) create mode 100644 libraries/tllist/README create mode 100644 libraries/tllist/slack-desc create mode 100644 libraries/tllist/tllist.SlackBuild create mode 100644 libraries/tllist/tllist.info diff --git a/libraries/tllist/README b/libraries/tllist/README new file mode 100644 index 0000000000..a0113f5afe --- /dev/null +++ b/libraries/tllist/README @@ -0,0 +1,24 @@ +Most C implementations of linked list are untyped. That is, their data +carriers are typically void *. This is error prone since your compiler +will not be able to help you correct your mistakes. + +tllist addresses this by using pre-processor macros to implement +dynamic types, where the data carrier is typed to whatever you want; +both primitive data types are supported as well as aggregated ones +such as structs, enums and unions. + +Being a double-linked list, most operations are constant in time +(including pushing and popping both to/from front and back). + +The memory overhead is fairly small; each item carries, besides its +data, a prev and next pointer (i.e. a constant 16 byte overhead per item +on 64-bit architectures). + +The list itself has two head and tail pointers, plus a length variable +(typically 8 bytes on 64-bit architectures) to make list length lookup +constant in time. + +Thus, assuming 64-bit pointers (and a 64-bit size_t type), the total +overhead is 3*8 + n*2*8 bytes. + +tllist is a needed dependency for fcft,foot,fuzzel,fnott,wbg diff --git a/libraries/tllist/slack-desc b/libraries/tllist/slack-desc new file mode 100644 index 0000000000..1b63bf7a3f --- /dev/null +++ b/libraries/tllist/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 ':'. + + |-----handy-ruler------------------------------------------------------| +tllist: tllist (typed linked list c header file) +tllist: +tllist: Tllist is a Typed Linked List C header file only library implemented +tllist: using pre-processor macros. +tllist: +tllist: +tllist: +tllist: Homepage: https://codeberg.org/dnk/tllist +tllist: +tllist: +tllist: diff --git a/libraries/tllist/tllist.SlackBuild b/libraries/tllist/tllist.SlackBuild new file mode 100644 index 0000000000..0bce38afa5 --- /dev/null +++ b/libraries/tllist/tllist.SlackBuild @@ -0,0 +1,118 @@ +#!/bin/bash + +# Slackware build script for tllist + +# Copyright 2022 Damian Perticone Berisso,Argentina +# 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. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=tllist +VERSION=${VERSION:-1.0.5} +BUILD=${BUILD:-1} +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} + +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 + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/$VERSION.tar.gz +cd $PRGNAM +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 {} \; + +mkdir build +cd build + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + meson .. \ + --buildtype=release \ + --infodir=/usr/info \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --localstatedir=/var \ + --mandir=/usr/man \ + --prefix=/usr \ + --sysconfdir=/etc \ + -Dstrip=true \ + + "${NINJA:=ninja}" + DESTDIR=$PKG $NINJA install + +rm -r $PKG/usr/share + +cd .. + +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la + +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 -name perllocal.pod \ + -o -name ".packlist" \ + -o -name "*.bs" \ + | xargs rm -f + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE PKGBUILD README.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$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/tllist/tllist.info b/libraries/tllist/tllist.info new file mode 100644 index 0000000000..364a152d7e --- /dev/null +++ b/libraries/tllist/tllist.info @@ -0,0 +1,10 @@ +PRGNAM="tllist" +VERSION="1.0.5" +HOMEPAGE="https://codeberg.org/dnkl/tllist" +DOWNLOAD="https://codeberg.org/dnkl/tllist/archive/1.0.5.tar.gz" +MD5SUM="5a778c92b33b654564094c8a40dce848" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Damian Perticone" +EMAIL="mjolnirdam@gmail.com" -- cgit v1.2.3