summaryrefslogtreecommitdiffstats
path: root/graphics/blender/blender.SlackBuild
blob: 9e9eb82acd254ed51c8bfe10af17036a62c1952a (about) (plain) (blame)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash

# Slackware build script for Blender

# Copyright 2008-2013  Robby Workman  Northport, AL, USA
# Copyright 2014-2017  Ryan P.C. McQuen | Everett, WA | ryanpcmcquen@member.fsf.org
# Copyright 2017       Dhaby Xiloj <slack.dhabyx@gmail.com>
# Copyright 2024       Jeremy Hansen <jebrhansen+SBo@gmail.com>

# All rights reserved.
#
# 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.

# 20220404 bkw: Modified by SlackBuilds.org, BUILD=2:
# - strip the python interpreter and one shared lib that weren't already.
# - remove the broken symlinks in the icons dir. upstream doesn't include
#   PNG icons (I assume it did at one time), only an SVG one.
# - add SlackBuild to doc dir.

# Thanks to Giorgio Peron <giorgio.peron@gmail.com> for some build tips

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=blender
VERSION=${VERSION:-4.1.1}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

SRCVERSION=${VERSION}-linux-x64

# We'll remove the libGL* shared libaries that are shipped with blender (and
# instead use the ones that are shipped with Slackware's Xorg)
# If this is undesirable for you, pass LMTFA=yes to the script when building
LMTFA=${LMTFA:-no}

case "$( uname -m )" in
  i?86) ARCH=i686 ;;
  arm*) ARCH=arm ;;
     *) ARCH=$( uname -m ) ;;
esac

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

if [ "$ARCH" = "x86_64" ]; then
  break
elif [ "$ARCH" = "i686" ]; then
  break
else
  printf "\n\n$ARCH is not supported... \n"
  exit 1
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$SRCVERSION
tar xvf $CWD/$PRGNAM-$SRCVERSION.tar.xz
cd $PRGNAM-$SRCVERSION
chown -R root:root .

# Move the docs to our standard location first
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mv *.txt readme.html \
   $PKG/usr/doc/$PRGNAM-$VERSION

# Now move everything else
mkdir -p $PKG/opt/blender
mv * $PKG/opt/blender

# Add profile scripts to append to PATH
mkdir -p $PKG/etc/profile.d
cp $CWD/profile.d/* $PKG/etc/profile.d/
chmod 0755 $PKG/etc/profile.d/*

# Leave me alone?
if [ "$LMTFA" != "yes" ]; then
  rm -f $PKG/opt/blender/lib/libGL*
fi

# 20220404 bkw: a couple of things aren't stripped... this
# is noticeably faster than the template find|strip.
find $PKG/opt/blender -type f -print0  | \
  xargs -0 file -m /etc/file/magic/elf | \
  grep 'ELF.*dynamic.*not stripped'    | \
  cut -d: -f1 | xargs strip

# Put symlinks to icons in the standard places.
# 20220404 bkw: looks like upstream got rid of PNG icons and only
# ships an SVG (which has moved).
mkdir -p $PKG/usr/share/icons/hicolor/scalable/apps
  ln -s ../../../../../../opt/blender/blender.svg \
        $PKG/usr/share/icons/hicolor/scalable/apps/

# Correct permissions for executables/libraries
find $PKG/opt/blender/${VERSION%.*}/python/lib -name *.so -exec chmod +x {} +
find $PKG/opt/blender/lib -name *.so* -exec chmod +x {} +
chmod +x $PKG/opt/blender/${VERSION%.*}/scripts/addons/cycles/lib/kernel_*.cubin

# Add a desktop menu entry
mkdir -p $PKG/usr/share/applications
cat $CWD/blender.desktop > $PKG/usr/share/applications/blender.desktop

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

cd $PKG
/sbin/makepkg -c n -l y $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE