xmms: bump PR
[openembedded.git] / classes / native.bbclass
blob345bd8028df290aeb50dc33d9fcb8c780308699e
1 # We want native packages to be relocatable
2 inherit relocatable
4 # Native packages are built indirectly via dependency,
5 # no need for them to be a direct target of 'world'
6 EXCLUDE_FROM_WORLD = "1"
8 PACKAGES = ""
9 PACKAGES_virtclass-native = ""
10 PACKAGE_ARCH = "${BUILD_ARCH}"
12 BASE_PACKAGE_ARCH = "${BUILD_ARCH}"
13 BASEPKG_HOST_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
14 BASEPKG_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
16 # When this class has packaging enabled, setting 
17 # RPROVIDES becomes unnecessary.
18 RPROVIDES = "${PN}"
20 TARGET_ARCH = "${BUILD_ARCH}"
21 TARGET_OS = "${BUILD_OS}"
22 TARGET_VENDOR = "${BUILD_VENDOR}"
23 TARGET_PREFIX = "${BUILD_PREFIX}"
24 TARGET_CC_ARCH = "${BUILD_CC_ARCH}"
25 TARGET_EXEEXT = "${BUILD_EXEEXT}"
27 HOST_ARCH = "${BUILD_ARCH}"
28 HOST_OS = "${BUILD_OS}"
29 HOST_VENDOR = "${BUILD_VENDOR}"
30 HOST_PREFIX = "${BUILD_PREFIX}"
31 HOST_CC_ARCH = "${BUILD_CC_ARCH}"
32 HOST_EXEEXT = "${BUILD_EXEEXT}"
34 CPPFLAGS = "${BUILD_CPPFLAGS}"
35 CFLAGS = "${BUILD_CFLAGS}"
36 CXXFLAGS = "${BUILD_CFLAGS}"
37 LDFLAGS = "${BUILD_LDFLAGS}"
38 LDFLAGS_build-darwin = "-L${STAGING_LIBDIR_NATIVE} "
40 STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}"
41 STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}"
43 STAGING_DIR_JAVA = "${STAGING_DATADIR_JAVA_NATIVE}"
44 DEPENDS_GETTEXT = "gettext-native"
46 # Don't use site files for native builds
47 export CONFIG_SITE = ""
49 # set the compiler as well. It could have been set to something else
50 export CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
51 export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}"
52 export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}"
53 export CPP = "${HOST_PREFIX}gcc -E"
54 export LD = "${HOST_PREFIX}ld"
55 export CCLD = "${CC}"
56 export AR = "${HOST_PREFIX}ar"
57 export AS = "${HOST_PREFIX}as"
58 export RANLIB = "${HOST_PREFIX}ranlib"
59 export STRIP = "${HOST_PREFIX}strip"
61 # Path prefixes
62 base_prefix = "${STAGING_DIR_NATIVE}"
63 prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
64 exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
66 # Since we actually install these into situ there is no staging prefix
67 STAGING_DIR_HOST = ""
68 STAGING_DIR_TARGET = ""
69 SHLIBSDIR = "${STAGING_DIR_NATIVE}/shlibs"
70 PKG_CONFIG_DIR = "${libdir}/pkgconfig"
72 do_stage_native () {
73         # If autotools is active, use the autotools staging function, else 
74         # use our "make install" equivalent
75         if [ "${AUTOTOOLS_NATIVE_STAGE_INSTALL}" == "1" ]
76         then
77                 autotools_stage_all
78         else
79                 oe_runmake install
80         fi
83 do_stage () {
84         do_stage_native
87 PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
88 PKG_CONFIG_SYSROOT_DIR = ""
90 ORIG_DEPENDS := "${DEPENDS}"
92 DEPENDS_virtclass-native ?= "${ORIG_DEPENDS}"
94 def native_virtclass_add_override(d):
95     if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""):
96         bb.data.setVar("OVERRIDES", bb.data.getVar("OVERRIDES", d, False) + ":virtclass-native", d)
98 OVERRIDES .= "${@native_virtclass_add_override(d)}"
100 python __anonymous () {
101     # If we've a legacy native do_stage, we need to neuter do_install
102     stagefunc = bb.data.getVar('do_stage', d, True)
104     # For now, force legacy mode for native packages using autotools_stage_all
105     if (stagefunc.strip() == "autotools_stage_all"):
106         bb.debug(1, "Forcing legacy staging mode for %s" % bb.data.getVar('FILE', d, 1))
107         bb.data.setVar('FORCE_LEGACY_STAGING', "1", d)
108     elif (stagefunc.strip() != "do_stage_native" and stagefunc.strip() != "autotools_stage_all") and bb.data.getVar('AUTOTOOLS_NATIVE_STAGE_INSTALL', d, 1) == "1":
109         bb.data.setVar("do_install", "      :", d)
111     if "native" in (bb.data.getVar('BBCLASSEXTEND', d, True) or ""):
112         pn = bb.data.getVar("PN", d, True)
113         depends = bb.data.getVar("DEPENDS_virtclass-native", d, True)
114         deps = bb.utils.explode_deps(depends)
115         newdeps = []
116         for dep in deps:
117             if dep.endswith("-cross"):
118                 newdeps.append(dep.replace("-cross", "-native"))
119             elif not dep.endswith("-native"):
120      
121                 newdeps.append(dep + "-native")
122             else:
123                 newdeps.append(dep)
124         bb.data.setVar("DEPENDS_virtclass-native", " ".join(newdeps), d)
125         provides = bb.data.getVar("PROVIDES", d, True)
126         for prov in provides.split():
127             if prov.find(pn) != -1:
128                 continue
129             if not prov.endswith("-native"):
130     
131                 provides = provides.replace(prov, prov + "-native")
132         bb.data.setVar("PROVIDES", provides, d)