summaryrefslogtreecommitdiff
path: root/mk/emulator
diff options
context:
space:
mode:
authorjlam <jlam>2007-08-21 22:49:02 +0000
committerjlam <jlam>2007-08-21 22:49:02 +0000
commitab694111ad4413494cc301a737b52c16afbbdd86 (patch)
treec963fbe349aa6c3a854fc36e80c1b467ee94113c /mk/emulator
parent333906725cd0e72024ceb197e8c81fd1c6bff2d2 (diff)
downloadpkgsrc-ab694111ad4413494cc301a737b52c16afbbdd86.tar.gz
* Support netbsd-* as a valid platform in EMUL_PLATFORMS. Use the
pkgsrc/emulator/compat* and pkgsrc/emulator/netbsd32_compat* packages to provide the necessary shared libraries to run dynamically linked NetBSD binaries from the days of yore. * Add some additional compat* packages for completeness: compat15, compat20, compat30 * Modify the compat* packages so that "compatNM" only provides files that aren't in "NetBSD-N.(M+1)". For example, compat12 only provides files that don't exist in NetBSD-1.3.x, compat13 only provides files that don't exist in NetBSD-1.4.x, etc. As a result, if you are running NetBSD-3.0/alpha and want to run a 1.3 dynamically linked binary, there is an automatic dependency chain that causes the following packages to be installed: compat13, compat14, compat15, compat16, compat20 There are some deviations from this dependency chain on platforms that have changed executable formats, e.g. i386, m68, sparc, etc. However, in general pkgsrc will require that you have the necessary COMPAT_* options in your kernel to match the installed compat* packages. This restriction is an artificial one imposed by pkgsrc, but allows for a single set of distfiles to be used on all versions of NetBSD. * Provide compat* package support for every supported architecture of NetBSD. Verily, it is now possible to run 1.2 binaries on NetBSD-1.5.3/pc532 by installing the compat12 package from pkgsrc. Rejoice, one and all! * The netbsd32_compat* packages mirror the corresponding compat* packages for use by sparc64 and x86_64 to allow running 32-bit binaries with COMPAT_NETBSD32 kernel support. The "extras" packages supply the additional shared libraries from the corresponding release of NetBSD so that the set of files in /emul/netbsd32 will be complete. * pkgsrc/emulators/compat_netbsd contains infrastructure files shared by all of the compat* packages.
Diffstat (limited to 'mk/emulator')
-rw-r--r--mk/emulator/emulator-vars.mk8
-rw-r--r--mk/emulator/netbsd-compat.mk73
-rw-r--r--mk/emulator/netbsd.mk48
3 files changed, 125 insertions, 4 deletions
diff --git a/mk/emulator/emulator-vars.mk b/mk/emulator/emulator-vars.mk
index 1455ac56edf..17594867e32 100644
--- a/mk/emulator/emulator-vars.mk
+++ b/mk/emulator/emulator-vars.mk
@@ -1,6 +1,6 @@
-# $NetBSD: emulator-vars.mk,v 1.4 2007/08/03 23:16:02 ghen Exp $
+# $NetBSD: emulator-vars.mk,v 1.5 2007/08/21 22:49:33 jlam Exp $
#
-# This file is included by bsd.prefs.mk only if EMUL_PLATORMS is defined
+# This file is included by bsd.prefs.mk only if EMUL_PLATFORMS is defined
# and non-empty.
#
# User-settable variables:
@@ -92,13 +92,13 @@ _EMUL_PREFER.netbsd-arm= linux-arm
_EMUL_PREFER.netbsd-i386= linux-i386 freebsd-i386 solaris-i386 darwin-i386
_EMUL_PREFER.netbsd-m68k= sunos-m68k linux-m68k
_EMUL_PREFER.netbsd-powerpc= linux-powerpc darwin-powerpc
-_EMUL_PREFER.netbsd-sparc64= solaris-sparc64 solaris-sparc sunos-sparc
+_EMUL_PREFER.netbsd-sparc64= netbsd-sparc 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.netbsd-x86_64= netbsd-i386 linux-x86_64 linux-i386
_EMUL_PREFER.dragonfly-i386= linux-i386
diff --git a/mk/emulator/netbsd-compat.mk b/mk/emulator/netbsd-compat.mk
new file mode 100644
index 00000000000..7b7e78dbd36
--- /dev/null
+++ b/mk/emulator/netbsd-compat.mk
@@ -0,0 +1,73 @@
+# $NetBSD: netbsd-compat.mk,v 1.1 2007/08/21 22:49:33 jlam Exp $
+#
+# COMPAT_* for NetBSD -- see options(4).
+#
+# Variables defined by this file:
+#
+# EMUL_EXEC_FMT
+# The executable format of the emulated operating system.
+#
+# NATIVE_EXEC_FMT
+# The executable format of the native operating system.
+#
+
+NATIVE_EXEC_FMT= ${_NATIVE_EXEC_FMT_cmd:sh}
+_NATIVE_EXEC_FMT_cmd= sh ${.CURDIR}/../../mk/scripts/shlib-type \
+ ${_OPSYS_SHLIB_TYPE:Q} ${MAKE:Q}
+
+NETBSD_VERSION_REQD?= 1.6
+
+# When building a NetBSD "compat" package, force the NetBSD type to be
+# the specific version of NetBSD compatibility that is being built.
+#
+.if defined(NETBSD_PKG) && defined(NETBSD_VERSION)
+EMUL_TYPE.netbsd= compat-${NETBSD_VERSION}
+.endif
+
+# The _EMUL_PKG.* table maps ${EMUL_TYPE.netbsd} to the NetBSD shared libs
+# package that provides that compatibility version.
+#
+_EMUL_PKG.compat-1.2= compat12
+_EMUL_PKG.compat-1.3= compat13
+_EMUL_PKG.compat-1.4= compat14
+_EMUL_PKG.compat-1.5= compat15
+_EMUL_PKG.compat-1.6= compat16
+_EMUL_PKG.compat-2.0= compat20
+_EMUL_PKG.compat-3.0= compat30
+_EMUL_PKG.compat= # defined, but empty
+
+# EMUL_TYPE.netbsd can be "compat" or "compat-[0-9]*". If a particular
+# EMUL_TYPE.netbsd is requested, then always use it, regardless of the
+# value of NETBSD_VERSION_REQD.
+#
+.if defined(_EMUL_PKG.${EMUL_TYPE.netbsd})
+. if !empty(_EMUL_PKG.${EMUL_TYPE.netbsd})
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.${EMUL_TYPE.netbsd}}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M1.2*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-1.2}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M1.3*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-1.3}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M1.4*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-1.4}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M1.5*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-1.5}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M1.6*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-1.6}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M2.*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-2.0}/emulator.mk"
+
+. elif !empty(NETBSD_VERSION_REQD:M3.*)
+. include "${PKGSRCDIR}/emulators/${_EMUL_PKG.compat-3.0}/emulator.mk"
+
+. endif
+
+.else
+EMUL_DISTRO= netbsd-0
+PKG_FAIL_REASON+= "[netbsd-compat.mk] ${EMUL_TYPE.netbsd} is not a supported EMUL_TYPE.netbsd"
+.endif
diff --git a/mk/emulator/netbsd.mk b/mk/emulator/netbsd.mk
new file mode 100644
index 00000000000..3641cc66846
--- /dev/null
+++ b/mk/emulator/netbsd.mk
@@ -0,0 +1,48 @@
+# $NetBSD: netbsd.mk,v 1.1 2007/08/21 22:49:33 jlam Exp $
+#
+# NetBSD binary emulation framework
+#
+# Nothing emulates NetBSD except for newer versions of NetBSD, so we can
+# safely assume that ${OPSYS} == "NetBSD".
+#
+
+EMUL_TYPE.netbsd?= compat
+EMUL_MODULES.netbsd?= # empty
+
+EMULDIR= ${PREFIX}/${EMULSUBDIR}
+
+# _EMUL_TYPES
+# List of recognized NetBSD types that a user may request.
+#
+# _EMUL_MODULES
+# List of recognized NetBSD "modules" that packages may request.
+#
+_EMUL_TYPES= builtin
+_EMUL_TYPES+= compat
+_EMUL_TYPES+= native
+
+.if !empty(EMUL_TYPE.netbsd:Mcompat-*)
+_EMUL_TYPE?= compat
+.endif
+_EMUL_TYPE?= ${EMUL_TYPE.netbsd}
+
+_EMUL_MODULES= base
+
+.if ${_EMUL_TYPE} == "builtin"
+EMUL_DISTRO= builtin-netbsd # managed outside pkgsrc
+.elif ${_EMUL_TYPE} == "native"
+EMUL_DISTRO= native-netbsd # native NetBSD
+EMULDIR= ${PREFIX}
+EMULSUBDIR= # empty
+.else
+. include "${PKGSRCDIR}/mk/emulator/netbsd-${_EMUL_TYPE}.mk"
+.endif
+
+.if (${_EMUL_TYPE} == "builtin") || (${_EMUL_TYPE} == "native")
+. for _mod_ in ${_EMUL_MODULES}
+DEPENDS_${EMUL_DISTRO}.${_mod_}= # empty
+. endfor
+.endif
+
+LDCONFIG_ADD_CMD?= /sbin/ldconfig
+LDCONFIG_REMOVE_CMD?= /sbin/ldconfig