merge with org.openembedded.dev
[openembedded.git] / classes / nativesdk.bbclass
1 # SDK packages are built either explicitly by the user,
2 # or indirectly via dependency.  No need to be in 'world'.
3 EXCLUDE_FROM_WORLD = "1"
4
5 #
6 # Update BASE_PACKAGE_ARCH and PACKAGE_ARCHS
7 #
8 OLD_PACKAGE_ARCH := ${BASE_PACKAGE_ARCH}
9 BASE_PACKAGE_ARCH = "${SDK_ARCH}-nativesdk"
10 python () {
11     archs = bb.data.getVar('PACKAGE_ARCHS', d, True).split()
12     sdkarchs = []
13     for arch in archs:
14         sdkarchs.append(arch + '-nativesdk')
15     bb.data.setVar('PACKAGE_ARCHS', " ".join(sdkarchs), d)
16 }
17
18 #STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_SYS}-nativesdk"
19 #STAGING_DIR_TARGET = "${STAGING_DIR}/${BASEPKG_TARGET_SYS}-nativesdk"
20
21 CROSS_DIR = "${TMPDIR}/cross/${HOST_ARCH}"
22
23 HOST_ARCH = "${SDK_ARCH}"
24 HOST_VENDOR = "${SDK_VENDOR}"
25 HOST_OS = "${SDK_OS}"
26 HOST_PREFIX = "${SDK_PREFIX}"
27 HOST_CC_ARCH = "${SDK_CC_ARCH}"
28 #HOST_SYS = "${HOST_ARCH}${TARGET_VENDOR}-${HOST_OS}"
29
30 TARGET_ARCH = "${SDK_ARCH}"
31 TARGET_VENDOR = "${SDK_VENDOR}"
32 TARGET_OS = "${SDK_OS}"
33 TARGET_PREFIX = "${SDK_PREFIX}"
34 TARGET_CC_ARCH = "${SDK_CC_ARCH}"
35
36 CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
37 CFLAGS = "${BUILDSDK_CFLAGS}"
38 CXXFLAGS = "${BUILDSDK_CFLAGS}"
39 LDFLAGS = "${BUILDSDK_LDFLAGS}"
40
41 # Change to place files in SDKPATH
42 prefix = "${SDKPATH}"
43 exec_prefix = "${SDKPATH}"
44 base_prefix = "${SDKPATH}"
45
46 FILES_${PN} += "${prefix}"
47 FILES_${PN}-dbg += "${prefix}/.debug \
48                     ${prefix}/bin/.debug \
49                    "
50
51 export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
52 export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
53
54 python __anonymous () {
55     pn = bb.data.getVar("PN", d, True)
56     depends = bb.data.getVar("DEPENDS", d, True)
57     deps = bb.utils.explode_deps(depends)
58     newdeps = []
59     for dep in deps:
60         if dep.endswith("-native") or dep.endswith("-cross"):
61             newdeps.append(dep)
62         elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc"):
63             newdeps.append(dep + "-crosssdk")
64         elif not dep.endswith("-nativesdk"):
65             newdeps.append(dep + "-nativesdk")
66         else:
67             newdeps.append(dep)
68     bb.data.setVar("DEPENDS", " ".join(newdeps), d)
69     provides = bb.data.getVar("PROVIDES", d, True)
70     for prov in provides.split():
71         if prov.find(pn) != -1:
72             continue
73         if not prov.endswith("-nativesdk"):
74             provides = provides.replace(prov, prov + "-nativesdk")
75     bb.data.setVar("PROVIDES", provides, d)
76 }
77
78