pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Support automatically using pkgsrc/emulators/darwin_li...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b2853393e1c0
branches:  trunk
changeset: 531522:b2853393e1c0
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Aug 01 16:28:08 2007 +0000

description:
Support automatically using pkgsrc/emulators/darwin_lib to satisfy
EMUL_PLATFORMs darwin-i386 and darwin-powerpc.

diffstat:

 emulators/darwin_lib/DEINSTALL   |   11 +++
 emulators/darwin_lib/INSTALL     |  133 +++++++++++++++++++++++++++++++-------
 emulators/darwin_lib/Makefile    |   43 +++++------
 emulators/darwin_lib/emulator.mk |   16 ++++
 mk/emulator/darwin-opendarwin.mk |   20 +++++
 mk/emulator/darwin.mk            |   44 ++++++++++++
 mk/emulator/emulator-vars.mk     |    6 +-
 7 files changed, 222 insertions(+), 51 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r b95997c8279e -r b2853393e1c0 emulators/darwin_lib/DEINSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/darwin_lib/DEINSTALL    Wed Aug 01 16:28:08 2007 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: DEINSTALL,v 1.1 2007/08/01 16:28:08 jlam Exp $
+
+EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
+
+case "${STAGE}" in
+DEINSTALL)
+       # Run any actions that require root privileges.
+       ${TEST} ! -x ./+ROOT_ACTIONS ||
+               ./+ROOT_ACTIONS REMOVE ${PKG_METADATA_DIR} || exit 1
+       ;;
+esac
diff -r b95997c8279e -r b2853393e1c0 emulators/darwin_lib/INSTALL
--- a/emulators/darwin_lib/INSTALL      Wed Aug 01 16:20:42 2007 +0000
+++ b/emulators/darwin_lib/INSTALL      Wed Aug 01 16:28:08 2007 +0000
@@ -1,30 +1,113 @@
-# $NetBSD: INSTALL,v 1.1 2006/06/23 15:52:34 jlam Exp $
+# $NetBSD: INSTALL,v 1.2 2007/08/01 16:28:08 jlam Exp $
+
+# Generate a +ROOT_ACTIONS script that runs certain actions that require
+# superuser privileges.
+#
+case "${STAGE},$1" in
+UNPACK,|UNPACK,+ROOT_ACTIONS)
+       ${CAT} > ./+ROOT_ACTIONS << 'EOF'
+#!@SH@
+#
+# +ROOT_ACTIONS - run actions requiring superuser privileges
+#
+# Usage: ./+ROOT_ACTIONS ADD|REMOVE [metadatadir]
+#
+# This script runs certain actions that require superuser privileges.
+# If such privileges are not available, then simply output a message
+# asking the user to run this script with the appropriate elevated
+# privileges.
+#
+
+CAT="@CAT@"
+CHMOD="@CHMOD@"
+CP="@CP@"
+DIRNAME="@DIRNAME@"
+ECHO="@ECHO@"
+ID="@ID@"
+LN="@LN@"
+MKDIR="@MKDIR@"
+PWD_CMD="@PWD_CMD@"
+RM="@RM@"
+SH="@SH@"
+TEST="@TEST@"
+
+SELF=$0
+ACTION=$1
+
+CURDIR=`${PWD_CMD}`
+PKG_METADATA_DIR="${2-${CURDIR}}"
+: ${PKGNAME=${PKG_METADATA_DIR##*/}}
+: ${PKG_PREFIX=@PREFIX@}
+
+EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
+OPSYS_EMULDIR="@OPSYS_EMULDIR@"
+
+ROOT_ACTIONS_COOKIE="./+ROOT_ACTIONS_done"
+EUID=`${ID} -u`
+
+exitcode=0
+case $ACTION,$EUID in
+ADD,0)
+       ${ECHO} "" > ${ROOT_ACTIONS_COOKIE}
+       ${CHMOD} g+w ${ROOT_ACTIONS_COOKIE}
+
+       # Create the appropriate symlink so that the kernel will
+       # find the installed files.
+       #
+       OPSYS_EMULDIR_PWD=`cd ${OPSYS_EMULDIR} 2>/dev/null && ${PWD_CMD}`
+       EMULDIR_PWD=`cd ${EMULDIR} 2>/dev/null && ${PWD_CMD}`
+
+       if ${TEST} "${OPSYS_EMULDIR_PWD}" != "${EMULDIR_PWD}"; then
+               if ${TEST} -e ${OPSYS_EMULDIR} -o -L ${OPSYS_EMULDIR}; then
+                       ${CAT} << EOM
+==============================================================================
+The following symbolic link must be created for ${PKGNAME}
+to work properly:
+
+       ${EMULDIR} -> ${OPSYS_EMULDIR}
+
+==============================================================================
+EOM
+               else
+                       ${ECHO} "${PKGNAME}: creating symlink ${EMULDIR} -> ${OPSYS_EMULDIR}"
+                       ( ${MKDIR} -p `${DIRNAME} ${OPSYS_EMULDIR}` && 
+                         ${LN} -fs ${EMULDIR} ${OPSYS_EMULDIR} ) || ${TRUE}
+               fi
+       fi
+       ;;
+
+ADD,*)
+       if ${TEST} ! -f ${ROOT_ACTIONS_COOKIE}; then
+               ${CAT} << EOM
+==============================================================================
+Please run the following command with superuser privileges to complete
+the installation of ${PKGNAME}:
+
+    cd ${PKG_METADATA_DIR} && ${SELF} ADD
+
+==============================================================================
+EOM
+       fi
+       ;;
+
+REMOVE,*)
+       ${RM} -f ${ROOT_ACTIONS_COOKIE}
+       ;;
+esac
+exit $exitcode
+
+EOF
+       ${CHMOD} +x ./+ROOT_ACTIONS
+       ;;
+esac
+
+EMULDIR="${PKG_PREFIX}/@EMULSUBDIR@"
+OPSYS_EMULDIR="@OPSYS_EMULDIR@"
 
 case "${STAGE}" in
 POST-INSTALL)
-       emulsubdir=darwin
-
-       emuldir="/emul/$emulsubdir"
-       pkgemuldir="${PKG_PREFIX}/emul/$emulsubdir"
-
-       emuldir_pwd=`cd $emuldir 2>/dev/null && ${PWD_CMD}`
-       pkgemuldir_pwd=`cd $pkgemuldir 2>/dev/null && ${PWD_CMD}`
-
-       if ${TEST} "$emuldir_pwd" != "$pkgemuldir_pwd"; then
-               if ${TEST} -e $emuldir -o -L $emuldir; then
-                       ${CAT} << EOF
-==============================================================================
-You must create a symbolic link for ${PKGNAME} to work properly:
-
-       $pkgemuldir  ->  $emuldir
-
-It seems there is something else located at $emuldir.
-==============================================================================
-EOF
-               else
-                       ${MKDIR} -p `${DIRNAME} $emuldir` && 
-                       ${LN} -fs $pkgemuldir $emuldir
-               fi
-       fi
+       # Run any actions that require root privileges.
+       ${TEST} ! -x ./+ROOT_ACTIONS ||
+               ./+ROOT_ACTIONS ADD ${PKG_METADATA_DIR}
        ;;
 esac
diff -r b95997c8279e -r b2853393e1c0 emulators/darwin_lib/Makefile
--- a/emulators/darwin_lib/Makefile     Wed Aug 01 16:20:42 2007 +0000
+++ b/emulators/darwin_lib/Makefile     Wed Aug 01 16:28:08 2007 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2006/07/02 10:05:55 rillig Exp $
+# $NetBSD: Makefile,v 1.8 2007/08/01 16:28:08 jlam Exp $
 
 DISTNAME=      darwin_lib-6.6.2
 PKGREVISION=   2
@@ -13,33 +13,30 @@
                org.opendarwin.XFree86-6.6.2-4.${DARWIN_ARCH}.rpm
 
 MAINTAINER=    abacau%yahoo.com.au@localhost
-HOMEPAGE=      http://www.opendarwin.org/
 COMMENT=       Darwin compatibility libraries (including X11)
 
-BUILD_DEPENDS+=        rpm2pkg>=1.3:../../pkgtools/rpm2pkg
+# The opendarwin.org domain is completely gone.  MASTER_SITES should
+# probably point to ${MASTER_SITE_LOCAL} instead.  I also think the ppc
+# XFree86 RPM is no longer available anywhere.
+#
+#HOMEPAGE=     http://www.opendarwin.org/
 
-ONLY_FOR_PLATFORM=     NetBSD-1.6Z*-powerpc NetBSD-1.6Z*-i386 \
+EMUL_PLATFORMS=                darwin-i386 darwin-powerpc
+ONLY_FOR_PLATFORM=     NetBSD-1.6Z*-powerpc NetBSD-1.6Z*-i386          \
                        NetBSD-[2-9]*-powerpc NetBSD-[2-9]*-i386
 
-PLIST_SRC=     ${WRKDIR}/.PLIST_SRC
-
-DARWIN_ARCH=   ${MACHINE_ARCH:C/powerpc/ppc/}
+DARWIN_PKG=            yes
+DARWIN_ARCH=           ${MACHINE_ARCH:C/powerpc/ppc/}
+WRKSRC=                        ${WRKDIR}
+BUILD_DIRS=            # empty
 
-RPM2PKG=       rpm2pkg
-RPMARGS=       -d ${PREFIX} -f ${WRKDIR}/PLIST_RPM2PKG -p emul/darwin  \
-               -i ./Developer -i ./usr/X11R6/lib/X11/doc/html          \
-               -i ./usr/share/man -i ./usr/include -i ./usr/X11R6/man  \
-               -i ./usr/X11R6/include -i ./usr/local/include           \
-               -i ./usr/local/man                                      \
-               ${DISTFILES:S/^/${DISTDIR}\//}
-
-EXTRACT_ONLY=  # empty
-NO_BUILD=      yes
-
-do-install:
-       ${RM} -f ${WRKDIR}/PLIST_RPM2PKG
-       ${RPM2PKG} ${RPMARGS}
-       ${SED} -e 's|^\./||' -e 's|/\./|/|g' -e 's|//*|/|g'             \
-               ${WRKDIR}/PLIST_RPM2PKG > ${PLIST_SRC}
+EMUL_PKG_FMT=          rpm
+RPM2PKG_PREFIX=                ${PREFIX}
+RPM2PKG_SUBPREFIX=     ${EMULSUBDIR}
+RPM2PKG_STAGE=         do-install
+RPMIGNOREPATH=         ./Developer ./usr/X11R6/lib/X11/doc/html        \
+                       ./usr/share/man ./usr/include ./usr/X11R6/man   \
+                       ./usr/X11R6/include ./usr/local/include         \
+                       ./usr/local/man
 
 .include "../../mk/bsd.pkg.mk"
diff -r b95997c8279e -r b2853393e1c0 emulators/darwin_lib/emulator.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/darwin_lib/emulator.mk  Wed Aug 01 16:28:08 2007 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: emulator.mk,v 1.1 2007/08/01 16:28:08 jlam Exp $
+#
+# This file is included by darwin-opendarwin.mk in the emulator framework.
+#
+# Variables set by this file:
+#
+# EMUL_DISTRO
+#      The OpenDarwin distribution.
+#
+
+EMUL_DISTRO=           opendarwin-6.6.2
+
+# The Darwin emulation supports no modules, so always depend on darwin_lib.
+.if !defined(DARWIN_PKG)
+DEPENDS+=              darwin_lib>=6.6.2:../../emulators/darwin_lib
+.endif
diff -r b95997c8279e -r b2853393e1c0 mk/emulator/darwin-opendarwin.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/emulator/darwin-opendarwin.mk  Wed Aug 01 16:28:08 2007 +0000
@@ -0,0 +1,20 @@
+# $NetBSD: darwin-opendarwin.mk,v 1.1 2007/08/01 16:28:08 jlam Exp $
+#
+# OpenDarwin
+#
+
+# EMUL_TYPE.darwin can be "opendarwin" or "opendarwin-[0-9]*".  If the
+# former, then use the default OpenDarwin version, otherwise use the
+# specific version requested.
+#
+.if !empty(EMUL_TYPE.darwin:Mopendarwin-6.x)
+.  include "${PKGSRCDIR}/emulators/darwin_lib/emulator.mk"
+
+.elif !empty(EMUL_TYPE.darwin:Mopendarwin)
+   # default to highest version of OpenDarwin
+.  include "${PKGSRCDIR}/emulators/darwin_lib/emulator.mk"
+
+.else
+EMUL_DISTRO=           opendarwin-0
+PKG_FAIL_REASON+=      "[darwin-opendarwin.mk] ${EMUL_TYPE.darwin} is not a supported EMUL_TYPE.darwin"
+.endif
diff -r b95997c8279e -r b2853393e1c0 mk/emulator/darwin.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/emulator/darwin.mk     Wed Aug 01 16:28:08 2007 +0000
@@ -0,0 +1,44 @@
+# $NetBSD: darwin.mk,v 1.1 2007/08/01 16:28:08 jlam Exp $
+#
+# Darwin (Mac OS X) binary emulation framework
+#
+
+.if !empty(OPSYS:MDarwin*)
+EMUL_TYPE.darwin?=     native
+.else
+EMUL_TYPE.darwin?=     opendarwin
+.endif
+EMUL_MODULES.darwin?=  # empty
+
+EMULSUBDIR=            emul/darwin
+EMULDIR=               ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR=         ${_OPSYS_EMULDIR.darwin}
+
+# _EMUL_TYPES
+#      List of recognized Darwin types that a user may request.
+#
+# _EMUL_MODULES
+#      List of recognized Darwin "modules" that packages may request.
+#
+_EMUL_TYPES=           builtin
+_EMUL_TYPES+=          native
+_EMUL_TYPES+=          opendarwin
+_EMUL_TYPE?=           ${EMUL_TYPE.darwin}
+
+_EMUL_MODULES=         # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO=           builtin-darwin  # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO=           native-darwin   # native OSF/1 (Tru64)



Home | Main Index | Thread Index | Old Index