Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # We want native packages to be relocatable |
| 2 | inherit relocatable |
| 3 | |
| 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" |
| 7 | |
| 8 | PACKAGES = "" |
| 9 | PACKAGES_class-native = "" |
| 10 | PACKAGES_DYNAMIC = "" |
| 11 | PACKAGES_DYNAMIC_class-native = "" |
| 12 | PACKAGE_ARCH = "${BUILD_ARCH}" |
| 13 | |
| 14 | # used by cmake class |
| 15 | OECMAKE_RPATH = "${libdir}" |
| 16 | OECMAKE_RPATH_class-native = "${libdir}" |
| 17 | |
| 18 | # When this class has packaging enabled, setting |
| 19 | # RPROVIDES becomes unnecessary. |
| 20 | RPROVIDES = "${PN}" |
| 21 | |
| 22 | TARGET_ARCH = "${BUILD_ARCH}" |
| 23 | TARGET_OS = "${BUILD_OS}" |
| 24 | TARGET_VENDOR = "${BUILD_VENDOR}" |
| 25 | TARGET_PREFIX = "${BUILD_PREFIX}" |
| 26 | TARGET_CC_ARCH = "${BUILD_CC_ARCH}" |
| 27 | TARGET_LD_ARCH = "${BUILD_LD_ARCH}" |
| 28 | TARGET_AS_ARCH = "${BUILD_AS_ARCH}" |
| 29 | TARGET_CPPFLAGS = "${BUILD_CPPFLAGS}" |
| 30 | TARGET_CFLAGS = "${BUILD_CFLAGS}" |
| 31 | TARGET_CXXFLAGS = "${BUILD_CXXFLAGS}" |
| 32 | TARGET_LDFLAGS = "${BUILD_LDFLAGS}" |
| 33 | TARGET_FPU = "" |
| 34 | |
| 35 | HOST_ARCH = "${BUILD_ARCH}" |
| 36 | HOST_OS = "${BUILD_OS}" |
| 37 | HOST_VENDOR = "${BUILD_VENDOR}" |
| 38 | HOST_PREFIX = "${BUILD_PREFIX}" |
| 39 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" |
| 40 | HOST_LD_ARCH = "${BUILD_LD_ARCH}" |
| 41 | HOST_AS_ARCH = "${BUILD_AS_ARCH}" |
| 42 | |
| 43 | CPPFLAGS = "${BUILD_CPPFLAGS}" |
| 44 | CFLAGS = "${BUILD_CFLAGS}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 45 | CXXFLAGS = "${BUILD_CXXFLAGS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | LDFLAGS = "${BUILD_LDFLAGS}" |
| 47 | LDFLAGS_build-darwin = "-L${STAGING_LIBDIR_NATIVE} " |
| 48 | |
| 49 | STAGING_BINDIR = "${STAGING_BINDIR_NATIVE}" |
| 50 | STAGING_BINDIR_CROSS = "${STAGING_BINDIR_NATIVE}" |
| 51 | |
| 52 | # native pkg doesn't need the TOOLCHAIN_OPTIONS. |
| 53 | TOOLCHAIN_OPTIONS = "" |
| 54 | |
| 55 | DEPENDS_GETTEXT = "gettext-native" |
| 56 | |
| 57 | # Don't build ptest natively |
| 58 | PTEST_ENABLED = "0" |
| 59 | |
| 60 | # Don't use site files for native builds |
| 61 | export CONFIG_SITE = "${COREBASE}/meta/site/native" |
| 62 | |
| 63 | # set the compiler as well. It could have been set to something else |
| 64 | export CC = "${BUILD_CC}" |
| 65 | export CXX = "${BUILD_CXX}" |
| 66 | export FC = "${BUILD_FC}" |
| 67 | export CPP = "${BUILD_CPP}" |
| 68 | export LD = "${BUILD_LD}" |
| 69 | export CCLD = "${BUILD_CCLD}" |
| 70 | export AR = "${BUILD_AR}" |
| 71 | export AS = "${BUILD_AS}" |
| 72 | export RANLIB = "${BUILD_RANLIB}" |
| 73 | export STRIP = "${BUILD_STRIP}" |
| 74 | export NM = "${BUILD_NM}" |
| 75 | |
| 76 | # Path prefixes |
| 77 | base_prefix = "${STAGING_DIR_NATIVE}" |
| 78 | prefix = "${STAGING_DIR_NATIVE}${prefix_native}" |
| 79 | exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}" |
| 80 | |
| 81 | bindir = "${STAGING_BINDIR_NATIVE}" |
| 82 | sbindir = "${STAGING_SBINDIR_NATIVE}" |
| 83 | libdir = "${STAGING_LIBDIR_NATIVE}" |
| 84 | includedir = "${STAGING_INCDIR_NATIVE}" |
| 85 | sysconfdir = "${STAGING_ETCDIR_NATIVE}" |
| 86 | datadir = "${STAGING_DATADIR_NATIVE}" |
| 87 | |
| 88 | baselib = "lib" |
| 89 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 90 | export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 91 | |
| 92 | NATIVE_PACKAGE_PATH_SUFFIX ?= "" |
| 93 | bindir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
| 94 | libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
| 95 | libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" |
| 96 | |
| 97 | do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/" |
| 98 | do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_NATIVE}/" |
| 99 | |
| 100 | # Since we actually install these into situ there is no staging prefix |
| 101 | STAGING_DIR_HOST = "" |
| 102 | STAGING_DIR_TARGET = "" |
| 103 | PKG_CONFIG_DIR = "${libdir}/pkgconfig" |
| 104 | |
| 105 | EXTRA_NATIVE_PKGCONFIG_PATH ?= "" |
| 106 | PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}" |
| 107 | PKG_CONFIG_SYSROOT_DIR = "" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 108 | PKG_CONFIG_SYSTEM_LIBRARY_PATH[unexport] = "1" |
| 109 | PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
| 111 | # we dont want libc-uclibc or libc-glibc to kick in for native recipes |
| 112 | LIBCOVERRIDE = "" |
| 113 | CLASSOVERRIDE = "class-native" |
| 114 | MACHINEOVERRIDES = "" |
| 115 | |
| 116 | PATH_prepend = "${COREBASE}/scripts/native-intercept:" |
| 117 | |
| 118 | python native_virtclass_handler () { |
| 119 | classextend = e.data.getVar('BBCLASSEXTEND', True) or "" |
| 120 | if "native" not in classextend: |
| 121 | return |
| 122 | |
| 123 | pn = e.data.getVar("PN", True) |
| 124 | if not pn.endswith("-native"): |
| 125 | return |
| 126 | |
| 127 | def map_dependencies(varname, d, suffix = ""): |
| 128 | if suffix: |
| 129 | varname = varname + "_" + suffix |
| 130 | deps = d.getVar(varname, True) |
| 131 | if not deps: |
| 132 | return |
| 133 | deps = bb.utils.explode_deps(deps) |
| 134 | newdeps = [] |
| 135 | for dep in deps: |
| 136 | if dep == pn: |
| 137 | continue |
| 138 | elif "-cross-" in dep: |
| 139 | newdeps.append(dep.replace("-cross", "-native")) |
| 140 | elif not dep.endswith("-native"): |
| 141 | newdeps.append(dep + "-native") |
| 142 | else: |
| 143 | newdeps.append(dep) |
| 144 | d.setVar(varname, " ".join(newdeps)) |
| 145 | |
| 146 | e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + ":virtclass-native") |
| 147 | |
| 148 | map_dependencies("DEPENDS", e.data) |
| 149 | for pkg in [e.data.getVar("PN", True), "", "${PN}"]: |
| 150 | map_dependencies("RDEPENDS", e.data, pkg) |
| 151 | map_dependencies("RRECOMMENDS", e.data, pkg) |
| 152 | map_dependencies("RSUGGESTS", e.data, pkg) |
| 153 | map_dependencies("RPROVIDES", e.data, pkg) |
| 154 | map_dependencies("RREPLACES", e.data, pkg) |
| 155 | |
| 156 | provides = e.data.getVar("PROVIDES", True) |
| 157 | nprovides = [] |
| 158 | for prov in provides.split(): |
| 159 | if prov.find(pn) != -1: |
| 160 | nprovides.append(prov) |
| 161 | elif not prov.endswith("-native"): |
| 162 | nprovides.append(prov.replace(prov, prov + "-native")) |
| 163 | else: |
| 164 | nprovides.append(prov) |
| 165 | e.data.setVar("PROVIDES", ' '.join(nprovides)) |
| 166 | |
| 167 | |
| 168 | } |
| 169 | |
| 170 | addhandler native_virtclass_handler |
| 171 | native_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" |
| 172 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 173 | inherit nopackages |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 174 | |
| 175 | do_packagedata[stamp-extra-info] = "" |
| 176 | do_populate_sysroot[stamp-extra-info] = "" |
| 177 | |
| 178 | USE_NLS = "no" |