aboutsummaryrefslogtreecommitdiff
path: root/network/opera/opera.SlackBuild
blob: d4d712fa3d1176dd689d28d1ab822d6cf723845f (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh

# Slackware build script for opera

# Copyright 2006  Martin Lefebvre <dadexter@gmail.com>
# Copyright 2008,2009  Robby Workman, Northport, Alabama, USA
# 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.

PRGNAM=opera
VERSION=10.10
ARCH=${ARCH:-i386}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

set -eu

if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  ARCH=i386
  LIBDIRSUFFIX=""
fi

# Don't bother this - it's for easier manipulation and sed'ing later
TOPDIR=$(tar tf $CWD/$PRGNAM-${VERSION}.gcc4-qt4.${ARCH}.tar.bz2 |head -1)

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP 
rm -rf $TOPDIR
tar xvf $CWD/$PRGNAM-${VERSION}.gcc4-qt4.${ARCH}.tar.bz2
cd $TOPDIR
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# No, the --DESTDIR isn't documented.  In fact, the presence of OPERADESTDIR
# at the top of install.sh is damn misleading.  I shouldn't have to actually
# read the install script to figure out DESTDIR: the --help should show it.
# --rworkman
./install.sh \
  --prefix=/usr \
  --exec_prefix=/usr/lib${LIBDIRSUFFIX}/opera \
  --sharedir=/usr/share/opera \
  --wrapperdir=/usr/bin \
  --mandir=/usr/man \
  --docdir=/usr/doc/opera-$VERSION \
  --plugindir=/usr/lib${LIBDIRSUFFIX}/mozilla/plugins \
  --DESTDIR=$PKG

# Fix a potential security issue (minor, but still) with a hardcoded path to
# the build directory lingering in /usr/bin/opera
# Theoretically, a malicious user looks at that in /usr/bin/opera and later
# recreates the directory and does some unknown havoc.  It may very well be
# completely safe and unexploitable and I'm just being Chicken Little here,
# but it's easy enough to fix and I'd rather be safe than sorry.  --rworkman
sed -i "s%$TMP/$TOPDIR\$0%\$PWD/\${0#./}%g" $PKG/usr/bin/opera

#  /usr/bin/opera doesn't look in the right places for 64bit java. Fix it.
if [ "$ARCH" = "x86_64" ]; then
sed -i -e "/PREFIXES=\"/,/\/opt\"/ s:/usr/lib:/usr/lib64:" \
       -e "s:i386:amd64:" $PKG/usr/bin/opera
fi

# Include config files
mv etc $PKG
mv $PKG/etc/operaprefs_default.ini $PKG/etc/operaprefs_default.ini.new
mv $PKG/etc/operaprefs_fixed.ini $PKG/etc/operaprefs_fixed.ini.new

# Add an opera.desktop file and link the icon to /usr/share/pixmaps
mv usr/share/icons usr/share/pixmaps $PKG/usr/share
mkdir -p $PKG/usr/share/applications
cat $CWD/opera.desktop > $PKG/usr/share/applications/opera.desktop

# Add a copy of the build script to the docs
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

# Compress the man page
gzip -9 $PKG/usr/man/man?/*.?

# Strip symbols we don't need
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

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

cd $PKG
/sbin/makepkg -p -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}