Skip to content

Commit cb79ef0

Browse files
shr-projectRaphael Kubo da Costa
authored andcommitted
firefox: use rust-common-without-python3native
* unfortunate side-effect of: https://git.openembedded.org/openembedded-core/commit/meta/classes/rust-common.bbclass?id=997d54363a3cb3a0e949b3626855f2fa41afeb2b is that python3native is now inheritted in firefox build which causes do_configure failure: DEBUG: Executing python function extend_recipe_sysroot NOTE: Direct dependencies are ['virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-extended/xz/xz_5.2.5.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/python/python3_3.10.2.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-graphics/cairo/cairo_1.16.0.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta-clang/recipes-devtools/clang/clang-cross_git.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-core/glibc/glibc_2.35.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-extended/unzip/unzip_6.0.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-extended/zip/zip_3.0.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta-openembedded/meta-oe/recipes-devtools/yasm/yasm_git.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta-openembedded/meta-oe/recipes-gnome/gtk+/gtk+_2.24.33.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/cargo/cargo_1.59.0.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-core/dbus/dbus-glib_0.112.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta-openembedded/meta-oe/recipes-devtools/nodejs/nodejs_16.14.0.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-devtools/rust/libstd-rs_1.59.0.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta-browser/meta-firefox/recipes-devtools/cbindgen/cbindgen_0.8.7.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-devtools/gcc/libgcc_11.2.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-support/icu/icu_70.1.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/nasm/nasm_2.15.05.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-multimedia/pulseaudio/pulseaudio_15.0.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-multimedia/alsa/alsa-lib_1.2.6.1.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-support/libevent/libevent_2.1.12.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-graphics/mesa/mesa_21.3.7.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-graphics/xorg-lib/libxi_1.8.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-graphics/xorg-lib/libxt_1.2.1.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-devtools/gcc/gcc-runtime_11.2.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-support/curl/curl_7.82.0.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb:do_populate_sysroot', 'virtual:native:/OE/build/test-oe-build-time/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-devtools/rust/rust-cross_1.59.0.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-gnome/gtk+/gtk+3_3.24.31.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-gnome/libnotify/libnotify_0.7.9.bb:do_populate_sysroot', '/OE/build/test-oe-build-time/poky/meta/recipes-graphics/startup-notification/startup-notification_0.12.bb:do_populate_sysroot'] NOTE: Installed into sysroot: [] NOTE: Skipping as already exists in sysroot: ['xz-native', 'quilt-native', 'python3-native', 'cairo', 'clang-cross-x86_64', 'glibc', 'unzip-native', 'zip-native', 'yasm-native', 'gtk+', 'cargo-native', 'dbus-glib', 'nodejs-native', 'libstd-rs', 'cbindgen-native', 'libgcc', 'icu', 'nasm-native', 'patch-native', 'pulseaudio', 'alsa-lib', 'libevent', 'mesa', 'pseudo-native', 'libxi', 'libxt', 'gcc-runtime', 'curl', 'gnu-config-native', 'pkgconfig-native', 'rust-cross-core2-64-glibc', 'gtk+3', 'libnotify', 'startup-notification', 'libtool-native', 'gettext-minimal-native', 'util-linux-libuuid-native', 'libnsl2-native', 'libtirpc-native', 'gdbm-native', 'sqlite3-native', 'bzip2-native', 'readline-native', 'zlib-native', 'libffi-native', 'openssl-native', 'fontconfig', 'libx11', 'glib-2.0', 'pixman', 'libpng', 'libxrender', 'libsm', 'libxcb', 'zlib', 'opkg-utils', 'libxext', 'clang-native', 'binutils-cross-x86_64', 'linux-libc-headers', 'flex-native', 'pango', 'libxcomposite', 'gobject-introspection', 'libxdamage', 'libjpeg-turbo', 'gdk-pixbuf', 'atk', 'libxcursor', 'libxrandr', 'rust-native', 'libssh2-native', 'ca-certificates-native', 'curl-native', 'bash-completion', 'expat', 'dbus', 'icu-native', 'brotli-native', 'c-ares-native', 'autoconf-archive', 'groff-native', 'attr-native', 'avahi', 'eudev', 'shadow-sysroot', 'libtool', 'bluez5', 'ofono', 'libsndfile1', 'libice', 'libcap', 'shadow', 'sbc', 'shadow-native', 'libatomic-ops', 'speexdsp', 'base-passwd', 'libxtst', 'base-files', 'libdrm', 'libxfixes', 'xrandr', 'wayland', 'xorgproto', 'libxxf86vm', 'libxshmfence', 'wayland-protocols', 'util-macros', 'libxdmcp', 'util-linux', 'libidn2', 'openssl', 'gcc-cross-x86_64', 'rust-llvm-native', 'libxkbcommon', 'libepoxy', 'at-spi2-atk', 'xcb-util', 'texinfo-dummy-native', 'ncurses-native', 'perl-native', 'freetype', 'xtrans', 'libpcre', 'libffi', 'libxau', 'libpthread-stubs', 'xcb-proto', 'libxml2-native', 'binutils-native', 'libedit-native', 'swig-native', 'cmake-native', 'm4-native', 'libxft', 'fribidi', 'harfbuzz', 'python3', 'shared-mime-info', 'initscripts', 'update-rc.d', 'libdaemon', 'kmod', 'readline', 'libical', 'mobile-broadband-provider-info', 'ell', 'flac', 'libvorbis', 'libogg', 'attr', 'libxcrypt', 'libpciaccess', 'libxml2', 'libcap-ng', 'ncurses', 'util-linux-libuuid', 'libunistring', 'gmp-native', 'libmpc-native', 'mpfr-native', 'xkeyboard-config', 'at-spi2-core', 'bzip2', 'elfutils-native', 'libpcre-native', 'zstd-native', 'gdbm', 'libtirpc', 'xz', 'libnsl2', 'sqlite3', 'vala', 'libmicrohttpd-native', 'libarchive-native', 'libgcrypt-native', 'gnutls-native', 'lzo-native', 'libgpg-error-native', 'libcap-native', 'libunistring-native', 'libidn2-native', 'nettle-native'] DEBUG: Python function extend_recipe_sysroot finished DEBUG: Executing shell function do_configure 0:00.40 Clobber not needed. 0:00.40 Adding make options from /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/mozconfig MOZ_OBJDIR=/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir OBJDIR=/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir FOUND_MOZCONFIG=/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/mozconfig export FOUND_MOZCONFIG 0:00.41 /OE/build/test-oe-build-time/poky/build/tmp/hosttools/make -f client.mk -s configure 0:00.42 cd /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir 0:00.42 /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/configure 0:00.50 Creating Python environment 0:00.81 /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py:25: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives 0:00.81 import distutils.spawn 0:00.81 /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py:26: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead 0:00.81 import distutils.sysconfig 0:00.81 /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py:1047: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses 0:00.81 import imp 0:00.81 Using base prefix '/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/recipe-sysroot-native/usr' 0:00.81 New python executable in /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir/_virtualenvs/init/bin/python3 0:00.81 Also creating executable in /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir/_virtualenvs/init/bin/python 0:00.81 Traceback (most recent call last): 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py", line 2349, in <module> 0:00.81 main() 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py", line 703, in main 0:00.81 create_environment(home_dir, 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py", line 925, in create_environment 0:00.81 py_executable = os.path.abspath(install_python( 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py", line 1444, in install_python 0:00.81 fix_local_scheme(home_dir, symlink) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/third_party/python/virtualenv/virtualenv.py", line 1527, in fix_local_scheme 0:00.81 if sysconfig._get_default_scheme() == 'posix_local': 0:00.81 AttributeError: module 'sysconfig' has no attribute '_get_default_scheme'. Did you mean: 'get_default_scheme'? 0:00.81 Traceback (most recent call last): 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/configure.py", line 132, in <module> 0:00.81 sys.exit(main(sys.argv)) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/configure.py", line 38, in main 0:00.81 sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure')) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 431, in run 0:00.81 self.include_file(path) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 422, in include_file 0:00.81 exec_(code, self) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/util.py", line 59, in exec_ 0:00.81 exec(object, globals, locals) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/moz.configure", line 7, in <module> 0:00.81 include('build/moz.configure/init.configure') 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 745, in include_impl 0:00.81 self.include_file(what) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 422, in include_file 0:00.81 exec_(code, self) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/util.py", line 59, in exec_ 0:00.81 exec(object, globals, locals) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/build/moz.configure/init.configure", line 212, in <module> 0:00.81 @imports('distutils.sysconfig') 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 728, in decorator 0:00.81 depends = DependsFunction(self, func, dependencies, when=when) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 125, in __init__ 0:00.81 sandbox._value_for(self) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 525, in _value_for 0:00.81 return self._value_for_depends(obj) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/util.py", line 947, in method_call 0:00.81 cache[args] = self.func(instance, *args) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 534, in _value_for_depends 0:00.81 value = obj.result() 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/util.py", line 947, in method_call 0:00.81 cache[args] = self.func(instance, *args) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 151, in result 0:00.81 return self._func(*resolved_args) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/configure/__init__.py", line 1097, in wrapped 0:00.81 return new_func(*args, **kwargs) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/build/moz.configure/init.configure", line 261, in virtualenv_python 0:00.81 manager.build(python) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/virtualenv.py", line 473, in build 0:00.81 self.create(python) 0:00.81 File "/OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/python/mozbuild/mozbuild/virtualenv.py", line 212, in create 0:00.81 'Failed to create virtualenv: %s' % self.virtualenv_root) 0:00.81 Exception: Failed to create virtualenv: /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/firefox-68.9.0/firefox-build-dir/_virtualenvs/init 0:00.82 *** Fix above errors and then restart with\ 0:00.82 "./mach build" 0:00.82 make: *** [client.mk:115: configure] Error 1 WARNING: /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/temp/run.do_configure.334283:205 exit 2 from './mach "$@"' WARNING: Backtrace (BB generated script): #1: mozilla_run_mach, /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/temp/run.do_configure.334283, line 205 #2: mozilla_do_configure, /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/temp/run.do_configure.334283, line 189 #3: do_configure, /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/temp/run.do_configure.334283, line 168 #4: main, /OE/build/test-oe-build-time/poky/build/tmp/work/core2-64-poky-linux/firefox/68.9.0esr-r0/temp/run.do_configure.334283, line 209 * as firefox-68 is way too old nowadays, it doesn't make much sense to spend more time trying to resolve this properly, add quick hack just to measure build time Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
1 parent 3c81df0 commit cb79ef0

File tree

2 files changed

+187
-1
lines changed

2 files changed

+187
-1
lines changed
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# removed, because firefox fails to configure when it finds native python3 instead of python2.7 from HOSTTOOLS
2+
# inherit python3native
3+
4+
# Common variables used by all Rust builds
5+
export rustlibdir = "${libdir}/rust"
6+
FILES:${PN} += "${rustlibdir}/*.so"
7+
FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
8+
FILES:${PN}-dbg += "${rustlibdir}/.debug"
9+
10+
RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
11+
RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
12+
RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}"
13+
RUSTLIB_DEP ?= "libstd-rs"
14+
export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/rustlib"
15+
RUST_PANIC_STRATEGY ?= "unwind"
16+
17+
# Native builds are not effected by TCLIBC. Without this, rust-native
18+
# thinks it's "target" (i.e. x86_64-linux) is a musl target.
19+
RUST_LIBC = "${TCLIBC}"
20+
RUST_LIBC:class-native = "glibc"
21+
22+
def determine_libc(d, thing):
23+
'''Determine which libc something should target'''
24+
25+
# BUILD is never musl, TARGET may be musl or glibc,
26+
# HOST could be musl, but only if a compiler is built to be run on
27+
# target in which case HOST_SYS != BUILD_SYS.
28+
if thing == 'TARGET':
29+
libc = d.getVar('RUST_LIBC')
30+
elif thing == 'BUILD' and (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
31+
libc = d.getVar('RUST_LIBC')
32+
else:
33+
libc = d.getVar('RUST_LIBC:class-native')
34+
35+
return libc
36+
37+
def target_is_armv7(d):
38+
'''Determine if target is armv7'''
39+
# TUNE_FEATURES may include arm* even if the target is not arm
40+
# in the case of *-native packages
41+
if d.getVar('TARGET_ARCH') != 'arm':
42+
return False
43+
44+
feat = d.getVar('TUNE_FEATURES')
45+
feat = frozenset(feat.split())
46+
mach_overrides = d.getVar('MACHINEOVERRIDES')
47+
mach_overrides = frozenset(mach_overrides.split(':'))
48+
49+
v7=frozenset(['armv7a', 'armv7r', 'armv7m', 'armv7ve'])
50+
if mach_overrides.isdisjoint(v7) and feat.isdisjoint(v7):
51+
return False
52+
else:
53+
return True
54+
target_is_armv7[vardepvalue] = "${@target_is_armv7(d)}"
55+
56+
# Responsible for taking Yocto triples and converting it to Rust triples
57+
def rust_base_triple(d, thing):
58+
'''
59+
Mangle bitbake's *_SYS into something that rust might support (see
60+
rust/mk/cfg/* for a list)
61+
62+
Note that os is assumed to be some linux form
63+
'''
64+
65+
# The llvm-target for armv7 is armv7-unknown-linux-gnueabihf
66+
if thing == "TARGET" and target_is_armv7(d):
67+
arch = "armv7"
68+
else:
69+
arch = oe.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
70+
71+
# All the Yocto targets are Linux and are 'unknown'
72+
vendor = "-unknown"
73+
os = d.getVar('{}_OS'.format(thing))
74+
libc = determine_libc(d, thing)
75+
76+
# Prefix with a dash and convert glibc -> gnu
77+
if libc == "glibc":
78+
libc = "-gnu"
79+
elif libc == "musl":
80+
libc = "-musl"
81+
82+
# Don't double up musl (only appears to be the case on aarch64)
83+
if os == "linux-musl":
84+
if libc != "-musl":
85+
bb.fatal("{}_OS was '{}' but TCLIBC was not 'musl'".format(thing, os))
86+
os = "linux"
87+
88+
# This catches ARM targets and appends the necessary hard float bits
89+
if os == "linux-gnueabi" or os == "linux-musleabi":
90+
libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
91+
return arch + vendor + '-' + os + libc
92+
93+
94+
# In some cases uname and the toolchain differ on their idea of the arch name
95+
RUST_BUILD_ARCH = "${@oe.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
96+
97+
# Naming explanation
98+
# Yocto
99+
# - BUILD_SYS - Yocto triple of the build environment
100+
# - HOST_SYS - What we're building for in Yocto
101+
# - TARGET_SYS - What we're building for in Yocto
102+
#
103+
# So when building '-native' packages BUILD_SYS == HOST_SYS == TARGET_SYS
104+
# When building packages for the image HOST_SYS == TARGET_SYS
105+
# This is a gross over simplification as there are other modes but
106+
# currently this is all that's supported.
107+
#
108+
# Rust
109+
# - TARGET - the system where the binary will run
110+
# - HOST - the system where the binary is being built
111+
#
112+
# Rust additionally will use two additional cases:
113+
# - undecorated (e.g. CC) - equivalent to TARGET
114+
# - triple suffix (e.g. CC:x86_64_unknown_linux_gnu) - both
115+
# see: https://github.com/alexcrichton/gcc-rs
116+
# The way that Rust's internal triples and Yocto triples are mapped together
117+
# its likely best to not use the triple suffix due to potential confusion.
118+
119+
RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}"
120+
RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}"
121+
RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
122+
123+
# wrappers to get around the fact that Rust needs a single
124+
# binary but Yocto's compiler and linker commands have
125+
# arguments. Technically the archiver is always one command but
126+
# this is necessary for builds that determine the prefix and then
127+
# use those commands based on the prefix.
128+
WRAPPER_DIR = "${WORKDIR}/wrapper"
129+
RUST_BUILD_CC = "${WRAPPER_DIR}/build-rust-cc"
130+
RUST_BUILD_CXX = "${WRAPPER_DIR}/build-rust-cxx"
131+
RUST_BUILD_CCLD = "${WRAPPER_DIR}/build-rust-ccld"
132+
RUST_BUILD_AR = "${WRAPPER_DIR}/build-rust-ar"
133+
RUST_TARGET_CC = "${WRAPPER_DIR}/target-rust-cc"
134+
RUST_TARGET_CXX = "${WRAPPER_DIR}/target-rust-cxx"
135+
RUST_TARGET_CCLD = "${WRAPPER_DIR}/target-rust-ccld"
136+
RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar"
137+
138+
create_wrapper () {
139+
file="$1"
140+
shift
141+
142+
cat <<- EOF > "${file}"
143+
#!/usr/bin/env python3
144+
import os, sys
145+
orig_binary = "$@"
146+
binary = orig_binary.split()[0]
147+
args = orig_binary.split() + sys.argv[1:]
148+
os.execvp(binary, args)
149+
EOF
150+
chmod +x "${file}"
151+
}
152+
153+
export WRAPPER_TARGET_CC = "${CC}"
154+
export WRAPPER_TARGET_CXX = "${CXX}"
155+
export WRAPPER_TARGET_CCLD = "${CCLD}"
156+
export WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}"
157+
export WRAPPER_TARGET_AR = "${AR}"
158+
159+
# compiler is used by gcc-rs
160+
# linker is used by rustc/cargo
161+
# archiver is used by the build of libstd-rs
162+
do_rust_create_wrappers () {
163+
mkdir -p "${WRAPPER_DIR}"
164+
165+
# Yocto Build / Rust Host C compiler
166+
create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}"
167+
# Yocto Build / Rust Host C++ compiler
168+
create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}"
169+
# Yocto Build / Rust Host linker
170+
create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}"
171+
# Yocto Build / Rust Host archiver
172+
create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
173+
174+
# Yocto Target / Rust Target C compiler
175+
create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_CC}" "${WRAPPER_TARGET_LDFLAGS}"
176+
# Yocto Target / Rust Target C++ compiler
177+
create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_CXX}"
178+
# Yocto Target / Rust Target linker
179+
create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}"
180+
# Yocto Target / Rust Target archiver
181+
create_wrapper "${RUST_TARGET_AR}" "${WRAPPER_TARGET_AR}"
182+
183+
}
184+
185+
addtask rust_create_wrappers before do_configure after do_patch do_prepare_recipe_sysroot
186+
do_rust_create_wrappers[dirs] += "${WRAPPER_DIR}"

meta-firefox/recipes-browser/firefox/firefox_68.9.0esr.bb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ S = "${WORKDIR}/firefox-${MOZ_APP_BASE_VERSION}"
6363

6464
MOZ_APP_BASE_VERSION = "${@'${PV}'.replace('esr', '')}"
6565

66-
inherit mozilla rust-common
66+
inherit mozilla rust-common-without-python3native
6767

6868
TOOLCHAIN:pn-firefox = "clang"
6969
AS = "${CC}"

0 commit comments

Comments
 (0)