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