summaryrefslogtreecommitdiffstats
path: root/meta/classes/cross-canadian.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/cross-canadian.bbclass')
-rw-r--r--meta/classes/cross-canadian.bbclass194
1 files changed, 0 insertions, 194 deletions
diff --git a/meta/classes/cross-canadian.bbclass b/meta/classes/cross-canadian.bbclass
deleted file mode 100644
index f5c9f61595..0000000000
--- a/meta/classes/cross-canadian.bbclass
+++ /dev/null
@@ -1,194 +0,0 @@
1#
2# NOTE - When using this class the user is responsible for ensuring that
3# TRANSLATED_TARGET_ARCH is added into PN. This ensures that if the TARGET_ARCH
4# is changed, another nativesdk xxx-canadian-cross can be installed
5#
6
7
8# SDK packages are built either explicitly by the user,
9# or indirectly via dependency. No need to be in 'world'.
10EXCLUDE_FROM_WORLD = "1"
11NATIVESDKLIBC ?= "libc-glibc"
12LIBCOVERRIDE = ":${NATIVESDKLIBC}"
13CLASSOVERRIDE = "class-cross-canadian"
14STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
15
16#
17# Update BASE_PACKAGE_ARCH and PACKAGE_ARCHS
18#
19PACKAGE_ARCH = "${SDK_ARCH}-${SDKPKGSUFFIX}"
20BASECANADIANEXTRAOS ?= "linux-musl"
21CANADIANEXTRAOS = "${BASECANADIANEXTRAOS}"
22CANADIANEXTRAVENDOR = ""
23MODIFYTOS ??= "1"
24python () {
25 archs = d.getVar('PACKAGE_ARCHS').split()
26 sdkarchs = []
27 for arch in archs:
28 sdkarchs.append(arch + '-${SDKPKGSUFFIX}')
29 d.setVar('PACKAGE_ARCHS', " ".join(sdkarchs))
30
31 # Allow the following code segment to be disabled, e.g. meta-environment
32 if d.getVar("MODIFYTOS") != "1":
33 return
34
35 if d.getVar("TCLIBC") in [ 'baremetal', 'newlib' ]:
36 return
37
38 tos = d.getVar("TARGET_OS")
39 whitelist = []
40 extralibcs = [""]
41 if "musl" in d.getVar("BASECANADIANEXTRAOS"):
42 extralibcs.append("musl")
43 for variant in ["", "spe", "x32", "eabi", "n32", "_ilp32"]:
44 for libc in extralibcs:
45 entry = "linux"
46 if variant and libc:
47 entry = entry + "-" + libc + variant
48 elif variant:
49 entry = entry + "-gnu" + variant
50 elif libc:
51 entry = entry + "-" + libc
52 whitelist.append(entry)
53 if tos not in whitelist:
54 bb.fatal("Building cross-candian for an unknown TARGET_SYS (%s), please update cross-canadian.bbclass" % d.getVar("TARGET_SYS"))
55
56 for n in ["PROVIDES", "DEPENDS"]:
57 d.setVar(n, d.getVar(n))
58 d.setVar("STAGING_BINDIR_TOOLCHAIN", d.getVar("STAGING_BINDIR_TOOLCHAIN"))
59 for prefix in ["AR", "AS", "DLLTOOL", "CC", "CXX", "GCC", "LD", "LIPO", "NM", "OBJDUMP", "RANLIB", "STRIP", "WINDRES"]:
60 n = prefix + "_FOR_TARGET"
61 d.setVar(n, d.getVar(n))
62 # This is a bit ugly. We need to zero LIBC/ABI extension which will change TARGET_OS
63 # however we need the old value in some variables. We expand those here first.
64 tarch = d.getVar("TARGET_ARCH")
65 if tarch == "x86_64":
66 d.setVar("LIBCEXTENSION", "")
67 d.setVar("ABIEXTENSION", "")
68 d.appendVar("CANADIANEXTRAOS", " linux-gnux32")
69 for extraos in d.getVar("BASECANADIANEXTRAOS").split():
70 d.appendVar("CANADIANEXTRAOS", " " + extraos + "x32")
71 elif tarch == "powerpc":
72 # PowerPC can build "linux" and "linux-gnuspe"
73 d.setVar("LIBCEXTENSION", "")
74 d.setVar("ABIEXTENSION", "")
75 d.appendVar("CANADIANEXTRAOS", " linux-gnuspe")
76 for extraos in d.getVar("BASECANADIANEXTRAOS").split():
77 d.appendVar("CANADIANEXTRAOS", " " + extraos + "spe")
78 elif tarch == "mips64":
79 d.appendVar("CANADIANEXTRAOS", " linux-gnun32")
80 for extraos in d.getVar("BASECANADIANEXTRAOS").split():
81 d.appendVar("CANADIANEXTRAOS", " " + extraos + "n32")
82 if tarch == "arm" or tarch == "armeb":
83 d.appendVar("CANADIANEXTRAOS", " linux-gnueabi linux-musleabi")
84 d.setVar("TARGET_OS", "linux-gnueabi")
85 else:
86 d.setVar("TARGET_OS", "linux")
87
88 # Also need to handle multilib target vendors
89 vendors = d.getVar("CANADIANEXTRAVENDOR")
90 if not vendors:
91 vendors = all_multilib_tune_values(d, 'TARGET_VENDOR')
92 origvendor = d.getVar("TARGET_VENDOR_MULTILIB_ORIGINAL")
93 if origvendor:
94 d.setVar("TARGET_VENDOR", origvendor)
95 if origvendor not in vendors.split():
96 vendors = origvendor + " " + vendors
97 d.setVar("CANADIANEXTRAVENDOR", vendors)
98}
99MULTIMACH_TARGET_SYS = "${PACKAGE_ARCH}${HOST_VENDOR}-${HOST_OS}"
100
101INHIBIT_DEFAULT_DEPS = "1"
102
103STAGING_DIR_HOST = "${RECIPE_SYSROOT}"
104
105TOOLCHAIN_OPTIONS = " --sysroot=${RECIPE_SYSROOT}"
106
107PATH_append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}"
108PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/"
109
110HOST_ARCH = "${SDK_ARCH}"
111HOST_VENDOR = "${SDK_VENDOR}"
112HOST_OS = "${SDK_OS}"
113HOST_PREFIX = "${SDK_PREFIX}"
114HOST_CC_ARCH = "${SDK_CC_ARCH}"
115HOST_LD_ARCH = "${SDK_LD_ARCH}"
116HOST_AS_ARCH = "${SDK_AS_ARCH}"
117
118#assign DPKG_ARCH
119DPKG_ARCH = "${@debian_arch_map(d.getVar('SDK_ARCH'), '')}"
120
121CPPFLAGS = "${BUILDSDK_CPPFLAGS}"
122CFLAGS = "${BUILDSDK_CFLAGS}"
123CXXFLAGS = "${BUILDSDK_CFLAGS}"
124LDFLAGS = "${BUILDSDK_LDFLAGS} \
125 -Wl,-rpath-link,${STAGING_LIBDIR}/.. \
126 -Wl,-rpath,${libdir}/.. "
127
128#
129# We need chrpath >= 0.14 to ensure we can deal with 32 and 64 bit
130# binaries
131#
132DEPENDS_append = " chrpath-replacement-native"
133EXTRANATIVEPATH += "chrpath-native"
134
135# Path mangling needed by the cross packaging
136# Note that we use := here to ensure that libdir and includedir are
137# target paths.
138target_base_prefix := "${base_prefix}"
139target_prefix := "${prefix}"
140target_exec_prefix := "${exec_prefix}"
141target_base_libdir = "${target_base_prefix}/${baselib}"
142target_libdir = "${target_exec_prefix}/${baselib}"
143target_includedir := "${includedir}"
144
145# Change to place files in SDKPATH
146base_prefix = "${SDKPATHNATIVE}"
147prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
148exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
149bindir = "${exec_prefix}/bin/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
150sbindir = "${bindir}"
151base_bindir = "${bindir}"
152base_sbindir = "${bindir}"
153libdir = "${exec_prefix}/lib/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
154libexecdir = "${exec_prefix}/libexec/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
155
156FILES_${PN} = "${prefix}"
157
158export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${layout_libdir}/pkgconfig"
159export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
160
161do_populate_sysroot[stamp-extra-info] = ""
162do_packagedata[stamp-extra-info] = ""
163
164USE_NLS = "${SDKUSE_NLS}"
165
166# We have to us TARGET_ARCH but we care about the absolute value
167# and not any particular tune that is enabled.
168TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
169
170PKGDATA_DIR = "${TMPDIR}/pkgdata/${SDK_SYS}"
171# If MLPREFIX is set by multilib code, shlibs
172# points to the wrong place so force it
173SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2"
174SHLIBSWORKDIR = "${PKGDATA_DIR}/nativesdk-shlibs2"
175
176cross_canadian_bindirlinks () {
177 for i in linux ${CANADIANEXTRAOS}
178 do
179 for v in ${CANADIANEXTRAVENDOR}
180 do
181 d=${D}${bindir}/../${TARGET_ARCH}$v-$i
182 if [ -d $d ];
183 then
184 continue
185 fi
186 install -d $d
187 for j in `ls ${D}${bindir}`
188 do
189 p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
190 ln -s ../${TARGET_SYS}/$j $d/$p
191 done
192 done
193 done
194}