summaryrefslogtreecommitdiff
path: root/mk/emulator
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2007-07-29 05:18:36 +0000
committerjlam <jlam@pkgsrc.org>2007-07-29 05:18:36 +0000
commit33f30156fb37245b360bbc293320402ecf1aba41 (patch)
tree45cad36d8470a568b9136017b2dd79c9efcc65bc /mk/emulator
parentffe106498e5f63e2e945d5b6b2ac8807a10ae78f (diff)
downloadpkgsrc-33f30156fb37245b360bbc293320402ecf1aba41.tar.gz
* Add new emulator framework in pkgsrc/mk/emulator that handles all
binary-only packages that require binary "emulation" on the native operating system. Please see pkgsrc/mk/emulator/README for more details. * Teach the plist framework to automatically use any existing PLIST.${EMUL_PLATFORM} as part of the default PLIST_SRC definition. * Convert all of the binary-only packages in pkgsrc to use the emulator framework. Most of them have been tested to install and deinstall correctly. This involves the following cleanup actions: * Remove use of custom PLIST code and use PLIST.${EMUL_PLATFORM} more consistently. * Simplify packages by using default INSTALL and DEINSTALL scripts instead of custom INSTALL/DEINSTALL code. * Remove "SUSE_COMPAT32" and "PKG_OPTIONS.suse" from pkgsrc. Packages only need to state exactly which emulations they support, and the framework handles any i386-on-x86_64 or sparc-on-sparc64 uses. * Remove "USE_NATIVE_LINUX" from pkgsrc. The framework will automatically detect when the package is installing on Linux. Specific changes to packages include: * Bump the PKGREVISIONs for all of the suse100* and suse91* packages due to changes in the +INSTALL/+DEINSTALL scripts used in all of the packages. * Remove pkgsrc/emulators/suse_linux, which is unused by any packages. * cad/lc -- remove custom code to create the distinfo file for all supported platforms; just use "emul-fetch" and "emul-distinfo" instead. * lang/Cg-compiler -- install the shared libraries under ${EMULDIR} instead of ${PREFIX}/lib so that compiled programs will find the shared libraries. * mail/thunderbird-bin-nightly -- update to latest binary distributions for supported platforms. * multimedia/ns-flash -- update Linux version to 9.0.48 as the older version is no longer available for interactive fetch. * security/uvscan -- set LD_LIBRARY_PATH explicitly so that it's not necessary to install library symlinks into ${EMULDIR}/usr/local/lib. * www/firefox-bin-flash -- update Linux version to 9.0.48 as the older version is no longer available for interactive fetch.
Diffstat (limited to 'mk/emulator')
-rw-r--r--mk/emulator/bsdi.mk27
-rw-r--r--mk/emulator/emulator-vars.mk156
-rw-r--r--mk/emulator/emulator.mk116
-rw-r--r--mk/emulator/freebsd.mk43
-rw-r--r--mk/emulator/irix.mk43
-rw-r--r--mk/emulator/linux-suse.mk43
-rw-r--r--mk/emulator/linux.mk79
-rw-r--r--mk/emulator/merge-distinfo.awk43
-rw-r--r--mk/emulator/osf1.mk43
-rw-r--r--mk/emulator/pkg-plain.mk4
-rw-r--r--mk/emulator/pkg-rpm.mk110
-rw-r--r--mk/emulator/solaris.mk52
-rw-r--r--mk/emulator/sunos.mk43
13 files changed, 802 insertions, 0 deletions
diff --git a/mk/emulator/bsdi.mk b/mk/emulator/bsdi.mk
new file mode 100644
index 00000000000..e9f30ad257c
--- /dev/null
+++ b/mk/emulator/bsdi.mk
@@ -0,0 +1,27 @@
+# $NetBSD: bsdi.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# BSD/OS binary emulation framework
+#
+
+EMUL_MODULES.bsdi?= # empty
+
+# Nothing emulates BSDi -- it's only available natively.
+EMUL_TYPE.bsdi?= native
+EMUL_DISTRO= native
+EMULSUBDIR= # empty
+EMULDIR= ${PREFIX}
+OPSYS_EMULDIR= # empty
+
+# _EMUL_TYPES
+# List of recognized BSD/OS types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized BSD/OS "modules" that packages may request.
+#
+_EMUL_TYPES= native
+_EMUL_TYPE= native
+_EMUL_MODULES= # empty
+
+.for _mod_ in ${_EMUL_MODULES}
+DEPENDS_native.${_mod_}?= # empty
+.endfor
diff --git a/mk/emulator/emulator-vars.mk b/mk/emulator/emulator-vars.mk
new file mode 100644
index 00000000000..d5e89989c20
--- /dev/null
+++ b/mk/emulator/emulator-vars.mk
@@ -0,0 +1,156 @@
+# $NetBSD: emulator-vars.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# This file is included by bsd.prefs.mk only if EMUL_PLATORMS is defined
+# and non-empty.
+#
+# User-settable variables:
+#
+# EMUL_TYPE.${EMUL_OPSYS}
+# Specifies the "type" or "variant" of ${EMUL_OPSYS} to use, e.g.
+# ${EMUL_TYPE.linux} == "suse".
+#
+# EMUL_PLATFORM
+# Specifies the platform to emulate, and is of the form
+# ${EMUL_OPSYS}-${EMUL_ARCH}, e.g. linux-i386. By default
+# this is the best-matching platform listed in EMUL_PLATFORMS
+# chosen based on EMUL_PREFER.
+#
+# EMUL_PREFER
+# The list of platforms to try to emulate in order of preference.
+# By default, only try to emulate the native platform. See the
+# _EMUL_PREFER.* table below for additional preferences for various
+# platforms.
+#
+# Package-settable variables:
+#
+# EMUL_PLATFORMS
+# List of "${EMUL_OPSYS}-${EMUL_ARCH}" binary emulations supported
+# by the package. This should be set prior to the inclusion of
+# bsd.prefs.mk.
+#
+# Default value: undefined
+#
+# Variables defined by this file:
+#
+# EMUL_ARCH
+# The machine architecture being emulated, e.g. i386. If the
+# package isn't supported on this machine, then its value is
+# "none".
+#
+# EMUL_OPSYS
+# The operating system being emulated, e.g. linux. If the
+# package isn't supported on this machine, then its value is
+# "none".
+#
+# EMUL_DISTRO
+# The distribution of the emulated operating system being used,
+# e.g. native-linux, suse-10.0, etc. If the package isn't
+# supported on this machine, then its value is "none".
+#
+# EMULDIR
+# Convenience variable that expands to ${PREFIX}/${EMULSUBDIR}
+#
+# EMULSUBDIR
+# Path relative to ${PREFIX} where the files and directories
+# are located, e.g. emul/linux.
+#
+# OPSYS_EMULDIR
+# Path through which the platform expects to find a "chroot"
+# installation of the files and directories, e.g. /emul/linux.
+#
+
+# _EMUL_OPSYS
+# A table that maps ${OPSYS} to the operating system names
+# (${EMUL_OPSYS}) used by the emulator framework.
+#
+# _EMUL_MACHINE_PLATFORM
+# An "opsys-arch" pair that describes the "native" platform.
+#
+# _EMUL_OPSYSES
+# A list of supported binary emulations.
+#
+# _EMUL_PREFER.*
+# A table that maps ${_EMUL_MACHINE_PLATFORM} to a list of
+# platforms to try to emulate on the native platform, excluding
+# itself.
+#
+_EMUL_OPSYSES+= bsdi
+_EMUL_OPSYS.HPUX= hpux
+_EMUL_OPSYS.IRIX= irix
+_EMUL_OPSYS.OSF1= osf1
+.if !empty(OS_VERSION:M4.*)
+_EMUL_OPSYS.SunOS= sunos
+.else
+_EMUL_OPSYS.SunOS= solaris
+.endif
+.if defined(_EMUL_OPSYS.${OPSYS})
+_EMUL_OPSYS= ${_EMUL_OPSYS.${OPSYS}}
+.else
+_EMUL_OPSYS= ${LOWER_OPSYS}
+.endif
+
+_EMUL_MACHINE_PLATFORM= ${_EMUL_OPSYS}-${MACHINE_ARCH}
+
+_EMUL_OPSYSES+= darwin
+_EMUL_OPSYSES+= freebsd
+_EMUL_OPSYSES+= hpux
+_EMUL_OPSYSES+= irix
+_EMUL_OPSYSES+= linux
+_EMUL_OPSYSES+= netbsd
+_EMUL_OPSYSES+= osf1
+_EMUL_OPSYSES+= sunos
+_EMUL_OPSYSES+= solaris
+
+_EMUL_PREFER.netbsd-alpha= osf1-alpha linux-alpha
+_EMUL_PREFER.netbsd-arm= linux-arm
+_EMUL_PREFER.netbsd-i386= linux-i386 freebsd-i386 solaris-i386
+_EMUL_PREFER.netbsd-m68k= sunos-m68k linux-m68k
+_EMUL_PREFER.netbsd-powerpc= linux-powerpc
+_EMUL_PREFER.netbsd-sparc64= solaris-sparc64 solaris-sparc sunos-sparc
+.if !empty(MACHINE_PLATFORM:MNetBSD-1.*-sparc*)
+_EMUL_PREFER.netbsd-sparc= sunos-sparc
+.else
+_EMUL_PREFER.netbsd-sparc= solaris-sparc sunos-sparc
+.endif
+_EMUL_PREFER.netbsd-x86_64= linux-x86_64 linux-i386
+
+_EMUL_PREFER.solaris-sparc64= solaris-sparc
+_EMUL_PREFER.solaris-x86_64= solaris-i386
+
+_EMUL_PREFER.linux-sparc64= linux-sparc
+_EMUL_PREFER.linux-x86_64= linux-i386
+
+# Prefer "emulating" the native operating system, then fall back to
+# the other preferences listed above.
+#
+EMUL_PREFER?= ${_EMUL_MACHINE_PLATFORM} \
+ ${_EMUL_PREFER.${_EMUL_MACHINE_PLATFORM}}
+
+.for _platform_ in ${EMUL_PREFER}
+. if !empty(EMUL_PLATFORMS:M${_platform_})
+EMUL_PLATFORM?= ${_platform_}
+. endif
+.endfor
+EMUL_PLATFORM?= none
+
+# _EMUL_RUN_LDCONFIG
+# This is YesNo variable that is modified by makefiles in the
+# emulator framework. This is used as the default value of
+# RUN_LDCONFIG by any package that uses the emulator framework.
+#
+# Default value: no
+#
+_EMUL_RUN_LDCONFIG= no
+
+.if ${EMUL_PLATFORM} == "none"
+EMUL_ARCH?= none
+EMUL_OPSYS?= none
+EMUL_DISTRO?= none
+EMULSUBDIR?= # empty
+EMULDIR?= ${PREFIX}
+OPSYS_EMULDIR?= # empty
+.else
+EMUL_ARCH?= ${EMUL_PLATFORM:C/.*-//}
+EMUL_OPSYS?= ${EMUL_PLATFORM:C/-.*//}
+. include "../../mk/emulator/${EMUL_OPSYS}.mk"
+.endif
diff --git a/mk/emulator/emulator.mk b/mk/emulator/emulator.mk
new file mode 100644
index 00000000000..d58304a347d
--- /dev/null
+++ b/mk/emulator/emulator.mk
@@ -0,0 +1,116 @@
+# $NetBSD: emulator.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# This file is included by bsd.pkg.mk.
+#
+# Package-settable variables:
+#
+# EMUL_MODULES.${EMUL_OPSYS}
+# List of modules of ${EMUL_OPSYS} that are used by the package.
+#
+# Default value: undefined
+#
+# EMUL_PKG_FMT
+# Binary emulation packaging format requested by the package.
+# Possible values: any format listed in ${_EMUL_PKG_FMTS}.
+#
+# Default value: plain
+#
+# Variables defined by this file:
+#
+# EMULSUBDIRSLASH
+# Expands to either ${EMULSUBDIR}/lib or just lib depending on
+# whether EMULSUBDIR is empty or not. It is meant to be used
+# in PLISTs and files where one wants to avoid "//" artifacts,
+# e.g., ${EMULSUBDIRSLASH}lib.
+#
+# Public targets:
+#
+# emul-fetch
+# This is a public target that fetches the distfiles for all
+# supported EMUL_PLATFORMs.
+#
+# emul-distinfo
+# This is a public target that generates a new distinfo file
+# that contains checksums for all supported EMUL_PLATFORMs.
+# This target should be run after the successful completion
+# of the ``emul-fetch'' target.
+#
+
+# If we're doing true binary emulation, then file paths found in the
+# package's binaries, libraries and scripts won't necessarily match the
+# actual paths on the file system, so skip some path checks that are
+# likely to fail.
+#
+.if empty(EMUL_DISTRO:Mnative-*)
+CHECK_SHLIBS_SUPPORTED?= no
+CHECK_INTERPRETER_SKIP= *
+.endif
+
+# We're not concerned about "portability" problems if we're using
+# a package that requires binary emulation.
+#
+CHECK_PORTABILITY_SKIP= *
+
+RUN_LDCONFIG?= ${_EMUL_RUN_LDCONFIG}
+
+FILES_SUBST+= EMULDIR=${EMULDIR:Q}
+FILES_SUBST+= EMULSUBDIR=${EMULSUBDIR:Q}
+FILES_SUBST+= OPSYS_EMULDIR=${OPSYS_EMULDIR:Q}
+
+PLIST_SUBST+= EMULDIR=${EMULDIR:Q}
+PLIST_SUBST+= EMULSUBDIR=${EMULSUBDIR:Q}
+PLIST_SUBST+= OPSYS_EMULDIR=${OPSYS_EMULDIR:Q}
+
+EMULSUBDIRSLASH= ${EMULSUBDIR:S/$/\//:C/^\/$//}
+FILES_SUBST+= EMULSUBDIRSLASH=${EMULSUBDIRSLASH:Q}
+PLIST_SUBST+= EMULSUBDIRSLASH=${EMULSUBDIRSLASH:Q}
+
+.if empty(EMUL_PLATFORMS:M${EMUL_PLATFORM})
+PKG_FAIL_REASON+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}"
+.endif
+
+# Add dependencies for each "module" that the package requests in
+# EMUL_MODULES.${EMUL_OPSYS}.
+#
+.for _mod_ in ${EMUL_MODULES.${EMUL_OPSYS}}
+. if !defined(DEPENDS_${EMUL_DISTRO}.${_mod_})
+PKG_FAIL_REASON+= "${EMUL_DISTRO}: unknown module ${_mod_}"
+. else
+DEPENDS+= ${DEPENDS_${EMUL_DISTRO}.${_mod_}}
+. endif
+.endfor
+
+# _EMUL_PKG_FMTS
+# List of recognized binary emulation packaging formats that
+# packages may request.
+#
+_EMUL_PKG_FMTS= plain
+_EMUL_PKG_FMTS+= rpm
+
+EMUL_PKG_FMT?= plain
+
+.include "${PKGSRCDIR}/mk/emulator/pkg-${EMUL_PKG_FMT}.mk"
+
+.PHONY: emul-fetch
+emul-fetch:
+.for _platform_ in ${EMUL_PLATFORMS}
+ ${RUN} ${MAKE} ${MAKEFLAGS} fetch NO_SKIP=yes \
+ EMUL_PLATFORM=${_platform_}
+.endfor
+
+.PHONY: emul-distinfo
+emul-distinfo:
+ ${RUN} ${RM} -f ${DISTINFO_FILE}.emul
+ ${RUN} ( ${ECHO} "$$""NetBSD""$$"; ${ECHO} "" ) \
+ >> ${DISTINFO_FILE}.emul
+.for _platform_ in ${EMUL_PLATFORMS}
+ ${RUN} \
+ ( ${MAKE} ${MAKEFLAGS} distinfo NO_SKIP=yes \
+ ECHO_MSG=: EMUL_PLATFORM=${_platform_} && \
+ ${SED} "1,2d" ${DISTINFO_FILE} && \
+ ${RM} -f ${DISTINFO_FILE} ) >> ${DISTINFO_FILE}.emul
+.endfor
+ ${RUN} ${RM} -f ${DISTINFO_FILE}
+ ${RUN} ${AWK} -f ${PKGSRCDIR}/mk/emulator/merge-distinfo.awk \
+ ${DISTINFO_FILE}.emul > ${DISTINFO_FILE}
+ ${RUN} ${RM} -f ${DISTINFO_FILE}.emul
diff --git a/mk/emulator/freebsd.mk b/mk/emulator/freebsd.mk
new file mode 100644
index 00000000000..4784cf2efcb
--- /dev/null
+++ b/mk/emulator/freebsd.mk
@@ -0,0 +1,43 @@
+# $NetBSD: freebsd.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# FreeBSD binary emulation framework
+#
+
+.if !empty(OPSYS:MFreeBSD*)
+EMUL_TYPE.freebsd?= native
+.else
+EMUL_TYPE.freebsd?= builtin
+.endif
+EMUL_MODULES.freebsd?= # empty
+
+EMULSUBDIR= emul/freebsd
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.freebsd}
+
+# _EMUL_TYPES
+# List of recognized FreeBSD types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized FreeBSD "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+_EMUL_TYPE?= ${EMUL_TYPE.freebsd}
+
+_EMUL_MODULES= # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-freebsd # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-freebsd # native FreeBSD installation
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/freebsd-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}?= # empty
+. endfor
+.endif
diff --git a/mk/emulator/irix.mk b/mk/emulator/irix.mk
new file mode 100644
index 00000000000..411eb2c944d
--- /dev/null
+++ b/mk/emulator/irix.mk
@@ -0,0 +1,43 @@
+# $NetBSD: irix.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# IRIX binary emulation framework
+#
+
+.if !empty(OPSYS:MIRIX*)
+EMUL_TYPE.irix?= native
+.else
+EMUL_TYPE.irix?= builtin
+.endif
+EMUL_MODULES.irix?= # empty
+
+EMULSUBDIR= emul/irix
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.irix}
+
+# _EMUL_TYPES
+# List of recognized IRIX types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized IRIX "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+_EMUL_TYPE?= ${EMUL_TYPE.irix}
+
+_EMUL_MODULES= # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-irix # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-irix # native IRIX installation
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/irix-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}?= # empty
+. endfor
+.endif
diff --git a/mk/emulator/linux-suse.mk b/mk/emulator/linux-suse.mk
new file mode 100644
index 00000000000..bc181cf4614
--- /dev/null
+++ b/mk/emulator/linux-suse.mk
@@ -0,0 +1,43 @@
+# $NetBSD: linux-suse.mk,v 1.1 2007/07/29 05:19:42 jlam Exp $
+#
+# SuSE Linux
+#
+
+# Most Linux software only need suse>=6.4.
+SUSE_VERSION_REQD?= 6.4
+
+# When building the SuSE packages, force the Linux type to be the specific
+# version of SuSE that is being built.
+#
+.if defined(SUSE_PKG) && defined(SUSE_VERSION)
+EMUL_TYPE.linux= suse-${SUSE_VERSION}
+.endif
+
+# EMUL_TYPE.linux can be "suse" or "suse-[0-9]*". If the former, then use
+# the default SuSE version, otherwise use the specific version requested.
+#
+.if !empty(EMUL_TYPE.linux:Msuse-9.1)
+. include "${PKGSRCDIR}/emulators/suse91_linux/emulator.mk"
+
+.elif !empty(EMUL_TYPE.linux:Msuse-9.x)
+ # use the highest version of SuSE-9.x
+. include "${PKGSRCDIR}/emulators/suse91_linux/emulator.mk"
+
+.elif !empty(EMUL_TYPE.linux:Msuse-10.0)
+. include "${PKGSRCDIR}/emulators/suse100_linux/emulator.mk"
+
+.elif !empty(EMUL_TYPE.linux:Msuse-10.x)
+ # use the highest version of SuSE-10.x
+. include "${PKGSRCDIR}/emulators/suse100_linux/emulator.mk"
+
+.elif !empty(EMUL_TYPE.linux:Msuse)
+ # default to highest version of SuSE
+. include "${PKGSRCDIR}/emulators/suse100_linux/emulator.mk"
+
+.else
+EMUL_DISTRO= suse-0
+PKG_FAIL_REASON+= "[linux-suse.mk] ${EMUL_TYPE.linux} is not a supported EMUL_TYPE.linux"
+.endif
+
+# XXX There should be a check here to verify that ${EMUL_DISTRO} satisfies
+# XXX suse>=${SUSE_VERSION_REQD}.
diff --git a/mk/emulator/linux.mk b/mk/emulator/linux.mk
new file mode 100644
index 00000000000..542240e5aa8
--- /dev/null
+++ b/mk/emulator/linux.mk
@@ -0,0 +1,79 @@
+# $NetBSD: linux.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# Linux binary emulation framework
+#
+
+.if ${OPSYS} == "Linux"
+EMUL_TYPE.linux?= native
+.else
+EMUL_TYPE.linux?= suse
+.endif
+EMUL_MODULES.linux?= # empty
+
+.if ((${EMUL_ARCH} == "i386") && (${MACHINE_ARCH} == "x86_64")) || \
+ ((${EMUL_ARCH} == "sparc") && (${MACHINE_ARCH} == "sparc64"))
+_LINUX_BASE= linux32
+EMULSUBDIR= emul/linux32
+.else
+_LINUX_BASE= linux
+EMULSUBDIR= emul/linux
+.endif
+
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.${_LINUX_BASE}}
+
+# _EMUL_TYPES
+# List of recognized Linux types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized Linux "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+_EMUL_TYPES+= suse
+
+.if !empty(EMUL_TYPE.linux:Msuse-*)
+_EMUL_TYPE?= suse
+.endif
+_EMUL_TYPE?= ${EMUL_TYPE.linux}
+
+_EMUL_MODULES= aspell
+_EMUL_MODULES+= base
+_EMUL_MODULES+= compat
+_EMUL_MODULES+= cups
+_EMUL_MODULES+= expat
+_EMUL_MODULES+= fontconfig
+_EMUL_MODULES+= freetype2
+_EMUL_MODULES+= gdk-pixbuf
+_EMUL_MODULES+= glx
+_EMUL_MODULES+= gtk
+_EMUL_MODULES+= gtk2
+_EMUL_MODULES+= jpeg
+_EMUL_MODULES+= locale
+_EMUL_MODULES+= motif
+_EMUL_MODULES+= openssl
+_EMUL_MODULES+= png
+_EMUL_MODULES+= slang
+_EMUL_MODULES+= tiff
+_EMUL_MODULES+= vmware
+_EMUL_MODULES+= x11
+_EMUL_MODULES+= xml2
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-linux # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-linux # native Linux installation
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/linux-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_native-linux.${_mod_}= # empty
+. endfor
+.endif
+
+LDCONFIG_ADD_CMD?= ${EMULDIR}/sbin/ldconfig -r ${EMULDIR}
+LDCONFIG_REMOVE_CMD?= ${EMULDIR}/sbin/ldconfig -r ${EMULDIR}
diff --git a/mk/emulator/merge-distinfo.awk b/mk/emulator/merge-distinfo.awk
new file mode 100644
index 00000000000..7acdcfe31e0
--- /dev/null
+++ b/mk/emulator/merge-distinfo.awk
@@ -0,0 +1,43 @@
+# $NetBSD: merge-distinfo.awk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# This awk script sorts the contents of several distinfo files into a
+# single distinfo file.
+#
+
+# insertion sort
+function sort(a, nelem, temp, i, j) {
+ for (i = 2; i <= nelem; ++i) {
+ for (j = i; a[j-1] > a[j]; --j) {
+ temp = a[j]
+ a[j] = a[j-1]
+ a[j-1] = temp
+ }
+ }
+ return
+}
+
+/^[A-Z]+/ {
+ file = $2
+ files[file] = file
+ if (!($0 in seen)) {
+ seen[$0] = $0
+ properties[file, 0]++
+ properties[file, properties[file, 0]] = $0
+ }
+}
+
+END {
+ print "$" "NetBSD" "$"
+ print ""
+ n = 1
+ for (f in files) {
+ orderedfiles[n++] = f
+ }
+ n--;
+ sort(orderedfiles, n)
+ for (i = 1; i <= n; i++) {
+ f = orderedfiles[i]
+ for (j = 1; j <= properties[f, 0]; j++)
+ print properties[f, j]
+ }
+}
diff --git a/mk/emulator/osf1.mk b/mk/emulator/osf1.mk
new file mode 100644
index 00000000000..09d3bfb7354
--- /dev/null
+++ b/mk/emulator/osf1.mk
@@ -0,0 +1,43 @@
+# $NetBSD: osf1.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# OSF/1 (Tru64) binary emulation framework
+#
+
+.if !empty(OPSYS:MOSF*)
+EMUL_TYPE.osf1?= native
+.else
+EMUL_TYPE.osf1?= builtin
+.endif
+EMUL_MODULES.osf1?= # empty
+
+EMULSUBDIR= emul/osf1
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.osf1}
+
+# _EMUL_TYPES
+# List of recognized OSF/1 types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized OSF/1 "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+_EMUL_TYPE?= ${EMUL_TYPE.osf1}
+
+_EMUL_MODULES= # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-osf1 # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-osf1 # native OSF/1 (Tru64)
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/osf1-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}?= # empty
+. endfor
+.endif
diff --git a/mk/emulator/pkg-plain.mk b/mk/emulator/pkg-plain.mk
new file mode 100644
index 00000000000..ce8caf22073
--- /dev/null
+++ b/mk/emulator/pkg-plain.mk
@@ -0,0 +1,4 @@
+# $NetBSD: pkg-plain.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# "Plain" archived software without any special package format.
+#
diff --git a/mk/emulator/pkg-rpm.mk b/mk/emulator/pkg-rpm.mk
new file mode 100644
index 00000000000..493badc15e5
--- /dev/null
+++ b/mk/emulator/pkg-rpm.mk
@@ -0,0 +1,110 @@
+# $NetBSD: pkg-rpm.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# RPM package format
+#
+# Package-settable variables:
+#
+# RPM2PKG_PLIST
+# This is the path to the PLIST created by rpm2pkg(8) which will
+# list the files and directories extracted from the RPMs. If
+# this is empty, then no PLIST is created.
+#
+# Default value: ${WRKDIR}/.PLIST.rpm2pkg
+#
+# RPM2PKG_PREFIX
+# This is the directory under which the contents of the RPMs will
+# be extracted. This directory is stripped from the paths which
+# are stored in ${RPM2PKG_PLIST}.
+#
+# Default value: ${WRKDIR}
+#
+# RPM2PKG_SUBPREFIX
+# This is the subdirectory under ${RPM2PKG_PREFIX} within which
+# the RPMs are directly extracted. If this is empty, then the
+# RPMs are extracted directly into ${RPM2PKG_PREFIX}.
+#
+# Default value: empty
+#
+# RPM2PKG_STRIP
+# This is the number of path components to strip from the head
+# of paths of files and directories stored in the RPMs during
+# extraction. RPMs usually store all paths with a leading path
+# component of ``./''.
+#
+# Default value: 1
+#
+# RPM2PKG_STAGE
+# Stage at which to run the ``extract-rpm'' target.
+#
+# Default value: do-extract
+#
+# RPMFILES
+# The list of paths to RPMs to extract using rpm2pkg(8).
+#
+# Default value: all *.rpm files in DISTFILES located in ${_DISTDIR}
+#
+# RPMIGNOREPATH
+# The list of files or paths to skip during extraction of the RPMs.
+#
+# Default value: undefined
+#
+# Public targets:
+#
+# extract-rpm
+# Runs rpm2pkg(8) with the appropriate arguments based on the
+# RPM* variables set in the package Makefile to extract the
+# files listed in RPMFILES.
+#
+
+BUILD_DEPENDS+= rpm2pkg>=2.1:../../pkgtools/rpm2pkg
+EVAL_PREFIX+= _RPM2PKG_PREFIX=rpm2pkg
+RPM2PKG= ${_RPM2PKG_PREFIX}/sbin/rpm2pkg
+
+RPMFILES?= ${DISTFILES:M*.rpm:S/^/${_DISTDIR}\//}
+BUILD_DEFS+= RPMFILES
+.if defined(RPMIGNOREPATH)
+BUILD_DEFS+= RPMIGNOREPATH
+.endif
+
+RPM2PKGSTRIP?= ${RPM2PKG_STRIP}
+
+RPM2PKG_STRIP?= 1
+RPM2PKG_PREFIX?= ${WRKDIR}
+RPM2PKG_SUBPREFIX?= # empty
+RPM2PKG_PLIST?= ${WRKDIR}/.PLIST.rpm2pkg
+
+# By default, extract the RPMs during the do-extract step.
+RPM2PKG_STAGE?= do-extract
+
+RPM2PKG_ARGS_DFLT= -d ${RPM2PKG_PREFIX:Q}
+.if !empty(RPM2PKG_SUBPREFIX)
+RPM2PKG_ARGS_DFLT+= -p ${RPM2PKG_SUBPREFIX:Q}
+.endif
+.if !empty(RPM2PKG_PLIST)
+RPM2PKG_ARGS_DFLT+= -f ${RPM2PKG_PLIST:Q}
+.endif
+.if empty(RPM2PKG_STRIP:M0)
+RPM2PKG_ARGS_DFLT+= -s ${RPM2PKG_STRIP}
+.endif
+.for _ignoredir_ in ${RPMIGNOREPATH}
+RPM2PKG_ARGS_DFLT+= -i ${_ignoredir_}
+.endfor
+RPM2PKG_ARGS?= ${RPM2PKG_ARGS_DFLT}
+
+PLIST_SRC_DFLT+= ${RPM2PKG_PLIST}
+
+# We handle the extraction of the RPMs in the extract-rpm target below.
+EXTRACT_ONLY?= # empty
+
+# Usually, packages we install via RPMs also install shared libraries.
+_EMUL_RUN_LDCONFIG= yes
+
+.PHONY: extract-rpm
+extract-rpm:
+ @${STEP_MSG} "Extracting RPM files"
+.if !empty(RPM2PKG_PLIST)
+ ${RUN} ${RM} -f ${RPM2PKG_PLIST}
+.endif
+ ${RUN} ${RPM2PKG} ${RPM2PKG_ARGS} ${RPMFILES}
+
+${RPM2PKG_STAGE}: extract-rpm
diff --git a/mk/emulator/solaris.mk b/mk/emulator/solaris.mk
new file mode 100644
index 00000000000..d4f73403c42
--- /dev/null
+++ b/mk/emulator/solaris.mk
@@ -0,0 +1,52 @@
+# $NetBSD: solaris.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# Solaris (SVR4) binary emulation framework
+#
+
+.if ${OPSYS} == "SunOS"
+EMUL_TYPE.solaris?= native
+.else
+EMUL_TYPE.solaris?= builtin
+.endif
+EMUL_MODULES.solaris?= # empty
+
+.if ((${EMUL_ARCH} == "i386") && (${MACHINE_ARCH} == "x86_64")) || \
+ ((${EMUL_ARCH} == "sparc") && (${MACHINE_ARCH} == "sparc64"))
+_SOLARIS_BASE= solaris32
+EMULSUBDIR= emul/svr4_32
+.else
+_SOLARIS_BASE= solaris
+EMULSUBDIR= emul/svr4
+.endif
+
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.${_SOLARIS_BASE}}
+
+# _EMUL_TYPES
+# List of recognized Solaris types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized Solaris "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+#_EMUL_TYPES+= opensolaris
+_EMUL_TYPE?= ${EMUL_TYPE.solaris}
+
+_EMUL_MODULES= # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-solaris # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-solaris # native SunOS 5.x
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/solaris-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}= # empty
+. endfor
+.endif
diff --git a/mk/emulator/sunos.mk b/mk/emulator/sunos.mk
new file mode 100644
index 00000000000..5b60c748e1f
--- /dev/null
+++ b/mk/emulator/sunos.mk
@@ -0,0 +1,43 @@
+# $NetBSD: sunos.mk,v 1.1 2007/07/29 05:19:43 jlam Exp $
+#
+# SunOS 4.x binary emulation framework
+#
+
+.if ${OPSYS} == "SunOS"
+EMUL_TYPE.sunos?= native
+.else
+EMUL_TYPE.sunos?= builtin
+.endif
+EMUL_MODULES.sunos?= # empty
+
+EMULSUBDIR= emul/sunos
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+OPSYS_EMULDIR= ${_OPSYS_EMULDIR.sunos}
+
+# _EMUL_TYPES
+# List of recognized SunOS types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized SunOS "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= native
+_EMUL_TYPE?= ${EMUL_TYPE.sunos}
+
+_EMUL_MODULES= # empty
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-sunos # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= native-sunos # native SunOS 4.x
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/sunos-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}= # empty
+. endfor
+.endif