slackbuilds

Personal Slackbuilds in the style of slackbuilds.org
git clone git://git.danielmoch.com/slackbuilds.git
Log | Files | Refs

libedit.SlackBuild (3172B)


      1 #!/bin/sh
      2 
      3 # Slackware build script for libedit
      4 
      5 # Copyright 2011 Mikko Värri, Finland
      6 # Copyright 2013-2019 LEVAI Daniel <leva@ecentrum.hu>
      7 # All rights reserved.
      8 #
      9 # Redistribution and use of this script, with or without modification, is
     10 # permitted provided that the following conditions are met:
     11 #
     12 # 1. Redistributions of this script must retain the above copyright
     13 #    notice, this list of conditions and the following disclaimer.
     14 #
     15 #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
     16 #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     17 #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
     18 #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     19 #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     20 #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     21 #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     22 #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     23 #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     24 #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     25 
     26 PRGNAM=libedit
     27 VERSION=${VERSION:-20191231_3.1}
     28 BUILD=${BUILD:-1}
     29 TAG=${TAG:-_djmoch}
     30 
     31 if [ -z "$ARCH" ]; then
     32   case "$( uname -m )" in
     33     i?86) ARCH=i586 ;;
     34     arm*) ARCH=arm ;;
     35        *) ARCH=$( uname -m ) ;;
     36   esac
     37 fi
     38 
     39 CWD=$(pwd)
     40 TMP=${TMP:-/tmp/djmoch}
     41 PKG=$TMP/package-$PRGNAM
     42 OUTPUT=${OUTPUT:-/tmp}
     43 
     44 SRC_VERSION=$(echo $VERSION | tr _ -)
     45 
     46 if [ "$ARCH" = "i586" ]; then
     47   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
     48   LIBDIRSUFFIX=""
     49 elif [ "$ARCH" = "i686" ]; then
     50   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
     51   LIBDIRSUFFIX=""
     52 elif [ "$ARCH" = "x86_64" ]; then
     53   SLKCFLAGS="-O2 -fPIC"
     54   LIBDIRSUFFIX="64"
     55 else
     56   SLKCFLAGS="-O2"
     57   LIBDIRSUFFIX=""
     58 fi
     59 
     60 set -e
     61 
     62 rm -rf $PKG
     63 mkdir -p $TMP $PKG $OUTPUT
     64 cd $TMP
     65 rm -rf $PRGNAM-$SRC_VERSION
     66 tar xvf $CWD/$PRGNAM-$SRC_VERSION.tar.gz
     67 cd $PRGNAM-$SRC_VERSION
     68 chown -R root:root .
     69 find -L . \
     70  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
     71  -exec chmod 755 {} \; -o \
     72  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
     73  -exec chmod 644 {} \;
     74 
     75 if [ "${LIBEDIT_WIDEC}" = 'yes' ];then
     76 	LIBEDIT_WIDEC='--enable-widec'
     77 else
     78 	LIBEDIT_WIDEC='--disable-widec'
     79 fi
     80 
     81 patch -p1 <$CWD/el.patch
     82 CFLAGS="$SLKCFLAGS" \
     83 CXXFLAGS="$SLKCFLAGS" \
     84 ./configure \
     85   --prefix=/usr \
     86   --libdir=/usr/lib${LIBDIRSUFFIX} \
     87   --mandir=/usr/man \
     88   --disable-static \
     89   --build=$ARCH-slackware-linux \
     90   "${LIBEDIT_WIDEC}"
     91 
     92 make
     93 make install-strip DESTDIR=$PKG
     94 
     95 find $PKG/usr/man -type f -exec gzip -9 {} \;
     96 for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
     97 
     98 mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
     99 cp -a COPYING ChangeLog INSTALL THANKS $PKG/usr/doc/$PRGNAM-$VERSION
    100 cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
    101 mv $PKG/usr/man/man3/history.3.gz $PKG/usr/man/man3/el_history.3.gz
    102 
    103 mkdir -p $PKG/install
    104 cat $CWD/slack-desc > $PKG/install/slack-desc
    105 
    106 cd $PKG
    107 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}