summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/uninative.bbclass41
1 files changed, 38 insertions, 3 deletions
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 0cd27db853..fe1e89b29c 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -2,16 +2,51 @@ NATIVELSBSTRING = "universal"
2 2
3UNINATIVE_LOADER ?= "${@bb.utils.contains('BUILD_ARCH', 'x86_64', '${STAGING_DIR_NATIVE}/lib/ld-linux-x86-64.so.2', '${STAGING_DIR_NATIVE}/lib/ld-linux.so.2', d)}" 3UNINATIVE_LOADER ?= "${@bb.utils.contains('BUILD_ARCH', 'x86_64', '${STAGING_DIR_NATIVE}/lib/ld-linux-x86-64.so.2', '${STAGING_DIR_NATIVE}/lib/ld-linux.so.2', d)}"
4 4
5UNINATIVE_URL ?= "unset"
6UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc.tar.bz2"
7# Example checksums
8#UNINATIVE_CHECKSUM[i586] = "dead"
9#UNINATIVE_CHECKSUM[x86_64] = "dead"
10UNINATIVE_DLDIR ?= "${COREBASE}"
11
5addhandler uninative_eventhandler 12addhandler uninative_eventhandler
6uninative_eventhandler[eventmask] = "bb.event.BuildStarted" 13uninative_eventhandler[eventmask] = "bb.event.BuildStarted"
7 14
8python uninative_eventhandler() { 15python uninative_eventhandler() {
9 loader = e.data.getVar("UNINATIVE_LOADER", True) 16 loader = e.data.getVar("UNINATIVE_LOADER", True)
17 tarball = d.getVar("UNINATIVE_TARBALL", True)
18 tarballdir = d.getVar("UNINATIVE_DLDIR", True)
10 if not os.path.exists(loader): 19 if not os.path.exists(loader):
11 import subprocess 20 import subprocess
12 cmd = e.data.expand("mkdir -p ${STAGING_DIR}; cd ${STAGING_DIR}; tar -xjf ${COREBASE}/${BUILD_ARCH}-nativesdk-libc.tar.bz2; ${STAGING_DIR}/relocate_sdk.py ${STAGING_DIR_NATIVE} ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${STAGING_BINDIR_NATIVE}/patchelf-uninative") 21
13 #bb.warn("nativesdk lib extraction: " + cmd) 22 olddir = os.getcwd()
14 subprocess.check_call(cmd, shell=True) 23 if not os.path.exists(os.path.join(tarballdir, tarball)):
24 # Copy the data object and override DL_DIR and SRC_URI
25 localdata = bb.data.createCopy(d)
26
27 if d.getVar("UNINATIVE_URL", True) == "unset":
28 bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
29
30 chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
31 if not chksum:
32 bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
33
34 srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};md5sum=%s" % chksum)
35 dldir = localdata.expand(tarballdir)
36 localdata.setVar('FILESPATH', dldir)
37 localdata.setVar('DL_DIR', dldir)
38 bb.note("Fetching uninative binary shim from %s" % srcuri)
39 fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
40 try:
41 fetcher.download()
42 except Exception as exc:
43 bb.fatal("Unable to download uninative tarball: %s" % str(exc))
44 cmd = e.data.expand("mkdir -p ${STAGING_DIR}; cd ${STAGING_DIR}; tar -xjf ${UNINATIVE_DLDIR}/${UNINATIVE_TARBALL}; ${STAGING_DIR}/relocate_sdk.py ${STAGING_DIR_NATIVE} ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${STAGING_BINDIR_NATIVE}/patchelf-uninative")
45 try:
46 subprocess.check_call(cmd, shell=True)
47 except subprocess.CalledProcessError as exc:
48 bb.fatal("Unable to install uninative tarball: %s" % str(exc))
49 os.chdir(olddir)
15} 50}
16 51
17SSTATEPOSTUNPACKFUNCS_append = " uninative_changeinterp" 52SSTATEPOSTUNPACKFUNCS_append = " uninative_changeinterp"