mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-29 13:00:32 +01:00
111 lines
3.9 KiB
Bash
111 lines
3.9 KiB
Bash
#!/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}
|