aboutsummaryrefslogtreecommitdiff
path: root/graphics/yafray/yafray.SlackBuild
blob: 41ca01e25654e6695194e361153a4e558eb9e71e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh

# Slackware build script for yafray
#
# This script is very fragile and works around the Scons setup, so be
# careful when upgrading to a new version!
#
# Written by Brian Muramatsu (brian@fhobia.org)

PRGNAM=yafray
VERSION=0.0.9
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
# Extracts to "yafray" rather than "yafray-0.0.9" as might be expected.
tar xvzf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM
chown -R root:root . 
chmod -R u+w,go+r-w,a-s .

# SConstruct uses linux-settings.py to parse arguments. In the get_cxxflags,
# it looks for "arch" and "tune" and doesn't seem to look at the regular 
# CFLAGS and CXXFLAGS. These are the only optimization flags I saw in
# linux-settings.py.
if [ "$ARCH" = "i486" ]; then
  SCONFLAGS="arch=i486 tune=i486"
elif [ "$ARCH" = "i586" ]; then
  SCONFLAGS="arch=i586 tune=i586"
elif [ "$ARCH" = "i686" ]; then
  SCONFLAGS="arch=i686 tune=i686"
fi

# linux-settings.py shows that there is only the "prefix" flag to control
# where files will be copied to. Set the prefix to the SBo package directory,
# so that we can work on the package there.
SCONFLAGS="prefix=$PKG/usr $SCONFLAGS"

# Equivalent to the usual "make" step...
scons $SCONFLAGS

# The Yafray wiki says you need to put the flags again or else the information
# about the architecture will be lost, and it will compile it all over again!
#
# http://wiki.yafray.org/bin/view.pl/UserDoc/FaqEng#Compilation
scons $SCONFLAGS install

# Move /usr/etc/gram.yafray to /etc/gram.yafray. Other distributions like
# Debian, Fedora, and Gentoo seem to do the same. At this point, I don't know
# what the impact of moving this is, but it does not seem to impede Yafray's
# function as described in the README.
mkdir $PKG/etc
mv $PKG/usr/etc/gram.yafray $PKG/etc/gram.yafray
rm -rf $PKG/usr/etc

# Yafray's code seems to hardcode /usr/local/lib...so create a symlink from
# /usr/local/lib/yafray to /usr/lib/yafray. This made Blender work properly
# with Yafray immediately after installing this package.
mkdir -p $PKG/usr/local/lib
ln -sf /usr/lib/yafray $PKG/usr/local/lib/yafray

# Copy over documentation. The only difference is there are some technical
# documents under the doc directory that are also copied besides the usual
# suspects.
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog INSTALL LICENSE NEWS README doc $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc/$PRGNAM-$VERSION -type f -exec chmod 644 {} \;

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

# Strip some libraries and 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
)

# Build the package
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz