summaryrefslogtreecommitdiff
path: root/www/opera
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2007-08-07 21:37:24 +0000
committerjlam <jlam@pkgsrc.org>2007-08-07 21:37:24 +0000
commitfc399295614cd244b59897d84b0ac5ee46a78ec7 (patch)
tree1188a322b156f5ca22bbeff50ee9a5feb9edfed2 /www/opera
parentdf88d56da8ce9f4977ca16c81694948e57ba4df2 (diff)
downloadpkgsrc-fc399295614cd244b59897d84b0ac5ee46a78ec7.tar.gz
Rewrite the opera.sh shell script to properly check for versions of
Linux kernel emulation <= 2.0.38. Also ensure that /lib is in LD_LIBRARY_PATH so that the opera binary can find /lib/libpthread.so.0 in ${EMULDIR} and not NetBSD's /usr/lib/libpthread.so.0. Bump the PKGREVISION to 1.
Diffstat (limited to 'www/opera')
-rw-r--r--www/opera/Makefile15
-rw-r--r--www/opera/files/opera.sh73
2 files changed, 60 insertions, 28 deletions
diff --git a/www/opera/Makefile b/www/opera/Makefile
index 365171ff54c..4ef75cefb51 100644
--- a/www/opera/Makefile
+++ b/www/opera/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.70 2007/07/29 05:20:00 jlam Exp $
+# $NetBSD: Makefile,v 1.71 2007/08/07 21:37:24 jlam Exp $
DISTNAME= opera-${OPERA_PKG_VERSION:S/u/pl/}
+PKGREVISION= 1
CATEGORIES= www
MASTER_SITES= ftp://ftp.hu-berlin.de/pub/www/opera/${OPERA_DIR}/
MASTER_SITES+= http://ftp.sunet.se/pub/www/clients/Opera/${OPERA_DIR}/
@@ -53,12 +54,16 @@ RPM2PKG_PREFIX= ${PREFIX}
RPM2PKG_SUBPREFIX= ${EMULSUBDIR}
RPM2PKG_STAGE= do-install
-do-build:
- ${SED} -e 's#@EMULDIR@#${EMULDIR}#g' \
- ${FILESDIR}/opera.sh > ${WRKDIR}/opera
+SUBST_CLASSES+= opera-sh
+SUBST_STAGE.opera-sh= post-build
+SUBST_FILES.opera-sh= opera.sh
+SUBST_VARS.opera-sh= CMP EMULDIR MKDIR MV RM SED SH
+
+post-extract:
+ ${CP} ${FILESDIR}/opera.sh ${WRKSRC}
post-install:
- ${INSTALL_SCRIPT} ${WRKDIR}/opera ${PREFIX}/bin
+ ${INSTALL_SCRIPT} ${WRKDIR}/opera.sh ${PREFIX}/bin/opera
${LN} -fs ${EMULDIR}/usr/share/man/man1/opera.1 \
${PREFIX}/${PKGMANDIR}/man1
${ECHO} "bin/opera" >> ${RPM2PKG_PLIST}
diff --git a/www/opera/files/opera.sh b/www/opera/files/opera.sh
index e42c0b923c0..9fcb6bceaba 100644
--- a/www/opera/files/opera.sh
+++ b/www/opera/files/opera.sh
@@ -1,25 +1,52 @@
-#!/bin/sh
-LINUX_KERN_OSREL=`/sbin/sysctl -n emul.linux.kern.osrelease 2>/dev/null`
-if [ -z "$LINUX_KERN_OSREL" -o "$LINUX_KERN_OSREL" = "2.0.38" ]
-then
- OPERADIR=$HOME/.opera
- mkdir -p $OPERADIR || exit 1
- for FILE in $OPERADIR/opera6.ini $OPERADIR/opera.ini
- do
- if [ -f ${FILE} ]
- then
- if grep -q '^Synchronous DNS Lookup=0$' ${FILE}
- then
- cp -p ${FILE} ${FILE}.patch
- sed -e 's#^\(Synchronous DNS Lookup\)=0$#\1=1#' ${FILE}.patch >${FILE}
- rm -f ${FILE}.patch
- fi
- else
- echo >${FILE} "[Performance]"
- echo >>${FILE} "Synchronous DNS Lookup=1"
- fi
- done
-fi
+#!@SH@
+#
+# $NetBSD: opera.sh,v 1.4 2007/08/07 21:37:25 jlam Exp $
+#
+# This script is used with linux-* emulations to ensure that opera is
+# started with the proper environment.
+#
+
+#
+# fixup_opera_ini
+# This corrects opera.ini and opera6.ini files in the user's
+# $HOME directory to enable synchronous DNS lookups on older
+# versions of NetBSD.
+#
+fixup_opera_ini()
+{
+ linux_osrel=`/sbin/sysctl -n emul.linux.kern.osrelease 2>/dev/null`
+ case "$linux_osrel" in
+ [01].*|2.0|2.0.[0-9]|2.0.[12][0-9]|2.0.3[0-8])
+ # On older NetBSD (linux kernel emulation <= 2.0.38),
+ # synchronous DNS lookups need to be explicitly enabled.
+ ;;
+ *) return 0 ;;
+ esac
+
+ OPERADIR=$HOME/.opera
+ @MKDIR@ $OPERADIR || return 1
+ for inifile in $OPERADIR/opera6.ini $OPERADIR/opera.ini; do
+ if [ ! -f $inifile ]; then
+ echo >$inifile "[Performance]"
+ echo >>$inifile "Synchronous DNS Lookup=1"
+ continue
+ fi
+ @SED@ "s/^\(Synchronous DNS Lookup\)=0/\1=1/" \
+ $inifile > $inifile.patched
+ if @CMP@ -s $inifile $inifile.patched; then
+ @RM@ -f $inifile.patched
+ else
+ @MV@ -f $inifile.patched $inifile
+ fi
+ done
+ return 0
+}
+
+fixup_opera_ini || exit 1
+
+# Fix up LD_LIBRARY_PATH so that /lib is always searched for shared
+# libraries.
+#
+LD_LIBRARY_PATH=/lib:/usr/lib; export LD_LIBRARY_PATH
-unset LD_LIBRARY_PATH
exec @EMULDIR@/bin/bash /usr/bin/opera "$@"