#!/bin/sh # Copyright Loris Vincenzi (http://www.slacky.eu) # All rights reserved. # # Heavily based on the Slackware 13.1 SlackBuild # http://www.cybercom.net/~dcoffin/dcraw/ # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Exit on most errors set -e # Set variables: CWD=`pwd` OUTPUT=${OUTPUT:-$CWD} PKGNAME=dcraw TMP=${TMP:-/tmp/txz/$PKGNAME} PKG=$TMP/package VERSION=${VERSION:-9.03} ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-sl} SOURCE="http://www.cybercom.net/~dcoffin/dcraw/archive/$PKGNAME-$VERSION.tar.gz" # Download sorce tarball if still not present if [ ! -e $CWD/$PKGNAME-$VERSION.tar.gz ]; then wget -c $SOURCE fi # Set compiling FLAGS if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST="i486" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686"; SLKLDFLAGS=""; LIBDIRSUFFIX=""; CHOST="i686" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC"; SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"; CHOST="x86_64" fi # DCRaw build flags as suggested on the author's page. # builds with support for jpeg, png, lcms and tiff DCRAW_BUILD_FLAGS="-lm -ljpeg -llcms -lpng -ltiff" rm -rf $PKG mkdir -p $TMP $PKG cd $TMP tar xvzf $CWD/$PKGNAME-$VERSION.tar.gz # Adjust permissions and ownerships cd $PKGNAME chmod -R u+w,go+r-w,a-s . chown -R root:root . # Build and install gcc \ $SLKCFLAGS -Wall -v \ -o dcraw dcraw.c \ $DCRAW_BUILD_FLAGS \ -DLOCALEDIR=\"/usr/share/locale/\" install -m 755 -p -D dcraw $PKG/usr/bin/dcraw install -m 644 -p -D dcraw.1 $PKG/usr/man/man1/dcraw.1 for lang in eo ru fr it de pt es zh_TW zh_CN pl hu cs ca sv ; do install -d -m 0755 $PKG/usr/man/$lang.UTF-8/man1 install -m 0644 dcraw_$lang.1 $PKG/usr/man/$lang.UTF-8/man1/dcraw.1 || true # Missing man page, hence the || true above # install -d -m 0755 $PKG/usr/share/locale/$lang/LC_MESSAGES msgfmt -o $PKG/usr/share/locale/$lang/LC_MESSAGES/dcraw.mo dcraw_$lang.po || true # Missing po file for zh_CN language, hence the || above done # remove any empty directories find $PKG -depth -empty -type d -exec rmdir '{}' \; # Installing GIMP plugin gimptool-2.0 --build $CWD/rawphoto.c install -m 755 -p -D rawphoto $PKG/usr/lib${LIBDIRSUFFIX}/gimp/2.0/plug-ins/rawphoto # Also add the slack-desk file and this slackbuild to the package #Add documentation files: readme, changelog and so on mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/slack-desc cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$VERSION/SlackBuild/$PKGNAME.SlackBuild # Compress the man pages if present if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi strip --strip-unneeded $PKG/usr/bin/dcraw # Find and print dependencies into slack-required file cd $PKG chown -R root:root $PKG if [ -x /usr/bin/requiredbuilder ];then requiredbuilder -y -v -s $CWD $PKG fi # Create txz package /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} # Cleanup if enabled if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi