slackbuilds

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

autorandr.SlackBuild (2802B)


      1 #!/bin/sh
      2 
      3 # Slackware build script for autorandr
      4 #
      5 # Permission is hereby granted, free of charge, to any person obtaining a
      6 # copy of this software and associated documentation files (the "Software"),
      7 # to deal in the Software without restriction, including without limitation
      8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
      9 # and/or sell copies of the Software, and to permit persons to whom the
     10 # Software is furnished to do so, subject to the following conditions:
     11 #
     12 # The above copyright notice and this permission notice shall be included
     13 # in all copies or substantial portions of the Software.
     14 #
     15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
     19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     21 # OTHER DEALINGS IN THE SOFTWARE.
     22 
     23 PRGNAM=autorandr
     24 VERSION=${VERSION:-1.9}
     25 BUILD=${BUILD:-1}
     26 TAG=${TAG:-_djmoch}
     27 
     28 if [ -z "$ARCH" ]; then
     29   case "$( uname -m )" in
     30     i?86) ARCH=i586 ;;
     31     arm*) ARCH=arm ;;
     32        *) ARCH=$( uname -m ) ;;
     33   esac
     34 fi
     35 
     36 CWD=$(pwd)
     37 TMP=${TMP:-/tmp/djmoch}
     38 PKG=$TMP/package-$PRGNAM
     39 OUTPUT=${OUTPUT:-/tmp}
     40 
     41 if [ "$ARCH" = "i586" ]; then
     42   SLKCFLAGS="-O2 -march=i586 -mtune=i686"
     43   LIBDIRSUFFIX=""
     44 elif [ "$ARCH" = "i686" ]; then
     45   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
     46   LIBDIRSUFFIX=""
     47 elif [ "$ARCH" = "x86_64" ]; then
     48   SLKCFLAGS="-O2 -fPIC"
     49   LIBDIRSUFFIX="64"
     50 else
     51   SLKCFLAGS="-O2"
     52   LIBDIRSUFFIX=""
     53 fi
     54 
     55 set -e
     56 
     57 rm -rf $PKG
     58 mkdir -p $TMP $PKG $OUTPUT
     59 cd $TMP
     60 rm -rf $PRGNAM-$VERSION
     61 tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
     62 cd $PRGNAM-$VERSION
     63 chown -R root:root .
     64 find -L . \
     65  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
     66   -o -perm 511 \) -exec chmod 755 {} \; -o \
     67  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
     68   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
     69 
     70 python3 setup.py install --root=$PKG --optimize=1
     71 
     72 gzip -9 $PRGNAM.1
     73 install -Dm644 $PRGNAM.1.gz $PKG/usr/man/man1/$PRGNAM.1.gz
     74 
     75 install -Dm644 README.md $PKG/usr/doc/$PRGNAM-$VERSION/README
     76 install -Dm644 gpl-3.0.txt $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE
     77 install -Dm644 $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAME.SlackBuild
     78 install -Dm644 $CWD/slack-desc $PKG/install/slack-desc
     79 install -Dm644 $CWD/40-monitor-hotplug.rules $PKG/lib/udev/rules.d/40-monitor-hotplug.rules
     80 install -Dm644 contrib/pm-utils/40autorandr $PKG/usr/lib$LIBDIRSUFFIX/pm-utils/sleep.d/40autorandr
     81 
     82 cd $PKG
     83 /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.${PKGTYPE:-tgz}