From 3ba36d6c416359083cc3507fd2eee909d3b1e0e4 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Thu, 18 Aug 2011 21:26:14 +0000 Subject: Update to 0.14 for Slackware 13.37 --- psi/build/psi.SlackBuild | 149 ++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 80 deletions(-) diff --git a/psi/build/psi.SlackBuild b/psi/build/psi.SlackBuild index b91d4e06..98491681 100755 --- a/psi/build/psi.SlackBuild +++ b/psi/build/psi.SlackBuild @@ -1,6 +1,6 @@ #!/bin/sh # $Id$ -# Copyright (c) 2007 Eric Hameleers +# Copyright 2007, 2011 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for @@ -54,6 +54,8 @@ # More languages were added to the language pack. # Moved old 'qca' package files to their own package dir # (qca is part of Slackware 12.0) +# 0.14-1: 18/aug/2011 by Eric Hameleers +# * Updated the SlackBuild script for a Slackware 13.37 package. # # Run 'sh psi.SlackBuild --cleanup' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . @@ -64,20 +66,18 @@ # Set initial variables: PRGNAM=psi -VERSION=${VERSION:-0.10} +VERSION=${VERSION:-0.14} ARCH=${ARCH:-i486} -BUILD=${BUILD:-3} +BUILD=${BUILD:-1} # We are going to download and add the following language packs for psi: -LANG="ca de et es eo fr hu it nl pl pt_BR sk sl sr@Latn vi cs bg mk zh" -LANGURLBASE="http://psi-im.org/files/translation/${VERSION}/" +LANG="be cs de es fr it ja mk pl pt_BR ru sl sv ur_PK zh_TW" +LANGURLBASE="http://psi-im.org/download/lang/" DOCS="COPYING ChangeLog README TODO" # Where do we look for sources? -CWD=`pwd` -SRCDIR=`dirname $0` -[ "${SRCDIR:0:1}" == "." ] && SRCDIR=${CWD}/${SRCDIR} +SRCDIR=$(cd $(dirname $0); pwd) # Place to build (TMP) package (PKG) and output (OUTPUT) the program: TMP=${TMP:-/tmp/build} @@ -86,71 +86,68 @@ OUTPUT=${OUTPUT:-/tmp} # Make sure you edit SRCURL when you change the program's VERSION SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.bz2" -SRCURL="http://dl.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.bz2" +SRCURL="http://downloads.sourceforge.net/${PRGNAM}/${PRGNAM}-${VERSION}.tar.bz2" ## ## --- with a little luck, you won't have to edit below this point --- ## ## -# Exit the script on errors: -set -e -trap 'echo "$0 FAILED at line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR -# Catch unitialized variables: -set -u -P1=${1:-1} - -# Slackware 11 and up need other option (gcc > 3.3.x) -if [ `gcc -dumpversion | tr -d '.' |cut -c 1-2` -gt 33 ]; then - MOPT=tune -else - MOPT=cpu +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac fi case "$ARCH" in - i386) SLKCFLAGS="-O2 -march=i386 -m${MOPT}=i686" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - i486) SLKCFLAGS="-O2 -march=i486 -m${MOPT}=i686" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - s390) SLKCFLAGS="-O2" - SLKLDFLAGS=""; LIBDIRSUFFIX="" - ;; - powerpc) SLKCFLAGS="-O2" + i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKLDFLAGS=""; LIBDIRSUFFIX="" ;; x86_64) SLKCFLAGS="-O2 -fPIC" SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64" ;; - athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" + *) SLKCFLAGS="-O2" SLKLDFLAGS=""; LIBDIRSUFFIX="" ;; esac +# Exit the script on errors: +set -e +trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR +# Catch unitialized variables: +set -u +P1=${1:-1} + +# Save old umask and set to 0022: +_UMASK_=$(umask) +umask 0022 # Create working directories: +mkdir -p $OUTPUT # place for the package to be saved mkdir -p $TMP/tmp-$PRGNAM # location to build the source -rm -rf $TMP/tmp-$PRGNAM/* # By default we remove the remnants of previous build -mkdir -p $PKG # place for the package to be built -mkdir -p ${PKG}-lang # place for the package to be built -rm -rf $PKG/* # We always erase old package's contents: -rm -rf ${PKG}-lang/* # We always erase old package's contents: -mkdir -p $OUTPUT # place for the package to be saved - -# Source file availability: +mkdir -p $PKG # place for the package to be built +rm -rf $PKG/* # always erase old package's contents +rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build +rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log + # remove old log files + if ! [ -f ${SOURCE} ]; then + echo "Source '$(basename ${SOURCE})' not available yet..." + # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT + [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/$(basename $SOURCE)" + if [ -f ${SOURCE} ]; then echo "Ah, found it!"; continue; fi if ! [ "x${SRCURL}" == "x" ]; then - # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT - [ -w "$SRCDIR" ] || SOURCE="$OUTPUT/`basename ${SOURCE}`" - echo "Source '`basename ${SOURCE}`' not available yet..." - echo "Will download file to `dirname $SOURCE`" - wget -nv --connect-timeout=30 -O "${SOURCE}" "${SRCURL}" || true + echo "Will download file to $(dirname $SOURCE)" + wget -nv -T 20 -O "${SOURCE}" "${SRCURL}" || true if [ $? -ne 0 -o ! -s "${SOURCE}" ]; then - echo "Downloading '`basename ${SOURCE}`' failed.. aborting the build." + echo "Downloading '$(basename ${SOURCE})' failed... aborting the build." mv -f "${SOURCE}" "${SOURCE}".FAIL exit 1 fi else - echo "File '`basename ${SOURCE}`' not available.. aborting the build." + echo "File '$(basename ${SOURCE})' not available... aborting the build." exit 1 fi fi @@ -185,14 +182,10 @@ echo "++" cd $TMP/tmp-$PRGNAM echo "Extracting the source archive(s) for $PRGNAM..." -if `file ${SOURCE} | grep -q ": bzip2"`; then - tar -xjvf ${SOURCE} -elif `file ${SOURCE} | grep -q ": gzip"`; then - tar -xzvf ${SOURCE} -fi +tar -xvf ${SOURCE} cd ${PRGNAM}-${VERSION} chown -R root:root . -chmod -R u+w,go+r-w,a-s . +chmod -R u+w,go+r-w,a+X-s . echo Building ... LDFLAGS="$SLKLDFLAGS" \ @@ -202,13 +195,7 @@ CFLAGS="$SLKCFLAGS" \ make 2>&1 | tee $OUTPUT/make-${PRGNAM}.log # Install all the needed stuff to the package dir -# Use installwatch if available, to produce a logfile of the installation -# process that is more easily readable: -if `which installwatch > /dev/null 2>&1`; then - installwatch -o $OUTPUT/install-${PRGNAM}.log make INSTALL_ROOT=$PKG install -else - make INSTALL_ROOT=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log -fi +make INSTALL_ROOT=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log # Not only KDE wants a pixmap mkdir -p $PKG/usr/share/pixmaps/ @@ -216,34 +203,39 @@ cp $PKG/usr/share/icons/hicolor/32x32/apps/psi.png $PKG/usr/share/pixmaps/ # Update the desktop database: mkdir -p $PKG/install -cat <<-EOTT > $PKG/install/doinst.sh - if [ -x usr/bin/update-desktop-database ]; then - chroot . /usr/bin/update-desktop-database /usr/share/applications > /dev/null 2>&1 - fi - EOTT +cat < $PKG/install/doinst.sh +# Update the desktop database: +if [ -x usr/bin/update-desktop-database ]; then + chroot . /usr/bin/update-desktop-database usr/share/applications > /dev/null 2>&1 +fi +# Update hicolor theme cache: +if [ -d usr/share/icons/hicolor ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + chroot . /usr/bin/gtk-update-icon-cache -f -t usr/share/icons/hicolor 1> /dev/null 2> /dev/null + fi +fi + +EOT # Add documentation: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true -chmod -R a-w $PKG/usr/doc/$PRGNAM-$VERSION/* +cat $SRCDIR/$(basename $0) > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION +find $PKG/usr/doc -type f -exec chmod 644 {} \; # Compress the man page(s): if [ -d $PKG/usr/man ]; then find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \; fi -# Strip binaries: -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 - +# Strip binaries (if any): +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true # Add a package description: mkdir -p $PKG/install cat $SRCDIR/${PRGNAM}.slack-desc > $PKG/install/slack-desc -if [ -f $SRCDIR/doinst.sh ]; then - cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh -fi # Separate package "psi-lang" for the language translation files # Add some translations @@ -268,9 +260,6 @@ md5sum ${PRGNAM}-lang-${VERSION}-${ARCH}-${BUILD}.tgz > ${PRGNAM}-lang-${VERSION cd - cat ${PKG}-lang/install/slack-desc | grep "^${PRGNAM}-lang" > $OUTPUT/${PRGNAM}-lang-${VERSION}-${ARCH}-${BUILD}.txt -# Clean up the extra stuff: -if [ "$P1" = "--cleanup" ]; then - rm -rf $TMP/tmp-$PRGNAM - rm -rf $PKG - rm -rf ${PKG}-lang -fi +# Restore the original umask: +umask ${_UMASK_} + -- cgit v1.2.3-65-gdbad