From f9e5f10b3219cbe7cf9a2dbce9ae0194b2e9facf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ozan=20T=C3=BCrky=C4=B1lmaz?= Date: Sat, 1 Jan 2011 12:05:52 -0500 Subject: system/prelink: Miscellaneous build fixes. Added two helper scripts and a warning in the README. Signed-off-by: dsomero --- system/prelink/README | 33 ++++++++++++++++++++++----------- system/prelink/prelink-all | 11 +++++++++++ system/prelink/prelink-undo | 6 ++++++ system/prelink/prelink.SlackBuild | 23 +++++++++++++---------- system/prelink/prelink.cron | 2 +- system/prelink/prelink.info | 2 +- 6 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 system/prelink/prelink-all create mode 100644 system/prelink/prelink-undo (limited to 'system/prelink') diff --git a/system/prelink/README b/system/prelink/README index f55bdb00ab..8eaeeb26ab 100644 --- a/system/prelink/README +++ b/system/prelink/README @@ -1,13 +1,24 @@ -Prelink is a program that modifies ELF shared libraries and ELF dynamically -linked binaries in such a way that the time needed for the dynamic linker to -perform relocations at startup significantly decreases. Due to fewer -relocations, the run-time memory consumption decreases as well (especially -the number of unshareable pages). The prelinking information is only used -at startup time if none of the dependent libraries have changed since -prelinking; otherwise, programs are relocated normally. +Prelink is a program that modifies ELF shared libraries and ELF +dynamically linked binaries in such a way that the time needed for +the dynamic linker to perform relocations at start-up significantly +decreases. Due to fewer relocations, the run-time memory consumption +decreases as well (especially the number of unsharable pages). The +prelinking information is only used at start-up time if none of the +dependent libraries have changed since prelinking; otherwise programs +are relocated normally. -There is a script in the prelink documentation directory that is suitable -for a cron job. Before setting up a cron job, first run prelink on the -system and then read the script and modify it as needed. +This requires libelf which is available from slackbuilds.org.org -This requires libelf. +There's a script for prelink suitable for a cron job which can be found +at /usr/doc/prelink-$VERSION. Before setting up a cron job, First run +prelink on the system then read script and modify it if you think it's +needed. + +WARNING: Non-prelinked binaries may cause SEGFAULT in prelinked +systems using prelinked libraries. If some programs crashes with +SEGFAULT while calling system libraries then run prelink on the +programs in question. The prelink-all script ,which can be found in +/usr/doc/prelink-$VERSION, can be used to prelink all system as a root. +In same place as prelink-all script, there is a prelink-undo script to +undo prelink system wide. Run it as root and it will undo the prelink +system wide. diff --git a/system/prelink/prelink-all b/system/prelink/prelink-all new file mode 100644 index 0000000000..f75be7d5f8 --- /dev/null +++ b/system/prelink/prelink-all @@ -0,0 +1,11 @@ +#!/bin/sh +# +# This small script can be used for prelinking whole system while in root +# account. It will do a -amR on the system according to /etc/prelink.conf +# Check prelink(8) for details. + +renice +19 -p $$ > /dev/null 2>&1 + +PRELINKOPTS=${PRELINKOPTS:-amR} + +/usr/sbin/prelink -$PRELINKOPTS diff --git a/system/prelink/prelink-undo b/system/prelink/prelink-undo new file mode 100644 index 0000000000..1535f9ef3f --- /dev/null +++ b/system/prelink/prelink-undo @@ -0,0 +1,6 @@ +#!/bin/sh +#Undo the prelink system wide. + +renice +19 -p $$ > /dev/null 2>&1 + +prelink -au diff --git a/system/prelink/prelink.SlackBuild b/system/prelink/prelink.SlackBuild index 9c5169d00b..97b71cc8ca 100644 --- a/system/prelink/prelink.SlackBuild +++ b/system/prelink/prelink.SlackBuild @@ -24,7 +24,7 @@ PRGNAM=prelink VERSION=${VERSION:-20100106} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -36,7 +36,7 @@ if [ -z "$ARCH" ]; then fi CWD=$(pwd) -TPM=${TMP:-/tmp/SBo} +TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} @@ -59,9 +59,11 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM +rm -rf $PRGNAM-$VERSION tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 -cd $PRGNAM +mv $PRGNAM $PRGNAM-$VERSION +cd $PRGNAM-$VERSION + chown -R root:root . find . \ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ @@ -80,11 +82,8 @@ CXXFLAGS="$SLKFLAGS" \ --build=$ARCH-slackware-linux make -make -C doc -make install DESTDIR=$PKG - -find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ - | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +make -C doc +make install-strip DESTDIR=$PKG find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlint $i ).gz $i.gz ; rm $i ; done @@ -94,10 +93,14 @@ cat $CWD/prelink.conf > $PKG/etc/prelink.conf.new mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a \ - AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO doc/*.pdf \ + AUTHORS COPYING ChangeLog INSTALL NEWS README THANKS TODO \ $PKG/usr/doc/$PRGNAM-$VERSION +cp doc/prelink.pdf $PKG/usr/doc/$PRGNAM-$VERSION + cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/prelink.cron > $PKG/usr/doc/$PRGNAM-$VERSION/prelink.cron +cat $CWD/prelink-all > $PKG/usr/doc/$PRGNAM-$VERSION/prelink-all +cat $CWD/prelink-undo > $PKG/usr/doc/$PRGNAM-$VERSION/prelink-undo mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc diff --git a/system/prelink/prelink.cron b/system/prelink/prelink.cron index 5a5f15739b..5ffd98b9d0 100644 --- a/system/prelink/prelink.cron +++ b/system/prelink/prelink.cron @@ -5,6 +5,6 @@ renice +19 -p $$ > /dev/null 2>&1 #By default, we'll do quick cron runs of prelink PRELINK_OPTS="-amRq" #If you don't want to do this, then use this opts. -#PRELINK_OPT="-amR" +#PRELINK_OPTS="-amR" /usr/sbin/prelink $PRELINK_OPTS diff --git a/system/prelink/prelink.info b/system/prelink/prelink.info index 652c1125e6..11e4e74750 100644 --- a/system/prelink/prelink.info +++ b/system/prelink/prelink.info @@ -7,4 +7,4 @@ DOWNLOAD_x86_64="" MD5SUM_x86_64="" MAINTAINER="Ozan Türkyılmaz" EMAIL="ozan.turkyilmaz@gmail.com" -APPROVED="rworkman" +APPROVED="dsomero" -- cgit v1.2.3