pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/opera Rewrite the opera.sh shell script to properl...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0d4d52a36b79
branches:  trunk
changeset: 531853:0d4d52a36b79
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Aug 07 21:37:24 2007 +0000

description:
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:

 www/opera/Makefile       |  15 ++++++---
 www/opera/files/opera.sh |  73 ++++++++++++++++++++++++++++++++---------------
 2 files changed, 60 insertions(+), 28 deletions(-)

diffs (112 lines):

diff -r 8e27b386fba1 -r 0d4d52a36b79 www/opera/Makefile
--- a/www/opera/Makefile        Tue Aug 07 21:26:49 2007 +0000
+++ b/www/opera/Makefile        Tue Aug 07 21:37:24 2007 +0000
@@ -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_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 -r 8e27b386fba1 -r 0d4d52a36b79 www/opera/files/opera.sh
--- a/www/opera/files/opera.sh  Tue Aug 07 21:26:49 2007 +0000
+++ b/www/opera/files/opera.sh  Tue Aug 07 21:37:24 2007 +0000
@@ -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
 
-unset LD_LIBRARY_PATH
+       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
+
 exec @EMULDIR@/bin/bash /usr/bin/opera "$@"



Home | Main Index | Thread Index | Old Index