Add files from parent branch HEAD:
[pkgsrcv2.git] / mk / emulator / emulator-vars.mk
1 # $NetBSD: emulator-vars.mk,v 1.7 2007/08/23 13:43:57 jlam Exp $
2 #
3 # This file is included by bsd.prefs.mk only if EMUL_PLATFORMS is defined
4 # and non-empty.
5 #
6 # User-settable variables:
7 #
8 # EMUL_TYPE.${EMUL_OPSYS}
9 #       Specifies the "type" or "variant" of ${EMUL_OPSYS} to use, e.g.
10 #       ${EMUL_TYPE.linux} == "suse".
11 #
12 # EMUL_PLATFORM
13 #       Specifies the platform to emulate, and is of the form
14 #       ${EMUL_OPSYS}-${EMUL_ARCH}, e.g. linux-i386.  By default
15 #       this is the best-matching platform listed in EMUL_PLATFORMS
16 #       chosen based on EMUL_PREFER.
17 #
18 # EMUL_PREFER
19 #       The list of platforms to try to emulate in order of preference.
20 #       By default, only try to emulate the native platform.  See the
21 #       _EMUL_PREFER.* table below for additional preferences for various
22 #       platforms.
23 #
24 # Package-settable variables:
25 #
26 # EMUL_PLATFORMS
27 #       List of "${EMUL_OPSYS}-${EMUL_ARCH}" binary emulations supported
28 #       by the package.  This should be set prior to the inclusion of
29 #       bsd.prefs.mk.
30 #
31 #       Default value: undefined
32 #
33 # Variables defined by this file:
34 #
35 # EMUL_ARCH
36 #       The machine architecture being emulated, e.g. i386.  If the
37 #       package isn't supported on this machine, then its value is
38 #       "none".
39 #
40 # EMUL_OPSYS
41 #       The operating system being emulated, e.g. linux.  If the
42 #       package isn't supported on this machine, then its value is
43 #       "none".
44 #
45 # EMUL_IS_NATIVE
46 #       Whether or not the operating system being emulated matches the
47 #       native operating system.  It is either defined or undefined.
48 #
49
50 _VARGROUPS+=            emulator
51 _USER_VARS.emulator=    EMUL_TYPE.${EMUL_OPSYS} EMUL_PLATFORM EMUL_PREFER
52 _PKG_VARS.emulator=     EMUL_PLATFORMS
53 _SYS_VARS.emulator=     EMUL_ARCH EMUL_OPSYS EMUL_IS_NATIVE
54
55 # _EMUL_OPSYS
56 #       A table that maps ${OPSYS} to the operating system names
57 #       (${EMUL_OPSYS}) used by the emulator framework.
58 #
59 # _EMUL_MACHINE_PLATFORM
60 #       An "opsys-arch" pair that describes the "native" platform.
61 #
62 # _EMUL_PREFER.*
63 #       A table that maps ${_EMUL_MACHINE_PLATFORM} to a list of
64 #       platforms to try to emulate on the native platform, excluding
65 #       itself.
66 #
67 _EMUL_OPSYS.HPUX=       hpux
68 _EMUL_OPSYS.IRIX=       irix
69 _EMUL_OPSYS.OSF1=       osf1
70 .if !empty(OS_VERSION:M4.*)
71 _EMUL_OPSYS.SunOS=      sunos
72 .else
73 _EMUL_OPSYS.SunOS=      solaris
74 .endif
75 .if defined(_EMUL_OPSYS.${OPSYS})
76 _EMUL_OPSYS=            ${_EMUL_OPSYS.${OPSYS}}
77 .else
78 _EMUL_OPSYS=            ${LOWER_OPSYS}
79 .endif
80
81 _EMUL_MACHINE_PLATFORM= ${_EMUL_OPSYS}-${MACHINE_ARCH}
82
83 _EMUL_PREFER.netbsd-alpha=      osf1-alpha linux-alpha
84 _EMUL_PREFER.netbsd-arm=        linux-arm
85 _EMUL_PREFER.netbsd-i386=       linux-i386 freebsd-i386 solaris-i386 darwin-i386
86 _EMUL_PREFER.netbsd-m68k=       sunos-m68k linux-m68k
87 _EMUL_PREFER.netbsd-powerpc=    linux-powerpc darwin-powerpc
88 _EMUL_PREFER.netbsd-sparc64=    netbsd-sparc solaris-sparc64 solaris-sparc sunos-sparc
89 .if !empty(MACHINE_PLATFORM:MNetBSD-1.*-sparc*)
90 _EMUL_PREFER.netbsd-sparc=      sunos-sparc
91 .else
92 _EMUL_PREFER.netbsd-sparc=      solaris-sparc sunos-sparc
93 .endif
94 _EMUL_PREFER.netbsd-x86_64=     netbsd-i386 linux-x86_64 linux-i386
95
96 _EMUL_PREFER.dragonfly-i386=    linux-i386
97
98 _EMUL_PREFER.solaris-sparc64=   solaris-sparc
99 _EMUL_PREFER.solaris-x86_64=    solaris-i386
100
101 _EMUL_PREFER.linux-sparc64=     linux-sparc
102 _EMUL_PREFER.linux-x86_64=      linux-i386
103
104 # Prefer "emulating" the native operating system, then fall back to
105 # the other preferences listed above.
106 #
107 EMUL_PREFER?=           ${_EMUL_MACHINE_PLATFORM}                       \
108                         ${_EMUL_PREFER.${_EMUL_MACHINE_PLATFORM}}
109
110 .for _platform_ in ${EMUL_PREFER}
111 .  if !empty(EMUL_PLATFORMS:M${_platform_})
112 EMUL_PLATFORM?=         ${_platform_}
113 .  endif
114 .endfor
115 EMUL_PLATFORM?=         none
116
117 .if ${EMUL_PLATFORM} == "none"
118 EMUL_ARCH?=             none
119 EMUL_OPSYS?=            none
120 .else
121 EMUL_ARCH?=             ${EMUL_PLATFORM:C/.*-//}
122 EMUL_OPSYS?=            ${EMUL_PLATFORM:C/-.*//}
123 .endif
124
125 .if ${_EMUL_OPSYS} == ${EMUL_OPSYS}
126 EMUL_IS_NATIVE=         defined
127 .endif