slackbuilds_ponce/graphics/ldglite/ldglite.SlackBuild

86 lines
2.2 KiB
Text
Raw Normal View History

#!/bin/sh
# Slackware build script for ldglite:
# a program to view and edit LDraw files
# Written by Niels Horn - niels.horn@gmail.com
# revision date 2010/01/27
PRGNAM=ldglite
VERSION=1.2.4
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
SRCVERSION=$(echo $VERSION | tr . _)
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
# We cannot use -O2 - compilation will crash
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $TMP/$PRGNAM-$VERSION $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
unzip $CWD/${PRGNAM}${SRCVERSION}src.zip -d $PRGNAM-$VERSION
cd $PRGNAM-$VERSION/$PRGNAM
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# patch makefile.linux to add SBO_FLAGS
patch < $CWD/cflags.patch
SBO_FLAGS=$SLKCFLAGS ENABLE_OFFSCREEN_RENDERING=no make -f makefile.linux
# Install manually
mkdir -p $PKG/usr/bin
cp -a $PRGNAM $PKG/usr/bin/${PRGNAM}_bin
strip --strip-unneeded $PKG/usr/bin/${PRGNAM}_bin
cat $CWD/$PRGNAM.sh > $PKG/usr/bin/$PRGNAM
chmod 0755 $PKG/usr/bin/$PRGNAM
# Copy icon & desktop file to package
mkdir -p $PKG/usr/share/{applications,mime/packages,pixmaps}
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
cat $CWD/ldraw.xml > $PKG/usr/share/mime/packages/ldraw.xml
cd doc
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a LDGLITE.TXT LICENCE README.TXT bowtie.txt $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION/ -type f -exec chmod 644 {} \;
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}