From f3a236a8b4081ae5d5a0d783a9e9edec08d56d13 Mon Sep 17 00:00:00 2001 From: V'yacheslav Stetskevych Date: Thu, 13 May 2010 00:59:13 +0200 Subject: libraries/pthsem: Added to 13.0 repository --- .../0001-Use-monotonic-clock-for-pthsem.patch | 35 ++++++++ libraries/pthsem/README | 7 ++ libraries/pthsem/pthsem.SlackBuild | 96 ++++++++++++++++++++++ libraries/pthsem/pthsem.info | 10 +++ libraries/pthsem/slack-desc | 19 +++++ 5 files changed, 167 insertions(+) create mode 100644 libraries/pthsem/0001-Use-monotonic-clock-for-pthsem.patch create mode 100644 libraries/pthsem/README create mode 100644 libraries/pthsem/pthsem.SlackBuild create mode 100644 libraries/pthsem/pthsem.info create mode 100644 libraries/pthsem/slack-desc diff --git a/libraries/pthsem/0001-Use-monotonic-clock-for-pthsem.patch b/libraries/pthsem/0001-Use-monotonic-clock-for-pthsem.patch new file mode 100644 index 0000000000..c049529fbb --- /dev/null +++ b/libraries/pthsem/0001-Use-monotonic-clock-for-pthsem.patch @@ -0,0 +1,35 @@ +From 1eedb024a141665fd186d1d51e73bb64c6202476 Mon Sep 17 00:00:00 2001 +From: Martin Koegler +Date: Sat, 23 Aug 2008 00:54:20 +0200 +Subject: [PATCH] Use montonic clock for pthsem + +Signed-off-by: Martin Koegler +--- + pth_time.c | 11 +++++++++++ + 1 files changed, 11 insertions(+), 0 deletions(-) + +diff --git a/pth_time.c b/pth_time.c +index b94dafe..e81f80a 100644 +--- a/pth_time.c ++++ b/pth_time.c +@@ -60,6 +60,17 @@ intern void pth_time_usleep(unsigned long usec) + #else + #define __gettimeofday(t) gettimeofday(t, NULL) + #endif ++#undef __gettimeofday ++ ++static int inline __gettimeofday(struct timeval *tv) ++{ ++ struct timespec t; ++ int res = clock_gettime(CLOCK_MONOTONIC, &t); ++ tv->tv_sec = t.tv_sec; ++ tv->tv_usec = t.tv_nsec/1000; ++ return res; ++} ++ + #define pth_time_set(t1,t2) \ + do { \ + if ((t2) == PTH_TIME_NOW) \ +-- +1.5.3.1 + diff --git a/libraries/pthsem/README b/libraries/pthsem/README new file mode 100644 index 0000000000..7e8dcc7284 --- /dev/null +++ b/libraries/pthsem/README @@ -0,0 +1,7 @@ +pthsem is an extended version of the GNU Pth, a user mode multi threading +library, with added support for semaphores. This package can be installed +in parallel with a normal pth, which is included in Slackware. + +This version includes a patch by the developer to make pthsem use the +monotonic clock and be able to react to date and time changes more +adequately. diff --git a/libraries/pthsem/pthsem.SlackBuild b/libraries/pthsem/pthsem.SlackBuild new file mode 100644 index 0000000000..b1d78cc8f4 --- /dev/null +++ b/libraries/pthsem/pthsem.SlackBuild @@ -0,0 +1,96 @@ +#!/bin/sh + +# Slackware build script for pthsem. + +# Written by V'yacheslav Stetskevych + +PRGNAM=pthsem +VERSION=${VERSION:-2.0.7} +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +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 . \ + \( -perm 777 -o -perm 775 -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 {} \; + +# Apply the patch to use the monotonic clock, for eibd to work correctly +# after a date/time change. +patch -p1 < $CWD/0001-Use-monotonic-clock-for-pthsem.patch + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux \ + --enable-shared=yes \ + --enable-static=no \ + --enable-pthread=no + +# Edit the Makefile to enable compilation with the monotonic clock patch. +sed 's/-ldl/-ldl -lrt/' Makefile > Makefile.sed +mv Makefile.sed Makefile + +make +make test +make install DESTDIR=$PKG + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true +) + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; +) + +# Edit the output of pthsem-config to let eibd compile against modified pthsem. +( cd $PKG/usr/bin + sed 's/-lpthsem/-lpthsem -lrt/' pthsem-config > pthsem-config.sed + mv pthsem-config.sed pthsem-config + chmod 755 pthsem-config +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a ANNOUNCE AUTHORS COPYING HACKING HISTORY INSTALL NEWS PORTING \ + README SUPPORT TESTS THANKS USERS $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:-tgz} diff --git a/libraries/pthsem/pthsem.info b/libraries/pthsem/pthsem.info new file mode 100644 index 0000000000..1fe61b8b8f --- /dev/null +++ b/libraries/pthsem/pthsem.info @@ -0,0 +1,10 @@ +PRGNAM="pthsem" +VERSION="2.0.7" +HOMEPAGE="http://www.auto.tuwien.ac.at/~mkoegler/index.php/pth" +DOWNLOAD="http://www.auto.tuwien.ac.at/~mkoegler/pth/pthsem-2.0.7.tar.gz" +MD5SUM="b277716ee1224ca9925176fa29e1f0c5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="V'yacheslav Stetskevych" +EMAIL="slava18@gmail.com" +APPROVED="dsomero" diff --git a/libraries/pthsem/slack-desc b/libraries/pthsem/slack-desc new file mode 100644 index 0000000000..097931f81a --- /dev/null +++ b/libraries/pthsem/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------------------------------------------------------| +pthsem: pthsem (extended version of the GNU Pth) +pthsem: +pthsem: pthsem is an extended version of the GNU Pth, a user mode +pthsem: multi threading library, with added support for semaphores. +pthsem: This package can be installed in parallel with a normal pth, +pthsem: which is included in Slackware. +pthsem: +pthsem: This version includes a patch by the developer to make pthsem use +pthsem: the monotonic clock and be able to react to date and time changes +pthsem: more adequately. +pthsem: Homepage: http://www.auto.tuwien.ac.at/~mkoegler/index.php/pth -- cgit v1.2.3-65-gdbad