summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/base-files/base-files/filesystems8
-rw-r--r--meta/recipes-core/base-files/base-files/fstab2
-rw-r--r--meta/recipes-core/base-files/base-files/hosts8
-rw-r--r--meta/recipes-core/base-files/base-files/profile72
-rw-r--r--meta/recipes-core/base-files/base-files/share/dot.profile3
-rw-r--r--meta/recipes-core/base-files/base-files/usbd0
-rw-r--r--meta/recipes-core/base-files/base-files_3.0.14.bb68
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/input.patch2
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/kvm.patch23
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/nobash.patch2
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/noshadow.patch2
-rw-r--r--meta/recipes-core/base-passwd/base-passwd_3.5.29.bb63
-rw-r--r--meta/recipes-core/busybox/busybox-inittab_1.34.1.bb85
-rw-r--r--meta/recipes-core/busybox/busybox.inc458
-rw-r--r--meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch114
-rw-r--r--meta/recipes-core/busybox/busybox/0001-chown-fix-help-text.patch34
-rw-r--r--meta/recipes-core/busybox/busybox/0001-du-l-works-fix-to-use-145-instead-of-144.patch32
-rw-r--r--meta/recipes-core/busybox/busybox/0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch67
-rw-r--r--meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch81
-rw-r--r--meta/recipes-core/busybox/busybox/0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch40
-rw-r--r--meta/recipes-core/busybox/busybox/0001-testsuite-check-uudecode-before-using-it.patch45
-rw-r--r--meta/recipes-core/busybox/busybox/0001-testsuite-use-www.example.org-for-wget-test-cases.patch62
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch37
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch20
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch126
-rw-r--r--meta/recipes-core/busybox/busybox/defconfig797
-rw-r--r--meta/recipes-core/busybox/busybox/fail_on_no_media.patch3
-rw-r--r--meta/recipes-core/busybox/busybox/get_header_tar.patch22
-rw-r--r--meta/recipes-core/busybox/busybox/getopts.cfg3
-rw-r--r--meta/recipes-core/busybox/busybox/init.cfg8
-rw-r--r--meta/recipes-core/busybox/busybox/longopts.cfg15
-rw-r--r--meta/recipes-core/busybox/busybox/makefile-libbb-race.patch34
-rw-r--r--meta/recipes-core/busybox/busybox/mdev.cfg13
-rw-r--r--meta/recipes-core/busybox/busybox/mount-via-label.cfg2
-rw-r--r--meta/recipes-core/busybox/busybox/musl.cfg11
-rw-r--r--meta/recipes-core/busybox/busybox/pgrep.cfg1
-rw-r--r--meta/recipes-core/busybox/busybox/resize.cfg2
-rw-r--r--meta/recipes-core/busybox/busybox/rev.cfg1
-rw-r--r--meta/recipes-core/busybox/busybox/syslog.cfg11
-rw-r--r--meta/recipes-core/busybox/busybox/unicode.cfg10
-rw-r--r--meta/recipes-core/busybox/busybox_1.23.2.bb49
-rw-r--r--meta/recipes-core/busybox/busybox_1.34.1.bb54
-rw-r--r--meta/recipes-core/busybox/busybox_git.bb54
-rw-r--r--meta/recipes-core/busybox/files/busybox-syslog.default2
-rw-r--r--meta/recipes-core/busybox/files/inittab28
-rwxr-xr-xmeta/recipes-core/busybox/files/mdev54
-rw-r--r--meta/recipes-core/busybox/files/mdev-mount.sh12
-rw-r--r--meta/recipes-core/busybox/files/mdev.conf2
-rwxr-xr-xmeta/recipes-core/busybox/files/mount.busybox3
-rw-r--r--meta/recipes-core/busybox/files/rcK26
-rw-r--r--meta/recipes-core/busybox/files/rcS27
-rw-r--r--meta/recipes-core/busybox/files/rcS.default31
-rw-r--r--meta/recipes-core/busybox/files/run-ptest8
-rw-r--r--meta/recipes-core/busybox/files/simple.script28
-rw-r--r--meta/recipes-core/busybox/files/syslog22
-rwxr-xr-xmeta/recipes-core/busybox/files/umount.busybox3
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/Makevars41
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/codepage.patch17
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/compile.patch12
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/configure.patch29
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/fix-libconsole-linking.patch56
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/kbdrate.patch75
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/lcmessage.m424
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/no-dep-on-libfl.patch19
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/nodocs.patch22
-rw-r--r--meta/recipes-core/console-tools/console-tools-0.3.2/uclibc-fileno.patch49
-rw-r--r--meta/recipes-core/console-tools/console-tools_0.3.2.bb37
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch120
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-build-with-acl.patch28
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch101
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch375
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch4051
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch117
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch19
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch32
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch85
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/futimens.patch63
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch21
-rw-r--r--meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch24
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.24/0001-Unset-need_charset_alias-when-building-for-musl.patch33
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.24/man-decouple-manpages-from-build.patch27
-rw-r--r--meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch26
-rw-r--r--meta/recipes-core/coreutils/coreutils/0001-uname-report-processor-and-hardware-correctly.patch64
-rw-r--r--meta/recipes-core/coreutils/coreutils/e8b56ebd536e82b15542a00c888109471936bfda.patch93
-rw-r--r--meta/recipes-core/coreutils/coreutils/fix-selinux-flask.patch (renamed from meta/recipes-core/coreutils/coreutils-8.24/fix-selinux-flask.patch)14
-rw-r--r--meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch (renamed from meta/recipes-core/coreutils/coreutils-8.24/remove-usr-local-lib-from-m4.patch)23
-rwxr-xr-xmeta/recipes-core/coreutils/coreutils/run-ptest17
-rw-r--r--meta/recipes-core/coreutils/coreutils_6.9.bb102
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.24.bb127
-rw-r--r--meta/recipes-core/coreutils/coreutils_9.0.bb209
-rw-r--r--meta/recipes-core/dbus-wait/dbus-wait_git.bb4
-rw-r--r--meta/recipes-core/dbus/dbus-glib.inc43
-rw-r--r--meta/recipes-core/dbus/dbus-glib/no-examples.patch10
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.104.bb4
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.112.bb39
-rw-r--r--meta/recipes-core/dbus/dbus-test_1.12.20.bb64
-rw-r--r--meta/recipes-core/dbus/dbus-test_1.8.20.bb61
-rw-r--r--meta/recipes-core/dbus/dbus.inc183
-rw-r--r--meta/recipes-core/dbus/dbus/dbus-1.init4
-rw-r--r--meta/recipes-core/dbus/dbus/os-test.patch35
-rw-r--r--meta/recipes-core/dbus/dbus/python-config.patch21
-rwxr-xr-xmeta/recipes-core/dbus/dbus/run-ptest31
-rw-r--r--meta/recipes-core/dbus/dbus/stop_using_selinux_set_mapping.patch148
-rw-r--r--meta/recipes-core/dbus/dbus_1.12.20.bb153
-rw-r--r--meta/recipes-core/dbus/dbus_1.8.20.bb4
-rw-r--r--meta/recipes-core/dropbear/dropbear.inc66
-rw-r--r--meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch16
-rw-r--r--meta/recipes-core/dropbear/dropbear/0003-configure.patch42
-rw-r--r--meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch22
-rw-r--r--meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch44
-rw-r--r--meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch23
-rw-r--r--meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch140
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch35
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear.default2
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear@.service3
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbearkey.service10
-rwxr-xr-xmeta/recipes-core/dropbear/dropbear/init60
-rw-r--r--meta/recipes-core/dropbear/dropbear_2015.68.bb4
-rw-r--r--meta/recipes-core/dropbear/dropbear_2020.81.bb3
-rw-r--r--meta/recipes-core/ell/ell/0001-pem.c-do-not-use-rawmemchr.patch27
-rw-r--r--meta/recipes-core/ell/ell_0.44.bb24
-rw-r--r--meta/recipes-core/expat/expat-2.1.0/autotools.patch24
-rw-r--r--meta/recipes-core/expat/expat.inc20
-rw-r--r--meta/recipes-core/expat/expat/libtool-tag.patch30
-rw-r--r--meta/recipes-core/expat/expat/run-ptest23
-rw-r--r--meta/recipes-core/expat/expat_2.1.0.bb5
-rw-r--r--meta/recipes-core/expat/expat_2.4.1.bb32
-rw-r--r--meta/recipes-core/fts/fts_1.2.7.bb22
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch39
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch110
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch348
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch19
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch20
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch51
-rw-r--r--meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch720
-rw-r--r--meta/recipes-core/gettext/gettext-0.19.4/parallel.patch23
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/0001-init-env.in-do-not-add-C-CXX-parameters.patch29
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/0001-msgmerge-29-Add-executable-file-mode-bits.patch23
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/0001-tests-autopoint-3-unset-MAKEFLAGS.patch26
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/mingw.patch28
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/parallel.patch32
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/run-ptest6
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/serial-tests-config.patch56
-rw-r--r--meta/recipes-core/gettext/gettext-0.21/use-pkgconfig.patch699
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/0001-PATCH-Disable-the-test-to-convert-euc-jp.patch38
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgzbin39744 -> 0 bytes
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/COPYING (renamed from meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING)2
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/Makefile.in.in (renamed from meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in)167
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/gettext.m4386
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/host-cpu-c-abi.m4675
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/iconv.m4288
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/intlmacosx.m465
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-ld.m4168
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-link.m4800
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-prefix.m4320
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/nls.m432
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/po.m4450
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/progtest.m491
-rwxr-xr-xmeta/recipes-core/gettext/gettext-minimal-0.21/config.rpath (renamed from meta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath)2
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.21/remove-potcdate.sin (renamed from meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin)8
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-native_0.21.bb (renamed from meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb)8
-rw-r--r--meta/recipes-core/gettext/gettext_0.16.1.bb107
-rw-r--r--meta/recipes-core/gettext/gettext_0.19.4.bb106
-rw-r--r--meta/recipes-core/gettext/gettext_0.21.bb208
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch39
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-write-bindir-into-pkg-config-files.patch61
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch31
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch27
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch24
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch95
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch31
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch26
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch28
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch29
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch44
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/Enable-more-tests-while-cross-compiling.patch121
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/add-march-i486-into-CFLAGS-automatically.patch39
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch39
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/configure-libtool.patch60
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/fix-conflicting-rand.patch35
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/glib-2.0-configure-readlink.patch29
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/glib-gettextize-dir.patch24
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common3
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc5
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux5
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw6
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl6
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/ptest-paths.patch30
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch50
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/run-ptest8
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch20
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.44.1.bb23
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.70.0.bb54
-rw-r--r--meta/recipes-core/glib-2.0/glib.inc195
-rw-r--r--meta/recipes-core/glib-networking/glib-networking/run-ptest3
-rw-r--r--meta/recipes-core/glib-networking/glib-networking_2.44.0.bb30
-rw-r--r--meta/recipes-core/glib-networking/glib-networking_2.70.0.bb38
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch18
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.22.bb59
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.34.bb49
-rw-r--r--meta/recipes-core/glibc/glibc-collateral.inc24
-rw-r--r--meta/recipes-core/glibc/glibc-common.inc22
-rw-r--r--meta/recipes-core/glibc/glibc-initial.inc76
-rw-r--r--meta/recipes-core/glibc/glibc-initial_2.22.bb11
-rw-r--r--meta/recipes-core/glibc/glibc-ld.inc58
-rw-r--r--meta/recipes-core/glibc/glibc-locale.inc91
-rw-r--r--meta/recipes-core/glibc/glibc-locale_2.34.bb (renamed from meta/recipes-core/glibc/glibc-locale_2.22.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace.inc11
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace_2.34.bb (renamed from meta/recipes-core/glibc/glibc-mtrace_2.22.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-options.inc162
-rw-r--r--meta/recipes-core/glibc/glibc-package.inc359
-rw-r--r--meta/recipes-core/glibc/glibc-scripts.inc13
-rw-r--r--meta/recipes-core/glibc/glibc-scripts_2.34.bb (renamed from meta/recipes-core/glibc/glibc-scripts_2.22.bb)0
-rw-r--r--meta/recipes-core/glibc/glibc-testing.inc96
-rw-r--r--meta/recipes-core/glibc/glibc-tests.inc32
-rw-r--r--meta/recipes-core/glibc/glibc-testsuite_2.34.bb35
-rw-r--r--meta/recipes-core/glibc/glibc-version.inc8
-rw-r--r--meta/recipes-core/glibc/glibc.inc91
-rw-r--r--meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch43
-rw-r--r--meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch79
-rw-r--r--meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch1130
-rw-r--r--meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch150
-rw-r--r--meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch238
-rw-r--r--meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch (renamed from meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch)33
-rw-r--r--meta/recipes-core/glibc/glibc/0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch34
-rw-r--r--meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch (renamed from meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch)12
-rw-r--r--meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch (renamed from meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch)111
-rw-r--r--meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch39
-rw-r--r--meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch100
-rw-r--r--meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch387
-rw-r--r--meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch32
-rw-r--r--meta/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch (renamed from meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch)83
-rw-r--r--meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch (renamed from meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch)31
-rw-r--r--meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch355
-rw-r--r--meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch44
-rw-r--r--meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch (renamed from meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch)12
-rw-r--r--meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch (renamed from meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch)21
-rw-r--r--meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch34
-rw-r--r--meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch58
-rw-r--r--meta/recipes-core/glibc/glibc/0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch32
-rw-r--r--meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch (renamed from meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch)11
-rw-r--r--meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch39
-rw-r--r--meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch39
-rw-r--r--meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch72
-rw-r--r--meta/recipes-core/glibc/glibc/0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch1436
-rw-r--r--meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch (renamed from meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch)15
-rw-r--r--meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch17
-rw-r--r--meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch (renamed from meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch)13
-rw-r--r--meta/recipes-core/glibc/glibc/0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch64
-rw-r--r--meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch81
-rw-r--r--meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch560
-rw-r--r--meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-eglibc-options-groups-support.patch16842
-rw-r--r--meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch80
-rw-r--r--meta/recipes-core/glibc/glibc/0025-eglibc-Install-PIC-archives.patch123
-rw-r--r--meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch53
-rw-r--r--meta/recipes-core/glibc/glibc/0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch556
-rw-r--r--meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch31
-rw-r--r--meta/recipes-core/glibc/glibc/0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch145
-rw-r--r--meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch53
-rw-r--r--meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch (renamed from meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch)10
-rw-r--r--meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch67
-rw-r--r--meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch48
-rw-r--r--meta/recipes-core/glibc/glibc/check-test-wrapper80
-rw-r--r--meta/recipes-core/glibc/glibc/etc/ld.so.conf1
-rwxr-xr-xmeta/recipes-core/glibc/glibc/makedbs.sh177
-rw-r--r--meta/recipes-core/glibc/glibc_2.22.bb135
-rw-r--r--meta/recipes-core/glibc/glibc_2.34.bb133
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch29
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch79
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch2
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/no-aux-cache.patch19
-rw-r--r--meta/recipes-core/glibc/ldconfig-native_2.12.1.bb2
-rw-r--r--meta/recipes-core/glibc/site_config/funcs474
-rw-r--r--meta/recipes-core/glibc/site_config/headers156
-rw-r--r--meta/recipes-core/glibc/site_config/types21
-rw-r--r--meta/recipes-core/ifupdown/files/0001-Define-FNM_EXTMATCH-for-musl.patch47
-rw-r--r--meta/recipes-core/ifupdown/files/0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch23
-rw-r--r--meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch32
-rw-r--r--meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch9
-rw-r--r--meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch103
-rw-r--r--meta/recipes-core/ifupdown/files/run-ptest4
-rw-r--r--meta/recipes-core/ifupdown/files/tweak-ptest-script.patch54
-rw-r--r--meta/recipes-core/ifupdown/ifupdown_0.8.36.bb (renamed from meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb)37
-rw-r--r--meta/recipes-core/images/build-appliance-image/README_VirtualBox_Guest_Additions.txt75
-rw-r--r--meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt78
-rw-r--r--meta/recipes-core/images/build-appliance-image_12.0.1.bb93
-rw-r--r--meta/recipes-core/images/build-appliance-image_15.0.0.bb137
-rw-r--r--meta/recipes-core/images/core-image-minimal-initramfs.bb17
-rw-r--r--meta/recipes-core/images/core-image-minimal.bb4
-rw-r--r--meta/recipes-core/images/core-image-ptest-all.bb25
-rw-r--r--meta/recipes-core/images/core-image-ptest-fast.bb24
-rw-r--r--meta/recipes-core/images/core-image-tiny-initramfs.bb44
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuall/interfaces (renamed from meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces)0
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces5
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces5
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces5
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces8
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb10
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh16
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh118
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh127
-rwxr-xr-x[-rw-r--r--]meta/recipes-core/initrdscripts/files/init-live.sh50
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb7
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/exec29
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish22
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/init28
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/lvm13
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/mdev4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs48
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/rootfs66
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/setup-live64
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/udev5
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb87
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb21
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb7
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb4
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb7
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb18
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb23
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb20
-rw-r--r--meta/recipes-core/initscripts/init-system-helpers_1.60.bb41
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/alignment.sh (renamed from meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh)0
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh7
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkroot.sh4
-rwxr-xr-x[-rw-r--r--]meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh4
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountall.sh24
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh9
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh145
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh9
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh6
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh12
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/umountfs2
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/volatiles9
-rw-r--r--meta/recipes-core/initscripts/initscripts_1.0.bb45
-rw-r--r--meta/recipes-core/jpeg/jpeg_9a.bb29
-rw-r--r--meta/recipes-core/kbd/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch29
-rw-r--r--meta/recipes-core/kbd/kbd/uclibc-stdarg.patch36
-rw-r--r--meta/recipes-core/kbd/kbd_2.0.2.bb36
-rw-r--r--meta/recipes-core/kbd/kbd_2.4.0.bb46
-rw-r--r--meta/recipes-core/libcgroup/libcgroup/module.patch36
-rw-r--r--meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch284
-rw-r--r--meta/recipes-core/libcgroup/libcgroup_0.41.bb38
-rw-r--r--meta/recipes-core/libcgroup/libcgroup_2.0.bb35
-rw-r--r--meta/recipes-core/libxcrypt/files/fix_cflags_handling.patch33
-rw-r--r--meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.26.bb18
-rw-r--r--meta/recipes-core/libxcrypt/libxcrypt.inc35
-rw-r--r--meta/recipes-core/libxcrypt/libxcrypt_4.4.26.bb2
-rw-r--r--meta/recipes-core/libxml/libxml2.inc78
-rw-r--r--meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch181
-rw-r--r--meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch86
-rw-r--r--meta/recipes-core/libxml/libxml2/0001-threads-Define-pthread-definitions-for-glibc-complia.patch32
-rw-r--r--meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch30
-rw-r--r--meta/recipes-core/libxml/libxml2/ansidecl.patch25
-rw-r--r--meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch45
-rw-r--r--meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch33
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-64bit.patch24
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch41
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch37
-rw-r--r--meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch13
-rw-r--r--meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch43
-rw-r--r--meta/recipes-core/libxml/libxml2/run-ptest1
-rw-r--r--meta/recipes-core/libxml/libxml2/runtest.patch291
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.12.bb109
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.2.bb11
-rw-r--r--meta/recipes-core/meta/build-sysroots.bb42
-rw-r--r--meta/recipes-core/meta/buildtools-extended-tarball.bb49
-rw-r--r--meta/recipes-core/meta/buildtools-tarball.bb94
-rw-r--r--meta/recipes-core/meta/cve-update-db-native.bb229
-rw-r--r--meta/recipes-core/meta/dummy-sdk-package.inc31
-rw-r--r--meta/recipes-core/meta/meta-environment-extsdk.bb6
-rw-r--r--meta/recipes-core/meta/meta-environment.bb36
-rw-r--r--meta/recipes-core/meta/meta-extsdk-toolchain.bb29
-rw-r--r--meta/recipes-core/meta/meta-go-toolchain.bb12
-rw-r--r--meta/recipes-core/meta/meta-ide-support.bb14
-rw-r--r--meta/recipes-core/meta/meta-toolchain.bb3
-rw-r--r--meta/recipes-core/meta/meta-world-pkgdata.bb53
-rw-r--r--meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb52
-rw-r--r--meta/recipes-core/meta/nativesdk-sdk-provides-dummy.bb17
-rw-r--r--meta/recipes-core/meta/package-index.bb22
-rw-r--r--meta/recipes-core/meta/signing-keys.bb81
-rw-r--r--meta/recipes-core/meta/target-sdk-provides-dummy.bb61
-rw-r--r--meta/recipes-core/meta/testexport-tarball.bb69
-rw-r--r--meta/recipes-core/meta/uninative-tarball.bb45
-rw-r--r--meta/recipes-core/meta/wic-tools.bb27
-rw-r--r--meta/recipes-core/musl/bsd-headers.bb31
-rw-r--r--meta/recipes-core/musl/bsd-headers/sys-cdefs.h26
-rw-r--r--meta/recipes-core/musl/bsd-headers/sys-queue.h846
-rw-r--r--meta/recipes-core/musl/bsd-headers/sys-tree.h761
-rw-r--r--meta/recipes-core/musl/gcompat_git.bb54
-rw-r--r--meta/recipes-core/musl/libssp-nonshared.bb35
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/stack_chk.c40
-rw-r--r--meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch49
-rw-r--r--meta/recipes-core/musl/libucontext_git.bb54
-rw-r--r--meta/recipes-core/musl/musl-obstack.bb22
-rw-r--r--meta/recipes-core/musl/musl-utils.bb27
-rw-r--r--meta/recipes-core/musl/musl.inc31
-rw-r--r--meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch69
-rw-r--r--meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch54
-rw-r--r--meta/recipes-core/musl/musl_git.bb87
-rw-r--r--meta/recipes-core/ncurses/files/0001-tic-hang.patch43
-rw-r--r--meta/recipes-core/ncurses/files/0002-configure-reproducible.patch33
-rw-r--r--meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch30
-rw-r--r--meta/recipes-core/ncurses/ncurses-5.9/config.cache4
-rw-r--r--meta/recipes-core/ncurses/ncurses-5.9/tic-hang.patch27
-rw-r--r--meta/recipes-core/ncurses/ncurses.inc93
-rw-r--r--meta/recipes-core/ncurses/ncurses_5.9.bb12
-rw-r--r--meta/recipes-core/ncurses/ncurses_6.3.bb14
-rw-r--r--meta/recipes-core/netbase/netbase/hosts2
-rw-r--r--meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch44
-rw-r--r--meta/recipes-core/netbase/netbase_5.3.bb24
-rw-r--r--meta/recipes-core/netbase/netbase_6.3.bb23
-rw-r--r--meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch41
-rw-r--r--meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch30
-rw-r--r--meta/recipes-core/newlib/libgloss_4.1.0.bb33
-rw-r--r--meta/recipes-core/newlib/newlib.inc54
-rw-r--r--meta/recipes-core/newlib/newlib_4.1.0.bb20
-rw-r--r--meta/recipes-core/os-release/os-release.bb40
-rw-r--r--meta/recipes-core/ovmf/ovmf-shell-image.bb21
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-Fix-VLA-parameter-warning.patch51
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch33
-rw-r--r--meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch66
-rw-r--r--meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch45
-rw-r--r--meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch32
-rw-r--r--meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch104
-rw-r--r--meta/recipes-core/ovmf/ovmf/0006-reproducible.patch180
-rw-r--r--meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks4
-rw-r--r--meta/recipes-core/ovmf/ovmf_git.bb264
-rw-r--r--meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb16
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-base.bb190
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-boot.bb22
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb3
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb3
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-nfs.bb10
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-sdk.bb32
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb3
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb3
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb12
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb12
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb80
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb26
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb9
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-go-cross-canadian.bb12
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-go-sdk-target.bb12
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb18
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-self-hosted.bb83
-rw-r--r--meta/recipes-core/psplash/files/0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch53
-rwxr-xr-xmeta/recipes-core/psplash/files/psplash-init15
-rw-r--r--meta/recipes-core/psplash/files/psplash-start.service12
-rw-r--r--meta/recipes-core/psplash/files/psplash-systemd.service13
-rw-r--r--meta/recipes-core/psplash/psplash_git.bb96
-rw-r--r--meta/recipes-core/readline/files/config-dirent-symbols.patch34
-rw-r--r--meta/recipes-core/readline/files/inputrc (renamed from meta/recipes-core/base-files/base-files/inputrc)0
-rw-r--r--meta/recipes-core/readline/readline-5.2/configure-fix.patch26
-rw-r--r--meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch21
-rw-r--r--meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch32
-rw-r--r--meta/recipes-core/readline/readline-6.3/readline63-00343
-rw-r--r--meta/recipes-core/readline/readline-8.1/configure-fix.patch (renamed from meta/recipes-core/readline/readline-6.3/configure-fix.patch)0
-rw-r--r--meta/recipes-core/readline/readline-8.1/norpath.patch (renamed from meta/recipes-core/readline/files/norpath.patch)0
-rw-r--r--meta/recipes-core/readline/readline-8.1/rl-native.map12
-rw-r--r--meta/recipes-core/readline/readline.inc30
-rw-r--r--meta/recipes-core/readline/readline_5.2.bb84
-rw-r--r--meta/recipes-core/readline/readline_6.3.bb8
-rw-r--r--meta/recipes-core/readline/readline_8.1.bb7
-rw-r--r--meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb12
-rw-r--r--meta/recipes-core/systemd/systemd-boot_249.5.bb74
-rw-r--r--meta/recipes-core/systemd/systemd-bootconf_1.00.bb32
-rw-r--r--meta/recipes-core/systemd/systemd-compat-units.bb32
-rw-r--r--meta/recipes-core/systemd/systemd-conf/journald.conf3
-rw-r--r--meta/recipes-core/systemd/systemd-conf/logind.conf2
-rw-r--r--meta/recipes-core/systemd/systemd-conf/system.conf2
-rw-r--r--meta/recipes-core/systemd/systemd-conf/system.conf-qemuall3
-rw-r--r--meta/recipes-core/systemd/systemd-conf/wired.network13
-rw-r--r--meta/recipes-core/systemd/systemd-conf_1.0.bb43
-rw-r--r--meta/recipes-core/systemd/systemd-machine-units_1.0.bb13
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb35
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service18
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb2
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl522
-rw-r--r--meta/recipes-core/systemd/systemd.inc22
-rw-r--r--meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf6
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Revert-core-mount-add-dependencies-to-dynamically-mo.patch36
-rw-r--r--meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch81
-rw-r--r--meta/recipes-core/systemd/systemd/0001-meson-use-partial_dependency-to-get-include-director.patch46
-rw-r--r--meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch29
-rw-r--r--meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch44
-rw-r--r--meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch163
-rw-r--r--meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch25
-rw-r--r--meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch74
-rw-r--r--meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch41
-rw-r--r--meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch76
-rw-r--r--meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch433
-rw-r--r--meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch48
-rw-r--r--meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch41
-rw-r--r--meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch694
-rw-r--r--meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch382
-rw-r--r--meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch96
-rw-r--r--meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch153
-rw-r--r--meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch57
-rw-r--r--meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch46
-rw-r--r--meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch43
-rw-r--r--meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch143
-rw-r--r--meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch185
-rw-r--r--meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch104
-rw-r--r--meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch31
-rw-r--r--meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch98
-rw-r--r--meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch185
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch32
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch60
-rw-r--r--meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch33
-rw-r--r--meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch28
-rw-r--r--meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch24
-rw-r--r--meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch38
-rw-r--r--meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch31
-rw-r--r--meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch392
-rw-r--r--meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch58
-rw-r--r--meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch171
-rw-r--r--meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch34
-rw-r--r--meta/recipes-core/systemd/systemd/99-default.preset1
-rw-r--r--meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf11
-rw-r--r--meta/recipes-core/systemd/systemd/qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch31
-rw-r--r--meta/recipes-core/systemd/systemd/run-ptest5
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pager.sh7
-rw-r--r--meta/recipes-core/systemd/systemd/tmpfiles-pam.patch30
-rw-r--r--meta/recipes-core/systemd/systemd_219.bb420
-rw-r--r--meta/recipes-core/systemd/systemd_249.5.bb792
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch25
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/start_getty17
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb46
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch52
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch50
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch38
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/install.patch (renamed from meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch)48
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch (renamed from meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch)64
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc16
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/rcS-default7
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/realpath.patch59
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_3.00.bb (renamed from meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb)65
-rw-r--r--meta/recipes-core/uclibc/site_config/funcs474
-rw-r--r--meta/recipes-core/uclibc/site_config/headers156
-rw-r--r--meta/recipes-core/uclibc/site_config/types21
-rw-r--r--meta/recipes-core/uclibc/uclibc-config.inc142
-rw-r--r--meta/recipes-core/uclibc/uclibc-git.inc20
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Disable-lrount_tes-function.patch37
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0002-Add-implementation-for-copysignl-for-ppc.patch125
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch5811
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch30
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch233
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch35
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/locale.cfg3
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/obstack.cfg1
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/uClibc.distro193
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/uClibc.machine14
-rw-r--r--meta/recipes-core/uclibc/uclibc-initial_git.bb36
-rw-r--r--meta/recipes-core/uclibc/uclibc-package.inc37
-rw-r--r--meta/recipes-core/uclibc/uclibc.inc168
-rw-r--r--meta/recipes-core/uclibc/uclibc_git.bb22
-rw-r--r--meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch (renamed from meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch)0
-rw-r--r--meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch (renamed from meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch)207
-rw-r--r--meta/recipes-core/udev/eudev/devfs-udev.rules (renamed from meta/recipes-core/udev/udev/devfs-udev.rules)0
-rw-r--r--meta/recipes-core/udev/eudev/init (renamed from meta/recipes-core/udev/udev/init)51
-rw-r--r--meta/recipes-core/udev/eudev/links.conf (renamed from meta/recipes-core/udev/udev/links.conf)0
-rw-r--r--meta/recipes-core/udev/eudev/local.rules (renamed from meta/recipes-core/udev/udev/local.rules)0
-rw-r--r--meta/recipes-core/udev/eudev/permissions.rules (renamed from meta/recipes-core/udev/udev/permissions.rules)6
-rw-r--r--meta/recipes-core/udev/eudev/run.rules (renamed from meta/recipes-core/udev/udev/run.rules)0
-rw-r--r--meta/recipes-core/udev/eudev/udev.rules (renamed from meta/recipes-core/udev/udev/udev.rules)0
-rw-r--r--meta/recipes-core/udev/eudev_3.2.10.bb97
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh123
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb20
-rw-r--r--meta/recipes-core/udev/udev.inc111
-rw-r--r--meta/recipes-core/udev/udev/0001-Fixing-keyboard_force_release.sh-shell-script-path.patch35
-rw-r--r--meta/recipes-core/udev/udev/add-install-ptest.patch86
-rw-r--r--meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch25
-rw-r--r--meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch59
-rw-r--r--meta/recipes-core/udev/udev/run-ptest5
-rw-r--r--meta/recipes-core/udev/udev/udev-cache75
-rw-r--r--meta/recipes-core/udev/udev/udev-cache.default5
-rw-r--r--meta/recipes-core/udev/udev_182.bb9
-rw-r--r--meta/recipes-core/update-rc.d/update-rc.d/add-verbose.patch49
-rw-r--r--meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch59
-rw-r--r--meta/recipes-core/update-rc.d/update-rc.d/fix-to-handle-priority-numbers-correctly.patch28
-rw-r--r--meta/recipes-core/update-rc.d/update-rc.d_0.7.bb31
-rw-r--r--meta/recipes-core/update-rc.d/update-rc.d_0.8.bb26
-rw-r--r--meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb16
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc282
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch29
-rw-r--r--meta/recipes-core/util-linux/util-linux/configure-sbindir.patch10
-rw-r--r--meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch25
-rw-r--r--meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch35
-rw-r--r--meta/recipes-core/util-linux/util-linux/ptest.patch24
-rw-r--r--meta/recipes-core/util-linux/util-linux/run-ptest24
-rw-r--r--meta/recipes-core/util-linux/util-linux/runuser-l.pamd3
-rw-r--r--meta/recipes-core/util-linux/util-linux/runuser.pamd4
-rw-r--r--meta/recipes-core/util-linux/util-linux/uclibc-__progname-conflict.patch32
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch33
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-native.patch57
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch27
-rw-r--r--meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch33
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.26.2.bb30
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.37.2.bb320
-rwxr-xr-xmeta/recipes-core/volatile-binds/files/mount-copybind56
-rw-r--r--meta/recipes-core/volatile-binds/files/volatile-binds.service.in1
-rw-r--r--meta/recipes-core/volatile-binds/volatile-binds.bb24
-rw-r--r--meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch38
-rw-r--r--meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch20
-rw-r--r--meta/recipes-core/zlib/zlib-1.2.8/run-ptest2
-rw-r--r--meta/recipes-core/zlib/zlib/ldflags-tests.patch (renamed from meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch)4
-rw-r--r--meta/recipes-core/zlib/zlib/run-ptest7
-rw-r--r--meta/recipes-core/zlib/zlib_1.2.11.bb (renamed from meta/recipes-core/zlib/zlib_1.2.8.bb)35
621 files changed, 25915 insertions, 44068 deletions
diff --git a/meta/recipes-core/base-files/base-files/filesystems b/meta/recipes-core/base-files/base-files/filesystems
deleted file mode 100644
index 7e6c41c38f..0000000000
--- a/meta/recipes-core/base-files/base-files/filesystems
+++ /dev/null
@@ -1,8 +0,0 @@
-ext4
-ext3
-ext2
-vfat
-fat
-btrfs
-minix
-*
diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab
index d79a01602f..70e400f567 100644
--- a/meta/recipes-core/base-files/base-files/fstab
+++ b/meta/recipes-core/base-files/base-files/fstab
@@ -2,7 +2,7 @@
/dev/root / auto defaults 1 1
proc /proc proc defaults 0 0
-devpts /dev/pts devpts mode=0620,gid=5 0 0
+devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
diff --git a/meta/recipes-core/base-files/base-files/hosts b/meta/recipes-core/base-files/base-files/hosts
new file mode 100644
index 0000000000..b94f414d5c
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/hosts
@@ -0,0 +1,8 @@
+127.0.0.1 localhost.localdomain localhost
+
+# The following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
index 53c2680409..cc37e1ba77 100644
--- a/meta/recipes-core/base-files/base-files/profile
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -2,35 +2,65 @@
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
PATH="/usr/local/bin:/usr/bin:/bin"
-EDITOR="vi" # needed for packages like cron, git-commit
-test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
+[ "$TERM" ] || TERM="vt100" # Basic terminal capab. For screen etc.
-if [ ! -e /etc/localtime -a ! -e /etc/TZ ]; then
- TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html
- # for an explanation of how to set this to your local timezone.
- export TZ
-fi
+# Add /sbin & co to $PATH for the root user
+[ "$HOME" != "ROOTHOME" ] || PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
-if [ "$HOME" = "ROOTHOME" ]; then
- PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
-fi
-if [ "$PS1" ]; then
-# works for bash and ash (no other shells known to be in use here)
- PS1='\u@\h:\w\$ '
-fi
+# Set the prompt for bash and ash (no other shells known to be in use here)
+[ -z "$PS1" ] || PS1='\u@\h:\w\$ '
if [ -d /etc/profile.d ]; then
- for i in /etc/profile.d/* ; do
- . $i
- done
- unset i
+ for i in /etc/profile.d/*.sh; do
+ if [ -f $i -a -r $i ]; then
+ . $i
+ fi
+ done
+ unset i
fi
-if [ -x /usr/bin/resize ];then
- /usr/bin/resize >/dev/null
+if [ -t 0 -a $# -eq 0 ]; then
+ if [ ! -x @BINDIR@/resize ] ; then
+ if [ -n "$BASH_VERSION" ] ; then
+# Optimized resize funciton for bash
+resize() {
+ local x y
+ IFS='[;' read -t 2 -p $(printf '\e7\e[r\e[999;999H\e[6n\e8') -sd R _ y x _
+ [ -n "$y" ] && \
+ echo -e "COLUMNS=$x;\nLINES=$y;\nexport COLUMNS LINES;" && \
+ stty cols $x rows $y
+}
+ else
+# Portable resize function for ash/bash/dash/ksh
+# with subshell to avoid local variables
+resize() {
+ (o=$(stty -g)
+ stty -echo raw min 0 time 2
+ printf '\0337\033[r\033[999;999H\033[6n\0338'
+ if echo R | read -d R x 2> /dev/null; then
+ IFS='[;R' read -t 2 -d R -r z y x _
+ else
+ IFS='[;R' read -r _ y x _
+ fi
+ stty "$o"
+ [ -z "$y" ] && y=${z##*[}&&x=${y##*;}&&y=${y%%;*}
+ [ -n "$y" ] && \
+ echo "COLUMNS=$x;"&&echo "LINES=$y;"&&echo "export COLUMNS LINES;"&& \
+ stty cols $x rows $y)
+}
+ fi
+ fi
+ # Use the EDITOR not being set as a trigger to call resize
+ # and only do this for /dev/tty[A-z] which are typically
+ # serial ports
+ if [ -z "$EDITOR" -a "$SHLVL" = 1 ] ; then
+ case $(tty 2>/dev/null) in
+ /dev/tty[A-z]*) resize >/dev/null;;
+ esac
+ fi
fi
+EDITOR="vi" # needed for packages like cron, git-commit
export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
umask 022
-
diff --git a/meta/recipes-core/base-files/base-files/share/dot.profile b/meta/recipes-core/base-files/base-files/share/dot.profile
index 979793e8b5..a87316077c 100644
--- a/meta/recipes-core/base-files/base-files/share/dot.profile
+++ b/meta/recipes-core/base-files/base-files/share/dot.profile
@@ -7,4 +7,5 @@ fi
# path set by /etc/profile
# export PATH
-mesg n
+# Might fail after "su - myuser" when /dev/tty* is not writable by "myuser".
+mesg n 2>/dev/null
diff --git a/meta/recipes-core/base-files/base-files/usbd b/meta/recipes-core/base-files/base-files/usbd
deleted file mode 100644
index e69de29bb2..0000000000
--- a/meta/recipes-core/base-files/base-files/usbd
+++ /dev/null
diff --git a/meta/recipes-core/base-files/base-files_3.0.14.bb b/meta/recipes-core/base-files/base-files_3.0.14.bb
index e16fe722b8..c3ecd81c4a 100644
--- a/meta/recipes-core/base-files/base-files_3.0.14.bb
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -13,15 +13,13 @@ LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
SRC_URI = "file://rotation \
file://nsswitch.conf \
file://motd \
- file://inputrc \
+ file://hosts \
file://host.conf \
file://profile \
file://shells \
file://fstab \
- file://filesystems \
file://issue.net \
file://issue \
- file://usbd \
file://share/dot.bashrc \
file://share/dot.profile \
file://licenses/GPL-2 \
@@ -30,19 +28,21 @@ S = "${WORKDIR}"
INHIBIT_DEFAULT_DEPS = "1"
-docdir_append = "/${P}"
+docdir:append = "/${P}"
dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
dirs2775 = ""
-dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
- ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
+dirs555 = "/sys /proc"
+dirs755 = "/boot /dev ${base_bindir} ${base_sbindir} ${base_libdir} \
+ ${sysconfdir} ${sysconfdir}/default \
+ ${sysconfdir}/skel ${nonarch_base_libdir} /mnt ${ROOT_HOME} /run \
${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
${libdir} ${sbindir} ${datadir} \
${datadir}/common-licenses ${datadir}/dict ${infodir} \
${mandir} ${datadir}/misc ${localstatedir} \
${localstatedir}/backups ${localstatedir}/lib \
- /sys ${localstatedir}/lib/misc ${localstatedir}/spool \
+ ${localstatedir}/lib/misc ${localstatedir}/spool \
${localstatedir}/volatile \
- ${localstatedir}/volatile/log \
+ ${localstatedir}/${@'volatile/' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''}log \
/home ${prefix}/src ${localstatedir}/local \
/media"
@@ -53,9 +53,9 @@ dirs755-lsb = "/srv \
${prefix}/lib/locale"
dirs2775-lsb = "/var/mail"
-volatiles = "log tmp"
+volatiles = "${@'log' if oe.types.boolean('${VOLATILE_LOG_DIR}') else ''} tmp"
conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
- ${sysconfdir}/inputrc ${sysconfdir}/issue /${sysconfdir}/issue.net \
+ ${sysconfdir}/issue /${sysconfdir}/issue.net \
${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
${sysconfdir}/default"
@@ -64,7 +64,7 @@ conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
# hostnames.
#
# The hostname can be changed outside of this recipe by using
-# hostname_pn-base-files = "my-host-name".
+# hostname:pn-base-files = "my-host-name".
hostname = "${MACHINE}"
BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
@@ -77,7 +77,7 @@ BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
# Otherwise the directory creation will fail and we will have circular symbolic
# links.
#
-pkg_preinst_${PN} () {
+pkg_preinst:${PN} () {
#!/bin/sh -e
if [ x"$D" = "x" ]; then
if [ -h "/var/lock" ]; then
@@ -93,6 +93,9 @@ pkg_preinst_${PN} () {
}
do_install () {
+ for d in ${dirs555}; do
+ install -m 0555 -d ${D}$d
+ done
for d in ${dirs755}; do
install -m 0755 -d ${D}$d
done
@@ -109,6 +112,7 @@ do_install () {
ln -snf ../run ${D}${localstatedir}/run
ln -snf ../run/lock ${D}${localstatedir}/lock
+ install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
${BASEFILESISSUEINSTALL}
rotation=`cat ${WORKDIR}/rotation`
@@ -117,38 +121,38 @@ do_install () {
fi
install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
- install -m 0644 ${WORKDIR}/filesystems ${D}${sysconfdir}/filesystems
- install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
+ sed -i 's#@BINDIR@#${bindir}#g' ${D}${sysconfdir}/profile
install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
- install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc
- install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
- if [ "/usr/bin" != "${bindir}" ]; then
- sed -i "s,/usr/bin/resize,${bindir}/resize," ${D}${sysconfdir}/profile
- fi
-
ln -sf /proc/mounts ${D}${sysconfdir}/mtab
-}
-DISTRO_VERSION[vardepsexclude] += "DATE"
-do_install_basefilesissue () {
+ # deal with hostname
if [ "${hostname}" ]; then
echo ${hostname} > ${D}${sysconfdir}/hostname
+ echo "127.0.1.1 ${hostname}" >> ${D}${sysconfdir}/hosts
fi
+}
+
+do_install:append:libc-glibc () {
+ install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
+}
+DISTRO_VERSION[vardepsexclude] += "DATE"
+do_install_basefilesissue () {
install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
if [ -n "${DISTRO_NAME}" ]; then
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
if [ -n "${DISTRO_VERSION}" ]; then
- printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
- printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
+ distro_version_nodate="${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}','snapshot').replace('${DATE}','')}"
+ printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue
+ printf "%s " $distro_version_nodate >> ${D}${sysconfdir}/issue.net
fi
printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
echo >> ${D}${sysconfdir}/issue
@@ -156,8 +160,9 @@ do_install_basefilesissue () {
echo >> ${D}${sysconfdir}/issue.net
fi
}
+do_install_basefilesissue[vardepsexclude] += "DATE"
-do_install_append_linuxstdbase() {
+do_install:append:linuxstdbase() {
for d in ${dirs755-lsb}; do
install -m 0755 -d ${D}$d
done
@@ -167,12 +172,15 @@ do_install_append_linuxstdbase() {
done
}
+SYSROOT_DIRS += "${sysconfdir}/skel"
+
PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
-FILES_${PN} = "/"
-FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
+FILES:${PN} = "/"
+FILES:${PN}-doc = "${docdir} ${datadir}/common-licenses"
PACKAGE_ARCH = "${MACHINE_ARCH}"
-CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]} ${sysconfdir}/shells"
-CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
+CONFFILES:${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname ${sysconfdir}/hosts'][(d.getVar('hostname') != '')]} ${sysconfdir}/shells"
+CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
+INSANE_SKIP:${PN} += "empty-dirs"
diff --git a/meta/recipes-core/base-passwd/base-passwd/input.patch b/meta/recipes-core/base-passwd/base-passwd/input.patch
index f1bfc2f604..3abbcad5d5 100644
--- a/meta/recipes-core/base-passwd/base-passwd/input.patch
+++ b/meta/recipes-core/base-passwd/base-passwd/input.patch
@@ -1,6 +1,6 @@
Add an input group for the /dev/input/* devices.
-Upstream-Status: Invalid [configuration]
+Upstream-Status: Inappropriate [configuration]
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
diff --git a/meta/recipes-core/base-passwd/base-passwd/kvm.patch b/meta/recipes-core/base-passwd/base-passwd/kvm.patch
new file mode 100644
index 0000000000..113d5151e7
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/kvm.patch
@@ -0,0 +1,23 @@
+From 6355278b9f744291864c373a32a8da8f84aaaf37 Mon Sep 17 00:00:00 2001
+From: Jacob Kroon <jacob.kroon@gmail.com>
+Date: Wed, 30 Jan 2019 04:53:48 +0000
+Subject: [PATCH] Add kvm group
+
+Upstream-Status: Pending
+Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
+---
+ group.master | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/group.master b/group.master
+index cea9d60..5b62284 100644
+--- a/group.master
++++ b/group.master
+@@ -34,6 +34,7 @@ utmp:*:43:
+ video:*:44:
+ sasl:*:45:
+ plugdev:*:46:
++kvm:*:47:
+ staff:*:50:
+ games:*:60:
+ shutdown:*:70:
diff --git a/meta/recipes-core/base-passwd/base-passwd/nobash.patch b/meta/recipes-core/base-passwd/base-passwd/nobash.patch
index eed87db6cb..b5a692295b 100644
--- a/meta/recipes-core/base-passwd/base-passwd/nobash.patch
+++ b/meta/recipes-core/base-passwd/base-passwd/nobash.patch
@@ -1,7 +1,7 @@
use /bin/sh instead of /bin/bash, since the latter may not be included in
some images such as minimal
-Upstream-Status: Invalid [configuration]
+Upstream-Status: Inappropriate [configuration]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
diff --git a/meta/recipes-core/base-passwd/base-passwd/noshadow.patch b/meta/recipes-core/base-passwd/base-passwd/noshadow.patch
index e1cded61d6..e27bf7d9be 100644
--- a/meta/recipes-core/base-passwd/base-passwd/noshadow.patch
+++ b/meta/recipes-core/base-passwd/base-passwd/noshadow.patch
@@ -1,6 +1,6 @@
remove "*" for root since we don't have a /etc/shadow so far.
-Upstream-Status: Invalid [configuration]
+Upstream-Status: Inappropriate [configuration]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index ac9bd81d31..2926a377c6 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -1,7 +1,8 @@
SUMMARY = "Base system master password/group files"
DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files."
+HOMEPAGE = "https://launchpad.net/base-passwd"
SECTION = "base"
-LICENSE = "GPLv2+"
+LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
RECIPE_NO_UPDATE_REASON = "Version 3.5.38 requires cdebconf for update-passwd utility"
@@ -12,14 +13,17 @@ SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar
file://noshadow.patch \
file://input.patch \
file://disable-docs.patch \
- "
+ file://kvm.patch \
+ "
SRC_URI[md5sum] = "6beccac48083fe8ae5048acd062e5421"
SRC_URI[sha256sum] = "f0b66388b2c8e49c15692439d2bee63bcdd4bbbf7a782c7f64accc55986b6a36"
-inherit autotools
+# the package is taken from launchpad; that source is static and goes stale
+# so we check the latest upstream from a directory that does get updated
+UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/"
-SSTATEPOSTINSTFUNCS += "base_passwd_sstate_postinst"
+inherit autotools
do_install () {
install -d -m 755 ${D}${sbindir}
@@ -41,26 +45,35 @@ do_install () {
install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
}
-base_passwd_sstate_postinst() {
- if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
- then
- # Staging does not copy ${sysconfdir} files into the
- # target sysroot, so we need to do so manually. We
- # put these files in the target sysroot so they can
- # be used by recipes which use custom user/group
- # permissions.
- # Install passwd.master and group.master to sysconfdir and mv
- # them to make sure they are atomically install.
- install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
- for i in passwd group; do
- install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \
- ${STAGING_DIR_TARGET}${sysconfdir}/
- mv ${STAGING_DIR_TARGET}${sysconfdir}/$i.master ${STAGING_DIR_TARGET}${sysconfdir}/$i
- done
+basepasswd_sysroot_postinst() {
+#!/bin/sh
+
+# Install passwd.master and group.master to sysconfdir
+install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
+for i in passwd group; do
+ install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/\$i.master \
+ ${STAGING_DIR_TARGET}${sysconfdir}/\$i
+done
+
+# Run any useradd postinsts
+for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do
+ if [ -f \$script ]; then
+ \$script
fi
+done
+}
+
+SYSROOT_DIRS += "${sysconfdir}"
+SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot"
+
+base_passwd_tweaksysroot () {
+ mkdir -p ${SYSROOT_DESTDIR}${bindir}
+ dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN}
+ echo "${basepasswd_sysroot_postinst}" > $dest
+ chmod 0755 $dest
}
-python populate_packages_prepend() {
+python populate_packages:prepend() {
# Add in the preinst function for ${PN}
# We have to do this here as prior to this, passwd/group.master
# would be unavailable. We need to create these files at preinst
@@ -85,17 +98,17 @@ if [ ! -e $D${sysconfdir}/group ]; then
""" + group + """EOF
fi
"""
- d.setVar('pkg_preinst_${PN}', preinst)
+ d.setVar(d.expand('pkg_preinst:${PN}'), preinst)
}
addtask do_package after do_populate_sysroot
-ALLOW_EMPTY_${PN} = "1"
+ALLOW_EMPTY:${PN} = "1"
PACKAGES =+ "${PN}-update"
-FILES_${PN}-update = "${sbindir}/* ${datadir}/${PN}"
+FILES:${PN}-update = "${sbindir}/* ${datadir}/${PN}"
-pkg_postinst_${PN}-update () {
+pkg_postinst:${PN}-update () {
#!/bin/sh
if [ -n "$D" ]; then
exit 0
diff --git a/meta/recipes-core/busybox/busybox-inittab_1.34.1.bb b/meta/recipes-core/busybox/busybox-inittab_1.34.1.bb
new file mode 100644
index 0000000000..be8c06323c
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox-inittab_1.34.1.bb
@@ -0,0 +1,85 @@
+SUMMARY = "inittab configuration for BusyBox"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+SRC_URI = "file://inittab"
+
+S = "${WORKDIR}"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_compile() {
+ :
+}
+
+do_install() {
+ install -d ${D}${sysconfdir}
+ install -D -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
+ tmp="${SERIAL_CONSOLES}"
+ [ -n "$tmp" ] && echo >> ${D}${sysconfdir}/inittab
+ for i in $tmp
+ do
+ j=`echo ${i} | sed s/\;/\ /g`
+ id=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'`
+ echo "$id::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
+ done
+ if [ "${USE_VT}" = "1" ]; then
+ cat <<EOF >>${D}${sysconfdir}/inittab
+# ${base_sbindir}/getty invocations for the runlevels.
+#
+# The "id" field MUST be the same as the last
+# characters of the device (after "tty").
+#
+# Format:
+# <id>:<runlevels>:<action>:<process>
+#
+
+EOF
+
+ for n in ${SYSVINIT_ENABLED_GETTYS}
+ do
+ echo "tty$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
+ done
+ echo "" >> ${D}${sysconfdir}/inittab
+ fi
+
+}
+
+pkg_postinst:${PN} () {
+# run this on host and on target
+if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
+ exit 0
+fi
+}
+
+pkg_postinst_ontarget:${PN} () {
+# run this on the target
+if [ -e /proc/consoles ]; then
+ tmp="${SERIAL_CONSOLES_CHECK}"
+ for i in $tmp
+ do
+ j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
+ k=`echo ${i} | sed s/^.*\://g`
+ if [ -z "`grep ${j} /proc/consoles`" ]; then
+ if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
+ sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
+ fi
+ fi
+ done
+ kill -HUP 1
+else
+ exit 1
+fi
+}
+
+# SERIAL_CONSOLES is generally defined by the MACHINE .conf.
+# Set PACKAGE_ARCH appropriately.
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES:${PN} = "${sysconfdir}/inittab"
+CONFFILES:${PN} = "${sysconfdir}/inittab"
+
+RCONFLICTS:${PN} = "sysvinit-inittab"
+
+USE_VT ?= "1"
+SYSVINIT_ENABLED_GETTYS ?= "1"
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index ed8f9fe766..622325aabb 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -1,14 +1,15 @@
SUMMARY = "Tiny versions of many common UNIX utilities in a single small executable"
DESCRIPTION = "BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete POSIX environment for any small or embedded system."
-HOMEPAGE = "http://www.busybox.net"
+HOMEPAGE = "https://www.busybox.net"
BUGTRACKER = "https://bugs.busybox.net/"
-DEPENDS += "kern-tools-native"
+DEPENDS += "kern-tools-native virtual/crypt"
-# bzip2 applet in busybox is based on lightly-modified bzip2 source
+# bzip2 applet in busybox is based on lightly-modified bzip2-1.0.4 source
# the GPL is version 2 only
-LICENSE = "GPLv2 & bzip2"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb"
+LICENSE = "GPLv2 & bzip2-1.0.4"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb \
+ file://archival/libarchive/bz/LICENSE;md5=28e3301eae987e8cfe19988e98383dae"
SECTION = "base"
@@ -17,70 +18,77 @@ BUSYBOX_SPLIT_SUID ?= "1"
export EXTRA_CFLAGS = "${CFLAGS}"
export EXTRA_LDFLAGS = "${LDFLAGS}"
-export EXTRA_OEMAKE += "'LD=${CCLD}'"
+
+EXTRA_OEMAKE = "CC='${CC}' LD='${CCLD}' V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y HOSTCC='${BUILD_CC}' HOSTCPP='${BUILD_CPP}'"
PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
-FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
-FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
-FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
-FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
-FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
-FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
+FILES:${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
+FILES:${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_system_unitdir}/syslog.service ${sysconfdir}/default/busybox-syslog"
+FILES:${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
+FILES:${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
+FILES:${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
+FILES:${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock"
-INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
-INITSCRIPT_NAME_${PN}-hwclock = "hwclock.sh"
-INITSCRIPT_NAME_${PN}-mdev = "mdev"
-INITSCRIPT_PARAMS_${PN}-mdev = "start 03 S ."
-INITSCRIPT_NAME_${PN}-syslog = "syslog"
-INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
+INITSCRIPT_NAME:${PN}-httpd = "busybox-httpd"
+INITSCRIPT_NAME:${PN}-hwclock = "hwclock.sh"
+INITSCRIPT_NAME:${PN}-mdev = "mdev"
+INITSCRIPT_PARAMS:${PN}-mdev = "start 04 S ."
+INITSCRIPT_NAME:${PN}-syslog = "syslog"
+INITSCRIPT_NAME:${PN}-udhcpd = "busybox-udhcpd"
SYSTEMD_PACKAGES = "${PN}-syslog"
-SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
+SYSTEMD_SERVICE:${PN}-syslog = "${@bb.utils.contains('SRC_URI', 'file://syslog.cfg', 'busybox-syslog.service', '', d)}"
+
+RDEPENDS:${PN}-syslog = "busybox"
+CONFFILES:${PN}-syslog = "${sysconfdir}/syslog-startup.conf"
+RCONFLICTS:${PN}-syslog = "rsyslog sysklogd syslog-ng"
+
+CONFFILES:${PN}-mdev = "${sysconfdir}/mdev.conf"
-CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
-CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
+RRECOMMENDS:${PN} = "${PN}-udhcpc"
-RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
+RDEPENDS:${PN} = "${@["", "busybox-inittab"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]}"
inherit cml1 systemd update-rc.d ptest
+# busybox's unzip test case needs zip command, which busybox itself does not provide
+RDEPENDS:${PN}-ptest = "zip"
+
# internal helper
def busybox_cfg(feature, tokens, cnf, rem):
- if type(tokens) == type(""):
- tokens = [tokens]
- rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
- if feature:
- cnf.extend([token + '=y' for token in tokens])
- else:
- cnf.extend(['# ' + token + ' is not set' for token in tokens])
+ if type(tokens) == type(""):
+ tokens = [tokens]
+ rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
+ if feature:
+ cnf.extend([token + '=y' for token in tokens])
+ else:
+ cnf.extend(['# ' + token + ' is not set' for token in tokens])
# Map distro features to config settings
def features_to_busybox_settings(d):
- cnf, rem = ([], [])
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_LFS', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'wifi', True, False, d), 'CONFIG_RFKILL', cnf, rem)
- busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'bluetooth', True, False, d), 'CONFIG_RFKILL', cnf, rem)
- return "\n".join(cnf), "\n".join(rem)
-
-# X, Y = ${@features_to_uclibc_settings(d)}
+ cnf, rem = ([], [])
+ busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem)
+ busybox_cfg(True, 'CONFIG_LFS', cnf, rem)
+ busybox_cfg(True, 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
+ busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem)
+ busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
+ busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
+ busybox_cfg(bb.utils.contains_any('DISTRO_FEATURES', 'bluetooth wifi', True, False, d), 'CONFIG_RFKILL', cnf, rem)
+ return "\n".join(cnf), "\n".join(rem)
+
+# X, Y = ${@features_to_busybox_settings(d)}
# unfortunately doesn't seem to work with bitbake, workaround:
def features_to_busybox_conf(d):
- cnf, rem = features_to_busybox_settings(d)
- return cnf
+ cnf, rem = features_to_busybox_settings(d)
+ return cnf
def features_to_busybox_del(d):
- cnf, rem = features_to_busybox_settings(d)
- return rem
+ cnf, rem = features_to_busybox_settings(d)
+ return rem
-configmangle = '/CROSS_COMPILER_PREFIX/d; \
- /CONFIG_EXTRA_CFLAGS/d; \
+configmangle = '/CONFIG_EXTRA_CFLAGS/d; \
'
OE_FEATURES := "${@features_to_busybox_conf(d)}"
OE_DEL := "${@features_to_busybox_del(d)}"
@@ -89,50 +97,44 @@ DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}"
python () {
if "${OE_DEL}":
- d.setVar('configmangle_append', "${OE_DEL}" + "\n")
+ d.setVar('configmangle:append', "${OE_DEL}" + "\n")
if "${OE_FEATURES}":
- d.setVar('configmangle_append',
+ d.setVar('configmangle:append',
"/^### DISTRO FEATURES$/a\\\n%s\n\n" %
("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
- d.setVar('configmangle_append',
+ d.setVar('configmangle:append',
"/^### CROSS$/a\\\n%s\n" %
- ("\\n".join(["CONFIG_CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
- "CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\" \"${HOST_CC_ARCH}\""
+ ("\\n".join(["CONFIG_EXTRA_CFLAGS=\"${CFLAGS} ${HOST_CC_ARCH}\""
])
))
}
do_prepare_config () {
- sed -e 's#@DATADIR@#${datadir}#g' \
+ export KCONFIG_NOTIMESTAMP=1
+
+ sed -e '/CONFIG_STATIC/d' \
< ${WORKDIR}/defconfig > ${S}/.config
- sed -i -e '/CONFIG_STATIC/d' .config
echo "# CONFIG_STATIC is not set" >> .config
for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \
${S}/.config
sed -i -e '${configmangle}' ${S}/.config
if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then
- # disable networking applets
- mv ${S}/.config ${S}/.config.oe-tmp
- awk 'BEGIN{net=0}
- /^# Networking Utilities/{net=1}
- /^#$/{if(net){net=net+1}}
- {if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \
- ${S}/.config.oe-tmp > ${S}/.config
+ # disable networking applets
+ mv ${S}/.config ${S}/.config.oe-tmp
+ awk 'BEGIN{net=0}
+ /^# Networking Utilities/{net=1}
+ /^#$/{if(net){net=net+1}}
+ {if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \
+ ${S}/.config.oe-tmp > ${S}/.config
fi
sed -i 's/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b"/' ${S}/.config
+ if [ -n "${DEBUG_PREFIX_MAP}" ]; then
+ sed -i 's|${DEBUG_PREFIX_MAP}||g' ${S}/.config
+ fi
}
-# returns all the elements from the src uri that are .cfg files
-def find_cfgs(d):
- sources=src_patches(d, True)
- sources_list=[]
- for s in sources:
- if s.endswith('.cfg'):
- sources_list.append(s)
-
- return sources_list
-
do_configure () {
+ set -x
do_prepare_config
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
cml1_do_configure
@@ -140,11 +142,23 @@ do_configure () {
do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
+ export KCONFIG_NOTIMESTAMP=1
+
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
- # split the .config into two parts, and make two busybox binaries
+ # split the .config into two parts, and make two busybox binaries
+ if [ -e .config.orig ]; then
+ # Need to guard again an interrupted do_compile - restore any backup
+ cp .config.orig .config
+ fi
cp .config .config.orig
oe_runmake busybox.cfg.suid
oe_runmake busybox.cfg.nosuid
+
+ # workaround for suid bug 10346
+ if ! grep -q "CONFIG_SH_IS_NONE" busybox.cfg.nosuid; then
+ echo "CONFIG_SH_IS_NONE" >> busybox.cfg.suid
+ fi
+
for i in `cat busybox.cfg.suid busybox.cfg.nosuid`; do
echo "# $i is not set" >> .config.disable.apps
done
@@ -154,12 +168,25 @@ do_compile() {
cat busybox.cfg.$s | while read item; do
grep -w "$item" .config.orig
done > .config.app.$s
+
+ # workaround for suid bug 10346
+ if [ "$s" = "suid" ] ; then
+ sed "s/.*CONFIG_SH_IS_NONE.*$/CONFIG_SH_IS_NONE=y/" -i .config.app.suid
+ fi
+
merge_config.sh -m .config.nonapps .config.app.$s
oe_runmake busybox_unstripped
mv busybox_unstripped busybox.$s
oe_runmake busybox.links
- mv busybox.links busybox.links.$s
+ sort busybox.links > busybox.links.$s
+ rm busybox.links
done
+
+ # hard fail if sh is being linked to the suid busybox (detects bug 10346)
+ if grep -q -x "/bin/sh" busybox.links.suid; then
+ bbfatal "busybox suid binary incorrectly provides /bin/sh"
+ fi
+
# copy .config.orig back to .config, because the install process may check this file
cp .config.orig .config
# cleanup
@@ -172,20 +199,24 @@ do_compile() {
}
do_install () {
- if [ "${prefix}" != "/usr" ]; then
- sed -i "s:^/usr/:${prefix}/:" busybox.links*
- fi
- if [ "${base_sbindir}" != "/sbin" ]; then
- sed -i "s:^/sbin/:${base_sbindir}/:" busybox.links*
- fi
- if [ "${base_bindir}" != "/bin" ]; then
- sed -i "s:^/bin/:${base_bindir}/:" busybox.links*
- fi
+ sed -i "s:^/bin/:BASE_BINDIR/:" busybox.links*
+ sed -i "s:^/sbin/:BASE_SBINDIR/:" busybox.links*
+ sed -i "s:^/usr/bin/:BINDIR/:" busybox.links*
+ sed -i "s:^/usr/sbin/:SBINDIR/:" busybox.links*
+
+ # Move arch/link to BINDIR to match coreutils
+ sed -i "s:^BASE_BINDIR/arch:BINDIR/arch:" busybox.links*
+ sed -i "s:^BASE_BINDIR/link:BINDIR/link:" busybox.links*
+
+ sed -i "s:^BASE_BINDIR/:${base_bindir}/:" busybox.links*
+ sed -i "s:^BASE_SBINDIR/:${base_sbindir}/:" busybox.links*
+ sed -i "s:^BINDIR/:${bindir}/:" busybox.links*
+ sed -i "s:^SBINDIR/:${sbindir}/:" busybox.links*
install -d ${D}${sysconfdir}/init.d
if ! grep -q "CONFIG_FEATURE_INDIVIDUAL=y" ${B}/.config; then
- # Install /bin/busybox, and the /bin/sh link so the postinst script
+ # Install ${base_bindir}/busybox, and the ${base_bindir}/sh link so the postinst script
# can run. Let update-alternatives handle the rest.
install -d ${D}${base_bindir}
if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then
@@ -193,7 +224,7 @@ do_install () {
install -m 0755 ${B}/busybox.nosuid ${D}${base_bindir}
install -m 0644 ${S}/busybox.links.suid ${D}${sysconfdir}
install -m 0644 ${S}/busybox.links.nosuid ${D}${sysconfdir}
- if grep -q "CONFIG_FEATURE_SH_IS_ASH=y" ${B}/.config; then
+ if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then
ln -sf busybox.nosuid ${D}${base_bindir}/sh
fi
# Keep a default busybox for people who want to invoke busybox directly.
@@ -207,19 +238,18 @@ do_install () {
install -m 0755 ${B}/busybox ${D}${base_bindir}
fi
install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
- if grep -q "CONFIG_FEATURE_SH_IS_ASH=y" ${B}/.config; then
+ if grep -q "CONFIG_SH_IS_ASH=y" ${B}/.config; then
ln -sf busybox ${D}${base_bindir}/sh
fi
# We make this symlink here to eliminate the error when upgrading together
# with busybox-syslog. Without this symlink, the opkg may think of the
# busybox.nosuid as obsolete and remove it, resulting in dead links like
- # /bin/sed -> /bin/busybox.nosuid. This will make upgrading busybox-syslog fail.
+ # ${base_bindir}/sed -> ${base_bindir}/busybox.nosuid. This will make upgrading busybox-syslog fail.
# This symlink will be safely deleted in postinst, thus no negative effect.
ln -sf busybox ${D}${base_bindir}/busybox.nosuid
fi
else
- install -d ${D}${base_bindir} ${D}${base_sbindir}
- install -d ${D}${libdir} ${D}${bindir} ${D}${sbindir}
+ install -d ${D}${base_bindir} ${D}${bindir} ${D}${libdir}
cat busybox.links | while read FILE; do
NAME=`basename "$FILE"`
install -m 0755 "0_lib/$NAME" "${D}$FILE.${BPN}"
@@ -239,93 +269,100 @@ do_install () {
fi
if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
- install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${BPN}
- install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf.${BPN}
- install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf.${BPN}
+ install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog
+ install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf
+ install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf
fi
- if grep "CONFIG_CROND=y" ${B}/.config; then
+ if grep -q "CONFIG_CROND=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
fi
- if grep "CONFIG_HTTPD=y" ${B}/.config; then
+ if grep -q "CONFIG_HTTPD=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
install -d ${D}/srv/www
fi
- if grep "CONFIG_UDHCPD=y" ${B}/.config; then
+ if grep -q "CONFIG_UDHCPD=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
fi
- if grep "CONFIG_HWCLOCK=y" ${B}/.config; then
+ if grep -q "CONFIG_HWCLOCK=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
fi
- if grep "CONFIG_UDHCPC=y" ${B}/.config; then
+ if grep -q "CONFIG_UDHCPC=y" ${B}/.config; then
install -d ${D}${sysconfdir}/udhcpc.d
install -d ${D}${datadir}/udhcpc
- install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
+ install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
+ sed -i "s:/SBIN_DIR/:${base_sbindir}/:" ${D}${sysconfdir}/udhcpc.d/50default
install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
fi
- if grep "CONFIG_INETD=y" ${B}/.config; then
+ if grep -q "CONFIG_INETD=y" ${B}/.config; then
install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN}
sed -i "s:/usr/sbin/:${sbindir}/:" ${D}${sysconfdir}/init.d/inetd.${BPN}
install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/
fi
- if grep "CONFIG_MDEV=y" ${B}/.config; then
- install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
- if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
- install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
- install -d ${D}${sysconfdir}/mdev
- install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
- install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
- fi
+ if grep -q "CONFIG_MDEV=y" ${B}/.config; then
+ install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
+ if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
+ install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
+ install -d ${D}${sysconfdir}/mdev
+ install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
+ install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
+ fi
+ fi
+ if grep -q "CONFIG_INIT=y" ${B}/.config && ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','busybox','true','false',d)}; then
+ install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS
+ install -D -m 0755 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK
+ install -D -m 0755 ${WORKDIR}/rcS.default ${D}${sysconfdir}/default/rcS
fi
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
- if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
- install -d ${D}${systemd_unitdir}/system
- sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
- > ${D}${systemd_unitdir}/system/busybox-syslog.service
- if [ -f ${WORKDIR}/busybox-syslog.default ] ; then
- install -d ${D}${sysconfdir}/default
- install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog
- fi
- ln -sf /dev/null ${D}${systemd_unitdir}/system/syslog.service
- fi
- if grep -q "CONFIG_KLOGD=y" ${B}/.config; then
- install -d ${D}${systemd_unitdir}/system
- sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
- > ${D}${systemd_unitdir}/system/busybox-klogd.service
- fi
- fi
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ if grep -q "CONFIG_KLOGD=y" ${B}/.config; then
+ install -d ${D}${systemd_system_unitdir}
+ sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
+ > ${D}${systemd_system_unitdir}/busybox-klogd.service
+ fi
- # Remove the sysvinit specific configuration file for systemd systems to avoid confusion
- if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
- rm -f ${D}${sysconfdir}/syslog-startup.conf.${BPN}
- fi
+ if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
+ install -d ${D}${systemd_system_unitdir}
+ sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
+ > ${D}${systemd_system_unitdir}/busybox-syslog.service
+ if [ ! -e ${D}${systemd_system_unitdir}/busybox-klogd.service ] ; then
+ sed -i '/klog/d' ${D}${systemd_system_unitdir}/busybox-syslog.service
+ fi
+ if [ -f ${WORKDIR}/busybox-syslog.default ] ; then
+ install -d ${D}${sysconfdir}/default
+ install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog
+ fi
+ fi
+ fi
+
+ # Remove the sysvinit specific configuration file for systemd systems to avoid confusion
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
+ rm -f ${D}${sysconfdir}/syslog-startup.conf
+ fi
}
-inherit update-alternatives
+PTEST_BINDIR = "1"
-ALTERNATIVE_PRIORITY = "50"
+do_install_ptest () {
+ cp -r ${B}/testsuite ${D}${PTEST_PATH}/
+ # These access the internet which is not guaranteed to work on machines running the tests
+ rm -rf ${D}${PTEST_PATH}/testsuite/wget
+ sort ${B}/.config > ${D}${PTEST_PATH}/.config
+ ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
+}
-ALTERNATIVE_${PN}-syslog += "syslog-conf"
-ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
+inherit update-alternatives
-python () {
- if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- pn = d.getVar('PN', True)
- d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-init')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
- d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-startup-conf')
- d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir', True)))
- d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
-}
+ALTERNATIVE_PRIORITY = "50"
-python do_package_prepend () {
+python do_package:prepend () {
# We need to load the full set of busybox provides from the /etc/busybox.links
# Use this to see the update-alternatives with the right information
- dvar = d.getVar('D', True)
- pn = d.getVar('PN', True)
+ dvar = d.getVar('D')
+ pn = d.getVar('PN')
def set_alternative_vars(links, target):
+ links = d.expand(links)
+ target = d.expand(target)
f = open('%s%s' % (dvar, links), 'r')
for alt_link_name in f:
alt_link_name = alt_link_name.strip()
@@ -333,7 +370,10 @@ python do_package_prepend () {
# Match coreutils
if alt_name == '[':
alt_name = 'lbracket'
- d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
+ if alt_name == 'klogd' or alt_name == 'syslogd':
+ d.appendVar('ALTERNATIVE:%s-syslog' % (pn), ' ' + alt_name)
+ else:
+ d.appendVar('ALTERNATIVE:%s' % (pn), ' ' + alt_name)
d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
if os.path.exists('%s%s' % (dvar, target)):
d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
@@ -347,45 +387,69 @@ python do_package_prepend () {
set_alternative_vars("${sysconfdir}/busybox.links.suid", "${base_bindir}/busybox.suid")
}
-pkg_postinst_${PN} () {
- # This part of code is dedicated to the on target upgrade problem.
- # It's known that if we don't make appropriate symlinks before update-alternatives calls,
- # there will be errors indicating missing commands such as 'sed'.
- # These symlinks will later be updated by update-alternatives calls.
- test -n 2 > /dev/null || alias test='busybox test'
- if test "x$D" = "x"; then
- # Remove busybox.nosuid if it's a symlink, because this situation indicates
- # that we're installing or upgrading to a one-binary busybox.
- if test -h ${base_bindir}/busybox.nosuid; then
- rm -f ${base_bindir}/busybox.nosuid
- fi
- for suffix in "" ".nosuid" ".suid"; do
- if test -e ${sysconfdir}/busybox.links$suffix; then
- while read link; do
- if test ! -e "$link"; then
- case "$link" in
- /*/*/*)
- to="../..${base_bindir}/busybox$suffix"
- ;;
- /bin/*)
- to="busybox$suffix"
- ;;
- /*/*)
- to="..${base_bindir}/busybox$suffix"
- ;;
- esac
- # we can use busybox here because even if we are using splitted busybox
- # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
- busybox rm -f $link
- busybox ln -s $to $link
- fi
- done < ${sysconfdir}/busybox.links$suffix
- fi
- done
- fi
+# This part of code is dedicated to the on target upgrade problem. It's known
+# that if we don't make appropriate symlinks before update-alternatives calls,
+# there will be errors indicating missing commands such as 'sed'.
+# These symlinks will later be updated by update-alternatives calls.
+# The update-alternatives.bbclass' postinst script runs firstly before other
+# postinst, but this part of code needs run firstly, so add this funtion.
+python populate_packages_updatealternatives:append() {
+ postinst = """
+test -n 2 > /dev/null || alias test='busybox test'
+if test "x$D" = "x"; then
+ # Remove busybox.nosuid if it's a symlink, because this situation indicates
+ # that we're installing or upgrading to a one-binary busybox.
+ if test -h ${base_bindir}/busybox.nosuid; then
+ rm -f ${base_bindir}/busybox.nosuid
+ fi
+ for suffix in "" ".nosuid" ".suid"; do
+ if test -e ${sysconfdir}/busybox.links$suffix; then
+ while read link; do
+ if test ! -e "$link"; then
+ # we can use busybox here because even if we are using splitted busybox
+ # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
+ busybox rm -f $link
+ busybox ln -s "${base_bindir}/busybox$suffix" $link
+ fi
+ done < ${sysconfdir}/busybox.links$suffix
+ fi
+ done
+fi
+if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links*; then
+ grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells
+fi
+
+"""
+ d.prependVar('pkg_postinst:%s' % pkg, postinst)
}
-pkg_prerm_${PN} () {
+pkg_postinst:${PN}:prepend () {
+ # Need path to saved utils, but they may have be removed on upgrade of busybox
+ # Only use shell to get paths. Also capture if busybox was saved.
+ BUSYBOX=""
+ if [ "x$D" = "x" ] ; then
+ for busybox_rmdir in /tmp/busyboxrm-*; do
+ if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then
+ export PATH=$busybox_rmdir:$PATH
+ if [ -e $busybox_rmdir/busybox* ] ; then
+ BUSYBOX="$busybox_rmdir/busybox*"
+ fi
+ fi
+ done
+ fi
+}
+
+pkg_postinst:${PN}:append () {
+ # If busybox exists in the remove directory it is because it was the only shell left.
+ if [ "x$D" = "x" ] ; then
+ if [ "x$BUSYBOX" != "x" ] ; then
+ update-alternatives --remove sh $BUSYBOX
+ rm -f $BUSYBOX
+ fi
+ fi
+}
+
+pkg_prerm:${PN} () {
# This is so you can make busybox commit suicide - removing busybox with no other packages
# providing its files, this will make update-alternatives work, but the update-rc.d part
# for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
@@ -403,14 +467,40 @@ pkg_prerm_${PN} () {
ln -s ${base_bindir}/busybox $tmpdir/sed
ln -s ${base_bindir}/busybox $tmpdir/sort
ln -s ${base_bindir}/busybox $tmpdir/grep
+ ln -s ${base_bindir}/busybox $tmpdir/tail
export PATH=$PATH:$tmpdir
+
+ # If busybox is the shell, we need to save it since its the lowest priority shell
+ # Register saved bitbake as the lowest priority shell possible as back up.
+ if [ -n "$(readlink -f /bin/sh | grep busybox)" ] ; then
+ BUSYBOX=$(readlink -f /bin/sh)
+ cp $BUSYBOX $tmpdir/$(basename $BUSYBOX)
+ update-alternatives --install /bin/sh sh $tmpdir/$(basename $BUSYBOX) 1
+ fi
+}
+
+pkg_postrm:${PN} () {
+ # Add path to remove dir in case we removed our only grep
+ if [ "x$D" = "x" ] ; then
+ for busybox_rmdir in /tmp/busyboxrm-*; do
+ if [ "$busybox_rmdir" != '/tmp/busyboxrm-*' ] ; then
+ export PATH=$busybox_rmdir:$PATH
+ fi
+ done
+ fi
+
+ if grep -q "^${base_bindir}/bash$" $D${sysconfdir}/busybox.links* && [ ! -e $D${base_bindir}/bash ]; then
+ printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells
+ fi
}
-pkg_prerm_${PN}-syslog () {
+pkg_prerm:${PN}-syslog () {
# remove syslog
if test "x$D" = "x"; then
if test "$1" = "upgrade" -o "$1" = "remove"; then
- ${sysconfdir}/init.d/syslog stop
+ ${sysconfdir}/init.d/syslog stop || :
fi
fi
}
+
+RPROVIDES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/ash', '', d)}"
diff --git a/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch b/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch
new file mode 100644
index 0000000000..2bf2b91c7e
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch
@@ -0,0 +1,114 @@
+From a9333eb6a7b8dbda735947cd5bc981ff9352a2c9 Mon Sep 17 00:00:00 2001
+From: Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
+Date: Thu, 10 Mar 2011 00:27:08 -0500
+Subject: [PATCH 1/2] Use $(CC) when linking instead of $(LD) and use $(CFLAGS)
+ and $(EXTRA_CFLAGS) when linking.
+
+This fixes the issue where LDFLAGS escaped with -Wl are ignored during
+compilation. It also simplifies using CFLAGS or EXTRA_CFLAGS (such as
+-m32 on x86_64 or -flto) which apply to both compilation and linking
+situations.
+
+Signed-off-by: Nathan Phillip Brink <ohnobinki@ohnopublishing.net>
+---
+Upstream-Status: Pending
+
+ Makefile | 7 ++++---
+ scripts/Makefile.build | 8 ++++----
+ scripts/Makefile.lib | 13 +++----------
+ 3 files changed, 11 insertions(+), 17 deletions(-)
+
+Index: busybox-1.23.2/Makefile
+===================================================================
+--- busybox-1.23.2.orig/Makefile
++++ busybox-1.23.2/Makefile
+@@ -309,7 +309,8 @@ CHECKFLAGS := -D__linux__ -Dlinux -D
+ MODFLAGS = -DMODULE
+ CFLAGS_MODULE = $(MODFLAGS)
+ AFLAGS_MODULE = $(MODFLAGS)
+-LDFLAGS_MODULE = -r
++LDFLAGS_RELOCATABLE = -r -nostdlib
++LDFLAGS_MODULE = $(LDFLAGS_RELOCATABLE)
+ CFLAGS_KERNEL =
+ AFLAGS_KERNEL =
+
+@@ -331,7 +332,7 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL)
+ export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \
+ ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
+ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
+- HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
++ HOSTCXX HOSTCXXFLAGS LDFLAGS_RELOCATABLE LDFLAGS_MODULE CHECK CHECKFLAGS
+
+ export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
+ export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
+@@ -610,7 +611,7 @@ quiet_cmd_busybox__ ?= LINK $@
+ cmd_busybox__ ?= $(srctree)/scripts/trylink \
+ "$@" \
+ "$(CC)" \
+- "$(CFLAGS) $(CFLAGS_busybox)" \
++ "$(CFLAGS) $(CFLAGS_busybox) $(EXTRA_CFLAGS)" \
+ "$(LDFLAGS) $(EXTRA_LDFLAGS)" \
+ "$(core-y)" \
+ "$(libs-y)" \
+Index: busybox-1.23.2/scripts/Makefile.build
+===================================================================
+--- busybox-1.23.2.orig/scripts/Makefile.build
++++ busybox-1.23.2/scripts/Makefile.build
+@@ -174,7 +174,7 @@ cmd_modversions = \
+ | $(GENKSYMS) -a $(ARCH) \
+ > $(@D)/.tmp_$(@F:.o=.ver); \
+ \
+- $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
++ $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(@D)/.tmp_$(@F) \
+ -T $(@D)/.tmp_$(@F:.o=.ver); \
+ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
+ else \
+@@ -257,7 +257,7 @@ quiet_cmd_link_o_target = LD $@
+ # If the list of objects to link is empty, just create an empty built-in.o
+ # -nostdlib is added to make "make LD=gcc ..." work (some people use that)
+ cmd_link_o_target = $(if $(strip $(obj-y)),\
+- $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
++ $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(filter $(obj-y), $^),\
+ rm -f $@; $(AR) rcs $@)
+
+ $(builtin-target): $(obj-y) FORCE
+@@ -292,10 +292,10 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \
+ $($(subst $(obj)/,,$(@:.o=-y)))), $^)
+
+ quiet_cmd_link_multi-y = LD $@
+-cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
++cmd_link_multi-y = $(CC) $(ld_flags_partial) $(LDFLAGS_RELOCATABLE) -o $@ $(link_multi_deps)
+
+ quiet_cmd_link_multi-m = LD [M] $@
+-cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
++cmd_link_multi-m = $(CC) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
+
+ # We would rather have a list of rules like
+ # foo.o: $(foo-objs)
+Index: busybox-1.23.2/scripts/Makefile.lib
+===================================================================
+--- busybox-1.23.2.orig/scripts/Makefile.lib
++++ busybox-1.23.2/scripts/Makefile.lib
+@@ -121,7 +121,8 @@ cpp_flags = -Wp,-MD,$(depfile) $(NO
+ # yet ld_flags is fed to ld.
+ #ld_flags = $(LDFLAGS) $(EXTRA_LDFLAGS)
+ # Remove the -Wl, prefix from linker options normally passed through gcc
+-ld_flags = $(filter-out -Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS))
++ld_flags = $(filter-out -Wl$(comma)%,$(LDFLAGS) $(EXTRA_LDFLAGS) $(CFLAGS) $(EXTRA_CFLAGS))
++ld_flags_partial = $($(filter-out -shared%, $(filter-out -pie%,$(ld_flags))))
+
+
+ # Finds the multi-part object the current object will be linked into
+@@ -151,10 +152,8 @@ $(obj)/%:: $(src)/%_shipped
+ # Linking
+ # ---------------------------------------------------------------------------
+
+-# TODO: LDFLAGS usually is supposed to contain gcc's flags, not ld's.
+-# but here we feed them to ld!
+-quiet_cmd_ld = LD $@
+-cmd_ld = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDFLAGS_$(@F)) \
++quiet_cmd_ld = CC $@
++cmd_ld = $(CC) $(ld_flags) $(LDFLAGS_$(@F)) \
+ $(filter-out FORCE,$^) -o $@
+
+ # Objcopy
diff --git a/meta/recipes-core/busybox/busybox/0001-chown-fix-help-text.patch b/meta/recipes-core/busybox/busybox/0001-chown-fix-help-text.patch
deleted file mode 100644
index 4299799664..0000000000
--- a/meta/recipes-core/busybox/busybox/0001-chown-fix-help-text.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From d291c2fdd5cb8616605c67ecbfb04274fa094242 Mon Sep 17 00:00:00 2001
-From: Junling Zheng <zhengjunling@huawei.com>
-Date: Sun, 7 Jun 2015 02:32:23 +0200
-Subject: [PATCH] chown: fix help text
-
-Derived from:
-http://git.busybox.net/busybox/commit/?id=d291c2fdd5cb8616605c67ecbfb04274fa094242.
-
-Only when DESKTOP is enabled, chown has -L, -H and -P options.
-
-Upstream-Status: Backport
-
-Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- coreutils/chown.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/coreutils/chown.c b/coreutils/chown.c
-index cb07bbc..679c0d8 100644
---- a/coreutils/chown.c
-+++ b/coreutils/chown.c
-@@ -11,7 +11,7 @@
- /* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */
-
- //usage:#define chown_trivial_usage
--//usage: "[-RhLHP"IF_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..."
-+//usage: "[-Rh"IF_DESKTOP("LHPcvf")"]... OWNER[<.|:>[GROUP]] FILE..."
- //usage:#define chown_full_usage "\n\n"
- //usage: "Change the owner and/or group of each FILE to OWNER and/or GROUP\n"
- //usage: "\n -R Recurse"
---
-1.8.3.4
-
diff --git a/meta/recipes-core/busybox/busybox/0001-du-l-works-fix-to-use-145-instead-of-144.patch b/meta/recipes-core/busybox/busybox/0001-du-l-works-fix-to-use-145-instead-of-144.patch
new file mode 100644
index 0000000000..bb5f7533ec
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-du-l-works-fix-to-use-145-instead-of-144.patch
@@ -0,0 +1,32 @@
+From c69feb2fdb755d6db34d0eb0a9e9994386c15e3a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 14 Nov 2018 15:19:57 +0800
+Subject: [PATCH] du-l-works: fix to use 145 instead of 144
+
+64 + 64 + 16 = 144
+144 + size_of_directory >= 145
+So fix to use 145 instead of 144.
+
+Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086836.html]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ testsuite/du/du-l-works | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
+index af87345..575064a 100644
+--- a/testsuite/du/du-l-works
++++ b/testsuite/du/du-l-works
+@@ -5,7 +5,7 @@ cd du.testdir
+ dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
+ ln file1 file1.1
+ dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
+-test x"`busybox du -l .`" = x"144 ." \
++test x"`busybox du -l .`" = x"145 ." \
+ -o x"`busybox du -l .`" = x"146 ." \
+ -o x"`busybox du -l .`" = x"148 ." \
+ -o x"`busybox du -l .`" = x"152 ." \
+--
+2.7.4
+
diff --git a/meta/recipes-core/busybox/busybox/0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch b/meta/recipes-core/busybox/busybox/0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch
deleted file mode 100644
index 2d729b1b05..0000000000
--- a/meta/recipes-core/busybox/busybox/0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From a97777889328157bb7d06ec618bad16712a9c345 Mon Sep 17 00:00:00 2001
-From: Denys Vlasenko <vda.linux@googlemail.com>
-Date: Tue, 3 Feb 2015 12:11:30 +0100
-Subject: [PATCH] ifconfig: fix double free fatal error in INET_sprint
-
-Derived from:
-http://git.busybox.net/busybox/commit/?id=a97777889328157bb7d06ec618bad16712a9c345.
-
-While INET_sprint or INET6_sprint is called circularly by keeping
-ifconfiging, sap->sa_family would be cleaned by other parallel processes
-such as dhclient sometimes, and then there would be a double free error
-like the following:
-
- *** glibc detected *** ifconfig: double free or corruption (fasttop): 0x000a6008 ***
- ======= Backtrace: =========
- /lib/libc.so.6(+0x6bc84)[0x40133c84]
- /lib/libc.so.6(cfree+0x94)[0x40138684]
- ifconfig[0x1c460]
- ifconfig[0x1c6a0]
- ifconfig[0x1ccf4]
- ifconfig[0x187c8]
- ifconfig[0xd544]
- ifconfig[0xd5dc]
- ifconfig[0xdca8]
- /lib/libc.so.6(__libc_start_main+0x110)[0x400df258]
- ======= Memory map: ========
- 00008000-0009c000 r-xp 00000000 1f:05 444328 /bin/busybox
- 000a3000-000a4000 rw-p 00093000 1f:05 444328 /bin/busybox
-
-This patch moved free() two lines down to address this problem.
-
-Upstream-Status: Backport
-
-Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
----
- networking/interface.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/networking/interface.c b/networking/interface.c
-index bf7d2b1..b0572d0 100644
---- a/networking/interface.c
-+++ b/networking/interface.c
-@@ -91,9 +91,9 @@ static const char* FAST_FUNC INET_sprint(struct sockaddr *sap, int numeric)
- {
- static char *buff; /* defaults to NULL */
-
-- free(buff);
- if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
- return "[NONE SET]";
-+ free(buff);
- buff = INET_rresolve((struct sockaddr_in *) sap, numeric, 0xffffff00);
- return buff;
- }
-@@ -173,9 +173,9 @@ static const char* FAST_FUNC INET6_sprint(struct sockaddr *sap, int numeric)
- {
- static char *buff;
-
-- free(buff);
- if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
- return "[NONE SET]";
-+ free(buff);
- buff = INET6_rresolve((struct sockaddr_in6 *) sap, numeric);
- return buff;
- }
---
-1.8.3.4
-
diff --git a/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch b/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch
new file mode 100644
index 0000000000..4a1960dff2
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-mktemp-add-tmpdir-option.patch
@@ -0,0 +1,81 @@
+From ceb378209f953ea745ed93a8645567196380ce3c Mon Sep 17 00:00:00 2001
+From: Andrej Valek <andrej.valek@siemens.com>
+Date: Thu, 24 Jun 2021 19:13:22 +0200
+Subject: [PATCH] mktemp: add tmpdir option
+
+Make mktemp more compatible with coreutils.
+- add "--tmpdir" option
+- add long variants for "d,q,u" options
+
+Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-June/088932.html]
+
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ coreutils/mktemp.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/coreutils/mktemp.c b/coreutils/mktemp.c
+index 5393320a5..05c6d98c6 100644
+--- a/coreutils/mktemp.c
++++ b/coreutils/mktemp.c
+@@ -39,16 +39,17 @@
+ //kbuild:lib-$(CONFIG_MKTEMP) += mktemp.o
+
+ //usage:#define mktemp_trivial_usage
+-//usage: "[-dt] [-p DIR] [TEMPLATE]"
++//usage: "[-dt] [-p DIR, --tmpdir[=DIR]] [TEMPLATE]"
+ //usage:#define mktemp_full_usage "\n\n"
+ //usage: "Create a temporary file with name based on TEMPLATE and print its name.\n"
+ //usage: "TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX).\n"
+ //usage: "Without TEMPLATE, -t tmp.XXXXXX is assumed.\n"
+-//usage: "\n -d Make directory, not file"
+-//usage: "\n -q Fail silently on errors"
+-//usage: "\n -t Prepend base directory name to TEMPLATE"
+-//usage: "\n -p DIR Use DIR as a base directory (implies -t)"
+-//usage: "\n -u Do not create anything; print a name"
++//usage: "\n -d Make directory, not file"
++//usage: "\n -q Fail silently on errors"
++//usage: "\n -t Prepend base directory name to TEMPLATE"
++//usage: "\n -p DIR, --tmpdir[=DIR] Use DIR as a base directory (implies -t)"
++//usage: "\n For --tmpdir is a optional one."
++//usage: "\n -u Do not create anything; print a name"
+ //usage: "\n"
+ //usage: "\nBase directory is: -p DIR, else $TMPDIR, else /tmp"
+ //usage:
+@@ -72,13 +73,22 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
+ OPT_t = 1 << 2,
+ OPT_p = 1 << 3,
+ OPT_u = 1 << 4,
++ OPT_td = 1 << 5,
+ };
+
+ path = getenv("TMPDIR");
+ if (!path || path[0] == '\0')
+ path = "/tmp";
+
+- opts = getopt32(argv, "^" "dqtp:u" "\0" "?1"/*1 arg max*/, &path);
++ opts = getopt32long(argv, "^"
++ "dqtp:u\0"
++ "?1" /* 1 arg max */,
++ "directory\0" No_argument "d"
++ "quiet\0" No_argument "q"
++ "dry-run\0" No_argument "u"
++ "tmpdir\0" Optional_argument "\xff"
++ , &path, &path
++ );
+
+ chp = argv[optind];
+ if (!chp) {
+@@ -95,7 +105,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
+ goto error;
+ }
+ #endif
+- if (opts & (OPT_t|OPT_p))
++ if (opts & (OPT_t|OPT_p|OPT_td))
+ chp = concat_path_file(path, chp);
+
+ if (opts & OPT_u) {
+--
+2.11.0
+
diff --git a/meta/recipes-core/busybox/busybox/0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch b/meta/recipes-core/busybox/busybox/0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch
new file mode 100644
index 0000000000..9f58eaef67
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch
@@ -0,0 +1,40 @@
+From 3bee0460d74bad88eca6592e63ca926961b43b67 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <yi.zhao@windriver.com>
+Date: Fri, 6 Mar 2020 16:09:26 +0800
+Subject: [PATCH] sysctl: ignore EIO of stable_secret below
+ /proc/sys/net/ipv6/conf
+
+Avoid confusing messages caused by EIO on reading
+/proc/sys/net/ipv6/conf/*/stable_secret if those are not set yet.
+Make it behave the same as procps(>=3.3.13).
+
+Upstream-Status: Submitted [busybox@busybox.net mailing list]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ procps/sysctl.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/procps/sysctl.c b/procps/sysctl.c
+index 6d77185ca..42c51cc91 100644
+--- a/procps/sysctl.c
++++ b/procps/sysctl.c
+@@ -202,7 +202,14 @@ static int sysctl_act_on_setting(char *setting)
+ value = cptr = xmalloc_read(fd, NULL);
+ close(fd);
+ if (value == NULL) {
+- bb_perror_msg("error reading key '%s'", outname);
++ switch (errno) {
++ case EIO:
++ /* Ignore stable_secret below /proc/sys/net/ipv6/conf */
++ break;
++ default:
++ bb_perror_msg("error reading key '%s'", outname);
++ break;
++ }
+ retval = EXIT_FAILURE;
+ goto end;
+ }
+--
+2.17.1
+
diff --git a/meta/recipes-core/busybox/busybox/0001-testsuite-check-uudecode-before-using-it.patch b/meta/recipes-core/busybox/busybox/0001-testsuite-check-uudecode-before-using-it.patch
new file mode 100644
index 0000000000..d4bda3c12f
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-testsuite-check-uudecode-before-using-it.patch
@@ -0,0 +1,45 @@
+From 85f164ec427fecbae24140b3c93acbbe2ba1c817 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 13 Nov 2018 11:27:01 +0800
+Subject: [PATCH] testsuite: check uudecode before using it
+
+The unzip and tar test cases use uudecode command, so also
+check it via optional function.
+
+Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086833.html]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ testsuite/tar.tests | 2 +-
+ testsuite/unzip.tests | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/testsuite/tar.tests b/testsuite/tar.tests
+index d71a349..8c88567 100755
+--- a/testsuite/tar.tests
++++ b/testsuite/tar.tests
+@@ -339,7 +339,7 @@ cd .. || exit 1; rm -rf tar.tempdir 2>/d
+ fi
+
+ mkdir tar.tempdir && cd tar.tempdir || exit 1
+-optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS
++optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS UUDECODE
+ testing "tar Symlink attack: create symlink and then write through it" '\
+ exec 2>&1
+ uudecode -o input && tar xvf input; echo $?
+diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
+index af53de9..3b45ece 100755
+--- a/testsuite/unzip.tests
++++ b/testsuite/unzip.tests
+@@ -31,7 +31,7 @@ rmdir foo
+ rm foo.zip
+
+ # File containing some damaged encrypted stream
+-optional FEATURE_UNZIP_CDF CONFIG_UNICODE_SUPPORT
++optional FEATURE_UNZIP_CDF CONFIG_UNICODE_SUPPORT UUDECODE
+ testing "unzip (bad archive)" "uudecode; unzip bad.zip 2>&1; echo \$?" \
+ "Archive: bad.zip
+ inflating: ]3j½r«I??K-%Ix
+--
+2.7.4
+
diff --git a/meta/recipes-core/busybox/busybox/0001-testsuite-use-www.example.org-for-wget-test-cases.patch b/meta/recipes-core/busybox/busybox/0001-testsuite-use-www.example.org-for-wget-test-cases.patch
new file mode 100644
index 0000000000..7ba0f77fa2
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-testsuite-use-www.example.org-for-wget-test-cases.patch
@@ -0,0 +1,62 @@
+From 03acf460990dfcf6e52b298301b348b9504460a8 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 13 Nov 2018 13:51:42 +0800
+Subject: [PATCH] testsuite: use www.example.org for wget test cases
+
+Use example.org instead of google.com to make sure it's
+always reachible.
+
+Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2018-November/086835.html]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ testsuite/wget/wget--O-overrides--P | 2 +-
+ testsuite/wget/wget-handles-empty-path | 2 +-
+ testsuite/wget/wget-retrieves-google-index | 2 +-
+ testsuite/wget/wget-supports--P | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/testsuite/wget/wget--O-overrides--P b/testsuite/wget/wget--O-overrides--P
+index 40a3a96..490d743 100644
+--- a/testsuite/wget/wget--O-overrides--P
++++ b/testsuite/wget/wget--O-overrides--P
+@@ -1,5 +1,5 @@
+ test x"$SKIP_INTERNET_TESTS" != x"" && exit
+
+ mkdir foo
+-busybox wget -q -O index.html -P foo http://www.google.com/
++busybox wget -q -O index.html -P foo http://www.example.org/
+ test -s index.html
+diff --git a/testsuite/wget/wget-handles-empty-path b/testsuite/wget/wget-handles-empty-path
+index 01d60bd..1802db6 100644
+--- a/testsuite/wget/wget-handles-empty-path
++++ b/testsuite/wget/wget-handles-empty-path
+@@ -1,3 +1,3 @@
+ test x"$SKIP_INTERNET_TESTS" != x"" && exit
+
+-busybox wget http://www.google.com
++busybox wget http://www.example.org
+diff --git a/testsuite/wget/wget-retrieves-google-index b/testsuite/wget/wget-retrieves-google-index
+index f9dbb8b..fc801d4 100644
+--- a/testsuite/wget/wget-retrieves-google-index
++++ b/testsuite/wget/wget-retrieves-google-index
+@@ -1,4 +1,4 @@
+ test x"$SKIP_INTERNET_TESTS" != x"" && exit
+
+-busybox wget -q -O foo http://www.google.com/
++busybox wget -q -O foo http://www.example.org/
+ test -s foo
+diff --git a/testsuite/wget/wget-supports--P b/testsuite/wget/wget-supports--P
+index bfe4ac4..4ff2fe0 100644
+--- a/testsuite/wget/wget-supports--P
++++ b/testsuite/wget/wget-supports--P
+@@ -1,5 +1,5 @@
+ test x"$SKIP_INTERNET_TESTS" != x"" && exit
+
+ mkdir foo
+-busybox wget -q -P foo http://www.google.com/
++busybox wget -q -P foo http://www.example.org/
+ test -s foo/index.html
+--
+2.7.4
+
diff --git a/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch b/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch
deleted file mode 100644
index de2dbcceb1..0000000000
--- a/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Upstream-Status: Pending
-
-# copy commit message from OE as the patch comment:
-# commit 98c24291aa165f53423c27ae033831ce0b3bb676
-# Author: Roman I Khimov <khimov@altell.ru>
-# Date: Thu Mar 26 23:03:58 2009 +0000
-#
-# busybox: update appletlib dependency patch
-#
-# Previous version still failed from time to time on clean-start builds
-# with 4 bitbake threads and '-j16'. Building busybox as sole target worked
-# well.
-#
-# The reason is that previous version introduced a race between applets make
-# processes spawned from top-level Makefile and from libbb Makefile.
-#
-# Fix it with high-level dependency that doesn't create races.
-#
-# Signed-off-by: Koen Kooi <koen@openembedded.org>
-#
-# above comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-06
-
-Index: busybox-1.13.2/Makefile
-===================================================================
---- busybox-1.13.2.orig/Makefile 2009-03-19 15:44:37.419270265 +0300
-+++ busybox-1.13.2/Makefile 2009-03-19 15:45:57.737521296 +0300
-@@ -471,6 +471,10 @@
- util-linux/ \
- util-linux/volume_id/ \
-
-+# Lib interdeps
-+# libbb uses headers generated in applets
-+libbb: applets
-+
- endif # KBUILD_EXTMOD
-
- ifeq ($(dot-config),1)
diff --git a/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch b/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
index 781f5af14a..6faca227f7 100644
--- a/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
+++ b/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
@@ -2,7 +2,7 @@ From: Jason Wessel <jason.wessel@windriver.com>
Date: Sun, 3 Mar 2013 12:31:40 -0600
Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location
-Upstream-status: Submitted
+Upstream-Status: Submitted
[ based on: https://lkml.org/lkml/2013/3/3/103 ]
@@ -33,7 +33,7 @@ cc: linux-kbuild@vger.kernel.org
scripts/kconfig/lxdialog/Makefile | 2 +-
scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
-
+
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,6 +4,10 @@
@@ -44,10 +44,10 @@ cc: linux-kbuild@vger.kernel.org
+ echo "$CROSS_CURSES_LIB"
+ exit
+ fi
- for ext in so a dylib ; do
- for lib in ncursesw ncurses curses ; do
- $cc -print-file-name=lib${lib}.${ext} | grep -q /
-@@ -19,6 +23,10 @@ ldflags()
+ pkg-config --libs ncursesw 2>/dev/null && exit
+ pkg-config --libs ncurses 2>/dev/null && exit
+ for ext in so a dll.a dylib ; do
+@@ -21,6 +25,10 @@
# Where is ncurses.h?
ccflags()
{
@@ -55,12 +55,12 @@ cc: linux-kbuild@vger.kernel.org
+ echo "$CROSS_CURSES_INC"
+ exit
+ fi
- if [ -f /usr/include/ncursesw/ncurses.h ]; then
- echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"'
- elif [ -f /usr/include/ncursesw/curses.h ]; then
+ if pkg-config --cflags ncursesw 2>/dev/null; then
+ echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
+ elif pkg-config --cflags ncurses 2>/dev/null; then
--- a/scripts/kconfig/lxdialog/Makefile
+++ b/scripts/kconfig/lxdialog/Makefile
-@@ -5,7 +5,7 @@ check-lxdialog := $(srctree)/$(src)/che
+@@ -5,7 +5,7 @@
# Use reursively expanded variables so we do not call gcc unless
# we really need to do so. (Do not call gcc as part of make mrproper)
diff --git a/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch b/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch
index 4c9ce3b711..948932a3e8 100644
--- a/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch
+++ b/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch
@@ -28,110 +28,60 @@ Fixed options -b, -a and -P.
Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
---
- networking/udhcp/dhcpc.c | 29 +++++++++++++++++++++--------
- 1 files changed, 21 insertions(+), 8 deletions(-)
+ networking/udhcp/dhcpc.c | 29 ++++++++++++++++------
+ 1 file changed, 21 insertions(+), 8 deletions(-)
-Index: busybox-1.20.2/networking/udhcp/dhcpc.c
+Index: busybox-1.34.0/networking/udhcp/dhcpc.c
===================================================================
---- busybox-1.20.2.orig/networking/udhcp/dhcpc.c
-+++ busybox-1.20.2/networking/udhcp/dhcpc.c
-@@ -29,6 +29,9 @@
- #include <netpacket/packet.h>
- #include <linux/filter.h>
+--- busybox-1.34.0.orig/networking/udhcp/dhcpc.c
++++ busybox-1.34.0/networking/udhcp/dhcpc.c
+@@ -48,6 +48,8 @@
+ };
+ #endif
+/* option whether to down the interface when reconfiguring */
+static int allow_deconfig = 1;
-+
- /* "struct client_config_t client_config" is in bb_common_bufsiz1 */
+ /* "struct client_data_t client_data" is in bb_common_bufsiz1 */
-@@ -81,8 +84,9 @@ enum {
- OPT_x = 1 << 18,
- OPT_f = 1 << 19,
- OPT_B = 1 << 20,
-+ OPT_D = 1 << 21,
+@@ -100,8 +102,10 @@
+ OPT_x = 1 << 16,
+ OPT_f = 1 << 17,
+ OPT_B = 1 << 18,
++ OPT_D = 1 << 19,
/* The rest has variable bit positions, need to be clever */
-- OPTBIT_B = 20,
-+ OPTBIT_D = 21,
+ OPTBIT_B = 18,
++ OPTBIT_D = 19,
USE_FOR_MMU( OPTBIT_b,)
IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
-@@ -1040,7 +1044,8 @@ static void perform_renew(void)
- state = RENEW_REQUESTED;
- break;
- case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- case REQUESTING:
- case RELEASED:
- change_listen_mode(LISTEN_RAW);
-@@ -1064,7 +1069,8 @@ static void perform_release(uint32_t ser
- bb_info_msg("Unicasting a release of %s to %s",
- inet_ntoa(temp_addr), buffer);
- send_release(server_addr, requested_ip); /* unicast */
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- }
- bb_info_msg("Entering released state");
+@@ -587,7 +591,8 @@
+
+ static void d4_run_script_deconfig(void)
+ {
+- d4_run_script(NULL, "deconfig");
++ if (allow_deconfig)
++ d4_run_script(NULL, "deconfig");
+ }
-@@ -1215,7 +1221,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
- /* O,x: list; -T,-t,-A take numeric param */
- opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ;
- IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
-- opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
-+ opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fBD"
+ /*** Sending/receiving packets ***/
+@@ -1244,7 +1249,7 @@
+ /* Parse command line */
+ opt = getopt32long(argv, "^"
+ /* O,x: list; -T,-t,-A take numeric param */
+- "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fB"
++ "CV:F:i:np:qRr:s:T:+t:+SA:+O:*ox:*fBD"
USE_FOR_MMU("b")
- IF_FEATURE_UDHCPC_ARPING("a")
+ IF_FEATURE_UDHCPC_ARPING("a::")
IF_FEATURE_UDHCP_PORT("P:")
-@@ -1316,6 +1322,9 @@ int udhcpc_main(int argc UNUSED_PARAM, c
+@@ -1361,6 +1366,10 @@
logmode |= LOGMODE_SYSLOG;
}
-+ if (opt & OPT_D)
++ if (opt & OPT_D) {
+ allow_deconfig = 0;
++ }
+
- /* Make sure fd 0,1,2 are open */
- bb_sanitize_stdio();
- /* Equivalent of doing a fflush after every \n */
-@@ -1330,7 +1339,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
- srand(monotonic_us());
-
- state = INIT_SELECTING;
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- change_listen_mode(LISTEN_RAW);
- packet_num = 0;
- timeout = 0;
-@@ -1484,7 +1494,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
- }
- /* Timed out, enter init state */
- bb_info_msg("Lease lost, entering init state");
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- state = INIT_SELECTING;
- client_config.first_secs = 0; /* make secs field count from 0 */
- /*timeout = 0; - already is */
-@@ -1667,7 +1678,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
- send_decline(/*xid,*/ server_addr, packet.yiaddr);
-
- if (state != REQUESTING)
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- change_listen_mode(LISTEN_RAW);
- state = INIT_SELECTING;
- client_config.first_secs = 0; /* make secs field count from 0 */
-@@ -1711,7 +1723,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
- bb_info_msg("Received DHCP NAK");
- udhcp_run_script(&packet, "nak");
- if (state != REQUESTING)
-- udhcp_run_script(NULL, "deconfig");
-+ if (allow_deconfig)
-+ udhcp_run_script(NULL, "deconfig");
- change_listen_mode(LISTEN_RAW);
- sleep(3); /* avoid excessive network traffic */
- state = INIT_SELECTING;
+ /* Create pidfile */
+ write_pidfile(client_data.pidfile);
+ /* Goes to stdout (unless NOMMU) and possibly syslog */
diff --git a/meta/recipes-core/busybox/busybox/defconfig b/meta/recipes-core/busybox/busybox/defconfig
index 4f5df9ebee..16c61a84b2 100644
--- a/meta/recipes-core/busybox/busybox/defconfig
+++ b/meta/recipes-core/busybox/busybox/defconfig
@@ -1,58 +1,41 @@
#
# Automatically generated make config: don't edit
-# Busybox version: 1.23.2
-# Thu Jul 30 11:00:00 2015
+# Busybox version: 1.34.0
+# Wed Aug 23 09:07:25 2021
#
CONFIG_HAVE_DOT_CONFIG=y
#
-# Busybox Settings
-#
-
-#
-# General Configuration
+# Settings
#
# CONFIG_DESKTOP is not set
# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_FEDORA_COMPAT is not set
# CONFIG_INCLUDE_SUSv2 is not set
-# CONFIG_USE_PORTABLE_CODE is not set
-CONFIG_PLATFORM_LINUX=y
-CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
-# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
-# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_LONG_OPTS=y
CONFIG_SHOW_USAGE=y
# CONFIG_FEATURE_VERBOSE_USAGE is not set
CONFIG_FEATURE_COMPRESS_USAGE=y
-# CONFIG_FEATURE_INSTALLER is not set
-# CONFIG_INSTALL_NO_USR is not set
-# CONFIG_LOCALE_SUPPORT is not set
-# CONFIG_UNICODE_SUPPORT is not set
-# CONFIG_UNICODE_USING_LOCALE is not set
-# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
-CONFIG_SUBST_WCHAR=0
-CONFIG_LAST_SUPPORTED_WCHAR=0
-# CONFIG_UNICODE_COMBINING_WCHARS is not set
-# CONFIG_UNICODE_WIDE_WCHARS is not set
-# CONFIG_UNICODE_BIDI_SUPPORT is not set
-# CONFIG_UNICODE_NEUTRAL_TABLE is not set
-# CONFIG_UNICODE_PRESERVE_BROKEN is not set
+CONFIG_LFS=y
# CONFIG_PAM is not set
-CONFIG_FEATURE_USE_SENDFILE=y
-CONFIG_LONG_OPTS=y
CONFIG_FEATURE_DEVPTS=y
-# CONFIG_FEATURE_CLEAN_UP is not set
CONFIG_FEATURE_UTMP=y
# CONFIG_FEATURE_WTMP is not set
CONFIG_FEATURE_PIDFILE=y
CONFIG_PID_FILE_PATH="/var/run"
+CONFIG_BUSYBOX=y
+# CONFIG_FEATURE_SHOW_SCRIPT is not set
+# CONFIG_FEATURE_INSTALLER is not set
+# CONFIG_INSTALL_NO_USR is not set
CONFIG_FEATURE_SUID=y
CONFIG_FEATURE_SUID_CONFIG=y
CONFIG_FEATURE_SUID_CONFIG_QUIET=y
-# CONFIG_SELINUX is not set
# CONFIG_FEATURE_PREFER_APPLETS is not set
CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_CLEAN_UP is not set
+CONFIG_FEATURE_SYSLOG_INFO=y
CONFIG_FEATURE_SYSLOG=y
-CONFIG_FEATURE_HAVE_RPC=y
#
# Build Options
@@ -61,25 +44,17 @@ CONFIG_FEATURE_HAVE_RPC=y
# CONFIG_PIE is not set
# CONFIG_NOMMU is not set
# CONFIG_BUILD_LIBBUSYBOX is not set
+# CONFIG_FEATURE_LIBBUSYBOX_STATIC is not set
# CONFIG_FEATURE_INDIVIDUAL is not set
# CONFIG_FEATURE_SHARED_BUSYBOX is not set
-CONFIG_LFS=y
-# CONFIG_CROSS_COMPILER_PREFIX is not set
+CONFIG_CROSS_COMPILER_PREFIX=""
CONFIG_SYSROOT=""
-# CONFIG_EXTRA_CFLAGS is not set
+CONFIG_EXTRA_CFLAGS=""
CONFIG_EXTRA_LDFLAGS=""
CONFIG_EXTRA_LDLIBS=""
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG is not set
-# CONFIG_DEBUG_PESSIMIZE is not set
-# CONFIG_UNIT_TEST is not set
-# CONFIG_WERROR is not set
-CONFIG_NO_DEBUG_LIB=y
-# CONFIG_DMALLOC is not set
-# CONFIG_EFENCE is not set
+# CONFIG_USE_PORTABLE_CODE is not set
+CONFIG_STACK_OPTIMIZATION_386=y
+CONFIG_STATIC_LIBGCC=y
#
# Installation Options ("make install" behavior)
@@ -94,16 +69,34 @@ CONFIG_INSTALL_APPLET_SYMLINKS=y
CONFIG_PREFIX="./_install"
#
-# Busybox Library Tuning
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PESSIMIZE is not set
+# CONFIG_DEBUG_SANITIZE is not set
+# CONFIG_UNIT_TEST is not set
+# CONFIG_WERROR is not set
+# CONFIG_WARN_SIMPLE_MSG is not set
+CONFIG_NO_DEBUG_LIB=y
+# CONFIG_DMALLOC is not set
+# CONFIG_EFENCE is not set
+
+#
+# Library Tuning
#
-CONFIG_FEATURE_SYSTEMD=y
+# CONFIG_FEATURE_USE_BSS_TAIL is not set
+CONFIG_FLOAT_DURATION=y
CONFIG_FEATURE_RTMINMAX=y
+# CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS is not set
+CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
+# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
CONFIG_PASSWORD_MINLEN=6
CONFIG_MD5_SMALL=1
CONFIG_SHA3_SMALL=1
CONFIG_FEATURE_FAST_TOP=y
# CONFIG_FEATURE_ETC_NETWORKS is not set
-CONFIG_FEATURE_USE_TERMIOS=y
+# CONFIG_FEATURE_ETC_SERVICES is not set
CONFIG_FEATURE_EDITING=y
CONFIG_FEATURE_EDITING_MAX_LEN=1024
# CONFIG_FEATURE_EDITING_VI is not set
@@ -114,9 +107,22 @@ CONFIG_FEATURE_EDITING_SAVEHISTORY=y
CONFIG_FEATURE_TAB_COMPLETION=y
CONFIG_FEATURE_USERNAME_COMPLETION=y
CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
+# CONFIG_FEATURE_EDITING_WINCH is not set
# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_UNICODE_SUPPORT=y
+# CONFIG_UNICODE_USING_LOCALE is not set
+CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=767
+CONFIG_UNICODE_COMBINING_WCHARS=y
+CONFIG_UNICODE_WIDE_WCHARS=y
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
CONFIG_FEATURE_NON_POSIX_CP=y
# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
+CONFIG_FEATURE_USE_SENDFILE=y
CONFIG_FEATURE_COPYBUF_KB=4
CONFIG_FEATURE_SKIP_ROOTFS=y
CONFIG_MONOTONIC_SYSCALL=y
@@ -135,86 +141,88 @@ CONFIG_FEATURE_SEAMLESS_LZMA=y
CONFIG_FEATURE_SEAMLESS_BZ2=y
CONFIG_FEATURE_SEAMLESS_GZ=y
CONFIG_FEATURE_SEAMLESS_Z=y
-CONFIG_AR=y
+# CONFIG_AR is not set
# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
# CONFIG_FEATURE_AR_CREATE is not set
# CONFIG_UNCOMPRESS is not set
CONFIG_GUNZIP=y
+CONFIG_ZCAT=y
+CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
CONFIG_BUNZIP2=y
+CONFIG_BZCAT=y
# CONFIG_UNLZMA is not set
-# CONFIG_FEATURE_LZMA_FAST is not set
+CONFIG_LZCAT=y
# CONFIG_LZMA is not set
# CONFIG_UNXZ is not set
+CONFIG_XZCAT=y
# CONFIG_XZ is not set
-# CONFIG_BZIP2 is not set
+CONFIG_BZIP2=y
+CONFIG_BZIP2_SMALL=8
+CONFIG_FEATURE_BZIP2_DECOMPRESS=y
CONFIG_CPIO=y
# CONFIG_FEATURE_CPIO_O is not set
# CONFIG_FEATURE_CPIO_P is not set
# CONFIG_DPKG is not set
# CONFIG_DPKG_DEB is not set
-# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
CONFIG_GZIP=y
# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
CONFIG_GZIP_FAST=0
+# CONFIG_FEATURE_GZIP_LEVELS is not set
+CONFIG_FEATURE_GZIP_DECOMPRESS=y
# CONFIG_LZOP is not set
+# CONFIG_UNLZOP is not set
+# CONFIG_LZOPCAT is not set
# CONFIG_LZOP_COMPR_HIGH is not set
# CONFIG_RPM is not set
# CONFIG_RPM2CPIO is not set
CONFIG_TAR=y
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
CONFIG_FEATURE_TAR_CREATE=y
CONFIG_FEATURE_TAR_AUTODETECT=y
CONFIG_FEATURE_TAR_FROM=y
CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
# CONFIG_FEATURE_TAR_TO_COMMAND is not set
# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
# CONFIG_FEATURE_TAR_SELINUX is not set
CONFIG_UNZIP=y
+CONFIG_FEATURE_UNZIP_CDF=y
+# CONFIG_FEATURE_UNZIP_BZIP2 is not set
+# CONFIG_FEATURE_UNZIP_LZMA is not set
+# CONFIG_FEATURE_UNZIP_XZ is not set
+# CONFIG_FEATURE_LZMA_FAST is not set
#
# Coreutils
#
CONFIG_BASENAME=y
CONFIG_CAT=y
-CONFIG_DATE=y
-# CONFIG_FEATURE_DATE_ISOFMT is not set
-# CONFIG_FEATURE_DATE_NANO is not set
-CONFIG_FEATURE_DATE_COMPAT=y
-# CONFIG_HOSTID is not set
-CONFIG_ID=y
-CONFIG_GROUPS=y
-CONFIG_SHUF=y
-CONFIG_TEST=y
-CONFIG_FEATURE_TEST_64=y
-CONFIG_TOUCH=y
-CONFIG_FEATURE_TOUCH_NODEREF=y
-CONFIG_FEATURE_TOUCH_SUSV3=y
-CONFIG_TR=y
-CONFIG_FEATURE_TR_CLASSES=y
-# CONFIG_FEATURE_TR_EQUIV is not set
-CONFIG_UNLINK=y
-# CONFIG_BASE64 is not set
-CONFIG_WHO=y
-CONFIG_USERS=y
-# CONFIG_CAL is not set
-# CONFIG_CATV is not set
+CONFIG_FEATURE_CATN=y
+# CONFIG_FEATURE_CATV is not set
CONFIG_CHGRP=y
CONFIG_CHMOD=y
CONFIG_CHOWN=y
# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
CONFIG_CHROOT=y
# CONFIG_CKSUM is not set
+CONFIG_CRC32=y
# CONFIG_COMM is not set
CONFIG_CP=y
# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
+# CONFIG_FEATURE_CP_REFLINK is not set
CONFIG_CUT=y
+CONFIG_FEATURE_CUT_REGEX=y
+CONFIG_DATE=y
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+# CONFIG_FEATURE_DATE_NANO is not set
+CONFIG_FEATURE_DATE_COMPAT=y
CONFIG_DD=y
CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
# CONFIG_FEATURE_DD_IBS_OBS is not set
+# CONFIG_FEATURE_DD_STATUS is not set
CONFIG_DF=y
# CONFIG_FEATURE_DF_FANCY is not set
CONFIG_DIRNAME=y
@@ -225,39 +233,54 @@ CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
CONFIG_ECHO=y
CONFIG_FEATURE_FANCY_ECHO=y
CONFIG_ENV=y
-CONFIG_FEATURE_ENV_LONG_OPTIONS=y
# CONFIG_EXPAND is not set
-# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
+# CONFIG_UNEXPAND is not set
CONFIG_EXPR=y
CONFIG_EXPR_MATH_SUPPORT_64=y
+# CONFIG_FACTOR is not set
CONFIG_FALSE=y
# CONFIG_FOLD is not set
-# CONFIG_FSYNC is not set
CONFIG_HEAD=y
# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+CONFIG_ID=y
+CONFIG_GROUPS=y
# CONFIG_INSTALL is not set
# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
+# CONFIG_LINK is not set
CONFIG_LN=y
CONFIG_LOGNAME=y
CONFIG_LS=y
CONFIG_FEATURE_LS_FILETYPES=y
CONFIG_FEATURE_LS_FOLLOWLINKS=y
CONFIG_FEATURE_LS_RECURSIVE=y
+CONFIG_FEATURE_LS_WIDTH=y
CONFIG_FEATURE_LS_SORTFILES=y
CONFIG_FEATURE_LS_TIMESTAMPS=y
CONFIG_FEATURE_LS_USERNAME=y
CONFIG_FEATURE_LS_COLOR=y
# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
CONFIG_MD5SUM=y
+CONFIG_SHA1SUM=y
+CONFIG_SHA256SUM=y
+# CONFIG_SHA512SUM is not set
+# CONFIG_SHA3SUM is not set
+
+#
+# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
+#
+CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
CONFIG_MKDIR=y
-CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y
CONFIG_MKFIFO=y
CONFIG_MKNOD=y
+CONFIG_MKTEMP=y
CONFIG_MV=y
-# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
# CONFIG_NICE is not set
+# CONFIG_NL is not set
CONFIG_NOHUP=y
+CONFIG_NPROC=y
CONFIG_OD=y
+# CONFIG_PASTE is not set
# CONFIG_PRINTENV is not set
CONFIG_PRINTF=y
CONFIG_PWD=y
@@ -266,40 +289,57 @@ CONFIG_FEATURE_READLINK_FOLLOW=y
CONFIG_REALPATH=y
CONFIG_RM=y
CONFIG_RMDIR=y
-# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
CONFIG_SEQ=y
-# CONFIG_SHA1SUM is not set
-# CONFIG_SHA256SUM is not set
-# CONFIG_SHA512SUM is not set
-# CONFIG_SHA3SUM is not set
+# CONFIG_SHRED is not set
+CONFIG_SHUF=y
CONFIG_SLEEP=y
CONFIG_FEATURE_FANCY_SLEEP=y
-# CONFIG_FEATURE_FLOAT_SLEEP is not set
CONFIG_SORT=y
CONFIG_FEATURE_SORT_BIG=y
+# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set
# CONFIG_SPLIT is not set
# CONFIG_FEATURE_SPLIT_FANCY is not set
CONFIG_STAT=y
CONFIG_FEATURE_STAT_FORMAT=y
+CONFIG_FEATURE_STAT_FILESYSTEM=y
CONFIG_STTY=y
# CONFIG_SUM is not set
CONFIG_SYNC=y
+# CONFIG_FEATURE_SYNC_FANCY is not set
+# CONFIG_FSYNC is not set
# CONFIG_TAC is not set
CONFIG_TAIL=y
CONFIG_FEATURE_FANCY_TAIL=y
CONFIG_TEE=y
# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+CONFIG_TEST=y
+CONFIG_TEST1=y
+CONFIG_TEST2=y
+CONFIG_FEATURE_TEST_64=y
+# CONFIG_TIMEOUT is not set
+CONFIG_TOUCH=y
+CONFIG_FEATURE_TOUCH_SUSV3=y
+CONFIG_TR=y
+CONFIG_FEATURE_TR_CLASSES=y
+# CONFIG_FEATURE_TR_EQUIV is not set
CONFIG_TRUE=y
+# CONFIG_TRUNCATE is not set
CONFIG_TTY=y
CONFIG_UNAME=y
-# CONFIG_UNEXPAND is not set
-# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
+CONFIG_UNAME_OSNAME="GNU/Linux"
+# CONFIG_BB_ARCH is not set
CONFIG_UNIQ=y
+CONFIG_UNLINK=y
CONFIG_USLEEP=y
# CONFIG_UUDECODE is not set
+CONFIG_BASE32=y
+# CONFIG_BASE64 is not set
# CONFIG_UUENCODE is not set
CONFIG_WC=y
# CONFIG_FEATURE_WC_LARGE is not set
+CONFIG_WHO=y
+# CONFIG_W is not set
+CONFIG_USERS=y
CONFIG_WHOAMI=y
CONFIG_YES=y
@@ -314,64 +354,61 @@ CONFIG_FEATURE_VERBOSE=y
# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
#
-# Common options for ls, more and telnet
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
# Common options for df, du, ls
#
CONFIG_FEATURE_HUMAN_READABLE=y
#
-# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
-#
-CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
-
-#
# Console Utilities
#
CONFIG_CHVT=y
-# CONFIG_FGCONSOLE is not set
CONFIG_CLEAR=y
CONFIG_DEALLOCVT=y
CONFIG_DUMPKMAP=y
+# CONFIG_FGCONSOLE is not set
# CONFIG_KBD_MODE is not set
CONFIG_LOADFONT=y
-CONFIG_LOADKMAP=y
-CONFIG_OPENVT=y
-CONFIG_RESET=y
-# CONFIG_RESIZE is not set
-# CONFIG_FEATURE_RESIZE_PRINT is not set
-CONFIG_SETCONSOLE=y
-# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
# CONFIG_SETFONT is not set
# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
CONFIG_DEFAULT_SETFONT_DIR=""
-# CONFIG_SETKEYCODES is not set
-# CONFIG_SETLOGCONS is not set
-# CONFIG_SHOWKEY is not set
#
# Common options for loadfont and setfont
#
# CONFIG_FEATURE_LOADFONT_PSF2 is not set
# CONFIG_FEATURE_LOADFONT_RAW is not set
+CONFIG_LOADKMAP=y
+CONFIG_OPENVT=y
+CONFIG_RESET=y
+CONFIG_RESIZE=y
+CONFIG_FEATURE_RESIZE_PRINT=y
+CONFIG_SETCONSOLE=y
+# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
+# CONFIG_SETKEYCODES is not set
+# CONFIG_SETLOGCONS is not set
+# CONFIG_SHOWKEY is not set
#
# Debian Utilities
#
-CONFIG_MKTEMP=y
# CONFIG_PIPE_PROGRESS is not set
CONFIG_RUN_PARTS=y
CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
CONFIG_START_STOP_DAEMON=y
-CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
+CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
CONFIG_WHICH=y
#
+# klibc-utils
+#
+# CONFIG_MINIPS is not set
+# CONFIG_NUKE is not set
+# CONFIG_RESUME is not set
+# CONFIG_RUN_INIT is not set
+
+#
# Editors
#
CONFIG_AWK=y
@@ -388,6 +425,7 @@ CONFIG_VI=y
CONFIG_FEATURE_VI_MAX_LEN=1024
CONFIG_FEATURE_VI_8BIT=y
CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_COLON_EXPAND=y
CONFIG_FEATURE_VI_YANKMARK=y
CONFIG_FEATURE_VI_SEARCH=y
# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
@@ -401,6 +439,7 @@ CONFIG_FEATURE_VI_WIN_RESIZE=y
CONFIG_FEATURE_VI_UNDO=y
CONFIG_FEATURE_VI_UNDO_QUEUE=y
CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256
+CONFIG_FEATURE_VI_VERBOSE_STATUS=y
CONFIG_FEATURE_ALLOW_EXEC=y
#
@@ -412,6 +451,7 @@ CONFIG_FEATURE_FIND_MTIME=y
CONFIG_FEATURE_FIND_MMIN=y
CONFIG_FEATURE_FIND_PERM=y
CONFIG_FEATURE_FIND_TYPE=y
+CONFIG_FEATURE_FIND_EXECUTABLE=y
CONFIG_FEATURE_FIND_XDEV=y
CONFIG_FEATURE_FIND_MAXDEPTH=y
CONFIG_FEATURE_FIND_NEWER=y
@@ -425,14 +465,16 @@ CONFIG_FEATURE_FIND_DEPTH=y
CONFIG_FEATURE_FIND_PAREN=y
CONFIG_FEATURE_FIND_SIZE=y
CONFIG_FEATURE_FIND_PRUNE=y
+CONFIG_FEATURE_FIND_QUIT=y
# CONFIG_FEATURE_FIND_DELETE is not set
+CONFIG_FEATURE_FIND_EMPTY=y
CONFIG_FEATURE_FIND_PATH=y
CONFIG_FEATURE_FIND_REGEX=y
# CONFIG_FEATURE_FIND_CONTEXT is not set
# CONFIG_FEATURE_FIND_LINKS is not set
CONFIG_GREP=y
-CONFIG_FEATURE_GREP_EGREP_ALIAS=y
-CONFIG_FEATURE_GREP_FGREP_ALIAS=y
+CONFIG_EGREP=y
+CONFIG_FGREP=y
CONFIG_FEATURE_GREP_CONTEXT=y
CONFIG_XARGS=y
# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
@@ -440,6 +482,8 @@ CONFIG_XARGS=y
# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
+# CONFIG_FEATURE_XARGS_SUPPORT_PARALLEL is not set
+# CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE is not set
#
# Init Utilities
@@ -447,60 +491,62 @@ CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y
# CONFIG_BOOTCHARTD is not set
# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
-CONFIG_HALT=y
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+CONFIG_REBOOT=y
+# CONFIG_FEATURE_WAIT_FOR_INIT is not set
# CONFIG_FEATURE_CALL_TELINIT is not set
CONFIG_TELINIT_PATH=""
# CONFIG_INIT is not set
+# CONFIG_LINUXRC is not set
# CONFIG_FEATURE_USE_INITTAB is not set
# CONFIG_FEATURE_KILL_REMOVED is not set
CONFIG_FEATURE_KILL_DELAY=0
# CONFIG_FEATURE_INIT_SCTTY is not set
# CONFIG_FEATURE_INIT_SYSLOG is not set
-# CONFIG_FEATURE_EXTRA_QUIET is not set
+# CONFIG_FEATURE_INIT_QUIET is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
-# CONFIG_FEATURE_INITRD is not set
CONFIG_INIT_TERMINAL_TYPE=""
-CONFIG_MESG=y
-# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_FEATURE_INIT_MODIFY_CMDLINE is not set
#
# Login/Password Management Utilities
#
-# CONFIG_ADD_SHELL is not set
-# CONFIG_REMOVE_SHELL is not set
-# CONFIG_FEATURE_SHADOWPASSWDS is not set
+CONFIG_FEATURE_SHADOWPASSWDS=y
# CONFIG_USE_BB_PWD_GRP is not set
# CONFIG_USE_BB_SHADOW is not set
CONFIG_USE_BB_CRYPT=y
# CONFIG_USE_BB_CRYPT_SHA is not set
-# CONFIG_ADDUSER is not set
-# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
+# CONFIG_ADD_SHELL is not set
+# CONFIG_REMOVE_SHELL is not set
+CONFIG_ADDGROUP=y
+# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
+CONFIG_ADDUSER=y
# CONFIG_FEATURE_CHECK_NAMES is not set
CONFIG_LAST_ID=60000
CONFIG_FIRST_SYSTEM_ID=100
CONFIG_LAST_SYSTEM_ID=999
-# CONFIG_ADDGROUP is not set
-# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
-# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
-# CONFIG_DELUSER is not set
-# CONFIG_DELGROUP is not set
+# CONFIG_CHPASSWD is not set
+CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
+# CONFIG_CRYPTPW is not set
+# CONFIG_MKPASSWD is not set
+CONFIG_DELUSER=y
+CONFIG_DELGROUP=y
# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
-# CONFIG_GETTY is not set
-# CONFIG_LOGIN is not set
+CONFIG_GETTY=y
+CONFIG_LOGIN=y
# CONFIG_LOGIN_SESSION_AS_CHILD is not set
# CONFIG_LOGIN_SCRIPTS is not set
# CONFIG_FEATURE_NOLOGIN is not set
# CONFIG_FEATURE_SECURETTY is not set
-# CONFIG_PASSWD is not set
+CONFIG_PASSWD=y
# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
-# CONFIG_CRYPTPW is not set
-# CONFIG_CHPASSWD is not set
-CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
-# CONFIG_SU is not set
+CONFIG_SU=y
# CONFIG_FEATURE_SU_SYSLOG is not set
# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
-# CONFIG_SULOGIN is not set
-# CONFIG_VLOCK is not set
+# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
+CONFIG_SULOGIN=y
+CONFIG_VLOCK=y
#
# Linux Ext2 FS Progs
@@ -513,29 +559,29 @@ CONFIG_FSCK=y
#
# Linux Module Utilities
#
-# CONFIG_MODINFO is not set
# CONFIG_MODPROBE_SMALL is not set
-# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set
-# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
+CONFIG_DEPMOD=y
CONFIG_INSMOD=y
-CONFIG_RMMOD=y
CONFIG_LSMOD=y
# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
+# CONFIG_MODINFO is not set
CONFIG_MODPROBE=y
# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
-CONFIG_DEPMOD=y
+CONFIG_RMMOD=y
#
# Options common to multiple modutils
#
+CONFIG_FEATURE_CMDLINE_MODULE_OPTIONS=y
+# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
# CONFIG_FEATURE_2_4_MODULES is not set
-# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
+# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
CONFIG_FEATURE_MODUTILS_ALIAS=y
CONFIG_FEATURE_MODUTILS_SYMBOLS=y
CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
@@ -544,26 +590,23 @@ CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
#
# Linux System Utilities
#
-# CONFIG_BLOCKDEV is not set
-# CONFIG_FATATTR is not set
-CONFIG_FSTRIM=y
-# CONFIG_MDEV is not set
-# CONFIG_FEATURE_MDEV_CONF is not set
-# CONFIG_FEATURE_MDEV_RENAME is not set
-# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
-# CONFIG_FEATURE_MDEV_EXEC is not set
-# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
-# CONFIG_REV is not set
# CONFIG_ACPID is not set
# CONFIG_FEATURE_ACPID_COMPAT is not set
-# CONFIG_BLKID is not set
-# CONFIG_FEATURE_BLKID_TYPE is not set
+# CONFIG_BLKDISCARD is not set
+CONFIG_BLKID=y
+CONFIG_FEATURE_BLKID_TYPE=y
+# CONFIG_BLOCKDEV is not set
+# CONFIG_CAL is not set
+# CONFIG_CHRT is not set
CONFIG_DMESG=y
CONFIG_FEATURE_DMESG_PRETTY=y
+# CONFIG_EJECT is not set
+# CONFIG_FEATURE_EJECT_SCSI is not set
+# CONFIG_FALLOCATE is not set
+# CONFIG_FATATTR is not set
CONFIG_FBSET=y
CONFIG_FEATURE_FBSET_FANCY=y
CONFIG_FEATURE_FBSET_READMODE=y
-# CONFIG_FDFLUSH is not set
# CONFIG_FDFORMAT is not set
CONFIG_FDISK=y
# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
@@ -576,26 +619,42 @@ CONFIG_FEATURE_FDISK_WRITABLE=y
# CONFIG_FEATURE_FDISK_ADVANCED is not set
# CONFIG_FINDFS is not set
CONFIG_FLOCK=y
+# CONFIG_FDFLUSH is not set
# CONFIG_FREERAMDISK is not set
# CONFIG_FSCK_MINIX is not set
-# CONFIG_MKFS_EXT2 is not set
-# CONFIG_MKFS_MINIX is not set
-# CONFIG_FEATURE_MINIX2 is not set
-# CONFIG_MKFS_REISER is not set
-# CONFIG_MKFS_VFAT is not set
-# CONFIG_GETOPT is not set
-# CONFIG_FEATURE_GETOPT_LONG is not set
+# CONFIG_FSFREEZE is not set
+CONFIG_FSTRIM=y
+CONFIG_GETOPT=y
+CONFIG_FEATURE_GETOPT_LONG=y
CONFIG_HEXDUMP=y
-# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
# CONFIG_HD is not set
+# CONFIG_XXD is not set
CONFIG_HWCLOCK=y
-CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
+# CONFIG_IONICE is not set
# CONFIG_IPCRM is not set
# CONFIG_IPCS is not set
+# CONFIG_LAST is not set
+# CONFIG_FEATURE_LAST_FANCY is not set
CONFIG_LOSETUP=y
# CONFIG_LSPCI is not set
# CONFIG_LSUSB is not set
+# CONFIG_MDEV is not set
+# CONFIG_FEATURE_MDEV_CONF is not set
+# CONFIG_FEATURE_MDEV_RENAME is not set
+# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
+# CONFIG_FEATURE_MDEV_EXEC is not set
+# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+# CONFIG_FEATURE_MDEV_DAEMON is not set
+CONFIG_MESG=y
+# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
+# CONFIG_MKE2FS is not set
+# CONFIG_MKFS_EXT2 is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_FEATURE_MINIX2 is not set
+# CONFIG_MKFS_REISER is not set
+# CONFIG_MKDOSFS is not set
+# CONFIG_MKFS_VFAT is not set
CONFIG_MKSWAP=y
# CONFIG_FEATURE_MKSWAP_UUID is not set
CONFIG_MORE=y
@@ -603,25 +662,47 @@ CONFIG_MOUNT=y
# CONFIG_FEATURE_MOUNT_FAKE is not set
# CONFIG_FEATURE_MOUNT_VERBOSE is not set
# CONFIG_FEATURE_MOUNT_HELPERS is not set
-# CONFIG_FEATURE_MOUNT_LABEL is not set
-CONFIG_FEATURE_MOUNT_NFS=y
+CONFIG_FEATURE_MOUNT_LABEL=y
+# CONFIG_FEATURE_MOUNT_NFS is not set
# CONFIG_FEATURE_MOUNT_CIFS is not set
CONFIG_FEATURE_MOUNT_FLAGS=y
CONFIG_FEATURE_MOUNT_FSTAB=y
+# CONFIG_FEATURE_MOUNT_OTHERTAB is not set
+CONFIG_MOUNTPOINT=y
+# CONFIG_NOLOGIN is not set
+# CONFIG_NOLOGIN_DEPENDENCIES is not set
+# CONFIG_NSENTER is not set
CONFIG_PIVOT_ROOT=y
CONFIG_RDATE=y
# CONFIG_RDEV is not set
# CONFIG_READPROFILE is not set
+CONFIG_RENICE=y
+CONFIG_REV=y
# CONFIG_RTCWAKE is not set
# CONFIG_SCRIPT is not set
# CONFIG_SCRIPTREPLAY is not set
# CONFIG_SETARCH is not set
-CONFIG_SWAPONOFF=y
+# CONFIG_LINUX32 is not set
+# CONFIG_LINUX64 is not set
+# CONFIG_SETPRIV is not set
+# CONFIG_FEATURE_SETPRIV_DUMP is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITIES is not set
+# CONFIG_FEATURE_SETPRIV_CAPABILITY_NAMES is not set
+CONFIG_SETSID=y
+CONFIG_SWAPON=y
CONFIG_FEATURE_SWAPON_DISCARD=y
CONFIG_FEATURE_SWAPON_PRI=y
+CONFIG_SWAPOFF=y
+# CONFIG_FEATURE_SWAPONOFF_LABEL is not set
CONFIG_SWITCH_ROOT=y
+# CONFIG_TASKSET is not set
+# CONFIG_FEATURE_TASKSET_FANCY is not set
+# CONFIG_FEATURE_TASKSET_CPULIST is not set
+# CONFIG_UEVENT is not set
CONFIG_UMOUNT=y
CONFIG_FEATURE_UMOUNT_ALL=y
+# CONFIG_UNSHARE is not set
+# CONFIG_WALL is not set
#
# Common options for mount/umount
@@ -629,63 +710,51 @@ CONFIG_FEATURE_UMOUNT_ALL=y
CONFIG_FEATURE_MOUNT_LOOP=y
CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
# CONFIG_FEATURE_MTAB_SUPPORT is not set
-# CONFIG_VOLUMEID is not set
-# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
+CONFIG_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+# CONFIG_FEATURE_VOLUMEID_BCACHE is not set
+CONFIG_FEATURE_VOLUMEID_BTRFS=y
# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
+CONFIG_FEATURE_VOLUMEID_EROFS=y
# CONFIG_FEATURE_VOLUMEID_EXFAT is not set
-# CONFIG_FEATURE_VOLUMEID_EXT is not set
-# CONFIG_FEATURE_VOLUMEID_F2FS is not set
-# CONFIG_FEATURE_VOLUMEID_FAT is not set
+CONFIG_FEATURE_VOLUMEID_EXT=y
+CONFIG_FEATURE_VOLUMEID_F2FS=y
+CONFIG_FEATURE_VOLUMEID_FAT=y
# CONFIG_FEATURE_VOLUMEID_HFS is not set
# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
# CONFIG_FEATURE_VOLUMEID_JFS is not set
+# CONFIG_FEATURE_VOLUMEID_LFS is not set
# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
# CONFIG_FEATURE_VOLUMEID_LUKS is not set
+# CONFIG_FEATURE_VOLUMEID_MINIX is not set
# CONFIG_FEATURE_VOLUMEID_NILFS is not set
# CONFIG_FEATURE_VOLUMEID_NTFS is not set
# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
-# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
+CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
# CONFIG_FEATURE_VOLUMEID_SYSV is not set
+# CONFIG_FEATURE_VOLUMEID_UBIFS is not set
# CONFIG_FEATURE_VOLUMEID_UDF is not set
# CONFIG_FEATURE_VOLUMEID_XFS is not set
#
# Miscellaneous Utilities
#
-# CONFIG_CONSPY is not set
-# CONFIG_CROND is not set
-# CONFIG_FEATURE_CROND_D is not set
-# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
-CONFIG_FEATURE_CROND_DIR=""
-CONFIG_LESS=y
-CONFIG_FEATURE_LESS_MAXLINES=9999999
-CONFIG_FEATURE_LESS_BRACKETS=y
-CONFIG_FEATURE_LESS_FLAGS=y
-# CONFIG_FEATURE_LESS_MARKS is not set
-# CONFIG_FEATURE_LESS_REGEXP is not set
-# CONFIG_FEATURE_LESS_WINCH is not set
-# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
-# CONFIG_FEATURE_LESS_DASHCMD is not set
-# CONFIG_FEATURE_LESS_LINENUMS is not set
-# CONFIG_NANDWRITE is not set
-# CONFIG_NANDDUMP is not set
-CONFIG_RFKILL=y
-# CONFIG_SETSERIAL is not set
-# CONFIG_TASKSET is not set
-# CONFIG_FEATURE_TASKSET_FANCY is not set
-# CONFIG_UBIATTACH is not set
-# CONFIG_UBIDETACH is not set
-# CONFIG_UBIMKVOL is not set
-# CONFIG_UBIRMVOL is not set
-# CONFIG_UBIRSVOL is not set
-# CONFIG_UBIUPDATEVOL is not set
-# CONFIG_WALL is not set
# CONFIG_ADJTIMEX is not set
+CONFIG_ASCII=y
# CONFIG_BBCONFIG is not set
# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
+# CONFIG_BC is not set
+CONFIG_DC=y
+# CONFIG_FEATURE_DC_BIG is not set
+# CONFIG_FEATURE_DC_LIBM is not set
+# CONFIG_FEATURE_BC_INTERACTIVE is not set
+# CONFIG_FEATURE_BC_LONG_OPTIONS is not set
# CONFIG_BEEP is not set
CONFIG_FEATURE_BEEP_FREQ=0
CONFIG_FEATURE_BEEP_LENGTH_MS=0
@@ -697,28 +766,24 @@ CONFIG_FEATURE_BEEP_LENGTH_MS=0
# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
-# CONFIG_CHRT is not set
+# CONFIG_CONSPY is not set
+# CONFIG_CROND is not set
+# CONFIG_FEATURE_CROND_D is not set
+# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
+# CONFIG_FEATURE_CROND_SPECIAL_TIMES is not set
+CONFIG_FEATURE_CROND_DIR=""
# CONFIG_CRONTAB is not set
-CONFIG_DC=y
-# CONFIG_FEATURE_DC_LIBM is not set
# CONFIG_DEVFSD is not set
# CONFIG_DEVFSD_MODLOAD is not set
# CONFIG_DEVFSD_FG_NP is not set
# CONFIG_DEVFSD_VERBOSE is not set
# CONFIG_FEATURE_DEVFS is not set
# CONFIG_DEVMEM is not set
-# CONFIG_EJECT is not set
-# CONFIG_FEATURE_EJECT_SCSI is not set
# CONFIG_FBSPLASH is not set
-# CONFIG_FLASHCP is not set
+# CONFIG_FLASH_ERASEALL is not set
# CONFIG_FLASH_LOCK is not set
# CONFIG_FLASH_UNLOCK is not set
-# CONFIG_FLASH_ERASEALL is not set
-# CONFIG_IONICE is not set
-# CONFIG_INOTIFYD is not set
-# CONFIG_LAST is not set
-# CONFIG_FEATURE_LAST_SMALL is not set
-# CONFIG_FEATURE_LAST_FANCY is not set
+# CONFIG_FLASHCP is not set
# CONFIG_HDPARM is not set
# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
@@ -726,43 +791,67 @@ CONFIG_DC=y
# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
+# CONFIG_HEXEDIT is not set
+# CONFIG_I2CGET is not set
+# CONFIG_I2CSET is not set
+# CONFIG_I2CDUMP is not set
+# CONFIG_I2CDETECT is not set
+# CONFIG_I2CTRANSFER is not set
+# CONFIG_INOTIFYD is not set
+CONFIG_LESS=y
+CONFIG_FEATURE_LESS_MAXLINES=9999999
+CONFIG_FEATURE_LESS_BRACKETS=y
+CONFIG_FEATURE_LESS_FLAGS=y
+# CONFIG_FEATURE_LESS_TRUNCATE is not set
+# CONFIG_FEATURE_LESS_MARKS is not set
+# CONFIG_FEATURE_LESS_REGEXP is not set
+# CONFIG_FEATURE_LESS_WINCH is not set
+# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
+# CONFIG_FEATURE_LESS_DASHCMD is not set
+# CONFIG_FEATURE_LESS_LINENUMS is not set
+# CONFIG_FEATURE_LESS_RAW is not set
+# CONFIG_FEATURE_LESS_ENV is not set
+# CONFIG_LSSCSI is not set
# CONFIG_MAKEDEVS is not set
# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
# CONFIG_MAN is not set
CONFIG_MICROCOM=y
-# CONFIG_MOUNTPOINT is not set
+# CONFIG_MIM is not set
# CONFIG_MT is not set
+# CONFIG_NANDWRITE is not set
+# CONFIG_NANDDUMP is not set
+# CONFIG_PARTPROBE is not set
# CONFIG_RAIDAUTORUN is not set
# CONFIG_READAHEAD is not set
+CONFIG_RFKILL=y
# CONFIG_RUNLEVEL is not set
# CONFIG_RX is not set
-# CONFIG_SETSID is not set
+# CONFIG_SETFATTR is not set
+# CONFIG_SETSERIAL is not set
CONFIG_STRINGS=y
CONFIG_TIME=y
-# CONFIG_TIMEOUT is not set
+CONFIG_TS=y
# CONFIG_TTYSIZE is not set
+# CONFIG_UBIATTACH is not set
+# CONFIG_UBIDETACH is not set
+# CONFIG_UBIMKVOL is not set
+# CONFIG_UBIRMVOL is not set
+# CONFIG_UBIRSVOL is not set
+# CONFIG_UBIUPDATEVOL is not set
+# CONFIG_UBIRENAME is not set
# CONFIG_VOLNAME is not set
# CONFIG_WATCHDOG is not set
+# CONFIG_FEATURE_WATCHDOG_OPEN_TWICE is not set
#
# Networking Utilities
#
-# CONFIG_NAMEIF is not set
-# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
-# CONFIG_NBDCLIENT is not set
-CONFIG_NC=y
-# CONFIG_NC_SERVER is not set
-# CONFIG_NC_EXTRA is not set
-# CONFIG_NC_110_COMPAT is not set
-CONFIG_PING=y
-CONFIG_PING6=y
-CONFIG_FEATURE_FANCY_PING=y
-# CONFIG_WHOIS is not set
CONFIG_FEATURE_IPV6=y
# CONFIG_FEATURE_UNIX_LOCAL is not set
CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
+# CONFIG_FEATURE_TLS_SHA1 is not set
# CONFIG_ARP is not set
# CONFIG_ARPING is not set
# CONFIG_BRCTL is not set
@@ -770,15 +859,15 @@ CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
# CONFIG_FEATURE_BRCTL_SHOW is not set
# CONFIG_DNSD is not set
# CONFIG_ETHER_WAKE is not set
-# CONFIG_FAKEIDENTD is not set
# CONFIG_FTPD is not set
-# CONFIG_FEATURE_FTP_WRITE is not set
+# CONFIG_FEATURE_FTPD_WRITE is not set
# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
-# CONFIG_FEATURE_FTP_AUTHENTICATION is not set
+# CONFIG_FEATURE_FTPD_AUTHENTICATION is not set
# CONFIG_FTPGET is not set
# CONFIG_FTPPUT is not set
# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
CONFIG_HOSTNAME=y
+CONFIG_DNSDOMAINNAME=y
# CONFIG_HTTPD is not set
# CONFIG_FEATURE_HTTPD_RANGES is not set
# CONFIG_FEATURE_HTTPD_SETUID is not set
@@ -791,6 +880,10 @@ CONFIG_HOSTNAME=y
# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
# CONFIG_FEATURE_HTTPD_PROXY is not set
# CONFIG_FEATURE_HTTPD_GZIP is not set
+# CONFIG_FEATURE_HTTPD_ETAG is not set
+# CONFIG_FEATURE_HTTPD_LAST_MODIFIED is not set
+# CONFIG_FEATURE_HTTPD_DATE is not set
+# CONFIG_FEATURE_HTTPD_ACL_IP is not set
CONFIG_IFCONFIG=y
CONFIG_FEATURE_IFCONFIG_STATUS=y
# CONFIG_FEATURE_IFCONFIG_SLIP is not set
@@ -799,11 +892,10 @@ CONFIG_FEATURE_IFCONFIG_HW=y
# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
# CONFIG_IFENSLAVE is not set
# CONFIG_IFPLUGD is not set
-CONFIG_IFUPDOWN=y
+CONFIG_IFUP=y
+CONFIG_IFDOWN=y
CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
-# CONFIG_FEATURE_IFUPDOWN_IP is not set
-# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
-CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN=y
+CONFIG_FEATURE_IFUPDOWN_IP=y
CONFIG_FEATURE_IFUPDOWN_IPV4=y
CONFIG_FEATURE_IFUPDOWN_IPV6=y
CONFIG_FEATURE_IFUPDOWN_MAPPING=y
@@ -816,81 +908,111 @@ CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y
# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
# CONFIG_FEATURE_INETD_RPC is not set
CONFIG_IP=y
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_IPRULE is not set
+# CONFIG_IPNEIGH is not set
CONFIG_FEATURE_IP_ADDRESS=y
CONFIG_FEATURE_IP_LINK=y
CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2"
CONFIG_FEATURE_IP_TUNNEL=y
# CONFIG_FEATURE_IP_RULE is not set
-# CONFIG_FEATURE_IP_SHORT_FORMS is not set
+# CONFIG_FEATURE_IP_NEIGH is not set
# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
-# CONFIG_IPADDR is not set
-# CONFIG_IPLINK is not set
-# CONFIG_IPROUTE is not set
-# CONFIG_IPTUNNEL is not set
-# CONFIG_IPRULE is not set
# CONFIG_IPCALC is not set
-# CONFIG_FEATURE_IPCALC_FANCY is not set
# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
+# CONFIG_FEATURE_IPCALC_FANCY is not set
+# CONFIG_FAKEIDENTD is not set
+# CONFIG_NAMEIF is not set
+# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
+# CONFIG_NBDCLIENT is not set
+CONFIG_NC=y
+# CONFIG_NETCAT is not set
+# CONFIG_NC_SERVER is not set
+# CONFIG_NC_EXTRA is not set
+# CONFIG_NC_110_COMPAT is not set
CONFIG_NETSTAT=y
# CONFIG_FEATURE_NETSTAT_WIDE is not set
# CONFIG_FEATURE_NETSTAT_PRG is not set
CONFIG_NSLOOKUP=y
+# CONFIG_FEATURE_NSLOOKUP_BIG is not set
+# CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS is not set
# CONFIG_NTPD is not set
# CONFIG_FEATURE_NTPD_SERVER is not set
# CONFIG_FEATURE_NTPD_CONF is not set
+# CONFIG_FEATURE_NTP_AUTH is not set
+CONFIG_PING=y
+CONFIG_PING6=y
+CONFIG_FEATURE_FANCY_PING=y
# CONFIG_PSCAN is not set
CONFIG_ROUTE=y
# CONFIG_SLATTACH is not set
+# CONFIG_SSL_CLIENT is not set
+# CONFIG_TC is not set
+# CONFIG_FEATURE_TC_INGRESS is not set
# CONFIG_TCPSVD is not set
+# CONFIG_UDPSVD is not set
CONFIG_TELNET=y
# CONFIG_FEATURE_TELNET_TTYPE is not set
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
+CONFIG_FEATURE_TELNET_WIDTH=y
# CONFIG_TELNETD is not set
# CONFIG_FEATURE_TELNETD_STANDALONE is not set
# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
CONFIG_TFTP=y
+# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
+CONFIG_FEATURE_TFTP_HPA_COMPAT=y
# CONFIG_TFTPD is not set
-
-#
-# Common options for tftp/tftpd
-#
CONFIG_FEATURE_TFTP_GET=y
CONFIG_FEATURE_TFTP_PUT=y
# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
# CONFIG_TFTP_DEBUG is not set
+CONFIG_TLS=y
CONFIG_TRACEROUTE=y
# CONFIG_TRACEROUTE6 is not set
# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
-# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
# CONFIG_TUNCTL is not set
# CONFIG_FEATURE_TUNCTL_UG is not set
-# CONFIG_UDHCPC6 is not set
+# CONFIG_VCONFIG is not set
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_LONG_OPTIONS=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_FTP=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+CONFIG_FEATURE_WGET_TIMEOUT=y
+CONFIG_FEATURE_WGET_HTTPS=y
+# CONFIG_FEATURE_WGET_OPENSSL is not set
+# CONFIG_WHOIS is not set
+# CONFIG_ZCIP is not set
CONFIG_UDHCPD=y
-# CONFIG_DHCPRELAY is not set
-CONFIG_DUMPLEASES=y
-# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
+# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
+CONFIG_DUMPLEASES=y
+# CONFIG_DHCPRELAY is not set
CONFIG_UDHCPC=y
CONFIG_FEATURE_UDHCPC_ARPING=y
CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y
+CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
+# CONFIG_UDHCPC6 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC3646 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4704 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC4833 is not set
+# CONFIG_FEATURE_UDHCPC6_RFC5970 is not set
+
+#
+# Common options for DHCP applets
+#
# CONFIG_FEATURE_UDHCP_PORT is not set
CONFIG_UDHCP_DEBUG=0
-# CONFIG_FEATURE_UDHCP_RFC3397 is not set
-# CONFIG_FEATURE_UDHCP_8021Q is not set
-CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
-CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
-# CONFIG_UDPSVD is not set
-# CONFIG_VCONFIG is not set
-CONFIG_WGET=y
-CONFIG_FEATURE_WGET_STATUSBAR=y
-CONFIG_FEATURE_WGET_AUTHENTICATION=y
-CONFIG_FEATURE_WGET_LONG_OPTIONS=y
-CONFIG_FEATURE_WGET_TIMEOUT=y
-# CONFIG_ZCIP is not set
+CONFIG_FEATURE_UDHCP_RFC3397=y
+# CONFIG_FEATURE_UDHCP_8021Q is not set
+CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b"
#
# Print Utilities
@@ -903,26 +1025,45 @@ CONFIG_FEATURE_WGET_TIMEOUT=y
# Mail Utilities
#
# CONFIG_MAKEMIME is not set
-CONFIG_FEATURE_MIME_CHARSET=""
# CONFIG_POPMAILDIR is not set
# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
# CONFIG_REFORMIME is not set
# CONFIG_FEATURE_REFORMIME_COMPAT is not set
# CONFIG_SENDMAIL is not set
+CONFIG_FEATURE_MIME_CHARSET=""
#
# Process Utilities
#
+CONFIG_FREE=y
+CONFIG_FUSER=y
# CONFIG_IOSTAT is not set
+CONFIG_KILL=y
+CONFIG_KILLALL=y
+# CONFIG_KILLALL5 is not set
# CONFIG_LSOF is not set
# CONFIG_MPSTAT is not set
# CONFIG_NMETER is not set
+CONFIG_PGREP=y
+# CONFIG_PKILL is not set
+CONFIG_PIDOF=y
+# CONFIG_FEATURE_PIDOF_SINGLE is not set
+# CONFIG_FEATURE_PIDOF_OMIT is not set
# CONFIG_PMAP is not set
# CONFIG_POWERTOP is not set
+# CONFIG_FEATURE_POWERTOP_INTERACTIVE is not set
+CONFIG_PS=y
+CONFIG_FEATURE_PS_WIDE=y
+CONFIG_FEATURE_PS_LONG=y
+# CONFIG_FEATURE_PS_TIME is not set
+# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
+# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
# CONFIG_PSTREE is not set
# CONFIG_PWDX is not set
# CONFIG_SMEMCAP is not set
+CONFIG_BB_SYSCTL=y
CONFIG_TOP=y
+# CONFIG_FEATURE_TOP_INTERACTIVE is not set
CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
# CONFIG_FEATURE_TOP_SMP_CPU is not set
@@ -931,80 +1072,74 @@ CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
# CONFIG_FEATURE_TOPMEM is not set
CONFIG_UPTIME=y
# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
-CONFIG_FREE=y
-CONFIG_FUSER=y
-CONFIG_KILL=y
-CONFIG_KILLALL=y
-# CONFIG_KILLALL5 is not set
-# CONFIG_PGREP is not set
-CONFIG_PIDOF=y
-# CONFIG_FEATURE_PIDOF_SINGLE is not set
-# CONFIG_FEATURE_PIDOF_OMIT is not set
-# CONFIG_PKILL is not set
-CONFIG_PS=y
-CONFIG_FEATURE_PS_WIDE=y
-CONFIG_FEATURE_PS_LONG=y
-# CONFIG_FEATURE_PS_TIME is not set
-# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
-# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
-CONFIG_RENICE=y
-CONFIG_BB_SYSCTL=y
-# CONFIG_FEATURE_SHOW_THREADS is not set
CONFIG_WATCH=y
+# CONFIG_FEATURE_SHOW_THREADS is not set
#
# Runit Utilities
#
+# CONFIG_CHPST is not set
+# CONFIG_SETUIDGID is not set
+# CONFIG_ENVUIDGID is not set
+# CONFIG_ENVDIR is not set
+# CONFIG_SOFTLIMIT is not set
# CONFIG_RUNSV is not set
# CONFIG_RUNSVDIR is not set
# CONFIG_FEATURE_RUNSVDIR_LOG is not set
# CONFIG_SV is not set
CONFIG_SV_DEFAULT_SERVICE_DIR=""
+# CONFIG_SVC is not set
+# CONFIG_SVOK is not set
# CONFIG_SVLOGD is not set
-# CONFIG_CHPST is not set
-# CONFIG_SETUIDGID is not set
-# CONFIG_ENVUIDGID is not set
-# CONFIG_ENVDIR is not set
-# CONFIG_SOFTLIMIT is not set
# CONFIG_CHCON is not set
-# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
# CONFIG_GETENFORCE is not set
# CONFIG_GETSEBOOL is not set
# CONFIG_LOAD_POLICY is not set
# CONFIG_MATCHPATHCON is not set
-# CONFIG_RESTORECON is not set
# CONFIG_RUNCON is not set
-# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
# CONFIG_SELINUXENABLED is not set
+# CONFIG_SESTATUS is not set
# CONFIG_SETENFORCE is not set
# CONFIG_SETFILES is not set
# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
+# CONFIG_RESTORECON is not set
# CONFIG_SETSEBOOL is not set
-# CONFIG_SESTATUS is not set
#
# Shells
#
+CONFIG_SH_IS_ASH=y
+# CONFIG_SH_IS_HUSH is not set
+# CONFIG_SH_IS_NONE is not set
+# CONFIG_BASH_IS_ASH is not set
+# CONFIG_BASH_IS_HUSH is not set
+CONFIG_BASH_IS_NONE=y
+CONFIG_SHELL_ASH=y
CONFIG_ASH=y
+CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
+CONFIG_ASH_INTERNAL_GLOB=y
CONFIG_ASH_BASH_COMPAT=y
-# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_BASH_SOURCE_CURDIR is not set
+CONFIG_ASH_BASH_NOT_FOUND_HOOK=y
CONFIG_ASH_JOB_CONTROL=y
CONFIG_ASH_ALIAS=y
-CONFIG_ASH_GETOPTS=y
-CONFIG_ASH_BUILTIN_ECHO=y
-CONFIG_ASH_BUILTIN_PRINTF=y
-CONFIG_ASH_BUILTIN_TEST=y
-CONFIG_ASH_HELP=y
-# CONFIG_ASH_CMDCMD is not set
-# CONFIG_ASH_MAIL is not set
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
# CONFIG_ASH_RANDOM_SUPPORT is not set
CONFIG_ASH_EXPAND_PRMT=y
+# CONFIG_ASH_IDLE_TIMEOUT is not set
+# CONFIG_ASH_MAIL is not set
+CONFIG_ASH_ECHO=y
+CONFIG_ASH_PRINTF=y
+CONFIG_ASH_TEST=y
+CONFIG_ASH_HELP=y
+CONFIG_ASH_GETOPTS=y
+CONFIG_ASH_CMDCMD=y
# CONFIG_CTTYHACK is not set
# CONFIG_HUSH is not set
+# CONFIG_SHELL_HUSH is not set
# CONFIG_HUSH_BASH_COMPAT is not set
# CONFIG_HUSH_BRACE_EXPANSION is not set
-# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_LINENO_VAR is not set
+# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set
# CONFIG_HUSH_INTERACTIVE is not set
# CONFIG_HUSH_SAVEHISTORY is not set
# CONFIG_HUSH_JOB is not set
@@ -1015,40 +1150,60 @@ CONFIG_ASH_EXPAND_PRMT=y
# CONFIG_HUSH_FUNCTIONS is not set
# CONFIG_HUSH_LOCAL is not set
# CONFIG_HUSH_RANDOM_SUPPORT is not set
-# CONFIG_HUSH_EXPORT_N is not set
# CONFIG_HUSH_MODE_X is not set
-# CONFIG_MSH is not set
-CONFIG_FEATURE_SH_IS_ASH=y
-# CONFIG_FEATURE_SH_IS_HUSH is not set
-# CONFIG_FEATURE_SH_IS_NONE is not set
-# CONFIG_FEATURE_BASH_IS_ASH is not set
-# CONFIG_FEATURE_BASH_IS_HUSH is not set
-CONFIG_FEATURE_BASH_IS_NONE=y
-CONFIG_SH_MATH_SUPPORT=y
-# CONFIG_SH_MATH_SUPPORT_64 is not set
+# CONFIG_HUSH_ECHO is not set
+# CONFIG_HUSH_PRINTF is not set
+# CONFIG_HUSH_TEST is not set
+# CONFIG_HUSH_HELP is not set
+# CONFIG_HUSH_EXPORT is not set
+# CONFIG_HUSH_EXPORT_N is not set
+# CONFIG_HUSH_READONLY is not set
+# CONFIG_HUSH_KILL is not set
+# CONFIG_HUSH_WAIT is not set
+# CONFIG_HUSH_COMMAND is not set
+# CONFIG_HUSH_TRAP is not set
+# CONFIG_HUSH_TYPE is not set
+# CONFIG_HUSH_TIMES is not set
+# CONFIG_HUSH_READ is not set
+# CONFIG_HUSH_SET is not set
+# CONFIG_HUSH_UNSET is not set
+# CONFIG_HUSH_ULIMIT is not set
+# CONFIG_HUSH_UMASK is not set
+# CONFIG_HUSH_GETOPTS is not set
+# CONFIG_HUSH_MEMLEAK is not set
+
+#
+# Options common to all shells
+#
+CONFIG_FEATURE_SH_MATH=y
+# CONFIG_FEATURE_SH_MATH_64 is not set
+CONFIG_FEATURE_SH_MATH_BASE=y
CONFIG_FEATURE_SH_EXTRA_QUIET=y
# CONFIG_FEATURE_SH_STANDALONE is not set
# CONFIG_FEATURE_SH_NOFORK is not set
+# CONFIG_FEATURE_SH_READ_FRAC is not set
CONFIG_FEATURE_SH_HISTFILESIZE=y
+# CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS is not set
#
# System Logging Utilities
#
+CONFIG_KLOGD=y
+
+#
+# klogd should not be used together with syslog to kernel printk buffer
+#
+CONFIG_FEATURE_KLOGD_KLOGCTL=y
+CONFIG_LOGGER=y
+CONFIG_LOGREAD=y
+CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_SYSLOGD=y
CONFIG_FEATURE_ROTATE_LOGFILE=y
CONFIG_FEATURE_REMOTE_LOG=y
CONFIG_FEATURE_SYSLOGD_DUP=y
CONFIG_FEATURE_SYSLOGD_CFG=y
+# CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set
CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
CONFIG_FEATURE_IPC_SYSLOG=y
CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
-CONFIG_LOGREAD=y
-CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
CONFIG_FEATURE_KMSG_SYSLOG=y
-CONFIG_KLOGD=y
-
-#
-# klogd should not be used together with syslog to kernel printk buffer
-#
-CONFIG_FEATURE_KLOGD_KLOGCTL=y
-CONFIG_LOGGER=y
diff --git a/meta/recipes-core/busybox/busybox/fail_on_no_media.patch b/meta/recipes-core/busybox/busybox/fail_on_no_media.patch
index 6745f169fe..820acc2684 100644
--- a/meta/recipes-core/busybox/busybox/fail_on_no_media.patch
+++ b/meta/recipes-core/busybox/busybox/fail_on_no_media.patch
@@ -1,4 +1,5 @@
-Upstream-Status: Pending
+Upstream-Status: Denied
+[https://www.mail-archive.com/busybox@busybox.net/msg22354.html]
The current behaviour of busybox is to try all fstype when automounting
even when no media exists. The util-linux mount command bails when no
diff --git a/meta/recipes-core/busybox/busybox/get_header_tar.patch b/meta/recipes-core/busybox/busybox/get_header_tar.patch
deleted file mode 100644
index 0e528ff91f..0000000000
--- a/meta/recipes-core/busybox/busybox/get_header_tar.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Upstream-Status: Pending
-
-# copy commit message from OE as the patch comment:
-# commit 5a0e1d473ca7aca5ffefffe9a2ec44ae7a1f35bc
-# Author: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
-# Date: Wed Feb 11 22:40:21 2009 +0100
-#
-# busybox: fix tar problem with filenames that are exactly 100 bytes
-#
-# above comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-06
-
---- busybox-1.13.2/archival/libarchive/get_header_tar.c.orig 2008-11-09 18:28:02.000000000 +0100
-+++ busybox-1.13.2/archival/libarchive/get_header_tar.c 2009-02-11 22:34:52.000000000 +0100
-@@ -252,6 +252,8 @@
- file_header->name = concat_path_file(tar.prefix, tar.name);
- } else
- file_header->name = xstrdup(tar.name);
-+ if (strlen(file_header->name) > 100)
-+ file_header->name[100] = 0;
- }
-
- /* Set bits 12-15 of the files mode */
diff --git a/meta/recipes-core/busybox/busybox/getopts.cfg b/meta/recipes-core/busybox/busybox/getopts.cfg
new file mode 100644
index 0000000000..8db0a4a8f2
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/getopts.cfg
@@ -0,0 +1,3 @@
+CONFIG_GETOPT=y
+CONFIG_LONG_OPTS=y
+CONFIG_FEATURE_GETOPT_LONG=y
diff --git a/meta/recipes-core/busybox/busybox/init.cfg b/meta/recipes-core/busybox/busybox/init.cfg
new file mode 100644
index 0000000000..e96700682a
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/init.cfg
@@ -0,0 +1,8 @@
+CONFIG_INIT=y
+CONFIG_RUNLEVEL=y
+CONFIG_FEATURE_USE_INITTAB=y
+CONFIG_HALT=y
+CONFIG_POWEROFF=y
+CONFIG_FEATURE_KILL_DELAY=0
+CONFIG_TELINIT_PATH=""
+CONFIG_INIT_TERMINAL_TYPE=""
diff --git a/meta/recipes-core/busybox/busybox/longopts.cfg b/meta/recipes-core/busybox/busybox/longopts.cfg
new file mode 100644
index 0000000000..dcfab99919
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/longopts.cfg
@@ -0,0 +1,15 @@
+CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
+CONFIG_FEATURE_TAR_LONG_OPTIONS=y
+CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
+CONFIG_FEATURE_CP_LONG_OPTIONS=y
+CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
+CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
+CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
+CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
+CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
+CONFIG_FEATURE_BC_LONG_OPTIONS=y
+CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
+CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
+CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y
+CONFIG_FEATURE_WGET_LONG_OPTIONS=y
diff --git a/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch b/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
new file mode 100644
index 0000000000..97278ab973
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/makefile-libbb-race.patch
@@ -0,0 +1,34 @@
+There is a potential race when building libbb, as some header files
+needed by libbb are not generated yet (or are being modified) at the time
+libbb is compiled.
+This patch avoids this scenario by building libbb as the last directory.
+
+Upstream-Status: Submitted
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+Index: busybox-1.24.1/Makefile
+===================================================================
+diff --git a/Makefile b/Makefile
+index 5cfc763..69f3831 100644
+--- a/Makefile
++++ b/Makefile
+@@ -738,9 +738,18 @@ $(sort $(busybox-all)): $(busybox-dirs) ;
+ # Error messages still appears in the original language
+
+ PHONY += $(busybox-dirs)
+-$(busybox-dirs): prepare scripts
++
++libbb-dir = $(filter libbb,$(busybox-dirs))
++busybox-dirs1 = $(filter-out libbb,$(busybox-dirs))
++
++$(busybox-dirs1): prepare scripts
+ $(Q)$(MAKE) $(build)=$@
+
++ifneq ($(libbb-dir),)
++$(libbb-dir): | $(busybox-dirs1)
++ $(Q)$(MAKE) $(build)=$@
++endif
++
+ # Build the kernel release string
+ # The KERNELRELEASE is stored in a file named .kernelrelease
+ # to be used when executing for example make install or make modules_install
diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
new file mode 100644
index 0000000000..143e6097cb
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/mdev.cfg
@@ -0,0 +1,13 @@
+CONFIG_MDEV=y
+CONFIG_FEATURE_MDEV_CONF=y
+CONFIG_FEATURE_MDEV_RENAME=y
+CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
+CONFIG_FEATURE_MDEV_EXEC=y
+CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
+
+CONFIG_SETSID=y
+CONFIG_CTTYHACK=y
+
+CONFIG_FEATURE_SHADOWPASSWDS=y
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
+CONFIG_FEATURE_MDEV_DAEMON=y
diff --git a/meta/recipes-core/busybox/busybox/mount-via-label.cfg b/meta/recipes-core/busybox/busybox/mount-via-label.cfg
index 2fe7ab2e5f..5a285de7cd 100644
--- a/meta/recipes-core/busybox/busybox/mount-via-label.cfg
+++ b/meta/recipes-core/busybox/busybox/mount-via-label.cfg
@@ -1,9 +1,11 @@
CONFIG_BLKID=y
CONFIG_FEATURE_BLKID_TYPE=y
CONFIG_FEATURE_MOUNT_LABEL=y
+CONFIG_FEATURE_SWAPONOFF_LABEL=y
CONFIG_VOLUMEID=y
CONFIG_FEATURE_VOLUMEID_BTRFS=y
CONFIG_FEATURE_VOLUMEID_EXT=y
CONFIG_FEATURE_VOLUMEID_F2FS=y
CONFIG_FEATURE_VOLUMEID_FAT=y
CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
+CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
diff --git a/meta/recipes-core/busybox/busybox/musl.cfg b/meta/recipes-core/busybox/busybox/musl.cfg
new file mode 100644
index 0000000000..6fffc91098
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/musl.cfg
@@ -0,0 +1,11 @@
+# CONFIG_EXTRA_COMPAT is not set
+# CONFIG_SELINUX is not set
+# CONFIG_FEATURE_HAVE_RPC is not set
+# CONFIG_WERROR is not set
+# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
+# CONFIG_PAM is not set
+# CONFIG_FEATURE_INETD_RPC is not set
+# CONFIG_SELINUXENABLED is not set
+# CONFIG_FEATURE_MOUNT_NFS is not set
+# CONFIG_FEATURE_UTMP is not set
+
diff --git a/meta/recipes-core/busybox/busybox/pgrep.cfg b/meta/recipes-core/busybox/busybox/pgrep.cfg
new file mode 100644
index 0000000000..775e487d60
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/pgrep.cfg
@@ -0,0 +1 @@
+CONFIG_PGREP=y
diff --git a/meta/recipes-core/busybox/busybox/resize.cfg b/meta/recipes-core/busybox/busybox/resize.cfg
new file mode 100644
index 0000000000..a1d9c95b2f
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/resize.cfg
@@ -0,0 +1,2 @@
+CONFIG_RESIZE=y
+CONFIG_FEATURE_RESIZE_PRINT=y
diff --git a/meta/recipes-core/busybox/busybox/rev.cfg b/meta/recipes-core/busybox/busybox/rev.cfg
new file mode 100644
index 0000000000..da008c30cd
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/rev.cfg
@@ -0,0 +1 @@
+CONFIG_REV=y
diff --git a/meta/recipes-core/busybox/busybox/syslog.cfg b/meta/recipes-core/busybox/busybox/syslog.cfg
new file mode 100644
index 0000000000..e2425ed80e
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/syslog.cfg
@@ -0,0 +1,11 @@
+CONFIG_SYSLOGD=y
+CONFIG_FEATURE_ROTATE_LOGFILE=y
+CONFIG_FEATURE_REMOTE_LOG=y
+CONFIG_FEATURE_SYSLOGD_DUP=y
+CONFIG_FEATURE_SYSLOGD_CFG=y
+CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
+CONFIG_FEATURE_IPC_SYSLOG=y
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
+CONFIG_LOGREAD=y
+CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
+CONFIG_FEATURE_KMSG_SYSLOG=y
diff --git a/meta/recipes-core/busybox/busybox/unicode.cfg b/meta/recipes-core/busybox/busybox/unicode.cfg
new file mode 100644
index 0000000000..ecb5a64f27
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/unicode.cfg
@@ -0,0 +1,10 @@
+CONFIG_UNICODE_SUPPORT=y
+# CONFIG_UNICODE_USING_LOCALE is not set
+CONFIG_FEATURE_CHECK_UNICODE_IN_ENV=y
+CONFIG_SUBST_WCHAR=63
+CONFIG_LAST_SUPPORTED_WCHAR=767
+CONFIG_UNICODE_COMBINING_WCHARS=y
+CONFIG_UNICODE_WIDE_WCHARS=y
+# CONFIG_UNICODE_BIDI_SUPPORT is not set
+# CONFIG_UNICODE_NEUTRAL_TABLE is not set
+# CONFIG_UNICODE_PRESERVE_BROKEN is not set
diff --git a/meta/recipes-core/busybox/busybox_1.23.2.bb b/meta/recipes-core/busybox/busybox_1.23.2.bb
deleted file mode 100644
index 8a4bae692a..0000000000
--- a/meta/recipes-core/busybox/busybox_1.23.2.bb
+++ /dev/null
@@ -1,49 +0,0 @@
-require busybox.inc
-
-SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
- file://get_header_tar.patch \
- file://busybox-appletlib-dependency.patch \
- file://busybox-udhcpc-no_deconfig.patch \
- file://find-touchscreen.sh \
- file://busybox-cron \
- file://busybox-httpd \
- file://busybox-udhcpd \
- file://default.script \
- file://simple.script \
- file://hwclock.sh \
- file://mount.busybox \
- file://syslog \
- file://syslog-startup.conf \
- file://syslog.conf \
- file://busybox-syslog.default \
- file://mdev \
- file://mdev.conf \
- file://mdev-mount.sh \
- file://umount.busybox \
- file://defconfig \
- file://busybox-syslog.service.in \
- file://busybox-klogd.service.in \
- file://fail_on_no_media.patch \
- file://run-ptest \
- file://inetd.conf \
- file://inetd \
- file://login-utilities.cfg \
- file://recognize_connmand.patch \
- file://busybox-cross-menuconfig.patch \
- file://0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch \
- file://0001-chown-fix-help-text.patch \
- file://mount-via-label.cfg \
- file://sha1sum.cfg \
- file://sha256sum.cfg \
-"
-
-SRC_URI[tarball.md5sum] = "7925683d7dd105aabe9b6b618d48cc73"
-SRC_URI[tarball.sha256sum] = "05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a"
-
-EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
-
-do_install_ptest () {
- cp -r ${B}/testsuite ${D}${PTEST_PATH}/
- cp ${B}/.config ${D}${PTEST_PATH}/
- ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
-}
diff --git a/meta/recipes-core/busybox/busybox_1.34.1.bb b/meta/recipes-core/busybox/busybox_1.34.1.bb
new file mode 100644
index 0000000000..6aed0f0476
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox_1.34.1.bb
@@ -0,0 +1,54 @@
+require busybox.inc
+
+SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
+ file://busybox-udhcpc-no_deconfig.patch \
+ file://find-touchscreen.sh \
+ file://busybox-cron \
+ file://busybox-httpd \
+ file://busybox-udhcpd \
+ file://default.script \
+ file://simple.script \
+ file://hwclock.sh \
+ file://syslog \
+ file://syslog-startup.conf \
+ file://syslog.conf \
+ file://busybox-syslog.default \
+ file://mdev \
+ file://mdev.conf \
+ file://mdev-mount.sh \
+ file://defconfig \
+ file://busybox-syslog.service.in \
+ file://busybox-klogd.service.in \
+ file://fail_on_no_media.patch \
+ file://run-ptest \
+ file://inetd.conf \
+ file://inetd \
+ file://login-utilities.cfg \
+ file://recognize_connmand.patch \
+ file://busybox-cross-menuconfig.patch \
+ file://0001-Use-CC-when-linking-instead-of-LD-and-use-CFLAGS-and.patch \
+ file://mount-via-label.cfg \
+ file://sha1sum.cfg \
+ file://sha256sum.cfg \
+ file://getopts.cfg \
+ file://longopts.cfg \
+ file://resize.cfg \
+ ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
+ ${@["", "file://rcS.default"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
+ ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \
+ file://syslog.cfg \
+ file://unicode.cfg \
+ file://rev.cfg \
+ file://pgrep.cfg \
+ file://rcS \
+ file://rcK \
+ file://makefile-libbb-race.patch \
+ file://0001-testsuite-check-uudecode-before-using-it.patch \
+ file://0001-testsuite-use-www.example.org-for-wget-test-cases.patch \
+ file://0001-du-l-works-fix-to-use-145-instead-of-144.patch \
+ file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \
+ file://0001-mktemp-add-tmpdir-option.patch \
+ "
+SRC_URI:append:libc-musl = " file://musl.cfg "
+
+SRC_URI[tarball.sha256sum] = "415fbd89e5344c96acf449d94a6f956dbed62e18e835fc83e064db33a34bd549"
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
deleted file mode 100644
index ade72f4b71..0000000000
--- a/meta/recipes-core/busybox/busybox_git.bb
+++ /dev/null
@@ -1,54 +0,0 @@
-require busybox.inc
-
-SRCREV = "be947c4d97c0dacb703a6f24dd813ff6dd3a33b6"
-# Lookout for PV bump too when SRCREV is changed
-PV = "1.23.2+git${SRCPV}"
-
-S = "${WORKDIR}/git"
-
-SRC_URI = "git://busybox.net/busybox.git \
- file://get_header_tar.patch \
- file://busybox-appletlib-dependency.patch \
- file://busybox-udhcpc-no_deconfig.patch \
- file://find-touchscreen.sh \
- file://busybox-cron \
- file://busybox-httpd \
- file://busybox-udhcpd \
- file://default.script \
- file://simple.script \
- file://hwclock.sh \
- file://mount.busybox \
- file://syslog \
- file://syslog-startup.conf \
- file://syslog.conf \
- file://busybox-syslog.default \
- file://mdev \
- file://mdev.conf \
- file://mdev-mount.sh \
- file://umount.busybox \
- file://defconfig \
- file://busybox-syslog.service.in \
- file://busybox-klogd.service.in \
- file://fail_on_no_media.patch \
- file://run-ptest \
- file://inetd.conf \
- file://inetd \
- file://login-utilities.cfg \
- file://recognize_connmand.patch \
- file://busybox-cross-menuconfig.patch \
- file://0001-ifconfig-fix-double-free-fatal-error-in-INET_sprint.patch \
- file://0001-chown-fix-help-text.patch \
- file://mount-via-label.cfg \
- file://sha1sum.cfg \
- file://sha256sum.cfg \
-"
-
-EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
-
-do_install_ptest () {
- cp -r ${B}/testsuite ${D}${PTEST_PATH}/
- cp ${B}/.config ${D}${PTEST_PATH}/
- ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
-}
-
-DEFAULT_PREFERENCE = "-1"
diff --git a/meta/recipes-core/busybox/files/busybox-syslog.default b/meta/recipes-core/busybox/files/busybox-syslog.default
index e516caf518..2dced80231 100644
--- a/meta/recipes-core/busybox/files/busybox-syslog.default
+++ b/meta/recipes-core/busybox/files/busybox-syslog.default
@@ -1,4 +1,4 @@
-OPTIONS="-C"
+#OPTIONS="-C"
# The above option means syslogd will log to 16K shm circular buffer.
# You could use `logread' to read it.
diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab
new file mode 100644
index 0000000000..e8ec2ab68e
--- /dev/null
+++ b/meta/recipes-core/busybox/files/inittab
@@ -0,0 +1,28 @@
+# This is run first except when booting in single-user mode.
+
+# Startup the system
+::sysinit:/bin/mount -t proc proc /proc
+::sysinit:/bin/mount -t sysfs sysfs /sys
+::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
+::sysinit:/bin/mount -o remount,rw /
+::sysinit:/bin/mkdir -p /dev/pts
+::sysinit:/bin/mount -t devpts devpts /dev/pts
+::sysinit:/bin/mount -a
+::sysinit:/sbin/swapon -a
+null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
+null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
+null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
+null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
+# set hostname
+null::sysinit:/bin/busybox hostname -F /etc/hostname
+::sysinit:/etc/init.d/rcS
+
+# Stuff to do before rebooting
+#::ctrlaltdel:/sbin/reboot
+::shutdown:/etc/init.d/rcK
+::shutdown:/sbin/swapoff -a
+::shutdown:/bin/umount -a -r
+
+# Stuff to do when restarting the init process
+::restart:/sbin/init
+
diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 96252477e0..2fbdfb073e 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -1,19 +1,43 @@
#!/bin/sh
-
-mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
-mkdir /dev/pts /dev/shm
-chmod 777 /dev/shm
-mount -t devpts devpts /dev/pts
-touch /dev/mdev.seq
-echo "/sbin/mdev" > /proc/sys/kernel/hotplug
-mdev -s
-
#
-# We might have mounted something over /dev, see if /dev/initctl is there.
+# Run the mdev daemon
#
-if test ! -p /dev/initctl
-then
- rm -f /dev/initctl
- mknod -m 600 /dev/initctl p
-fi
+
+DAEMON="mdev"
+PIDFILE="/var/run/$DAEMON.pid"
+
+
+start() {
+ echo -n "Starting $DAEMON... "
+ start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
+ [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+
+ # coldplug modules
+ find /sys/ -name modalias -print0 | \
+ xargs -0 sort -u | \
+ tr '\n' '\0' | \
+ xargs -0 modprobe -abq
+}
+
+stop() {
+ echo -n "Stopping $DAEMON... "
+ start-stop-daemon -K -p $PIDFILE
+ [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start|stop|restart)
+ "$1"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
index d5d66d66fb..130e9472f3 100644
--- a/meta/recipes-core/busybox/files/mdev-mount.sh
+++ b/meta/recipes-core/busybox/files/mdev-mount.sh
@@ -15,7 +15,7 @@ case "$ACTION" in
exit 0
fi
DEVBASE=`expr substr $MDEV 1 3`
- if [ "${DEVBASE}" == "mmc" ] ; then
+ if [ "${DEVBASE}" = "mmc" ] ; then
DEVBASE=`expr substr $MDEV 1 7`
fi
# check for "please don't mount it" file
@@ -24,8 +24,8 @@ case "$ACTION" in
exit 0
fi
# check for full-disk partition
- if [ "${DEVBASE}" == "${MDEV}" ] ; then
- if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
+ if [ "${DEVBASE}" = "${MDEV}" ] ; then
+ if [ -f /sys/block/${DEVBASE}/${DEVBASE}*1/partition ] ; then
# Partition detected, just quit
exit 0
fi
@@ -33,7 +33,7 @@ case "$ACTION" in
# No size at all
exit 0
fi
- if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
+ if [ "`cat /sys/block/${DEVBASE}/size`" = "0" ] ; then
# empty device, bail out
exit 0
fi
@@ -42,8 +42,8 @@ case "$ACTION" in
if ! mount /dev/$MDEV > /dev/null 2>&1
then
MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
- mkdir "$MOUNTPOINT"
- mount -t auto /dev/$MDEV "$MOUNTPOINT"
+ mkdir -p "$MOUNTPOINT"
+ mount -t auto /dev/$MDEV "$MOUNTPOINT" || rmdir "$MOUNTPOINT"
fi
;;
remove)
diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
index 17e93da7c3..4e9c23f14b 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -39,4 +39,6 @@ input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
+mmcblk[0-9]rpmb 0:0 660
+mmcblk[0-9]boot[0-9] 0:0 660
mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
diff --git a/meta/recipes-core/busybox/files/mount.busybox b/meta/recipes-core/busybox/files/mount.busybox
deleted file mode 100755
index fef945b7b2..0000000000
--- a/meta/recipes-core/busybox/files/mount.busybox
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /bin/busybox mount $@
diff --git a/meta/recipes-core/busybox/files/rcK b/meta/recipes-core/busybox/files/rcK
new file mode 100644
index 0000000000..f8a63e1325
--- /dev/null
+++ b/meta/recipes-core/busybox/files/rcK
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Stop all init scripts in /etc/rc6.d
+# executing them in numerical order.
+#
+for i in /etc/rc6.d/K??*; do
+
+ # Ignore dangling symlinks (if any).
+ [ ! -f "$i" ] && continue
+
+ case "$i" in
+ *.sh)
+ # Source shell script for speed.
+ (
+ trap - INT QUIT TSTP
+ set stop
+ . $i
+ )
+ ;;
+ *)
+ # No sh extension, so fork subprocess.
+ $i stop
+ ;;
+ esac
+done
+
diff --git a/meta/recipes-core/busybox/files/rcS b/meta/recipes-core/busybox/files/rcS
new file mode 100644
index 0000000000..bb03eb6088
--- /dev/null
+++ b/meta/recipes-core/busybox/files/rcS
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# Start all init scripts in /etc/rcS.d and /etc/rc5.d
+# executing them in numerical order.
+#
+
+for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do
+
+ # Ignore dangling symlinks (if any).
+ [ ! -f "$i" ] && continue
+
+ case "$i" in
+ *.sh)
+ # Source shell script for speed.
+ (
+ trap - INT QUIT TSTP
+ set start
+ . $i
+ )
+ ;;
+ *)
+ # No sh extension, so fork subprocess.
+ $i start
+ ;;
+ esac
+done
+
diff --git a/meta/recipes-core/busybox/files/rcS.default b/meta/recipes-core/busybox/files/rcS.default
new file mode 100644
index 0000000000..44c9747e34
--- /dev/null
+++ b/meta/recipes-core/busybox/files/rcS.default
@@ -0,0 +1,31 @@
+#
+# Defaults for the boot scripts in /etc/rcS.d
+#
+
+# Time files in /tmp are kept in days.
+TMPTIME=0
+# Set to yes if you want sulogin to be spawned on bootup
+SULOGIN=no
+# Set to no if you want to be able to login over telnet/rlogin
+# before system startup is complete (as soon as inetd is started)
+DELAYLOGIN=no
+# Assume that the BIOS clock is set to UTC time (recommended)
+UTC=yes
+# Set VERBOSE to "no" if you would like a more quiet bootup.
+VERBOSE=no
+# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
+EDITMOTD=no
+# Whether to fsck root on boot
+ENABLE_ROOTFS_FSCK=no
+# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
+FSCKFIX=yes
+# Set TICKADJ to the correct tick value for this specific machine
+#TICKADJ=10000
+# Enable caching in populate-volatile.sh
+VOLATILE_ENABLE_CACHE=yes
+# Indicate whether the rootfs is intended to be read-only or not.
+# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
+# Normally you should not change this value.
+ROOTFS_READ_ONLY=no
+# Indicate init system type
+INIT_SYSTEM=busybox
diff --git a/meta/recipes-core/busybox/files/run-ptest b/meta/recipes-core/busybox/files/run-ptest
index 3608a8eb65..76873c9de2 100644
--- a/meta/recipes-core/busybox/files/run-ptest
+++ b/meta/recipes-core/busybox/files/run-ptest
@@ -1,7 +1,9 @@
#!/bin/sh
-current_dir=$(readlink -f $0)
-export bindir=$(dirname $current_dir)
+current_path=$(readlink -f $0)
+export bindir=$(dirname $current_path)
+export PATH=$bindir/bin:$PATH
+export SKIP_KNOWN_BUGS=1
cd testsuite || exit 1
-./runtest -v | sed -r 's/^(SKIPPED|UNTESTED):/SKIP:/'
+LANG=C.UTF-8 ./runtest -v | sed -r 's/^(SKIPPED|UNTESTED):/SKIP:/'
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 22168b07e6..013440574d 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -14,7 +14,7 @@ root_is_nfs() {
}
have_bin_ip=0
-if [ -x /sbin/ip ]; then
+if [ -x /SBIN_DIR/ip ]; then
have_bin_ip=1
BROADCAST="broadcast +"
fi
@@ -23,34 +23,34 @@ fi
case "$1" in
deconfig)
- if [ -x /sbin/resolvconf ]; then
- /sbin/resolvconf -d "${interface}.udhcpc"
+ if [ -x /SBIN_DIR/resolvconf ]; then
+ /SBIN_DIR/resolvconf -d "${interface}.udhcpc"
fi
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- ip addr flush dev $interface
- ip link set dev $interface up
+ /SBIN_DIR/ip -4 addr flush dev $interface
+ /SBIN_DIR/ip link set dev $interface up
else
- /sbin/ifconfig $interface 0.0.0.0
+ /SBIN_DIR/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
- ip addr add dev $interface local $ip/$mask $BROADCAST
+ /SBIN_DIR/ip addr add dev $interface local $ip/$mask $BROADCAST
else
- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+ /SBIN_DIR/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ] ; then
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- while ip route del default dev $interface 2>/dev/null ; do
+ while /SBIN_DIR/ip route del default dev $interface 2>/dev/null ; do
:
done
else
- while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
+ while /SBIN_DIR/route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
:
done
fi
@@ -59,9 +59,9 @@ case "$1" in
metric=10
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
- ip route add default via $i metric $metric
+ /SBIN_DIR/ip route add default via $i metric $metric dev $interface
else
- route add default gw $i dev $interface metric $metric 2>/dev/null
+ /SBIN_DIR/route add default gw $i dev $interface metric $metric 2>/dev/null
fi
metric=$(($metric + 1))
done
@@ -77,8 +77,8 @@ case "$1" in
"
done
- if [ -x /sbin/resolvconf ]; then
- echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
+ if [ -x /SBIN_DIR/resolvconf ]; then
+ echo -n "$R" | /SBIN_DIR/resolvconf -a "${interface}.udhcpc"
else
echo -n "$R" > "$RESOLV_CONF"
fi
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
index 89c4d12e9c..2208613e8c 100644
--- a/meta/recipes-core/busybox/files/syslog
+++ b/meta/recipes-core/busybox/files/syslog
@@ -51,6 +51,22 @@ else
SYSLOG_ARGS="-C"
fi
+waitpid ()
+{
+ pid=$1
+ # Give pid a chance to exit before we restart with a 5s timeout in 1s intervals
+ if [ -z "$pid" ]; then
+ return
+ fi
+ timeout=5;
+ while [ $timeout -gt 0 ]
+ do
+ timeout=$(( $timeout-1 ))
+ kill -0 $pid 2> /dev/null || break
+ sleep 1
+ done
+}
+
case "$1" in
start)
echo -n "Starting syslogd/klogd: "
@@ -65,7 +81,11 @@ case "$1" in
echo "done"
;;
restart)
- $0 stop
+ pid1=`pidof syslogd`
+ pid2=`pidof klogd`
+ $0 stop
+ waitpid $pid1
+ waitpid $pid2
$0 start
;;
*)
diff --git a/meta/recipes-core/busybox/files/umount.busybox b/meta/recipes-core/busybox/files/umount.busybox
deleted file mode 100755
index f3731626e6..0000000000
--- a/meta/recipes-core/busybox/files/umount.busybox
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /bin/busybox umount $@
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/Makevars b/meta/recipes-core/console-tools/console-tools-0.3.2/Makevars
deleted file mode 100644
index 32692ab4b9..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/Makevars
+++ /dev/null
@@ -1,41 +0,0 @@
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
-# package. (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.) Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright. The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Free Software Foundation, Inc.
-
-# This is the email address or URL to which the translators shall report
-# bugs in the untranslated strings:
-# - Strings which are not entire sentences, see the maintainer guidelines
-# in the GNU gettext documentation, section 'Preparing Strings'.
-# - Strings which use unclear terms or require additional context to be
-# understood.
-# - Strings which make invalid assumptions about notation of date, time or
-# money.
-# - Pluralisation problems.
-# - Incorrect English spelling.
-# - Incorrect formatting.
-# It can be your email address, or a mailing list address where translators
-# can write to without being subscribed, or the URL of a web page through
-# which the translators can contact you.
-MSGID_BUGS_ADDRESS =
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used. It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/codepage.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/codepage.patch
deleted file mode 100644
index c287014767..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/codepage.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Upstream-Status: Pending
-
-#
-# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
-#
-
---- console-tools-0.3.2/contrib/codepage.c~codepage
-+++ console-tools-0.3.2/contrib/codepage.c
-@@ -229,7 +229,7 @@
- return 0;
-
- fprintf(stderr, "\
--Warning: CP format is a hack!\n
-+Warning: CP format is a hack!\n\
- The files produced may or may not be usable!\n");
-
- sprintf(outfile, "%d.cp", CPEntryHeader.codepage);
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/compile.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/compile.patch
deleted file mode 100644
index c93f511950..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/compile.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Upstream-Status: Pending
-
---- console-tools-0.3.2/kbdtools/showkey.c~compile 1999-08-25 17:20:08.000000000 -0400
-+++ console-tools-0.3.2/kbdtools/showkey.c 2004-05-09 03:03:23.000000000 -0400
-@@ -264,7 +264,6 @@
- break;
- case cmd_keymap:
- printf(")\n");
-- default:
- }
- }
-
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/configure.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/configure.patch
deleted file mode 100644
index 15c100c908..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/configure.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Upstream-Status: Pending
-
---- console-tools-0.3.2/configure.in~configure
-+++ console-tools-0.3.2/configure.in
-@@ -2,13 +2,14 @@
- dnl Process this file with autoconf to produce a configure script.
-
- # Initialize
--AC_INIT(kbdtools/loadkeys.y)
-+AC_INIT
-+AC_CONFIG_SRCDIR([kbdtools/loadkeys.y])
-
- define(ct_unicodedata_default,/usr/share/unidata/UnicodeData-2.txt)
- ct_localdatadir_default=/usr/local/share # iff --enable-localdatadir without specific dir
-
- #AC_CONFIG_AUX_DIR(autoconf)
--AC_CANONICAL_SYSTEM
-+AC_CANONICAL_TARGET([])
- AM_INIT_AUTOMAKE(console-tools, 0.3.2)
-
- # Defaults
-@@ -25,7 +26,6 @@
- # i18n stuff
- ALL_LINGUAS="cs de ru ga fr"
- AM_GNU_GETTEXT
--AC_OUTPUT_COMMANDS([sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
-
- AC_DEFINE_UNQUOTED(LOCALEDIR, "/usr/share/locale")
-
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/fix-libconsole-linking.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/fix-libconsole-linking.patch
deleted file mode 100644
index be61eb846b..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/fix-libconsole-linking.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-Fix the following error detected with i586-pokymllib32-linux-gcc (the
-multilib x86-64 lib32 compiler):
- ../lib/ctutils/.libs/libctutils.so: undefined reference to `get_kernel_sfm'
- collect2: error: ld returned 1 exit status
-
-It seems that libctutils.so (the library that uses get_kernel_sfm) must
-be stated before libconsole.so (the library that exports the function) when
-using multilib gcc
-
-Upstream-Status: Pending
-Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
-
-Index: console-tools-0.3.2/fontfiletools/Makefile.am
-===================================================================
---- console-tools-0.3.2.orig/fontfiletools/Makefile.am
-+++ console-tools-0.3.2/fontfiletools/Makefile.am
-@@ -10,5 +10,5 @@ EXTRA_DIST = fonts2virfont.c virfont.h
-
- # libconsole is needed by ctutils
- LDADD = ../lib/ctlocal/libctlocal.a ../lib/cfont/libcfont.la \
-- ../lib/console/libconsole.la \
-- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
-+ ../lib/ctutils/libctutils.la \
-+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
-Index: console-tools-0.3.2/vttools/Makefile.am
-===================================================================
---- console-tools-0.3.2.orig/vttools/Makefile.am
-+++ console-tools-0.3.2/vttools/Makefile.am
-@@ -7,9 +7,9 @@ bin_PROGRAMS = chvt deallocvt writevt fg
- vcstime vt-is-UTF8 openvt @RESIZECONS@
- EXTRA_PROGRAMS = resizecons
-
--LDADD = ../lib/ctlocal/libctlocal.a ../lib/console/libconsole.la \
-+LDADD = ../lib/ctlocal/libctlocal.a ../lib/ctutils/libctutils.la \
- ../lib/cfont/libcfont.la \
-- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
-+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
-
- vcstime_LDADD = ../lib/ctlocal/libctlocal.a
- screendump_LDADD = ../lib/ctlocal/libctlocal.a
-Index: console-tools-0.3.2/kbdtools/Makefile.am
-===================================================================
---- console-tools-0.3.2.orig/kbdtools/Makefile.am
-+++ console-tools-0.3.2/kbdtools/Makefile.am
-@@ -15,9 +15,9 @@ EXTRA_PROGRAMS = getkeycodes setkeycodes
- loadkeys_SOURCES = loadkeys.y analyze.l
-
- YFLAGS = -d
--LDADD = ../lib/ctlocal/libctlocal.a ../lib/console/libconsole.la \
-+LDADD = ../lib/ctlocal/libctlocal.a ../lib/ctutils/libctutils.la \
- ../lib/cfont/libcfont.la \
-- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
-+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
-
- loadkeys_LDADD = $(LDADD) @LEXLIB@
-
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/kbdrate.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/kbdrate.patch
deleted file mode 100644
index f370be8592..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/kbdrate.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Patch from Matthias Goebl <oe@m.goebl.net>
-Added via OE bugtracker: bug #478
-
-Upstream-Status: Pending
-
---- console-tools-0.3.2/kbdtools/kbd_mode.c.orig
-+++ console-tools-0.3.2/kbdtools/kbd_mode.c
-@@ -29,11 +29,16 @@
- OPT("-u --unicode ", _("UTF-8 mode (UNICODE)"));
- OPT("-s --scancode ", _("scancode mode (RAW)"));
- OPT(" --mode={8bit,keycode,unicode,scancode} ", _("set mode"));
-+ OPT("-r --rate=RATE ", _("set repeat rate (default: 33)"));
-+ OPT("-d --delay=DELAY ", _("set repeat delay (default: 250)"));
-
- OPT("-h --help ", HELPDESC);
- OPT("-V --version ", VERSIONDESC);
- }
-
-+int rate=-1;
-+int delay=-1;
-+
- static int parse_cmdline (int argc, char *argv[])
- {
- int mode = -1;
-@@ -46,11 +51,13 @@
- { "mode" , required_argument, NULL, 'm' },
- { "scancode" , no_argument, NULL, 's' },
- { "unicode" , no_argument, NULL, 'u' },
-+ { "rate" , required_argument, NULL, 'r' },
-+ { "delay" , required_argument, NULL, 'd' },
- { NULL, 0, NULL, 0 }
- };
- int c;
-
-- while ( (c = getopt_long (argc, argv, "Vhaksu", long_opts, NULL)) != EOF)
-+ while ( (c = getopt_long (argc, argv, "Vhaksur:d:", long_opts, NULL)) != EOF)
- switch (c) {
- case 'h':
- usage ();
-@@ -58,6 +65,14 @@
- case 'V':
- version ();
- exit(0);
-+ case 'r':
-+ rate = atoi(optarg);
-+ mode = -2;
-+ break;
-+ case 'd':
-+ delay = atoi(optarg);
-+ mode = -2;
-+ break;
- case 'a':
- mode = K_XLATE;
- break;
-@@ -129,6 +144,20 @@
- exit(0);
- }
-
-+ if ( rate != -1 || delay != -1 )
-+ {
-+ struct kbd_repeat kbd_rep;
-+ kbd_rep.delay = delay;
-+ kbd_rep.period = rate;
-+ if (ioctl(fd, KDKBDREP, &kbd_rep))
-+ {
-+ fprintf(stderr, progname);
-+ perror(_(": error setting keyboard repeat mode\n"));
-+ exit(1);
-+ }
-+ if(mode==-2) exit(0);
-+ }
-+
- if (ioctl(fd, KDSKBMODE, mode))
- {
- fprintf(stderr, progname);
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/lcmessage.m4 b/meta/recipes-core/console-tools/console-tools-0.3.2/lcmessage.m4
deleted file mode 100644
index 18d47a94f7..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/lcmessage.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-# Check whether LC_MESSAGES is available in <locale.h>.
-# Ulrich Drepper <drepper@cygnus.com>, 1995.
-#
-# This file can be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU General Public
-# License or the GNU Library General Public License but which still want
-# to provide support for the GNU gettext functionality.
-# Please note that the actual code of the GNU gettext library is covered
-# by the GNU Library General Public License, and the rest of the GNU
-# gettext package package is covered by the GNU General Public License.
-# They are *not* in the public domain.
-
-# serial 2
-
-AC_DEFUN([AM_LC_MESSAGES],
- [if test $ac_cv_header_locale_h = yes; then
- AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
- [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
- am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
- if test $am_cv_val_LC_MESSAGES = yes; then
- AC_DEFINE(HAVE_LC_MESSAGES, 1,
- [Define if your <locale.h> file defines LC_MESSAGES.])
- fi
- fi])
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/no-dep-on-libfl.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/no-dep-on-libfl.patch
deleted file mode 100644
index a6735a53ff..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/no-dep-on-libfl.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-No reason to link with libfl since 'loadkeys' implements
-its own yywrap()/yylex() functions.
-
-Upstream-Status: Pending
-Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se>
-
-Index: console-tools-0.3.2/kbdtools/Makefile.am
-===================================================================
---- console-tools-0.3.2.orig/kbdtools/Makefile.am
-+++ console-tools-0.3.2/kbdtools/Makefile.am
-@@ -19,8 +19,6 @@ LDADD = ../lib/ctlocal/libctlocal.a ../l
- ../lib/cfont/libcfont.la \
- ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
-
--loadkeys_LDADD = $(LDADD) @LEXLIB@
--
- bin_SCRIPTS = mk_modmap
-
- noinst_HEADERS = loadkeys.h
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/nodocs.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/nodocs.patch
deleted file mode 100644
index 2ed609219c..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/nodocs.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-The docs need tools we don't have to build so disable them.
-
-Also remove intl since the Makefile doesn't work with 3.82 and we
-don't want to build libintl anyway.
-
-Upstream-Status: Inappropriate [configuration]
-RP 2012/10/17
-
-Index: console-tools-0.3.2/Makefile.am
-===================================================================
---- console-tools-0.3.2.orig/Makefile.am 1999-04-15 01:33:24.000000000 +0000
-+++ console-tools-0.3.2/Makefile.am 2012-10-17 11:48:14.107069145 +0000
-@@ -1,7 +1,7 @@
- # -*- makefile -*-
- AUTOMAKE_OPTIONS = foreign
-
--SUBDIRS = lib fontfiletools vttools kbdtools screenfonttools contrib doc \
-- compat include examples po intl
-+SUBDIRS = lib fontfiletools vttools kbdtools screenfonttools contrib \
-+ compat include examples po
-
- EXTRA_DIST = BUGS RELEASE CREDITS COPYING.kbd local-scripts/* debian/* *.lsm
diff --git a/meta/recipes-core/console-tools/console-tools-0.3.2/uclibc-fileno.patch b/meta/recipes-core/console-tools/console-tools-0.3.2/uclibc-fileno.patch
deleted file mode 100644
index 0c95068a36..0000000000
--- a/meta/recipes-core/console-tools/console-tools-0.3.2/uclibc-fileno.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Fixing the locale issues isn't enough, console-tools also does a couple of
-other pretty stupid things (like FILE *f; f->_fileno instead of fileno(f)),
-
-Upstream-Status: Pending
-
---- console-tools-0.3.2/lib/cfont/fontstruct.c.ark 2005-05-22 19:12:38.000000000 +0000
-+++ console-tools-0.3.2/lib/cfont/fontstruct.c 2005-05-22 19:13:23.000000000 +0000
-@@ -50,8 +50,7 @@
- * get filesize
- */
-
-- /* FIXME: should not use _fileno ! */
-- if (fstat(fontfile->_fileno, &stbuf) == -1)
-+ if (fstat(fileno(fontfile), &stbuf) == -1)
- goto rsf_return_error;
-
- if (S_ISREG(stbuf.st_mode))
-@@ -211,8 +210,7 @@
- * get filesize
- */
-
-- /* FIXME: should not use _fileno ! */
-- if (fstat(fontfile->_fileno, &stbuf) == -1)
-+ if (fstat(fileno(fontfile), &stbuf) == -1)
- goto rfg_return_error;
-
- if (S_ISREG(stbuf.st_mode))
---- console-tools-0.3.2/lib/console/acm.c.ark 2005-05-22 19:17:15.000000000 +0000
-+++ console-tools-0.3.2/lib/console/acm.c 2005-05-22 19:17:23.000000000 +0000
-@@ -30,7 +30,7 @@
- lct_boolean parse_failed = False;
- lct_boolean is_unicode;
-
-- if (fstat(fp->_fileno, &stbuf))
-+ if (fstat(fileno(fp), &stbuf))
- perror(_("Cannot stat ACM file")), exit(1);
-
- /* first try a wg15-charmap (glibc) file format */
---- console-tools-0.3.2/include/lct/local.h.ark 2005-05-22 19:08:54.000000000 +0000
-+++ console-tools-0.3.2/include/lct/local.h 2005-05-22 19:09:12.000000000 +0000
-@@ -8,7 +8,7 @@
- #include <locale.h>
-
-
--#ifdef HAVE_LOCALE_H
-+#if defined(HAVE_LOCALE_H) && defined(HAVE_LIBINTL_H)
- # include <libintl.h>
- # define _(String) gettext (String)
- # ifdef gettext_noop
diff --git a/meta/recipes-core/console-tools/console-tools_0.3.2.bb b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
deleted file mode 100644
index c60a5a05bb..0000000000
--- a/meta/recipes-core/console-tools/console-tools_0.3.2.bb
+++ /dev/null
@@ -1,37 +0,0 @@
-SECTION = "base"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING.kbd;md5=9b2d91511d3d80d4d20ac6e6b0137fe9"
-SUMMARY = "Allows you to set-up and manipulate the Linux console"
-DESCRIPTION = "Provides tools that enable the set-up and manipulation of the linux console and console-font files."
-PR = "r8"
-
-SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
- file://codepage.patch \
- file://configure.patch \
- file://compile.patch \
- file://kbdrate.patch \
- file://uclibc-fileno.patch \
- file://nodocs.patch \
- file://fix-libconsole-linking.patch \
- file://no-dep-on-libfl.patch \
- file://lcmessage.m4 \
- file://Makevars"
-
-SRC_URI[md5sum] = "bf21564fc38b3af853ef724babddbacd"
-SRC_URI[sha256sum] = "eea6b441672dacd251079fc85ed322e196282e0e66c16303ec64c3a2b1c126c2"
-
-do_configure_prepend () {
- mkdir -p ${S}/m4
- cp ${WORKDIR}/lcmessage.m4 ${S}/m4/
- rm -f ${S}/acinclude.m4
- cp ${WORKDIR}/Makevars ${S}/po/
-}
-
-inherit autotools gettext update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-
-bindir_progs = "chvt deallocvt fgconsole openvt"
-ALTERNATIVE_${PN} = "${bindir_progs}"
-
-RDEPENDS_${PN} = "bash"
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch
deleted file mode 100644
index 5452b46bbc..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
-----
-
-When "cp -i --update old new" would do nothing because "new" is
-newer than "old", cp would nonetheless prompt for whether it is
-ok to overwrite "new". Then, regardless of the response (because
-of the --update option), cp would do nothing.
-
-The following patch eliminates the unnecessary prompt in that case.
-
-diff --git a/src/copy.c b/src/copy.c
-index b7bf73b..0e549d2 100644
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -1210,6 +1210,30 @@ copy_internal (char const *src_name, char const *dst_name,
- return false;
- }
-
-+ if (!S_ISDIR (src_mode) && x->update)
-+ {
-+ /* When preserving time stamps (but not moving within a file
-+ system), don't worry if the destination time stamp is
-+ less than the source merely because of time stamp
-+ truncation. */
-+ int options = ((x->preserve_timestamps
-+ && ! (x->move_mode
-+ && dst_sb.st_dev == src_sb.st_dev))
-+ ? UTIMECMP_TRUNCATE_SOURCE
-+ : 0);
-+
-+ if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
-+ {
-+ /* We're using --update and the destination is not older
-+ than the source, so do not copy or move. Pretend the
-+ rename succeeded, so the caller (if it's mv) doesn't
-+ end up removing the source file. */
-+ if (rename_succeeded)
-+ *rename_succeeded = true;
-+ return true;
-+ }
-+ }
-+
- /* When there is an existing destination file, we may end up
- returning early, and hence not copying/moving the file.
- This may be due to an interactive `negative' reply to the
-@@ -1302,30 +1326,6 @@ copy_internal (char const *src_name, char const *dst_name,
- return false;
- }
- }
--
-- if (x->update)
-- {
-- /* When preserving time stamps (but not moving within a file
-- system), don't worry if the destination time stamp is
-- less than the source merely because of time stamp
-- truncation. */
-- int options = ((x->preserve_timestamps
-- && ! (x->move_mode
-- && dst_sb.st_dev == src_sb.st_dev))
-- ? UTIMECMP_TRUNCATE_SOURCE
-- : 0);
--
-- if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
-- {
-- /* We're using --update and the destination is not older
-- than the source, so do not copy or move. Pretend the
-- rename succeeded, so the caller (if it's mv) doesn't
-- end up removing the source file. */
-- if (rename_succeeded)
-- *rename_succeeded = true;
-- return true;
-- }
-- }
- }
-
- if (x->move_mode)
-diff --git a/tests/mv/update b/tests/mv/update
-index 0c06024..6c3d149 100755
---- a/tests/mv/update
-+++ b/tests/mv/update
-@@ -1,7 +1,7 @@
- #!/bin/sh
- # make sure --update works as advertised
-
--# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
-+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
-
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
-@@ -46,11 +46,16 @@ fi
-
- fail=0
-
--for cp_or_mv in cp mv; do
-- # This is a no-op.
-- $cp_or_mv --update old new || fail=1
-- case "`cat new`" in new) ;; *) fail=1 ;; esac
-- case "`cat old`" in old) ;; *) fail=1 ;; esac
-+for interactive in '' -i; do
-+ for cp_or_mv in cp mv; do
-+ # This is a no-op, with no prompt.
-+ # With coreutils-6.9 and earlier, using --update with -i would
-+ # mistakenly elicit a prompt.
-+ $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
-+ test -s out && fail=1
-+ case "`cat new`" in new) ;; *) fail=1 ;; esac
-+ case "`cat old`" in old) ;; *) fail=1 ;; esac
-+ done
- done
-
- # This will actually perform the rename.
---
-1.5.3.rc1.16.g9d6f
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-build-with-acl.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-build-with-acl.patch
deleted file mode 100644
index 8273d78eb3..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-build-with-acl.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Upstream-Status: Inappropriate [embedded specific]
-
-Fix the following issue so that coreutils can build with ACL:
-
-configure: WARNING: libacl development library was not found or not usable.
-configure: WARNING: GNU coreutils will be built without ACL support.
-
-Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
----
- m4/acl.m4 | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/m4/acl.m4 b/m4/acl.m4
-index d6a448a..a9d4836 100644
---- a/m4/acl.m4
-+++ b/m4/acl.m4
-@@ -159,7 +159,7 @@ AC_DEFUN([gl_ACL_GET_FILE],
- ]])],
- [gl_cv_func_working_acl_get_file=yes],
- [gl_cv_func_working_acl_get_file=no],
-- [gl_cv_func_working_acl_get_file=cross-compiling])])
-+ [gl_cv_func_working_acl_get_file=yes])])
-
- AS_IF([test $gl_cv_func_working_acl_get_file = yes], [$1], [$2])
- ])
---
-1.7.7
-
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch
deleted file mode 100644
index 88f61fa108..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-The install command doesn't over write the dangling symlink, for
-example:
-
-$ install fileA /tmp/fileA
-
-If /tmp/fileA is a dangling symlink, there would be an error:
-
-install: cannot create regular file '/tmp/fileA': File exists
-
-This is because of the following code in copy.c:
-
- if (!new_dst)
- {
- if (XSTAT (x, dst_name, &dst_sb) != 0)
- {
- if (errno != ENOENT)
- {
- error (0, errno, _("cannot stat %s"), quote (dst_name));
- return false;
- }
- else
- {
- new_dst = true;
- }
- }
-
-XSTAT() use stat() for dst_name(the dangling symlink /tmp/fileA) when
-install.c invokes it, and stat will set errno to ENOENT, and then
-new_dst will be set to true which means that /tmp/fileA doesn't exist,
-then we will create /tmp/fileA without remove it first, so the error
-comes.
-
-This is fixed in a way which adds the member cmd_install in
-struct cp_options to make sure my change only affected to the install
-command and use lstat to fix the problem.
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
----
- src/copy.c | 10 +++++++++-
- src/copy.h | 3 +++
- src/install.c | 1 +
- 3 files changed, 13 insertions(+), 1 deletions(-)
-
-diff --git a/src/copy.c b/src/copy.c
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -1029,6 +1029,7 @@ copy_internal (char const *src_name, char const *dst_name,
- bool delayed_ok;
- bool copied_as_regular = false;
- bool preserve_metadata;
-+ int dst_stat_result;
-
- if (x->move_mode && rename_succeeded)
- *rename_succeeded = false;
-@@ -1069,7 +1070,14 @@ copy_internal (char const *src_name, char const *dst_name,
-
- if (!new_dst)
- {
-- if (XSTAT (x, dst_name, &dst_sb) != 0)
-+ if ( x->cmd_install && ( x->backup_type == no_backups))
-+ dst_stat_result = lstat (dst_name, &dst_sb);
-+ else
-+ {
-+ dst_stat_result = XSTAT (x, dst_name, &dst_sb);
-+ }
-+
-+ if (dst_stat_result != 0)
- {
- if (errno != ENOENT)
- {
-diff --git a/src/copy.h b/src/copy.h
---- a/src/copy.h
-+++ b/src/copy.h
-@@ -114,6 +114,9 @@ struct cp_options
- If that fails, then resort to copying. */
- bool move_mode;
-
-+ /* For the install command */
-+ bool cmd_install;
-+
- /* Whether this process has appropriate privileges to chown a file
- whose owner is not the effective user ID. */
- bool chown_privileges;
-diff --git a/src/install.c b/src/install.c
---- a/src/install.c
-+++ b/src/install.c
-@@ -149,6 +149,7 @@ cp_option_init (struct cp_options *x)
- x->hard_link = false;
- x->interactive = I_UNSPECIFIED;
- x->move_mode = false;
-+ x->cmd_install = true;
- x->chown_privileges = chown_privileges ();
- x->one_file_system = false;
- x->preserve_ownership = false;
---
-1.7.0.1
-
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch
deleted file mode 100644
index 3ae5a2faeb..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch
+++ /dev/null
@@ -1,375 +0,0 @@
-From 170be4023bbf9e9698a709e03265945588ac8e01 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Tue, 26 Nov 2013 00:21:50 +0800
-Subject: [PATCH] doc/coreutils.texi: Use '@item' instead of '@itemx'
-
-Use '@item' instead of '@itemx' in several places, as Texinfo 5 refuses
-to process an '@itemx' that is not preceded by an '@item'. Ensure that
-node extended names in menus and sectioning are consistent, and that
-ordering and presence of nodes in menus and in the actual text are
-consistent as well.
-
-Upstream-Status: Backport [From: coreutils.7620.n7.nabble.com, bug#11828]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- doc/coreutils.texi | 82 +++++++++++++++++++++++++++---------------------------
- 1 file changed, 41 insertions(+), 41 deletions(-)
-
-diff --git a/doc/coreutils.texi b/doc/coreutils.texi
-index 588147f..2dae3fe 100644
---- a/doc/coreutils.texi
-+++ b/doc/coreutils.texi
-@@ -555,7 +555,7 @@ symbolic link to a directory. @xref{Target directory}.
- @end macro
-
- @macro optSi
--@itemx --si
-+@item --si
- @opindex --si
- @cindex SI output
- Append an SI-style abbreviation to each size, such as @samp{M} for
-@@ -578,7 +578,7 @@ Use the @option{--si} option if you prefer powers of 1000.
- @end macro
-
- @macro optStripTrailingSlashes
--@itemx @w{@kbd{--strip-trailing-slashes}}
-+@item @w{@kbd{--strip-trailing-slashes}}
- @opindex --strip-trailing-slashes
- @cindex stripping trailing slashes
- Remove any trailing slashes from each @var{source} argument.
-@@ -2496,7 +2496,7 @@ by 1048576.
- However, if @var{n} starts with a @samp{-},
- print all but the last @var{n} bytes of each file.
-
--@itemx -n @var{n}
-+@item -n @var{n}
- @itemx --lines=@var{n}
- @opindex -n
- @opindex --lines
-@@ -2633,7 +2633,7 @@ This option is the same as @option{--follow=name --retry}. That is, tail
- will attempt to reopen a file when it is removed. Should this fail, tail
- will keep trying until it becomes accessible again.
-
--@itemx --retry
-+@item --retry
- @opindex --retry
- This option is useful mainly when following by name (i.e., with
- @option{--follow=name}).
-@@ -2641,7 +2641,7 @@ Without this option, when tail encounters a file that doesn't
- exist or is otherwise inaccessible, it reports that fact and
- never checks it again.
-
--@itemx --sleep-interval=@var{number}
-+@item --sleep-interval=@var{number}
- @opindex --sleep-interval
- Change the number of seconds to wait between iterations (the default is 1.0).
- During one iteration, every specified file is checked to see if it has
-@@ -2651,7 +2651,7 @@ Historical implementations of @command{tail} have required that
- an arbitrary floating point number (using a period before any
- fractional digits).
-
--@itemx --pid=@var{pid}
-+@item --pid=@var{pid}
- @opindex --pid
- When following by name or by descriptor, you may specify the process ID,
- @var{pid}, of the sole writer of all @var{file} arguments. Then, shortly
-@@ -2674,7 +2674,7 @@ terminate until long after the real writer has terminated.
- Note that @option{--pid} cannot be supported on some systems; @command{tail}
- will print a warning if this is the case.
-
--@itemx --max-unchanged-stats=@var{n}
-+@item --max-unchanged-stats=@var{n}
- @opindex --max-unchanged-stats
- When tailing a file by name, if there have been @var{n} (default
- n=@value{DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS}) consecutive
-@@ -2686,7 +2686,7 @@ number of seconds between when tail prints the last pre-rotation lines
- and when it prints the lines that have accumulated in the new log file.
- This option is meaningful only when following by name.
-
--@itemx -n @var{n}
-+@item -n @var{n}
- @itemx --lines=@var{n}
- @opindex -n
- @opindex --lines
-@@ -2817,7 +2817,7 @@ option.
- @opindex --numeric-suffixes
- Use digits in suffixes rather than lower-case letters.
-
--@itemx --verbose
-+@item --verbose
- @opindex --verbose
- Write a diagnostic to standard error just before each output file is opened.
-
-@@ -3055,7 +3055,7 @@ Print only the newline counts.
- @opindex --max-line-length
- Print only the maximum line lengths.
-
--@itemx --files0-from=@var{FILE}
-+@item --files0-from=@var{FILE}
- @opindex --files0-from=@var{FILE}
- @cindex including files from @command{du}
- Rather than processing files named on the command line, process those
-@@ -3250,7 +3250,7 @@ an MD5 checksum inconsistent with the associated file, or if no valid
- line is found, @command{md5sum} exits with nonzero status. Otherwise,
- it exits successfully.
-
--@itemx --status
-+@item --status
- @opindex --status
- @cindex verifying MD5 checksums
- This option is useful only when verifying checksums.
-@@ -5837,7 +5837,7 @@ command line unless the @option{--dereference-command-line} (@option{-H}),
- If a command line argument specifies a symbolic link, show information
- for the file the link references rather than for the link itself.
-
--@itemx --dereference-command-line-symlink-to-dir
-+@item --dereference-command-line-symlink-to-dir
- @opindex --dereference-command-line-symlink-to-dir
- @cindex symbolic links, dereferencing
- Do not dereference symbolic links, with one exception:
-@@ -7015,15 +7015,15 @@ If specified, the @var{attribute_list} must be a comma-separated list
- of one or more of the following strings:
-
- @table @samp
--@itemx mode
-+@item mode
- Preserve the file mode bits and access control lists.
--@itemx ownership
-+@item ownership
- Preserve the owner and group. On most modern systems,
- only users with appropriate privileges may change the owner of a file,
- and ordinary users
- may preserve the group ownership of a file only if they happen to be
- a member of the desired group.
--@itemx timestamps
-+@item timestamps
- Preserve the times of last access and last modification, when possible.
- In general, it is not possible to preserve these attributes
- when the affected file is a symbolic link.
-@@ -7031,12 +7031,12 @@ However, FreeBSD now provides the @code{lutimes} function, which makes
- it possibile even for symbolic links. However, this implementation does
- not yet take advantage of that.
- @c FIXME: once we provide lutimes support, update the above.
--@itemx links
-+@item links
- Preserve in the destination files
- any links between corresponding source files.
- @c Give examples illustrating how hard links are preserved.
- @c Also, show how soft links map to hard links with -L and -H.
--@itemx all
-+@item all
- Preserve all file attributes.
- Equivalent to specifying all of the above.
- @end table
-@@ -7049,12 +7049,12 @@ mode bits of the corresponding source file, minus the bits set in the
- umask and minus the set-user-ID and set-group-ID bits.
- @xref{File permissions}.
-
--@itemx @w{@kbd{--no-preserve}=@var{attribute_list}}
-+@item @w{@kbd{--no-preserve}=@var{attribute_list}}
- @cindex file information, preserving
- Do not preserve the specified attributes. The @var{attribute_list}
- has the same form as for @option{--preserve}.
-
--@itemx --parents
-+@item --parents
- @opindex --parents
- @cindex parent directories and @command{cp}
- Form the name of each destination file by appending to the target
-@@ -7070,7 +7070,7 @@ cp --parents a/b/c existing_dir
- copies the file @file{a/b/c} to @file{existing_dir/a/b/c}, creating
- any missing intermediate directories.
-
--@itemx @w{@kbd{--reply}=@var{how}}
-+@item @w{@kbd{--reply}=@var{how}}
- @opindex --reply
- @cindex interactivity
- @c FIXME: remove in 2008
-@@ -7742,7 +7742,7 @@ Prompt whether to overwrite each existing destination file, regardless
- of its permissions.
- If the response is not affirmative, the file is skipped.
-
--@itemx @w{@kbd{--reply}=@var{how}}
-+@item @w{@kbd{--reply}=@var{how}}
- @opindex --reply
- @cindex interactivity
- @c FIXME: remove in 2008
-@@ -7847,7 +7847,7 @@ files are named or if a recursive removal is requested. Ignore any
- previous @option{--force} (@option{-f}) option. Equivalent to
- @option{--interactive=once}.
-
--@itemx --interactive [=@var{when}]
-+@item --interactive [=@var{when}]
- @opindex --interactive
- Specify when to issue an interactive prompt. @var{when} may be
- omitted, or one of:
-@@ -7866,7 +7866,7 @@ removal is requested. Equivalent to @option{-I}.
- Specifying @option{--interactive} and no @var{when} is equivalent to
- @option{--interactive=always}.
-
--@itemx --one-file-system
-+@item --one-file-system
- @opindex --one-file-system
- @cindex one file system, restricting @command{rm} to
- When removing a hierarchy recursively, skip any directory that is on a
-@@ -7884,7 +7884,7 @@ warn about and skip directories on other file systems.
- Of course, this will not save your @file{/home} if it and your
- chroot happen to be on the same file system.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive destruction
- Fail upon any attempt to remove the root directory, @file{/},
-@@ -7892,7 +7892,7 @@ when used with the @option{--recursive} option.
- This is the default behavior.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive destruction
- Do not treat @file{/} specially when removing recursively.
-@@ -8874,7 +8874,7 @@ actually changes.
- Do not print error messages about files whose ownership cannot be
- changed.
-
--@itemx @w{@kbd{--from}=@var{old-owner}}
-+@item @w{@kbd{--from}=@var{old-owner}}
- @opindex --from
- @cindex symbolic links, changing owner
- Change a @var{file}'s ownership only if it has current attributes specified
-@@ -8928,14 +8928,14 @@ is a symbolic link.
- By default, no diagnostic is issued for symbolic links encountered
- during a recursive traversal, but see @option{--verbose}.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9054,14 +9054,14 @@ is a symbolic link.
- By default, no diagnostic is issued for symbolic links encountered
- during a recursive traversal, but see @option{--verbose}.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9175,14 +9175,14 @@ actually changes.
- Do not print error messages about files whose permissions cannot be
- changed.
-
--@itemx --preserve-root
-+@item --preserve-root
- @opindex --preserve-root
- @cindex root directory, disallow recursive modification
- Fail upon any attempt to recursively change the root directory, @file{/}.
- Without @option{--recursive}, this option has no effect.
- @xref{Treating / specially}.
-
--@itemx --no-preserve-root
-+@item --no-preserve-root
- @opindex --no-preserve-root
- @cindex root directory, allow recursive modification
- Cancel the effect of any preceding @option{--preserve-root} option.
-@@ -9603,7 +9603,7 @@ The program accepts the following options. Also see @ref{Common options}.
- @opindex --all
- Show counts for all files, not just directories.
-
--@itemx --apparent-size
-+@item --apparent-size
- @opindex --apparent-size
- Print apparent sizes, rather than disk usage. The apparent size of a
- file is the number of bytes reported by @code{wc -c} on regular files,
-@@ -9654,7 +9654,7 @@ Does not affect other symbolic links. This is helpful for finding
- out the disk usage of directories, such as @file{/usr/tmp}, which
- are often symbolic links.
-
--@itemx --files0-from=@var{FILE}
-+@item --files0-from=@var{FILE}
- @opindex --files0-from=@var{FILE}
- @cindex including files from @command{du}
- Rather than processing files named on the command line, process those
-@@ -9733,7 +9733,7 @@ Output a null byte at the end of each line, rather than a newline.
- This option enables other programs to parse the output of @command{du}
- even when that output would contain file names with embedded newlines.
-
--@itemx --si
-+@item --si
- @opindex --si
- @cindex SI output
- Append an SI-style abbreviation to each size, such as @samp{MB} for
-@@ -9754,13 +9754,13 @@ Display only a total for each argument.
- Report the size of each directory separately, not including the sizes
- of subdirectories.
-
--@itemx --time
-+@item --time
- @opindex --time
- @cindex last modified dates, displaying in @command{du}
- Show time of the most recent modification of any file in the directory,
- or any of its subdirectories.
-
--@itemx --time=ctime
-+@item --time=ctime
- @itemx --time=status
- @itemx --time=use
- @opindex --time
-@@ -9770,7 +9770,7 @@ or any of its subdirectories.
- Show the most recent status change time (the @samp{ctime} in the inode) of
- any file in the directory, instead of the modification time.
-
--@itemx --time=atime
-+@item --time=atime
- @itemx --time=access
- @opindex --time
- @opindex atime@r{, show the most recent}
-@@ -9911,7 +9911,7 @@ $ stat --format=%d:%i / /usr
- 2057:2
- @end example
-
--@itemx --printf=@var{format}
-+@item --printf=@var{format}
- @opindex --printf=@var{format}
- @cindex output format
- Use @var{format} rather than the default format.
-@@ -12240,7 +12240,7 @@ Overrides all other options.
- @opindex -s
- Ignored; for compatibility with other versions of @command{who}.
-
--@itemx -u
-+@item -u
- @opindex -u
- @cindex idle time
- After the login time, print the number of hours and minutes that the
-@@ -12254,7 +12254,7 @@ user has been idle. @samp{.} means the user was active in the last minute.
- List only the entries that correspond to processes via which the
- system is waiting for a user to login. The user name is always @samp{LOGIN}.
-
--@itemx --lookup
-+@item --lookup
- @opindex --lookup
- Attempt to canonicalize hostnames found in utmp through a DNS lookup. This
- is not the default because it can cause significant delays on systems with
---
-1.8.3.1
-
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
deleted file mode 100644
index 653722348a..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
+++ /dev/null
@@ -1,4051 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-The comment indicates that the purpose is lin18nux/lsb compliance.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/sort-mb-tests 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,58 @@
-+#! /bin/sh
-+case $# in
-+ 0) xx='../../src/sort';;
-+ *) xx="$1";;
-+esac
-+test "$VERBOSE" && echo=echo || echo=:
-+$echo testing program: $xx
-+errors=0
-+test "$srcdir" || srcdir=.
-+test "$VERBOSE" && $xx --version 2> /dev/null
-+
-+export LC_ALL=en_US.UTF-8
-+locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77
-+errors=0
-+
-+$xx -t @ -k2 -n mb1.I > mb1.O
-+code=$?
-+if test $code != 0; then
-+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2
-+ errors=`expr $errors + 1`
-+else
-+ cmp mb1.O $srcdir/mb1.X > /dev/null 2>&1
-+ case $? in
-+ 0) if test "$VERBOSE"; then $echo "passed mb1"; fi;;
-+ 1) $echo "Test mb1 failed: files mb1.O and $srcdir/mb1.X differ" 1>&2
-+ (diff -c mb1.O $srcdir/mb1.X) 2> /dev/null
-+ errors=`expr $errors + 1`;;
-+ 2) $echo "Test mb1 may have failed." 1>&2
-+ $echo The command "cmp mb1.O $srcdir/mb1.X" failed. 1>&2
-+ errors=`expr $errors + 1`;;
-+ esac
-+fi
-+
-+$xx -t @ -k4 -n mb2.I > mb2.O
-+code=$?
-+if test $code != 0; then
-+ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2
-+ errors=`expr $errors + 1`
-+else
-+ cmp mb2.O $srcdir/mb2.X > /dev/null 2>&1
-+ case $? in
-+ 0) if test "$VERBOSE"; then $echo "passed mb2"; fi;;
-+ 1) $echo "Test mb2 failed: files mb2.O and $srcdir/mb2.X differ" 1>&2
-+ (diff -c mb2.O $srcdir/mb2.X) 2> /dev/null
-+ errors=`expr $errors + 1`;;
-+ 2) $echo "Test mb2 may have failed." 1>&2
-+ $echo The command "cmp mb2.O $srcdir/mb2.X" failed. 1>&2
-+ errors=`expr $errors + 1`;;
-+ esac
-+fi
-+
-+if test $errors = 0; then
-+ $echo Passed all 113 tests. 1>&2
-+else
-+ $echo Failed $errors tests. 1>&2
-+fi
-+test $errors = 0 || errors=1
-+exit $errors
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb2.I 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Apple@AA10@@20
-+Banana@AA5@@30
-+Citrus@AA20@@5
-+Cherry@AA30@@10
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb2.X 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Citrus@AA20@@5
-+Cherry@AA30@@10
-+Apple@AA10@@20
-+Banana@AA5@@30
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb1.I 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Apple@10
-+Banana@5
-+Citrus@20
-+Cherry@30
---- /dev/null 2007-03-01 09:16:39.219409909 +0000
-+++ coreutils-6.8+/tests/sort/mb1.X 2007-03-01 15:08:24.000000000 +0000
-@@ -0,0 +1,4 @@
-+Banana@5
-+Apple@10
-+Citrus@20
-+Cherry@30
---- coreutils-6.8+/tests/sort/Makefile.am.i18n 2007-01-24 07:47:37.000000000 +0000
-+++ coreutils-6.8+/tests/sort/Makefile.am 2007-03-01 15:09:59.000000000 +0000
-@@ -66,15 +66,17 @@
- bigfield.O bigfield.E
- ##test-files-end
-
--EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
--noinst_SCRIPTS = $x-tests
-+run_gen += mb1.0 mb2.0
-+
-+EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X
-+noinst_SCRIPTS = $x-tests # $x-mb-tests
- TESTS_ENVIRONMENT = \
- CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
- PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
-
- editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g'
-
--TESTS = $x-tests
-+TESTS = $x-tests $x-mb-tests
-
- mk_script = $(srcdir)/../mk-script
- $(srcdir)/$x-tests: $(mk_script) Test.pm Makefile.am
---- coreutils-6.8+/lib/linebuffer.h.i18n 2005-05-14 07:44:24.000000000 +0100
-+++ coreutils-6.8+/lib/linebuffer.h 2007-03-01 15:08:24.000000000 +0000
-@@ -22,6 +22,11 @@
-
- # include <stdio.h>
-
-+/* Get mbstate_t. */
-+# if HAVE_WCHAR_H
-+# include <wchar.h>
-+# endif
-+
- /* A `struct linebuffer' holds a line of text. */
-
- struct linebuffer
-@@ -29,6 +34,9 @@
- size_t size; /* Allocated. */
- size_t length; /* Used. */
- char *buffer;
-+# if HAVE_WCHAR_H
-+ mbstate_t state;
-+# endif
- };
-
- /* Initialize linebuffer LINEBUFFER for use. */
---- coreutils-6.8+/src/expand.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/expand.c 2007-03-01 15:08:24.000000000 +0000
-@@ -38,11 +38,28 @@
- #include <stdio.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "expand"
-
-@@ -183,6 +200,7 @@
- stops = num_start + len - 1;
- }
- }
-+
- else
- {
- error (0, 0, _("tab size contains invalid character(s): %s"),
-@@ -365,6 +383,142 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+expand_multibyte (void)
-+{
-+ FILE *fp; /* Input strem. */
-+ mbstate_t i_state; /* Current shift state of the input stream. */
-+ mbstate_t i_state_bak; /* Back up the I_STATE. */
-+ mbstate_t o_state; /* Current shift state of the output stream. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ wchar_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character
-+ which shows as same character as WC. */
-+ int tab_index = 0; /* Index in `tab_list' of next tabstop. */
-+ int column = 0; /* Column on screen of the next char. */
-+ int next_tab_column; /* Column the next tab stop is on. */
-+ int convert = 1; /* If nonzero, perform translations. */
-+
-+ fp = next_file ((FILE *) NULL);
-+ if (fp == NULL)
-+ return;
-+
-+ memset (&o_state, '\0', sizeof(mbstate_t));
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ /* Refill the buffer BUF. */
-+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
-+ bufpos = buf;
-+ }
-+
-+ /* No character is left in BUF. */
-+ if (buflen < 1)
-+ {
-+ fp = next_file (fp);
-+
-+ if (fp == NULL)
-+ break; /* No more files. */
-+ else
-+ {
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+ continue;
-+ }
-+ }
-+
-+ /* Get a wide character. */
-+ i_state_bak = i_state;
-+ mblength = mbrtowc (&wc, bufpos, buflen, &i_state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1: /* illegal byte sequence. */
-+ case (size_t)-2:
-+ mblength = 1;
-+ i_state = i_state_bak;
-+ if (convert)
-+ {
-+ ++column;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ putchar (*bufpos);
-+ break;
-+
-+ case 0: /* null. */
-+ mblength = 1;
-+ if (convert && convert_entire_line == 0)
-+ convert = 0;
-+ putchar ('\0');
-+ break;
-+
-+ default:
-+ if (wc == L'\n') /* LF. */
-+ {
-+ tab_index = 0;
-+ column = 0;
-+ convert = 1;
-+ putchar ('\n');
-+ }
-+ else if (wc == L'\t' && convert) /* Tab. */
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (tab_index < first_free_tab - 1
-+ && column >= tab_list[tab_index])
-+ tab_index++;
-+ next_tab_column = tab_list[tab_index];
-+ if (tab_index < first_free_tab - 1)
-+ tab_index++;
-+ if (column >= next_tab_column)
-+ next_tab_column = column + 1;
-+ }
-+ else
-+ next_tab_column = column + tab_size - column % tab_size;
-+
-+ while (column < next_tab_column)
-+ {
-+ putchar (' ');
-+ ++column;
-+ }
-+ }
-+ else /* Others. */
-+ {
-+ if (convert)
-+ {
-+ if (wc == L'\b')
-+ {
-+ if (column > 0)
-+ --column;
-+ }
-+ else
-+ {
-+ int width; /* The width of WC. */
-+
-+ width = wcwidth (wc);
-+ column += (width > 0) ? width : 0;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ }
-+ fwrite (bufpos, sizeof(char), mblength, stdout);
-+ }
-+ }
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
- int
- main (int argc, char **argv)
- {
-@@ -429,7 +583,12 @@
-
- file_list = (optind < argc ? &argv[optind] : stdin_argv);
-
-- expand ();
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ expand_multibyte ();
-+ else
-+#endif
-+ expand ();
-
- if (have_read_stdin && fclose (stdin) != 0)
- error (EXIT_FAILURE, errno, "-");
---- coreutils-6.8+/src/join.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/join.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,16 +23,30 @@
- #include <sys/types.h>
- #include <getopt.h>
-
-+/* Get mbstate_t, mbrtowc(), mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswblank(), towupper. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "hard-locale.h"
- #include "linebuffer.h"
--#include "memcasecmp.h"
- #include "quote.h"
- #include "stdio--.h"
- #include "xmemcoll.h"
- #include "xstrtol.h"
-
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "join"
-
-@@ -104,10 +118,12 @@
- /* Last element in `outlist', where a new element can be added. */
- static struct outlist *outlist_end = &outlist_head;
-
--/* Tab character separating fields. If negative, fields are separated
-- by any nonempty string of blanks, otherwise by exactly one
-- tab character whose value (when cast to unsigned char) equals TAB. */
--static int tab = -1;
-+/* Tab character separating fields. If NULL, fields are separated
-+ by any nonempty string of blanks. */
-+static char *tab = NULL;
-+
-+/* The number of bytes used for tab. */
-+static size_t tablen = 0;
-
- static struct option const longopts[] =
- {
-@@ -190,6 +206,8 @@
-
- /* Fill in the `fields' structure in LINE. */
-
-+/* Fill in the `fields' structure in LINE. */
-+
- static void
- xfields (struct line *line)
- {
-@@ -199,10 +217,11 @@
- if (ptr == lim)
- return;
-
-- if (0 <= tab)
-+ if (tab != NULL)
- {
-+ unsigned char t = tab[0];
- char *sep;
-- for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1)
-+ for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1)
- extract_field (line, ptr, sep - ptr);
- }
- else
-@@ -229,6 +248,148 @@
- extract_field (line, ptr, lim - ptr);
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+xfields_multibyte (struct line *line)
-+{
-+ char *ptr = line->buf.buffer;
-+ char const *lim = ptr + line->buf.length - 1;
-+ wchar_t wc = 0;
-+ size_t mblength = 1;
-+ mbstate_t state, state_bak;
-+
-+ memset (&state, 0, sizeof (mbstate_t));
-+
-+ if (ptr == lim)
-+ return;
-+
-+ if (tab != NULL)
-+ {
-+ unsigned char t = tab[0];
-+ char *sep = ptr;
-+ for (; ptr < lim; ptr = sep + mblength)
-+ {
-+ sep = ptr;
-+ while (sep < lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (mblength == tablen && !memcmp (sep, tab, mblength))
-+ break;
-+ else
-+ {
-+ sep += mblength;
-+ continue;
-+ }
-+ }
-+
-+ if (sep == lim)
-+ break;
-+
-+ extract_field (line, ptr, sep - ptr);
-+ }
-+ }
-+ else
-+ {
-+ /* Skip leading blanks before the first field. */
-+ while(ptr < lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (!iswblank(wc))
-+ break;
-+ ptr += mblength;
-+ }
-+
-+ do
-+ {
-+ char *sep;
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ sep = ptr + mblength;
-+ while (sep != lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (iswblank (wc))
-+ break;
-+
-+ sep += mblength;
-+ }
-+
-+ extract_field (line, ptr, sep - ptr);
-+ if (sep == lim)
-+ return;
-+
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ ptr = sep + mblength;
-+ while (ptr != lim)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ mblength = 1;
-+ state = state_bak;
-+ break;
-+ }
-+ mblength = (mblength < 1) ? 1 : mblength;
-+
-+ if (!iswblank (wc))
-+ break;
-+
-+ ptr += mblength;
-+ }
-+ }
-+ while (ptr != lim);
-+ }
-+
-+ extract_field (line, ptr, lim - ptr);
-+}
-+#endif
-+
- /* Read a line from FP into LINE and split it into fields.
- Return true if successful. */
-
-@@ -249,6 +410,11 @@
- line->nfields_allocated = 0;
- line->nfields = 0;
- line->fields = NULL;
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ xfields_multibyte (line);
-+ else
-+#endif
- xfields (line);
- return true;
- }
-@@ -303,56 +469,114 @@
- keycmp (struct line const *line1, struct line const *line2)
- {
- /* Start of field to compare in each file. */
-- char *beg1;
-- char *beg2;
--
-- size_t len1;
-- size_t len2; /* Length of fields to compare. */
-+ char *beg[2];
-+ char *copy[2];
-+ size_t len[2]; /* Length of fields to compare. */
- int diff;
-+ int i, j;
-
- if (join_field_1 < line1->nfields)
- {
-- beg1 = line1->fields[join_field_1].beg;
-- len1 = line1->fields[join_field_1].len;
-+ beg[0] = line1->fields[join_field_1].beg;
-+ len[0] = line1->fields[join_field_1].len;
- }
- else
- {
-- beg1 = NULL;
-- len1 = 0;
-+ beg[0] = NULL;
-+ len[0] = 0;
- }
-
- if (join_field_2 < line2->nfields)
- {
-- beg2 = line2->fields[join_field_2].beg;
-- len2 = line2->fields[join_field_2].len;
-+ beg[1] = line2->fields[join_field_2].beg;
-+ len[1] = line2->fields[join_field_2].len;
- }
- else
- {
-- beg2 = NULL;
-- len2 = 0;
-+ beg[1] = NULL;
-+ len[1] = 0;
- }
-
-- if (len1 == 0)
-- return len2 == 0 ? 0 : -1;
-- if (len2 == 0)
-+ if (len[0] == 0)
-+ return len[1] == 0 ? 0 : -1;
-+ if (len[1] == 0)
- return 1;
-
- if (ignore_case)
- {
-- /* FIXME: ignore_case does not work with NLS (in particular,
-- with multibyte chars). */
-- diff = memcasecmp (beg1, beg2, MIN (len1, len2));
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ size_t mblength;
-+ wchar_t wc, uwc;
-+ mbstate_t state, state_bak;
-+
-+ memset (&state, '\0', sizeof (mbstate_t));
-+
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0; j < MIN (len[0], len[1]);)
-+ {
-+ state_bak = state;
-+ mblength = mbrtowc (&wc, beg[i] + j, len[i] - j, &state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t) -1:
-+ case (size_t) -2:
-+ state = state_bak;
-+ /* Fall through */
-+ case 0:
-+ mblength = 1;
-+ break;
-+
-+ default:
-+ uwc = towupper (wc);
-+
-+ if (uwc != wc)
-+ {
-+ mbstate_t state_wc;
-+
-+ memset (&state_wc, '\0', sizeof (mbstate_t));
-+ wcrtomb (copy[i] + j, uwc, &state_wc);
-+ }
-+ else
-+ memcpy (copy[i] + j, beg[i] + j, mblength);
-+ }
-+ j += mblength;
-+ }
-+ copy[i][j] = '\0';
-+ }
-+ }
-+ else
-+#endif
-+ {
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0; j < MIN (len[0], len[1]); j++)
-+ copy[i][j] = toupper (beg[i][j]);
-+
-+ copy[i][j] = '\0';
-+ }
-+ }
- }
- else
- {
-- if (hard_LC_COLLATE)
-- return xmemcoll (beg1, len1, beg2, len2);
-- diff = memcmp (beg1, beg2, MIN (len1, len2));
-+ copy[0] = (unsigned char *) beg[0];
-+ copy[1] = (unsigned char *) beg[1];
- }
-
-+ if (hard_LC_COLLATE)
-+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
-+ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1]));
-+
- if (diff)
- return diff;
-- return len1 < len2 ? -1 : len1 != len2;
-+ return len[0] - len[1];
- }
-
- /* Print field N of LINE if it exists and is nonempty, otherwise
-@@ -377,11 +601,18 @@
-
- /* Print the join of LINE1 and LINE2. */
-
-+#define PUT_TAB_CHAR \
-+ do \
-+ { \
-+ (tab != NULL) ? \
-+ fwrite(tab, sizeof(char), tablen, stdout) : putchar (' '); \
-+ } \
-+ while (0)
-+
- static void
- prjoin (struct line const *line1, struct line const *line2)
- {
- const struct outlist *outlist;
-- char output_separator = tab < 0 ? ' ' : tab;
-
- outlist = outlist_head.next;
- if (outlist)
-@@ -397,12 +628,12 @@
- if (o->file == 0)
- {
- if (line1 == &uni_blank)
-- {
-+ {
- line = line2;
- field = join_field_2;
- }
- else
-- {
-+ {
- line = line1;
- field = join_field_1;
- }
-@@ -416,7 +647,7 @@
- o = o->next;
- if (o == NULL)
- break;
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- }
- putchar ('\n');
- }
-@@ -434,23 +665,23 @@
- prfield (join_field_1, line1);
- for (i = 0; i < join_field_1 && i < line1->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line1);
- }
- for (i = join_field_1 + 1; i < line1->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line1);
- }
-
- for (i = 0; i < join_field_2 && i < line2->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line2);
- }
- for (i = join_field_2 + 1; i < line2->nfields; ++i)
- {
-- putchar (output_separator);
-+ PUT_TAB_CHAR;
- prfield (i, line2);
- }
- putchar ('\n');
-@@ -859,20 +1090,41 @@
-
- case 't':
- {
-- unsigned char newtab = optarg[0];
-- if (! newtab)
-+ char *newtab;
-+ size_t newtablen;
-+ if (! optarg[0])
- error (EXIT_FAILURE, 0, _("empty tab"));
-- if (optarg[1])
-+ newtab = xstrdup (optarg);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ mbstate_t state;
-+
-+ memset (&state, 0, sizeof (mbstate_t));
-+ newtablen = mbrtowc (NULL, newtab,
-+ strnlen (newtab, MB_LEN_MAX),
-+ &state);
-+ if (newtablen == (size_t) 0
-+ || newtablen == (size_t) -1
-+ || newtablen == (size_t) -2)
-+ newtablen = 1;
-+ }
-+ else
-+#endif
-+ newtablen = 1;
-+
-+ if (newtablen == 1 && newtab[1])
-+ {
-+ if (STREQ (newtab, "\\0"))
-+ newtab[0] = '\0';
-+ }
-+ if (tab != NULL && strcmp (tab, newtab))
- {
-- if (STREQ (optarg, "\\0"))
-- newtab = '\0';
-- else
-- error (EXIT_FAILURE, 0, _("multi-character tab %s"),
-- quote (optarg));
-+ free (newtab);
-+ error (EXIT_FAILURE, 0, _("incompatible tabs"));
- }
-- if (0 <= tab && tab != newtab)
-- error (EXIT_FAILURE, 0, _("incompatible tabs"));
- tab = newtab;
-+ tablen = newtablen;
- }
- break;
-
---- coreutils-6.8+/src/uniq.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/uniq.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,6 +23,16 @@
- #include <getopt.h>
- #include <sys/types.h>
-
-+/* Get mbstate_t, mbrtowc(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get isw* functions. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "argmatch.h"
- #include "linebuffer.h"
-@@ -32,7 +42,19 @@
- #include "quote.h"
- #include "xmemcoll.h"
- #include "xstrtol.h"
--#include "memcasecmp.h"
-+#include "xmemcoll.h"
-+
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
-
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "uniq"
-@@ -109,6 +131,10 @@
- /* Select whether/how to delimit groups of duplicate lines. */
- static enum delimit_method delimit_groups;
-
-+/* Function pointers. */
-+static char *
-+(*find_field) (struct linebuffer *line);
-+
- static struct option const longopts[] =
- {
- {"count", no_argument, NULL, 'c'},
-@@ -198,7 +224,7 @@
- return a pointer to the beginning of the line's field to be compared. */
-
- static char *
--find_field (const struct linebuffer *line)
-+find_field_uni (struct linebuffer *line)
- {
- size_t count;
- char *lp = line->buffer;
-@@ -219,6 +245,83 @@
- return lp + i;
- }
-
-+#if HAVE_MBRTOWC
-+
-+# define MBCHAR_TO_WCHAR(WC, MBLENGTH, LP, POS, SIZE, STATEP, CONVFAIL) \
-+ do \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ CONVFAIL = 0; \
-+ state_bak = *STATEP; \
-+ \
-+ MBLENGTH = mbrtowc (&WC, LP + POS, SIZE - POS, STATEP); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-2: \
-+ case (size_t)-1: \
-+ *STATEP = state_bak; \
-+ CONVFAIL++; \
-+ /* Fall through */ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ } \
-+ } \
-+ while (0)
-+
-+static char *
-+find_field_multi (struct linebuffer *line)
-+{
-+ size_t count;
-+ char *lp = line->buffer;
-+ size_t size = line->length - 1;
-+ size_t pos;
-+ size_t mblength;
-+ wchar_t wc;
-+ mbstate_t *statep;
-+ int convfail;
-+
-+ pos = 0;
-+ statep = &(line->state);
-+
-+ /* skip fields. */
-+ for (count = 0; count < skip_fields && pos < size; count++)
-+ {
-+ while (pos < size)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+
-+ if (convfail || !iswblank (wc))
-+ {
-+ pos += mblength;
-+ break;
-+ }
-+ pos += mblength;
-+ }
-+
-+ while (pos < size)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+
-+ if (!convfail && iswblank (wc))
-+ break;
-+
-+ pos += mblength;
-+ }
-+ }
-+
-+ /* skip fields. */
-+ for (count = 0; count < skip_chars && pos < size; count++)
-+ {
-+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
-+ pos += mblength;
-+ }
-+
-+ return lp + pos;
-+}
-+#endif
-+
- /* Return false if two strings OLD and NEW match, true if not.
- OLD and NEW point not to the beginnings of the lines
- but rather to the beginnings of the fields to compare.
-@@ -227,6 +330,8 @@
- static bool
- different (char *old, char *new, size_t oldlen, size_t newlen)
- {
-+ char *copy_old, *copy_new;
-+
- if (check_chars < oldlen)
- oldlen = check_chars;
- if (check_chars < newlen)
-@@ -234,14 +339,92 @@
-
- if (ignore_case)
- {
-- /* FIXME: This should invoke strcoll somehow. */
-- return oldlen != newlen || memcasecmp (old, new, oldlen);
-+ size_t i;
-+
-+ copy_old = alloca (oldlen + 1);
-+ copy_new = alloca (oldlen + 1);
-+
-+ for (i = 0; i < oldlen; i++)
-+ {
-+ copy_old[i] = toupper (old[i]);
-+ copy_new[i] = toupper (new[i]);
-+ }
- }
-- else if (hard_LC_COLLATE)
-- return xmemcoll (old, oldlen, new, newlen) != 0;
- else
-- return oldlen != newlen || memcmp (old, new, oldlen);
-+ {
-+ copy_old = (char *)old;
-+ copy_new = (char *)new;
-+ }
-+
-+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
-+}
-+
-+#if HAVE_MBRTOWC
-+static int
-+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
-+{
-+ size_t i, j, chars;
-+ const char *str[2];
-+ char *copy[2];
-+ size_t len[2];
-+ mbstate_t state[2];
-+ size_t mblength;
-+ wchar_t wc, uwc;
-+ mbstate_t state_bak;
-+
-+ str[0] = old;
-+ str[1] = new;
-+ len[0] = oldlen;
-+ len[1] = newlen;
-+ state[0] = oldstate;
-+ state[1] = newstate;
-+
-+ for (i = 0; i < 2; i++)
-+ {
-+ copy[i] = alloca (len[i] + 1);
-+
-+ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
-+ {
-+ state_bak = state[i];
-+ mblength = mbrtowc (&wc, str[i] + j, len[i] - j, &(state[i]));
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1:
-+ case (size_t)-2:
-+ state[i] = state_bak;
-+ /* Fall through */
-+ case 0:
-+ mblength = 1;
-+ break;
-+
-+ default:
-+ if (ignore_case)
-+ {
-+ uwc = towupper (wc);
-+
-+ if (uwc != wc)
-+ {
-+ mbstate_t state_wc;
-+
-+ memset (&state_wc, '\0', sizeof(mbstate_t));
-+ wcrtomb (copy[i] + j, uwc, &state_wc);
-+ }
-+ else
-+ memcpy (copy[i] + j, str[i] + j, mblength);
-+ }
-+ else
-+ memcpy (copy[i] + j, str[i] + j, mblength);
-+ }
-+ j += mblength;
-+ }
-+ copy[i][j] = '\0';
-+ len[i] = j;
-+ }
-+
-+ return xmemcoll (copy[0], len[0], copy[1], len[1]);
- }
-+#endif
-
- /* Output the line in linebuffer LINE to standard output
- provided that the switches say it should be output.
-@@ -295,15 +478,43 @@
- {
- char *prevfield IF_LINT (= NULL);
- size_t prevlen IF_LINT (= 0);
-+#if HAVE_MBRTOWC
-+ mbstate_t prevstate;
-+
-+ memset (&prevstate, '\0', sizeof (mbstate_t));
-+#endif
-
- while (!feof (stdin))
- {
- char *thisfield;
- size_t thislen;
-+#if HAVE_MBRTOWC
-+ mbstate_t thisstate;
-+#endif
-+
- if (readlinebuffer (thisline, stdin) == 0)
- break;
- thisfield = find_field (thisline);
- thislen = thisline->length - 1 - (thisfield - thisline->buffer);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ thisstate = thisline->state;
-+
-+ if (prevline->length == 0 || different_multi
-+ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate))
-+ {
-+ fwrite (thisline->buffer, sizeof (char),
-+ thisline->length, stdout);
-+
-+ SWAP_LINES (prevline, thisline);
-+ prevfield = thisfield;
-+ prevlen = thislen;
-+ prevstate = thisstate;
-+ }
-+ }
-+ else
-+#endif
- if (prevline->length == 0
- || different (thisfield, prevfield, thislen, prevlen))
- {
-@@ -322,17 +533,26 @@
- size_t prevlen;
- uintmax_t match_count = 0;
- bool first_delimiter = true;
-+#if HAVE_MBRTOWC
-+ mbstate_t prevstate;
-+#endif
-
- if (readlinebuffer (prevline, stdin) == 0)
- goto closefiles;
- prevfield = find_field (prevline);
- prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
-+#if HAVE_MBRTOWC
-+ prevstate = prevline->state;
-+#endif
-
- while (!feof (stdin))
- {
- bool match;
- char *thisfield;
- size_t thislen;
-+#if HAVE_MBRTOWC
-+ mbstate_t thisstate;
-+#endif
- if (readlinebuffer (thisline, stdin) == 0)
- {
- if (ferror (stdin))
-@@ -341,6 +561,15 @@
- }
- thisfield = find_field (thisline);
- thislen = thisline->length - 1 - (thisfield - thisline->buffer);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ thisstate = thisline->state;
-+ match = !different_multi (thisfield, prevfield,
-+ thislen, prevlen, thisstate, prevstate);
-+ }
-+ else
-+#endif
- match = !different (thisfield, prevfield, thislen, prevlen);
- match_count += match;
-
-@@ -373,6 +602,9 @@
- SWAP_LINES (prevline, thisline);
- prevfield = thisfield;
- prevlen = thislen;
-+#if HAVE_MBRTOWC
-+ prevstate = thisstate;
-+#endif
- if (!match)
- match_count = 0;
- }
-@@ -417,6 +649,19 @@
-
- atexit (close_stdout);
-
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ find_field = find_field_multi;
-+ }
-+ else
-+#endif
-+ {
-+ find_field = find_field_uni;
-+ }
-+
-+
-+
- skip_chars = 0;
- skip_fields = 0;
- check_chars = SIZE_MAX;
---- coreutils-6.8+/src/fold.c.i18n 2007-02-23 12:01:47.000000000 +0000
-+++ coreutils-6.8+/src/fold.c 2007-03-01 15:08:24.000000000 +0000
-@@ -23,11 +23,33 @@
- #include <getopt.h>
- #include <sys/types.h>
-
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswprint(), iswblank(), wcwidth(). */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrtol.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# undef MB_LEN_MAX
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- #define TAB_WIDTH 8
-
- /* The official name of this program (e.g., no `g' prefix). */
-@@ -35,23 +57,44 @@
-
- #define AUTHORS "David MacKenzie"
-
-+#define FATAL_ERROR(Message) \
-+ do \
-+ { \
-+ error (0, 0, (Message)); \
-+ usage (2); \
-+ } \
-+ while (0)
-+
-+enum operating_mode
-+{
-+ /* Fold texts by columns that are at the given positions. */
-+ column_mode,
-+
-+ /* Fold texts by bytes that are at the given positions. */
-+ byte_mode,
-+
-+ /* Fold texts by characters that are at the given positions. */
-+ character_mode,
-+};
-+
- /* The name this program was run with. */
- char *program_name;
-
-+/* The argument shows current mode. (Default: column_mode) */
-+static enum operating_mode operating_mode;
-+
- /* If nonzero, try to break on whitespace. */
- static bool break_spaces;
-
--/* If nonzero, count bytes, not column positions. */
--static bool count_bytes;
--
- /* If nonzero, at least one of the files we read was standard input. */
- static bool have_read_stdin;
-
--static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::";
-+static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::";
-
- static struct option const longopts[] =
- {
- {"bytes", no_argument, NULL, 'b'},
-+ {"characters", no_argument, NULL, 'c'},
- {"spaces", no_argument, NULL, 's'},
- {"width", required_argument, NULL, 'w'},
- {GETOPT_HELP_OPTION_DECL},
-@@ -81,6 +124,7 @@
- "), stdout);
- fputs (_("\
- -b, --bytes count bytes rather than columns\n\
-+ -c, --characters count characters rather than columns\n\
- -s, --spaces break at spaces\n\
- -w, --width=WIDTH use WIDTH columns instead of 80\n\
- "), stdout);
-@@ -98,7 +142,7 @@
- static size_t
- adjust_column (size_t column, char c)
- {
-- if (!count_bytes)
-+ if (operating_mode != byte_mode)
- {
- if (c == '\b')
- {
-@@ -121,30 +165,14 @@
- to stdout, with maximum line length WIDTH.
- Return true if successful. */
-
--static bool
--fold_file (char const *filename, size_t width)
-+static void
-+fold_text (FILE *istream, size_t width, int *saved_errno)
- {
-- FILE *istream;
- int c;
- size_t column = 0; /* Screen column where next char will go. */
- size_t offset_out = 0; /* Index in `line_out' for next char. */
- static char *line_out = NULL;
- static size_t allocated_out = 0;
-- int saved_errno;
--
-- if (STREQ (filename, "-"))
-- {
-- istream = stdin;
-- have_read_stdin = true;
-- }
-- else
-- istream = fopen (filename, "r");
--
-- if (istream == NULL)
-- {
-- error (0, errno, "%s", filename);
-- return false;
-- }
-
- while ((c = getc (istream)) != EOF)
- {
-@@ -172,6 +200,15 @@
- bool found_blank = false;
- size_t logical_end = offset_out;
-
-+ /* If LINE_OUT has no wide character,
-+ put a new wide character in LINE_OUT
-+ if column is bigger than width. */
-+ if (offset_out == 0)
-+ {
-+ line_out[offset_out++] = c;
-+ continue;
-+ }
-+
- /* Look for the last blank. */
- while (logical_end)
- {
-@@ -218,11 +255,225 @@
- line_out[offset_out++] = c;
- }
-
-- saved_errno = errno;
-+ *saved_errno = errno;
-+
-+ if (offset_out)
-+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-+
-+ free(line_out);
-+}
-+
-+#if HAVE_MBRTOWC
-+static void
-+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
-+{
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ char *bufpos; /* Next read position of BUF. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state, state_bak; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ char *line_out = NULL;
-+ size_t offset_out = 0; /* Index in `line_out' for next char. */
-+ size_t allocated_out = 0;
-+
-+ int increment;
-+ size_t column = 0;
-+
-+ size_t last_blank_pos;
-+ size_t last_blank_column;
-+ int is_blank_seen;
-+ int last_blank_increment;
-+ int is_bs_following_last_blank;
-+ size_t bs_following_last_blank_num;
-+ int is_cr_after_last_blank;
-+
-+#define CLEAR_FLAGS \
-+ do \
-+ { \
-+ last_blank_pos = 0; \
-+ last_blank_column = 0; \
-+ is_blank_seen = 0; \
-+ is_bs_following_last_blank = 0; \
-+ bs_following_last_blank_num = 0; \
-+ is_cr_after_last_blank = 0; \
-+ } \
-+ while (0)
-+
-+#define START_NEW_LINE \
-+ do \
-+ { \
-+ putchar ('\n'); \
-+ column = 0; \
-+ offset_out = 0; \
-+ CLEAR_FLAGS; \
-+ } \
-+ while (0)
-+
-+ CLEAR_FLAGS;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ for (;; bufpos += mblength, buflen -= mblength)
-+ {
-+ if (buflen < MB_LEN_MAX && !feof (istream) && !ferror (istream))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, istream);
-+ bufpos = buf;
-+ }
-+
-+ if (buflen < 1)
-+ break;
-+
-+ /* Get a wide character. */
-+ convfail = 0;
-+ state_bak = state;
-+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state);
-+
-+ switch (mblength)
-+ {
-+ case (size_t)-1:
-+ case (size_t)-2:
-+ convfail++;
-+ state = state_bak;
-+ /* Fall through. */
-+
-+ case 0:
-+ mblength = 1;
-+ break;
-+ }
-+
-+rescan:
-+ if (operating_mode == byte_mode) /* byte mode */
-+ increment = mblength;
-+ else if (operating_mode == character_mode) /* character mode */
-+ increment = 1;
-+ else /* column mode */
-+ {
-+ if (convfail)
-+ increment = 1;
-+ else
-+ {
-+ switch (wc)
-+ {
-+ case L'\n':
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ continue;
-+
-+ case L'\b':
-+ increment = (column > 0) ? -1 : 0;
-+ break;
-+
-+ case L'\r':
-+ increment = -1 * column;
-+ break;
-+
-+ case L'\t':
-+ increment = 8 - column % 8;
-+ break;
-+
-+ default:
-+ increment = wcwidth (wc);
-+ increment = (increment < 0) ? 0 : increment;
-+ }
-+ }
-+ }
-+
-+ if (column + increment > width && break_spaces && last_blank_pos)
-+ {
-+ fwrite (line_out, sizeof(char), last_blank_pos, stdout);
-+ putchar ('\n');
-+
-+ offset_out = offset_out - last_blank_pos;
-+ column = column - last_blank_column + ((is_cr_after_last_blank)
-+ ? last_blank_increment : bs_following_last_blank_num);
-+ memmove (line_out, line_out + last_blank_pos, offset_out);
-+ CLEAR_FLAGS;
-+ goto rescan;
-+ }
-+
-+ if (column + increment > width && column != 0)
-+ {
-+ fwrite (line_out, sizeof(char), offset_out, stdout);
-+ START_NEW_LINE;
-+ goto rescan;
-+ }
-+
-+ if (allocated_out < offset_out + mblength)
-+ {
-+ allocated_out += 1024;
-+ line_out = xrealloc (line_out, allocated_out);
-+ }
-+
-+ memcpy (line_out + offset_out, bufpos, mblength);
-+ offset_out += mblength;
-+ column += increment;
-+
-+ if (is_blank_seen && !convfail && wc == L'\r')
-+ is_cr_after_last_blank = 1;
-+
-+ if (is_bs_following_last_blank && !convfail && wc == L'\b')
-+ ++bs_following_last_blank_num;
-+ else
-+ is_bs_following_last_blank = 0;
-+
-+ if (break_spaces && !convfail && iswblank (wc))
-+ {
-+ last_blank_pos = offset_out;
-+ last_blank_column = column;
-+ is_blank_seen = 1;
-+ last_blank_increment = increment;
-+ is_bs_following_last_blank = 1;
-+ bs_following_last_blank_num = 0;
-+ is_cr_after_last_blank = 0;
-+ }
-+ }
-+
-+ *saved_errno = errno;
-
- if (offset_out)
- fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
-
-+ free(line_out);
-+}
-+#endif
-+
-+/* Fold file FILENAME, or standard input if FILENAME is "-",
-+ to stdout, with maximum line length WIDTH.
-+ Return 0 if successful, 1 if an error occurs. */
-+
-+static bool
-+fold_file (char *filename, size_t width)
-+{
-+ FILE *istream;
-+ int saved_errno;
-+
-+ if (STREQ (filename, "-"))
-+ {
-+ istream = stdin;
-+ have_read_stdin = 1;
-+ }
-+ else
-+ istream = fopen (filename, "r");
-+
-+ if (istream == NULL)
-+ {
-+ error (0, errno, "%s", filename);
-+ return 1;
-+ }
-+
-+ /* Define how ISTREAM is being folded. */
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ fold_multibyte_text (istream, width, &saved_errno);
-+ else
-+#endif
-+ fold_text (istream, width, &saved_errno);
-+
- if (ferror (istream))
- {
- error (0, saved_errno, "%s", filename);
-@@ -255,7 +506,8 @@
-
- atexit (close_stdout);
-
-- break_spaces = count_bytes = have_read_stdin = false;
-+ operating_mode = column_mode;
-+ break_spaces = have_read_stdin = false;
-
- while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
- {
-@@ -264,7 +516,15 @@
- switch (optc)
- {
- case 'b': /* Count bytes rather than columns. */
-- count_bytes = true;
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = byte_mode;
-+ break;
-+
-+ case 'c':
-+ if (operating_mode != column_mode)
-+ FATAL_ERROR (_("only one way of folding may be specified"));
-+ operating_mode = character_mode;
- break;
-
- case 's': /* Break at word boundaries. */
---- coreutils-6.8+/src/sort.c.i18n 2007-02-24 11:23:23.000000000 +0000
-+++ coreutils-6.8+/src/sort.c 2007-03-01 15:10:57.000000000 +0000
-@@ -23,10 +23,19 @@
-
- #include <config.h>
-
-+#include <assert.h>
- #include <getopt.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <signal.h>
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+/* Get isw* functions. */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+
- #include "system.h"
- #include "argmatch.h"
- #include "error.h"
-@@ -116,14 +125,38 @@
- /* Thousands separator; if -1, then there isn't one. */
- static int thousands_sep;
-
-+static int force_general_numcompare = 0;
-+
- /* Nonzero if the corresponding locales are hard. */
- static bool hard_LC_COLLATE;
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- static bool hard_LC_TIME;
- #endif
-
- #define NONZERO(x) ((x) != 0)
-
-+/* get a multibyte character's byte length. */
-+#define GET_BYTELEN_OF_CHAR(LIM, PTR, MBLENGTH, STATE) \
-+ do \
-+ { \
-+ wchar_t wc; \
-+ mbstate_t state_bak; \
-+ \
-+ state_bak = STATE; \
-+ mblength = mbrtowc (&wc, PTR, LIM - PTR, &STATE); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-1: \
-+ case (size_t)-2: \
-+ STATE = state_bak; \
-+ /* Fall through. */ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ } \
-+ } \
-+ while (0)
-+
- /* The kind of blanks for '-b' to skip in various options. */
- enum blanktype { bl_start, bl_end, bl_both };
-
-@@ -261,13 +294,11 @@
- they were read if all keys compare equal. */
- static bool stable;
-
--/* If TAB has this value, blanks separate fields. */
--enum { TAB_DEFAULT = CHAR_MAX + 1 };
--
--/* Tab character separating fields. If TAB_DEFAULT, then fields are
-+/* Tab character separating fields. If tab_length is 0, then fields are
- separated by the empty string between a non-blank character and a blank
- character. */
--static int tab = TAB_DEFAULT;
-+static char tab[MB_LEN_MAX + 1];
-+static size_t tab_length = 0;
-
- /* Flag to remove consecutive duplicate lines from the output.
- Only the last of a sequence of equal lines will be output. */
-@@ -639,6 +670,44 @@
- update_proc (pid);
- }
-
-+/* Function pointers. */
-+static void
-+(*inittables) (void);
-+static char *
-+(*begfield) (const struct line*, const struct keyfield *);
-+static char *
-+(*limfield) (const struct line*, const struct keyfield *);
-+static int
-+(*getmonth) (char const *, size_t);
-+static int
-+(*keycompare) (const struct line *, const struct line *);
-+static int
-+(*numcompare) (const char *, const char *);
-+
-+/* Test for white space multibyte character.
-+ Set LENGTH the byte length of investigated multibyte character. */
-+#if HAVE_MBRTOWC
-+static int
-+ismbblank (const char *str, size_t len, size_t *length)
-+{
-+ size_t mblength;
-+ wchar_t wc;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ mblength = mbrtowc (&wc, str, len, &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ *length = 1;
-+ return 0;
-+ }
-+
-+ *length = (mblength < 1) ? 1 : mblength;
-+ return iswblank (wc);
-+}
-+#endif
-+
- /* Clean up any remaining temporary files. */
-
- static void
-@@ -978,7 +1047,7 @@
- free (node);
- }
-
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
-
- static int
- struct_month_cmp (const void *m1, const void *m2)
-@@ -993,7 +1062,7 @@
- /* Initialize the character class tables. */
-
- static void
--inittables (void)
-+inittables_uni (void)
- {
- size_t i;
-
-@@ -1005,7 +1074,7 @@
- fold_toupper[i] = toupper (i);
- }
-
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- /* If we're not in the "C" locale, read different names for months. */
- if (hard_LC_TIME)
- {
-@@ -1031,6 +1100,64 @@
- #endif
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+inittables_mb (void)
-+{
-+ int i, j, k, l;
-+ char *name, *s;
-+ size_t s_len, mblength;
-+ char mbc[MB_LEN_MAX];
-+ wchar_t wc, pwc;
-+ mbstate_t state_mb, state_wc;
-+
-+ for (i = 0; i < MONTHS_PER_YEAR; i++)
-+ {
-+ s = (char *) nl_langinfo (ABMON_1 + i);
-+ s_len = strlen (s);
-+ monthtab[i].name = name = (char *) xmalloc (s_len + 1);
-+ monthtab[i].val = i + 1;
-+
-+ memset (&state_mb, '\0', sizeof (mbstate_t));
-+ memset (&state_wc, '\0', sizeof (mbstate_t));
-+
-+ for (j = 0; j < s_len;)
-+ {
-+ if (!ismbblank (s + j, s_len - j, &mblength))
-+ break;
-+ j += mblength;
-+ }
-+
-+ for (k = 0; j < s_len;)
-+ {
-+ mblength = mbrtowc (&wc, (s + j), (s_len - j), &state_mb);
-+ assert (mblength != (size_t)-1 && mblength != (size_t)-2);
-+ if (mblength == 0)
-+ break;
-+
-+ pwc = towupper (wc);
-+ if (pwc == wc)
-+ {
-+ memcpy (mbc, s + j, mblength);
-+ j += mblength;
-+ }
-+ else
-+ {
-+ j += mblength;
-+ mblength = wcrtomb (mbc, pwc, &state_wc);
-+ assert (mblength != (size_t)0 && mblength != (size_t)-1);
-+ }
-+
-+ for (l = 0; l < mblength; l++)
-+ name[k++] = mbc[l];
-+ }
-+ name[k] = '\0';
-+ }
-+ qsort ((void *) monthtab, MONTHS_PER_YEAR,
-+ sizeof (struct month), struct_month_cmp);
-+}
-+#endif
-+
- /* Specify the amount of main memory to use when sorting. */
- static void
- specify_sort_size (char const *s)
-@@ -1241,7 +1368,7 @@
- by KEY in LINE. */
-
- static char *
--begfield (const struct line *line, const struct keyfield *key)
-+begfield_uni (const struct line *line, const struct keyfield *key)
- {
- char *ptr = line->text, *lim = ptr + line->length - 1;
- size_t sword = key->sword;
-@@ -1251,10 +1378,10 @@
- /* The leading field separator itself is included in a field when -t
- is absent. */
-
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- while (ptr < lim && sword--)
- {
-- while (ptr < lim && *ptr != tab)
-+ while (ptr < lim && *ptr != tab[0])
- ++ptr;
- if (ptr < lim)
- ++ptr;
-@@ -1282,11 +1409,70 @@
- return ptr;
- }
-
-+#if HAVE_MBRTOWC
-+static char *
-+begfield_mb (const struct line *line, const struct keyfield *key)
-+{
-+ int i;
-+ char *ptr = line->text, *lim = ptr + line->length - 1;
-+ size_t sword = key->sword;
-+ size_t schar = key->schar;
-+ size_t mblength;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ if (tab_length)
-+ while (ptr < lim && sword--)
-+ {
-+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ }
-+ else
-+ while (ptr < lim && sword--)
-+ {
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ }
-+
-+ if (key->skipsblanks)
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+
-+ for (i = 0; i < schar; i++)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+
-+ if (ptr + mblength > lim)
-+ break;
-+ else
-+ ptr += mblength;
-+ }
-+
-+ return ptr;
-+}
-+#endif
-+
- /* Return the limit of (a pointer to the first character after) the field
- in LINE specified by KEY. */
-
- static char *
--limfield (const struct line *line, const struct keyfield *key)
-+limfield_uni (const struct line *line, const struct keyfield *key)
- {
- char *ptr = line->text, *lim = ptr + line->length - 1;
- size_t eword = key->eword, echar = key->echar;
-@@ -1299,10 +1485,10 @@
- `beginning' is the first character following the delimiting TAB.
- Otherwise, leave PTR pointing at the first `blank' character after
- the preceding field. */
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- while (ptr < lim && eword--)
- {
-- while (ptr < lim && *ptr != tab)
-+ while (ptr < lim && *ptr != tab[0])
- ++ptr;
- if (ptr < lim && (eword | echar))
- ++ptr;
-@@ -1348,10 +1534,10 @@
- */
-
- /* Make LIM point to the end of (one byte past) the current field. */
-- if (tab != TAB_DEFAULT)
-+ if (tab_length)
- {
- char *newlim;
-- newlim = memchr (ptr, tab, lim - ptr);
-+ newlim = memchr (ptr, tab[0], lim - ptr);
- if (newlim)
- lim = newlim;
- }
-@@ -1384,6 +1570,107 @@
- return ptr;
- }
-
-+#if HAVE_MBRTOWC
-+static char *
-+limfield_mb (const struct line *line, const struct keyfield *key)
-+{
-+ char *ptr = line->text, *lim = ptr + line->length - 1;
-+ size_t eword = key->eword, echar = key->echar;
-+ int i;
-+ size_t mblength;
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ if (tab_length)
-+ while (ptr < lim && eword--)
-+ {
-+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ if (ptr < lim && (eword | echar))
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ }
-+ else
-+ while (ptr < lim && eword--)
-+ {
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+ }
-+
-+
-+# ifdef POSIX_UNSPECIFIED
-+ /* Make LIM point to the end of (one byte past) the current field. */
-+ if (tab_length)
-+ {
-+ char *newlim, *p;
-+
-+ newlim = NULL;
-+ for (p = ptr; p < lim;)
-+ {
-+ if (memcmp (p, tab, tab_length) == 0)
-+ {
-+ newlim = p;
-+ break;
-+ }
-+
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ p += mblength;
-+ }
-+ }
-+ else
-+ {
-+ char *newlim;
-+ newlim = ptr;
-+
-+ while (newlim < lim && ismbblank (newlim, lim - newlim, &mblength))
-+ newlim += mblength;
-+ if (ptr < lim)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+ ptr += mblength;
-+ }
-+ while (newlim < lim && !ismbblank (newlim, lim - newlim, &mblength))
-+ newlim += mblength;
-+ lim = newlim;
-+ }
-+# endif
-+
-+ /* If we're skipping leading blanks, don't start counting characters
-+ * until after skipping past any leading blanks. */
-+ if (key->skipsblanks)
-+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
-+ ptr += mblength;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */
-+ for (i = 0; i < echar; i++)
-+ {
-+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
-+
-+ if (ptr + mblength > lim)
-+ break;
-+ else
-+ ptr += mblength;
-+ }
-+
-+ return ptr;
-+}
-+#endif
-+
- /* Fill BUF reading from FP, moving buf->left bytes from the end
- of buf->buf to the beginning first. If EOF is reached and the
- file wasn't terminated by a newline, supply one. Set up BUF's line
-@@ -1466,8 +1753,24 @@
- else
- {
- if (key->skipsblanks)
-- while (blanks[to_uchar (*line_start)])
-- line_start++;
-+ {
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ size_t mblength;
-+ mbstate_t state;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ while (line_start < line->keylim &&
-+ ismbblank (line_start,
-+ line->keylim - line_start,
-+ &mblength))
-+ line_start += mblength;
-+ }
-+ else
-+#endif
-+ while (blanks[to_uchar (*line_start)])
-+ line_start++;
-+ }
- line->keybeg = line_start;
- }
- }
-@@ -1500,7 +1803,7 @@
- hideously fast. */
-
- static int
--numcompare (const char *a, const char *b)
-+numcompare_uni (const char *a, const char *b)
- {
- while (blanks[to_uchar (*a)])
- a++;
-@@ -1510,6 +1813,25 @@
- return strnumcmp (a, b, decimal_point, thousands_sep);
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+numcompare_mb (const char *a, const char *b)
-+{
-+ size_t mblength, len;
-+ len = strlen (a); /* okay for UTF-8 */
-+ while (*a && ismbblank (a, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
-+ {
-+ a += mblength;
-+ len -= mblength;
-+ }
-+ len = strlen (b); /* okay for UTF-8 */
-+ while (*b && ismbblank (b, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
-+ b += mblength;
-+
-+ return strnumcmp (a, b, decimal_point, thousands_sep);
-+}
-+#endif /* HAV_EMBRTOWC */
-+
- static int
- general_numcompare (const char *sa, const char *sb)
- {
-@@ -1543,7 +1865,7 @@
- Return 0 if the name in S is not recognized. */
-
- static int
--getmonth (char const *month, size_t len)
-+getmonth_uni (char const *month, size_t len)
- {
- size_t lo = 0;
- size_t hi = MONTHS_PER_YEAR;
-@@ -1698,11 +2020,79 @@
- return diff;
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+getmonth_mb (const char *s, size_t len)
-+{
-+ char *month;
-+ register size_t i;
-+ register int lo = 0, hi = MONTHS_PER_YEAR, result;
-+ char *tmp;
-+ size_t wclength, mblength;
-+ const char **pp;
-+ const wchar_t **wpp;
-+ wchar_t *month_wcs;
-+ mbstate_t state;
-+
-+ while (len > 0 && ismbblank (s, len, &mblength))
-+ {
-+ s += mblength;
-+ len -= mblength;
-+ }
-+
-+ if (len == 0)
-+ return 0;
-+
-+ month = (char *) alloca (len + 1);
-+
-+ tmp = (char *) alloca (len + 1);
-+ memcpy (tmp, s, len);
-+ tmp[len] = '\0';
-+ pp = (const char **)&tmp;
-+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t));
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
-+ assert (wclength != (size_t)-1 && *pp == NULL);
-+
-+ for (i = 0; i < wclength; i++)
-+ {
-+ month_wcs[i] = towupper(month_wcs[i]);
-+ if (iswblank (month_wcs[i]))
-+ {
-+ month_wcs[i] = L'\0';
-+ break;
-+ }
-+ }
-+
-+ wpp = (const wchar_t **)&month_wcs;
-+
-+ mblength = wcsrtombs (month, wpp, len + 1, &state);
-+ assert (mblength != (-1) && *wpp == NULL);
-+
-+ do
-+ {
-+ int ix = (lo + hi) / 2;
-+
-+ if (strncmp (month, monthtab[ix].name, strlen (monthtab[ix].name)) < 0)
-+ hi = ix;
-+ else
-+ lo = ix;
-+ }
-+ while (hi - lo > 1);
-+
-+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name))
-+ ? monthtab[lo].val : 0);
-+
-+ return result;
-+}
-+#endif
-+
- /* Compare two lines A and B trying every key in sequence until there
- are no more keys or a difference is found. */
-
- static int
--keycompare (const struct line *a, const struct line *b)
-+keycompare_uni (const struct line *a, const struct line *b)
- {
- struct keyfield const *key = keylist;
-
-@@ -1875,6 +2265,179 @@
- return key->reverse ? -diff : diff;
- }
-
-+#if HAVE_MBRTOWC
-+static int
-+keycompare_mb (const struct line *a, const struct line *b)
-+{
-+ struct keyfield *key = keylist;
-+
-+ /* For the first iteration only, the key positions have been
-+ precomputed for us. */
-+ char *texta = a->keybeg;
-+ char *textb = b->keybeg;
-+ char *lima = a->keylim;
-+ char *limb = b->keylim;
-+
-+ size_t mblength_a, mblength_b;
-+ wchar_t wc_a, wc_b;
-+ mbstate_t state_a, state_b;
-+
-+ int diff;
-+
-+ memset (&state_a, '\0', sizeof(mbstate_t));
-+ memset (&state_b, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ unsigned char *translate = (unsigned char *) key->translate;
-+ bool const *ignore = key->ignore;
-+
-+ /* Find the lengths. */
-+ size_t lena = lima <= texta ? 0 : lima - texta;
-+ size_t lenb = limb <= textb ? 0 : limb - textb;
-+
-+ /* Actually compare the fields. */
-+ if (key->random)
-+ diff = compare_random (texta, lena, textb, lenb);
-+ else if (key->numeric | key->general_numeric)
-+ {
-+ char savea = *lima, saveb = *limb;
-+
-+ *lima = *limb = '\0';
-+ if (force_general_numcompare)
-+ diff = general_numcompare (texta, textb);
-+ else
-+ diff = ((key->numeric ? numcompare : general_numcompare)
-+ (texta, textb));
-+ *lima = savea, *limb = saveb;
-+ }
-+ else if (key->month)
-+ diff = getmonth (texta, lena) - getmonth (textb, lenb);
-+ else
-+ {
-+ if (ignore || translate)
-+ {
-+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
-+ char *copy_b = copy_a + lena + 1;
-+ size_t new_len_a, new_len_b;
-+ size_t i, j;
-+
-+ /* Ignore and/or translate chars before comparing. */
-+# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \
-+ do \
-+ { \
-+ wchar_t uwc; \
-+ char mbc[MB_LEN_MAX]; \
-+ mbstate_t state_wc; \
-+ \
-+ for (NEW_LEN = i = 0; i < LEN;) \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ state_bak = STATE; \
-+ MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \
-+ \
-+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \
-+ || MBLENGTH == 0) \
-+ { \
-+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \
-+ STATE = state_bak; \
-+ if (!ignore) \
-+ COPY[NEW_LEN++] = TEXT[i++]; \
-+ continue; \
-+ } \
-+ \
-+ if (ignore) \
-+ { \
-+ if ((ignore == nonprinting && !iswprint (WC)) \
-+ || (ignore == nondictionary \
-+ && !iswalnum (WC) && !iswblank (WC))) \
-+ { \
-+ i += MBLENGTH; \
-+ continue; \
-+ } \
-+ } \
-+ \
-+ if (translate) \
-+ { \
-+ \
-+ uwc = towupper(WC); \
-+ if (WC == uwc) \
-+ { \
-+ memcpy (mbc, TEXT + i, MBLENGTH); \
-+ i += MBLENGTH; \
-+ } \
-+ else \
-+ { \
-+ i += MBLENGTH; \
-+ WC = uwc; \
-+ memset (&state_wc, '\0', sizeof (mbstate_t)); \
-+ \
-+ MBLENGTH = wcrtomb (mbc, WC, &state_wc); \
-+ assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \
-+ } \
-+ \
-+ for (j = 0; j < MBLENGTH; j++) \
-+ COPY[NEW_LEN++] = mbc[j]; \
-+ } \
-+ else \
-+ for (j = 0; j < MBLENGTH; j++) \
-+ COPY[NEW_LEN++] = TEXT[i++]; \
-+ } \
-+ COPY[NEW_LEN] = '\0'; \
-+ } \
-+ while (0)
-+ IGNORE_CHARS (new_len_a, lena, texta, copy_a,
-+ wc_a, mblength_a, state_a);
-+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b,
-+ wc_b, mblength_b, state_b);
-+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b);
-+ }
-+ else if (lena == 0)
-+ diff = - NONZERO (lenb);
-+ else if (lenb == 0)
-+ goto greater;
-+ else
-+ diff = xmemcoll (texta, lena, textb, lenb);
-+ }
-+
-+ if (diff)
-+ goto not_equal;
-+
-+ key = key->next;
-+ if (! key)
-+ break;
-+
-+ /* Find the beginning and limit of the next field. */
-+ if (key->eword != -1)
-+ lima = limfield (a, key), limb = limfield (b, key);
-+ else
-+ lima = a->text + a->length - 1, limb = b->text + b->length - 1;
-+
-+ if (key->sword != -1)
-+ texta = begfield (a, key), textb = begfield (b, key);
-+ else
-+ {
-+ texta = a->text, textb = b->text;
-+ if (key->skipsblanks)
-+ {
-+ while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))
-+ texta += mblength_a;
-+ while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))
-+ textb += mblength_b;
-+ }
-+ }
-+ }
-+
-+ return 0;
-+
-+greater:
-+ diff = 1;
-+not_equal:
-+ return key->reverse ? -diff : diff;
-+}
-+#endif
-+
- /* Compare two lines A and B, returning negative, zero, or positive
- depending on whether A compares less than, equal to, or greater than B. */
-
-@@ -2744,7 +3305,7 @@
- initialize_exit_failure (SORT_FAILURE);
-
- hard_LC_COLLATE = hard_locale (LC_COLLATE);
--#if HAVE_NL_LANGINFO
-+#if HAVE_LANGINFO_CODESET
- hard_LC_TIME = hard_locale (LC_TIME);
- #endif
-
-@@ -2765,6 +3326,27 @@
- thousands_sep = -1;
- }
-
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ inittables = inittables_mb;
-+ begfield = begfield_mb;
-+ limfield = limfield_mb;
-+ getmonth = getmonth_mb;
-+ keycompare = keycompare_mb;
-+ numcompare = numcompare_mb;
-+ }
-+ else
-+#endif
-+ {
-+ inittables = inittables_uni;
-+ begfield = begfield_uni;
-+ limfield = limfield_uni;
-+ getmonth = getmonth_uni;
-+ keycompare = keycompare_uni;
-+ numcompare = numcompare_uni;
-+ }
-+
- have_read_stdin = false;
- inittables ();
-
-@@ -3015,13 +3597,35 @@
-
- case 't':
- {
-- char newtab = optarg[0];
-- if (! newtab)
-+ char newtab[MB_LEN_MAX + 1];
-+ size_t newtab_length = 1;
-+ strncpy (newtab, optarg, MB_LEN_MAX);
-+ if (! newtab[0])
- error (SORT_FAILURE, 0, _("empty tab"));
-- if (optarg[1])
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ wchar_t wc;
-+ mbstate_t state;
-+ size_t i;
-+
-+ memset (&state, '\0', sizeof (mbstate_t));
-+ newtab_length = mbrtowc (&wc, newtab, strnlen (newtab,
-+ MB_LEN_MAX),
-+ &state);
-+ switch (newtab_length)
-+ {
-+ case (size_t) -1:
-+ case (size_t) -2:
-+ case 0:
-+ newtab_length = 1;
-+ }
-+ }
-+#endif
-+ if (newtab_length == 1 && optarg[1])
- {
- if (STREQ (optarg, "\\0"))
-- newtab = '\0';
-+ newtab[0] = '\0';
- else
- {
- /* Provoke with `sort -txx'. Complain about
-@@ -3032,9 +3636,12 @@
- quote (optarg));
- }
- }
-- if (tab != TAB_DEFAULT && tab != newtab)
-+ if (tab_length
-+ && (tab_length != newtab_length
-+ || memcmp (tab, newtab, tab_length) != 0))
- error (SORT_FAILURE, 0, _("incompatible tabs"));
-- tab = newtab;
-+ memcpy (tab, newtab, newtab_length);
-+ tab_length = newtab_length;
- }
- break;
-
---- coreutils-6.8+/src/unexpand.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/unexpand.c 2007-03-01 15:08:24.000000000 +0000
-@@ -39,11 +39,28 @@
- #include <stdio.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "unexpand"
-
-@@ -110,6 +127,208 @@
- {NULL, 0, NULL, 0}
- };
-
-+static FILE *next_file (FILE *fp);
-+
-+#if HAVE_MBRTOWC
-+static void
-+unexpand_multibyte (void)
-+{
-+ FILE *fp; /* Input stream. */
-+ mbstate_t i_state; /* Current shift state of the input stream. */
-+ mbstate_t i_state_bak; /* Back up the I_STATE. */
-+ mbstate_t o_state; /* Current shift state of the output stream. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen = 0; /* The length of the byte sequence in buf. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character
-+ which shows as same character as WC. */
-+
-+ /* Index in `tab_list' of next tabstop: */
-+ int tab_index = 0; /* For calculating width of pending tabs. */
-+ int print_tab_index = 0; /* For printing as many tabs as possible. */
-+ unsigned int column = 0; /* Column on screen of next char. */
-+ int next_tab_column; /* Column the next tab stop is on. */
-+ int convert = 1; /* If nonzero, perform translations. */
-+ unsigned int pending = 0; /* Pending columns of blanks. */
-+
-+ fp = next_file ((FILE *) NULL);
-+ if (fp == NULL)
-+ return;
-+
-+ memset (&o_state, '\0', sizeof(mbstate_t));
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+
-+ for (;;)
-+ {
-+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
-+ {
-+ memmove (buf, bufpos, buflen);
-+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
-+ bufpos = buf;
-+ }
-+
-+ /* Get a wide character. */
-+ if (buflen < 1)
-+ {
-+ mblength = 1;
-+ wc = WEOF;
-+ }
-+ else
-+ {
-+ i_state_bak = i_state;
-+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &i_state);
-+ }
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ i_state = i_state_bak;
-+ wc = L'\0';
-+ }
-+
-+ if (wc == L' ' && convert && column < INT_MAX)
-+ {
-+ ++pending;
-+ ++column;
-+ }
-+ else if (wc == L'\t' && convert)
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (tab_index < first_free_tab - 1
-+ && column >= tab_list[tab_index])
-+ tab_index++;
-+ next_tab_column = tab_list[tab_index];
-+ if (tab_index < first_free_tab - 1)
-+ tab_index++;
-+ if (column >= next_tab_column)
-+ {
-+ convert = 0; /* Ran out of tab stops. */
-+ goto flush_pend_mb;
-+ }
-+ }
-+ else
-+ {
-+ next_tab_column = column + tab_size - column % tab_size;
-+ }
-+ pending += next_tab_column - column;
-+ column = next_tab_column;
-+ }
-+ else
-+ {
-+flush_pend_mb:
-+ /* Flush pending spaces. Print as many tabs as possible,
-+ then print the rest as spaces. */
-+ if (pending == 1)
-+ {
-+ putchar (' ');
-+ pending = 0;
-+ }
-+ column -= pending;
-+ while (pending > 0)
-+ {
-+ if (tab_size == 0)
-+ {
-+ /* Do not let print_tab_index == first_free_tab;
-+ stop when it is 1 less. */
-+ while (print_tab_index < first_free_tab - 1
-+ && column >= tab_list[print_tab_index])
-+ print_tab_index++;
-+ next_tab_column = tab_list[print_tab_index];
-+ if (print_tab_index < first_free_tab - 1)
-+ print_tab_index++;
-+ }
-+ else
-+ {
-+ next_tab_column =
-+ column + tab_size - column % tab_size;
-+ }
-+ if (next_tab_column - column <= pending)
-+ {
-+ putchar ('\t');
-+ pending -= next_tab_column - column;
-+ column = next_tab_column;
-+ }
-+ else
-+ {
-+ --print_tab_index;
-+ column += pending;
-+ while (pending != 0)
-+ {
-+ putchar (' ');
-+ pending--;
-+ }
-+ }
-+ }
-+
-+ if (wc == WEOF)
-+ {
-+ fp = next_file (fp);
-+ if (fp == NULL)
-+ break; /* No more files. */
-+ else
-+ {
-+ memset (&i_state, '\0', sizeof(mbstate_t));
-+ continue;
-+ }
-+ }
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ if (convert)
-+ {
-+ ++column;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ mblength = 1;
-+ putchar (buf[0]);
-+ }
-+ else if (mblength == 0)
-+ {
-+ if (convert && convert_entire_line == 0)
-+ convert = 0;
-+ mblength = 1;
-+ putchar ('\0');
-+ }
-+ else
-+ {
-+ if (convert)
-+ {
-+ if (wc == L'\b')
-+ {
-+ if (column > 0)
-+ --column;
-+ }
-+ else
-+ {
-+ int width; /* The width of WC. */
-+
-+ width = wcwidth (wc);
-+ column += (width > 0) ? width : 0;
-+ if (convert_entire_line == 0)
-+ convert = 0;
-+ }
-+ }
-+
-+ if (wc == L'\n')
-+ {
-+ tab_index = print_tab_index = 0;
-+ column = pending = 0;
-+ convert = 1;
-+ }
-+ fwrite (bufpos, sizeof(char), mblength, stdout);
-+ }
-+ }
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
-+
- void
- usage (int status)
- {
-@@ -531,7 +750,12 @@
-
- file_list = (optind < argc ? &argv[optind] : stdin_argv);
-
-- unexpand ();
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ unexpand_multibyte ();
-+ else
-+#endif
-+ unexpand ();
-
- if (have_read_stdin && fclose (stdin) != 0)
- error (EXIT_FAILURE, errno, "-");
---- coreutils-6.8+/src/pr.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/pr.c 2007-03-01 15:08:24.000000000 +0000
-@@ -313,6 +313,32 @@
-
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get MB_LEN_MAX. */
-+#include <limits.h>
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX == 1
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Get MB_CUR_MAX. */
-+#include <stdlib.h>
-+
-+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-+/* Get mbstate_t, mbrtowc(), wcwidth(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
-+
-+/* Get iswprint(). -- for wcwidth(). */
-+#if HAVE_WCTYPE_H
-+# include <wctype.h>
-+#endif
-+#if !defined iswprint && !HAVE_ISWPRINT
-+# define iswprint(wc) 1
-+#endif
-+
- #include "system.h"
- #include "error.h"
- #include "hard-locale.h"
-@@ -324,6 +350,18 @@
- #include "strftime.h"
- #include "xstrtol.h"
-
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
-+#ifndef HAVE_DECL_WCWIDTH
-+"this configure-time declaration test was not run"
-+#endif
-+#if !HAVE_DECL_WCWIDTH
-+extern int wcwidth ();
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "pr"
-
-@@ -416,7 +454,20 @@
-
- #define NULLCOL (COLUMN *)0
-
--static int char_to_clump (char c);
-+/* Funtion pointers to switch functions for single byte locale or for
-+ multibyte locale. If multibyte functions do not exist in your sysytem,
-+ these pointers always point the function for single byte locale. */
-+static void (*print_char) (char c);
-+static int (*char_to_clump) (char c);
-+
-+/* Functions for single byte locale. */
-+static void print_char_single (char c);
-+static int char_to_clump_single (char c);
-+
-+/* Functions for multibyte locale. */
-+static void print_char_multi (char c);
-+static int char_to_clump_multi (char c);
-+
- static bool read_line (COLUMN *p);
- static bool print_page (void);
- static bool print_stored (COLUMN *p);
-@@ -426,6 +477,7 @@
- static void pad_across_to (int position);
- static void add_line_number (COLUMN *p);
- static void getoptarg (char *arg, char switch_char, char *character,
-+ int *character_length, int *character_width,
- int *number);
- void usage (int status);
- static void print_files (int number_of_files, char **av);
-@@ -440,7 +492,6 @@
- static void pad_down (int lines);
- static void read_rest_of_line (COLUMN *p);
- static void skip_read (COLUMN *p, int column_number);
--static void print_char (char c);
- static void cleanup (void);
- static void print_sep_string (void);
- static void separator_string (const char *optarg_S);
-@@ -455,7 +506,7 @@
- we store the leftmost columns contiguously in buff.
- To print a line from buff, get the index of the first character
- from line_vector[i], and print up to line_vector[i + 1]. */
--static char *buff;
-+static unsigned char *buff;
-
- /* Index of the position in buff where the next character
- will be stored. */
-@@ -559,7 +610,7 @@
- static bool untabify_input = false;
-
- /* (-e) The input tab character. */
--static char input_tab_char = '\t';
-+static char input_tab_char[MB_LEN_MAX] = "\t";
-
- /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
- where the leftmost column is 1. */
-@@ -569,7 +620,10 @@
- static bool tabify_output = false;
-
- /* (-i) The output tab character. */
--static char output_tab_char = '\t';
-+static char output_tab_char[MB_LEN_MAX] = "\t";
-+
-+/* (-i) The byte length of output tab character. */
-+static int output_tab_char_length = 1;
-
- /* (-i) The width of the output tab. */
- static int chars_per_output_tab = 8;
-@@ -643,7 +697,13 @@
- static bool numbered_lines = false;
-
- /* (-n) Character which follows each line number. */
--static char number_separator = '\t';
-+static char number_separator[MB_LEN_MAX] = "\t";
-+
-+/* (-n) The byte length of the character which follows each line number. */
-+static int number_separator_length = 1;
-+
-+/* (-n) The character width of the character which follows each line number. */
-+static int number_separator_width = 0;
-
- /* (-n) line counting starts with 1st line of input file (not with 1st
- line of 1st page printed). */
-@@ -696,6 +756,7 @@
- -a|COLUMN|-m is a `space' and with the -J option a `tab'. */
- static char *col_sep_string = "";
- static int col_sep_length = 0;
-+static int col_sep_width = 0;
- static char *column_separator = " ";
- static char *line_separator = "\t";
-
-@@ -852,6 +913,13 @@
- col_sep_length = (int) strlen (optarg_S);
- col_sep_string = xmalloc (col_sep_length + 1);
- strcpy (col_sep_string, optarg_S);
-+
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ col_sep_width = mbswidth (col_sep_string, 0);
-+ else
-+#endif
-+ col_sep_width = col_sep_length;
- }
-
- int
-@@ -877,6 +945,21 @@
-
- atexit (close_stdout);
-
-+/* Define which functions are used, the ones for single byte locale or the ones
-+ for multibyte locale. */
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1)
-+ {
-+ print_char = print_char_multi;
-+ char_to_clump = char_to_clump_multi;
-+ }
-+ else
-+#endif
-+ {
-+ print_char = print_char_single;
-+ char_to_clump = char_to_clump_single;
-+ }
-+
- n_files = 0;
- file_names = (argc > 1
- ? xmalloc ((argc - 1) * sizeof (char *))
-@@ -949,8 +1032,12 @@
- break;
- case 'e':
- if (optarg)
-- getoptarg (optarg, 'e', &input_tab_char,
-- &chars_per_input_tab);
-+ {
-+ int dummy_length, dummy_width;
-+
-+ getoptarg (optarg, 'e', input_tab_char, &dummy_length,
-+ &dummy_width, &chars_per_input_tab);
-+ }
- /* Could check tab width > 0. */
- untabify_input = true;
- break;
-@@ -963,8 +1050,12 @@
- break;
- case 'i':
- if (optarg)
-- getoptarg (optarg, 'i', &output_tab_char,
-- &chars_per_output_tab);
-+ {
-+ int dummy_width;
-+
-+ getoptarg (optarg, 'i', output_tab_char, &output_tab_char_length,
-+ &dummy_width, &chars_per_output_tab);
-+ }
- /* Could check tab width > 0. */
- tabify_output = true;
- break;
-@@ -991,8 +1082,8 @@
- case 'n':
- numbered_lines = true;
- if (optarg)
-- getoptarg (optarg, 'n', &number_separator,
-- &chars_per_number);
-+ getoptarg (optarg, 'n', number_separator, &number_separator_length,
-+ &number_separator_width, &chars_per_number);
- break;
- case 'N':
- skip_count = false;
-@@ -1031,7 +1122,7 @@
- old_s = false;
- /* Reset an additional input of -s, -S dominates -s */
- col_sep_string = "";
-- col_sep_length = 0;
-+ col_sep_length = col_sep_width = 0;
- use_col_separator = true;
- if (optarg)
- separator_string (optarg);
-@@ -1188,10 +1279,45 @@
- a number. */
-
- static void
--getoptarg (char *arg, char switch_char, char *character, int *number)
-+getoptarg (char *arg, char switch_char, char *character, int *character_length,
-+ int *character_width, int *number)
- {
- if (!ISDIGIT (*arg))
-- *character = *arg++;
-+ {
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1) /* for multibyte locale. */
-+ {
-+ wchar_t wc;
-+ size_t mblength;
-+ int width;
-+ mbstate_t state = {'\0'};
-+
-+ mblength = mbrtowc (&wc, arg, strnlen(arg, MB_LEN_MAX), &state);
-+
-+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
-+ {
-+ *character_length = 1;
-+ *character_width = 1;
-+ }
-+ else
-+ {
-+ *character_length = (mblength < 1) ? 1 : mblength;
-+ width = wcwidth (wc);
-+ *character_width = (width < 0) ? 0 : width;
-+ }
-+
-+ strncpy (character, arg, *character_length);
-+ arg += *character_length;
-+ }
-+ else /* for single byte locale. */
-+#endif
-+ {
-+ *character = *arg++;
-+ *character_length = 1;
-+ *character_width = 1;
-+ }
-+ }
-+
- if (*arg)
- {
- long int tmp_long;
-@@ -1256,7 +1382,7 @@
- else
- col_sep_string = column_separator;
-
-- col_sep_length = 1;
-+ col_sep_length = col_sep_width = 1;
- use_col_separator = true;
- }
- /* It's rather pointless to define a TAB separator with column
-@@ -1288,11 +1414,11 @@
- TAB_WIDTH (chars_per_input_tab, chars_per_number); */
-
- /* Estimate chars_per_text without any margin and keep it constant. */
-- if (number_separator == '\t')
-+ if (number_separator[0] == '\t')
- number_width = chars_per_number +
- TAB_WIDTH (chars_per_default_tab, chars_per_number);
- else
-- number_width = chars_per_number + 1;
-+ number_width = chars_per_number + number_separator_width;
-
- /* The number is part of the column width unless we are
- printing files in parallel. */
-@@ -1307,7 +1433,7 @@
- }
-
- chars_per_column = (chars_per_line - chars_used_by_number -
-- (columns - 1) * col_sep_length) / columns;
-+ (columns - 1) * col_sep_width) / columns;
-
- if (chars_per_column < 1)
- error (EXIT_FAILURE, 0, _("page width too narrow"));
-@@ -1432,7 +1558,7 @@
-
- /* Enlarge p->start_position of first column to use the same form of
- padding_not_printed with all columns. */
-- h = h + col_sep_length;
-+ h = h + col_sep_width;
-
- /* This loop takes care of all but the rightmost column. */
-
-@@ -1466,7 +1592,7 @@
- }
- else
- {
-- h = h_next + col_sep_length;
-+ h = h_next + col_sep_width;
- h_next = h + chars_per_column;
- }
- }
-@@ -1756,9 +1882,9 @@
- align_column (COLUMN *p)
- {
- padding_not_printed = p->start_position;
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2029,13 +2155,13 @@
- /* May be too generous. */
- buff = X2REALLOC (buff, &buff_allocated);
- }
-- buff[buff_current++] = c;
-+ buff[buff_current++] = (unsigned char) c;
- }
-
- static void
- add_line_number (COLUMN *p)
- {
-- int i;
-+ int i, j;
- char *s;
- int left_cut;
-
-@@ -2058,22 +2184,24 @@
- /* Tabification is assumed for multiple columns, also for n-separators,
- but `default n-separator = TAB' hasn't been given priority over
- equal column_width also specified by POSIX. */
-- if (number_separator == '\t')
-+ if (number_separator[0] == '\t')
- {
- i = number_width - chars_per_number;
- while (i-- > 0)
- (p->char_func) (' ');
- }
- else
-- (p->char_func) (number_separator);
-+ for (j = 0; j < number_separator_length; j++)
-+ (p->char_func) (number_separator[j]);
- }
- else
- /* To comply with POSIX, we avoid any expansion of default TAB
- separator with a single column output. No column_width requirement
- has to be considered. */
- {
-- (p->char_func) (number_separator);
-- if (number_separator == '\t')
-+ for (j = 0; j < number_separator_length; j++)
-+ (p->char_func) (number_separator[j]);
-+ if (number_separator[0] == '\t')
- output_position = POS_AFTER_TAB (chars_per_output_tab,
- output_position);
- }
-@@ -2234,7 +2362,7 @@
- while (goal - h_old > 1
- && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
- {
-- putchar (output_tab_char);
-+ fwrite (output_tab_char, sizeof(char), output_tab_char_length, stdout);
- h_old = h_new;
- }
- while (++h_old <= goal)
-@@ -2254,6 +2382,7 @@
- {
- char *s;
- int l = col_sep_length;
-+ int not_space_flag;
-
- s = col_sep_string;
-
-@@ -2267,6 +2396,7 @@
- {
- for (; separators_not_printed > 0; --separators_not_printed)
- {
-+ not_space_flag = 0;
- while (l-- > 0)
- {
- /* 3 types of sep_strings: spaces only, spaces and chars,
-@@ -2280,12 +2410,15 @@
- }
- else
- {
-+ not_space_flag = 1;
- if (spaces_not_printed > 0)
- print_white_space ();
- putchar (*s++);
-- ++output_position;
- }
- }
-+ if (not_space_flag)
-+ output_position += col_sep_width;
-+
- /* sep_string ends with some spaces */
- if (spaces_not_printed > 0)
- print_white_space ();
-@@ -2313,7 +2446,7 @@
- required number of tabs and spaces. */
-
- static void
--print_char (char c)
-+print_char_single (char c)
- {
- if (tabify_output)
- {
-@@ -2337,6 +2470,74 @@
- putchar (c);
- }
-
-+#ifdef HAVE_MBRTOWC
-+static void
-+print_char_multi (char c)
-+{
-+ static size_t mbc_pos = 0;
-+ static char mbc[MB_LEN_MAX] = {'\0'};
-+ static mbstate_t state = {'\0'};
-+ mbstate_t state_bak;
-+ wchar_t wc;
-+ size_t mblength;
-+ int width;
-+
-+ if (tabify_output)
-+ {
-+ state_bak = state;
-+ mbc[mbc_pos++] = c;
-+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
-+
-+ while (mbc_pos > 0)
-+ {
-+ switch (mblength)
-+ {
-+ case (size_t)-2:
-+ state = state_bak;
-+ return;
-+
-+ case (size_t)-1:
-+ state = state_bak;
-+ ++output_position;
-+ putchar (mbc[0]);
-+ memmove (mbc, mbc + 1, MB_CUR_MAX - 1);
-+ --mbc_pos;
-+ break;
-+
-+ case 0:
-+ mblength = 1;
-+
-+ default:
-+ if (wc == L' ')
-+ {
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ --mbc_pos;
-+ ++spaces_not_printed;
-+ return;
-+ }
-+ else if (spaces_not_printed > 0)
-+ print_white_space ();
-+
-+ /* Nonprintables are assumed to have width 0, except L'\b'. */
-+ if ((width = wcwidth (wc)) < 1)
-+ {
-+ if (wc == L'\b')
-+ --output_position;
-+ }
-+ else
-+ output_position += width;
-+
-+ fwrite (mbc, sizeof(char), mblength, stdout);
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ mbc_pos -= mblength;
-+ }
-+ }
-+ return;
-+ }
-+ putchar (c);
-+}
-+#endif
-+
- /* Skip to page PAGE before printing.
- PAGE may be larger than total number of pages. */
-
-@@ -2517,9 +2718,9 @@
- align_empty_cols = false;
- }
-
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2620,9 +2821,9 @@
- }
- }
-
-- if (padding_not_printed - col_sep_length > 0)
-+ if (padding_not_printed - col_sep_width > 0)
- {
-- pad_across_to (padding_not_printed - col_sep_length);
-+ pad_across_to (padding_not_printed - col_sep_width);
- padding_not_printed = ANYWHERE;
- }
-
-@@ -2635,8 +2836,8 @@
- if (spaces_not_printed == 0)
- {
- output_position = p->start_position + end_vector[line];
-- if (p->start_position - col_sep_length == chars_per_margin)
-- output_position -= col_sep_length;
-+ if (p->start_position - col_sep_width == chars_per_margin)
-+ output_position -= col_sep_width;
- }
-
- return true;
-@@ -2655,7 +2856,7 @@
- number of characters is 1.) */
-
- static int
--char_to_clump (char c)
-+char_to_clump_single (char c)
- {
- unsigned char uc = c;
- char *s = clump_buff;
-@@ -2665,10 +2866,10 @@
- int chars;
- int chars_per_c = 8;
-
-- if (c == input_tab_char)
-+ if (c == input_tab_char[0])
- chars_per_c = chars_per_input_tab;
-
-- if (c == input_tab_char || c == '\t')
-+ if (c == input_tab_char[0] || c == '\t')
- {
- width = TAB_WIDTH (chars_per_c, input_position);
-
-@@ -2739,6 +2940,154 @@
- return chars;
- }
-
-+#ifdef HAVE_MBRTOWC
-+static int
-+char_to_clump_multi (char c)
-+{
-+ static size_t mbc_pos = 0;
-+ static char mbc[MB_LEN_MAX] = {'\0'};
-+ static mbstate_t state = {'\0'};
-+ mbstate_t state_bak;
-+ wchar_t wc;
-+ size_t mblength;
-+ int wc_width;
-+ register char *s = clump_buff;
-+ register int i, j;
-+ char esc_buff[4];
-+ int width;
-+ int chars;
-+ int chars_per_c = 8;
-+
-+ state_bak = state;
-+ mbc[mbc_pos++] = c;
-+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
-+
-+ width = 0;
-+ chars = 0;
-+ while (mbc_pos > 0)
-+ {
-+ switch (mblength)
-+ {
-+ case (size_t)-2:
-+ state = state_bak;
-+ return 0;
-+
-+ case (size_t)-1:
-+ state = state_bak;
-+ mblength = 1;
-+
-+ if (use_esc_sequence || use_cntrl_prefix)
-+ {
-+ width = +4;
-+ chars = +4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", mbc[0]);
-+ for (i = 0; i <= 2; ++i)
-+ *s++ = (int) esc_buff[i];
-+ }
-+ else
-+ {
-+ width += 1;
-+ chars += 1;
-+ *s++ = mbc[0];
-+ }
-+ break;
-+
-+ case 0:
-+ mblength = 1;
-+ /* Fall through */
-+
-+ default:
-+ if (memcmp (mbc, input_tab_char, mblength) == 0)
-+ chars_per_c = chars_per_input_tab;
-+
-+ if (memcmp (mbc, input_tab_char, mblength) == 0 || c == '\t')
-+ {
-+ int width_inc;
-+
-+ width_inc = TAB_WIDTH (chars_per_c, input_position);
-+ width += width_inc;
-+
-+ if (untabify_input)
-+ {
-+ for (i = width_inc; i; --i)
-+ *s++ = ' ';
-+ chars += width_inc;
-+ }
-+ else
-+ {
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ chars += mblength;
-+ }
-+ }
-+ else if ((wc_width = wcwidth (wc)) < 1)
-+ {
-+ if (use_esc_sequence)
-+ {
-+ for (i = 0; i < mblength; i++)
-+ {
-+ width += 4;
-+ chars += 4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", c);
-+ for (j = 0; j <= 2; ++j)
-+ *s++ = (int) esc_buff[j];
-+ }
-+ }
-+ else if (use_cntrl_prefix)
-+ {
-+ if (wc < 0200)
-+ {
-+ width += 2;
-+ chars += 2;
-+ *s++ = '^';
-+ *s++ = wc ^ 0100;
-+ }
-+ else
-+ {
-+ for (i = 0; i < mblength; i++)
-+ {
-+ width += 4;
-+ chars += 4;
-+ *s++ = '\\';
-+ sprintf (esc_buff, "%03o", c);
-+ for (j = 0; j <= 2; ++j)
-+ *s++ = (int) esc_buff[j];
-+ }
-+ }
-+ }
-+ else if (wc == L'\b')
-+ {
-+ width += -1;
-+ chars += 1;
-+ *s++ = c;
-+ }
-+ else
-+ {
-+ width += 0;
-+ chars += mblength;
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ }
-+ }
-+ else
-+ {
-+ width += wc_width;
-+ chars += mblength;
-+ for (i = 0; i < mblength; i++)
-+ *s++ = mbc[i];
-+ }
-+ }
-+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
-+ mbc_pos -= mblength;
-+ }
-+
-+ input_position += width;
-+ return chars;
-+}
-+#endif
-+
- /* We've just printed some files and need to clean up things before
- looking for more options and printing the next batch of files.
-
---- coreutils-6.8+/src/cut.c.i18n 2007-01-14 15:41:28.000000000 +0000
-+++ coreutils-6.8+/src/cut.c 2007-03-01 15:08:24.000000000 +0000
-@@ -29,6 +29,11 @@
- #include <assert.h>
- #include <getopt.h>
- #include <sys/types.h>
-+
-+/* Get mbstate_t, mbrtowc(). */
-+#if HAVE_WCHAR_H
-+# include <wchar.h>
-+#endif
- #include "system.h"
-
- #include "error.h"
-@@ -37,6 +42,18 @@
- #include "quote.h"
- #include "xstrndup.h"
-
-+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
-+ installation; work around this configuration error. */
-+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
-+# undef MB_LEN_MAX
-+# define MB_LEN_MAX 16
-+#endif
-+
-+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
-+#if HAVE_MBRTOWC && defined mbstate_t
-+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
-+#endif
-+
- /* The official name of this program (e.g., no `g' prefix). */
- #define PROGRAM_NAME "cut"
-
-@@ -67,6 +84,52 @@
- } \
- while (0)
-
-+/* Refill the buffer BUF to get a multibyte character. */
-+#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \
-+ do \
-+ { \
-+ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \
-+ { \
-+ memmove (BUF, BUFPOS, BUFLEN); \
-+ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \
-+ BUFPOS = BUF; \
-+ } \
-+ } \
-+ while (0)
-+
-+/* Get wide character on BUFPOS. BUFPOS is not included after that.
-+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */
-+#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \
-+ do \
-+ { \
-+ mbstate_t state_bak; \
-+ \
-+ if (BUFLEN < 1) \
-+ { \
-+ WC = WEOF; \
-+ break; \
-+ } \
-+ \
-+ /* Get a wide character. */ \
-+ CONVFAIL = 0; \
-+ state_bak = STATE; \
-+ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \
-+ \
-+ switch (MBLENGTH) \
-+ { \
-+ case (size_t)-1: \
-+ case (size_t)-2: \
-+ CONVFAIL++; \
-+ STATE = state_bak; \
-+ /* Fall througn. */ \
-+ \
-+ case 0: \
-+ MBLENGTH = 1; \
-+ break; \
-+ } \
-+ } \
-+ while (0)
-+
- struct range_pair
- {
- size_t lo;
-@@ -85,7 +148,7 @@
- /* The number of bytes allocated for FIELD_1_BUFFER. */
- static size_t field_1_bufsize;
-
--/* The largest field or byte index used as an endpoint of a closed
-+/* The largest byte, character or field index used as an endpoint of a closed
- or degenerate range specification; this doesn't include the starting
- index of right-open-ended ranges. For example, with either range spec
- `2-5,9-', `2-3,5,9-' this variable would be set to 5. */
-@@ -97,10 +160,11 @@
-
- /* This is a bit vector.
- In byte mode, which bytes to output.
-+ In character mode, which characters to output.
- In field mode, which DELIM-separated fields to output.
-- Both bytes and fields are numbered starting with 1,
-+ Bytes, characters and fields are numbered starting with 1,
- so the zeroth bit of this array is unused.
-- A field or byte K has been selected if
-+ A byte, character or field K has been selected if
- (K <= MAX_RANGE_ENDPOINT and is_printable_field(K))
- || (EOL_RANGE_START > 0 && K >= EOL_RANGE_START). */
- static unsigned char *printable_field;
-@@ -109,9 +173,12 @@
- {
- undefined_mode,
-
-- /* Output characters that are in the given bytes. */
-+ /* Output bytes that are at the given positions. */
- byte_mode,
-
-+ /* Output characters that are at the given positions. */
-+ character_mode,
-+
- /* Output the given delimeter-separated fields. */
- field_mode
- };
-@@ -121,6 +188,13 @@
-
- static enum operating_mode operating_mode;
-
-+/* If nonzero, when in byte mode, don't split multibyte characters. */
-+static int byte_mode_character_aware;
-+
-+/* If nonzero, the function for single byte locale is work
-+ if this program runs on multibyte locale. */
-+static int force_singlebyte_mode;
-+
- /* If true do not output lines containing no delimeter characters.
- Otherwise, all such lines are printed. This option is valid only
- with field mode. */
-@@ -132,6 +206,9 @@
-
- /* The delimeter character for field mode. */
- static unsigned char delim;
-+#if HAVE_WCHAR_H
-+static wchar_t wcdelim;
-+#endif
-
- /* True if the --output-delimiter=STRING option was specified. */
- static bool output_delimiter_specified;
-@@ -205,7 +282,7 @@
- -f, --fields=LIST select only these fields; also print any line\n\
- that contains no delimiter character, unless\n\
- the -s option is specified\n\
-- -n (ignored)\n\
-+ -n with -b: don't split multibyte characters\n\
- "), stdout);
- fputs (_("\
- --complement complement the set of selected bytes, characters\n\
-@@ -362,7 +439,7 @@
- in_digits = false;
- /* Starting a range. */
- if (dash_found)
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
- dash_found = true;
- fieldstr++;
-
-@@ -387,14 +464,16 @@
- if (value == 0)
- {
- /* `n-'. From `initial' to end of line. */
-- eol_range_start = initial;
-+ if (eol_range_start == 0 ||
-+ (eol_range_start != 0 && eol_range_start > initial))
-+ eol_range_start = initial;
- field_found = true;
- }
- else
- {
- /* `m-n' or `-n' (1-n). */
- if (value < initial)
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
-
- /* Is there already a range going to end of line? */
- if (eol_range_start != 0)
-@@ -467,6 +546,9 @@
- if (operating_mode == byte_mode)
- error (0, 0,
- _("byte offset %s is too large"), quote (bad_num));
-+ else if (operating_mode == character_mode)
-+ error (0, 0,
-+ _("character offset %s is too large"), quote (bad_num));
- else
- error (0, 0,
- _("field number %s is too large"), quote (bad_num));
-@@ -477,7 +559,7 @@
- fieldstr++;
- }
- else
-- FATAL_ERROR (_("invalid byte or field list"));
-+ FATAL_ERROR (_("invalid byte, character or field list"));
- }
-
- max_range_endpoint = 0;
-@@ -570,6 +652,63 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+/* This function is in use for the following case.
-+
-+ 1. Read from the stream STREAM, printing to standard output any selected
-+ characters.
-+
-+ 2. Read from stream STREAM, printing to standard output any selected bytes,
-+ without splitting multibyte characters. */
-+
-+static void
-+cut_characters_or_cut_bytes_no_split (FILE *stream)
-+{
-+ int idx; /* number of bytes or characters in the line so far. */
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen; /* The length of the byte sequence in buf. */
-+ wint_t wc; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ idx = 0;
-+ buflen = 0;
-+ bufpos = buf;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ {
-+ if (idx > 0)
-+ putchar ('\n');
-+ break;
-+ }
-+ else if (wc == L'\n')
-+ {
-+ putchar ('\n');
-+ idx = 0;
-+ }
-+ else
-+ {
-+ idx += (operating_mode == byte_mode) ? mblength : 1;
-+ if (print_kth (idx, NULL))
-+ fwrite (bufpos, mblength, sizeof(char), stdout);
-+ }
-+
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+}
-+#endif
-+
- /* Read from stream STREAM, printing to standard output any selected fields. */
-
- static void
-@@ -692,13 +831,192 @@
- }
- }
-
-+#if HAVE_MBRTOWC
-+static void
-+cut_fields_mb (FILE *stream)
-+{
-+ int c;
-+ unsigned int field_idx;
-+ int found_any_selected_field;
-+ int buffer_first_field;
-+ int empty_input;
-+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
-+ char *bufpos; /* Next read position of BUF. */
-+ size_t buflen; /* The length of the byte sequence in buf. */
-+ wint_t wc = 0; /* A gotten wide character. */
-+ size_t mblength; /* The byte size of a multibyte character which shows
-+ as same character as WC. */
-+ mbstate_t state; /* State of the stream. */
-+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
-+
-+ found_any_selected_field = 0;
-+ field_idx = 1;
-+ bufpos = buf;
-+ buflen = 0;
-+ memset (&state, '\0', sizeof(mbstate_t));
-+
-+ c = getc (stream);
-+ empty_input = (c == EOF);
-+ if (c != EOF)
-+ ungetc (c, stream);
-+ else
-+ wc = WEOF;
-+
-+ /* To support the semantics of the -s flag, we may have to buffer
-+ all of the first field to determine whether it is `delimited.'
-+ But that is unnecessary if all non-delimited lines must be printed
-+ and the first field has been selected, or if non-delimited lines
-+ must be suppressed and the first field has *not* been selected.
-+ That is because a non-delimited line has exactly one field. */
-+ buffer_first_field = (suppress_non_delimited ^ !print_kth (1, NULL));
-+
-+ while (1)
-+ {
-+ if (field_idx == 1 && buffer_first_field)
-+ {
-+ int len = 0;
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER
-+ (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ break;
-+
-+ field_1_buffer = xrealloc (field_1_buffer, len + mblength);
-+ memcpy (field_1_buffer + len, bufpos, mblength);
-+ len += mblength;
-+ buflen -= mblength;
-+ bufpos += mblength;
-+
-+ if (!convfail && (wc == L'\n' || wc == wcdelim))
-+ break;
-+ }
-+
-+ if (wc == WEOF)
-+ break;
-+
-+ /* If the first field extends to the end of line (it is not
-+ delimited) and we are printing all non-delimited lines,
-+ print this one. */
-+ if (convfail || (!convfail && wc != wcdelim))
-+ {
-+ if (suppress_non_delimited)
-+ {
-+ /* Empty. */
-+ }
-+ else
-+ {
-+ fwrite (field_1_buffer, sizeof (char), len, stdout);
-+ /* Make sure the output line is newline terminated. */
-+ if (convfail || (!convfail && wc != L'\n'))
-+ putchar ('\n');
-+ }
-+ continue;
-+ }
-+
-+ if (print_kth (1, NULL))
-+ {
-+ /* Print the field, but not the trailing delimiter. */
-+ fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
-+ found_any_selected_field = 1;
-+ }
-+ ++field_idx;
-+ }
-+
-+ if (wc != WEOF)
-+ {
-+ if (print_kth (field_idx, NULL))
-+ {
-+ if (found_any_selected_field)
-+ {
-+ fwrite (output_delimiter_string, sizeof (char),
-+ output_delimiter_length, stdout);
-+ }
-+ found_any_selected_field = 1;
-+ }
-+
-+ while (1)
-+ {
-+ REFILL_BUFFER (buf, bufpos, buflen, stream);
-+
-+ GET_NEXT_WC_FROM_BUFFER
-+ (wc, bufpos, buflen, mblength, state, convfail);
-+
-+ if (wc == WEOF)
-+ break;
-+ else if (!convfail && (wc == wcdelim || wc == L'\n'))
-+ {
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ break;
-+ }
-+
-+ if (print_kth (field_idx, NULL))
-+ fwrite (bufpos, mblength, sizeof(char), stdout);
-+
-+ buflen -= mblength;
-+ bufpos += mblength;
-+ }
-+ }
-+
-+ if ((!convfail || wc == L'\n') && buflen < 1)
-+ wc = WEOF;
-+
-+ if (!convfail && wc == wcdelim)
-+ ++field_idx;
-+ else if (wc == WEOF || (!convfail && wc == L'\n'))
-+ {
-+ if (found_any_selected_field
-+ || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
-+ putchar ('\n');
-+ if (wc == WEOF)
-+ break;
-+ field_idx = 1;
-+ found_any_selected_field = 0;
-+ }
-+ }
-+}
-+#endif
-+
- static void
- cut_stream (FILE *stream)
- {
-- if (operating_mode == byte_mode)
-- cut_bytes (stream);
-+#if HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
-+ {
-+ switch (operating_mode)
-+ {
-+ case byte_mode:
-+ if (byte_mode_character_aware)
-+ cut_characters_or_cut_bytes_no_split (stream);
-+ else
-+ cut_bytes (stream);
-+ break;
-+
-+ case character_mode:
-+ cut_characters_or_cut_bytes_no_split (stream);
-+ break;
-+
-+ case field_mode:
-+ cut_fields_mb (stream);
-+ break;
-+
-+ default:
-+ abort ();
-+ }
-+ }
- else
-- cut_fields (stream);
-+#endif
-+ {
-+ if (operating_mode == field_mode)
-+ cut_fields (stream);
-+ else
-+ cut_bytes (stream);
-+ }
- }
-
- /* Process file FILE to standard output.
-@@ -748,6 +1066,8 @@
- bool ok;
- bool delim_specified = false;
- char *spec_list_string IF_LINT(= NULL);
-+ char mbdelim[MB_LEN_MAX + 1];
-+ size_t delimlen = 0;
-
- initialize_main (&argc, &argv);
- program_name = argv[0];
-@@ -770,7 +1090,6 @@
- switch (optc)
- {
- case 'b':
-- case 'c':
- /* Build the byte list. */
- if (operating_mode != undefined_mode)
- FATAL_ERROR (_("only one type of list may be specified"));
-@@ -778,6 +1097,14 @@
- spec_list_string = optarg;
- break;
-
-+ case 'c':
-+ /* Build the character list. */
-+ if (operating_mode != undefined_mode)
-+ FATAL_ERROR (_("only one type of list may be specified"));
-+ operating_mode = character_mode;
-+ spec_list_string = optarg;
-+ break;
-+
- case 'f':
- /* Build the field list. */
- if (operating_mode != undefined_mode)
-@@ -789,10 +1116,35 @@
- case 'd':
- /* New delimiter. */
- /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */
-- if (optarg[0] != '\0' && optarg[1] != '\0')
-- FATAL_ERROR (_("the delimiter must be a single character"));
-- delim = optarg[0];
-- delim_specified = true;
-+#if HAVE_MBRTOWC
-+ {
-+ if(MB_CUR_MAX > 1)
-+ {
-+ mbstate_t state;
-+
-+ memset (&state, '\0', sizeof(mbstate_t));
-+ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state);
-+
-+ if (delimlen == (size_t)-1 || delimlen == (size_t)-2)
-+ ++force_singlebyte_mode;
-+ else
-+ {
-+ delimlen = (delimlen < 1) ? 1 : delimlen;
-+ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0')
-+ FATAL_ERROR (_("the delimiter must be a single character"));
-+ memcpy (mbdelim, optarg, delimlen);
-+ }
-+ }
-+
-+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
-+#endif
-+ {
-+ if (optarg[0] != '\0' && optarg[1] != '\0')
-+ FATAL_ERROR (_("the delimiter must be a single character"));
-+ delim = (unsigned char) optarg[0];
-+ }
-+ delim_specified = true;
-+ }
- break;
-
- case OUTPUT_DELIMITER_OPTION:
-@@ -805,6 +1157,7 @@
- break;
-
- case 'n':
-+ byte_mode_character_aware = 1;
- break;
-
- case 's':
-@@ -827,7 +1180,7 @@
- if (operating_mode == undefined_mode)
- FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
-
-- if (delim != '\0' && operating_mode != field_mode)
-+ if (delim_specified && operating_mode != field_mode)
- FATAL_ERROR (_("an input delimiter may be specified only\
- when operating on fields"));
-
-@@ -854,15 +1207,34 @@
- }
-
- if (!delim_specified)
-- delim = '\t';
-+ {
-+ delim = '\t';
-+#ifdef HAVE_MBRTOWC
-+ wcdelim = L'\t';
-+ mbdelim[0] = '\t';
-+ mbdelim[1] = '\0';
-+ delimlen = 1;
-+#endif
-+ }
-
- if (output_delimiter_string == NULL)
- {
-- static char dummy[2];
-- dummy[0] = delim;
-- dummy[1] = '\0';
-- output_delimiter_string = dummy;
-- output_delimiter_length = 1;
-+#ifdef HAVE_MBRTOWC
-+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
-+ {
-+ output_delimiter_string = xstrdup(mbdelim);
-+ output_delimiter_length = delimlen;
-+ }
-+
-+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
-+#endif
-+ {
-+ static char dummy[2];
-+ dummy[0] = delim;
-+ dummy[1] = '\0';
-+ output_delimiter_string = dummy;
-+ output_delimiter_length = 1;
-+ }
- }
-
- if (optind == argc)
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch
deleted file mode 100644
index aba8742f6a..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- coreutils-6.9/src/ls.c.ls-x 2007-06-13 14:27:36.000000000 +0100
-+++ coreutils-6.9/src/ls.c 2007-06-13 14:28:42.000000000 +0100
-@@ -4151,16 +4151,16 @@
- size_t pos = 0;
- size_t cols = calculate_columns (false);
- struct column_info const *line_fmt = &column_info[cols - 1];
-- size_t name_length = length_of_file_name_and_frills (cwd_file);
-+ struct fileinfo const *f = sorted_file[0];
-+ size_t name_length = length_of_file_name_and_frills (f);
- size_t max_name_length = line_fmt->col_arr[0];
-
- /* Print first entry. */
-- print_file_name_and_frills (cwd_file);
-+ print_file_name_and_frills (f);
-
- /* Now the rest. */
- for (filesno = 1; filesno < cwd_n_used; ++filesno)
- {
-- struct fileinfo const *f;
- size_t col = filesno % cols;
-
- if (col == 0)
---- coreutils-6.9/tests/ls/Makefile.am.ls-x 2007-03-18 21:36:43.000000000 +0000
-+++ coreutils-6.9/tests/ls/Makefile.am 2007-06-13 14:28:42.000000000 +0100
-@@ -24,7 +24,7 @@
- stat-dtype \
- inode dangle file-type recursive dired infloop \
- rt-1 time-1 symlink-slash follow-slink no-arg m-option \
-- stat-vs-dirent
-+ stat-vs-dirent x-option
-
- EXTRA_DIST = $(TESTS)
- TESTS_ENVIRONMENT = \
---- /dev/null 2007-06-13 08:43:51.993263382 +0100
-+++ coreutils-6.9/tests/ls/x-option 2007-06-13 14:28:42.000000000 +0100
-@@ -0,0 +1,59 @@
-+#!/bin/sh
-+# Exercise the -x option.
-+
-+# Copyright (C) 2007 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+# GNU General Public License for more details.
-+
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-+# 02110-1301, USA.
-+
-+if test "$VERBOSE" = yes; then
-+ set -x
-+ ls --version
-+fi
-+
-+. $srcdir/../envvar-check
-+. $srcdir/../lang-default
-+
-+pwd=`pwd`
-+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-+trap '(exit $?); exit $?' 1 2 13 15
-+
-+framework_failure=0
-+mkdir -p $tmp || framework_failure=1
-+cd $tmp || framework_failure=1
-+mkdir subdir || framework_failure=1
-+touch subdir/b || framework_failure=1
-+touch subdir/a || framework_failure=1
-+
-+if test $framework_failure = 1; then
-+ echo "$0: failure in testing framework" 1>&2
-+ (exit 1); exit 1
-+fi
-+
-+fail=0
-+
-+# Coreutils 6.8 and 6.9 would output this in the wrong order.
-+ls -x subdir > out || fail=1
-+ls -rx subdir >> out || fail=1
-+cat <<\EOF > exp || fail=1
-+a b
-+b a
-+EOF
-+
-+cmp out exp || fail=1
-+test $fail = 1 && diff out exp 2> /dev/null
-+
-+(exit $fail); exit $fail
---- coreutils-6.9/NEWS.ls-x 2007-03-22 21:19:45.000000000 +0000
-+++ coreutils-6.9/NEWS 2007-06-13 14:28:42.000000000 +0100
-@@ -13,6 +13,11 @@
- Using pr -m -s (i.e. merging files, with TAB as the output separator)
- no longer inserts extraneous spaces between output columns.
-
-+** Bug fixes
-+
-+ ls -x DIR would sometimes output the wrong string in place of the
-+ first entry. [introduced in coreutils-6.8]
-+
-
- * Noteworthy changes in release 6.8 (2007-02-24) [not-unstable]
-
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
deleted file mode 100644
index 58074c09a5..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
-
-The package is stated as being Licensed as GPLv2+.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
-+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
-@@ -75,7 +75,7 @@
- # define NEW_TIME 0
- #endif
-
--#define IDLESTR_LEN 6
-+#define IDLESTR_LEN 10
-
- #if HAVE_STRUCT_XTMP_UT_PID
- # define PIDSTR_DECL_AND_INIT(Var, Utmp_ent) \
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch
deleted file mode 100644
index 02730dbbb4..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Upstream-Status: Pending
-
-automake 1.12 has depricated automatic de-ANSI-fication support
-
-this patch avoids these kinds of errors:
-
-| configure.ac:40: error: automatic de-ANSI-fication support has been removed
-| /srv/home/nitin/builds/build-gcc47/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12/protos.m4:12: AM_C_PROTOTYPES is expanded from...
-| /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-linux/coreutils-native-6.9-r2/coreutils-6.9/m4/jm-macros.m4:138: gl_CHECK_ALL_TYPES is expanded from...
-| /srv/home/nitin/builds/build-gcc47/tmp/work/x86_64-linux/coreutils-native-6.9-r2/coreutils-6.9/m4/jm-macros.m4:24: coreutils_MACROS is expanded from...
-| configure.ac:40: the top level
-| autom4te: m4 failed with exit status: 1
-
-Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
-2012/05/04
-
-Index: coreutils-6.9/m4/jm-macros.m4
-===================================================================
---- coreutils-6.9.orig/m4/jm-macros.m4
-+++ coreutils-6.9/m4/jm-macros.m4
-@@ -142,11 +142,6 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
- dnl whether functions and headers are available, whether they work, etc.
- AC_REQUIRE([AC_SYS_LARGEFILE])
-
-- dnl This test must precede tests of compiler characteristics like
-- dnl that for the inline keyword, since it may change the degree to
-- dnl which the compiler supports such features.
-- AC_REQUIRE([AM_C_PROTOTYPES])
--
- dnl Checks for typedefs, structures, and compiler characteristics.
- AC_REQUIRE([AC_C_BIGENDIAN])
- AC_REQUIRE([AC_C_VOLATILE])
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch b/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch
deleted file mode 100644
index e0d600a390..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch
+++ /dev/null
@@ -1,85 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-Use native coreutils binaries to build manpages in cross environment.
-This avoids man page build issues like this:
-
-| Making all in man
-| make[1]: Entering directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
-| Updating man page cut.1
-| Updating man page dir.1
-| Updating man page expand.1
-| Updating man page fold.1
-| Updating man page install.1
-| Updating man page join.1
-| Updating man page pr.1
-| Updating man page ls.1
-| Updating man page sort.1
-| Updating man page unexpand.1
-| Updating man page uniq.1
-| Updating man page who.1
-| Updating man page vdir.1
-| help2man: can't get `--help' info from dir.td/dir
-| help2man: can't get `--help' info from cut.td/cut
-| make[1]: *** [dir.1] Error 126
-| make[1]: *** Waiting for unfinished jobs....
-| help2man: can't get `--help' info from fold.td/fold
-| help2man: can't get `--help' info from install.td/install
-| help2man: can't get `--help' info from expand.td/expand
-| help2man: can't get `--help' info from join.td/join
-| make[1]: *** [cut.1] Error 126
-| make[1]: *** [fold.1] Error 126
-| make[1]: *** [install.1] Error 126
-| help2man: can't get `--help' info from sort.td/sort
-| make[1]: *** [expand.1] Error 126
-| help2man: can't get `--help' info from pr.td/pr
-| make[1]: *** [join.1] Error 126
-| help2man: can't get `--help' info from ls.td/ls
-| help2man: can't get `--help' info from unexpand.td/unexpand
-| help2man: can't get `--help' info from uniq.td/uniq
-| help2man: can't get `--help' info from who.td/who
-| make[1]: *** [sort.1] Error 126
-| make[1]: *** [pr.1] Error 126
-| help2man: can't get `--help' info from vdir.td/vdir
-| make[1]: *** [ls.1] Error 126
-| make[1]: *** [uniq.1] Error 126
-| make[1]: *** [unexpand.1] Error 126
-| make[1]: *** [who.1] Error 126
-| make[1]: *** [vdir.1] Error 126
-| make[1]: Leaving directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
-| make: *** [all-recursive] Error 1
-| FATAL: oe_runmake failed
-| ERROR: Function 'do_compile' failed (see /build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/temp/log.do_compile.12780 for further information)
-NOTE: package coreutils-6.9-r0: task do_compile: Failed
-ERROR: Task 8 (/home/nitin/prj/poky.git/meta/recipes-core/coreutils/coreutils_6.9.bb, do_compile) failed with exit code '1'
-
-
-This patch is made for gplv2 coreutils the recipe
-Nitin A Kamble <nitin.a.kamble@intel.com>
-2011/03/17
-
-Index: man/Makefile.am
-===================================================================
---- a/man.orig/Makefile.am
-+++ b/man/Makefile.am
-@@ -167,7 +167,7 @@ mapped_name = `echo $*|sed 's/install/gi
- $(PERL) -- $(srcdir)/help2man \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/$*.x \
-- --output=$t/$@ $t/$*; \
-+ --output=$t/$@ $*; \
- } \
- && sed 's|$*\.td/||g' $t/$@ > $@ \
- && chmod a-w $@ \
-Index: man/Makefile.in
-===================================================================
---- a/man.orig/Makefile.in
-+++ b/man/Makefile.in
-@@ -865,7 +865,7 @@ yes.1: $(common_dep) $(srcdir)/yes.x .
- $(PERL) -- $(srcdir)/help2man \
- --source='$(PACKAGE_STRING)' \
- --include=$(srcdir)/$*.x \
-- --output=$t/$@ $t/$*; \
-+ --output=$t/$@ $*; \
- } \
- && sed 's|$*\.td/||g' $t/$@ > $@ \
- && chmod a-w $@ \
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch b/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch
deleted file mode 100644
index 5ca590bcc6..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# coreutils uses gnulib which conflicts with newer libc header on futimens
-# this patch simply renames coreutils futimes to avoid confliction
-#
-# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/lib/utimens.c b/lib/utimens.c
-index 71bc510..ae870b8 100644
---- a/lib/utimens.c
-+++ b/lib/utimens.c
-@@ -75,7 +75,7 @@ struct utimbuf
- Return 0 on success, -1 (setting errno) on failure. */
-
- int
--futimens (int fd ATTRIBUTE_UNUSED,
-+futimens_coreutils (int fd ATTRIBUTE_UNUSED,
- char const *file, struct timespec const timespec[2])
- {
- /* Some Linux-based NFS clients are buggy, and mishandle time stamps
-@@ -185,5 +185,5 @@ futimens (int fd ATTRIBUTE_UNUSED,
- int
- utimens (char const *file, struct timespec const timespec[2])
- {
-- return futimens (-1, file, timespec);
-+ return futimens_coreutils (-1, file, timespec);
- }
-diff --git a/lib/utimens.h b/lib/utimens.h
-index 0097aaa..13fc45a 100644
---- a/lib/utimens.h
-+++ b/lib/utimens.h
-@@ -1,3 +1,3 @@
- #include <time.h>
--int futimens (int, char const *, struct timespec const [2]);
-+int futimens_coreutils (int, char const *, struct timespec const [2]);
- int utimens (char const *, struct timespec const [2]);
-diff --git a/src/copy.c b/src/copy.c
-index 4bdb75c..04634f1 100644
---- a/src/copy.c
-+++ b/src/copy.c
-@@ -518,7 +518,7 @@ copy_reg (char const *src_name, char const *dst_name,
- timespec[0] = get_stat_atime (src_sb);
- timespec[1] = get_stat_mtime (src_sb);
-
-- if (futimens (dest_desc, dst_name, timespec) != 0)
-+ if (futimens_coreutils (dest_desc, dst_name, timespec) != 0)
- {
- error (0, errno, _("preserving times for %s"), quote (dst_name));
- if (x->require_preserve)
-diff --git a/src/touch.c b/src/touch.c
-index a79c26d..6ef317d 100644
---- a/src/touch.c
-+++ b/src/touch.c
-@@ -182,7 +182,7 @@ touch (const char *file)
- t = timespec;
- }
-
-- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
-+ ok = (futimens_coreutils (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
-
- if (fd == STDIN_FILENO)
- {
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch b/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
deleted file mode 100644
index 8f355520bd..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# remove the line to cause recursive inclusion error from autoreconf, sicne
-# newer autoconf has included this definition. Simply rename it here.
-#
-# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/extensions.m4 b/extensions.m4
-index 143a9e5..f6558f1 100644
---- a/m4/extensions.m4
-+++ b/m4/extensions.m4
-@@ -16,7 +16,7 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS_DUMMY],
- [
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch b/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch
deleted file mode 100644
index c42cb9c059..0000000000
--- a/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Upstream-Status: Inappropriate [legacy version]
-
-# man page for 'touch' is generated differently from others. All other utilities
-# are provided static man source files, while for 'touch' it requires help2man
-# to invoke "touch --help" and then convert the output into the manual. Since touch
-# is with target format which can't be invoked on build system, disable building
-# 'touch' man page here.
-#
-# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
-# (this patch is licensed under GPLv2)
-
-diff --git a/man/Makefile.am b/man/Makefile.am
-index 32df9d1..37b09e3 100644
---- a/man/Makefile.am
-+++ b/man/Makefile.am
-@@ -27,7 +27,7 @@ dist_man_MANS = \
- paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
- rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
- shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
-- su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
-+ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 tr.1 true.1 tsort.1 \
- tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
- whoami.1 yes.1 $(MAN)
- optional_mans = \
diff --git a/meta/recipes-core/coreutils/coreutils-8.24/0001-Unset-need_charset_alias-when-building-for-musl.patch b/meta/recipes-core/coreutils/coreutils-8.24/0001-Unset-need_charset_alias-when-building-for-musl.patch
deleted file mode 100644
index abdfa2a50b..0000000000
--- a/meta/recipes-core/coreutils/coreutils-8.24/0001-Unset-need_charset_alias-when-building-for-musl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 13 Apr 2015 17:02:13 -0700
-Subject: [PATCH] Unset need_charset_alias when building for musl
-
-localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4
-which actually shoudl be fixed in gnulib and then all downstream
-projects will get it eventually. For now we apply the fix to
-coreutils
-
-Upstream-Status: Not Required
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/gnulib.mk | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/gnulib.mk b/lib/gnulib.mk
-index e1d74db..c0e92dd 100644
---- a/lib/gnulib.mk
-+++ b/lib/gnulib.mk
-@@ -1882,7 +1882,7 @@ install-exec-localcharset: all-local
- case '$(host_os)' in \
- darwin[56]*) \
- need_charset_alias=true ;; \
-- darwin* | cygwin* | mingw* | pw32* | cegcc*) \
-+ darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \
- need_charset_alias=false ;; \
- *) \
- need_charset_alias=true ;; \
---
-2.1.4
-
diff --git a/meta/recipes-core/coreutils/coreutils-8.24/man-decouple-manpages-from-build.patch b/meta/recipes-core/coreutils/coreutils-8.24/man-decouple-manpages-from-build.patch
deleted file mode 100644
index 3c896a11bf..0000000000
--- a/meta/recipes-core/coreutils/coreutils-8.24/man-decouple-manpages-from-build.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From b4d258629f090066783c3b4c91b40f63b9d0a296 Mon Sep 17 00:00:00 2001
-From: Paul Gortmaker <paul.gortmaker@windriver.com>
-Date: Sun, 8 Feb 2015 16:51:57 -0500
-Subject: [PATCH] man: decouple manpages from build
-
-The use of "help2man" doesn't work at all for cross compile, in
-addition to the extra requirement of perl it adds.
-
-Just decouple the manpages from the build in order to pave the way for
-importing prebuilt manpages that can be used in a cross build situation.
-
-Upstream-Status: Inappropriate [upstream doesn't care about x-compile case.]
-Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-
-diff --git a/Makefile.am b/Makefile.am
-index fb4af27..7576b2c 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -214,5 +214,4 @@ AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib -Isrc -I$(top_srcdir)/src
- include $(top_srcdir)/lib/local.mk
- include $(top_srcdir)/src/local.mk
- include $(top_srcdir)/doc/local.mk
--include $(top_srcdir)/man/local.mk
- include $(top_srcdir)/tests/local.mk
---
-2.2.2
-
diff --git a/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch b/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch
new file mode 100644
index 0000000000..66f9a716c9
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/0001-local.mk-fix-cross-compiling-problem.patch
@@ -0,0 +1,26 @@
+Subject: local.mk: fix cross compiling problem
+
+We meet the following error when cross compiling.
+| Makefile:3418: *** Recursive variable 'INSTALL' references itself (eventually). Stop.
+This patch fixes this problem.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/local.mk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/local.mk b/src/local.mk
+index 36dfa4e..c5898cc 100644
+--- a/src/local.mk
++++ b/src/local.mk
+@@ -649,4 +649,4 @@ cu_install_program = @INSTALL_PROGRAM@
+ else
+ cu_install_program = src/ginstall
+ endif
+-INSTALL = $(cu_install_program) -c
++INSTALL_PROGRAM = $(cu_install_program)
+--
+2.1.0
+
diff --git a/meta/recipes-core/coreutils/coreutils/0001-uname-report-processor-and-hardware-correctly.patch b/meta/recipes-core/coreutils/coreutils/0001-uname-report-processor-and-hardware-correctly.patch
new file mode 100644
index 0000000000..3c43e1d5da
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/0001-uname-report-processor-and-hardware-correctly.patch
@@ -0,0 +1,64 @@
+Upstream-Status: Denied
+
+Subject: uname: report processor and hardware correctly
+
+This patch is rejected by coreutils upstream, but distros like debian and fedora
+uses this patch to make `uname -i' and `uname -p' to not report 'unknown'.
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/uname.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/uname.c b/src/uname.c
+index 39bd28c..c84582d 100644
+--- a/src/uname.c
++++ b/src/uname.c
+@@ -299,13 +299,19 @@ main (int argc, char **argv)
+
+ if (toprint & PRINT_PROCESSOR)
+ {
+- char const *element = unknown;
++ char *element = unknown;
+ #if HAVE_SYSINFO && defined SI_ARCHITECTURE
+ {
+ static char processor[257];
+ if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
+ element = processor;
+ }
++#else
++ {
++ static struct utsname u;
++ uname(&u);
++ element = u.machine;
++ }
+ #endif
+ #ifdef UNAME_PROCESSOR
+ if (element == unknown)
+@@ -343,7 +349,7 @@ main (int argc, char **argv)
+
+ if (toprint & PRINT_HARDWARE_PLATFORM)
+ {
+- char const *element = unknown;
++ char *element = unknown;
+ #if HAVE_SYSINFO && defined SI_PLATFORM
+ {
+ static char hardware_platform[257];
+@@ -361,6 +367,14 @@ main (int argc, char **argv)
+ if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
+ element = hardware_platform;
+ }
++#else
++ {
++ static struct utsname u;
++ uname(&u);
++ element = u.machine;
++ if(strlen(element)==4 && element[0]=='i' && element[2]=='8' && element[3]=='6')
++ element[1]='3';
++ }
+ #endif
+ if (! (toprint == UINT_MAX && element == unknown))
+ print_element (element);
+--
+1.9.1
+
diff --git a/meta/recipes-core/coreutils/coreutils/e8b56ebd536e82b15542a00c888109471936bfda.patch b/meta/recipes-core/coreutils/coreutils/e8b56ebd536e82b15542a00c888109471936bfda.patch
new file mode 100644
index 0000000000..d69ee95e4a
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/e8b56ebd536e82b15542a00c888109471936bfda.patch
@@ -0,0 +1,93 @@
+From e8b56ebd536e82b15542a00c888109471936bfda Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
+Date: Fri, 24 Sep 2021 20:57:41 +0100
+Subject: [PATCH] chmod: fix exit status when ignoring symlinks
+
+* src/chmod.c: Reorder enum so CH_NOT_APPLIED
+can be treated as a non error.
+* tests/chmod/ignore-symlink.sh: A new test.
+* tests/local.mk: Reference the new test.
+* NEWS: Mention the bug fix.
+Fixes https://bugs.gnu.org/50784
+
+Upstream-Status: Backport
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ src/chmod.c | 4 ++--
+ tests/chmod/ignore-symlink.sh | 31 +++++++++++++++++++++++++++++++
+ tests/local.mk | 1 +
+ 4 files changed, 40 insertions(+), 2 deletions(-)
+ create mode 100755 tests/chmod/ignore-symlink.sh
+
+diff --git a/src/chmod.c b/src/chmod.c
+index 37b04f500..57ac47f33 100644
+--- a/src/chmod.c
++++ b/src/chmod.c
+@@ -44,8 +44,8 @@ struct change_status
+ enum
+ {
+ CH_NO_STAT,
+- CH_NOT_APPLIED,
+ CH_FAILED,
++ CH_NOT_APPLIED,
+ CH_NO_CHANGE_REQUESTED,
+ CH_SUCCEEDED
+ }
+@@ -322,7 +322,7 @@ process_file (FTS *fts, FTSENT *ent)
+ if ( ! recurse)
+ fts_set (fts, ent, FTS_SKIP);
+
+- return CH_NO_CHANGE_REQUESTED <= ch.status;
++ return CH_NOT_APPLIED <= ch.status;
+ }
+
+ /* Recursively change the modes of the specified FILES (the last entry
+diff --git a/tests/chmod/ignore-symlink.sh b/tests/chmod/ignore-symlink.sh
+new file mode 100755
+index 000000000..5ce3de816
+--- /dev/null
++++ b/tests/chmod/ignore-symlink.sh
+@@ -0,0 +1,31 @@
++#!/bin/sh
++# Test for proper exit code of chmod on a processed symlink.
++
++# Copyright (C) 2021 Free Software Foundation, Inc.
++
++# This program is free software: you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation, either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see <https://www.gnu.org/licenses/>.
++
++. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
++print_ver_ chmod
++
++mkdir dir || framework_failure_
++touch dir/f || framework_failure_
++ln -s f dir/l || framework_failure_
++
++# This operation ignores symlinks but should succeed.
++chmod u+w -R dir 2> out || fail=1
++
++compare /dev/null out || fail=1
++
++Exit $fail
+diff --git a/tests/local.mk b/tests/local.mk
+index 228d0e368..b5b893fb7 100644
+--- a/tests/local.mk
++++ b/tests/local.mk
+@@ -456,6 +456,7 @@ all_tests = \
+ tests/chmod/c-option.sh \
+ tests/chmod/equal-x.sh \
+ tests/chmod/equals.sh \
++ tests/chmod/ignore-symlink.sh \
+ tests/chmod/inaccessible.sh \
+ tests/chmod/octal.sh \
+ tests/chmod/setgid.sh \
diff --git a/meta/recipes-core/coreutils/coreutils-8.24/fix-selinux-flask.patch b/meta/recipes-core/coreutils/coreutils/fix-selinux-flask.patch
index 9d1ae55d47..4f126ad67c 100644
--- a/meta/recipes-core/coreutils/coreutils-8.24/fix-selinux-flask.patch
+++ b/meta/recipes-core/coreutils/coreutils/fix-selinux-flask.patch
@@ -1,4 +1,4 @@
-From a1d360509fa3a4aff57eedcd528cc0347a87531d Mon Sep 17 00:00:00 2001
+From b04363018b4b9b45fdf23384f30d02caa5564602 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Tue, 16 Sep 2014 01:59:08 -0700
Subject: [PATCH] gnulib-comp.m4: selinux/flask.h should respect to
@@ -13,27 +13,25 @@ compilation terminated.
Upstream-Status: Pending
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+
---
- m4/gnulib-comp.m4 | 2 +-
+ m4/gnulib-comp.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
-index 472d3a0..5f09734 100644
+index 3857233..c01fb30 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
-@@ -1730,11 +1730,11 @@ AC_DEFUN([gl_INIT],
+@@ -1953,11 +1953,11 @@ AC_DEFUN([gl_INIT],
AC_LIBOBJ([select])
fi
gl_SYS_SELECT_MODULE_INDICATOR([select])
- AC_CHECK_HEADERS([selinux/flask.h])
- AC_LIBOBJ([selinux-at])
gl_HEADERS_SELINUX_SELINUX_H
gl_HEADERS_SELINUX_CONTEXT_H
+ gl_HEADERS_SELINUX_LABEL_H
if test "$with_selinux" != no && test "$ac_cv_header_selinux_selinux_h" = yes; then
+ AC_CHECK_HEADERS([selinux/flask.h])
AC_LIBOBJ([getfilecon])
fi
gl_SERVENT
---
-1.7.9.5
-
diff --git a/meta/recipes-core/coreutils/coreutils-8.24/remove-usr-local-lib-from-m4.patch b/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch
index 2ef8a548ac..1a8a9b9983 100644
--- a/meta/recipes-core/coreutils/coreutils-8.24/remove-usr-local-lib-from-m4.patch
+++ b/meta/recipes-core/coreutils/coreutils/remove-usr-local-lib-from-m4.patch
@@ -1,3 +1,8 @@
+From a26530083a29eeee910bfd606ecc621acecd547a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 3 Aug 2011 14:12:30 -0700
+Subject: [PATCH] coreutils: Fix build on uclibc
+
We have problem using hardcoded directories like /usr/local here
which will be checked for cross builds. This is a special case which
is valid for AIX only. We do not have AIX as one of our supported
@@ -8,11 +13,15 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [Upstream does care for AIX while we may not]
-Index: coreutils-8.14/m4/getloadavg.m4
-===================================================================
---- coreutils-8.14.orig/m4/getloadavg.m4 2011-09-19 08:09:24.000000000 -0700
-+++ coreutils-8.14/m4/getloadavg.m4 2011-10-19 21:42:00.385533357 -0700
-@@ -41,16 +41,6 @@
+---
+ m4/getloadavg.m4 | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
+index 8e96965..63782a2 100644
+--- a/m4/getloadavg.m4
++++ b/m4/getloadavg.m4
+@@ -41,18 +41,6 @@ AC_CHECK_FUNC([getloadavg], [],
[LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
fi
@@ -20,7 +29,9 @@ Index: coreutils-8.14/m4/getloadavg.m4
- # There is a commonly available library for RS/6000 AIX.
- # Since it is not a standard part of AIX, it might be installed locally.
- gl_getloadavg_LIBS=$LIBS
-- LIBS="-L/usr/local/lib $LIBS"
+- if test $cross_compiling != yes; then
+- LIBS="-L/usr/local/lib $LIBS"
+- fi
- AC_CHECK_LIB([getloadavg], [getloadavg],
- [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
- [LIBS=$gl_getloadavg_LIBS])
diff --git a/meta/recipes-core/coreutils/coreutils/run-ptest b/meta/recipes-core/coreutils/coreutils/run-ptest
new file mode 100755
index 0000000000..6d4a7b365d
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils/run-ptest
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# remove any stale lock files so that the calls to groupadd/useradd don't stop
+# the ptest if re-using the same image
+rm -rf /etc/passwd.lock /etc/group.lock /etc/gshadow.lock
+
+COREUTILSLIB=@libdir@/coreutils
+LOG="${COREUTILSLIB}/ptest/coreutils_ptest_$(date +%Y%m%d-%H%M%S).log"
+USERNAME="tester"
+groupadd ugroup1
+groupadd ugroup2
+useradd -G ugroup1,ugroup2 $USERNAME || echo "user $USERNAME already exists"
+
+su tester -c "cd ${COREUTILSLIB}/ptest && make check-TESTS top_srcdir=. srcdir=." 2>&1 | tee -a ${LOG}
+userdel $USERNAME
+groupdel ugroup1
+groupdel ugroup2
diff --git a/meta/recipes-core/coreutils/coreutils_6.9.bb b/meta/recipes-core/coreutils/coreutils_6.9.bb
deleted file mode 100644
index 4ff1d50bd4..0000000000
--- a/meta/recipes-core/coreutils/coreutils_6.9.bb
+++ /dev/null
@@ -1,102 +0,0 @@
-SUMMARY = "The basic file, shell and text manipulation utilities"
-DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
-manipulation utilities. These are the core utilities which are expected to exist on \
-every system."
-
-HOMEPAGE = "http://www.gnu.org/software/coreutils/"
-BUGTRACKER = "http://debbugs.gnu.org/coreutils"
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
- file://src/ls.c;beginline=4;endline=16;md5=15ed60f67b1db5fedd5dbc37cf8a9543"
-PR = "r5"
-
-inherit autotools gettext texinfo
-
-SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
- file://gnulib_m4.patch \
- file://futimens.patch \
- file://coreutils-ls-x.patch \
- file://coreutils-6.9-cp-i-u.patch \
- file://coreutils-i18n.patch \
- file://coreutils-overflow.patch \
- file://coreutils-fix-install.patch \
- file://man-touch.patch \
- file://coreutils_fix_for_automake-1.12.patch \
- file://coreutils-build-with-acl.patch \
- file://coreutils-fix-texinfo.patch \
- file://fix_for_manpage_building.patch \
- "
-
-SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
-SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
-
-EXTRA_OECONF += "ac_cv_func_getgroups_works=yes \
- ac_cv_func_strcoll_works=yes"
-
-# acl is not a default feature
-#
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
-
-# with, without, depends, rdepends
-#
-PACKAGECONFIG[acl] = "ac_cv_header_sys_acl_h=yes,ac_cv_header_sys_acl_h=no,acl,"
-
-
-# [ gets a special treatment and is not included in this
-bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
- env expand expr factor fmt fold groups head hostid id install \
- join link logname md5sum mkfifo nice nl nohup od paste pathchk \
- pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
- sha384sum sha512sum shred shuf sort split sum tac tail tee test \
- tr tsort tty unexpand uniq unlink users vdir wc who whoami yes uptime"
-
-# hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
- mknod mv pwd rm rmdir sleep stty sync touch true uname hostname stat"
-
-sbindir_progs= "chroot"
-
-# Let aclocal use the relative path for the m4 file rather than the
-# absolute since coreutils has a lot of m4 files, otherwise there might
-# be an "Argument list too long" error when it is built in a long/deep
-# directory.
-acpaths = "-I ./m4"
-
-do_install() {
- autotools_do_install
-
- install -d ${D}${base_bindir}
- [ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
-
- install -d ${D}${sbindir}
- [ "${bindir}" != "${sbindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
-
- # [ requires special handling because [.coreutils will cause the sed stuff
- # in update-alternatives to fail, therefore use lbracket - the name used
- # for the actual source file.
- mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
-
- # Newer versions of coreutils do not include su, to mimic this behavior
- # we simply remove it.
- rm -f ${D}${bindir}/su
-}
-
-inherit update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-
-ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs}"
-
-ALTERNATIVE_PRIORITY[uptime] = "10"
-ALTERNATIVE_PRIORITY[hostname] = "10"
-
-ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
-ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
-
-python __anonymous() {
- for prog in d.getVar('base_bindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
-
- for prog in d.getVar('sbindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
-}
diff --git a/meta/recipes-core/coreutils/coreutils_8.24.bb b/meta/recipes-core/coreutils/coreutils_8.24.bb
deleted file mode 100644
index 034ebcda95..0000000000
--- a/meta/recipes-core/coreutils/coreutils_8.24.bb
+++ /dev/null
@@ -1,127 +0,0 @@
-SUMMARY = "The basic file, shell and text manipulation utilities"
-DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
-manipulation utilities. These are the core utilities which are expected to exist on \
-every system."
-HOMEPAGE = "http://www.gnu.org/software/coreutils/"
-BUGTRACKER = "http://debbugs.gnu.org/coreutils"
-LICENSE = "GPLv3+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\
- file://src/ls.c;beginline=5;endline=16;md5=38b79785ca88537b75871782a2a3c6b8"
-DEPENDS = "gmp libcap"
-DEPENDS_class-native = ""
-
-inherit autotools gettext texinfo
-
-SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz;name=tarball \
- http://distfiles.gentoo.org/distfiles/${BP}-man.tar.xz;name=manpages \
- file://man-decouple-manpages-from-build.patch \
- file://remove-usr-local-lib-from-m4.patch \
- file://fix-selinux-flask.patch \
- file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
- "
-
-SRC_URI[tarball.md5sum] = "40efdbce865d2458d8da0a9dcee7c16c"
-SRC_URI[tarball.sha256sum] = "a2d75286a4b9ef3a13039c2da3868a61be4ee9f17d8ae380a35a97e506972170"
-SRC_URI[manpages.md5sum] = "728a91a5c1095a33cffb9959bb891963"
-SRC_URI[manpages.sha256sum] = "cf0333b5f134a331e0b46e2ddf90666f8bdc3281c1ca2c7ccbb75b437589ce37"
-
-EXTRA_OECONF_class-native = "--without-gmp"
-EXTRA_OECONF_class-target = "--enable-install-program=arch --libexecdir=${libdir}"
-
-# acl is not a default feature
-#
-PACKAGECONFIG_class-target ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
-PACKAGECONFIG_class-native ??= ""
-
-# with, without, depends, rdepends
-#
-PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
-
-# [ df mktemp base64 gets a special treatment and is not included in this
-bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
- env expand expr factor fmt fold groups head hostid id install \
- join link logname md5sum mkfifo nice nl nohup nproc od paste pathchk \
- pinky pr printenv printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
- sha384sum sha512sum shred shuf sort split stdbuf sum tac tail tee test timeout\
- tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
-
-# hostname gets a special treatment and is not included in this
-base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
- mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
-
-sbindir_progs= "chroot"
-
-# Let aclocal use the relative path for the m4 file rather than the
-# absolute since coreutils has a lot of m4 files, otherwise there might
-# be an "Argument list too long" error when it is built in a long/deep
-# directory.
-acpaths = "-I ./m4"
-
-# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
-do_compile_prepend () {
- mkdir -p ${B}/src
-}
-
-do_install_append() {
- for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
-
- install -d ${D}${base_bindir}
- [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
-
- install -d ${D}${sbindir}
- [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
-
- # [ requires special handling because [.coreutils will cause the sed stuff
- # in update-alternatives to fail, therefore use lbracket - the name used
- # for the actual source file.
- mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
-
- # prebuilt man pages
- install -d ${D}/${mandir}/man1
- install -t ${D}/${mandir}/man1 ${S}/man/*.1
- # prebuilt man pages don't do a separate man page for [ vs test.
- # see comment above r.e. sed and update-alternatives
- cp -a ${D}${mandir}/man1/test.1 ${D}${mandir}/man1/lbracket.1.${BPN}
-}
-
-do_install_append_class-native(){
- # remove groups to fix conflict with shadow-native
- rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
-}
-
-inherit update-alternatives
-
-ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 mktemp df"
-ALTERNATIVE_${PN}-doc = "base64.1 mktemp.1 df.1 lbracket.1 groups.1 kill.1 uptime.1 stat.1"
-
-ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
-ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
-ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
-
-ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
-ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
-ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
-
-ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
-ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
-ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
-
-ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
-ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
-ALTERNATIVE_LINK_NAME[lbracket.1] = "${mandir}/man1/lbracket.1"
-
-ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
-ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
-ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
-ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
-
-python __anonymous() {
- for prog in d.getVar('base_bindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
-
- for prog in d.getVar('sbindir_progs', True).split():
- d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
new file mode 100644
index 0000000000..0800bc3b6d
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
@@ -0,0 +1,209 @@
+SUMMARY = "The basic file, shell and text manipulation utilities"
+DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
+manipulation utilities. These are the core utilities which are expected to exist on \
+every system."
+HOMEPAGE = "http://www.gnu.org/software/coreutils/"
+BUGTRACKER = "http://debbugs.gnu.org/coreutils"
+LICENSE = "GPLv3+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
+ file://src/ls.c;beginline=1;endline=15;md5=3b8fbaee597c8a9bb88d30840d53048c \
+ "
+DEPENDS = "gmp libcap"
+DEPENDS:class-native = ""
+
+inherit autotools gettext texinfo
+
+SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
+ file://remove-usr-local-lib-from-m4.patch \
+ file://fix-selinux-flask.patch \
+ file://0001-uname-report-processor-and-hardware-correctly.patch \
+ file://0001-local.mk-fix-cross-compiling-problem.patch \
+ file://e8b56ebd536e82b15542a00c888109471936bfda.patch \
+ file://run-ptest \
+ "
+
+SRC_URI[sha256sum] = "ce30acdf4a41bc5bb30dd955e9eaa75fa216b4e3deb08889ed32433c7b3b97ce"
+
+# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842
+# runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue.
+CVE_CHECK_WHITELIST += "CVE-2016-2781"
+
+EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}"
+EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname"
+
+# acl and xattr are not default features
+#
+PACKAGECONFIG:class-target ??= "\
+ ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
+"
+
+# The lib/oe/path.py requires xattr
+PACKAGECONFIG:class-native ??= "xattr"
+
+# oe-core builds need xattr support
+PACKAGECONFIG:class-nativesdk ??= "xattr"
+
+# with, without, depends, rdepends
+#
+PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
+PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
+PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
+
+# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
+bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
+ env expand expr factor fmt fold groups head hostid id install \
+ join link logname md5sum mkfifo nl nohup nproc od paste pathchk \
+ pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
+ sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \
+ tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
+
+# hostname gets a special treatment and is not included in this
+base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \
+ mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
+
+sbindir_progs= "chroot"
+
+# Split stdbuf into its own package, so one can include
+# coreutils-stdbuf without getting the rest of coreutils, but make
+# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils"
+# always provides all coreutils
+PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
+FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so"
+RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
+
+# However, when the single-binary PACKAGECONFIG is used, stdbuf
+# functionality is built into the single coreutils binary, so there's
+# no point splitting /usr/bin/stdbuf to its own package. Instead, add
+# an RPROVIDE so that rdepending on coreutils-stdbuf will work
+# regardless of whether single-binary is in effect.
+RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}"
+
+# Let aclocal use the relative path for the m4 file rather than the
+# absolute since coreutils has a lot of m4 files, otherwise there might
+# be an "Argument list too long" error when it is built in a long/deep
+# directory.
+acpaths = "-I ./m4"
+
+# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
+do_compile:prepend () {
+ mkdir -p ${B}/src
+}
+
+do_install:class-native() {
+ autotools_do_install
+ # remove groups to fix conflict with shadow-native
+ rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
+ # The return is a must since native doesn't need the
+ # do_install:append() in the below.
+ return
+}
+
+do_install:append() {
+ for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
+
+ install -d ${D}${base_bindir}
+ [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
+
+ install -d ${D}${sbindir}
+ [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
+
+ # [ requires special handling because [.coreutils will cause the sed stuff
+ # in update-alternatives to fail, therefore use lbracket - the name used
+ # for the actual source file.
+ mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
+}
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+# Make hostname's priority higher than busybox but lower than net-tools
+ALTERNATIVE_PRIORITY[hostname] = "90"
+ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df"
+ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1"
+
+ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
+
+ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
+ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
+ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
+
+ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
+ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
+ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
+
+ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
+ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
+ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
+
+ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice"
+ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}"
+ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1"
+
+ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv"
+ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}"
+
+ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
+ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
+
+ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
+ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
+ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
+ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
+
+python __anonymous() {
+ for prog in d.getVar('base_bindir_progs').split():
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
+
+ for prog in d.getVar('sbindir_progs').split():
+ d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog))
+}
+
+BBCLASSEXTEND = "native nativesdk"
+
+inherit ptest
+
+RDEPENDS:${PN}-ptest += "bash findutils gawk liberror-perl make perl perl-modules python3-core sed shadow"
+
+# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy
+# may need tweaking if DEPENDS changes
+RRECOMMENDS:coreutils-dev[nodeprrecs] = "1"
+RRECOMMENDS:coreutils-dev = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
+
+do_install_ptest () {
+ install -d ${D}${PTEST_PATH}/tests
+ cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
+ sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
+ install -d ${D}${PTEST_PATH}/build-aux
+ install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
+ cp ${B}/Makefile ${D}${PTEST_PATH}/
+ cp ${S}/init.cfg ${D}${PTEST_PATH}/
+ cp -r ${B}/src ${D}${PTEST_PATH}/
+ cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
+ sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
+ sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
+ chmod -R 777 ${D}${PTEST_PATH}
+
+ # Disable subcase stty-pairs.sh, it will cause test framework hang
+ sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
+
+ # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems
+ sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile
+
+ # Tweak test d_type-check to use python3 instead of python
+ sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check
+ install ${B}/src/getlimits ${D}/${bindir}
+
+ # handle multilib
+ sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
+}
+
+FILES:${PN}-ptest += "${bindir}/getlimits"
+
+# These are specific to Opensuse
+CVE_WHITELIST += "CVE-2013-0221 CVE-2013-0222 CVE-2013-0223"
diff --git a/meta/recipes-core/dbus-wait/dbus-wait_git.bb b/meta/recipes-core/dbus-wait/dbus-wait_git.bb
index 691dc86e92..b39f7523c0 100644
--- a/meta/recipes-core/dbus-wait/dbus-wait_git.bb
+++ b/meta/recipes-core/dbus-wait/dbus-wait_git.bb
@@ -1,5 +1,6 @@
SUMMARY = "A simple tool to wait for a specific signal over DBus"
HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/dbus-wait"
+DESCRIPTION = "${SUMMARY}"
SECTION = "base"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
@@ -10,7 +11,8 @@ SRCREV = "6cc6077a36fe2648a5f993fe7c16c9632f946517"
PV = "0.1+git${SRCPV}"
PR = "r2"
-SRC_URI = "git://git.yoctoproject.org/${BPN}"
+SRC_URI = "git://git.yoctoproject.org/${BPN};branch=master"
+UPSTREAM_CHECK_COMMITS = "1"
S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/dbus/dbus-glib.inc b/meta/recipes-core/dbus/dbus-glib.inc
deleted file mode 100644
index abd013247c..0000000000
--- a/meta/recipes-core/dbus/dbus-glib.inc
+++ /dev/null
@@ -1,43 +0,0 @@
-SUMMARY = "High level language (GLib) binding for D-Bus"
-DESCRIPTION = "GLib bindings for the D-Bus message bus that integrate \
-the D-Bus library with the GLib thread abstraction and main loop."
-HOMEPAGE = "http://www.freedesktop.org/Software/dbus"
-LICENSE = "AFL-2 | GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=cf5b3a2f7083750d504333114e738656 \
- file://dbus/dbus-glib.h;beginline=7;endline=21;md5=7755c9d7abccd5dbd25a6a974538bb3c"
-SECTION = "base"
-
-DEPENDS = "expat glib-2.0 virtual/libintl dbus-glib-native dbus"
-DEPENDS_class-native = "glib-2.0-native dbus-native"
-
-SRC_URI = "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
- file://no-examples.patch \
- file://test-install-makefile.patch \
-"
-
-inherit autotools pkgconfig gettext
-
-#default disable regression tests, some unit test code in non testing code
-#PACKAGECONFIG_pn-${PN} = "tests" enable regression tests local.conf
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[tests] = "--enable-tests,,,"
-
-EXTRA_OECONF = "--with-introspect-xml=${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml \
- --with-dbus-binding-tool=${STAGING_BINDIR_NATIVE}/dbus-binding-tool"
-EXTRA_OECONF_class-native = "--with-introspect-xml=${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml"
-
-PACKAGES += "${PN}-bash-completion ${PN}-tests-dbg ${PN}-tests"
-
-FILES_${PN} = "${libdir}/lib*${SOLIBS}"
-FILES_${PN}-bash-completion = "${sysconfdir}/bash_completion.d/dbus-bash-completion.sh \
- ${libexecdir}/dbus-bash-completion-helper"
-FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
-FILES_${PN}-dev += "${bindir}/dbus-binding-tool"
-
-RDEPENDS_${PN}-tests += "dbus-x11"
-FILES_${PN}-tests = "${datadir}/${BPN}/tests"
-FILES_${PN}-tests-dbg = "${datadir}/${BPN}/tests/.debug/* \
- ${datadir}/${BPN}/tests/core/.debug/* \
- ${datadir}/${BPN}/tests/interfaces/.debug/*"
-
-BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/dbus/dbus-glib/no-examples.patch b/meta/recipes-core/dbus/dbus-glib/no-examples.patch
index fbb4967828..32e7611718 100644
--- a/meta/recipes-core/dbus/dbus-glib/no-examples.patch
+++ b/meta/recipes-core/dbus/dbus-glib/no-examples.patch
@@ -5,11 +5,13 @@ Upstream-Status: Inappropriate [disable feature]
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---- dbus-glib-0.70/dbus/Makefile.am.orig 2006-07-23 16:04:43.000000000 +0200
-+++ dbus-glib-0.70/dbus/Makefile.am 2006-07-23 16:04:52.000000000 +0200
+Index: dbus-glib-0.108/dbus/Makefile.am
+===================================================================
+--- dbus-glib-0.108.orig/dbus/Makefile.am
++++ dbus-glib-0.108/dbus/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . examples
+SUBDIRS = .
- INCLUDES=-I$(top_srcdir) $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_TOOL_CFLAGS) -DDBUS_COMPILATION=1 -DDBUS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\"
-
+ AM_CPPFLAGS = \
+ -I$(top_srcdir) \
diff --git a/meta/recipes-core/dbus/dbus-glib_0.104.bb b/meta/recipes-core/dbus/dbus-glib_0.104.bb
deleted file mode 100644
index c1263c0aff..0000000000
--- a/meta/recipes-core/dbus/dbus-glib_0.104.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require dbus-glib.inc
-
-SRC_URI[md5sum] = "5497d2070709cf796f1878c75a72a039"
-SRC_URI[sha256sum] = "bfc1f1a82bfc3ec3ecafe04d0e87bab7e999f50dce4f4a34d0b89caf6bd821f6"
diff --git a/meta/recipes-core/dbus/dbus-glib_0.112.bb b/meta/recipes-core/dbus/dbus-glib_0.112.bb
new file mode 100644
index 0000000000..99b0a20004
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib_0.112.bb
@@ -0,0 +1,39 @@
+SUMMARY = "High level language (GLib) binding for D-Bus"
+DESCRIPTION = "GLib bindings for the D-Bus message bus that integrate \
+the D-Bus library with the GLib thread abstraction and main loop."
+HOMEPAGE = "https://www.freedesktop.org/Software/dbus"
+LICENSE = "AFL-2.1 | GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c31c73c1d8f5d06784b2ccd22e42d641 \
+ file://dbus/dbus-glib.h;beginline=7;endline=21;md5=c374833bd817988323f3a8fda0dc7f48"
+SECTION = "base"
+
+DEPENDS = "expat glib-2.0 virtual/libintl dbus-glib-native dbus"
+DEPENDS:class-native = "glib-2.0-native dbus-native"
+
+SRC_URI = "https://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
+ file://no-examples.patch \
+ file://test-install-makefile.patch \
+"
+SRC_URI[md5sum] = "021e6c8a288df02c227e4aafbf7e7527"
+SRC_URI[sha256sum] = "7d550dccdfcd286e33895501829ed971eeb65c614e73aadb4a08aeef719b143a"
+
+inherit autotools pkgconfig gettext bash-completion gtk-doc
+
+#default disable regression tests, some unit test code in non testing code
+#PACKAGECONFIG:pn-${PN} = "tests" enable regression tests local.conf
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[tests] = "--enable-tests,,,"
+
+EXTRA_OECONF:class-target = "--with-dbus-binding-tool=${STAGING_BINDIR_NATIVE}/dbus-binding-tool"
+
+PACKAGES += "${PN}-tests"
+
+FILES:${PN} = "${libdir}/lib*${SOLIBS}"
+FILES:${PN}-bash-completion += "${libexecdir}/dbus-bash-completion-helper"
+FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
+FILES:${PN}-dev += "${bindir}/dbus-binding-tool"
+
+RDEPENDS:${PN}-tests += "dbus-x11"
+FILES:${PN}-tests = "${datadir}/${BPN}/tests"
+
+BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/dbus/dbus-test_1.12.20.bb b/meta/recipes-core/dbus/dbus-test_1.12.20.bb
new file mode 100644
index 0000000000..ae70301431
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-test_1.12.20.bb
@@ -0,0 +1,64 @@
+SUMMARY = "D-Bus test package (for D-bus functionality testing only)"
+HOMEPAGE = "http://dbus.freedesktop.org"
+SECTION = "base"
+
+require dbus.inc
+
+SRC_URI += "file://run-ptest \
+ file://python-config.patch \
+ "
+
+DEPENDS = "dbus glib-2.0"
+
+RDEPENDS:${PN}-dev = ""
+
+S="${WORKDIR}/dbus-${PV}"
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
+
+inherit ptest
+
+EXTRA_OECONF += "--enable-tests \
+ --enable-modular-tests \
+ --enable-installed-tests \
+ --enable-checks \
+ --enable-asserts \
+ --with-dbus-test-dir=${PTEST_PATH} \
+ --enable-embedded-tests \
+ "
+
+do_install() {
+ :
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/test
+ l="shell printf refs syslog marshal syntax corrupt dbus-daemon dbus-daemon-eavesdrop loopback relay \
+ variant uid-permissions syntax spawn sd-activation names monitor message fdpass service shell-service"
+ for i in $l; do install ${B}/test/.libs/test-$i ${D}${PTEST_PATH}/test; done
+
+ l="bus bus-system bus-launch-helper"
+ for i in $l; do install ${B}/bus/.libs/test-$i ${D}${PTEST_PATH}/test; done
+
+ install -d ${D}${PTEST_PATH}/bus
+ install ${B}/bus/.libs/dbus-daemon-launch-helper-test ${D}${PTEST_PATH}/bus
+
+ install ${B}/test/test-segfault ${D}${PTEST_PATH}/test
+
+ cp -r ${B}/test/data ${D}${PTEST_PATH}/test
+ install ${B}/dbus/.libs/test-dbus ${D}${PTEST_PATH}/test
+
+ install -d ${D}${PTEST_PATH}/test/.libs
+ cp -a ${B}/dbus/.libs/*.so* ${D}${PTEST_PATH}/test/.libs
+
+ # Remove build host references...
+ find "${D}${PTEST_PATH}/test/data" \( -name *.service -o -name *.conf -o -name "*.aaprofile" \) -type f -exec \
+ sed -i \
+ -e 's:${B}:${PTEST_PATH}:g' \
+ {} +
+ sed -i -e 's;@PTEST_PATH@;${PTEST_PATH};g' ${D}${PTEST_PATH}/run-ptest
+}
+
+RDEPENDS:${PN}-ptest += "bash make dbus"
+RDEPENDS:${PN}-ptest:remove = "${PN}"
+
+PRIVATE_LIBS:${PN}-ptest = "libdbus-1.so.3"
diff --git a/meta/recipes-core/dbus/dbus-test_1.8.20.bb b/meta/recipes-core/dbus/dbus-test_1.8.20.bb
deleted file mode 100644
index 704070bf20..0000000000
--- a/meta/recipes-core/dbus/dbus-test_1.8.20.bb
+++ /dev/null
@@ -1,61 +0,0 @@
-SUMMARY = "D-Bus test package (for D-bus functionality testing only)"
-HOMEPAGE = "http://dbus.freedesktop.org"
-SECTION = "base"
-LICENSE = "AFL-2 | GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
- file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c"
-
-DEPENDS = "python-pygobject dbus dbus-glib"
-
-RDEPENDS_${PN} += "make"
-RDEPENDS_${PN}-dev = ""
-
-SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
- file://tmpdir.patch \
- file://dbus-1.init \
- file://run-ptest \
- file://python-config.patch \
- file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
- "
-
-SRC_URI[md5sum] = "b49890bbabedab3a1c3f4f73c7ff8b2b"
-SRC_URI[sha256sum] = "5c4fbf4c64621c96e871da91d2b729a5b00536e116d3c4612a469d924b1b703a"
-
-S="${WORKDIR}/dbus-${PV}"
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
-
-inherit autotools pkgconfig gettext ptest
-
-EXTRA_OECONF_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '--with-x', '--without-x', d)}"
-EXTRA_OECONF_X_class-native = "--without-x"
-
-EXTRA_OECONF = "--enable-tests \
- --enable-modular-tests \
- --enable-installed-tests \
- --enable-checks \
- --enable-asserts \
- --enable-verbose-mode \
- --disable-xml-docs \
- --disable-doxygen-docs \
- --disable-libaudit \
- --disable-systemd \
- --without-systemdsystemunitdir \
- --with-dbus-test-dir=${PTEST_PATH} \
- ${EXTRA_OECONF_X}"
-
-do_install() {
- :
-}
-
-do_install_ptest() {
- install -d ${D}${PTEST_PATH}/test
- case1="shell printf refs syslog"
- for i in ${case1}; do install ${B}/test/test-$i ${D}${PTEST_PATH}/test; done
- case2="marshal syntax corrupt dbus-daemon dbus-daemon-eavesdrop loopback relay"
- for i in ${case2}; do install ${B}/test/.libs/test-$i ${D}${PTEST_PATH}/test; done
- case3="bus bus-system bus-launch-helper"
- for i in ${case3}; do install ${B}/bus/test-$i ${D}${PTEST_PATH}/test; done
- install ${B}/dbus/test-dbus ${D}${PTEST_PATH}/test
- cp -r ${B}/test/data ${D}${PTEST_PATH}/test
-}
-RDEPENDS_${PN}-ptest += "bash"
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
index 3971081fd1..adc138bf10 100644
--- a/meta/recipes-core/dbus/dbus.inc
+++ b/meta/recipes-core/dbus/dbus.inc
@@ -1,170 +1,35 @@
-SUMMARY = "D-Bus message bus"
-DESCRIPTION = "D-Bus is a message bus system, a simple way for applications to talk to one another. In addition to interprocess communication, D-Bus helps coordinate process lifecycle; it makes it simple and reliable to code a \"single instance\" application or daemon, and to launch applications and daemons on demand when their services are needed."
-HOMEPAGE = "http://dbus.freedesktop.org"
-SECTION = "base"
-LICENSE = "AFL-2 | GPLv2+"
+inherit autotools pkgconfig gettext upstream-version-is-even
+
+LICENSE = "AFL-2.1 | GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c"
-DEPENDS = "expat virtual/libintl"
-RDEPENDS_dbus_class-native = ""
-RDEPENDS_dbus_class-nativesdk = ""
-PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${PN}-ptest', '', d)}"
-ALLOW_EMPTY_dbus-ptest = "1"
-RDEPENDS_dbus-ptest_class-target = "dbus-test-ptest"
-SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
+SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
file://tmpdir.patch \
file://dbus-1.init \
- file://os-test.patch \
file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
+ file://stop_using_selinux_set_mapping.patch \
"
-inherit useradd autotools pkgconfig gettext update-rc.d
-
-INITSCRIPT_NAME = "dbus-1"
-INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
-
-python __anonymous() {
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM_${PN} = "-r netdev"
-USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
- --no-create-home --shell /bin/false \
- --user-group messagebus"
-
-CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
-
-DEBIANNAME_${PN} = "dbus-1"
-
-PACKAGES =+ "${PN}-lib"
-
-OLDPKGNAME = "dbus-x11"
-OLDPKGNAME_class-nativesdk = ""
-
-# for compatibility
-RPROVIDES_${PN} = "${OLDPKGNAME}"
-RREPLACES_${PN} += "${OLDPKGNAME}"
+SRC_URI[md5sum] = "dfe8a71f412e0b53be26ed4fbfdc91c4"
+SRC_URI[sha256sum] = "f77620140ecb4cdc67f37fb444f8a6bea70b5b6461f12f1cbe2cec60fa7de5fe"
-FILES_${PN} = "${bindir}/dbus-daemon* \
- ${bindir}/dbus-uuidgen \
- ${bindir}/dbus-cleanup-sockets \
- ${bindir}/dbus-send \
- ${bindir}/dbus-monitor \
- ${bindir}/dbus-launch \
- ${bindir}/dbus-run-session \
- ${libexecdir}/dbus* \
- ${sysconfdir} \
- ${localstatedir} \
- ${datadir}/dbus-1/services \
- ${datadir}/dbus-1/system-services \
- ${systemd_unitdir}/system/"
-FILES_${PN}-lib = "${libdir}/lib*.so.*"
-RRECOMMENDS_${PN}-lib = "${PN}"
-FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
-
-pkg_postinst_dbus() {
- # If both systemd and sysvinit are enabled, mask the dbus-1 init script
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
- if [ -n "$D" ]; then
- OPTS="--root=$D"
- fi
- systemctl $OPTS mask dbus-1.service
- fi
-
- if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
- /etc/init.d/populate-volatile.sh update
- fi
-}
-
-EXTRA_OECONF = "--disable-tests \
- --disable-xml-docs \
+EXTRA_OECONF = "--disable-xml-docs \
--disable-doxygen-docs \
- --disable-libaudit \
- --disable-systemd \
- --without-dbus-glib"
-
-EXTRA_OECONF_append_class-native = " --disable-selinux"
-
-PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
-PACKAGECONFIG_class-native = ""
-PACKAGECONFIG_class-nativesdk = ""
-
-# Would like to --enable-systemd but that's a circular build-dependency between
-# systemd<->dbus
-PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir"
+ --enable-largefile \
+ --with-system-socket=/run/dbus/system_bus_socket \
+ "
+EXTRA_OECONF:append:class-target = " SYSTEMCTL=${base_bindir}/systemctl"
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \
+ user-session \
+ "
+PACKAGECONFIG:class-native = ""
+PACKAGECONFIG:class-nativesdk = ""
+
+PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd_system_unitdir},--disable-systemd --without-systemdsystemunitdir,systemd"
PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
-
-do_install() {
- autotools_do_install
-
- if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
- install -d ${D}${sysconfdir}/init.d
- sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
- install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
- fi
-
- if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
- for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
- install -d ${D}${systemd_unitdir}/system/$i; done
- install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_unitdir}/system/
- cd ${D}${systemd_unitdir}/system/dbus.target.wants/
- ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/dbus.target.wants/dbus.socket
- ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/sockets.target.wants/dbus.socket
- ln -fs ../dbus.service ${D}${systemd_unitdir}/system/multi-user.target.wants/dbus.service
- fi
-
- install -d ${D}${sysconfdir}/default/volatiles
- echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
- > ${D}${sysconfdir}/default/volatiles/99_dbus
-
-
- mkdir -p ${D}${localstatedir}/lib/dbus
-
- chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
-
- chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
- chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
-
- # Remove Red Hat initscript
- rm -rf ${D}${sysconfdir}/rc.d
-
- # Remove empty testexec directory as we don't build tests
- rm -rf ${D}${libdir}/dbus-1.0/test
-
- # Remove /var/run as it is created on startup
- rm -rf ${D}${localstatedir}/run
-}
-
-do_install_class-native() {
- autotools_do_install
-
- # for dbus-glib-native introspection generation
- install -d ${D}${STAGING_DATADIR_NATIVE}/dbus/
- # N.B. is below install actually required?
- install -m 0644 bus/session.conf ${D}${STAGING_DATADIR_NATIVE}/dbus/session.conf
-
- # dbus-glib-native and dbus-glib need this xml file
- ./bus/dbus-daemon --introspect > ${D}${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml
-
- # dbus-launch has no X support so lets not install it in case the host
- # has a more featured and useful version
- rm -f ${D}${bindir}/dbus-launch
-}
-
-do_install_class-nativesdk() {
- autotools_do_install
-
- # dbus-launch has no X support so lets not install it in case the host
- # has a more featured and useful version
- rm -f ${D}${bindir}/dbus-launch
-
- # Remove /var/run to avoid QA error
- rm -rf ${D}${localstatedir}/run
-}
-BBCLASSEXTEND = "native nativesdk"
-
-INSANE_SKIP_${PN}-ptest += "build-deps"
+PACKAGECONFIG[user-session] = "--enable-user-session --with-systemduserunitdir=${systemd_user_unitdir},--disable-user-session"
+PACKAGECONFIG[verbose-mode] = "--enable-verbose-mode,,,"
+PACKAGECONFIG[audit] = "--enable-libaudit,--disable-libaudit,audit"
+PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
diff --git a/meta/recipes-core/dbus/dbus/dbus-1.init b/meta/recipes-core/dbus/dbus/dbus-1.init
index 42c86297c3..90e167e572 100644
--- a/meta/recipes-core/dbus/dbus/dbus-1.init
+++ b/meta/recipes-core/dbus/dbus/dbus-1.init
@@ -21,8 +21,8 @@
DAEMON=@bindir@/dbus-daemon
NAME=dbus
-DAEMONUSER=messagebus # must match /etc/dbus-1/system.conf
-PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf
+DAEMONUSER=messagebus # must match /usr/share/dbus-1/system.conf
+PIDFILE=/var/run/dbus/pid # must match /usr/share/dbus-1/system.conf
UUIDDIR=/var/lib/dbus
DESC="system message bus"
EVENTDIR=/etc/dbus-1/event.d
diff --git a/meta/recipes-core/dbus/dbus/os-test.patch b/meta/recipes-core/dbus/dbus/os-test.patch
deleted file mode 100644
index 79554b1ee1..0000000000
--- a/meta/recipes-core/dbus/dbus/os-test.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-dbus: remove build host test in configure script
-
-The dbus build tests the build host to detect what initscript
-environment it expects. Remove the test and set it to "redhat"
-unconditionally as the oe-core initscript has a redhat-style pid file
-path.
-
-Signed-off-by: Andy Ross <andy.ross@windriver.com>
-Upstream-Status: innappropriate [embedded]
-
-diff -u a/configure.ac b/configure.ac
---- a/configure.ac 2012-08-28 11:23:43.040609874 -0700
-+++ b/configure.ac 2012-08-28 11:54:25.602913945 -0700
-@@ -1348,19 +1348,8 @@
- AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
- AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
-
--#### Check our operating system
--operating_system=unknown
--if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
-- operating_system=redhat
--fi
--
--if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
-- operating_system=slackware
--fi
--
--if test -f /usr/bin/cygwin1.dll || test -f $EXPANDED_BINDIR/cygwin1.dll ; then
-- operating_system=cygwin
--fi
-+#### Build host test removed from upstream code, openembedded initscript is redhat-like:
-+operating_system=redhat
-
- #### Sort out init scripts
-
diff --git a/meta/recipes-core/dbus/dbus/python-config.patch b/meta/recipes-core/dbus/dbus/python-config.patch
index 294400247e..da2f10c726 100644
--- a/meta/recipes-core/dbus/dbus/python-config.patch
+++ b/meta/recipes-core/dbus/dbus/python-config.patch
@@ -7,19 +7,28 @@ Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
---- dbus-1.6.8/configure.ac.orig 2013-07-11 14:15:58.834554799 -0500
-+++ dbus-1.6.8/configure.ac 2013-07-11 14:14:40.969554848 -0500
-@@ -257,13 +257,6 @@
+---
+ configure.ac | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 80d27b4..becc1cc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -279,13 +279,6 @@ if test "x$enable_tests" = xyes; then
# full test coverage is required, Python is a hard dependency
- AC_MSG_NOTICE([Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygobject])
+ AC_MSG_NOTICE([Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygi])
AM_PATH_PYTHON([2.6])
- AC_MSG_CHECKING([for Python modules for full test coverage])
-- if "$PYTHON" -c "import dbus, gobject, dbus.mainloop.glib"; then
+- if "$PYTHON" -c "import dbus, gi.repository.GObject, dbus.mainloop.glib"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
-- AC_MSG_ERROR([cannot import dbus, gobject, dbus.mainloop.glib Python modules])
+- AC_MSG_ERROR([cannot import dbus, gi.repository.GObject, dbus.mainloop.glib Python modules])
- fi
else
# --enable-tests not given: do not abort if Python is missing
AM_PATH_PYTHON([2.6], [], [:])
+--
+1.9.1
+
diff --git a/meta/recipes-core/dbus/dbus/run-ptest b/meta/recipes-core/dbus/dbus/run-ptest
index c72d083a91..d3eec08235 100755
--- a/meta/recipes-core/dbus/dbus/run-ptest
+++ b/meta/recipes-core/dbus/dbus/run-ptest
@@ -1,10 +1,35 @@
#!/bin/sh
output() {
- if [ $? -eq 0 ]
+ retcode=$?
+ if [ $retcode -eq 0 ]
then echo "PASS: $i"
- else echo "FAIL: $i"
+ elif [ $retcode -eq 77 ]
+ then echo "SKIP: $i"
+ else echo "FAIL: $i"
fi
}
-for i in `ls test/test-*`; do ./$i ./test/data DBUS_TEST_HOMEDIR=./test >/dev/null; output; done
+export DBUS_TEST_HOMEDIR=./test
+export XDG_RUNTIME_DIR=./test
+export LD_LIBRARY_PATH=@PTEST_PATH@/test/.libs
+
+files=`ls test/test-*`
+
+for i in $files
+do
+ #these programs are used by testcase test-bus, don't run here
+ #additionally, test-names needs to be run under X
+ if [ $i = "test/test-service" ] \
+ || [ $i = "test/test-shell-service" ] \
+ || [ $i = "test/test-segfault" ] \
+ || [ $i = "test/test-bus" ] \
+ || [ $i = "test/test-names" ]
+ then
+ continue
+ fi
+
+ ./$i ./test/data >/dev/null 2>&1
+ output
+done
+
diff --git a/meta/recipes-core/dbus/dbus/stop_using_selinux_set_mapping.patch b/meta/recipes-core/dbus/dbus/stop_using_selinux_set_mapping.patch
new file mode 100644
index 0000000000..7035098e41
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/stop_using_selinux_set_mapping.patch
@@ -0,0 +1,148 @@
+From 6072f8b24153d844a3033108a17bcd0c1a967816 Mon Sep 17 00:00:00 2001
+From: Laurent Bigonville <bigon@bigon.be>
+Date: Sat, 3 Mar 2018 11:15:23 +0100
+Subject: [PATCH] Stop using selinux_set_mapping() function
+
+Currently, if the "dbus" security class or the associated AV doesn't
+exist, dbus-daemon fails to initialize and exits immediately. Also the
+security classes or access vector cannot be reordered in the policy.
+This can be a problem for people developing their own policy or trying
+to access a machine where, for some reasons, there is not policy defined
+at all.
+
+The code here copy the behaviour of the selinux_check_access() function.
+We cannot use this function here as it doesn't allow us to define the
+AVC entry reference.
+
+See the discussion at https://marc.info/?l=selinux&m=152163374332372&w=2
+
+Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/198
+---
+ bus/selinux.c | 75 ++++++++++++++++++++++++++++-----------------------
+ 1 file changed, 42 insertions(+), 33 deletions(-)
+
+
+Upstream-Status: Backport
+Signed-off-by: Nisha.Parrakat <Nisha.Parrakat@kpit.com>
+diff --git a/bus/selinux.c b/bus/selinux.c
+
+--- a/bus/selinux.c 2021-08-11 14:45:59.048513026 +0000
++++ b/bus/selinux.c 2021-08-11 14:57:47.144846966 +0000
+@@ -311,24 +311,6 @@
+ #endif
+ }
+
+-/*
+- * Private Flask definitions; the order of these constants must
+- * exactly match that of the structure array below!
+- */
+-/* security dbus class constants */
+-#define SECCLASS_DBUS 1
+-
+-/* dbus's per access vector constants */
+-#define DBUS__ACQUIRE_SVC 1
+-#define DBUS__SEND_MSG 2
+-
+-#ifdef HAVE_SELINUX
+-static struct security_class_mapping dbus_map[] = {
+- { "dbus", { "acquire_svc", "send_msg", NULL } },
+- { NULL }
+-};
+-#endif /* HAVE_SELINUX */
+-
+ /**
+ * Establish dynamic object class and permission mapping and
+ * initialize the user space access vector cache (AVC) for D-Bus and set up
+@@ -350,13 +332,6 @@
+
+ _dbus_verbose ("SELinux is enabled in this kernel.\n");
+
+- if (selinux_set_mapping (dbus_map) < 0)
+- {
+- _dbus_warn ("Failed to set up security class mapping (selinux_set_mapping():%s).",
+- strerror (errno));
+- return FALSE;
+- }
+-
+ avc_entry_ref_init (&aeref);
+ if (avc_init ("avc", &mem_cb, &log_cb, &thread_cb, &lock_cb) < 0)
+ {
+@@ -421,19 +396,53 @@
+ static dbus_bool_t
+ bus_selinux_check (BusSELinuxID *sender_sid,
+ BusSELinuxID *override_sid,
+- security_class_t target_class,
+- access_vector_t requested,
++ const char *target_class,
++ const char *requested,
+ DBusString *auxdata)
+ {
++ int saved_errno;
++ security_class_t security_class;
++ access_vector_t requested_access;
++
+ if (!selinux_enabled)
+ return TRUE;
+
++ security_class = string_to_security_class (target_class);
++ if (security_class == 0)
++ {
++ saved_errno = errno;
++ log_callback (SELINUX_ERROR, "Unknown class %s", target_class);
++ if (security_deny_unknown () == 0)
++ {
++ return TRUE;
++ }
++
++ _dbus_verbose ("Unknown class %s\n", target_class);
++ errno = saved_errno;
++ return FALSE;
++ }
++
++ requested_access = string_to_av_perm (security_class, requested);
++ if (requested_access == 0)
++ {
++ saved_errno = errno;
++ log_callback (SELINUX_ERROR, "Unknown permission %s for class %s", requested, target_class);
++ if (security_deny_unknown () == 0)
++ {
++ return TRUE;
++ }
++
++ _dbus_verbose ("Unknown permission %s for class %s\n", requested, target_class);
++ errno = saved_errno;
++ return FALSE;
++ }
++
+ /* Make the security check. AVC checks enforcing mode here as well. */
+ if (avc_has_perm (SELINUX_SID_FROM_BUS (sender_sid),
+ override_sid ?
+ SELINUX_SID_FROM_BUS (override_sid) :
+ bus_sid,
+- target_class, requested, &aeref, auxdata) < 0)
++ security_class, requested_access, &aeref, auxdata) < 0)
+ {
+ switch (errno)
+ {
+@@ -500,8 +509,8 @@
+
+ ret = bus_selinux_check (connection_sid,
+ service_sid,
+- SECCLASS_DBUS,
+- DBUS__ACQUIRE_SVC,
++ "dbus",
++ "acquire_svc",
+ &auxdata);
+
+ _dbus_string_free (&auxdata);
+@@ -629,8 +638,8 @@
+
+ ret = bus_selinux_check (sender_sid,
+ recipient_sid,
+- SECCLASS_DBUS,
+- DBUS__SEND_MSG,
++ "dbus",
++ "send_msg",
+ &auxdata);
+
+ _dbus_string_free (&auxdata);
diff --git a/meta/recipes-core/dbus/dbus_1.12.20.bb b/meta/recipes-core/dbus/dbus_1.12.20.bb
new file mode 100644
index 0000000000..48947209d9
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus_1.12.20.bb
@@ -0,0 +1,153 @@
+SUMMARY = "D-Bus message bus"
+DESCRIPTION = "D-Bus is a message bus system, a simple way for applications to talk to one another. In addition to interprocess communication, D-Bus helps coordinate process lifecycle; it makes it simple and reliable to code a \"single instance\" application or daemon, and to launch applications and daemons on demand when their services are needed."
+HOMEPAGE = "https://dbus.freedesktop.org"
+SECTION = "base"
+
+require dbus.inc
+
+DEPENDS = "expat virtual/libintl autoconf-archive"
+PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${PN}-ptest', '', d)}"
+ALLOW_EMPTY:dbus-ptest = "1"
+RDEPENDS:dbus-ptest:class-target = "dbus-test-ptest"
+RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
+RDEPENDS:${PN}:class-native = ""
+
+inherit useradd update-rc.d
+
+INITSCRIPT_NAME = "dbus-1"
+INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
+
+python __anonymous() {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
+PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools"
+
+USERADD_PACKAGES = "dbus-common"
+USERADD_PARAM:dbus-common = "--system --home ${localstatedir}/lib/dbus \
+ --no-create-home --shell /bin/false \
+ --user-group messagebus"
+
+CONFFILES:${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
+
+DEBIANNAME:${PN} = "dbus-1"
+
+OLDPKGNAME = "dbus-x11"
+OLDPKGNAME:class-nativesdk = ""
+
+# for compatibility
+RPROVIDES:${PN} = "${OLDPKGNAME}"
+RREPLACES:${PN} += "${OLDPKGNAME}"
+
+FILES:${PN} = "${bindir}/dbus-daemon* \
+ ${bindir}/dbus-cleanup-sockets \
+ ${bindir}/dbus-launch \
+ ${bindir}/dbus-run-session \
+ ${libexecdir}/dbus* \
+ ${sysconfdir} \
+ ${localstatedir} \
+ ${systemd_system_unitdir} \
+ ${systemd_user_unitdir} \
+ ${nonarch_libdir}/tmpfiles.d/dbus.conf \
+"
+FILES:${PN}-common = "${sysconfdir}/dbus-1 \
+ ${datadir}/dbus-1/services \
+ ${datadir}/dbus-1/system-services \
+ ${datadir}/dbus-1/session.d \
+ ${datadir}/dbus-1/session.conf \
+ ${datadir}/dbus-1/system.d \
+ ${datadir}/dbus-1/system.conf \
+ ${systemd_system_unitdir}/dbus.socket \
+ ${systemd_system_unitdir}/sockets.target.wants \
+ ${systemd_user_unitdir}/dbus.socket \
+ ${systemd_user_unitdir}/sockets.target.wants \
+ ${nonarch_libdir}/sysusers.d/dbus.conf \
+"
+FILES:${PN}-tools = "${bindir}/dbus-uuidgen \
+ ${bindir}/dbus-send \
+ ${bindir}/dbus-monitor \
+ ${bindir}/dbus-update-activation-environment \
+"
+FILES:${PN}-lib = "${libdir}/lib*.so.*"
+RRECOMMENDS:${PN}-lib = "${PN}"
+FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadir}/xml/dbus-1"
+
+PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
+pkg_postinst:dbus() {
+ # If both systemd and sysvinit are enabled, mask the dbus-1 init script
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
+ if [ -n "$D" ]; then
+ OPTS="--root=$D"
+ fi
+ systemctl $OPTS mask dbus-1.service
+ fi
+
+ if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
+ /etc/init.d/populate-volatile.sh update
+ fi
+}
+
+
+EXTRA_OECONF += "--disable-tests"
+
+do_install() {
+ autotools_do_install
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/init.d
+ sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
+ install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
+ install -d ${D}${sysconfdir}/default/volatiles
+ echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
+ > ${D}${sysconfdir}/default/volatiles/99_dbus
+ fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
+ install -d ${D}${systemd_system_unitdir}/$i; done
+ install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
+ ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
+ ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
+ ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
+ fi
+
+
+ mkdir -p ${D}${localstatedir}/lib/dbus
+
+ chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
+
+ chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
+ chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
+
+ # Remove Red Hat initscript
+ rm -rf ${D}${sysconfdir}/rc.d
+
+ # Remove empty testexec directory as we don't build tests
+ rm -rf ${D}${libdir}/dbus-1.0/test
+
+ # Remove /var/run as it is created on startup
+ rm -rf ${D}${localstatedir}/run
+}
+
+do_install:class-native() {
+ autotools_do_install
+
+ # dbus-launch has no X support so lets not install it in case the host
+ # has a more featured and useful version
+ rm -f ${D}${bindir}/dbus-launch
+}
+
+do_install:class-nativesdk() {
+ autotools_do_install
+
+ # dbus-launch has no X support so lets not install it in case the host
+ # has a more featured and useful version
+ rm -f ${D}${bindir}/dbus-launch
+
+ # Remove /var/run to avoid QA error
+ rm -rf ${D}${localstatedir}/run
+}
+BBCLASSEXTEND = "native nativesdk"
+
+INSANE_SKIP:${PN}-ptest += "build-deps"
diff --git a/meta/recipes-core/dbus/dbus_1.8.20.bb b/meta/recipes-core/dbus/dbus_1.8.20.bb
deleted file mode 100644
index a8f2094ea6..0000000000
--- a/meta/recipes-core/dbus/dbus_1.8.20.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-include dbus.inc
-
-SRC_URI[md5sum] = "b49890bbabedab3a1c3f4f73c7ff8b2b"
-SRC_URI[sha256sum] = "5c4fbf4c64621c96e871da91d2b729a5b00536e116d3c4612a469d924b1b703a"
diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
index a2c736e174..78f9f9adbd 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -1,27 +1,28 @@
SUMMARY = "A lightweight SSH and SCP implementation"
HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
+DESCRIPTION = "Dropbear is a relatively small SSH server and client. It runs on a variety of POSIX-based platforms. Dropbear is open source software, distributed under a MIT-style license. Dropbear is particularly useful for "embedded"-type Linux (or other Unix) systems, such as wireless routers."
SECTION = "console/network"
# some files are from other projects and have others license terms:
# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=a5ec40cafba26fc4396d0b550f824e01"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=25cf44512b7bc8966a48b6b1a9b7605f"
-DEPENDS = "zlib"
-RPROVIDES_${PN} = "ssh sshd"
+DEPENDS = "zlib virtual/crypt"
+RPROVIDES:${PN} = "ssh sshd"
+RCONFLICTS:${PN} = "openssh-sshd openssh"
DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
file://0001-urandom-xauth-changes-to-options.h.patch \
- file://0003-configure.patch \
- file://0004-fix-2kb-keys.patch \
- file://0007-dropbear-fix-for-x32-abi.patch \
file://init \
file://dropbearkey.service \
file://dropbear@.service \
file://dropbear.socket \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} "
+ file://dropbear.default \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'disable-weak-ciphers', 'file://dropbear-disable-weak-ciphers.patch', '', d)} "
PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
file://0006-dropbear-configuration-file.patch \
@@ -32,24 +33,34 @@ PAM_PLUGINS = "libpam-runtime \
pam-plugin-permit \
pam-plugin-unix \
"
-RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
+RDEPENDS:${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
inherit autotools update-rc.d systemd
+CVE_PRODUCT = "dropbear_ssh"
+
INITSCRIPT_NAME = "dropbear"
INITSCRIPT_PARAMS = "defaults 10"
-SYSTEMD_SERVICE_${PN} = "dropbear.socket"
-
-CFLAGS_prepend = " -I. "
-LD = "${CC}"
+SYSTEMD_SERVICE:${PN} = "dropbear.socket"
SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
BINCOMMANDS = "dbclient ssh scp"
EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
+
+PACKAGECONFIG ?= "disable-weak-ciphers"
+PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
+PACKAGECONFIG[disable-weak-ciphers] = ""
+
EXTRA_OECONF += "\
${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
-CFLAGS += "-DSFTPSERVER_PATH=\\"${libdir}/openssh/sftp-server\\""
+
+# This option appends to CFLAGS and LDFLAGS from OE
+# This is causing [textrel] QA warning
+EXTRA_OECONF += "--disable-harden"
+
+# musl does not implement wtmp/logwtmp APIs
+EXTRA_OECONF:append:libc-musl = " --disable-wtmp --disable-lastlog"
do_install() {
install -d ${D}${sysconfdir} \
@@ -60,9 +71,16 @@ do_install() {
${D}${sbindir} \
${D}${localstatedir}
+ install -m 0644 ${WORKDIR}/dropbear.default ${D}${sysconfdir}/default/dropbear
+
install -m 0755 dropbearmulti ${D}${sbindir}/
- ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
-
+
+ for i in ${BINCOMMANDS}
+ do
+ # ssh and scp symlinks are created by update-alternatives
+ if [ $i = ssh ] || [ $i = scp ]; then continue; fi
+ ln -s ${sbindir}/dropbearmulti ${D}${bindir}/$i
+ done
for i in ${SBINCOMMANDS}
do
ln -s ./dropbearmulti ${D}${sbindir}/$i
@@ -73,30 +91,30 @@ do_install() {
-e 's,/usr/bin,${bindir},g' \
-e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
chmod 755 ${D}${sysconfdir}/init.d/dropbear
- if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
+ if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
install -d ${D}${sysconfdir}/pam.d
install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
fi
# deal with systemd unit files
- install -d ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_system_unitdir}
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
-e 's,@BINDIR@,${bindir},g' \
-e 's,@SBINDIR@,${sbindir},g' \
- ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
+ ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "20"
-ALTERNATIVE_${PN} = "scp ssh"
+ALTERNATIVE:${PN} = "${@bb.utils.filter('BINCOMMANDS', 'scp ssh', d)}"
ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
-pkg_postrm_append_${PN} () {
+pkg_postrm:${PN} () {
if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
fi
@@ -104,3 +122,5 @@ pkg_postrm_append_${PN} () {
rm ${sysconfdir}/dropbear/dropbear_dss_host_key
fi
}
+
+FILES:${PN} += "${bindir}"
diff --git a/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
index dc9d5782e8..684641dcbd 100644
--- a/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
+++ b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
@@ -2,20 +2,20 @@ Subject: [PATCH 1/6] urandom-xauth-changes-to-options.h
Upstream-Status: Inappropriate [configuration]
---
- options.h | 2 +-
+ default_options.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/options.h b/options.h
-index 7d06322..71a21c2 100644
---- a/options.h
-+++ b/options.h
-@@ -247,7 +247,7 @@ much traffic. */
+diff --git a/default_options.h b/default_options.h
+index 3b75eb8..1fd8082 100644
+--- a/default_options.h
++++ b/default_options.h
+@@ -243,7 +243,7 @@ Homedir is prepended unless path begins with / */
+
/* The command to invoke for xauth when using X11 forwarding.
* "-q" for quiet */
- #ifndef XAUTH_COMMAND
-#define XAUTH_COMMAND "/usr/bin/xauth -q"
+#define XAUTH_COMMAND "xauth -q"
- #endif
+
/* if you want to enable running an sftp server (such as the one included with
--
diff --git a/meta/recipes-core/dropbear/dropbear/0003-configure.patch b/meta/recipes-core/dropbear/dropbear/0003-configure.patch
deleted file mode 100644
index c53ab01ddd..0000000000
--- a/meta/recipes-core/dropbear/dropbear/0003-configure.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From c5f5c5054c1b15539dccf866e2c3faba7ed68456 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
-Date: Thu, 25 Apr 2013 00:27:25 +0200
-Subject: [PATCH 3/6] configure: add a variable to allow openpty check to be cached
-
-Upstream-Status: Pending
-
----
- configure.ac | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 05461f3..9c16d90 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -166,15 +166,20 @@ AC_ARG_ENABLE(openpty,
- AC_MSG_NOTICE(Not using openpty)
- else
- AC_MSG_NOTICE(Using openpty if available)
-- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
-+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
- fi
- ],
- [
- AC_MSG_NOTICE(Using openpty if available)
-- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
-+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
- ]
- )
--
-+
-+if test "x$dropbear_cv_func_have_openpty" = "xyes"; then
-+ AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)
-+ no_ptc_check=yes
-+ no_ptmx_check=yes
-+fi
-
- AC_ARG_ENABLE(syslog,
- [ --disable-syslog Don't include syslog support],
---
-1.7.11.7
-
diff --git a/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch b/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
deleted file mode 100644
index 7539d2034f..0000000000
--- a/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-Subject: [PATCH 4/6] fix 2kb keys
-
-Upstream-Status: Inappropriate [configuration]
----
- kex.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/kex.h b/kex.h
-index 72430e9..375c677 100644
---- a/kex.h
-+++ b/kex.h
-@@ -67,6 +67,6 @@ struct KEXState {
- };
-
-
--#define MAX_KEXHASHBUF 2000
-+#define MAX_KEXHASHBUF 3000
-
- #endif /* _KEX_H_ */
---
-1.7.11.7
-
diff --git a/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
index c408c571e6..857681520c 100644
--- a/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
+++ b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
@@ -1,28 +1,42 @@
-Subject: [PATCH 5/6] dropbear enable pam
+From b8cece92ba19aa77ac013ea161bfe4c7147747c9 Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Wed, 2 Dec 2015 11:36:02 +0200
+Subject: Enable pam
-dropbear: We need modify file option.h besides enabling pam in \
+We need modify file default_options.h besides enabling pam in
configure if we want dropbear to support pam.
Upstream-Status: Pending
Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
- options.h | 4 ++--
+ default_options.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
-Index: dropbear-2013.62/options.h
-===================================================================
---- dropbear-2013.62.orig/options.h 2014-01-14 21:53:02.803262009 +0000
-+++ dropbear-2013.62/options.h 2014-01-14 21:53:56.119263462 +0000
-@@ -192,9 +192,9 @@
+diff --git a/default_options.h b/default_options.h
+index 3b75eb8..8617cd0 100644
+--- a/default_options.h
++++ b/default_options.h
+@@ -179,7 +179,7 @@ group1 in Dropbear server too */
+
+ /* Authentication Types - at least one required.
+ RFC Draft requires pubkey auth, and recommends password */
+-#define DROPBEAR_SVR_PASSWORD_AUTH 1
++#define DROPBEAR_SVR_PASSWORD_AUTH 0
+
+ /* Note: PAM auth is quite simple and only works for PAM modules which just do
+ * a simple "Login: " "Password: " (you can edit the strings in svr-authpam.c).
+@@ -187,7 +187,7 @@ group1 in Dropbear server too */
+ * but there's an interface via a PAM module. It won't work for more complex
* PAM challenge/response.
* You can't enable both PASSWORD and PAM. */
+-#define DROPBEAR_SVR_PAM_AUTH 0
++#define DROPBEAR_SVR_PAM_AUTH 1
--#define ENABLE_SVR_PASSWORD_AUTH
-+/*#define ENABLE_SVR_PASSWORD_AUTH*/
- /* PAM requires ./configure --enable-pam */
--/*#define ENABLE_SVR_PAM_AUTH */
-+#define ENABLE_SVR_PAM_AUTH
- #define ENABLE_SVR_PUBKEY_AUTH
+ /* ~/.ssh/authorized_keys authentication */
+ #define DROPBEAR_SVR_PUBKEY_AUTH 1
- /* Whether to take public key options in
+--
+2.1.4
+
diff --git a/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
index fa4c8d0a67..deed78ffb9 100644
--- a/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
+++ b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
@@ -1,4 +1,7 @@
-Subject: [PATCH 6/6] dropbear configuration file
+From e3a5db1b6d3f6382a15b2266458c26c645a10f18 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <Mingli.Yu@windriver.com>
+Date: Thu, 6 Sep 2018 15:54:00 +0800
+Subject: [PATCH] dropbear configuration file
dropbear: Change the path ("/etc/pam.d/sshd" as default) to find a pam configuration file \
to "/etc/pam.d/dropbear for dropbear when enabling pam supporting"
@@ -7,12 +10,17 @@ Upstream-Status: Inappropriate [configuration]
Signed-off-by: Maxin B. John <maxin.john@enea.com>
Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
-diff -Naur dropbear-2013.60-orig/svr-authpam.c dropbear-2013.60/svr-authpam.c
---- dropbear-2013.60-orig/svr-authpam.c 2013-10-16 16:34:53.000000000 +0200
-+++ dropbear-2013.60/svr-authpam.c 2013-10-21 17:04:04.969416055 +0200
-@@ -211,7 +211,7 @@
- userData.passwd = password;
+ svr-authpam.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/svr-authpam.c b/svr-authpam.c
+index d201bc9..165ec5c 100644
+--- a/svr-authpam.c
++++ b/svr-authpam.c
+@@ -223,7 +223,7 @@ void svr_auth_pam(int valid_user) {
+ }
/* Init pam */
- if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
@@ -20,3 +28,6 @@ diff -Naur dropbear-2013.60-orig/svr-authpam.c dropbear-2013.60/svr-authpam.c
dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s",
rc, pam_strerror(pamHandlep, rc));
goto cleanup;
+--
+2.7.4
+
diff --git a/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch b/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch
deleted file mode 100644
index b4501211c3..0000000000
--- a/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch
+++ /dev/null
@@ -1,140 +0,0 @@
-Upstream-Status: Pending
-
-The dropbearkey utility built in x32 abi format, when generating ssh
-keys, was getting lost in the infinite loop.
-
-This patch fixes the issue by fixing types of variables and
-parameters of functions used in the code, which were getting
-undesired size, when compiled with the x32 abi toolchain.
-
-2013/05/23
-Received this fix from H J Lu.
-
-Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
-
-# HG changeset patch
-# User H.J. Lu <hjl.tools@gmail.com>
-# Date 1369344079 25200
-# Node ID a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
-# Parent e76614145aea67f66e4a4257685c771efba21aa1
-Typdef mp_digit to unsigned long long for MP_64BIT
-
-When GCC is used with MP_64BIT, we should typedef mp_digit to unsigned
-long long instead of unsigned long since for x32, unsigned long is
-32-bit and unsigned long long is 64-bit and it is safe to use unsigned
-long long for 64-bit integer with GCC.
-
-diff -r e76614145aea -r a10a1c46b857 libtommath/tommath.h
---- a/libtommath/tommath.h Thu Apr 18 22:57:47 2013 +0800
-+++ b/libtommath/tommath.h Thu May 23 14:21:19 2013 -0700
-@@ -73,7 +73,7 @@
- typedef signed long long long64;
- #endif
-
-- typedef unsigned long mp_digit;
-+ typedef unsigned long long mp_digit;
- typedef unsigned long mp_word __attribute__ ((mode(TI)));
-
- #define DIGIT_BIT 60
-# HG changeset patch
-# User H.J. Lu <hjl.tools@gmail.com>
-# Date 1369344241 25200
-# Node ID c7555a4cb7ded3a88409ba85f4027baa7af5f536
-# Parent a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
-Cast to mp_digit when updating *rho
-
-There is
-
-int
-mp_montgomery_setup (mp_int * n, mp_digit * rho)
-
-We should cast to mp_digit instead of unsigned long when updating
-*rho since mp_digit may be unsigned long long and unsigned long long
-may be different from unsigned long, like in x32.
-
-diff -r a10a1c46b857 -r c7555a4cb7de libtommath/bn_mp_montgomery_setup.c
---- a/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:21:19 2013 -0700
-+++ b/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:24:01 2013 -0700
-@@ -48,7 +48,7 @@
- #endif
-
- /* rho = -1/m mod b */
-- *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
-+ *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
-
- return MP_OKAY;
- }
-# HG changeset patch
-# User H.J. Lu <hjl.tools@gmail.com>
-# Date 1369344541 25200
-# Node ID 7c656e7071a6412688b2f30a529a9afac6c7bf5a
-# Parent c7555a4cb7ded3a88409ba85f4027baa7af5f536
-Define LTC_FAST_TYPE to unsigned long long for __x86_64__
-
-We should define LTC_FAST_TYPE to unsigned long long instead of unsigned
-long if __x86_64__ to support x32 where unsigned long long is 64-bit
-and unsigned long is 32-bit.
-
-diff -r c7555a4cb7de -r 7c656e7071a6 libtomcrypt/src/headers/tomcrypt_cfg.h
---- a/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:24:01 2013 -0700
-+++ b/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:29:01 2013 -0700
-@@ -74,7 +74,7 @@
- #define ENDIAN_LITTLE
- #define ENDIAN_64BITWORD
- #define LTC_FAST
-- #define LTC_FAST_TYPE unsigned long
-+ #define LTC_FAST_TYPE unsigned long long
- #endif
-
- /* detect PPC32 */
-# HG changeset patch
-# User H.J. Lu <hjl.tools@gmail.com>
-# Date 1369344730 25200
-# Node ID a7d4690158fae4ede2c4e5b56233e83730bf38ee
-# Parent 7c656e7071a6412688b2f30a529a9afac6c7bf5a
-Use unsigned long long aas unsigned 64-bit integer for x86-64 GCC
-
-We should use unsigned long long instead of unsigned long as unsigned
-64-bit integer for x86-64 GCC to support x32 where unsigned long is
-32-bit.
-
-diff -r 7c656e7071a6 -r a7d4690158fa libtomcrypt/src/headers/tomcrypt_macros.h
---- a/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:29:01 2013 -0700
-+++ b/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:32:10 2013 -0700
-@@ -343,7 +343,7 @@
- /* 64-bit Rotates */
- #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(LTC_NO_ASM)
-
--static inline unsigned long ROL64(unsigned long word, int i)
-+static inline unsigned long long ROL64(unsigned long long word, int i)
- {
- asm("rolq %%cl,%0"
- :"=r" (word)
-@@ -351,7 +351,7 @@
- return word;
- }
-
--static inline unsigned long ROR64(unsigned long word, int i)
-+static inline unsigned long long ROR64(unsigned long long word, int i)
- {
- asm("rorq %%cl,%0"
- :"=r" (word)
-@@ -361,7 +361,7 @@
-
- #ifndef LTC_NO_ROLC
-
--static inline unsigned long ROL64c(unsigned long word, const int i)
-+static inline unsigned long long ROL64c(unsigned long long word, const int i)
- {
- asm("rolq %2,%0"
- :"=r" (word)
-@@ -369,7 +369,7 @@
- return word;
- }
-
--static inline unsigned long ROR64c(unsigned long word, const int i)
-+static inline unsigned long long ROR64c(unsigned long long word, const int i)
- {
- asm("rorq %2,%0"
- :"=r" (word)
-
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch b/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch
new file mode 100644
index 0000000000..b54581f17a
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear-disable-weak-ciphers.patch
@@ -0,0 +1,35 @@
+From c347ece05a7fdbf50d76cb136b9ed45caed333f6 Mon Sep 17 00:00:00 2001
+From: Joseph Reynolds <joseph.reynolds1@ibm.com>
+Date: Thu, 20 Jun 2019 16:29:15 -0500
+Subject: [PATCH] dropbear: new feature: disable-weak-ciphers
+
+This feature disables all CBC, SHA1, and diffie-hellman group1 ciphers
+in the dropbear ssh server and client since they're considered weak ciphers
+and we want to support the stong algorithms.
+
+Upstream-Status: Inappropriate [configuration]
+Signed-off-by: Joseph Reynolds <joseph.reynolds1@ibm.com>
+
+---
+ default_options.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/default_options.h b/default_options.h
+index 1aa2297..7ff1394 100644
+--- a/default_options.h
++++ b/default_options.h
+@@ -163,12 +163,12 @@ IMPORTANT: Some options will require "make clean" after changes */
+ * Small systems should generally include either curve25519 or ecdh for performance.
+ * curve25519 is less widely supported but is faster
+ */
+-#define DROPBEAR_DH_GROUP14_SHA1 1
++#define DROPBEAR_DH_GROUP14_SHA1 0
+ #define DROPBEAR_DH_GROUP14_SHA256 1
+ #define DROPBEAR_DH_GROUP16 0
+ #define DROPBEAR_CURVE25519 1
+ #define DROPBEAR_ECDH 1
+-#define DROPBEAR_DH_GROUP1 1
++#define DROPBEAR_DH_GROUP1 0
+
+ /* When group1 is enabled it will only be allowed by Dropbear client
+ not as a server, due to concerns over its strength. Set to 0 to allow
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear.default b/meta/recipes-core/dropbear/dropbear/dropbear.default
new file mode 100644
index 0000000000..522453a86c
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear.default
@@ -0,0 +1,2 @@
+# Disallow root logins by default
+DROPBEAR_EXTRA_ARGS="-w"
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear@.service b/meta/recipes-core/dropbear/dropbear/dropbear@.service
index 6fe9942090..b420bcddcb 100644
--- a/meta/recipes-core/dropbear/dropbear/dropbear@.service
+++ b/meta/recipes-core/dropbear/dropbear/dropbear@.service
@@ -4,8 +4,9 @@ Wants=dropbearkey.service
After=syslog.target dropbearkey.service
[Service]
+Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
EnvironmentFile=-/etc/default/dropbear
-ExecStart=-@SBINDIR@/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
+ExecStart=-@SBINDIR@/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
StandardInput=socket
KillMode=process
diff --git a/meta/recipes-core/dropbear/dropbear/dropbearkey.service b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
index ccc21d5cca..71a12a6110 100644
--- a/meta/recipes-core/dropbear/dropbear/dropbearkey.service
+++ b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
@@ -1,8 +1,14 @@
[Unit]
Description=SSH Key Generation
-ConditionPathExists=|!/etc/dropbear/dropbear_rsa_host_key
+RequiresMountsFor=/var /var/lib
+ConditionPathExists=!/etc/dropbear/dropbear_rsa_host_key
+ConditionPathExists=!/var/lib/dropbear/dropbear_rsa_host_key
[Service]
+Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
+EnvironmentFile=-/etc/default/dropbear
Type=oneshot
-ExecStart=@SBINDIR@/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ExecStart=@BASE_BINDIR@/mkdir -p ${DROPBEAR_RSAKEY_DIR}
+ExecStart=@SBINDIR@/dropbearkey -t rsa -f ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key
RemainAfterExit=yes
+Nice=10
diff --git a/meta/recipes-core/dropbear/dropbear/init b/meta/recipes-core/dropbear/dropbear/init
index e8fed3f94d..ffab7a2362 100755
--- a/meta/recipes-core/dropbear/dropbear/init
+++ b/meta/recipes-core/dropbear/dropbear/init
@@ -17,8 +17,11 @@ NAME=dropbear
DESC="Dropbear SSH server"
PIDFILE=/var/run/dropbear.pid
+# These values may be replaced by those from /etc/default/dropbear
+DROPBEAR_RSAKEY_DIR="/etc/dropbear"
DROPBEAR_PORT=22
DROPBEAR_EXTRA_ARGS=
+DROPBEAR_RSAKEY_ARGS=
NO_START=0
set -e
@@ -28,61 +31,27 @@ test "$NO_START" = "0" || exit 0
test -x "$DAEMON" || exit 0
test ! -h /var/service/dropbear || exit 0
-readonly_rootfs=0
-for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' </proc/mounts`; do
- case $flag in
- ro)
- readonly_rootfs=1
- ;;
- esac
-done
-
-if [ $readonly_rootfs = "1" ]; then
- mkdir -p /var/lib/dropbear
- DROPBEAR_RSAKEY_DEFAULT="/var/lib/dropbear/dropbear_rsa_host_key"
- DROPBEAR_DSSKEY_DEFAULT="/var/lib/dropbear/dropbear_dss_host_key"
-else
- DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key"
- DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key"
-fi
-
test -z "$DROPBEAR_BANNER" || \
DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
test -n "$DROPBEAR_RSAKEY" || \
- DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT
-test -n "$DROPBEAR_DSSKEY" || \
- DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT
-test -n "$DROPBEAR_KEYTYPES" || \
- DROPBEAR_KEYTYPES="rsa"
+ DROPBEAR_RSAKEY="${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key"
gen_keys() {
-for t in $DROPBEAR_KEYTYPES; do
- case $t in
- rsa)
- if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
- rm $DROPBEAR_RSAKEY || true
- fi
- test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
- ;;
- dsa)
- if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
- rm $DROPBEAR_DSSKEY || true
- fi
- test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY
- ;;
- esac
-done
+ if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
+ rm $DROPBEAR_RSAKEY || true
+ fi
+ if [ ! -f "$DROPBEAR_RSAKEY" ]; then
+ mkdir -p ${DROPBEAR_RSAKEY%/*}
+ dropbearkey -t rsa -f $DROPBEAR_RSAKEY $DROPBEAR_RSAKEY_ARGS
+ fi
}
case "$1" in
start)
echo -n "Starting $DESC: "
gen_keys
- KEY_ARGS=""
- test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
- test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S -p $PIDFILE \
- -x "$DAEMON" -- $KEY_ARGS \
+ -x "$DAEMON" -- -r $DROPBEAR_RSAKEY \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."
;;
@@ -95,11 +64,8 @@ case "$1" in
echo -n "Restarting $DESC: "
start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
sleep 1
- KEY_ARGS=""
- test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
- test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
start-stop-daemon -S -p $PIDFILE \
- -x "$DAEMON" -- $KEY_ARGS \
+ -x "$DAEMON" -- -r $DROPBEAR_RSAKEY \
-p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
echo "$NAME."
;;
diff --git a/meta/recipes-core/dropbear/dropbear_2015.68.bb b/meta/recipes-core/dropbear/dropbear_2015.68.bb
deleted file mode 100644
index 1b749d703f..0000000000
--- a/meta/recipes-core/dropbear/dropbear_2015.68.bb
+++ /dev/null
@@ -1,4 +0,0 @@
-require dropbear.inc
-
-SRC_URI[md5sum] = "7664ac10f7cc2301c530eb80c756fc5d"
-SRC_URI[sha256sum] = "55ea7c1e904ffe4b1cdbe1addca8291a2533d7d285fd22ac33608e9502a62446"
diff --git a/meta/recipes-core/dropbear/dropbear_2020.81.bb b/meta/recipes-core/dropbear/dropbear_2020.81.bb
new file mode 100644
index 0000000000..c7edea84f8
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear_2020.81.bb
@@ -0,0 +1,3 @@
+require dropbear.inc
+
+SRC_URI[sha256sum] = "48235d10b37775dbda59341ac0c4b239b82ad6318c31568b985730c788aac53b"
diff --git a/meta/recipes-core/ell/ell/0001-pem.c-do-not-use-rawmemchr.patch b/meta/recipes-core/ell/ell/0001-pem.c-do-not-use-rawmemchr.patch
new file mode 100644
index 0000000000..f0ce6f1364
--- /dev/null
+++ b/meta/recipes-core/ell/ell/0001-pem.c-do-not-use-rawmemchr.patch
@@ -0,0 +1,27 @@
+From 277e1eca67fcc23cb31be7b826d83a19d9b89bd2 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Tue, 22 Dec 2020 10:30:54 +0000
+Subject: [PATCH] pem.c: do not use rawmemchr()
+
+This is a glibc-only function, and causes build failures with
+alternative libc implementations such as musl.
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ ell/pem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ell/pem.c b/ell/pem.c
+index 790f2c2..237ae02 100644
+--- a/ell/pem.c
++++ b/ell/pem.c
+@@ -224,7 +224,7 @@ static uint8_t *pem_load_buffer(const void *buf, size_t buf_len,
+
+ /* Check that each header line has a key and a colon */
+ while (start < end) {
+- const char *lf = rawmemchr(start, '\n');
++ const char *lf = memchr(start, '\n', end - start);
+ const char *colon = memchr(start, ':', lf - start);
+
+ if (!colon)
diff --git a/meta/recipes-core/ell/ell_0.44.bb b/meta/recipes-core/ell/ell_0.44.bb
new file mode 100644
index 0000000000..d1f1691645
--- /dev/null
+++ b/meta/recipes-core/ell/ell_0.44.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Embedded Linux Library"
+HOMEPAGE = "https://01.org/ell"
+DESCRIPTION = "The Embedded Linux Library (ELL) provides core, \
+low-level functionality for system daemons. It typically has no \
+dependencies other than the Linux kernel, C standard library, and \
+libdl (for dynamic linking). While ELL is designed to be efficient \
+and compact enough for use on embedded Linux platforms, it is not \
+limited to resource-constrained systems."
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=fb504b67c50331fc78734fed90fb0e09"
+
+DEPENDS = "dbus"
+
+inherit autotools pkgconfig
+
+SRC_URI = "https://mirrors.edge.kernel.org/pub/linux/libs/${BPN}/${BPN}-${PV}.tar.xz \
+ file://0001-pem.c-do-not-use-rawmemchr.patch \
+ "
+SRC_URI[sha256sum] = "41a6f8fa4d285b52cb7a5a87bda3e7370ecaac02d94aaa7ec1a23f0480b8bc3f"
+
+do_configure:prepend () {
+ mkdir -p ${S}/build-aux
+}
diff --git a/meta/recipes-core/expat/expat-2.1.0/autotools.patch b/meta/recipes-core/expat/expat-2.1.0/autotools.patch
deleted file mode 100644
index 0e599697a6..0000000000
--- a/meta/recipes-core/expat/expat-2.1.0/autotools.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Avoid using expat's m4 files
-
-Upstream-Status: Inappropriate [Other]
-Workaround specific to our build system.
-
-Signed-off-by: Kevin Tian <kevin.tian@intel.com>
-Signed-off-by: Scott Garman <scott.a.garman@intel.com>
-
-Updated to apply over expat 2.1.0
-
-Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
-
-diff -Nurd expat-2.1.0/configure.in expat-2.1.0/configure.in
---- expat-2.1.0/configure.in 2012-03-04 01:45:53.000000000 +0200
-+++ expat-2.1.0/configure.in 2012-05-10 21:04:44.000000000 +0300
-@@ -51,8 +51,6 @@
-
- AC_CONFIG_HEADER(expat_config.h)
-
--sinclude(conftools/ac_c_bigendian_cross.m4)
--
- AC_LIBTOOL_WIN32_DLL
- AC_PROG_LIBTOOL
-
diff --git a/meta/recipes-core/expat/expat.inc b/meta/recipes-core/expat/expat.inc
deleted file mode 100644
index 6dfafe94d2..0000000000
--- a/meta/recipes-core/expat/expat.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-SUMMARY = "A stream-oriented XML parser library"
-DESCRIPTION = "Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags)"
-HOMEPAGE = "http://expat.sourceforge.net/"
-SECTION = "libs"
-LICENSE = "MIT"
-
-SRC_URI = "${SOURCEFORGE_MIRROR}/expat/expat-${PV}.tar.gz \
- file://autotools.patch"
-
-inherit autotools lib_package gzipnative
-
-# This package uses an archive format known to have issue with some
-# versions of gzip
-do_unpack[depends] += "gzip-native:do_populate_sysroot"
-
-do_configure_prepend () {
- rm -f ${S}/conftools/libtool.m4
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/expat/expat/libtool-tag.patch b/meta/recipes-core/expat/expat/libtool-tag.patch
new file mode 100644
index 0000000000..0a0aed23e5
--- /dev/null
+++ b/meta/recipes-core/expat/expat/libtool-tag.patch
@@ -0,0 +1,30 @@
+From 10342e6b600858b091bc7771e454d9e06af06410 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 2 Nov 2017 18:20:57 +0800
+Subject: [PATCH] Add CC tag to build
+
+Add CC tag to build
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+---
+ Makefile.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 9560a95..d444bd6 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -319,7 +319,7 @@ LIBCURRENT = @LIBCURRENT@
+ LIBOBJS = @LIBOBJS@
+ LIBREVISION = @LIBREVISION@
+ LIBS = @LIBS@
+-LIBTOOL = @LIBTOOL@
++LIBTOOL = @LIBTOOL@ --tag CC
+ LIPO = @LIPO@
+ LN_S = @LN_S@
+ LTLIBOBJS = @LTLIBOBJS@
+--
+2.7.4
+
diff --git a/meta/recipes-core/expat/expat/run-ptest b/meta/recipes-core/expat/expat/run-ptest
new file mode 100644
index 0000000000..59d8ab57e3
--- /dev/null
+++ b/meta/recipes-core/expat/expat/run-ptest
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+output=${1:-"expat_tests.log"} # default log file
+
+# logging function
+function testCheck() {
+ testExec="$1"
+ shift
+ echo && echo ${testExec} && ./${testExec} "$@"
+ error=$?
+ result=$([[ ${error} -eq 0 ]] && echo "PASS" || echo "FAIL")
+ echo "${result}: ${testExec}" && echo "============================"
+}
+
+export output
+export -f testCheck
+TIME=$(which time)
+
+echo "Architecture: $(uname -m)" > ${output}
+echo "Image: $(uname -sr)" >> ${output}
+${TIME} -f 'Execution time: %e s' bash -c "testCheck runtests -v" |& tee -a ${output}
+${TIME} -f 'Execution time: %e s' bash -c "testCheck runtestspp -v" |& tee -a ${output}
+echo
diff --git a/meta/recipes-core/expat/expat_2.1.0.bb b/meta/recipes-core/expat/expat_2.1.0.bb
deleted file mode 100644
index b958742edc..0000000000
--- a/meta/recipes-core/expat/expat_2.1.0.bb
+++ /dev/null
@@ -1,5 +0,0 @@
-require expat.inc
-LIC_FILES_CHKSUM = "file://COPYING;md5=1b71f681713d1256e1c23b0890920874"
-
-SRC_URI[md5sum] = "dd7dab7a5fea97d2a6a43f511449b7cd"
-SRC_URI[sha256sum] = "823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86"
diff --git a/meta/recipes-core/expat/expat_2.4.1.bb b/meta/recipes-core/expat/expat_2.4.1.bb
new file mode 100644
index 0000000000..14e5aca9e6
--- /dev/null
+++ b/meta/recipes-core/expat/expat_2.4.1.bb
@@ -0,0 +1,32 @@
+SUMMARY = "A stream-oriented XML parser library"
+DESCRIPTION = "Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags)"
+HOMEPAGE = "http://expat.sourceforge.net/"
+SECTION = "libs"
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=9e2ce3b3c4c0f2670883a23bbd7c37a9"
+
+VERSION_TAG = "${@d.getVar('PV').replace('.', '_')}"
+
+SRC_URI = "https://github.com/libexpat/libexpat/releases/download/R_${VERSION_TAG}/expat-${PV}.tar.bz2 \
+ file://libtool-tag.patch \
+ file://run-ptest \
+ "
+
+UPSTREAM_CHECK_URI = "https://github.com/libexpat/libexpat/releases/"
+
+SRC_URI[sha256sum] = "2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40"
+
+EXTRA_OECMAKE:class-native += "-DEXPAT_BUILD_DOCS=OFF"
+
+RDEPENDS:${PN}-ptest += "bash"
+
+inherit cmake lib_package ptest
+
+do_install_ptest:class-target() {
+ install -m 755 ${B}/tests/* ${D}${PTEST_PATH}
+}
+
+BBCLASSEXTEND += "native nativesdk"
+
+CVE_PRODUCT = "expat libexpat"
diff --git a/meta/recipes-core/fts/fts_1.2.7.bb b/meta/recipes-core/fts/fts_1.2.7.bb
new file mode 100644
index 0000000000..f907a35a90
--- /dev/null
+++ b/meta/recipes-core/fts/fts_1.2.7.bb
@@ -0,0 +1,22 @@
+# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Implementation of ftsfor musl libc packages"
+HOMEPAGE = "https://github.com/pullmoll/musl-fts"
+DESCRIPTION = "The musl-fts package implements the fts(3) functions fts_open, fts_read, fts_children, fts_set and fts_close, which are missing in musl libc."
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://COPYING;md5=5ffe358174aad383f1b69ce3b53da982"
+SECTION = "libs"
+
+SRCREV = "0bde52df588e8969879a2cae51c3a4774ec62472"
+
+SRC_URI = "git://github.com/pullmoll/musl-fts.git;branch=master"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch b/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch
deleted file mode 100644
index e4c5f1566b..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/gettext-tools/configure.ac
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/configure.ac 2006-11-27 09:02:01.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/configure.ac 2011-03-16 16:55:36.111396557 -0700
-@@ -36,27 +36,15 @@
- gt_JAVA_CHOICE
-
- gt_GCJ
--if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
-- BUILDJAVAEXE=yes
--else
- BUILDJAVAEXE=no
--fi
- AC_SUBST(BUILDJAVAEXE)
-
- gt_JAVAEXEC
- gt_JAVACOMP([1.3])
- AC_CHECK_PROG(JAR, jar, jar)
--if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then
-- BUILDJAVA=yes
--else
- BUILDJAVA=no
--fi
- AC_SUBST(BUILDJAVA)
--if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
-- TESTJAVA=yes
--else
- TESTJAVA=no
--fi
- AC_SUBST(TESTJAVA)
-
- gt_CSHARPCOMP
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch b/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch
deleted file mode 100644
index 7293f5b08d..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-
-This patch updates the required version number from 2.61 to the
-current 2.65 version of aclocal, this will need to be updated
-when we update aclocal
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by Saul Wold <sgw@linux.intel.com>
-
-Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:45.569526073 -0700
-@@ -148,7 +148,7 @@
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- dnl Autoconf >= 2.61 supports dots in --with options.
-- define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
-+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.65]),[-1],[translit([$1],[.],[_])],[$1])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:45.570526904 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:45.572525773 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:45.578394916 -0700
-@@ -11,7 +11,7 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
- [m4_fatal([this file was generated for autoconf 2.61.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-Index: gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
-+++ gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:45.586395416 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/gettext-tools/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/aclocal.m4 2006-11-27 09:34:32.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/aclocal.m4 2011-03-17 02:27:01.135682807 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
-Index: gettext-0.16.1/gettext-tools/examples/aclocal.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/examples/aclocal.m4 2006-11-27 09:16:23.000000000 -0800
-+++ gettext-0.16.1/gettext-tools/examples/aclocal.m4 2011-03-17 02:26:52.589396683 -0700
-@@ -11,8 +11,8 @@
- # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- # PARTICULAR PURPOSE.
-
--m4_if(m4_PACKAGE_VERSION, [2.61],,
--[m4_fatal([this file was generated for autoconf 2.61.
-+m4_if(m4_PACKAGE_VERSION, [2.65],,
-+[m4_fatal([this file was generated for autoconf 2.65.
- You have another version of autoconf. If you want to use that,
- you should regenerate the build system entirely.], [63])])
-
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch b/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch
deleted file mode 100644
index 06861492c0..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch
+++ /dev/null
@@ -1,348 +0,0 @@
-
-This patch removes the circular dependency on AC_GNU_SOURCE in
-AC_USE_SYSTEM_EXTENSIONS.
-
-Thanks to Mark Hatle for the timely pointers and fixes.
-
-Upstream-Status: Inappropriate [licensing]
-
-Signed-off-by Saul Wold <sgw@linux.intel.com>
-
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 gettext.patched/gettext-runtime/gnulib-m4/extensions.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/extensions.m4 2011-03-16 23:54:01.711923448 -0700
-@@ -16,43 +16,47 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
-- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-- AC_BEFORE([$0], [AC_RUN_IFELSE])
--
-- AC_REQUIRE([AC_GNU_SOURCE])
-- AC_REQUIRE([AC_AIX])
-- AC_REQUIRE([AC_MINIX])
--
-- AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris. */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
-- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-- [ac_cv_safe_to_define___extensions__],
-- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([
--# define __EXTENSIONS__ 1
-- AC_INCLUDES_DEFAULT])],
-- [ac_cv_safe_to_define___extensions__=yes],
-- [ac_cv_safe_to_define___extensions__=no])])
-- test $ac_cv_safe_to_define___extensions__ = yes &&
-- AC_DEFINE([__EXTENSIONS__])
-- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-- AC_DEFINE([_TANDEM_SOURCE])
--])
-+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+#[
-+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-+# AC_BEFORE([$0], [AC_RUN_IFELSE])
-+#
-+# AC_REQUIRE([AC_GNU_SOURCE])
-+# AC_REQUIRE([AC_AIX])
-+# AC_REQUIRE([AC_MINIX])
-+#
-+# AH_VERBATIM([__EXTENSIONS__],
-+#[/* Enable extensions on Solaris. */
-+##ifndef __EXTENSIONS__
-+## undef __EXTENSIONS__
-+##endif
-+##ifndef _POSIX_PTHREAD_SEMANTICS
-+## undef _POSIX_PTHREAD_SEMANTICS
-+##endif
-+##ifndef _TANDEM_SOURCE
-+## undef _TANDEM_SOURCE
-+##endif])
-+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-+# [ac_cv_safe_to_define___extensions__],
-+# [AC_COMPILE_IFELSE(
-+# [AC_LANG_PROGRAM([
-+## define __EXTENSIONS__ 1
-+# AC_INCLUDES_DEFAULT])],
-+# [ac_cv_safe_to_define___extensions__=yes],
-+# [ac_cv_safe_to_define___extensions__=no])])
-+# test $ac_cv_safe_to_define___extensions__ = yes &&
-+# AC_DEFINE([__EXTENSIONS__])
-+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-+# AC_DEFINE([_TANDEM_SOURCE])
-+#])
-
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
- AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
-+[
-+ AC_REQUIRE([AC_GNU_SOURCE])
-+
-+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-+])
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:19.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4 2011-03-16 23:50:17.471531838 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- ])
-
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4 2011-03-16 23:50:10.814396529 -0700
-@@ -9,7 +9,7 @@
-
- AC_DEFUN([gl_MBCHAR],
- [
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- dnl The following line is that so the user can test HAVE_WCHAR_H
- dnl before #include "mbchar.h".
- AC_CHECK_HEADERS_ONCE([wchar.h])
-diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4
---- gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 2006-11-27 09:14:38.000000000 -0800
-+++ gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4 2011-03-16 23:50:08.357396247 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_WCWIDTH],
- [
- dnl Persuade glibc <wchar.h> to declare wcwidth().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
-diff -ru gettext-0.16.1/gettext-runtime/m4/lock.m4 gettext.patched/gettext-runtime/m4/lock.m4
---- gettext-0.16.1/gettext-runtime/m4/lock.m4 2006-10-24 13:59:59.000000000 -0700
-+++ gettext.patched/gettext-runtime/m4/lock.m4 2011-03-16 23:50:04.355891676 -0700
-@@ -35,7 +35,7 @@
- AC_BEFORE([$0], [gl_ARGP])dnl
-
- AC_REQUIRE([AC_CANONICAL_HOST])
-- AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
-+ dnl AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
- dnl Check for multithreading.
- AC_ARG_ENABLE(threads,
- AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 gettext.patched/gettext-tools/gnulib-m4/extensions.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/extensions.m4 2011-03-16 23:53:28.487671266 -0700
-@@ -16,43 +16,47 @@
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
--AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
--[
-- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-- AC_BEFORE([$0], [AC_RUN_IFELSE])
--
-- AC_REQUIRE([AC_GNU_SOURCE])
-- AC_REQUIRE([AC_AIX])
-- AC_REQUIRE([AC_MINIX])
--
-- AH_VERBATIM([__EXTENSIONS__],
--[/* Enable extensions on Solaris. */
--#ifndef __EXTENSIONS__
--# undef __EXTENSIONS__
--#endif
--#ifndef _POSIX_PTHREAD_SEMANTICS
--# undef _POSIX_PTHREAD_SEMANTICS
--#endif
--#ifndef _TANDEM_SOURCE
--# undef _TANDEM_SOURCE
--#endif])
-- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-- [ac_cv_safe_to_define___extensions__],
-- [AC_COMPILE_IFELSE(
-- [AC_LANG_PROGRAM([
--# define __EXTENSIONS__ 1
-- AC_INCLUDES_DEFAULT])],
-- [ac_cv_safe_to_define___extensions__=yes],
-- [ac_cv_safe_to_define___extensions__=no])])
-- test $ac_cv_safe_to_define___extensions__ = yes &&
-- AC_DEFINE([__EXTENSIONS__])
-- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-- AC_DEFINE([_TANDEM_SOURCE])
--])
-+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-+#[
-+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-+# AC_BEFORE([$0], [AC_RUN_IFELSE])
-+#
-+# AC_REQUIRE([AC_GNU_SOURCE])
-+# AC_REQUIRE([AC_AIX])
-+# AC_REQUIRE([AC_MINIX])
-+#
-+# AH_VERBATIM([__EXTENSIONS__],
-+#[/* Enable extensions on Solaris. */
-+##ifndef __EXTENSIONS__
-+## undef __EXTENSIONS__
-+##endif
-+##ifndef _POSIX_PTHREAD_SEMANTICS
-+## undef _POSIX_PTHREAD_SEMANTICS
-+##endif
-+##ifndef _TANDEM_SOURCE
-+## undef _TANDEM_SOURCE
-+##endif])
-+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
-+# [ac_cv_safe_to_define___extensions__],
-+# [AC_COMPILE_IFELSE(
-+# [AC_LANG_PROGRAM([
-+## define __EXTENSIONS__ 1
-+# AC_INCLUDES_DEFAULT])],
-+# [ac_cv_safe_to_define___extensions__=yes],
-+# [ac_cv_safe_to_define___extensions__=no])])
-+# test $ac_cv_safe_to_define___extensions__ = yes &&
-+# AC_DEFINE([__EXTENSIONS__])
-+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-+# AC_DEFINE([_TANDEM_SOURCE])
-+#])
-
- # gl_USE_SYSTEM_EXTENSIONS
- # ------------------------
- # Enable extensions on systems that normally disable them,
- # typically due to standards-conformance issues.
- AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
-- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
-+[
-+ AC_REQUIRE([AC_GNU_SOURCE])
-+
-+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-+])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4 2011-03-16 23:52:06.477463671 -0700
-@@ -91,7 +91,7 @@
- AC_DEFUN([gl_FUNC_FNMATCH_GNU],
- [
- dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- FNMATCH_H=
- _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 gettext.patched/gettext-tools/gnulib-m4/getdelim.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/getdelim.m4 2011-03-16 23:52:22.871674845 -0700
-@@ -12,7 +12,7 @@
- [
-
- dnl Persuade glibc <stdio.h> to declare getdelim().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REPLACE_FUNCS(getdelim)
- AC_CHECK_DECLS_ONCE(getdelim)
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 gettext.patched/gettext-tools/gnulib-m4/getline.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 2006-11-27 09:14:54.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/getline.m4 2011-03-16 23:51:49.829971108 -0700
-@@ -16,7 +16,7 @@
- AC_DEFUN([gl_FUNC_GETLINE],
- [
- dnl Persuade glibc <stdio.h> to declare getline().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_CHECK_DECLS([getline])
-
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:36.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4 2011-03-16 23:52:18.970450488 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_LOCK_EARLY])
- ])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 gettext.patched/gettext-tools/gnulib-m4/mbchar.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/mbchar.m4 2011-03-16 23:51:40.844410216 -0700
-@@ -9,7 +9,7 @@
-
- AC_DEFUN([gl_MBCHAR],
- [
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- dnl The following line is that so the user can test HAVE_WCHAR_H
- dnl before #include "mbchar.h".
- AC_CHECK_HEADERS_ONCE([wchar.h])
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4 2011-03-16 23:52:14.691396045 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_STPCPY],
- [
- dnl Persuade glibc <string.h> to declare stpcpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REPLACE_FUNCS(stpcpy)
- if test $ac_cv_func_stpcpy = no; then
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4 2011-03-16 23:52:10.356641459 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_STPNCPY],
- [
- dnl Persuade glibc <string.h> to declare stpncpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
- dnl declared in <string.h>. Its side effects are the same as those
-diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4
---- gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 2006-11-27 09:14:55.000000000 -0800
-+++ gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4 2011-03-16 23:51:08.260324221 -0700
-@@ -7,7 +7,7 @@
- AC_DEFUN([gl_FUNC_WCWIDTH],
- [
- dnl Persuade glibc <wchar.h> to declare wcwidth().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gt_TYPE_WCHAR_T])
-diff -ru gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4
---- gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:45.000000000 -0800
-+++ gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2011-03-16 23:51:02.036061317 -0700
-@@ -25,7 +25,7 @@
- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
- AC_REQUIRE([AC_PROG_RANLIB])
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_REQUIRE([gl_LOCK_EARLY])
- ])
-diff -ru gettext-0.16.1/gettext-tools/m4/regex.m4 gettext.patched/gettext-tools/m4/regex.m4
---- gettext-0.16.1/gettext-tools/m4/regex.m4 2006-11-27 09:02:05.000000000 -0800
-+++ gettext.patched/gettext-tools/m4/regex.m4 2011-03-16 23:50:53.533477195 -0700
-@@ -116,7 +116,7 @@
- dnl to get them.
-
- dnl Persuade glibc <string.h> to declare mempcpy().
-- AC_REQUIRE([AC_GNU_SOURCE])
-+ dnl AC_REQUIRE([AC_GNU_SOURCE])
-
- AC_REQUIRE([AC_C_RESTRICT])
- AC_REQUIRE([AC_FUNC_ALLOCA])
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch b/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch
deleted file mode 100644
index 072fe5ff6c..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
---- gettext-0.17/autoconf-lib-link/m4/lib-link.m4~ 2009-04-17 15:12:30.000000000 -0700
-+++ gettext-0.17/autoconf-lib-link/m4/lib-link.m4 2009-04-17 15:37:39.000000000 -0700
-@@ -267,6 +267,9 @@
- fi
- fi
- fi
-+ dnl Just let the compiler find the library, the compiler and user are smarter then this script
-+ dnl when cross compiling and working with a relocated install.
-+ found_dir=""
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch b/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch
deleted file mode 100644
index f09e450efe..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/gettext-runtime/intl/Makefile.in
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/intl/Makefile.in 2006-11-27 09:02:00.000000000 -0800
-+++ gettext-0.16.1/gettext-runtime/intl/Makefile.in 2011-03-16 16:04:49.175419930 -0700
-@@ -35,7 +35,7 @@
- # 'make' does the wrong thing if GNU gettext was configured with
- # "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
- # files it finds in srcdir = ../../gettext-runtime/intl.
--VPATH = $(srcdir)
-+#VPATH = $(srcdir)
-
- prefix = @prefix@
- exec_prefix = @exec_prefix@
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch b/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch
deleted file mode 100644
index 4da8dd4536..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-
-This patch hardcodes in version 0.17 for the GETTEXT_MACRO_VERSION,
-the version check is only part of 0.17 and will not affect any 0.16.1
-operations
-
-Upstream-Status: Inappropriate [licensing]
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: gettext-0.16.1/gettext-runtime/m4/po.m4
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/m4/po.m4 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-runtime/m4/po.m4 2011-03-17 02:28:25.455396862 -0700
-@@ -27,6 +27,9 @@
- AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
- AC_REQUIRE([AM_NLS])dnl
-
-+ dnl Hardcode the MACRO_VERSION to 0.17 for gnutls
-+ AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
-+
- dnl Perform the following tests also if --disable-nls has been given,
- dnl because they are needed for "make dist" to work.
-
-Index: gettext-0.16.1/gettext-runtime/po/Makefile.in.in
-===================================================================
---- gettext-0.16.1.orig/gettext-runtime/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-runtime/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
-@@ -10,6 +10,9 @@
- #
- # Origin: gettext-0.16
-
-+# Hardcode this value for gnutls building against gplv2 code
-+GETTEXT_MACRO_VERSION = 0.17
-+
- PACKAGE = @PACKAGE@
- VERSION = @VERSION@
- PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-Index: gettext-0.16.1/gettext-tools/po/Makefile.in.in
-===================================================================
---- gettext-0.16.1.orig/gettext-tools/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
-+++ gettext-0.16.1/gettext-tools/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
-@@ -10,6 +10,9 @@
- #
- # Origin: gettext-0.16
-
-+# Hardcode this value for gnutls building against gplv2 code
-+GETTEXT_MACRO_VERSION = 0.17
-+
- PACKAGE = @PACKAGE@
- VERSION = @VERSION@
- PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch b/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch
deleted file mode 100644
index d921069711..0000000000
--- a/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch
+++ /dev/null
@@ -1,720 +0,0 @@
-
-# Pulled from OpenEmbedded
-#
-# Commented by: Saul Wold <saul.wold@intel.com>
-
-Upstream-Status: Inappropriate [licensing]
-
-Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2006-11-27 09:01:58.000000000 -0800
-+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 00:36:08.710836720 -0700
-@@ -6,12 +6,14 @@
-
- dnl From Bruno Haible.
-
--AC_PREREQ(2.50)
-+AC_PREREQ(2.54)
-
- dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
- dnl the libraries corresponding to explicit and implicit dependencies.
- dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
- dnl augments the CPPFLAGS variable.
-+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_LINKFLAGS],
- [
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-@@ -24,13 +26,16 @@
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
-+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
-+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
-+ AC_SUBST([LIB]NAME[_PREFIX])
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
-@@ -46,6 +51,8 @@
- dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
- dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
- dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
- [
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
-@@ -82,17 +89,24 @@
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
-+ LIB[]NAME[]_PREFIX=
-+
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
-+ AC_SUBST([LIB]NAME[_PREFIX])
- undefine([Name])
- undefine([NAME])
- ])
-
- dnl Determine the platform dependent parameters needed to use rpath:
--dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
--dnl hardcode_direct, hardcode_minus_L.
-+dnl acl_libext,
-+dnl acl_shlibext,
-+dnl acl_hardcode_libdir_flag_spec,
-+dnl acl_hardcode_libdir_separator,
-+dnl acl_hardcode_direct,
-+dnl acl_hardcode_minus_L.
- AC_DEFUN([AC_LIB_RPATH],
- [
- dnl Tell automake >= 1.10 to complain if config.rpath is missing.
-@@ -109,12 +123,14 @@
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
-- libext="$acl_cv_libext"
-- shlibext="$acl_cv_shlibext"
-- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-- hardcode_direct="$acl_cv_hardcode_direct"
-- hardcode_minus_L="$acl_cv_hardcode_minus_L"
-+ acl_libext="$acl_cv_libext"
-+ acl_shlibext="$acl_cv_shlibext"
-+ acl_libname_spec="$acl_cv_libname_spec"
-+ acl_library_names_spec="$acl_cv_library_names_spec"
-+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
-+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
-+ acl_hardcode_direct="$acl_cv_hardcode_direct"
-+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath do not hardcode runtime library paths],
-@@ -124,20 +140,24 @@
- dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
- dnl the libraries corresponding to explicit and implicit dependencies.
- dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
-+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
- AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
- [
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-+ dnl Autoconf >= 2.61 supports dots in --with options.
-+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
-- AC_LIB_ARG_WITH([lib$1-prefix],
--[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
-- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
-+ AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
-+[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
-+ --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
- [
- if test "X$withval" = "Xno"; then
- use_additional=no
-@@ -158,6 +178,7 @@
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
-+ LIB[]NAME[]_PREFIX=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
-@@ -197,27 +218,53 @@
- found_la=
- found_so=
- found_a=
-+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
-+ if test -n "$acl_shlibext"; then
-+ shrext=".$acl_shlibext" # typically: shrext=.so
-+ else
-+ shrext=
-+ fi
- if test $use_additional = yes; then
-- if test -n "$shlibext" \
-- && { test -f "$additional_libdir/lib$name.$shlibext" \
-- || { test "$shlibext" = dll \
-- && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
-- found_dir="$additional_libdir"
-- if test -f "$additional_libdir/lib$name.$shlibext"; then
-- found_so="$additional_libdir/lib$name.$shlibext"
-+ dir="$additional_libdir"
-+ dnl The same code as in the loop below:
-+ dnl First look for a shared library.
-+ if test -n "$acl_shlibext"; then
-+ if test -f "$dir/$libname$shrext"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext"
- else
-- found_so="$additional_libdir/lib$name.dll.a"
-+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-+ ver=`(cd "$dir" && \
-+ for f in "$libname$shrext".*; do echo "$f"; done \
-+ | sed -e "s,^$libname$shrext\\\\.,," \
-+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-+ | sed 1q ) 2>/dev/null`
-+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext.$ver"
-+ fi
-+ else
-+ eval library_names=\"$acl_library_names_spec\"
-+ for f in $library_names; do
-+ if test -f "$dir/$f"; then
-+ found_dir="$dir"
-+ found_so="$dir/$f"
-+ break
-+ fi
-+ done
-+ fi
- fi
-- if test -f "$additional_libdir/lib$name.la"; then
-- found_la="$additional_libdir/lib$name.la"
-+ fi
-+ dnl Then look for a static library.
-+ if test "X$found_dir" = "X"; then
-+ if test -f "$dir/$libname.$acl_libext"; then
-+ found_dir="$dir"
-+ found_a="$dir/$libname.$acl_libext"
- fi
-- else
-- if test -f "$additional_libdir/lib$name.$libext"; then
-- found_dir="$additional_libdir"
-- found_a="$additional_libdir/lib$name.$libext"
-- if test -f "$additional_libdir/lib$name.la"; then
-- found_la="$additional_libdir/lib$name.la"
-- fi
-+ fi
-+ if test "X$found_dir" != "X"; then
-+ if test -f "$dir/$libname.la"; then
-+ found_la="$dir/$libname.la"
- fi
- fi
- fi
-@@ -227,26 +274,44 @@
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
-- if test -n "$shlibext" \
-- && { test -f "$dir/lib$name.$shlibext" \
-- || { test "$shlibext" = dll \
-- && test -f "$dir/lib$name.dll.a"; }; }; then
-- found_dir="$dir"
-- if test -f "$dir/lib$name.$shlibext"; then
-- found_so="$dir/lib$name.$shlibext"
-+ dnl First look for a shared library.
-+ if test -n "$acl_shlibext"; then
-+ if test -f "$dir/$libname$shrext"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext"
- else
-- found_so="$dir/lib$name.dll.a"
-- fi
-- if test -f "$dir/lib$name.la"; then
-- found_la="$dir/lib$name.la"
-+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
-+ ver=`(cd "$dir" && \
-+ for f in "$libname$shrext".*; do echo "$f"; done \
-+ | sed -e "s,^$libname$shrext\\\\.,," \
-+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
-+ | sed 1q ) 2>/dev/null`
-+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
-+ found_dir="$dir"
-+ found_so="$dir/$libname$shrext.$ver"
-+ fi
-+ else
-+ eval library_names=\"$acl_library_names_spec\"
-+ for f in $library_names; do
-+ if test -f "$dir/$f"; then
-+ found_dir="$dir"
-+ found_so="$dir/$f"
-+ break
-+ fi
-+ done
-+ fi
- fi
-- else
-- if test -f "$dir/lib$name.$libext"; then
-+ fi
-+ dnl Then look for a static library.
-+ if test "X$found_dir" = "X"; then
-+ if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
-- found_a="$dir/lib$name.$libext"
-- if test -f "$dir/lib$name.la"; then
-- found_la="$dir/lib$name.la"
-- fi
-+ found_a="$dir/$libname.$acl_libext"
-+ fi
-+ fi
-+ if test "X$found_dir" != "X"; then
-+ if test -f "$dir/$libname.la"; then
-+ found_la="$dir/$libname.la"
- fi
- fi
- ;;
-@@ -282,12 +347,12 @@
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
-- if test "$hardcode_direct" = yes; then
-+ if test "$acl_hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
-- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
-@@ -318,13 +383,13 @@
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
-- if test "$hardcode_minus_L" != no; then
-+ if test "$acl_hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
-- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
-+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
-@@ -512,18 +577,18 @@
- done
- done
- if test "X$rpathdirs" != "X"; then
-- if test -n "$hardcode_libdir_separator"; then
-+ if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
-- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
- done
-- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
-+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
-- eval flag=\"$hardcode_libdir_flag_spec\"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
-@@ -531,7 +596,7 @@
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
-- eval flag=\"$hardcode_libdir_flag_spec\"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
-@@ -642,3 +707,79 @@
- fi
- AC_SUBST([$1])
- ])
-+
-+dnl For those cases where a variable contains several -L and -l options
-+dnl referring to unknown libraries and directories, this macro determines the
-+dnl necessary additional linker options for the runtime path.
-+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
-+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
-+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
-+dnl otherwise linking without libtool is assumed.
-+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
-+[
-+ AC_REQUIRE([AC_LIB_RPATH])
-+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
-+ $1=
-+ if test "$enable_rpath" != no; then
-+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
-+ dnl Use an explicit option to hardcode directories into the resulting
-+ dnl binary.
-+ rpathdirs=
-+ next=
-+ for opt in $2; do
-+ if test -n "$next"; then
-+ dir="$next"
-+ dnl No need to hardcode the standard /usr/lib.
-+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
-+ rpathdirs="$rpathdirs $dir"
-+ fi
-+ next=
-+ else
-+ case $opt in
-+ -L) next=yes ;;
-+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
-+ dnl No need to hardcode the standard /usr/lib.
-+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
-+ rpathdirs="$rpathdirs $dir"
-+ fi
-+ next= ;;
-+ *) next= ;;
-+ esac
-+ fi
-+ done
-+ if test "X$rpathdirs" != "X"; then
-+ if test -n ""$3""; then
-+ dnl libtool is used for linking. Use -R options.
-+ for dir in $rpathdirs; do
-+ $1="${$1}${$1:+ }-R$dir"
-+ done
-+ else
-+ dnl The linker is used for linking directly.
-+ if test -n "$acl_hardcode_libdir_separator"; then
-+ dnl Weird platform: only the last -rpath option counts, the user
-+ dnl must pass all path elements in one option.
-+ alldirs=
-+ for dir in $rpathdirs; do
-+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
-+ done
-+ acl_save_libdir="$libdir"
-+ libdir="$alldirs"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
-+ libdir="$acl_save_libdir"
-+ $1="$flag"
-+ else
-+ dnl The -rpath options are cumulative.
-+ for dir in $rpathdirs; do
-+ acl_save_libdir="$libdir"
-+ libdir="$dir"
-+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
-+ libdir="$acl_save_libdir"
-+ $1="${$1}${$1:+ }$flag"
-+ done
-+ fi
-+ fi
-+ fi
-+ fi
-+ fi
-+ AC_SUBST([$1])
-+])
-Index: gettext-0.16.1/autoconf-lib-link/config.rpath
-===================================================================
---- gettext-0.16.1.orig/autoconf-lib-link/config.rpath 2006-11-27 09:01:58.000000000 -0800
-+++ gettext-0.16.1/autoconf-lib-link/config.rpath 2011-03-17 00:33:23.336539490 -0700
-@@ -2,7 +2,7 @@
- # Output a system dependent set of variables, describing how to set the
- # run time search path of shared libraries in an executable.
- #
--# Copyright 1996-2006 Free Software Foundation, Inc.
-+# Copyright 1996-2007 Free Software Foundation, Inc.
- # Taken from GNU libtool, 2001
- # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
- #
-@@ -47,6 +47,18 @@
- done
- cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-
-+# Code taken from libtool.m4's _LT_CC_BASENAME.
-+
-+for cc_temp in $CC""; do
-+ case $cc_temp in
-+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-+ \-*) ;;
-+ *) break;;
-+ esac
-+done
-+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-+
- # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
-
- wl=
-@@ -64,7 +76,14 @@
- ;;
- esac
- ;;
-- mingw* | pw32* | os2*)
-+ darwin*)
-+ case $cc_basename in
-+ xlc*)
-+ wl='-Wl,'
-+ ;;
-+ esac
-+ ;;
-+ mingw* | cygwin* | pw32* | os2*)
- ;;
- hpux9* | hpux10* | hpux11*)
- wl='-Wl,'
-@@ -74,7 +93,7 @@
- ;;
- newsos6)
- ;;
-- linux*)
-+ linux* | k*bsd*-gnu)
- case $cc_basename in
- icc* | ecc*)
- wl='-Wl,'
-@@ -100,7 +119,7 @@
- osf3* | osf4* | osf5*)
- wl='-Wl,'
- ;;
-- sco3.2v5*)
-+ rdos*)
- ;;
- solaris*)
- wl='-Wl,'
-@@ -108,11 +127,14 @@
- sunos4*)
- wl='-Qoption ld '
- ;;
-- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-+ sysv4 | sysv4.2uw2* | sysv4.3*)
- wl='-Wl,'
- ;;
- sysv4*MP*)
- ;;
-+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-+ wl='-Wl,'
-+ ;;
- unicos*)
- wl='-Wl,'
- ;;
-@@ -141,6 +163,10 @@
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
-+ interix*)
-+ # we just hope/assume this is gcc and not c89 (= MSVC++)
-+ with_gnu_ld=yes
-+ ;;
- openbsd*)
- with_gnu_ld=no
- ;;
-@@ -189,11 +215,11 @@
- ld_shlibs=no
- fi
- ;;
-- interix3*)
-+ interix[3-9]*)
- hardcode_direct=no
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
-- linux*)
-+ gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
-@@ -280,7 +306,7 @@
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
-- hardcode_direct=yes
-+ :
- else
- # We have old collect2
- hardcode_direct=unsupported
-@@ -359,7 +385,7 @@
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-- freebsd* | kfreebsd*-gnu | dragonfly*)
-+ freebsd* | dragonfly*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
-@@ -412,18 +438,22 @@
- hardcode_libdir_separator=:
- ;;
- openbsd*)
-- hardcode_direct=yes
-- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ if test -f /usr/libexec/ld.so; then
-+ hardcode_direct=yes
-+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ else
-+ case "$host_os" in
-+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-+ hardcode_libdir_flag_spec='-R$libdir'
-+ ;;
-+ *)
-+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-+ ;;
-+ esac
-+ fi
- else
-- case "$host_os" in
-- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-- hardcode_libdir_flag_spec='-R$libdir'
-- ;;
-- *)
-- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-- ;;
-- esac
-+ ld_shlibs=no
- fi
- ;;
- os2*)
-@@ -471,7 +501,7 @@
- ld_shlibs=yes
- fi
- ;;
-- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
-+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* |sco3.2v5.0.[024]*)
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-@@ -488,33 +518,51 @@
-
- # Check dynamic linker characteristics
- # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
-+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
-+# only about the one the linker finds when passed -lNAME. This is the last
-+# element of library_names_spec in libtool.m4, or possibly two of them if the
-+# linker has special search rules.
-+library_names_spec= # the last element of library_names_spec in libtool.m4
- libname_spec='lib$name'
- case "$host_os" in
- aix3*)
-+ library_names_spec='$libname.a'
- ;;
- aix4* | aix5*)
-+ library_names_spec='$libname$shrext'
- ;;
- amigaos*)
-+ library_names_spec='$libname.a'
- ;;
- beos*)
-+ library_names_spec='$libname$shrext'
- ;;
- bsdi[45]*)
-+ library_names_spec='$libname$shrext'
- ;;
- cygwin* | mingw* | pw32*)
- shrext=.dll
-+ library_names_spec='$libname.dll.a $libname.lib'
- ;;
- darwin* | rhapsody*)
- shrext=.dylib
-+ library_names_spec='$libname$shrext'
- ;;
- dgux*)
-+ library_names_spec='$libname$shrext'
- ;;
- freebsd1*)
- ;;
-- kfreebsd*-gnu)
-- ;;
- freebsd* | dragonfly*)
-+ case "$host_os" in
-+ freebsd[123]*)
-+ library_names_spec='$libname$shrext$versuffix' ;;
-+ *)
-+ library_names_spec='$libname$shrext' ;;
-+ esac
- ;;
- gnu*)
-+ library_names_spec='$libname$shrext'
- ;;
- hpux9* | hpux10* | hpux11*)
- case $host_cpu in
-@@ -528,10 +576,13 @@
- shrext=.sl
- ;;
- esac
-+ library_names_spec='$libname$shrext'
- ;;
-- interix3*)
-+ interix[3-9]*)
-+ library_names_spec='$libname$shrext'
- ;;
- irix5* | irix6* | nonstopux*)
-+ library_names_spec='$libname$shrext'
- case "$host_os" in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
-@@ -548,33 +599,46 @@
- ;;
- linux*oldld* | linux*aout* | linux*coff*)
- ;;
-- linux*)
-+ linux* | k*bsd*-gnu)
-+ library_names_spec='$libname$shrext'
- ;;
- knetbsd*-gnu)
-+ library_names_spec='$libname$shrext'
- ;;
- netbsd*)
-+ library_names_spec='$libname$shrext'
- ;;
- newsos6)
-+ library_names_spec='$libname$shrext'
- ;;
- nto-qnx*)
-+ library_names_spec='$libname$shrext'
- ;;
- openbsd*)
-+ library_names_spec='$libname$shrext$versuffix'
- ;;
- os2*)
- libname_spec='$name'
- shrext=.dll
-+ library_names_spec='$libname.a'
- ;;
- osf3* | osf4* | osf5*)
-+ library_names_spec='$libname$shrext'
- ;;
- solaris*)
-+ library_names_spec='$libname$shrext'
- ;;
- sunos4*)
-+ library_names_spec='$libname$shrext$versuffix'
- ;;
- sysv4 | sysv4.3*)
-+ library_names_spec='$libname$shrext'
- ;;
- sysv4*MP*)
-+ library_names_spec='$libname$shrext'
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-+ library_names_spec='$libname$shrext'
- ;;
- uts4*)
- ;;
-@@ -583,6 +647,8 @@
- sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
- escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
- shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
-+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
- escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-
- LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
-@@ -596,6 +662,12 @@
- # Shared library suffix (normally "so").
- shlibext="$shlibext"
-
-+# Format of library name prefix.
-+libname_spec="$escaped_libname_spec"
-+
-+# Library names that the linker finds when passed -lNAME.
-+library_names_spec="$escaped_library_names_spec"
-+
- # Flag to hardcode \$libdir into a binary during linking.
- # This must work even if \$libdir does not exist.
- hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
diff --git a/meta/recipes-core/gettext/gettext-0.19.4/parallel.patch b/meta/recipes-core/gettext/gettext-0.19.4/parallel.patch
deleted file mode 100644
index c8e2c94af0..0000000000
--- a/meta/recipes-core/gettext/gettext-0.19.4/parallel.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-instal libgettextlib.a before removing it
-
-In a multiple job build, Makefile can simultaneously
-be installing and removing libgettextlib.a. We serialize
-the operations.
-
-Upstream-Status: Pending
-
-Signed-off-by: Joe Slater <jslater@windriver.com>
-
---- a/gettext-tools/gnulib-lib/Makefile.am
-+++ b/gettext-tools/gnulib-lib/Makefile.am
-@@ -57,6 +57,10 @@ endif
- # Rules generated and collected by gnulib-tool.
- include Makefile.gnulib
-
-+# defined in Makefile.gnulib but missing this dependency
-+#
-+install-exec-clean: install-libLTLIBRARIES
-+
- # Which classes to export from the shared library.
- MOOPPFLAGS += --dllexport=styled_ostream
-
diff --git a/meta/recipes-core/gettext/gettext-0.21/0001-init-env.in-do-not-add-C-CXX-parameters.patch b/meta/recipes-core/gettext/gettext-0.21/0001-init-env.in-do-not-add-C-CXX-parameters.patch
new file mode 100644
index 0000000000..d45b75869a
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/0001-init-env.in-do-not-add-C-CXX-parameters.patch
@@ -0,0 +1,29 @@
+From 9b912a47f790a7b282ec0c2295a188c5d8fb6a7c Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Fri, 6 Mar 2020 21:04:05 +0000
+Subject: [PATCH] init-env.in: do not add C/CXX parameters
+
+These are taken from the cross environment and include
+sysroot paths, so are not reproducible.
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ gettext-tools/tests/init-env.in | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/gettext-tools/tests/init-env.in b/gettext-tools/tests/init-env.in
+index cc84ffd..b69c990 100644
+--- a/gettext-tools/tests/init-env.in
++++ b/gettext-tools/tests/init-env.in
+@@ -3,10 +3,6 @@ top_builddir=../..
+
+ OBJEXT="@OBJEXT@"
+ EXEEXT="@EXEEXT@"
+-CC="@CC@"
+-CFLAGS="@CFLAGS@"
+-CXX="@CXX@"
+-CXXFLAGS="@CXXFLAGS@"
+ CPPFLAGS="@CPPFLAGS@"
+ LDFLAGS="@LDFLAGS@"
+ LTLIBINTL="@LTLIBINTL@"
diff --git a/meta/recipes-core/gettext/gettext-0.21/0001-msgmerge-29-Add-executable-file-mode-bits.patch b/meta/recipes-core/gettext/gettext-0.21/0001-msgmerge-29-Add-executable-file-mode-bits.patch
new file mode 100644
index 0000000000..e42a6c0a4d
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/0001-msgmerge-29-Add-executable-file-mode-bits.patch
@@ -0,0 +1,23 @@
+From 71988f83b69c4ed98d1b9418da80edf11a931894 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 23 Sep 2020 22:08:34 -0700
+Subject: [PATCH] msgmerge-29: Add executable file mode bits
+
+This script is installed with default mode bits and executed directly
+e.g ./msgmerge-29 when doing make check which results in
+
+/bin/bash: line 9: ./msgmerge-29: Permission denied
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ gettext-tools/tests/msgmerge-29 | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ mode change 100644 => 100755 gettext-tools/tests/msgmerge-29
+
+diff --git a/gettext-tools/tests/msgmerge-29 b/gettext-tools/tests/msgmerge-29
+old mode 100644
+new mode 100755
+--
+2.28.0
+
diff --git a/meta/recipes-core/gettext/gettext-0.21/0001-tests-autopoint-3-unset-MAKEFLAGS.patch b/meta/recipes-core/gettext/gettext-0.21/0001-tests-autopoint-3-unset-MAKEFLAGS.patch
new file mode 100644
index 0000000000..b0bc6b97a6
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/0001-tests-autopoint-3-unset-MAKEFLAGS.patch
@@ -0,0 +1,26 @@
+From 38b256e5aa7dfeb42acffd89565e53a2c0bab3e3 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Tue, 7 Jan 2020 16:44:38 +0100
+Subject: [PATCH] tests/autopoint-3: unset MAKEFLAGS
+
+This is needed when running ptests, as the MAKEFLAGS value (set up by run-ptest)
+is messing up the test.
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ gettext-tools/tests/autopoint-3 | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gettext-tools/tests/autopoint-3 b/gettext-tools/tests/autopoint-3
+index e13552b..55188df 100755
+--- a/gettext-tools/tests/autopoint-3
++++ b/gettext-tools/tests/autopoint-3
+@@ -126,6 +126,7 @@ test $? = 0 || { cat autopoint.err; Exit 1; }
+ ${CONFIG_SHELL} ./configure >/dev/null 2>autpoint.err
+ test $? = 0 || { cat autopoint.err; Exit 1; }
+
++unset MAKEFLAGS
+ ${MAKE} >/dev/null 2>autopoint.err
+ test $? = 0 || { cat autopoint.err; Exit 1; }
+
diff --git a/meta/recipes-core/gettext/gettext-0.21/mingw.patch b/meta/recipes-core/gettext/gettext-0.21/mingw.patch
new file mode 100644
index 0000000000..b062c784f6
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/mingw.patch
@@ -0,0 +1,28 @@
+From 7cf68dffb2adb76375bfb0781e277510523a1f3e Mon Sep 17 00:00:00 2001
+From: Michele Locati <michele@locati.it>
+Date: Thu, 30 Jul 2020 18:58:02 +0200
+Subject: [PATCH] build: Fix build failure on Cygwin and mingw.
+
+* gettext-tools/woe32dll/gettextsrc-exports.c: Export formatstring_ruby.
+
+Upstream-Status: Backport
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ gettext-tools/woe32dll/gettextsrc-exports.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gettext-tools/woe32dll/gettextsrc-exports.c b/gettext-tools/woe32dll/gettextsrc-exports.c
+index 4477ae8..6d76089 100644
+--- a/gettext-tools/woe32dll/gettextsrc-exports.c
++++ b/gettext-tools/woe32dll/gettextsrc-exports.c
+@@ -50,6 +50,7 @@ VARIABLE(formatstring_python)
+ VARIABLE(formatstring_python_brace)
+ VARIABLE(formatstring_qt)
+ VARIABLE(formatstring_qt_plural)
++VARIABLE(formatstring_ruby)
+ VARIABLE(formatstring_scheme)
+ VARIABLE(formatstring_sh)
+ VARIABLE(formatstring_smalltalk)
+--
+1.9.1
+
diff --git a/meta/recipes-core/gettext/gettext-0.21/parallel.patch b/meta/recipes-core/gettext/gettext-0.21/parallel.patch
new file mode 100644
index 0000000000..d96a376b7d
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/parallel.patch
@@ -0,0 +1,32 @@
+From 4a2a0a93b469093b60ffd0bec55d33d1e03d4713 Mon Sep 17 00:00:00 2001
+From: Joe Slater <jslater@windriver.com>
+Date: Thu, 7 Jun 2012 16:37:01 -0700
+Subject: [PATCH] instal libgettextlib.a before removing it
+
+In a multiple job build, Makefile can simultaneously
+be installing and removing libgettextlib.a. We serialize
+the operations.
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater <jslater@windriver.com>
+
+---
+ gettext-tools/gnulib-lib/Makefile.am | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/gettext-tools/gnulib-lib/Makefile.am b/gettext-tools/gnulib-lib/Makefile.am
+index 2126699..d2dd7e4 100644
+--- a/gettext-tools/gnulib-lib/Makefile.am
++++ b/gettext-tools/gnulib-lib/Makefile.am
+@@ -58,6 +58,10 @@ endif
+ # Rules generated and collected by gnulib-tool.
+ include Makefile.gnulib
+
++# defined in Makefile.gnulib but missing this dependency
++#
++install-exec-clean: install-libLTLIBRARIES
++
+ # OS/2 does not support a DLL name longer than 8 characters.
+ if OS2
+ libgettextlib_la_LDFLAGS += -os2dllname gtlib
diff --git a/meta/recipes-core/gettext/gettext-0.21/run-ptest b/meta/recipes-core/gettext/gettext-0.21/run-ptest
new file mode 100644
index 0000000000..f17f3c87a7
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/run-ptest
@@ -0,0 +1,6 @@
+#!/bin/sh
+#
+#This script is used to run gettext test suites
+cd tests
+
+make -k runtest-TESTS top_srcdir=.. srcdir=. abs_srcdir=$PWD top_builddir=$PWD/../ abs_top_srcdir=$PWD/../ | cat
diff --git a/meta/recipes-core/gettext/gettext-0.21/serial-tests-config.patch b/meta/recipes-core/gettext/gettext-0.21/serial-tests-config.patch
new file mode 100644
index 0000000000..93f7c03334
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/serial-tests-config.patch
@@ -0,0 +1,56 @@
+From ed64a5724ef7d6eb4e9a876f817ea266a536e195 Mon Sep 17 00:00:00 2001
+From: "Hongjun.Yang" <hongjun.yang@windriver.com>
+Date: Thu, 28 Jul 2016 12:36:15 +0800
+Subject: [PATCH] fix for ptest
+
+Add serial-tests support, ptest need it
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+
+---
+ configure.ac | 2 +-
+ gettext-runtime/configure.ac | 2 +-
+ gettext-tools/configure.ac | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 38db6fd..f019ae0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -22,7 +22,7 @@ AC_INIT([gettext],
+ [bug-gettext@gnu.org])
+ AC_CONFIG_SRCDIR([gettext-tools/src/msgfmt.c])
+ AC_CONFIG_AUX_DIR([build-aux])
+-AM_INIT_AUTOMAKE([1.13 silent-rules parallel-tests tar-ustar])
++AM_INIT_AUTOMAKE([1.13 silent-rules serial-tests tar-ustar])
+
+ dnl Override automake's tar command used for creating distributions.
+ am__tar='${AMTAR} chf - --format=ustar --owner=root --group=root "$$tardir"'
+diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac
+index de203e7..138a07f 100644
+--- a/gettext-runtime/configure.ac
++++ b/gettext-runtime/configure.ac
+@@ -22,7 +22,7 @@ AC_INIT([gettext-runtime],
+ [bug-gettext@gnu.org])
+ AC_CONFIG_SRCDIR([intl/dcigettext.c])
+ AC_CONFIG_AUX_DIR([../build-aux])
+-AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
++AM_INIT_AUTOMAKE([1.11.1 silent-rules serial-tests])
+ AC_CONFIG_HEADERS([config.h])
+
+ dnl Installation directories.
+diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
+index cf1dd73..b544d6d 100644
+--- a/gettext-tools/configure.ac
++++ b/gettext-tools/configure.ac
+@@ -22,7 +22,7 @@ AC_INIT([gettext-tools],
+ [bug-gettext@gnu.org])
+ AC_CONFIG_SRCDIR([src/msgfmt.c])
+ AC_CONFIG_AUX_DIR([../build-aux])
+-AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
++AM_INIT_AUTOMAKE([1.11.1 silent-rules serial-tests])
+ AC_CONFIG_HEADERS([config.h])
+
+ dnl Installation directories.
diff --git a/meta/recipes-core/gettext/gettext-0.21/use-pkgconfig.patch b/meta/recipes-core/gettext/gettext-0.21/use-pkgconfig.patch
new file mode 100644
index 0000000000..fc77feb270
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.21/use-pkgconfig.patch
@@ -0,0 +1,699 @@
+From 15647f679834be633fb4a9aeff4671b9cb95ccb8 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Tue, 23 Jan 2018 00:54:13 +0000
+Subject: [PATCH] gettext: beat library detection into shape
+
+For reasons which I just can't fathom gnulib doesn't use the expected tools to
+find libraries but badly reinvents the wheel. This will trivially lead to host
+contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad
+canonicalisation resulting in relative paths).
+
+Simply delete all the crazy, and replace with a single call to pkg-config.
+
+Upstream-Status: Inappropriate [upstream still refuse to consider pkg-config]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+---
+ gettext-tools/gnulib-m4/libxml.m4 | 99 +----------------
+ .../gnulib-local/lib/term-styled-ostream.oo.c | 12 +--
+ libtextstyle/gnulib-local/m4/libcroco.m4 | 99 +++--------------
+ libtextstyle/gnulib-local/m4/libglib.m4 | 100 +++---------------
+ libtextstyle/gnulib-m4/libcroco.m4 | 99 +++--------------
+ libtextstyle/gnulib-m4/libglib.m4 | 100 +++---------------
+ libtextstyle/lib/term-styled-ostream.c | 12 +--
+ libtextstyle/lib/term-styled-ostream.oo.c | 12 +--
+ 8 files changed, 83 insertions(+), 450 deletions(-)
+
+diff --git a/gettext-tools/gnulib-m4/libxml.m4 b/gettext-tools/gnulib-m4/libxml.m4
+index 2f80c37..30ce58e 100644
+--- a/gettext-tools/gnulib-m4/libxml.m4
++++ b/gettext-tools/gnulib-m4/libxml.m4
+@@ -13,6 +13,7 @@ dnl gl_LIBXML(FORCE-INCLUDED)
+ dnl forces the use of the included or an external libxml.
+ AC_DEFUN([gl_LIBXML],
+ [
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ AC_REQUIRE([AM_ICONV_LINK])
+
+ ifelse([$1], , [
+@@ -30,100 +31,10 @@ AC_DEFUN([gl_LIBXML],
+ INCXML=
+ ifelse([$1], [yes], , [
+ if test "$gl_cv_libxml_use_included" != yes; then
+- dnl Figure out whether we can use a preinstalled libxml2, or have to use
+- dnl the included one.
+- AC_CACHE_VAL([gl_cv_libxml], [
+- gl_cv_libxml=no
+- gl_cv_LIBXML=
+- gl_cv_LTLIBXML=
+- gl_cv_INCXML=
+- gl_save_LIBS="$LIBS"
+- LIBS="$LIBS $LIBICONV"
+- dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2
+- dnl accordingly.
+- dnl Don't use xml2-config nor pkg-config, since it doesn't work when
+- dnl cross-compiling or when the C compiler in use is different from the
+- dnl one that built the library.
+- dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
+- dnl libxml2 is built in such a way that uses of xmlFree work fine with
+- dnl -Wl,--enable-auto-import but lead to a link error with
+- dnl -Wl,--disable-auto-import.
+- AC_LIB_LINKFLAGS_BODY([xml2])
+- LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
+- AC_TRY_LINK([#include <libxml/xmlversion.h>
+- #include <libxml/xmlmemory.h>
+- #include <libxml/xpath.h>
+- ],
+- [xmlCheckVersion (0);
+- xmlFree ((void *) 0);
+- xmlXPathSetContextNode ((void *)0, (void *)0);
+- ],
+- [gl_cv_libxml=yes
+- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
+- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
+- ])
+- if test "$gl_cv_libxml" != yes; then
+- gl_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCXML2"
+- AC_TRY_LINK([#include <libxml/xmlversion.h>
+- #include <libxml/xmlmemory.h>
+- #include <libxml/xpath.h>
+- ],
+- [xmlCheckVersion (0);
+- xmlFree ((void *) 0);
+- xmlXPathSetContextNode ((void *)0, (void *)0);
+- ],
+- [gl_cv_libxml=yes
+- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
+- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
+- gl_cv_INCXML="$INCXML2"
+- ])
+- if test "$gl_cv_libxml" != yes; then
+- dnl Often the include files are installed in /usr/include/libxml2.
+- dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained.
+- dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is
+- dnl self-contained.
+- libxml2_include_dir=
+- AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>],
+- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h])
+- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'`
+- ])
+- if test -z "$libxml2_include_dir"; then
+- AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>],
+- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h])
+- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'`
+- ])
+- fi
+- if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
+- CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
+- AC_TRY_LINK([#include <libxml/xmlversion.h>
+- #include <libxml/xmlmemory.h>
+- #include <libxml/xpath.h>
+- ],
+- [xmlCheckVersion (0);
+- xmlFree ((void *) 0);
+- xmlXPathSetContextNode ((void *)0, (void *)0);
+- ],
+- [gl_cv_libxml=yes
+- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
+- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
+- gl_cv_INCXML="-I$libxml2_include_dir"
+- ])
+- fi
+- fi
+- CPPFLAGS="$gl_save_CPPFLAGS"
+- fi
+- LIBS="$gl_save_LIBS"
+- ])
+- AC_MSG_CHECKING([for libxml])
+- AC_MSG_RESULT([$gl_cv_libxml])
+- if test $gl_cv_libxml = yes; then
+- LIBXML="$gl_cv_LIBXML"
+- LTLIBXML="$gl_cv_LTLIBXML"
+- INCXML="$gl_cv_INCXML"
+- else
+- gl_cv_libxml_use_included=yes
+- fi
++ PKG_CHECK_MODULES([XML], [libxml-2.0])
++ LIBXML=$XML_LIBS
++ LTLIBXML=$XML_LIBS
++ INCXML=$XML_CFLAGS
+ fi
+ ])
+ AC_SUBST([LIBXML])
+diff --git a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
+index 2ff978f..5ffb17a 100644
+--- a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
++++ b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
+@@ -22,15 +22,15 @@
+
+ #include <stdlib.h>
+
+-#include <cr-om-parser.h>
+-#include <cr-sel-eng.h>
+-#include <cr-style.h>
+-#include <cr-rgb.h>
++#include <libcroco/cr-om-parser.h>
++#include <libcroco/cr-sel-eng.h>
++#include <libcroco/cr-style.h>
++#include <libcroco/cr-rgb.h>
+ /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */
+ #ifndef __CR_FONTS_H__
+-# include <cr-fonts.h>
++# include <libcroco/cr-fonts.h>
+ #endif
+-#include <cr-string.h>
++#include <libcroco/cr-string.h>
+
+ #include "term-ostream.h"
+ #include "mem-hash-map.h"
+diff --git a/libtextstyle/gnulib-local/m4/libcroco.m4 b/libtextstyle/gnulib-local/m4/libcroco.m4
+index bc53cc6..10b2455 100644
+--- a/libtextstyle/gnulib-local/m4/libcroco.m4
++++ b/libtextstyle/gnulib-local/m4/libcroco.m4
+@@ -1,99 +1,34 @@
+-# libcroco.m4 serial 3
+-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
++# libcroco.m4 serial 2 (gettext-0.17)
++dnl Copyright (C) 2006, 2015-2016 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Bruno Haible.
+
+-dnl gl_LIBCROCO
+-dnl gives the user the option to decide whether to use the included or
+-dnl an external libcroco.
+-dnl gl_LIBCROCO(FORCE-INCLUDED)
+-dnl forces the use of the included or an external libcroco.
+ AC_DEFUN([gl_LIBCROCO],
+ [
+- ifelse([$1], [yes], , [
+- dnl libcroco depends on libglib.
+- AC_REQUIRE([gl_LIBGLIB])
+- ])
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++ dnl libcroco depends on libglib.
++ AC_REQUIRE([gl_LIBGLIB])
+
+- ifelse([$1], , [
+- AC_MSG_CHECKING([whether included libcroco is requested])
+- AC_ARG_WITH([included-libcroco],
+- [ --with-included-libcroco use the libcroco included here],
+- [gl_cv_libcroco_force_included=$withval],
+- [gl_cv_libcroco_force_included=no])
+- AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+- ], [gl_cv_libcroco_force_included=$1])
++ AC_MSG_CHECKING([whether included libcroco is requested])
++ AC_ARG_WITH([included-libcroco],
++ [ --with-included-libcroco use the libcroco included here],
++ [gl_cv_libcroco_force_included=$withval],
++ [gl_cv_libcroco_force_included=no])
++ AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+
+ gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included"
+ LIBCROCO=
+ LTLIBCROCO=
+ INCCROCO=
+- ifelse([$1], [yes], , [
+- if test "$gl_cv_libcroco_use_included" != yes; then
+- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
+- dnl use the included one.
+- AC_CACHE_VAL([gl_cv_libcroco], [
+- gl_cv_libcroco=no
+- gl_cv_LIBCROCO=
+- gl_cv_LTLIBCROCO=
+- gl_cv_INCCROCO=
+- gl_save_LIBS="$LIBS"
+- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
+- dnl INCCROCO_0_6 accordingly.
+- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
+- dnl cross-compiling or when the C compiler in use is different from the
+- dnl one that built the library.
+- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
+- LIBS="$gl_save_LIBS $LIBCROCO_0_6"
+- AC_TRY_LINK([#include <libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- ])
+- if test "$gl_cv_libcroco" != yes; then
+- gl_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
+- AC_TRY_LINK([#include <libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- gl_cv_INCCROCO="$INCCROCO_0_6"
+- ])
+- if test "$gl_cv_libcroco" != yes; then
+- dnl Often the include files are installed in
+- dnl /usr/include/libcroco-0.6/libcroco.
+- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
+- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
+- if test -d "$libcroco_include_dir"; then
+- gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- gl_cv_INCCROCO="-I$libcroco_include_dir"
+- fi
+- ])
+- fi
+- CPPFLAGS="$gl_save_CPPFLAGS"
+- fi
+- LIBS="$gl_save_LIBS"
+- ])
+- AC_MSG_CHECKING([for libcroco])
+- AC_MSG_RESULT([$gl_cv_libcroco])
+- if test $gl_cv_libcroco = yes; then
+- LIBCROCO="$gl_cv_LIBCROCO"
+- LTLIBCROCO="$gl_cv_LTLIBCROCO"
+- INCCROCO="$gl_cv_INCCROCO"
+- else
+- gl_cv_libcroco_use_included=yes
+- fi
+- fi
+- ])
++ if test "$gl_cv_libcroco_use_included" != yes; then
++ PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
++ LIBCROCO=$CROCO_LIBS
++ LTLIBCROCO=$CROCO_LIBS
++ INCCROCO=$CROCO_CFLAGS
++ fi
+ AC_SUBST([LIBCROCO])
+ AC_SUBST([LTLIBCROCO])
+ AC_SUBST([INCCROCO])
+diff --git a/libtextstyle/gnulib-local/m4/libglib.m4 b/libtextstyle/gnulib-local/m4/libglib.m4
+index 5853772..767fba2 100644
+--- a/libtextstyle/gnulib-local/m4/libglib.m4
++++ b/libtextstyle/gnulib-local/m4/libglib.m4
+@@ -6,100 +6,26 @@ dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Bruno Haible.
+
+-dnl gl_LIBGLIB
+-dnl gives the user the option to decide whether to use the included or
+-dnl an external libglib.
+-dnl gl_LIBGLIB(FORCE-INCLUDED)
+-dnl forces the use of the included or an external libglib.
+ AC_DEFUN([gl_LIBGLIB],
+ [
+- ifelse([$1], , [
+- AC_MSG_CHECKING([whether included glib is requested])
+- AC_ARG_WITH([included-glib],
+- [ --with-included-glib use the glib2 included here],
+- [gl_cv_libglib_force_included=$withval],
+- [gl_cv_libglib_force_included=no])
+- AC_MSG_RESULT([$gl_cv_libglib_force_included])
+- ], [gl_cv_libglib_force_included=$1])
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++ AC_MSG_CHECKING([whether included glib is requested])
++ AC_ARG_WITH([included-glib],
++ [ --with-included-glib use the glib2 included here],
++ [gl_cv_libglib_force_included=$withval],
++ [gl_cv_libglib_force_included=no])
++ AC_MSG_RESULT([$gl_cv_libglib_force_included])
+
+ gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
+ LIBGLIB=
+ LTLIBGLIB=
+ INCGLIB=
+- ifelse([$1], [yes], , [
+- if test "$gl_cv_libglib_use_included" != yes; then
+- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
+- dnl the included one.
+- AC_CACHE_VAL([gl_cv_libglib], [
+- gl_cv_libglib=no
+- gl_cv_LIBGLIB=
+- gl_cv_LTLIBGLIB=
+- gl_cv_INCGLIB=
+- gl_save_LIBS="$LIBS"
+- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
+- dnl INCGLIB_2_0 accordingly.
+- dnl Don't use glib-config nor pkg-config, since it doesn't work when
+- dnl cross-compiling or when the C compiler in use is different from the
+- dnl one that built the library.
+- AC_LIB_LINKFLAGS_BODY([glib-2.0])
+- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- ])
+- if test "$gl_cv_libglib" != yes; then
+- gl_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- gl_cv_INCGLIB="$INCGLIB_2_0"
+- ])
+- if test "$gl_cv_libglib" != yes; then
+- dnl Often the include files are installed in /usr/include/glib-2.0
+- dnl and /usr/lib/glib-2.0/include.
+- if test -n "$LIBGLIB_2_0_PREFIX"; then
+- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
+- ])
+- fi
+- fi
+- CPPFLAGS="$gl_save_CPPFLAGS"
+- fi
+- LIBS="$gl_save_LIBS"
+- ])
+- AC_MSG_CHECKING([for glib])
+- AC_MSG_RESULT([$gl_cv_libglib])
+- if test $gl_cv_libglib = yes; then
+- LIBGLIB="$gl_cv_LIBGLIB"
+- LTLIBGLIB="$gl_cv_LTLIBGLIB"
+- INCGLIB="$gl_cv_INCGLIB"
+- else
+- gl_cv_libglib_use_included=yes
+- fi
+- fi
+- ])
++ if test "$gl_cv_libglib_use_included" != yes; then
++ PKG_CHECK_MODULES([GLIB], [glib-2.0])
++ LIBGLIB="$GLIB_LIBS"
++ LTLIBGLIB="$GLIB_LIBS"
++ INCGLIB="$GLIB_CFLAGS"
++ fi
+ AC_SUBST([LIBGLIB])
+ AC_SUBST([LTLIBGLIB])
+ AC_SUBST([INCGLIB])
+diff --git a/libtextstyle/gnulib-m4/libcroco.m4 b/libtextstyle/gnulib-m4/libcroco.m4
+index bc53cc6..10b2455 100644
+--- a/libtextstyle/gnulib-m4/libcroco.m4
++++ b/libtextstyle/gnulib-m4/libcroco.m4
+@@ -1,99 +1,34 @@
+-# libcroco.m4 serial 3
+-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
++# libcroco.m4 serial 2 (gettext-0.17)
++dnl Copyright (C) 2006, 2015-2016 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+ dnl gives unlimited permission to copy and/or distribute it,
+ dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Bruno Haible.
+
+-dnl gl_LIBCROCO
+-dnl gives the user the option to decide whether to use the included or
+-dnl an external libcroco.
+-dnl gl_LIBCROCO(FORCE-INCLUDED)
+-dnl forces the use of the included or an external libcroco.
+ AC_DEFUN([gl_LIBCROCO],
+ [
+- ifelse([$1], [yes], , [
+- dnl libcroco depends on libglib.
+- AC_REQUIRE([gl_LIBGLIB])
+- ])
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++ dnl libcroco depends on libglib.
++ AC_REQUIRE([gl_LIBGLIB])
+
+- ifelse([$1], , [
+- AC_MSG_CHECKING([whether included libcroco is requested])
+- AC_ARG_WITH([included-libcroco],
+- [ --with-included-libcroco use the libcroco included here],
+- [gl_cv_libcroco_force_included=$withval],
+- [gl_cv_libcroco_force_included=no])
+- AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+- ], [gl_cv_libcroco_force_included=$1])
++ AC_MSG_CHECKING([whether included libcroco is requested])
++ AC_ARG_WITH([included-libcroco],
++ [ --with-included-libcroco use the libcroco included here],
++ [gl_cv_libcroco_force_included=$withval],
++ [gl_cv_libcroco_force_included=no])
++ AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+
+ gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included"
+ LIBCROCO=
+ LTLIBCROCO=
+ INCCROCO=
+- ifelse([$1], [yes], , [
+- if test "$gl_cv_libcroco_use_included" != yes; then
+- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
+- dnl use the included one.
+- AC_CACHE_VAL([gl_cv_libcroco], [
+- gl_cv_libcroco=no
+- gl_cv_LIBCROCO=
+- gl_cv_LTLIBCROCO=
+- gl_cv_INCCROCO=
+- gl_save_LIBS="$LIBS"
+- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
+- dnl INCCROCO_0_6 accordingly.
+- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
+- dnl cross-compiling or when the C compiler in use is different from the
+- dnl one that built the library.
+- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
+- LIBS="$gl_save_LIBS $LIBCROCO_0_6"
+- AC_TRY_LINK([#include <libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- ])
+- if test "$gl_cv_libcroco" != yes; then
+- gl_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
+- AC_TRY_LINK([#include <libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- gl_cv_INCCROCO="$INCCROCO_0_6"
+- ])
+- if test "$gl_cv_libcroco" != yes; then
+- dnl Often the include files are installed in
+- dnl /usr/include/libcroco-0.6/libcroco.
+- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
+- [const char *version = LIBCROCO_VERSION; return !version;],
+- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
+- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
+- if test -d "$libcroco_include_dir"; then
+- gl_cv_libcroco=yes
+- gl_cv_LIBCROCO="$LIBCROCO_0_6"
+- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+- gl_cv_INCCROCO="-I$libcroco_include_dir"
+- fi
+- ])
+- fi
+- CPPFLAGS="$gl_save_CPPFLAGS"
+- fi
+- LIBS="$gl_save_LIBS"
+- ])
+- AC_MSG_CHECKING([for libcroco])
+- AC_MSG_RESULT([$gl_cv_libcroco])
+- if test $gl_cv_libcroco = yes; then
+- LIBCROCO="$gl_cv_LIBCROCO"
+- LTLIBCROCO="$gl_cv_LTLIBCROCO"
+- INCCROCO="$gl_cv_INCCROCO"
+- else
+- gl_cv_libcroco_use_included=yes
+- fi
+- fi
+- ])
++ if test "$gl_cv_libcroco_use_included" != yes; then
++ PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
++ LIBCROCO=$CROCO_LIBS
++ LTLIBCROCO=$CROCO_LIBS
++ INCCROCO=$CROCO_CFLAGS
++ fi
+ AC_SUBST([LIBCROCO])
+ AC_SUBST([LTLIBCROCO])
+ AC_SUBST([INCCROCO])
+diff --git a/libtextstyle/gnulib-m4/libglib.m4 b/libtextstyle/gnulib-m4/libglib.m4
+index 5853772..767fba2 100644
+--- a/libtextstyle/gnulib-m4/libglib.m4
++++ b/libtextstyle/gnulib-m4/libglib.m4
+@@ -6,100 +6,26 @@ dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Bruno Haible.
+
+-dnl gl_LIBGLIB
+-dnl gives the user the option to decide whether to use the included or
+-dnl an external libglib.
+-dnl gl_LIBGLIB(FORCE-INCLUDED)
+-dnl forces the use of the included or an external libglib.
+ AC_DEFUN([gl_LIBGLIB],
+ [
+- ifelse([$1], , [
+- AC_MSG_CHECKING([whether included glib is requested])
+- AC_ARG_WITH([included-glib],
+- [ --with-included-glib use the glib2 included here],
+- [gl_cv_libglib_force_included=$withval],
+- [gl_cv_libglib_force_included=no])
+- AC_MSG_RESULT([$gl_cv_libglib_force_included])
+- ], [gl_cv_libglib_force_included=$1])
++ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++ AC_MSG_CHECKING([whether included glib is requested])
++ AC_ARG_WITH([included-glib],
++ [ --with-included-glib use the glib2 included here],
++ [gl_cv_libglib_force_included=$withval],
++ [gl_cv_libglib_force_included=no])
++ AC_MSG_RESULT([$gl_cv_libglib_force_included])
+
+ gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
+ LIBGLIB=
+ LTLIBGLIB=
+ INCGLIB=
+- ifelse([$1], [yes], , [
+- if test "$gl_cv_libglib_use_included" != yes; then
+- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
+- dnl the included one.
+- AC_CACHE_VAL([gl_cv_libglib], [
+- gl_cv_libglib=no
+- gl_cv_LIBGLIB=
+- gl_cv_LTLIBGLIB=
+- gl_cv_INCGLIB=
+- gl_save_LIBS="$LIBS"
+- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
+- dnl INCGLIB_2_0 accordingly.
+- dnl Don't use glib-config nor pkg-config, since it doesn't work when
+- dnl cross-compiling or when the C compiler in use is different from the
+- dnl one that built the library.
+- AC_LIB_LINKFLAGS_BODY([glib-2.0])
+- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- ])
+- if test "$gl_cv_libglib" != yes; then
+- gl_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- gl_cv_INCGLIB="$INCGLIB_2_0"
+- ])
+- if test "$gl_cv_libglib" != yes; then
+- dnl Often the include files are installed in /usr/include/glib-2.0
+- dnl and /usr/lib/glib-2.0/include.
+- if test -n "$LIBGLIB_2_0_PREFIX"; then
+- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
+- AC_TRY_LINK([#include <glib.h>
+-#ifndef G_BEGIN_DECLS
+-error this glib.h includes a glibconfig.h from a glib version 1.x
+-#endif
+-],
+- [g_string_new ("foo");],
+- [gl_cv_libglib=yes
+- gl_cv_LIBGLIB="$LIBGLIB_2_0"
+- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
+- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
+- ])
+- fi
+- fi
+- CPPFLAGS="$gl_save_CPPFLAGS"
+- fi
+- LIBS="$gl_save_LIBS"
+- ])
+- AC_MSG_CHECKING([for glib])
+- AC_MSG_RESULT([$gl_cv_libglib])
+- if test $gl_cv_libglib = yes; then
+- LIBGLIB="$gl_cv_LIBGLIB"
+- LTLIBGLIB="$gl_cv_LTLIBGLIB"
+- INCGLIB="$gl_cv_INCGLIB"
+- else
+- gl_cv_libglib_use_included=yes
+- fi
+- fi
+- ])
++ if test "$gl_cv_libglib_use_included" != yes; then
++ PKG_CHECK_MODULES([GLIB], [glib-2.0])
++ LIBGLIB="$GLIB_LIBS"
++ LTLIBGLIB="$GLIB_LIBS"
++ INCGLIB="$GLIB_CFLAGS"
++ fi
+ AC_SUBST([LIBGLIB])
+ AC_SUBST([LTLIBGLIB])
+ AC_SUBST([INCGLIB])
+diff --git a/libtextstyle/lib/term-styled-ostream.c b/libtextstyle/lib/term-styled-ostream.c
+index 5484800..16793fa 100644
+--- a/libtextstyle/lib/term-styled-ostream.c
++++ b/libtextstyle/lib/term-styled-ostream.c
+@@ -28,15 +28,15 @@
+
+ #include <stdlib.h>
+
+-#include <cr-om-parser.h>
+-#include <cr-sel-eng.h>
+-#include <cr-style.h>
+-#include <cr-rgb.h>
++#include <libcroco/cr-om-parser.h>
++#include <libcroco/cr-sel-eng.h>
++#include <libcroco/cr-style.h>
++#include <libcroco/cr-rgb.h>
+ /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */
+ #ifndef __CR_FONTS_H__
+-# include <cr-fonts.h>
++# include <libcroco/cr-fonts.h>
+ #endif
+-#include <cr-string.h>
++#include <libcroco/cr-string.h>
+
+ #include "term-ostream.h"
+ #include "mem-hash-map.h"
+diff --git a/libtextstyle/lib/term-styled-ostream.oo.c b/libtextstyle/lib/term-styled-ostream.oo.c
+index 2ff978f..5ffb17a 100644
+--- a/libtextstyle/lib/term-styled-ostream.oo.c
++++ b/libtextstyle/lib/term-styled-ostream.oo.c
+@@ -22,15 +22,15 @@
+
+ #include <stdlib.h>
+
+-#include <cr-om-parser.h>
+-#include <cr-sel-eng.h>
+-#include <cr-style.h>
+-#include <cr-rgb.h>
++#include <libcroco/cr-om-parser.h>
++#include <libcroco/cr-sel-eng.h>
++#include <libcroco/cr-style.h>
++#include <libcroco/cr-rgb.h>
+ /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */
+ #ifndef __CR_FONTS_H__
+-# include <cr-fonts.h>
++# include <libcroco/cr-fonts.h>
+ #endif
+-#include <cr-string.h>
++#include <libcroco/cr-string.h>
+
+ #include "term-ostream.h"
+ #include "mem-hash-map.h"
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/0001-PATCH-Disable-the-test-to-convert-euc-jp.patch b/meta/recipes-core/gettext/gettext-minimal-0.19.4/0001-PATCH-Disable-the-test-to-convert-euc-jp.patch
deleted file mode 100644
index 29ef2a5a63..0000000000
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/0001-PATCH-Disable-the-test-to-convert-euc-jp.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-[PATCH] Disable the test to convert euc-jp
-
-Remove the test "Test against HP-UX 11.11 bug:
-No converter from EUC-JP to UTF-8 is provided"
-since we don't support HP-UX and if the euc-jp is not
-installed on the host, the dependence will be built without
-iconv support and will cause guile-native building fail.
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Roy Li <rongqing.li@windriver.com>
----
- iconv.m4 | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/iconv.m4 b/iconv.m4
-index 4e37363..35f54bd 100644
---- a/iconv.m4
-+++ b/iconv.m4
-@@ -165,6 +165,7 @@ AC_DEFUN([AM_ICONV_LINK],
- }
- }
- #endif
-+#if 0
- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
- provided. */
- if (/* Try standardized names. */
-@@ -176,6 +177,7 @@ AC_DEFUN([AM_ICONV_LINK],
- /* Try HP-UX names. */
- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
- result |= 16;
-+#endif
- return result;
- ]])],
- [am_cv_func_iconv_works=yes], ,
---
-2.0.1
-
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz b/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz
deleted file mode 100644
index b04ba55032..0000000000
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/aclocal.tgz
+++ /dev/null
Binary files differ
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING b/meta/recipes-core/gettext/gettext-minimal-0.21/COPYING
index 8d11d1d8e9..3671ab6985 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/COPYING
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/COPYING
@@ -1,4 +1,4 @@
-dnl Copyright (C) 1995-2014 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in b/meta/recipes-core/gettext/gettext-minimal-0.21/Makefile.in.in
index 8906ba0ff1..6b25f0d916 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/Makefile.in.in
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/Makefile.in.in
@@ -1,15 +1,14 @@
# Makefile for PO directory in any package using GNU gettext.
-# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
+# Copyright (C) 1995-2000 Ulrich Drepper <drepper@gnu.ai.mit.edu>
+# Copyright (C) 2000-2020 Free Software Foundation, Inc.
#
-# This file can be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU General Public
-# License but which still want to provide support for the GNU gettext
-# functionality.
-# Please note that the actual code of GNU gettext is covered by the GNU
-# General Public License and is *not* in the public domain.
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
#
-# Origin: gettext-0.19
-GETTEXT_MACRO_VERSION = 0.19
+# Origin: gettext-0.21
+GETTEXT_MACRO_VERSION = 0.20
PACKAGE = @PACKAGE@
VERSION = @VERSION@
@@ -33,22 +32,34 @@ gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
+# We use $(mkdir_p).
+# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
+# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
+# @install_sh@ does not start with $(SHELL), so we add it.
+# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
+# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
+# versions, $(mkinstalldirs) and $(install_sh) are unused.
+mkinstalldirs = $(SHELL) @install_sh@ -d
+install_sh = $(SHELL) @install_sh@
MKDIR_P = @MKDIR_P@
+mkdir_p = @mkdir_p@
+
+# When building gettext-tools, we prefer to use the built programs
+# rather than installed programs. However, we can't do that when we
+# are cross compiling.
+CROSS_COMPILING = @CROSS_COMPILING@
GMSGFMT_ = @GMSGFMT@
GMSGFMT_no = @GMSGFMT@
GMSGFMT_yes = @GMSGFMT_015@
GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
-MSGFMT_ = @MSGFMT@
-MSGFMT_no = @MSGFMT@
-MSGFMT_yes = @MSGFMT_015@
-MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
XGETTEXT_ = @XGETTEXT@
XGETTEXT_no = @XGETTEXT@
XGETTEXT_yes = @XGETTEXT_015@
XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
-MSGMERGE = msgmerge
+MSGMERGE = @MSGMERGE@
MSGMERGE_UPDATE = @MSGMERGE@ --update
+MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
@@ -79,27 +90,44 @@ DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
# Makevars gets inserted here. (Don't remove this line!)
-.SUFFIXES:
-.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
+all: all-@USE_NLS@
-.po.mo:
- @echo "$(MSGFMT) -c -o $@ $<"; \
- $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
+.SUFFIXES:
+.SUFFIXES: .po .gmo .sed .sin .nop .po-create .po-update
+
+# The .pot file, stamp-po, .po files, and .gmo files appear in release tarballs.
+# The GNU Coding Standards say in
+# <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>:
+# "GNU distributions usually contain some files which are not source files
+# ... . Since these files normally appear in the source directory, they
+# should always appear in the source directory, not in the build directory.
+# So Makefile rules to update them should put the updated files in the
+# source directory."
+# Therefore we put these files in the source directory, not the build directory.
+
+# During .po -> .gmo conversion, take into account the most recent changes to
+# the .pot file. This eliminates the need to update the .po files when the
+# .pot file has changed, which would be troublesome if the .po files are put
+# under version control.
+$(GMOFILES): $(srcdir)/$(DOMAIN).pot
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
- echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
- cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+ echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
+ cd $(srcdir) && \
+ rm -f $${lang}.gmo && \
+ $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && \
+ $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.1po && \
+ mv t-$${lang}.gmo $${lang}.gmo && \
+ rm -f $${lang}.1po
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
-all: all-@USE_NLS@
-
-all-yes: stamp-po
+all-yes: $(srcdir)/stamp-po
all-no:
# Ensure that the gettext macros and this Makefile.in.in are in sync.
@@ -113,24 +141,24 @@ CHECK_MACRO_VERSION = \
# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
# we don't want to bother translators with empty POT files). We assume that
# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
-# In this case, stamp-po is a nop (i.e. a phony target).
-
-# stamp-po is a timestamp denoting the last time at which the CATALOGS have
-# been loosely updated. Its purpose is that when a developer or translator
-# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
-# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
-# invocations of "make" will do nothing. This timestamp would not be necessary
-# if updating the $(CATALOGS) would always touch them; however, the rule for
-# $(POFILES) has been designed to not touch files that don't need to be
-# changed.
-stamp-po: $(srcdir)/$(DOMAIN).pot
+# In this case, $(srcdir)/stamp-po is a nop (i.e. a phony target).
+
+# $(srcdir)/stamp-po is a timestamp denoting the last time at which the CATALOGS
+# have been loosely updated. Its purpose is that when a developer or translator
+# checks out the package from a version control system, and the $(DOMAIN).pot
+# file is not under version control, "make" will update the $(DOMAIN).pot and
+# the $(CATALOGS), but subsequent invocations of "make" will do nothing. This
+# timestamp would not be necessary if updating the $(CATALOGS) would always
+# touch them; however, the rule for $(POFILES) has been designed to not touch
+# files that don't need to be changed.
+$(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
@$(CHECK_MACRO_VERSION)
test ! -f $(srcdir)/$(DOMAIN).pot || \
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
- echo "touch stamp-po" && \
- echo timestamp > stamp-poT && \
- mv stamp-poT stamp-po; \
+ echo "touch $(srcdir)/stamp-po" && \
+ echo timestamp > $(srcdir)/stamp-poT && \
+ mv $(srcdir)/stamp-poT $(srcdir)/stamp-po; \
}
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
@@ -146,11 +174,9 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
package_gnu="$(PACKAGE_GNU)"; \
test -n "$$package_gnu" || { \
if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
- LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f \
- -size -10000000c -exec grep 'GNU @PACKAGE@' \
- /dev/null '{}' ';' 2>/dev/null; \
+ LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep -i 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
else \
- LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
+ LC_ALL=C grep -i 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
fi; \
} | grep -v 'libtool:' >/dev/null; then \
package_gnu=yes; \
@@ -171,22 +197,30 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
- --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+ --add-comments=TRANSLATORS: \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address="$$msgid_bugs_address" \
+ $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
;; \
*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
- --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
+ --add-comments=TRANSLATORS: \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--package-name="$${package_prefix}@PACKAGE@" \
--package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \
+ $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
;; \
esac
test ! -f $(DOMAIN).po || { \
+ if test -f $(srcdir)/$(DOMAIN).pot-header; then \
+ sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \
+ cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po && \
+ rm -f $(DOMAIN).1po \
+ || exit 1; \
+ fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
@@ -210,17 +244,19 @@ $(srcdir)/$(DOMAIN).pot:
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(POFILESDEPS)
+ @test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
- test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
- echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
+ echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
- '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
+ 0.1[6-7] | 0.1[6-7].*) \
+ $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \
*) \
- $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
+ $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \
esac; \
}; \
else \
@@ -232,7 +268,7 @@ install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
- $(MKDIR_P) $(DESTDIR)$(gettextsrcdir); \
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
for file in $(DISTFILES.common) Makevars.template; do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(DESTDIR)$(gettextsrcdir)/$$file; \
@@ -250,7 +286,7 @@ install-data-yes: all
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
- $(MKDIR_P) $(DESTDIR)$$dir; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
@@ -290,7 +326,7 @@ installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
- $(MKDIR_P) $(DESTDIR)$(gettextsrcdir); \
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
else \
: ; \
fi
@@ -301,7 +337,7 @@ installdirs-data-yes:
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
- $(MKDIR_P) $(DESTDIR)$$dir; \
+ $(mkdir_p) $(DESTDIR)$$dir; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
@@ -355,34 +391,41 @@ check: all
info dvi ps pdf html tags TAGS ctags CTAGS ID:
+install-dvi install-ps install-pdf install-html:
+
mostlyclean:
rm -f remove-potcdate.sed
- rm -f stamp-poT
+ rm -f $(srcdir)/stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -fr *.o
clean: mostlyclean
distclean: clean
- rm -f Makefile Makefile.in POTFILES *.mo
+ rm -f Makefile Makefile.in POTFILES
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
- rm -f stamp-po $(GMOFILES)
+ rm -f $(srcdir)/$(DOMAIN).pot $(srcdir)/stamp-po $(GMOFILES)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
-dist2: stamp-po $(DISTFILES)
- dists="$(DISTFILES)"; \
+dist2: $(srcdir)/stamp-po $(DISTFILES)
+ @dists="$(DISTFILES)"; \
if test "$(PACKAGE)" = "gettext-tools"; then \
dists="$$dists Makevars.template"; \
fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
dists="$$dists $(DOMAIN).pot stamp-po"; \
+ else \
+ case $(XGETTEXT) in \
+ :) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because a suitable 'xgettext' program was not found in PATH." 1>&2;; \
+ *) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because 'xgettext' found no strings to extract. Check the contents of the POTFILES.in file and the XGETTEXT_OPTIONS in the Makevars file." 1>&2;; \
+ esac; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
@@ -417,17 +460,19 @@ update-po: Makefile
.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
- if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
+ if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
- echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
+ echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
- '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+ 0.1[6-7] | 0.1[6-7].*) \
+ $(MSGMERGE) $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
*) \
- $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
+ $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
esac; \
}; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/gettext.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/gettext.m4
new file mode 100644
index 0000000000..4f25a27d93
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/gettext.m4
@@ -0,0 +1,386 @@
+# gettext.m4 serial 71 (gettext-0.20.2)
+dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
+dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
+dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
+dnl If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl depending on --{enable,disable}-{shared,static} and on the presence of
+dnl AM-DISABLE-SHARED).
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl implementations (in libc or libintl) without the ngettext() function
+dnl will be ignored. If NEEDSYMBOL is specified and is
+dnl 'need-formatstring-macros', then GNU gettext implementations that don't
+dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries. If empty,
+dnl the value '$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl and used.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl Catalog format: none
+dnl Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+ dnl Argument checking.
+ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [use-libtool], ,
+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])
+ ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
+ [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
+])])
+ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+ define([gt_included_intl],
+ ifelse([$1], [external], [no], [yes]))
+ gt_NEEDS_INIT
+ AM_GNU_GETTEXT_NEED([$2])
+
+ AC_REQUIRE([AM_PO_SUBDIRS])dnl
+ ifelse(gt_included_intl, yes, [
+ AC_REQUIRE([AM_INTL_SUBDIR])dnl
+ ])
+
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ dnl Ideally we would do this search only after the
+ dnl if test "$USE_NLS" = "yes"; then
+ dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+ dnl the configure script would need to contain the same shell code
+ dnl again, outside any 'if'. There are two solutions:
+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+ dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
+ ifelse(gt_included_intl, yes, , [
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+ ])
+
+ dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
+ gt_INTL_MACOSX
+
+ dnl Set USE_NLS.
+ AC_REQUIRE([AM_NLS])
+
+ ifelse(gt_included_intl, yes, [
+ BUILD_INCLUDED_LIBINTL=no
+ USE_INCLUDED_LIBINTL=no
+ ])
+ LIBINTL=
+ LTLIBINTL=
+ POSUB=
+
+ dnl Add a version number to the cache macros.
+ case " $gt_needs " in
+ *" need-formatstring-macros "*) gt_api_version=3 ;;
+ *" need-ngettext "*) gt_api_version=2 ;;
+ *) gt_api_version=1 ;;
+ esac
+ gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
+ gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ gt_use_preinstalled_gnugettext=no
+ ifelse(gt_included_intl, yes, [
+ AC_MSG_CHECKING([whether included gettext is requested])
+ AC_ARG_WITH([included-gettext],
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+ AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ ])
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If GNU gettext is available we use this. Else we have
+ dnl to fall back to GNU NLS library.
+
+ if test $gt_api_version -ge 3; then
+ gt_revision_test_code='
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+'
+ else
+ gt_revision_test_code=
+ fi
+ if test $gt_api_version -ge 2; then
+ gt_expression_test_code=' + * ngettext ("", "", 0)'
+ else
+ gt_expression_test_code=
+ fi
+
+ AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings)
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
+$gt_revision_test_code
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
+ ]])],
+ [eval "$gt_func_gnugettext_libc=yes"],
+ [eval "$gt_func_gnugettext_libc=no"])])
+
+ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ ifelse(gt_included_intl, yes, , [
+ AM_ICONV_LINK
+ ])
+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+ dnl even if libiconv doesn't exist.
+ AC_LIB_LINKFLAGS_BODY([intl])
+ AC_CACHE_CHECK([for GNU gettext in libintl],
+ [$gt_func_gnugettext_libintl],
+ [gt_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCINTL"
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBINTL"
+ dnl Now see whether libintl exists and does not depend on libiconv.
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
+$gt_revision_test_code
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
+ ]])],
+ [eval "$gt_func_gnugettext_libintl=yes"],
+ [eval "$gt_func_gnugettext_libintl=no"])
+ dnl Now see whether libintl exists and depends on libiconv.
+ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+ LIBS="$LIBS $LIBICONV"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <libintl.h>
+#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias (const char *);
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
+#else
+#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+#endif
+$gt_revision_test_code
+ ]],
+ [[
+bindtextdomain ("", "");
+return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
+ ]])],
+ [LIBINTL="$LIBINTL $LIBICONV"
+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+ eval "$gt_func_gnugettext_libintl=yes"
+ ])
+ fi
+ CPPFLAGS="$gt_save_CPPFLAGS"
+ LIBS="$gt_save_LIBS"])
+ fi
+
+ dnl If an already present or preinstalled GNU gettext() is found,
+ dnl use it. But if this macro is used in GNU gettext, and GNU
+ dnl gettext is already preinstalled in libintl, we update this
+ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
+ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
+ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+ && test "$PACKAGE" != gettext-runtime \
+ && test "$PACKAGE" != gettext-tools; }; then
+ gt_use_preinstalled_gnugettext=yes
+ else
+ dnl Reset the values set by searching for libintl.
+ LIBINTL=
+ LTLIBINTL=
+ INCINTL=
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+ dnl GNU gettext is not found in the C library.
+ dnl Fall back on included GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions used to generate GNU NLS library.
+ BUILD_INCLUDED_LIBINTL=yes
+ USE_INCLUDED_LIBINTL=yes
+ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
+ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+ fi
+
+ CATOBJEXT=
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions to use GNU gettext tools.
+ CATOBJEXT=.gmo
+ fi
+ ])
+
+ if test -n "$INTL_MACOSX_LIBS"; then
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Some extra flags are needed during linking.
+ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
+ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
+ fi
+ fi
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ AC_DEFINE([ENABLE_NLS], [1],
+ [Define to 1 if translation of program messages to the user's native language
+ is requested.])
+ else
+ USE_NLS=no
+ fi
+ fi
+
+ AC_MSG_CHECKING([whether to use NLS])
+ AC_MSG_RESULT([$USE_NLS])
+ if test "$USE_NLS" = "yes"; then
+ AC_MSG_CHECKING([where the gettext function comes from])
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ gt_source="external libintl"
+ else
+ gt_source="libc"
+ fi
+ else
+ gt_source="included intl directory"
+ fi
+ AC_MSG_RESULT([$gt_source])
+ fi
+
+ if test "$USE_NLS" = "yes"; then
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ AC_MSG_CHECKING([how to link with libintl])
+ AC_MSG_RESULT([$LIBINTL])
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+ fi
+
+ dnl For backward compatibility. Some packages may be using this.
+ AC_DEFINE([HAVE_GETTEXT], [1],
+ [Define if the GNU gettext() function is already present or preinstalled.])
+ AC_DEFINE([HAVE_DCGETTEXT], [1],
+ [Define if the GNU dcgettext() function is already present or preinstalled.])
+ fi
+
+ dnl We need to process the po/ directory.
+ POSUB=po
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
+ dnl because some of the testsuite requires it.
+ BUILD_INCLUDED_LIBINTL=yes
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST([BUILD_INCLUDED_LIBINTL])
+ AC_SUBST([USE_INCLUDED_LIBINTL])
+ AC_SUBST([CATOBJEXT])
+ ])
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INTLLIBS="$LIBINTL"
+ AC_SUBST([INTLLIBS])
+
+ dnl Make all documented variables known to autoconf.
+ AC_SUBST([LIBINTL])
+ AC_SUBST([LTLIBINTL])
+ AC_SUBST([POSUB])
+])
+
+
+dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
+m4_define([gt_NEEDS_INIT],
+[
+ m4_divert_text([DEFAULTS], [gt_needs=])
+ m4_define([gt_NEEDS_INIT], [])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
+AC_DEFUN([AM_GNU_GETTEXT_NEED],
+[
+ m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
+
+
+dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/host-cpu-c-abi.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/host-cpu-c-abi.m4
new file mode 100644
index 0000000000..6db2aa25ae
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/host-cpu-c-abi.m4
@@ -0,0 +1,675 @@
+# host-cpu-c-abi.m4 serial 13
+dnl Copyright (C) 2002-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible and Sam Steingold.
+
+dnl Sets the HOST_CPU variable to the canonical name of the CPU.
+dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its
+dnl C language ABI (application binary interface).
+dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in
+dnl config.h.
+dnl
+dnl This canonical name can be used to select a particular assembly language
+dnl source file that will interoperate with C code on the given host.
+dnl
+dnl For example:
+dnl * 'i386' and 'sparc' are different canonical names, because code for i386
+dnl will not run on SPARC CPUs and vice versa. They have different
+dnl instruction sets.
+dnl * 'sparc' and 'sparc64' are different canonical names, because code for
+dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code
+dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit
+dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit
+dnl mode, but not both.
+dnl * 'mips' and 'mipsn32' are different canonical names, because they use
+dnl different argument passing and return conventions for C functions, and
+dnl although the instruction set of 'mips' is a large subset of the
+dnl instruction set of 'mipsn32'.
+dnl * 'mipsn32' and 'mips64' are different canonical names, because they use
+dnl different sizes for the C types like 'int' and 'void *', and although
+dnl the instruction sets of 'mipsn32' and 'mips64' are the same.
+dnl * The same canonical name is used for different endiannesses. You can
+dnl determine the endianness through preprocessor symbols:
+dnl - 'arm': test __ARMEL__.
+dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL.
+dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN.
+dnl * The same name 'i386' is used for CPUs of type i386, i486, i586
+dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because
+dnl - Instructions that do not exist on all of these CPUs (cmpxchg,
+dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your
+dnl assembly language source files use such instructions, you will
+dnl need to make the distinction.
+dnl - Speed of execution of the common instruction set is reasonable across
+dnl the entire family of CPUs. If you have assembly language source files
+dnl that are optimized for particular CPU types (like GNU gmp has), you
+dnl will need to make the distinction.
+dnl See <https://en.wikipedia.org/wiki/X86_instruction_listings>.
+AC_DEFUN([gl_HOST_CPU_C_ABI],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([gl_C_ASM])
+ AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi],
+ [case "$host_cpu" in
+
+changequote(,)dnl
+ i[34567]86 )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=i386
+ ;;
+
+ x86_64 )
+ # On x86_64 systems, the C compiler may be generating code in one of
+ # these ABIs:
+ # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
+ # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
+ # with native Windows (mingw, MSVC).
+ # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
+ # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if (defined __x86_64__ || defined __amd64__ \
+ || defined _M_X64 || defined _M_AMD64)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __ILP32__ || defined _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=x86_64-x32],
+ [gl_cv_host_cpu_c_abi=x86_64])],
+ [gl_cv_host_cpu_c_abi=i386])
+ ;;
+
+changequote(,)dnl
+ alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=alpha
+ ;;
+
+ arm* | aarch64 )
+ # Assume arm with EABI.
+ # On arm64 systems, the C compiler may be generating code in one of
+ # these ABIs:
+ # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
+ # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
+ # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef __aarch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __ILP32__ || defined _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=arm64-ilp32],
+ [gl_cv_host_cpu_c_abi=arm64])],
+ [# Don't distinguish little-endian and big-endian arm, since they
+ # don't require different machine code for simple operations and
+ # since the user can distinguish them through the preprocessor
+ # defines __ARMEL__ vs. __ARMEB__.
+ # But distinguish arm which passes floating-point arguments and
+ # return values in integer registers (r0, r1, ...) - this is
+ # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which
+ # passes them in float registers (s0, s1, ...) and double registers
+ # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer
+ # sets the preprocessor defines __ARM_PCS (for the first case) and
+ # __ARM_PCS_VFP (for the second case), but older GCC does not.
+ echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c
+ # Look for a reference to the register d0 in the .s file.
+ AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
+ if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then
+ gl_cv_host_cpu_c_abi=armhf
+ else
+ gl_cv_host_cpu_c_abi=arm
+ fi
+ rm -f conftest*
+ ])
+ ;;
+
+ hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
+ # On hppa, the C compiler may be generating 32-bit code or 64-bit
+ # code. In the latter case, it defines _LP64 and __LP64__.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef __LP64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=hppa64],
+ [gl_cv_host_cpu_c_abi=hppa])
+ ;;
+
+ ia64* )
+ # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
+ # 32-bit code. In the latter case, it defines _ILP32.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=ia64-ilp32],
+ [gl_cv_host_cpu_c_abi=ia64])
+ ;;
+
+ mips* )
+ # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
+ # at 32.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=mips64],
+ [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but
+ # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIN32.
+ # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but
+ # may later get defined by <sgidefs.h>), and _MIPS_SIM == _ABIO32.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if (_MIPS_SIM == _ABIN32)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=mipsn32],
+ [gl_cv_host_cpu_c_abi=mips])])
+ ;;
+
+ powerpc* )
+ # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
+ # No need to distinguish them here; the caller may distinguish
+ # them based on the OS.
+ # On powerpc64 systems, the C compiler may still be generating
+ # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
+ # be generating 64-bit code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [# On powerpc64, there are two ABIs on Linux: The AIX compatible
+ # one and the ELFv2 one. The latter defines _CALL_ELF=2.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined _CALL_ELF && _CALL_ELF == 2
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=powerpc64-elfv2],
+ [gl_cv_host_cpu_c_abi=powerpc64])
+ ],
+ [gl_cv_host_cpu_c_abi=powerpc])
+ ;;
+
+ rs6000 )
+ gl_cv_host_cpu_c_abi=powerpc
+ ;;
+
+ riscv32 | riscv64 )
+ # There are 2 architectures (with variants): rv32* and rv64*.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if __riscv_xlen == 64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [cpu=riscv64],
+ [cpu=riscv32])
+ # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
+ # Size of 'long' and 'void *':
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [main_abi=lp64],
+ [main_abi=ilp32])
+ # Float ABIs:
+ # __riscv_float_abi_double:
+ # 'float' and 'double' are passed in floating-point registers.
+ # __riscv_float_abi_single:
+ # 'float' are passed in floating-point registers.
+ # __riscv_float_abi_soft:
+ # No values are passed in floating-point registers.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __riscv_float_abi_double
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [float_abi=d],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __riscv_float_abi_single
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [float_abi=f],
+ [float_abi=''])
+ ])
+ gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}"
+ ;;
+
+ s390* )
+ # On s390x, the C compiler may be generating 64-bit (= s390x) code
+ # or 31-bit (= s390) code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__ || defined __s390x__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=s390x],
+ [gl_cv_host_cpu_c_abi=s390])
+ ;;
+
+ sparc | sparc64 )
+ # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
+ # C compiler still generates 32-bit code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __sparcv9 || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi=sparc64],
+ [gl_cv_host_cpu_c_abi=sparc])
+ ;;
+
+ *)
+ gl_cv_host_cpu_c_abi="$host_cpu"
+ ;;
+ esac
+ ])
+
+ dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same.
+ HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'`
+ HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi"
+ AC_SUBST([HOST_CPU])
+ AC_SUBST([HOST_CPU_C_ABI])
+
+ # This was
+ # AC_DEFINE_UNQUOTED([__${HOST_CPU}__])
+ # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__])
+ # earlier, but KAI C++ 3.2d doesn't like this.
+ sed -e 's/-/_/g' >> confdefs.h <<EOF
+#ifndef __${HOST_CPU}__
+#define __${HOST_CPU}__ 1
+#endif
+#ifndef __${HOST_CPU_C_ABI}__
+#define __${HOST_CPU_C_ABI}__ 1
+#endif
+EOF
+ AH_TOP([/* CPU and C ABI indicator */
+#ifndef __i386__
+#undef __i386__
+#endif
+#ifndef __x86_64_x32__
+#undef __x86_64_x32__
+#endif
+#ifndef __x86_64__
+#undef __x86_64__
+#endif
+#ifndef __alpha__
+#undef __alpha__
+#endif
+#ifndef __arm__
+#undef __arm__
+#endif
+#ifndef __armhf__
+#undef __armhf__
+#endif
+#ifndef __arm64_ilp32__
+#undef __arm64_ilp32__
+#endif
+#ifndef __arm64__
+#undef __arm64__
+#endif
+#ifndef __hppa__
+#undef __hppa__
+#endif
+#ifndef __hppa64__
+#undef __hppa64__
+#endif
+#ifndef __ia64_ilp32__
+#undef __ia64_ilp32__
+#endif
+#ifndef __ia64__
+#undef __ia64__
+#endif
+#ifndef __m68k__
+#undef __m68k__
+#endif
+#ifndef __mips__
+#undef __mips__
+#endif
+#ifndef __mipsn32__
+#undef __mipsn32__
+#endif
+#ifndef __mips64__
+#undef __mips64__
+#endif
+#ifndef __powerpc__
+#undef __powerpc__
+#endif
+#ifndef __powerpc64__
+#undef __powerpc64__
+#endif
+#ifndef __powerpc64_elfv2__
+#undef __powerpc64_elfv2__
+#endif
+#ifndef __riscv32__
+#undef __riscv32__
+#endif
+#ifndef __riscv64__
+#undef __riscv64__
+#endif
+#ifndef __riscv32_ilp32__
+#undef __riscv32_ilp32__
+#endif
+#ifndef __riscv32_ilp32f__
+#undef __riscv32_ilp32f__
+#endif
+#ifndef __riscv32_ilp32d__
+#undef __riscv32_ilp32d__
+#endif
+#ifndef __riscv64_ilp32__
+#undef __riscv64_ilp32__
+#endif
+#ifndef __riscv64_ilp32f__
+#undef __riscv64_ilp32f__
+#endif
+#ifndef __riscv64_ilp32d__
+#undef __riscv64_ilp32d__
+#endif
+#ifndef __riscv64_lp64__
+#undef __riscv64_lp64__
+#endif
+#ifndef __riscv64_lp64f__
+#undef __riscv64_lp64f__
+#endif
+#ifndef __riscv64_lp64d__
+#undef __riscv64_lp64d__
+#endif
+#ifndef __s390__
+#undef __s390__
+#endif
+#ifndef __s390x__
+#undef __s390x__
+#endif
+#ifndef __sh__
+#undef __sh__
+#endif
+#ifndef __sparc__
+#undef __sparc__
+#endif
+#ifndef __sparc64__
+#undef __sparc64__
+#endif
+])
+
+])
+
+
+dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI
+dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit
+dnl one, or to 'unknown' if unknown.
+dnl This is a simplified variant of gl_HOST_CPU_C_ABI.
+AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT],
+[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit],
+ [if test -n "$gl_cv_host_cpu_c_abi"; then
+ case "$gl_cv_host_cpu_c_abi" in
+ i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc)
+ gl_cv_host_cpu_c_abi_32bit=yes ;;
+ x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 )
+ gl_cv_host_cpu_c_abi_32bit=no ;;
+ *)
+ gl_cv_host_cpu_c_abi_32bit=unknown ;;
+ esac
+ else
+ case "$host_cpu" in
+
+ # CPUs that only support a 32-bit ABI.
+ arc \
+ | bfin \
+ | cris* \
+ | csky \
+ | epiphany \
+ | ft32 \
+ | h8300 \
+ | m68k \
+ | microblaze | microblazeel \
+ | nds32 | nds32le | nds32be \
+ | nios2 | nios2eb | nios2el \
+ | or1k* \
+ | or32 \
+ | sh | sh[1234] | sh[1234]e[lb] \
+ | tic6x \
+ | xtensa* )
+ gl_cv_host_cpu_c_abi_32bit=yes
+ ;;
+
+ # CPUs that only support a 64-bit ABI.
+changequote(,)dnl
+ alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \
+ | mmix )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi_32bit=no
+ ;;
+
+changequote(,)dnl
+ i[34567]86 )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi_32bit=yes
+ ;;
+
+ x86_64 )
+ # On x86_64 systems, the C compiler may be generating code in one of
+ # these ABIs:
+ # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64.
+ # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64
+ # with native Windows (mingw, MSVC).
+ # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32.
+ # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if (defined __x86_64__ || defined __amd64__ \
+ || defined _M_X64 || defined _M_AMD64) \
+ && !(defined __ILP32__ || defined _ILP32)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ arm* | aarch64 )
+ # Assume arm with EABI.
+ # On arm64 systems, the C compiler may be generating code in one of
+ # these ABIs:
+ # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64.
+ # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32.
+ # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ hppa1.0 | hppa1.1 | hppa2.0* | hppa64 )
+ # On hppa, the C compiler may be generating 32-bit code or 64-bit
+ # code. In the latter case, it defines _LP64 and __LP64__.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef __LP64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ ia64* )
+ # On ia64 on HP-UX, the C compiler may be generating 64-bit code or
+ # 32-bit code. In the latter case, it defines _ILP32.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#ifdef _ILP32
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=yes],
+ [gl_cv_host_cpu_c_abi_32bit=no])
+ ;;
+
+ mips* )
+ # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this
+ # at 32.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64)
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ powerpc* )
+ # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD.
+ # No need to distinguish them here; the caller may distinguish
+ # them based on the OS.
+ # On powerpc64 systems, the C compiler may still be generating
+ # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may
+ # be generating 64-bit code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ rs6000 )
+ gl_cv_host_cpu_c_abi_32bit=yes
+ ;;
+
+ riscv32 | riscv64 )
+ # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d.
+ # Size of 'long' and 'void *':
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ s390* )
+ # On s390x, the C compiler may be generating 64-bit (= s390x) code
+ # or 31-bit (= s390) code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __LP64__ || defined __s390x__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ sparc | sparc64 )
+ # UltraSPARCs running Linux have `uname -m` = "sparc64", but the
+ # C compiler still generates 32-bit code.
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __sparcv9 || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [gl_cv_host_cpu_c_abi_32bit=no],
+ [gl_cv_host_cpu_c_abi_32bit=yes])
+ ;;
+
+ *)
+ gl_cv_host_cpu_c_abi_32bit=unknown
+ ;;
+ esac
+ fi
+ ])
+
+ HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit"
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/iconv.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/iconv.m4
new file mode 100644
index 0000000000..e593b7270a
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/iconv.m4
@@ -0,0 +1,288 @@
+# iconv.m4 serial 21
+dnl Copyright (C) 2000-2002, 2007-2014, 2016-2020 Free Software Foundation,
+dnl Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed libiconv and not disabled its use
+ dnl via --without-libiconv-prefix, he wants to use it. The first
+ dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
+ am_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+ AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
+ [am_cv_func_iconv=yes])
+ if test "$am_cv_func_iconv" != yes; then
+ am_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBICONV"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+ ]],
+ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+ iconv_close(cd);]])],
+ [am_cv_lib_iconv=yes]
+ [am_cv_func_iconv=yes])
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+ AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+ dnl Solaris 10.
+ am_save_LIBS="$LIBS"
+ if test $am_cv_lib_iconv = yes; then
+ LIBS="$LIBS $LIBICONV"
+ fi
+ am_cv_func_iconv_works=no
+ for ac_iconv_const in '' 'const'; do
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <iconv.h>
+#include <string.h>
+
+#ifndef ICONV_CONST
+# define ICONV_CONST $ac_iconv_const
+#endif
+ ]],
+ [[int result = 0;
+ /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+ returns. */
+ {
+ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+ if (cd_utf8_to_88591 != (iconv_t)(-1))
+ {
+ static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
+ char buf[10];
+ ICONV_CONST char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_utf8_to_88591,
+ &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 1;
+ iconv_close (cd_utf8_to_88591);
+ }
+ }
+ /* Test against Solaris 10 bug: Failures are not distinguishable from
+ successful returns. */
+ {
+ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+ if (cd_ascii_to_88591 != (iconv_t)(-1))
+ {
+ static ICONV_CONST char input[] = "\263";
+ char buf[10];
+ ICONV_CONST char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_ascii_to_88591,
+ &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res == 0)
+ result |= 2;
+ iconv_close (cd_ascii_to_88591);
+ }
+ }
+ /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static ICONV_CONST char input[] = "\304";
+ static char buf[2] = { (char)0xDE, (char)0xAD };
+ ICONV_CONST char *inptr = input;
+ size_t inbytesleft = 1;
+ char *outptr = buf;
+ size_t outbytesleft = 1;
+ size_t res = iconv (cd_88591_to_utf8,
+ &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+ result |= 4;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#if 0 /* This bug could be worked around by the caller. */
+ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
+ {
+ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+ if (cd_88591_to_utf8 != (iconv_t)(-1))
+ {
+ static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+ char buf[50];
+ ICONV_CONST char *inptr = input;
+ size_t inbytesleft = strlen (input);
+ char *outptr = buf;
+ size_t outbytesleft = sizeof (buf);
+ size_t res = iconv (cd_88591_to_utf8,
+ &inptr, &inbytesleft,
+ &outptr, &outbytesleft);
+ if ((int)res > 0)
+ result |= 8;
+ iconv_close (cd_88591_to_utf8);
+ }
+ }
+#endif
+ /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+ provided. */
+ {
+ /* Try standardized names. */
+ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
+ /* Try IRIX, OSF/1 names. */
+ iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
+ /* Try AIX names. */
+ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
+ /* Try HP-UX names. */
+ iconv_t cd4 = iconv_open ("utf8", "eucJP");
+ if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
+ && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
+ result |= 16;
+ if (cd1 != (iconv_t)(-1))
+ iconv_close (cd1);
+ if (cd2 != (iconv_t)(-1))
+ iconv_close (cd2);
+ if (cd3 != (iconv_t)(-1))
+ iconv_close (cd3);
+ if (cd4 != (iconv_t)(-1))
+ iconv_close (cd4);
+ }
+ return result;
+]])],
+ [am_cv_func_iconv_works=yes], ,
+ [case "$host_os" in
+ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+ *) am_cv_func_iconv_works="guessing yes" ;;
+ esac])
+ test "$am_cv_func_iconv_works" = no || break
+ done
+ LIBS="$am_save_LIBS"
+ ])
+ case "$am_cv_func_iconv_works" in
+ *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+ *) am_func_iconv=yes ;;
+ esac
+ else
+ am_func_iconv=no am_cv_lib_iconv=no
+ fi
+ if test "$am_func_iconv" = yes; then
+ AC_DEFINE([HAVE_ICONV], [1],
+ [Define if you have the iconv() function and it works.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
+ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+ dnl either.
+ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+ AC_SUBST([LIBICONV])
+ AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl warnings.
+m4_define([gl_iconv_AC_DEFUN],
+ m4_version_prereq([2.64],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [m4_ifdef([gl_00GNULIB],
+ [[AC_DEFUN_ONCE(
+ [$1], [$2])]],
+ [[AC_DEFUN(
+ [$1], [$2])]])]))
+gl_iconv_AC_DEFUN([AM_ICONV],
+[
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+ AC_MSG_CHECKING([for iconv declaration])
+ AC_CACHE_VAL([am_cv_proto_iconv], [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+ ]],
+ [[]])],
+ [am_cv_proto_iconv_arg1=""],
+ [am_cv_proto_iconv_arg1="const"])
+ am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+ am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+ AC_MSG_RESULT([
+ $am_cv_proto_iconv])
+ else
+ dnl When compiling GNU libiconv on a system that does not have iconv yet,
+ dnl pick the POSIX compliant declaration without 'const'.
+ am_cv_proto_iconv_arg1=""
+ fi
+ AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
+ [Define as const if the declaration of iconv() needs const.])
+ dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+ m4_ifdef([gl_ICONV_H_DEFAULTS],
+ [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+ if test -n "$am_cv_proto_iconv_arg1"; then
+ ICONV_CONST="const"
+ fi
+ ])
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/intlmacosx.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/intlmacosx.m4
new file mode 100644
index 0000000000..ebd9937c1a
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/intlmacosx.m4
@@ -0,0 +1,65 @@
+# intlmacosx.m4 serial 8 (gettext-0.20.2)
+dnl Copyright (C) 2004-2014, 2016, 2019-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Checks for special options needed on Mac OS X.
+dnl Defines INTL_MACOSX_LIBS.
+AC_DEFUN([gt_INTL_MACOSX],
+[
+ dnl Check for API introduced in Mac OS X 10.4.
+ AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
+ [gt_cv_func_CFPreferencesCopyAppValue],
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFPreferences.h>]],
+ [[CFPreferencesCopyAppValue(NULL, NULL)]])],
+ [gt_cv_func_CFPreferencesCopyAppValue=yes],
+ [gt_cv_func_CFPreferencesCopyAppValue=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
+ AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
+ [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
+ fi
+ dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
+ dnl because in macOS 10.13.4 it has the following behaviour:
+ dnl When two or more languages are specified in the
+ dnl "System Preferences > Language & Region > Preferred Languages" panel,
+ dnl it returns en_CC where CC is the territory (even when English is not among
+ dnl the preferred languages!). What we want instead is what
+ dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
+ dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
+ dnl first among the preferred languages and CC is the territory.
+ AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
+ [gt_save_LIBS="$LIBS"
+ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <CoreFoundation/CFLocale.h>]],
+ [[CFLocaleCopyPreferredLanguages();]])],
+ [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
+ [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
+ LIBS="$gt_save_LIBS"])
+ if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
+ AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
+ [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
+ fi
+ INTL_MACOSX_LIBS=
+ if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
+ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
+ fi
+ AC_SUBST([INTL_MACOSX_LIBS])
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-ld.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-ld.m4
new file mode 100644
index 0000000000..98c348faff
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-ld.m4
@@ -0,0 +1,168 @@
+# lib-ld.m4 serial 9
+dnl Copyright (C) 1996-2003, 2009-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid
+dnl collision with libtool.m4.
+
+dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ acl_cv_prog_gnu_ld=yes
+ ;;
+*)
+ acl_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-2.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld [default=no]])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
+fi
+
+if test -n "$LD"; then
+ AC_MSG_CHECKING([for ld])
+elif test "$GCC" = yes; then
+ AC_MSG_CHECKING([for ld used by $CC])
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+if test -n "$LD"; then
+ # Let the user override the test with a path.
+ :
+else
+ AC_CACHE_VAL([acl_cv_path_LD],
+ [
+ acl_cv_path_LD= # Final result of this test
+ ac_prog=ld # Program to search in $PATH
+ if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ acl_output=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $acl_output in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'`
+ while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do
+ acl_output=`echo $acl_output | sed "s%$re_direlt%/%"`
+ done
+ # Got the pathname. No search in PATH is needed.
+ acl_cv_path_LD="$acl_output"
+ ac_prog=
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+ fi
+ if test -n "$ac_prog"; then
+ # Search for $ac_prog in $PATH.
+ acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$acl_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ acl_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_ifs"
+ fi
+ case $host in
+ *-*-aix*)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __powerpc64__ || defined _ARCH_PPC64
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [# The compiler produces 64-bit code. Add option '-b64' so that the
+ # linker groks 64-bit object files.
+ case "$acl_cv_path_LD " in
+ *" -b64 "*) ;;
+ *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;;
+ esac
+ ], [])
+ ;;
+ sparc64-*-netbsd*)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [[#if defined __sparcv9 || defined __arch64__
+ int ok;
+ #else
+ error fail
+ #endif
+ ]])],
+ [],
+ [# The compiler produces 32-bit code. Add option '-m elf32_sparc'
+ # so that the linker groks 32-bit object files.
+ case "$acl_cv_path_LD " in
+ *" -m elf32_sparc "*) ;;
+ *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;;
+ esac
+ ])
+ ;;
+ esac
+ ])
+ LD="$acl_cv_path_LD"
+fi
+if test -n "$LD"; then
+ AC_MSG_RESULT([$LD])
+else
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([no acceptable ld found in \$PATH])
+fi
+AC_LIB_PROG_LD_GNU
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-link.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-link.m4
new file mode 100644
index 0000000000..eecf70ec76
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-link.m4
@@ -0,0 +1,800 @@
+# lib-link.m4 serial 31
+dnl Copyright (C) 2001-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ([2.61])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+ ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+ ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+ ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+ ])
+ LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+ LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+ INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+ dnl results of this search when this library appears as a dependency.
+ HAVE_LIB[]NAME=yes
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+ pushdef([Name],[m4_translit([$1],[./+-], [____])])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+
+ dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+ dnl accordingly.
+ AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+ dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+ dnl because if the user has installed lib[]Name and not disabled its use
+ dnl via --without-lib[]Name-prefix, he wants to use it.
+ ac_save_CPPFLAGS="$CPPFLAGS"
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+ AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+ ac_save_LIBS="$LIBS"
+ dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+ dnl because these -l options might require -L options that are present in
+ dnl LIBS. -l options benefit only from the -L options listed before it.
+ dnl Otherwise, add it to the front of LIBS, because it may be a static
+ dnl library that depends on another static library that is present in LIBS.
+ dnl Static libraries benefit only from the static libraries listed after
+ dnl it.
+ case " $LIB[]NAME" in
+ *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+ *) LIBS="$LIB[]NAME $LIBS" ;;
+ esac
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[$3]], [[$4]])],
+ [ac_cv_lib[]Name=yes],
+ [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+ LIBS="$ac_save_LIBS"
+ ])
+ if test "$ac_cv_lib[]Name" = yes; then
+ HAVE_LIB[]NAME=yes
+ AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+ AC_MSG_CHECKING([how to link with lib[]$1])
+ AC_MSG_RESULT([$LIB[]NAME])
+ else
+ HAVE_LIB[]NAME=no
+ dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+ dnl $INC[]NAME either.
+ CPPFLAGS="$ac_save_CPPFLAGS"
+ LIB[]NAME=
+ LTLIB[]NAME=
+ LIB[]NAME[]_PREFIX=
+ fi
+ AC_SUBST([HAVE_LIB]NAME)
+ AC_SUBST([LIB]NAME)
+ AC_SUBST([LTLIB]NAME)
+ AC_SUBST([LIB]NAME[_PREFIX])
+ popdef([NAME])
+ popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl acl_libext,
+dnl acl_shlibext,
+dnl acl_libname_spec,
+dnl acl_library_names_spec,
+dnl acl_hardcode_libdir_flag_spec,
+dnl acl_hardcode_libdir_separator,
+dnl acl_hardcode_direct,
+dnl acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+ dnl Complain if config.rpath is missing.
+ AC_REQUIRE_AUX_FILE([config.rpath])
+ AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
+ AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
+ AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+ AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+ CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+ . ./conftest.sh
+ rm -f ./conftest.sh
+ acl_cv_rpath=done
+ ])
+ wl="$acl_cv_wl"
+ acl_libext="$acl_cv_libext"
+ acl_shlibext="$acl_cv_shlibext"
+ acl_libname_spec="$acl_cv_libname_spec"
+ acl_library_names_spec="$acl_cv_library_names_spec"
+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+ acl_hardcode_direct="$acl_cv_hardcode_direct"
+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+ dnl Determine whether the user wants rpath handling at all.
+ AC_ARG_ENABLE([rpath],
+ [ --disable-rpath do not hardcode runtime library paths],
+ :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ define([acl_frompackage_]NAME, [$2])
+ popdef([NAME])
+ pushdef([PACK],[$2])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ define([acl_libsinpackage_]PACKUP,
+ m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+ popdef([PACKUP])
+ popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+ pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+ pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
+ eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
+ ])
+ AC_ARG_WITH(PACK[-prefix],
+[[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
+ --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\"
+ eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ additional_libdir2="$withval/$acl_libdirstem2"
+ additional_libdir3="$withval/$acl_libdirstem3"
+ fi
+ fi
+])
+ if test "X$additional_libdir2" = "X$additional_libdir"; then
+ additional_libdir2=
+ fi
+ if test "X$additional_libdir3" = "X$additional_libdir"; then
+ additional_libdir3=
+ fi
+ dnl Search the library and its dependencies in $additional_libdir and
+ dnl $LDFLAGS. Using breadth-first-seach.
+ LIB[]NAME=
+ LTLIB[]NAME=
+ INC[]NAME=
+ LIB[]NAME[]_PREFIX=
+ dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+ dnl computed. So it has to be reset here.
+ HAVE_LIB[]NAME=
+ rpathdirs=
+ ltrpathdirs=
+ names_already_handled=
+ names_next_round='$1 $2'
+ while test -n "$names_next_round"; do
+ names_this_round="$names_next_round"
+ names_next_round=
+ for name in $names_this_round; do
+ already_handled=
+ for n in $names_already_handled; do
+ if test "$n" = "$name"; then
+ already_handled=yes
+ break
+ fi
+ done
+ if test -z "$already_handled"; then
+ names_already_handled="$names_already_handled $name"
+ dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+ dnl or AC_LIB_HAVE_LINKFLAGS call.
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+ eval value=\"\$HAVE_LIB$uppername\"
+ if test -n "$value"; then
+ if test "$value" = yes; then
+ eval value=\"\$LIB$uppername\"
+ test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+ eval value=\"\$LTLIB$uppername\"
+ test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+ else
+ dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+ dnl that this library doesn't exist. So just drop it.
+ :
+ fi
+ else
+ dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+ dnl and the already constructed $LIBNAME/$LTLIBNAME.
+ found_dir=
+ found_la=
+ found_so=
+ found_a=
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
+ if test -n "$acl_shlibext"; then
+ shrext=".$acl_shlibext" # typically: shrext=.so
+ else
+ shrext=
+ fi
+ if test $use_additional = yes; then
+ for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do
+ if test "X$found_dir" = "X"; then
+ eval dir=\$$additional_libdir_variable
+ if test -n "$dir"; then
+ dnl The same code as in the loop below:
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+ if test "X$found_dir" = "X"; then
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ case "$x" in
+ -L*)
+ dir=`echo "X$x" | sed -e 's/^X-L//'`
+ dnl First look for a shared library.
+ if test -n "$acl_shlibext"; then
+ if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext"
+ else
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+ ver=`(cd "$dir" && \
+ for f in "$libname$shrext".*; do echo "$f"; done \
+ | sed -e "s,^$libname$shrext\\\\.,," \
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+ | sed 1q ) 2>/dev/null`
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then
+ found_dir="$dir"
+ found_so="$dir/$libname$shrext.$ver"
+ fi
+ else
+ eval library_names=\"$acl_library_names_spec\"
+ for f in $library_names; do
+ if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then
+ found_dir="$dir"
+ found_so="$dir/$f"
+ break
+ fi
+ done
+ fi
+ fi
+ fi
+ dnl Then look for a static library.
+ if test "X$found_dir" = "X"; then
+ if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then
+ found_dir="$dir"
+ found_a="$dir/$libname.$acl_libext"
+ fi
+ fi
+ if test "X$found_dir" != "X"; then
+ if test -f "$dir/$libname.la"; then
+ found_la="$dir/$libname.la"
+ fi
+ fi
+ ;;
+ esac
+ if test "X$found_dir" != "X"; then
+ break
+ fi
+ done
+ fi
+ if test "X$found_dir" != "X"; then
+ dnl Found the library.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+ if test "X$found_so" != "X"; then
+ dnl Linking with a shared library. We attempt to hardcode its
+ dnl directory into the executable's runpath, unless it's the
+ dnl standard /usr/lib.
+ if test "$enable_rpath" = no \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem2" \
+ || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then
+ dnl No hardcoding is needed.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $found_dir"
+ fi
+ dnl The hardcoding into $LIBNAME is system dependent.
+ if test "$acl_hardcode_direct" = yes; then
+ dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+ dnl resulting binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode DIR into the resulting
+ dnl binary.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $found_dir"
+ fi
+ else
+ dnl Rely on "-L$found_dir".
+ dnl But don't add it if it's already contained in the LDFLAGS
+ dnl or the already constructed $LIBNAME
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$found_dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+ fi
+ if test "$acl_hardcode_minus_L" != no; then
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+ else
+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+ dnl here, because this doesn't fit in flags passed to the
+ dnl compiler. So give up. No hardcoding. This affects only
+ dnl very old systems.
+ dnl FIXME: Not sure whether we should use
+ dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+ dnl here.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ fi
+ else
+ if test "X$found_a" != "X"; then
+ dnl Linking with a static library.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+ else
+ dnl We shouldn't come here, but anyway it's good to have a
+ dnl fallback.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+ fi
+ fi
+ dnl Assume the include files are nearby.
+ additional_includedir=
+ case "$found_dir" in
+ */$acl_libdirstem | */$acl_libdirstem/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem2 | */$acl_libdirstem2/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ */$acl_libdirstem3 | */$acl_libdirstem3/)
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'`
+ if test "$name" = '$1'; then
+ LIB[]NAME[]_PREFIX="$basedir"
+ fi
+ additional_includedir="$basedir/include"
+ ;;
+ esac
+ if test "X$additional_includedir" != "X"; then
+ dnl Potentially add $additional_includedir to $INCNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 3. if it's already present in $CPPFLAGS or the already
+ dnl constructed $INCNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ for x in $CPPFLAGS $INC[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $INCNAME.
+ INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ fi
+ dnl Look for dependencies.
+ if test -n "$found_la"; then
+ dnl Read the .la file. It defines the variables
+ dnl dlname, library_names, old_library, dependency_libs, current,
+ dnl age, revision, installed, dlopen, dlpreopen, libdir.
+ save_libdir="$libdir"
+ case "$found_la" in
+ */* | *\\*) . "$found_la" ;;
+ *) . "./$found_la" ;;
+ esac
+ libdir="$save_libdir"
+ dnl We use only dependency_libs.
+ for dep in $dependency_libs; do
+ case "$dep" in
+ -L*)
+ dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+ dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 3. if it's already present in $LDFLAGS or the already
+ dnl constructed $LIBNAME,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \
+ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \
+ && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then
+ haveit=
+ if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \
+ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \
+ || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ haveit=
+ for x in $LDFLAGS $LIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$dependency_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$dependency_libdir"; then
+ dnl Really add $dependency_libdir to $LIBNAME.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir"
+ fi
+ fi
+ haveit=
+ for x in $LDFLAGS $LTLIB[]NAME; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$dependency_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test -d "$dependency_libdir"; then
+ dnl Really add $dependency_libdir to $LTLIBNAME.
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir"
+ fi
+ fi
+ fi
+ fi
+ ;;
+ -R*)
+ dir=`echo "X$dep" | sed -e 's/^X-R//'`
+ if test "$enable_rpath" != no; then
+ dnl Potentially add DIR to rpathdirs.
+ dnl The rpathdirs will be appended to $LIBNAME at the end.
+ haveit=
+ for x in $rpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ dnl Potentially add DIR to ltrpathdirs.
+ dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+ haveit=
+ for x in $ltrpathdirs; do
+ if test "X$x" = "X$dir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ ltrpathdirs="$ltrpathdirs $dir"
+ fi
+ fi
+ ;;
+ -l*)
+ dnl Handle this in the next round.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+ ;;
+ *.la)
+ dnl Handle this in the next round. Throw away the .la's
+ dnl directory; it is already contained in a preceding -L
+ dnl option.
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+ ;;
+ *)
+ dnl Most likely an immediate library name.
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+ ;;
+ esac
+ done
+ fi
+ else
+ dnl Didn't find the library; assume it is in the system directories
+ dnl known to the linker and runtime loader. (All the system
+ dnl directories known to the linker should also be known to the
+ dnl runtime loader, otherwise the system is severely misconfigured.)
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+ fi
+ fi
+ fi
+ done
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user must
+ dnl pass all path elements in one option. We can arrange that for a
+ dnl single library, but not when more than one $LIBNAMEs are used.
+ alldirs=
+ for found_dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+ done
+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for found_dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$found_dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+ done
+ fi
+ fi
+ if test "X$ltrpathdirs" != "X"; then
+ dnl When using libtool, the option that works for both libraries and
+ dnl executables is -R. The -R options are cumulative.
+ for found_dir in $ltrpathdirs; do
+ LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+ done
+ fi
+ popdef([PACKLIBS])
+ popdef([PACKUP])
+ popdef([PACK])
+ popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+ for element in [$2]; do
+ haveit=
+ for x in $[$1]; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X$element"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ [$1]="${[$1]}${[$1]:+ }$element"
+ fi
+ done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+ AC_REQUIRE([AC_LIB_RPATH])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ $1=
+ if test "$enable_rpath" != no; then
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+ dnl Use an explicit option to hardcode directories into the resulting
+ dnl binary.
+ rpathdirs=
+ next=
+ for opt in $2; do
+ if test -n "$next"; then
+ dir="$next"
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2" \
+ && test "X$dir" != "X/usr/$acl_libdirstem3"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next=
+ else
+ case $opt in
+ -L) next=yes ;;
+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+ dnl No need to hardcode the standard /usr/lib.
+ if test "X$dir" != "X/usr/$acl_libdirstem" \
+ && test "X$dir" != "X/usr/$acl_libdirstem2" \
+ && test "X$dir" != "X/usr/$acl_libdirstem3"; then
+ rpathdirs="$rpathdirs $dir"
+ fi
+ next= ;;
+ *) next= ;;
+ esac
+ fi
+ done
+ if test "X$rpathdirs" != "X"; then
+ if test -n ""$3""; then
+ dnl libtool is used for linking. Use -R options.
+ for dir in $rpathdirs; do
+ $1="${$1}${$1:+ }-R$dir"
+ done
+ else
+ dnl The linker is used for linking directly.
+ if test -n "$acl_hardcode_libdir_separator"; then
+ dnl Weird platform: only the last -rpath option counts, the user
+ dnl must pass all path elements in one option.
+ alldirs=
+ for dir in $rpathdirs; do
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+ done
+ acl_save_libdir="$libdir"
+ libdir="$alldirs"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="$flag"
+ else
+ dnl The -rpath options are cumulative.
+ for dir in $rpathdirs; do
+ acl_save_libdir="$libdir"
+ libdir="$dir"
+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
+ libdir="$acl_save_libdir"
+ $1="${$1}${$1:+ }$flag"
+ done
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_SUBST([$1])
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-prefix.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-prefix.m4
new file mode 100644
index 0000000000..c8a0b464c2
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/lib-prefix.m4
@@ -0,0 +1,320 @@
+# lib-prefix.m4 serial 17
+dnl Copyright (C) 2001-2005, 2008-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+ AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ dnl By default, look in $includedir and $libdir.
+ use_additional=yes
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ AC_ARG_WITH([lib-prefix],
+[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+ --without-lib-prefix don't search for libraries in includedir and libdir]],
+[
+ if test "X$withval" = "Xno"; then
+ use_additional=no
+ else
+ if test "X$withval" = "X"; then
+ AC_LIB_WITH_FINAL_PREFIX([
+ eval additional_includedir=\"$includedir\"
+ eval additional_libdir=\"$libdir\"
+ ])
+ else
+ additional_includedir="$withval/include"
+ additional_libdir="$withval/$acl_libdirstem"
+ fi
+ fi
+])
+ if test $use_additional = yes; then
+ dnl Potentially add $additional_includedir to $CPPFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/include,
+ dnl 2. if it's already present in $CPPFLAGS,
+ dnl 3. if it's /usr/local/include and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_includedir" != "X/usr/include"; then
+ haveit=
+ for x in $CPPFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-I$additional_includedir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_includedir" = "X/usr/local/include"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_includedir"; then
+ dnl Really add $additional_includedir to $CPPFLAGS.
+ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+ fi
+ fi
+ fi
+ fi
+ dnl Potentially add $additional_libdir to $LDFLAGS.
+ dnl But don't add it
+ dnl 1. if it's the standard /usr/lib,
+ dnl 2. if it's already present in $LDFLAGS,
+ dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
+ dnl 4. if it doesn't exist as a directory.
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+ haveit=
+ for x in $LDFLAGS; do
+ AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+ if test "X$x" = "X-L$additional_libdir"; then
+ haveit=yes
+ break
+ fi
+ done
+ if test -z "$haveit"; then
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+ if test -n "$GCC"; then
+ case $host_os in
+ linux*) haveit=yes;;
+ esac
+ fi
+ fi
+ if test -z "$haveit"; then
+ if test -d "$additional_libdir"; then
+ dnl Really add $additional_libdir to $LDFLAGS.
+ LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+ fi
+ fi
+ fi
+ fi
+ fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+ dnl Unfortunately, prefix and exec_prefix get only finally determined
+ dnl at the end of configure.
+ if test "X$prefix" = "XNONE"; then
+ acl_final_prefix="$ac_default_prefix"
+ else
+ acl_final_prefix="$prefix"
+ fi
+ if test "X$exec_prefix" = "XNONE"; then
+ acl_final_exec_prefix='${prefix}'
+ else
+ acl_final_exec_prefix="$exec_prefix"
+ fi
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+ acl_save_prefix="$prefix"
+ prefix="$acl_final_prefix"
+ acl_save_exec_prefix="$exec_prefix"
+ exec_prefix="$acl_final_exec_prefix"
+ $1
+ exec_prefix="$acl_save_exec_prefix"
+ prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a function acl_is_expected_elfclass, that tests whether standard input
+dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI,
+dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing
+dnl the basename of the libdir to try in turn, either "lib" or "lib64" or
+dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar.
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+ dnl There is no formal standard regarding lib, lib32, and lib64.
+ dnl On most glibc systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on
+ dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go
+ dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib.
+ dnl We determine the compiler's default mode by looking at the compiler's
+ dnl library search path. If at least one of its elements ends in /lib64 or
+ dnl points to a directory whose absolute pathname ends in /lib64, we use that
+ dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default,
+ dnl namely "lib".
+ dnl On Solaris systems, the current practice is that on a system supporting
+ dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+ dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+ dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT])
+
+ AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf],
+ [AC_EGREP_CPP([Extensible Linking Format],
+ [#ifdef __ELF__
+ Extensible Linking Format
+ #endif
+ ],
+ [gl_cv_elf=yes],
+ [gl_cv_elf=no])
+ ])
+ if test $gl_cv_elf; then
+ # Extract the ELF class of a file (5th byte) in decimal.
+ # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header
+ if od -A x < /dev/null >/dev/null 2>/dev/null; then
+ # Use POSIX od.
+ func_elfclass ()
+ {
+ od -A n -t d1 -j 4 -N 1
+ }
+ else
+ # Use BSD hexdump.
+ func_elfclass ()
+ {
+ dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "'
+ echo
+ }
+ fi
+changequote(,)dnl
+ case $HOST_CPU_C_ABI_32BIT in
+ yes)
+ # 32-bit ABI.
+ acl_is_expected_elfclass ()
+ {
+ test "`func_elfclass | sed -e 's/[ ]//g'`" = 1
+ }
+ ;;
+ no)
+ # 64-bit ABI.
+ acl_is_expected_elfclass ()
+ {
+ test "`func_elfclass | sed -e 's/[ ]//g'`" = 2
+ }
+ ;;
+ *)
+ # Unknown.
+ acl_is_expected_elfclass ()
+ {
+ :
+ }
+ ;;
+ esac
+changequote([,])dnl
+ else
+ acl_is_expected_elfclass ()
+ {
+ :
+ }
+ fi
+
+ dnl Allow the user to override the result by setting acl_cv_libdirstems.
+ AC_CACHE_CHECK([for the common suffixes of directories in the library search path],
+ [acl_cv_libdirstems],
+ [dnl Try 'lib' first, because that's the default for libdir in GNU, see
+ dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>.
+ acl_libdirstem=lib
+ acl_libdirstem2=
+ acl_libdirstem3=
+ case "$host_os" in
+ solaris*)
+ dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+ dnl <https://docs.oracle.com/cd/E19253-01/816-5138/dev-env/index.html>.
+ dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+ dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+ dnl symlink is missing, so we set acl_libdirstem2 too.
+ if test $HOST_CPU_C_ABI_32BIT = no; then
+ acl_libdirstem2=lib/64
+ case "$host_cpu" in
+ sparc*) acl_libdirstem3=lib/sparcv9 ;;
+ i*86 | x86_64) acl_libdirstem3=lib/amd64 ;;
+ esac
+ fi
+ ;;
+ *)
+ dnl If $CC generates code for a 32-bit ABI, the libraries are
+ dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64.
+ dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries
+ dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32.
+ dnl Find the compiler's search path. However, non-system compilers
+ dnl sometimes have odd library search paths. But we can't simply invoke
+ dnl '/usr/bin/gcc -print-search-dirs' because that would not take into
+ dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS.
+ searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \
+ | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+ if test $HOST_CPU_C_ABI_32BIT != no; then
+ # 32-bit or unknown ABI.
+ if test -d /usr/lib32; then
+ acl_libdirstem2=lib32
+ fi
+ fi
+ if test $HOST_CPU_C_ABI_32BIT != yes; then
+ # 64-bit or unknown ABI.
+ if test -d /usr/lib64; then
+ acl_libdirstem3=lib64
+ fi
+ fi
+ if test -n "$searchpath"; then
+ acl_save_IFS="${IFS= }"; IFS=":"
+ for searchdir in $searchpath; do
+ if test -d "$searchdir"; then
+ case "$searchdir" in
+ */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;;
+ */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;;
+ */../ | */.. )
+ # Better ignore directories of this form. They are misleading.
+ ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib32 ) acl_libdirstem2=lib32 ;;
+ */lib64 ) acl_libdirstem3=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ if test $HOST_CPU_C_ABI_32BIT = yes; then
+ # 32-bit ABI.
+ acl_libdirstem3=
+ fi
+ if test $HOST_CPU_C_ABI_32BIT = no; then
+ # 64-bit ABI.
+ acl_libdirstem2=
+ fi
+ fi
+ ;;
+ esac
+ test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+ test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem"
+ acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3"
+ ])
+ dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and
+ dnl acl_libdirstem3.
+changequote(,)dnl
+ acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'`
+ acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'`
+ acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'`
+changequote([,])dnl
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/nls.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/nls.m4
new file mode 100644
index 0000000000..5a506fc4b5
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/nls.m4
@@ -0,0 +1,32 @@
+# nls.m4 serial 6 (gettext-0.20.2)
+dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2020 Free
+dnl Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_NLS],
+[
+ AC_MSG_CHECKING([whether NLS is requested])
+ dnl Default is enabled NLS
+ AC_ARG_ENABLE([nls],
+ [ --disable-nls do not use Native Language Support],
+ USE_NLS=$enableval, USE_NLS=yes)
+ AC_MSG_RESULT([$USE_NLS])
+ AC_SUBST([USE_NLS])
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/po.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/po.m4
new file mode 100644
index 0000000000..3778fd7aac
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/po.m4
@@ -0,0 +1,450 @@
+# po.m4 serial 31 (gettext-0.20.2)
+dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+AC_PREREQ([2.60])
+
+dnl Checks for all prerequisites of the po subdirectory.
+AC_DEFUN([AM_PO_SUBDIRS],
+[
+ AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+ AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+ AC_REQUIRE([AC_PROG_SED])dnl
+ AC_REQUIRE([AM_NLS])dnl
+
+ dnl Release version of the gettext macros. This is used to ensure that
+ dnl the gettext macros and po/Makefile.in.in are in sync.
+ AC_SUBST([GETTEXT_MACRO_VERSION], [0.20])
+
+ dnl Perform the following tests also if --disable-nls has been given,
+ dnl because they are needed for "make dist" to work.
+
+ dnl Search for GNU msgfmt in the PATH.
+ dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
+ dnl The second test excludes FreeBSD msgfmt.
+ AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
+ [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+ (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+ AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
+
+ dnl Test whether it is GNU msgfmt >= 0.15.
+changequote(,)dnl
+ case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
+ *) GMSGFMT_015=$GMSGFMT ;;
+ esac
+changequote([,])dnl
+ AC_SUBST([GMSGFMT_015])
+
+ dnl Search for GNU xgettext 0.12 or newer in the PATH.
+ dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
+ dnl The second test excludes FreeBSD xgettext.
+ AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
+ [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
+ (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
+ :)
+ dnl Remove leftover from FreeBSD xgettext call.
+ rm -f messages.po
+
+ dnl Test whether it is GNU xgettext >= 0.15.
+changequote(,)dnl
+ case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
+ '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
+ *) XGETTEXT_015=$XGETTEXT ;;
+ esac
+changequote([,])dnl
+ AC_SUBST([XGETTEXT_015])
+
+ dnl Search for GNU msgmerge 0.11 or newer in the PATH.
+ AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
+ [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
+
+ dnl Test whether it is GNU msgmerge >= 0.20.
+ if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then
+ MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt'
+ else
+ dnl Test whether it is GNU msgmerge >= 0.12.
+ if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then
+ MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet'
+ else
+ dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is
+ dnl slow. But this is not a big problem, as such old gettext versions are
+ dnl hardly in use any more.
+ MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet'
+ fi
+ fi
+ AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION])
+
+ dnl Support for AM_XGETTEXT_OPTION.
+ test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
+ AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
+
+ AC_CONFIG_COMMANDS([po-directories], [[
+ for ac_file in $CONFIG_FILES; do
+ # Support "outfile[:infile[:infile...]]"
+ case "$ac_file" in
+ *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ esac
+ # PO directories have a Makefile.in generated from Makefile.in.in.
+ case "$ac_file" in */Makefile.in)
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+ # Treat a directory as a PO directory if and only if it has a
+ # POTFILES.in file. This allows packages to have multiple PO
+ # directories under different names or in different locations.
+ if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
+ rm -f "$ac_dir/POTFILES"
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
+ gt_tab=`printf '\t'`
+ cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
+ POMAKEFILEDEPS="POTFILES.in"
+ # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
+ # on $ac_dir but don't depend on user-specified configuration
+ # parameters.
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # The set of available languages was given in configure.in.
+ ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS
+ fi
+ # Compute POFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+ # Compute UPDATEPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+ # Compute DUMMYPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+ # Compute GMOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ GMOFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ done
+ fi
+ test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
+ sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
+ for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
+ if test -f "$f"; then
+ case "$f" in
+ *.orig | *.bak | *~) ;;
+ *) cat "$f" >> "$ac_dir/Makefile" ;;
+ esac
+ fi
+ done
+ fi
+ ;;
+ esac
+ done]],
+ [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+ # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS.
+ OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS"
+ # Capture the value of LINGUAS because we need it to compute CATALOGS.
+ LINGUAS="${LINGUAS-%UNSET%}"
+ ])
+])
+
+dnl Postprocesses a Makefile in a directory containing PO files.
+AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
+[
+ # When this code is run, in config.status, two variables have already been
+ # set:
+ # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
+ # - LINGUAS is the value of the environment variable LINGUAS at configure
+ # time.
+
+changequote(,)dnl
+ # Adjust a relative srcdir.
+ ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
+ ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'`
+ ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
+ # In autoconf-2.13 it is called $ac_given_srcdir.
+ # In autoconf-2.50 it is called $srcdir.
+ test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
+ case "$ac_given_srcdir" in
+ .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
+ /*) top_srcdir="$ac_given_srcdir" ;;
+ *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ # Find a way to echo strings without interpreting backslash.
+ if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
+ gt_echo='echo'
+ else
+ if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
+ gt_echo='printf %s\n'
+ else
+ echo_func () {
+ cat <<EOT
+$*
+EOT
+ }
+ gt_echo='echo_func'
+ fi
+ fi
+
+ # A sed script that extracts the value of VARIABLE from a Makefile.
+ tab=`printf '\t'`
+ sed_x_variable='
+# Test if the hold space is empty.
+x
+s/P/P/
+x
+ta
+# Yes it was empty. Look if we have the expected variable definition.
+/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{
+ # Seen the first line of the variable definition.
+ s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=//
+ ba
+}
+bd
+:a
+# Here we are processing a line from the variable definition.
+# Remove comment, more precisely replace it with a space.
+s/#.*$/ /
+# See if the line ends in a backslash.
+tb
+:b
+s/\\$//
+# Print the line, without the trailing backslash.
+p
+tc
+# There was no trailing backslash. The end of the variable definition is
+# reached. Clear the hold space.
+s/^.*$//
+x
+bd
+:c
+# A trailing backslash means that the variable definition continues in the
+# next line. Put a nonempty string into the hold space to indicate this.
+s/^.*$/P/
+x
+:d
+'
+changequote([,])dnl
+
+ # Set POTFILES to the value of the Makefile variable POTFILES.
+ sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
+ POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
+ # Compute POTFILES_DEPS as
+ # $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
+ POTFILES_DEPS=
+ for file in $POTFILES; do
+ POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
+ done
+ POMAKEFILEDEPS=""
+
+ if test -n "$OBSOLETE_ALL_LINGUAS"; then
+ test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
+ fi
+ if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
+ # The LINGUAS file contains the set of available languages.
+ ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
+ POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
+ else
+ # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
+ sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
+ ALL_LINGUAS=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
+ fi
+ # Compute POFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
+ # Compute UPDATEPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
+ # Compute DUMMYPOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
+ # Compute GMOFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
+ # Compute PROPERTIESFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).properties)
+ # Compute CLASSFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(DOMAIN)_$(lang).class)
+ # Compute QMFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
+ # Compute MSGFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
+ # Compute RESOURCESDLLFILES
+ # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
+ case "$ac_given_srcdir" in
+ .) srcdirpre= ;;
+ *) srcdirpre='$(srcdir)/' ;;
+ esac
+ POFILES=
+ UPDATEPOFILES=
+ DUMMYPOFILES=
+ GMOFILES=
+ PROPERTIESFILES=
+ CLASSFILES=
+ QMFILES=
+ MSGFILES=
+ RESOURCESDLLFILES=
+ for lang in $ALL_LINGUAS; do
+ POFILES="$POFILES $srcdirpre$lang.po"
+ UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
+ DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
+ GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
+ PROPERTIESFILES="$PROPERTIESFILES \$(srcdir)/\$(DOMAIN)_$lang.properties"
+ CLASSFILES="$CLASSFILES \$(srcdir)/\$(DOMAIN)_$lang.class"
+ QMFILES="$QMFILES $srcdirpre$lang.qm"
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
+ done
+ # CATALOGS depends on both $ac_dir and the user's LINGUAS
+ # environment variable.
+ INST_LINGUAS=
+ if test -n "$ALL_LINGUAS"; then
+ for presentlang in $ALL_LINGUAS; do
+ useit=no
+ if test "%UNSET%" != "$LINGUAS"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$ALL_LINGUAS"
+ fi
+ for desiredlang in $desiredlanguages; do
+ # Use the presentlang catalog if desiredlang is
+ # a. equal to presentlang, or
+ # b. a variant of presentlang (because in this case,
+ # presentlang can be used as a fallback for messages
+ # which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*) useit=yes;;
+ esac
+ done
+ if test $useit = yes; then
+ INST_LINGUAS="$INST_LINGUAS $presentlang"
+ fi
+ done
+ fi
+ CATALOGS=
+ JAVACATALOGS=
+ QTCATALOGS=
+ TCLCATALOGS=
+ CSHARPCATALOGS=
+ if test -n "$INST_LINGUAS"; then
+ for lang in $INST_LINGUAS; do
+ CATALOGS="$CATALOGS $lang.gmo"
+ JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
+ QTCATALOGS="$QTCATALOGS $lang.qm"
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
+ done
+ fi
+
+ sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp"
+ tab=`printf '\t'`
+ if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
+ # Add dependencies that cannot be formulated as a simple suffix rule.
+ for lang in $ALL_LINGUAS; do
+ frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ cat >> "$ac_file.tmp" <<EOF
+$frobbedlang.msg: $lang.po
+${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
+${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+ done
+ fi
+ if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
+ # Add dependencies that cannot be formulated as a simple suffix rule.
+ for lang in $ALL_LINGUAS; do
+ frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'`
+ cat >> "$ac_file.tmp" <<EOF
+$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
+${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
+${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
+EOF
+ done
+ fi
+ if test -n "$POMAKEFILEDEPS"; then
+ cat >> "$ac_file.tmp" <<EOF
+Makefile: $POMAKEFILEDEPS
+EOF
+ fi
+ mv "$ac_file.tmp" "$ac_file"
+])
+
+dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
+AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
+[
+ XGETTEXT_EXTRA_OPTIONS=
+])
+
+dnl Registers an option to be passed to xgettext in the po subdirectory.
+AC_DEFUN([AM_XGETTEXT_OPTION],
+[
+ AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
+ XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/progtest.m4 b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/progtest.m4
new file mode 100644
index 0000000000..f28010aed1
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/aclocal/progtest.m4
@@ -0,0 +1,91 @@
+# progtest.m4 serial 8 (gettext-0.20.2)
+dnl Copyright (C) 1996-2003, 2005, 2008-2020 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl This file can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Lesser General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Lesser General Public License, and the rest of the GNU
+dnl gettext package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+AC_PREREQ([2.50])
+
+# Search path for a program which passes the given test.
+
+dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
+dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
+AC_DEFUN([AM_PATH_PROG_WITH_TEST],
+[
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+ # contains only /bin. Note that ksh looks also at the FPATH variable,
+ # so we have to set that as well for the test.
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+ || PATH_SEPARATOR=';'
+ }
+fi
+
+# Find out how to test for executable files. Don't use a zero-byte file,
+# as systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ ac_executable_p="test -x"
+else
+ ac_executable_p="test -f"
+fi
+rm -f conf$$.file
+
+# Extract the first word of "$2", so it can be a program name with args.
+set dummy $2; ac_word=[$]2
+AC_MSG_CHECKING([for $ac_word])
+AC_CACHE_VAL([ac_cv_path_$1],
+[case "[$]$1" in
+ [[\\/]]* | ?:[[\\/]]*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+ *)
+ ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in ifelse([$5], , $PATH, [$5]); do
+ IFS="$ac_save_IFS"
+ test -z "$ac_dir" && ac_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
+ echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
+ break 2
+ fi
+ fi
+ done
+ done
+ IFS="$ac_save_IFS"
+dnl If no 4th arg is given, leave the cache variable unset,
+dnl so AC_PATH_PROGS will keep looking.
+ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
+])dnl
+ ;;
+esac])dnl
+$1="$ac_cv_path_$1"
+if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+ AC_MSG_RESULT([$][$1])
+else
+ AC_MSG_RESULT([no])
+fi
+AC_SUBST([$1])dnl
+])
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath b/meta/recipes-core/gettext/gettext-minimal-0.21/config.rpath
index b625621fac..24be79cfb6 100755
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/config.rpath
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/config.rpath
@@ -2,7 +2,7 @@
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2014 Free Software Foundation, Inc.
+# Copyright 1996-2020 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin b/meta/recipes-core/gettext/gettext-minimal-0.21/remove-potcdate.sin
index 2436c49e78..8c70dfbf14 100644
--- a/meta/recipes-core/gettext/gettext-minimal-0.19.4/remove-potcdate.sin
+++ b/meta/recipes-core/gettext/gettext-minimal-0.21/remove-potcdate.sin
@@ -1,6 +1,12 @@
-# Sed script that remove the POT-Creation-Date line in the header entry
+# Sed script that removes the POT-Creation-Date line in the header entry
# from a POT file.
#
+# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+#
# The distinction between the first and the following occurrences of the
# pattern is achieved by looking at the hold space.
/^"POT-Creation-Date: .*"$/{
diff --git a/meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb b/meta/recipes-core/gettext/gettext-minimal-native_0.21.bb
index 1d4a443b7f..7a4dcbec57 100644
--- a/meta/recipes-core/gettext/gettext-minimal-native_0.19.4.bb
+++ b/meta/recipes-core/gettext/gettext-minimal-native_0.21.bb
@@ -3,28 +3,26 @@ DESCRIPTION = "Contains the m4 macros sufficient to support building \
autoconf/automake. This provides a significant build time speedup by \
the removal of gettext-native from most dependency chains (now only \
needed for gettext for the target)."
-SRC_URI = "file://aclocal.tgz \
+SRC_URI = "file://aclocal/ \
file://config.rpath \
file://Makefile.in.in \
file://remove-potcdate.sin \
file://COPYING \
- file://0001-PATCH-Disable-the-test-to-convert-euc-jp.patch \
"
INHIBIT_DEFAULT_DEPS = "1"
INHIBIT_AUTOTOOLS_DEPS = "1"
LICENSE = "FSF-Unlimited"
-LIC_FILES_CHKSUM = "file://COPYING;md5=1b20675cd5158442f6007d022f46b35b"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4bd090a20bfcd1a18f1f79837b5e3e91"
inherit native
-
S = "${WORKDIR}"
do_install () {
install -d ${D}${datadir}/aclocal/
- cp ${WORKDIR}/*.m4 ${D}${datadir}/aclocal/
+ cp ${WORKDIR}/aclocal/*.m4 ${D}${datadir}/aclocal/
install -d ${D}${datadir}/gettext/po/
cp ${WORKDIR}/config.rpath ${D}${datadir}/gettext/
cp ${WORKDIR}/Makefile.in.in ${D}${datadir}/gettext/po/
diff --git a/meta/recipes-core/gettext/gettext_0.16.1.bb b/meta/recipes-core/gettext/gettext_0.16.1.bb
deleted file mode 100644
index f9f7a7f4c8..0000000000
--- a/meta/recipes-core/gettext/gettext_0.16.1.bb
+++ /dev/null
@@ -1,107 +0,0 @@
-SUMMARY = "Utilities and libraries for producing multi-lingual messages"
-DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
-HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
-SECTION = "libs"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=9ea3144f04c41cd2eada5d3f472e6ea5"
-
-PR = "r6"
-DEPENDS = "virtual/libiconv"
-DEPENDS_class-native = ""
-PROVIDES = "virtual/libintl virtual/gettext"
-PROVIDES_class-native = ""
-
-SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
- file://gettext-vpath.patch \
- file://linklib_from_0.17.patch \
- file://gettext-autoconf-lib-link-no-L.patch \
- file://disable_java.patch \
- file://fix_aclocal_version.patch \
- file://fix_gnu_source_circular.patch \
- file://hardcode_macro_version.patch \
- "
-
-LDFLAGS_prepend_libc-uclibc = " -lrt -lpthread "
-
-SRC_URI[md5sum] = "3d9ad24301c6d6b17ec30704a13fe127"
-SRC_URI[sha256sum] = "0bf850d1a079fb5a61f0a47b1a9efd35eb44032255375e1cedb0253bc27b376d"
-
-PARALLEL_MAKE = ""
-
-inherit autotools texinfo
-
-EXTRA_OECONF += "--without-lisp --disable-csharp --disable-openmp --without-emacs"
-acpaths = '-I ${S}/autoconf-lib-link/m4/ \
- -I ${S}/gettext-runtime/m4 \
- -I ${S}/gettext-tools/m4'
-
-do_configure_prepend() {
- rm -f ${S}/config/m4/libtool.m4
-}
-
-# these lack the .x behind the .so, but shouldn't be in the -dev package
-# Otherwise you get the following results:
-# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# because gettext depends on gettext-dev, which pulls in more -dev packages:
-# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
-# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
-# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
-# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
-
-PACKAGES =+ "libgettextlib libgettextsrc"
-FILES_libgettextlib = "${libdir}/libgettextlib-*.so*"
-FILES_libgettextsrc = "${libdir}/libgettextsrc-*.so*"
-
-PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-staticdev gettext-runtime-doc"
-
-FILES_${PN} += "${libdir}/${BPN}/*"
-
-FILES_gettext-runtime = "${bindir}/gettext \
- ${bindir}/ngettext \
- ${bindir}/envsubst \
- ${bindir}/gettext.sh \
- ${libdir}/libasprintf${SODEV} \
- ${libdir}/GNU.Gettext.dll \
- "
-FILES_gettext-runtime_append_libc-uclibc = " ${libdir}/libintl.so.* \
- ${libdir}/charset.alias \
- "
-FILES_gettext-runtime-staticdev += "${libdir}/libasprintf.a"
-FILES_gettext-runtime-dev += "${includedir}/autosprintf.h \
- ${libdir}/libasprintf${SOLIBDEV}"
-FILES_gettext-runtime-dev_append_libc-uclibc = " ${libdir}/libintl.so \
- ${includedir}/libintl.h \
- "
-FILES_gettext-runtime-doc = "${mandir}/man1/gettext.* \
- ${mandir}/man1/ngettext.* \
- ${mandir}/man1/envsubst.* \
- ${mandir}/man1/.* \
- ${mandir}/man3/* \
- ${docdir}/gettext/gettext.* \
- ${docdir}/gettext/ngettext.* \
- ${docdir}/gettext/envsubst.* \
- ${docdir}/gettext/*.3.html \
- ${datadir}/gettext/ABOUT-NLS \
- ${docdir}/gettext/csharpdoc/* \
- ${docdir}/libasprintf/autosprintf.html \
- ${infodir}/autosprintf.info \
- "
-
-
-do_install_append() {
- rm -f ${D}${libdir}/preloadable_libintl.so
-}
-
-# Anyone inheriting gettext will have both gettext-native and gettext
-# available, and we don't want to use older macros from the target gettext in
-# a non-gplv3 build, so kill them and let dependent recipes rely on
-# gettext-native.
-
-SYSROOT_PREPROCESS_FUNCS += "remove_sysroot_m4_macros"
-
-remove_sysroot_m4_macros () {
- rm -r "${SYSROOT_DESTDIR}${datadir}/aclocal"
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/gettext/gettext_0.19.4.bb b/meta/recipes-core/gettext/gettext_0.19.4.bb
deleted file mode 100644
index cebf6c78c6..0000000000
--- a/meta/recipes-core/gettext/gettext_0.19.4.bb
+++ /dev/null
@@ -1,106 +0,0 @@
-SUMMARY = "Utilities and libraries for producing multi-lingual messages"
-DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
-HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
-SECTION = "libs"
-LICENSE = "GPLv3+ & LGPL-2.1+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
-
-DEPENDS = "gettext-native virtual/libiconv expat"
-DEPENDS_class-native = "gettext-minimal-native"
-PROVIDES = "virtual/libintl virtual/gettext"
-PROVIDES_class-native = "virtual/gettext-native"
-RCONFLICTS_${PN} = "proxy-libintl"
-SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
- file://parallel.patch \
- "
-
-PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses,"
-
-LDFLAGS_prepend_libc-uclibc = " -lrt -lpthread "
-
-SRC_URI[md5sum] = "d3511af1e604a3478900d2c2b4a4a48e"
-SRC_URI[sha256sum] = "8ac9f1ed1a5f8c4e656a2f37f5ba6b9ee04c4df79a575e876b0b6946aa417f3f"
-
-inherit autotools texinfo
-
-EXTRA_OECONF += "--without-lispdir \
- --disable-csharp \
- --disable-libasprintf \
- --disable-java \
- --disable-native-java \
- --disable-openmp \
- --disable-acl \
- --with-included-glib \
- --without-emacs \
- --without-cvs \
- --without-git \
- --with-included-libxml \
- --with-included-libcroco \
- --with-included-libunistring \
- "
-
-acpaths = '-I ${S}/gettext-runtime/m4 \
- -I ${S}/gettext-tools/m4'
-
-
-# these lack the .x behind the .so, but shouldn't be in the -dev package
-# Otherwise you get the following results:
-# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
-# because gettext depends on gettext-dev, which pulls in more -dev packages:
-# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
-# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
-# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
-# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
-
-PACKAGES =+ "libgettextlib libgettextsrc"
-FILES_libgettextlib = "${libdir}/libgettextlib-*.so*"
-FILES_libgettextsrc = "${libdir}/libgettextsrc-*.so*"
-
-PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-doc"
-
-FILES_${PN} += "${libdir}/${BPN}/*"
-
-FILES_gettext-runtime = "${bindir}/gettext \
- ${bindir}/ngettext \
- ${bindir}/envsubst \
- ${bindir}/gettext.sh \
- ${libdir}/libasprintf.so* \
- ${libdir}/GNU.Gettext.dll \
- "
-FILES_gettext-runtime_append_libc-uclibc = " ${libdir}/libintl.so.* \
- ${libdir}/charset.alias \
- "
-FILES_gettext-runtime-dev += "${libdir}/libasprintf.a \
- ${includedir}/autosprintf.h \
- "
-FILES_gettext-runtime-dev_append_libc-uclibc = " ${libdir}/libintl.so \
- ${includedir}/libintl.h \
- "
-FILES_gettext-runtime-doc = "${mandir}/man1/gettext.* \
- ${mandir}/man1/ngettext.* \
- ${mandir}/man1/envsubst.* \
- ${mandir}/man1/.* \
- ${mandir}/man3/* \
- ${docdir}/gettext/gettext.* \
- ${docdir}/gettext/ngettext.* \
- ${docdir}/gettext/envsubst.* \
- ${docdir}/gettext/*.3.html \
- ${datadir}/gettext/ABOUT-NLS \
- ${docdir}/gettext/csharpdoc/* \
- ${docdir}/libasprintf/autosprintf.html \
- ${infodir}/autosprintf.info \
- "
-
-do_install_append() {
- rm -f ${D}${libdir}/preloadable_libintl.so
-}
-
-do_install_append_class-native () {
- rm ${D}${datadir}/aclocal/*
- rm ${D}${datadir}/gettext/config.rpath
- rm ${D}${datadir}/gettext/po/Makefile.in.in
- rm ${D}${datadir}/gettext/po/remove-potcdate.sin
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/gettext/gettext_0.21.bb b/meta/recipes-core/gettext/gettext_0.21.bb
new file mode 100644
index 0000000000..5ada709937
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext_0.21.bb
@@ -0,0 +1,208 @@
+SUMMARY = "Utilities and libraries for producing multi-lingual messages"
+DESCRIPTION = "GNU gettext is a set of tools that provides a framework to help other programs produce multi-lingual messages. \
+These tools include a set of conventions about how programs should be written to support message catalogs, a directory and file \
+naming organization for the message catalogs themselves, a runtime library supporting the retrieval of translated messages, and \
+a few stand-alone programs to massage in various ways the sets of translatable and already translated strings."
+HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
+SECTION = "libs"
+LICENSE = "GPLv3+ & LGPL-2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c678957b0c8e964aa6c70fd77641a71e"
+
+DEPENDS = "gettext-native virtual/libiconv"
+DEPENDS:class-native = "gettext-minimal-native"
+PROVIDES = "virtual/libintl virtual/gettext"
+PROVIDES:class-native = "virtual/gettext-native"
+RCONFLICTS:${PN} = "proxy-libintl"
+SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
+ file://parallel.patch \
+ file://use-pkgconfig.patch \
+ file://run-ptest \
+ file://serial-tests-config.patch \
+ file://0001-tests-autopoint-3-unset-MAKEFLAGS.patch \
+ file://0001-init-env.in-do-not-add-C-CXX-parameters.patch \
+ file://mingw.patch \
+ file://0001-msgmerge-29-Add-executable-file-mode-bits.patch \
+ "
+SRC_URI[sha256sum] = "c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12"
+
+inherit autotools texinfo pkgconfig ptest
+
+EXTRA_OECONF += "--without-lispdir \
+ --disable-csharp \
+ --disable-libasprintf \
+ --disable-java \
+ --disable-native-java \
+ --disable-openmp \
+ --disable-acl \
+ --without-emacs \
+ --without-cvs \
+ --without-git \
+ --cache-file=${B}/config.cache \
+ "
+EXTRA_OECONF:append:class-target = " \
+ --with-bisonlocaledir=${datadir}/locale \
+ gt_cv_locale_fr_utf8=fr_FR \
+ gt_cv_locale_fr=fr_FR.ISO-8859-1 \
+ gt_cv_locale_de_utf8=de_DE \
+ gt_cv_locale_de=de_DE.ISO-8859-1 \
+"
+
+PACKAGECONFIG ??= "croco glib libxml"
+PACKAGECONFIG:class-native = ""
+PACKAGECONFIG:class-nativesdk = ""
+
+PACKAGECONFIG[croco] = "--without-included-libcroco,--with-included-libcroco,libcroco"
+PACKAGECONFIG[glib] = "--without-included-glib,--with-included-glib,glib-2.0"
+PACKAGECONFIG[libxml] = "--without-included-libxml,--with-included-libxml,libxml2"
+# Need paths here to avoid host contamination but this can cause RPATH warnings
+# or problems if $libdir isn't $prefix/lib.
+PACKAGECONFIG[libunistring] = "--with-libunistring-prefix=${STAGING_LIBDIR}/..,--with-included-libunistring,libunistring"
+PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses,"
+
+acpaths = '-I ${S}/gettext-runtime/m4 \
+ -I ${S}/gettext-tools/m4'
+
+do_install:append:libc-musl () {
+ rm -f ${D}${libdir}/charset.alias
+ rm -f ${D}${includedir}/libintl.h
+ rm -f ${D}${libdir}/libintl.la
+}
+
+# these lack the .x behind the .so, but shouldn't be in the -dev package
+# Otherwise you get the following results:
+# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
+# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
+# because gettext depends on gettext-dev, which pulls in more -dev packages:
+# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
+# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
+# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
+# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
+
+PACKAGES =+ "libgettextlib libgettextsrc"
+FILES:libgettextlib = "${libdir}/libgettextlib-*.so*"
+FILES:libgettextsrc = "${libdir}/libgettextsrc-*.so*"
+
+PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-doc"
+
+FILES:${PN} += "${libdir}/${BPN}/*"
+
+# The its/Makefile.am has defined:
+# itsdir = $(pkgdatadir)$(PACKAGE_SUFFIX)/its
+# not itsdir = $(pkgdatadir), so use wildcard to match the version.
+FILES:${PN} += "${datadir}/${BPN}-*/*"
+
+FILES:gettext-runtime = "${bindir}/gettext \
+ ${bindir}/ngettext \
+ ${bindir}/envsubst \
+ ${bindir}/gettext.sh \
+ ${libdir}/libasprintf.so* \
+ ${libdir}/GNU.Gettext.dll \
+ "
+FILES:gettext-runtime-dev += "${libdir}/libasprintf.a \
+ ${includedir}/autosprintf.h \
+ "
+FILES:gettext-runtime-doc = "${mandir}/man1/gettext.* \
+ ${mandir}/man1/ngettext.* \
+ ${mandir}/man1/envsubst.* \
+ ${mandir}/man1/.* \
+ ${mandir}/man3/* \
+ ${docdir}/gettext/gettext.* \
+ ${docdir}/gettext/ngettext.* \
+ ${docdir}/gettext/envsubst.* \
+ ${docdir}/gettext/*.3.html \
+ ${datadir}/gettext/ABOUT-NLS \
+ ${docdir}/gettext/csharpdoc/* \
+ ${docdir}/libasprintf/autosprintf.html \
+ ${infodir}/autosprintf.info \
+ "
+
+do_install:append() {
+ rm -f ${D}${libdir}/preloadable_libintl.so
+}
+
+do_install:append:class-native () {
+ rm ${D}${datadir}/aclocal/*
+ rm ${D}${datadir}/gettext/config.rpath
+ rm ${D}${datadir}/gettext/po/Makefile.in.in
+ rm ${D}${datadir}/gettext/po/remove-potcdate.sin
+
+ create_wrapper ${D}${bindir}/msgfmt \
+ GETTEXTDATADIR="${STAGING_DATADIR_NATIVE}/gettext-${PV}/"
+
+}
+
+do_compile_ptest() {
+ cd ${B}/gettext-tools/tests/
+ sed -i '/^buildtest-TESTS: /c buildtest-TESTS: $(TESTS) $(check_PROGRAMS)' Makefile
+ oe_runmake buildtest-TESTS
+ cd -
+}
+
+do_install_ptest() {
+ if [ ${PTEST_ENABLED} = "1" ]; then
+ mkdir -p ${D}${PTEST_PATH}/tests
+ mkdir -p ${D}${PTEST_PATH}/src
+ mkdir -p ${D}${PTEST_PATH}/po
+ mkdir -p ${D}${PTEST_PATH}/misc
+ mkdir -p ${D}${PTEST_PATH}/its
+ mkdir -p ${D}${PTEST_PATH}/styles
+ mkdir -p ${D}${PTEST_PATH}/gnulib-lib
+ mkdir -p ${D}${PTEST_PATH}/examples
+ cp -rf ${S}/gettext-tools/its/* ${D}${PTEST_PATH}/its
+ cp -rf ${S}/gettext-tools/styles/* ${D}${PTEST_PATH}/styles
+ cp -rf ${S}/gettext-tools/gnulib-lib/gettext.h ${D}${PTEST_PATH}/gnulib-lib
+ cp -rf ${S}/gettext-tools/examples/hello-c ${D}${PTEST_PATH}/examples
+ cp -rf ${S}/gettext-tools/tests/* ${D}${PTEST_PATH}/tests
+ cp -rf ${B}/gettext-tools/tests/.libs/* ${D}${PTEST_PATH}/tests
+ cp -rf ${B}/gettext-runtime/intl/.libs/libgnuintl.so.8* ${D}${libdir}/
+ cp -rf ${B}/gettext-tools/tests/Makefile ${D}${PTEST_PATH}/tests
+ cp -rf ${B}/gettext-tools/tests/init-env ${D}${PTEST_PATH}/tests
+ sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile
+ sed -i -e 's:lang-c lang-c++:lang-c++:g' ${D}${PTEST_PATH}/tests/Makefile
+ install ${S}/gettext-tools/src/msgunfmt.tcl ${D}${PTEST_PATH}/src
+ install ${S}/gettext-tools/src/project-id ${D}${PTEST_PATH}/src
+ install ${B}/gettext-runtime/src/gettext.sh ${D}${PTEST_PATH}/src
+ install ${B}/gettext-runtime/src/ngettext ${D}${PTEST_PATH}/src
+ install ${B}/gettext-runtime/src/envsubst ${D}${PTEST_PATH}/src
+ install ${B}/gettext-runtime/src/gettext ${D}${PTEST_PATH}/src
+ install ${B}/gettext-tools/src/.libs/cldr-plurals ${D}${PTEST_PATH}/src
+ install ${S}/gettext-tools/po/gettext-tools.pot ${D}${PTEST_PATH}/po
+ install ${B}/gettext-tools/misc/* ${D}${PTEST_PATH}/misc
+ find ${D}${PTEST_PATH}/ -name "*.o" -exec rm {} \;
+ chmod 0755 ${D}${PTEST_PATH}/tests/lang-vala ${D}${PTEST_PATH}/tests/plural-1 ${D}${PTEST_PATH}/tests/xgettext-tcl-4 \
+ ${D}${PTEST_PATH}/tests/xgettext-vala-1 ${D}${PTEST_PATH}/tests/xgettext-po-2
+ sed -i -e 's|${DEBUG_PREFIX_MAP}||g' ${D}${PTEST_PATH}/tests/init-env
+ fi
+}
+
+RDEPENDS:${PN}-ptest += "make xz"
+RDEPENDS:${PN}-ptest:append:libc-glibc = "\
+ glibc-gconv-big5 \
+ glibc-charmap-big5 \
+ glibc-gconv-cp1251 \
+ glibc-charmap-cp1251 \
+ glibc-charmap-iso-8859-9 \
+ glibc-gconv-iso8859-9 \
+ glibc-charmap-koi8-r \
+ glibc-gconv-koi8-r \
+ glibc-gconv-iso8859-2 \
+ glibc-charmap-iso-8859-2 \
+ glibc-gconv-iso8859-1 \
+ glibc-charmap-iso-8859-1 \
+ glibc-gconv-euc-kr \
+ glibc-charmap-euc-kr \
+ glibc-gconv-euc-jp \
+ glibc-charmap-euc-jp \
+ locale-base-de-de \
+ locale-base-fr-fr \
+"
+
+RRECOMMENDS:${PN}-ptest:append:libc-glibc = "\
+ locale-base-de-de.iso-8859-1 \
+ locale-base-fr-fr.iso-8859-1 \
+"
+
+INSANE_SKIP:${PN}-ptest += "ldflags"
+INSANE_SKIP:${PN}-ptest += "rpaths"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch
new file mode 100644
index 0000000000..f3a0069633
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-ignore-return-value-of-write.patch
@@ -0,0 +1,39 @@
+From 658c034d92027dc8af5f784cae852123fac79b19 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 16 Apr 2016 13:28:59 -0700
+Subject: [PATCH] Do not ignore return value of write()
+
+gcc warns about ignoring return value when compiling
+with fortify turned on.
+
+assert when write() fails
+
+Upstream-Status: Submitted
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ glib/tests/unix.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/glib/tests/unix.c b/glib/tests/unix.c
+index 7639d06..f941141 100644
+--- a/glib/tests/unix.c
++++ b/glib/tests/unix.c
+@@ -33,14 +33,15 @@ test_pipe (void)
+ GError *error = NULL;
+ int pipefd[2];
+ char buf[1024];
+- gssize bytes_read;
++ gssize bytes_read, bytes_written;
+ gboolean res;
+
+ res = g_unix_open_pipe (pipefd, FD_CLOEXEC, &error);
+ g_assert (res);
+ g_assert_no_error (error);
+
+- write (pipefd[1], "hello", sizeof ("hello"));
++ bytes_written = write (pipefd[1], "hello", sizeof ("hello"));
++ g_assert (bytes_written != -1 && "write() failed");
+ memset (buf, 0, sizeof (buf));
+ bytes_read = read (pipefd[0], buf, sizeof(buf) - 1);
+ g_assert_cmpint (bytes_read, >, 0);
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-write-bindir-into-pkg-config-files.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-write-bindir-into-pkg-config-files.patch
new file mode 100644
index 0000000000..5fe3aa898e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Do-not-write-bindir-into-pkg-config-files.patch
@@ -0,0 +1,61 @@
+From 0797a40627a4cb5439a24b872edc65356dceaaf0 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Fri, 15 Feb 2019 11:17:27 +0100
+Subject: [PATCH] Do not write $bindir into pkg-config files
+
+This would otherwise break when using the files to build other target
+components (we need to rely on PATH containing the paths to utilities,
+rather than use target paths).
+
+Upstream-Status: Inappropriate [upstream wants the paths in .pc files]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
+---
+ gio/meson.build | 16 ++++++++--------
+ glib/meson.build | 6 +++---
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/gio/meson.build b/gio/meson.build
+index 532b086..98468a3 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -820,14 +820,14 @@ pkg.generate(libgio,
+ 'schemasdir=' + join_paths('${datadir}', schemas_subdir),
+ 'bindir=' + join_paths('${prefix}', get_option('bindir')),
+ 'giomoduledir=' + pkgconfig_giomodulesdir,
+- 'gio=' + join_paths('${bindir}', 'gio'),
+- 'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'),
+- 'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'),
+- 'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'),
+- 'gdbus=' + join_paths('${bindir}', 'gdbus'),
+- 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'),
+- 'gresource=' + join_paths('${bindir}', 'gresource'),
+- 'gsettings=' + join_paths('${bindir}', 'gsettings')],
++ 'gio=gio',
++ 'gio_querymodules=gio-querymodules',
++ 'glib_compile_schemas=glib-compile-schemas',
++ 'glib_compile_resources=glib-compile-resources',
++ 'gdbus=gdbus',
++ 'gdbus_codegen=gdbus-codegen',
++ 'gresource=gresource',
++ 'gsettings=gsettings'],
+ version : glib_version,
+ install_dir : glib_pkgconfigreldir,
+ filebase : 'gio-2.0',
+diff --git a/glib/meson.build b/glib/meson.build
+index aaf5f00..1e0992b 100644
+--- a/glib/meson.build
++++ b/glib/meson.build
+@@ -375,9 +375,9 @@ pkg.generate(libglib,
+ subdirs : ['glib-2.0'],
+ extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
+ variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
+- 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
+- 'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
+- 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
++ 'glib_genmarshal=glib-genmarshal',
++ 'gobject_query=gobject-query',
++ 'glib_mkenums=glib-mkenums'],
+ version : glib_version,
+ install_dir : glib_pkgconfigreldir,
+ filebase : 'glib-2.0',
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch
new file mode 100644
index 0000000000..16f2d31496
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch
@@ -0,0 +1,31 @@
+From c94e669de98a3892c699bd8d0d2b5164b2de747e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 15 Mar 2014 22:42:29 -0700
+Subject: [PATCH] Fix DATADIRNAME on uclibc/Linux
+
+translation files are always installed under PREFIX/share/locale in uclibc
+based systems therefore lets set DATADIRNAME to "share".
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+
+---
+ m4macros/glib-gettext.m4 | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4
+index df6fbf0..47db864 100644
+--- a/m4macros/glib-gettext.m4
++++ b/m4macros/glib-gettext.m4
+@@ -293,6 +293,10 @@ msgstr ""
+ CATOBJEXT=.mo
+ DATADIRNAME=share
+ ;;
++ *-*-musl* | *-*-linux-uclibc*)
++ CATOBJEXT=.gmo
++ DATADIRNAME=share
++ ;;
+ *)
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch
new file mode 100644
index 0000000000..597864d9ac
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch
@@ -0,0 +1,27 @@
+From 0015db45cd1bfefc04959dffab5dabeead93136f Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Tue, 22 Mar 2016 15:14:58 +0200
+Subject: [PATCH] Install gio-querymodules as libexec_PROGRAM
+
+We want to install this binary with the gio library, and debian
+renamer does not cope with library packages with files in ${bindir}
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Upstream-Status: Inappropriate [OE specific]
+
+---
+ gio/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/gio/meson.build b/gio/meson.build
+index 2ef60ed..532b086 100644
+--- a/gio/meson.build
++++ b/gio/meson.build
+@@ -936,6 +936,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu
+ c_args : gio_c_args,
+ # intl.lib is not compatible with SAFESEH
+ link_args : noseh_link_args,
++ install_dir: glib_libexecdir,
+ dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
+
+ glib_compile_schemas = executable('glib-compile-schemas',
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch
index 41a190eddf..6fd93526ce 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch
@@ -1,4 +1,4 @@
-From 41534253b6b61ed4769eb6a3966698a50ee73b71 Mon Sep 17 00:00:00 2001
+From 4f47b8a8d650d185aa61aec2f56a283522a723c4 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 12 Jun 2015 17:08:46 +0300
Subject: [PATCH] Remove the warning about deprecated paths in schemas
@@ -11,26 +11,30 @@ Upstream-Status: Inappropriate
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
- gio/glib-compile-schemas.c | 6 ------
- 1 file changed, 6 deletions(-)
+ gio/glib-compile-schemas.c | 13 -------------
+ 1 file changed, 13 deletions(-)
diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
-index e42949b..ec79d7c 100644
+index 7888120..7acbd5b 100644
--- a/gio/glib-compile-schemas.c
+++ b/gio/glib-compile-schemas.c
-@@ -1202,12 +1202,6 @@ parse_state_start_schema (ParseState *state,
+@@ -1232,19 +1232,6 @@ parse_state_start_schema (ParseState *state,
return;
}
- if (path && (g_str_has_prefix (path, "/apps/") ||
- g_str_has_prefix (path, "/desktop/") ||
- g_str_has_prefix (path, "/system/")))
-- g_printerr ("warning: Schema '%s' has path '%s'. Paths starting with "
-- "'/apps/', '/desktop/' or '/system/' are deprecated.\n", id, path);
+- {
+- gchar *message = NULL;
+- message = g_strdup_printf (_("Warning: Schema “%s” has path “%s”. "
+- "Paths starting with "
+- "“/apps/”, “/desktop/” or “/system/” are deprecated."),
+- id, path);
+- g_printerr ("%s\n", message);
+- g_free (message);
+- }
-
state->schema_state = schema_state_new (path, gettext_domain,
extends, extends_name, list_of);
---
-2.1.4
-
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch
new file mode 100644
index 0000000000..8a6d46df79
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch
@@ -0,0 +1,95 @@
+From 333809ded70ad4e3470b7134e3fac1a42ff48e61 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Wed, 13 Feb 2019 15:32:05 +0100
+Subject: [PATCH] Set host_machine correctly when building with mingw32
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
+---
+ gio/tests/meson.build | 8 ++++----
+ glib/tests/meson.build | 2 +-
+ meson.build | 3 +++
+ tests/meson.build | 2 +-
+ 4 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/gio/tests/meson.build b/gio/tests/meson.build
+index 3a19c82..b762835 100644
+--- a/gio/tests/meson.build
++++ b/gio/tests/meson.build
+@@ -27,7 +27,7 @@ test_c_args = [
+ endif # libutil.length() > 0
+ endif # build_machine.system() == 'linux'
+
+-if host_machine.system() == 'windows'
++if host_system == 'windows'
+ common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
+ endif
+
+@@ -148,7 +148,7 @@ else
+ endif
+
+ # Test programs buildable on UNIX only
+-if host_machine.system() != 'windows'
++if host_system != 'windows'
+ gio_tests += {
+ 'file' : {},
+ 'gdbus-peer' : {
+@@ -402,7 +402,7 @@ if host_machine.system() != 'windows'
+ endif # unix
+
+ # Test programs buildable on Windows only
+-if host_machine.system() == 'windows'
++if host_system == 'windows'
+ gio_tests += {'win32-streams' : {}}
+ endif
+
+@@ -472,7 +472,7 @@ if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
+ }
+ endif
+
+-if host_machine.system() != 'windows'
++if host_system != 'windows'
+ test_extra_programs += {
+ 'gdbus-example-unix-fd-client' : {
+ 'install' : false,
+diff --git a/glib/tests/meson.build b/glib/tests/meson.build
+index 6eb23e8..36eb919 100644
+--- a/glib/tests/meson.build
++++ b/glib/tests/meson.build
+@@ -142,7 +142,7 @@ if glib_conf.has('HAVE_EVENTFD')
+ }
+ endif
+
+-if host_machine.system() == 'windows'
++if host_system == 'windows'
+ if winsock2.found()
+ glib_tests += {
+ 'gpoll' : {
+diff --git a/meson.build b/meson.build
+index 47f3a5c..7ea7ad1 100644
+--- a/meson.build
++++ b/meson.build
+@@ -32,6 +32,9 @@ else
+ endif
+
+ host_system = host_machine.system()
++if host_system == 'mingw32'
++ host_system = 'windows'
++endif
+
+ if host_system == 'darwin'
+ ios_test_code = '''#include <TargetConditionals.h>
+diff --git a/tests/meson.build b/tests/meson.build
+index 6741f8f..12fdc90 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -73,7 +73,7 @@ test_extra_programs = {
+ 'unicode-collate' : {},
+ }
+
+-if host_machine.system() != 'windows'
++if host_system != 'windows'
+ tests += {
+ 'timeloop' : {},
+ 'iochannel-test' : {},
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch
deleted file mode 100644
index 0be36316b9..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-commit 9b38d507ec37b3d7d4df6095fa7ed16b47d399f7
-Author: Drew Moseley <drew_moseley@mentor.com>
-Date: Sat Mar 29 21:10:43 2014 -0400
-
- configure.ac: Do not use readlink when cross compiling.
-
- Do not use readlink to set ABS_GLIB_RUNTIME_LIBDIR when cross
- compiling. Doing so causes host paths to potentially pollute
- the target.
-
- Note that in this case the path is not converted to absolute if
- it contains any ".." references so it's not completely correct.
-
- Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=727575]
- Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
-
-diff -rub glib-2.38.2.orig/configure.ac glib-2.38.2/configure.ac
---- glib-2.38.2.orig/configure.ac 2014-04-03 20:17:13.035567143 -0400
-+++ glib-2.38.2/configure.ac 2014-04-03 20:19:07.071566057 -0400
-@@ -275,7 +275,11 @@
- [],
- [with_runtime_libdir=""])
- GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
-+AS_IF([ test $cross_compiling = yes ], [
-+ABS_GLIB_RUNTIME_LIBDIR="$libdir/$with_runtime_libdir"
-+], [
- ABS_GLIB_RUNTIME_LIBDIR="`readlink -m $libdir/$with_runtime_libdir`"
-+])
- AC_SUBST(GLIB_RUNTIME_LIBDIR)
- AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
- AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch
new file mode 100644
index 0000000000..fbdd4c2660
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch
@@ -0,0 +1,26 @@
+From b833254bcc9fcf4cdc2572027b1154d799535ca4 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sun, 20 Dec 2020 22:01:43 +0100
+Subject: [PATCH] gio/tests/codegen.py: bump timeout to 100 seconds
+
+This may be necessary on overloaded CI systems.
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ gio/tests/codegen.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gio/tests/codegen.py b/gio/tests/codegen.py
+index 51de0ed..ca98c9d 100644
+--- a/gio/tests/codegen.py
++++ b/gio/tests/codegen.py
+@@ -55,7 +55,7 @@ class TestCodegen(unittest.TestCase):
+ cwd = ""
+
+ def setUp(self):
+- self.timeout_seconds = 10 # seconds per test
++ self.timeout_seconds = 100 # seconds per test
+ self.tmpdir = tempfile.TemporaryDirectory()
+ self.cwd = os.getcwd()
+ os.chdir(self.tmpdir.name)
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch
new file mode 100644
index 0000000000..d33fdd4d8b
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch
@@ -0,0 +1,28 @@
+From 92de6c7eb30b961b24a2dce812d5276487b7d23d Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Wed, 8 Jan 2020 18:22:46 +0100
+Subject: [PATCH] gio/tests/resources.c: comment out a build host-only test
+
+This test requires building resources in a way that is
+not cross-compatible (hardcodes ld and objcopy).
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
+---
+ gio/tests/resources.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gio/tests/resources.c b/gio/tests/resources.c
+index c44d214..e289a01 100644
+--- a/gio/tests/resources.c
++++ b/gio/tests/resources.c
+@@ -993,7 +993,7 @@ main (int argc,
+ g_test_add_func ("/resource/automatic", test_resource_automatic);
+ /* This only uses automatic resources too, so it tests the constructors and destructors */
+ g_test_add_func ("/resource/module", test_resource_module);
+- g_test_add_func ("/resource/binary-linked", test_resource_binary_linked);
++ /* g_test_add_func ("/resource/binary-linked", test_resource_binary_linked); */
+ #endif
+ g_test_add_func ("/resource/uri/query-info", test_uri_query_info);
+ g_test_add_func ("/resource/uri/file", test_uri_file);
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch
new file mode 100644
index 0000000000..44482dd2b7
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch
@@ -0,0 +1,29 @@
+From 4b97f457b7b44117e27d2a218c4b68e7fe3fe4ce Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 12 Oct 2019 17:46:26 -0700
+Subject: [PATCH] meson: Run atomics test on clang as well
+
+Fixes
+./glib-2.62.1/glib/gatomic.c:675:2: error: G_ATOMIC_LOCK_FREE defined, but incapable of lock-free atomics.
+^
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index afb6eaa..6aa70f5 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1692,7 +1692,7 @@ atomicdefine = '''
+ # We know that we can always use real ("lock free") atomic operations with MSVC
+ if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, name : 'atomic ops')
+ have_atomic_lock_free = true
+- if cc.get_id() == 'gcc' and not cc.compiles(atomicdefine, name : 'atomic ops define')
++ if (cc.get_id() == 'gcc' or cc.get_id() == 'clang') and not cc.compiles(atomicdefine, name : 'atomic ops define')
+ # Old gcc release may provide
+ # __sync_bool_compare_and_swap but doesn't define
+ # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch b/meta/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch
new file mode 100644
index 0000000000..1c645f3a9a
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch
@@ -0,0 +1,44 @@
+From 79ce7e545dd3a93f77d2146d50b6fa061fbceed9 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Tue, 3 Oct 2017 10:45:55 +0300
+Subject: [PATCH] Do not hardcode python path into various tools
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
+---
+ gio/gdbus-2.0/codegen/gdbus-codegen.in | 2 +-
+ gobject/glib-genmarshal.in | 2 +-
+ gobject/glib-mkenums.in | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in
+index 67d3675..4e92a7a 100755
+--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in
++++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env @PYTHON@
++#!/usr/bin/env python3
+
+ # GDBus - GLib D-Bus Library
+ #
+diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in
+index 7380f24..c8abeaa 100755
+--- a/gobject/glib-genmarshal.in
++++ b/gobject/glib-genmarshal.in
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env @PYTHON@
++#!/usr/bin/env python3
+
+ # pylint: disable=too-many-lines, missing-docstring, invalid-name
+
+diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
+index 91ad779..3ebef62 100755
+--- a/gobject/glib-mkenums.in
++++ b/gobject/glib-mkenums.in
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env @PYTHON@
++#!/usr/bin/env python3
+
+ # If the code below looks horrible and unpythonic, do not panic.
+ #
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/Enable-more-tests-while-cross-compiling.patch b/meta/recipes-core/glib-2.0/glib-2.0/Enable-more-tests-while-cross-compiling.patch
new file mode 100644
index 0000000000..9bbb33ffc1
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/Enable-more-tests-while-cross-compiling.patch
@@ -0,0 +1,121 @@
+From 73b1c416674d285b021e218da1a3ddb884e606da Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Mon, 9 Nov 2015 11:07:27 +0200
+Subject: [PATCH] Enable more tests while cross-compiling
+
+Upstream disables a few tests while cross-compiling because their build requires
+running other built binaries. This usually makes sense but in the cross-compile
+case we can depend on glib-2.0-native.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+
+---
+ gio/tests/meson.build | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/gio/tests/meson.build b/gio/tests/meson.build
+index 5dbfb8e..3fd7998 100644
+--- a/gio/tests/meson.build
++++ b/gio/tests/meson.build
+@@ -221,7 +221,7 @@ if host_machine.system() != 'windows'
+
+ # Test programs that need to bring up a session bus (requires dbus-daemon)
+ have_dbus_daemon = find_program('dbus-daemon', required : false).found()
+- if have_dbus_daemon
++ if true
+ annotate_args = [
+ '--annotate', 'org.project.Bar', 'Key1', 'Value1',
+ '--annotate', 'org.project.Bar', 'org.gtk.GDBus.Internal', 'Value2',
+@@ -570,12 +570,12 @@ if installed_tests_enabled
+ endforeach
+ endif
+
+-if not meson.is_cross_build() or meson.has_exe_wrapper()
++if meson.is_cross_build()
+
+ plugin_resources_c = custom_target('plugin-resources.c',
+ input : 'test4.gresource.xml',
+ output : 'plugin-resources.c',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--generate-source',
+@@ -599,7 +599,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ test_gresource = custom_target('test.gresource',
+ input : 'test.gresource.xml',
+ output : 'test.gresource',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+@@ -610,7 +610,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ test_resources2_c = custom_target('test_resources2.c',
+ input : 'test3.gresource.xml',
+ output : 'test_resources2.c',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--generate',
+@@ -621,7 +621,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ test_resources2_h = custom_target('test_resources2.h',
+ input : 'test3.gresource.xml',
+ output : 'test_resources2.h',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--generate',
+@@ -633,7 +633,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ input : 'test2.gresource.xml',
+ depends : big_test_resource,
+ output : 'test_resources.c',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+@@ -644,7 +644,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ digit_test_resources_c = custom_target('digit_test_resources.c',
+ input : '111_digit_test.gresource.xml',
+ output : 'digit_test_resources.c',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+@@ -655,7 +655,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ digit_test_resources_h = custom_target('digit_test_resources.h',
+ input : '111_digit_test.gresource.xml',
+ output : 'digit_test_resources.h',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--generate',
+@@ -688,11 +688,11 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+
+ ld = find_program('ld', required : false)
+
+- if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
++ if not meson.is_cross_build()
+ test_gresource_binary = custom_target('test5.gresource',
+ input : 'test5.gresource.xml',
+ output : 'test5.gresource',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
+@@ -704,7 +704,7 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
+ test_resources_binary_c = custom_target('test_resources_binary.c',
+ input : 'test5.gresource.xml',
+ output : 'test_resources_binary.c',
+- command : [glib_compile_resources,
++ command : ['glib-compile-resources',
+ '--target=@OUTPUT@',
+ '--sourcedir=' + meson.current_source_dir(),
+ '--sourcedir=' + meson.current_build_dir(),
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/add-march-i486-into-CFLAGS-automatically.patch b/meta/recipes-core/glib-2.0/glib-2.0/add-march-i486-into-CFLAGS-automatically.patch
deleted file mode 100644
index 3aac35a5d3..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/add-march-i486-into-CFLAGS-automatically.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 55253b55b9c65f3e0efbbe03cbab2a4c4014a16b Mon Sep 17 00:00:00 2001
-From: Song.Li <Song.Li@windriver.com>
-Date: Thu, 5 Jul 2012 15:09:41 +0800
-Subject: [PATCH] add -march=i486 into CFLAGS automatically
-
-Upstream-Status: Inappropriate [configuration]
-
-glib configure will check if current gcc need -march=i486,
-when gcc need -march=i486 but CFLAGS don't have,
-glib configure will abort and advise the user to add -march=i486 or later.
-This will break the build process,it's not good for automatic build system.
-so change this to adding -march=i485 automatically when it is needed.
----
- configure.ac | 6 ++++--
- 1 files changed, 4 insertions(+), 2 deletions(-)
-
-Index: glib-2.36.0/configure.ac
-===================================================================
---- glib-2.36.0.orig/configure.ac
-+++ glib-2.36.0/configure.ac
-@@ -2378,7 +2378,7 @@ dnl
- dnl Note that the atomic ops are only available with GCC on x86 when
- dnl using -march=i486 or higher. If we detect that the atomic ops are
- dnl not available but would be available given the right flags, we want
--dnl to abort and advise the user to fix their CFLAGS. It's better to do
-+dnl to add -march=i486 automatically to fix their CFLAGS. It's better to do
- dnl that then to silently fall back on emulated atomic ops just because
- dnl the user had the wrong build environment.
-
-@@ -2401,7 +2401,8 @@ AC_CACHE_CHECK([for lock-free atomic int
- AC_TRY_COMPILE([],
- [volatile int atomic = 2;\
- __sync_bool_compare_and_swap (&atomic, 2, 3);],
-- [AC_MSG_ERROR([GLib must be build with -march=i486 or later.])],
-+ [AC_MSG_WARN([GLib must be build with -march=i486 or later.])
-+ SAVE_CFLAGS="${SAVE_CFLAGS} -march=i486"],
- [])
- CFLAGS="${SAVE_CFLAGS}"
- fi
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch b/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
deleted file mode 100644
index 3d0c008bbe..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From c53e94a520b573aa0dcf12903e9563fe8badc34c Mon Sep 17 00:00:00 2001
-From: Marius Avram <marius.avram@intel.com>
-Date: Wed, 27 Aug 2014 12:10:41 +0300
-Subject: [PATCH] Allow /run/media/sdX drive mount if username root
-
-In case that the username logged in the system is root
-the drives are directly mounted in /run/media/sdX and
-not /run/media/<username>/sdX as the function
-g_unix_mount_guess_should_display() expects.
-
-Without this change USB stick mounts are not accesible from
-graphical applications such as the File Manager (pcmanfm).
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Marius Avram <marius.avram@intel.com>
----
- gio/gunixmounts.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
-index 4999354..f6c1472 100644
---- a/gio/gunixmounts.c
-+++ b/gio/gunixmounts.c
-@@ -2136,6 +2136,11 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
- mount_path[sizeof ("/run/media/") - 1 + user_name_len] == '/')
- is_in_runtime_dir = TRUE;
-
-+ /* Allow no username in path in /run/media if current user is root */
-+ if (strcmp(user_name, "root") == 0 &&
-+ strncmp (mount_path, "/run/media/", sizeof("run/media")) == 0)
-+ is_in_runtime_dir = TRUE;
-+
- if (is_in_runtime_dir || g_str_has_prefix (mount_path, "/media/"))
- {
- char *path;
---
-1.7.9.5
-
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/configure-libtool.patch b/meta/recipes-core/glib-2.0/glib-2.0/configure-libtool.patch
deleted file mode 100644
index 1d69a3f290..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/configure-libtool.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 1c5718648d49e795efee91c220a2bf9386c184f2 Mon Sep 17 00:00:00 2001
-From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Sat, 28 Apr 2012 18:24:50 +0200
-Subject: [PATCH] configure: use $host_alias-libtool instead of libtool
- directly
-
-Poky renames libtool to $host_alias-libtool.
-./$host_alias-libtool isn't created until after configure runs with
-libtool >= 2.2.2
-so we can't call # it at this point. We can safely assume a version is
-available
-from PATH though
-
-Rebased to glib-2.27.3 by Dongxiao Xu <dongxiao.xu@intel.com>
-Rebased to glib-2.32.1 by Martin Jansa <Martin.Jansa@gmail.com>
-
-Upstream-Status: Inappropriate [configuration]
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- configure.ac | 8 ++++----
- 1 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index a6478c6..9a93d60 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1470,7 +1470,7 @@ if test x"$glib_native_win32" = xyes; then
- G_MODULE_LDFLAGS=
- else
- export SED
-- G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
-+ G_MODULE_LDFLAGS=`(./$host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
- fi
- dnl G_MODULE_IMPL= don't reset, so cmd-line can override
- G_MODULE_NEED_USCORE=0
-@@ -1535,9 +1535,9 @@ if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
- LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
- dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
- echo "void glib_plugin_test(void) { }" > plugin.c
-- ${SHELL} ./libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
-+ ${SHELL} ./$host_alias-libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
- ${CPPFLAGS} -c -o plugin.lo plugin.c >/dev/null 2>&1
-- ${SHELL} ./libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
-+ ${SHELL} ./$host_alias-libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
- ${LDFLAGS} -module -o plugin.la -export-dynamic \
- -shrext ".o" -avoid-version plugin.lo \
- -rpath /dont/care >/dev/null 2>&1
-@@ -1614,7 +1614,7 @@ fi
-
- AC_MSG_CHECKING(for the suffix of module shared libraries)
- export SED
--shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
-+shrext_cmds=`./$host_alias-libtool --config | grep '^shrext_cmds='`
- eval $shrext_cmds
- module=yes eval std_shrext=$shrext_cmds
- # chop the initial dot
---
-1.7.8.6
-
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/fix-conflicting-rand.patch b/meta/recipes-core/glib-2.0/glib-2.0/fix-conflicting-rand.patch
deleted file mode 100644
index 1571112b0e..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/fix-conflicting-rand.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-Rename 'rand' variable to avoid conflict.
-
-Upstream-Status: pending
-Signed-off-by: Björn Stenberg <bjst@enea.com>
-
-diff -u glib-2.34.3/tests/refcount/signals.c~ glib-2.34.3/tests/refcount/signals.c
---- glib-2.34.3/tests/refcount/signals.c 2012-11-26 17:52:48.000000000 +0100
-+++ glib-2.34.3/tests/refcount/signals.c 2013-02-08 14:24:10.052477546 +0100
-@@ -9,7 +9,7 @@
- #define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
- #define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
-
--static GRand *rand;
-+static GRand *grand;
-
- typedef struct _GTest GTest;
- typedef struct _GTestClass GTestClass;
-@@ -84,7 +84,7 @@
- NULL
- };
-
-- rand = g_rand_new();
-+ grand = g_rand_new();
-
- test_type = g_type_register_static (G_TYPE_OBJECT, "GTest",
- &test_info, 0);
-@@ -218,7 +218,7 @@
- static void
- my_test_do_prop (GTest * test)
- {
-- test->value = g_rand_int (rand);
-+ test->value = g_rand_int (grand);
- g_object_notify (G_OBJECT (test), "test-prop");
- }
-
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/glib-2.0-configure-readlink.patch b/meta/recipes-core/glib-2.0/glib-2.0/glib-2.0-configure-readlink.patch
deleted file mode 100644
index 9759d11e3c..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/glib-2.0-configure-readlink.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-configure.ac: change readlink -f to -m
-
-Change "readlink -f" to "readlink -m" since $libdir/$with_runtime_libdir
-may not exist.
-
-This patch should go to the upstream, I will send it sooner.
-
-Upstream-Status: Pending
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
---- a/configure.ac
-+++ b/configure.ac
-@@ -271,7 +271,7 @@ AC_ARG_WITH(runtime-libdir,
- [],
- [with_runtime_libdir=""])
- GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
--ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
-+ABS_GLIB_RUNTIME_LIBDIR="`readlink -m $libdir/$with_runtime_libdir`"
- AC_SUBST(GLIB_RUNTIME_LIBDIR)
- AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
- AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
---
-1.8.1.2
-
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/glib-gettextize-dir.patch b/meta/recipes-core/glib-2.0/glib-2.0/glib-gettextize-dir.patch
deleted file mode 100644
index ee435111fc..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/glib-gettextize-dir.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-# an very old patch cherry-picked in every glib-2.0 patch directory. The earliest container
-# for it is 2.6.5 in OE. The earliest commit for it is c8e5702127e507e82e6f68a4b8c546803accea9d
-# in OE side which ports from previous bitkeeper SCM. In OE side it's only used til 2.12.4.
-#
-# keep it since it's always cleaner to not hardcode destination path. Use @datadir@ is more
-# portable here. mark for upstream
-#
-# by Kevin Tian <kevin.tian@intel.com>, 06/25/2010
-# Rebased by Dongxiao Xu <dongxiao.xu@intel.com>, 11/16/2010
-
-Upstream-Status: Inappropriate [configuration]
-
-diff -ruN glib-2.27.3-orig/glib-gettextize.in glib-2.27.3/glib-gettextize.in
---- glib-2.27.3-orig/glib-gettextize.in 2009-04-01 07:04:20.000000000 +0800
-+++ glib-2.27.3/glib-gettextize.in 2010-11-16 12:55:06.874605916 +0800
-@@ -52,7 +52,7 @@
- datadir=@datadir@
- datarootdir=@datarootdir@
-
--gettext_dir=$prefix/share/glib-2.0/gettext
-+gettext_dir=@datadir@/glib-2.0/gettext
-
- while test $# -gt 0; do
- case "$1" in
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common
new file mode 100644
index 0000000000..0d7c5fa3f8
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common
@@ -0,0 +1,3 @@
+[properties]
+# On all known supported architectures the stack grows down
+growing_stack = false
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc
new file mode 100644
index 0000000000..c4648f58c7
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc
@@ -0,0 +1,5 @@
+[properties]
+have_c99_vsnprintf = true
+have_c99_snprintf = true
+have_unix98_printf = true
+va_val_copy = true
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux
new file mode 100644
index 0000000000..adad7e62ee
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux
@@ -0,0 +1,5 @@
+[properties]
+have_proc_self_cmdline = true
+
+[binaries]
+env = '/usr/bin/env'
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw
new file mode 100644
index 0000000000..75f911ba1e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw
@@ -0,0 +1,6 @@
+[properties]
+have_c99_vsnprintf = false
+have_c99_snprintf = false
+have_unix98_printf = false
+va_val_copy = true
+have_proc_self_cmdline = false
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl
new file mode 100644
index 0000000000..3049e5116e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl
@@ -0,0 +1,6 @@
+[properties]
+have_c99_vsnprintf = true
+have_c99_snprintf = true
+have_unix98_printf = true
+va_val_copy = true
+have_strlcpy = true
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/ptest-paths.patch b/meta/recipes-core/glib-2.0/glib-2.0/ptest-paths.patch
deleted file mode 100644
index f3be02770c..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/ptest-paths.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Instead of writing the temporary mapping files in the mappedfile test to the
-user runtime directory, write them to $TMP. The runtime directory may not
-currently exist if the test is executed on a non-desktop system and the test
-doesn't attempt to create the directory structure.
-
-Upstream-Status: Pending
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-diff --git a/glib/tests/mappedfile.c b/glib/tests/mappedfile.c
-index 40e0e60..27a24be 100644
---- a/glib/tests/mappedfile.c
-+++ b/glib/tests/mappedfile.c
-@@ -81,7 +81,7 @@ test_writable (void)
- const gchar *new = "abcdefghijklmnopqrstuvxyz";
- gchar *tmp_copy_path;
-
-- tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
-+ tmp_copy_path = g_build_filename (g_get_tmp_dir (), "glib-test-4096-random-bytes", NULL);
-
- g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
- g_assert_no_error (error);
-@@ -125,7 +125,7 @@ test_writable_fd (void)
- int fd;
- gchar *tmp_copy_path;
-
-- tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
-+ tmp_copy_path = g_build_filename (g_get_tmp_dir (), "glib-test-4096-random-bytes", NULL);
-
- g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
- g_assert_no_error (error);
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch b/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch
new file mode 100644
index 0000000000..9bfb6e85cc
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch
@@ -0,0 +1,50 @@
+From ab071f315deed3740f867161ee58436b985d6fc1 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@intel.com>
+Date: Fri, 11 Mar 2016 15:35:55 +0000
+Subject: [PATCH] glib-2.0: relocate the GIO module directory for native builds
+
+Instead of hard-coding GIO_MODULE_PATH when glib is built, use dladdr() to
+determine where libglib.so is and use that path to calculate GIO_MODULES_DIR.
+
+This solves relocation problems with GIOModule for native builds of glib.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+Port patch to 2.48
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+
+---
+ gio/giomodule.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/gio/giomodule.c b/gio/giomodule.c
+index d34037a..7442df6 100644
+--- a/gio/giomodule.c
++++ b/gio/giomodule.c
+@@ -54,6 +54,8 @@
+ #ifdef G_OS_WIN32
+ #include "gregistrysettingsbackend.h"
+ #include "giowin32-priv.h"
++#else
++#include <dlfcn.h>
+ #endif
+ #include <glib/gstdio.h>
+
+@@ -1224,7 +1226,15 @@ get_gio_module_dir (void)
+ NULL);
+ g_free (install_dir);
+ #else
+- module_dir = g_strdup (GIO_MODULE_DIR);
++ Dl_info info;
++
++ if (dladdr (g_io_module_new, &info)) {
++ char *libdir = g_path_get_dirname (info.dli_fname);
++ module_dir = g_build_filename (libdir, "gio", "modules", NULL);
++ g_free (libdir);
++ } else {
++ module_dir = g_strdup (GIO_MODULE_DIR);
++ }
+ #endif
+ }
+
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/run-ptest b/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
index 130ae09b6c..7a231b514b 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
+++ b/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
@@ -1,3 +1,9 @@
#! /bin/sh
-gnome-desktop-testing-runner glib
+set -eux
+if id -u glib2-test; then
+ userdel glib2-test
+fi
+useradd glib2-test
+su glib2-test -c 'gnome-desktop-testing-runner glib'
+userdel glib2-test
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch b/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch
deleted file mode 100644
index 2a154fdd4a..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Fix DATADIRNAME on uclibc/Linux
-
-translation files are always installed under PREFIX/share/locale in uclibc
-based systems therefore lets set DATADIRNAME to "share".
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
-Index: glib-2.38.2/m4macros/glib-gettext.m4
-===================================================================
---- glib-2.38.2.orig/m4macros/glib-gettext.m4 2013-11-07 07:29:13.000000000 -0800
-+++ glib-2.38.2/m4macros/glib-gettext.m4 2014-03-15 14:51:54.712135644 -0700
-@@ -239,7 +239,7 @@
- [CATOBJEXT=.mo
- DATADIRNAME=lib])
- ;;
-- *-*-openbsd*)
-+ *-*-openbsd* | *-*-linux-uclibc*)
- CATOBJEXT=.mo
- DATADIRNAME=share
- ;;
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.44.1.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.44.1.bb
deleted file mode 100644
index 1e3d36af1c..0000000000
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.44.1.bb
+++ /dev/null
@@ -1,23 +0,0 @@
-require glib.inc
-
-PE = "1"
-
-SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
-
-SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
- file://configure-libtool.patch \
- file://fix-conflicting-rand.patch \
- file://add-march-i486-into-CFLAGS-automatically.patch \
- file://glib-2.0-configure-readlink.patch \
- file://run-ptest \
- file://ptest-paths.patch \
- file://uclibc.patch \
- file://0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch \
- file://allow-run-media-sdX-drive-mount-if-username-root.patch \
- file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \
- "
-
-SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"
-
-SRC_URI[md5sum] = "83efba4722a9674b97437d1d99af79db"
-SRC_URI[sha256sum] = "8811deacaf8a503d0a9b701777ea079ca6a4277be10e3d730d2112735d5eca07"
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.70.0.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.70.0.bb
new file mode 100644
index 0000000000..8217aaa8d0
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.70.0.bb
@@ -0,0 +1,54 @@
+require glib.inc
+
+PE = "1"
+
+SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
+
+SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
+ file://run-ptest \
+ file://0001-Fix-DATADIRNAME-on-uclibc-Linux.patch \
+ file://Enable-more-tests-while-cross-compiling.patch \
+ file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \
+ file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \
+ file://0001-Do-not-ignore-return-value-of-write.patch \
+ file://0010-Do-not-hardcode-python-path-into-various-tools.patch \
+ file://0001-Set-host_machine-correctly-when-building-with-mingw3.patch \
+ file://0001-Do-not-write-bindir-into-pkg-config-files.patch \
+ file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
+ file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
+ file://0001-gio-tests-codegen.py-bump-timeout-to-100-seconds.patch \
+ "
+SRC_URI:append:class-native = " file://relocate-modules.patch"
+
+SRC_URI[sha256sum] = "200d7df811c5ba634afbf109f14bb40ba7fde670e89389885da14e27c0840742"
+
+# Find any meson cross files in FILESPATH that are relevant for the current
+# build (using siteinfo) and add them to EXTRA_OEMESON.
+inherit siteinfo
+def find_meson_cross_files(d):
+ if bb.data.inherits_class('native', d):
+ return ""
+
+ thisdir = os.path.normpath(d.getVar("THISDIR"))
+ import collections
+ sitedata = siteinfo_data(d)
+ # filename -> found
+ files = collections.OrderedDict()
+ for path in d.getVar("FILESPATH").split(":"):
+ for element in sitedata:
+ filename = os.path.normpath(os.path.join(path, "meson.cross.d", element))
+ sanitized_path = filename.replace(thisdir, "${THISDIR}")
+ if sanitized_path == filename:
+ if os.path.exists(filename):
+ bb.error("Cannot add '%s' to --cross-file, because it's not relative to THISDIR '%s' and sstate signature would contain this full path" % (filename, thisdir))
+ continue
+ files[filename.replace(thisdir, "${THISDIR}")] = os.path.exists(filename)
+
+ items = ["--cross-file=" + k for k,v in files.items() if v]
+ d.appendVar("EXTRA_OEMESON", " " + " ".join(items))
+ items = ["%s:%s" % (k, "True" if v else "False") for k,v in files.items()]
+ d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(items))
+
+python () {
+ find_meson_cross_files(d)
+}
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 072f790111..0eef2e330c 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -3,91 +3,174 @@ DESCRIPTION = "GLib is a general-purpose utility library, which provides many us
HOMEPAGE = "https://developer.gnome.org/glib/"
# pcre is under BSD;
-# docs/reference/COPYING is with a 'public domai'-like license!
-LICENSE = "LGPLv2+ & BSD & PD"
-LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
- file://glib/glib.h;beginline=4;endline=17;md5=b4f0f4a399c19e5ebb20c31b79d6bc32 \
- file://gmodule/COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
- file://gmodule/gmodule.h;beginline=4;endline=17;md5=b4f0f4a399c19e5ebb20c31b79d6bc32 \
- file://glib/pcre/COPYING;md5=266ebc3ff74ee9ce6fad65577667c0f4 \
- file://glib/pcre/pcre.h;beginline=11;endline=35;md5=de27f2bf633d20a2b7af0b1983423283 \
+# docs/reference/COPYING is with a 'public domain'-like license!
+LICENSE = "LGPLv2.1+ & BSD-3-Clause & PD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
+ file://glib/glib.h;beginline=4;endline=17;md5=b88abb7f3ad09607e71cb9d530155906 \
+ file://gmodule/COPYING;md5=4fbd65380cdd255951079008b364516c \
+ file://gmodule/gmodule.h;beginline=4;endline=17;md5=b88abb7f3ad09607e71cb9d530155906 \
file://docs/reference/COPYING;md5=f51a5100c17af6bae00735cd791e1fcc"
BUGTRACKER = "http://bugzilla.gnome.org"
SECTION = "libs"
+CVE_PRODUCT = "glib"
+
BBCLASSEXTEND = "native nativesdk"
-DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
-DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', ' dbus', '', d)}"
-DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native zlib-native"
-DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib ${BPN}-native"
+DEPENDS = "glib-2.0-native \
+ virtual/libintl \
+ virtual/libiconv \
+ libffi \
+ libpcre \
+ zlib"
-PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
+PACKAGES += "${PN}-codegen ${PN}-utils"
LEAD_SONAME = "libglib-2.0.*"
-FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext"
-inherit autotools gettext gtk-doc pkgconfig ptest-gnome
+inherit meson gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages
+
+DEPENDS:append:class-target = "${@' gtk-doc' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
+
+GTKDOC_MESON_OPTION = "gtk_doc"
S = "${WORKDIR}/glib-${PV}"
-CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap --disable-man"
+PACKAGECONFIG ??= "libmount \
+ ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
+# To use the system pcre it must be configured with --enable-unicode-properties
+PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux"
+PACKAGECONFIG[manpages] = "-Dman=true, -Dman=false, libxslt-native xmlto-native"
+# libelf is auto-detected without a configuration option
+PACKAGECONFIG[libelf] = ",,elfutils"
+PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false,dbus"
+PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux"
-PRINTF = "--enable-included-printf=no"
-PRINTF_darwin = "--enable-included-printf=yes"
-PRINTF_mingw32 = "--enable-included-printf=yes"
-EXTRA_OECONF = "${PRINTF} ${CORECONF}"
-EXTRA_OECONF_class-native = "${CORECONF} --disable-selinux"
-EXTRA_OECONF_append_libc-uclibc = " --with-libiconv=gnu"
+EXTRA_OEMESON = "-Ddtrace=false -Dfam=false -Dsystemtap=false"
-do_configure_prepend() {
- sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
+do_configure:prepend() {
+ sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
}
-FILES_${PN} = "${libdir}/lib*${SOLIBS} ${libdir}/gio ${datadir}/glib-2.0/schemas \
- ${datadir}/glib-2.0/gettext/mkinstalldirs ${datadir}/glib-2.0/gettext/po/Makefile.in.in"
-FILES_${PN}-dev += "${libdir}/glib-2.0/include \
+FILES:${PN} = "${libdir}/lib*${SOLIBS} \
+ ${libdir}/gio \
+ ${libexecdir}/*gio-querymodules \
+ ${datadir}/glib-2.0/schemas"
+
+FILES:${PN}-utils += "${bindir}/glib-genmarshal \
+ ${bindir}/glib-gettextize \
+ ${bindir}/glib-mkenums \
+ ${bindir}/glib-compile-resources"
+
+FILES:${PN}-dev += "${libdir}/glib-2.0/include \
${libdir}/gio/modules/lib*${SOLIBSDEV} \
- ${libdir}/gio/modules/*.la"
-FILES_${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb \
- ${libdir}/gio/modules/.debug \
- ${libdir}/glib-2.0/installed-tests/glib/.debug"
-FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py"
-FILES_${PN}-bash-completion = "${sysconfdir}/bash_completion.d \
- ${datadir}/bash-completion"
-
-ARM_INSTRUCTION_SET = "arm"
-USE_NLS = "yes"
-
-do_install_append () {
+ ${libdir}/gio/modules/*.la \
+ ${datadir}/glib-2.0/gettext/po/Makefile.in.in \
+ ${datadir}/glib-2.0/schemas/gschema.dtd \
+ ${datadir}/glib-2.0/valgrind/glib.supp \
+ ${datadir}/gettext/its"
+FILES:${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb"
+FILES:${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \
+ ${bindir}/gdbus-codegen"
+FILES:${PN}-utils = "${bindir}/*"
+
+SHAREDMIMEDEP = "shared-mime-info"
+SHAREDMIMEDEP:class-native = ""
+# When cross compiling for Windows we don't want to include this
+SHAREDMIMEDEP:mingw32 = ""
+
+RRECOMMENDS:${PN} += "${SHAREDMIMEDEP}"
+
+ARM_INSTRUCTION_SET:armv4 = "arm"
+ARM_INSTRUCTION_SET:armv5 = "arm"
+# Valgrind runtime detection works using hand-written assembly, which
+# doesn't support mips16e
+CPPFLAGS:append:class-target:mips16e = " -DNVALGRIND=1"
+
+# GLib generally requires gettext to be present so for USE_NLS to yes. For
+# native builds as i18n is disabled globally we have to add a gettext-native dependency.
+USE_NLS:class-target = "yes"
+USE_NLS:class-nativesdk = "yes"
+DEPENDS:append:class-native = " gettext-native"
+
+EXEEXT = ""
+EXEEXT:mingw32 = ".exe"
+
+do_install:append () {
if [ -f ${D}${bindir}/gtester-report ]; then
- sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python|'
+ sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python3|'
fi
# Remove some unpackaged files
+ rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__
rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo
- # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
- # for target as /usr/bin/perl, so fix it to /usr/bin/perl.
- if [ -f ${D}${bindir}/glib-mkenums ]; then
- sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/glib-mkenums
+ if [ -e ${D}${libdir}/charset.alias ]; then
+ rm -f ${D}${libdir}/charset.alias
+ fi
+
+ # Make sure gio-querymodules is unique among multilibs
+ if test "x${MLPREFIX}" != "x"; then
+ mv ${D}${libexecdir}/gio-querymodules${EXEEXT} ${D}${libexecdir}/${MLPREFIX}gio-querymodules${EXEEXT}
+ fi
+ # Autotools does this, meson does not
+ mkdir -p ${D}${libdir}/gio/modules
+}
+
+do_install:append:class-target () {
+ # Tests are only installed on targets, not native builds. Separating this out
+ # keeps glib-2.0-native from depending on DISTRO_FEATURES
+ if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then
+ if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then
+ rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test
+ fi
+ fi
+ if [ -f ${D}${datadir}/installed-tests/glib/static-link.test ]; then
+ if test "x${MLPREFIX}" != "x"; then
+ mv ${D}${datadir}/installed-tests/glib/static-link.test ${D}${datadir}/installed-tests/glib/${MLPREFIX}static-link.test
+ fi
fi
}
-RDEPENDS_${PN}-ptest += "\
+# As we do not build python3 for windows, makes no sense to ship the script that's using it
+do_install:append:mingw32() {
+ rm -f ${D}${bindir}/gtester-report
+}
+
+CODEGEN_PYTHON_RDEPENDS = "python3 python3-distutils python3-xml"
+CODEGEN_PYTHON_RDEPENDS:mingw32 = ""
+
+RDEPENDS:${PN}-codegen += "${CODEGEN_PYTHON_RDEPENDS}"
+
+RDEPENDS:${PN}-ptest += "${PN}-utils"
+
+RDEPENDS:${PN}-ptest += "\
+ coreutils \
+ libgcc \
+ dbus \
gnome-desktop-testing \
tzdata \
tzdata-americas \
tzdata-asia \
tzdata-europe \
tzdata-posix \
- python-pygobject \
- python-dbus \
shared-mime-info \
+ ${PN}-locale-ja \
+ ${PN}-locale-fr \
+ ${PN}-locale-el \
+ ${PN}-locale-hr \
+ ${PN}-locale-lt \
+ ${PN}-locale-pl \
+ ${PN}-locale-ru \
+ ${PN}-locale-th \
+ python3-core \
+ python3-modules \
+ ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-dbusmock', '', d)} \
+ ${PN}-codegen \
"
-RDEPENDS_${PN}-ptest_append_libc-glibc = "\
+RDEPENDS:${PN}-ptest:append:libc-glibc = "\
glibc-gconv-utf-16 \
glibc-charmap-utf-8 \
glibc-gconv-cp1255 \
@@ -99,6 +182,18 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = "\
glibc-gconv-iso8859-15 \
glibc-charmap-invariant \
glibc-localedata-translit-cjk-variants \
+ locale-base-tr-tr \
+ locale-base-lt-lt \
+ locale-base-ja-jp.euc-jp \
+ locale-base-fa-ir \
+ locale-base-ru-ru \
+ locale-base-de-de \
+ locale-base-hr-hr \
+ locale-base-el-gr \
+ locale-base-fr-fr \
+ locale-base-es-es \
+ locale-base-en-gb \
+ locale-base-en-us \
+ locale-base-pl-pl \
+ locale-base-pl-pl.iso-8859-2 \
"
-
-INSANE_SKIP_${PN}-ptest += "libdir"
diff --git a/meta/recipes-core/glib-networking/glib-networking/run-ptest b/meta/recipes-core/glib-networking/glib-networking/run-ptest
new file mode 100644
index 0000000000..6d520f94f6
--- /dev/null
+++ b/meta/recipes-core/glib-networking/glib-networking/run-ptest
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+gnome-desktop-testing-runner glib-networking
diff --git a/meta/recipes-core/glib-networking/glib-networking_2.44.0.bb b/meta/recipes-core/glib-networking/glib-networking_2.44.0.bb
deleted file mode 100644
index 4f91b76acf..0000000000
--- a/meta/recipes-core/glib-networking/glib-networking_2.44.0.bb
+++ /dev/null
@@ -1,30 +0,0 @@
-SUMMARY = "GLib networking extensions"
-DESCRIPTION = "glib-networking contains the implementations of certain GLib networking features that cannot be implemented directly in GLib itself because of their dependencies."
-HOMEPAGE = "http://git.gnome.org/browse/glib-networking/"
-BUGTRACKER = "http://bugzilla.gnome.org"
-
-LICENSE = "LGPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
-
-SECTION = "libs"
-DEPENDS = "glib-2.0 intltool-native"
-
-SRC_URI[archive.md5sum] = "6989b20cf3b26dd5ae272e04a9acb0b3"
-SRC_URI[archive.sha256sum] = "8f8a340d3ba99bfdef38b653da929652ea6640e27969d29f7ac51fbbe11a4346"
-
-PACKAGECONFIG ??= "ca-certificates gnutls"
-
-# No explicit dependency as it works without ca-certificates installed
-PACKAGECONFIG[ca-certificates] = "--with-ca-certificates=${sysconfdir}/ssl/certs/ca-certificates.crt,--without-ca-certificates"
-PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls"
-PACKAGECONFIG[libproxy] = "--with-libproxy,--without-libproxy,libproxy"
-PACKAGECONFIG[pkcs11] = "--with-pkcs11,--without-pkcs11,p11-kit"
-
-EXTRA_OECONF = "--without-gnome-proxy"
-
-inherit gnomebase gettext
-
-FILES_${PN} += "${libdir}/gio/modules/libgio*.so ${datadir}/dbus-1/services/"
-FILES_${PN}-dbg += "${libdir}/gio/modules/.debug/"
-FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
-FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
diff --git a/meta/recipes-core/glib-networking/glib-networking_2.70.0.bb b/meta/recipes-core/glib-networking/glib-networking_2.70.0.bb
new file mode 100644
index 0000000000..fc700e03b7
--- /dev/null
+++ b/meta/recipes-core/glib-networking/glib-networking_2.70.0.bb
@@ -0,0 +1,38 @@
+SUMMARY = "GLib networking extensions"
+DESCRIPTION = "glib-networking contains the implementations of certain GLib networking features that cannot be implemented directly in GLib itself because of their dependencies."
+HOMEPAGE = "https://gitlab.gnome.org/GNOME/glib-networking/"
+BUGTRACKER = "http://bugzilla.gnome.org"
+
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
+
+SECTION = "libs"
+DEPENDS = "glib-2.0"
+
+SRC_URI[archive.sha256sum] = "66b408e7afa86c582fe38963db56133869ab4b57d34e48ec56aba621940d6f35"
+
+PACKAGECONFIG ??= "openssl ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
+
+PACKAGECONFIG[gnutls] = "-Dgnutls=enabled,-Dgnutls=disabled,gnutls"
+PACKAGECONFIG[openssl] = "-Dopenssl=enabled,-Dopenssl=disabled,openssl"
+PACKAGECONFIG[libproxy] = "-Dlibproxy=enabled,-Dlibproxy=disabled,libproxy"
+PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false"
+
+EXTRA_OEMESON = "-Dgnome_proxy=disabled"
+
+GNOMEBASEBUILDCLASS = "meson"
+inherit gnomebase gettext upstream-version-is-even gio-module-cache ptest-gnome
+
+SRC_URI += "file://run-ptest"
+
+FILES:${PN} += "\
+ ${libdir}/gio/modules/libgio*.so \
+ ${datadir}/dbus-1/services/ \
+ ${systemd_user_unitdir} \
+ "
+FILES:${PN}-dev += "${libdir}/gio/modules/libgio*.la"
+FILES:${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
+
+RDEPENDS:${PN}-ptest += "bash"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch b/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch
deleted file mode 100644
index 186a480458..0000000000
--- a/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Upstream-Status: Inappropriate [other]
-
-This is a hack to fix building the locale bits on an older
-CentOs 5.X machine
-
-Index: git/locale/programs/config.h
-===================================================================
---- git/locale/programs/config.h
-+++ git.orig/locale/programs/config.h
-@@ -19,6 +19,8 @@
- #ifndef _LD_CONFIG_H
- #define _LD_CONFIG_H 1
-
-+#define DUMMY_LOCALE_T
-+
- /* Use the internal textdomain used for libc messages. */
- #define PACKAGE _libc_intl_domainname
- #ifndef VERSION
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.22.bb b/meta/recipes-core/glibc/cross-localedef-native_2.22.bb
deleted file mode 100644
index 2153ece0e2..0000000000
--- a/meta/recipes-core/glibc/cross-localedef-native_2.22.bb
+++ /dev/null
@@ -1,59 +0,0 @@
-SUMMARY = "Cross locale generation tool for glibc"
-HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
-SECTION = "libs"
-LICENSE = "LGPL-2.1"
-
-LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
- file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
- file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
-
-
-inherit native
-inherit autotools
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
-
-BRANCH ?= "release/${PV}/master"
-GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
-
-SRC_URI = "${GLIBC_GIT_URI};branch=${BRANCH};name=glibc \
- git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
- file://fix_for_centos_5.8.patch \
- ${EGLIBCPATCHES} \
-"
-EGLIBCPATCHES = "\
- file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
- file://0018-eglibc-Cross-building-and-testing-instructions.patch \
- file://0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch \
- file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
- file://0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch \
- file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
- file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
- file://0024-eglibc-Forward-port-eglibc-options-groups-support.patch \
- file://0025-eglibc-Install-PIC-archives.patch \
- file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \
- file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \
-"
-
-SRCREV_glibc ?= "a34d1c6afc86521d6ad17662a3b5362d8481514c"
-SRCREV_localedef ?= "c833367348d39dad7ba018990bfdaffaec8e9ed3"
-
-# Makes for a rather long rev (22 characters), but...
-#
-SRCREV_FORMAT = "glibc_localedef"
-
-S = "${WORKDIR}/git"
-
-EXTRA_OECONF = "--with-glibc=${S}"
-CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
-
-do_configure () {
- ${S}/localedef/configure ${EXTRA_OECONF}
-}
-
-
-do_install() {
- install -d ${D}${bindir}
- install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
-}
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb b/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
new file mode 100644
index 0000000000..6100f3d4c4
--- /dev/null
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
@@ -0,0 +1,49 @@
+SUMMARY = "Cross locale generation tool for glibc"
+HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
+SECTION = "libs"
+LICENSE = "LGPL-2.1"
+
+LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
+ file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
+ file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
+
+require glibc-version.inc
+
+# Tell autotools that we're working in the localedef directory
+#
+AUTOTOOLS_SCRIPT_PATH = "${S}/localedef"
+
+inherit autotools
+inherit native
+
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
+
+SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
+ git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
+ \
+ file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
+ file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
+ \
+ file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
+ file://0018-Remove-bash-dependency-for-nscd-init-script.patch \
+ file://0019-eglibc-Cross-building-and-testing-instructions.patch \
+ file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
+ file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
+ file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
+ file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
+"
+# Makes for a rather long rev (22 characters), but...
+#
+SRCREV_FORMAT = "glibc_localedef"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = "--with-glibc=${S}"
+CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
+ install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink
+}
diff --git a/meta/recipes-core/glibc/glibc-collateral.inc b/meta/recipes-core/glibc/glibc-collateral.inc
index 60655eba3c..4f81f07da7 100644
--- a/meta/recipes-core/glibc/glibc-collateral.inc
+++ b/meta/recipes-core/glibc/glibc-collateral.inc
@@ -1,22 +1,12 @@
-INHIBIT_DEFAULT_DEPS = "1"
-LICENSE = "GPLv2 & LGPLv2.1"
-LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
- file://${COMMON_LICENSE_DIR}/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"
-HOMEPAGE = "http://www.gnu.org/software/libc/index.html"
+require glibc-common.inc
-# This needs to match with glibc.inc, otherwise glibc-scripts and glibc-locale
-# will fail to find main glibc, for details see
-# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
-ARM_INSTRUCTION_SET = "arm"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \
+ file://${COMMON_LICENSE_DIR}/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780"
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
do_configure[noexec] = "1"
do_compile[noexec] = "1"
-do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
-
-COMPATIBLE_HOST_libc-musl_class-target = "null"
-COMPATIBLE_HOST_libc-uclibc_class-target = "null"
-
+do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc
index bba1568baf..f695cd6a4a 100644
--- a/meta/recipes-core/glibc/glibc-common.inc
+++ b/meta/recipes-core/glibc/glibc-common.inc
@@ -3,7 +3,23 @@ DESCRIPTION = "The GNU C Library is used as the system C library in most systems
HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
SECTION = "libs"
LICENSE = "GPLv2 & LGPLv2.1"
-LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
- file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
+
+LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
+ file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
- file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
+ file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
+
+CVE_PRODUCT = "glibc"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+ARM_INSTRUCTION_SET:armv4 = "arm"
+ARM_INSTRUCTION_SET:armv5 = "arm"
+ARM_INSTRUCTION_SET:armv6 = "arm"
+#
+# We will skip parsing glibc when target system C library selection is not glibc
+# this helps in easing out parsing for non-glibc system libraries
+#
+COMPATIBLE_HOST:libc-musl:class-target = "null"
+
+PV = "2.34"
diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
deleted file mode 100644
index 35008489ee..0000000000
--- a/meta/recipes-core/glibc/glibc-initial.inc
+++ /dev/null
@@ -1,76 +0,0 @@
-DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial libgcc-initial"
-PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
-
-PACKAGES = ""
-PACKAGES_DYNAMIC = ""
-
-STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
-STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
-
-do_configure () {
- (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
- find ${S} -name "configure" | xargs touch
- ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
- --prefix=/usr \
- --without-cvs --disable-sanity-checks \
- --with-headers=${STAGING_DIR_TARGET}${includedir} \
- --with-kconfig=${STAGING_BINDIR_NATIVE} \
- --enable-hacker-mode --enable-addons
-}
-
-do_compile () {
- :
-}
-
-do_install () {
- oe_runmake cross-compiling=yes install_root=${D} \
- includedir='${includedir}' prefix='${prefix}' \
- install-bootstrap-headers=yes install-headers
-
- oe_runmake csu/subdir_lib
- mkdir -p ${D}${libdir}/
- install -m 644 csu/crt[1in].o ${D}${libdir}
-
- # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
- # so do them by hand. We can tolerate an empty stubs.h for the moment.
- # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
- mkdir -p ${D}${includedir}/gnu/
- touch ${D}${includedir}/gnu/stubs.h
- cp ${S}/include/features.h ${D}${includedir}/features.h
-
- if [ -e ${B}/bits/stdio_lim.h ]; then
- cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/
- fi
- # add links to linux-libc-headers: final glibc build need this.
- for t in linux asm asm-generic; do
- ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
- done
-}
-
-do_install_locale() {
- :
-}
-
-do_siteconfig () {
- :
-}
-
-SSTATEPOSTINSTFUNCS += "glibcinitial_sstate_postinst"
-glibcinitial_sstate_postinst() {
- if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
- then
- # Recreate the symlinks to ensure they point to the correct location
- for t in linux asm asm-generic; do
- rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
- ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
- done
- fi
-}
-
-do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
-
-# We don't install any scripts so there is nothing to evacuate
-do_evacuate_scripts () {
- :
-}
diff --git a/meta/recipes-core/glibc/glibc-initial_2.22.bb b/meta/recipes-core/glibc/glibc-initial_2.22.bb
deleted file mode 100644
index 8ab01dc79d..0000000000
--- a/meta/recipes-core/glibc/glibc-initial_2.22.bb
+++ /dev/null
@@ -1,11 +0,0 @@
-require glibc_${PV}.bb
-require glibc-initial.inc
-
-DEPENDS += "kconfig-frontends-native"
-
-# main glibc recipes muck with TARGET_CPPFLAGS to point into
-# final target sysroot but we
-# are not there when building glibc-initial
-# so reset it here
-
-TARGET_CPPFLAGS = ""
diff --git a/meta/recipes-core/glibc/glibc-ld.inc b/meta/recipes-core/glibc/glibc-ld.inc
index 962d666885..da8fcc430b 100644
--- a/meta/recipes-core/glibc/glibc-ld.inc
+++ b/meta/recipes-core/glibc/glibc-ld.inc
@@ -1,56 +1,20 @@
-def ld_append_if_tune_exists(d, infos, dict):
- tune = d.getVar("DEFAULTTUNE", True) or ""
- libdir = d.getVar("base_libdir", True) or ""
- if tune in dict:
- infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }')
- infos['lddrewrite'].add(libdir+'/'+dict[tune][0])
+inherit linuxloader
-def glibc_dl_info(d):
- ld_info_all = {
- "mips": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mipsel": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "mips64el-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "powerpc": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "powerpc-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
- "powerpc64": ["ld64.so.1", "FLAG_ELF_LIBC6"],
- "powerpc64-nf": ["ld64.so.1", "FLAG_ELF_LIBC6"],
- "core2-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
- "core2-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
- "x86": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
- "x86-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
- "i586": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
- "corei7-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
- "corei7-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
- }
+GLIBC_GETLOADER = "${@get_linuxloader(d)}"
+def glibc_dl_info(d):
infos = {'ldconfig':set(), 'lddrewrite':set()}
- ld_append_if_tune_exists(d, infos, ld_info_all)
- #DEFAULTTUNE_MULTILIB_ORIGINAL
- original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL",True)
- if original_tune:
- localdata = bb.data.createCopy(d)
- localdata.setVar("DEFAULTTUNE", original_tune)
- ld_append_if_tune_exists(localdata, infos, ld_info_all)
+ loaders = all_multilib_tune_values(d, "GLIBC_GETLOADER").split()
+ for loader in loaders:
+ infos['ldconfig'].add('{"' + loader + '",' + "FLAG_ELF_LIBC6" + ' }')
+ infos['lddrewrite'].add(loader)
- variants = d.getVar("MULTILIB_VARIANTS", True) or ""
- for item in variants.split():
- localdata = bb.data.createCopy(d)
- overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
- localdata.setVar("OVERRIDES", overrides)
- bb.data.update_data(localdata)
- ld_append_if_tune_exists(localdata, infos, ld_info_all)
- infos['ldconfig'] = ','.join(infos['ldconfig'])
- infos['lddrewrite'] = ' '.join(infos['lddrewrite'])
+ infos['ldconfig'] = ','.join(sorted(infos['ldconfig']))
+ infos['lddrewrite'] = ' '.join(sorted(infos['lddrewrite']))
return infos
EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}"
RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}"
+RTLDLIST:class-nativesdk = "${base_libdir}/${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}"
+glibc_dl_info[vardepsexclude] = "OVERRIDES"
diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
index df6d073436..b8de7d3192 100644
--- a/meta/recipes-core/glibc/glibc-locale.inc
+++ b/meta/recipes-core/glibc/glibc-locale.inc
@@ -1,4 +1,4 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "Locale data from glibc"
@@ -9,21 +9,23 @@ LOCALEBASEPN = "${MLPREFIX}glibc"
# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so')
# ERROR: Function failed: split_and_strip_files
BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot"
-BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
+BINUTILSDEP:class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
do_package[depends] += "${BINUTILSDEP}"
+DEPENDS += "virtual/libc"
+
# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
# is set. The idea is to avoid running localedef on the target (at first boot)
# to decrease initial boot time and avoid localedef being killed by the OOM
# killer which used to effectively break i18n on machines with < 128MB RAM.
-# default to disabled
+# default to disabled
ENABLE_BINARY_LOCALE_GENERATION ?= "0"
-ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "0"
+ENABLE_BINARY_LOCALE_GENERATION:pn-nativesdk-glibc-locale = "1"
#enable locale generation on these arches
# BINARY_LOCALE_ARCHES is a space separated list of regular expressions
-BINARY_LOCALE_ARCHES ?= "arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64"
+BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64"
# set "1" to use cross-localedef for locale generation
# set "0" for qemu emulation of native localedef for locale generation
@@ -35,62 +37,67 @@ PACKAGES = "localedef ${PN}-dbg"
PACKAGES_DYNAMIC = "^locale-base-.* \
^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
- ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
^${MLPREFIX}glibc-gconv$"
# Create a glibc-binaries package
-ALLOW_EMPTY_${BPN}-binaries = "1"
+ALLOW_EMPTY:${BPN}-binaries = "1"
PACKAGES += "${BPN}-binaries"
-RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-binary") != -1])}"
+RRECOMMENDS:${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}"
# Create a glibc-charmaps package
-ALLOW_EMPTY_${BPN}-charmaps = "1"
+ALLOW_EMPTY:${BPN}-charmaps = "1"
PACKAGES += "${BPN}-charmaps"
-RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-charmap") != -1])}"
+RRECOMMENDS:${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}"
# Create a glibc-gconvs package
-ALLOW_EMPTY_${BPN}-gconvs = "1"
+ALLOW_EMPTY:${BPN}-gconvs = "1"
PACKAGES += "${BPN}-gconvs"
-RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-gconv") != -1])}"
+RRECOMMENDS:${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}"
# Create a glibc-localedatas package
-ALLOW_EMPTY_${BPN}-localedatas = "1"
+ALLOW_EMPTY:${BPN}-localedatas = "1"
PACKAGES += "${BPN}-localedatas"
-RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-localedata") != -1])}"
+RRECOMMENDS:${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}"
-DESCRIPTION_localedef = "glibc: compile locale definition files"
+DESCRIPTION:localedef = "glibc: compile locale definition files"
# glibc-gconv is dynamically added into PACKAGES, thus
-# FILES_glibc-gconv will not be automatically extended in multilib.
-# Explicitly add ${MLPREFIX} for FILES_glibc-gconv.
-FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
-FILES_${PN}-dbg += "${libdir}/gconv/.debug/*"
-FILES_localedef = "${bindir}/localedef"
-
-LOCALETREESRC = "${STAGING_INCDIR}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}"
-
-do_install () {
- mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir}
- if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
- cp -fpPR ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
- fi
- if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
- mkdir -p ${D}${localedir}
- cp -fpPR ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
- fi
- if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
- cp -fpPR ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
- fi
- if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
- cp -fpPR ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
- fi
- if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
- cp -fpPR ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+# FILES:glibc-gconv will not be automatically extended in multilib.
+# Explicitly add ${MLPREFIX} for FILES:glibc-gconv.
+FILES:${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
+FILES:localedef = "${bindir}/localedef"
+
+LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
+
+copy_locale_files() {
+ local dir=$1 mode=$2
+
+ [ -e "${LOCALETREESRC}$dir" ] || return 0
+
+ for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
+ install -d ${D}$dir/$d
+ find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
+ -exec install -m $mode -t "${D}$dir/$d" {} \;
+ done
+}
+
+do_install() {
+ copy_locale_files ${bindir} 0755
+ copy_locale_files ${localedir} 0644
+ if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
+ copy_locale_files ${libdir}/gconv 0755
+ copy_locale_files ${datadir}/i18n 0644
+ else
+ # Remove the libdir if it is empty when gconv is not copied
+ find ${D}${libdir} -type d -empty -delete
fi
- chown root.root -R ${D}
- cp -fpPR ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+ copy_locale_files ${datadir}/locale 0644
+ install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
}
inherit libc-package
BBCLASSEXTEND = "nativesdk"
+
+# Don't scan for CVEs as glibc will be scanned
+CVE_PRODUCT = ""
diff --git a/meta/recipes-core/glibc/glibc-locale_2.22.bb b/meta/recipes-core/glibc/glibc-locale_2.34.bb
index f7702e0358..f7702e0358 100644
--- a/meta/recipes-core/glibc/glibc-locale_2.22.bb
+++ b/meta/recipes-core/glibc/glibc-locale_2.34.bb
diff --git a/meta/recipes-core/glibc/glibc-mtrace.inc b/meta/recipes-core/glibc/glibc-mtrace.inc
index e12b079e06..734a566562 100644
--- a/meta/recipes-core/glibc/glibc-mtrace.inc
+++ b/meta/recipes-core/glibc/glibc-mtrace.inc
@@ -1,13 +1,16 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "mtrace utility provided by glibc"
DESCRIPTION = "mtrace utility provided by glibc"
-RDEPENDS_${PN} = "perl"
-RPROVIDES_${PN} = "libc-mtrace"
+RDEPENDS:${PN} = "perl"
+RPROVIDES:${PN} = "libc-mtrace"
-SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
+SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
do_install() {
install -d -m 0755 ${D}${bindir}
install -m 0755 ${SRC}/mtrace ${D}${bindir}/
}
+
+# Don't scan for CVEs as glibc will be scanned
+CVE_PRODUCT = ""
diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.22.bb b/meta/recipes-core/glibc/glibc-mtrace_2.34.bb
index 0b69bad46a..0b69bad46a 100644
--- a/meta/recipes-core/glibc/glibc-mtrace_2.22.bb
+++ b/meta/recipes-core/glibc/glibc-mtrace_2.34.bb
diff --git a/meta/recipes-core/glibc/glibc-options.inc b/meta/recipes-core/glibc/glibc-options.inc
deleted file mode 100644
index 9fd27f32f9..0000000000
--- a/meta/recipes-core/glibc/glibc-options.inc
+++ /dev/null
@@ -1,162 +0,0 @@
-def glibc_cfg(feature, tokens, cnf):
- if type(tokens) == type(""):
- tokens = [tokens]
- if feature:
- cnf.extend([token + '=y' for token in tokens])
- else:
- for token in tokens:
- cnf.extend([token + '=n'])
- if token == 'OPTION_EGLIBC_NSSWITCH':
- cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""])
- cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""])
-
-# Map distro features to glibc options settings
-def features_to_glibc_settings(d):
- cnf = ([])
-
- ipv4 = bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d)
- ipv6 = bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d)
- libc_backtrace = bb.utils.contains('DISTRO_FEATURES', 'libc-backtrace', True, False, d)
- libc_big_macros = bb.utils.contains('DISTRO_FEATURES', 'libc-big-macros', True, False, d)
- libc_bsd = bb.utils.contains('DISTRO_FEATURES', 'libc-bsd', True, False, d)
- libc_cxx_tests = bb.utils.contains('DISTRO_FEATURES', 'libc-cxx-tests', True, False, d)
- libc_catgets = bb.utils.contains('DISTRO_FEATURES', 'libc-catgets', True, False, d)
- libc_charsets = bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d)
- libc_crypt = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt', True, False, d)
- libc_crypt_ufc = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt-ufc', True, False, d)
- libc_db_aliases = bb.utils.contains('DISTRO_FEATURES', 'libc-db-aliases', True, False, d)
- libc_envz = bb.utils.contains('DISTRO_FEATURES', 'libc-envz', True, False, d)
- libc_fcvt = bb.utils.contains('DISTRO_FEATURES', 'libc-fcvt', True, False, d)
- libc_fmtmsg = bb.utils.contains('DISTRO_FEATURES', 'libc-fmtmsg', True, False, d)
- libc_fstab = bb.utils.contains('DISTRO_FEATURES', 'libc-fstab', True, False, d)
- libc_ftraverse = bb.utils.contains('DISTRO_FEATURES', 'libc-ftraverse', True, False, d)
- libc_getlogin = bb.utils.contains('DISTRO_FEATURES', 'libc-getlogin', True, False, d)
- libc_idn = bb.utils.contains('DISTRO_FEATURES', 'libc-idn', True, False, d)
- libc_inet_anl = bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', True, False, d)
- libc_libm = bb.utils.contains('DISTRO_FEATURES', 'libc-libm', True, False, d)
- libc_locales = bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d)
- libc_locale_code = bb.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d)
- libc_memusage = bb.utils.contains('DISTRO_FEATURES', 'libc-memusage', True, False, d)
- libc_nis = bb.utils.contains('DISTRO_FEATURES', 'libc-nis', True, False, d)
- libc_nsswitch = bb.utils.contains('DISTRO_FEATURES', 'libc-nsswitch', True, False, d)
- libc_rcmd = bb.utils.contains('DISTRO_FEATURES', 'libc-rcmd', True, False, d)
- libc_rtld_debug = bb.utils.contains('DISTRO_FEATURES', 'libc-rtld-debug', True, False, d)
- libc_spawn = bb.utils.contains('DISTRO_FEATURES', 'libc-spawn', True, False, d)
- libc_streams = bb.utils.contains('DISTRO_FEATURES', 'libc-streams', True, False, d)
- libc_sunrpc = bb.utils.contains('DISTRO_FEATURES', 'libc-sunrpc', True, False, d)
- libc_utmp = bb.utils.contains('DISTRO_FEATURES', 'libc-utmp', True, False, d)
- libc_utmpx = bb.utils.contains('DISTRO_FEATURES', 'libc-utmpx', True, False, d)
- libc_wordexp = bb.utils.contains('DISTRO_FEATURES', 'libc-wordexp', True, False, d)
- libc_posix_clang_wchar = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', True, False, d)
- libc_posix_regexp = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp', True, False, d)
- libc_posix_regexp_glibc = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d)
- libc_posix_wchar_io = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d)
-
- # arrange the dependencies among glibc configuable options according to file option-groups.def from glibc source code
- new_dep = True
- while new_dep:
- new_dep = False
-
- if ipv6 and not ipv4:
- new_dep = True
- ipv4 = True
-
- if ipv4 and not libc_nsswitch:
- new_dep = True
- libc_nsswitch = True
-
- if libc_cxx_tests:
- if not libc_posix_wchar_io:
- new_dep = True
- libc_posix_wchar_io = True
- if not libc_libm:
- new_dep = True
- libc_libm = True
-
- if libc_catgets and not libc_locale_code:
- new_dep = True
- libc_locale_code = True
-
- if libc_crypt_ufc and not libc_crypt:
- new_dep = True
- libc_crypt = True
-
- if libc_getlogin and not libc_utmp:
- new_dep = True
- libc_utmp = True
-
- if libc_inet_anl and not ipv4:
- new_dep = True
- ipv4 = True
-
- if libc_locale_code and not libc_posix_clang_wchar:
- new_dep = True
- libc_posix_clang_wchar = True
-
- if libc_nis:
- if not ipv4:
- new_dep = True
- ipv4 = True
- if not libc_sunrpc:
- new_dep = True
- libc_sunrpc = True
-
- if libc_rcmd and not ipv4:
- new_dep = True
- ipv4 = True
-
- if libc_sunrpc and not ipv4:
- new_dep = True
- ipv4 = True
-
- if libc_utmpx and not libc_utmp:
- new_dep = True
- libc_utmp = True
-
- if libc_posix_regexp_glibc and not libc_posix_regexp:
- new_dep = True
- libc_posix_regexp = True
-
- if libc_posix_wchar_io and not libc_posix_clang_wchar:
- new_dep = True
- libc_posix_clang_wchar = True
-
- glibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
- glibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
- glibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
- glibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
- glibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
- glibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
- glibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
- glibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
- glibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
- glibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
- glibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
- glibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
- glibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
- glibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
- glibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
- glibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
- glibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
- glibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
- glibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
- glibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
- glibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
- glibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
- glibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
- glibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
- glibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
- glibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
- glibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
- glibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
- glibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
- glibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
- glibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
- glibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
- glibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
- glibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
- glibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
- glibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
- glibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
-
- return "\n".join(cnf)
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 5f6036840f..571ae7ae09 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -1,179 +1,204 @@
-#
-# For now, we will skip building of a gcc package if it is a uclibc one
-# and our build is not a uclibc one, and we skip a glibc one if our build
-# is a uclibc build.
-#
-# See the note in gcc/gcc_3.4.0.oe
-#
-
-python __anonymous () {
- import bb, re
- uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS', True)) != None)
- if uc_os:
- raise bb.parse.SkipPackage("incompatible with target %s" %
- d.getVar('TARGET_OS', True))
-}
-
-# Set this to zero if you don't want ldconfig in the output package
-USE_LDCONFIG ?= "1"
-
INHIBIT_SYSROOT_STRIP = "1"
-PACKAGES = "${PN}-dbg catchsegv sln nscd ldd tzcode ${PN}-utils glibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
+PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src"
# The ld.so in this glibc supports the GNU_HASH
-RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
-RPROVIDES_${PN}-utils = "eglibc-utils"
-RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace"
-RPROVIDES_${PN}-pic = "eglibc-pic"
-RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
-RPROVIDES_${PN}-staticdev = "eglibc-staticdev"
-RPROVIDES_${PN}-doc = "eglibc-doc"
-RPROVIDES_glibc-extra-nss = "eglibc-extra-nss"
-RPROVIDES_glibc-thread-db = "eglibc-thread-db"
-RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile"
-RPROVIDES_${PN}-dbg = "eglibc-dbg"
-libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
-libc_baselibs_append_aarch64 = " /lib/ld-linux-aarch64*.so.1"
-INSANE_SKIP_${PN}_append_aarch64 = " libdir"
-
-FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
-FILES_ldd = "${bindir}/ldd"
-FILES_libsegfault = "${base_libdir}/libSegFault*"
-FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
-FILES_libmemusage = "${base_libdir}/libmemusage.so"
-FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
-FILES_sln = "${base_sbindir}/sln"
-FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
-FILES_libsotruss = "${libdir}/audit/sotruss-lib.so"
+RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)"
+RPROVIDES:${PN}-utils = "eglibc-utils"
+RPROVIDES:${PN}-mtrace = "eglibc-mtrace libc-mtrace"
+RPROVIDES:${PN}-pic = "eglibc-pic"
+RPROVIDES:${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
+RPROVIDES:${PN}-staticdev = "eglibc-staticdev"
+RPROVIDES:${PN}-doc = "eglibc-doc"
+RPROVIDES:glibc-extra-nss = "eglibc-extra-nss"
+RPROVIDES:glibc-thread-db = "eglibc-thread-db"
+RPROVIDES:${PN}-pcprofile = "eglibc-pcprofile"
+RPROVIDES:${PN}-dbg = "eglibc-dbg"
+libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
+ARCH_DYNAMIC_LOADER = ""
+# The aarch64 ABI says the dynamic linker -must- be
+# /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that
+# we need to install it in /usr/lib.
+ARCH_DYNAMIC_LOADER:aarch64 = "ld-linux-${TARGET_ARCH}.so.1"
+libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
+INSANE_SKIP:${PN}:append:aarch64 = " libdir"
+INSANE_SKIP:${PN}-dev += "staticdev"
+
+FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
+RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
+FILES:ldconfig = "${base_sbindir}/ldconfig"
+FILES:ldd = "${bindir}/ldd"
+FILES:libsegfault = "${base_libdir}/libSegFault*"
+FILES:libmemusage = "${base_libdir}/libmemusage.so"
+FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0"
+FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh"
+RDEPENDS:libnss-db = "${PN}-utils"
+FILES:glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
+FILES:sln = "${base_sbindir}/sln"
+FILES:${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
+FILES:libsotruss = "${libdir}/audit/sotruss-lib.so"
FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
-FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
-FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
-FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_unitdir}/system/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \
+FILES:${PN}-dev += "${libdir}/libpthread.a ${libdir}/libdl.a ${libdir}/libutil.a ${libdir}/libanl.a ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
+RDEPENDS:${PN}-dev = "linux-libc-headers-dev"
+FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
+FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdir}/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \
${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd"
-FILES_${PN}-mtrace = "${bindir}/mtrace"
-FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump"
-FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
-FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/audit/.debug"
-FILES_catchsegv = "${bindir}/catchsegv"
-RDEPENDS_catchsegv = "libsegfault"
-FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
-FILES_glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
-RPROVIDES_${PN}-dev += "libc-dev"
-RPROVIDES_${PN}-staticdev += "libc-staticdev"
-
-SUMMARY_sln = "The static ln"
-DESCRIPTION_sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional."
-SUMMARY_nscd = "Name service cache daemon"
-DESCRIPTION_nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services."
-SUMMARY_glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
-DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
-SUMMARY_ldd = "print shared library dependencies"
-DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
-SUMMARY_${PN}-utils = "Miscellaneous utilities provided by glibc"
-DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, rpcgen, ..."
-DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs"
-DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect"
-
-inherit libc-common multilib_header
-
-do_install_append () {
+FILES:${PN}-mtrace = "${bindir}/mtrace"
+FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump"
+FILES:${PN}-utils = "${bindir}/* ${sbindir}/*"
+FILES:catchsegv = "${bindir}/catchsegv"
+RDEPENDS:catchsegv = "libsegfault"
+FILES:${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
+FILES:glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
+RPROVIDES:${PN}-dev += "libc-dev"
+RPROVIDES:${PN}-staticdev += "libc-staticdev"
+
+SUMMARY:sln = "The static ln"
+DESCRIPTION:sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional."
+SUMMARY:nscd = "Name service cache daemon"
+DESCRIPTION:nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services."
+SUMMARY:glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
+DESCRIPTION:glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
+SUMMARY:ldd = "print shared library dependencies"
+DESCRIPTION:ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
+SUMMARY:${PN}-utils = "Miscellaneous utilities provided by glibc"
+DESCRIPTION:${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, ..."
+DESCRIPTION:libsotruss = "Library to support sotruss which traces calls through PLTs"
+DESCRIPTION:tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect"
+
+inherit multilib_header
+
+do_install() {
+ oe_runmake install_root=${D} install
+ install -Dm 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ld.so.conf
+ install -d ${D}${localedir}
+ make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED"
+ # get rid of some broken files...
+ for i in ${GLIBC_BROKEN_LOCALES}; do
+ sed -i "/$i/d" ${WORKDIR}/SUPPORTED
+ done
+ rm -f ${D}${sysconfdir}/rpc
+ rm -rf ${D}${datadir}/zoneinfo
+ rm -rf ${D}${libexecdir}/getconf
+
rm -f ${D}${sysconfdir}/localtime
- rm -rf ${D}${localstatedir}
# remove empty glibc dir
- if [ -d ${D}${libdir}/glibc -a ! -e ${D}${libdir}/glibc/pt_chown ]; then
- rmdir ${D}${libdir}/glibc
+ if [ -d ${D}${libexecdir} ]; then
+ rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
fi
- oe_multilib_header bits/syscall.h
+
+ oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h
if [ -f ${D}${bindir}/mtrace ]; then
sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace
fi
- rm -rf ${D}${includedir}/rpcsvc/rquota*
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
- if [ "${USE_LDCONFIG}" != "1" ]; then
- # We won't ship these files (see FILES above) so let's not install them
- rm -f ${D}${sysconfdir}/ld.so.conf
- rm -f ${D}${base_sbindir}/ldconfig
- # This directory will be empty now so remove it too.
- # But check whether it exists first, since it won't for glibc-initial.
- if [ -d ${D}${sysconfdir} ]; then
- rmdir ${D}${sysconfdir}
- fi
- fi
-
- if echo ${PN}|grep -q "glibc-initial"; then
- return
- fi
-
install -d ${D}${sysconfdir}/init.d
install -d ${D}${localstatedir}/db/nscd
install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
+ install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db
sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
+ sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
+
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/
- install -d ${D}${systemd_unitdir}/system
- install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_unitdir}/system/
+ # The dynamic loader will have been installed into
+ # ${base_libdir}. However, if that isn't going to end up being
+ # available in the ABI-mandated location, then a symlink must
+ # be created.
+ if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
+ install -d ${D}${root_prefix}/lib
+ ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \
+ ${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}
+ fi
+ lnr ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so
+ lnr ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so
+}
+
+def get_libc_fpu_setting(bb, d):
+ if d.getVar('TARGET_FPU') in [ 'soft', 'ppc-efd' ]:
+ return "--without-fp"
+ return ""
+
+do_install:append:class-target() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/nscd 755 root root -" \
> ${D}${sysconfdir}/tmpfiles.d/nscd.conf
- else
+ fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/default/volatiles
echo "d root root 0755 /var/run/nscd none" \
> ${D}${sysconfdir}/default/volatiles/98_nscd
fi
+
+}
+do_install:append:aarch64 () {
+ do_install_armmultilib
}
-do_install_append_aarch64 () {
- if [ "${base_libdir}" != "/lib" ] ; then
- # The aarch64 ABI says the dynamic linker -must- be /lib/ld-linux-aarch64[_be].so.1
- install -d ${D}/lib
- if [ -e ${D}${base_libdir}/ld-linux-aarch64.so.1 ]; then
- ln -s ${@base_path_relative('/lib', '${base_libdir}')}/ld-linux-aarch64.so.1 \
- ${D}/lib/ld-linux-aarch64.so.1
- elif [ -e ${D}${base_libdir}/ld-linux-aarch64_be.so.1 ]; then
- ln -s ${@base_path_relative('/lib', '${base_libdir}')}/ld-linux-aarch64_be.so.1 \
- ${D}/lib/ld-linux-aarch64_be.so.1
- fi
- fi
+do_install:append:arm () {
+ do_install_armmultilib
}
-do_install_locale () {
- dest=${D}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
- install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir}
- if [ "${base_libdir}" != "${libdir}" ]; then
- cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir}
- fi
+do_install:append:armeb () {
+ do_install_armmultilib
+}
+
+do_install_armmultilib () {
+ oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h
+ oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/pthreadtypes-arch.h bits/sem.h bits/semaphore.h bits/setjmp.h
+ oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h
+ oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h
+ oe_multilib_header bits/struct_stat.h bits/pthread_stack_min.h
+
+ oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
+
+ oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h
+}
+
+
+LOCALESTASH = "${WORKDIR}/stashed-locale"
+bashscripts = "mtrace sotruss xtrace"
+
+do_stash_locale () {
+ dest=${LOCALESTASH}
+ install -d $dest${base_libdir} $dest${bindir} $dest${libdir} $dest${datadir}
+ # Hide away the locale data from the deployment
if [ -e ${D}${bindir}/localedef ]; then
- mv -f ${D}${bindir}/localedef ${dest}${bindir}
+ cp -a ${D}${bindir}/localedef $dest${bindir}
fi
if [ -e ${D}${libdir}/gconv ]; then
- mv -f ${D}${libdir}/gconv ${dest}${libdir}
- fi
- if [ -e ${D}${exec_prefix}/lib ]; then
- cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix}
+ cp -a ${D}${libdir}/gconv $dest${libdir}
fi
if [ -e ${D}${datadir}/i18n ]; then
- mv ${D}${datadir}/i18n ${dest}${datadir}
+ cp -a ${D}${datadir}/i18n $dest${datadir}
fi
- cp -fpPR ${D}${datadir}/* ${dest}${datadir}
- rm -rf ${D}${datadir}/locale/
- cp -fpPR ${WORKDIR}/SUPPORTED ${dest}
-}
-addtask do_install_locale after do_install before do_populate_sysroot do_package
+ # Make a copy of all the libraries into the locale stash
+ cp -fpPR ${D}${libdir}/* $dest${libdir}
+ if [ "${base_libdir}" != "${libdir}" ]; then
+ cp -fpPR ${D}${base_libdir}/* $dest${base_libdir}
+ fi
+ if [ -e ${D}${exec_prefix}/lib ]; then
+ if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then
+ cp -fpPR ${D}${exec_prefix}/lib $dest${exec_prefix}
+ fi
+ fi
-bashscripts = "mtrace sotruss xtrace"
+ cp -fpPR ${D}${datadir}/* $dest${datadir}
+ cp -fpPR ${WORKDIR}/SUPPORTED $dest
-do_evacuate_scripts () {
- target=${D}${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+ target=$dest/scripts
mkdir -p $target
for i in ${bashscripts}; do
if [ -f ${D}${bindir}/$i ]; then
@@ -182,24 +207,74 @@ do_evacuate_scripts () {
done
}
-addtask evacuate_scripts after do_install before do_populate_sysroot do_package
+addtask do_stash_locale after do_install before do_populate_sysroot do_package
+do_stash_locale[dirs] = "${B}"
+do_stash_locale[cleandirs] = "${LOCALESTASH}"
+SSTATETASKS += "do_stash_locale"
+do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}"
+do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
+do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
-PACKAGE_PREPROCESS_FUNCS += "glibc_package_preprocess"
+python do_stash_locale_setscene () {
+ sstate_setscene(d)
+}
+addtask do_stash_locale_setscene
-glibc_package_preprocess () {
- rm -rf ${PKGD}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
- rm -rf ${PKGD}/${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
+PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup"
+SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup"
+stash_locale_cleanup () {
+ cleanupdir=$1
+ # Remove all files which do_stash_locale() copies
for i in ${bashscripts}; do
- rm -f ${PKGD}${bindir}/$i
+ rm -f $cleanupdir${bindir}/$i
done
- rm -rf ${PKGD}/${localedir}
- if [ "${libdir}" != "${exec_prefix}/lib" ]; then
- # This dir only exists to hold locales
- rm -rf ${PKGD}${exec_prefix}/lib
+ rm -f $cleanupdir${bindir}/localedef
+ rm -rf $cleanupdir${datadir}/i18n
+ rm -rf $cleanupdir${libdir}/gconv
+ rm -rf $cleanupdir${localedir}
+ rm -rf $cleanupdir${datadir}/locale
+ rmdir --ignore-fail-on-non-empty $cleanupdir${datadir}
+
+ if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then
+ if [ -d "$cleanupdir${exec_prefix}/lib" ]; then
+ if [ -z "${ARCH_DYNAMIC_LOADER}" -o \
+ ! -e "$cleanupdir${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
+ # error out if directory isn't empty
+ # this dir should only contain locale dir
+ # which has been deleted in the previous step
+ rmdir $cleanupdir${exec_prefix}/lib
+ fi
+ fi
fi
}
-pkg_postinst_nscd () {
+stash_locale_sysroot_cleanup() {
+ stash_locale_cleanup ${SYSROOT_DESTDIR}
+}
+stash_locale_package_cleanup() {
+ stash_locale_cleanup ${PKGD}
+}
+
+python populate_packages:prepend () {
+ if d.getVar('DEBIAN_NAMES'):
+ pkgs = d.getVar('PACKAGES').split()
+ bpn = d.getVar('BPN')
+ prefix = d.getVar('MLPREFIX') or ""
+ # Set the base package...
+ d.setVar('PKG:' + prefix + bpn, prefix + 'libc6')
+ libcprefix = prefix + bpn + '-'
+ for p in pkgs:
+ # And all the subpackages.
+ if p.startswith(libcprefix):
+ renamed = p.replace(bpn, 'libc6', 1)
+ d.setVar('PKG:' + p, renamed)
+ # For backward compatibility with old -dbg package
+ d.appendVar('RPROVIDES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+ d.appendVar('RCONFLICTS:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+ d.appendVar('RREPLACES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
+}
+
+pkg_postinst:nscd () {
if [ -z "$D" ]; then
if command -v systemd-tmpfiles >/dev/null; then
systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf
@@ -208,7 +283,7 @@ pkg_postinst_nscd () {
fi
fi
}
-CONFFILES_nscd="${sysconfdir}/nscd.conf"
+CONFFILES:nscd="${sysconfdir}/nscd.conf"
SYSTEMD_PACKAGES = "nscd"
-SYSTEMD_SERVICE_nscd = "nscd.service"
+SYSTEMD_SERVICE:nscd = "nscd.service"
diff --git a/meta/recipes-core/glibc/glibc-scripts.inc b/meta/recipes-core/glibc/glibc-scripts.inc
index 3a06773d66..47216ae7d7 100644
--- a/meta/recipes-core/glibc/glibc-scripts.inc
+++ b/meta/recipes-core/glibc/glibc-scripts.inc
@@ -1,10 +1,10 @@
-include glibc-collateral.inc
+require glibc-collateral.inc
SUMMARY = "utility scripts provided by glibc"
DESCRIPTION = "utility scripts provided by glibc"
-RDEPENDS_${PN} = "bash glibc-mtrace"
+RDEPENDS:${PN} = "bash glibc-mtrace"
-SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
+SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
bashscripts = "sotruss xtrace"
@@ -14,3 +14,10 @@ do_install() {
install -m 0755 ${SRC}/$i ${D}${bindir}/
done
}
+
+# sotruss script requires sotruss-lib.so (given by libsotruss package),
+# to produce trace of the library calls.
+RDEPENDS:${PN} += "libsotruss"
+
+# Don't scan for CVEs as glibc will be scanned
+CVE_PRODUCT = ""
diff --git a/meta/recipes-core/glibc/glibc-scripts_2.22.bb b/meta/recipes-core/glibc/glibc-scripts_2.34.bb
index 5a89bd8022..5a89bd8022 100644
--- a/meta/recipes-core/glibc/glibc-scripts_2.22.bb
+++ b/meta/recipes-core/glibc/glibc-scripts_2.34.bb
diff --git a/meta/recipes-core/glibc/glibc-testing.inc b/meta/recipes-core/glibc/glibc-testing.inc
deleted file mode 100644
index fd1af39922..0000000000
--- a/meta/recipes-core/glibc/glibc-testing.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-do_compile_append () {
- # now generate script to drive testing
- echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testglibc
- set >> ${B}/${HOST_PREFIX}testglibc
- # prune out the unneeded vars
- sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PATCH_GET/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testglibc
- sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testglibc
-
- # point to real sysroot not the toolchain bootstrap sysroot
- sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testglibc
-
- # use the final cross-gcc to test since some tests need libstdc++
- sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testglibc
-
- # append execution part script
-cat >> ${B}/${HOST_PREFIX}testglibc << STOP
-target="\$1"
-if [ "x\$target" = "x" ]
-then
- echo "Please specify the target machine and remote user in form of user@target"
- exit 1;
-fi
-ssh \$target ls \$PWD\ 2>&1 > /dev/null
-if [ "x\$?" != "x0" ]
-then
- echo "Failed connecting to \$target it could be because of:"
- echo "1. You dont have passwordless ssh setup to access \$target"
- echo "2. NFS share on \$target is not mounted or if mounted then not matching the build tree layout."
- echo " The tree should be accessible at same location on build host and target"
- echo " You can add nfs-server to IMAGE_FEATURES to get the nfs client on target"
- echo "3. nfs server on build host is not running."
- echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want"
- echo " to test as root user on target (usually its recommended to create a non"
- echo " root user."
- echo " As a sanity check make sure that target can read/write to the glibc build tree"
- echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup"
- exit 1
-fi
- echo "# we test using cross compiler from real sysroot therefore override the" > ${B}/configparms
- echo "# definitions that come from ${B}/config.make" >> ${B}/configparms
- fgrep tcbootstrap ${B}/config.make > ${B}/configparms
- sed -i -e "s/\-tcbootstrap//g" ${B}/configparms
-
-# g++ uses flag -nostdinc, so the locations of system include headers must be explicitly specified
-# If the locations are not already specified in config.make, then we provide the following locations:
-# <sysroot>/usr/include/c++/<g++ version>
-# <sysroot>/usr/include/c++/<g++ version>/<machine>
-
-cxxincludes=\`cat ${B}/config.make | gawk '\$1 == "c++-sysincludes"' | gawk -F"=" '{print \$2}' | sed "s/[ \t]\?//g"\`
-
-if [ -z "\$cxxincludes" ]; then
- sysroot=\`cat ${B}/configparms | sed -n "/CXX/p" | sed -e "s/^.*--sysroot=//"\`
- cxx=\`cat ${B}/configparms | gawk '\$1 ~ /^CXX/' | gawk -F"=" '{print \$2}' | gawk '{print \$1}'\`
- cxxmachine=\`\$cxx -dumpmachine\`
- cxxversion=\`\$cxx -dumpversion\`
- # pass the new value of c++-sysincludes via configparms
- echo "# c++-sysincludes added:" >> ${B}/configparms
- echo "c++-sysincludes = -isystem \$sysroot/usr/include/c++/\$cxxversion -isystem \$sysroot/usr/include/c++/\$cxxversion/\$cxxmachine" >> ${B}/configparms
-fi
-
-wrapper="${S}/scripts/cross-test-ssh.sh \$target"
-localedef="${STAGING_BINDIR_NATIVE}/cross-localedef --little-endian --uint32-align=4"
-make tests-clean
-make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check
-rm -rf ${B}/configparms
-STOP
-
- chmod +x ${B}/${HOST_PREFIX}testglibc
-}
diff --git a/meta/recipes-core/glibc/glibc-tests.inc b/meta/recipes-core/glibc/glibc-tests.inc
new file mode 100644
index 0000000000..a8fe160a54
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-tests.inc
@@ -0,0 +1,32 @@
+EXCLUDE_FROM_WORLD = "1"
+
+# handle PN differences
+FILESEXTRAPATHS:prepend := "${THISDIR}/glibc:"
+
+# setup depends
+INHIBIT_DEFAULT_DEPS = ""
+
+python () {
+ libc = d.getVar("PREFERRED_PROVIDER_virtual/libc")
+ libclocale = d.getVar("PREFERRED_PROVIDER_virtual/libc-locale")
+ if libc != "glibc" or libclocale != "glibc-locale":
+ raise bb.parse.SkipRecipe("glibc-testsuite requires that virtual/libc is glibc")
+}
+
+DEPENDS += "glibc-locale libgcc gcc-runtime"
+
+# remove the initial depends
+DEPENDS:remove = "libgcc-initial"
+
+do_check[dirs] += "${B}"
+do_check () {
+ # clean out previous test results
+ oe_runmake tests-clean
+ # makefiles don't clean entirely (and also sometimes fails due to too many args)
+ find ${B} -type f -name "*.out" -delete
+ find ${B} -type f -name "*.test-result" -delete
+ find ${B}/catgets -name "*.cat" -delete
+ find ${B}/conform -name "symlist-*" -delete
+ [ ! -e ${B}/timezone/testdata ] || rm -rf ${B}/timezone/testdata
+}
+addtask do_check after do_compile
diff --git a/meta/recipes-core/glibc/glibc-testsuite_2.34.bb b/meta/recipes-core/glibc/glibc-testsuite_2.34.bb
new file mode 100644
index 0000000000..e8ad2a938b
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-testsuite_2.34.bb
@@ -0,0 +1,35 @@
+require glibc_${PV}.bb
+require glibc-tests.inc
+
+inherit qemu
+
+SRC_URI += "file://check-test-wrapper"
+
+# strip provides
+PROVIDES = ""
+
+DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}"
+
+TOOLCHAIN_TEST_TARGET ??= "user"
+TOOLCHAIN_TEST_HOST ??= "localhost"
+TOOLCHAIN_TEST_HOST_USER ??= "root"
+TOOLCHAIN_TEST_HOST_PORT ??= "2222"
+
+do_check[nostamp] = "1"
+do_check:append () {
+ chmod 0755 ${WORKDIR}/check-test-wrapper
+
+ oe_runmake -i \
+ QEMU_SYSROOT="${RECIPE_SYSROOT}" \
+ QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \
+ SSH_HOST="${TOOLCHAIN_TEST_HOST}" \
+ SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \
+ SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \
+ test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \
+ check
+}
+
+inherit nopackages
+deltask do_stash_locale
+deltask do_install
+deltask do_populate_sysroot
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc
new file mode 100644
index 0000000000..6dac7f0c7a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-version.inc
@@ -0,0 +1,8 @@
+SRCBRANCH ?= "release/2.34/master"
+PV = "2.34"
+SRCREV_glibc ?= "ae37d06c7d127817ba43850f0f898b793d42aea7"
+SRCREV_localedef ?= "95c0221703ad970a52445e9eaf91c4aff35eebef"
+
+GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;branch=master"
+
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)"
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 17fa2d52a5..80a3e0b493 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -1,80 +1,33 @@
require glibc-common.inc
require glibc-ld.inc
-require glibc-testing.inc
-STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
-STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
-PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
-
-# glibc can't be built without optimization, if someone tries to compile an
-# entire image as -O0, we override it with -O2 here and give a note about it.
-def get_optimization(d):
- selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
- if bb.utils.contains("SELECTED_OPTIMIZATION", "-O2", "x", "", d) == "x":
- return selected_optimization
- elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O", "x", "", d) == "x":
- bb.note("glibc can't be built with -O, -O -Wno-error will be used instead.")
- return selected_optimization.replace("-O", "-O -Wno-error")
- elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
- bb.note("glibc can't be built with -O0, -O2 will be used instead.")
- return selected_optimization.replace("-O0", "-O2")
- elif bb.utils.contains("SELECTED_OPTIMIZATION", "-Os", "x", "", d) == "x":
- bb.note("glibc can't be built with -Os, -Os -Wno-error will be used instead.")
- return selected_optimization.replace("-Os", "-Os -Wno-error")
- elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O1", "x", "", d) == "x":
- bb.note("glibc can't be built with -O1, -O1 -Wno-error will be used instead.")
- return selected_optimization.replace("-O1", "-O1 -Wno-error")
- return selected_optimization
-
-SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
-
-# siteconfig.bbclass runs configure which needs a working compiler
-# For the compiler to work we need a working libc yet libc isn't
-# in the sysroots directory at this point. This means the libc.so
-# linker script won't work as the --sysroot setting isn't correct.
-# Here we create a hacked up libc linker script and pass in the right
-# flags to let configure work. Ugly.
-EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
-siteconfig_do_siteconfig_gencache_prepend = " \
- mkdir -p ${WORKDIR}/site_config_libc; \
- cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
- sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
-"
-
-# nptl needs unwind support in gcc, which can't be built without glibc.
-DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial"
-# nptl needs libgcc but dlopens it, so our shlibs code doesn't detect this
-#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
-PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
+PROVIDES = "virtual/libc"
PROVIDES += "virtual/libintl virtual/libiconv"
-inherit autotools texinfo distro_features_check systemd
-require glibc-options.inc
-
-# The main purpose of setting this variable is to prevent users from accidently
-# overriding DISTRO_FEATRUES, causing obscure build failures because of lack
-# of libc functions.
-REQUIRED_DISTRO_FEATURES = "${DISTRO_FEATURES_LIBC}"
+inherit autotools texinfo systemd
LEAD_SONAME = "libc.so"
+# msgfmt could come from gettext-native but we don't depend on that and
+# disable for reproducibility
CACHED_CONFIGUREVARS += " \
ac_cv_path_BASH_SHELL=${base_bindir}/bash \
+ ac_cv_prog_MSGFMT= \
libc_cv_slibdir=${base_libdir} \
libc_cv_rootsbindir=${base_sbindir} \
libc_cv_localedir=${localedir} \
+ libc_cv_ssp_strong=no \
+ libc_cv_ssp_all=no \
libc_cv_ssp=no \
+ libc_cv_include_x86_isa_level=no \
"
-GLIBC_EXTRA_OECONF ?= ""
-GLIBC_EXTRA_OECONF_class-nativesdk = ""
-INHIBIT_DEFAULT_DEPS = "1"
+# ifunc doesn't appear to work on mips, casuses libbfd assertion failures
+CACHED_CONFIGUREVARS:append:mipsarch = " libc_cv_ld_gnu_indirect_function=no"
-# This needs to match with glibc-collateral.inc, otherwise glibc-scripts and glibc-locale
-# will fail to find main glibc, for details see
-# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
-ARM_INSTRUCTION_SET = "arm"
+GLIBC_EXTRA_OECONF ?= ""
+GLIBC_EXTRA_OECONF:class-nativesdk = ""
# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
@@ -88,18 +41,12 @@ PARALLEL_MAKE = ""
# ensure make uses /bin/bash
EXTRA_OEMAKE += "SHELL=/bin/bash"
-OE_FEATURES = "${@features_to_glibc_settings(d)}"
-do_configure_prepend() {
- sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
- echo '${OE_FEATURES}' > ${B}/option-groups.config
+do_configure:prepend() {
+ sed -e "s#/bin/bash#/bin/sh#" -i ${S}/elf/ldd.bash.in
}
-do_configure_append() {
- yes '' | oe_runmake config
-
- # Remove quotation marks from OPTION_EGLIBC_NSSWITCH_FIXED_*. This will
- # avoid install error.
- sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
+# Enable backtrace from abort()
+do_configure:append:arm () {
+ echo "CFLAGS-abort.c = -fasynchronous-unwind-tables" >> ${B}/configparms
+ echo "CFLAGS-raise.c = -fasynchronous-unwind-tables" >> ${B}/configparms
}
-
-GLIBC_ADDONS ?= "nptl,libidn"
diff --git a/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch
new file mode 100644
index 0000000000..1e94049004
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-CVE-2021-38604.patch
@@ -0,0 +1,43 @@
+From b805aebd42364fe696e417808a700fdb9800c9e8 Mon Sep 17 00:00:00 2001
+From: Nikita Popov <npv1310@gmail.com>
+Date: Mon, 9 Aug 2021 20:17:34 +0530
+Subject: [PATCH] librt: fix NULL pointer dereference (bug 28213)
+
+Helper thread frees copied attribute on NOTIFY_REMOVED message
+received from the OS kernel. Unfortunately, it fails to check whether
+copied attribute actually exists (data.attr != NULL). This worked
+earlier because free() checks passed pointer before actually
+attempting to release corresponding memory. But
+__pthread_attr_destroy assumes pointer is not NULL.
+
+So passing NULL pointer to __pthread_attr_destroy will result in
+segmentation fault. This scenario is possible if
+notification->sigev_notify_attributes == NULL (which means default
+thread attributes should be used).
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=b805aebd42364fe696e417808a700fdb9800c9e8]
+CVE: CVE-2021-38604
+
+Signed-off-by: Nikita Popov <npv1310@gmail.com>
+Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
+Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
+---
+ sysdeps/unix/sysv/linux/mq_notify.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
+index 9799dcdaa4..eccae2e4c6 100644
+--- a/sysdeps/unix/sysv/linux/mq_notify.c
++++ b/sysdeps/unix/sysv/linux/mq_notify.c
+@@ -131,7 +131,7 @@ helper_thread (void *arg)
+ to wait until it is done with it. */
+ (void) __pthread_barrier_wait (&notify_barrier);
+ }
+- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
++ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
+ {
+ /* The only state we keep is the copy of the thread attributes. */
+ __pthread_attr_destroy (data.attr);
+--
+2.31.1
+
diff --git a/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch b/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
new file mode 100644
index 0000000000..3283dd7ad8
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch
@@ -0,0 +1,79 @@
+From a8bc44936202692edcd82a48c07d7cf27d6ed8ee Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Sun, 29 Aug 2021 20:49:16 +0800
+Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287]
+
+Since commit [d8ea0d0168 Add an internal wrapper for clone, clone2 and clone3]
+applied, start a unprivileged container (docker run without --privileged),
+it creates a thread failed in container.
+
+In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined. If
+__clone3 returns -1 with ENOSYS, fall back to clone or clone2.
+
+As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP,
+CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS
+was specified by an unprivileged process (process without CAP_SYS_ADMIN)
+
+[1] https://man7.org/linux/man-pages/man2/clone3.2.html
+
+So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could
+fix the issue. Here are the test steps:
+
+1) Prepare test code
+cat > conftest.c <<ENDOF
+ #include <pthread.h>
+ #include <stdio.h>
+
+int check_me = 0;
+void* func(void* data) {check_me = 42; printf("start thread: check_me %d\n", check_me); return &check_me;}
+int main()
+{
+ pthread_t t;
+ void *ret;
+ pthread_create (&t, 0, func, 0);
+ pthread_join (t, &ret);
+ printf("check_me %d, p %p\n", check_me, &ret);
+ return (check_me != 42 || ret != &check_me);
+}
+
+ENDOF
+
+2) Compile
+gcc -o conftest -pthread conftest.c
+
+3) Start a container with glibc 2.34 installed
+[skip details]
+docker run -it <container-image-name> bash
+
+4) Run conftest without this patch
+$ ./conftest
+check_me 0, p 0x7ffd91ccd400
+
+5) Run conftest with this patch
+$ ./conftest
+start thread: check_me 42
+check_me 42, p 0x7ffe253c6f20
+
+Upstream-Status: Submitted [libc-alpha@sourceware.org]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ sysdeps/unix/sysv/linux/clone-internal.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c
+index 979f7880be..97101994e8 100644
+--- a/sysdeps/unix/sysv/linux/clone-internal.c
++++ b/sysdeps/unix/sysv/linux/clone-internal.c
+@@ -52,7 +52,7 @@ __clone_internal (struct clone_args *cl_args,
+ /* Try clone3 first. */
+ int saved_errno = errno;
+ ret = __clone3 (cl_args, sizeof (*cl_args), func, arg);
+- if (ret != -1 || errno != ENOSYS)
++ if (ret != -1 || (errno != ENOSYS && errno != EPERM))
+ return ret;
+
+ /* NB: Restore errno since errno may be checked against non-zero
+--
+2.30.2
+
diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
new file mode 100644
index 0000000000..3ff485b1e3
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch
@@ -0,0 +1,1130 @@
+From d34ba0833cd811f8869a6262044af55f9e7b59d8 Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel@windriver.com>
+Date: Sat, 7 Dec 2019 09:59:22 -0800
+Subject: [PATCH] localedef: Add hardlink resolver from util-linux
+
+The hard link resolver that is built into localedef cannot be run in
+parallel. It will search sibling directories (which are be processed
+in parallel) and perform a creation of a .tmp file and remove the
+original and move the .tmp file in. The problem is that if a probe
+occurs a hard link can be requested to the file that is being removed.
+This will lead to a stray copy or potentially, on a loaded system
+cause race condition which pseudo cannot deal with, where it is left
+with a hard link request to a file that no longer exists. In this
+situation psuedo will inherit the permissions of what ever the target
+inode had to offer.
+
+In short, there are two problems:
+
+1) You will be left with stray copies when using the hard link
+resolution that is built in while running in parallel with
+localedef.
+
+2) When running under pseudo the possibility exists for uid/gid
+leakage when the source file is removed before the hard link can
+be completed.
+
+The solution is to call localedef with --no-hard-links and separately
+process the hardlinks at a later point. To do this requires the
+inclusion of the hardlink utility found in modern versions of
+util-linux. Most host systems do not have this, so it will be
+included with the cross-localedef binary.
+
+[YOCTO #11299]
+[YOCTO #12434]
+
+Upstream-Status: Pending
+
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/programs/c.h | 407 ++++++++++++++++
+ locale/programs/cross-localedef-hardlink.c | 528 +++++++++++++++++++++
+ locale/programs/xalloc.h | 129 +++++
+ 3 files changed, 1064 insertions(+)
+ create mode 100644 locale/programs/c.h
+ create mode 100644 locale/programs/cross-localedef-hardlink.c
+ create mode 100644 locale/programs/xalloc.h
+
+diff --git a/locale/programs/c.h b/locale/programs/c.h
+new file mode 100644
+index 0000000000..d0a402e90e
+--- /dev/null
++++ b/locale/programs/c.h
+@@ -0,0 +1,407 @@
++/*
++ * Fundamental C definitions.
++ */
++
++#ifndef UTIL_LINUX_C_H
++#define UTIL_LINUX_C_H
++
++#include <limits.h>
++#include <stddef.h>
++#include <stdint.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <stdarg.h>
++#include <stdlib.h>
++#include <string.h>
++#include <errno.h>
++
++#include <assert.h>
++
++#ifdef HAVE_ERR_H
++# include <err.h>
++#endif
++
++#ifdef HAVE_SYS_SYSMACROS_H
++# include <sys/sysmacros.h> /* for major, minor */
++#endif
++
++#ifndef LOGIN_NAME_MAX
++# define LOGIN_NAME_MAX 256
++#endif
++
++#ifndef NAME_MAX
++# define NAME_MAX PATH_MAX
++#endif
++
++/*
++ * __GNUC_PREREQ is deprecated in favour of __has_attribute() and
++ * __has_feature(). The __has macros are supported by clang and gcc>=5.
++ */
++#ifndef __GNUC_PREREQ
++# if defined __GNUC__ && defined __GNUC_MINOR__
++# define __GNUC_PREREQ(maj, min) \
++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
++# else
++# define __GNUC_PREREQ(maj, min) 0
++# endif
++#endif
++
++#ifdef __GNUC__
++
++/* &a[0] degrades to a pointer: a different type from an array */
++# define __must_be_array(a) \
++ UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0])))
++
++# define ignore_result(x) __extension__ ({ \
++ __typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \
++})
++
++#else /* !__GNUC__ */
++# define __must_be_array(a) 0
++# define __attribute__(_arg_)
++# define ignore_result(x) ((void) (x))
++#endif /* !__GNUC__ */
++
++/*
++ * It evaluates to 1 if the attribute/feature is supported by the current
++ * compilation targed. Fallback for old compilers.
++ */
++#ifndef __has_attribute
++ #define __has_attribute(x) 0
++#endif
++
++#ifndef __has_feature
++ #define __has_feature(x) 0
++#endif
++
++/*
++ * Function attributes
++ */
++#ifndef __ul_alloc_size
++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3)
++# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result))
++# else
++# define __ul_alloc_size(s)
++# endif
++#endif
++
++#ifndef __ul_calloc_size
++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3)
++# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result))
++# else
++# define __ul_calloc_size(n, s)
++# endif
++#endif
++
++#if __has_attribute(returns_nonnull) || __GNUC_PREREQ (4, 9)
++# define __ul_returns_nonnull __attribute__((returns_nonnull))
++#else
++# define __ul_returns_nonnull
++#endif
++
++/*
++ * Force a compilation error if condition is true, but also produce a
++ * result (of value 0 and type size_t), so the expression can be used
++ * e.g. in a structure initializer (or wherever else comma expressions
++ * aren't permitted).
++ */
++#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); }))
++#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
++
++#ifndef ARRAY_SIZE
++# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
++#endif
++
++#ifndef PATH_MAX
++# define PATH_MAX 4096
++#endif
++
++#ifndef TRUE
++# define TRUE 1
++#endif
++
++#ifndef FALSE
++# define FALSE 0
++#endif
++
++#ifndef min
++# define min(x, y) __extension__ ({ \
++ __typeof__(x) _min1 = (x); \
++ __typeof__(y) _min2 = (y); \
++ (void) (&_min1 == &_min2); \
++ _min1 < _min2 ? _min1 : _min2; })
++#endif
++
++#ifndef max
++# define max(x, y) __extension__ ({ \
++ __typeof__(x) _max1 = (x); \
++ __typeof__(y) _max2 = (y); \
++ (void) (&_max1 == &_max2); \
++ _max1 > _max2 ? _max1 : _max2; })
++#endif
++
++#ifndef cmp_numbers
++# define cmp_numbers(x, y) __extension__ ({ \
++ __typeof__(x) _a = (x); \
++ __typeof__(y) _b = (y); \
++ (void) (&_a == &_b); \
++ _a == _b ? 0 : _a > _b ? 1 : -1; })
++#endif
++
++#ifndef offsetof
++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
++#endif
++
++/*
++ * container_of - cast a member of a structure out to the containing structure
++ * @ptr: the pointer to the member.
++ * @type: the type of the container struct this is embedded in.
++ * @member: the name of the member within the struct.
++ */
++#ifndef container_of
++#define container_of(ptr, type, member) __extension__ ({ \
++ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
++ (type *)( (char *)__mptr - offsetof(type,member) );})
++#endif
++
++#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
++# ifdef HAVE___PROGNAME
++extern char *__progname;
++# define program_invocation_short_name __progname
++# else
++# ifdef HAVE_GETEXECNAME
++# define program_invocation_short_name \
++ prog_inv_sh_nm_from_file(getexecname(), 0)
++# else
++# define program_invocation_short_name \
++ prog_inv_sh_nm_from_file(__FILE__, 1)
++# endif
++static char prog_inv_sh_nm_buf[256];
++static inline char *
++prog_inv_sh_nm_from_file(char *f, char stripext)
++{
++ char *t;
++
++ if ((t = strrchr(f, '/')) != NULL)
++ t++;
++ else
++ t = f;
++
++ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1);
++ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0';
++
++ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL)
++ *t = '\0';
++
++ return prog_inv_sh_nm_buf;
++}
++# endif
++#endif
++
++
++#ifndef HAVE_ERR_H
++static inline void
++errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
++{
++ fprintf(stderr, "%s: ", program_invocation_short_name);
++ if (fmt != NULL) {
++ va_list argp;
++ va_start(argp, fmt);
++ vfprintf(stderr, fmt, argp);
++ va_end(argp);
++ if (adderr)
++ fprintf(stderr, ": ");
++ }
++ if (adderr)
++ fprintf(stderr, "%m");
++ fprintf(stderr, "\n");
++ if (doexit)
++ exit(excode);
++}
++
++#ifndef HAVE_ERR
++# define err(E, FMT...) errmsg(1, E, 1, FMT)
++#endif
++
++#ifndef HAVE_ERRX
++# define errx(E, FMT...) errmsg(1, E, 0, FMT)
++#endif
++
++#ifndef HAVE_WARN
++# define warn(FMT...) errmsg(0, 0, 1, FMT)
++#endif
++
++#ifndef HAVE_WARNX
++# define warnx(FMT...) errmsg(0, 0, 0, FMT)
++#endif
++#endif /* !HAVE_ERR_H */
++
++
++/* Don't use inline function to avoid '#include "nls.h"' in c.h
++ */
++#define errtryhelp(eval) __extension__ ({ \
++ fprintf(stderr, _("Try '%s --help' for more information.\n"), \
++ program_invocation_short_name); \
++ exit(eval); \
++})
++
++/* After failed execvp() */
++#define EX_EXEC_FAILED 126 /* Program located, but not usable. */
++#define EX_EXEC_ENOENT 127 /* Could not find program to exec. */
++#define errexec(name) err(errno == ENOENT ? EX_EXEC_ENOENT : EX_EXEC_FAILED, \
++ _("failed to execute %s"), name)
++
++
++static inline __attribute__((const)) int is_power_of_2(unsigned long num)
++{
++ return (num != 0 && ((num & (num - 1)) == 0));
++}
++
++#ifndef HAVE_LOFF_T
++typedef int64_t loff_t;
++#endif
++
++#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD)
++#include <sys/types.h>
++#include <dirent.h>
++static inline int dirfd(DIR *d)
++{
++ return d->dd_fd;
++}
++#endif
++
++/*
++ * Fallback defines for old versions of glibc
++ */
++#include <fcntl.h>
++
++#ifdef O_CLOEXEC
++#define UL_CLOEXECSTR "e"
++#else
++#define UL_CLOEXECSTR ""
++#endif
++
++#ifndef O_CLOEXEC
++#define O_CLOEXEC 0
++#endif
++
++#ifdef __FreeBSD_kernel__
++#ifndef F_DUPFD_CLOEXEC
++#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
++#endif
++#endif
++
++
++#ifndef AI_ADDRCONFIG
++#define AI_ADDRCONFIG 0x0020
++#endif
++
++#ifndef IUTF8
++#define IUTF8 0040000
++#endif
++
++/*
++ * MAXHOSTNAMELEN replacement
++ */
++static inline size_t get_hostname_max(void)
++{
++ long len = sysconf(_SC_HOST_NAME_MAX);
++
++ if (0 < len)
++ return len;
++
++#ifdef MAXHOSTNAMELEN
++ return MAXHOSTNAMELEN;
++#elif HOST_NAME_MAX
++ return HOST_NAME_MAX;
++#endif
++ return 64;
++}
++
++
++/*
++ * Constant strings for usage() functions. For more info see
++ * Documentation/{howto-usage-function.txt,boilerplate.c}
++ */
++#define USAGE_HEADER ("\nUsage:\n")
++#define USAGE_OPTIONS ("\nOptions:\n")
++#define USAGE_FUNCTIONS ("\nFunctions:\n")
++#define USAGE_COMMANDS ("\nCommands:\n")
++#define USAGE_COLUMNS ("\nAvailable output columns:\n")
++#define USAGE_SEPARATOR "\n"
++
++#define USAGE_OPTSTR_HELP ("display this help")
++#define USAGE_OPTSTR_VERSION ("display version")
++
++#define USAGE_HELP_OPTIONS(marg_dsc) \
++ "%-" #marg_dsc "s%s\n" \
++ "%-" #marg_dsc "s%s\n" \
++ , " -h, --help", USAGE_OPTSTR_HELP \
++ , " -V, --version", USAGE_OPTSTR_VERSION
++
++#define USAGE_MAN_TAIL(_man) ("\nFor more details see %s.\n"), _man
++
++#define UTIL_LINUX_VERSION ("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
++
++#define print_version(eval) __extension__ ({ \
++ printf(UTIL_LINUX_VERSION); \
++ exit(eval); \
++})
++
++/*
++ * scanf modifiers for "strings allocation"
++ */
++#ifdef HAVE_SCANF_MS_MODIFIER
++#define UL_SCNsA "%ms"
++#elif defined(HAVE_SCANF_AS_MODIFIER)
++#define UL_SCNsA "%as"
++#endif
++
++/*
++ * seek stuff
++ */
++#ifndef SEEK_DATA
++# define SEEK_DATA 3
++#endif
++#ifndef SEEK_HOLE
++# define SEEK_HOLE 4
++#endif
++
++
++/*
++ * Macros to convert #define'itions to strings, for example
++ * #define XYXXY 42
++ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY));
++ */
++#define stringify_value(s) stringify(s)
++#define stringify(s) #s
++
++/*
++ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time
++ * instrumentation shipped with Clang and GCC) to not instrument the
++ * annotated function. Furthermore, it will prevent the compiler from
++ * inlining the function because inlining currently breaks the blacklisting
++ * mechanism of AddressSanitizer.
++ */
++#if __has_feature(address_sanitizer) && __has_attribute(no_sanitize_memory) && __has_attribute(no_sanitize_address)
++# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address))
++#else
++# define UL_ASAN_BLACKLIST /* nothing */
++#endif
++
++/*
++ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for
++ * pwd buffer and in some cases it is not large enough. See POSIX and
++ * getpwnam_r man page for more details.
++ */
++#define UL_GETPW_BUFSIZ (16 * 1024)
++
++/*
++ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must
++ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h.
++ */
++#if !defined MAP_ANONYMOUS && defined MAP_ANON
++# define MAP_ANONYMOUS (MAP_ANON)
++#endif
++
++#endif /* UTIL_LINUX_C_H */
+diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
+new file mode 100644
+index 0000000000..63615896b0
+--- /dev/null
++++ b/locale/programs/cross-localedef-hardlink.c
+@@ -0,0 +1,528 @@
++/*
++ * hardlink - consolidate duplicate files via hardlinks
++ *
++ * Copyright (C) 2018 Red Hat, Inc. All rights reserved.
++ * Written by Jakub Jelinek <jakub@redhat.com>
++ *
++ * Copyright (C) 2019 Karel Zak <kzak@redhat.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it would be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++ */
++#include <sys/types.h>
++#include <stdlib.h>
++#include <getopt.h>
++#include <stdio.h>
++#include <unistd.h>
++#include <sys/stat.h>
++#include <sys/mman.h>
++#include <string.h>
++#include <dirent.h>
++#include <fcntl.h>
++#include <errno.h>
++#ifdef HAVE_PCRE
++# define PCRE2_CODE_UNIT_WIDTH 8
++# include <pcre2.h>
++#endif
++
++#include "c.h"
++#include "xalloc.h"
++#include "nls.h"
++#include "closestream.h"
++
++#define NHASH (1<<17) /* Must be a power of 2! */
++#define NBUF 64
++
++struct hardlink_file;
++
++struct hardlink_hash {
++ struct hardlink_hash *next;
++ struct hardlink_file *chain;
++ off_t size;
++ time_t mtime;
++};
++
++struct hardlink_dir {
++ struct hardlink_dir *next;
++ char name[];
++};
++
++struct hardlink_file {
++ struct hardlink_file *next;
++ ino_t ino;
++ dev_t dev;
++ unsigned int cksum;
++ char name[];
++};
++
++struct hardlink_dynstr {
++ char *buf;
++ size_t alloc;
++};
++
++struct hardlink_ctl {
++ struct hardlink_dir *dirs;
++ struct hardlink_hash *hps[NHASH];
++ char iobuf1[BUFSIZ];
++ char iobuf2[BUFSIZ];
++ /* summary counters */
++ unsigned long long ndirs;
++ unsigned long long nobjects;
++ unsigned long long nregfiles;
++ unsigned long long ncomp;
++ unsigned long long nlinks;
++ unsigned long long nsaved;
++ /* current device */
++ dev_t dev;
++ /* flags */
++ unsigned int verbose;
++ unsigned int
++ no_link:1,
++ content_only:1,
++ force:1;
++};
++/* ctl is in global scope due use in atexit() */
++struct hardlink_ctl global_ctl;
++
++__attribute__ ((always_inline))
++static inline unsigned int hash(off_t size, time_t mtime)
++{
++ return (size ^ mtime) & (NHASH - 1);
++}
++
++__attribute__ ((always_inline))
++static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope)
++{
++ if (content_scope)
++ return st1->st_size != st2->st_size;
++
++ return st1->st_mode != st2->st_mode
++ || st1->st_uid != st2->st_uid
++ || st1->st_gid != st2->st_gid
++ || st1->st_size != st2->st_size
++ || st1->st_mtime != st2->st_mtime;
++}
++
++static void print_summary(void)
++{
++ struct hardlink_ctl const *const ctl = &global_ctl;
++
++ if (!ctl->verbose)
++ return;
++
++ if (ctl->verbose > 1 && ctl->nlinks)
++ fputc('\n', stdout);
++
++ printf(_("Directories: %9lld\n"), ctl->ndirs);
++ printf(_("Objects: %9lld\n"), ctl->nobjects);
++ printf(_("Regular files: %9lld\n"), ctl->nregfiles);
++ printf(_("Comparisons: %9lld\n"), ctl->ncomp);
++ printf( "%s%9lld\n", (ctl->no_link ?
++ _("Would link: ") :
++ _("Linked: ")), ctl->nlinks);
++ printf( "%s %9lld\n", (ctl->no_link ?
++ _("Would save: ") :
++ _("Saved: ")), ctl->nsaved);
++}
++
++static void __attribute__((__noreturn__)) usage(void)
++{
++ fputs(USAGE_HEADER, stdout);
++ printf(_(" %s [options] directory...\n"), program_invocation_short_name);
++
++ fputs(USAGE_SEPARATOR, stdout);
++ puts(_("Consolidate duplicate files using hardlinks."));
++
++ fputs(USAGE_OPTIONS, stdout);
++ puts(_(" -c, --content compare only contents, ignore permission, etc."));
++ puts(_(" -n, --dry-run don't actually link anything"));
++ puts(_(" -v, --verbose print summary after hardlinking"));
++ puts(_(" -vv print every hardlinked file and summary"));
++ puts(_(" -f, --force force hardlinking across filesystems"));
++ puts(_(" -x, --exclude <regex> exclude files matching pattern"));
++
++ fputs(USAGE_SEPARATOR, stdout);
++ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */
++ printf(USAGE_MAN_TAIL("hardlink(1)"));
++ exit(EXIT_SUCCESS);
++}
++
++__attribute__ ((always_inline))
++static inline size_t add2(size_t a, size_t b)
++{
++ size_t sum = a + b;
++
++ if (sum < a)
++ errx(EXIT_FAILURE, _("integer overflow"));
++ return sum;
++}
++
++__attribute__ ((always_inline))
++static inline size_t add3(size_t a, size_t b, size_t c)
++{
++ return add2(add2(a, b), c);
++}
++
++static void growstr(struct hardlink_dynstr *str, size_t newlen)
++{
++ if (newlen < str->alloc)
++ return;
++ str->buf = xrealloc(str->buf, str->alloc = add2(newlen, 1));
++}
++
++static void process_path(struct hardlink_ctl *ctl, const char *name)
++{
++ struct stat st, st2, st3;
++ const size_t namelen = strlen(name);
++
++ ctl->nobjects++;
++ if (lstat(name, &st))
++ return;
++
++ if (st.st_dev != ctl->dev && !ctl->force) {
++ if (ctl->dev)
++ errx(EXIT_FAILURE,
++ _("%s is on different filesystem than the rest "
++ "(use -f option to override)."), name);
++ ctl->dev = st.st_dev;
++ }
++ if (S_ISDIR(st.st_mode)) {
++ struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1));
++ memcpy(dp->name, name, namelen + 1);
++ dp->next = ctl->dirs;
++ ctl->dirs = dp;
++
++ } else if (S_ISREG(st.st_mode)) {
++ int fd, i;
++ struct hardlink_file *fp, *fp2;
++ struct hardlink_hash *hp;
++ const char *n1, *n2;
++ unsigned int buf[NBUF];
++ int cksumsize = sizeof(buf);
++ unsigned int cksum;
++ time_t mtime = ctl->content_only ? 0 : st.st_mtime;
++ unsigned int hsh = hash(st.st_size, mtime);
++ off_t fsize;
++
++ ctl->nregfiles++;
++ if (ctl->verbose > 1)
++ printf("%s\n", name);
++
++ fd = open(name, O_RDONLY);
++ if (fd < 0)
++ return;
++
++ if ((size_t)st.st_size < sizeof(buf)) {
++ cksumsize = st.st_size;
++ memset(((char *)buf) + cksumsize, 0,
++ (sizeof(buf) - cksumsize) % sizeof(buf[0]));
++ }
++ if (read(fd, buf, cksumsize) != cksumsize) {
++ close(fd);
++ return;
++ }
++ cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]);
++ for (i = 0, cksum = 0; i < cksumsize; i++) {
++ if (cksum + buf[i] < cksum)
++ cksum += buf[i] + 1;
++ else
++ cksum += buf[i];
++ }
++ for (hp = ctl->hps[hsh]; hp; hp = hp->next) {
++ if (hp->size == st.st_size && hp->mtime == mtime)
++ break;
++ }
++ if (!hp) {
++ hp = xmalloc(sizeof(*hp));
++ hp->size = st.st_size;
++ hp->mtime = mtime;
++ hp->chain = NULL;
++ hp->next = ctl->hps[hsh];
++ ctl->hps[hsh] = hp;
++ }
++ for (fp = hp->chain; fp; fp = fp->next) {
++ if (fp->cksum == cksum)
++ break;
++ }
++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) {
++ if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) {
++ close(fd);
++ return;
++ }
++ }
++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) {
++
++ if (!lstat(fp2->name, &st2) && S_ISREG(st2.st_mode) &&
++ !stcmp(&st, &st2, ctl->content_only) &&
++ st2.st_ino != st.st_ino &&
++ st2.st_dev == st.st_dev) {
++
++ int fd2 = open(fp2->name, O_RDONLY);
++ if (fd2 < 0)
++ continue;
++
++ if (fstat(fd2, &st2) || !S_ISREG(st2.st_mode)
++ || st2.st_size == 0) {
++ close(fd2);
++ continue;
++ }
++ ctl->ncomp++;
++ lseek(fd, 0, SEEK_SET);
++
++ for (fsize = st.st_size; fsize > 0;
++ fsize -= (off_t)sizeof(ctl->iobuf1)) {
++ ssize_t xsz;
++ ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ?
++ (ssize_t) sizeof(ctl->iobuf1) : fsize;
++
++ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize)
++ warn(_("cannot read %s"), name);
++ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize)
++ warn(_("cannot read %s"), fp2->name);
++
++ if (xsz != rsize) {
++ close(fd);
++ close(fd2);
++ return;
++ }
++ if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize))
++ break;
++ }
++ close(fd2);
++ if (fsize > 0)
++ continue;
++ if (lstat(name, &st3)) {
++ warn(_("cannot stat %s"), name);
++ close(fd);
++ return;
++ }
++ st3.st_atime = st.st_atime;
++ if (stcmp(&st, &st3, 0)) {
++ warnx(_("file %s changed underneath us"), name);
++ close(fd);
++ return;
++ }
++ n1 = fp2->name;
++ n2 = name;
++
++ if (!ctl->no_link) {
++ const char *suffix =
++ ".$$$___cleanit___$$$";
++ const size_t suffixlen = strlen(suffix);
++ size_t n2len = strlen(n2);
++ struct hardlink_dynstr nam2 = { NULL, 0 };
++
++ growstr(&nam2, add2(n2len, suffixlen));
++ memcpy(nam2.buf, n2, n2len);
++ memcpy(&nam2.buf[n2len], suffix,
++ suffixlen + 1);
++ /* First create a temporary link to n1 under a new name */
++ if (link(n1, nam2.buf)) {
++ warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"),
++ n1, n2, nam2.buf);
++ free(nam2.buf);
++ continue;
++ }
++ /* Then rename into place over the existing n2 */
++ if (rename(nam2.buf, n2)) {
++ warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"),
++ n1, n2, n2);
++ /* Something went wrong, try to remove the now redundant temporary link */
++ if (unlink(nam2.buf))
++ warn(_("failed to remove temporary link %s"), nam2.buf);
++ free(nam2.buf);
++ continue;
++ }
++ free(nam2.buf);
++ }
++ ctl->nlinks++;
++ if (st3.st_nlink > 1) {
++ /* We actually did not save anything this time, since the link second argument
++ had some other links as well. */
++ if (ctl->verbose > 1)
++ printf(_(" %s %s to %s\n"),
++ (ctl->no_link ? _("Would link") : _("Linked")),
++ n1, n2);
++ } else {
++ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096;
++ if (ctl->verbose > 1)
++ printf(_(" %s %s to %s, %s %jd\n"),
++ (ctl->no_link ? _("Would link") : _("Linked")),
++ n1, n2,
++ (ctl->no_link ? _("would save") : _("saved")),
++ (intmax_t)st.st_size);
++ }
++ close(fd);
++ return;
++ }
++ }
++ fp2 = xmalloc(add3(sizeof(*fp2), namelen, 1));
++ close(fd);
++ fp2->ino = st.st_ino;
++ fp2->dev = st.st_dev;
++ fp2->cksum = cksum;
++ memcpy(fp2->name, name, namelen + 1);
++
++ if (fp) {
++ fp2->next = fp->next;
++ fp->next = fp2;
++ } else {
++ fp2->next = hp->chain;
++ hp->chain = fp2;
++ }
++ return;
++ }
++}
++
++int main(int argc, char **argv)
++{
++ int ch;
++ int i;
++#ifdef HAVE_PCRE
++ int errornumber;
++ PCRE2_SIZE erroroffset;
++ pcre2_code *re = NULL;
++ PCRE2_SPTR exclude_pattern = NULL;
++ pcre2_match_data *match_data = NULL;
++#endif
++ struct hardlink_dynstr nam1 = { NULL, 0 };
++ struct hardlink_ctl *ctl = &global_ctl;
++
++ static const struct option longopts[] = {
++ { "content", no_argument, NULL, 'c' },
++ { "dry-run", no_argument, NULL, 'n' },
++ { "exclude", required_argument, NULL, 'x' },
++ { "force", no_argument, NULL, 'f' },
++ { "help", no_argument, NULL, 'h' },
++ { "verbose", no_argument, NULL, 'v' },
++ { "version", no_argument, NULL, 'V' },
++ { NULL, 0, NULL, 0 },
++ };
++
++ setlocale(LC_ALL, "");
++ bindtextdomain(PACKAGE, LOCALEDIR);
++ textdomain(PACKAGE);
++ close_stdout_atexit();
++
++ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) {
++ switch (ch) {
++ case 'n':
++ ctl->no_link = 1;
++ break;
++ case 'v':
++ ctl->verbose++;
++ break;
++ case 'c':
++ ctl->content_only = 1;
++ break;
++ case 'f':
++ ctl->force = 1;
++ break;
++ case 'x':
++#ifdef HAVE_PCRE
++ exclude_pattern = (PCRE2_SPTR) optarg;
++#else
++ errx(EXIT_FAILURE,
++ _("option --exclude not supported (built without pcre2)"));
++#endif
++ break;
++ case 'V':
++ print_version(EXIT_SUCCESS);
++ case 'h':
++ usage();
++ default:
++ errtryhelp(EXIT_FAILURE);
++ }
++ }
++
++ if (optind == argc) {
++ warnx(_("no directory specified"));
++ errtryhelp(EXIT_FAILURE);
++ }
++
++#ifdef HAVE_PCRE
++ if (exclude_pattern) {
++ re = pcre2_compile(exclude_pattern, /* the pattern */
++ PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminate */
++ 0, /* default options */
++ &errornumber, &erroroffset, NULL); /* use default compile context */
++ if (!re) {
++ PCRE2_UCHAR buffer[256];
++ pcre2_get_error_message(errornumber, buffer,
++ sizeof(buffer));
++ errx(EXIT_FAILURE, _("pattern error at offset %d: %s"),
++ (int)erroroffset, buffer);
++ }
++ match_data = pcre2_match_data_create_from_pattern(re, NULL);
++ }
++#endif
++ atexit(print_summary);
++
++ for (i = optind; i < argc; i++)
++ process_path(ctl, argv[i]);
++
++ while (ctl->dirs) {
++ DIR *dh;
++ struct dirent *di;
++ struct hardlink_dir *dp = ctl->dirs;
++ size_t nam1baselen = strlen(dp->name);
++
++ ctl->dirs = dp->next;
++ growstr(&nam1, add2(nam1baselen, 1));
++ memcpy(nam1.buf, dp->name, nam1baselen);
++ free(dp);
++ nam1.buf[nam1baselen++] = '/';
++ nam1.buf[nam1baselen] = 0;
++ dh = opendir(nam1.buf);
++
++ if (dh == NULL)
++ continue;
++ ctl->ndirs++;
++
++ while ((di = readdir(dh)) != NULL) {
++ if (!di->d_name[0])
++ continue;
++ if (di->d_name[0] == '.') {
++ if (!di->d_name[1] || !strcmp(di->d_name, ".."))
++ continue;
++ }
++#ifdef HAVE_PCRE
++ if (re && pcre2_match(re, /* compiled regex */
++ (PCRE2_SPTR) di->d_name, strlen(di->d_name), 0, /* start at offset 0 */
++ 0, /* default options */
++ match_data, /* block for storing the result */
++ NULL) /* use default match context */
++ >=0) {
++ if (ctl->verbose) {
++ nam1.buf[nam1baselen] = 0;
++ printf(_("Skipping %s%s\n"), nam1.buf, di->d_name);
++ }
++ continue;
++ }
++#endif
++ {
++ size_t subdirlen;
++ growstr(&nam1,
++ add2(nam1baselen, subdirlen =
++ strlen(di->d_name)));
++ memcpy(&nam1.buf[nam1baselen], di->d_name,
++ add2(subdirlen, 1));
++ }
++ process_path(ctl, nam1.buf);
++ }
++ closedir(dh);
++ }
++
++ return 0;
++}
+diff --git a/locale/programs/xalloc.h b/locale/programs/xalloc.h
+new file mode 100644
+index 0000000000..0129a85e2e
+--- /dev/null
++++ b/locale/programs/xalloc.h
+@@ -0,0 +1,129 @@
++/*
++ * Copyright (C) 2010 Davidlohr Bueso <dave@gnu.org>
++ *
++ * This file may be redistributed under the terms of the
++ * GNU Lesser General Public License.
++ *
++ * General memory allocation wrappers for malloc, realloc, calloc and strdup
++ */
++
++#ifndef UTIL_LINUX_XALLOC_H
++#define UTIL_LINUX_XALLOC_H
++
++#include <stdlib.h>
++#include <string.h>
++
++#include "c.h"
++
++#ifndef XALLOC_EXIT_CODE
++# define XALLOC_EXIT_CODE EXIT_FAILURE
++#endif
++
++static inline void __attribute__((__noreturn__))
++__err_oom(const char *file, unsigned int line)
++{
++ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line);
++}
++
++#define err_oom() __err_oom(__FILE__, __LINE__)
++
++static inline __ul_alloc_size(1) __ul_returns_nonnull
++void *xmalloc(const size_t size)
++{
++ void *ret = malloc(size);
++
++ if (!ret && size)
++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
++ return ret;
++}
++
++static inline __ul_alloc_size(2) __ul_returns_nonnull
++void *xrealloc(void *ptr, const size_t size)
++{
++ void *ret = realloc(ptr, size);
++
++ if (!ret && size)
++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
++ return ret;
++}
++
++static inline __ul_calloc_size(1, 2) __ul_returns_nonnull
++void *xcalloc(const size_t nelems, const size_t size)
++{
++ void *ret = calloc(nelems, size);
++
++ if (!ret && size && nelems)
++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size);
++ return ret;
++}
++
++static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull
++*xstrdup(const char *str)
++{
++ char *ret;
++
++ if (!str)
++ return NULL;
++
++ ret = strdup(str);
++
++ if (!ret)
++ err(XALLOC_EXIT_CODE, "cannot duplicate string");
++ return ret;
++}
++
++static inline char * __attribute__((warn_unused_result)) __ul_returns_nonnull
++xstrndup(const char *str, size_t size)
++{
++ char *ret;
++
++ if (!str)
++ return NULL;
++
++ ret = strndup(str, size);
++
++ if (!ret)
++ err(XALLOC_EXIT_CODE, "cannot duplicate string");
++ return ret;
++}
++
++
++static inline int __attribute__ ((__format__(printf, 2, 3)))
++ xasprintf(char **strp, const char *fmt, ...)
++{
++ int ret;
++ va_list args;
++ va_start(args, fmt);
++ ret = vasprintf(&(*strp), fmt, args);
++ va_end(args);
++ if (ret < 0)
++ err(XALLOC_EXIT_CODE, "cannot allocate string");
++ return ret;
++}
++
++static inline int __attribute__ ((__format__(printf, 2, 0)))
++xvasprintf(char **strp, const char *fmt, va_list ap)
++{
++ int ret = vasprintf(&(*strp), fmt, ap);
++ if (ret < 0)
++ err(XALLOC_EXIT_CODE, "cannot allocate string");
++ return ret;
++}
++
++
++static inline char * __attribute__((warn_unused_result)) xgethostname(void)
++{
++ char *name;
++ size_t sz = get_hostname_max() + 1;
++
++ name = xmalloc(sizeof(char) * sz);
++
++ if (gethostname(name, sz) != 0) {
++ free(name);
++ return NULL;
++ }
++ name[sz - 1] = '\0';
++ return name;
++}
++
++#endif
diff --git a/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch b/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch
new file mode 100644
index 0000000000..9f71fecddb
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-CVE-2021-38604.patch
@@ -0,0 +1,150 @@
+From 4cc79c217744743077bf7a0ec5e0a4318f1e6641 Mon Sep 17 00:00:00 2001
+From: Nikita Popov <npv1310@gmail.com>
+Date: Thu, 12 Aug 2021 16:09:50 +0530
+Subject: [PATCH] librt: add test (bug 28213)
+
+This test implements following logic:
+1) Create POSIX message queue.
+ Register a notification with mq_notify (using NULL attributes).
+ Then immediately unregister the notification with mq_notify.
+ Helper thread in a vulnerable version of glibc
+ should cause NULL pointer dereference after these steps.
+2) Once again, register the same notification.
+ Try to send a dummy message.
+ Test is considered successfulif the dummy message
+ is successfully received by the callback function.
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=4cc79c217744743077bf7a0ec5e0a4318f1e6641]
+CVE: CVE-2021-38604
+
+Signed-off-by: Nikita Popov <npv1310@gmail.com>
+Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
+Signed-off-by: Vinay Kumar <vinay.m.engg@gmail.com>
+---
+ rt/Makefile | 1 +
+ rt/tst-bz28213.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 102 insertions(+)
+ create mode 100644 rt/tst-bz28213.c
+
+diff --git a/rt/Makefile b/rt/Makefile
+index 113cea03a5..910e775995 100644
+--- a/rt/Makefile
++++ b/rt/Makefile
+@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \
+ tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
+ tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
+ tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
++ tst-bz28213 \
+ tst-timer3 tst-timer4 tst-timer5 \
+ tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
+ tst-shm-cancel \
+diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c
+new file mode 100644
+index 0000000000..0c096b5a0a
+--- /dev/null
++++ b/rt/tst-bz28213.c
+@@ -0,0 +1,101 @@
++/* Bug 28213: test for NULL pointer dereference in mq_notify.
++ Copyright (C) The GNU Toolchain Authors.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <https://www.gnu.org/licenses/>. */
++
++#include <errno.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
++#include <unistd.h>
++#include <mqueue.h>
++#include <signal.h>
++#include <stdlib.h>
++#include <string.h>
++#include <support/check.h>
++
++static mqd_t m = -1;
++static const char msg[] = "hello";
++
++static void
++check_bz28213_cb (union sigval sv)
++{
++ char buf[sizeof (msg)];
++
++ (void) sv;
++
++ TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL)
++ == sizeof (buf));
++ TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0);
++
++ exit (0);
++}
++
++static void
++check_bz28213 (void)
++{
++ struct sigevent sev;
++
++ memset (&sev, '\0', sizeof (sev));
++ sev.sigev_notify = SIGEV_THREAD;
++ sev.sigev_notify_function = check_bz28213_cb;
++
++ /* Step 1: Register & unregister notifier.
++ Helper thread should receive NOTIFY_REMOVED notification.
++ In a vulnerable version of glibc, NULL pointer dereference follows. */
++ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
++ TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0);
++
++ /* Step 2: Once again, register notification.
++ Try to send one message.
++ Test is considered successful, if the callback does exit (0). */
++ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
++ TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0);
++
++ /* Wait... */
++ pause ();
++}
++
++static int
++do_test (void)
++{
++ static const char m_name[] = "/bz28213_queue";
++ struct mq_attr m_attr;
++
++ memset (&m_attr, '\0', sizeof (m_attr));
++ m_attr.mq_maxmsg = 1;
++ m_attr.mq_msgsize = sizeof (msg);
++
++ m = mq_open (m_name,
++ O_RDWR | O_CREAT | O_EXCL,
++ 0600,
++ &m_attr);
++
++ if (m < 0)
++ {
++ if (errno == ENOSYS)
++ FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n");
++ FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n");
++ }
++
++ TEST_VERIFY_EXIT (mq_unlink (m_name) == 0);
++
++ check_bz28213 ();
++
++ return 0;
++}
++
++#include <support/test-driver.c>
+--
+2.31.1
+
diff --git a/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
new file mode 100644
index 0000000000..2445aa56b3
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch
@@ -0,0 +1,238 @@
+From d7bb36a9a27e5e4c3be6378493b41286513750e9 Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel@windriver.com>
+Date: Sat, 7 Dec 2019 10:01:37 -0800
+Subject: [PATCH] localedef: fix-ups hardlink to make it compile
+
+Upstream-Status: Pending
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/programs/c.h | 2 +-
+ locale/programs/cross-localedef-hardlink.c | 79 +++++++++++-----------
+ 2 files changed, 39 insertions(+), 42 deletions(-)
+
+diff --git a/locale/programs/c.h b/locale/programs/c.h
+index d0a402e90e..1804d31c73 100644
+--- a/locale/programs/c.h
++++ b/locale/programs/c.h
+@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
+ /* Don't use inline function to avoid '#include "nls.h"' in c.h
+ */
+ #define errtryhelp(eval) __extension__ ({ \
+- fprintf(stderr, _("Try '%s --help' for more information.\n"), \
++ fprintf(stderr, ("Try '%s --help' for more information.\n"), \
+ program_invocation_short_name); \
+ exit(eval); \
+ })
+diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
+index 63615896b0..726e6dd948 100644
+--- a/locale/programs/cross-localedef-hardlink.c
++++ b/locale/programs/cross-localedef-hardlink.c
+@@ -20,6 +20,8 @@
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
++
++#undef HAVE_PCRE
+ #include <sys/types.h>
+ #include <stdlib.h>
+ #include <getopt.h>
+@@ -38,8 +40,8 @@
+
+ #include "c.h"
+ #include "xalloc.h"
+-#include "nls.h"
+-#include "closestream.h"
++//#include "nls.h"
++//#include "closestream.h"
+
+ #define NHASH (1<<17) /* Must be a power of 2! */
+ #define NBUF 64
+@@ -124,33 +126,33 @@ static void print_summary(void)
+ if (ctl->verbose > 1 && ctl->nlinks)
+ fputc('\n', stdout);
+
+- printf(_("Directories: %9lld\n"), ctl->ndirs);
+- printf(_("Objects: %9lld\n"), ctl->nobjects);
+- printf(_("Regular files: %9lld\n"), ctl->nregfiles);
+- printf(_("Comparisons: %9lld\n"), ctl->ncomp);
++ printf(("Directories: %9lld\n"), ctl->ndirs);
++ printf(("Objects: %9lld\n"), ctl->nobjects);
++ printf(("Regular files: %9lld\n"), ctl->nregfiles);
++ printf(("Comparisons: %9lld\n"), ctl->ncomp);
+ printf( "%s%9lld\n", (ctl->no_link ?
+- _("Would link: ") :
+- _("Linked: ")), ctl->nlinks);
++ ("Would link: ") :
++ ("Linked: ")), ctl->nlinks);
+ printf( "%s %9lld\n", (ctl->no_link ?
+- _("Would save: ") :
+- _("Saved: ")), ctl->nsaved);
++ ("Would save: ") :
++ ("Saved: ")), ctl->nsaved);
+ }
+
+ static void __attribute__((__noreturn__)) usage(void)
+ {
+ fputs(USAGE_HEADER, stdout);
+- printf(_(" %s [options] directory...\n"), program_invocation_short_name);
++ printf((" %s [options] directory...\n"), program_invocation_short_name);
+
+ fputs(USAGE_SEPARATOR, stdout);
+- puts(_("Consolidate duplicate files using hardlinks."));
++ puts(("Consolidate duplicate files using hardlinks."));
+
+ fputs(USAGE_OPTIONS, stdout);
+- puts(_(" -c, --content compare only contents, ignore permission, etc."));
+- puts(_(" -n, --dry-run don't actually link anything"));
+- puts(_(" -v, --verbose print summary after hardlinking"));
+- puts(_(" -vv print every hardlinked file and summary"));
+- puts(_(" -f, --force force hardlinking across filesystems"));
+- puts(_(" -x, --exclude <regex> exclude files matching pattern"));
++ puts((" -c, --content compare only contents, ignore permission, etc."));
++ puts((" -n, --dry-run don't actually link anything"));
++ puts((" -v, --verbose print summary after hardlinking"));
++ puts((" -vv print every hardlinked file and summary"));
++ puts((" -f, --force force hardlinking across filesystems"));
++ puts((" -x, --exclude <regex> exclude files matching pattern"));
+
+ fputs(USAGE_SEPARATOR, stdout);
+ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */
+@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b)
+ size_t sum = a + b;
+
+ if (sum < a)
+- errx(EXIT_FAILURE, _("integer overflow"));
++ errx(EXIT_FAILURE, ("integer overflow"));
+ return sum;
+ }
+
+@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ if (st.st_dev != ctl->dev && !ctl->force) {
+ if (ctl->dev)
+ errx(EXIT_FAILURE,
+- _("%s is on different filesystem than the rest "
++ ("%s is on different filesystem than the rest "
+ "(use -f option to override)."), name);
+ ctl->dev = st.st_dev;
+ }
+@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ (ssize_t) sizeof(ctl->iobuf1) : fsize;
+
+ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize)
+- warn(_("cannot read %s"), name);
++ warn(("cannot read %s"), name);
+ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize)
+- warn(_("cannot read %s"), fp2->name);
++ warn(("cannot read %s"), fp2->name);
+
+ if (xsz != rsize) {
+ close(fd);
+@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ if (fsize > 0)
+ continue;
+ if (lstat(name, &st3)) {
+- warn(_("cannot stat %s"), name);
++ warn(("cannot stat %s"), name);
+ close(fd);
+ return;
+ }
+ st3.st_atime = st.st_atime;
+ if (stcmp(&st, &st3, 0)) {
+- warnx(_("file %s changed underneath us"), name);
++ warnx(("file %s changed underneath us"), name);
+ close(fd);
+ return;
+ }
+@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ suffixlen + 1);
+ /* First create a temporary link to n1 under a new name */
+ if (link(n1, nam2.buf)) {
+- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"),
++ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"),
+ n1, n2, nam2.buf);
+ free(nam2.buf);
+ continue;
+ }
+ /* Then rename into place over the existing n2 */
+ if (rename(nam2.buf, n2)) {
+- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"),
++ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"),
+ n1, n2, n2);
+ /* Something went wrong, try to remove the now redundant temporary link */
+ if (unlink(nam2.buf))
+- warn(_("failed to remove temporary link %s"), nam2.buf);
++ warn(("failed to remove temporary link %s"), nam2.buf);
+ free(nam2.buf);
+ continue;
+ }
+@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ /* We actually did not save anything this time, since the link second argument
+ had some other links as well. */
+ if (ctl->verbose > 1)
+- printf(_(" %s %s to %s\n"),
+- (ctl->no_link ? _("Would link") : _("Linked")),
++ printf((" %s %s to %s\n"),
++ (ctl->no_link ? ("Would link") : ("Linked")),
+ n1, n2);
+ } else {
+ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096;
+ if (ctl->verbose > 1)
+- printf(_(" %s %s to %s, %s %jd\n"),
+- (ctl->no_link ? _("Would link") : _("Linked")),
++ printf((" %s %s to %s, %s %jd\n"),
++ (ctl->no_link ? ("Would link") : ("Linked")),
+ n1, n2,
+- (ctl->no_link ? _("would save") : _("saved")),
++ (ctl->no_link ? ("would save") : ("saved")),
+ (intmax_t)st.st_size);
+ }
+ close(fd);
+@@ -410,11 +412,6 @@ int main(int argc, char **argv)
+ { NULL, 0, NULL, 0 },
+ };
+
+- setlocale(LC_ALL, "");
+- bindtextdomain(PACKAGE, LOCALEDIR);
+- textdomain(PACKAGE);
+- close_stdout_atexit();
+-
+ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) {
+ switch (ch) {
+ case 'n':
+@@ -434,7 +431,7 @@ int main(int argc, char **argv)
+ exclude_pattern = (PCRE2_SPTR) optarg;
+ #else
+ errx(EXIT_FAILURE,
+- _("option --exclude not supported (built without pcre2)"));
++ ("option --exclude not supported (built without pcre2)"));
+ #endif
+ break;
+ case 'V':
+@@ -447,7 +444,7 @@ int main(int argc, char **argv)
+ }
+
+ if (optind == argc) {
+- warnx(_("no directory specified"));
++ warnx(("no directory specified"));
+ errtryhelp(EXIT_FAILURE);
+ }
+
+@@ -461,7 +458,7 @@ int main(int argc, char **argv)
+ PCRE2_UCHAR buffer[256];
+ pcre2_get_error_message(errornumber, buffer,
+ sizeof(buffer));
+- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"),
++ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"),
+ (int)erroroffset, buffer);
+ }
+ match_data = pcre2_match_data_create_from_pattern(re, NULL);
+@@ -506,7 +503,7 @@ int main(int argc, char **argv)
+ >=0) {
+ if (ctl->verbose) {
+ nam1.buf[nam1baselen] = 0;
+- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name);
++ printf(("Skipping %s%s\n"), nam1.buf, di->d_name);
+ }
+ continue;
+ }
diff --git a/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
index 3d66348133..210cc1076c 100644
--- a/meta/recipes-core/glibc/glibc/0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
+++ b/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch
@@ -1,8 +1,7 @@
-From 0876fea1b5b26da84f298714a2e23ba696607dba Mon Sep 17 00:00:00 2001
+From 776a53db6afba8a7ff4412aba88b0679227877f9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:48:24 +0000
-Subject: [PATCH 01/27] nativesdk-glibc: Look for host system ld.so.cache as
- well
+Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
Upstream-Status: Inappropriate [embedded specific]
@@ -27,30 +26,29 @@ RP 14/10/2010
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- elf/dl-load.c | 17 ++++++++---------
- 1 file changed, 8 insertions(+), 9 deletions(-)
+ elf/dl-load.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
-index 0c052e4..f45085a 100644
+index a08df001af..d09daf9e41 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
-@@ -2040,7 +2040,14 @@ _dl_map_object (struct link_map *loader, const char *name,
- fd = open_path (name, namelen, mode,
- &loader->l_runpath_dirs, &realname, &fb, loader,
- LA_SER_RUNPATH, &found_other_class);
--
+@@ -2196,6 +2196,14 @@ _dl_map_object (struct link_map *loader, const char *name,
+ }
+ }
+
+ /* try the default path. */
+ if (fd == -1
+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
-+ && rtld_search_dirs.dirs != (void *) -1)
-+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
++ && __rtld_search_dirs.dirs != (void *) -1)
++ fd = open_path (name, namelen, mode & __RTLD_SECURE, &__rtld_search_dirs,
+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
+ /* Finally try ld.so.cache */
#ifdef USE_LDCONFIG
if (fd == -1
&& (__glibc_likely ((mode & __RTLD_SECURE) == 0)
-@@ -2099,14 +2106,6 @@ _dl_map_object (struct link_map *loader, const char *name,
+@@ -2254,14 +2262,6 @@ _dl_map_object (struct link_map *loader, const char *name,
}
#endif
@@ -58,13 +56,10 @@ index 0c052e4..f45085a 100644
- if (fd == -1
- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
-- && rtld_search_dirs.dirs != (void *) -1)
-- fd = open_path (name, namelen, mode, &rtld_search_dirs,
+- && __rtld_search_dirs.dirs != (void *) -1)
+- fd = open_path (name, namelen, mode, &__rtld_search_dirs,
- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
-
/* Add another newline when we are tracing the library loading. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch b/meta/recipes-core/glibc/glibc/0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch
deleted file mode 100644
index 748750304f..0000000000
--- a/meta/recipes-core/glibc/glibc/0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 2560b564b5674bf2990e5607f6342c1647a5dc4f Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 8 Mar 2015 04:01:01 +0000
-Subject: [PATCH 04/27] Backport
- https://sourceware.org/ml/libc-ports/2007-12/msg00000.html
-
-Upstream-Status: Pending
-
-2007-12-03 Kristian Van Der Vliet <vanders@liqwyd.com>
-
- * bits/stdio-lock.h (_IO_acquire_lock_clear_flags2): Define
-
-Signed-off-by: Kristian Van Der Vliet <vanders@liqwyd.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- bits/stdio-lock.h | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/bits/stdio-lock.h b/bits/stdio-lock.h
-index 0c5bb65..66304a6 100644
---- a/bits/stdio-lock.h
-+++ b/bits/stdio-lock.h
-@@ -49,6 +49,8 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
- _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
- _IO_flockfile (_fp)
-
-+# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
-+
- # define _IO_release_lock(_fp) \
- _IO_funlockfile (_fp); \
- _IO_cleanup_region_end (0)
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
index b568fc6bdc..010b816e11 100644
--- a/meta/recipes-core/glibc/glibc/0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
+++ b/meta/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch
@@ -1,8 +1,7 @@
-From 086b65d9aacffc47fcd8df68818a476a5ae76fa1 Mon Sep 17 00:00:00 2001
+From df18bae1eeee55ecb9db36d13fe67c58355682eb Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:50:00 +0000
-Subject: [PATCH 02/27] nativesdk-glibc: Fix buffer overrun with a relocated
- SDK
+Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
When ld-linux-*.so.2 is relocated to a path that is longer than the
original fixed location, the dynamic loader will crash in open_path
@@ -22,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 12 insertions(+)
diff --git a/elf/dl-load.c b/elf/dl-load.c
-index f45085a..f1eb5ed 100644
+index d09daf9e41..2c6270e2a7 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
-@@ -1765,7 +1765,19 @@ open_path (const char *name, size_t namelen, int mode,
+@@ -1892,7 +1892,19 @@ open_path (const char *name, size_t namelen, int mode,
given on the command line when rtld is run directly. */
return -1;
@@ -45,6 +44,3 @@ index f45085a..f1eb5ed 100644
do
{
struct r_search_path_elem *this_dir = *dirs;
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
index a681a64e85..bf9f3e36ca 100644
--- a/meta/recipes-core/glibc/glibc/0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
+++ b/meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch
@@ -1,8 +1,7 @@
-From fd595a5ec885bcb4c14417daa21c2e61c5b72e42 Mon Sep 17 00:00:00 2001
+From 6af8ce8eceed86addbc188f773a2d36d83ee4042 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:51:38 +0000
-Subject: [PATCH 03/27] nativesdk-glibc: Raise the size of arrays containing dl
- paths
+Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
and lengths as well as ld.so.cache path in the dynamic loader to specific
@@ -18,33 +17,35 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
elf/dl-cache.c | 4 ++++
elf/dl-load.c | 4 ++--
+ elf/dl-usage.c | 6 ++++--
elf/interp.c | 2 +-
elf/ldconfig.c | 3 +++
- elf/rtld.c | 5 +++--
+ elf/rtld.c | 1 +
+ iconv/gconv_conf.c | 2 +-
sysdeps/generic/dl-cache.h | 4 ----
- 6 files changed, 13 insertions(+), 9 deletions(-)
+ 8 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
-index dec49bc..862f1d8 100644
+index 2b8da8650d..3d9787bda4 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
-@@ -132,6 +132,10 @@ do \
- while (0)
-
+@@ -355,6 +355,10 @@ search_cache (const char *string_table, uint32_t string_table_size,
+ return best;
+ }
+const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) =
+ SYSCONFDIR "/ld.so.cache";
+
+
int
- internal_function
_dl_cache_libcmp (const char *p1, const char *p2)
+ {
diff --git a/elf/dl-load.c b/elf/dl-load.c
-index f1eb5ed..f664f50 100644
+index 2c6270e2a7..23018d2f7e 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
-@@ -104,8 +104,8 @@ static size_t max_capstrlen attribute_relro;
- /* Get the generated information about the trusted directories. */
+@@ -115,8 +115,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
+ gen-trusted-dirs.awk. */
#include "trusted-dirs.h"
-static const char system_dirs[] = SYSTEM_DIRS;
@@ -54,8 +55,39 @@ index f1eb5ed..f664f50 100644
{
SYSTEM_DIRS_LEN
};
+diff --git a/elf/dl-usage.c b/elf/dl-usage.c
+index 5ad3a72559..88f26d3692 100644
+--- a/elf/dl-usage.c
++++ b/elf/dl-usage.c
+@@ -25,6 +25,8 @@
+ #include <dl-procinfo.h>
+ #include <dl-hwcaps.h>
+
++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
++
+ void
+ _dl_usage (const char *argv0, const char *wrong_option)
+ {
+@@ -244,7 +246,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
+ --list list all dependencies and how they are resolved\n\
+ --verify verify that given object really is a dynamically linked\n\
+ object we can handle\n\
+- --inhibit-cache Do not use " LD_SO_CACHE "\n\
++ --inhibit-cache Do not use %s\n\
+ --library-path PATH use given PATH instead of content of the environment\n\
+ variable LD_LIBRARY_PATH\n\
+ --glibc-hwcaps-prepend LIST\n\
+@@ -267,7 +269,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
+ \n\
+ This program interpreter self-identifies as: " RTLD "\n\
+ ",
+- argv0);
++ argv0, LD_SO_CACHE);
+ print_search_path_for_help (state);
+ print_hwcaps_subdirectories (state);
+ print_legacy_hwcap_directories ();
diff --git a/elf/interp.c b/elf/interp.c
-index 422ea95e..6d61a36 100644
+index 91966702ca..dc86c20e83 100644
--- a/elf/interp.c
+++ b/elf/interp.c
@@ -18,5 +18,5 @@
@@ -66,10 +98,10 @@ index 422ea95e..6d61a36 100644
+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
= RUNTIME_LINKER;
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
-index f54ec22..0e78a83 100644
+index 1037e8d0cf..ffdac84952 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
-@@ -167,6 +167,9 @@ static struct argp argp =
+@@ -177,6 +177,9 @@ static struct argp argp =
options, parse_opt, NULL, doc, NULL, more_help, NULL
};
@@ -80,37 +112,35 @@ index f54ec22..0e78a83 100644
a platform. */
static int
diff --git a/elf/rtld.c b/elf/rtld.c
-index 69873c2..6d3add7 100644
+index fbbd60b446..fce9940f80 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
-@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local
- strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
- #endif
-
+@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p)
+ }
+ return *p != '\0';
+ }
+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
- /* List of auditing DSOs. */
- static struct audit_list
-@@ -877,12 +878,12 @@ of this helper program; chances are you did not intend to run this program.\n\
- --list list all dependencies and how they are resolved\n\
- --verify verify that given object really is a dynamically linked\n\
- object we can handle\n\
-- --inhibit-cache Do not use " LD_SO_CACHE "\n\
-+ --inhibit-cache Do not use %s\n\
- --library-path PATH use given PATH instead of content of the environment\n\
- variable LD_LIBRARY_PATH\n\
- --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
- in LIST\n\
-- --audit LIST use objects named in LIST as auditors\n");
-+ --audit LIST use objects named in LIST as auditors\n", LD_SO_CACHE);
+ static void
+ audit_list_init (struct audit_list *list)
+diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
+index 62bee28769..67b60dc88c 100644
+--- a/iconv/gconv_conf.c
++++ b/iconv/gconv_conf.c
+@@ -36,7 +36,7 @@
+ #include <gconv_parseconfdir.h>
- ++_dl_skip_args;
- --_dl_argc;
+ /* This is the default path where we look for module lists. */
+-static const char default_gconv_path[] = GCONV_PATH;
++static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH;
+
+ /* Type to represent search path. */
+ struct path_elem
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
-index 4b49869..1800d03 100644
+index 964d50a486..94bf68ca9d 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
-@@ -27,10 +27,6 @@
+@@ -34,10 +34,6 @@
((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
#endif
@@ -121,6 +151,3 @@ index 4b49869..1800d03 100644
#ifndef add_system_dir
# define add_system_dir(dir) add_dir (dir)
#endif
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
new file mode 100644
index 0000000000..3a37f7af72
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch
@@ -0,0 +1,39 @@
+From b30f380cd88ae181a4a6a3a4784206ffe3ccd19b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 14:35:35 -0800
+Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
+
+The fix consist of allowing 64bit atomic ops for x86.
+This should be safe for i586 and newer CPUs.
+It also makes the synchronization more efficient.
+
+Upstream-Status: Inappropriate [OE-Specific]
+
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/x86/atomic-machine.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
+index 695222e4fa..9d39bfdbd5 100644
+--- a/sysdeps/x86/atomic-machine.h
++++ b/sysdeps/x86/atomic-machine.h
+@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t;
+ #define LOCK_PREFIX "lock;"
+
+ #define USE_ATOMIC_COMPILER_BUILTINS 1
++# define __HAVE_64B_ATOMICS 1
+
+ #ifdef __x86_64__
+-# define __HAVE_64B_ATOMICS 1
+ # define SP_REG "rsp"
+ # define SEG_REG "fs"
+ # define BR_CONSTRAINT "q"
+ # define IBR_CONSTRAINT "iq"
+ #else
+-# define __HAVE_64B_ATOMICS 0
+ # define SP_REG "esp"
+ # define SEG_REG "gs"
+ # define BR_CONSTRAINT "r"
diff --git a/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
new file mode 100644
index 0000000000..d763178f21
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch
@@ -0,0 +1,100 @@
+From 24bffe9c2645cd6542e29cb57786dc703cced07b Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 3 Aug 2018 09:55:12 -0700
+Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales
+
+The glibc locale path is hard-coded to the install prefix, but in SDKs we need
+to be able to relocate the binaries. Expand the strings to 4K and put them in a
+magic segment that we can relocate at install time.
+
+Upstream-Status: Inappropriate (OE-specific)
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/findlocale.c | 4 ++--
+ locale/loadarchive.c | 2 +-
+ locale/localeinfo.h | 2 +-
+ locale/programs/locale.c | 7 ++++---
+ 4 files changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/locale/findlocale.c b/locale/findlocale.c
+index ab09122b0c..f42cc75780 100644
+--- a/locale/findlocale.c
++++ b/locale/findlocale.c
+@@ -56,7 +56,7 @@ struct __locale_data *const _nl_C[] attribute_hidden =
+ which are somehow addressed. */
+ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
+
+-const char _nl_default_locale_path[] attribute_hidden = COMPLOCALEDIR;
++char _nl_default_locale_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR;
+
+ /* Checks if the name is actually present, that is, not NULL and not
+ empty. */
+@@ -166,7 +166,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
+
+ /* Nothing in the archive. Set the default path to search below. */
+ locale_path = _nl_default_locale_path;
+- locale_path_len = sizeof _nl_default_locale_path;
++ locale_path_len = strlen(locale_path) + 1;
+ }
+ else
+ /* We really have to load some data. First see whether the name is
+diff --git a/locale/loadarchive.c b/locale/loadarchive.c
+index 512769eaec..436619091b 100644
+--- a/locale/loadarchive.c
++++ b/locale/loadarchive.c
+@@ -42,7 +42,7 @@
+
+
+ /* Name of the locale archive file. */
+-static const char archfname[] = COMPLOCALEDIR "/locale-archive";
++static const char archfname[4096] __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR "/locale-archive";
+
+ /* Size of initial mapping window, optimal if large enough to
+ cover the header plus the initial locale. */
+diff --git a/locale/localeinfo.h b/locale/localeinfo.h
+index b3d4da0185..22f9dc1140 100644
+--- a/locale/localeinfo.h
++++ b/locale/localeinfo.h
+@@ -331,7 +331,7 @@ _nl_lookup_word (locale_t l, int category, int item)
+ }
+
+ /* Default search path if no LOCPATH environment variable. */
+-extern const char _nl_default_locale_path[] attribute_hidden;
++extern char _nl_default_locale_path[4096] attribute_hidden;
+
+ /* Load the locale data for CATEGORY from the file specified by *NAME.
+ If *NAME is "", use environment variables as specified by POSIX, and
+diff --git a/locale/programs/locale.c b/locale/programs/locale.c
+index ca0a95be99..6b98895203 100644
+--- a/locale/programs/locale.c
++++ b/locale/programs/locale.c
+@@ -632,6 +632,7 @@ nameentcmp (const void *a, const void *b)
+ ((const struct nameent *) b)->name);
+ }
+
++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME;
+
+ static int
+ write_archive_locales (void **all_datap, char *linebuf)
+@@ -645,7 +646,7 @@ write_archive_locales (void **all_datap, char *linebuf)
+ int fd, ret = 0;
+ uint32_t cnt;
+
+- fd = open64 (ARCHIVE_NAME, O_RDONLY);
++ fd = open64 (_write_archive_locales_path, O_RDONLY);
+ if (fd < 0)
+ return 0;
+
+@@ -700,8 +701,8 @@ write_archive_locales (void **all_datap, char *linebuf)
+ if (cnt)
+ putchar_unlocked ('\n');
+
+- printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n",
+- names[cnt].name, linebuf);
++ printf ("locale: %-15.15s archive: %s\n%s\n",
++ names[cnt].name, _write_archive_locales_path, linebuf);
+
+ locrec = (struct locrecent *) (addr + names[cnt].locrec_offset);
+
diff --git a/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
deleted file mode 100644
index b3fa931c6c..0000000000
--- a/meta/recipes-core/glibc/glibc/0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ /dev/null
@@ -1,387 +0,0 @@
-From 2456ea44aeeedae87edb522f77a7969d636399b0 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:16:38 +0000
-Subject: [PATCH 08/27] __ieee754_sqrt{,f} are now inline functions and call
- out __slow versions
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 8 +++++++-
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 14 +++++++++++---
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 14 +++++++++++---
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 12 ++++++++++--
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 8 ++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 8 ++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 12 ++++++++++--
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 9 ++++++++-
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 14 +++++++++++---
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 12 ++++++++++--
- 12 files changed, 114 insertions(+), 21 deletions(-)
-
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-index 1795fd6..daa83f3 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
- simultaneously. */
-
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- {
- if (__builtin_expect (b > 0, 1))
- {
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
-
- /* Handle small numbers by scaling. */
- if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-- return __ieee754_sqrt (b * two108) * twom54;
-+ return __slow_ieee754_sqrt (b * two108) * twom54;
-
- #define FMADD(a_, c_, b_) \
- ({ double __r; \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-index a917f31..b812cf1 100644
---- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
- square root. */
-
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- {
- if (__builtin_expect (b > 0, 1))
- {
-@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b)
- }
- return f_washf (b);
- }
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-index fc4a749..7038a70 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
-
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
- double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
- /* Handle small numbers by scaling. */
- if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-- return __ieee754_sqrt (b * two108) * twom54;
-+ return __slow_ieee754_sqrt (b * two108) * twom54;
-
- #define FMADD(a_, c_, b_) \
- ({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-index 9d17512..10de1f0 100644
---- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
-
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
- float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
- }
- return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-index fc4a749..7038a70 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
-
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
- double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
- /* Handle small numbers by scaling. */
- if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-- return __ieee754_sqrt (b * two108) * twom54;
-+ return __slow_ieee754_sqrt (b * two108) * twom54;
-
- #define FMADD(a_, c_, b_) \
- ({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-index 9d17512..10de1f0 100644
---- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
-
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
- float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
- }
- return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index fc4a749..1c34244 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 9d17512..8126535 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
- }
- return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-index 1795fd6..13a8197 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-@@ -40,7 +40,7 @@ static const float half = 0.5;
- simultaneously. */
-
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- {
- if (__builtin_expect (b > 0, 1))
- {
-@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
-
- /* Handle small numbers by scaling. */
- if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-- return __ieee754_sqrt (b * two108) * twom54;
-+ return __slow_ieee754_sqrt (b * two108) * twom54;
-
- #define FMADD(a_, c_, b_) \
- ({ double __r; \
-@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-index a917f31..fae2d81 100644
---- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
- square root. */
-
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- {
- if (__builtin_expect (b > 0, 1))
- {
-@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b)
- }
- return f_washf (b);
- }
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-index fc4a749..7038a70 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-@@ -41,10 +41,10 @@ static const float half = 0.5;
-
- #ifdef __STDC__
- double
--__ieee754_sqrt (double b)
-+__slow_ieee754_sqrt (double b)
- #else
- double
--__ieee754_sqrt (b)
-+__slow_ieee754_sqrt (b)
- double b;
- #endif
- {
-@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
-
- /* Handle small numbers by scaling. */
- if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
-- return __ieee754_sqrt (b * two108) * twom54;
-+ return __slow_ieee754_sqrt (b * two108) * twom54;
-
- #define FMADD(a_, c_, b_) \
- ({ double __r; \
-@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
- }
- return f_wash (b);
- }
-+
-+#undef __ieee754_sqrt
-+double
-+__ieee754_sqrt (double x)
-+{
-+ return __slow_ieee754_sqrt (x);
-+}
-+
- strong_alias (__ieee754_sqrt, __sqrt_finite)
-diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-index 9d17512..10de1f0 100644
---- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
-
- #ifdef __STDC__
- float
--__ieee754_sqrtf (float b)
-+__slow_ieee754_sqrtf (float b)
- #else
- float
--__ieee754_sqrtf (b)
-+__slow_ieee754_sqrtf (b)
- float b;
- #endif
- {
-@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
- }
- return f_washf (b);
- }
-+
-+#undef __ieee754_sqrtf
-+float
-+__ieee754_sqrtf (float x)
-+{
-+ return __slow_ieee754_sqrtf (x);
-+}
-+
- strong_alias (__ieee754_sqrtf, __sqrtf_finite)
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch b/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
new file mode 100644
index 0000000000..f4fc1d68c4
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch
@@ -0,0 +1,32 @@
+From 2761400989bcbf11e10bc85f90c3a2ba1305c4ae Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 6 Mar 2021 14:48:56 -0800
+Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns
+ EPERM
+
+Fedora-specific workaround for systemd-nspawn
+
+Upstream-Status: Inappropriate [Distro Specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/unix/sysv/linux/faccessat.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c
+index 13160d3249..ee3ddc9b79 100644
+--- a/sysdeps/unix/sysv/linux/faccessat.c
++++ b/sysdeps/unix/sysv/linux/faccessat.c
+@@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag)
+ #if __ASSUME_FACCESSAT2
+ return ret;
+ #else
+- if (ret == 0 || errno != ENOSYS)
++ /* Fedora-specific workaround:
++ As a workround for a broken systemd-nspawn that returns
++ EPERM when a syscall is not allowed instead of ENOSYS
++ we must check for EPERM here and fall back to faccessat. */
++ if (ret == 0 || !(errno == ENOSYS || errno == EPERM))
+ return ret;
+
+ if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))
diff --git a/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch b/meta/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
index 8d3f859555..01de227a02 100644
--- a/meta/recipes-core/glibc/glibc/0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
+++ b/meta/recipes-core/glibc/glibc/0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch
@@ -1,31 +1,31 @@
-From aa0cd82892f32e58602143c697ef0524696a6428 Mon Sep 17 00:00:00 2001
+From 74923ca4b1ae0ed5a2478e7d265b37534f6815d7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:01:50 +0000
-Subject: [PATCH 05/27] fsl e500/e5500/e6500/603e fsqrt implementation
+Subject: [PATCH] fsl e500/e5500/e6500/603e fsqrt implementation
Upstream-Status: Pending
Signed-off-by: Edmar Wienskoski <edmar@freescale.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 101 ++++++++++++++++
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 101 ++++++++++++++++
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 101 ++++++++++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 101 ++++++++++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 101 ++++++++++++++++
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 134 +++++++++++++++++++++
- sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 101 ++++++++++++++++
- .../sysv/linux/powerpc/powerpc32/603e/fpu/Implies | 1 +
- .../linux/powerpc/powerpc32/e300c3/fpu/Implies | 2 +
- .../linux/powerpc/powerpc32/e500mc/fpu/Implies | 1 +
- .../sysv/linux/powerpc/powerpc32/e5500/fpu/Implies | 1 +
- .../sysv/linux/powerpc/powerpc32/e6500/fpu/Implies | 1 +
- .../sysv/linux/powerpc/powerpc64/e5500/fpu/Implies | 1 +
- .../sysv/linux/powerpc/powerpc64/e6500/fpu/Implies | 1 +
+ sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 101 +++++++++++++
+ sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ .../powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 101 +++++++++++++
+ sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 101 +++++++++++++
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 101 +++++++++++++
+ sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 101 +++++++++++++
+ sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 134 ++++++++++++++++++
+ sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 101 +++++++++++++
+ .../linux/powerpc/powerpc32/603e/fpu/Implies | 1 +
+ .../powerpc/powerpc32/e300c3/fpu/Implies | 2 +
+ .../powerpc/powerpc32/e500mc/fpu/Implies | 1 +
+ .../linux/powerpc/powerpc32/e5500/fpu/Implies | 1 +
+ .../linux/powerpc/powerpc32/e6500/fpu/Implies | 1 +
+ .../linux/powerpc/powerpc64/e5500/fpu/Implies | 1 +
+ .../linux/powerpc/powerpc64/e6500/fpu/Implies | 1 +
19 files changed, 1418 insertions(+)
create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
create mode 100644 sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
@@ -49,7 +49,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -189,7 +189,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -296,7 +296,7 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -436,7 +436,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -543,7 +543,7 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -683,7 +683,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -790,7 +790,7 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -930,7 +930,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -1037,7 +1037,7 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -1177,7 +1177,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -1284,7 +1284,7 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
new file mode 100644
-index 0000000..71e516d
+index 0000000000..71e516d1c8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
@@ -0,0 +1,134 @@
@@ -1424,7 +1424,7 @@ index 0000000..71e516d
+}
diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
new file mode 100644
-index 0000000..26fa067
+index 0000000000..26fa067abf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
@@ -0,0 +1,101 @@
@@ -1531,14 +1531,14 @@ index 0000000..26fa067
+}
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
new file mode 100644
-index 0000000..b103b4d
+index 0000000000..b103b4dea5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc32/603e/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
new file mode 100644
-index 0000000..64db17f
+index 0000000000..64db17fada
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
@@ -0,0 +1,2 @@
@@ -1546,39 +1546,36 @@ index 0000000..64db17f
+powerpc/powerpc32/603e/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
new file mode 100644
-index 0000000..7eac5fc
+index 0000000000..7eac5fcf02
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc32/e500mc/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
new file mode 100644
-index 0000000..264b2a7
+index 0000000000..264b2a7700
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc32/e5500/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
new file mode 100644
-index 0000000..a259344
+index 0000000000..a25934467b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc32/e6500/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
new file mode 100644
-index 0000000..a7bc854
+index 0000000000..a7bc854be8
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/e5500/fpu
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
new file mode 100644
-index 0000000..04ff8cc
+index 0000000000..04ff8cc181
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
@@ -0,0 +1 @@
+powerpc/powerpc64/e6500/fpu
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
index aec8fbeb9a..5c1130cf10 100644
--- a/meta/recipes-core/glibc/glibc/0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
+++ b/meta/recipes-core/glibc/glibc/0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch
@@ -1,7 +1,7 @@
-From ea98b1a12b5f779fd79478ff930a79ef60387851 Mon Sep 17 00:00:00 2001
+From 5da3da7f2d276c2a6ae1b04419b28e96953803ec Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:15:07 +0000
-Subject: [PATCH 07/27] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
+Subject: [PATCH] ppc/sqrt: Fix undefined reference to `__sqrt_finite'
on ppc fixes the errors like below
| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
@@ -36,7 +36,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
12 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
-index 71e516d..1795fd6 100644
+index 71e516d1c8..1795fd6c3e 100644
--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
@@ -39,14 +39,8 @@ static const float half = 0.5;
@@ -60,7 +60,7 @@ index 71e516d..1795fd6 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
-index 26fa067..a917f31 100644
+index 26fa067abf..a917f313ab 100644
--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
@@ -84,7 +84,7 @@ index 26fa067..a917f31 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
-index 71e516d..fc4a749 100644
+index 71e516d1c8..fc4a74990e 100644
--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
@@ -93,7 +93,7 @@ index 71e516d..fc4a749 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
-index 26fa067..9d17512 100644
+index 26fa067abf..9d175122a8 100644
--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
@@ -102,7 +102,7 @@ index 26fa067..9d17512 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
-index 71e516d..fc4a749 100644
+index 71e516d1c8..fc4a74990e 100644
--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
@@ -111,7 +111,7 @@ index 71e516d..fc4a749 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
-index 26fa067..9d17512 100644
+index 26fa067abf..9d175122a8 100644
--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
@@ -120,7 +120,7 @@ index 26fa067..9d17512 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index 71e516d..fc4a749 100644
+index 71e516d1c8..fc4a74990e 100644
--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
@@ -129,7 +129,7 @@ index 71e516d..fc4a749 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 26fa067..9d17512 100644
+index 26fa067abf..9d175122a8 100644
--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
@@ -138,7 +138,7 @@ index 26fa067..9d17512 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
-index 71e516d..1795fd6 100644
+index 71e516d1c8..1795fd6c3e 100644
--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
@@ -39,14 +39,8 @@ static const float half = 0.5;
@@ -162,7 +162,7 @@ index 71e516d..1795fd6 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
-index 26fa067..a917f31 100644
+index 26fa067abf..a917f313ab 100644
--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
@@ -186,7 +186,7 @@ index 26fa067..a917f31 100644
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
-index 71e516d..fc4a749 100644
+index 71e516d1c8..fc4a74990e 100644
--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
@@ -195,7 +195,7 @@ index 71e516d..fc4a749 100644
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
-index 26fa067..9d17512 100644
+index 26fa067abf..9d175122a8 100644
--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
@@ -203,6 +203,3 @@ index 26fa067..9d17512 100644
return f_washf (b);
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
index 07a112b218..b72e79057b 100644
--- a/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
+++ b/meta/recipes-core/glibc/glibc/0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -1,22 +1,90 @@
-From 1be45f870ebbb0259bea5250a6d2c2fbcb33409d Mon Sep 17 00:00:00 2001
+From 77f1c90d67a2f8852184fb8fd95cb0ed63065dc7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:24:46 +0000
-Subject: [PATCH 11/27] __ieee754_sqrt{,f} are now inline functions and call
- out __slow versions
+Date: Wed, 18 Mar 2015 00:16:38 +0000
+Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
+ __slow versions
Upstream-Status: Pending
-Signed-off-by: chunrong guo <B40290@freescale.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 6 +++---
- sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 4 ++--
- 2 files changed, 5 insertions(+), 5 deletions(-)
+ sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c | 12 ++++++++++--
+ sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c | 8 +++++++-
+ sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c | 14 +++++++++++---
+ sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c | 12 ++++++++++--
+ sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c | 14 +++++++++++---
+ sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c | 12 ++++++++++--
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 8 ++++++++
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 8 ++++++++
+ sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c | 12 ++++++++++--
+ sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c | 9 ++++++++-
+ sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c | 14 +++++++++++---
+ sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c | 12 ++++++++++--
+ 12 files changed, 114 insertions(+), 21 deletions(-)
-diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-index 1c34244..7038a70 100644
---- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
-+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+index 1795fd6c3e..daa83f3fe8 100644
+--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
+@@ -40,7 +40,7 @@ static const float half = 0.5;
+ simultaneously. */
+
+ double
+-__ieee754_sqrt (double b)
++__slow_ieee754_sqrt (double b)
+ {
+ if (__builtin_expect (b > 0, 1))
+ {
+@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
+
+ /* Handle small numbers by scaling. */
+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
+- return __ieee754_sqrt (b * two108) * twom54;
++ return __slow_ieee754_sqrt (b * two108) * twom54;
+
+ #define FMADD(a_, c_, b_) \
+ ({ double __r; \
+@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
+diff --git a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+index a917f313ab..b812cf1705 100644
+--- a/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
+@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
+ square root. */
+
+ float
+-__ieee754_sqrtf (float b)
++__slow_ieee754_sqrtf (float b)
+ {
+ if (__builtin_expect (b > 0, 1))
+ {
+@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b)
+ }
+ return f_washf (b);
+ }
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
+index fc4a74990e..7038a70b47 100644
+--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
@@ -41,10 +41,10 @@ static const float half = 0.5;
#ifdef __STDC__
@@ -39,10 +107,255 @@ index 1c34244..7038a70 100644
#define FMADD(a_, c_, b_) \
({ double __r; \
+@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
+diff --git a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+index 9d175122a8..10de1f0cc3 100644
+--- a/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
+@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+
+ #ifdef __STDC__
+ float
+-__ieee754_sqrtf (float b)
++__slow_ieee754_sqrtf (float b)
+ #else
+ float
+-__ieee754_sqrtf (b)
++__slow_ieee754_sqrtf (b)
+ float b;
+ #endif
+ {
+@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+ }
+ return f_washf (b);
+ }
++
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
++
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+index fc4a74990e..7038a70b47 100644
+--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
+@@ -41,10 +41,10 @@ static const float half = 0.5;
+
+ #ifdef __STDC__
+ double
+-__ieee754_sqrt (double b)
++__slow_ieee754_sqrt (double b)
+ #else
+ double
+-__ieee754_sqrt (b)
++__slow_ieee754_sqrt (b)
+ double b;
+ #endif
+ {
+@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
+
+ /* Handle small numbers by scaling. */
+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
+- return __ieee754_sqrt (b * two108) * twom54;
++ return __slow_ieee754_sqrt (b * two108) * twom54;
+
+ #define FMADD(a_, c_, b_) \
+ ({ double __r; \
+@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
+diff --git a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+index 9d175122a8..10de1f0cc3 100644
+--- a/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
+@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+
+ #ifdef __STDC__
+ float
+-__ieee754_sqrtf (float b)
++__slow_ieee754_sqrtf (float b)
+ #else
+ float
+-__ieee754_sqrtf (b)
++__slow_ieee754_sqrtf (b)
+ float b;
+ #endif
+ {
+@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+ }
+ return f_washf (b);
+ }
++
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
++
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+index fc4a74990e..1c34244bd8 100644
+--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
-index 8126535..10de1f0 100644
+index 9d175122a8..812653558f 100644
--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+ }
+ return f_washf (b);
+ }
++
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
++
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+index 1795fd6c3e..13a81973e3 100644
+--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
+@@ -40,7 +40,7 @@ static const float half = 0.5;
+ simultaneously. */
+
+ double
+-__ieee754_sqrt (double b)
++__slow_ieee754_sqrt (double b)
+ {
+ if (__builtin_expect (b > 0, 1))
+ {
+@@ -77,7 +77,7 @@ __ieee754_sqrt (double b)
+
+ /* Handle small numbers by scaling. */
+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
+- return __ieee754_sqrt (b * two108) * twom54;
++ return __slow_ieee754_sqrt (b * two108) * twom54;
+
+ #define FMADD(a_, c_, b_) \
+ ({ double __r; \
+@@ -126,4 +126,12 @@ __ieee754_sqrt (double b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
+diff --git a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+index a917f313ab..fae2d81210 100644
+--- a/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
+@@ -38,7 +38,7 @@ static const float threehalf = 1.5;
+ square root. */
+
+ float
+-__ieee754_sqrtf (float b)
++__slow_ieee754_sqrtf (float b)
+ {
+ if (__builtin_expect (b > 0, 1))
+ {
+@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b)
+ }
+ return f_washf (b);
+ }
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
++
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
+diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+index fc4a74990e..7038a70b47 100644
+--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
+@@ -41,10 +41,10 @@ static const float half = 0.5;
+
+ #ifdef __STDC__
+ double
+-__ieee754_sqrt (double b)
++__slow_ieee754_sqrt (double b)
+ #else
+ double
+-__ieee754_sqrt (b)
++__slow_ieee754_sqrt (b)
+ double b;
+ #endif
+ {
+@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
+
+ /* Handle small numbers by scaling. */
+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
+- return __ieee754_sqrt (b * two108) * twom54;
++ return __slow_ieee754_sqrt (b * two108) * twom54;
+
+ #define FMADD(a_, c_, b_) \
+ ({ double __r; \
+@@ -132,4 +132,12 @@ __ieee754_sqrt (b)
+ }
+ return f_wash (b);
+ }
++
++#undef __ieee754_sqrt
++double
++__ieee754_sqrt (double x)
++{
++ return __slow_ieee754_sqrt (x);
++}
++
+ strong_alias (__ieee754_sqrt, __sqrt_finite)
+diff --git a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
+index 9d175122a8..10de1f0cc3 100644
+--- a/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
#ifdef __STDC__
@@ -56,6 +369,16 @@ index 8126535..10de1f0 100644
float b;
#endif
{
---
-2.1.4
-
+@@ -99,4 +99,12 @@ __ieee754_sqrtf (b)
+ }
+ return f_washf (b);
+ }
++
++#undef __ieee754_sqrtf
++float
++__ieee754_sqrtf (float x)
++{
++ return __slow_ieee754_sqrtf (x);
++}
++
+ strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch b/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch
deleted file mode 100644
index 267791393e..0000000000
--- a/meta/recipes-core/glibc/glibc/0012-Make-ld-version-output-matching-grok-gold-s-output.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 49471ab1f90e392da9520eea831ce8731be9fc8b Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:25:45 +0000
-Subject: [PATCH 12/27] Make ld --version output matching grok gold's output
-
-adapted from from upstream branch roland/gold-vs-libc
-
-Upstream-Status: Backport
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- configure | 2 +-
- configure.ac | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure b/configure
-index 45cc7cb..7d7299a 100755
---- a/configure
-+++ b/configure
-@@ -4709,7 +4709,7 @@ else
- # Found it, now check the version.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
- $as_echo_n "checking version of $LD... " >&6; }
-- ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
-+ ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
- case $ac_prog_version in
- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*)
-diff --git a/configure.ac b/configure.ac
-index 7e9383a..a467a69 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -941,7 +941,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
- [2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- AS=: critic_missing="$critic_missing as")
- AC_CHECK_PROG_VER(LD, $LD, --version,
-- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
-+ [GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- LD=: critic_missing="$critic_missing ld")
-
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
index 1f5475912c..07d4411c61 100644
--- a/meta/recipes-core/glibc/glibc/0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
+++ b/meta/recipes-core/glibc/glibc/0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch
@@ -1,8 +1,7 @@
-From acf7a028817e71eb99d785037659abd4d120ffe2 Mon Sep 17 00:00:00 2001
+From add514edf4299d1bf540d85d0aa0bd5fe0d46b78 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:20:09 +0000
-Subject: [PATCH 09/27] Quote from bug 1443 which explains what the patch does
- :
+Subject: [PATCH] Quote from bug 1443 which explains what the patch does :
We build some random program and link it with -lust. When we run it,
it dies with a SIGSEGV before reaching main().
@@ -45,10 +44,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
-index 6fb20bd..8805537 100644
+index ff5e09e207..d68bfe5cbe 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
-@@ -499,7 +499,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
+@@ -510,7 +510,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
case R_ARM_TLS_DTPOFF32:
if (sym != NULL)
@@ -57,6 +56,3 @@ index 6fb20bd..8805537 100644
break;
case R_ARM_TLS_TPOFF32:
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
index d71e576a6f..c2766ef4c3 100644
--- a/meta/recipes-core/glibc/glibc/0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
+++ b/meta/recipes-core/glibc/glibc/0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -1,7 +1,7 @@
-From 017322ee28c1579ce6c81904842aaada9c82403c Mon Sep 17 00:00:00 2001
+From c5047b8f7d1a17324cfa02b99f07a70ebcec2cf2 Mon Sep 17 00:00:00 2001
From: Ting Liu <b28495@freescale.com>
Date: Wed, 19 Dec 2012 04:39:57 -0600
-Subject: [PATCH 10/27] eglibc: run libm-err-tab.pl with specific dirs in ${S}
+Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
libm-err-tab.pl will parse all the files named "libm-test-ulps"
in the given dir recursively. To avoid parsing the one in
@@ -18,19 +18,16 @@ Signed-off-by: Ting Liu <b28495@freescale.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/manual/Makefile b/manual/Makefile
-index 5382208..6b701b0 100644
+index e83444341e..aa2645bc55 100644
--- a/manual/Makefile
+++ b/manual/Makefile
-@@ -105,7 +105,8 @@ $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err
- $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
- $(dir)/libm-test-ulps))
+@@ -103,7 +103,8 @@ $(objpfx)stamp-libm-err: $(..)math/gen-libm-test.py \
+ $(wildcard $(foreach dir,$(sysdirs),\
+ $(dir)/libm-test-ulps))
pwd=`pwd`; \
-- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
-+ $(PERL) $< $$pwd/../ports > $(objpfx)libm-err-tmp
-+ $(PERL) $< $$pwd/../sysdeps >> $(objpfx)libm-err-tmp
+- $(PYTHON) $< -s $$pwd/.. -m $(objpfx)libm-err-tmp
++ $(PYTHON) $< -s $$pwd/../ports -m $(objpfx)libm-err-tmp
++ $(PYTHON) $< -s $$pwd/../sysdeps -m $(objpfx)libm-err-tmp
$(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
touch $@
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch b/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
deleted file mode 100644
index 0ba5d2fbad..0000000000
--- a/meta/recipes-core/glibc/glibc/0014-Add-unused-attribute.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 0229d6c9c0e7721773118d5ae1d172c269bc9826 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:28:41 +0000
-Subject: [PATCH 14/27] Add unused attribute
-
-Helps in avoiding gcc warning when header is is included in
-a source file which does not use both functions
-
- * iconv/gconv_charset.h (strip):
- Add unused attribute.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- iconv/gconv_charset.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
-index 80290bc..7890a8e 100644
---- a/iconv/gconv_charset.h
-+++ b/iconv/gconv_charset.h
-@@ -21,7 +21,7 @@
- #include <locale.h>
-
-
--static void
-+static void __attribute__ ((unused))
- strip (char *wp, const char *s)
- {
- int slash_count = 0;
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
new file mode 100644
index 0000000000..088b810530
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch
@@ -0,0 +1,58 @@
+From 133870f12ba36686dd8df1311fac32a4c5b28579 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 18 Mar 2015 00:24:46 +0000
+Subject: [PATCH] __ieee754_sqrt{,f} are now inline functions and call out
+ __slow versions
+
+Upstream-Status: Pending
+
+Signed-off-by: chunrong guo <B40290@freescale.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c | 6 +++---
+ sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c | 4 ++--
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+index 1c34244bd8..7038a70b47 100644
+--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
+@@ -41,10 +41,10 @@ static const float half = 0.5;
+
+ #ifdef __STDC__
+ double
+-__ieee754_sqrt (double b)
++__slow_ieee754_sqrt (double b)
+ #else
+ double
+-__ieee754_sqrt (b)
++__slow_ieee754_sqrt (b)
+ double b;
+ #endif
+ {
+@@ -83,7 +83,7 @@ __ieee754_sqrt (b)
+
+ /* Handle small numbers by scaling. */
+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
+- return __ieee754_sqrt (b * two108) * twom54;
++ return __slow_ieee754_sqrt (b * two108) * twom54;
+
+ #define FMADD(a_, c_, b_) \
+ ({ double __r; \
+diff --git a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+index 812653558f..10de1f0cc3 100644
+--- a/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
++++ b/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
+@@ -39,10 +39,10 @@ static const float threehalf = 1.5;
+
+ #ifdef __STDC__
+ float
+-__ieee754_sqrtf (float b)
++__slow_ieee754_sqrtf (float b)
+ #else
+ float
+-__ieee754_sqrtf (b)
++__slow_ieee754_sqrtf (b)
+ float b;
+ #endif
+ {
diff --git a/meta/recipes-core/glibc/glibc/0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch b/meta/recipes-core/glibc/glibc/0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch
deleted file mode 100644
index 4b261ca1ef..0000000000
--- a/meta/recipes-core/glibc/glibc/0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From f058c884dd26d10c94550ca5252ed6576614d659 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 19 Feb 2015 03:23:45 +0000
-Subject: [PATCH 15/27] When disabling SSE also make sure that fpmath is not
- set to use SSE as well
-
-This fixes errors when we inject sse options through CFLAGS and now
-that we have -Werror turned on by default this warning turns to become
-error on x86
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- sysdeps/x86/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
-index 19f5eca..827ea71 100644
---- a/sysdeps/x86/Makefile
-+++ b/sysdeps/x86/Makefile
-@@ -1,6 +1,6 @@
- ifeq ($(subdir),elf)
- CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
-- -mno-sse -mno-mmx)
-+ -mno-sse -mno-mmx -mfpmath=387)
-
- tests-special += $(objpfx)tst-ld-sse-use.out
- $(objpfx)tst-ld-sse-use.out: ../sysdeps/x86/tst-ld-sse-use.sh $(objpfx)ld.so
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
index c1fda9d433..e8332a53c2 100644
--- a/meta/recipes-core/glibc/glibc/0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
+++ b/meta/recipes-core/glibc/glibc/0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch
@@ -1,7 +1,7 @@
-From b55e49b199c46a278ab66b6b1e3eab483b913197 Mon Sep 17 00:00:00 2001
+From b4613f814ba7ba5db95d18116172f81a83ac8f5b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:27:10 +0000
-Subject: [PATCH 13/27] sysdeps/gnu/configure.ac: handle correctly
+Subject: [PATCH] sysdeps/gnu/configure.ac: handle correctly
$libc_cv_rootsbindir
Upstream-Status:Pending
@@ -14,7 +14,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure
-index 9239297..c5ed3ca 100644
+index c15d1087e8..37cc983f2a 100644
--- a/sysdeps/gnu/configure
+++ b/sysdeps/gnu/configure
@@ -32,6 +32,6 @@ case "$prefix" in
@@ -26,7 +26,7 @@ index 9239297..c5ed3ca 100644
;;
esac
diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac
-index 634fe4d..3db1697 100644
+index 634fe4de2a..3db1697f4f 100644
--- a/sysdeps/gnu/configure.ac
+++ b/sysdeps/gnu/configure.ac
@@ -21,6 +21,6 @@ case "$prefix" in
@@ -37,6 +37,3 @@ index 634fe4d..3db1697 100644
+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
;;
esac
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch b/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch
index 089e8b1b0b..f7e7f1cd10 100644
--- a/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch
+++ b/meta/recipes-core/glibc/glibc/0016-yes-within-the-path-sets-wrong-config-variables.patch
@@ -1,7 +1,7 @@
-From 70199fe59c38b621ab4121d7a55719b2b29b36de Mon Sep 17 00:00:00 2001
+From 7be3e82b66394a7b242e56c6fc609e858b8e2436 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:31:06 +0000
-Subject: [PATCH 16/27] 'yes' within the path sets wrong config variables
+Subject: [PATCH] 'yes' within the path sets wrong config variables
It seems that the 'AC_EGREP_CPP(yes...' example is quite popular
but being such a short word to grep it is likely to produce
@@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
12 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
-index 5bd355a..3bc5537 100644
+index 4c1fac49f3..597314f476 100644
--- a/sysdeps/aarch64/configure
+++ b/sysdeps/aarch64/configure
-@@ -148,12 +148,12 @@ else
+@@ -157,12 +157,12 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifdef __AARCH64EB__
@@ -48,10 +48,10 @@ index 5bd355a..3bc5537 100644
else
libc_cv_aarch64_be=no
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
-index 7851dd4..6e92381 100644
+index 3347c13fa1..4af163c0b6 100644
--- a/sysdeps/aarch64/configure.ac
+++ b/sysdeps/aarch64/configure.ac
-@@ -10,8 +10,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+@@ -17,8 +17,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE)
# the dynamic linker via %ifdef.
AC_CACHE_CHECK([for big endian],
[libc_cv_aarch64_be],
@@ -63,7 +63,7 @@ index 7851dd4..6e92381 100644
], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
if test $libc_cv_aarch64_be = yes; then
diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
-index 158116b..5eaf54e 100644
+index 431e843b2b..e152461138 100644
--- a/sysdeps/arm/configure
+++ b/sysdeps/arm/configure
@@ -151,12 +151,12 @@ else
@@ -82,7 +82,7 @@ index 158116b..5eaf54e 100644
else
libc_cv_arm_pcs_vfp=no
diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
-index 859c92a..2f4a6e2 100644
+index 90cdd69c75..05a262ba00 100644
--- a/sysdeps/arm/configure.ac
+++ b/sysdeps/arm/configure.ac
@@ -15,8 +15,8 @@ AC_DEFINE(PI_STATIC_AND_HIDDEN)
@@ -97,7 +97,7 @@ index 859c92a..2f4a6e2 100644
], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
if test $libc_cv_arm_pcs_vfp = yes; then
diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure
-index 4e13248..f14af95 100644
+index 4e13248c03..f14af952d0 100644
--- a/sysdeps/mips/configure
+++ b/sysdeps/mips/configure
@@ -143,11 +143,11 @@ else
@@ -115,7 +115,7 @@ index 4e13248..f14af95 100644
else
libc_cv_mips_nan2008=no
diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac
-index bcbdaff..ad3057f 100644
+index bcbdaffd9f..ad3057f4cc 100644
--- a/sysdeps/mips/configure.ac
+++ b/sysdeps/mips/configure.ac
@@ -6,9 +6,9 @@ dnl position independent way.
@@ -131,7 +131,7 @@ index bcbdaff..ad3057f 100644
if test x$libc_cv_mips_nan2008 = xyes; then
AC_DEFINE(HAVE_MIPS_NAN2008)
diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure
-index 14c8a3a..dde3814 100644
+index 14c8a3a014..dde3814ef2 100644
--- a/sysdeps/nios2/configure
+++ b/sysdeps/nios2/configure
@@ -142,12 +142,12 @@ else
@@ -150,7 +150,7 @@ index 14c8a3a..dde3814 100644
else
libc_cv_nios2_be=no
diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac
-index f05f438..dc86399 100644
+index f05f43802b..dc8639902d 100644
--- a/sysdeps/nios2/configure.ac
+++ b/sysdeps/nios2/configure.ac
@@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
@@ -165,10 +165,10 @@ index f05f438..dc86399 100644
], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)])
if test $libc_cv_nios2_be = yes; then
diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure
-index 83f8b13..2b6cbee 100644
+index f25f2a3a65..1b7483e6c6 100644
--- a/sysdeps/unix/sysv/linux/mips/configure
+++ b/sysdeps/unix/sysv/linux/mips/configure
-@@ -387,11 +387,11 @@ else
+@@ -414,11 +414,11 @@ else
/* end confdefs.h. */
dnl
#ifdef __mips_nan2008
@@ -183,10 +183,10 @@ index 83f8b13..2b6cbee 100644
else
libc_cv_mips_nan2008=no
diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac
-index 5039ec9..1035f76 100644
+index 049a0f4bdf..005526d4e8 100644
--- a/sysdeps/unix/sysv/linux/mips/configure.ac
+++ b/sysdeps/unix/sysv/linux/mips/configure.ac
-@@ -98,9 +98,9 @@ AC_COMPILE_IFELSE(
+@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE(
LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}])
AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding],
@@ -199,7 +199,7 @@ index 5039ec9..1035f76 100644
libc_mips_nan=
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
-index 70bb18a..ffd9e3e 100644
+index ae7f254da4..874519000b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
@@ -155,12 +155,12 @@ else
@@ -233,7 +233,7 @@ index 70bb18a..ffd9e3e 100644
else
libc_cv_ppc64_def_call_elf=no
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
-index 0822915..9a32fdd 100644
+index f9cba6e15d..b21f72f1e4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64])
@@ -258,6 +258,3 @@ index 0822915..9a32fdd 100644
#endif
], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)])
if test $libc_cv_ppc64_def_call_elf = no; then
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch
index 0ce823087d..100d08599c 100644
--- a/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch
+++ b/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch
@@ -1,7 +1,7 @@
-From c90306107fbbe2979012917e87747ce78c82ab88 Mon Sep 17 00:00:00 2001
+From 2731fa0c7463cd160361a8ac92f3bd7f984d953d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:33:03 +0000
-Subject: [PATCH 17/27] timezone: re-written tzselect as posix sh
+Subject: [PATCH] timezone: re-written tzselect as posix sh
To avoid the bash dependency.
@@ -10,36 +10,25 @@ Upstream-Status: Pending
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- timezone/Makefile | 2 +-
- timezone/tzselect.ksh | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
+ timezone/tzselect.ksh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
-diff --git a/timezone/Makefile b/timezone/Makefile
-index 24c93c6..886b06e 100644
---- a/timezone/Makefile
-+++ b/timezone/Makefile
-@@ -126,7 +126,7 @@ $(testdata)/XT%: testdata/XT%
- cp $< $@
-
- $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
-- sed -e 's|/bin/bash|$(BASH)|' \
-+ sed -e 's|/bin/bash|/bin/sh|' \
- -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
- -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
- -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh
-index 9d70691..25f45a8 100755
+index 18fce27e24..7705df83d7 100755
--- a/timezone/tzselect.ksh
+++ b/timezone/tzselect.ksh
-@@ -35,7 +35,7 @@ REPORT_BUGS_TO=tz@iana.org
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # Ask the user about the time zone, and output the resulting TZ value to stdout.
+ # Interact with the user via stderr and stdin.
+
+@@ -34,7 +34,7 @@ REPORT_BUGS_TO=tz@iana.org
# Specify default values for environment variables if they are unset.
: ${AWK=awk}
-: ${TZDIR=`pwd`}
+: ${TZDIR=$(pwd)}
- # Check for awk Posix compliance.
- ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
---
-2.1.4
-
+ # Output one argument as-is to standard output.
+ # Safer than 'echo', which can mishandle '\' or leading '-'.
diff --git a/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch b/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch
new file mode 100644
index 0000000000..23296da61d
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0018-Remove-bash-dependency-for-nscd-init-script.patch
@@ -0,0 +1,72 @@
+From 412d33bbfe42a10a9b1f62afcc73fe121a0363b0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Dec 2015 14:33:02 -0800
+Subject: [PATCH] Remove bash dependency for nscd init script
+
+The nscd init script uses #! /bin/bash but only really uses one bashism
+(translated strings), so remove them and switch the shell to #!/bin/sh.
+
+Upstream-Status: Pending
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ nscd/nscd.init | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/nscd/nscd.init b/nscd/nscd.init
+index a882da7d8b..b02986ec15 100644
+--- a/nscd/nscd.init
++++ b/nscd/nscd.init
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #
+ # nscd: Starts the Name Switch Cache Daemon
+ #
+@@ -49,7 +49,7 @@ prog=nscd
+ start () {
+ [ -d /var/run/nscd ] || mkdir /var/run/nscd
+ [ -d /var/db/nscd ] || mkdir /var/db/nscd
+- echo -n $"Starting $prog: "
++ echo -n "Starting $prog: "
+ daemon /usr/sbin/nscd
+ RETVAL=$?
+ echo
+@@ -58,7 +58,7 @@ start () {
+ }
+
+ stop () {
+- echo -n $"Stopping $prog: "
++ echo -n "Stopping $prog: "
+ /usr/sbin/nscd -K
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+@@ -67,9 +67,9 @@ stop () {
+ # a non-privileged user
+ rm -f /var/run/nscd/nscd.pid
+ rm -f /var/run/nscd/socket
+- success $"$prog shutdown"
++ success "$prog shutdown"
+ else
+- failure $"$prog shutdown"
++ failure "$prog shutdown"
+ fi
+ echo
+ return $RETVAL
+@@ -103,13 +103,13 @@ case "$1" in
+ RETVAL=$?
+ ;;
+ force-reload | reload)
+- echo -n $"Reloading $prog: "
++ echo -n "Reloading $prog: "
+ killproc /usr/sbin/nscd -HUP
+ RETVAL=$?
+ echo
+ ;;
+ *)
+- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
++ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}"
+ RETVAL=1
+ ;;
+ esac
diff --git a/meta/recipes-core/glibc/glibc/0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch b/meta/recipes-core/glibc/glibc/0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch
deleted file mode 100644
index dcb80f9c80..0000000000
--- a/meta/recipes-core/glibc/glibc/0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch
+++ /dev/null
@@ -1,1436 +0,0 @@
-From aa7c5fe86d04584a9aed4dc40ba856c65a1ef9c4 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:45:18 +0000
-Subject: [PATCH 19/27] eglibc: Bring Eglibc option group infrastructure to
- glibc
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- EGLIBC.option-groups | 122 ++++++
- Makefile | 1 +
- config.make.in | 2 +
- configure | 13 +
- configure.ac | 10 +
- option-groups.def | 868 ++++++++++++++++++++++++++++++++++++++
- option-groups.defaults | 47 +++
- option-groups.mak | 41 ++
- options-config/Makefile | 55 +++
- options-config/config-postproc.pl | 58 +++
- options-config/config-preproc.pl | 8 +
- scripts/option-groups.awk | 63 +++
- 12 files changed, 1288 insertions(+)
- create mode 100644 EGLIBC.option-groups
- create mode 100644 option-groups.def
- create mode 100644 option-groups.defaults
- create mode 100644 option-groups.mak
- create mode 100644 options-config/Makefile
- create mode 100644 options-config/config-postproc.pl
- create mode 100644 options-config/config-preproc.pl
- create mode 100644 scripts/option-groups.awk
-
-diff --git a/EGLIBC.option-groups b/EGLIBC.option-groups
-new file mode 100644
-index 0000000..6a50b8d
---- /dev/null
-+++ b/EGLIBC.option-groups
-@@ -0,0 +1,122 @@
-+ -*- mode: text -*-
-+
-+ The EGLIBC Component Configuration System
-+ Jim Blandy <jimb@codesourcery.com>
-+
-+Introduction
-+
-+The GNU C library (GLIBC) provides a broad range of functionality,
-+ranging from internationalization support to transcendental
-+mathematical functions. Its website boasts that "nearly all known and
-+useful functions from any other C library are available." This
-+exhaustive approach has been one of GLIBC's strengths on desktop and
-+server systems, but it has also given GLIBC a large footprint, both in
-+memory and on disk, making it a challenge to use in embedded systems
-+with limited resources.
-+
-+The Embedded GNU C library (EGLIBC) is a variant of the GNU C library
-+designed to work well on embedded systems. In particular, EGLIBC's
-+component configuration system allows embedded developers to build
-+customized versions of the library that include only the features
-+their application uses, reducing its space requirements.
-+
-+EGLIBC's component configuration system categorizes the library's
-+functions into "option groups", and allows you to include or exclude
-+option groups individually. Some option groups depend on others;
-+EGLIBC tracks these relationships, and ensures that the selected
-+configuration yields a functioning library.
-+
-+
-+Consistent and Predictable Behavior
-+
-+A flexible configuration system is a mixed blessing: if the options
-+offered are poorly designed, it can be hard to see which choices will
-+have the desired effects, and choices with obscure consequences can
-+make debugging difficult. EGLIBC's configuration follows some general
-+principles to reduce these risks:
-+
-+- EGLIBC has a single default configuration for each target
-+ architecture.
-+
-+- In the default configuration, all option groups are enabled, and
-+ EGLIBC is upwardly API- and ABI-compatible with GLIBC.
-+
-+- As much as possible, configurations only affect what functions are
-+ present, not how they behave. If the system works with an option
-+ group disabled, it will still work with it enabled.
-+
-+- As much as possible, configurations only select option groups ---
-+ they do not describe characteristics of the target architecture.
-+
-+These rules mean that you have a simple debugging strategy available
-+if you suspect that your EGLIBC configuration might be the source of a
-+problem: fall back to the default configuration, re-test, and then
-+disable option groups one by one, until the problem reappears.
-+
-+
-+The Option Groups
-+
-+To see the current full list of implemented option groups, refer to the
-+file 'option-groups.def' at the top of the source tree, or run
-+'make menuconfig' from the top-level build directory.
-+
-+The POSIX.1-2001 specification includes a suggested partition of all
-+the functions in the POSIX C API into option groups: math functions
-+like 'sin' and 'cos'; networking functions like 'socket' and
-+'connect'; and so on. EGLIBC could use this partitioning as the basis
-+for future option groups.
-+
-+
-+Implementation
-+
-+The EGLIBC component configuration system resembles the approach used
-+by the Linux kernel to select device drivers, network protocols, and
-+other features. A file named 'option-groups.config' in the top-level
-+build directory contains assignments to Make variables, each of which
-+enables or disables a particular option group. If the variable's
-+value is set to 'y', then the option group is enabled; if it set to
-+anything else, the option group is omitted. The file
-+'option-groups.defaults', at the top of the source tree, establishes
-+default values for all variables; all option groups are enabled by
-+default.
-+
-+For example, the following 'option-groups.config' would omit locale
-+data, but include mathematical functions, and everything else:
-+
-+ OPTION_EGLIBC_LOCALES = n
-+ OPTION_EGLIBC_LIBM = y
-+
-+Like the Linux kernel, EGLIBC supports a similar set of '*config' make
-+targets to make it easier to create 'option-groups.config', with all
-+dependencies between option groups automatically satisfied. Run
-+'make help' to see the list of supported make config targets. For
-+example, 'make menuconfig' will update the current config utilising a
-+menu based program.
-+
-+The option group names and their type (boolean, int, hex, string), help
-+description, and dependencies with other option groups, are described by
-+'option-groups.def' at the top of the source tree, analogous to the
-+'Kconfig' files in the Linux kernel.
-+
-+In general, each option group variable controls whether a given set of
-+object files in EGLIBC is compiled and included in the final
-+libraries, or omitted from the build.
-+
-+Each subdirectory's Makefile categorizes its routines, libraries, and
-+executables by option group. For example, EGLIBC's 'math/Makefile'
-+places the 'libm' library in the OPTION_EGLIBC_LIBM group as follows:
-+
-+ extra-libs-$(OPTION_EGLIBC_LIBM) := libm
-+
-+Finally, common code in 'Makerules' cites the value of the variable
-+'extra-libs-y', selecting only those libraries that belong to enabled
-+option groups to be built.
-+
-+
-+Current Status and Future Directions
-+
-+The EGLIBC component configuration system described here is still
-+under development.
-+
-+We have used the system to subset some portions of EGLIBC's
-+Index: libc/configure.ac
-diff --git a/Makefile b/Makefile
-index 658ccfa..f906391 100644
---- a/Makefile
-+++ b/Makefile
-@@ -24,6 +24,7 @@ endif
-
- include Makeconfig
-
-+include options-config/Makefile
-
- # This is the default target; it makes everything except the tests.
- .PHONY: all
-diff --git a/config.make.in b/config.make.in
-index a9f5696..294f8d1 100644
---- a/config.make.in
-+++ b/config.make.in
-@@ -47,6 +47,8 @@ c++-sysincludes = @CXX_SYSINCLUDES@
- all-warnings = @all_warnings@
- enable-werror = @enable_werror@
-
-+kconfig_tools = @KCONFIG_TOOLS@
-+
- have-z-combreloc = @libc_cv_z_combreloc@
- have-z-execstack = @libc_cv_z_execstack@
- have-Bgroup = @libc_cv_Bgroup@
-diff --git a/configure b/configure
-index 7d7299a..4116404 100755
---- a/configure
-+++ b/configure
-@@ -641,6 +641,7 @@ INSTALL_INFO
- PERL
- BASH_SHELL
- libc_cv_gcc_static_libgcc
-+KCONFIG_TOOLS
- CXX_SYSINCLUDES
- SYSINCLUDES
- AUTOCONF
-@@ -755,6 +756,7 @@ with_fp
- with_binutils
- with_selinux
- with_headers
-+with_kconfig
- with_default_link
- enable_sanity_checks
- enable_shared
-@@ -1459,6 +1461,9 @@ Optional Packages:
- --with-selinux if building with SELinux support
- --with-headers=PATH location of system headers to use (for example
- /usr/src/linux/include) [default=compiler default]
-+ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
-+ builds) to re-use for configuring EGLIBC option
-+ groups
- --with-default-link do not use explicit linker scripts
- --with-cpu=CPU select code for CPU variant
-
-@@ -3517,6 +3522,14 @@ fi
-
-
-
-+# Check whether --with-kconfig was given.
-+if test "${with_kconfig+set}" = set; then
-+ withval=$with_kconfig; KCONFIG_TOOLS=$withval
-+else
-+ KCONFIG_TOOLS=''
-+fi
-+
-+
-
- # Check whether --with-default-link was given.
- if test "${with_default_link+set}" = set; then :
-diff --git a/configure.ac b/configure.ac
-index a467a69..fc0ed4d 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -136,6 +136,16 @@ AC_ARG_WITH([headers],
- [sysheaders=''])
- AC_SUBST(sysheaders)
-
-+AC_ARG_WITH([kconfig],
-+ AC_HELP_STRING([--with-kconfig=PATH],
-+ [location of kconfig tools to use (from Linux
-+ kernel builds) to re-use for configuring EGLIBC
-+ option groups]),
-+ [KCONFIG_TOOLS=$withval],
-+ [KCONFIG_TOOLS=''])
-+AC_SUBST(KCONFIG_TOOLS)
-+
-+
- AC_SUBST(use_default_link)
- AC_ARG_WITH([default-link],
- AC_HELP_STRING([--with-default-link],
-diff --git a/option-groups.def b/option-groups.def
-new file mode 100644
-index 0000000..6aebd94
---- /dev/null
-+++ b/option-groups.def
-@@ -0,0 +1,868 @@
-+# This file documents the option groups EGLIBC currently supports, in
-+# a format akin to the Linux Kconfig system's. The syntax may change
-+# over time.
-+#
-+# An entry of the form:
-+#
-+# config GROUP_NAME
-+# bool "one-line explanation of what this option group controls"
-+# help
-+# Multi-line help explaining the option group's meaning in
-+# some detail, terminated by indentation level.
-+#
-+# defines an option group whose variable is GROUP_NAME, with
-+# meaningful values 'y' (enabled) and 'n' (disabled). The
-+# documentation is formatted to be consumed by some sort of
-+# interactive configuration interface, but EGLIBC doesn't have such an
-+# interface yet.
-+#
-+# An option may have a 'depends on' line, indicating which other options
-+# must also be enabled if this option is. At present, EGLIBC doesn't
-+# check that these dependencies are satisfied.
-+#
-+# Option group variables get their default values from the file
-+# 'option-groups.defaults', in the top directory of the EGLIBC source
-+# tree. By default, all EGLIBC option groups are enabled --- their
-+# variables are set to 'y'.
-+#
-+# After including 'option-groups.defaults', the EGLIBC make machinery
-+# includes the file 'option-groups.config' from the top of the build
-+# tree, if it is present. Developers can place assignments to option
-+# group variables in that file to override the defaults. For example,
-+# to disable an option group, place a line of the form:
-+#
-+# OPTION_GROUP_NAME = n
-+#
-+# in 'option-groups.config' at the top of your build tree. To
-+# explicitly enable an option group, you may also write:
-+#
-+# OPTION_GROUP_NAME = y
-+#
-+# although this simply reestablishes the value already set by
-+# 'option-groups.defaults'.
-+
-+config EGLIBC_ADVANCED_INET6
-+ bool "IPv6 Advanced Sockets API support (RFC3542)"
-+ depends on EGLIBC_INET
-+ help
-+ This option group includes the functions specified by RFC 3542,
-+ "Advanced Sockets Application Program Interface (API) for
-+ IPv6".
-+
-+ This option group includes the following functions:
-+
-+ inet6_opt_append
-+ inet6_opt_find
-+ inet6_opt_finish
-+ inet6_opt_get_val
-+ inet6_opt_init
-+ inet6_option_alloc
-+ inet6_option_append
-+ inet6_option_find
-+ inet6_option_init
-+ inet6_option_next
-+ inet6_option_space
-+ inet6_opt_next
-+ inet6_opt_set_val
-+ inet6_rth_add
-+ inet6_rth_getaddr
-+ inet6_rth_init
-+ inet6_rth_reverse
-+ inet6_rth_segments
-+ inet6_rth_space
-+
-+config EGLIBC_BACKTRACE
-+ bool "Functions for producing backtraces"
-+ help
-+ This option group includes functions for producing a list of
-+ the function calls that are currently active in a thread, from
-+ within the thread itself. These functions are often used
-+ within signal handlers, to produce diagnostic output.
-+
-+ This option group includes the following functions:
-+
-+ backtrace
-+ backtrace_symbols
-+ backtrace_symbols_fd
-+
-+config EGLIBC_BIG_MACROS
-+ bool "Use extensive inline code"
-+ help
-+ This option group specifies whether certain pieces of code
-+ should be inlined to achieve maximum speed. If this option
-+ group is not selected, function calls will be used instead,
-+ hence reducing the library footprint.
-+
-+config EGLIBC_BSD
-+ bool "BSD-specific functions, and their compatibility stubs"
-+ help
-+ This option group includes functions specific to BSD kernels.
-+ A number of these functions have stub versions that are also
-+ included in libraries built for non-BSD systems for
-+ compatibility.
-+
-+ This option group includes the following functions:
-+
-+ chflags
-+ fchflags
-+ lchmod
-+ revoke
-+ setlogin
-+
-+config EGLIBC_CXX_TESTS
-+ bool "Tests that link against the standard C++ library."
-+ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
-+ help
-+ This option group does not include any C library functions;
-+ instead, it controls which EGLIBC tests an ordinary 'make
-+ tests' runs. With this group disabled, tests that would
-+ normally link against the standard C++ library are not
-+ run.
-+
-+ The standard C++ library depends on the math library 'libm' and
-+ the wide character I/O functions included in EGLIBC. So those
-+ option groups must be enabled if this test is enabled.
-+
-+config EGLIBC_CATGETS
-+ bool "Functions for accessing message catalogs"
-+ depends on EGLIBC_LOCALE_CODE
-+ help
-+ This option group includes functions for accessing message
-+ catalogs: catopen, catclose, and catgets.
-+
-+ This option group depends on the EGLIBC_LOCALE_CODE
-+ option group.
-+
-+config EGLIBC_CHARSETS
-+ bool "iconv/gconv character set conversion libraries"
-+ help
-+ This option group includes support for character sets other
-+ than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
-+ various encodings. This affects both the character sets
-+ supported by the wide and multibyte character functions, and
-+ those supported by the 'iconv' functions.
-+
-+ With this option group disabled, EGLIBC supports only the
-+ following character sets:
-+
-+ ANSI_X3.4 - ASCII
-+ ANSI_X3.4-1968
-+ ANSI_X3.4-1986
-+ ASCII
-+ CP367
-+ CSASCII
-+ IBM367
-+ ISO-IR-6
-+ ISO646-US
-+ ISO_646.IRV:1991
-+ OSF00010020
-+ US
-+ US-ASCII
-+
-+ 10646-1:1993 - ISO 10646, in big-endian UCS4 form
-+ 10646-1:1993/UCS4
-+ CSUCS4
-+ ISO-10646
-+ ISO-10646/UCS4
-+ OSF00010104
-+ OSF00010105
-+ OSF00010106
-+ UCS-4
-+ UCS-4BE
-+ UCS4
-+
-+ UCS-4LE - ISO 10646, in little-endian UCS4 form
-+
-+ ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
-+ ISO-10646/UTF8
-+ ISO-IR-193
-+ OSF05010001
-+ UTF-8
-+ UTF8
-+
-+ ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
-+ OSF00010100
-+ OSF00010101
-+ OSF00010102
-+ UCS-2
-+ UCS2
-+
-+ UCS-2BE - ISO 10646, in big-endian UCS2 form
-+ UNICODEBIG
-+
-+ UCS-2LE - ISO 10646, in little-endian UCS2 form
-+ UNICODELITTLE
-+
-+ WCHAR_T - EGLIBC's internal form (target-endian,
-+ 32-bit ISO 10646)
-+
-+config EGLIBC_CRYPT
-+ bool "Encryption library"
-+ help
-+ This option group includes the `libcrypt' library which
-+ provides functions for one-way encryption. Supported
-+ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
-+
-+config EGLIBC_CRYPT_UFC
-+ bool "Ultra fast `crypt' implementation"
-+ depends on EGLIBC_CRYPT
-+ help
-+ This option group provides ultra fast DES-based implementation of
-+ the `crypt' function. When this option group is disabled,
-+ (a) the library will not provide the setkey[_r] and encrypt[_r]
-+ functions and (b) the crypt[_r] function will return NULL and set the
-+ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
-+ SHA-256 or SHA-512 algorithm.
-+
-+config EGLIBC_DB_ALIASES
-+ bool "Functions for accessing the mail aliases database"
-+ help
-+ This option group includues functions for looking up mail
-+ aliases in '/etc/aliases' or using nsswitch. It includes the
-+ following functions:
-+
-+ endaliasent
-+ getaliasbyname
-+ getaliasbyname_r
-+ getaliasent
-+ getaliasent_r
-+ setaliasent
-+
-+ When this option group is disabled, the NSS service libraries
-+ also lack support for querying their mail alias tables.
-+
-+config EGLIBC_ENVZ
-+ bool "Functions for handling envz-style environment vectors."
-+ help
-+ This option group contains functions for creating and operating
-+ on envz vectors. An "envz vector" is a vector of strings in a
-+ contiguous block of memory, where each element is a name-value
-+ pair, and elements are separated from their neighbors by null
-+ characters.
-+
-+ This option group includes the following functions:
-+
-+ envz_add envz_merge
-+ envz_entry envz_remove
-+ envz_get envz_strip
-+
-+config EGLIBC_FCVT
-+ bool "Functions for converting floating-point numbers to strings"
-+ help
-+ This option group includes functions for converting
-+ floating-point numbers to strings.
-+
-+ This option group includes the following functions:
-+
-+ ecvt qecvt
-+ ecvt_r qecvt_r
-+ fcvt qfcvt
-+ fcvt_r qfcvt_r
-+ gcvt qgcvt
-+
-+config EGLIBC_FMTMSG
-+ bool "Functions for formatting messages"
-+ help
-+ This option group includes the following functions:
-+
-+ addseverity fmtmsg
-+
-+config EGLIBC_FSTAB
-+ bool "Access functions for 'fstab'"
-+ help
-+ This option group includes functions for reading the mount
-+ point specification table, '/etc/fstab'. These functions are
-+ not included in the POSIX standard, which provides the
-+ 'getmntent' family of functions instead.
-+
-+ This option group includes the following functions:
-+
-+ endfsent getfsspec
-+ getfsent setfsent
-+ getfsfile
-+
-+config EGLIBC_FTRAVERSE
-+ bool "Functions for traversing file hierarchies"
-+ help
-+ This option group includes functions for traversing file
-+ UNIX file hierachies.
-+
-+ This option group includes the following functions:
-+
-+ fts_open ftw
-+ fts_read nftw
-+ fts_children ftw64
-+ fts_set nftw64
-+ fts_close
-+
-+config EGLIBC_GETLOGIN
-+ bool "The getlogin function"
-+ depends on EGLIBC_UTMP
-+ help
-+ This function group includes the 'getlogin' and 'getlogin_r'
-+ functions, which return the user name associated by the login
-+ activity with the current process's controlling terminal.
-+
-+ With this option group disabled, the 'glob' function will not
-+ fall back on 'getlogin' to find the user's login name for tilde
-+ expansion when the 'HOME' environment variable is not set.
-+
-+config EGLIBC_IDN
-+ bool "International domain names support"
-+ help
-+ This option group includes the `libcidn' library which
-+ provides support for international domain names.
-+
-+config EGLIBC_INET
-+ bool "Networking support"
-+ help
-+ This option group includes networking-specific functions and
-+ data. With EGLIBC_INET disabled, the EGLIBC
-+ installation and API changes as follows:
-+
-+ - The following libraries are not installed:
-+
-+ libnsl
-+ libnss_compat
-+ libnss_dns
-+ libnss_hesiod
-+ libnss_nis
-+ libnss_nisplus
-+ libresolv
-+
-+ - The following functions and variables are omitted from libc:
-+
-+ authdes_create hstrerror svc_fdset
-+ authdes_getucred htonl svc_getreq
-+ authdes_pk_create htons svc_getreq_common
-+ authnone_create if_freenameindex svc_getreq_poll
-+ authunix_create if_indextoname svc_getreqset
-+ authunix_create_default if_nameindex svc_max_pollfd
-+ bindresvport if_nametoindex svc_pollfd
-+ callrpc in6addr_any svcraw_create
-+ cbc_crypt in6addr_loopback svc_register
-+ clnt_broadcast inet6_opt_append svc_run
-+ clnt_create inet6_opt_find svc_sendreply
-+ clnt_pcreateerror inet6_opt_finish svctcp_create
-+ clnt_perrno inet6_opt_get_val svcudp_bufcreate
-+ clnt_perror inet6_opt_init svcudp_create
-+ clntraw_create inet6_option_alloc svcudp_enablecache
-+ clnt_spcreateerror inet6_option_append svcunix_create
-+ clnt_sperrno inet6_option_find svcunixfd_create
-+ clnt_sperror inet6_option_init svc_unregister
-+ clnttcp_create inet6_option_next user2netname
-+ clntudp_bufcreate inet6_option_space xdecrypt
-+ clntudp_create inet6_opt_next xdr_accepted_reply
-+ clntunix_create inet6_opt_set_val xdr_array
-+ des_setparity inet6_rth_add xdr_authdes_cred
-+ ecb_crypt inet6_rth_getaddr xdr_authdes_verf
-+ endaliasent inet6_rth_init xdr_authunix_parms
-+ endhostent inet6_rth_reverse xdr_bool
-+ endnetent inet6_rth_segments xdr_bytes
-+ endnetgrent inet6_rth_space xdr_callhdr
-+ endprotoent inet_addr xdr_callmsg
-+ endrpcent inet_aton xdr_char
-+ endservent inet_lnaof xdr_cryptkeyarg
-+ ether_aton inet_makeaddr xdr_cryptkeyarg2
-+ ether_aton_r inet_netof xdr_cryptkeyres
-+ ether_hostton inet_network xdr_des_block
-+ ether_line inet_nsap_addr xdr_double
-+ ether_ntoa inet_nsap_ntoa xdr_enum
-+ ether_ntoa_r inet_ntoa xdr_float
-+ ether_ntohost inet_ntop xdr_free
-+ freeaddrinfo inet_pton xdr_getcredres
-+ freeifaddrs innetgr xdr_hyper
-+ gai_strerror iruserok xdr_int
-+ getaddrinfo iruserok_af xdr_int16_t
-+ getaliasbyname key_decryptsession xdr_int32_t
-+ getaliasbyname_r key_decryptsession_pk xdr_int64_t
-+ getaliasent key_encryptsession xdr_int8_t
-+ getaliasent_r key_encryptsession_pk xdr_keybuf
-+ gethostbyaddr key_gendes xdr_key_netstarg
-+ gethostbyaddr_r key_get_conv xdr_key_netstres
-+ gethostbyname key_secretkey_is_set xdr_keystatus
-+ gethostbyname2 key_setnet xdr_long
-+ gethostbyname2_r key_setsecret xdr_longlong_t
-+ gethostbyname_r netname2host xdrmem_create
-+ gethostent netname2user xdr_netnamestr
-+ gethostent_r ntohl xdr_netobj
-+ getifaddrs ntohs xdr_opaque
-+ getipv4sourcefilter passwd2des xdr_opaque_auth
-+ get_myaddress pmap_getmaps xdr_pmap
-+ getnameinfo pmap_getport xdr_pmaplist
-+ getnetbyaddr pmap_rmtcall xdr_pointer
-+ getnetbyaddr_r pmap_set xdr_quad_t
-+ getnetbyname pmap_unset xdrrec_create
-+ getnetbyname_r rcmd xdrrec_endofrecord
-+ getnetent rcmd_af xdrrec_eof
-+ getnetent_r registerrpc xdrrec_skiprecord
-+ getnetgrent res_init xdr_reference
-+ getnetgrent_r rexec xdr_rejected_reply
-+ getnetname rexec_af xdr_replymsg
-+ getprotobyname rexecoptions xdr_rmtcall_args
-+ getprotobyname_r rpc_createerr xdr_rmtcallres
-+ getprotobynumber rresvport xdr_short
-+ getprotobynumber_r rresvport_af xdr_sizeof
-+ getprotoent rtime xdrstdio_create
-+ getprotoent_r ruserok xdr_string
-+ getpublickey ruserok_af xdr_u_char
-+ getrpcbyname ruserpass xdr_u_hyper
-+ getrpcbyname_r setaliasent xdr_u_int
-+ getrpcbynumber sethostent xdr_uint16_t
-+ getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
-+ getrpcent setnetent xdr_uint64_t
-+ getrpcent_r setnetgrent xdr_uint8_t
-+ getrpcport setprotoent xdr_u_long
-+ getsecretkey setrpcent xdr_u_longlong_t
-+ getservbyname setservent xdr_union
-+ getservbyname_r setsourcefilter xdr_unixcred
-+ getservbyport svcauthdes_stats xdr_u_quad_t
-+ getservbyport_r svcerr_auth xdr_u_short
-+ getservent svcerr_decode xdr_vector
-+ getservent_r svcerr_noproc xdr_void
-+ getsourcefilter svcerr_noprog xdr_wrapstring
-+ h_errlist svcerr_progvers xencrypt
-+ h_errno svcerr_systemerr xprt_register
-+ herror svcerr_weakauth xprt_unregister
-+ h_nerr svc_exit
-+ host2netname svcfd_create
-+
-+ - The rpcgen, nscd, and rpcinfo commands are not installed.
-+
-+ - The 'rpc' file (a text file listing RPC services) is not installed.
-+
-+ Socket-related system calls do not fall in this option group,
-+ because many are also used for other inter-process
-+ communication mechanisms. For example, the 'syslog' routines
-+ use Unix-domain sockets to communicate with the syslog daemon;
-+ syslog is valuable in non-networked contexts.
-+
-+config EGLIBC_INET_ANL
-+ bool "Asynchronous name lookup"
-+ depends on EGLIBC_INET
-+ help
-+ This option group includes the `libanl' library which
-+ provides support for asynchronous name lookup.
-+
-+config EGLIBC_LIBM
-+ bool "libm (math library)"
-+ help
-+ This option group includes the 'libm' library, containing
-+ mathematical functions. If this option group is omitted, then
-+ an EGLIBC installation does not include shared or unshared versions
-+ of the math library.
-+
-+ Note that this does not remove all floating-point related
-+ functionality from EGLIBC; for example, 'printf' and 'scanf'
-+ can still print and read floating-point values with this option
-+ group disabled.
-+
-+ Note that the ISO Standard C++ library 'libstdc++' depends on
-+ EGLIBC's math library 'libm'. If you disable this option
-+ group, you will not be able to build 'libstdc++' against the
-+ resulting EGLIBC installation.
-+
-+config EGLIBC_LOCALES
-+ bool "Locale definitions"
-+ help
-+ This option group includes all locale definitions other than
-+ that for the "C" locale. If this option group is omitted, then
-+ only the "C" locale is supported.
-+
-+
-+config EGLIBC_LOCALE_CODE
-+ bool "Locale functions"
-+ depends on POSIX_C_LANG_WIDE_CHAR
-+ help
-+ This option group includes locale support functions, programs,
-+ and libraries. With EGLIBC_LOCALE_CODE disabled,
-+ EGLIBC supports only the 'C' locale (also known as 'POSIX'),
-+ and ignores the settings of the 'LANG' and 'LC_*' environment
-+ variables.
-+
-+ With EGLIBC_LOCALE_CODE disabled, the following
-+ functions are omitted from libc:
-+
-+ duplocale localeconv nl_langinfo rpmatch strfmon_l
-+ freelocale newlocale nl_langinfo_l strfmon uselocale
-+
-+ Furthermore, only the LC_CTYPE and LC_TIME categories of the
-+ standard "C" locale are available.
-+
-+ The EGLIBC_CATGETS option group depends on this option group.
-+
-+
-+config EGLIBC_MEMUSAGE
-+ bool "Memory profiling library"
-+ help
-+ This option group includes the `libmemusage' library and
-+ the `memusage' and `memusagestat' utilities.
-+ These components provide memory profiling functions.
-+
-+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+ int "Memory profiling library buffer size"
-+ depends on EGLIBC_MEMUSAGE
-+ default "32768"
-+ help
-+ Libmemusage library buffers the profiling data in memory
-+ before writing it out to disk. By default, the library
-+ allocates 1.5M buffer, which can be substantial for some
-+ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
-+ allows to change the default buffer size. It specifies
-+ the number of entries the buffer should have.
-+ On most architectures one buffer entry amounts to 48 bytes,
-+ so setting this option to the value of 512 will reduce the size of
-+ the memory buffer to 24K.
-+
-+config EGLIBC_NIS
-+ bool "Support for NIS, NIS+, and the special 'compat' services."
-+ depends on EGLIBC_INET && EGLIBC_SUNRPC
-+ help
-+ This option group includes the NIS, NIS+, and 'compat' Name
-+ Service Switch service libraries. When it is disabled, those
-+ services libraries are not installed; you should remove any
-+ references to them from your 'nsswitch.conf' file.
-+
-+ This option group depends on the EGLIBC_INET option
-+ group; you must enable that to enable this option group.
-+
-+config EGLIBC_NSSWITCH
-+ bool "Name service switch (nsswitch) support"
-+ help
-+ This option group includes support for the 'nsswitch' facility.
-+ With this option group enabled, all EGLIBC functions for
-+ accessing various system databases (passwords and groups;
-+ networking; aliases; public keys; and so on) consult the
-+ '/etc/nsswitch.conf' configuration file to decide how to handle
-+ queries.
-+
-+ With this option group disabled, EGLIBC uses a fixed list of
-+ services to satisfy queries on each database, as requested by
-+ configuration files specified when EGLIBC is built. Your
-+ 'option-groups.config' file must set the following two
-+ variables:
-+
-+config EGLIBC_NSSWITCH_FIXED_CONFIG
-+ string "Nsswitch fixed config filename"
-+ depends on !EGLIBC_NSSWITCH
-+ default ""
-+ help
-+ Set this to the name of a file whose contents observe the
-+ same syntax as an ordinary '/etc/nsswitch.conf' file. The
-+ EGLIBC build process parses this file just as EGLIBC would
-+ at run time if EGLIBC_NSSWITCH were enabled, and
-+ produces a C library that uses the nsswitch service
-+ libraries to search for database entries as this file
-+ specifies, instead of consulting '/etc/nsswitch.conf' at run
-+ time.
-+
-+ This should be an absolute filename. The EGLIBC build
-+ process may use it from several different working
-+ directories. It may include references to Makefile
-+ variables like 'common-objpfx' (the top of the build tree,
-+ with a trailing slash), or '..' (the top of the source tree,
-+ with a trailing slash).
-+
-+ The EGLIBC source tree includes a sample configuration file
-+ named 'nss/fixed-nsswitch.conf'; for simple configurations,
-+ you will probably want to delete references to databases not
-+ needed on your system.
-+
-+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-+ string "Nsswitch fixed functions filename"
-+ depends on !EGLIBC_NSSWITCH
-+ default ""
-+ help
-+ The EGLIBC build process uses this file to decide which
-+ functions to make available from which service libraries.
-+ The file 'nss/fixed-nsswitch.functions' serves as a sample
-+ configuration file for this setting, and explains its syntax
-+ and meaning in more detail.
-+
-+ This should be an absolute file name. The EGLIBC build
-+ process may use it from several different working
-+ directories. It may include references to Makefile
-+ variables like 'common-objpfx' (the top of the build tree,
-+ with a trailing slash), or '..' (the top of the source tree,
-+ with a trailing slash).
-+
-+ Be sure to mention each function in each service you wish to
-+ use. If you do not mention a service's function here, the
-+ EGLIBC database access functions will not find it, even if
-+ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
-+ file.
-+
-+ In this arrangement, EGLIBC will not use the 'dlopen' and
-+ 'dlsym' functions to find database access functions. Instead,
-+ libc hard-codes references to the service libraries' database
-+ access functions. You must explicitly link your program
-+ against the name service libraries (those whose names start
-+ with 'libnss_', in the sysroot's '/lib' directory) whose
-+ functions you intend to use. This arrangement helps
-+ system-wide static analysis tools decide which functions a
-+ system actually uses.
-+
-+ Note that some nsswitch service libraries require other option
-+ groups to be enabled; for example, the EGLIBC_INET
-+ option group must be enabled to use the 'libnss_dns.so.2'
-+ service library, which uses the Domain Name System network
-+ protocol to answer queries.
-+
-+config EGLIBC_RCMD
-+ bool "Support for 'rcmd' and related library functions"
-+ depends on EGLIBC_INET
-+ help
-+ This option group includes functions for running commands on
-+ remote machines via the 'rsh' protocol, and doing authentication
-+ related to those functions. This also includes functions that
-+ use the 'rexec' protocol.
-+
-+ This option group includes the following functions:
-+
-+ rcmd ruserok
-+ rcmd_af ruserok_af
-+ rexec iruserok
-+ rexec_af iruserok_af
-+ rresvport ruserpass
-+ rresvport_af
-+
-+config EGLIBC_RTLD_DEBUG
-+ bool "Runtime linker debug print outs"
-+ help
-+ This option group enables debug output of the runtime linker
-+ which is activated via LD_DEBUG and LD_TRACE_PRELINKING
-+ environment variables. Disabling this option group yields
-+ a smaller runtime linker binary.
-+ BEWARE: Disabling this option group is likely to break
-+ the `ldd' utility which may also be used by the prelinker.
-+ In particular, the `--unused' ldd option will not work correctly.
-+
-+config EGLIBC_SPAWN
-+ bool "Support for POSIX posix_spawn functions"
-+ help
-+ This option group includes the POSIX functions for executing
-+ programs in child processes without using 'fork' or 'vfork'.
-+
-+ This option group includes the following functions:
-+
-+ posix_spawn
-+ posix_spawnattr_destroy
-+ posix_spawnattr_getflags
-+ posix_spawnattr_getpgroup
-+ posix_spawnattr_getschedparam
-+ posix_spawnattr_getschedpolicy
-+ posix_spawnattr_getsigdefault
-+ posix_spawnattr_getsigmask
-+ posix_spawnattr_init
-+ posix_spawnattr_setflags
-+ posix_spawnattr_setpgroup
-+ posix_spawnattr_setschedparam
-+ posix_spawnattr_setschedpolicy
-+ posix_spawnattr_setsigdefault
-+ posix_spawnattr_setsigmask
-+ posix_spawn_file_actions_addclose
-+ posix_spawn_file_actions_adddup2
-+ posix_spawn_file_actions_addopen
-+ posix_spawn_file_actions_destroy
-+ posix_spawn_file_actions_init
-+ posix_spawnp
-+
-+ This option group also provides the ability for the iconv,
-+ localedef, and locale programs to operate transparently on
-+ compressed charset definitions. When this option group is
-+ disabled, those programs will only operate on uncompressed
-+ charmap files.
-+
-+config EGLIBC_STREAMS
-+ bool "Support for accessing STREAMS."
-+ help
-+ This option group includes functions for reading and writing
-+ messages to and from STREAMS. The STREAMS interface provides a
-+ uniform mechanism for implementing networking services and other
-+ character-based I/O. (STREAMS are not to be confused with
-+ <stdio.h> FILE objects, also called 'streams'.)
-+
-+ This option group includes the following functions:
-+
-+ getmsg putpmsg
-+ getpmsg fattach
-+ isastream fdetach
-+ putmsg
-+
-+config EGLIBC_SUNRPC
-+ bool "Support for the Sun 'RPC' protocol."
-+ depends on EGLIBC_INET
-+ help
-+ This option group includes support for the Sun RPC protocols,
-+ including the 'rpcgen' and 'rpcinfo' programs.
-+
-+config EGLIBC_UTMP
-+ bool "Older access functions for 'utmp' login records"
-+ help
-+ This option group includes the older 'utent' family of
-+ functions for accessing user login records in the 'utmp' file.
-+ POSIX omits these functions in favor of the 'utxent' family,
-+ and they are obsolete on systems other than Linux.
-+
-+ This option group includes the following functions:
-+
-+ endutent
-+ getutent
-+ getutent_r
-+ getutid
-+ getutid_r
-+ getutline
-+ getutline_r
-+ logwtmp
-+ pututline
-+ setutent
-+ updwtmp
-+ utmpname
-+
-+ This option group includes the following libraries:
-+
-+ libutil.so (and libutil.a)
-+
-+config EGLIBC_UTMPX
-+ bool "POSIX access functions for 'utmp' login records"
-+ depends on EGLIBC_UTMP
-+ help
-+ This option group includes the POSIX functions for reading and
-+ writing user login records in the 'utmp' file (usually
-+ '/var/run/utmp'). The POSIX functions operate on 'struct
-+ utmpx' structures, as opposed to the family of older 'utent'
-+ functions, which operate on 'struct utmp' structures.
-+
-+ This option group includes the following functions:
-+
-+ endutxent
-+ getutmp
-+ getutmpx
-+ getutxent
-+ getutxid
-+ getutxline
-+ pututxline
-+ setutxent
-+ updwtmpx
-+ utmpxname
-+
-+config EGLIBC_WORDEXP
-+ bool "Shell-style word expansion"
-+ help
-+ This option group includes the 'wordexp' function for
-+ performing word expansion in the manner of the shell, and the
-+ accompanying 'wordfree' function.
-+
-+config POSIX_C_LANG_WIDE_CHAR
-+ bool "ISO C library wide character functions, excluding I/O"
-+ help
-+ This option group includes the functions defined by the ISO C
-+ standard for working with wide and multibyte characters in
-+ memory. Functions for reading and writing wide and multibyte
-+ characters from and to files call in the
-+ POSIX_WIDE_CHAR_DEVICE_IO option group.
-+
-+ This option group includes the following functions:
-+
-+ btowc mbsinit wcscspn wcstoll
-+ iswalnum mbsrtowcs wcsftime wcstombs
-+ iswalpha mbstowcs wcslen wcstoul
-+ iswblank mbtowc wcsncat wcstoull
-+ iswcntrl swprintf wcsncmp wcstoumax
-+ iswctype swscanf wcsncpy wcsxfrm
-+ iswdigit towctrans wcspbrk wctob
-+ iswgraph towlower wcsrchr wctomb
-+ iswlower towupper wcsrtombs wctrans
-+ iswprint vswprintf wcsspn wctype
-+ iswpunct vswscanf wcsstr wmemchr
-+ iswspace wcrtomb wcstod wmemcmp
-+ iswupper wcscat wcstof wmemcpy
-+ iswxdigit wcschr wcstoimax wmemmove
-+ mblen wcscmp wcstok wmemset
-+ mbrlen wcscoll wcstol
-+ mbrtowc wcscpy wcstold
-+
-+config POSIX_REGEXP
-+ bool "Regular expressions"
-+ help
-+ This option group includes the POSIX regular expression
-+ functions, and the associated non-POSIX extensions and
-+ compatibility functions.
-+
-+ With POSIX_REGEXP disabled, the following functions are
-+ omitted from libc:
-+
-+ re_comp re_max_failures regcomp
-+ re_compile_fastmap re_search regerror
-+ re_compile_pattern re_search_2 regexec
-+ re_exec re_set_registers regfree
-+ re_match re_set_syntax rpmatch
-+ re_match_2 re_syntax_options
-+
-+ Furthermore, the compatibility regexp interface defined in the
-+ <regexp.h> header file, 'compile', 'step', and 'advance', is
-+ omitted.
-+
-+config POSIX_REGEXP_GLIBC
-+ bool "Regular expressions from GLIBC"
-+ depends on POSIX_REGEXP
-+ help
-+ This option group specifies which regular expression
-+ library to use. The choice is between regex
-+ implementation from GLIBC and regex implementation from
-+ libiberty. The GLIBC variant is fully POSIX conformant and
-+ optimized for speed; regex from libiberty is more than twice
-+ as small while still is enough for most practical purposes.
-+
-+config POSIX_WIDE_CHAR_DEVICE_IO
-+ bool "Input and output functions for wide characters"
-+ depends on POSIX_C_LANG_WIDE_CHAR
-+ help
-+ This option group includes functions for reading and writing
-+ wide characters to and from <stdio.h> streams.
-+
-+ This option group includes the following functions:
-+
-+ fgetwc fwprintf putwchar vwscanf
-+ fgetws fwscanf ungetwc wprintf
-+ fputwc getwc vfwprintf wscanf
-+ fputws getwchar vfwscanf
-+ fwide putwc vwprintf
-+
-+ This option group further includes the following unlocked
-+ variants of the above functions:
-+
-+ fgetwc_unlocked getwc_unlocked
-+ fgetws_unlocked getwchar_unlocked
-+ fputwc_unlocked putwc_unlocked
-+ fputws_unlocked putwchar_unlocked
-+
-+ Note that the GNU standard C++ library, 'libstdc++.so', uses
-+ some of these functions; you will not be able to link or run
-+ C++ programs if you disable this option group.
-+
-+ This option group also affects the behavior of the following
-+ functions:
-+
-+ fdopen
-+ fopen
-+ fopen64
-+ freopen
-+ freopen64
-+
-+ These functions all take an OPENTYPE parameter which may
-+ contain a string of the form ",ccs=CHARSET", indicating that
-+ the underlying file uses the character set named CHARSET.
-+ This produces a wide-oriented stream, which is only useful
-+ when the functions included in this option group are present.
-+ If the user attempts to open a file specifying a character set
-+ in the OPENTYPE parameter, and EGLIBC was built with this
-+ option group disabled, the function returns NULL, and sets
-+ errno to EINVAL.
-+
-+
-+# This helps Emacs users browse this file using the page motion commands
-+# and commands like 'pages-directory'.
-+# Local Variables:
-+# page-delimiter: "^config\\s-"
-+# End:
-diff --git a/option-groups.defaults b/option-groups.defaults
-new file mode 100644
-index 0000000..8141201
---- /dev/null
-+++ b/option-groups.defaults
-@@ -0,0 +1,47 @@
-+# This file sets default values for all option group variables
-+# mentioned in option-groups.def; see that file for a description of
-+# each option group.
-+#
-+# Subdirectory makefiles include this file before including the user's
-+# settings from option-groups.config at the top of the build tree;
-+# that file need only refer to those options whose default settings
-+# are to be changed.
-+#
-+# By default, all option groups are enabled.
-+OPTION_EGLIBC_ADVANCED_INET6 = y
-+OPTION_EGLIBC_BACKTRACE = y
-+OPTION_EGLIBC_BIG_MACROS = y
-+OPTION_EGLIBC_BSD = y
-+OPTION_EGLIBC_CXX_TESTS = y
-+OPTION_EGLIBC_CATGETS = y
-+OPTION_EGLIBC_CHARSETS = y
-+OPTION_EGLIBC_CRYPT = y
-+OPTION_EGLIBC_CRYPT_UFC = y
-+OPTION_EGLIBC_DB_ALIASES = y
-+OPTION_EGLIBC_ENVZ = y
-+OPTION_EGLIBC_FCVT = y
-+OPTION_EGLIBC_FMTMSG = y
-+OPTION_EGLIBC_FSTAB = y
-+OPTION_EGLIBC_FTRAVERSE = y
-+OPTION_EGLIBC_GETLOGIN = y
-+OPTION_EGLIBC_IDN = y
-+OPTION_EGLIBC_INET = y
-+OPTION_EGLIBC_INET_ANL = y
-+OPTION_EGLIBC_LIBM = y
-+OPTION_EGLIBC_LOCALES = y
-+OPTION_EGLIBC_LOCALE_CODE = y
-+OPTION_EGLIBC_MEMUSAGE = y
-+OPTION_EGLIBC_NIS = y
-+OPTION_EGLIBC_NSSWITCH = y
-+OPTION_EGLIBC_RCMD = y
-+OPTION_EGLIBC_RTLD_DEBUG = y
-+OPTION_EGLIBC_SPAWN = y
-+OPTION_EGLIBC_STREAMS = y
-+OPTION_EGLIBC_SUNRPC = y
-+OPTION_EGLIBC_UTMP = y
-+OPTION_EGLIBC_UTMPX = y
-+OPTION_EGLIBC_WORDEXP = y
-+OPTION_POSIX_C_LANG_WIDE_CHAR = y
-+OPTION_POSIX_REGEXP = y
-+OPTION_POSIX_REGEXP_GLIBC = y
-+OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
-diff --git a/option-groups.mak b/option-groups.mak
-new file mode 100644
-index 0000000..f83e0c1
---- /dev/null
-+++ b/option-groups.mak
-@@ -0,0 +1,41 @@
-+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
-+
-+# EGLIBC shouldn't need to override this. However, the
-+# cross-build-friendly localedef includes this makefile to get option
-+# group variable definitions; it uses a single build tree for all the
-+# multilibs, and needs to be able to specify a different option group
-+# configuration file for each multilib.
-+option_group_config_file ?= $(objdir)/option-groups.config
-+
-+# Read the default settings for all options.
-+# We're included before ../Rules, so we can't assume $(..) is set.
-+include $(firstword $(..) ../)option-groups.defaults
-+
-+# Read the developer's option group selections, overriding the
-+# defaults from option-groups.defaults.
-+-include $(option_group_config_file)
-+
-+# $(call option-disabled, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
-+# VAR should be a variable name, not a variable reference; this is
-+# less general, but more terse for the intended use.
-+# You can use it to add a file to a list if an option group is
-+# disabled, like this:
-+# routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
-+define option-disabled
-+$(firstword $(subst y,n,$(filter y,$($(strip $(1))))) y)
-+endef
-+
-+# Establish 'routines-y', etc. as simply-expanded variables.
-+aux-y :=
-+extra-libs-others-y :=
-+extra-libs-y :=
-+extra-objs-y :=
-+install-bin-y :=
-+install-others-y :=
-+install-sbin-y :=
-+others-y :=
-+others-pie-y :=
-+routines-y :=
-+test-srcs-y :=
-+tests-y :=
-+xtests-y :=
-diff --git a/options-config/Makefile b/options-config/Makefile
-new file mode 100644
-index 0000000..db00708
---- /dev/null
-+++ b/options-config/Makefile
-@@ -0,0 +1,55 @@
-+# ===========================================================================
-+# EGLIBC option-groups configuration targets
-+# These targets are included from top-level makefile
-+
-+ifneq ($(kconfig_tools),)
-+ifneq (no,$(PERL))
-+
-+ocdir := options-config
-+
-+OconfigDefaults := option-groups.defaults
-+OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
-+OconfigDef := option-groups.def
-+Oconfig := $(common-objpfx)option-groups.config
-+Oconfig_tmp := $(common-objpfx).tmp.config
-+
-+conf := $(kconfig_tools)/conf
-+mconf := $(kconfig_tools)/mconf
-+
-+preproc := $(PERL) $(ocdir)/config-preproc.pl
-+postproc := $(PERL) $(ocdir)/config-postproc.pl
-+
-+PHONY += defconfig config menuconfig
-+
-+defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(OconfigDefaults_tmp)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
-+ $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+ rm $(OconfigDefaults_tmp)
-+
-+config: $(conf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+
-+menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
-+ rm -f $(Oconfig_tmp)
-+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
-+ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
-+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
-+ rm $(Oconfig_tmp)
-+
-+# Help text used by make help
-+help:
-+ @echo ' defconfig - New config with default from default config'
-+ @echo ' config - Update current config utilising a line-oriented program'
-+ @echo ' menuconfig - Update current config utilising a menu based program'
-+
-+endif
-+endif
-diff --git a/options-config/config-postproc.pl b/options-config/config-postproc.pl
-new file mode 100644
-index 0000000..4dd1c63
---- /dev/null
-+++ b/options-config/config-postproc.pl
-@@ -0,0 +1,58 @@
-+#!/usr/bin/perl
-+
-+$usage = "usage: $0 <default config file> <config file>\n";
-+
-+die "$usage" unless @ARGV;
-+$defaults = shift @ARGV;
-+die "$usage" unless @ARGV;
-+die "Could not open $ARGV[0]" unless -T $ARGV[0];
-+
-+sub yank {
-+ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
-+}
-+
-+open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
-+
-+# get the full list of available options using the default config file
-+$i = 0;
-+while (<DEFAULTS>) {
-+ if (/^\s*OPTION_(\w+\s*=.*$)/) {
-+ $option[$i++] = $1;
-+ }
-+}
-+
-+# now go through the config file, making the necessary changes
-+while (<>) {
-+ if (/Linux Kernel Configuration/) {
-+ # change title
-+ s/Linux Kernel/Option Groups/;
-+ print;
-+ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
-+ # this is an explicit option set line, change CONFIG_ to OPTION_
-+ # before printing and remove this option from option list
-+ $opt = $1;
-+ yank($opt);
-+ s/CONFIG_/OPTION_/g;
-+ print;
-+ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
-+ # this is a comment line for an unset boolean option, change CONFIG_
-+ # to OPTION_, remove this option from option list, and convert to
-+ # explicit OPTION_FOO=n
-+ $opt = $1;
-+ yank($opt);
-+ s/CONFIG_/OPTION_/g;
-+ print "OPTION_$opt=n\n";
-+ } else {
-+ print;
-+ }
-+}
-+
-+# any boolean options left in @options, are options that were not mentioned in
-+# the config file, and implicitly that means the option must be set =n,
-+# so do that here.
-+foreach $opt (@option) {
-+ if ($opt =~ /=\s*[yn]/) {
-+ $opt =~ s/=\s*[yn]/=n/;
-+ print "OPTION_$opt\n";
-+ }
-+}
-diff --git a/options-config/config-preproc.pl b/options-config/config-preproc.pl
-new file mode 100644
-index 0000000..b83bb85
---- /dev/null
-+++ b/options-config/config-preproc.pl
-@@ -0,0 +1,8 @@
-+#!/usr/bin/perl
-+
-+if (@ARGV) {
-+ while (<>) {
-+ s/OPTION_/CONFIG_/g;
-+ print;
-+ }
-+}
-diff --git a/scripts/option-groups.awk b/scripts/option-groups.awk
-new file mode 100644
-index 0000000..533af0c
---- /dev/null
-+++ b/scripts/option-groups.awk
-@@ -0,0 +1,63 @@
-+# option-groups.awk --- generate option group header file
-+# Given input files containing makefile-style assignments to variables,
-+# print out a header file that #defines an appropriate preprocessor
-+# symbol for each variable left set to 'y'.
-+
-+BEGIN { FS="=" }
-+
-+# Trim spaces.
-+{ gsub (/[[:blank:]]/, "") }
-+
-+# Skip comments.
-+/^#/ { next }
-+
-+# Process assignments.
-+NF == 2 {
-+ vars[$1] = $2
-+}
-+
-+# Print final values.
-+END {
-+ print "/* This file is automatically generated by scripts/option-groups.awk"
-+ print " in the EGLIBC source tree."
-+ print ""
-+ print " It defines macros that indicate which EGLIBC option groups were"
-+ print " configured in 'option-groups.config' when this C library was"
-+ print " built. For each option group named OPTION_foo, it #defines"
-+ print " __OPTION_foo to be 1 if the group is enabled, or #defines that"
-+ print " symbol to be 0 if the group is disabled. */"
-+ print ""
-+ print "#ifndef __GNU_OPTION_GROUPS_H"
-+ print "#define __GNU_OPTION_GROUPS_H"
-+ print ""
-+
-+ # Produce a sorted list of variable names.
-+ i=0
-+ for (var in vars)
-+ names[i++] = var
-+ n = asort (names)
-+
-+ for (i = 1; i <= n; i++)
-+ {
-+ var = names[i]
-+ if (var ~ /^OPTION_/)
-+ {
-+ if (vars[var] == "y")
-+ print "#define __" var " 1"
-+ else if (vars[var] == "n")
-+ print "#define __" var " 0"
-+ else if (vars[var] ~ /^[0-9]+/ ||
-+ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
-+ vars[var] ~ /^\"/)
-+ print "#define __" var " " vars[var]
-+ else
-+ print "/* #undef __" var " */"
-+ # Ignore variables that don't have boolean, int, hex, or
-+ # string values. Ideally, this would be driven by the types
-+ # given in option-groups.def.
-+ }
-+ }
-+
-+ print ""
-+ print "#endif /* __GNU_OPTION_GROUPS_H */"
-+}
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch b/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch
index 8eacbc059f..8fb9182d98 100644
--- a/meta/recipes-core/glibc/glibc/0018-eglibc-Cross-building-and-testing-instructions.patch
+++ b/meta/recipes-core/glibc/glibc/0019-eglibc-Cross-building-and-testing-instructions.patch
@@ -1,22 +1,22 @@
-From eff048074ac7b5258bb615e5a5b221daa19b18ae Mon Sep 17 00:00:00 2001
+From db9674ffc6583a508da1a3cb044c3ccf3febaea1 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:42:58 +0000
-Subject: [PATCH 18/27] eglibc: Cross building and testing instructions
+Subject: [PATCH] eglibc: Cross building and testing instructions
Ported from eglibc
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++++++++++
- GLIBC.cross-testing | 205 +++++++++++++++++++++++++++
+ GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++
+ GLIBC.cross-testing | 205 +++++++++++++++++++++++
2 files changed, 588 insertions(+)
create mode 100644 GLIBC.cross-building
create mode 100644 GLIBC.cross-testing
diff --git a/GLIBC.cross-building b/GLIBC.cross-building
new file mode 100644
-index 0000000..e6e0da1
+index 0000000000..e6e0da1aaf
--- /dev/null
+++ b/GLIBC.cross-building
@@ -0,0 +1,383 @@
@@ -405,7 +405,7 @@ index 0000000..e6e0da1
+ Hello, C++ world!
diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing
new file mode 100644
-index 0000000..b67b468
+index 0000000000..b67b468466
--- /dev/null
+++ b/GLIBC.cross-testing
@@ -0,0 +1,205 @@
@@ -614,6 +614,3 @@ index 0000000..b67b468
+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we
+ simply place copies of these libraries in the top GLIBC build
+ directory.
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch b/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch
index df93094543..9b76cfd3b8 100644
--- a/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch
+++ b/meta/recipes-core/glibc/glibc/0020-eglibc-Help-bootstrap-cross-toolchain.patch
@@ -1,7 +1,7 @@
-From 8fe0d29488b376011cdaaa462d557ffc0b31fb63 Mon Sep 17 00:00:00 2001
+From 7856684f76c100155cad11b5b236fb31234b6e28 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:49:28 +0000
-Subject: [PATCH 20/27] eglibc: Help bootstrap cross toolchain
+Subject: [PATCH] eglibc: Help bootstrap cross toolchain
Taken from EGLIBC, r1484 + r1525
@@ -29,10 +29,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
create mode 100644 include/stubs-bootstrap.h
diff --git a/Makefile b/Makefile
-index f906391..e4e149e 100644
+index f98d5a9e67..c36d04da0f 100644
--- a/Makefile
+++ b/Makefile
-@@ -69,9 +69,18 @@ subdir-dirs = include
+@@ -79,9 +79,18 @@ subdir-dirs = include
vpath %.h $(subdir-dirs)
# What to install.
@@ -52,7 +52,7 @@ index f906391..e4e149e 100644
ifeq (yes,$(build-shared))
headers += gnu/lib-names.h
endif
-@@ -151,6 +160,16 @@ others: $(common-objpfx)testrun.sh
+@@ -415,6 +424,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
@@ -69,7 +69,7 @@ index f906391..e4e149e 100644
ifndef abi-variants
installed-stubs = $(inst_includedir)/gnu/stubs.h
else
-@@ -177,6 +196,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
+@@ -441,6 +460,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
install-others-nosubdir: $(installed-stubs)
endif
@@ -79,7 +79,7 @@ index f906391..e4e149e 100644
# Since stubs.h is never needed when building the library, we simplify the
diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h
new file mode 100644
-index 0000000..1d2b669
+index 0000000000..1d2b669aff
--- /dev/null
+++ b/include/stubs-bootstrap.h
@@ -0,0 +1,12 @@
@@ -95,6 +95,3 @@ index 0000000..1d2b669
+ difficult headers. The <gnu/stubs.h> header depends, via the
+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
+ an empty stubs.h like this will do fine for GCC. */
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch
index 9f3d753d70..74c8c10661 100644
--- a/meta/recipes-core/glibc/glibc/0023-eglibc-Resolve-__fpscr_values-on-SH4.patch
+++ b/meta/recipes-core/glibc/glibc/0021-eglibc-Resolve-__fpscr_values-on-SH4.patch
@@ -1,7 +1,7 @@
-From 718e7e5db1c8b073adb9a79ec6f167238c2d8bda Mon Sep 17 00:00:00 2001
+From 111ab95a85314d1e70fb159a14250354cc69d899 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:55:53 +0000
-Subject: [PATCH 23/27] eglibc: Resolve __fpscr_values on SH4
+Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4
2010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Andrew Stubbs <ams@codesourcery.com>
@@ -21,10 +21,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 12 insertions(+)
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
-index e0938c4..ca1d7da 100644
+index 9c734ff755..974e33b4b1 100644
--- a/sysdeps/unix/sysv/linux/sh/Versions
+++ b/sysdeps/unix/sysv/linux/sh/Versions
-@@ -2,6 +2,7 @@ libc {
+@@ -3,6 +3,7 @@ libc {
GLIBC_2.2 {
# functions used in other libraries
__xstat64; __fxstat64; __lxstat64;
@@ -33,7 +33,7 @@ index e0938c4..ca1d7da 100644
# a*
alphasort64;
diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S
-index a02b7e2..b9be326 100644
+index a18fbb2e8b..59421bfbb0 100644
--- a/sysdeps/unix/sysv/linux/sh/sysdep.S
+++ b/sysdeps/unix/sysv/linux/sh/sysdep.S
@@ -30,3 +30,14 @@ ENTRY (__syscall_error)
@@ -51,6 +51,3 @@ index a02b7e2..b9be326 100644
+ .long 0x80000
+weak_alias (___fpscr_values, __fpscr_values)
+
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch b/meta/recipes-core/glibc/glibc/0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch
deleted file mode 100644
index 38bb8a15e3..0000000000
--- a/meta/recipes-core/glibc/glibc/0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From fe2ae4f877928dd6bff5bac3f15bce4b50d2bd12 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:51:16 +0000
-Subject: [PATCH 21/27] eglibc: cherry-picked from
- http://www.eglibc.org/archives/patches/msg00772.html
-
-It hasn't yet been merged into glibc
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- resolv/res_libc.c | 15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/resolv/res_libc.c b/resolv/res_libc.c
-index ee3fa21..29e2340 100644
---- a/resolv/res_libc.c
-+++ b/resolv/res_libc.c
-@@ -22,12 +22,13 @@
- #include <arpa/nameser.h>
- #include <resolv.h>
- #include <bits/libc-lock.h>
--
-+#include <sys/stat.h>
-
- /* The following bit is copied from res_data.c (where it is #ifdef'ed
- out) since res_init() should go into libc.so but the rest of that
- file should not. */
-
-+__libc_lock_define_initialized (static, lock);
- extern unsigned long long int __res_initstamp attribute_hidden;
- /* We have atomic increment operations on 64-bit platforms. */
- #if __WORDSIZE == 64
-@@ -35,7 +36,6 @@ extern unsigned long long int __res_initstamp attribute_hidden;
- # define atomicincunlock(lock) (void) 0
- # define atomicinc(var) catomic_increment (&(var))
- #else
--__libc_lock_define_initialized (static, lock);
- # define atomicinclock(lock) __libc_lock_lock (lock)
- # define atomicincunlock(lock) __libc_lock_unlock (lock)
- # define atomicinc(var) ++var
-@@ -94,7 +94,18 @@ res_init(void) {
- int
- __res_maybe_init (res_state resp, int preinit)
- {
-+ static time_t last_mtime;
-+ struct stat statbuf;
-+ int ret;
-+
- if (resp->options & RES_INIT) {
-+ ret = stat (_PATH_RESCONF, &statbuf);
-+ __libc_lock_lock (lock);
-+ if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
-+ last_mtime = statbuf.st_mtime;
-+ atomicinc (__res_initstamp);
-+ }
-+ __libc_lock_unlock (lock);
- if (__res_initstamp != resp->_u._ext.initstamp) {
- if (resp->nscount > 0)
- __res_iclose (resp, true);
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
deleted file mode 100644
index 8a4c9c3e89..0000000000
--- a/meta/recipes-core/glibc/glibc/0022-eglibc-Clear-cache-lines-on-ppc8xx.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-From be7273225698074347a71de58006977bb304d7f7 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:53:47 +0000
-Subject: [PATCH 22/27] eglibc: Clear cache lines on ppc8xx
-
-2007-06-13 Nathan Sidwell <nathan@codesourcery.com>
- Mark Shinwell <shinwell@codesourcery.com>
-
- * sysdeps/unix/sysv/linux/powerpc/libc-start.c
- (__libc_start_main): Detect 8xx parts and clear
- __cache_line_size if detected.
- * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
- (DL_PLATFORM_AUXV): Likewise.
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c | 14 +++++++++++++-
- sysdeps/unix/sysv/linux/powerpc/libc-start.c | 15 ++++++++++++++-
- 2 files changed, 27 insertions(+), 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-index c2504ff..d50f1cb 100644
---- a/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-+++ b/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
-@@ -24,9 +24,21 @@ int __cache_line_size attribute_hidden;
- /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found
- verify that the static extern __cache_line_size is defined by checking
- for not NULL. If it is defined then assign the cache block size
-- value to __cache_line_size. */
-+ value to __cache_line_size. This is used by memset to
-+ optimize setting to zero. We have to detect 8xx processors, which
-+ have buggy dcbz implementations that cannot report page faults
-+ correctly. That requires reading SPR, which is a privileged
-+ operation. Fortunately 2.2.18 and later emulates PowerPC mfspr
-+ reads from the PVR register. */
- #define DL_PLATFORM_AUXV \
- case AT_DCACHEBSIZE: \
-+ if (__LINUX_KERNEL_VERSION >= 0x020218) \
-+ { \
-+ unsigned pvr = 0; \
-+ asm ("mfspr %0, 287" : "=r" (pvr)); \
-+ if ((pvr & 0xffff0000) == 0x00500000) \
-+ break; \
-+ } \
- __cache_line_size = av->a_un.a_val; \
- break;
-
-diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-index a9364c7..a3ed1d4 100644
---- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-+++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
-@@ -68,11 +68,24 @@ __libc_start_main (int argc, char **argv,
- rtld_fini = NULL;
- }
-
-- /* Initialize the __cache_line_size variable from the aux vector. */
-+ /* Initialize the __cache_line_size variable from the aux vector.
-+ This is used by memset to optimize setting to zero. We have to
-+ detect 8xx processors, which have buggy dcbz implementations that
-+ cannot report page faults correctly. That requires reading SPR,
-+ which is a privileged operation. Fortunately 2.2.18 and later
-+ emulates PowerPC mfspr reads from the PVR register. */
- for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
- switch (av->a_type)
- {
- case AT_DCACHEBSIZE:
-+ if (__LINUX_KERNEL_VERSION >= 0x020218)
-+ {
-+ unsigned pvr = 0;
-+
-+ asm ("mfspr %0, 287" : "=r" (pvr) :);
-+ if ((pvr & 0xffff0000) == 0x00500000)
-+ break;
-+ }
- __cache_line_size = av->a_un.a_val;
- break;
- }
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch b/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch
new file mode 100644
index 0000000000..a9ff8e92ea
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0022-eglibc-Forward-port-cross-locale-generation-support.patch
@@ -0,0 +1,560 @@
+From 4e5de801a39d66b8bd93d09f5912dcbe5db4ef04 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 18 Mar 2015 01:33:49 +0000
+Subject: [PATCH] eglibc: Forward port cross locale generation support
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/Makefile | 3 +-
+ locale/catnames.c | 46 +++++++++++++++++++++++++++
+ locale/localeinfo.h | 2 +-
+ locale/programs/charmap-dir.c | 6 ++++
+ locale/programs/ld-collate.c | 17 +++++-----
+ locale/programs/ld-ctype.c | 27 ++++++++--------
+ locale/programs/ld-time.c | 31 ++++++++++++------
+ locale/programs/linereader.c | 2 +-
+ locale/programs/localedef.c | 8 +++++
+ locale/programs/locfile.c | 5 ++-
+ locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++--
+ locale/setlocale.c | 29 -----------------
+ 12 files changed, 167 insertions(+), 68 deletions(-)
+ create mode 100644 locale/catnames.c
+
+diff --git a/locale/Makefile b/locale/Makefile
+index b7c60681fa..07c606cde3 100644
+--- a/locale/Makefile
++++ b/locale/Makefile
+@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \
+ bits/types/locale_t.h bits/types/__locale_t.h
+ routines = setlocale findlocale loadlocale loadarchive \
+ localeconv nl_langinfo nl_langinfo_l mb_cur_max \
+- newlocale duplocale freelocale uselocale
++ newlocale duplocale freelocale uselocale \
++ catnames
+ tests = tst-C-locale tst-locname tst-duplocale
+ tests-container = tst-localedef-path-norm
+ categories = ctype messages monetary numeric time paper name \
+diff --git a/locale/catnames.c b/locale/catnames.c
+new file mode 100644
+index 0000000000..538f3f5edb
+--- /dev/null
++++ b/locale/catnames.c
+@@ -0,0 +1,46 @@
++/* Copyright (C) 2006 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include "localeinfo.h"
++
++/* Define an array of category names (also the environment variable names). */
++const struct catnamestr_t _nl_category_names attribute_hidden =
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ category_name,
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ };
++
++const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)),
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ };
++
++/* An array of their lengths, for convenience. */
++const uint8_t _nl_category_name_sizes[] attribute_hidden =
++ {
++#define DEFINE_CATEGORY(category, category_name, items, a) \
++ [category] = sizeof (category_name) - 1,
++#include "categories.def"
++#undef DEFINE_CATEGORY
++ [LC_ALL] = sizeof ("LC_ALL") - 1
++ };
+diff --git a/locale/localeinfo.h b/locale/localeinfo.h
+index 22f9dc1140..fa31b3c5ea 100644
+--- a/locale/localeinfo.h
++++ b/locale/localeinfo.h
+@@ -230,7 +230,7 @@ __libc_tsd_define (extern, locale_t, LOCALE)
+ unused. We can manage this playing some tricks with weak references.
+ But with thread-local locale settings, it becomes quite ungainly unless
+ we can use __thread variables. So only in that case do we attempt this. */
+-#ifndef SHARED
++#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
+ # include <tls.h>
+ # define NL_CURRENT_INDIRECT 1
+ #endif
+diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
+index 4841bfd05d..ffcba1fd79 100644
+--- a/locale/programs/charmap-dir.c
++++ b/locale/programs/charmap-dir.c
+@@ -18,7 +18,9 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <libintl.h>
++#ifndef NO_UNCOMPRESS
+ #include <spawn.h>
++#endif
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir)
+ return closedir (dir);
+ }
+
++#ifndef NO_UNCOMPRESS
+ /* Creates a subprocess decompressing the given pathname, and returns
+ a stream reading its output (the decompressed data). */
+ static
+@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor)
+ }
+ return NULL;
+ }
++#endif
+
+ /* Opens a charmap for reading, given its name (not an alias name). */
+ FILE *
+@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name)
+ if (stream != NULL)
+ return stream;
+
++#ifndef NO_UNCOMPRESS
+ memcpy (p, ".gz", 4);
+ stream = fopen_uncompressed (pathname, "gzip");
+ if (stream != NULL)
+@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name)
+ stream = fopen_uncompressed (pathname, "bzip2");
+ if (stream != NULL)
+ return stream;
++#endif
+
+ return NULL;
+ }
+diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
+index b6406b775d..bfa4adba9c 100644
+--- a/locale/programs/ld-collate.c
++++ b/locale/programs/ld-collate.c
+@@ -349,7 +349,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
+ }
+ if (wcs != NULL)
+ {
+- size_t nwcs = wcslen ((wchar_t *) wcs);
++ size_t nwcs = wcslen_uint32 (wcs);
+ uint32_t zero = 0;
+ /* Handle <U0000> as a single character. */
+ if (nwcs == 0)
+@@ -1775,8 +1775,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
+
+ if ((*eptr)->nwcs == runp->nwcs)
+ {
+- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
+- (wchar_t *) runp->wcs, runp->nwcs);
++ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
+
+ if (c == 0)
+ {
+@@ -2003,9 +2002,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
+ one consecutive entry. */
+ if (runp->wcnext != NULL
+ && runp->nwcs == runp->wcnext->nwcs
+- && wmemcmp ((wchar_t *) runp->wcs,
+- (wchar_t *)runp->wcnext->wcs,
+- runp->nwcs - 1) == 0
++ && wmemcmp_uint32 (runp->wcs,
++ runp->wcnext->wcs,
++ runp->nwcs - 1) == 0
+ && (runp->wcs[runp->nwcs - 1]
+ == runp->wcnext->wcs[runp->nwcs - 1] + 1))
+ {
+@@ -2029,9 +2028,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
+ runp = runp->wcnext;
+ while (runp->wcnext != NULL
+ && runp->nwcs == runp->wcnext->nwcs
+- && wmemcmp ((wchar_t *) runp->wcs,
+- (wchar_t *)runp->wcnext->wcs,
+- runp->nwcs - 1) == 0
++ && wmemcmp_uint32 (runp->wcs,
++ runp->wcnext->wcs,
++ runp->nwcs - 1) == 0
+ && (runp->wcs[runp->nwcs - 1]
+ == runp->wcnext->wcs[runp->nwcs - 1] + 1));
+
+diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
+index 2fb579bbbf..d0be99581c 100644
+--- a/locale/programs/ld-ctype.c
++++ b/locale/programs/ld-ctype.c
+@@ -915,7 +915,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
+ allocate_arrays (ctype, charmap, ctype->repertoire);
+
+ default_missing_len = (ctype->default_missing
+- ? wcslen ((wchar_t *) ctype->default_missing)
++ ? wcslen_uint32 (ctype->default_missing)
+ : 0);
+
+ init_locale_data (&file, nelems);
+@@ -1927,7 +1927,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
+ ignore = 1;
+ else
+ /* This value is usable. */
+- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
++ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
+
+ first = 0;
+ }
+@@ -2461,8 +2461,8 @@ with character code range values one must use the absolute ellipsis `...'"));
+ }
+
+ handle_tok_digit:
+- class_bit = _ISwdigit;
+- class256_bit = _ISdigit;
++ class_bit = BITw (tok_digit);
++ class256_bit = BIT (tok_digit);
+ handle_digits = 1;
+ goto read_charclass;
+
+@@ -3904,8 +3904,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+
+ while (idx < number)
+ {
+- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
+- (const wchar_t *) runp->from);
++ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
+ if (res == 0)
+ {
+ replace = 1;
+@@ -3942,11 +3941,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+ for (size_t cnt = 0; cnt < number; ++cnt)
+ {
+ struct translit_to_t *srunp;
+- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
++ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
+ srunp = sorted[cnt]->to;
+ while (srunp != NULL)
+ {
+- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
++ to_len += wcslen_uint32 (srunp->str) + 1;
+ srunp = srunp->next;
+ }
+ /* Plus one for the extra NUL character marking the end of
+@@ -3970,18 +3969,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
+ ctype->translit_from_idx[cnt] = from_len;
+ ctype->translit_to_idx[cnt] = to_len;
+
+- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
+- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
+- (const wchar_t *) sorted[cnt]->from, len);
++ len = wcslen_uint32 (sorted[cnt]->from) + 1;
++ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
++ sorted[cnt]->from, len);
+ from_len += len;
+
+ ctype->translit_to_idx[cnt] = to_len;
+ srunp = sorted[cnt]->to;
+ while (srunp != NULL)
+ {
+- len = wcslen ((const wchar_t *) srunp->str) + 1;
+- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
+- (const wchar_t *) srunp->str, len);
++ len = wcslen_uint32 (srunp->str) + 1;
++ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
++ srunp->str, len);
+ to_len += len;
+ srunp = srunp->next;
+ }
+diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
+index dcd2a2386d..6814740325 100644
+--- a/locale/programs/ld-time.c
++++ b/locale/programs/ld-time.c
+@@ -220,8 +220,10 @@ No definition for %s category found"), "LC_TIME");
+ }
+ else
+ {
++ static const uint32_t wt_fmt_ampm[]
++ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
+ time->t_fmt_ampm = "%I:%M:%S %p";
+- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
++ time->wt_fmt_ampm = wt_fmt_ampm;
+ }
+ }
+
+@@ -231,7 +233,7 @@ No definition for %s category found"), "LC_TIME");
+ const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
+ 31, 31, 30, 31 ,30, 31 };
+ size_t idx;
+- wchar_t *wstr;
++ uint32_t *wstr;
+
+ time->era_entries =
+ (struct era_data *) xmalloc (time->num_era
+@@ -457,18 +459,18 @@ No definition for %s category found"), "LC_TIME");
+ }
+
+ /* Now generate the wide character name and format. */
+- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
+- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
++ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
+ if (wstr != NULL)
+ {
+- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
+- wstr = wcschr (wstr + 1, L':'); /* end name */
++ time->era_entries[idx].wname = wstr + 1;
++ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
+ if (wstr != NULL)
+ {
+ *wstr = L'\0';
+- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
++ time->era_entries[idx].wformat = wstr + 1;
+ }
+ else
+ time->era_entries[idx].wname =
+@@ -527,7 +529,16 @@ No definition for %s category found"), "LC_TIME");
+ if (time->date_fmt == NULL)
+ time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
+ if (time->wdate_fmt == NULL)
+- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
++ {
++ static const uint32_t wdate_fmt[] =
++ { '%','a',' ',
++ '%','b',' ',
++ '%','e',' ',
++ '%','H',':','%','M',':','%','S',' ',
++ '%','Z',' ',
++ '%','Y',0 };
++ time->wdate_fmt = wdate_fmt;
++ }
+ }
+
+
+diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
+index 96d3ab66db..3af379d2c3 100644
+--- a/locale/programs/linereader.c
++++ b/locale/programs/linereader.c
+@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
+ {
+ int return_widestr = lr->return_widestr;
+ char *buf;
+- wchar_t *buf2 = NULL;
++ uint32_t *buf2 = NULL;
+ size_t bufact;
+ size_t bufmax = 56;
+
+diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
+index 832c8fd1fc..fe689b3ae1 100644
+--- a/locale/programs/localedef.c
++++ b/locale/programs/localedef.c
+@@ -109,6 +109,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+ #define OPT_NO_WARN 402
+ #define OPT_WARN 403
+ #define OPT_NO_HARD_LINKS 404
++#define OPT_UINT32_ALIGN 405
+
+ /* Definitions of arguments for argp functions. */
+ static const struct argp_option options[] =
+@@ -153,6 +154,8 @@ static const struct argp_option options[] =
+ N_("Generate little-endian output") },
+ { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
+ N_("Generate big-endian output") },
++ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
++ N_("Set the target's uint32_t alignment in bytes (default 4)") },
+ { NULL, 0, NULL, 0, NULL }
+ };
+
+@@ -243,12 +246,14 @@ main (int argc, char *argv[])
+ ctype locale. (P1003.2 4.35.5.2) */
+ setlocale (LC_CTYPE, "POSIX");
+
++#ifndef NO_SYSCONF
+ /* Look whether the system really allows locale definitions. POSIX
+ defines error code 3 for this situation so I think it must be
+ a fatal error (see P1003.2 4.35.8). */
+ if (sysconf (_SC_2_LOCALEDEF) < 0)
+ record_error (3, 0, _("\
+ FATAL: system does not define `_POSIX2_LOCALEDEF'"));
++#endif
+
+ /* Process charmap file. */
+ charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
+@@ -400,6 +405,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
+ /* Do not hard link to other locales. */
+ hard_links = false;
+ break;
++ case OPT_UINT32_ALIGN:
++ uint32_align_mask = strtol (arg, NULL, 0) - 1;
++ break;
+ case 'c':
+ force_output = 1;
+ break;
+diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
+index 0f1affa1d4..7d86fae801 100644
+--- a/locale/programs/locfile.c
++++ b/locale/programs/locfile.c
+@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
+ machine running localedef. */
+ bool swap_endianness_p;
+
++/* The target's value of __align__(uint32_t) - 1. */
++unsigned int uint32_align_mask = 3;
++
+ /* When called outside a start_locale_structure/end_locale_structure
+ or start_locale_prelude/end_locale_prelude block, record that the
+ next byte in FILE's obstack will be the first byte of a new element.
+@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string)
+ void
+ add_locale_wstring (struct locale_file *file, const uint32_t *string)
+ {
+- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
++ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
+ }
+
+ /* Record that FILE's next element is the 32-bit integer VALUE. */
+diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
+index c986d599ec..222a779176 100644
+--- a/locale/programs/locfile.h
++++ b/locale/programs/locfile.h
+@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions,
+
+ extern bool swap_endianness_p;
+
++extern unsigned int uint32_align_mask;
++
+ /* Change the output to be big-endian if BIG_ENDIAN is true and
+ little-endian otherwise. */
+ static inline void
+@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value)
+ }
+
+ /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
+-static inline void
++static void
++__attribute__ ((unused))
+ maybe_swap_uint32_array (uint32_t *array, size_t n)
+ {
+ if (swap_endianness_p)
+@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
+
+ /* Like maybe_swap_uint32_array, but the array of N elements is at
+ the end of OBSTACK's current object. */
+-static inline void
++static void
++__attribute__ ((unused))
+ maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
+ {
+ maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
+@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale,
+ const struct charmap_t *charmap,
+ const char *output_path);
+
++static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused));
++static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
++static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused));
++static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused));
++static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
++
++static size_t
++wcslen_uint32 (const uint32_t *str)
++{
++ size_t len = 0;
++ while (str[len] != 0)
++ len++;
++ return len;
++}
++
++static int
++wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
++{
++ while (n-- != 0)
++ {
++ int diff = *s1++ - *s2++;
++ if (diff != 0)
++ return diff;
++ }
++ return 0;
++}
++
++static int
++wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
++{
++ while (*s1 != 0 && *s1 == *s2)
++ s1++, s2++;
++ return *s1 - *s2;
++}
++
++static uint32_t *
++wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
++{
++ return memcpy (s1, s2, n * sizeof (uint32_t));
++}
++
++static uint32_t *
++wcschr_uint32 (const uint32_t *s, uint32_t ch)
++{
++ do
++ if (*s == ch)
++ return (uint32_t *) s;
++ while (*s++ != 0);
++ return 0;
++}
++
+ #endif /* locfile.h */
+diff --git a/locale/setlocale.c b/locale/setlocale.c
+index 19ed85ae8e..f28ca11446 100644
+--- a/locale/setlocale.c
++++ b/locale/setlocale.c
+@@ -63,35 +63,6 @@ static char *const _nl_current_used[] =
+
+ #endif
+
+-
+-/* Define an array of category names (also the environment variable names). */
+-const struct catnamestr_t _nl_category_names attribute_hidden =
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- category_name,
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- };
+-
+-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)),
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- };
+-
+-/* An array of their lengths, for convenience. */
+-const uint8_t _nl_category_name_sizes[] attribute_hidden =
+- {
+-#define DEFINE_CATEGORY(category, category_name, items, a) \
+- [category] = sizeof (category_name) - 1,
+-#include "categories.def"
+-#undef DEFINE_CATEGORY
+- [LC_ALL] = sizeof ("LC_ALL") - 1
+- };
+-
+-
+ #ifdef NL_CURRENT_INDIRECT
+ # define WEAK_POSTLOAD(postload) weak_extern (postload)
+ #else
diff --git a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-eglibc-options-groups-support.patch b/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-eglibc-options-groups-support.patch
deleted file mode 100644
index 0514e282e6..0000000000
--- a/meta/recipes-core/glibc/glibc/0024-eglibc-Forward-port-eglibc-options-groups-support.patch
+++ /dev/null
@@ -1,16842 +0,0 @@
-From 2a5d7bcf0ff791c95ee1388772408a1bf4454694 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 01:33:49 +0000
-Subject: [PATCH 24/27] eglibc: Forward port eglibc options groups support
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makeconfig | 20 +-
- Makerules | 19 +
- argp/Makefile | 2 +
- argp/argp-fmtstream.c | 25 +-
- argp/argp-help.c | 13 +-
- argp/argp-namefrob.h | 2 +
- catgets/Makefile | 17 +-
- crypt/Makefile | 20 +-
- crypt/crypt-entry.c | 13 +
- crypt/crypt_common.c | 42 +
- crypt/crypt_util.c | 18 -
- csu/Makefile | 2 +
- debug/Makefile | 41 +-
- debug/segfault.c | 11 +-
- debug/tst-chk1.c | 7 +
- dlfcn/Makefile | 7 +-
- elf/dl-support.c | 3 +
- elf/rtld.c | 17 +-
- extra-lib.mk | 6 +-
- grp/Makefile | 5 +
- hesiod/Makefile | 6 +-
- iconv/Makefile | 7 +
- iconv/gconv_db.c | 3 +
- iconv/gconv_trans.c | 7 +
- iconv/iconv_prog.c | 8 +
- iconvdata/Makefile | 27 +-
- include/netdb.h | 4 +
- inet/Makefile | 22 +-
- intl/Makefile | 3 +-
- intl/dcigettext.c | 39 +-
- io/Makefile | 18 +-
- libidn/Makefile | 5 +-
- libidn/toutf8.c | 11 +-
- libio/Makefile | 66 +-
- libio/__fpurge.c | 2 +-
- libio/fileops.c | 10 +-
- libio/iofwide.c | 26 +
- libio/ioseekoff.c | 2 +-
- libio/ioseekpos.c | 2 +-
- libio/iosetbuffer.c | 4 +
- libio/libioP.h | 18 +-
- libio/wdummyfileops.c | 161 +
- locale/C-ctype.c | 20 +
- locale/Makefile | 41 +-
- locale/catnames.c | 48 +
- locale/dummy-setlocale.c | 33 +
- locale/localeinfo.h | 2 +-
- locale/programs/charmap-dir.c | 6 +
- locale/programs/ld-collate.c | 17 +-
- locale/programs/ld-ctype.c | 27 +-
- locale/programs/ld-messages.c | 5 +
- locale/programs/ld-time.c | 31 +-
- locale/programs/linereader.c | 2 +-
- locale/programs/localedef.c | 8 +
- locale/programs/locfile.c | 5 +-
- locale/programs/locfile.h | 59 +-
- locale/setlocale.c | 30 -
- locale/xlocale.c | 37 +
- localedata/Makefile | 35 +-
- login/Makefile | 17 +-
- malloc/Makefile | 10 +-
- malloc/memusage.c | 7 +-
- malloc/memusage.sh | 2 +-
- math/Makefile | 6 +-
- misc/Makefile | 25 +-
- misc/err.c | 11 +
- misc/error.c | 5 +
- misc/tst-efgcvt.c | 2 +-
- nis/Makefile | 31 +-
- nptl/Makefile | 28 +-
- nptl/pthread_create.c | 5 +
- nscd/Makefile | 33 +-
- nscd/nis_hash.c | 3 +
- nss/Makefile | 67 +-
- nss/fixed-nsswitch.conf | 22 +
- nss/fixed-nsswitch.functions | 121 +
- nss/gen-fixed-nsswitch.c | 803 +++
- nss/getent.c | 46 +-
- nss/getnssent_r.c | 9 +-
- nss/nsswitch.c | 109 +-
- nss/nsswitch.h | 18 +-
- posix/Makefile | 94 +-
- posix/bug-regex1.c | 3 +
- posix/bug-regex6.c | 8 +-
- posix/fnmatch.c | 6 +-
- posix/fnmatch_loop.c | 23 +-
- posix/glob.c | 15 +-
- posix/regcomp.c | 98 +-
- posix/regex.h | 11 +
- posix/regex_internal.c | 45 +-
- posix/regex_internal.h | 23 +-
- posix/regexec-compat.c | 39 +
- posix/regexec.c | 71 +-
- posix/xregex.c | 8215 +++++++++++++++++++++++++++++++
- pwd/Makefile | 2 +
- resolv/Makefile | 21 +-
- stdio-common/Makefile | 35 +-
- stdio-common/_i18n_number.h | 13 +
- stdio-common/fxprintf.c | 5 +
- stdio-common/printf_fp.c | 22 +
- stdio-common/printf_fphex.c | 13 +
- stdio-common/printf_size.c | 8 +
- stdio-common/scanf14.c | 3 +
- stdio-common/tst-popen.c | 3 +
- stdio-common/tst-sprintf.c | 4 +-
- stdio-common/tstdiomisc.c | 5 +
- stdio-common/vfprintf.c | 31 +-
- stdio-common/vfscanf.c | 53 +-
- stdlib/Makefile | 34 +-
- stdlib/strtod_l.c | 13 +
- stdlib/tst-strtod.c | 5 +
- streams/Makefile | 5 +-
- string/Makefile | 14 +-
- string/strcoll_l.c | 5 +
- string/strerror_l.c | 5 +
- string/strxfrm_l.c | 5 +
- string/test-strcmp.c | 28 -
- string/tst-strxfrm.c | 3 +
- string/tst-strxfrm2.c | 3 +
- sunrpc/Makefile | 44 +-
- sysdeps/arm/Makefile | 5 +-
- sysdeps/generic/ldsodefs.h | 8 +
- sysdeps/gnu/Makefile | 3 +-
- sysdeps/ieee754/ldbl-opt/Makefile | 27 +-
- sysdeps/ieee754/ldbl-opt/nldbl-compat.c | 40 +-
- sysdeps/ieee754/ldbl-opt/nldbl-compat.h | 24 +-
- sysdeps/nptl/Makefile | 3 +
- sysdeps/nptl/bits/libc-lock.h | 45 +
- sysdeps/nptl/bits/libc-lockP.h | 50 +-
- sysdeps/nptl/small-macros-fns.c | 72 +
- sysdeps/unix/sysv/linux/gethostid.c | 6 +
- sysdeps/unix/sysv/linux/libc_fatal.c | 3 +
- time/Makefile | 18 +-
- time/strftime_l.c | 12 +-
- time/strptime_l.c | 14 +-
- timezone/Makefile | 2 +-
- wcsmbs/Makefile | 27 +-
- wcsmbs/wcsmbsload.c | 13 +
- wctype/Makefile | 14 +-
- 139 files changed, 11363 insertions(+), 583 deletions(-)
- create mode 100644 crypt/crypt_common.c
- create mode 100644 libio/wdummyfileops.c
- create mode 100644 locale/catnames.c
- create mode 100644 locale/dummy-setlocale.c
- create mode 100644 nscd/nis_hash.c
- create mode 100644 nss/fixed-nsswitch.conf
- create mode 100644 nss/fixed-nsswitch.functions
- create mode 100644 nss/gen-fixed-nsswitch.c
- create mode 100644 posix/regexec-compat.c
- create mode 100644 posix/xregex.c
- create mode 100644 sysdeps/nptl/small-macros-fns.c
-
-diff --git a/Makeconfig b/Makeconfig
-index f136b88..52dae8f 100644
---- a/Makeconfig
-+++ b/Makeconfig
-@@ -609,7 +609,7 @@ elf-objpfx = $(common-objpfx)elf/
- # and run on the build system, causes that program with those
- # arguments to be run on the host for which the library is built.
- ifndef test-wrapper
--test-wrapper =
-+test-wrapper = $(cross-test-wrapper)
- endif
- # Likewise, but the name of the program is preceded by
- # <variable>=<value> assignments for environment variables.
-@@ -1089,6 +1089,24 @@ libm = $(common-objpfx)math/libm.a
- libmvec = $(common-objpfx)mathvec/libmvec.a
- endif
-
-+# Generate a header file that #defines preprocessor symbols indicating
-+# which option groups are enabled. Note that the option-groups.config file
-+# may not exist at all.
-+before-compile += $(common-objpfx)gnu/option-groups.h
-+common-generated += gnu/option-groups.h gnu/option-groups.stmp
-+headers += gnu/option-groups.h
-+$(common-objpfx)gnu/option-groups.h: $(common-objpfx)gnu/option-groups.stmp; @:
-+$(common-objpfx)gnu/option-groups.stmp: \
-+ $(..)scripts/option-groups.awk \
-+ $(..)option-groups.defaults \
-+ $(wildcard $(common-objpfx)option-groups.config)
-+ $(make-target-directory)
-+ @rm -f ${@:stmp=T} $@
-+ LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
-+ $(move-if-change) ${@:stmp=T} ${@:stmp=h}
-+ touch $@
-+
-+
- # These are the subdirectories containing the library source. The order
- # is more or less arbitrary. The sorting step will take care of the
- # dependencies.
-diff --git a/Makerules b/Makerules
-index f9ca3f5..1dd41aa 100644
---- a/Makerules
-+++ b/Makerules
-@@ -456,6 +456,25 @@ define sed-remove-objpfx
- endef
- endif
-
-+# Include targets in the selected option groups.
-+aux += $(aux-y)
-+extra-libs += $(extra-libs-y)
-+extra-libs-others += $(extra-libs-others-y)
-+extra-objs += $(extra-objs-y)
-+install-bin += $(install-bin-y)
-+install-others += $(install-others-y)
-+install-sbin += $(install-sbin-y)
-+modules += $(modules-y)
-+others += $(others-y)
-+others-pie += $(others-pie-y)
-+routines += $(routines-y)
-+static-only-routines += $(static-only-routines-y)
-+sysdep_routines += $(sysdep_routines-y)
-+test-srcs += $(test-srcs-y)
-+tests += $(tests-y)
-+xtests += $(xtests-y)
-+
-+
- # Modify the list of routines we build for different targets
-
- ifeq (yes,$(build-shared))
-diff --git a/argp/Makefile b/argp/Makefile
-index 1a87629..f7c1e40 100644
---- a/argp/Makefile
-+++ b/argp/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for argp.
- #
-+include ../option-groups.mak
-+
- subdir := argp
-
- include ../Makeconfig
-diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c
-index 2b845e0..c344e7b 100644
---- a/argp/argp-fmtstream.c
-+++ b/argp/argp-fmtstream.c
-@@ -42,6 +42,7 @@
- #ifdef _LIBC
- # include <wchar.h>
- # include <libio/libioP.h>
-+# include <gnu/option-groups.h>
- # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
- #endif
-
-@@ -100,7 +101,11 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
- __argp_fmtstream_update (fs);
- if (fs->p > fs->buf)
- {
-+#ifdef _LIBC
- __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-+#else
-+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
-+#endif
- }
- free (fs->buf);
- free (fs);
-@@ -145,9 +150,17 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
- size_t i;
- for (i = 0; i < pad; i++)
- {
-+#ifdef _LIBC
- if (_IO_fwide (fs->stream, 0) > 0)
-- putwc_unlocked (L' ', fs->stream);
-+ {
-+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+ putwc_unlocked (L' ', fs->stream);
-+#else
-+ abort ();
-+#endif
-+ }
- else
-+#endif
- putc_unlocked (' ', fs->stream);
- }
- }
-@@ -308,9 +321,17 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
- *nl++ = ' ';
- else
- for (i = 0; i < fs->wmargin; ++i)
-+#ifdef _LIBC
- if (_IO_fwide (fs->stream, 0) > 0)
-- putwc_unlocked (L' ', fs->stream);
-+ {
-+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+ putwc_unlocked (L' ', fs->stream);
-+#else
-+ abort ();
-+#endif
-+ }
- else
-+#endif
- putc_unlocked (' ', fs->stream);
-
- /* Copy the tail of the original buffer into the current buffer
-diff --git a/argp/argp-help.c b/argp/argp-help.c
-index b055e45..6b3c4c1 100644
---- a/argp/argp-help.c
-+++ b/argp/argp-help.c
-@@ -51,6 +51,7 @@ char *alloca ();
- #ifdef _LIBC
- # include <../libio/libioP.h>
- # include <wchar.h>
-+# include <gnu/option-groups.h>
- #endif
-
- #ifndef _
-@@ -1702,7 +1703,7 @@ char *__argp_basename (char *name)
- }
-
- char *
--__argp_short_program_name (void)
-+(__argp_short_program_name) (void)
- {
- # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
- return program_invocation_short_name;
-@@ -1873,9 +1874,17 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
- #endif
- }
-
-+#ifdef _LIBC
- if (_IO_fwide (stream, 0) > 0)
-- putwc_unlocked (L'\n', stream);
-+ {
-+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+ putwc_unlocked (L'\n', stream);
-+#else
-+ abort ();
-+#endif
-+ }
- else
-+#endif
- putc_unlocked ('\n', stream);
-
- #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-diff --git a/argp/argp-namefrob.h b/argp/argp-namefrob.h
-index f67c58f..e2002dc 100644
---- a/argp/argp-namefrob.h
-+++ b/argp/argp-namefrob.h
-@@ -76,10 +76,12 @@
- #undef __argp_fmtstream_wmargin
- #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
-
-+#if 0
- #include "mempcpy.h"
- #include "strcase.h"
- #include "strchrnul.h"
- #include "strndup.h"
-+#endif
-
- /* normal libc functions we call */
- #undef __flockfile
-diff --git a/catgets/Makefile b/catgets/Makefile
-index 4624a88..05714fd 100644
---- a/catgets/Makefile
-+++ b/catgets/Makefile
-@@ -22,20 +22,23 @@ subdir := catgets
-
- include ../Makeconfig
-
-+include ../option-groups.mak
-+
- headers = nl_types.h
--routines = catgets open_catalog
--others = gencat
--install-bin = gencat
--extra-objs = $(gencat-modules:=.o)
-+routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog
-+others-$(OPTION_EGLIBC_CATGETS) := gencat
-+install-bin-$(OPTION_EGLIBC_CATGETS) := gencat
-+extra-objs-$(OPTION_EGLIBC_CATGETS) := $(gencat-modules:=.o)
-
--tests = tst-catgets
--test-srcs = test-gencat
-+tests-$(OPTION_EGLIBC_CATGETS) := tst-catgets
-+test-srcs-$(OPTION_EGLIBC_CATGETS) := test-gencat
-
-+ifeq (y,$(OPTION_EGLIBC_CATGETS))
- ifeq ($(run-built-tests),yes)
- tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
- $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
- endif
--
-+endif
- gencat-modules = xmalloc
-
- # To find xmalloc.c
-diff --git a/crypt/Makefile b/crypt/Makefile
-index 34c4dd7..7c18c88 100644
---- a/crypt/Makefile
-+++ b/crypt/Makefile
-@@ -18,21 +18,25 @@
- #
- # Sub-makefile for crypt() portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := crypt
-
- include ../Makeconfig
-
- headers := crypt.h
-
--extra-libs := libcrypt
--extra-libs-others := $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_CRYPT) := libcrypt
-+extra-libs-others-y := $(extra-libs-y)
-
--libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
-- crypt_util
-+libcrypt-routines :=crypt-entry md5-crypt sha256-crypt sha512-crypt crypt_common
-+libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt crypt_util
-+libcrypt-routines += $(libcrypt-routines-y)
-
--tests := cert md5c-test sha256c-test sha512c-test badsalttest
-+tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test badsalttest
-+tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
-
--ifeq ($(crypt-in-libc),yes)
-+ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy)
- routines += $(libcrypt-routines)
- endif
-
-@@ -44,7 +48,7 @@ LDLIBS-crypt.so = -lfreebl3
- else
- libcrypt-routines += md5 sha256 sha512
-
--tests += md5test sha256test sha512test
-+tests-$(OPTION_EGLIBC_CRYPT) += md5test sha256test sha512test
-
- # The test md5test-giant uses up to 400 MB of RSS and runs on a fast
- # machine over a minute.
-@@ -64,8 +68,10 @@ $(objpfx)sha256test: $(patsubst %, $(objpfx)%.o,$(sha256-routines))
- $(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
- endif
-
-+ifeq ($(OPTION_EGLIBC_CRYPT),y)
- ifeq (yes,$(build-shared))
- $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
- else
- $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
- endif
-+endif # eglibc: OPTION_EGLIBC_CRYPT
-diff --git a/crypt/crypt-entry.c b/crypt/crypt-entry.c
-index 7e655ba..6ae5c2b 100644
---- a/crypt/crypt-entry.c
-+++ b/crypt/crypt-entry.c
-@@ -27,6 +27,7 @@
- #include <stdio.h>
- #endif
- #include <string.h>
-+#include <gnu/option-groups.h>
- #include <errno.h>
- #include <fips-private.h>
-
-@@ -76,9 +77,11 @@ __crypt_r (key, salt, data)
- const char *salt;
- struct crypt_data * __restrict data;
- {
-+#if __OPTION_EGLIBC_CRYPT_UFC
- ufc_long res[4];
- char ktab[9];
- ufc_long xx = 25; /* to cope with GCC long long compiler bugs */
-+#endif /*__OPTION_EGLIBC_CRYPT_UFC*/
-
- #ifdef _LIBC
- /* Try to find out whether we have to use MD5 encryption replacement. */
-@@ -105,6 +108,7 @@ __crypt_r (key, salt, data)
- sizeof (struct crypt_data));
- #endif
-
-+#if __OPTION_EGLIBC_CRYPT_UFC
- /*
- * Hack DES tables according to salt
- */
-@@ -144,6 +148,10 @@ __crypt_r (key, salt, data)
- */
- _ufc_output_conversion_r (res[0], res[1], salt, data);
- return data->crypt_3_buf;
-+#else /* __OPTION_EGLIBC_CRYPT_UFC */
-+ __set_errno (ENOSYS);
-+ return NULL;
-+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
- }
- weak_alias (__crypt_r, crypt_r)
-
-@@ -168,7 +176,12 @@ crypt (key, salt)
- return __sha512_crypt (key, salt);
- #endif
-
-+#if __OPTION_EGLIBC_CRYPT_UFC
- return __crypt_r (key, salt, &_ufc_foobar);
-+#else /* __OPTION_EGLIBC_CRYPT_UFC */
-+ __set_errno (ENOSYS);
-+ return NULL;
-+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
- }
-
-
-diff --git a/crypt/crypt_common.c b/crypt/crypt_common.c
-new file mode 100644
-index 0000000..cce6a31
---- /dev/null
-+++ b/crypt/crypt_common.c
-@@ -0,0 +1,42 @@
-+/*
-+ * crypt: crypt(3) implementation
-+ *
-+ * Copyright (C) 1991-2014 Free Software Foundation, Inc.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Lesser General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2.1 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Lesser General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Lesser General Public
-+ * License along with this library; see the file COPYING.LIB. If not,
-+ * see <http://www.gnu.org/licenses/>.
-+ *
-+ * General Support routines
-+ *
-+ */
-+
-+#include "crypt-private.h"
-+
-+/* Table with characters for base64 transformation. */
-+static const char b64t[64] =
-+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-+
-+void
-+__b64_from_24bit (char **cp, int *buflen,
-+ unsigned int b2, unsigned int b1, unsigned int b0,
-+ int n)
-+{
-+ unsigned int w = (b2 << 16) | (b1 << 8) | b0;
-+ while (n-- > 0 && (*buflen) > 0)
-+ {
-+ *(*cp)++ = b64t[w & 0x3f];
-+ --(*buflen);
-+ w >>= 6;
-+ }
-+}
-diff --git a/crypt/crypt_util.c b/crypt/crypt_util.c
-index 1597885..9297974 100644
---- a/crypt/crypt_util.c
-+++ b/crypt/crypt_util.c
-@@ -242,10 +242,6 @@ static ufc_long eperm32tab[4][256][2];
- */
- static ufc_long efp[16][64][2];
-
--/* Table with characters for base64 transformation. */
--static const char b64t[64] =
--"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
--
- /*
- * For use by the old, non-reentrant routines
- * (crypt/encrypt/setkey)
-@@ -949,17 +945,3 @@ setkey(__key)
- {
- __setkey_r(__key, &_ufc_foobar);
- }
--
--void
--__b64_from_24bit (char **cp, int *buflen,
-- unsigned int b2, unsigned int b1, unsigned int b0,
-- int n)
--{
-- unsigned int w = (b2 << 16) | (b1 << 8) | b0;
-- while (n-- > 0 && (*buflen) > 0)
-- {
-- *(*cp)++ = b64t[w & 0x3f];
-- --(*buflen);
-- w >>= 6;
-- }
--}
-diff --git a/csu/Makefile b/csu/Makefile
-index 9f0855a..b1c3363 100644
---- a/csu/Makefile
-+++ b/csu/Makefile
-@@ -22,6 +22,8 @@
- # crtn.o, special "initializer" and "finalizer" files used in the link
- # to make the .init and .fini sections work right.
-
-+include ../option-groups.mak
-+
- subdir := csu
-
- include ../Makeconfig
-diff --git a/debug/Makefile b/debug/Makefile
-index 9ff357b..d23d97d 100644
---- a/debug/Makefile
-+++ b/debug/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for debug portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := debug
-
- include ../Makeconfig
-@@ -27,7 +29,7 @@ headers := execinfo.h
- # Note that ptsname_r_chk and getlogin_r are not here, but in
- # login/Makefile instead. If that subdir is omitted from the
- # build, its _FORTIFY_SOURCE support will be too.
--routines = backtrace backtracesyms backtracesymsfd noophooks \
-+routines = noophooks \
- memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
- strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
- sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
-@@ -36,20 +38,27 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \
- read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
- readlink_chk readlinkat_chk getwd_chk getcwd_chk \
- realpath_chk fread_chk fread_u_chk \
-- wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
-- wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
-- wcpncpy_chk \
-- swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
-- vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
- confstr_chk getgroups_chk ttyname_r_chk \
-- gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
-- wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
-- wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
-+ gethostname_chk getdomainname_chk \
-+ asprintf_chk vasprintf_chk dprintf_chk \
- vdprintf_chk obprintf_chk \
- longjmp_chk ____longjmp_chk \
- fdelt_chk poll_chk ppoll_chk \
- stack_chk_fail fortify_fail \
- $(static-only-routines)
-+routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd
-+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-+ += wprintf_chk fwprintf_chk \
-+ vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
-+ wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
-+ wcpncpy_chk \
-+ swprintf_chk vswprintf_chk \
-+ wcrtomb_chk mbsnrtowcs_chk \
-+ wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
-+ wcstombs_chk
-+
- static-only-routines := warning-nop stack_chk_fail_local
-
- CFLAGS-backtrace.c = -fno-omit-frame-pointer
-@@ -131,11 +140,15 @@ LDFLAGS-tst-backtrace4 = -rdynamic
- LDFLAGS-tst-backtrace5 = -rdynamic
- LDFLAGS-tst-backtrace6 = -rdynamic
-
--tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
-- tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
-- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
-- tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
-- tst-backtrace5 tst-backtrace6
-+tests = tst-longjmp_chk test-strcpy_chk test-stpcpy_chk tst-longjmp_chk2
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-chk1 tst-chk2 tst-chk3 tst-lfschk1 tst-lfschk2 tst-lfschk3
-+tests-$(OPTION_EGLIBC_BACKTRACE) \
-+ += backtrace-tst tst-backtrace2 tst-backtrace3 tst-backtrace4 \
-+ tst-backtrace5 tst-backtrace6
-+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_EGLIBC_CXX_TESTS))
-+tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
-+endif
-
- ifeq (,$(CXX))
- tests-unsupported = tst-chk4 tst-chk5 tst-chk6 \
-diff --git a/debug/segfault.c b/debug/segfault.c
-index 3459a2a..ee9a146 100644
---- a/debug/segfault.c
-+++ b/debug/segfault.c
-@@ -30,6 +30,7 @@
- #include <unistd.h>
- #include <_itoa.h>
- #include <ldsodefs.h>
-+#include <gnu/option-groups.h>
-
- /* This file defines macros to access the content of the sigcontext element
- passed up by the signal handler. */
-@@ -68,11 +69,13 @@ write_strsignal (int fd, int signal)
- static void
- catch_segfault (int signal, SIGCONTEXT ctx)
- {
-- int fd, cnt, i;
-- void **arr;
-+ int fd;
- struct sigaction sa;
-+#if __OPTION_EGLIBC_BACKTRACE
-+ int cnt, i;
-+ void **arr;
- uintptr_t pc;
--
-+#endif
- /* This is the name of the file we are writing to. If none is given
- or we cannot write to this file write to stderr. */
- fd = 2;
-@@ -91,6 +94,7 @@ catch_segfault (int signal, SIGCONTEXT ctx)
- REGISTER_DUMP;
- #endif
-
-+#if __OPTION_EGLIBC_BACKTRACE
- WRITE_STRING ("\nBacktrace:\n");
-
- /* Get the backtrace. */
-@@ -113,6 +117,7 @@ catch_segfault (int signal, SIGCONTEXT ctx)
-
- /* Now generate nicely formatted output. */
- __backtrace_symbols_fd (arr + i, cnt - i, fd);
-+#endif
-
- #ifdef HAVE_PROC_SELF
- /* Now the link map. */
-diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
-index 53559e6..362d92a 100644
---- a/debug/tst-chk1.c
-+++ b/debug/tst-chk1.c
-@@ -31,6 +31,7 @@
- #include <sys/select.h>
- #include <sys/socket.h>
- #include <sys/un.h>
-+#include <gnu/option-groups.h>
-
-
- #define obstack_chunk_alloc malloc
-@@ -307,6 +308,7 @@ do_test (void)
- snprintf (buf + 8, l0 + 3, "%d", num2);
- CHK_FAIL_END
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- CHK_FAIL_START
- swprintf (wbuf + 8, 3, L"%d", num1);
- CHK_FAIL_END
-@@ -314,6 +316,7 @@ do_test (void)
- CHK_FAIL_START
- swprintf (wbuf + 8, l0 + 3, L"%d", num1);
- CHK_FAIL_END
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
- # endif
-
- memcpy (buf, str1 + 2, l0 + 9);
-@@ -381,6 +384,7 @@ do_test (void)
- CHK_FAIL_END
- #endif
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
-
- /* These ops can be done without runtime checking of object size. */
- wmemcpy (wbuf, L"abcdefghij", 10);
-@@ -605,6 +609,7 @@ do_test (void)
- CHK_FAIL_END
- #endif
-
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
-
- /* Now checks for %n protection. */
-
-@@ -1192,6 +1197,7 @@ do_test (void)
- # endif
- #endif
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- if (setlocale (LC_ALL, "de_DE.UTF-8") != NULL)
- {
- assert (MB_CUR_MAX <= 10);
-@@ -1348,6 +1354,7 @@ do_test (void)
- puts ("cannot set locale");
- ret = 1;
- }
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
-
- int fd = posix_openpt (O_RDWR);
- if (fd != -1)
-diff --git a/dlfcn/Makefile b/dlfcn/Makefile
-index 759780d..3827607 100644
---- a/dlfcn/Makefile
-+++ b/dlfcn/Makefile
-@@ -15,6 +15,8 @@
- # License along with the GNU C Library; if not, see
- # <http://www.gnu.org/licenses/>.
-
-+include ../option-groups.mak
-+
- subdir := dlfcn
-
- include ../Makeconfig
-@@ -36,8 +38,11 @@ endif
- ifeq (yes,$(build-shared))
- tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
- bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
-- bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
-+ tstatexit bug-dl-leaf tst-rec-dlopen
- endif
-+
-+tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
-+
- modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
- defaultmod2 errmsg1mod modatexit modcxaatexit \
- bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
-diff --git a/elf/dl-support.c b/elf/dl-support.c
-index 4d036f1..c15f405 100644
---- a/elf/dl-support.c
-+++ b/elf/dl-support.c
-@@ -19,6 +19,7 @@
- /* This file defines some things that for the dynamic linker are defined in
- rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */
-
-+#include <gnu/option-groups.h>
- #include <errno.h>
- #include <libintl.h>
- #include <stdlib.h>
-@@ -42,7 +43,9 @@ char **_dl_argv = &__progname; /* This is checked for some error messages. */
- const char *_dl_platform;
- size_t _dl_platformlen;
-
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- int _dl_debug_mask;
-+#endif
- int _dl_lazy;
- ElfW(Addr) _dl_use_load_bias = -2;
- int _dl_dynamic_weak;
-diff --git a/elf/rtld.c b/elf/rtld.c
-index 6d3add7..fc3a2db 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -16,6 +16,7 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-+#include <gnu/option-groups.h>
- #include <errno.h>
- #include <dlfcn.h>
- #include <fcntl.h>
-@@ -2201,6 +2202,7 @@ print_missing_version (int errcode __attribute__ ((unused)),
- objname, errstring);
- }
-
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- /* Nonzero if any of the debugging options is enabled. */
- static int any_debug attribute_relro;
-
-@@ -2310,6 +2312,7 @@ a filename can be specified using the LD_DEBUG_OUTPUT environment variable.\n");
- _exit (0);
- }
- }
-+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
-
- static void
- process_dl_audit (char *str)
-@@ -2349,8 +2352,9 @@ process_envvars (enum mode *modep)
- char **runp = _environ;
- char *envline;
- enum mode mode = normal;
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- char *debug_output = NULL;
--
-+#endif
- /* This is the default place for profiling data file. */
- GLRO(dl_profile_output)
- = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0];
-@@ -2377,12 +2381,14 @@ process_envvars (enum mode *modep)
- break;
-
- case 5:
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- /* Debugging of the dynamic linker? */
- if (memcmp (envline, "DEBUG", 5) == 0)
- {
- process_dl_debug (&envline[6]);
- break;
- }
-+#endif
- if (memcmp (envline, "AUDIT", 5) == 0)
- process_dl_audit (&envline[6]);
- break;
-@@ -2448,13 +2454,14 @@ process_envvars (enum mode *modep)
- break;
- }
-
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- /* Where to place the profiling data file. */
- if (memcmp (envline, "DEBUG_OUTPUT", 12) == 0)
- {
- debug_output = &envline[13];
- break;
- }
--
-+#endif
- if (!__libc_enable_secure
- && memcmp (envline, "DYNAMIC_WEAK", 12) == 0)
- GLRO(dl_dynamic_weak) = 1;
-@@ -2491,7 +2498,9 @@ process_envvars (enum mode *modep)
- {
- mode = trace;
- GLRO(dl_verbose) = 1;
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
-+#endif
- GLRO(dl_trace_prelink) = &envline[17];
- }
- break;
-@@ -2538,12 +2547,15 @@ process_envvars (enum mode *modep)
- if (__access ("/etc/suid-debug", F_OK) != 0)
- {
- unsetenv ("MALLOC_CHECK_");
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- GLRO(dl_debug_mask) = 0;
-+#endif
- }
-
- if (mode != normal)
- _exit (5);
- }
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- /* If we have to run the dynamic linker in debugging mode and the
- LD_DEBUG_OUTPUT environment variable is given, we write the debug
- messages to this file. */
-@@ -2568,6 +2580,7 @@ process_envvars (enum mode *modep)
- /* We use standard output if opening the file failed. */
- GLRO(dl_debug_fd) = STDOUT_FILENO;
- }
-+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
- }
-
-
-diff --git a/extra-lib.mk b/extra-lib.mk
-index b10748d..d71a06f 100644
---- a/extra-lib.mk
-+++ b/extra-lib.mk
-@@ -25,7 +25,9 @@ install-lib := $(install-lib)
- extra-objs := $(extra-objs)
-
- # The modules that go in $(lib).
--all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
-+all-$(lib)-routines := $($(lib)-routines) \
-+ $($(lib)-routines-y) \
-+ $($(lib)-sysdep_routines)
-
- # Add each flavor of library to the lists of things to build and install.
- install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
-@@ -101,7 +103,7 @@ endif
- endif
-
- # This will define `libof-ROUTINE := LIB' for each of the routines.
--cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
-+cpp-srcs-left := $(all-$(lib)-routines)
- ifneq (,$(cpp-srcs-left))
- include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
- endif
-diff --git a/grp/Makefile b/grp/Makefile
-index c63b552..7486f32 100644
---- a/grp/Makefile
-+++ b/grp/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for grp portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := grp
-
- include ../Makeconfig
-@@ -29,6 +31,9 @@ routines := fgetgrent initgroups setgroups \
- getgrent_r getgrgid_r getgrnam_r fgetgrent_r
-
- tests := testgrp
-+ifneq (y,$(OPTION_EGLIBC_NSSWITCH))
-+LDLIBS-testgrp += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
-+endif
-
- ifeq (yes,$(build-shared))
- test-srcs := tst_fgetgrent
-diff --git a/hesiod/Makefile b/hesiod/Makefile
-index ac0bc01..38263b4 100644
---- a/hesiod/Makefile
-+++ b/hesiod/Makefile
-@@ -18,12 +18,14 @@
- #
- # Sub-makefile for hesiod portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := hesiod
-
- include ../Makeconfig
-
--extra-libs := libnss_hesiod
--extra-libs-others = $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod
-+extra-libs-others-y += $(extra-libs-y)
-
- subdir-dirs = nss_hesiod
- vpath %.c nss_hesiod
-diff --git a/iconv/Makefile b/iconv/Makefile
-index 0d55eda..a1847c6 100644
---- a/iconv/Makefile
-+++ b/iconv/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for iconv.
- #
-+include ../option-groups.mak
-+
- subdir := iconv
-
- include ../Makeconfig
-@@ -39,6 +41,11 @@ CFLAGS-iconv_charmap.c = -I../locale/programs
- CFLAGS-dummy-repertoire.c = -I../locale/programs
- CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
- -DDEFAULT_CHARMAP=null_pointer -DNEED_NULL_POINTER
-+
-+ifneq (y,$(OPTION_EGLIBC_SPAWN))
-+CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
-+endif
-+
- CFLAGS-linereader.c = -DNO_TRANSLITERATION
- CFLAGS-simple-hash.c = -I../locale
-
-diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
-index ce46216..ea18964 100644
---- a/iconv/gconv_db.c
-+++ b/iconv/gconv_db.c
-@@ -25,6 +25,7 @@
- #include <sys/param.h>
- #include <bits/libc-lock.h>
- #include <locale/localeinfo.h>
-+#include <gnu/option-groups.h>
-
- #include <dlfcn.h>
- #include <gconv_int.h>
-@@ -828,9 +829,11 @@ free_modules_db (struct gconv_module *node)
- /* Free all resources if necessary. */
- libc_freeres_fn (free_mem)
- {
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* First free locale memory. This needs to be done before freeing derivations,
- as ctype cleanup functions dereference steps arrays which we free below. */
- _nl_locale_subfreeres ();
-+#endif
-
- /* finddomain.c has similar problem. */
- extern void _nl_finddomain_subfreeres (void) attribute_hidden;
-diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
-index 5d5d4d7..a7d3072 100644
---- a/iconv/gconv_trans.c
-+++ b/iconv/gconv_trans.c
-@@ -23,6 +23,7 @@
- #include <stdint.h>
- #include <string.h>
- #include <stdlib.h>
-+#include <gnu/option-groups.h>
-
- #include <bits/libc-lock.h>
- #include "gconv_int.h"
-@@ -38,15 +39,19 @@ __gconv_transliterate (struct __gconv_step *step,
- unsigned char **outbufstart, size_t *irreversible)
- {
- /* Find out about the locale's transliteration. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
- uint_fast32_t size;
- const uint32_t *from_idx;
- const uint32_t *from_tbl;
- const uint32_t *to_idx;
- const uint32_t *to_tbl;
-+#endif
- const uint32_t *winbuf;
- const uint32_t *winbufend;
-+#if __OPTION_EGLIBC_LOCALE_CODE
- uint_fast32_t low;
- uint_fast32_t high;
-+#endif
-
- /* The input buffer. There are actually 4-byte values. */
- winbuf = (const uint32_t *) *inbufp;
-@@ -58,6 +63,7 @@ __gconv_transliterate (struct __gconv_step *step,
- PTR_DEMANGLE (fct);
- #endif
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* If there is no transliteration information in the locale don't do
- anything and return the error. */
- size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_TAB_SIZE);
-@@ -193,6 +199,7 @@ __gconv_transliterate (struct __gconv_step *step,
- sorted. */
- break;
- }
-+#endif
-
- /* One last chance: use the default replacement. */
- if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN) != 0)
-diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
-index e249bce..403ece5 100644
---- a/iconv/iconv_prog.c
-+++ b/iconv/iconv_prog.c
-@@ -35,6 +35,7 @@
- #ifdef _POSIX_MAPPED_FILES
- # include <sys/mman.h>
- #endif
-+#include <gnu/option-groups.h>
- #include <charmap.h>
- #include <gconv_int.h>
- #include "iconv_prog.h"
-@@ -221,10 +222,17 @@ main (int argc, char *argv[])
- bool to_wrong =
- (iconv_open (to_code, "UTF-8") == (iconv_t) -1
- && errno == EINVAL);
-+#if __OPTION_EGLIBC_LOCALE_CODE
- const char *from_pretty =
- (from_code[0] ? from_code : nl_langinfo (CODESET));
- const char *to_pretty =
- (orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET));
-+#else
-+ const char *from_pretty =
-+ (from_code[0] ? from_code : "ANSI_X3.4-1968");
-+ const char *to_pretty =
-+ (orig_to_code[0] ? orig_to_code : "ANSI_X3.4-1968");
-+#endif
-
- if (from_wrong)
- {
-diff --git a/iconvdata/Makefile b/iconvdata/Makefile
-index a3d1d09..0832708 100644
---- a/iconvdata/Makefile
-+++ b/iconvdata/Makefile
-@@ -18,12 +18,15 @@
- #
- # Makefile for iconv data and code.
- #
-+include ../option-groups.mak
-+
- subdir := iconvdata
-
- include ../Makeconfig
-
- # Names of all the shared objects which implement the transformations.
--modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
-+modules-$(OPTION_EGLIBC_CHARSETS) \
-+ := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
- ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 \
- ISO8859-11 ISO8859-13 ISO8859-14 ISO8859-15 ISO8859-16 \
- T.61 ISO_6937 SJIS KOI-8 HP-ROMAN8 HP-ROMAN9 EBCDIC-AT-DE \
-@@ -63,11 +66,13 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
- MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \
- CP770 CP771 CP772 CP773 CP774
-
--modules.so := $(addsuffix .so, $(modules))
-+modules.so := $(addsuffix .so, $(modules-y))
-
- ifeq (yes,$(build-shared))
- tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
-- tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
-+ tst-iconv6 bug-iconv5 bug-iconv8 bug-iconv9
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) += bug-iconv6 tst-iconv7
-+
- ifeq ($(have-thread-library),yes)
- tests += bug-iconv3
- endif
-@@ -127,13 +132,13 @@ ifeq (yes,$(build-shared))
- # Rule to generate the shared objects.
- charmaps = ../localedata/charmaps
- -include $(objpfx)iconv-rules
--extra-modules-left := $(modules)
-+extra-modules-left := $(modules-y)
- include extra-module.mk
-
-
- extra-objs += $(modules.so)
--install-others = $(addprefix $(inst_gconvdir)/, $(modules.so)) \
-- $(inst_gconvdir)/gconv-modules
-+install-others-y += $(addprefix $(inst_gconvdir)/, $(modules.so))
-+install-others-$(OPTION_EGLIBC_CHARSETS) += $(inst_gconvdir)/gconv-modules
-
- # We can build the conversion tables for numerous charsets automatically.
-
-@@ -201,7 +206,7 @@ before-compile += $(addprefix $(objpfx),$(generated-modules:=.h))
- ifndef avoid-generated
- $(objpfx)iconv-rules: Makefile
- $(make-target-directory)
-- { echo $(filter-out lib%, $(modules)); \
-+ { echo $(filter-out lib%, $(modules-y)); \
- echo 8bit $(gen-8bit-modules); \
- echo 8bit-gap $(gen-8bit-gap-modules); } | \
- LC_ALL=C \
-@@ -245,7 +250,7 @@ $(addprefix $(inst_gconvdir)/, $(modules.so)): \
- $(do-install-program)
- $(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
- $(do-install)
--ifeq (no,$(cross-compiling))
-+# eglibc: ifeq (no,$(cross-compiling))
- # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
- # if this libc has more gconv modules than the previously installed one.
- if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
-@@ -254,9 +259,9 @@ ifeq (no,$(cross-compiling))
- $(common-objpfx)iconv/iconvconfig \
- $(addprefix --prefix=,$(install_root)); \
- fi
--else
-- @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
--endif
-+# eglibc: else
-+# eglibc: @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
-+# eglibc: endif
-
- endif # build-shared = yes
-
-diff --git a/include/netdb.h b/include/netdb.h
-index e1f051d..f6d15aa 100644
---- a/include/netdb.h
-+++ b/include/netdb.h
-@@ -232,6 +232,10 @@ extern enum nss_status _nss_ ## service ## _gethostbyname2_r \
- (const char *name, int af, struct hostent *host, \
- char *buffer, size_t buflen, int *errnop, \
- int *h_errnop); \
-+extern enum nss_status _nss_ ## service ## _gethostbyname3_r \
-+ (const char *name, int af, struct hostent *result, \
-+ char *buffer, size_t buflen, int *errnop, \
-+ int *h_errnop, int32_t *ttlp, char **canonp); \
- extern enum nss_status _nss_ ## service ## _gethostbyname_r \
- (const char *name, struct hostent *host, char *buffer, \
- size_t buflen, int *errnop, int *h_errnop); \
-diff --git a/inet/Makefile b/inet/Makefile
-index f1d871f..7cb1709 100644
---- a/inet/Makefile
-+++ b/inet/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for inet portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := inet
-
- include ../Makeconfig
-@@ -27,7 +29,8 @@ headers := netinet/ether.h netinet/in.h netinet/in_systm.h \
- netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
- aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
-
--routines := htonl htons \
-+routines-$(OPTION_EGLIBC_INET) \
-+ += htonl htons \
- inet_lnaof inet_mkadr \
- inet_netof inet_ntoa inet_net herrno herrno-loc \
- gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
-@@ -39,18 +42,23 @@ routines := htonl htons \
- getservent_r \
- ether_aton ether_aton_r ether_hton ether_line \
- ether_ntoa ether_ntoa_r ether_ntoh \
-- rcmd rexec ruserpass \
- getnetgrent_r getnetgrent \
-- getaliasent_r getaliasent getaliasname getaliasname_r \
-- in6_addr getnameinfo if_index ifaddrs inet6_option \
-+ in6_addr getnameinfo if_index ifaddrs \
- getipv4sourcefilter setipv4sourcefilter \
-- getsourcefilter setsourcefilter inet6_opt inet6_rth
-+ getsourcefilter setsourcefilter
-+routines-$(OPTION_EGLIBC_RCMD) \
-+ += rcmd rexec ruserpass
-+routines-$(OPTION_EGLIBC_DB_ALIASES) \
-+ += getaliasent_r getaliasent getaliasname getaliasname_r
-+routines-$(OPTION_EGLIBC_ADVANCED_INET6) \
-+ += inet6_option inet6_opt inet6_rth
-
--aux := check_pf check_native ifreq
-+aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq
-
- tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
-- tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
-+ tst-gethnm test-ifaddrs bug-if1 tst-ether_line \
- tst-getni1 tst-getni2 tst-inet6_rth tst-checks
-+tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt
-
- include ../Rules
-
-diff --git a/intl/Makefile b/intl/Makefile
-index 9ecf8fe..587bc0d 100644
---- a/intl/Makefile
-+++ b/intl/Makefile
-@@ -16,6 +16,7 @@
- # <http://www.gnu.org/licenses/>.
-
- # Makefile for intl subdirectory: message handling code from GNU gettext.
-+include ../option-groups.mak
-
- subdir = intl
-
-@@ -48,7 +49,7 @@ endif
- $(objpfx)plural.o: plural.c
-
- ifeq ($(run-built-tests),yes)
--ifeq (yes,$(build-shared))
-+ifeq (yyyes,$(OPTION_EGLIBC_LOCALES)$(OPTION_EGLIBC_LOCALE_CODE)$(build-shared))
- ifneq ($(strip $(MSGFMT)),:)
- tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
- $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
-diff --git a/intl/dcigettext.c b/intl/dcigettext.c
-index 8a3f091..e271648 100644
---- a/intl/dcigettext.c
-+++ b/intl/dcigettext.c
-@@ -100,11 +100,15 @@ extern int errno;
- # include "libgnuintl.h"
- #endif
- #include "hash-string.h"
-+#ifdef _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-
- /* Handle multi-threaded applications. */
- #ifdef _LIBC
- # include <bits/libc-lock.h>
- # define gl_rwlock_define_initialized __libc_rwlock_define_initialized
-+# define gl_rwlock_define __libc_rwlock_define
- # define gl_rwlock_rdlock __libc_rwlock_rdlock
- # define gl_rwlock_wrlock __libc_rwlock_wrlock
- # define gl_rwlock_unlock __libc_rwlock_unlock
-@@ -523,8 +527,10 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
- saved_errno = errno;
-
- #ifdef _LIBC
-- __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
-- __libc_rwlock_rdlock (__libc_setlocale_lock);
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+ gl_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
-+ gl_rwlock_rdlock (__libc_setlocale_lock);
-+# endif
- #endif
-
- gl_rwlock_rdlock (_nl_state_lock);
-@@ -550,7 +556,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
- #ifdef HAVE_PER_THREAD_LOCALE
- # ifndef IN_LIBGLOCALE
- # ifdef _LIBC
-- localename = strdupa (__current_locale_name (category));
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+ localename = strdupa (__current_locale_name (category));
-+# else
-+ localename = "C";
-+# endif
- # else
- categoryname = category_to_name (category);
- # define CATEGORYNAME_INITIALIZED
-@@ -581,10 +591,12 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
- else
- retval = (char *) (*foundp)->translation;
-
-- gl_rwlock_unlock (_nl_state_lock);
- # ifdef _LIBC
-- __libc_rwlock_unlock (__libc_setlocale_lock);
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+ gl_rwlock_unlock (__libc_setlocale_lock);
-+# endif
- # endif
-+ gl_rwlock_unlock (_nl_state_lock);
- __set_errno (saved_errno);
- return retval;
- }
-@@ -838,10 +850,13 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
- if (plural)
- retval = plural_lookup (domain, n, retval, retlen);
-
-- gl_rwlock_unlock (_nl_state_lock);
- #ifdef _LIBC
-- __libc_rwlock_unlock (__libc_setlocale_lock);
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+
-+ gl_rwlock_unlock (__libc_setlocale_lock);
-+# endif
- #endif
-+ gl_rwlock_unlock (_nl_state_lock);
- return retval;
- }
- }
-@@ -850,10 +865,12 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
- return_untranslated:
- /* Return the untranslated MSGID. */
- FREE_BLOCKS (block_list);
-- gl_rwlock_unlock (_nl_state_lock);
- #ifdef _LIBC
-- __libc_rwlock_unlock (__libc_setlocale_lock);
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+ gl_rwlock_unlock (__libc_setlocale_lock);
-+# endif
- #endif
-+ gl_rwlock_unlock (_nl_state_lock);
- #ifndef _LIBC
- if (!ENABLE_SECURE)
- {
-@@ -1550,7 +1567,11 @@ guess_category_value (int category, const char *categoryname)
- `LC_xxx', and `LANG'. On some systems this can be done by the
- `setlocale' function itself. */
- # ifdef _LIBC
-+# if __OPTION_EGLIBC_LOCALE_CODE
- locale = __current_locale_name (category);
-+# else
-+ locale = "C";
-+# endif
- # else
- locale_defaulted = 0;
- # if HAVE_USELOCALE
-diff --git a/io/Makefile b/io/Makefile
-index 613dce0..697439e 100644
---- a/io/Makefile
-+++ b/io/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for I/O portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := io
-
- include ../Makeconfig
-@@ -36,7 +38,7 @@ routines := \
- fxstatat fxstatat64 \
- statfs fstatfs statfs64 fstatfs64 \
- statvfs fstatvfs statvfs64 fstatvfs64 \
-- umask chmod fchmod lchmod fchmodat \
-+ umask chmod fchmod fchmodat \
- mkdir mkdirat \
- open open_2 open64 open64_2 openat openat_2 openat64 openat64_2 \
- read write lseek lseek64 access euidaccess faccessat \
-@@ -49,11 +51,13 @@ routines := \
- ttyname ttyname_r isatty \
- link linkat symlink symlinkat readlink readlinkat \
- unlink unlinkat rmdir \
-- ftw ftw64 fts poll ppoll \
-+ poll ppoll \
- posix_fadvise posix_fadvise64 \
- posix_fallocate posix_fallocate64 \
- sendfile sendfile64 \
- utimensat futimens
-+routines-$(OPTION_EGLIBC_BSD) += lchmod
-+routines-$(OPTION_EGLIBC_FTRAVERSE) += ftw ftw64 fts
-
- aux := have_o_cloexec
-
-@@ -64,18 +68,22 @@ static-only-routines = stat fstat lstat stat64 fstat64 lstat64 \
- fstatat fstatat64 mknod mknodat
-
- others := pwd
--test-srcs := ftwtest
-+test-srcs-$(OPTION_EGLIBC_FTRAVERSE) := ftwtest
- tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
-- tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
-+ tst-fcntl tst-statvfs \
- tst-openat tst-unlinkat tst-fstatat tst-futimesat \
- tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
- tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
-- tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 \
-+ tst-mknodat tst-mkfifoat tst-ttyname_r \
- tst-posix_fallocate
-+tests-$(OPTION_EGLIBC_FTRAVERSE) += bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 \
-+ bug-ftw5
-
- ifeq ($(run-built-tests),yes)
-+ifeq (y,$(OPTION_EGLIBC_FTRAVERSE))
- tests-special += $(objpfx)ftwtest.out
- endif
-+endif
-
- include ../Rules
-
-diff --git a/libidn/Makefile b/libidn/Makefile
-index 940fa52..43aad0c 100644
---- a/libidn/Makefile
-+++ b/libidn/Makefile
-@@ -16,6 +16,7 @@
- # <http://www.gnu.org/licenses/>.
-
- # Makefile for libidn subdirectory of GNU C Library.
-+include ../option-groups.mak
-
- subdir := libidn
-
-@@ -23,8 +24,8 @@ include ../Makeconfig
-
- routines = idn-stub
-
--extra-libs = libcidn
--extra-libs-others = $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_IDN) = libcidn
-+extra-libs-others-y = $(extra-libs-y)
-
- libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
- iconvme
-diff --git a/libidn/toutf8.c b/libidn/toutf8.c
-index c7e67ca..62df478 100644
---- a/libidn/toutf8.c
-+++ b/libidn/toutf8.c
-@@ -33,6 +33,11 @@
- /* Get strlen. */
- #include <string.h>
-
-+/* Get __OPTION_EGLIBC_LOCALE_CODE. */
-+#ifdef _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-+
- /* Get iconv_string. */
- #include "iconvme.h"
-
-@@ -47,7 +52,11 @@
- #endif
-
- #ifdef _LIBC
--# define stringprep_locale_charset() nl_langinfo (CODESET)
-+# if __OPTION_EGLIBC_LOCALE_CODE
-+# define stringprep_locale_charset() nl_langinfo (CODESET)
-+# else
-+# define stringprep_locale_charset() "ANSI_X3.4-1968"
-+# endif
- #else
- /**
- * stringprep_locale_charset - return charset used in current locale
-diff --git a/libio/Makefile b/libio/Makefile
-index 7b3bcf9..27c9186 100644
---- a/libio/Makefile
-+++ b/libio/Makefile
-@@ -18,6 +18,8 @@
- #
- # Specific makefile for libio.
- #
-+include ../option-groups.mak
-+
- subdir := libio
-
- include ../Makeconfig
-@@ -27,16 +29,13 @@ headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
-
- routines := \
- filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
-- iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
-+ iofopncook iofputs iofread iofsetpos ioftell \
- iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
- ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
- iovsprintf iovsscanf \
- iofgetpos64 iofopen64 iofsetpos64 \
-- fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
-- iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
-- putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
-- wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
-- wstrops wfileops iofwide fwide wmemstream \
-+ putchar putchar_u \
-+ iofwide \
- \
- clearerr feof ferror fileno fputc freopen fseek getc getchar \
- memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
-@@ -48,24 +47,49 @@ routines := \
- \
- libc_fatal fmemopen oldfmemopen
-
--tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
-- tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
-- tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
-- tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
-- tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
-+ wfiledoalloc \
-+ iowpadn \
-+ swprintf \
-+ vswprintf iovswscanf swscanf wgenops \
-+ wstrops wfileops wmemstream
-+routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += \
-+ wdummyfileops
-+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += \
-+ fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
-+ iofputws iofputws_u iogetwline ioungetwc putwc putwc_u \
-+ putwchar putwchar_u fwprintf vwprintf \
-+ wprintf wscanf fwscanf vwscanf \
-+ fwide
-+
-+tests = test-fmemopen tst-ext tst-ext2 \
-+ tst-mmap-setvbuf tst-atime tst-eof \
-+ tst-freopen bug-ungetc bug-fseek \
- tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
-- tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
-- bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
-+ tst-mmap2-eofsync tst-mmap-offend bug-fopena+ \
-+ bug-ungetc2 bug-ungetc3 bug-ungetc4 \
- tst-memstream1 tst-memstream2 \
-- tst-wmemstream1 tst-wmemstream2 \
-- bug-memstream1 bug-wmemstream1 \
-- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
-- tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
-- tst-ftell-append tst-fputws
-+ bug-memstream1 tst-popen1 tst-fwrite-error \
-+ tst-ftell-active-handler tst-ftell-append
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-swscanf tst-fgetws tst-setvbuf1 \
-+ tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
-+ tst-widetext tst-fputws
-+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-+ += bug-rewind bug-rewind2 bug-ungetwc1 \
-+ bug-wfflush bug-wmemstream1 tst-fopenloc2 \
-+ tst_getwc \
-+ tst_putwc tst_wprintf tst_wprintf2 tst_wscanf \
-+ tst-fgetwc bug-wsetpos tst-fseek tst-ftell-partial-wide
-+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += tst_swprintf tst_swscanf \
-+ tst-sscanf \
-+ tst-wmemstream1 tst-wmemstream2
-+
- ifeq (yes,$(build-shared))
- # Add test-fopenloc only if shared library is enabled since it depends on
- # shared localedata objects.
--tests += tst-fopenloc
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-fopenloc
- endif
- test-srcs = test-freopen
-
-@@ -164,13 +188,17 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
- oldiofsetpos64
-
- ifeq ($(run-built-tests),yes)
-+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
- tests-special += $(objpfx)test-freopen.out
-+endif
-+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
- ifeq (yes,$(build-shared))
- # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
- # library is enabled since they depend on tst-fopenloc.out.
- tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
- endif
- endif
-+endif
-
- include ../Rules
-
-diff --git a/libio/__fpurge.c b/libio/__fpurge.c
-index 065cf61..e32a3e9 100644
---- a/libio/__fpurge.c
-+++ b/libio/__fpurge.c
-@@ -21,7 +21,7 @@
- void
- __fpurge (FILE *fp)
- {
-- if (fp->_mode > 0)
-+ if (_IO_is_wide (fp))
- {
- /* Wide-char stream. */
- if (_IO_in_backup (fp))
-diff --git a/libio/fileops.c b/libio/fileops.c
-index cbcd6f5..19e43c2 100644
---- a/libio/fileops.c
-+++ b/libio/fileops.c
-@@ -39,6 +39,7 @@
- #include <string.h>
- #include <errno.h>
- #include <unistd.h>
-+#include <gnu/option-groups.h>
- #include <stdlib.h>
- #if _LIBC
- # include "../wcsmbs/wcsmbsload.h"
-@@ -173,7 +174,7 @@ _IO_new_file_close_it (_IO_FILE *fp)
-
- /* Free buffer. */
- #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-- if (fp->_mode > 0)
-+ if (_IO_is_wide (fp))
- {
- if (_IO_have_wbackup (fp))
- _IO_free_wbackup_area (fp);
-@@ -348,6 +349,7 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
- cs = strstr (last_recognized + 1, ",ccs=");
- if (cs != NULL)
- {
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- /* Yep. Load the appropriate conversions and set the orientation
- to wide. */
- struct gconv_fcts fcts;
-@@ -418,6 +420,12 @@ _IO_new_file_fopen (_IO_FILE *fp, const char *filename, const char *mode,
-
- /* Set the mode now. */
- result->_mode = 1;
-+#else
-+ /* Treat this as if we couldn't find the given character set. */
-+ (void) _IO_file_close_it (fp);
-+ __set_errno (EINVAL);
-+ return NULL;
-+#endif
- }
- }
-
-diff --git a/libio/iofwide.c b/libio/iofwide.c
-index 0c175d1..3e9f52b 100644
---- a/libio/iofwide.c
-+++ b/libio/iofwide.c
-@@ -26,6 +26,7 @@
-
- #include <libioP.h>
- #ifdef _LIBC
-+# include <gnu/option-groups.h>
- # include <dlfcn.h>
- # include <wchar.h>
- #endif
-@@ -43,6 +44,8 @@
- #endif
-
-
-+#if ! defined _LIBC || __OPTION_POSIX_C_LANG_WIDE_CHAR
-+
- /* Prototypes of libio's codecvt functions. */
- static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
- __mbstate_t *statep,
-@@ -499,3 +502,26 @@ do_max_length (struct _IO_codecvt *codecvt)
- return MB_CUR_MAX;
- #endif
- }
-+
-+#else
-+/* OPTION_POSIX_C_LANG_WIDE_CHAR is disabled. */
-+
-+#undef _IO_fwide
-+int
-+_IO_fwide (fp, mode)
-+ _IO_FILE *fp;
-+ int mode;
-+{
-+ /* Die helpfully if the user tries to create a wide stream; I
-+ disbelieve that most users check the return value from
-+ 'fwide (fp, 1)'. */
-+ assert (mode <= 0);
-+
-+ /* We can only make streams byte-oriented, which is trivial. */
-+ if (mode < 0)
-+ fp->_mode = -1;
-+
-+ return fp->_mode;
-+}
-+
-+#endif
-diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c
-index 11765cf..15d6230 100644
---- a/libio/ioseekoff.c
-+++ b/libio/ioseekoff.c
-@@ -60,7 +60,7 @@ _IO_seekoff_unlocked (fp, offset, dir, mode)
- else
- abort ();
- }
-- if (_IO_fwide (fp, 0) < 0)
-+ if (! _IO_is_wide (fp))
- _IO_free_backup_area (fp);
- else
- _IO_free_wbackup_area (fp);
-diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c
-index a7652a1..6938b68 100644
---- a/libio/ioseekpos.c
-+++ b/libio/ioseekpos.c
-@@ -35,7 +35,7 @@ _IO_seekpos_unlocked (fp, pos, mode)
- /* If we have a backup buffer, get rid of it, since the __seekoff
- callback may not know to do the right thing about it.
- This may be over-kill, but it'll do for now. TODO */
-- if (_IO_fwide (fp, 0) <= 0)
-+ if (! _IO_is_wide (fp))
- {
- if (_IO_have_backup (fp))
- _IO_free_backup_area (fp);
-diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c
-index 0a41c10..3d99fa0 100644
---- a/libio/iosetbuffer.c
-+++ b/libio/iosetbuffer.c
-@@ -24,6 +24,8 @@
- This exception applies to code released by its copyright holders
- in files containing the exception. */
-
-+#include <gnu/option-groups.h>
-+
- #include "libioP.h"
-
- void
-@@ -38,9 +40,11 @@ _IO_setbuffer (fp, buf, size)
- if (!buf)
- size = 0;
- (void) _IO_SETBUF (fp, buf, size);
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- if (_IO_vtable_offset (fp) == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp))
- /* We also have to set the buffer using the wide char function. */
- (void) _IO_WSETBUF (fp, buf, size);
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
- _IO_release_lock (fp);
- }
- libc_hidden_def (_IO_setbuffer)
-diff --git a/libio/libioP.h b/libio/libioP.h
-index 0f16e2d..d2626d6 100644
---- a/libio/libioP.h
-+++ b/libio/libioP.h
-@@ -44,6 +44,10 @@
- /*# include <comthread.h>*/
- #endif
-
-+#if defined _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-+
- #include <math_ldbl_opt.h>
-
- #include "iolibio.h"
-@@ -523,8 +527,20 @@ extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW;
-
-
- #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
-+
-+/* _IO_is_wide (fp) is roughly equivalent to '_IO_fwide (fp, 0) > 0',
-+ except that when OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, it
-+ expands to a constant, allowing the compiler to realize that it can
-+ eliminate code that references wide stream handling functions.
-+ This, in turn, allows us to omit them. */
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
-+# define _IO_is_wide(_f) ((_f)->_mode > 0)
-+#else
-+# define _IO_is_wide(_f) (0)
-+#endif
-+
- # define _IO_do_flush(_f) \
-- ((_f)->_mode <= 0 \
-+ (! _IO_is_wide (_f) \
- ? _IO_do_write(_f, (_f)->_IO_write_base, \
- (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
- : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
-diff --git a/libio/wdummyfileops.c b/libio/wdummyfileops.c
-new file mode 100644
-index 0000000..c0150b8
---- /dev/null
-+++ b/libio/wdummyfileops.c
-@@ -0,0 +1,161 @@
-+/* Copyright (C) 2007 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ As a special exception, if you link the code in this file with
-+ files compiled with a GNU compiler to produce an executable,
-+ that does not cause the resulting executable to be covered by
-+ the GNU Lesser General Public License. This exception does not
-+ however invalidate any other reasons why the executable file
-+ might be covered by the GNU Lesser General Public License.
-+ This exception applies to code released by its copyright holders
-+ in files containing the exception. */
-+
-+#include <assert.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <libioP.h>
-+
-+static void __THROW __attribute__ ((__noreturn__))
-+_IO_wfile_wide_char_support_disabled (void)
-+{
-+ static const char errstr[]
-+ = ("The application tried to use wide character I/O, but libc.so"
-+ " was compiled\n"
-+ "with the OPTION_POSIX_C_LANG_WIDE_CHAR option group disabled.\n");
-+ __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
-+ abort ();
-+}
-+
-+static void
-+_IO_wfile_disabled_void_int (_IO_FILE *fp, int x)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static int
-+_IO_wfile_disabled_int_int (_IO_FILE *fp, int x)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static int
-+_IO_wfile_disabled_int_none (_IO_FILE *fp)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_size_t
-+_IO_wfile_disabled_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_size_t
-+_IO_wfile_disabled_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_off64_t
-+_IO_wfile_disabled_seekoff (_IO_FILE *fp, _IO_off64_t off, int dir, int mode)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_off64_t
-+_IO_wfile_disabled_seekpos (_IO_FILE *fp, _IO_off64_t pos, int flags)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_FILE *
-+_IO_wfile_disabled_setbuf (_IO_FILE *fp, char *buffer, _IO_ssize_t length)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_ssize_t
-+_IO_wfile_disabled_read (_IO_FILE *fp, void *buffer, _IO_ssize_t length)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_ssize_t
-+_IO_wfile_disabled_write (_IO_FILE *fp, const void *buffer, _IO_ssize_t length)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static _IO_off64_t
-+_IO_wfile_disabled_seek (_IO_FILE *fp, _IO_off64_t offset, int mode)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static int
-+_IO_wfile_disabled_close (_IO_FILE *fp)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static int
-+_IO_wfile_disabled_stat (_IO_FILE *fp, void *buf)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static int
-+_IO_wfile_disabled_showmanyc (_IO_FILE *fp)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static void
-+_IO_wfile_disabled_imbue (_IO_FILE *fp, void *locale)
-+{
-+ _IO_wfile_wide_char_support_disabled ();
-+}
-+
-+static const struct _IO_jump_t _IO_wfile_jumps_disabled =
-+{
-+ JUMP_INIT_DUMMY,
-+ JUMP_INIT(finish, _IO_wfile_disabled_void_int),
-+ JUMP_INIT(overflow, _IO_wfile_disabled_int_int),
-+ JUMP_INIT(underflow, _IO_wfile_disabled_int_none),
-+ JUMP_INIT(uflow, _IO_wfile_disabled_int_none),
-+ JUMP_INIT(pbackfail, _IO_wfile_disabled_int_int),
-+ JUMP_INIT(xsputn, _IO_wfile_disabled_xsputn),
-+ JUMP_INIT(xsgetn, _IO_wfile_disabled_xsgetn),
-+ JUMP_INIT(seekoff, _IO_wfile_disabled_seekoff),
-+ JUMP_INIT(seekpos, _IO_wfile_disabled_seekpos),
-+ JUMP_INIT(setbuf, _IO_wfile_disabled_setbuf),
-+ JUMP_INIT(sync, _IO_wfile_disabled_int_none),
-+ JUMP_INIT(doallocate, _IO_wfile_disabled_int_none),
-+ JUMP_INIT(read, _IO_wfile_disabled_read),
-+ JUMP_INIT(write, _IO_wfile_disabled_write),
-+ JUMP_INIT(seek, _IO_wfile_disabled_seek),
-+ JUMP_INIT(close, _IO_wfile_disabled_close),
-+ JUMP_INIT(stat, _IO_wfile_disabled_stat),
-+ JUMP_INIT(showmanyc, _IO_wfile_disabled_showmanyc),
-+ JUMP_INIT(imbue, _IO_wfile_disabled_imbue)
-+};
-+
-+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps)
-+libc_hidden_data_def (_IO_wfile_jumps)
-+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_mmap)
-+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_maybe_mmap)
-diff --git a/locale/C-ctype.c b/locale/C-ctype.c
-index aa5f19f..06be081 100644
---- a/locale/C-ctype.c
-+++ b/locale/C-ctype.c
-@@ -19,8 +19,11 @@
- #include "localeinfo.h"
- #include <endian.h>
- #include <stdint.h>
-+#include <gnu/option-groups.h>
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- #include "C-translit.h"
-+#endif
-
- /* This table's entries are taken from POSIX.2 Table 2-6
- ``LC_CTYPE Category Definition in the POSIX Locale''.
-@@ -634,6 +637,7 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
- { .word = L'7' },
- { .word = L'8' },
- { .word = L'9' },
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
- { .word = NTRANSLIT },
- /* _NL_CTYPE_TRANSLIT_FROM_IDX */
-@@ -644,6 +648,22 @@ const struct __locale_data _nl_C_LC_CTYPE attribute_hidden =
- { .wstr = translit_to_idx },
- /* _NL_CTYPE_TRANSLIT_TO_TBL */
- { .wstr = (uint32_t *) translit_to_tbl },
-+#else
-+ /* If the locale code isn't enabled, we don't have the
-+ transliteration code in iconv/gconv_trans.c anyway, so there's
-+ no need for the transliteration tables here. We'll fall back
-+ on the default missing replacement, '?'. */
-+ /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
-+ { .word = 0 },
-+ /* _NL_CTYPE_TRANSLIT_FROM_IDX */
-+ { .wstr = NULL },
-+ /* _NL_CTYPE_TRANSLIT_FROM_TBL */
-+ { .wstr = NULL },
-+ /* _NL_CTYPE_TRANSLIT_TO_IDX */
-+ { .wstr = NULL },
-+ /* _NL_CTYPE_TRANSLIT_TO_TBL */
-+ { .wstr = NULL },
-+#endif
- /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN */
- { .word = 1 },
- /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING */
-diff --git a/locale/Makefile b/locale/Makefile
-index f1b4343..599a1a9 100644
---- a/locale/Makefile
-+++ b/locale/Makefile
-@@ -18,27 +18,43 @@
- #
- # Makefile for locales.
- #
-+include ../option-groups.mak
-+
- subdir := locale
-
- include ../Makeconfig
-
- headers = locale.h bits/locale.h langinfo.h xlocale.h
--routines = setlocale findlocale loadlocale loadarchive \
-- localeconv nl_langinfo nl_langinfo_l mb_cur_max \
-- newlocale duplocale freelocale uselocale
--tests = tst-C-locale tst-locname tst-duplocale
-+# catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code.
-+# If we put the latter in an option group, too, we can omit catnames
-+# when both option groups are disabled. libstdc++-v3 needs mb_cur_max.
-+routines-y := catnames mb_cur_max
-+routines-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += setlocale findlocale loadlocale loadarchive \
-+ localeconv nl_langinfo nl_langinfo_l \
-+ newlocale duplocale freelocale uselocale
-+ifneq (y,$(OPTION_EGLIBC_LOCALE_CODE))
-+routines-y += dummy-setlocale
-+endif
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-C-locale tst-locname tst-duplocale
- categories = ctype messages monetary numeric time paper name \
- address telephone measurement identification collate
--aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
-- xlocale localename global-locale coll-lookup
--others = localedef locale
-+# C-messages belongs in an intl option group.
-+aux-y := C-ctype C-time \
-+ SYS_libc C_name xlocale global-locale coll-lookup
-+aux-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += $(filter-out $(aux-y), \
-+ $(categories:%=lc-%) $(categories:%=C-%)) \
-+ localename
-+others-$(OPTION_EGLIBC_LOCALE_CODE) = localedef locale
- #others-static = localedef locale
--install-bin = localedef locale
--extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
-+install-bin = $(others-y)
-+extra-objs-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ = $(localedef-modules:=.o) $(localedef-aux:=.o) \
- $(locale-modules:=.o) $(lib-modules:=.o)
-
--extra-libs = libBrokenLocale
--extra-libs-others = $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_LOCALE_CODE) = libBrokenLocale
-+extra-libs-others = $(extra-libs-y)
-
- libBrokenLocale-routines = broken_cur_max
-
-@@ -93,6 +109,9 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
- CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
- CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
- CFLAGS-charmap-dir.c = -Wno-write-strings
-+ifneq (y,$(OPTION_EGLIBC_SPAWN))
-+CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
-+endif
-
- # Set libof-* for each routine.
- cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
-diff --git a/locale/catnames.c b/locale/catnames.c
-new file mode 100644
-index 0000000..9fad357
---- /dev/null
-+++ b/locale/catnames.c
-@@ -0,0 +1,48 @@
-+/* Copyright (C) 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include "localeinfo.h"
-+
-+/* Define an array of category names (also the environment variable names). */
-+const union catnamestr_t _nl_category_names attribute_hidden =
-+ {
-+ {
-+#define DEFINE_CATEGORY(category, category_name, items, a) \
-+ category_name,
-+#include "categories.def"
-+#undef DEFINE_CATEGORY
-+ }
-+ };
-+
-+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
-+ {
-+#define DEFINE_CATEGORY(category, category_name, items, a) \
-+ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
-+#include "categories.def"
-+#undef DEFINE_CATEGORY
-+ };
-+
-+/* An array of their lengths, for convenience. */
-+const uint8_t _nl_category_name_sizes[] attribute_hidden =
-+ {
-+#define DEFINE_CATEGORY(category, category_name, items, a) \
-+ [category] = sizeof (category_name) - 1,
-+#include "categories.def"
-+#undef DEFINE_CATEGORY
-+ [LC_ALL] = sizeof ("LC_ALL") - 1
-+ };
-diff --git a/locale/dummy-setlocale.c b/locale/dummy-setlocale.c
-new file mode 100644
-index 0000000..219964a
---- /dev/null
-+++ b/locale/dummy-setlocale.c
-@@ -0,0 +1,33 @@
-+/* Copyright (C) 2006 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <string.h>
-+#include <locale.h>
-+
-+char *
-+setlocale (int category, const char *locale)
-+{
-+ if (! locale
-+ || locale[0] == '\0'
-+ || strcmp (locale, "C") == 0
-+ || strcmp (locale, "POSIX") == 0)
-+ return (char *) "C";
-+ else
-+ return NULL;
-+}
-+libc_hidden_def (setlocale)
-diff --git a/locale/localeinfo.h b/locale/localeinfo.h
-index bdab9fe..a7516c0 100644
---- a/locale/localeinfo.h
-+++ b/locale/localeinfo.h
-@@ -232,7 +232,7 @@ __libc_tsd_define (extern, __locale_t, LOCALE)
- unused. We can manage this playing some tricks with weak references.
- But with thread-local locale settings, it becomes quite ungainly unless
- we can use __thread variables. So only in that case do we attempt this. */
--#ifndef SHARED
-+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
- # include <tls.h>
- # define NL_CURRENT_INDIRECT 1
- #endif
-diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c
-index cf7adea..ef3b811 100644
---- a/locale/programs/charmap-dir.c
-+++ b/locale/programs/charmap-dir.c
-@@ -19,7 +19,9 @@
- #include <error.h>
- #include <fcntl.h>
- #include <libintl.h>
-+#ifndef NO_UNCOMPRESS
- #include <spawn.h>
-+#endif
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -156,6 +158,7 @@ charmap_closedir (CHARMAP_DIR *cdir)
- return closedir (dir);
- }
-
-+#ifndef NO_UNCOMPRESS
- /* Creates a subprocess decompressing the given pathname, and returns
- a stream reading its output (the decompressed data). */
- static
-@@ -204,6 +207,7 @@ fopen_uncompressed (const char *pathname, const char *compressor)
- }
- return NULL;
- }
-+#endif
-
- /* Opens a charmap for reading, given its name (not an alias name). */
- FILE *
-@@ -226,6 +230,7 @@ charmap_open (const char *directory, const char *name)
- if (stream != NULL)
- return stream;
-
-+#ifndef NO_UNCOMPRESS
- memcpy (p, ".gz", 4);
- stream = fopen_uncompressed (pathname, "gzip");
- if (stream != NULL)
-@@ -235,6 +240,7 @@ charmap_open (const char *directory, const char *name)
- stream = fopen_uncompressed (pathname, "bzip2");
- if (stream != NULL)
- return stream;
-+#endif
-
- return NULL;
- }
-diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
-index a39a94f..16e9039 100644
---- a/locale/programs/ld-collate.c
-+++ b/locale/programs/ld-collate.c
-@@ -351,7 +351,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen,
- }
- if (wcs != NULL)
- {
-- size_t nwcs = wcslen ((wchar_t *) wcs);
-+ size_t nwcs = wcslen_uint32 (wcs);
- uint32_t zero = 0;
- /* Handle <U0000> as a single character. */
- if (nwcs == 0)
-@@ -1777,8 +1777,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name);
-
- if ((*eptr)->nwcs == runp->nwcs)
- {
-- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
-- (wchar_t *) runp->wcs, runp->nwcs);
-+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
-
- if (c == 0)
- {
-@@ -2011,9 +2010,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
- one consecutive entry. */
- if (runp->wcnext != NULL
- && runp->nwcs == runp->wcnext->nwcs
-- && wmemcmp ((wchar_t *) runp->wcs,
-- (wchar_t *)runp->wcnext->wcs,
-- runp->nwcs - 1) == 0
-+ && wmemcmp_uint32 (runp->wcs,
-+ runp->wcnext->wcs,
-+ runp->nwcs - 1) == 0
- && (runp->wcs[runp->nwcs - 1]
- == runp->wcnext->wcs[runp->nwcs - 1] + 1))
- {
-@@ -2037,9 +2036,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
- runp = runp->wcnext;
- while (runp->wcnext != NULL
- && runp->nwcs == runp->wcnext->nwcs
-- && wmemcmp ((wchar_t *) runp->wcs,
-- (wchar_t *)runp->wcnext->wcs,
-- runp->nwcs - 1) == 0
-+ && wmemcmp_uint32 (runp->wcs,
-+ runp->wcnext->wcs,
-+ runp->nwcs - 1) == 0
- && (runp->wcs[runp->nwcs - 1]
- == runp->wcnext->wcs[runp->nwcs - 1] + 1));
-
-diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
-index 3f464ef..b7b6b51 100644
---- a/locale/programs/ld-ctype.c
-+++ b/locale/programs/ld-ctype.c
-@@ -926,7 +926,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap,
- allocate_arrays (ctype, charmap, ctype->repertoire);
-
- default_missing_len = (ctype->default_missing
-- ? wcslen ((wchar_t *) ctype->default_missing)
-+ ? wcslen_uint32 (ctype->default_missing)
- : 0);
-
- init_locale_data (&file, nelems);
-@@ -1937,7 +1937,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype,
- ignore = 1;
- else
- /* This value is usable. */
-- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
-+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
-
- first = 0;
- }
-@@ -2471,8 +2471,8 @@ with character code range values one must use the absolute ellipsis `...'"));
- }
-
- handle_tok_digit:
-- class_bit = _ISwdigit;
-- class256_bit = _ISdigit;
-+ class_bit = BITw (tok_digit);
-+ class256_bit = BIT (tok_digit);
- handle_digits = 1;
- goto read_charclass;
-
-@@ -3929,8 +3929,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
-
- while (idx < number)
- {
-- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
-- (const wchar_t *) runp->from);
-+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
- if (res == 0)
- {
- replace = 1;
-@@ -3967,11 +3966,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
- for (size_t cnt = 0; cnt < number; ++cnt)
- {
- struct translit_to_t *srunp;
-- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
-+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
- srunp = sorted[cnt]->to;
- while (srunp != NULL)
- {
-- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
-+ to_len += wcslen_uint32 (srunp->str) + 1;
- srunp = srunp->next;
- }
- /* Plus one for the extra NUL character marking the end of
-@@ -3995,18 +3994,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap,
- ctype->translit_from_idx[cnt] = from_len;
- ctype->translit_to_idx[cnt] = to_len;
-
-- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
-- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
-- (const wchar_t *) sorted[cnt]->from, len);
-+ len = wcslen_uint32 (sorted[cnt]->from) + 1;
-+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
-+ sorted[cnt]->from, len);
- from_len += len;
-
- ctype->translit_to_idx[cnt] = to_len;
- srunp = sorted[cnt]->to;
- while (srunp != NULL)
- {
-- len = wcslen ((const wchar_t *) srunp->str) + 1;
-- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
-- (const wchar_t *) srunp->str, len);
-+ len = wcslen_uint32 (srunp->str) + 1;
-+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
-+ srunp->str, len);
- to_len += len;
- srunp = srunp->next;
- }
-diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c
-index ec1a80b..736eed8 100644
---- a/locale/programs/ld-messages.c
-+++ b/locale/programs/ld-messages.c
-@@ -25,6 +25,7 @@
- #include <string.h>
- #include <stdint.h>
- #include <sys/uio.h>
-+#include <gnu/option-groups.h>
-
- #include <assert.h>
-
-@@ -124,6 +125,7 @@ No definition for %s category found"), "LC_MESSAGES"));
- }
- else
- {
-+#if __OPTION_POSIX_REGEXP
- int result;
- regex_t re;
-
-@@ -140,6 +142,7 @@ No definition for %s category found"), "LC_MESSAGES"));
- }
- else if (result != 0)
- regfree (&re);
-+#endif
- }
-
- if (messages->noexpr == NULL)
-@@ -158,6 +161,7 @@ No definition for %s category found"), "LC_MESSAGES"));
- }
- else
- {
-+#if __OPTION_POSIX_REGEXP
- int result;
- regex_t re;
-
-@@ -174,6 +178,7 @@ No definition for %s category found"), "LC_MESSAGES"));
- }
- else if (result != 0)
- regfree (&re);
-+#endif
- }
- }
-
-diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
-index db490c6..75dc505 100644
---- a/locale/programs/ld-time.c
-+++ b/locale/programs/ld-time.c
-@@ -215,8 +215,10 @@ No definition for %s category found"), "LC_TIME"));
- }
- else
- {
-+ static const uint32_t wt_fmt_ampm[]
-+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
- time->t_fmt_ampm = "%I:%M:%S %p";
-- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
-+ time->wt_fmt_ampm = wt_fmt_ampm;
- }
- }
-
-@@ -226,7 +228,7 @@ No definition for %s category found"), "LC_TIME"));
- const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
- 31, 31, 30, 31 ,30, 31 };
- size_t idx;
-- wchar_t *wstr;
-+ uint32_t *wstr;
-
- time->era_entries =
- (struct era_data *) xmalloc (time->num_era
-@@ -464,18 +466,18 @@ No definition for %s category found"), "LC_TIME"));
- }
-
- /* Now generate the wide character name and format. */
-- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
-- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
-- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
-- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
-+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
-+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
-+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
-+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
- if (wstr != NULL)
- {
-- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
-- wstr = wcschr (wstr + 1, L':'); /* end name */
-+ time->era_entries[idx].wname = wstr + 1;
-+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
- if (wstr != NULL)
- {
- *wstr = L'\0';
-- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
-+ time->era_entries[idx].wformat = wstr + 1;
- }
- else
- time->era_entries[idx].wname =
-@@ -530,7 +532,16 @@ No definition for %s category found"), "LC_TIME"));
- if (time->date_fmt == NULL)
- time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
- if (time->wdate_fmt == NULL)
-- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
-+ {
-+ static const uint32_t wdate_fmt[] =
-+ { '%','a',' ',
-+ '%','b',' ',
-+ '%','e',' ',
-+ '%','H',':','%','M',':','%','S',' ',
-+ '%','Z',' ',
-+ '%','Y',0 };
-+ time->wdate_fmt = wdate_fmt;
-+ }
- }
-
-
-diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
-index 2e05130..653b68c 100644
---- a/locale/programs/linereader.c
-+++ b/locale/programs/linereader.c
-@@ -595,7 +595,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap,
- {
- int return_widestr = lr->return_widestr;
- char *buf;
-- wchar_t *buf2 = NULL;
-+ uint32_t *buf2 = NULL;
- size_t bufact;
- size_t bufmax = 56;
-
-diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
-index 2a0f2aa..583d233 100644
---- a/locale/programs/localedef.c
-+++ b/locale/programs/localedef.c
-@@ -114,6 +114,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
- #define OPT_LIST_ARCHIVE 309
- #define OPT_LITTLE_ENDIAN 400
- #define OPT_BIG_ENDIAN 401
-+#define OPT_UINT32_ALIGN 402
-
- /* Definitions of arguments for argp functions. */
- static const struct argp_option options[] =
-@@ -150,6 +151,8 @@ static const struct argp_option options[] =
- N_("Generate little-endian output") },
- { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
- N_("Generate big-endian output") },
-+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
-+ N_("Set the target's uint32_t alignment in bytes (default 4)") },
- { NULL, 0, NULL, 0, NULL }
- };
-
-@@ -239,12 +242,14 @@ main (int argc, char *argv[])
- ctype locale. (P1003.2 4.35.5.2) */
- setlocale (LC_CTYPE, "POSIX");
-
-+#ifndef NO_SYSCONF
- /* Look whether the system really allows locale definitions. POSIX
- defines error code 3 for this situation so I think it must be
- a fatal error (see P1003.2 4.35.8). */
- if (sysconf (_SC_2_LOCALEDEF) < 0)
- WITH_CUR_LOCALE (error (3, 0, _("\
- FATAL: system does not define `_POSIX2_LOCALEDEF'")));
-+#endif
-
- /* Process charmap file. */
- charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
-@@ -338,6 +343,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
- case OPT_BIG_ENDIAN:
- set_big_endian (true);
- break;
-+ case OPT_UINT32_ALIGN:
-+ uint32_align_mask = strtol (arg, NULL, 0) - 1;
-+ break;
- case 'c':
- force_output = 1;
- break;
-diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
-index 33da52e..f790c4c 100644
---- a/locale/programs/locfile.c
-+++ b/locale/programs/locfile.c
-@@ -544,6 +544,9 @@ compare_files (const char *filename1, const char *filename2, size_t size,
- machine running localedef. */
- bool swap_endianness_p;
-
-+/* The target's value of __align__(uint32_t) - 1. */
-+unsigned int uint32_align_mask = 3;
-+
- /* When called outside a start_locale_structure/end_locale_structure
- or start_locale_prelude/end_locale_prelude block, record that the
- next byte in FILE's obstack will be the first byte of a new element.
-@@ -621,7 +624,7 @@ add_locale_string (struct locale_file *file, const char *string)
- void
- add_locale_wstring (struct locale_file *file, const uint32_t *string)
- {
-- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
-+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
- }
-
- /* Record that FILE's next element is the 32-bit integer VALUE. */
-diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h
-index 6fc441b..118b171 100644
---- a/locale/programs/locfile.h
-+++ b/locale/programs/locfile.h
-@@ -71,6 +71,8 @@ extern void write_all_categories (struct localedef_t *definitions,
-
- extern bool swap_endianness_p;
-
-+extern unsigned int uint32_align_mask;
-+
- /* Change the output to be big-endian if BIG_ENDIAN is true and
- little-endian otherwise. */
- static inline void
-@@ -89,7 +91,8 @@ maybe_swap_uint32 (uint32_t value)
- }
-
- /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */
--static inline void
-+static void
-+__attribute__ ((unused))
- maybe_swap_uint32_array (uint32_t *array, size_t n)
- {
- if (swap_endianness_p)
-@@ -99,7 +102,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n)
-
- /* Like maybe_swap_uint32_array, but the array of N elements is at
- the end of OBSTACK's current object. */
--static inline void
-+static void
-+__attribute__ ((unused))
- maybe_swap_uint32_obstack (struct obstack *obstack, size_t n)
- {
- maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n);
-@@ -276,4 +280,55 @@ extern void identification_output (struct localedef_t *locale,
- const struct charmap_t *charmap,
- const char *output_path);
-
-+static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused));
-+static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
-+static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused));
-+static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused));
-+static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused));
-+
-+static size_t
-+wcslen_uint32 (const uint32_t *str)
-+{
-+ size_t len = 0;
-+ while (str[len] != 0)
-+ len++;
-+ return len;
-+}
-+
-+static int
-+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
-+{
-+ while (n-- != 0)
-+ {
-+ int diff = *s1++ - *s2++;
-+ if (diff != 0)
-+ return diff;
-+ }
-+ return 0;
-+}
-+
-+static int
-+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
-+{
-+ while (*s1 != 0 && *s1 == *s2)
-+ s1++, s2++;
-+ return *s1 - *s2;
-+}
-+
-+static uint32_t *
-+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
-+{
-+ return memcpy (s1, s2, n * sizeof (uint32_t));
-+}
-+
-+static uint32_t *
-+wcschr_uint32 (const uint32_t *s, uint32_t ch)
-+{
-+ do
-+ if (*s == ch)
-+ return (uint32_t *) s;
-+ while (*s++ != 0);
-+ return 0;
-+}
-+
- #endif /* locfile.h */
-diff --git a/locale/setlocale.c b/locale/setlocale.c
-index fa9cb3a..8eee284 100644
---- a/locale/setlocale.c
-+++ b/locale/setlocale.c
-@@ -64,36 +64,6 @@ static char *const _nl_current_used[] =
- #endif
-
-
--/* Define an array of category names (also the environment variable names). */
--const union catnamestr_t _nl_category_names attribute_hidden =
-- {
-- {
--#define DEFINE_CATEGORY(category, category_name, items, a) \
-- category_name,
--#include "categories.def"
--#undef DEFINE_CATEGORY
-- }
-- };
--
--const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
-- {
--#define DEFINE_CATEGORY(category, category_name, items, a) \
-- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
--#include "categories.def"
--#undef DEFINE_CATEGORY
-- };
--
--/* An array of their lengths, for convenience. */
--const uint8_t _nl_category_name_sizes[] attribute_hidden =
-- {
--#define DEFINE_CATEGORY(category, category_name, items, a) \
-- [category] = sizeof (category_name) - 1,
--#include "categories.def"
--#undef DEFINE_CATEGORY
-- [LC_ALL] = sizeof ("LC_ALL") - 1
-- };
--
--
- #ifdef NL_CURRENT_INDIRECT
- # define WEAK_POSTLOAD(postload) weak_extern (postload)
- #else
-diff --git a/locale/xlocale.c b/locale/xlocale.c
-index fec4564..f00269c 100644
---- a/locale/xlocale.c
-+++ b/locale/xlocale.c
-@@ -18,6 +18,7 @@
- <http://www.gnu.org/licenses/>. */
-
- #include <locale.h>
-+#include <gnu/option-groups.h>
- #include "localeinfo.h"
-
- #define DEFINE_CATEGORY(category, category_name, items, a) \
-@@ -25,6 +26,19 @@ extern struct __locale_data _nl_C_##category;
- #include "categories.def"
- #undef DEFINE_CATEGORY
-
-+/* If the locale support code isn't enabled, don't generate strong
-+ reference to the C locale_data structures here; let the Makefile
-+ decide which ones to include. (In the static linking case, the
-+ strong reference to the 'class', 'toupper', and 'tolower' tables
-+ will cause C-ctype.o to be brought in, as it should be, even when
-+ the reference to _nl_C_LC_CTYPE will be weak.) */
-+#if ! __OPTION_EGLIBC_LOCALE_CODE
-+# define DEFINE_CATEGORY(category, category_name, items, a) \
-+ weak_extern (_nl_C_##category)
-+# include "categories.def"
-+# undef DEFINE_CATEGORY
-+#endif
-+
- /* Defined in locale/C-ctype.c. */
- extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
- extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
-@@ -52,3 +66,26 @@ const struct __locale_struct _nl_C_locobj attribute_hidden =
- .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
- .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
- };
-+
-+
-+#if ! __OPTION_EGLIBC_LOCALE_CODE
-+/* When locale code is enabled, these are each defined in the
-+ appropriate lc-CATEGORY.c file, so that static links (when __thread
-+ is supported) bring in only those lc-CATEGORY.o files for
-+ categories the program actually uses; look for NL_CURRENT_INDIRECT
-+ in localeinfo.h.
-+
-+ When locale code is disabled, the _nl_C_CATEGORY objects are the
-+ only possible referents. At the moment, there isn't a way to get
-+ __OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
-+ #includes localeinfo.h, so we can't just turn off
-+ NL_CURRENT_INDIRECT. So we'll define the _nl_current_CATEGORY
-+ pointers here. */
-+#if defined (NL_CURRENT_INDIRECT)
-+#define DEFINE_CATEGORY(category, category_name, items, a) \
-+ __thread struct __locale_data * const *_nl_current_##category \
-+ attribute_hidden = &_nl_C_locobj.__locales[category];
-+#include "categories.def"
-+#undef DEFINE_CATEGORY
-+#endif
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
-diff --git a/localedata/Makefile b/localedata/Makefile
-index ebf6ac9..1870753 100644
---- a/localedata/Makefile
-+++ b/localedata/Makefile
-@@ -21,12 +21,22 @@ subdir := localedata
-
- include ../Makeconfig
-
--# List with all available character set descriptions.
--charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
-+include ../option-groups.mak
-
- # List with all available character set descriptions.
--locales := $(wildcard locales/*)
--
-+all-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
-+
-+all-locales := $(wildcard locales/*)
-+
-+# If the EGLIBC_LOCALES option group is not enabled, trim the
-+# list of charmap and locale source files.
-+ifeq ($(OPTION_EGLIBC_LOCALES),y)
-+charmaps := $(all-charmaps)
-+locales := $(all-locales)
-+else
-+charmaps :=
-+locales := locales/POSIX
-+endif
-
- subdir-dirs = tests-mbwc
- vpath %.c tests-mbwc
-@@ -71,14 +81,20 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
- tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
- tst_wctype tst_wcwidth
-
--tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
-+# Since these tests build their own locale files, they're not
-+# dependent on the OPTION_EGLIBC_LOCALES option group. But they do
-+# need the locale functions to be present.
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
- tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
- tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
- tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
- tst-wctype
-+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
- tests-static = bug-setlocale1-static
- tests += $(tests-static)
--ifeq (yes,$(build-shared))
-+endif
-+ifeq (yesy,$(build-shared)$(OPTION_EGLIBC_LOCALE_CODE))
- ifneq (no,$(PERL))
- tests-special += $(objpfx)mtrace-tst-leaks.out
- endif
-@@ -95,6 +111,7 @@ tests: $(objdir)/iconvdata/gconv-modules
- tests-static += tst-langinfo-static
-
- ifeq ($(run-built-tests),yes)
-+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
- tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
- $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
- $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
-@@ -109,6 +126,7 @@ LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
- tr_TR.ISO-8859-9 en_GB.UTF-8 uk_UA.UTF-8
- include ../gen-locales.mk
- endif
-+endif
-
- include ../Rules
-
-@@ -191,6 +209,11 @@ endif
-
- include SUPPORTED
-
-+# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
-+ifneq ($(OPTION_EGLIBC_LOCALES),y)
-+SUPPORTED-LOCALES :=
-+endif
-+
- INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
-
- # Sometimes the whole collection of locale files should be installed.
-diff --git a/login/Makefile b/login/Makefile
-index 0f4bb22..4036ddb 100644
---- a/login/Makefile
-+++ b/login/Makefile
-@@ -18,6 +18,7 @@
- #
- # Sub-makefile for login portion of the library.
- #
-+include ../option-groups.mak
-
- subdir := login
-
-@@ -25,14 +26,16 @@ include ../Makeconfig
-
- headers := utmp.h bits/utmp.h lastlog.h pty.h
-
--routines := getlogin getlogin_r setlogin getlogin_r_chk \
-- getutent getutent_r getutid getutline getutid_r getutline_r \
-- utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \
-- ptsname_r_chk
-+routines := getpt grantpt unlockpt ptsname ptsname_r_chk
-+routines-$(OPTION_EGLIBC_UTMP) \
-+ += getutent getutent_r getutid getutline getutid_r getutline_r \
-+ utmp_file utmpname updwtmp
-+routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin getlogin_r getlogin_r_chk
-+routines-$(OPTION_EGLIBC_BSD) += setlogin
-
- CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
-
--others = utmpdump
-+others-$(OPTION_EGLIBC_UTMP) += utmpdump
-
- ifeq (yes,$(build-pt-chown))
- others += pt_chown
-@@ -46,8 +49,8 @@ vpath %.c programs
- tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname tst-getlogin
-
- # Build the -lutil library with these extra functions.
--extra-libs := libutil
--extra-libs-others := $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_UTMP) := libutil
-+extra-libs-others := $(extra-libs-y)
-
- libutil-routines:= login login_tty logout logwtmp openpty forkpty
-
-diff --git a/malloc/Makefile b/malloc/Makefile
-index 67ed293..272ca4d 100644
---- a/malloc/Makefile
-+++ b/malloc/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for malloc routines
- #
-+include ../option-groups.mak
-+
- subdir := malloc
-
- include ../Makeconfig
-@@ -39,9 +41,15 @@ install-lib := libmcheck.a
- non-lib.a := libmcheck.a
-
- # Additional library.
-+ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
- extra-libs = libmemusage
- extra-libs-others = $(extra-libs)
-
-+ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
-+endif
-+endif
-+
- libmemusage-routines = memusage
- libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
-
-@@ -71,7 +79,7 @@ endif
- # Unless we get a test for the availability of libgd which also works
- # for cross-compiling we disable the memusagestat generation in this
- # situation.
--ifneq ($(cross-compiling),yes)
-+ifeq ($(cross-compiling)$(OPTION_EGLIBC_MEMUSAGE),noy)
- # If the gd library is available we build the `memusagestat' program.
- ifneq ($(LIBGD),no)
- others: $(objpfx)memusage
-diff --git a/malloc/memusage.c b/malloc/memusage.c
-index a57ba8e..732ba9d 100644
---- a/malloc/memusage.c
-+++ b/malloc/memusage.c
-@@ -33,6 +33,7 @@
- #include <stdint.h>
- #include <sys/mman.h>
- #include <sys/time.h>
-+#include <gnu/option-groups.h>
-
- #include <memusage.h>
-
-@@ -93,7 +94,11 @@ static __thread uintptr_t start_sp;
- #define peak_stack peak_use[1]
- #define peak_total peak_use[2]
-
--#define DEFAULT_BUFFER_SIZE 32768
-+#ifndef __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+# define DEFAULT_BUFFER_SIZE 32768
-+#else
-+# define DEFAULT_BUFFER_SIZE __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-+#endif
- static size_t buffer_size;
-
- static int fd = -1;
-diff --git a/malloc/memusage.sh b/malloc/memusage.sh
-index 8ab8cc2..d18f446 100755
---- a/malloc/memusage.sh
-+++ b/malloc/memusage.sh
-@@ -35,7 +35,7 @@ do_missing_arg() {
-
- # Print help message
- do_help() {
-- echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
-+ printf $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
- Profile memory usage of PROGRAM.
-
- -n,--progname=NAME Name of the program file to profile
-diff --git a/math/Makefile b/math/Makefile
-index 6388bae..ed1c511 100644
---- a/math/Makefile
-+++ b/math/Makefile
-@@ -21,6 +21,8 @@ subdir := math
-
- include ../Makeconfig
-
-+include ../option-groups.mak
-+
- # Installed header files.
- headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
- bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
-@@ -34,8 +36,8 @@ aux := setfpucw fpu_control
-
- # Build the -lm library.
-
--extra-libs := libm
--extra-libs-others = $(extra-libs)
-+extra-libs-$(OPTION_EGLIBC_LIBM) := libm
-+extra-libs-others-$(OPTION_EGLIBC_LIBM) = $(extra-libs-$(OPTION_EGLIBC_LIBM))
-
- libm-support = s_lib_version s_matherr s_signgam \
- fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
-diff --git a/misc/Makefile b/misc/Makefile
-index aecb0da..e6b7c23 100644
---- a/misc/Makefile
-+++ b/misc/Makefile
-@@ -19,6 +19,10 @@
- # Sub-makefile for misc portion of the library.
- #
-
-+# Some system-dependent implementations of these functions use option
-+# groups (see sysdeps/unix/sysv/linux/Makefile, for example).
-+include ../option-groups.mak
-+
- subdir := misc
-
- include ../Makeconfig
-@@ -46,40 +50,47 @@ routines := brk sbrk sstk ioctl \
- select pselect \
- acct chroot fsync sync fdatasync syncfs reboot \
- gethostid sethostid \
-- revoke vhangup \
-+ vhangup \
- swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
- mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
- ualarm usleep \
- gtty stty \
- ptrace \
-- fstab mntent mntent_r \
-+ mntent mntent_r \
- utimes lutimes futimes futimesat \
- truncate ftruncate truncate64 ftruncate64 \
-- chflags fchflags \
- insremque getttyent getusershell getpass ttyslot \
- syslog syscall daemon \
- mmap mmap64 munmap mprotect msync madvise mincore remap_file_pages\
- mlock munlock mlockall munlockall \
-- efgcvt efgcvt_r qefgcvt qefgcvt_r \
- hsearch hsearch_r tsearch lsearch \
- err error ustat \
-- getsysstats dirname regexp \
-+ getsysstats dirname \
- getloadavg getclktck \
- fgetxattr flistxattr fremovexattr fsetxattr getxattr \
- listxattr lgetxattr llistxattr lremovexattr lsetxattr \
- removexattr setxattr getauxval ifunc-impl-list
-
-+routines-$(OPTION_POSIX_REGEXP) += regexp
-+routines-$(OPTION_EGLIBC_FSTAB) += fstab
-+routines-$(OPTION_EGLIBC_BSD) += chflags fchflags revoke
-+routines-$(OPTION_EGLIBC_FCVT) += efgcvt efgcvt_r qefgcvt qefgcvt_r
-+
- generated += tst-error1.mtrace tst-error1-mem.out
-
- aux := init-misc
- install-lib := libg.a
- gpl2lgpl := error.c error.h
-
--tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
-- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
-+tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
-+ tst-pselect tst-insremque tst-mntent2 bug-hsearch1
-+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
-+tests-$(OPTION_EGLIBC_FCVT) += tst-efgcvt
- ifeq ($(run-built-tests),yes)
-+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
- tests-special += $(objpfx)tst-error1-mem.out
- endif
-+endif
-
- CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-tsearch.c = $(uses-callbacks)
-diff --git a/misc/err.c b/misc/err.c
-index 7b98157..efce8d5 100644
---- a/misc/err.c
-+++ b/misc/err.c
-@@ -22,6 +22,7 @@
- #include <errno.h>
- #include <string.h>
- #include <stdio.h>
-+#include <gnu/option-groups.h>
-
- #include <wchar.h>
- #define flockfile(s) _IO_flockfile (s)
-@@ -37,6 +38,7 @@ extern char *__progname;
- va_end (ap); \
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- static void
- convert_and_print (const char *format, __gnuc_va_list ap)
- {
-@@ -81,6 +83,7 @@ convert_and_print (const char *format, __gnuc_va_list ap)
-
- __vfwprintf (stderr, wformat, ap);
- }
-+#endif
-
- void
- vwarnx (const char *format, __gnuc_va_list ap)
-@@ -88,9 +91,13 @@ vwarnx (const char *format, __gnuc_va_list ap)
- flockfile (stderr);
- if (_IO_fwide (stderr, 0) > 0)
- {
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- __fwprintf (stderr, L"%s: ", __progname);
- convert_and_print (format, ap);
- putwc_unlocked (L'\n', stderr);
-+#else
-+ abort ();
-+#endif
- }
- else
- {
-@@ -111,6 +118,7 @@ vwarn (const char *format, __gnuc_va_list ap)
- flockfile (stderr);
- if (_IO_fwide (stderr, 0) > 0)
- {
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- __fwprintf (stderr, L"%s: ", __progname);
- if (format)
- {
-@@ -119,6 +127,9 @@ vwarn (const char *format, __gnuc_va_list ap)
- }
- __set_errno (error);
- __fwprintf (stderr, L"%m\n");
-+#else
-+ abort ();
-+#endif
- }
- else
- {
-diff --git a/misc/error.c b/misc/error.c
-index aaa120d..d6cbc82 100644
---- a/misc/error.c
-+++ b/misc/error.c
-@@ -35,6 +35,7 @@
- #endif
-
- #ifdef _LIBC
-+# include <gnu/option-groups.h>
- # include <libintl.h>
- # include <stdbool.h>
- # include <stdint.h>
-@@ -205,6 +206,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
- #if _LIBC
- if (_IO_fwide (stderr, 0) > 0)
- {
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- size_t len = strlen (message) + 1;
- wchar_t *wmessage = NULL;
- mbstate_t st;
-@@ -265,6 +267,9 @@ error_tail (int status, int errnum, const char *message, va_list args)
-
- if (use_malloc)
- free (wmessage);
-+#else
-+ abort ();
-+#endif
- }
- else
- #endif
-diff --git a/misc/tst-efgcvt.c b/misc/tst-efgcvt.c
-index 5083fec..79ed36c 100644
---- a/misc/tst-efgcvt.c
-+++ b/misc/tst-efgcvt.c
-@@ -59,7 +59,7 @@ static testcase ecvt_tests[] =
- { 123.01, -4, 3, "" },
- { 126.71, -4, 3, "" },
- { 0.0, 4, 1, "0000" },
--#if DBL_MANT_DIG == 53
-+#if DBL_MANT_DIG == 53 && !(defined __powerpc__ && defined __NO_FPRS__ && !defined _SOFT_FLOAT && !defined _SOFT_DOUBLE)
- { 0x1p-1074, 3, -323, "494" },
- { -0x1p-1074, 3, -323, "494" },
- #endif
-diff --git a/nis/Makefile b/nis/Makefile
-index 037e674..c967850 100644
---- a/nis/Makefile
-+++ b/nis/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for NIS/NIS+ part.
- #
-+include ../option-groups.mak
-+
- subdir := nis
-
- include ../Makeconfig
-@@ -30,19 +32,26 @@ endif
-
- # These are the databases available for the nis (and perhaps later nisplus)
- # service. This must be a superset of the services in nss.
--databases = proto service hosts network grp pwd rpc ethers \
-- spwd netgrp alias publickey
-+databases-y := proto service hosts network grp pwd rpc ethers \
-+ spwd netgrp publickey
-+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
-
- # Specify rules for the nss_* modules.
--services := nis nisplus compat
-+# The 'compat' module includes nis support, and the 'nss' directory
-+# includes a bare-bones "files" library, so we'll include 'compat' in
-+# OPTION_EGLIBC_NIS.
-+services-y :=
-+services-$(OPTION_EGLIBC_NIS) += nis nisplus compat
-+
-+extra-libs-$(OPTION_EGLIBC_NIS) += libnsl
-+extra-libs-y += $(services-y:%=libnss_%)
-
--extra-libs = libnsl $(services:%=libnss_%)
- # These libraries will be built in the `others' pass rather than
- # the `lib' pass, because they depend on libc.so being built already.
--extra-libs-others = $(extra-libs)
-+extra-libs-others-y += $(extra-libs-y)
-
- # The sources are found in the appropriate subdir.
--subdir-dirs = $(services:%=nss_%)
-+subdir-dirs = $(services-y:%=nss_%)
- vpath %.c $(subdir-dirs)
-
- libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
-@@ -60,11 +69,11 @@ libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
- libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups)
- libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
-
--libnss_nis-routines := $(addprefix nis-,$(databases)) nis-initgroups \
-+libnss_nis-routines := $(addprefix nis-,$(databases-y)) nis-initgroups \
- nss-nis
- libnss_nis-inhibit-o = $(filter-out .os,$(object-suffixes))
-
--libnss_nisplus-routines := $(addprefix nisplus-,$(databases)) nisplus-parser \
-+libnss_nisplus-routines := $(addprefix nisplus-,$(databases-y)) nisplus-parser \
- nss-nisplus nisplus-initgroups
- libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
-
-@@ -80,12 +89,12 @@ libnsl-libc = $(common-objpfx)linkobj/libc.so
- # Target-specific variable setting to link objects using deprecated
- # RPC interfaces with the version of libc.so that makes them available
- # for new links:
--$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
-+$(services-y:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
- libc-for-link = $(libnsl-libc)
-
-
- ifeq ($(build-shared),yes)
--$(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
-+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
- else
--$(others:%=$(objpfx)%): $(objpfx)libnsl.a
-+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.a
- endif
-diff --git a/nptl/Makefile b/nptl/Makefile
-index aaca0a4..596ca3c 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for NPTL portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := nptl
-
- include ../Makeconfig
-@@ -118,7 +120,7 @@ libpthread-routines = nptl-init vars events version pt-interp \
- pt-raise pt-system \
- flockfile ftrylockfile funlockfile \
- sigaction \
-- herrno res pt-allocrtsig \
-+ pt-allocrtsig \
- pthread_kill_other_threads \
- pthread_getaffinity pthread_setaffinity \
- pthread_attr_getaffinity pthread_attr_setaffinity \
-@@ -138,8 +140,10 @@ libpthread-routines = nptl-init vars events version pt-interp \
- # pthread_setgid pthread_setegid pthread_setregid \
- # pthread_setresgid
-
-+libpthread-routines-$(OPTION_EGLIBC_INET) := herrno res
- libpthread-shared-only-routines = version pt-interp pt-allocrtsig \
- unwind-forcedunwind
-+
- libpthread-static-only-routines = pthread_atfork
-
- # Since cancellation handling is in large parts handled using exceptions
-@@ -220,7 +224,7 @@ tests = tst-typesizes \
- tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
- tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
- tst-mutexpi9 \
-- tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
-+ tst-spin1 tst-spin2 tst-spin3 \
- tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
- tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
- tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
-@@ -256,14 +260,14 @@ tests = tst-typesizes \
- tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
- tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
- tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
-- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
-+ tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
- tst-cancel-self tst-cancel-self-cancelstate \
- tst-cancel-self-canceltype tst-cancel-self-testcancel \
- tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
- tst-flock1 tst-flock2 \
- tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
- tst-signal6 tst-signal7 \
-- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
-+ tst-exec2 tst-exec3 tst-exec4 \
- tst-exit1 tst-exit2 tst-exit3 \
- tst-stdio1 tst-stdio2 \
- tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
-@@ -271,13 +275,12 @@ tests = tst-typesizes \
- tst-unload \
- tst-dlsym1 \
- tst-sysconf \
-- tst-locale1 tst-locale2 \
-+ tst-locale2 \
- tst-umask1 \
- tst-popen1 \
- tst-clock1 \
- tst-context1 \
- tst-sched1 \
-- tst-backtrace1 \
- tst-abstime \
- tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
- tst-getpid3 \
-@@ -288,9 +291,16 @@ xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
- tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
- test-srcs = tst-oddstacklimit
-
--# Test expected to fail on most targets (except x86_64) due to bug
--# 18435 - pthread_once hangs when init routine throws an exception.
--test-xfail-tst-once5 = yes
-+# This test uses the posix_spawn functions.
-+tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
-+
-+# This test uses the 'backtrace' functions.
-+tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
-+
-+# This test is written in C++.
-+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
-+
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1
-
- # Files which must not be linked with libpthread.
- tests-nolibpthread = tst-unload
-diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
-index d10f4ea..14257ce 100644
---- a/nptl/pthread_create.c
-+++ b/nptl/pthread_create.c
-@@ -33,6 +33,7 @@
- #include <default-sched.h>
- #include <futex-internal.h>
-
-+#include <gnu/option-groups.h>
- #include <shlib-compat.h>
-
- #include <stap-probe.h>
-@@ -262,8 +263,10 @@ START_THREAD_DEFN
- THREAD_SETMEM (pd, cpuclock_offset, now);
- #endif
-
-+#if __OPTION_EGLIBC_INET
- /* Initialize resolver state pointer. */
- __resp = &pd->res;
-+#endif
-
- /* Initialize pointers to locale data. */
- __ctype_init ();
-@@ -346,8 +349,10 @@ START_THREAD_DEFN
- /* Run the destructor for the thread-local data. */
- __nptl_deallocate_tsd ();
-
-+#if __OPTION_EGLIBC_INET
- /* Clean up any state libc stored in thread-local variables. */
- __libc_thread_freeres ();
-+#endif
-
- /* If this is the last thread we terminate the process now. We
- do not notify the debugger, it might just irritate it if there
-diff --git a/nscd/Makefile b/nscd/Makefile
-index ede941d..f4f3f8d 100644
---- a/nscd/Makefile
-+++ b/nscd/Makefile
-@@ -18,14 +18,17 @@
- #
- # Sub-makefile for nscd portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := nscd
-
- include ../Makeconfig
-
- ifneq ($(use-nscd),no)
--routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
-+routines-$(OPTION_EGLIBC_INET) += \
-+ nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
- nscd_initgroups nscd_getserv_r nscd_netgroup
--aux := nscd_helper
-+aux-$(OPTION_EGLIBC_INET) += nscd_helper
- endif
-
- # To find xmalloc.c
-@@ -37,14 +40,18 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
- dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
- xmalloc xstrdup aicache initgrcache gai res_hconf \
- netgroupcache
--
-+ifneq (y,$(OPTION_EGLIBC_NIS))
-+# If we haven't build libnsl.so, then we'll need to include our
-+# own copy of nis_hash.
-+nscd-modules += nis_hash
-+endif
- ifeq ($(build-nscd)$(have-thread-library),yesyes)
-
--others += nscd
--others-pie += nscd
--install-sbin := nscd
-+others-$(OPTION_EGLIBC_INET) += nscd
-+others-pie-$(OPTION_EGLIBC_INET) += nscd
-+install-sbin-$(OPTION_EGLIBC_INET) += nscd
-
--extra-objs = $(nscd-modules:=.o)
-+extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
-
- endif
-
-@@ -100,7 +107,15 @@ include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
- $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
-
- ifeq ($(build-shared),yes)
--$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
-+$(objpfx)nscd: $(shared-thread-library)
-+else
-+$(objpfx)nscd: $(static-thread-library)
-+endif
-+
-+ifeq (y,$(OPTION_EGLIBC_NIS))
-+ifeq ($(build-shared),yes)
-+$(objpfx)nscd: $(common-objpfx)nis/libnsl.so
- else
--$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
-+$(objpfx)nscd: $(common-objpfx)nis/libnsl.a
-+endif
- endif
-diff --git a/nscd/nis_hash.c b/nscd/nis_hash.c
-new file mode 100644
-index 0000000..d244c41
---- /dev/null
-+++ b/nscd/nis_hash.c
-@@ -0,0 +1,3 @@
-+/* If OPTION_EGLIBC_NIS is disabled, nscd can't get this from libnsl.so;
-+ we need our own copy. */
-+#include "../nis/nis_hash.c"
-diff --git a/nss/Makefile b/nss/Makefile
-index 65ab7b5..19f0aef 100644
---- a/nss/Makefile
-+++ b/nss/Makefile
-@@ -18,28 +18,35 @@
- #
- # Makefile for name service switch.
- #
-+include ../option-groups.mak
-+
- subdir := nss
-
- include ../Makeconfig
-
- headers := nss.h
-
--# This is the trivial part which goes into libc itself.
--routines = nsswitch getnssent getnssent_r digits_dots \
-- $(addsuffix -lookup,$(databases))
--
- # These are the databases that go through nss dispatch.
- # Caution: if you add a database here, you must add its real name
- # in databases.def, too.
--databases = proto service hosts network grp pwd ethers \
-- spwd netgrp alias sgrp
-+databases-y = grp pwd spwd sgrp
-+databases-$(OPTION_EGLIBC_INET) \
-+ += proto service hosts network ethers \
-+ netgrp
-+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
-+
-+routines-$(OPTION_EGLIBC_INET) += digits_dots
-
- ifneq (,$(filter sunrpc,$(subdirs)))
--databases += key rpc
-+databases-$(OPTION_EGLIBC_INET) += key rpc
- have-sunrpc := 1
- else
- have-sunrpc := 0
- endif
-+# This is the trivial part which goes into libc itself.
-+routines-y += nsswitch getnssent getnssent_r \
-+ $(addsuffix -lookup,$(databases-y))
-+
- CPPFLAGS-getent.c = -DHAVE_SUNRPC=$(have-sunrpc)
-
- others := getent makedb
-@@ -47,8 +54,9 @@ install-bin := getent makedb
- makedb-modules = xmalloc hash-string
- extra-objs += $(makedb-modules:=.o)
-
--tests = test-netdb tst-nss-test1 test-digits-dots tst-nss-getpwent
--xtests = bug-erange
-+tests = tst-nss-test1 tst-nss-getpwent
-+tests-$(OPTION_EGLIBC_INET) += test-netdb test-digits-dots
-+xtests-$(OPTION_EGLIBC_INET) += bug-erange
-
- # Specify rules for the nss_* modules. We have some services.
- services := files db
-@@ -63,7 +71,7 @@ subdir-dirs = $(services:%=nss_%)
- vpath %.c $(subdir-dirs) ../locale/programs ../intl
-
-
--libnss_files-routines := $(addprefix files-,$(databases)) \
-+libnss_files-routines := $(addprefix files-,$(databases-y)) \
- files-initgroups files-have_o_cloexec files-init
-
- libnss_db-dbs := $(addprefix db-,\
-@@ -86,6 +94,45 @@ tests-static = tst-nss-static
- tests += $(tests-static)
- endif
-
-+ifneq ($(OPTION_EGLIBC_NSSWITCH),y)
-+
-+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
-+$(error OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG variable left unset)
-+endif
-+
-+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-+$(error OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS variable left unset)
-+endif
-+
-+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)))
-+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed config file)
-+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG))
-+endif
-+
-+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)))
-+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed functions file)
-+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS))
-+endif
-+
-+before-compile := $(objpfx)fixed-nsswitch.h
-+generated := fixed-nsswitch.h
-+$(objpfx)fixed-nsswitch.h $(objfpx)fixed-nsswitch-libs: \
-+ $(objpfx)gen-fixed-nsswitch \
-+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
-+ $< $(objpfx)fixed-nsswitch.h \
-+ $(objpfx)fixed-nsswitch-libs \
-+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
-+
-+$(objpfx)gen-fixed-nsswitch: gen-fixed-nsswitch.c \
-+ $(common-objpfx)option-groups.config \
-+ $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)
-+ $(native-compile)
-+gen-fixed-nsswitch-CFLAGS = \
-+ -g3 -O -Wall \
-+ -I $(objpfx) \
-+ -DFIXED_FUNCTIONS='"$(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)"'
-+endif
-+
- include ../Rules
-
- ifeq (yes,$(have-selinux))
-diff --git a/nss/fixed-nsswitch.conf b/nss/fixed-nsswitch.conf
-new file mode 100644
-index 0000000..91bb675
---- /dev/null
-+++ b/nss/fixed-nsswitch.conf
-@@ -0,0 +1,22 @@
-+# /etc/nsswitch.conf
-+#
-+# Example configuration for fixed name service.
-+# See the description of OPTION_EGLIBC_NSSWITCH in option-groups.def
-+# for details.
-+#
-+
-+aliases: files
-+
-+passwd: files
-+group: files
-+shadow: files
-+
-+hosts: files dns
-+networks: files dns
-+
-+protocols: files
-+services: files
-+ethers: files
-+rpc: files
-+
-+netgroup: files
-diff --git a/nss/fixed-nsswitch.functions b/nss/fixed-nsswitch.functions
-new file mode 100644
-index 0000000..2f3fa83
---- /dev/null
-+++ b/nss/fixed-nsswitch.functions
-@@ -0,0 +1,121 @@
-+/* List of functions defined for fixed NSS in GNU C Library.
-+ Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* When OPTION_EGLIBC_NSSWITCH is disabled (see option-groups.def),
-+ EGLIBC does not use the 'dlopen' and 'dlsym' functions to look for
-+ database query functions in the individual name service libraries.
-+ Instead, it uses a set of functions chosen at compile time, as
-+ directed by the OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS file. This
-+ file is a sample of what you might use there.
-+
-+ This file is C source code; it should only contain invocations of
-+ the following macros:
-+
-+ - DEFINE_ENT (DATABASE, SERVICE, X)
-+
-+ Declare the 'setXent', 'getXent_r', and 'endXent' functions that
-+ query DATABASE using the service library 'libnss_SERVICE.so.2'.
-+ DATABASE should be the full name of the database as it appears in
-+ 'nsswitch.conf', like 'passwd' or 'aliases'.
-+
-+ (The non-reentrant 'getXent' functions are implemented in terms
-+ of the reentrant 'getXent_r' functions, so there is no need to
-+ refer to them explicitly here.)
-+
-+ - DEFINE_GETBY (DATABASE, SERVICE, X, KEY)
-+
-+ Declare the 'getXbyKEY_r' functions that query DATABASE using
-+ SERVICE. DATABASE and SERVICE are as described above.
-+
-+ (The non-reentrant 'getXbyKEY' functions are implemented in terms
-+ of the reentrant 'getXbyKEY_r' functions, so there is no need to
-+ refer to them explicitly here.)
-+
-+ Use the special key 'name3' for the service library function that
-+ implements the 'getaddrinfo' function.
-+
-+ - DEFINE_GET (DATABASE, SERVICE, QUERY)
-+
-+ Declare the 'getQUERY_r' functions that query DATABASE using
-+ SERVICE. This is used for functions like 'getpwnam'.
-+
-+ (The non-reentrant 'getQUERY' functions are implemented in terms
-+ of the reentrant 'getQUERY_r' functions, so there is no need to
-+ refer to them explicitly here.)
-+
-+ This sample file only includes functions that consult the files in
-+ '/etc', and the Domain Name System (DNS). */
-+
-+/* aliases */
-+DEFINE_ENT (aliases, files, alias)
-+DEFINE_GETBY (aliases, files, alias, name)
-+
-+/* ethers */
-+DEFINE_ENT (ethers, files, ether)
-+
-+/* group */
-+DEFINE_ENT (group, files, gr)
-+DEFINE_GET (group, files, grgid)
-+DEFINE_GET (group, files, grnam)
-+
-+/* hosts */
-+DEFINE_ENT (hosts, files, host)
-+DEFINE_GETBY (hosts, files, host, addr)
-+DEFINE_GETBY (hosts, files, host, name)
-+DEFINE_GETBY (hosts, files, host, name2)
-+DEFINE_GET (hosts, files, hostton)
-+DEFINE_GET (hosts, files, ntohost)
-+DEFINE_GETBY (hosts, dns, host, addr)
-+DEFINE_GETBY (hosts, dns, host, name)
-+DEFINE_GETBY (hosts, dns, host, name2)
-+DEFINE_GETBY (hosts, dns, host, name3)
-+
-+/* netgroup */
-+DEFINE_ENT (netgroup, files, netgr)
-+
-+/* networks */
-+DEFINE_ENT (networks, files, net)
-+DEFINE_GETBY (networks, files, net, name)
-+DEFINE_GETBY (networks, files, net, addr)
-+DEFINE_GETBY (networks, dns, net, name)
-+DEFINE_GETBY (networks, dns, net, addr)
-+
-+/* protocols */
-+DEFINE_ENT (protocols, files, proto)
-+DEFINE_GETBY (protocols, files, proto, name)
-+DEFINE_GETBY (protocols, files, proto, number)
-+
-+/* passwd */
-+DEFINE_ENT (passwd, files, pw)
-+DEFINE_GET (passwd, files, pwnam)
-+DEFINE_GET (passwd, files, pwuid)
-+
-+/* rpc */
-+DEFINE_ENT (rpc, files, rpc)
-+DEFINE_GETBY (rpc, files, rpc, name)
-+DEFINE_GETBY (rpc, files, rpc, number)
-+
-+/* services */
-+DEFINE_ENT (services, files, serv)
-+DEFINE_GETBY (services, files, serv, name)
-+DEFINE_GETBY (services, files, serv, port)
-+
-+/* shadow */
-+DEFINE_ENT (shadow, files, sp)
-+DEFINE_GET (shadow, files, spnam)
-diff --git a/nss/gen-fixed-nsswitch.c b/nss/gen-fixed-nsswitch.c
-new file mode 100644
-index 0000000..6e1c98c
---- /dev/null
-+++ b/nss/gen-fixed-nsswitch.c
-@@ -0,0 +1,803 @@
-+/* gen-fixed-nsswitch.c --- generate fixed name service data structures
-+ Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#define _GNU_SOURCE
-+
-+#include <stdlib.h>
-+#include <stdio.h>
-+#include <errno.h>
-+#include <string.h>
-+#include <stdarg.h>
-+#include <assert.h>
-+#include <ctype.h>
-+
-+#include "gnu/lib-names.h"
-+#include "nss.h"
-+
-+/* Provide a fallback definition to allow this file to be compiled outside
-+ libc. */
-+#ifndef internal_function
-+# define internal_function
-+#endif
-+
-+
-+/* Simple utilities. */
-+
-+void __attribute__ ((noreturn))
-+error (const char *message)
-+{
-+ fprintf (stderr, "%s\n", message);
-+ exit (1);
-+}
-+
-+
-+void *
-+check_alloc (void *p)
-+{
-+ if (p)
-+ return p;
-+ else
-+ error ("out of memory");
-+}
-+
-+void *
-+xmalloc (size_t size)
-+{
-+ return check_alloc (malloc (size));
-+}
-+
-+
-+/* Format ARGS according to FORMAT, and return the result as a
-+ malloc'ed string. */
-+char *
-+saprintf (const char *format, ...)
-+{
-+ va_list args;
-+ size_t len;
-+ char *buf;
-+
-+ va_start (args, format);
-+ len = vsnprintf (NULL, 0, format, args);
-+ va_end (args);
-+
-+ buf = xmalloc (len + 1);
-+ va_start (args, format);
-+ assert (len == vsnprintf (buf, len + 1, format, args));
-+ va_end (args);
-+
-+ return buf;
-+}
-+
-+
-+
-+/* Data structures representing the configuration file in memory. */
-+
-+/* These are copied from nsswitch.h.
-+
-+ We could simply #include that file, but this program runs on the
-+ build machine and links against the build machine's libraries,
-+ whereas that header is meant for use by target code; it uses
-+ 'libc_hidden_proto', 'internal_function', and related hair. Since
-+ we've copied the parsing code, we might as well copy the data
-+ structure definitions as well. */
-+
-+/* Actions performed after lookup finished. */
-+typedef enum
-+{
-+ NSS_ACTION_CONTINUE,
-+ NSS_ACTION_RETURN
-+} lookup_actions;
-+
-+
-+typedef struct service_library
-+{
-+ /* Name of service (`files', `dns', `nis', ...). */
-+ const char *name;
-+ /* Pointer to the loaded shared library. */
-+ void *lib_handle;
-+ /* And the link to the next entry. */
-+ struct service_library *next;
-+} service_library;
-+
-+
-+/* For mapping a function name to a function pointer. It is known in
-+ nsswitch.c:nss_lookup_function that a string pointer for the lookup key
-+ is the first member. */
-+typedef struct
-+{
-+ const char *fct_name;
-+ void *fct_ptr;
-+} known_function;
-+
-+
-+typedef struct service_user
-+{
-+ /* And the link to the next entry. */
-+ struct service_user *next;
-+ /* Action according to result. */
-+ lookup_actions actions[5];
-+ /* Link to the underlying library object. */
-+ service_library *library;
-+ /* Collection of known functions.
-+
-+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
-+ 'tsearch'-style tree.
-+
-+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
-+ pointers to known_function structures, NULL-terminated. */
-+ union
-+ {
-+ void *tree;
-+ const known_function **array;
-+ } known;
-+ /* Name of the service (`files', `dns', `nis', ...). */
-+ const char *name;
-+} service_user;
-+
-+/* To access the action based on the status value use this macro. */
-+#define nss_next_action(ni, status) ((ni)->actions[2 + status])
-+
-+
-+typedef struct name_database_entry
-+{
-+ /* And the link to the next entry. */
-+ struct name_database_entry *next;
-+ /* List of service to be used. */
-+ service_user *service;
-+ /* Name of the database. */
-+ const char *name;
-+} name_database_entry;
-+
-+
-+typedef struct name_database
-+{
-+ /* List of all known databases. */
-+ name_database_entry *entry;
-+ /* List of libraries with service implementation. */
-+ service_library *library;
-+} name_database;
-+
-+
-+
-+/* Gathering the contents of the FIXED_FUNCTIONS file. */
-+
-+/* It should be possible to generate this list automatically by
-+ looking at the services and databases used in the nsswitch.conf
-+ file, and having a hard-coded set of queries supported on each
-+ database. */
-+
-+/* We #include the FIXED_FUNCTIONS file several times to build an
-+ array of function structures holding its data. */
-+enum function_kind {
-+ fk_end = 0, /* Last entry. */
-+ fk_setent, /* Like setpwent. */
-+ fk_getent, /* Like getpwent. */
-+ fk_endent, /* Like endpwent. */
-+ fk_getby, /* Like gethostbyname. */
-+ fk_get /* Like getpwnam. */
-+};
-+
-+
-+struct function {
-+ /* What kind of function this is. */
-+ enum function_kind kind;
-+
-+ /* The database and service of the function being hardwired in. */
-+ char *database, *service;
-+
-+ /* The kind of entry being queried, for 'fk_setent', 'fk_getent',
-+ 'fk_endent', and 'fk_getby' functions. */
-+ char *entry;
-+
-+ /* The key, for 'fk_getby' entries. */
-+ char *key;
-+
-+ /* The value and key, for 'fk_get' entries. */
-+ char *value_and_key;
-+};
-+
-+
-+const struct function functions[] =
-+ {
-+
-+#define DEFINE_ENT(database, service, entry) \
-+ { fk_setent, #database, #service, #entry }, \
-+ { fk_getent, #database, #service, #entry }, \
-+ { fk_endent, #database, #service, #entry },
-+#define DEFINE_GETBY(database, service, entry, key) \
-+ { fk_getby, #database, #service, #entry, #key },
-+#define DEFINE_GET(database, service, value_and_key) \
-+ { fk_get, #database, #service, NULL, NULL, #value_and_key },
-+
-+#include FIXED_FUNCTIONS
-+
-+#undef DEFINE_ENT
-+#undef DEFINE_GETBY
-+#undef DEFINE_GET
-+
-+ { fk_end }
-+ };
-+
-+
-+/* Parsing the config file. Functions copied from nsswitch.c. */
-+
-+#define __strchrnul strchrnul
-+#define __getline getline
-+#define __strncasecmp strncasecmp
-+
-+/* Prototypes for the local functions. */
-+static name_database *nss_parse_file (const char *fname) internal_function;
-+static name_database_entry *nss_getline (char *line) internal_function;
-+static service_user *nss_parse_service_list (const char *line)
-+ internal_function;
-+
-+static name_database *
-+internal_function
-+nss_parse_file (const char *fname)
-+{
-+ FILE *fp;
-+ name_database *result;
-+ name_database_entry *last;
-+ char *line;
-+ size_t len;
-+
-+ /* Open the configuration file. */
-+ fp = fopen (fname, "rc");
-+ if (fp == NULL)
-+ return NULL;
-+
-+ // /* No threads use this stream. */
-+ // __fsetlocking (fp, FSETLOCKING_BYCALLER);
-+
-+ result = (name_database *) xmalloc (sizeof (name_database));
-+
-+ result->entry = NULL;
-+ result->library = NULL;
-+ last = NULL;
-+ line = NULL;
-+ len = 0;
-+ do
-+ {
-+ name_database_entry *this;
-+ ssize_t n;
-+
-+ n = __getline (&line, &len, fp);
-+ if (n < 0)
-+ break;
-+ if (line[n - 1] == '\n')
-+ line[n - 1] = '\0';
-+
-+ /* Because the file format does not know any form of quoting we
-+ can search forward for the next '#' character and if found
-+ make it terminating the line. */
-+ *__strchrnul (line, '#') = '\0';
-+
-+ /* If the line is blank it is ignored. */
-+ if (line[0] == '\0')
-+ continue;
-+
-+ /* Each line completely specifies the actions for a database. */
-+ this = nss_getline (line);
-+ if (this != NULL)
-+ {
-+ if (last != NULL)
-+ last->next = this;
-+ else
-+ result->entry = this;
-+
-+ last = this;
-+ }
-+ }
-+ while (!feof_unlocked (fp));
-+
-+ /* Free the buffer. */
-+ free (line);
-+ /* Close configuration file. */
-+ fclose (fp);
-+
-+ return result;
-+}
-+
-+
-+/* Read the source names:
-+ `( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
-+ */
-+static service_user *
-+internal_function
-+nss_parse_service_list (const char *line)
-+{
-+ service_user *result = NULL, **nextp = &result;
-+
-+ while (1)
-+ {
-+ service_user *new_service;
-+ const char *name;
-+
-+ while (isspace (line[0]))
-+ ++line;
-+ if (line[0] == '\0')
-+ /* No source specified. */
-+ return result;
-+
-+ /* Read <source> identifier. */
-+ name = line;
-+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[')
-+ ++line;
-+ if (name == line)
-+ return result;
-+
-+
-+ new_service = (service_user *) xmalloc (sizeof (*new_service));
-+ new_service->name = (char *) xmalloc (line - name + 1);
-+
-+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
-+ = '\0';
-+
-+ /* Set default actions. */
-+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
-+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE;
-+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE;
-+ new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
-+ new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
-+ new_service->library = NULL;
-+ new_service->known.tree = NULL;
-+ new_service->next = NULL;
-+
-+ while (isspace (line[0]))
-+ ++line;
-+
-+ if (line[0] == '[')
-+ {
-+ /* Read criterions. */
-+ do
-+ ++line;
-+ while (line[0] != '\0' && isspace (line[0]));
-+
-+ do
-+ {
-+ int not;
-+ enum nss_status status;
-+ lookup_actions action;
-+
-+ /* Grok ! before name to mean all statii but that one. */
-+ not = line[0] == '!';
-+ if (not)
-+ ++line;
-+
-+ /* Read status name. */
-+ name = line;
-+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
-+ && line[0] != ']')
-+ ++line;
-+
-+ /* Compare with known statii. */
-+ if (line - name == 7)
-+ {
-+ if (__strncasecmp (name, "SUCCESS", 7) == 0)
-+ status = NSS_STATUS_SUCCESS;
-+ else if (__strncasecmp (name, "UNAVAIL", 7) == 0)
-+ status = NSS_STATUS_UNAVAIL;
-+ else
-+ return result;
-+ }
-+ else if (line - name == 8)
-+ {
-+ if (__strncasecmp (name, "NOTFOUND", 8) == 0)
-+ status = NSS_STATUS_NOTFOUND;
-+ else if (__strncasecmp (name, "TRYAGAIN", 8) == 0)
-+ status = NSS_STATUS_TRYAGAIN;
-+ else
-+ return result;
-+ }
-+ else
-+ return result;
-+
-+ while (isspace (line[0]))
-+ ++line;
-+ if (line[0] != '=')
-+ return result;
-+ do
-+ ++line;
-+ while (isspace (line[0]));
-+
-+ name = line;
-+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
-+ && line[0] != ']')
-+ ++line;
-+
-+ if (line - name == 6 && __strncasecmp (name, "RETURN", 6) == 0)
-+ action = NSS_ACTION_RETURN;
-+ else if (line - name == 8
-+ && __strncasecmp (name, "CONTINUE", 8) == 0)
-+ action = NSS_ACTION_CONTINUE;
-+ else
-+ return result;
-+
-+ if (not)
-+ {
-+ /* Save the current action setting for this status,
-+ set them all to the given action, and reset this one. */
-+ const lookup_actions save = new_service->actions[2 + status];
-+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
-+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
-+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
-+ new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
-+ new_service->actions[2 + status] = save;
-+ }
-+ else
-+ new_service->actions[2 + status] = action;
-+
-+ /* Skip white spaces. */
-+ while (isspace (line[0]))
-+ ++line;
-+ }
-+ while (line[0] != ']');
-+
-+ /* Skip the ']'. */
-+ ++line;
-+ }
-+
-+ *nextp = new_service;
-+ nextp = &new_service->next;
-+ }
-+}
-+
-+static name_database_entry *
-+internal_function
-+nss_getline (char *line)
-+{
-+ const char *name;
-+ name_database_entry *result;
-+ size_t len;
-+
-+ /* Ignore leading white spaces. ATTENTION: this is different from
-+ what is implemented in Solaris. The Solaris man page says a line
-+ beginning with a white space character is ignored. We regard
-+ this as just another misfeature in Solaris. */
-+ while (isspace (line[0]))
-+ ++line;
-+
-+ /* Recognize `<database> ":"'. */
-+ name = line;
-+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
-+ ++line;
-+ if (line[0] == '\0' || name == line)
-+ /* Syntax error. */
-+ return NULL;
-+ *line++ = '\0';
-+
-+ len = strlen (name) + 1;
-+
-+ result = (name_database_entry *) xmalloc (sizeof (*result));
-+ result->name = (char *) xmalloc (len);
-+
-+ /* Save the database name. */
-+ memcpy ((char *) result->name, name, len);
-+
-+ /* Parse the list of services. */
-+ result->service = nss_parse_service_list (line);
-+
-+ result->next = NULL;
-+ return result;
-+}
-+
-+
-+
-+/* Generating code for statically initialized nsswitch structures. */
-+
-+
-+/* Return the service-neutral suffix of the name of the service
-+ library function referred to by the function F. The result is
-+ allocated with malloc. */
-+char *
-+known_function_suffix (const struct function *f)
-+{
-+ switch (f->kind)
-+ {
-+ case fk_setent:
-+ return saprintf ("set%sent", f->entry);
-+
-+ case fk_getent:
-+ return saprintf ("get%sent_r", f->entry);
-+
-+ case fk_endent:
-+ return saprintf ("end%sent", f->entry);
-+
-+ case fk_getby:
-+ return saprintf ("get%sby%s_r", f->entry, f->key);
-+
-+ case fk_get:
-+ return saprintf ("get%s_r", f->value_and_key);
-+
-+ default:
-+ abort ();
-+ }
-+}
-+
-+
-+/* Return the name of the service library function referred to by the
-+ function F. The result is allocated with malloc. */
-+char *
-+known_function_name (const struct function *f)
-+{
-+ return saprintf ("_nss_%s_%s", f->service, known_function_suffix (f));
-+}
-+
-+
-+/* Write initialized known_function structures to OUT for
-+ all the functions we'll use. */
-+void
-+generate_known_functions (FILE *out)
-+{
-+ int i;
-+
-+ /* First, generate weak references to the functions. The service
-+ libraries depend on libc, and if these references weren't weak,
-+ we'd be making libc depend circularly on the service
-+ libraries. */
-+ for (i = 0; functions[i].kind; i++)
-+ {
-+ char *name = known_function_name (&functions[i]);
-+ fprintf (out, "typeof (%s) %s __attribute__ ((weak));\n",
-+ name, name);
-+ }
-+ fputs ("\n", out);
-+
-+ /* Then, a table mapping names to functions. */
-+ fputs ("static const known_function fixed_known_functions[] = {\n",
-+ out);
-+ for (i = 0; functions[i].kind; i++)
-+ {
-+ const struct function *f = &functions[i];
-+ char *suffix = known_function_suffix (f);
-+
-+ fprintf (out, " /* %2d */ { \"%s\", _nss_%s_%s },\n",
-+ i, suffix, f->service, suffix);
-+ }
-+ fputs ("};\n", out);
-+ fputs ("\n", out);
-+}
-+
-+
-+/* Print code to OUT for an initialized array of pointers to the
-+ 'known_function' structures needed for USER, which is for
-+ DATABASE. Return its name, allocated with malloc. */
-+char *
-+generate_known_function_list (FILE *out,
-+ const name_database_entry *database,
-+ const service_user *user)
-+{
-+ char *list_name = saprintf ("fixed_%s_%s_known_funcs",
-+ database->name, user->name);
-+ fprintf (out, "static const known_function *%s[] = {\n",
-+ list_name);
-+ int i;
-+ for (i = 0; functions[i].kind; i++)
-+ if (strcmp (functions[i].database, database->name) == 0
-+ && strcmp (functions[i].service, user->name) == 0)
-+ fprintf (out, " &fixed_known_functions[%d], /* %s */\n",
-+ i, known_function_name (&functions[i]));
-+ fputs (" NULL\n", out);
-+ fputs ("};\n", out);
-+ fputs ("\n", out);
-+
-+ return list_name;
-+}
-+
-+
-+/* Return the name of the status value STATUS, as a statically
-+ allocated string. */
-+const char *
-+lookup_status_name (enum nss_status status)
-+{
-+ switch (status)
-+ {
-+ case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN";
-+ case NSS_STATUS_UNAVAIL: return "NSS_STATUS_UNAVAIL";
-+ case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND";
-+ case NSS_STATUS_SUCCESS: return "NSS_STATUS_SUCCESS";
-+ case NSS_STATUS_RETURN: return "NSS_STATUS_RETURN";
-+ default: abort ();
-+ };
-+}
-+
-+
-+/* Return the name of ACTION as a statically allocated string. */
-+const char *
-+lookup_action_name (lookup_actions action)
-+{
-+ switch (action)
-+ {
-+ case NSS_ACTION_CONTINUE: return "NSS_ACTION_CONTINUE";
-+ case NSS_ACTION_RETURN: return "NSS_ACTION_RETURN";
-+ default: abort ();
-+ }
-+}
-+
-+
-+/* Print code to OUT for the list of service_user structures starting
-+ with USER, which are all for DATABASE. Return the name of the
-+ first structure in that list, or zero if USER is NULL. */
-+char *
-+generate_service_user_list (FILE *out,
-+ name_database_entry *database,
-+ service_user *user)
-+{
-+ if (user)
-+ {
-+ /* Generate the tail of the list. */
-+ char *next_name = generate_service_user_list (out, database, user->next);
-+ /* Generate our known function list. */
-+ char *known_function_list_name =
-+ generate_known_function_list (out, database, user);
-+
-+ char *name = saprintf ("fixed_%s_%s_user", database->name, user->name);
-+
-+ fprintf (out, "static const service_user %s = {\n", name);
-+ if (next_name)
-+ fprintf (out, " (service_user *) &%s,\n", next_name);
-+ else
-+ fprintf (out, " NULL, /* no next entry */\n");
-+ fputs (" {\n", out);
-+ int i;
-+ for (i = 0; i < sizeof (user->actions) / sizeof (user->actions[0]); i++)
-+ fprintf (out, " %s, /* %s */\n",
-+ lookup_action_name (user->actions[i]),
-+ lookup_status_name (i - 2));
-+ fputs (" },\n", out);
-+ fprintf (out, " NULL, /* we never need the service library */\n");
-+ fprintf (out, " { .array = %s },\n", known_function_list_name);
-+ fprintf (out, " \"%s\"\n", user->name);
-+ fputs ("};\n", out);
-+ fputs ("\n", out);
-+
-+ return name;
-+ }
-+ else
-+ return NULL;
-+}
-+
-+
-+/* Print code to OUT for the list of name_database_entry structures
-+ starting with DATABASE. Return the name of the first structure
-+ in that list, or zero if DATABASE is NULL. */
-+char *
-+generate_name_database_entries (FILE *out, name_database_entry *database)
-+{
-+ if (database)
-+ {
-+ char *next_name = generate_name_database_entries (out, database->next);
-+ char *service_user_name
-+ = generate_service_user_list (out, database, database->service);
-+ char *name = saprintf ("fixed_%s_name_database", database->name);
-+
-+ fprintf (out, "static const name_database_entry %s = {\n", name);
-+
-+ if (next_name)
-+ fprintf (out, " (name_database_entry *) &%s,\n", next_name);
-+ else
-+ fprintf (out, " NULL,\n");
-+
-+ if (service_user_name)
-+ fprintf (out, " (service_user *) &%s,\n", service_user_name);
-+ else
-+ fprintf (out, " NULL,\n");
-+
-+ fprintf (out, " \"%s\"\n", database->name);
-+ fprintf (out, "};\n");
-+ fputs ("\n", out);
-+
-+ return name;
-+ }
-+ else
-+ return NULL;
-+}
-+
-+
-+void
-+generate_name_database (FILE *out, name_database *service_table)
-+{
-+ /* Produce a linked list of the known name_database_entry
-+ structures. */
-+ char *entries = generate_name_database_entries (out, service_table->entry);
-+
-+ /* Now produce the main structure that points to them all. */
-+ fprintf (out, "static const name_database fixed_name_database = {\n");
-+ if (entries)
-+ fprintf (out, " (name_database_entry *) &%s,\n", entries);
-+ else
-+ fprintf (out, " NULL,\n");
-+ fputs (" NULL /* we don't need the libraries */\n"
-+ "};\n",
-+ out);
-+}
-+
-+
-+
-+/* Generating the list of service libraries we generate references to. */
-+
-+/* String with revision number of the shared object files. */
-+static const char *const nss_shlib_revision = LIBNSS_FILES_SO + 15;
-+
-+void
-+generate_service_lib_list (FILE *out, name_database *service_table)
-+{
-+ int i, j;
-+ int printed_any = 0;
-+
-+ for (i = 0; functions[i].kind; i++)
-+ {
-+ /* Mention each service library only once. */
-+ for (j = 0; j < i; j++)
-+ if (strcmp (functions[i].service, functions[j].service) == 0)
-+ break;
-+
-+ if (j >= i)
-+ {
-+ if (printed_any)
-+ putc (' ', out);
-+ fprintf (out, "-lnss_%s",
-+ functions[i].service,
-+ nss_shlib_revision);
-+ printed_any = 1;
-+ }
-+ }
-+}
-+
-+
-+/* Main. */
-+
-+int
-+main (int argc, char **argv)
-+{
-+ if (argc != 4)
-+ {
-+ fprintf (stderr, "usage: gen-fixed-nsswitch HEADER SERVLIBS CONFIG\n");
-+ exit (1);
-+ }
-+
-+ name_database *service_table = nss_parse_file (argv[3]);
-+
-+ FILE *header = fopen (argv[1], "w");
-+ if (! header)
-+ {
-+ fprintf (stderr,
-+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
-+ argv[1], strerror (errno));
-+ exit (1);
-+ }
-+ fputs ("/* Generated by nss/gen-fixed-nsswitch.c. */\n", header);
-+ fputs ("\n", header);
-+ generate_known_functions (header);
-+ generate_name_database (header, service_table);
-+ fclose (header);
-+
-+ FILE *service_lib_list = fopen (argv[2], "w");
-+ if (! service_lib_list)
-+ {
-+ fprintf (stderr,
-+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
-+ argv[2], strerror (errno));
-+ exit (1);
-+ }
-+ generate_service_lib_list (service_lib_list, service_table);
-+ fclose (service_lib_list);
-+
-+ return 0;
-+}
-diff --git a/nss/getent.c b/nss/getent.c
-index 34df848..674c8ee 100644
---- a/nss/getent.c
-+++ b/nss/getent.c
-@@ -39,6 +39,7 @@
- #include <netinet/ether.h>
- #include <netinet/in.h>
- #include <sys/socket.h>
-+#include <gnu/option-groups.h>
-
- /* Get libc version number. */
- #include <version.h>
-@@ -91,6 +92,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
- fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
- }
-
-+#if __OPTION_EGLIBC_DB_ALIASES
- /* This is for aliases */
- static void
- print_aliases (struct aliasent *alias)
-@@ -135,7 +137,9 @@ aliases_keys (int number, char *key[])
-
- return result;
- }
-+#endif /* __OPTION_EGLIBC_DB_ALIASES */
-
-+#if __OPTION_EGLIBC_INET
- /* This is for ethers */
- static int
- ethers_keys (int number, char *key[])
-@@ -179,6 +183,7 @@ ethers_keys (int number, char *key[])
-
- return result;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* This is for group */
- static void
-@@ -301,6 +306,7 @@ gshadow_keys (int number, char *key[])
- return result;
- }
-
-+#if __OPTION_EGLIBC_INET
- /* This is for hosts */
- static void
- print_hosts (struct hostent *host)
-@@ -598,6 +604,7 @@ networks_keys (int number, char *key[])
-
- return result;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* Now is all for passwd */
- static void
-@@ -650,6 +657,7 @@ passwd_keys (int number, char *key[])
- return result;
- }
-
-+#if __OPTION_EGLIBC_INET
- /* This is for protocols */
- static void
- print_protocols (struct protoent *proto)
-@@ -807,6 +815,7 @@ services_keys (int number, char *key[])
-
- return result;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* This is for shadow */
- static void
-@@ -873,23 +882,36 @@ struct
- } databases[] =
- {
- #define D(name) { #name, name ## _keys },
--D(ahosts)
--D(ahostsv4)
--D(ahostsv6)
--D(aliases)
--D(ethers)
-+
-+#if __OPTION_EGLIBC_INET
-+# define DN(name) D(name)
-+#else
-+# define DN(name)
-+#endif
-+
-+#if __OPTION_EGLIBC_DB_ALIASES
-+# define DA(name) D(name)
-+#else
-+# define DA(name)
-+#endif
-+
-+DN(ahosts)
-+DN(ahostsv4)
-+DN(ahostsv6)
-+DA(aliases)
-+DN(ethers)
- D(group)
- D(gshadow)
--D(hosts)
--D(initgroups)
--D(netgroup)
--D(networks)
-+DN(hosts)
-+DN(initgroups)
-+DN(netgroup)
-+DN(networks)
- D(passwd)
--D(protocols)
-+DN(protocols)
- #if HAVE_SUNRPC
--D(rpc)
-+DN(rpc)
- #endif
--D(services)
-+DN(services)
- D(shadow)
- #undef D
- { NULL, NULL }
-diff --git a/nss/getnssent_r.c b/nss/getnssent_r.c
-index f5b9036..f09f7fe 100644
---- a/nss/getnssent_r.c
-+++ b/nss/getnssent_r.c
-@@ -16,6 +16,7 @@
- <http://www.gnu.org/licenses/>. */
-
- #include <errno.h>
-+#include <gnu/option-groups.h>
- #include <netdb.h>
- #include "nsswitch.h"
-
-@@ -59,11 +60,13 @@ __nss_setent (const char *func_name, db_lookup_function lookup_fct,
- } fct;
- int no_more;
-
-+#if __OPTION_EGLIBC_INET
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- __set_h_errno (NETDB_INTERNAL);
- return;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* Cycle through the services and run their `setXXent' functions until
- we find an available service. */
-@@ -101,11 +104,13 @@ __nss_endent (const char *func_name, db_lookup_function lookup_fct,
- } fct;
- int no_more;
-
-+#if __OPTION_EGLIBC_INET
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- __set_h_errno (NETDB_INTERNAL);
- return;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* Cycle through all the services and run their endXXent functions. */
- no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
-@@ -141,12 +146,14 @@ __nss_getent_r (const char *getent_func_name,
- int no_more;
- enum nss_status status;
-
-+#if __OPTION_EGLIBC_INET
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- *h_errnop = NETDB_INTERNAL;
- *result = NULL;
- return errno;
- }
-+#endif /* __OPTION_EGLIBC_INET */
-
- /* Initialize status to return if no more functions are found. */
- status = NSS_STATUS_NOTFOUND;
-@@ -161,7 +168,7 @@ __nss_getent_r (const char *getent_func_name,
- int is_last_nip = *nip == *last_nip;
-
- status = DL_CALL_FCT (fct.f,
-- (resbuf, buffer, buflen, &errno, &h_errno));
-+ (resbuf, buffer, buflen, &errno, h_errnop));
-
- /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
- provided buffer is too small. In this case we should give
-diff --git a/nss/nsswitch.c b/nss/nsswitch.c
-index 9712623..c81e207 100644
---- a/nss/nsswitch.c
-+++ b/nss/nsswitch.c
-@@ -26,6 +26,7 @@
- #include <stdio_ext.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <gnu/option-groups.h>
-
- #include <aliases.h>
- #include <grp.h>
-@@ -41,6 +42,15 @@
- #include "../nscd/nscd_proto.h"
- #include <sysdep.h>
-
-+/* When OPTION_EGLIBC_NSSWITCH is disabled, we use fixed tables of
-+ databases and services, generated at library build time. Thus:
-+ - We can't reconfigure individual databases, so we don't need a
-+ name-to-database map.
-+ - We never add databases or service libraries, or look up functions
-+ at runtime, so there's no need for a lock to protect our tables.
-+ See ../option-groups.def for the details. */
-+#if __OPTION_EGLIBC_NSSWITCH
-+
- /* Prototypes for the local functions. */
- static name_database *nss_parse_file (const char *fname) internal_function;
- static name_database_entry *nss_getline (char *line) internal_function;
-@@ -79,6 +89,9 @@ bool __nss_database_custom[NSS_DBSIDX_max];
-
- __libc_lock_define_initialized (static, lock)
-
-+#define lock_nsswitch __libc_lock_lock (lock)
-+#define unlock_nsswitch __libc_lock_unlock (lock)
-+
- #if !defined DO_STATIC_NSS || defined SHARED
- /* String with revision number of the shared object files. */
- static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
-@@ -93,6 +106,20 @@ static name_database *service_table;
- __libc_freeres. */
- static name_database_entry *defconfig_entries;
-
-+#else /* __OPTION_EGLIBC_NSSWITCH */
-+
-+/* Bring in the statically initialized service table we generated at
-+ build time. */
-+#include "fixed-nsswitch.h"
-+
-+const static name_database *service_table = &fixed_name_database;
-+
-+/* Nothing ever changes, so there's no need to lock anything. */
-+#define lock_nsswitch (0)
-+#define unlock_nsswitch (0)
-+
-+#endif /* __OPTION_EGLIBC_NSSWITCH */
-+
-
- #ifdef USE_NSCD
- /* Nonzero if this is the nscd process. */
-@@ -109,20 +136,22 @@ __nss_database_lookup (const char *database, const char *alternate_name,
- const char *defconfig, service_user **ni)
- {
- /* Prevent multiple threads to change the service table. */
-- __libc_lock_lock (lock);
-+ lock_nsswitch;
-
- /* Reconsider database variable in case some other thread called
- `__nss_configure_lookup' while we waited for the lock. */
- if (*ni != NULL)
- {
-- __libc_lock_unlock (lock);
-+ unlock_nsswitch;
- return 0;
- }
-
-+#if __OPTION_EGLIBC_NSSWITCH
- /* Are we initialized yet? */
- if (service_table == NULL)
- /* Read config file. */
- service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
-+#endif
-
- /* Test whether configuration data is available. */
- if (service_table != NULL)
-@@ -144,6 +173,7 @@ __nss_database_lookup (const char *database, const char *alternate_name,
- *ni = entry->service;
- }
-
-+#if __OPTION_EGLIBC_NSSWITCH
- /* No configuration data is available, either because nsswitch.conf
- doesn't exist or because it doesn't have a line for this database.
-
-@@ -166,13 +196,23 @@ __nss_database_lookup (const char *database, const char *alternate_name,
- {
- entry->next = defconfig_entries;
- entry->service = *ni;
-- entry->name[0] = '\0';
-+ entry->name = "";
- defconfig_entries = entry;
- }
- }
- }
-+#else
-+ /* Without the dynamic behavior, we can't process defconfig. The
-+ databases the user specified at library build time are all you
-+ get. */
-+ if (*ni == NULL)
-+ {
-+ unlock_nsswitch;
-+ return -1;
-+ }
-+#endif
-
-- __libc_lock_unlock (lock);
-+ unlock_nsswitch;
-
- return *ni != NULL ? 0 : -1;
- }
-@@ -252,6 +292,7 @@ __nss_next2 (service_user **ni, const char *fct_name, const char *fct2_name,
- libc_hidden_def (__nss_next2)
-
-
-+#if __OPTION_EGLIBC_NSSWITCH
- int
- attribute_compat_text_section
- __nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
-@@ -300,13 +341,13 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
- }
-
- /* Prevent multiple threads to change the service table. */
-- __libc_lock_lock (lock);
-+ lock_nsswitch;
-
- /* Install new rules. */
- *databases[cnt].dbp = new_db;
- __nss_database_custom[cnt] = true;
-
-- __libc_lock_unlock (lock);
-+ unlock_nsswitch;
-
- return 0;
- }
-@@ -402,7 +443,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
- void **found, *result;
-
- /* We now modify global data. Protect it. */
-- __libc_lock_lock (lock);
-+ lock_nsswitch;
-
- /* Search the tree of functions previously requested. Data in the
- tree are `known_function' structures, whose first member is a
-@@ -413,7 +454,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
- enough to a pointer to our structure to use as a lookup key that
- will be passed to `known_compare' (above). */
-
-- found = __tsearch (&fct_name, &ni->known, &known_compare);
-+ found = __tsearch (&fct_name, &ni->known.tree, &known_compare);
- if (found == NULL)
- /* This means out-of-memory. */
- result = NULL;
-@@ -440,7 +481,7 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
- #endif
- /* Oops. We can't instantiate this node properly.
- Remove it from the tree. */
-- __tdelete (&fct_name, &ni->known, &known_compare);
-+ __tdelete (&fct_name, &ni->known.tree, &known_compare);
- free (known);
- result = NULL;
- }
-@@ -520,13 +561,43 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
- }
-
- /* Remove the lock. */
-- __libc_lock_unlock (lock);
-+ unlock_nsswitch;
-
- return result;
- }
- libc_hidden_def (__nss_lookup_function)
-
-
-+#else /* below if ! __OPTION_EGLIBC_NSSWITCH */
-+
-+
-+int
-+__nss_configure_lookup (const char *dbname, const char *service_line)
-+{
-+ /* We can't dynamically configure lookup without
-+ OPTION_EGLIBC_NSSWITCH. */
-+ __set_errno (EINVAL);
-+ return -1;
-+}
-+
-+
-+void *
-+__nss_lookup_function (service_user *ni, const char *fct_name)
-+{
-+ int i;
-+ const known_function **known = ni->known.array;
-+
-+ for (i = 0; known[i]; i++)
-+ if (strcmp (fct_name, known[i]->fct_name) == 0)
-+ return known[i]->fct_ptr;
-+
-+ return NULL;
-+}
-+libc_hidden_def (__nss_lookup_function)
-+#endif
-+
-+
-+#if __OPTION_EGLIBC_NSSWITCH
- static name_database *
- internal_function
- nss_parse_file (const char *fname)
-@@ -632,8 +703,10 @@ nss_parse_service_list (const char *line)
- + (line - name + 1));
- if (new_service == NULL)
- return result;
-+ new_service->name = (char *) (new_service + 1);
-
-- *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
-+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
-+ = '\0';
-
- /* Set default actions. */
- new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
-@@ -642,7 +715,7 @@ nss_parse_service_list (const char *line)
- new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
- new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
- new_service->library = NULL;
-- new_service->known = NULL;
-+ new_service->known.tree = NULL;
- new_service->next = NULL;
-
- while (isspace (line[0]))
-@@ -778,9 +851,10 @@ nss_getline (char *line)
- result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
- if (result == NULL)
- return NULL;
-+ result->name = (char *) (result + 1);
-
- /* Save the database name. */
-- memcpy (result->name, name, len);
-+ memcpy ((char *) result->name, name, len);
-
- /* Parse the list of services. */
- result->service = nss_parse_service_list (line);
-@@ -816,6 +890,7 @@ nss_new_service (name_database *database, const char *name)
- return *currentp;
- }
- #endif
-+#endif /* __OPTION_EGLIBC_NSSWITCH */
-
-
- #if defined SHARED && defined USE_NSCD
-@@ -834,6 +909,7 @@ nss_load_all_libraries (const char *service, const char *def)
- }
-
-
-+#if __OPTION_EGLIBC_INET
- /* Called by nscd and nscd alone. */
- void
- __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
-@@ -857,8 +933,10 @@ __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
- __nss_not_use_nscd_services = -1;
- __nss_not_use_nscd_netgroup = -1;
- }
-+#endif /* __OPTION_EGLIBC_INET */
- #endif
-
-+#if __OPTION_EGLIBC_NSSWITCH
- static void
- free_database_entries (name_database_entry *entry)
- {
-@@ -871,8 +949,8 @@ free_database_entries (name_database_entry *entry)
- {
- service_user *olds = service;
-
-- if (service->known != NULL)
-- __tdestroy (service->known, free);
-+ if (service->known.tree != NULL)
-+ __tdestroy (service->known.tree, free);
-
- service = service->next;
- free (olds);
-@@ -926,3 +1004,4 @@ libc_freeres_fn (free_mem)
-
- free (top);
- }
-+#endif /* __OPTION_EGLIBC_NSSWITCH */
-diff --git a/nss/nsswitch.h b/nss/nsswitch.h
-index a5318fa..1730977 100644
---- a/nss/nsswitch.h
-+++ b/nss/nsswitch.h
-@@ -65,10 +65,20 @@ typedef struct service_user
- lookup_actions actions[5];
- /* Link to the underlying library object. */
- service_library *library;
-- /* Collection of known functions. */
-- void *known;
-+ /* Collection of known functions.
-+
-+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
-+ 'tsearch'-style tree.
-+
-+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
-+ pointers to known_function structures, NULL-terminated. */
-+ union
-+ {
-+ void *tree;
-+ const known_function **array;
-+ } known;
- /* Name of the service (`files', `dns', `nis', ...). */
-- char name[0];
-+ const char *name;
- } service_user;
-
- /* To access the action based on the status value use this macro. */
-@@ -82,7 +92,7 @@ typedef struct name_database_entry
- /* List of service to be used. */
- service_user *service;
- /* Name of the database. */
-- char name[0];
-+ const char *name;
- } name_database_entry;
-
-
-diff --git a/posix/Makefile b/posix/Makefile
-index 15e8818..609ed03 100644
---- a/posix/Makefile
-+++ b/posix/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for POSIX portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := posix
-
- include ../Makeconfig
-@@ -43,13 +45,24 @@ routines := \
- getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
- getresuid getresgid setresuid setresgid \
- pathconf sysconf fpathconf \
-- glob glob64 fnmatch regex \
-+ glob glob64 fnmatch \
- confstr \
- getopt getopt1 getopt_init \
- sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
- sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
-- getaddrinfo gai_strerror wordexp \
- pread pwrite pread64 pwrite64 \
-+ posix_madvise \
-+ get_child_max sched_cpucount sched_cpualloc sched_cpufree
-+
-+routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
-+
-+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
-+routines-$(OPTION_POSIX_REGEXP) += regex
-+else
-+routines-$(OPTION_POSIX_REGEXP) += xregex
-+endif
-+
-+routines-$(OPTION_EGLIBC_SPAWN) += \
- spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
- spawn_faction_addopen spawn_faction_adddup2 \
- spawnattr_init spawnattr_destroy \
-@@ -61,37 +74,54 @@ routines := \
- posix_madvise \
- get_child_max sched_cpucount sched_cpualloc sched_cpufree
-
-+routines-$(OPTION_EGLIBC_WORDEXP) += wordexp
-+
- aux := init-posix environ
--tests := tstgetopt testfnm runtests runptests \
-+tests := tstgetopt testfnm runtests \
- tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
-- tst-mmap tst-getaddrinfo tst-truncate \
-- tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
-- tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
-- tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
-- bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
-- bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
-- bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
-- bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
-- bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
-+ tst-mmap tst-truncate \
-+ tst-truncate64 tst-fork tst-dir \
-+ tst-chmod bug-regex2 bug-regex3 bug-regex4 \
-+ tst-gnuglob bug-regex6 bug-regex7 \
-+ bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
-+ bug-regex14 bug-regex15 \
-+ bug-regex21 bug-regex24 \
-+ bug-regex27 bug-regex28 \
- bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
-- bug-regex33 tst-nice tst-nanosleep tst-regex2 \
-- transbug tst-rxspencer tst-pcre tst-boost \
-- bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
-- tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
-+ tst-nice tst-nanosleep \
-+ transbug \
-+ tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
-+ bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
- tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
- tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
- tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
-- tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
-- tst-rfc3484-3 \
-- tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
-+ tst-execvp3 tst-execvp4 \
-+ tst-fnmatch2 tst-cpucount tst-cpuset \
- bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
- bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
- tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
- tst-fnmatch3 bug-regex36 tst-getaddrinfo5
--xtests := bug-ga2
-+
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-fnmatch tst-regexloc bug-regex1 bug-regex5 \
-+ bug-regex23 bug-regex25 bug-regex32 bug-regex33
-+tests-$(OPTION_EGLIBC_INET) \
-+ += tst-getaddrinfo bug-ga1 tst-getaddrinfo2 \
-+ tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 tst-getaddrinfo3
-+tests-$(OPTION_POSIX_REGEXP_GLIBC) \
-+ += runptests bug-regex11 bug-regex13 bug-regex16 \
-+ tst-regex2 tst-rxspencer tst-pcre tst-boost
-+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP_GLIBC))
-+tests += tst-regex bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
-+ bug-regex22 bug-regex26
-+endif
-+xtests-$(OPTION_EGLIBC_INET) += bug-ga2
-+
- ifeq (yes,$(build-shared))
- test-srcs := globtest
--tests += wordexp-test tst-exec tst-spawn
-+tests += tst-exec
-+tests-$(OPTION_EGLIBC_SPAWN) += tst-spawn
-+tests-$(OPTION_EGLIBC_WORDEXP) += wordexp-test
- endif
- tests-static = tst-exec-static tst-spawn-static
- tests += $(tests-static)
-@@ -117,7 +147,10 @@ generated += $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
-
- ifeq ($(run-built-tests),yes)
- ifeq (yes,$(build-shared))
--tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
-+tests-special += $(objpfx)globtest.out
-+ifeq (y,$(OPTION_EGLIBC_WORDEXP))
-+tests-special += $(objpfx)wordexp-tst.out
-+endif
- endif
- endif
-
-@@ -125,12 +158,16 @@ endif
- # XXX Please note that for now we ignore the result of this test.
- tests-special += $(objpfx)annexc.out
- ifeq ($(run-built-tests),yes)
--tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
-+tests-special += $(objpfx)bug-regex2-mem.out \
- $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
-- $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
-- $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
-+ $(objpfx)tst-getconf.out \
- $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
- $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out
-+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
-+tests-special += $(objpfx)bug-regex14-mem.out $(objpfx)tst-rxspencer-no-utf8-mem.out \
-+ $(objpfx)tst-pcre-mem.out $(objpfx)tst-boost-mem.out
-+endif
-+
- xtests-special += $(objpfx)bug-ga2-mem.out
- endif
-
-@@ -143,6 +180,8 @@ $(objpfx)globtest.out: globtest.sh $(objpfx)globtest
- $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
- '$(test-program-prefix)' '$(test-wrapper-env)'; \
- $(evaluate-test)
-+LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
-+
- $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
- $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
- '$(run-program-env)' '$(test-program-prefix-after-env)'; \
-@@ -205,7 +244,10 @@ tst-dir-ARGS = `pwd` `cd $(common-objdir)/$(subdir); pwd` `cd $(common-objdir);
- tst-chmod-ARGS = $(objdir)
- tst-vfork3-ARGS = --test-dir=$(objpfx)
-
--tst-rxspencer-ARGS = --utf8 rxspencer/tests
-+tst-rxspencer-ARGS = rxspencer/tests
-+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
-+tst-rxspencer-ARGS += --utf8
-+endif
- tst-rxspencer-no-utf8-ARGS = rxspencer/tests
- tst-pcre-ARGS = PCRE.tests
- tst-boost-ARGS = BOOST.tests
-diff --git a/posix/bug-regex1.c b/posix/bug-regex1.c
-index 38eb543..17cd1a0 100644
---- a/posix/bug-regex1.c
-+++ b/posix/bug-regex1.c
-@@ -4,6 +4,7 @@
- #include <string.h>
- #include <regex.h>
- #include <wchar.h>
-+#include <gnu/option-groups.h>
-
- int
- main (void)
-@@ -17,7 +18,9 @@ main (void)
- memset (&regex, '\0', sizeof (regex));
-
- setlocale (LC_ALL, "de_DE.ISO-8859-1");
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- fwide (stdout, -1);
-+#endif
-
- re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
-
-diff --git a/posix/bug-regex6.c b/posix/bug-regex6.c
-index efcc890..3b270c7 100644
---- a/posix/bug-regex6.c
-+++ b/posix/bug-regex6.c
-@@ -22,6 +22,7 @@
- #include <string.h>
- #include <sys/types.h>
- #include <regex.h>
-+#include <gnu/option-groups.h>
-
-
- int
-@@ -30,7 +31,12 @@ main (int argc, char *argv[])
- regex_t re;
- regmatch_t mat[10];
- int i, j, ret = 0;
-- const char *locales[] = { "C", "de_DE.UTF-8" };
-+ const char *locales[] = {
-+ "C",
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+ "de_DE.UTF-8"
-+#endif
-+ };
- const char *string = "http://www.regex.com/pattern/matching.html#intro";
- regmatch_t expect[10] = {
- { 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
-diff --git a/posix/fnmatch.c b/posix/fnmatch.c
-index fd85efa..01cc9fe 100644
---- a/posix/fnmatch.c
-+++ b/posix/fnmatch.c
-@@ -30,6 +30,10 @@
- #include <ctype.h>
- #include <string.h>
-
-+#if defined _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-+
- #if defined STDC_HEADERS || defined _LIBC
- # include <stdlib.h>
- #endif
-@@ -131,7 +135,7 @@ extern int fnmatch (const char *pattern, const char *string, int flags);
- # define ISWCTYPE(WC, WT) iswctype (WC, WT)
- # endif
-
--# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
-+# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS && _LIBC && __OPTION_EGLIBC_LOCALE_CODE)
- /* In this case we are implementing the multibyte character handling. */
- # define HANDLE_MULTIBYTE 1
- # endif
-diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
-index f46c9df..74e1754 100644
---- a/posix/fnmatch_loop.c
-+++ b/posix/fnmatch_loop.c
-@@ -15,6 +15,8 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-+#include <gnu/option-groups.h>
-+
- #include <stdint.h>
-
- struct STRUCT
-@@ -54,10 +56,15 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
- const char *collseq = (const char *)
- _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
- # else
-+# if __OPTION_EGLIBC_LOCALE_CODE
- const UCHAR *collseq = (const UCHAR *)
- _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
--# endif
--#endif
-+# define COLLSEQ_BYTE_LOOKUP(ix) (collseq[(ix)])
-+# else
-+# define COLLSEQ_BYTE_LOOKUP(ix) (ix)
-+# endif /* __OPTION_EGLIBC_LOCALE_CODE */
-+# endif /* WIDE_CHAR_VERSION */
-+#endif /* _LIBC */
-
- while ((c = *p++) != L('\0'))
- {
-@@ -277,7 +284,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
- /* Leave room for the null. */
- CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
- size_t c1 = 0;
--#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
-+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
- wctype_t wt;
- #endif
- const CHAR *startp = p;
-@@ -307,7 +314,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
- }
- str[c1] = L('\0');
-
--#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
-+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
- wt = IS_CHAR_CLASS (str);
- if (wt == 0)
- /* Invalid character class name. */
-@@ -680,8 +687,10 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
- else
- lcollseq = __collseq_table_lookup (collseq, cold);
- # else
-- fcollseq = collseq[fn];
-- lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
-+ fcollseq = COLLSEQ_BYTE_LOOKUP (fn);
-+ lcollseq = (is_seqval
-+ ? cold
-+ : COLLSEQ_BYTE_LOOKUP ((UCHAR) cold));
- # endif
-
- is_seqval = 0;
-@@ -857,7 +866,7 @@ FCT (pattern, string, string_end, no_leading_period, flags, ends, alloca_used)
- goto matched;
- }
- # else
-- hcollseq = collseq[cend];
-+ hcollseq = COLLSEQ_BYTE_LOOKUP (cend);
- # endif
- }
-
-diff --git a/posix/glob.c b/posix/glob.c
-index d65e55d..1ac00a1 100644
---- a/posix/glob.c
-+++ b/posix/glob.c
-@@ -25,6 +25,9 @@
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <stddef.h>
-+#ifdef _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-
- /* Outcomment the following line for production quality code. */
- /* #define NDEBUG 1 */
-@@ -607,6 +610,7 @@ glob (pattern, flags, errfunc, pglob)
- if (home_dir == NULL || home_dir[0] == '\0')
- home_dir = "c:/users/default"; /* poor default */
- # else
-+# if ! _LIBC || __OPTION_EGLIBC_GETLOGIN
- if (home_dir == NULL || home_dir[0] == '\0')
- {
- int success;
-@@ -623,19 +627,19 @@ glob (pattern, flags, errfunc, pglob)
- if (success)
- {
- struct passwd *p;
--# if defined HAVE_GETPWNAM_R || defined _LIBC
-+# if defined HAVE_GETPWNAM_R || defined _LIBC
- long int pwbuflen = GETPW_R_SIZE_MAX ();
- char *pwtmpbuf;
- struct passwd pwbuf;
- int malloc_pwtmpbuf = 0;
- int save = errno;
-
--# ifndef _LIBC
-+# ifndef _LIBC
- if (pwbuflen == -1)
- /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
- Try a moderate value. */
- pwbuflen = 1024;
--# endif
-+# endif
- if (__libc_use_alloca (alloca_used + pwbuflen))
- pwtmpbuf = alloca_account (pwbuflen, alloca_used);
- else
-@@ -682,9 +686,9 @@ glob (pattern, flags, errfunc, pglob)
- }
- __set_errno (save);
- }
--# else
-+# else
- p = getpwnam (name);
--# endif
-+# endif
- if (p != NULL)
- {
- if (!malloc_pwtmpbuf)
-@@ -713,6 +717,7 @@ glob (pattern, flags, errfunc, pglob)
- }
- }
- }
-+# endif /* ! _LIBC || __OPTION_EGLIBC_GETLOGIN */
- if (home_dir == NULL || home_dir[0] == '\0')
- {
- if (flags & GLOB_TILDE_CHECK)
-diff --git a/posix/regcomp.c b/posix/regcomp.c
-index bf8aa16..6a41251 100644
---- a/posix/regcomp.c
-+++ b/posix/regcomp.c
-@@ -18,6 +18,7 @@
- <http://www.gnu.org/licenses/>. */
-
- #include <stdint.h>
-+#include <gnu/option-groups.h>
-
- #ifdef _LIBC
- # include <locale/weight.h>
-@@ -309,7 +310,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- {
- re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
- int node_cnt;
-- int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
-+ int icase = (dfa_mb_cur_max (dfa) == 1 && (bufp->syntax & RE_ICASE));
- for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
- {
- int node = init_state->nodes.elems[node_cnt];
-@@ -319,9 +320,9 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- {
- re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
- #ifdef RE_ENABLE_I18N
-- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
-+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
- {
-- unsigned char *buf = alloca (dfa->mb_cur_max), *p;
-+ unsigned char *buf = alloca (dfa_mb_cur_max (dfa)), *p;
- wchar_t wc;
- mbstate_t state;
-
-@@ -352,7 +353,11 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- re_set_fastmap (fastmap, icase, ch);
- }
- }
--#ifdef RE_ENABLE_I18N
-+
-+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, the current
-+ locale is always C, which has no rules and no multi-byte
-+ characters. */
-+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
- else if (type == COMPLEX_BRACKET)
- {
- re_charset_t *cset = dfa->nodes[node].opr.mbcset;
-@@ -380,7 +385,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- i.e. where we would not find an invalid sequence. This only
- applies to multibyte character sets; for single byte character
- sets, the SIMPLE_BRACKET again suffices. */
-- if (dfa->mb_cur_max > 1
-+ if (dfa_mb_cur_max (dfa) > 1
- && (cset->nchar_classes || cset->non_match || cset->nranges
- # ifdef _LIBC
- || cset->nequiv_classes
-@@ -408,7 +413,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- memset (&state, '\0', sizeof (state));
- if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
- re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
-- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
-+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
- {
- if (__wcrtomb (buf, __towlower (cset->mbchars[i]), &state)
- != (size_t) -1)
-@@ -417,7 +422,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
- }
- }
- }
--#endif /* RE_ENABLE_I18N */
-+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
- else if (type == OP_PERIOD
- #ifdef RE_ENABLE_I18N
- || type == OP_UTF8_PERIOD
-@@ -860,11 +865,15 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
-
- dfa->mb_cur_max = MB_CUR_MAX;
- #ifdef _LIBC
-- if (dfa->mb_cur_max == 6
-+ if (dfa_mb_cur_max (dfa) == 6
- && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
- dfa->is_utf8 = 1;
-+# if __OPTION_EGLIBC_LOCALE_CODE
- dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
- != 0);
-+# else
-+ dfa->map_notascii = 0;
-+# endif
- #else
- # ifdef HAVE_LANGINFO_CODESET
- codeset_name = nl_langinfo (CODESET);
-@@ -890,7 +899,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
- #endif
-
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- {
- if (dfa->is_utf8)
- dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
-@@ -1788,7 +1797,7 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
- token->word_char = 0;
- #ifdef RE_ENABLE_I18N
- token->mb_partial = 0;
-- if (input->mb_cur_max > 1 &&
-+ if (string_mb_cur_max (input) > 1 &&
- !re_string_first_byte (input, re_string_cur_idx (input)))
- {
- token->type = CHARACTER;
-@@ -1809,7 +1818,7 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
- token->opr.c = c2;
- token->type = CHARACTER;
- #ifdef RE_ENABLE_I18N
-- if (input->mb_cur_max > 1)
-+ if (string_mb_cur_max (input) > 1)
- {
- wint_t wc = re_string_wchar_at (input,
- re_string_cur_idx (input) + 1);
-@@ -1923,7 +1932,7 @@ peek_token (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
-
- token->type = CHARACTER;
- #ifdef RE_ENABLE_I18N
-- if (input->mb_cur_max > 1)
-+ if (string_mb_cur_max (input) > 1)
- {
- wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
- token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
-@@ -2023,7 +2032,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
- token->opr.c = c;
-
- #ifdef RE_ENABLE_I18N
-- if (input->mb_cur_max > 1 &&
-+ if (string_mb_cur_max (input) > 1 &&
- !re_string_first_byte (input, re_string_cur_idx (input)))
- {
- token->type = CHARACTER;
-@@ -2246,7 +2255,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
- return NULL;
- }
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- {
- while (!re_string_eoi (regexp)
- && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
-@@ -2384,7 +2393,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
- *err = REG_ESPACE;
- return NULL;
- }
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- dfa->has_mb_node = 1;
- break;
- case OP_WORD:
-@@ -2690,7 +2699,7 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
- However, for !_LIBC we have no collation elements: if the
- character set is single byte, the single byte character set
- that we build below suffices. parse_bracket_exp passes
-- no MBCSET if dfa->mb_cur_max == 1. */
-+ no MBCSET if dfa_mb_cur_max (dfa) == 1. */
- if (mbcset)
- {
- /* Check the space of the arrays. */
-@@ -2786,7 +2795,13 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- reg_syntax_t syntax, reg_errcode_t *err)
- {
- #ifdef _LIBC
-+#if __OPTION_EGLIBC_LOCALE_CODE
- const unsigned char *collseqmb;
-+# define COLLSEQMB_LOOKUP(ix) (collseqmb[(ix)])
-+#else
-+# define COLLSEQMB_LOOKUP(ix) (ix)
-+#endif
-+
- const char *collseqwc;
- uint32_t nrules;
- int32_t table_size;
-@@ -2834,18 +2849,20 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- if (MB_CUR_MAX == 1)
- */
- if (nrules == 0)
-- return collseqmb[br_elem->opr.ch];
-+ return COLLSEQMB_LOOKUP (br_elem->opr.ch);
- else
- {
- wint_t wc = __btowc (br_elem->opr.ch);
- return __collseq_table_lookup (collseqwc, wc);
- }
- }
-+#if __OPTION_EGLIBC_LOCALE_CODE
- else if (br_elem->type == MB_CHAR)
- {
- if (nrules != 0)
- return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
- }
-+#endif
- else if (br_elem->type == COLL_SYM)
- {
- size_t sym_name_len = strlen ((char *) br_elem->opr.name);
-@@ -2876,11 +2893,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- {
- /* No valid character. Match it as a single byte
- character. */
-- return collseqmb[br_elem->opr.name[0]];
-+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
- }
- }
- else if (sym_name_len == 1)
-- return collseqmb[br_elem->opr.name[0]];
-+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
- }
- return UINT_MAX;
- }
-@@ -2920,7 +2937,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- However, if we have no collation elements, and the character set
- is single byte, the single byte character set that we
- build below suffices. */
-- if (nrules > 0 || dfa->mb_cur_max > 1)
-+ if (nrules > 0 || dfa_mb_cur_max (dfa) > 1)
- {
- /* Check the space of the arrays. */
- if (BE (*range_alloc == mbcset->nranges, 0))
-@@ -2957,7 +2974,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- if (MB_CUR_MAX == 1)
- */
- if (nrules == 0)
-- ch_collseq = collseqmb[ch];
-+ ch_collseq = COLLSEQMB_LOOKUP (ch);
- else
- ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
- if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
-@@ -3035,7 +3052,10 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- re_bitset_ptr_t sbcset;
- #ifdef RE_ENABLE_I18N
- re_charset_t *mbcset;
-- int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
-+ int coll_sym_alloc = 0, range_alloc = 0;
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+ int mbchar_alloc = 0;
-+#endif
- int equiv_class_alloc = 0, char_class_alloc = 0;
- #endif /* not RE_ENABLE_I18N */
- int non_match = 0;
-@@ -3043,9 +3063,15 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- int token_len;
- int first_round = 1;
- #ifdef _LIBC
-+#if __OPTION_EGLIBC_LOCALE_CODE
- collseqmb = (const unsigned char *)
- _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
- nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+#else
-+ /* This is true when OPTION_EGLIBC_LOCALE_CODE is disabled, but the
-+ compiler can't figure that out. */
-+ nrules = 0;
-+#endif
- if (nrules)
- {
- /*
-@@ -3175,7 +3201,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- #else
- # ifdef RE_ENABLE_I18N
- *err = build_range_exp (sbcset,
-- dfa->mb_cur_max > 1 ? mbcset : NULL,
-+ dfa_mb_cur_max (dfa) > 1 ? mbcset : NULL,
- &range_alloc, &start_elem, &end_elem);
- # else
- *err = build_range_exp (sbcset, &start_elem, &end_elem);
-@@ -3191,7 +3217,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- case SB_CHAR:
- bitset_set (sbcset, start_elem.opr.ch);
- break;
--#ifdef RE_ENABLE_I18N
-+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
- case MB_CHAR:
- /* Check whether the array has enough space. */
- if (BE (mbchar_alloc == mbcset->nmbchars, 0))
-@@ -3209,7 +3235,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
- }
- mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
- break;
--#endif /* RE_ENABLE_I18N */
-+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
- case EQUIV_CLASS:
- *err = build_equiv_class (sbcset,
- #ifdef RE_ENABLE_I18N
-@@ -3259,11 +3285,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
-
- #ifdef RE_ENABLE_I18N
- /* Ensure only single byte characters are set. */
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- bitset_mask (sbcset, dfa->sb_char);
-
- if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
-- || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
-+ || mbcset->nranges || (dfa_mb_cur_max (dfa) > 1 && (mbcset->nchar_classes
- || mbcset->non_match)))
- {
- bin_tree_t *mbc_tree;
-@@ -3332,7 +3358,7 @@ parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
- re_token_t *token, int token_len, re_dfa_t *dfa,
- reg_syntax_t syntax, int accept_hyphen)
- {
--#ifdef RE_ENABLE_I18N
-+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
- int cur_char_size;
- cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
- if (cur_char_size > 1)
-@@ -3342,7 +3368,7 @@ parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp,
- re_string_skip_bytes (regexp, cur_char_size);
- return REG_NOERROR;
- }
--#endif /* RE_ENABLE_I18N */
-+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
- re_string_skip_bytes (regexp, token_len); /* Skip a token. */
- if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
- || token->type == OP_OPEN_EQUIV_CLASS)
-@@ -3422,7 +3448,9 @@ build_equiv_class (bitset_t sbcset, re_charset_t *mbcset,
- build_equiv_class (bitset_t sbcset, const unsigned char *name)
- #endif /* not RE_ENABLE_I18N */
- {
--#ifdef _LIBC
-+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C locale
-+ is supported; it has no collation rules. */
-+#if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
- uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
- if (nrules != 0)
- {
-@@ -3492,7 +3520,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
- mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
- }
- else
--#endif /* _LIBC */
-+#endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
- {
- if (BE (strlen ((const char *) name) != 1, 0))
- return REG_ECOLLATE;
-@@ -3526,7 +3554,7 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
- && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
- name = "alpha";
-
--#ifdef RE_ENABLE_I18N
-+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
- /* Check the space of the arrays. */
- if (BE (*char_class_alloc == mbcset->nchar_classes, 0))
- {
-@@ -3542,7 +3570,7 @@ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset,
- *char_class_alloc = new_char_class_alloc;
- }
- mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
--#endif /* RE_ENABLE_I18N */
-+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
-
- #define BUILD_CHARCLASS_LOOP(ctype_func) \
- do { \
-@@ -3653,7 +3681,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
-
- #ifdef RE_ENABLE_I18N
- /* Ensure only single byte characters are set. */
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- bitset_mask (sbcset, dfa->sb_char);
- #endif
-
-@@ -3665,7 +3693,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
- goto build_word_op_espace;
-
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- {
- bin_tree_t *mbc_tree;
- /* Build a tree for complex bracket. */
-diff --git a/posix/regex.h b/posix/regex.h
-index 5b1981e..2941f94 100644
---- a/posix/regex.h
-+++ b/posix/regex.h
-@@ -21,6 +21,7 @@
- #define _REGEX_H 1
-
- #include <sys/types.h>
-+#include <gnu/option-groups.h>
-
- /* Allow the use in C++ code. */
- #ifdef __cplusplus
-@@ -156,6 +157,8 @@ typedef unsigned long int reg_syntax_t;
- treated as 'a\{1'. */
- # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
-
-+/* EGLIBC: Old regex implementation does not support these. */
-+# if __OPTION_POSIX_REGEXP_GLIBC
- /* If this bit is set, then ignore case when matching.
- If not set, then case is significant. */
- # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
-@@ -172,6 +175,7 @@ typedef unsigned long int reg_syntax_t;
- /* If this bit is set, then no_sub will be set to 1 during
- re_compile_pattern. */
- # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
-+# endif /* __OPTION_POSIX_REGEXP_GLIBC */
- #endif
-
- /* This global variable defines the particular regexp syntax to use (for
-@@ -231,8 +235,13 @@ extern reg_syntax_t re_syntax_options;
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-+#if __OPTION_POSIX_REGEXP_GLIBC
- #define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
-+#else
-+#define RE_SYNTAX_POSIX_BASIC \
-+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-+#endif
-
- /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
-@@ -298,9 +307,11 @@ extern reg_syntax_t re_syntax_options;
- /* Like REG_NOTBOL, except for the end-of-line. */
- #define REG_NOTEOL (1 << 1)
-
-+#if __OPTION_POSIX_REGEXP_GLIBC
- /* Use PMATCH[0] to delimit the start and end of the search in the
- buffer. */
- #define REG_STARTEND (1 << 2)
-+#endif
-
-
- /* If any error codes are removed, changed, or added, update the
-diff --git a/posix/regex_internal.c b/posix/regex_internal.c
-index 8597d7e..d53b2a8 100644
---- a/posix/regex_internal.c
-+++ b/posix/regex_internal.c
-@@ -43,8 +43,8 @@ re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
- int init_buf_len;
-
- /* Ensure at least one character fits into the buffers. */
-- if (init_len < dfa->mb_cur_max)
-- init_len = dfa->mb_cur_max;
-+ if (init_len < dfa_mb_cur_max (dfa))
-+ init_len = dfa_mb_cur_max (dfa);
- init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
- re_string_construct_common (str, len, pstr, trans, icase, dfa);
-
-@@ -55,7 +55,7 @@ re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len,
- pstr->word_char = dfa->word_char;
- pstr->word_ops_used = dfa->word_ops_used;
- pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
-- pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
-+ pstr->valid_len = (pstr->mbs_allocated || dfa_mb_cur_max (dfa) > 1) ? 0 : len;
- pstr->valid_raw_len = pstr->valid_len;
- return REG_NOERROR;
- }
-@@ -82,7 +82,7 @@ re_string_construct (re_string_t *pstr, const char *str, int len,
- if (icase)
- {
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- {
- while (1)
- {
-@@ -91,7 +91,7 @@ re_string_construct (re_string_t *pstr, const char *str, int len,
- return ret;
- if (pstr->valid_raw_len >= len)
- break;
-- if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
-+ if (pstr->bufs_len > pstr->valid_len + dfa_mb_cur_max (dfa))
- break;
- ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
- if (BE (ret != REG_NOERROR, 0))
-@@ -105,7 +105,7 @@ re_string_construct (re_string_t *pstr, const char *str, int len,
- else
- {
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- build_wcs_buffer (pstr);
- else
- #endif /* RE_ENABLE_I18N */
-@@ -130,7 +130,7 @@ internal_function __attribute_warn_unused_result__
- re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
- {
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- {
- wint_t *new_wcs;
-
-@@ -177,7 +177,7 @@ re_string_construct_common (const char *str, int len, re_string_t *pstr,
- pstr->trans = trans;
- pstr->icase = icase ? 1 : 0;
- pstr->mbs_allocated = (trans != NULL || icase);
-- pstr->mb_cur_max = dfa->mb_cur_max;
-+ pstr->mb_cur_max = dfa_mb_cur_max (dfa);
- pstr->is_utf8 = dfa->is_utf8;
- pstr->map_notascii = dfa->map_notascii;
- pstr->stop = pstr->len;
-@@ -203,7 +203,7 @@ build_wcs_buffer (re_string_t *pstr)
- {
- #ifdef _LIBC
- unsigned char buf[MB_LEN_MAX];
-- assert (MB_LEN_MAX >= pstr->mb_cur_max);
-+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
- #else
- unsigned char buf[64];
- #endif
-@@ -226,7 +226,7 @@ build_wcs_buffer (re_string_t *pstr)
- {
- int i, ch;
-
-- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
-+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
- {
- ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
- buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
-@@ -275,7 +275,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
- size_t mbclen;
- #ifdef _LIBC
- char buf[MB_LEN_MAX];
-- assert (MB_LEN_MAX >= pstr->mb_cur_max);
-+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
- #else
- char buf[64];
- #endif
-@@ -369,7 +369,7 @@ build_wcs_upper_buffer (re_string_t *pstr)
- {
- int i, ch;
-
-- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
-+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
- {
- ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
- buf[i] = pstr->trans[ch];
-@@ -567,8 +567,9 @@ re_string_translate_buffer (re_string_t *pstr)
- }
-
- /* This function re-construct the buffers.
-- Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
-- convert to upper case in case of REG_ICASE, apply translation. */
-+ Concretely, convert to wide character in case of
-+ string_mb_cur_max (pstr) > 1, convert to upper case in case of
-+ REG_ICASE, apply translation. */
-
- static reg_errcode_t
- internal_function __attribute_warn_unused_result__
-@@ -579,7 +580,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
- {
- /* Reset buffer. */
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
- #endif /* RE_ENABLE_I18N */
- pstr->len = pstr->raw_len;
-@@ -670,7 +671,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
- pstr->tip_context = re_string_context_at (pstr, offset - 1,
- eflags);
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- memmove (pstr->wcs, pstr->wcs + offset,
- (pstr->valid_len - offset) * sizeof (wint_t));
- #endif /* RE_ENABLE_I18N */
-@@ -699,7 +700,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
- #endif
- pstr->valid_len = 0;
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- {
- int wcs_idx;
- wint_t wc = WEOF;
-@@ -711,7 +712,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
- /* Special case UTF-8. Multi-byte chars start with any
- byte other than 0x80 - 0xbf. */
- raw = pstr->raw_mbs + pstr->raw_mbs_idx;
-- end = raw + (offset - pstr->mb_cur_max);
-+ end = raw + (offset - string_mb_cur_max (pstr));
- if (end < pstr->raw_mbs)
- end = pstr->raw_mbs;
- p = raw + offset - 1;
-@@ -803,7 +804,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags)
-
- /* Then build the buffers. */
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- {
- if (pstr->icase)
- {
-@@ -841,7 +842,7 @@ re_string_peek_byte_case (const re_string_t *pstr, int idx)
- return re_string_peek_byte (pstr, idx);
-
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1
-+ if (string_mb_cur_max (pstr) > 1
- && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
- return re_string_peek_byte (pstr, idx);
- #endif
-@@ -930,7 +931,7 @@ re_string_context_at (const re_string_t *input, int idx, int eflags)
- return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
- : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
- #ifdef RE_ENABLE_I18N
-- if (input->mb_cur_max > 1)
-+ if (string_mb_cur_max (input) > 1)
- {
- wint_t wc;
- int wc_idx = idx;
-@@ -1444,7 +1445,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
- dfa->nodes[dfa->nodes_len].constraint = 0;
- #ifdef RE_ENABLE_I18N
- dfa->nodes[dfa->nodes_len].accept_mb =
-- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET;
-+ (type == OP_PERIOD && dfa_mb_cur_max (dfa) > 1) || type == COMPLEX_BRACKET;
- #endif
- dfa->nexts[dfa->nodes_len] = -1;
- re_node_set_init_empty (dfa->edests + dfa->nodes_len);
-diff --git a/posix/regex_internal.h b/posix/regex_internal.h
-index 154e969..c43909a 100644
---- a/posix/regex_internal.h
-+++ b/posix/regex_internal.h
-@@ -26,6 +26,10 @@
- #include <stdlib.h>
- #include <string.h>
-
-+#if defined _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-+
- #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
- # include <langinfo.h>
- #endif
-@@ -369,6 +373,13 @@ struct re_string_t
- };
- typedef struct re_string_t re_string_t;
-
-+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
-+ help the compiler make use of that fact. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+# define string_mb_cur_max(str) ((str)->mb_cur_max + 0)
-+#else
-+# define string_mb_cur_max(str) (1)
-+#endif
-
- struct re_dfa_t;
- typedef struct re_dfa_t re_dfa_t;
-@@ -654,6 +665,14 @@ struct re_dfa_t
- __libc_lock_define (, lock)
- };
-
-+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
-+ help the compiler make use of that fact. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+# define dfa_mb_cur_max(dfa) ((dfa)->mb_cur_max + 0)
-+#else
-+# define dfa_mb_cur_max(dfa) (1)
-+#endif
-+
- #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
- #define re_node_set_remove(set,id) \
- (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
-@@ -714,7 +733,7 @@ internal_function __attribute__ ((pure, unused))
- re_string_char_size_at (const re_string_t *pstr, int idx)
- {
- int byte_idx;
-- if (pstr->mb_cur_max == 1)
-+ if (string_mb_cur_max (pstr) == 1)
- return 1;
- for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
- if (pstr->wcs[idx + byte_idx] != WEOF)
-@@ -726,7 +745,7 @@ static wint_t
- internal_function __attribute__ ((pure, unused))
- re_string_wchar_at (const re_string_t *pstr, int idx)
- {
-- if (pstr->mb_cur_max == 1)
-+ if (string_mb_cur_max (pstr) == 1)
- return (wint_t) pstr->mbs[idx];
- return (wint_t) pstr->wcs[idx];
- }
-diff --git a/posix/regexec-compat.c b/posix/regexec-compat.c
-new file mode 100644
-index 0000000..0f9b7c7
---- /dev/null
-+++ b/posix/regexec-compat.c
-@@ -0,0 +1,39 @@
-+/* Extended regular expression matching and search library.
-+ Copyright (C) 2008 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef _LIBC
-+# include <shlib-compat.h>
-+versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
-+
-+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-+__typeof__ (__regexec) __compat_regexec;
-+
-+int
-+attribute_compat_text_section
-+__compat_regexec (const regex_t *__restrict preg,
-+ const char *__restrict string, size_t nmatch,
-+ regmatch_t pmatch[], int eflags)
-+{
-+ return regexec (preg, string, nmatch, pmatch,
-+ eflags & (REG_NOTBOL | REG_NOTEOL));
-+}
-+compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
-+# endif
-+#endif
-diff --git a/posix/regexec.c b/posix/regexec.c
-index 70cd606..e3b49e4 100644
---- a/posix/regexec.c
-+++ b/posix/regexec.c
-@@ -18,6 +18,7 @@
- <http://www.gnu.org/licenses/>. */
-
- #include <stdint.h>
-+#include <gnu/option-groups.h>
-
- static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
- int n) internal_function;
-@@ -186,11 +187,11 @@ static int build_trtable (const re_dfa_t *dfa,
- static int check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- const re_string_t *input, int idx)
- internal_function;
--# ifdef _LIBC
-+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
- static unsigned int find_collation_sequence_value (const unsigned char *mbs,
- size_t name_len)
- internal_function;
--# endif /* _LIBC */
-+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
- #endif /* RE_ENABLE_I18N */
- static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
- const re_dfastate_t *state,
-@@ -255,25 +256,9 @@ regexec (preg, string, nmatch, pmatch, eflags)
- return err != REG_NOERROR;
- }
-
--#ifdef _LIBC
--# include <shlib-compat.h>
--versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
--
--# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
--__typeof__ (__regexec) __compat_regexec;
--
--int
--attribute_compat_text_section
--__compat_regexec (const regex_t *__restrict preg,
-- const char *__restrict string, size_t nmatch,
-- regmatch_t pmatch[], int eflags)
--{
-- return regexec (preg, string, nmatch, pmatch,
-- eflags & (REG_NOTBOL | REG_NOTEOL));
--}
--compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
--# endif
--#endif
-+/* EGLIBC: The code that used to be here was move to a separate file
-+ so that it can be shared with xregex.c. */
-+#include "regexec-compat.c"
-
- /* Entry points for GNU code. */
-
-@@ -728,7 +713,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
- incr = (range < 0) ? -1 : 1;
- left_lim = (range < 0) ? start + range : start;
- right_lim = (range < 0) ? start : start + range;
-- sb = dfa->mb_cur_max == 1;
-+ sb = dfa_mb_cur_max (dfa) == 1;
- match_kind =
- (fastmap
- ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
-@@ -3448,7 +3433,7 @@ out_free:
- if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0))
- goto out_free;
-
-- if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
-+ if (dest_states[i] != dest_states_word[i] && dfa_mb_cur_max (dfa) > 1)
- need_word_trtable = 1;
-
- dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
-@@ -3590,7 +3575,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
- else if (type == OP_PERIOD)
- {
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- bitset_merge (accepts, dfa->sb_char);
- else
- #endif
-@@ -3641,7 +3626,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
- continue;
- }
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- for (j = 0; j < BITSET_WORDS; ++j)
- any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
- else
-@@ -3660,7 +3645,7 @@ group_nodes_into_DFAstates (const re_dfa_t *dfa, const re_dfastate_t *state,
- continue;
- }
- #ifdef RE_ENABLE_I18N
-- if (dfa->mb_cur_max > 1)
-+ if (dfa_mb_cur_max (dfa) > 1)
- for (j = 0; j < BITSET_WORDS; ++j)
- any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
- else
-@@ -3836,12 +3821,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- if (node->type == COMPLEX_BRACKET)
- {
- const re_charset_t *cset = node->opr.mbcset;
--# ifdef _LIBC
-- const unsigned char *pin
-- = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
-- int j;
-- uint32_t nrules;
--# endif /* _LIBC */
- int match_len = 0;
- wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
- ? re_string_wchar_at (input, str_idx) : 0);
-@@ -3853,6 +3832,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- match_len = char_len;
- goto check_node_accept_bytes_match;
- }
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* match with character_class? */
- for (i = 0; i < cset->nchar_classes; ++i)
- {
-@@ -3863,14 +3843,22 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- goto check_node_accept_bytes_match;
- }
- }
-+#endif
-+
-+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C
-+ locale is supported; it has no collation rules. */
-+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
-+ const unsigned char *pin
-+ = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
-+ int j;
-+ uint32_t nrules;
-
--# ifdef _LIBC
- nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
- if (nrules != 0)
- {
- unsigned int in_collseq = 0;
- const int32_t *table, *indirect;
-- const unsigned char *weights, *extra;
-+ const unsigned char *weights, *extra = NULL;
- const char *collseqwc;
-
- /* match with collating_symbol? */
-@@ -3955,8 +3943,12 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- }
- }
- else
--# endif /* _LIBC */
-+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
- {
-+ /* In the _LIBC version, if OPTION_EGLIBC_LOCALE_CODE is
-+ disabled, there can be no multibyte range endpoints, and
-+ cset->nranges is always zero. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* match with range expression? */
- #if __GNUC__ >= 2
- wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
-@@ -3975,6 +3967,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- goto check_node_accept_bytes_match;
- }
- }
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
- }
- check_node_accept_bytes_match:
- if (!cset->non_match)
-@@ -3990,7 +3983,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
- return 0;
- }
-
--# ifdef _LIBC
-+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
- static unsigned int
- internal_function
- find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
-@@ -4048,7 +4041,7 @@ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
- return UINT_MAX;
- }
- }
--# endif /* _LIBC */
-+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
- #endif /* RE_ENABLE_I18N */
-
- /* Check whether the node accepts the byte which is IDX-th
-@@ -4139,7 +4132,7 @@ extend_buffers (re_match_context_t *mctx, int min_len)
- if (pstr->icase)
- {
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- {
- ret = build_wcs_upper_buffer (pstr);
- if (BE (ret != REG_NOERROR, 0))
-@@ -4152,7 +4145,7 @@ extend_buffers (re_match_context_t *mctx, int min_len)
- else
- {
- #ifdef RE_ENABLE_I18N
-- if (pstr->mb_cur_max > 1)
-+ if (string_mb_cur_max (pstr) > 1)
- build_wcs_buffer (pstr);
- else
- #endif /* RE_ENABLE_I18N */
-diff --git a/posix/xregex.c b/posix/xregex.c
-new file mode 100644
-index 0000000..d3f7ace
---- /dev/null
-+++ b/posix/xregex.c
-@@ -0,0 +1,8215 @@
-+/* Extended regular expression matching and search library,
-+ version 0.12.
-+ (Implements POSIX draft P1003.2/D11.2, except for some of the
-+ internationalization features.)
-+
-+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-+ 2002, 2005 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-+ 02110-1301 USA. */
-+
-+/* AIX requires this to be the first thing in the file. */
-+#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
-+ #pragma alloca
-+#endif
-+
-+#undef _GNU_SOURCE
-+#define _GNU_SOURCE
-+
-+#ifndef INSIDE_RECURSION
-+# ifdef HAVE_CONFIG_H
-+# include <config.h>
-+# endif
-+#endif
-+
-+/*#include <ansidecl.h>*/
-+
-+
-+#ifndef INSIDE_RECURSION
-+
-+# if defined STDC_HEADERS && !defined emacs
-+# include <stddef.h>
-+# else
-+/* We need this for `regex.h', and perhaps for the Emacs include files. */
-+# include <sys/types.h>
-+# endif
-+
-+# if (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC)
-+# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
-+# else
-+# define WIDE_CHAR_SUPPORT 0
-+# endif
-+/* For platform which support the ISO C amendement 1 functionality we
-+ support user defined character classes. */
-+# if WIDE_CHAR_SUPPORT
-+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
-+# include <wchar.h>
-+# include <wctype.h>
-+# endif
-+
-+# ifdef _LIBC
-+/* We have to keep the namespace clean. */
-+# define regfree(preg) __regfree (preg)
-+# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
-+# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
-+# define regerror(errcode, preg, errbuf, errbuf_size) \
-+ __regerror(errcode, preg, errbuf, errbuf_size)
-+# define re_set_registers(bu, re, nu, st, en) \
-+ __re_set_registers (bu, re, nu, st, en)
-+# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
-+ __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-+# define re_match(bufp, string, size, pos, regs) \
-+ __re_match (bufp, string, size, pos, regs)
-+# define re_search(bufp, string, size, startpos, range, regs) \
-+ __re_search (bufp, string, size, startpos, range, regs)
-+# define re_compile_pattern(pattern, length, bufp) \
-+ __re_compile_pattern (pattern, length, bufp)
-+# define re_set_syntax(syntax) __re_set_syntax (syntax)
-+# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
-+ __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
-+# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
-+
-+# define btowc __btowc
-+
-+/* We are also using some library internals. */
-+# include <locale/localeinfo.h>
-+# include <locale/elem-hash.h>
-+# include <langinfo.h>
-+# include <locale/coll-lookup.h>
-+# endif
-+
-+/* This is for other GNU distributions with internationalized messages. */
-+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-+# include <libintl.h>
-+# ifdef _LIBC
-+# undef gettext
-+# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
-+# endif
-+# else
-+# define gettext(msgid) (msgid)
-+# endif
-+
-+# ifndef gettext_noop
-+/* This define is so xgettext can find the internationalizable
-+ strings. */
-+# define gettext_noop(String) String
-+# endif
-+
-+/* The `emacs' switch turns on certain matching commands
-+ that make sense only in Emacs. */
-+# ifdef emacs
-+
-+# include "lisp.h"
-+# include "buffer.h"
-+# include "syntax.h"
-+
-+# else /* not emacs */
-+
-+/* If we are not linking with Emacs proper,
-+ we can't use the relocating allocator
-+ even if config.h says that we can. */
-+# undef REL_ALLOC
-+
-+# if defined STDC_HEADERS || defined _LIBC
-+# include <stdlib.h>
-+# else
-+char *malloc ();
-+char *realloc ();
-+# endif
-+
-+/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
-+ If nothing else has been done, use the method below. */
-+# ifdef INHIBIT_STRING_HEADER
-+# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-+# if !defined bzero && !defined bcopy
-+# undef INHIBIT_STRING_HEADER
-+# endif
-+# endif
-+# endif
-+
-+/* This is the normal way of making sure we have a bcopy and a bzero.
-+ This is used in most programs--a few other programs avoid this
-+ by defining INHIBIT_STRING_HEADER. */
-+# ifndef INHIBIT_STRING_HEADER
-+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
-+# include <string.h>
-+# ifndef bzero
-+# ifndef _LIBC
-+# define bzero(s, n) (memset (s, '\0', n), (s))
-+# else
-+# define bzero(s, n) __bzero (s, n)
-+# endif
-+# endif
-+# else
-+# include <strings.h>
-+# ifndef memcmp
-+# define memcmp(s1, s2, n) bcmp (s1, s2, n)
-+# endif
-+# ifndef memcpy
-+# define memcpy(d, s, n) (bcopy (s, d, n), (d))
-+# endif
-+# endif
-+# endif
-+
-+/* Define the syntax stuff for \<, \>, etc. */
-+
-+/* This must be nonzero for the wordchar and notwordchar pattern
-+ commands in re_match_2. */
-+# ifndef Sword
-+# define Sword 1
-+# endif
-+
-+# ifdef SWITCH_ENUM_BUG
-+# define SWITCH_ENUM_CAST(x) ((int)(x))
-+# else
-+# define SWITCH_ENUM_CAST(x) (x)
-+# endif
-+
-+# endif /* not emacs */
-+
-+# if defined _LIBC || HAVE_LIMITS_H
-+# include <limits.h>
-+# endif
-+
-+# ifndef MB_LEN_MAX
-+# define MB_LEN_MAX 1
-+# endif
-+
-+/* Get the interface, including the syntax bits. */
-+# include "regex.h"
-+
-+/* isalpha etc. are used for the character classes. */
-+# include <ctype.h>
-+
-+/* Jim Meyering writes:
-+
-+ "... Some ctype macros are valid only for character codes that
-+ isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
-+ using /bin/cc or gcc but without giving an ansi option). So, all
-+ ctype uses should be through macros like ISPRINT... If
-+ STDC_HEADERS is defined, then autoconf has verified that the ctype
-+ macros don't need to be guarded with references to isascii. ...
-+ Defining isascii to 1 should let any compiler worth its salt
-+ eliminate the && through constant folding."
-+ Solaris defines some of these symbols so we must undefine them first. */
-+
-+# undef ISASCII
-+# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
-+# define ISASCII(c) 1
-+# else
-+# define ISASCII(c) isascii(c)
-+# endif
-+
-+# ifdef isblank
-+# define ISBLANK(c) (ISASCII (c) && isblank (c))
-+# else
-+# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
-+# endif
-+# ifdef isgraph
-+# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
-+# else
-+# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
-+# endif
-+
-+# undef ISPRINT
-+# define ISPRINT(c) (ISASCII (c) && isprint (c))
-+# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
-+# define ISALNUM(c) (ISASCII (c) && isalnum (c))
-+# define ISALPHA(c) (ISASCII (c) && isalpha (c))
-+# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
-+# define ISLOWER(c) (ISASCII (c) && islower (c))
-+# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
-+# define ISSPACE(c) (ISASCII (c) && isspace (c))
-+# define ISUPPER(c) (ISASCII (c) && isupper (c))
-+# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
-+
-+# ifdef _tolower
-+# define TOLOWER(c) _tolower(c)
-+# else
-+# define TOLOWER(c) tolower(c)
-+# endif
-+
-+# ifndef NULL
-+# define NULL (void *)0
-+# endif
-+
-+/* We remove any previous definition of `SIGN_EXTEND_CHAR',
-+ since ours (we hope) works properly with all combinations of
-+ machines, compilers, `char' and `unsigned char' argument types.
-+ (Per Bothner suggested the basic approach.) */
-+# undef SIGN_EXTEND_CHAR
-+# if __STDC__
-+# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-+# else /* not __STDC__ */
-+/* As in Harbison and Steele. */
-+# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-+# endif
-+
-+# ifndef emacs
-+/* How many characters in the character set. */
-+# define CHAR_SET_SIZE 256
-+
-+# ifdef SYNTAX_TABLE
-+
-+extern char *re_syntax_table;
-+
-+# else /* not SYNTAX_TABLE */
-+
-+static char re_syntax_table[CHAR_SET_SIZE];
-+
-+static void init_syntax_once (void);
-+
-+static void
-+init_syntax_once (void)
-+{
-+ register int c;
-+ static int done = 0;
-+
-+ if (done)
-+ return;
-+ bzero (re_syntax_table, sizeof re_syntax_table);
-+
-+ for (c = 0; c < CHAR_SET_SIZE; ++c)
-+ if (ISALNUM (c))
-+ re_syntax_table[c] = Sword;
-+
-+ re_syntax_table['_'] = Sword;
-+
-+ done = 1;
-+}
-+
-+# endif /* not SYNTAX_TABLE */
-+
-+# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
-+
-+# endif /* emacs */
-+
-+/* Integer type for pointers. */
-+# if !defined _LIBC && !defined HAVE_UINTPTR_T
-+typedef unsigned long int uintptr_t;
-+# endif
-+
-+/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
-+ use `alloca' instead of `malloc'. This is because using malloc in
-+ re_search* or re_match* could cause memory leaks when C-g is used in
-+ Emacs; also, malloc is slower and causes storage fragmentation. On
-+ the other hand, malloc is more portable, and easier to debug.
-+
-+ Because we sometimes use alloca, some routines have to be macros,
-+ not functions -- `alloca'-allocated space disappears at the end of the
-+ function it is called in. */
-+
-+# ifdef REGEX_MALLOC
-+
-+# define REGEX_ALLOCATE malloc
-+# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
-+# define REGEX_FREE free
-+
-+# else /* not REGEX_MALLOC */
-+
-+/* Emacs already defines alloca, sometimes. */
-+# ifndef alloca
-+
-+/* Make alloca work the best possible way. */
-+# ifdef __GNUC__
-+# define alloca __builtin_alloca
-+# else /* not __GNUC__ */
-+# if HAVE_ALLOCA_H
-+# include <alloca.h>
-+# endif /* HAVE_ALLOCA_H */
-+# endif /* not __GNUC__ */
-+
-+# endif /* not alloca */
-+
-+# define REGEX_ALLOCATE alloca
-+
-+/* Assumes a `char *destination' variable. */
-+# define REGEX_REALLOCATE(source, osize, nsize) \
-+ (destination = (char *) alloca (nsize), \
-+ memcpy (destination, source, osize))
-+
-+/* No need to do anything to free, after alloca. */
-+# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
-+
-+# endif /* not REGEX_MALLOC */
-+
-+/* Define how to allocate the failure stack. */
-+
-+# if defined REL_ALLOC && defined REGEX_MALLOC
-+
-+# define REGEX_ALLOCATE_STACK(size) \
-+ r_alloc (&failure_stack_ptr, (size))
-+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
-+ r_re_alloc (&failure_stack_ptr, (nsize))
-+# define REGEX_FREE_STACK(ptr) \
-+ r_alloc_free (&failure_stack_ptr)
-+
-+# else /* not using relocating allocator */
-+
-+# ifdef REGEX_MALLOC
-+
-+# define REGEX_ALLOCATE_STACK malloc
-+# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
-+# define REGEX_FREE_STACK free
-+
-+# else /* not REGEX_MALLOC */
-+
-+# define REGEX_ALLOCATE_STACK alloca
-+
-+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
-+ REGEX_REALLOCATE (source, osize, nsize)
-+/* No need to explicitly free anything. */
-+# define REGEX_FREE_STACK(arg)
-+
-+# endif /* not REGEX_MALLOC */
-+# endif /* not using relocating allocator */
-+
-+
-+/* True if `size1' is non-NULL and PTR is pointing anywhere inside
-+ `string1' or just past its end. This works if PTR is NULL, which is
-+ a good thing. */
-+# define FIRST_STRING_P(ptr) \
-+ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
-+
-+/* (Re)Allocate N items of type T using malloc, or fail. */
-+# define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
-+# define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
-+# define RETALLOC_IF(addr, n, t) \
-+ if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
-+# define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
-+
-+# define BYTEWIDTH 8 /* In bits. */
-+
-+# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
-+
-+# undef MAX
-+# undef MIN
-+# define MAX(a, b) ((a) > (b) ? (a) : (b))
-+# define MIN(a, b) ((a) < (b) ? (a) : (b))
-+
-+typedef char boolean;
-+# define false 0
-+# define true 1
-+
-+static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
-+ reg_syntax_t syntax,
-+ struct re_pattern_buffer *bufp);
-+
-+static int byte_re_match_2_internal (struct re_pattern_buffer *bufp,
-+ const char *string1, int size1,
-+ const char *string2, int size2,
-+ int pos,
-+ struct re_registers *regs,
-+ int stop);
-+static int byte_re_search_2 (struct re_pattern_buffer *bufp,
-+ const char *string1, int size1,
-+ const char *string2, int size2,
-+ int startpos, int range,
-+ struct re_registers *regs, int stop);
-+static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp);
-+
-+#ifdef MBS_SUPPORT
-+static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
-+ reg_syntax_t syntax,
-+ struct re_pattern_buffer *bufp);
-+
-+
-+static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
-+ const char *cstring1, int csize1,
-+ const char *cstring2, int csize2,
-+ int pos,
-+ struct re_registers *regs,
-+ int stop,
-+ wchar_t *string1, int size1,
-+ wchar_t *string2, int size2,
-+ int *mbs_offset1, int *mbs_offset2);
-+static int wcs_re_search_2 (struct re_pattern_buffer *bufp,
-+ const char *string1, int size1,
-+ const char *string2, int size2,
-+ int startpos, int range,
-+ struct re_registers *regs, int stop);
-+static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp);
-+#endif
-+
-+/* These are the command codes that appear in compiled regular
-+ expressions. Some opcodes are followed by argument bytes. A
-+ command code can specify any interpretation whatsoever for its
-+ arguments. Zero bytes may appear in the compiled regular expression. */
-+
-+typedef enum
-+{
-+ no_op = 0,
-+
-+ /* Succeed right away--no more backtracking. */
-+ succeed,
-+
-+ /* Followed by one byte giving n, then by n literal bytes. */
-+ exactn,
-+
-+# ifdef MBS_SUPPORT
-+ /* Same as exactn, but contains binary data. */
-+ exactn_bin,
-+# endif
-+
-+ /* Matches any (more or less) character. */
-+ anychar,
-+
-+ /* Matches any one char belonging to specified set. First
-+ following byte is number of bitmap bytes. Then come bytes
-+ for a bitmap saying which chars are in. Bits in each byte
-+ are ordered low-bit-first. A character is in the set if its
-+ bit is 1. A character too large to have a bit in the map is
-+ automatically not in the set. */
-+ /* ifdef MBS_SUPPORT, following element is length of character
-+ classes, length of collating symbols, length of equivalence
-+ classes, length of character ranges, and length of characters.
-+ Next, character class element, collating symbols elements,
-+ equivalence class elements, range elements, and character
-+ elements follow.
-+ See regex_compile function. */
-+ charset,
-+
-+ /* Same parameters as charset, but match any character that is
-+ not one of those specified. */
-+ charset_not,
-+
-+ /* Start remembering the text that is matched, for storing in a
-+ register. Followed by one byte with the register number, in
-+ the range 0 to one less than the pattern buffer's re_nsub
-+ field. Then followed by one byte with the number of groups
-+ inner to this one. (This last has to be part of the
-+ start_memory only because we need it in the on_failure_jump
-+ of re_match_2.) */
-+ start_memory,
-+
-+ /* Stop remembering the text that is matched and store it in a
-+ memory register. Followed by one byte with the register
-+ number, in the range 0 to one less than `re_nsub' in the
-+ pattern buffer, and one byte with the number of inner groups,
-+ just like `start_memory'. (We need the number of inner
-+ groups here because we don't have any easy way of finding the
-+ corresponding start_memory when we're at a stop_memory.) */
-+ stop_memory,
-+
-+ /* Match a duplicate of something remembered. Followed by one
-+ byte containing the register number. */
-+ duplicate,
-+
-+ /* Fail unless at beginning of line. */
-+ begline,
-+
-+ /* Fail unless at end of line. */
-+ endline,
-+
-+ /* Succeeds if at beginning of buffer (if emacs) or at beginning
-+ of string to be matched (if not). */
-+ begbuf,
-+
-+ /* Analogously, for end of buffer/string. */
-+ endbuf,
-+
-+ /* Followed by two byte relative address to which to jump. */
-+ jump,
-+
-+ /* Same as jump, but marks the end of an alternative. */
-+ jump_past_alt,
-+
-+ /* Followed by two-byte relative address of place to resume at
-+ in case of failure. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ on_failure_jump,
-+
-+ /* Like on_failure_jump, but pushes a placeholder instead of the
-+ current string position when executed. */
-+ on_failure_keep_string_jump,
-+
-+ /* Throw away latest failure point and then jump to following
-+ two-byte relative address. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ pop_failure_jump,
-+
-+ /* Change to pop_failure_jump if know won't have to backtrack to
-+ match; otherwise change to jump. This is used to jump
-+ back to the beginning of a repeat. If what follows this jump
-+ clearly won't match what the repeat does, such that we can be
-+ sure that there is no use backtracking out of repetitions
-+ already matched, then we change it to a pop_failure_jump.
-+ Followed by two-byte address. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ maybe_pop_jump,
-+
-+ /* Jump to following two-byte address, and push a dummy failure
-+ point. This failure point will be thrown away if an attempt
-+ is made to use it for a failure. A `+' construct makes this
-+ before the first repeat. Also used as an intermediary kind
-+ of jump when compiling an alternative. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ dummy_failure_jump,
-+
-+ /* Push a dummy failure point and continue. Used at the end of
-+ alternatives. */
-+ push_dummy_failure,
-+
-+ /* Followed by two-byte relative address and two-byte number n.
-+ After matching N times, jump to the address upon failure. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ succeed_n,
-+
-+ /* Followed by two-byte relative address, and two-byte number n.
-+ Jump to the address N times, then fail. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ jump_n,
-+
-+ /* Set the following two-byte relative address to the
-+ subsequent two-byte number. The address *includes* the two
-+ bytes of number. */
-+ /* ifdef MBS_SUPPORT, the size of address is 1. */
-+ set_number_at,
-+
-+ wordchar, /* Matches any word-constituent character. */
-+ notwordchar, /* Matches any char that is not a word-constituent. */
-+
-+ wordbeg, /* Succeeds if at word beginning. */
-+ wordend, /* Succeeds if at word end. */
-+
-+ wordbound, /* Succeeds if at a word boundary. */
-+ notwordbound /* Succeeds if not at a word boundary. */
-+
-+# ifdef emacs
-+ ,before_dot, /* Succeeds if before point. */
-+ at_dot, /* Succeeds if at point. */
-+ after_dot, /* Succeeds if after point. */
-+
-+ /* Matches any character whose syntax is specified. Followed by
-+ a byte which contains a syntax code, e.g., Sword. */
-+ syntaxspec,
-+
-+ /* Matches any character whose syntax is not that specified. */
-+ notsyntaxspec
-+# endif /* emacs */
-+} re_opcode_t;
-+#endif /* not INSIDE_RECURSION */
-+
-+
-+#ifdef BYTE
-+# define CHAR_T char
-+# define UCHAR_T unsigned char
-+# define COMPILED_BUFFER_VAR bufp->buffer
-+# define OFFSET_ADDRESS_SIZE 2
-+# define PREFIX(name) byte_##name
-+# define ARG_PREFIX(name) name
-+# define PUT_CHAR(c) putchar (c)
-+# include <locale/weight.h>
-+# define FINDIDX findidx
-+#else
-+# ifdef WCHAR
-+# define CHAR_T wchar_t
-+# define UCHAR_T wchar_t
-+# define COMPILED_BUFFER_VAR wc_buffer
-+# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
-+# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
-+# define PREFIX(name) wcs_##name
-+# define ARG_PREFIX(name) c##name
-+/* Should we use wide stream?? */
-+# define PUT_CHAR(c) printf ("%C", c);
-+# define TRUE 1
-+# define FALSE 0
-+# define findidx findidxwc
-+# include <locale/weightwc.h>
-+# undef findidx
-+# define FINDIDX findidxwc
-+# else
-+# ifdef MBS_SUPPORT
-+# define WCHAR
-+# define INSIDE_RECURSION
-+# include "xregex.c"
-+# undef INSIDE_RECURSION
-+# endif
-+# define BYTE
-+# define INSIDE_RECURSION
-+# include "xregex.c"
-+# undef INSIDE_RECURSION
-+# endif
-+#endif
-+
-+#ifdef INSIDE_RECURSION
-+/* Common operations on the compiled pattern. */
-+
-+/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
-+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-+
-+# ifdef WCHAR
-+# define STORE_NUMBER(destination, number) \
-+ do { \
-+ *(destination) = (UCHAR_T)(number); \
-+ } while (0)
-+# else /* BYTE */
-+# define STORE_NUMBER(destination, number) \
-+ do { \
-+ (destination)[0] = (number) & 0377; \
-+ (destination)[1] = (number) >> 8; \
-+ } while (0)
-+# endif /* WCHAR */
-+
-+/* Same as STORE_NUMBER, except increment DESTINATION to
-+ the byte after where the number is stored. Therefore, DESTINATION
-+ must be an lvalue. */
-+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-+
-+# define STORE_NUMBER_AND_INCR(destination, number) \
-+ do { \
-+ STORE_NUMBER (destination, number); \
-+ (destination) += OFFSET_ADDRESS_SIZE; \
-+ } while (0)
-+
-+/* Put into DESTINATION a number stored in two contiguous bytes starting
-+ at SOURCE. */
-+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
-+
-+# ifdef WCHAR
-+# define EXTRACT_NUMBER(destination, source) \
-+ do { \
-+ (destination) = *(source); \
-+ } while (0)
-+# else /* BYTE */
-+# define EXTRACT_NUMBER(destination, source) \
-+ do { \
-+ (destination) = *(source) & 0377; \
-+ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
-+ } while (0)
-+# endif
-+
-+# ifdef DEBUG
-+static void PREFIX(extract_number) (int *dest, UCHAR_T *source);
-+static void
-+PREFIX(extract_number) (int *dest, UCHAR_T *source)
-+{
-+# ifdef WCHAR
-+ *dest = *source;
-+# else /* BYTE */
-+ int temp = SIGN_EXTEND_CHAR (*(source + 1));
-+ *dest = *source & 0377;
-+ *dest += temp << 8;
-+# endif
-+}
-+
-+# ifndef EXTRACT_MACROS /* To debug the macros. */
-+# undef EXTRACT_NUMBER
-+# define EXTRACT_NUMBER(dest, src) PREFIX(extract_number) (&dest, src)
-+# endif /* not EXTRACT_MACROS */
-+
-+# endif /* DEBUG */
-+
-+/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
-+ SOURCE must be an lvalue. */
-+
-+# define EXTRACT_NUMBER_AND_INCR(destination, source) \
-+ do { \
-+ EXTRACT_NUMBER (destination, source); \
-+ (source) += OFFSET_ADDRESS_SIZE; \
-+ } while (0)
-+
-+# ifdef DEBUG
-+static void PREFIX(extract_number_and_incr) (int *destination,
-+ UCHAR_T **source);
-+static void
-+PREFIX(extract_number_and_incr) (int *destination, UCHAR_T **source)
-+{
-+ PREFIX(extract_number) (destination, *source);
-+ *source += OFFSET_ADDRESS_SIZE;
-+}
-+
-+# ifndef EXTRACT_MACROS
-+# undef EXTRACT_NUMBER_AND_INCR
-+# define EXTRACT_NUMBER_AND_INCR(dest, src) \
-+ PREFIX(extract_number_and_incr) (&dest, &src)
-+# endif /* not EXTRACT_MACROS */
-+
-+# endif /* DEBUG */
-+
-+
-+
-+/* If DEBUG is defined, Regex prints many voluminous messages about what
-+ it is doing (if the variable `debug' is nonzero). If linked with the
-+ main program in `iregex.c', you can enter patterns and strings
-+ interactively. And if linked with the main program in `main.c' and
-+ the other test files, you can run the already-written tests. */
-+
-+# ifdef DEBUG
-+
-+# ifndef DEFINED_ONCE
-+
-+/* We use standard I/O for debugging. */
-+# include <stdio.h>
-+
-+/* It is useful to test things that ``must'' be true when debugging. */
-+# include <assert.h>
-+
-+static int debug;
-+
-+# define DEBUG_STATEMENT(e) e
-+# define DEBUG_PRINT1(x) if (debug) printf (x)
-+# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
-+# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
-+# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
-+# endif /* not DEFINED_ONCE */
-+
-+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
-+ if (debug) PREFIX(print_partial_compiled_pattern) (s, e)
-+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
-+ if (debug) PREFIX(print_double_string) (w, s1, sz1, s2, sz2)
-+
-+
-+/* Print the fastmap in human-readable form. */
-+
-+# ifndef DEFINED_ONCE
-+void
-+print_fastmap (char *fastmap)
-+{
-+ unsigned was_a_range = 0;
-+ unsigned i = 0;
-+
-+ while (i < (1 << BYTEWIDTH))
-+ {
-+ if (fastmap[i++])
-+ {
-+ was_a_range = 0;
-+ putchar (i - 1);
-+ while (i < (1 << BYTEWIDTH) && fastmap[i])
-+ {
-+ was_a_range = 1;
-+ i++;
-+ }
-+ if (was_a_range)
-+ {
-+ printf ("-");
-+ putchar (i - 1);
-+ }
-+ }
-+ }
-+ putchar ('\n');
-+}
-+# endif /* not DEFINED_ONCE */
-+
-+
-+/* Print a compiled pattern string in human-readable form, starting at
-+ the START pointer into it and ending just before the pointer END. */
-+
-+void
-+PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end)
-+{
-+ int mcnt, mcnt2;
-+ UCHAR_T *p1;
-+ UCHAR_T *p = start;
-+ UCHAR_T *pend = end;
-+
-+ if (start == NULL)
-+ {
-+ printf ("(null)\n");
-+ return;
-+ }
-+
-+ /* Loop over pattern commands. */
-+ while (p < pend)
-+ {
-+# ifdef _LIBC
-+ printf ("%td:\t", p - start);
-+# else
-+ printf ("%ld:\t", (long int) (p - start));
-+# endif
-+
-+ switch ((re_opcode_t) *p++)
-+ {
-+ case no_op:
-+ printf ("/no_op");
-+ break;
-+
-+ case exactn:
-+ mcnt = *p++;
-+ printf ("/exactn/%d", mcnt);
-+ do
-+ {
-+ putchar ('/');
-+ PUT_CHAR (*p++);
-+ }
-+ while (--mcnt);
-+ break;
-+
-+# ifdef MBS_SUPPORT
-+ case exactn_bin:
-+ mcnt = *p++;
-+ printf ("/exactn_bin/%d", mcnt);
-+ do
-+ {
-+ printf("/%lx", (long int) *p++);
-+ }
-+ while (--mcnt);
-+ break;
-+# endif /* MBS_SUPPORT */
-+
-+ case start_memory:
-+ mcnt = *p++;
-+ printf ("/start_memory/%d/%ld", mcnt, (long int) *p++);
-+ break;
-+
-+ case stop_memory:
-+ mcnt = *p++;
-+ printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++);
-+ break;
-+
-+ case duplicate:
-+ printf ("/duplicate/%ld", (long int) *p++);
-+ break;
-+
-+ case anychar:
-+ printf ("/anychar");
-+ break;
-+
-+ case charset:
-+ case charset_not:
-+ {
-+# ifdef WCHAR
-+ int i, length;
-+ wchar_t *workp = p;
-+ printf ("/charset [%s",
-+ (re_opcode_t) *(workp - 1) == charset_not ? "^" : "");
-+ p += 5;
-+ length = *workp++; /* the length of char_classes */
-+ for (i=0 ; i<length ; i++)
-+ printf("[:%lx:]", (long int) *p++);
-+ length = *workp++; /* the length of collating_symbol */
-+ for (i=0 ; i<length ;)
-+ {
-+ printf("[.");
-+ while(*p != 0)
-+ PUT_CHAR((i++,*p++));
-+ i++,p++;
-+ printf(".]");
-+ }
-+ length = *workp++; /* the length of equivalence_class */
-+ for (i=0 ; i<length ;)
-+ {
-+ printf("[=");
-+ while(*p != 0)
-+ PUT_CHAR((i++,*p++));
-+ i++,p++;
-+ printf("=]");
-+ }
-+ length = *workp++; /* the length of char_range */
-+ for (i=0 ; i<length ; i++)
-+ {
-+ wchar_t range_start = *p++;
-+ wchar_t range_end = *p++;
-+ printf("%C-%C", range_start, range_end);
-+ }
-+ length = *workp++; /* the length of char */
-+ for (i=0 ; i<length ; i++)
-+ printf("%C", *p++);
-+ putchar (']');
-+# else
-+ register int c, last = -100;
-+ register int in_range = 0;
-+
-+ printf ("/charset [%s",
-+ (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
-+
-+ assert (p + *p < pend);
-+
-+ for (c = 0; c < 256; c++)
-+ if (c / 8 < *p
-+ && (p[1 + (c/8)] & (1 << (c % 8))))
-+ {
-+ /* Are we starting a range? */
-+ if (last + 1 == c && ! in_range)
-+ {
-+ putchar ('-');
-+ in_range = 1;
-+ }
-+ /* Have we broken a range? */
-+ else if (last + 1 != c && in_range)
-+ {
-+ putchar (last);
-+ in_range = 0;
-+ }
-+
-+ if (! in_range)
-+ putchar (c);
-+
-+ last = c;
-+ }
-+
-+ if (in_range)
-+ putchar (last);
-+
-+ putchar (']');
-+
-+ p += 1 + *p;
-+# endif /* WCHAR */
-+ }
-+ break;
-+
-+ case begline:
-+ printf ("/begline");
-+ break;
-+
-+ case endline:
-+ printf ("/endline");
-+ break;
-+
-+ case on_failure_jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/on_failure_jump to %td", p + mcnt - start);
-+# else
-+ printf ("/on_failure_jump to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case on_failure_keep_string_jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/on_failure_keep_string_jump to %td", p + mcnt - start);
-+# else
-+ printf ("/on_failure_keep_string_jump to %ld",
-+ (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case dummy_failure_jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/dummy_failure_jump to %td", p + mcnt - start);
-+# else
-+ printf ("/dummy_failure_jump to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case push_dummy_failure:
-+ printf ("/push_dummy_failure");
-+ break;
-+
-+ case maybe_pop_jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/maybe_pop_jump to %td", p + mcnt - start);
-+# else
-+ printf ("/maybe_pop_jump to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case pop_failure_jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/pop_failure_jump to %td", p + mcnt - start);
-+# else
-+ printf ("/pop_failure_jump to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case jump_past_alt:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/jump_past_alt to %td", p + mcnt - start);
-+# else
-+ printf ("/jump_past_alt to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case jump:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+# ifdef _LIBC
-+ printf ("/jump to %td", p + mcnt - start);
-+# else
-+ printf ("/jump to %ld", (long int) (p + mcnt - start));
-+# endif
-+ break;
-+
-+ case succeed_n:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+ p1 = p + mcnt;
-+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
-+# ifdef _LIBC
-+ printf ("/succeed_n to %td, %d times", p1 - start, mcnt2);
-+# else
-+ printf ("/succeed_n to %ld, %d times",
-+ (long int) (p1 - start), mcnt2);
-+# endif
-+ break;
-+
-+ case jump_n:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+ p1 = p + mcnt;
-+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
-+ printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
-+ break;
-+
-+ case set_number_at:
-+ PREFIX(extract_number_and_incr) (&mcnt, &p);
-+ p1 = p + mcnt;
-+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
-+# ifdef _LIBC
-+ printf ("/set_number_at location %td to %d", p1 - start, mcnt2);
-+# else
-+ printf ("/set_number_at location %ld to %d",
-+ (long int) (p1 - start), mcnt2);
-+# endif
-+ break;
-+
-+ case wordbound:
-+ printf ("/wordbound");
-+ break;
-+
-+ case notwordbound:
-+ printf ("/notwordbound");
-+ break;
-+
-+ case wordbeg:
-+ printf ("/wordbeg");
-+ break;
-+
-+ case wordend:
-+ printf ("/wordend");
-+ break;
-+
-+# ifdef emacs
-+ case before_dot:
-+ printf ("/before_dot");
-+ break;
-+
-+ case at_dot:
-+ printf ("/at_dot");
-+ break;
-+
-+ case after_dot:
-+ printf ("/after_dot");
-+ break;
-+
-+ case syntaxspec:
-+ printf ("/syntaxspec");
-+ mcnt = *p++;
-+ printf ("/%d", mcnt);
-+ break;
-+
-+ case notsyntaxspec:
-+ printf ("/notsyntaxspec");
-+ mcnt = *p++;
-+ printf ("/%d", mcnt);
-+ break;
-+# endif /* emacs */
-+
-+ case wordchar:
-+ printf ("/wordchar");
-+ break;
-+
-+ case notwordchar:
-+ printf ("/notwordchar");
-+ break;
-+
-+ case begbuf:
-+ printf ("/begbuf");
-+ break;
-+
-+ case endbuf:
-+ printf ("/endbuf");
-+ break;
-+
-+ default:
-+ printf ("?%ld", (long int) *(p-1));
-+ }
-+
-+ putchar ('\n');
-+ }
-+
-+# ifdef _LIBC
-+ printf ("%td:\tend of pattern.\n", p - start);
-+# else
-+ printf ("%ld:\tend of pattern.\n", (long int) (p - start));
-+# endif
-+}
-+
-+
-+void
-+PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp)
-+{
-+ UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
-+
-+ PREFIX(print_partial_compiled_pattern) (buffer, buffer
-+ + bufp->used / sizeof(UCHAR_T));
-+ printf ("%ld bytes used/%ld bytes allocated.\n",
-+ bufp->used, bufp->allocated);
-+
-+ if (bufp->fastmap_accurate && bufp->fastmap)
-+ {
-+ printf ("fastmap: ");
-+ print_fastmap (bufp->fastmap);
-+ }
-+
-+# ifdef _LIBC
-+ printf ("re_nsub: %Zd\t", bufp->re_nsub);
-+# else
-+ printf ("re_nsub: %ld\t", (long int) bufp->re_nsub);
-+# endif
-+ printf ("regs_alloc: %d\t", bufp->regs_allocated);
-+ printf ("can_be_null: %d\t", bufp->can_be_null);
-+ printf ("newline_anchor: %d\n", bufp->newline_anchor);
-+ printf ("no_sub: %d\t", bufp->no_sub);
-+ printf ("not_bol: %d\t", bufp->not_bol);
-+ printf ("not_eol: %d\t", bufp->not_eol);
-+ printf ("syntax: %lx\n", bufp->syntax);
-+ /* Perhaps we should print the translate table? */
-+}
-+
-+
-+void
-+PREFIX(print_double_string) (const CHAR_T *where, const CHAR_T *string1,
-+ int size1, const CHAR_T *string2, int size2)
-+{
-+ int this_char;
-+
-+ if (where == NULL)
-+ printf ("(null)");
-+ else
-+ {
-+ int cnt;
-+
-+ if (FIRST_STRING_P (where))
-+ {
-+ for (this_char = where - string1; this_char < size1; this_char++)
-+ PUT_CHAR (string1[this_char]);
-+
-+ where = string2;
-+ }
-+
-+ cnt = 0;
-+ for (this_char = where - string2; this_char < size2; this_char++)
-+ {
-+ PUT_CHAR (string2[this_char]);
-+ if (++cnt > 100)
-+ {
-+ fputs ("...", stdout);
-+ break;
-+ }
-+ }
-+ }
-+}
-+
-+# ifndef DEFINED_ONCE
-+void
-+printchar (int c)
-+{
-+ putc (c, stderr);
-+}
-+# endif
-+
-+# else /* not DEBUG */
-+
-+# ifndef DEFINED_ONCE
-+# undef assert
-+# define assert(e)
-+
-+# define DEBUG_STATEMENT(e)
-+# define DEBUG_PRINT1(x)
-+# define DEBUG_PRINT2(x1, x2)
-+# define DEBUG_PRINT3(x1, x2, x3)
-+# define DEBUG_PRINT4(x1, x2, x3, x4)
-+# endif /* not DEFINED_ONCE */
-+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
-+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
-+
-+# endif /* not DEBUG */
-+
-+
-+
-+# ifdef WCHAR
-+/* This convert a multibyte string to a wide character string.
-+ And write their correspondances to offset_buffer(see below)
-+ and write whether each wchar_t is binary data to is_binary.
-+ This assume invalid multibyte sequences as binary data.
-+ We assume offset_buffer and is_binary is already allocated
-+ enough space. */
-+
-+static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
-+ size_t len, int *offset_buffer,
-+ char *is_binary);
-+static size_t
-+convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
-+ int *offset_buffer, char *is_binary)
-+ /* It hold correspondances between src(char string) and
-+ dest(wchar_t string) for optimization.
-+ e.g. src = "xxxyzz"
-+ dest = {'X', 'Y', 'Z'}
-+ (each "xxx", "y" and "zz" represent one multibyte character
-+ corresponding to 'X', 'Y' and 'Z'.)
-+ offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
-+ = {0, 3, 4, 6}
-+ */
-+{
-+ wchar_t *pdest = dest;
-+ const unsigned char *psrc = src;
-+ size_t wc_count = 0;
-+
-+ mbstate_t mbs;
-+ int i, consumed;
-+ size_t mb_remain = len;
-+ size_t mb_count = 0;
-+
-+ /* Initialize the conversion state. */
-+ memset (&mbs, 0, sizeof (mbstate_t));
-+
-+ offset_buffer[0] = 0;
-+ for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed,
-+ psrc += consumed)
-+ {
-+#ifdef _LIBC
-+ consumed = __mbrtowc (pdest, psrc, mb_remain, &mbs);
-+#else
-+ consumed = mbrtowc (pdest, psrc, mb_remain, &mbs);
-+#endif
-+
-+ if (consumed <= 0)
-+ /* failed to convert. maybe src contains binary data.
-+ So we consume 1 byte manualy. */
-+ {
-+ *pdest = *psrc;
-+ consumed = 1;
-+ is_binary[wc_count] = TRUE;
-+ }
-+ else
-+ is_binary[wc_count] = FALSE;
-+ /* In sjis encoding, we use yen sign as escape character in
-+ place of reverse solidus. So we convert 0x5c(yen sign in
-+ sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse
-+ solidus in UCS2). */
-+ if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5)
-+ *pdest = (wchar_t) *psrc;
-+
-+ offset_buffer[wc_count + 1] = mb_count += consumed;
-+ }
-+
-+ /* Fill remain of the buffer with sentinel. */
-+ for (i = wc_count + 1 ; i <= len ; i++)
-+ offset_buffer[i] = mb_count + 1;
-+
-+ return wc_count;
-+}
-+
-+# endif /* WCHAR */
-+
-+#else /* not INSIDE_RECURSION */
-+
-+/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
-+ also be assigned to arbitrarily: each pattern buffer stores its own
-+ syntax, so it can be changed between regex compilations. */
-+/* This has no initializer because initialized variables in Emacs
-+ become read-only after dumping. */
-+reg_syntax_t re_syntax_options;
-+
-+
-+/* Specify the precise syntax of regexps for compilation. This provides
-+ for compatibility for various utilities which historically have
-+ different, incompatible syntaxes.
-+
-+ The argument SYNTAX is a bit mask comprised of the various bits
-+ defined in regex.h. We return the old syntax. */
-+
-+reg_syntax_t
-+re_set_syntax (reg_syntax_t syntax)
-+{
-+ reg_syntax_t ret = re_syntax_options;
-+
-+ re_syntax_options = syntax;
-+# ifdef DEBUG
-+ if (syntax & RE_DEBUG)
-+ debug = 1;
-+ else if (debug) /* was on but now is not */
-+ debug = 0;
-+# endif /* DEBUG */
-+ return ret;
-+}
-+# ifdef _LIBC
-+weak_alias (__re_set_syntax, re_set_syntax)
-+# endif
-+
-+/* This table gives an error message for each of the error codes listed
-+ in regex.h. Obviously the order here has to be same as there.
-+ POSIX doesn't require that we do anything for REG_NOERROR,
-+ but why not be nice? */
-+
-+static const char *re_error_msgid[] =
-+ {
-+ gettext_noop ("Success"), /* REG_NOERROR */
-+ gettext_noop ("No match"), /* REG_NOMATCH */
-+ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
-+ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
-+ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
-+ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
-+ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
-+ gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
-+ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
-+ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
-+ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
-+ gettext_noop ("Invalid range end"), /* REG_ERANGE */
-+ gettext_noop ("Memory exhausted"), /* REG_ESPACE */
-+ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
-+ gettext_noop ("Premature end of regular expression"), /* REG_EEND */
-+ gettext_noop ("Regular expression too big"), /* REG_ESIZE */
-+ gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
-+ };
-+
-+#endif /* INSIDE_RECURSION */
-+
-+#ifndef DEFINED_ONCE
-+/* Avoiding alloca during matching, to placate r_alloc. */
-+
-+/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
-+ searching and matching functions should not call alloca. On some
-+ systems, alloca is implemented in terms of malloc, and if we're
-+ using the relocating allocator routines, then malloc could cause a
-+ relocation, which might (if the strings being searched are in the
-+ ralloc heap) shift the data out from underneath the regexp
-+ routines.
-+
-+ Here's another reason to avoid allocation: Emacs
-+ processes input from X in a signal handler; processing X input may
-+ call malloc; if input arrives while a matching routine is calling
-+ malloc, then we're scrod. But Emacs can't just block input while
-+ calling matching routines; then we don't notice interrupts when
-+ they come in. So, Emacs blocks input around all regexp calls
-+ except the matching calls, which it leaves unprotected, in the
-+ faith that they will not malloc. */
-+
-+/* Normally, this is fine. */
-+# define MATCH_MAY_ALLOCATE
-+
-+/* When using GNU C, we are not REALLY using the C alloca, no matter
-+ what config.h may say. So don't take precautions for it. */
-+# ifdef __GNUC__
-+# undef C_ALLOCA
-+# endif
-+
-+/* The match routines may not allocate if (1) they would do it with malloc
-+ and (2) it's not safe for them to use malloc.
-+ Note that if REL_ALLOC is defined, matching would not use malloc for the
-+ failure stack, but we would still use it for the register vectors;
-+ so REL_ALLOC should not affect this. */
-+# if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
-+# undef MATCH_MAY_ALLOCATE
-+# endif
-+#endif /* not DEFINED_ONCE */
-+
-+#ifdef INSIDE_RECURSION
-+/* Failure stack declarations and macros; both re_compile_fastmap and
-+ re_match_2 use a failure stack. These have to be macros because of
-+ REGEX_ALLOCATE_STACK. */
-+
-+
-+/* Number of failure points for which to initially allocate space
-+ when matching. If this number is exceeded, we allocate more
-+ space, so it is not a hard limit. */
-+# ifndef INIT_FAILURE_ALLOC
-+# define INIT_FAILURE_ALLOC 5
-+# endif
-+
-+/* Roughly the maximum number of failure points on the stack. Would be
-+ exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
-+ This is a variable only so users of regex can assign to it; we never
-+ change it ourselves. */
-+
-+
-+# ifndef DEFINED_ONCE
-+
-+# ifdef INT_IS_16BIT
-+# define RE_M_F_TYPE long int
-+# else
-+# define RE_M_F_TYPE int
-+# endif /* INT_IS_16BIT */
-+
-+# ifdef MATCH_MAY_ALLOCATE
-+/* 4400 was enough to cause a crash on Alpha OSF/1,
-+ whose default stack limit is 2mb. */
-+# define RE_M_F_DEFAULT 4000
-+# else
-+# define RE_M_F_DEFAULT 2000
-+# endif /* MATCH_MAY_ALLOCATE */
-+
-+# include <shlib-compat.h>
-+
-+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
-+link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
-+RE_M_F_TYPE re_max_failures = RE_M_F_DEFAULT;
-+# else
-+RE_M_F_TYPE re_max_failures attribute_hidden = RE_M_F_DEFAULT;
-+# endif /* SHLIB_COMPAT */
-+
-+# undef RE_M_F_TYPE
-+# undef RE_M_F_DEFAULT
-+
-+# endif /* DEFINED_ONCE */
-+
-+# ifdef INT_IS_16BIT
-+
-+union PREFIX(fail_stack_elt)
-+{
-+ UCHAR_T *pointer;
-+ long int integer;
-+};
-+
-+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
-+
-+typedef struct
-+{
-+ PREFIX(fail_stack_elt_t) *stack;
-+ unsigned long int size;
-+ unsigned long int avail; /* Offset of next open position. */
-+} PREFIX(fail_stack_type);
-+
-+# else /* not INT_IS_16BIT */
-+
-+union PREFIX(fail_stack_elt)
-+{
-+ UCHAR_T *pointer;
-+ int integer;
-+};
-+
-+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
-+
-+typedef struct
-+{
-+ PREFIX(fail_stack_elt_t) *stack;
-+ unsigned size;
-+ unsigned avail; /* Offset of next open position. */
-+} PREFIX(fail_stack_type);
-+
-+# endif /* INT_IS_16BIT */
-+
-+# ifndef DEFINED_ONCE
-+# define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
-+# define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
-+# define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
-+# endif
-+
-+
-+/* Define macros to initialize and free the failure stack.
-+ Do `return -2' if the alloc fails. */
-+
-+# ifdef MATCH_MAY_ALLOCATE
-+# define INIT_FAIL_STACK() \
-+ do { \
-+ fail_stack.stack = (PREFIX(fail_stack_elt_t) *) \
-+ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (PREFIX(fail_stack_elt_t))); \
-+ \
-+ if (fail_stack.stack == NULL) \
-+ return -2; \
-+ \
-+ fail_stack.size = INIT_FAILURE_ALLOC; \
-+ fail_stack.avail = 0; \
-+ } while (0)
-+
-+# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
-+# else
-+# define INIT_FAIL_STACK() \
-+ do { \
-+ fail_stack.avail = 0; \
-+ } while (0)
-+
-+# define RESET_FAIL_STACK()
-+# endif
-+
-+
-+/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
-+
-+ Return 1 if succeeds, and 0 if either ran out of memory
-+ allocating space for it or it was already too large.
-+
-+ REGEX_REALLOCATE_STACK requires `destination' be declared. */
-+
-+# define DOUBLE_FAIL_STACK(fail_stack) \
-+ ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \
-+ ? 0 \
-+ : ((fail_stack).stack = (PREFIX(fail_stack_elt_t) *) \
-+ REGEX_REALLOCATE_STACK ((fail_stack).stack, \
-+ (fail_stack).size * sizeof (PREFIX(fail_stack_elt_t)), \
-+ ((fail_stack).size << 1) * sizeof (PREFIX(fail_stack_elt_t))),\
-+ \
-+ (fail_stack).stack == NULL \
-+ ? 0 \
-+ : ((fail_stack).size <<= 1, \
-+ 1)))
-+
-+
-+/* Push pointer POINTER on FAIL_STACK.
-+ Return 1 if was able to do so and 0 if ran out of memory allocating
-+ space to do so. */
-+# define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \
-+ ((FAIL_STACK_FULL () \
-+ && !DOUBLE_FAIL_STACK (FAIL_STACK)) \
-+ ? 0 \
-+ : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \
-+ 1))
-+
-+/* Push a pointer value onto the failure stack.
-+ Assumes the variable `fail_stack'. Probably should only
-+ be called from within `PUSH_FAILURE_POINT'. */
-+# define PUSH_FAILURE_POINTER(item) \
-+ fail_stack.stack[fail_stack.avail++].pointer = (UCHAR_T *) (item)
-+
-+/* This pushes an integer-valued item onto the failure stack.
-+ Assumes the variable `fail_stack'. Probably should only
-+ be called from within `PUSH_FAILURE_POINT'. */
-+# define PUSH_FAILURE_INT(item) \
-+ fail_stack.stack[fail_stack.avail++].integer = (item)
-+
-+/* Push a fail_stack_elt_t value onto the failure stack.
-+ Assumes the variable `fail_stack'. Probably should only
-+ be called from within `PUSH_FAILURE_POINT'. */
-+# define PUSH_FAILURE_ELT(item) \
-+ fail_stack.stack[fail_stack.avail++] = (item)
-+
-+/* These three POP... operations complement the three PUSH... operations.
-+ All assume that `fail_stack' is nonempty. */
-+# define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
-+# define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
-+# define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
-+
-+/* Used to omit pushing failure point id's when we're not debugging. */
-+# ifdef DEBUG
-+# define DEBUG_PUSH PUSH_FAILURE_INT
-+# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
-+# else
-+# define DEBUG_PUSH(item)
-+# define DEBUG_POP(item_addr)
-+# endif
-+
-+
-+/* Push the information about the state we will need
-+ if we ever fail back to it.
-+
-+ Requires variables fail_stack, regstart, regend, reg_info, and
-+ num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
-+ be declared.
-+
-+ Does `return FAILURE_CODE' if runs out of memory. */
-+
-+# define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
-+ do { \
-+ char *destination; \
-+ /* Must be int, so when we don't save any registers, the arithmetic \
-+ of 0 + -1 isn't done as unsigned. */ \
-+ /* Can't be int, since there is not a shred of a guarantee that int \
-+ is wide enough to hold a value of something to which pointer can \
-+ be assigned */ \
-+ active_reg_t this_reg; \
-+ \
-+ DEBUG_STATEMENT (failure_id++); \
-+ DEBUG_STATEMENT (nfailure_points_pushed++); \
-+ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
-+ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
-+ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
-+ \
-+ DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
-+ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
-+ \
-+ /* Ensure we have enough space allocated for what we will push. */ \
-+ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
-+ { \
-+ if (!DOUBLE_FAIL_STACK (fail_stack)) \
-+ return failure_code; \
-+ \
-+ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
-+ (fail_stack).size); \
-+ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
-+ } \
-+ \
-+ /* Push the info, starting with the registers. */ \
-+ DEBUG_PRINT1 ("\n"); \
-+ \
-+ if (1) \
-+ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
-+ this_reg++) \
-+ { \
-+ DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
-+ DEBUG_STATEMENT (num_regs_pushed++); \
-+ \
-+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
-+ PUSH_FAILURE_POINTER (regstart[this_reg]); \
-+ \
-+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
-+ PUSH_FAILURE_POINTER (regend[this_reg]); \
-+ \
-+ DEBUG_PRINT2 (" info: %p\n ", \
-+ reg_info[this_reg].word.pointer); \
-+ DEBUG_PRINT2 (" match_null=%d", \
-+ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
-+ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
-+ DEBUG_PRINT2 (" matched_something=%d", \
-+ MATCHED_SOMETHING (reg_info[this_reg])); \
-+ DEBUG_PRINT2 (" ever_matched=%d", \
-+ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
-+ DEBUG_PRINT1 ("\n"); \
-+ PUSH_FAILURE_ELT (reg_info[this_reg].word); \
-+ } \
-+ \
-+ DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
-+ PUSH_FAILURE_INT (lowest_active_reg); \
-+ \
-+ DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
-+ PUSH_FAILURE_INT (highest_active_reg); \
-+ \
-+ DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
-+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
-+ PUSH_FAILURE_POINTER (pattern_place); \
-+ \
-+ DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
-+ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
-+ size2); \
-+ DEBUG_PRINT1 ("'\n"); \
-+ PUSH_FAILURE_POINTER (string_place); \
-+ \
-+ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
-+ DEBUG_PUSH (failure_id); \
-+ } while (0)
-+
-+# ifndef DEFINED_ONCE
-+/* This is the number of items that are pushed and popped on the stack
-+ for each register. */
-+# define NUM_REG_ITEMS 3
-+
-+/* Individual items aside from the registers. */
-+# ifdef DEBUG
-+# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
-+# else
-+# define NUM_NONREG_ITEMS 4
-+# endif
-+
-+/* We push at most this many items on the stack. */
-+/* We used to use (num_regs - 1), which is the number of registers
-+ this regexp will save; but that was changed to 5
-+ to avoid stack overflow for a regexp with lots of parens. */
-+# define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
-+
-+/* We actually push this many items. */
-+# define NUM_FAILURE_ITEMS \
-+ (((0 \
-+ ? 0 : highest_active_reg - lowest_active_reg + 1) \
-+ * NUM_REG_ITEMS) \
-+ + NUM_NONREG_ITEMS)
-+
-+/* How many items can still be added to the stack without overflowing it. */
-+# define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
-+# endif /* not DEFINED_ONCE */
-+
-+
-+/* Pops what PUSH_FAIL_STACK pushes.
-+
-+ We restore into the parameters, all of which should be lvalues:
-+ STR -- the saved data position.
-+ PAT -- the saved pattern position.
-+ LOW_REG, HIGH_REG -- the highest and lowest active registers.
-+ REGSTART, REGEND -- arrays of string positions.
-+ REG_INFO -- array of information about each subexpression.
-+
-+ Also assumes the variables `fail_stack' and (if debugging), `bufp',
-+ `pend', `string1', `size1', `string2', and `size2'. */
-+# define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
-+{ \
-+ DEBUG_STATEMENT (unsigned failure_id;) \
-+ active_reg_t this_reg; \
-+ const UCHAR_T *string_temp; \
-+ \
-+ assert (!FAIL_STACK_EMPTY ()); \
-+ \
-+ /* Remove failure points and point to how many regs pushed. */ \
-+ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
-+ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
-+ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
-+ \
-+ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
-+ \
-+ DEBUG_POP (&failure_id); \
-+ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
-+ \
-+ /* If the saved string location is NULL, it came from an \
-+ on_failure_keep_string_jump opcode, and we want to throw away the \
-+ saved NULL, thus retaining our current position in the string. */ \
-+ string_temp = POP_FAILURE_POINTER (); \
-+ if (string_temp != NULL) \
-+ str = (const CHAR_T *) string_temp; \
-+ \
-+ DEBUG_PRINT2 (" Popping string %p: `", str); \
-+ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
-+ DEBUG_PRINT1 ("'\n"); \
-+ \
-+ pat = (UCHAR_T *) POP_FAILURE_POINTER (); \
-+ DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
-+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
-+ \
-+ /* Restore register info. */ \
-+ high_reg = (active_reg_t) POP_FAILURE_INT (); \
-+ DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
-+ \
-+ low_reg = (active_reg_t) POP_FAILURE_INT (); \
-+ DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
-+ \
-+ if (1) \
-+ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
-+ { \
-+ DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
-+ \
-+ reg_info[this_reg].word = POP_FAILURE_ELT (); \
-+ DEBUG_PRINT2 (" info: %p\n", \
-+ reg_info[this_reg].word.pointer); \
-+ \
-+ regend[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
-+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
-+ \
-+ regstart[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
-+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
-+ } \
-+ else \
-+ { \
-+ for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
-+ { \
-+ reg_info[this_reg].word.integer = 0; \
-+ regend[this_reg] = 0; \
-+ regstart[this_reg] = 0; \
-+ } \
-+ highest_active_reg = high_reg; \
-+ } \
-+ \
-+ set_regs_matched_done = 0; \
-+ DEBUG_STATEMENT (nfailure_points_popped++); \
-+} /* POP_FAILURE_POINT */
-+
-+/* Structure for per-register (a.k.a. per-group) information.
-+ Other register information, such as the
-+ starting and ending positions (which are addresses), and the list of
-+ inner groups (which is a bits list) are maintained in separate
-+ variables.
-+
-+ We are making a (strictly speaking) nonportable assumption here: that
-+ the compiler will pack our bit fields into something that fits into
-+ the type of `word', i.e., is something that fits into one item on the
-+ failure stack. */
-+
-+
-+/* Declarations and macros for re_match_2. */
-+
-+typedef union
-+{
-+ PREFIX(fail_stack_elt_t) word;
-+ struct
-+ {
-+ /* This field is one if this group can match the empty string,
-+ zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
-+# define MATCH_NULL_UNSET_VALUE 3
-+ unsigned match_null_string_p : 2;
-+ unsigned is_active : 1;
-+ unsigned matched_something : 1;
-+ unsigned ever_matched_something : 1;
-+ } bits;
-+} PREFIX(register_info_type);
-+
-+# ifndef DEFINED_ONCE
-+# define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
-+# define IS_ACTIVE(R) ((R).bits.is_active)
-+# define MATCHED_SOMETHING(R) ((R).bits.matched_something)
-+# define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
-+
-+
-+/* Call this when have matched a real character; it sets `matched' flags
-+ for the subexpressions which we are currently inside. Also records
-+ that those subexprs have matched. */
-+# define SET_REGS_MATCHED() \
-+ do \
-+ { \
-+ if (!set_regs_matched_done) \
-+ { \
-+ active_reg_t r; \
-+ set_regs_matched_done = 1; \
-+ for (r = lowest_active_reg; r <= highest_active_reg; r++) \
-+ { \
-+ MATCHED_SOMETHING (reg_info[r]) \
-+ = EVER_MATCHED_SOMETHING (reg_info[r]) \
-+ = 1; \
-+ } \
-+ } \
-+ } \
-+ while (0)
-+# endif /* not DEFINED_ONCE */
-+
-+/* Registers are set to a sentinel when they haven't yet matched. */
-+static CHAR_T PREFIX(reg_unset_dummy);
-+# define REG_UNSET_VALUE (&PREFIX(reg_unset_dummy))
-+# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
-+
-+/* Subroutine declarations and macros for regex_compile. */
-+static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg);
-+static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc,
-+ int arg1, int arg2);
-+static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc,
-+ int arg, UCHAR_T *end);
-+static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc,
-+ int arg1, int arg2, UCHAR_T *end);
-+static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
-+ const CHAR_T *p,
-+ reg_syntax_t syntax);
-+static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p,
-+ const CHAR_T *pend,
-+ reg_syntax_t syntax);
-+# ifdef WCHAR
-+static reg_errcode_t wcs_compile_range (CHAR_T range_start,
-+ const CHAR_T **p_ptr,
-+ const CHAR_T *pend,
-+ char *translate,
-+ reg_syntax_t syntax,
-+ UCHAR_T *b,
-+ CHAR_T *char_set);
-+static void insert_space (int num, CHAR_T *loc, CHAR_T *end);
-+# else /* BYTE */
-+static reg_errcode_t byte_compile_range (unsigned int range_start,
-+ const char **p_ptr,
-+ const char *pend,
-+ RE_TRANSLATE_TYPE translate,
-+ reg_syntax_t syntax,
-+ unsigned char *b);
-+# endif /* WCHAR */
-+
-+/* Fetch the next character in the uncompiled pattern---translating it
-+ if necessary. Also cast from a signed character in the constant
-+ string passed to us by the user to an unsigned char that we can use
-+ as an array index (in, e.g., `translate'). */
-+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
-+ because it is impossible to allocate 4GB array for some encodings
-+ which have 4 byte character_set like UCS4. */
-+# ifndef PATFETCH
-+# ifdef WCHAR
-+# define PATFETCH(c) \
-+ do {if (p == pend) return REG_EEND; \
-+ c = (UCHAR_T) *p++; \
-+ if (translate && (c <= 0xff)) c = (UCHAR_T) translate[c]; \
-+ } while (0)
-+# else /* BYTE */
-+# define PATFETCH(c) \
-+ do {if (p == pend) return REG_EEND; \
-+ c = (unsigned char) *p++; \
-+ if (translate) c = (unsigned char) translate[c]; \
-+ } while (0)
-+# endif /* WCHAR */
-+# endif
-+
-+/* Fetch the next character in the uncompiled pattern, with no
-+ translation. */
-+# define PATFETCH_RAW(c) \
-+ do {if (p == pend) return REG_EEND; \
-+ c = (UCHAR_T) *p++; \
-+ } while (0)
-+
-+/* Go backwards one character in the pattern. */
-+# define PATUNFETCH p--
-+
-+
-+/* If `translate' is non-null, return translate[D], else just D. We
-+ cast the subscript to translate because some data is declared as
-+ `char *', to avoid warnings when a string constant is passed. But
-+ when we use a character as a subscript we must make it unsigned. */
-+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
-+ because it is impossible to allocate 4GB array for some encodings
-+ which have 4 byte character_set like UCS4. */
-+
-+# ifndef TRANSLATE
-+# ifdef WCHAR
-+# define TRANSLATE(d) \
-+ ((translate && ((UCHAR_T) (d)) <= 0xff) \
-+ ? (char) translate[(unsigned char) (d)] : (d))
-+# else /* BYTE */
-+# define TRANSLATE(d) \
-+ (translate ? (char) translate[(unsigned char) (d)] : (char) (d))
-+# endif /* WCHAR */
-+# endif
-+
-+
-+/* Macros for outputting the compiled pattern into `buffer'. */
-+
-+/* If the buffer isn't allocated when it comes in, use this. */
-+# define INIT_BUF_SIZE (32 * sizeof(UCHAR_T))
-+
-+/* Make sure we have at least N more bytes of space in buffer. */
-+# ifdef WCHAR
-+# define GET_BUFFER_SPACE(n) \
-+ while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \
-+ + (n)*sizeof(CHAR_T)) > bufp->allocated) \
-+ EXTEND_BUFFER ()
-+# else /* BYTE */
-+# define GET_BUFFER_SPACE(n) \
-+ while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \
-+ EXTEND_BUFFER ()
-+# endif /* WCHAR */
-+
-+/* Make sure we have one more byte of buffer space and then add C to it. */
-+# define BUF_PUSH(c) \
-+ do { \
-+ GET_BUFFER_SPACE (1); \
-+ *b++ = (UCHAR_T) (c); \
-+ } while (0)
-+
-+
-+/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
-+# define BUF_PUSH_2(c1, c2) \
-+ do { \
-+ GET_BUFFER_SPACE (2); \
-+ *b++ = (UCHAR_T) (c1); \
-+ *b++ = (UCHAR_T) (c2); \
-+ } while (0)
-+
-+
-+/* As with BUF_PUSH_2, except for three bytes. */
-+# define BUF_PUSH_3(c1, c2, c3) \
-+ do { \
-+ GET_BUFFER_SPACE (3); \
-+ *b++ = (UCHAR_T) (c1); \
-+ *b++ = (UCHAR_T) (c2); \
-+ *b++ = (UCHAR_T) (c3); \
-+ } while (0)
-+
-+/* Store a jump with opcode OP at LOC to location TO. We store a
-+ relative address offset by the three bytes the jump itself occupies. */
-+# define STORE_JUMP(op, loc, to) \
-+ PREFIX(store_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)))
-+
-+/* Likewise, for a two-argument jump. */
-+# define STORE_JUMP2(op, loc, to, arg) \
-+ PREFIX(store_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg)
-+
-+/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
-+# define INSERT_JUMP(op, loc, to) \
-+ PREFIX(insert_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b)
-+
-+/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
-+# define INSERT_JUMP2(op, loc, to, arg) \
-+ PREFIX(insert_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\
-+ arg, b)
-+
-+/* This is not an arbitrary limit: the arguments which represent offsets
-+ into the pattern are two bytes long. So if 2^16 bytes turns out to
-+ be too small, many things would have to change. */
-+/* Any other compiler which, like MSC, has allocation limit below 2^16
-+ bytes will have to use approach similar to what was done below for
-+ MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
-+ reallocating to 0 bytes. Such thing is not going to work too well.
-+ You have been warned!! */
-+# ifndef DEFINED_ONCE
-+# if defined _MSC_VER && !defined WIN32
-+/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
-+ The REALLOC define eliminates a flurry of conversion warnings,
-+ but is not required. */
-+# define MAX_BUF_SIZE 65500L
-+# define REALLOC(p,s) realloc ((p), (size_t) (s))
-+# else
-+# define MAX_BUF_SIZE (1L << 16)
-+# define REALLOC(p,s) realloc ((p), (s))
-+# endif
-+
-+/* Extend the buffer by twice its current size via realloc and
-+ reset the pointers that pointed into the old block to point to the
-+ correct places in the new one. If extending the buffer results in it
-+ being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-+# ifndef __BOUNDED_POINTERS__
-+# define __BOUNDED_POINTERS__ 0
-+# endif
-+# if __BOUNDED_POINTERS__
-+# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
-+# define MOVE_BUFFER_POINTER(P) \
-+ (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
-+# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
-+ else \
-+ { \
-+ SET_HIGH_BOUND (b); \
-+ SET_HIGH_BOUND (begalt); \
-+ if (fixup_alt_jump) \
-+ SET_HIGH_BOUND (fixup_alt_jump); \
-+ if (laststart) \
-+ SET_HIGH_BOUND (laststart); \
-+ if (pending_exact) \
-+ SET_HIGH_BOUND (pending_exact); \
-+ }
-+# else
-+# define MOVE_BUFFER_POINTER(P) (P) += incr
-+# define ELSE_EXTEND_BUFFER_HIGH_BOUND
-+# endif
-+# endif /* not DEFINED_ONCE */
-+
-+# ifdef WCHAR
-+# define EXTEND_BUFFER() \
-+ do { \
-+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
-+ int wchar_count; \
-+ if (bufp->allocated + sizeof(UCHAR_T) > MAX_BUF_SIZE) \
-+ return REG_ESIZE; \
-+ bufp->allocated <<= 1; \
-+ if (bufp->allocated > MAX_BUF_SIZE) \
-+ bufp->allocated = MAX_BUF_SIZE; \
-+ /* How many characters the new buffer can have? */ \
-+ wchar_count = bufp->allocated / sizeof(UCHAR_T); \
-+ if (wchar_count == 0) wchar_count = 1; \
-+ /* Truncate the buffer to CHAR_T align. */ \
-+ bufp->allocated = wchar_count * sizeof(UCHAR_T); \
-+ RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
-+ bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
-+ if (COMPILED_BUFFER_VAR == NULL) \
-+ return REG_ESPACE; \
-+ /* If the buffer moved, move all the pointers into it. */ \
-+ if (old_buffer != COMPILED_BUFFER_VAR) \
-+ { \
-+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
-+ MOVE_BUFFER_POINTER (b); \
-+ MOVE_BUFFER_POINTER (begalt); \
-+ if (fixup_alt_jump) \
-+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
-+ if (laststart) \
-+ MOVE_BUFFER_POINTER (laststart); \
-+ if (pending_exact) \
-+ MOVE_BUFFER_POINTER (pending_exact); \
-+ } \
-+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
-+ } while (0)
-+# else /* BYTE */
-+# define EXTEND_BUFFER() \
-+ do { \
-+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
-+ if (bufp->allocated == MAX_BUF_SIZE) \
-+ return REG_ESIZE; \
-+ bufp->allocated <<= 1; \
-+ if (bufp->allocated > MAX_BUF_SIZE) \
-+ bufp->allocated = MAX_BUF_SIZE; \
-+ bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, \
-+ bufp->allocated); \
-+ if (COMPILED_BUFFER_VAR == NULL) \
-+ return REG_ESPACE; \
-+ /* If the buffer moved, move all the pointers into it. */ \
-+ if (old_buffer != COMPILED_BUFFER_VAR) \
-+ { \
-+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
-+ MOVE_BUFFER_POINTER (b); \
-+ MOVE_BUFFER_POINTER (begalt); \
-+ if (fixup_alt_jump) \
-+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
-+ if (laststart) \
-+ MOVE_BUFFER_POINTER (laststart); \
-+ if (pending_exact) \
-+ MOVE_BUFFER_POINTER (pending_exact); \
-+ } \
-+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
-+ } while (0)
-+# endif /* WCHAR */
-+
-+# ifndef DEFINED_ONCE
-+/* Since we have one byte reserved for the register number argument to
-+ {start,stop}_memory, the maximum number of groups we can report
-+ things about is what fits in that byte. */
-+# define MAX_REGNUM 255
-+
-+/* But patterns can have more than `MAX_REGNUM' registers. We just
-+ ignore the excess. */
-+typedef unsigned regnum_t;
-+
-+
-+/* Macros for the compile stack. */
-+
-+/* Since offsets can go either forwards or backwards, this type needs to
-+ be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
-+/* int may be not enough when sizeof(int) == 2. */
-+typedef long pattern_offset_t;
-+
-+typedef struct
-+{
-+ pattern_offset_t begalt_offset;
-+ pattern_offset_t fixup_alt_jump;
-+ pattern_offset_t inner_group_offset;
-+ pattern_offset_t laststart_offset;
-+ regnum_t regnum;
-+} compile_stack_elt_t;
-+
-+
-+typedef struct
-+{
-+ compile_stack_elt_t *stack;
-+ unsigned size;
-+ unsigned avail; /* Offset of next open position. */
-+} compile_stack_type;
-+
-+
-+# define INIT_COMPILE_STACK_SIZE 32
-+
-+# define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
-+# define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
-+
-+/* The next available element. */
-+# define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
-+
-+# endif /* not DEFINED_ONCE */
-+
-+/* Set the bit for character C in a list. */
-+# ifndef DEFINED_ONCE
-+# define SET_LIST_BIT(c) \
-+ (b[((unsigned char) (c)) / BYTEWIDTH] \
-+ |= 1 << (((unsigned char) c) % BYTEWIDTH))
-+# endif /* DEFINED_ONCE */
-+
-+/* Get the next unsigned number in the uncompiled pattern. */
-+# define GET_UNSIGNED_NUMBER(num) \
-+ { \
-+ while (p != pend) \
-+ { \
-+ PATFETCH (c); \
-+ if (c < '0' || c > '9') \
-+ break; \
-+ if (num <= RE_DUP_MAX) \
-+ { \
-+ if (num < 0) \
-+ num = 0; \
-+ num = num * 10 + c - '0'; \
-+ } \
-+ } \
-+ }
-+
-+# ifndef DEFINED_ONCE
-+# if WIDE_CHAR_SUPPORT
-+/* The GNU C library provides support for user-defined character classes
-+ and the functions from ISO C amendement 1. */
-+# ifdef CHARCLASS_NAME_MAX
-+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
-+# else
-+/* This shouldn't happen but some implementation might still have this
-+ problem. Use a reasonable default value. */
-+# define CHAR_CLASS_MAX_LENGTH 256
-+# endif
-+
-+# ifdef _LIBC
-+# define IS_CHAR_CLASS(string) __wctype (string)
-+# else
-+# define IS_CHAR_CLASS(string) wctype (string)
-+# endif
-+# else
-+# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
-+
-+# define IS_CHAR_CLASS(string) \
-+ (STREQ (string, "alpha") || STREQ (string, "upper") \
-+ || STREQ (string, "lower") || STREQ (string, "digit") \
-+ || STREQ (string, "alnum") || STREQ (string, "xdigit") \
-+ || STREQ (string, "space") || STREQ (string, "print") \
-+ || STREQ (string, "punct") || STREQ (string, "graph") \
-+ || STREQ (string, "cntrl") || STREQ (string, "blank"))
-+# endif
-+# endif /* DEFINED_ONCE */
-+
-+# ifndef MATCH_MAY_ALLOCATE
-+
-+/* If we cannot allocate large objects within re_match_2_internal,
-+ we make the fail stack and register vectors global.
-+ The fail stack, we grow to the maximum size when a regexp
-+ is compiled.
-+ The register vectors, we adjust in size each time we
-+ compile a regexp, according to the number of registers it needs. */
-+
-+static PREFIX(fail_stack_type) fail_stack;
-+
-+/* Size with which the following vectors are currently allocated.
-+ That is so we can make them bigger as needed,
-+ but never make them smaller. */
-+# ifdef DEFINED_ONCE
-+static int regs_allocated_size;
-+
-+static const char ** regstart, ** regend;
-+static const char ** old_regstart, ** old_regend;
-+static const char **best_regstart, **best_regend;
-+static const char **reg_dummy;
-+# endif /* DEFINED_ONCE */
-+
-+static PREFIX(register_info_type) *PREFIX(reg_info);
-+static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
-+
-+/* Make the register vectors big enough for NUM_REGS registers,
-+ but don't make them smaller. */
-+
-+static void
-+PREFIX(regex_grow_registers) (int num_regs)
-+{
-+ if (num_regs > regs_allocated_size)
-+ {
-+ RETALLOC_IF (regstart, num_regs, const char *);
-+ RETALLOC_IF (regend, num_regs, const char *);
-+ RETALLOC_IF (old_regstart, num_regs, const char *);
-+ RETALLOC_IF (old_regend, num_regs, const char *);
-+ RETALLOC_IF (best_regstart, num_regs, const char *);
-+ RETALLOC_IF (best_regend, num_regs, const char *);
-+ RETALLOC_IF (PREFIX(reg_info), num_regs, PREFIX(register_info_type));
-+ RETALLOC_IF (reg_dummy, num_regs, const char *);
-+ RETALLOC_IF (PREFIX(reg_info_dummy), num_regs, PREFIX(register_info_type));
-+
-+ regs_allocated_size = num_regs;
-+ }
-+}
-+
-+# endif /* not MATCH_MAY_ALLOCATE */
-+
-+# ifndef DEFINED_ONCE
-+static boolean group_in_compile_stack (compile_stack_type compile_stack,
-+ regnum_t regnum);
-+# endif /* not DEFINED_ONCE */
-+
-+/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
-+ Returns one of error codes defined in `regex.h', or zero for success.
-+
-+ Assumes the `allocated' (and perhaps `buffer') and `translate'
-+ fields are set in BUFP on entry.
-+
-+ If it succeeds, results are put in BUFP (if it returns an error, the
-+ contents of BUFP are undefined):
-+ `buffer' is the compiled pattern;
-+ `syntax' is set to SYNTAX;
-+ `used' is set to the length of the compiled pattern;
-+ `fastmap_accurate' is zero;
-+ `re_nsub' is the number of subexpressions in PATTERN;
-+ `not_bol' and `not_eol' are zero;
-+
-+ The `fastmap' and `newline_anchor' fields are neither
-+ examined nor set. */
-+
-+/* Return, freeing storage we allocated. */
-+# ifdef WCHAR
-+# define FREE_STACK_RETURN(value) \
-+ return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
-+# else
-+# define FREE_STACK_RETURN(value) \
-+ return (free (compile_stack.stack), value)
-+# endif /* WCHAR */
-+
-+static reg_errcode_t
-+PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
-+ size_t ARG_PREFIX(size), reg_syntax_t syntax,
-+ struct re_pattern_buffer *bufp)
-+{
-+ /* We fetch characters from PATTERN here. Even though PATTERN is
-+ `char *' (i.e., signed), we declare these variables as unsigned, so
-+ they can be reliably used as array indices. */
-+ register UCHAR_T c, c1;
-+
-+#ifdef WCHAR
-+ /* A temporary space to keep wchar_t pattern and compiled pattern. */
-+ CHAR_T *pattern, *COMPILED_BUFFER_VAR;
-+ size_t size;
-+ /* offset buffer for optimization. See convert_mbs_to_wc. */
-+ int *mbs_offset = NULL;
-+ /* It hold whether each wchar_t is binary data or not. */
-+ char *is_binary = NULL;
-+ /* A flag whether exactn is handling binary data or not. */
-+ char is_exactn_bin = FALSE;
-+#endif /* WCHAR */
-+
-+ /* A random temporary spot in PATTERN. */
-+ const CHAR_T *p1;
-+
-+ /* Points to the end of the buffer, where we should append. */
-+ register UCHAR_T *b;
-+
-+ /* Keeps track of unclosed groups. */
-+ compile_stack_type compile_stack;
-+
-+ /* Points to the current (ending) position in the pattern. */
-+#ifdef WCHAR
-+ const CHAR_T *p;
-+ const CHAR_T *pend;
-+#else /* BYTE */
-+ const CHAR_T *p = pattern;
-+ const CHAR_T *pend = pattern + size;
-+#endif /* WCHAR */
-+
-+ /* How to translate the characters in the pattern. */
-+ RE_TRANSLATE_TYPE translate = bufp->translate;
-+
-+ /* Address of the count-byte of the most recently inserted `exactn'
-+ command. This makes it possible to tell if a new exact-match
-+ character can be added to that command or if the character requires
-+ a new `exactn' command. */
-+ UCHAR_T *pending_exact = 0;
-+
-+ /* Address of start of the most recently finished expression.
-+ This tells, e.g., postfix * where to find the start of its
-+ operand. Reset at the beginning of groups and alternatives. */
-+ UCHAR_T *laststart = 0;
-+
-+ /* Address of beginning of regexp, or inside of last group. */
-+ UCHAR_T *begalt;
-+
-+ /* Address of the place where a forward jump should go to the end of
-+ the containing expression. Each alternative of an `or' -- except the
-+ last -- ends with a forward jump of this sort. */
-+ UCHAR_T *fixup_alt_jump = 0;
-+
-+ /* Counts open-groups as they are encountered. Remembered for the
-+ matching close-group on the compile stack, so the same register
-+ number is put in the stop_memory as the start_memory. */
-+ regnum_t regnum = 0;
-+
-+#ifdef WCHAR
-+ /* Initialize the wchar_t PATTERN and offset_buffer. */
-+ p = pend = pattern = TALLOC(csize + 1, CHAR_T);
-+ mbs_offset = TALLOC(csize + 1, int);
-+ is_binary = TALLOC(csize + 1, char);
-+ if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
-+ {
-+ free(pattern);
-+ free(mbs_offset);
-+ free(is_binary);
-+ return REG_ESPACE;
-+ }
-+ pattern[csize] = L'\0'; /* sentinel */
-+ size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
-+ pend = p + size;
-+ if (size < 0)
-+ {
-+ free(pattern);
-+ free(mbs_offset);
-+ free(is_binary);
-+ return REG_BADPAT;
-+ }
-+#endif
-+
-+#ifdef DEBUG
-+ DEBUG_PRINT1 ("\nCompiling pattern: ");
-+ if (debug)
-+ {
-+ unsigned debug_count;
-+
-+ for (debug_count = 0; debug_count < size; debug_count++)
-+ PUT_CHAR (pattern[debug_count]);
-+ putchar ('\n');
-+ }
-+#endif /* DEBUG */
-+
-+ /* Initialize the compile stack. */
-+ compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
-+ if (compile_stack.stack == NULL)
-+ {
-+#ifdef WCHAR
-+ free(pattern);
-+ free(mbs_offset);
-+ free(is_binary);
-+#endif
-+ return REG_ESPACE;
-+ }
-+
-+ compile_stack.size = INIT_COMPILE_STACK_SIZE;
-+ compile_stack.avail = 0;
-+
-+ /* Initialize the pattern buffer. */
-+ bufp->syntax = syntax;
-+ bufp->fastmap_accurate = 0;
-+ bufp->not_bol = bufp->not_eol = 0;
-+
-+ /* Set `used' to zero, so that if we return an error, the pattern
-+ printer (for debugging) will think there's no pattern. We reset it
-+ at the end. */
-+ bufp->used = 0;
-+
-+ /* Always count groups, whether or not bufp->no_sub is set. */
-+ bufp->re_nsub = 0;
-+
-+#if !defined emacs && !defined SYNTAX_TABLE
-+ /* Initialize the syntax table. */
-+ init_syntax_once ();
-+#endif
-+
-+ if (bufp->allocated == 0)
-+ {
-+ if (bufp->buffer)
-+ { /* If zero allocated, but buffer is non-null, try to realloc
-+ enough space. This loses if buffer's address is bogus, but
-+ that is the user's responsibility. */
-+#ifdef WCHAR
-+ /* Free bufp->buffer and allocate an array for wchar_t pattern
-+ buffer. */
-+ free(bufp->buffer);
-+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(UCHAR_T),
-+ UCHAR_T);
-+#else
-+ RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, UCHAR_T);
-+#endif /* WCHAR */
-+ }
-+ else
-+ { /* Caller did not allocate a buffer. Do it for them. */
-+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(UCHAR_T),
-+ UCHAR_T);
-+ }
-+
-+ if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE);
-+#ifdef WCHAR
-+ bufp->buffer = (char*)COMPILED_BUFFER_VAR;
-+#endif /* WCHAR */
-+ bufp->allocated = INIT_BUF_SIZE;
-+ }
-+#ifdef WCHAR
-+ else
-+ COMPILED_BUFFER_VAR = (UCHAR_T*) bufp->buffer;
-+#endif
-+
-+ begalt = b = COMPILED_BUFFER_VAR;
-+
-+ /* Loop through the uncompiled pattern until we're at the end. */
-+ while (p != pend)
-+ {
-+ PATFETCH (c);
-+
-+ switch (c)
-+ {
-+ case '^':
-+ {
-+ if ( /* If at start of pattern, it's an operator. */
-+ p == pattern + 1
-+ /* If context independent, it's an operator. */
-+ || syntax & RE_CONTEXT_INDEP_ANCHORS
-+ /* Otherwise, depends on what's come before. */
-+ || PREFIX(at_begline_loc_p) (pattern, p, syntax))
-+ BUF_PUSH (begline);
-+ else
-+ goto normal_char;
-+ }
-+ break;
-+
-+
-+ case '$':
-+ {
-+ if ( /* If at end of pattern, it's an operator. */
-+ p == pend
-+ /* If context independent, it's an operator. */
-+ || syntax & RE_CONTEXT_INDEP_ANCHORS
-+ /* Otherwise, depends on what's next. */
-+ || PREFIX(at_endline_loc_p) (p, pend, syntax))
-+ BUF_PUSH (endline);
-+ else
-+ goto normal_char;
-+ }
-+ break;
-+
-+
-+ case '+':
-+ case '?':
-+ if ((syntax & RE_BK_PLUS_QM)
-+ || (syntax & RE_LIMITED_OPS))
-+ goto normal_char;
-+ handle_plus:
-+ case '*':
-+ /* If there is no previous pattern... */
-+ if (!laststart)
-+ {
-+ if (syntax & RE_CONTEXT_INVALID_OPS)
-+ FREE_STACK_RETURN (REG_BADRPT);
-+ else if (!(syntax & RE_CONTEXT_INDEP_OPS))
-+ goto normal_char;
-+ }
-+
-+ {
-+ /* Are we optimizing this jump? */
-+ boolean keep_string_p = false;
-+
-+ /* 1 means zero (many) matches is allowed. */
-+ char zero_times_ok = 0, many_times_ok = 0;
-+
-+ /* If there is a sequence of repetition chars, collapse it
-+ down to just one (the right one). We can't combine
-+ interval operators with these because of, e.g., `a{2}*',
-+ which should only match an even number of `a's. */
-+
-+ for (;;)
-+ {
-+ zero_times_ok |= c != '+';
-+ many_times_ok |= c != '?';
-+
-+ if (p == pend)
-+ break;
-+
-+ PATFETCH (c);
-+
-+ if (c == '*'
-+ || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
-+ ;
-+
-+ else if (syntax & RE_BK_PLUS_QM && c == '\\')
-+ {
-+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-+
-+ PATFETCH (c1);
-+ if (!(c1 == '+' || c1 == '?'))
-+ {
-+ PATUNFETCH;
-+ PATUNFETCH;
-+ break;
-+ }
-+
-+ c = c1;
-+ }
-+ else
-+ {
-+ PATUNFETCH;
-+ break;
-+ }
-+
-+ /* If we get here, we found another repeat character. */
-+ }
-+
-+ /* Star, etc. applied to an empty pattern is equivalent
-+ to an empty pattern. */
-+ if (!laststart)
-+ break;
-+
-+ /* Now we know whether or not zero matches is allowed
-+ and also whether or not two or more matches is allowed. */
-+ if (many_times_ok)
-+ { /* More than one repetition is allowed, so put in at the
-+ end a backward relative jump from `b' to before the next
-+ jump we're going to put in below (which jumps from
-+ laststart to after this jump).
-+
-+ But if we are at the `*' in the exact sequence `.*\n',
-+ insert an unconditional jump backwards to the .,
-+ instead of the beginning of the loop. This way we only
-+ push a failure point once, instead of every time
-+ through the loop. */
-+ assert (p - 1 > pattern);
-+
-+ /* Allocate the space for the jump. */
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+
-+ /* We know we are not at the first character of the pattern,
-+ because laststart was nonzero. And we've already
-+ incremented `p', by the way, to be the character after
-+ the `*'. Do we have to do something analogous here
-+ for null bytes, because of RE_DOT_NOT_NULL? */
-+ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
-+ && zero_times_ok
-+ && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
-+ && !(syntax & RE_DOT_NEWLINE))
-+ { /* We have .*\n. */
-+ STORE_JUMP (jump, b, laststart);
-+ keep_string_p = true;
-+ }
-+ else
-+ /* Anything else. */
-+ STORE_JUMP (maybe_pop_jump, b, laststart -
-+ (1 + OFFSET_ADDRESS_SIZE));
-+
-+ /* We've added more stuff to the buffer. */
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+ }
-+
-+ /* On failure, jump from laststart to b + 3, which will be the
-+ end of the buffer after this jump is inserted. */
-+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of
-+ 'b + 3'. */
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+ INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
-+ : on_failure_jump,
-+ laststart, b + 1 + OFFSET_ADDRESS_SIZE);
-+ pending_exact = 0;
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+
-+ if (!zero_times_ok)
-+ {
-+ /* At least one repetition is required, so insert a
-+ `dummy_failure_jump' before the initial
-+ `on_failure_jump' instruction of the loop. This
-+ effects a skip over that instruction the first time
-+ we hit that loop. */
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+ INSERT_JUMP (dummy_failure_jump, laststart, laststart +
-+ 2 + 2 * OFFSET_ADDRESS_SIZE);
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+ }
-+ }
-+ break;
-+
-+
-+ case '.':
-+ laststart = b;
-+ BUF_PUSH (anychar);
-+ break;
-+
-+
-+ case '[':
-+ {
-+ boolean had_char_class = false;
-+#ifdef WCHAR
-+ CHAR_T range_start = 0xffffffff;
-+#else
-+ unsigned int range_start = 0xffffffff;
-+#endif
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+#ifdef WCHAR
-+ /* We assume a charset(_not) structure as a wchar_t array.
-+ charset[0] = (re_opcode_t) charset(_not)
-+ charset[1] = l (= length of char_classes)
-+ charset[2] = m (= length of collating_symbols)
-+ charset[3] = n (= length of equivalence_classes)
-+ charset[4] = o (= length of char_ranges)
-+ charset[5] = p (= length of chars)
-+
-+ charset[6] = char_class (wctype_t)
-+ charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t)
-+ ...
-+ charset[l+5] = char_class (wctype_t)
-+
-+ charset[l+6] = collating_symbol (wchar_t)
-+ ...
-+ charset[l+m+5] = collating_symbol (wchar_t)
-+ ifdef _LIBC we use the index if
-+ _NL_COLLATE_SYMB_EXTRAMB instead of
-+ wchar_t string.
-+
-+ charset[l+m+6] = equivalence_classes (wchar_t)
-+ ...
-+ charset[l+m+n+5] = equivalence_classes (wchar_t)
-+ ifdef _LIBC we use the index in
-+ _NL_COLLATE_WEIGHT instead of
-+ wchar_t string.
-+
-+ charset[l+m+n+6] = range_start
-+ charset[l+m+n+7] = range_end
-+ ...
-+ charset[l+m+n+2o+4] = range_start
-+ charset[l+m+n+2o+5] = range_end
-+ ifdef _LIBC we use the value looked up
-+ in _NL_COLLATE_COLLSEQ instead of
-+ wchar_t character.
-+
-+ charset[l+m+n+2o+6] = char
-+ ...
-+ charset[l+m+n+2o+p+5] = char
-+
-+ */
-+
-+ /* We need at least 6 spaces: the opcode, the length of
-+ char_classes, the length of collating_symbols, the length of
-+ equivalence_classes, the length of char_ranges, the length of
-+ chars. */
-+ GET_BUFFER_SPACE (6);
-+
-+ /* Save b as laststart. And We use laststart as the pointer
-+ to the first element of the charset here.
-+ In other words, laststart[i] indicates charset[i]. */
-+ laststart = b;
-+
-+ /* We test `*p == '^' twice, instead of using an if
-+ statement, so we only need one BUF_PUSH. */
-+ BUF_PUSH (*p == '^' ? charset_not : charset);
-+ if (*p == '^')
-+ p++;
-+
-+ /* Push the length of char_classes, the length of
-+ collating_symbols, the length of equivalence_classes, the
-+ length of char_ranges and the length of chars. */
-+ BUF_PUSH_3 (0, 0, 0);
-+ BUF_PUSH_2 (0, 0);
-+
-+ /* Remember the first position in the bracket expression. */
-+ p1 = p;
-+
-+ /* charset_not matches newline according to a syntax bit. */
-+ if ((re_opcode_t) b[-6] == charset_not
-+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
-+ {
-+ BUF_PUSH('\n');
-+ laststart[5]++; /* Update the length of characters */
-+ }
-+
-+ /* Read in characters and ranges, setting map bits. */
-+ for (;;)
-+ {
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ PATFETCH (c);
-+
-+ /* \ might escape characters inside [...] and [^...]. */
-+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
-+ {
-+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-+
-+ PATFETCH (c1);
-+ BUF_PUSH(c1);
-+ laststart[5]++; /* Update the length of chars */
-+ range_start = c1;
-+ continue;
-+ }
-+
-+ /* Could be the end of the bracket expression. If it's
-+ not (i.e., when the bracket expression is `[]' so
-+ far), the ']' character bit gets set way below. */
-+ if (c == ']' && p != p1 + 1)
-+ break;
-+
-+ /* Look ahead to see if it's a range when the last thing
-+ was a character class. */
-+ if (had_char_class && c == '-' && *p != ']')
-+ FREE_STACK_RETURN (REG_ERANGE);
-+
-+ /* Look ahead to see if it's a range when the last thing
-+ was a character: if this is a hyphen not at the
-+ beginning or the end of a list, then it's the range
-+ operator. */
-+ if (c == '-'
-+ && !(p - 2 >= pattern && p[-2] == '[')
-+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
-+ && *p != ']')
-+ {
-+ reg_errcode_t ret;
-+ /* Allocate the space for range_start and range_end. */
-+ GET_BUFFER_SPACE (2);
-+ /* Update the pointer to indicate end of buffer. */
-+ b += 2;
-+ ret = wcs_compile_range (range_start, &p, pend, translate,
-+ syntax, b, laststart);
-+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
-+ range_start = 0xffffffff;
-+ }
-+ else if (p[0] == '-' && p[1] != ']')
-+ { /* This handles ranges made up of characters only. */
-+ reg_errcode_t ret;
-+
-+ /* Move past the `-'. */
-+ PATFETCH (c1);
-+ /* Allocate the space for range_start and range_end. */
-+ GET_BUFFER_SPACE (2);
-+ /* Update the pointer to indicate end of buffer. */
-+ b += 2;
-+ ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
-+ laststart);
-+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
-+ range_start = 0xffffffff;
-+ }
-+
-+ /* See if we're at the beginning of a possible character
-+ class. */
-+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
-+ { /* Leave room for the null. */
-+ char str[CHAR_CLASS_MAX_LENGTH + 1];
-+
-+ PATFETCH (c);
-+ c1 = 0;
-+
-+ /* If pattern is `[[:'. */
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (;;)
-+ {
-+ PATFETCH (c);
-+ if ((c == ':' && *p == ']') || p == pend)
-+ break;
-+ if (c1 < CHAR_CLASS_MAX_LENGTH)
-+ str[c1++] = c;
-+ else
-+ /* This is in any case an invalid class name. */
-+ str[0] = '\0';
-+ }
-+ str[c1] = '\0';
-+
-+ /* If isn't a word bracketed by `[:' and `:]':
-+ undo the ending character, the letters, and leave
-+ the leading `:' and `[' (but store them as character). */
-+ if (c == ':' && *p == ']')
-+ {
-+ wctype_t wt;
-+ uintptr_t alignedp;
-+
-+ /* Query the character class as wctype_t. */
-+ wt = IS_CHAR_CLASS (str);
-+ if (wt == 0)
-+ FREE_STACK_RETURN (REG_ECTYPE);
-+
-+ /* Throw away the ] at the end of the character
-+ class. */
-+ PATFETCH (c);
-+
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ /* Allocate the space for character class. */
-+ GET_BUFFER_SPACE(CHAR_CLASS_SIZE);
-+ /* Update the pointer to indicate end of buffer. */
-+ b += CHAR_CLASS_SIZE;
-+ /* Move data which follow character classes
-+ not to violate the data. */
-+ insert_space(CHAR_CLASS_SIZE,
-+ laststart + 6 + laststart[1],
-+ b - 1);
-+ alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
-+ + __alignof__(wctype_t) - 1)
-+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
-+ /* Store the character class. */
-+ *((wctype_t*)alignedp) = wt;
-+ /* Update length of char_classes */
-+ laststart[1] += CHAR_CLASS_SIZE;
-+
-+ had_char_class = true;
-+ }
-+ else
-+ {
-+ c1++;
-+ while (c1--)
-+ PATUNFETCH;
-+ BUF_PUSH ('[');
-+ BUF_PUSH (':');
-+ laststart[5] += 2; /* Update the length of characters */
-+ range_start = ':';
-+ had_char_class = false;
-+ }
-+ }
-+ else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
-+ || *p == '.'))
-+ {
-+ CHAR_T str[128]; /* Should be large enough. */
-+ CHAR_T delim = *p; /* '=' or '.' */
-+# ifdef _LIBC
-+ uint32_t nrules =
-+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+# endif
-+ PATFETCH (c);
-+ c1 = 0;
-+
-+ /* If pattern is `[[=' or '[[.'. */
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (;;)
-+ {
-+ PATFETCH (c);
-+ if ((c == delim && *p == ']') || p == pend)
-+ break;
-+ if (c1 < sizeof (str) - 1)
-+ str[c1++] = c;
-+ else
-+ /* This is in any case an invalid class name. */
-+ str[0] = '\0';
-+ }
-+ str[c1] = '\0';
-+
-+ if (c == delim && *p == ']' && str[0] != '\0')
-+ {
-+ unsigned int i, offset;
-+ /* If we have no collation data we use the default
-+ collation in which each character is in a class
-+ by itself. It also means that ASCII is the
-+ character set and therefore we cannot have character
-+ with more than one byte in the multibyte
-+ representation. */
-+
-+ /* If not defined _LIBC, we push the name and
-+ `\0' for the sake of matching performance. */
-+ int datasize = c1 + 1;
-+
-+# ifdef _LIBC
-+ int32_t idx = 0;
-+ if (nrules == 0)
-+# endif
-+ {
-+ if (c1 != 1)
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+ }
-+# ifdef _LIBC
-+ else
-+ {
-+ const int32_t *table;
-+ const int32_t *weights;
-+ const int32_t *extra;
-+ const int32_t *indirect;
-+ wint_t *cp;
-+
-+ if(delim == '=')
-+ {
-+ /* We push the index for equivalence class. */
-+ cp = (wint_t*)str;
-+
-+ table = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_TABLEWC);
-+ weights = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_WEIGHTWC);
-+ extra = (const wint_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_EXTRAWC);
-+ indirect = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_INDIRECTWC);
-+
-+ idx = FINDIDX (table, indirect, extra, &cp, 1);
-+ if (idx == 0 || cp < (wint_t*) str + c1)
-+ /* This is no valid character. */
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+
-+ str[0] = (wchar_t)idx;
-+ }
-+ else /* delim == '.' */
-+ {
-+ /* We push collation sequence value
-+ for collating symbol. */
-+ int32_t table_size;
-+ const int32_t *symb_table;
-+ const unsigned char *extra;
-+ int32_t idx;
-+ int32_t elem;
-+ int32_t second;
-+ int32_t hash;
-+ char char_str[c1];
-+
-+ /* We have to convert the name to a single-byte
-+ string. This is possible since the names
-+ consist of ASCII characters and the internal
-+ representation is UCS4. */
-+ for (i = 0; i < c1; ++i)
-+ char_str[i] = str[i];
-+
-+ table_size =
-+ _NL_CURRENT_WORD (LC_COLLATE,
-+ _NL_COLLATE_SYMB_HASH_SIZEMB);
-+ symb_table = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_SYMB_TABLEMB);
-+ extra = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_SYMB_EXTRAMB);
-+
-+ /* Locate the character in the hashing table. */
-+ hash = elem_hash (char_str, c1);
-+
-+ idx = 0;
-+ elem = hash % table_size;
-+ second = hash % (table_size - 2);
-+ while (symb_table[2 * elem] != 0)
-+ {
-+ /* First compare the hashing value. */
-+ if (symb_table[2 * elem] == hash
-+ && c1 == extra[symb_table[2 * elem + 1]]
-+ && memcmp (char_str,
-+ &extra[symb_table[2 * elem + 1]
-+ + 1], c1) == 0)
-+ {
-+ /* Yep, this is the entry. */
-+ idx = symb_table[2 * elem + 1];
-+ idx += 1 + extra[idx];
-+ break;
-+ }
-+
-+ /* Next entry. */
-+ elem += second;
-+ }
-+
-+ if (symb_table[2 * elem] != 0)
-+ {
-+ /* Compute the index of the byte sequence
-+ in the table. */
-+ idx += 1 + extra[idx];
-+ /* Adjust for the alignment. */
-+ idx = (idx + 3) & ~3;
-+
-+ str[0] = (wchar_t) idx + 4;
-+ }
-+ else if (symb_table[2 * elem] == 0 && c1 == 1)
-+ {
-+ /* No valid character. Match it as a
-+ single byte character. */
-+ had_char_class = false;
-+ BUF_PUSH(str[0]);
-+ /* Update the length of characters */
-+ laststart[5]++;
-+ range_start = str[0];
-+
-+ /* Throw away the ] at the end of the
-+ collating symbol. */
-+ PATFETCH (c);
-+ /* exit from the switch block. */
-+ continue;
-+ }
-+ else
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+ }
-+ datasize = 1;
-+ }
-+# endif
-+ /* Throw away the ] at the end of the equivalence
-+ class (or collating symbol). */
-+ PATFETCH (c);
-+
-+ /* Allocate the space for the equivalence class
-+ (or collating symbol) (and '\0' if needed). */
-+ GET_BUFFER_SPACE(datasize);
-+ /* Update the pointer to indicate end of buffer. */
-+ b += datasize;
-+
-+ if (delim == '=')
-+ { /* equivalence class */
-+ /* Calculate the offset of char_ranges,
-+ which is next to equivalence_classes. */
-+ offset = laststart[1] + laststart[2]
-+ + laststart[3] +6;
-+ /* Insert space. */
-+ insert_space(datasize, laststart + offset, b - 1);
-+
-+ /* Write the equivalence_class and \0. */
-+ for (i = 0 ; i < datasize ; i++)
-+ laststart[offset + i] = str[i];
-+
-+ /* Update the length of equivalence_classes. */
-+ laststart[3] += datasize;
-+ had_char_class = true;
-+ }
-+ else /* delim == '.' */
-+ { /* collating symbol */
-+ /* Calculate the offset of the equivalence_classes,
-+ which is next to collating_symbols. */
-+ offset = laststart[1] + laststart[2] + 6;
-+ /* Insert space and write the collationg_symbol
-+ and \0. */
-+ insert_space(datasize, laststart + offset, b-1);
-+ for (i = 0 ; i < datasize ; i++)
-+ laststart[offset + i] = str[i];
-+
-+ /* In re_match_2_internal if range_start < -1, we
-+ assume -range_start is the offset of the
-+ collating symbol which is specified as
-+ the character of the range start. So we assign
-+ -(laststart[1] + laststart[2] + 6) to
-+ range_start. */
-+ range_start = -(laststart[1] + laststart[2] + 6);
-+ /* Update the length of collating_symbol. */
-+ laststart[2] += datasize;
-+ had_char_class = false;
-+ }
-+ }
-+ else
-+ {
-+ c1++;
-+ while (c1--)
-+ PATUNFETCH;
-+ BUF_PUSH ('[');
-+ BUF_PUSH (delim);
-+ laststart[5] += 2; /* Update the length of characters */
-+ range_start = delim;
-+ had_char_class = false;
-+ }
-+ }
-+ else
-+ {
-+ had_char_class = false;
-+ BUF_PUSH(c);
-+ laststart[5]++; /* Update the length of characters */
-+ range_start = c;
-+ }
-+ }
-+
-+#else /* BYTE */
-+ /* Ensure that we have enough space to push a charset: the
-+ opcode, the length count, and the bitset; 34 bytes in all. */
-+ GET_BUFFER_SPACE (34);
-+
-+ laststart = b;
-+
-+ /* We test `*p == '^' twice, instead of using an if
-+ statement, so we only need one BUF_PUSH. */
-+ BUF_PUSH (*p == '^' ? charset_not : charset);
-+ if (*p == '^')
-+ p++;
-+
-+ /* Remember the first position in the bracket expression. */
-+ p1 = p;
-+
-+ /* Push the number of bytes in the bitmap. */
-+ BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
-+
-+ /* Clear the whole map. */
-+ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
-+
-+ /* charset_not matches newline according to a syntax bit. */
-+ if ((re_opcode_t) b[-2] == charset_not
-+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
-+ SET_LIST_BIT ('\n');
-+
-+ /* Read in characters and ranges, setting map bits. */
-+ for (;;)
-+ {
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ PATFETCH (c);
-+
-+ /* \ might escape characters inside [...] and [^...]. */
-+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
-+ {
-+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-+
-+ PATFETCH (c1);
-+ SET_LIST_BIT (c1);
-+ range_start = c1;
-+ continue;
-+ }
-+
-+ /* Could be the end of the bracket expression. If it's
-+ not (i.e., when the bracket expression is `[]' so
-+ far), the ']' character bit gets set way below. */
-+ if (c == ']' && p != p1 + 1)
-+ break;
-+
-+ /* Look ahead to see if it's a range when the last thing
-+ was a character class. */
-+ if (had_char_class && c == '-' && *p != ']')
-+ FREE_STACK_RETURN (REG_ERANGE);
-+
-+ /* Look ahead to see if it's a range when the last thing
-+ was a character: if this is a hyphen not at the
-+ beginning or the end of a list, then it's the range
-+ operator. */
-+ if (c == '-'
-+ && !(p - 2 >= pattern && p[-2] == '[')
-+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
-+ && *p != ']')
-+ {
-+ reg_errcode_t ret
-+ = byte_compile_range (range_start, &p, pend, translate,
-+ syntax, b);
-+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
-+ range_start = 0xffffffff;
-+ }
-+
-+ else if (p[0] == '-' && p[1] != ']')
-+ { /* This handles ranges made up of characters only. */
-+ reg_errcode_t ret;
-+
-+ /* Move past the `-'. */
-+ PATFETCH (c1);
-+
-+ ret = byte_compile_range (c, &p, pend, translate, syntax, b);
-+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
-+ range_start = 0xffffffff;
-+ }
-+
-+ /* See if we're at the beginning of a possible character
-+ class. */
-+
-+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
-+ { /* Leave room for the null. */
-+ char str[CHAR_CLASS_MAX_LENGTH + 1];
-+
-+ PATFETCH (c);
-+ c1 = 0;
-+
-+ /* If pattern is `[[:'. */
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (;;)
-+ {
-+ PATFETCH (c);
-+ if ((c == ':' && *p == ']') || p == pend)
-+ break;
-+ if (((int) c1) < CHAR_CLASS_MAX_LENGTH)
-+ str[c1++] = c;
-+ else
-+ /* This is in any case an invalid class name. */
-+ str[0] = '\0';
-+ }
-+ str[c1] = '\0';
-+
-+ /* If isn't a word bracketed by `[:' and `:]':
-+ undo the ending character, the letters, and leave
-+ the leading `:' and `[' (but set bits for them). */
-+ if (c == ':' && *p == ']')
-+ {
-+# if WIDE_CHAR_SUPPORT
-+ boolean is_lower = STREQ (str, "lower");
-+ boolean is_upper = STREQ (str, "upper");
-+ wctype_t wt;
-+ int ch;
-+
-+ wt = IS_CHAR_CLASS (str);
-+ if (wt == 0)
-+ FREE_STACK_RETURN (REG_ECTYPE);
-+
-+ /* Throw away the ] at the end of the character
-+ class. */
-+ PATFETCH (c);
-+
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
-+ {
-+# ifdef _LIBC
-+ if (__iswctype (__btowc (ch), wt))
-+ SET_LIST_BIT (ch);
-+# else
-+ if (iswctype (btowc (ch), wt))
-+ SET_LIST_BIT (ch);
-+# endif
-+
-+ if (translate && (is_upper || is_lower)
-+ && (ISUPPER (ch) || ISLOWER (ch)))
-+ SET_LIST_BIT (ch);
-+ }
-+
-+ had_char_class = true;
-+# else
-+ int ch;
-+ boolean is_alnum = STREQ (str, "alnum");
-+ boolean is_alpha = STREQ (str, "alpha");
-+ boolean is_blank = STREQ (str, "blank");
-+ boolean is_cntrl = STREQ (str, "cntrl");
-+ boolean is_digit = STREQ (str, "digit");
-+ boolean is_graph = STREQ (str, "graph");
-+ boolean is_lower = STREQ (str, "lower");
-+ boolean is_print = STREQ (str, "print");
-+ boolean is_punct = STREQ (str, "punct");
-+ boolean is_space = STREQ (str, "space");
-+ boolean is_upper = STREQ (str, "upper");
-+ boolean is_xdigit = STREQ (str, "xdigit");
-+
-+ if (!IS_CHAR_CLASS (str))
-+ FREE_STACK_RETURN (REG_ECTYPE);
-+
-+ /* Throw away the ] at the end of the character
-+ class. */
-+ PATFETCH (c);
-+
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
-+ {
-+ /* This was split into 3 if's to
-+ avoid an arbitrary limit in some compiler. */
-+ if ( (is_alnum && ISALNUM (ch))
-+ || (is_alpha && ISALPHA (ch))
-+ || (is_blank && ISBLANK (ch))
-+ || (is_cntrl && ISCNTRL (ch)))
-+ SET_LIST_BIT (ch);
-+ if ( (is_digit && ISDIGIT (ch))
-+ || (is_graph && ISGRAPH (ch))
-+ || (is_lower && ISLOWER (ch))
-+ || (is_print && ISPRINT (ch)))
-+ SET_LIST_BIT (ch);
-+ if ( (is_punct && ISPUNCT (ch))
-+ || (is_space && ISSPACE (ch))
-+ || (is_upper && ISUPPER (ch))
-+ || (is_xdigit && ISXDIGIT (ch)))
-+ SET_LIST_BIT (ch);
-+ if ( translate && (is_upper || is_lower)
-+ && (ISUPPER (ch) || ISLOWER (ch)))
-+ SET_LIST_BIT (ch);
-+ }
-+ had_char_class = true;
-+# endif /* libc || wctype.h */
-+ }
-+ else
-+ {
-+ c1++;
-+ while (c1--)
-+ PATUNFETCH;
-+ SET_LIST_BIT ('[');
-+ SET_LIST_BIT (':');
-+ range_start = ':';
-+ had_char_class = false;
-+ }
-+ }
-+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
-+ {
-+ unsigned char str[MB_LEN_MAX + 1];
-+# ifdef _LIBC
-+ uint32_t nrules =
-+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+# endif
-+
-+ PATFETCH (c);
-+ c1 = 0;
-+
-+ /* If pattern is `[[='. */
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (;;)
-+ {
-+ PATFETCH (c);
-+ if ((c == '=' && *p == ']') || p == pend)
-+ break;
-+ if (c1 < MB_LEN_MAX)
-+ str[c1++] = c;
-+ else
-+ /* This is in any case an invalid class name. */
-+ str[0] = '\0';
-+ }
-+ str[c1] = '\0';
-+
-+ if (c == '=' && *p == ']' && str[0] != '\0')
-+ {
-+ /* If we have no collation data we use the default
-+ collation in which each character is in a class
-+ by itself. It also means that ASCII is the
-+ character set and therefore we cannot have character
-+ with more than one byte in the multibyte
-+ representation. */
-+# ifdef _LIBC
-+ if (nrules == 0)
-+# endif
-+ {
-+ if (c1 != 1)
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+
-+ /* Throw away the ] at the end of the equivalence
-+ class. */
-+ PATFETCH (c);
-+
-+ /* Set the bit for the character. */
-+ SET_LIST_BIT (str[0]);
-+ }
-+# ifdef _LIBC
-+ else
-+ {
-+ /* Try to match the byte sequence in `str' against
-+ those known to the collate implementation.
-+ First find out whether the bytes in `str' are
-+ actually from exactly one character. */
-+ const int32_t *table;
-+ const unsigned char *weights;
-+ const unsigned char *extra;
-+ const int32_t *indirect;
-+ int32_t idx;
-+ const unsigned char *cp = str;
-+ int ch;
-+
-+ table = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
-+ weights = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
-+ extra = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
-+ indirect = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-+ idx = FINDIDX (table, indirect, extra, &cp, 1);
-+ if (idx == 0 || cp < str + c1)
-+ /* This is no valid character. */
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+
-+ /* Throw away the ] at the end of the equivalence
-+ class. */
-+ PATFETCH (c);
-+
-+ /* Now we have to go throught the whole table
-+ and find all characters which have the same
-+ first level weight.
-+
-+ XXX Note that this is not entirely correct.
-+ we would have to match multibyte sequences
-+ but this is not possible with the current
-+ implementation. */
-+ for (ch = 1; ch < 256; ++ch)
-+ /* XXX This test would have to be changed if we
-+ would allow matching multibyte sequences. */
-+ if (table[ch] > 0)
-+ {
-+ int32_t idx2 = table[ch];
-+ size_t len = weights[idx2];
-+
-+ /* Test whether the lenghts match. */
-+ if (weights[idx] == len)
-+ {
-+ /* They do. New compare the bytes of
-+ the weight. */
-+ size_t cnt = 0;
-+
-+ while (cnt < len
-+ && (weights[idx + 1 + cnt]
-+ == weights[idx2 + 1 + cnt]))
-+ ++cnt;
-+
-+ if (cnt == len)
-+ /* They match. Mark the character as
-+ acceptable. */
-+ SET_LIST_BIT (ch);
-+ }
-+ }
-+ }
-+# endif
-+ had_char_class = true;
-+ }
-+ else
-+ {
-+ c1++;
-+ while (c1--)
-+ PATUNFETCH;
-+ SET_LIST_BIT ('[');
-+ SET_LIST_BIT ('=');
-+ range_start = '=';
-+ had_char_class = false;
-+ }
-+ }
-+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
-+ {
-+ unsigned char str[128]; /* Should be large enough. */
-+# ifdef _LIBC
-+ uint32_t nrules =
-+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+# endif
-+
-+ PATFETCH (c);
-+ c1 = 0;
-+
-+ /* If pattern is `[[.'. */
-+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
-+
-+ for (;;)
-+ {
-+ PATFETCH (c);
-+ if ((c == '.' && *p == ']') || p == pend)
-+ break;
-+ if (c1 < sizeof (str))
-+ str[c1++] = c;
-+ else
-+ /* This is in any case an invalid class name. */
-+ str[0] = '\0';
-+ }
-+ str[c1] = '\0';
-+
-+ if (c == '.' && *p == ']' && str[0] != '\0')
-+ {
-+ /* If we have no collation data we use the default
-+ collation in which each character is the name
-+ for its own class which contains only the one
-+ character. It also means that ASCII is the
-+ character set and therefore we cannot have character
-+ with more than one byte in the multibyte
-+ representation. */
-+# ifdef _LIBC
-+ if (nrules == 0)
-+# endif
-+ {
-+ if (c1 != 1)
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+
-+ /* Throw away the ] at the end of the equivalence
-+ class. */
-+ PATFETCH (c);
-+
-+ /* Set the bit for the character. */
-+ SET_LIST_BIT (str[0]);
-+ range_start = ((const unsigned char *) str)[0];
-+ }
-+# ifdef _LIBC
-+ else
-+ {
-+ /* Try to match the byte sequence in `str' against
-+ those known to the collate implementation.
-+ First find out whether the bytes in `str' are
-+ actually from exactly one character. */
-+ int32_t table_size;
-+ const int32_t *symb_table;
-+ const unsigned char *extra;
-+ int32_t idx;
-+ int32_t elem;
-+ int32_t second;
-+ int32_t hash;
-+
-+ table_size =
-+ _NL_CURRENT_WORD (LC_COLLATE,
-+ _NL_COLLATE_SYMB_HASH_SIZEMB);
-+ symb_table = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_SYMB_TABLEMB);
-+ extra = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_SYMB_EXTRAMB);
-+
-+ /* Locate the character in the hashing table. */
-+ hash = elem_hash ((const char *) str, c1);
-+
-+ idx = 0;
-+ elem = hash % table_size;
-+ second = hash % (table_size - 2);
-+ while (symb_table[2 * elem] != 0)
-+ {
-+ /* First compare the hashing value. */
-+ if (symb_table[2 * elem] == hash
-+ && c1 == extra[symb_table[2 * elem + 1]]
-+ && memcmp (str,
-+ &extra[symb_table[2 * elem + 1]
-+ + 1],
-+ c1) == 0)
-+ {
-+ /* Yep, this is the entry. */
-+ idx = symb_table[2 * elem + 1];
-+ idx += 1 + extra[idx];
-+ break;
-+ }
-+
-+ /* Next entry. */
-+ elem += second;
-+ }
-+
-+ if (symb_table[2 * elem] == 0)
-+ /* This is no valid character. */
-+ FREE_STACK_RETURN (REG_ECOLLATE);
-+
-+ /* Throw away the ] at the end of the equivalence
-+ class. */
-+ PATFETCH (c);
-+
-+ /* Now add the multibyte character(s) we found
-+ to the accept list.
-+
-+ XXX Note that this is not entirely correct.
-+ we would have to match multibyte sequences
-+ but this is not possible with the current
-+ implementation. Also, we have to match
-+ collating symbols, which expand to more than
-+ one file, as a whole and not allow the
-+ individual bytes. */
-+ c1 = extra[idx++];
-+ if (c1 == 1)
-+ range_start = extra[idx];
-+ while (c1-- > 0)
-+ {
-+ SET_LIST_BIT (extra[idx]);
-+ ++idx;
-+ }
-+ }
-+# endif
-+ had_char_class = false;
-+ }
-+ else
-+ {
-+ c1++;
-+ while (c1--)
-+ PATUNFETCH;
-+ SET_LIST_BIT ('[');
-+ SET_LIST_BIT ('.');
-+ range_start = '.';
-+ had_char_class = false;
-+ }
-+ }
-+ else
-+ {
-+ had_char_class = false;
-+ SET_LIST_BIT (c);
-+ range_start = c;
-+ }
-+ }
-+
-+ /* Discard any (non)matching list bytes that are all 0 at the
-+ end of the map. Decrease the map-length byte too. */
-+ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
-+ b[-1]--;
-+ b += b[-1];
-+#endif /* WCHAR */
-+ }
-+ break;
-+
-+
-+ case '(':
-+ if (syntax & RE_NO_BK_PARENS)
-+ goto handle_open;
-+ else
-+ goto normal_char;
-+
-+
-+ case ')':
-+ if (syntax & RE_NO_BK_PARENS)
-+ goto handle_close;
-+ else
-+ goto normal_char;
-+
-+
-+ case '\n':
-+ if (syntax & RE_NEWLINE_ALT)
-+ goto handle_alt;
-+ else
-+ goto normal_char;
-+
-+
-+ case '|':
-+ if (syntax & RE_NO_BK_VBAR)
-+ goto handle_alt;
-+ else
-+ goto normal_char;
-+
-+
-+ case '{':
-+ if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
-+ goto handle_interval;
-+ else
-+ goto normal_char;
-+
-+
-+ case '\\':
-+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
-+
-+ /* Do not translate the character after the \, so that we can
-+ distinguish, e.g., \B from \b, even if we normally would
-+ translate, e.g., B to b. */
-+ PATFETCH_RAW (c);
-+
-+ switch (c)
-+ {
-+ case '(':
-+ if (syntax & RE_NO_BK_PARENS)
-+ goto normal_backslash;
-+
-+ handle_open:
-+ bufp->re_nsub++;
-+ regnum++;
-+
-+ if (COMPILE_STACK_FULL)
-+ {
-+ RETALLOC (compile_stack.stack, compile_stack.size << 1,
-+ compile_stack_elt_t);
-+ if (compile_stack.stack == NULL) return REG_ESPACE;
-+
-+ compile_stack.size <<= 1;
-+ }
-+
-+ /* These are the values to restore when we hit end of this
-+ group. They are all relative offsets, so that if the
-+ whole pattern moves because of realloc, they will still
-+ be valid. */
-+ COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR;
-+ COMPILE_STACK_TOP.fixup_alt_jump
-+ = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0;
-+ COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR;
-+ COMPILE_STACK_TOP.regnum = regnum;
-+
-+ /* We will eventually replace the 0 with the number of
-+ groups inner to this one. But do not push a
-+ start_memory for groups beyond the last one we can
-+ represent in the compiled pattern. */
-+ if (regnum <= MAX_REGNUM)
-+ {
-+ COMPILE_STACK_TOP.inner_group_offset = b
-+ - COMPILED_BUFFER_VAR + 2;
-+ BUF_PUSH_3 (start_memory, regnum, 0);
-+ }
-+
-+ compile_stack.avail++;
-+
-+ fixup_alt_jump = 0;
-+ laststart = 0;
-+ begalt = b;
-+ /* If we've reached MAX_REGNUM groups, then this open
-+ won't actually generate any code, so we'll have to
-+ clear pending_exact explicitly. */
-+ pending_exact = 0;
-+ break;
-+
-+
-+ case ')':
-+ if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
-+
-+ if (COMPILE_STACK_EMPTY)
-+ {
-+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
-+ goto normal_backslash;
-+ else
-+ FREE_STACK_RETURN (REG_ERPAREN);
-+ }
-+
-+ handle_close:
-+ if (fixup_alt_jump)
-+ { /* Push a dummy failure point at the end of the
-+ alternative for a possible future
-+ `pop_failure_jump' to pop. See comments at
-+ `push_dummy_failure' in `re_match_2'. */
-+ BUF_PUSH (push_dummy_failure);
-+
-+ /* We allocated space for this jump when we assigned
-+ to `fixup_alt_jump', in the `handle_alt' case below. */
-+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
-+ }
-+
-+ /* See similar code for backslashed left paren above. */
-+ if (COMPILE_STACK_EMPTY)
-+ {
-+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
-+ goto normal_char;
-+ else
-+ FREE_STACK_RETURN (REG_ERPAREN);
-+ }
-+
-+ /* Since we just checked for an empty stack above, this
-+ ``can't happen''. */
-+ assert (compile_stack.avail != 0);
-+ {
-+ /* We don't just want to restore into `regnum', because
-+ later groups should continue to be numbered higher,
-+ as in `(ab)c(de)' -- the second group is #2. */
-+ regnum_t this_group_regnum;
-+
-+ compile_stack.avail--;
-+ begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset;
-+ fixup_alt_jump
-+ = COMPILE_STACK_TOP.fixup_alt_jump
-+ ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1
-+ : 0;
-+ laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset;
-+ this_group_regnum = COMPILE_STACK_TOP.regnum;
-+ /* If we've reached MAX_REGNUM groups, then this open
-+ won't actually generate any code, so we'll have to
-+ clear pending_exact explicitly. */
-+ pending_exact = 0;
-+
-+ /* We're at the end of the group, so now we know how many
-+ groups were inside this one. */
-+ if (this_group_regnum <= MAX_REGNUM)
-+ {
-+ UCHAR_T *inner_group_loc
-+ = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset;
-+
-+ *inner_group_loc = regnum - this_group_regnum;
-+ BUF_PUSH_3 (stop_memory, this_group_regnum,
-+ regnum - this_group_regnum);
-+ }
-+ }
-+ break;
-+
-+
-+ case '|': /* `\|'. */
-+ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
-+ goto normal_backslash;
-+ handle_alt:
-+ if (syntax & RE_LIMITED_OPS)
-+ goto normal_char;
-+
-+ /* Insert before the previous alternative a jump which
-+ jumps to this alternative if the former fails. */
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+ INSERT_JUMP (on_failure_jump, begalt,
-+ b + 2 + 2 * OFFSET_ADDRESS_SIZE);
-+ pending_exact = 0;
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+
-+ /* The alternative before this one has a jump after it
-+ which gets executed if it gets matched. Adjust that
-+ jump so it will jump to this alternative's analogous
-+ jump (put in below, which in turn will jump to the next
-+ (if any) alternative's such jump, etc.). The last such
-+ jump jumps to the correct final destination. A picture:
-+ _____ _____
-+ | | | |
-+ | v | v
-+ a | b | c
-+
-+ If we are at `b', then fixup_alt_jump right now points to a
-+ three-byte space after `a'. We'll put in the jump, set
-+ fixup_alt_jump to right after `b', and leave behind three
-+ bytes which we'll fill in when we get to after `c'. */
-+
-+ if (fixup_alt_jump)
-+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-+
-+ /* Mark and leave space for a jump after this alternative,
-+ to be filled in later either by next alternative or
-+ when know we're at the end of a series of alternatives. */
-+ fixup_alt_jump = b;
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+
-+ laststart = 0;
-+ begalt = b;
-+ break;
-+
-+
-+ case '{':
-+ /* If \{ is a literal. */
-+ if (!(syntax & RE_INTERVALS)
-+ /* If we're at `\{' and it's not the open-interval
-+ operator. */
-+ || (syntax & RE_NO_BK_BRACES))
-+ goto normal_backslash;
-+
-+ handle_interval:
-+ {
-+ /* If got here, then the syntax allows intervals. */
-+
-+ /* At least (most) this many matches must be made. */
-+ int lower_bound = -1, upper_bound = -1;
-+
-+ /* Place in the uncompiled pattern (i.e., just after
-+ the '{') to go back to if the interval is invalid. */
-+ const CHAR_T *beg_interval = p;
-+
-+ if (p == pend)
-+ goto invalid_interval;
-+
-+ GET_UNSIGNED_NUMBER (lower_bound);
-+
-+ if (c == ',')
-+ {
-+ GET_UNSIGNED_NUMBER (upper_bound);
-+ if (upper_bound < 0)
-+ upper_bound = RE_DUP_MAX;
-+ }
-+ else
-+ /* Interval such as `{1}' => match exactly once. */
-+ upper_bound = lower_bound;
-+
-+ if (! (0 <= lower_bound && lower_bound <= upper_bound))
-+ goto invalid_interval;
-+
-+ if (!(syntax & RE_NO_BK_BRACES))
-+ {
-+ if (c != '\\' || p == pend)
-+ goto invalid_interval;
-+ PATFETCH (c);
-+ }
-+
-+ if (c != '}')
-+ goto invalid_interval;
-+
-+ /* If it's invalid to have no preceding re. */
-+ if (!laststart)
-+ {
-+ if (syntax & RE_CONTEXT_INVALID_OPS
-+ && !(syntax & RE_INVALID_INTERVAL_ORD))
-+ FREE_STACK_RETURN (REG_BADRPT);
-+ else if (syntax & RE_CONTEXT_INDEP_OPS)
-+ laststart = b;
-+ else
-+ goto unfetch_interval;
-+ }
-+
-+ /* We just parsed a valid interval. */
-+
-+ if (RE_DUP_MAX < upper_bound)
-+ FREE_STACK_RETURN (REG_BADBR);
-+
-+ /* If the upper bound is zero, don't want to succeed at
-+ all; jump from `laststart' to `b + 3', which will be
-+ the end of the buffer after we insert the jump. */
-+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE'
-+ instead of 'b + 3'. */
-+ if (upper_bound == 0)
-+ {
-+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
-+ INSERT_JUMP (jump, laststart, b + 1
-+ + OFFSET_ADDRESS_SIZE);
-+ b += 1 + OFFSET_ADDRESS_SIZE;
-+ }
-+
-+ /* Otherwise, we have a nontrivial interval. When
-+ we're all done, the pattern will look like:
-+ set_number_at <jump count> <upper bound>
-+ set_number_at <succeed_n count> <lower bound>
-+ succeed_n <after jump addr> <succeed_n count>
-+ <body of loop>
-+ jump_n <succeed_n addr> <jump count>
-+ (The upper bound and `jump_n' are omitted if
-+ `upper_bound' is 1, though.) */
-+ else
-+ { /* If the upper bound is > 1, we need to insert
-+ more at the end of the loop. */
-+ unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE +
-+ (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE);
-+
-+ GET_BUFFER_SPACE (nbytes);
-+
-+ /* Initialize lower bound of the `succeed_n', even
-+ though it will be set during matching by its
-+ attendant `set_number_at' (inserted next),
-+ because `re_compile_fastmap' needs to know.
-+ Jump to the `jump_n' we might insert below. */
-+ INSERT_JUMP2 (succeed_n, laststart,
-+ b + 1 + 2 * OFFSET_ADDRESS_SIZE
-+ + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE)
-+ , lower_bound);
-+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-+
-+ /* Code to initialize the lower bound. Insert
-+ before the `succeed_n'. The `5' is the last two
-+ bytes of this `set_number_at', plus 3 bytes of
-+ the following `succeed_n'. */
-+ /* ifdef WCHAR, The '1+2*OFFSET_ADDRESS_SIZE'
-+ is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE'
-+ of the following `succeed_n'. */
-+ PREFIX(insert_op2) (set_number_at, laststart, 1
-+ + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b);
-+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-+
-+ if (upper_bound > 1)
-+ { /* More than one repetition is allowed, so
-+ append a backward jump to the `succeed_n'
-+ that starts this interval.
-+
-+ When we've reached this during matching,
-+ we'll have matched the interval once, so
-+ jump back only `upper_bound - 1' times. */
-+ STORE_JUMP2 (jump_n, b, laststart
-+ + 2 * OFFSET_ADDRESS_SIZE + 1,
-+ upper_bound - 1);
-+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-+
-+ /* The location we want to set is the second
-+ parameter of the `jump_n'; that is `b-2' as
-+ an absolute address. `laststart' will be
-+ the `set_number_at' we're about to insert;
-+ `laststart+3' the number to set, the source
-+ for the relative address. But we are
-+ inserting into the middle of the pattern --
-+ so everything is getting moved up by 5.
-+ Conclusion: (b - 2) - (laststart + 3) + 5,
-+ i.e., b - laststart.
-+
-+ We insert this at the beginning of the loop
-+ so that if we fail during matching, we'll
-+ reinitialize the bounds. */
-+ PREFIX(insert_op2) (set_number_at, laststart,
-+ b - laststart,
-+ upper_bound - 1, b);
-+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
-+ }
-+ }
-+ pending_exact = 0;
-+ break;
-+
-+ invalid_interval:
-+ if (!(syntax & RE_INVALID_INTERVAL_ORD))
-+ FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
-+ unfetch_interval:
-+ /* Match the characters as literals. */
-+ p = beg_interval;
-+ c = '{';
-+ if (syntax & RE_NO_BK_BRACES)
-+ goto normal_char;
-+ else
-+ goto normal_backslash;
-+ }
-+
-+#ifdef emacs
-+ /* There is no way to specify the before_dot and after_dot
-+ operators. rms says this is ok. --karl */
-+ case '=':
-+ BUF_PUSH (at_dot);
-+ break;
-+
-+ case 's':
-+ laststart = b;
-+ PATFETCH (c);
-+ BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
-+ break;
-+
-+ case 'S':
-+ laststart = b;
-+ PATFETCH (c);
-+ BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
-+ break;
-+#endif /* emacs */
-+
-+
-+ case 'w':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ laststart = b;
-+ BUF_PUSH (wordchar);
-+ break;
-+
-+
-+ case 'W':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ laststart = b;
-+ BUF_PUSH (notwordchar);
-+ break;
-+
-+
-+ case '<':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (wordbeg);
-+ break;
-+
-+ case '>':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (wordend);
-+ break;
-+
-+ case 'b':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (wordbound);
-+ break;
-+
-+ case 'B':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (notwordbound);
-+ break;
-+
-+ case '`':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (begbuf);
-+ break;
-+
-+ case '\'':
-+ if (syntax & RE_NO_GNU_OPS)
-+ goto normal_char;
-+ BUF_PUSH (endbuf);
-+ break;
-+
-+ case '1': case '2': case '3': case '4': case '5':
-+ case '6': case '7': case '8': case '9':
-+ if (syntax & RE_NO_BK_REFS)
-+ goto normal_char;
-+
-+ c1 = c - '0';
-+
-+ if (c1 > regnum)
-+ FREE_STACK_RETURN (REG_ESUBREG);
-+
-+ /* Can't back reference to a subexpression if inside of it. */
-+ if (group_in_compile_stack (compile_stack, (regnum_t) c1))
-+ goto normal_char;
-+
-+ laststart = b;
-+ BUF_PUSH_2 (duplicate, c1);
-+ break;
-+
-+
-+ case '+':
-+ case '?':
-+ if (syntax & RE_BK_PLUS_QM)
-+ goto handle_plus;
-+ else
-+ goto normal_backslash;
-+
-+ default:
-+ normal_backslash:
-+ /* You might think it would be useful for \ to mean
-+ not to translate; but if we don't translate it
-+ it will never match anything. */
-+ c = TRANSLATE (c);
-+ goto normal_char;
-+ }
-+ break;
-+
-+
-+ default:
-+ /* Expects the character in `c'. */
-+ normal_char:
-+ /* If no exactn currently being built. */
-+ if (!pending_exact
-+#ifdef WCHAR
-+ /* If last exactn handle binary(or character) and
-+ new exactn handle character(or binary). */
-+ || is_exactn_bin != is_binary[p - 1 - pattern]
-+#endif /* WCHAR */
-+
-+ /* If last exactn not at current position. */
-+ || pending_exact + *pending_exact + 1 != b
-+
-+ /* We have only one byte following the exactn for the count. */
-+ || *pending_exact == (1 << BYTEWIDTH) - 1
-+
-+ /* If followed by a repetition operator. */
-+ || *p == '*' || *p == '^'
-+ || ((syntax & RE_BK_PLUS_QM)
-+ ? *p == '\\' && (p[1] == '+' || p[1] == '?')
-+ : (*p == '+' || *p == '?'))
-+ || ((syntax & RE_INTERVALS)
-+ && ((syntax & RE_NO_BK_BRACES)
-+ ? *p == '{'
-+ : (p[0] == '\\' && p[1] == '{'))))
-+ {
-+ /* Start building a new exactn. */
-+
-+ laststart = b;
-+
-+#ifdef WCHAR
-+ /* Is this exactn binary data or character? */
-+ is_exactn_bin = is_binary[p - 1 - pattern];
-+ if (is_exactn_bin)
-+ BUF_PUSH_2 (exactn_bin, 0);
-+ else
-+ BUF_PUSH_2 (exactn, 0);
-+#else
-+ BUF_PUSH_2 (exactn, 0);
-+#endif /* WCHAR */
-+ pending_exact = b - 1;
-+ }
-+
-+ BUF_PUSH (c);
-+ (*pending_exact)++;
-+ break;
-+ } /* switch (c) */
-+ } /* while p != pend */
-+
-+
-+ /* Through the pattern now. */
-+
-+ if (fixup_alt_jump)
-+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
-+
-+ if (!COMPILE_STACK_EMPTY)
-+ FREE_STACK_RETURN (REG_EPAREN);
-+
-+ /* If we don't want backtracking, force success
-+ the first time we reach the end of the compiled pattern. */
-+ if (syntax & RE_NO_POSIX_BACKTRACKING)
-+ BUF_PUSH (succeed);
-+
-+#ifdef WCHAR
-+ free (pattern);
-+ free (mbs_offset);
-+ free (is_binary);
-+#endif
-+ free (compile_stack.stack);
-+
-+ /* We have succeeded; set the length of the buffer. */
-+#ifdef WCHAR
-+ bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR;
-+#else
-+ bufp->used = b - bufp->buffer;
-+#endif
-+
-+#ifdef DEBUG
-+ if (debug)
-+ {
-+ DEBUG_PRINT1 ("\nCompiled pattern: \n");
-+ PREFIX(print_compiled_pattern) (bufp);
-+ }
-+#endif /* DEBUG */
-+
-+#ifndef MATCH_MAY_ALLOCATE
-+ /* Initialize the failure stack to the largest possible stack. This
-+ isn't necessary unless we're trying to avoid calling alloca in
-+ the search and match routines. */
-+ {
-+ int num_regs = bufp->re_nsub + 1;
-+
-+ /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
-+ is strictly greater than re_max_failures, the largest possible stack
-+ is 2 * re_max_failures failure points. */
-+ if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS))
-+ {
-+ fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
-+
-+# ifdef emacs
-+ if (! fail_stack.stack)
-+ fail_stack.stack
-+ = (PREFIX(fail_stack_elt_t) *) xmalloc (fail_stack.size
-+ * sizeof (PREFIX(fail_stack_elt_t)));
-+ else
-+ fail_stack.stack
-+ = (PREFIX(fail_stack_elt_t) *) xrealloc (fail_stack.stack,
-+ (fail_stack.size
-+ * sizeof (PREFIX(fail_stack_elt_t))));
-+# else /* not emacs */
-+ if (! fail_stack.stack)
-+ fail_stack.stack
-+ = (PREFIX(fail_stack_elt_t) *) malloc (fail_stack.size
-+ * sizeof (PREFIX(fail_stack_elt_t)));
-+ else
-+ fail_stack.stack
-+ = (PREFIX(fail_stack_elt_t) *) realloc (fail_stack.stack,
-+ (fail_stack.size
-+ * sizeof (PREFIX(fail_stack_elt_t))));
-+# endif /* not emacs */
-+ }
-+
-+ PREFIX(regex_grow_registers) (num_regs);
-+ }
-+#endif /* not MATCH_MAY_ALLOCATE */
-+
-+ return REG_NOERROR;
-+} /* regex_compile */
-+
-+/* Subroutines for `regex_compile'. */
-+
-+/* Store OP at LOC followed by two-byte integer parameter ARG. */
-+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-+
-+static void
-+PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg)
-+{
-+ *loc = (UCHAR_T) op;
-+ STORE_NUMBER (loc + 1, arg);
-+}
-+
-+
-+/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
-+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-+
-+static void
-+PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, int arg1, int arg2)
-+{
-+ *loc = (UCHAR_T) op;
-+ STORE_NUMBER (loc + 1, arg1);
-+ STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2);
-+}
-+
-+
-+/* Copy the bytes from LOC to END to open up three bytes of space at LOC
-+ for OP followed by two-byte integer parameter ARG. */
-+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-+
-+static void
-+PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, int arg, UCHAR_T *end)
-+{
-+ register UCHAR_T *pfrom = end;
-+ register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
-+
-+ while (pfrom != loc)
-+ *--pto = *--pfrom;
-+
-+ PREFIX(store_op1) (op, loc, arg);
-+}
-+
-+
-+/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
-+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
-+
-+static void
-+PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, int arg1,
-+ int arg2, UCHAR_T *end)
-+{
-+ register UCHAR_T *pfrom = end;
-+ register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
-+
-+ while (pfrom != loc)
-+ *--pto = *--pfrom;
-+
-+ PREFIX(store_op2) (op, loc, arg1, arg2);
-+}
-+
-+
-+/* P points to just after a ^ in PATTERN. Return true if that ^ comes
-+ after an alternative or a begin-subexpression. We assume there is at
-+ least one character before the ^. */
-+
-+static boolean
-+PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
-+ reg_syntax_t syntax)
-+{
-+ const CHAR_T *prev = p - 2;
-+ boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
-+
-+ return
-+ /* After a subexpression? */
-+ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
-+ /* After an alternative? */
-+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
-+}
-+
-+
-+/* The dual of at_begline_loc_p. This one is for $. We assume there is
-+ at least one character after the $, i.e., `P < PEND'. */
-+
-+static boolean
-+PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend,
-+ reg_syntax_t syntax)
-+{
-+ const CHAR_T *next = p;
-+ boolean next_backslash = *next == '\\';
-+ const CHAR_T *next_next = p + 1 < pend ? p + 1 : 0;
-+
-+ return
-+ /* Before a subexpression? */
-+ (syntax & RE_NO_BK_PARENS ? *next == ')'
-+ : next_backslash && next_next && *next_next == ')')
-+ /* Before an alternative? */
-+ || (syntax & RE_NO_BK_VBAR ? *next == '|'
-+ : next_backslash && next_next && *next_next == '|');
-+}
-+
-+#else /* not INSIDE_RECURSION */
-+
-+/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
-+ false if it's not. */
-+
-+static boolean
-+group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
-+{
-+ int this_element;
-+
-+ for (this_element = compile_stack.avail - 1;
-+ this_element >= 0;
-+ this_element--)
-+ if (compile_stack.stack[this_element].regnum == regnum)
-+ return true;
-+
-+ return false;
-+}
-+#endif /* not INSIDE_RECURSION */
-+
-+#ifdef INSIDE_RECURSION
-+
-+#ifdef WCHAR
-+/* This insert space, which size is "num", into the pattern at "loc".
-+ "end" must point the end of the allocated buffer. */
-+static void
-+insert_space (int num, CHAR_T *loc, CHAR_T *end)
-+{
-+ register CHAR_T *pto = end;
-+ register CHAR_T *pfrom = end - num;
-+
-+ while (pfrom >= loc)
-+ *pto-- = *pfrom--;
-+}
-+#endif /* WCHAR */
-+
-+#ifdef WCHAR
-+static reg_errcode_t
-+wcs_compile_range (CHAR_T range_start_char, const CHAR_T **p_ptr,
-+ const CHAR_T *pend, RE_TRANSLATE_TYPE translate,
-+ reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
-+{
-+ const CHAR_T *p = *p_ptr;
-+ CHAR_T range_start, range_end;
-+ reg_errcode_t ret;
-+# ifdef _LIBC
-+ uint32_t nrules;
-+ uint32_t start_val, end_val;
-+# endif
-+ if (p == pend)
-+ return REG_ERANGE;
-+
-+# ifdef _LIBC
-+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+ if (nrules != 0)
-+ {
-+ const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
-+ _NL_COLLATE_COLLSEQWC);
-+ const unsigned char *extra = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-+
-+ if (range_start_char < -1)
-+ {
-+ /* range_start is a collating symbol. */
-+ int32_t *wextra;
-+ /* Retreive the index and get collation sequence value. */
-+ wextra = (int32_t*)(extra + char_set[-range_start_char]);
-+ start_val = wextra[1 + *wextra];
-+ }
-+ else
-+ start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
-+
-+ end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
-+
-+ /* Report an error if the range is empty and the syntax prohibits
-+ this. */
-+ ret = ((syntax & RE_NO_EMPTY_RANGES)
-+ && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
-+
-+ /* Insert space to the end of the char_ranges. */
-+ insert_space(2, b - char_set[5] - 2, b - 1);
-+ *(b - char_set[5] - 2) = (wchar_t)start_val;
-+ *(b - char_set[5] - 1) = (wchar_t)end_val;
-+ char_set[4]++; /* ranges_index */
-+ }
-+ else
-+# endif
-+ {
-+ range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
-+ range_start_char;
-+ range_end = TRANSLATE (p[0]);
-+ /* Report an error if the range is empty and the syntax prohibits
-+ this. */
-+ ret = ((syntax & RE_NO_EMPTY_RANGES)
-+ && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
-+
-+ /* Insert space to the end of the char_ranges. */
-+ insert_space(2, b - char_set[5] - 2, b - 1);
-+ *(b - char_set[5] - 2) = range_start;
-+ *(b - char_set[5] - 1) = range_end;
-+ char_set[4]++; /* ranges_index */
-+ }
-+ /* Have to increment the pointer into the pattern string, so the
-+ caller isn't still at the ending character. */
-+ (*p_ptr)++;
-+
-+ return ret;
-+}
-+#else /* BYTE */
-+/* Read the ending character of a range (in a bracket expression) from the
-+ uncompiled pattern *P_PTR (which ends at PEND). We assume the
-+ starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
-+ Then we set the translation of all bits between the starting and
-+ ending characters (inclusive) in the compiled pattern B.
-+
-+ Return an error code.
-+
-+ We use these short variable names so we can use the same macros as
-+ `regex_compile' itself. */
-+
-+static reg_errcode_t
-+byte_compile_range (unsigned int range_start_char, const char **p_ptr,
-+ const char *pend, RE_TRANSLATE_TYPE translate,
-+ reg_syntax_t syntax, unsigned char *b)
-+{
-+ unsigned this_char;
-+ const char *p = *p_ptr;
-+ reg_errcode_t ret;
-+# if _LIBC
-+ const unsigned char *collseq;
-+ unsigned int start_colseq;
-+ unsigned int end_colseq;
-+# else
-+ unsigned end_char;
-+# endif
-+
-+ if (p == pend)
-+ return REG_ERANGE;
-+
-+ /* Have to increment the pointer into the pattern string, so the
-+ caller isn't still at the ending character. */
-+ (*p_ptr)++;
-+
-+ /* Report an error if the range is empty and the syntax prohibits this. */
-+ ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-+
-+# if _LIBC
-+ collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
-+ _NL_COLLATE_COLLSEQMB);
-+
-+ start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
-+ end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
-+ for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
-+ {
-+ unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
-+
-+ if (start_colseq <= this_colseq && this_colseq <= end_colseq)
-+ {
-+ SET_LIST_BIT (TRANSLATE (this_char));
-+ ret = REG_NOERROR;
-+ }
-+ }
-+# else
-+ /* Here we see why `this_char' has to be larger than an `unsigned
-+ char' -- we would otherwise go into an infinite loop, since all
-+ characters <= 0xff. */
-+ range_start_char = TRANSLATE (range_start_char);
-+ /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
-+ and some compilers cast it to int implicitly, so following for_loop
-+ may fall to (almost) infinite loop.
-+ e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
-+ To avoid this, we cast p[0] to unsigned int and truncate it. */
-+ end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
-+
-+ for (this_char = range_start_char; this_char <= end_char; ++this_char)
-+ {
-+ SET_LIST_BIT (TRANSLATE (this_char));
-+ ret = REG_NOERROR;
-+ }
-+# endif
-+
-+ return ret;
-+}
-+#endif /* WCHAR */
-+
-+/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
-+ BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
-+ characters can start a string that matches the pattern. This fastmap
-+ is used by re_search to skip quickly over impossible starting points.
-+
-+ The caller must supply the address of a (1 << BYTEWIDTH)-byte data
-+ area as BUFP->fastmap.
-+
-+ We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
-+ the pattern buffer.
-+
-+ Returns 0 if we succeed, -2 if an internal error. */
-+
-+#ifdef WCHAR
-+/* local function for re_compile_fastmap.
-+ truncate wchar_t character to char. */
-+static unsigned char truncate_wchar (CHAR_T c);
-+
-+static unsigned char
-+truncate_wchar (CHAR_T c)
-+{
-+ unsigned char buf[MB_CUR_MAX];
-+ mbstate_t state;
-+ int retval;
-+ memset (&state, '\0', sizeof (state));
-+# ifdef _LIBC
-+ retval = __wcrtomb (buf, c, &state);
-+# else
-+ retval = wcrtomb (buf, c, &state);
-+# endif
-+ return retval > 0 ? buf[0] : (unsigned char) c;
-+}
-+#endif /* WCHAR */
-+
-+static int
-+PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp)
-+{
-+ int j, k;
-+#ifdef MATCH_MAY_ALLOCATE
-+ PREFIX(fail_stack_type) fail_stack;
-+#endif
-+#ifndef REGEX_MALLOC
-+ char *destination;
-+#endif
-+
-+ register char *fastmap = bufp->fastmap;
-+
-+#ifdef WCHAR
-+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
-+ pattern to (char*) in regex_compile. */
-+ UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
-+ register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
-+#else /* BYTE */
-+ UCHAR_T *pattern = bufp->buffer;
-+ register UCHAR_T *pend = pattern + bufp->used;
-+#endif /* WCHAR */
-+ UCHAR_T *p = pattern;
-+
-+#ifdef REL_ALLOC
-+ /* This holds the pointer to the failure stack, when
-+ it is allocated relocatably. */
-+ fail_stack_elt_t *failure_stack_ptr;
-+#endif
-+
-+ /* Assume that each path through the pattern can be null until
-+ proven otherwise. We set this false at the bottom of switch
-+ statement, to which we get only if a particular path doesn't
-+ match the empty string. */
-+ boolean path_can_be_null = true;
-+
-+ /* We aren't doing a `succeed_n' to begin with. */
-+ boolean succeed_n_p = false;
-+
-+ assert (fastmap != NULL && p != NULL);
-+
-+ INIT_FAIL_STACK ();
-+ bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
-+ bufp->fastmap_accurate = 1; /* It will be when we're done. */
-+ bufp->can_be_null = 0;
-+
-+ while (1)
-+ {
-+ if (p == pend || *p == (UCHAR_T) succeed)
-+ {
-+ /* We have reached the (effective) end of pattern. */
-+ if (!FAIL_STACK_EMPTY ())
-+ {
-+ bufp->can_be_null |= path_can_be_null;
-+
-+ /* Reset for next path. */
-+ path_can_be_null = true;
-+
-+ p = fail_stack.stack[--fail_stack.avail].pointer;
-+
-+ continue;
-+ }
-+ else
-+ break;
-+ }
-+
-+ /* We should never be about to go beyond the end of the pattern. */
-+ assert (p < pend);
-+
-+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
-+ {
-+
-+ /* I guess the idea here is to simply not bother with a fastmap
-+ if a backreference is used, since it's too hard to figure out
-+ the fastmap for the corresponding group. Setting
-+ `can_be_null' stops `re_search_2' from using the fastmap, so
-+ that is all we do. */
-+ case duplicate:
-+ bufp->can_be_null = 1;
-+ goto done;
-+
-+
-+ /* Following are the cases which match a character. These end
-+ with `break'. */
-+
-+#ifdef WCHAR
-+ case exactn:
-+ fastmap[truncate_wchar(p[1])] = 1;
-+ break;
-+#else /* BYTE */
-+ case exactn:
-+ fastmap[p[1]] = 1;
-+ break;
-+#endif /* WCHAR */
-+#ifdef MBS_SUPPORT
-+ case exactn_bin:
-+ fastmap[p[1]] = 1;
-+ break;
-+#endif
-+
-+#ifdef WCHAR
-+ /* It is hard to distinguish fastmap from (multi byte) characters
-+ which depends on current locale. */
-+ case charset:
-+ case charset_not:
-+ case wordchar:
-+ case notwordchar:
-+ bufp->can_be_null = 1;
-+ goto done;
-+#else /* BYTE */
-+ case charset:
-+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
-+ if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
-+ fastmap[j] = 1;
-+ break;
-+
-+
-+ case charset_not:
-+ /* Chars beyond end of map must be allowed. */
-+ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
-+ fastmap[j] = 1;
-+
-+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
-+ if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
-+ fastmap[j] = 1;
-+ break;
-+
-+
-+ case wordchar:
-+ for (j = 0; j < (1 << BYTEWIDTH); j++)
-+ if (SYNTAX (j) == Sword)
-+ fastmap[j] = 1;
-+ break;
-+
-+
-+ case notwordchar:
-+ for (j = 0; j < (1 << BYTEWIDTH); j++)
-+ if (SYNTAX (j) != Sword)
-+ fastmap[j] = 1;
-+ break;
-+#endif /* WCHAR */
-+
-+ case anychar:
-+ {
-+ int fastmap_newline = fastmap['\n'];
-+
-+ /* `.' matches anything ... */
-+ for (j = 0; j < (1 << BYTEWIDTH); j++)
-+ fastmap[j] = 1;
-+
-+ /* ... except perhaps newline. */
-+ if (!(bufp->syntax & RE_DOT_NEWLINE))
-+ fastmap['\n'] = fastmap_newline;
-+
-+ /* Return if we have already set `can_be_null'; if we have,
-+ then the fastmap is irrelevant. Something's wrong here. */
-+ else if (bufp->can_be_null)
-+ goto done;
-+
-+ /* Otherwise, have to check alternative paths. */
-+ break;
-+ }
-+
-+#ifdef emacs
-+ case syntaxspec:
-+ k = *p++;
-+ for (j = 0; j < (1 << BYTEWIDTH); j++)
-+ if (SYNTAX (j) == (enum syntaxcode) k)
-+ fastmap[j] = 1;
-+ break;
-+
-+
-+ case notsyntaxspec:
-+ k = *p++;
-+ for (j = 0; j < (1 << BYTEWIDTH); j++)
-+ if (SYNTAX (j) != (enum syntaxcode) k)
-+ fastmap[j] = 1;
-+ break;
-+
-+
-+ /* All cases after this match the empty string. These end with
-+ `continue'. */
-+
-+
-+ case before_dot:
-+ case at_dot:
-+ case after_dot:
-+ continue;
-+#endif /* emacs */
-+
-+
-+ case no_op:
-+ case begline:
-+ case endline:
-+ case begbuf:
-+ case endbuf:
-+ case wordbound:
-+ case notwordbound:
-+ case wordbeg:
-+ case wordend:
-+ case push_dummy_failure:
-+ continue;
-+
-+
-+ case jump_n:
-+ case pop_failure_jump:
-+ case maybe_pop_jump:
-+ case jump:
-+ case jump_past_alt:
-+ case dummy_failure_jump:
-+ EXTRACT_NUMBER_AND_INCR (j, p);
-+ p += j;
-+ if (j > 0)
-+ continue;
-+
-+ /* Jump backward implies we just went through the body of a
-+ loop and matched nothing. Opcode jumped to should be
-+ `on_failure_jump' or `succeed_n'. Just treat it like an
-+ ordinary jump. For a * loop, it has pushed its failure
-+ point already; if so, discard that as redundant. */
-+ if ((re_opcode_t) *p != on_failure_jump
-+ && (re_opcode_t) *p != succeed_n)
-+ continue;
-+
-+ p++;
-+ EXTRACT_NUMBER_AND_INCR (j, p);
-+ p += j;
-+
-+ /* If what's on the stack is where we are now, pop it. */
-+ if (!FAIL_STACK_EMPTY ()
-+ && fail_stack.stack[fail_stack.avail - 1].pointer == p)
-+ fail_stack.avail--;
-+
-+ continue;
-+
-+
-+ case on_failure_jump:
-+ case on_failure_keep_string_jump:
-+ handle_on_failure_jump:
-+ EXTRACT_NUMBER_AND_INCR (j, p);
-+
-+ /* For some patterns, e.g., `(a?)?', `p+j' here points to the
-+ end of the pattern. We don't want to push such a point,
-+ since when we restore it above, entering the switch will
-+ increment `p' past the end of the pattern. We don't need
-+ to push such a point since we obviously won't find any more
-+ fastmap entries beyond `pend'. Such a pattern can match
-+ the null string, though. */
-+ if (p + j < pend)
-+ {
-+ if (!PUSH_PATTERN_OP (p + j, fail_stack))
-+ {
-+ RESET_FAIL_STACK ();
-+ return -2;
-+ }
-+ }
-+ else
-+ bufp->can_be_null = 1;
-+
-+ if (succeed_n_p)
-+ {
-+ EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
-+ succeed_n_p = false;
-+ }
-+
-+ continue;
-+
-+
-+ case succeed_n:
-+ /* Get to the number of times to succeed. */
-+ p += OFFSET_ADDRESS_SIZE;
-+
-+ /* Increment p past the n for when k != 0. */
-+ EXTRACT_NUMBER_AND_INCR (k, p);
-+ if (k == 0)
-+ {
-+ p -= 2 * OFFSET_ADDRESS_SIZE;
-+ succeed_n_p = true; /* Spaghetti code alert. */
-+ goto handle_on_failure_jump;
-+ }
-+ continue;
-+
-+
-+ case set_number_at:
-+ p += 2 * OFFSET_ADDRESS_SIZE;
-+ continue;
-+
-+
-+ case start_memory:
-+ case stop_memory:
-+ p += 2;
-+ continue;
-+
-+
-+ default:
-+ abort (); /* We have listed all the cases. */
-+ } /* switch *p++ */
-+
-+ /* Getting here means we have found the possible starting
-+ characters for one path of the pattern -- and that the empty
-+ string does not match. We need not follow this path further.
-+ Instead, look at the next alternative (remembered on the
-+ stack), or quit if no more. The test at the top of the loop
-+ does these things. */
-+ path_can_be_null = false;
-+ p = pend;
-+ } /* while p */
-+
-+ /* Set `can_be_null' for the last path (also the first path, if the
-+ pattern is empty). */
-+ bufp->can_be_null |= path_can_be_null;
-+
-+ done:
-+ RESET_FAIL_STACK ();
-+ return 0;
-+}
-+
-+#else /* not INSIDE_RECURSION */
-+
-+int
-+re_compile_fastmap (struct re_pattern_buffer *bufp)
-+{
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ return wcs_re_compile_fastmap(bufp);
-+ else
-+# endif
-+ return byte_re_compile_fastmap(bufp);
-+} /* re_compile_fastmap */
-+#ifdef _LIBC
-+weak_alias (__re_compile_fastmap, re_compile_fastmap)
-+#endif
-+
-+
-+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
-+ ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
-+ this memory for recording register information. STARTS and ENDS
-+ must be allocated using the malloc library routine, and must each
-+ be at least NUM_REGS * sizeof (regoff_t) bytes long.
-+
-+ If NUM_REGS == 0, then subsequent matches should allocate their own
-+ register data.
-+
-+ Unless this function is called, the first search or match using
-+ PATTERN_BUFFER will allocate its own register data, without
-+ freeing the old data. */
-+
-+void
-+re_set_registers (struct re_pattern_buffer *bufp,
-+ struct re_registers *regs, unsigned num_regs,
-+ regoff_t *starts, regoff_t *ends)
-+{
-+ if (num_regs)
-+ {
-+ bufp->regs_allocated = REGS_REALLOCATE;
-+ regs->num_regs = num_regs;
-+ regs->start = starts;
-+ regs->end = ends;
-+ }
-+ else
-+ {
-+ bufp->regs_allocated = REGS_UNALLOCATED;
-+ regs->num_regs = 0;
-+ regs->start = regs->end = (regoff_t *) 0;
-+ }
-+}
-+#ifdef _LIBC
-+weak_alias (__re_set_registers, re_set_registers)
-+#endif
-+
-+/* Searching routines. */
-+
-+/* Like re_search_2, below, but only one string is specified, and
-+ doesn't let you say where to stop matching. */
-+
-+int
-+re_search (struct re_pattern_buffer *bufp, const char *string, int size,
-+ int startpos, int range, struct re_registers *regs)
-+{
-+ return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
-+ regs, size);
-+}
-+#ifdef _LIBC
-+weak_alias (__re_search, re_search)
-+#endif
-+
-+
-+/* Using the compiled pattern in BUFP->buffer, first tries to match the
-+ virtual concatenation of STRING1 and STRING2, starting first at index
-+ STARTPOS, then at STARTPOS + 1, and so on.
-+
-+ STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
-+
-+ RANGE is how far to scan while trying to match. RANGE = 0 means try
-+ only at STARTPOS; in general, the last start tried is STARTPOS +
-+ RANGE.
-+
-+ In REGS, return the indices of the virtual concatenation of STRING1
-+ and STRING2 that matched the entire BUFP->buffer and its contained
-+ subexpressions.
-+
-+ Do not consider matching one past the index STOP in the virtual
-+ concatenation of STRING1 and STRING2.
-+
-+ We return either the position in the strings at which the match was
-+ found, -1 if no match, or -2 if error (such as failure
-+ stack overflow). */
-+
-+int
-+re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
-+ const char *string2, int size2, int startpos, int range,
-+ struct re_registers *regs, int stop)
-+{
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos,
-+ range, regs, stop);
-+ else
-+# endif
-+ return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos,
-+ range, regs, stop);
-+} /* re_search_2 */
-+#ifdef _LIBC
-+weak_alias (__re_search_2, re_search_2)
-+#endif
-+
-+#endif /* not INSIDE_RECURSION */
-+
-+#ifdef INSIDE_RECURSION
-+
-+#ifdef MATCH_MAY_ALLOCATE
-+# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
-+#else
-+# define FREE_VAR(var) if (var) free (var); var = NULL
-+#endif
-+
-+#ifdef WCHAR
-+# define MAX_ALLOCA_SIZE 2000
-+
-+# define FREE_WCS_BUFFERS() \
-+ do { \
-+ if (size1 > MAX_ALLOCA_SIZE) \
-+ { \
-+ free (wcs_string1); \
-+ free (mbs_offset1); \
-+ } \
-+ else \
-+ { \
-+ FREE_VAR (wcs_string1); \
-+ FREE_VAR (mbs_offset1); \
-+ } \
-+ if (size2 > MAX_ALLOCA_SIZE) \
-+ { \
-+ free (wcs_string2); \
-+ free (mbs_offset2); \
-+ } \
-+ else \
-+ { \
-+ FREE_VAR (wcs_string2); \
-+ FREE_VAR (mbs_offset2); \
-+ } \
-+ } while (0)
-+
-+#endif
-+
-+
-+static int
-+PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
-+ int size1, const char *string2, int size2,
-+ int startpos, int range,
-+ struct re_registers *regs, int stop)
-+{
-+ int val;
-+ register char *fastmap = bufp->fastmap;
-+ register RE_TRANSLATE_TYPE translate = bufp->translate;
-+ int total_size = size1 + size2;
-+ int endpos = startpos + range;
-+#ifdef WCHAR
-+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
-+ wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL;
-+ /* We need the size of wchar_t buffers correspond to csize1, csize2. */
-+ int wcs_size1 = 0, wcs_size2 = 0;
-+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
-+ int *mbs_offset1 = NULL, *mbs_offset2 = NULL;
-+ /* They hold whether each wchar_t is binary data or not. */
-+ char *is_binary = NULL;
-+#endif /* WCHAR */
-+
-+ /* Check for out-of-range STARTPOS. */
-+ if (startpos < 0 || startpos > total_size)
-+ return -1;
-+
-+ /* Fix up RANGE if it might eventually take us outside
-+ the virtual concatenation of STRING1 and STRING2.
-+ Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
-+ if (endpos < 0)
-+ range = 0 - startpos;
-+ else if (endpos > total_size)
-+ range = total_size - startpos;
-+
-+ /* If the search isn't to be a backwards one, don't waste time in a
-+ search for a pattern that must be anchored. */
-+ if (bufp->used > 0 && range > 0
-+ && ((re_opcode_t) bufp->buffer[0] == begbuf
-+ /* `begline' is like `begbuf' if it cannot match at newlines. */
-+ || ((re_opcode_t) bufp->buffer[0] == begline
-+ && !bufp->newline_anchor)))
-+ {
-+ if (startpos > 0)
-+ return -1;
-+ else
-+ range = 1;
-+ }
-+
-+#ifdef emacs
-+ /* In a forward search for something that starts with \=.
-+ don't keep searching past point. */
-+ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
-+ {
-+ range = PT - startpos;
-+ if (range <= 0)
-+ return -1;
-+ }
-+#endif /* emacs */
-+
-+ /* Update the fastmap now if not correct already. */
-+ if (fastmap && !bufp->fastmap_accurate)
-+ if (re_compile_fastmap (bufp) == -2)
-+ return -2;
-+
-+#ifdef WCHAR
-+ /* Allocate wchar_t array for wcs_string1 and wcs_string2 and
-+ fill them with converted string. */
-+ if (size1 != 0)
-+ {
-+ if (size1 > MAX_ALLOCA_SIZE)
-+ {
-+ wcs_string1 = TALLOC (size1 + 1, CHAR_T);
-+ mbs_offset1 = TALLOC (size1 + 1, int);
-+ is_binary = TALLOC (size1 + 1, char);
-+ }
-+ else
-+ {
-+ wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
-+ mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
-+ is_binary = REGEX_TALLOC (size1 + 1, char);
-+ }
-+ if (!wcs_string1 || !mbs_offset1 || !is_binary)
-+ {
-+ if (size1 > MAX_ALLOCA_SIZE)
-+ {
-+ free (wcs_string1);
-+ free (mbs_offset1);
-+ free (is_binary);
-+ }
-+ else
-+ {
-+ FREE_VAR (wcs_string1);
-+ FREE_VAR (mbs_offset1);
-+ FREE_VAR (is_binary);
-+ }
-+ return -2;
-+ }
-+ wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
-+ mbs_offset1, is_binary);
-+ wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
-+ if (size1 > MAX_ALLOCA_SIZE)
-+ free (is_binary);
-+ else
-+ FREE_VAR (is_binary);
-+ }
-+ if (size2 != 0)
-+ {
-+ if (size2 > MAX_ALLOCA_SIZE)
-+ {
-+ wcs_string2 = TALLOC (size2 + 1, CHAR_T);
-+ mbs_offset2 = TALLOC (size2 + 1, int);
-+ is_binary = TALLOC (size2 + 1, char);
-+ }
-+ else
-+ {
-+ wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
-+ mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
-+ is_binary = REGEX_TALLOC (size2 + 1, char);
-+ }
-+ if (!wcs_string2 || !mbs_offset2 || !is_binary)
-+ {
-+ FREE_WCS_BUFFERS ();
-+ if (size2 > MAX_ALLOCA_SIZE)
-+ free (is_binary);
-+ else
-+ FREE_VAR (is_binary);
-+ return -2;
-+ }
-+ wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
-+ mbs_offset2, is_binary);
-+ wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
-+ if (size2 > MAX_ALLOCA_SIZE)
-+ free (is_binary);
-+ else
-+ FREE_VAR (is_binary);
-+ }
-+#endif /* WCHAR */
-+
-+
-+ /* Loop through the string, looking for a place to start matching. */
-+ for (;;)
-+ {
-+ /* If a fastmap is supplied, skip quickly over characters that
-+ cannot be the start of a match. If the pattern can match the
-+ null string, however, we don't need to skip characters; we want
-+ the first null string. */
-+ if (fastmap && startpos < total_size && !bufp->can_be_null)
-+ {
-+ if (range > 0) /* Searching forwards. */
-+ {
-+ register const char *d;
-+ register int lim = 0;
-+ int irange = range;
-+
-+ if (startpos < size1 && startpos + range >= size1)
-+ lim = range - (size1 - startpos);
-+
-+ d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
-+
-+ /* Written out as an if-else to avoid testing `translate'
-+ inside the loop. */
-+ if (translate)
-+ while (range > lim
-+ && !fastmap[(unsigned char)
-+ translate[(unsigned char) *d++]])
-+ range--;
-+ else
-+ while (range > lim && !fastmap[(unsigned char) *d++])
-+ range--;
-+
-+ startpos += irange - range;
-+ }
-+ else /* Searching backwards. */
-+ {
-+ register CHAR_T c = (size1 == 0 || startpos >= size1
-+ ? string2[startpos - size1]
-+ : string1[startpos]);
-+
-+ if (!fastmap[(unsigned char) TRANSLATE (c)])
-+ goto advance;
-+ }
-+ }
-+
-+ /* If can't match the null string, and that's all we have left, fail. */
-+ if (range >= 0 && startpos == total_size && fastmap
-+ && !bufp->can_be_null)
-+ {
-+#ifdef WCHAR
-+ FREE_WCS_BUFFERS ();
-+#endif
-+ return -1;
-+ }
-+
-+#ifdef WCHAR
-+ val = wcs_re_match_2_internal (bufp, string1, size1, string2,
-+ size2, startpos, regs, stop,
-+ wcs_string1, wcs_size1,
-+ wcs_string2, wcs_size2,
-+ mbs_offset1, mbs_offset2);
-+#else /* BYTE */
-+ val = byte_re_match_2_internal (bufp, string1, size1, string2,
-+ size2, startpos, regs, stop);
-+#endif /* BYTE */
-+
-+#ifndef REGEX_MALLOC
-+# ifdef C_ALLOCA
-+ alloca (0);
-+# endif
-+#endif
-+
-+ if (val >= 0)
-+ {
-+#ifdef WCHAR
-+ FREE_WCS_BUFFERS ();
-+#endif
-+ return startpos;
-+ }
-+
-+ if (val == -2)
-+ {
-+#ifdef WCHAR
-+ FREE_WCS_BUFFERS ();
-+#endif
-+ return -2;
-+ }
-+
-+ advance:
-+ if (!range)
-+ break;
-+ else if (range > 0)
-+ {
-+ range--;
-+ startpos++;
-+ }
-+ else
-+ {
-+ range++;
-+ startpos--;
-+ }
-+ }
-+#ifdef WCHAR
-+ FREE_WCS_BUFFERS ();
-+#endif
-+ return -1;
-+}
-+
-+#ifdef WCHAR
-+/* This converts PTR, a pointer into one of the search wchar_t strings
-+ `string1' and `string2' into an multibyte string offset from the
-+ beginning of that string. We use mbs_offset to optimize.
-+ See convert_mbs_to_wcs. */
-+# define POINTER_TO_OFFSET(ptr) \
-+ (FIRST_STRING_P (ptr) \
-+ ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \
-+ : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \
-+ + csize1)))
-+#else /* BYTE */
-+/* This converts PTR, a pointer into one of the search strings `string1'
-+ and `string2' into an offset from the beginning of that string. */
-+# define POINTER_TO_OFFSET(ptr) \
-+ (FIRST_STRING_P (ptr) \
-+ ? ((regoff_t) ((ptr) - string1)) \
-+ : ((regoff_t) ((ptr) - string2 + size1)))
-+#endif /* WCHAR */
-+
-+/* Macros for dealing with the split strings in re_match_2. */
-+
-+#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
-+
-+/* Call before fetching a character with *d. This switches over to
-+ string2 if necessary. */
-+#define PREFETCH() \
-+ while (d == dend) \
-+ { \
-+ /* End of string2 => fail. */ \
-+ if (dend == end_match_2) \
-+ goto fail; \
-+ /* End of string1 => advance to string2. */ \
-+ d = string2; \
-+ dend = end_match_2; \
-+ }
-+
-+/* Test if at very beginning or at very end of the virtual concatenation
-+ of `string1' and `string2'. If only one string, it's `string2'. */
-+#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
-+#define AT_STRINGS_END(d) ((d) == end2)
-+
-+
-+/* Test if D points to a character which is word-constituent. We have
-+ two special cases to check for: if past the end of string1, look at
-+ the first character in string2; and if before the beginning of
-+ string2, look at the last character in string1. */
-+#ifdef WCHAR
-+/* Use internationalized API instead of SYNTAX. */
-+# define WORDCHAR_P(d) \
-+ (iswalnum ((wint_t)((d) == end1 ? *string2 \
-+ : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \
-+ || ((d) == end1 ? *string2 \
-+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
-+#else /* BYTE */
-+# define WORDCHAR_P(d) \
-+ (SYNTAX ((d) == end1 ? *string2 \
-+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
-+ == Sword)
-+#endif /* WCHAR */
-+
-+/* Disabled due to a compiler bug -- see comment at case wordbound */
-+#if 0
-+/* Test if the character before D and the one at D differ with respect
-+ to being word-constituent. */
-+#define AT_WORD_BOUNDARY(d) \
-+ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
-+ || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
-+#endif
-+
-+/* Free everything we malloc. */
-+#ifdef MATCH_MAY_ALLOCATE
-+# ifdef WCHAR
-+# define FREE_VARIABLES() \
-+ do { \
-+ REGEX_FREE_STACK (fail_stack.stack); \
-+ FREE_VAR (regstart); \
-+ FREE_VAR (regend); \
-+ FREE_VAR (old_regstart); \
-+ FREE_VAR (old_regend); \
-+ FREE_VAR (best_regstart); \
-+ FREE_VAR (best_regend); \
-+ FREE_VAR (reg_info); \
-+ FREE_VAR (reg_dummy); \
-+ FREE_VAR (reg_info_dummy); \
-+ if (!cant_free_wcs_buf) \
-+ { \
-+ FREE_VAR (string1); \
-+ FREE_VAR (string2); \
-+ FREE_VAR (mbs_offset1); \
-+ FREE_VAR (mbs_offset2); \
-+ } \
-+ } while (0)
-+# else /* BYTE */
-+# define FREE_VARIABLES() \
-+ do { \
-+ REGEX_FREE_STACK (fail_stack.stack); \
-+ FREE_VAR (regstart); \
-+ FREE_VAR (regend); \
-+ FREE_VAR (old_regstart); \
-+ FREE_VAR (old_regend); \
-+ FREE_VAR (best_regstart); \
-+ FREE_VAR (best_regend); \
-+ FREE_VAR (reg_info); \
-+ FREE_VAR (reg_dummy); \
-+ FREE_VAR (reg_info_dummy); \
-+ } while (0)
-+# endif /* WCHAR */
-+#else
-+# ifdef WCHAR
-+# define FREE_VARIABLES() \
-+ do { \
-+ if (!cant_free_wcs_buf) \
-+ { \
-+ FREE_VAR (string1); \
-+ FREE_VAR (string2); \
-+ FREE_VAR (mbs_offset1); \
-+ FREE_VAR (mbs_offset2); \
-+ } \
-+ } while (0)
-+# else /* BYTE */
-+# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
-+# endif /* WCHAR */
-+#endif /* not MATCH_MAY_ALLOCATE */
-+
-+/* These values must meet several constraints. They must not be valid
-+ register values; since we have a limit of 255 registers (because
-+ we use only one byte in the pattern for the register number), we can
-+ use numbers larger than 255. They must differ by 1, because of
-+ NUM_FAILURE_ITEMS above. And the value for the lowest register must
-+ be larger than the value for the highest register, so we do not try
-+ to actually save any registers when none are active. */
-+#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
-+#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
-+
-+#else /* not INSIDE_RECURSION */
-+/* Matching routines. */
-+
-+#ifndef emacs /* Emacs never uses this. */
-+/* re_match is like re_match_2 except it takes only a single string. */
-+
-+int
-+re_match (struct re_pattern_buffer *bufp, const char *string,
-+ int size, int pos, struct re_registers *regs)
-+{
-+ int result;
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ result = wcs_re_match_2_internal (bufp, NULL, 0, string, size,
-+ pos, regs, size,
-+ NULL, 0, NULL, 0, NULL, NULL);
-+ else
-+# endif
-+ result = byte_re_match_2_internal (bufp, NULL, 0, string, size,
-+ pos, regs, size);
-+# ifndef REGEX_MALLOC
-+# ifdef C_ALLOCA
-+ alloca (0);
-+# endif
-+# endif
-+ return result;
-+}
-+# ifdef _LIBC
-+weak_alias (__re_match, re_match)
-+# endif
-+#endif /* not emacs */
-+
-+#endif /* not INSIDE_RECURSION */
-+
-+#ifdef INSIDE_RECURSION
-+static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p,
-+ UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info);
-+static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p,
-+ UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info);
-+static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p,
-+ UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info);
-+static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2,
-+ register int len,
-+ RE_TRANSLATE_TYPE translate);
-+#else /* not INSIDE_RECURSION */
-+
-+/* re_match_2 matches the compiled pattern in BUFP against the
-+ the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
-+ and SIZE2, respectively). We start matching at POS, and stop
-+ matching at STOP.
-+
-+ If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
-+ store offsets for the substring each group matched in REGS. See the
-+ documentation for exactly how many groups we fill.
-+
-+ We return -1 if no match, -2 if an internal error (such as the
-+ failure stack overflowing). Otherwise, we return the length of the
-+ matched substring. */
-+
-+int
-+re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
-+ const char *string2, int size2, int pos,
-+ struct re_registers *regs, int stop)
-+{
-+ int result;
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ result = wcs_re_match_2_internal (bufp, string1, size1, string2, size2,
-+ pos, regs, stop,
-+ NULL, 0, NULL, 0, NULL, NULL);
-+ else
-+# endif
-+ result = byte_re_match_2_internal (bufp, string1, size1, string2, size2,
-+ pos, regs, stop);
-+
-+#ifndef REGEX_MALLOC
-+# ifdef C_ALLOCA
-+ alloca (0);
-+# endif
-+#endif
-+ return result;
-+}
-+#ifdef _LIBC
-+weak_alias (__re_match_2, re_match_2)
-+#endif
-+
-+#endif /* not INSIDE_RECURSION */
-+
-+#ifdef INSIDE_RECURSION
-+
-+#ifdef WCHAR
-+static int count_mbs_length (int *, int);
-+
-+/* This check the substring (from 0, to length) of the multibyte string,
-+ to which offset_buffer correspond. And count how many wchar_t_characters
-+ the substring occupy. We use offset_buffer to optimization.
-+ See convert_mbs_to_wcs. */
-+
-+static int
-+count_mbs_length(int *offset_buffer, int length)
-+{
-+ int upper, lower;
-+
-+ /* Check whether the size is valid. */
-+ if (length < 0)
-+ return -1;
-+
-+ if (offset_buffer == NULL)
-+ return 0;
-+
-+ /* If there are no multibyte character, offset_buffer[i] == i.
-+ Optmize for this case. */
-+ if (offset_buffer[length] == length)
-+ return length;
-+
-+ /* Set up upper with length. (because for all i, offset_buffer[i] >= i) */
-+ upper = length;
-+ lower = 0;
-+
-+ while (true)
-+ {
-+ int middle = (lower + upper) / 2;
-+ if (middle == lower || middle == upper)
-+ break;
-+ if (offset_buffer[middle] > length)
-+ upper = middle;
-+ else if (offset_buffer[middle] < length)
-+ lower = middle;
-+ else
-+ return middle;
-+ }
-+
-+ return -1;
-+}
-+#endif /* WCHAR */
-+
-+/* This is a separate function so that we can force an alloca cleanup
-+ afterwards. */
-+#ifdef WCHAR
-+static int
-+wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
-+ const char *cstring1, int csize1,
-+ const char *cstring2, int csize2,
-+ int pos,
-+ struct re_registers *regs,
-+ int stop,
-+ /* string1 == string2 == NULL means string1/2, size1/2 and
-+ mbs_offset1/2 need seting up in this function. */
-+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
-+ wchar_t *string1, int size1,
-+ wchar_t *string2, int size2,
-+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
-+ int *mbs_offset1, int *mbs_offset2)
-+#else /* BYTE */
-+static int
-+byte_re_match_2_internal (struct re_pattern_buffer *bufp,
-+ const char *string1, int size1,
-+ const char *string2, int size2,
-+ int pos,
-+ struct re_registers *regs, int stop)
-+#endif /* BYTE */
-+{
-+ /* General temporaries. */
-+ int mcnt;
-+ UCHAR_T *p1;
-+#ifdef WCHAR
-+ /* They hold whether each wchar_t is binary data or not. */
-+ char *is_binary = NULL;
-+ /* If true, we can't free string1/2, mbs_offset1/2. */
-+ int cant_free_wcs_buf = 1;
-+#endif /* WCHAR */
-+
-+ /* Just past the end of the corresponding string. */
-+ const CHAR_T *end1, *end2;
-+
-+ /* Pointers into string1 and string2, just past the last characters in
-+ each to consider matching. */
-+ const CHAR_T *end_match_1, *end_match_2;
-+
-+ /* Where we are in the data, and the end of the current string. */
-+ const CHAR_T *d, *dend;
-+
-+ /* Where we are in the pattern, and the end of the pattern. */
-+#ifdef WCHAR
-+ UCHAR_T *pattern, *p;
-+ register UCHAR_T *pend;
-+#else /* BYTE */
-+ UCHAR_T *p = bufp->buffer;
-+ register UCHAR_T *pend = p + bufp->used;
-+#endif /* WCHAR */
-+
-+ /* Mark the opcode just after a start_memory, so we can test for an
-+ empty subpattern when we get to the stop_memory. */
-+ UCHAR_T *just_past_start_mem = 0;
-+
-+ /* We use this to map every character in the string. */
-+ RE_TRANSLATE_TYPE translate = bufp->translate;
-+
-+ /* Failure point stack. Each place that can handle a failure further
-+ down the line pushes a failure point on this stack. It consists of
-+ restart, regend, and reg_info for all registers corresponding to
-+ the subexpressions we're currently inside, plus the number of such
-+ registers, and, finally, two char *'s. The first char * is where
-+ to resume scanning the pattern; the second one is where to resume
-+ scanning the strings. If the latter is zero, the failure point is
-+ a ``dummy''; if a failure happens and the failure point is a dummy,
-+ it gets discarded and the next next one is tried. */
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
-+ PREFIX(fail_stack_type) fail_stack;
-+#endif
-+#ifdef DEBUG
-+ static unsigned failure_id;
-+ unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
-+#endif
-+
-+#ifdef REL_ALLOC
-+ /* This holds the pointer to the failure stack, when
-+ it is allocated relocatably. */
-+ fail_stack_elt_t *failure_stack_ptr;
-+#endif
-+
-+ /* We fill all the registers internally, independent of what we
-+ return, for use in backreferences. The number here includes
-+ an element for register zero. */
-+ size_t num_regs = bufp->re_nsub + 1;
-+
-+ /* The currently active registers. */
-+ active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
-+ active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-+
-+ /* Information on the contents of registers. These are pointers into
-+ the input strings; they record just what was matched (on this
-+ attempt) by a subexpression part of the pattern, that is, the
-+ regnum-th regstart pointer points to where in the pattern we began
-+ matching and the regnum-th regend points to right after where we
-+ stopped matching the regnum-th subexpression. (The zeroth register
-+ keeps track of what the whole pattern matches.) */
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
-+ const CHAR_T **regstart, **regend;
-+#endif
-+
-+ /* If a group that's operated upon by a repetition operator fails to
-+ match anything, then the register for its start will need to be
-+ restored because it will have been set to wherever in the string we
-+ are when we last see its open-group operator. Similarly for a
-+ register's end. */
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
-+ const CHAR_T **old_regstart, **old_regend;
-+#endif
-+
-+ /* The is_active field of reg_info helps us keep track of which (possibly
-+ nested) subexpressions we are currently in. The matched_something
-+ field of reg_info[reg_num] helps us tell whether or not we have
-+ matched any of the pattern so far this time through the reg_num-th
-+ subexpression. These two fields get reset each time through any
-+ loop their register is in. */
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
-+ PREFIX(register_info_type) *reg_info;
-+#endif
-+
-+ /* The following record the register info as found in the above
-+ variables when we find a match better than any we've seen before.
-+ This happens as we backtrack through the failure points, which in
-+ turn happens only if we have not yet matched the entire string. */
-+ unsigned best_regs_set = false;
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
-+ const CHAR_T **best_regstart, **best_regend;
-+#endif
-+
-+ /* Logically, this is `best_regend[0]'. But we don't want to have to
-+ allocate space for that if we're not allocating space for anything
-+ else (see below). Also, we never need info about register 0 for
-+ any of the other register vectors, and it seems rather a kludge to
-+ treat `best_regend' differently than the rest. So we keep track of
-+ the end of the best match so far in a separate variable. We
-+ initialize this to NULL so that when we backtrack the first time
-+ and need to test it, it's not garbage. */
-+ const CHAR_T *match_end = NULL;
-+
-+ /* This helps SET_REGS_MATCHED avoid doing redundant work. */
-+ int set_regs_matched_done = 0;
-+
-+ /* Used when we pop values we don't care about. */
-+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
-+ const CHAR_T **reg_dummy;
-+ PREFIX(register_info_type) *reg_info_dummy;
-+#endif
-+
-+#ifdef DEBUG
-+ /* Counts the total number of registers pushed. */
-+ unsigned num_regs_pushed = 0;
-+#endif
-+
-+ DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
-+
-+ INIT_FAIL_STACK ();
-+
-+#ifdef MATCH_MAY_ALLOCATE
-+ /* Do not bother to initialize all the register variables if there are
-+ no groups in the pattern, as it takes a fair amount of time. If
-+ there are groups, we include space for register 0 (the whole
-+ pattern), even though we never use it, since it simplifies the
-+ array indexing. We should fix this. */
-+ if (bufp->re_nsub)
-+ {
-+ regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ regend = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ old_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ old_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ best_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ best_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ reg_info = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
-+ reg_dummy = REGEX_TALLOC (num_regs, const CHAR_T *);
-+ reg_info_dummy = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
-+
-+ if (!(regstart && regend && old_regstart && old_regend && reg_info
-+ && best_regstart && best_regend && reg_dummy && reg_info_dummy))
-+ {
-+ FREE_VARIABLES ();
-+ return -2;
-+ }
-+ }
-+ else
-+ {
-+ /* We must initialize all our variables to NULL, so that
-+ `FREE_VARIABLES' doesn't try to free them. */
-+ regstart = regend = old_regstart = old_regend = best_regstart
-+ = best_regend = reg_dummy = NULL;
-+ reg_info = reg_info_dummy = (PREFIX(register_info_type) *) NULL;
-+ }
-+#endif /* MATCH_MAY_ALLOCATE */
-+
-+ /* The starting position is bogus. */
-+#ifdef WCHAR
-+ if (pos < 0 || pos > csize1 + csize2)
-+#else /* BYTE */
-+ if (pos < 0 || pos > size1 + size2)
-+#endif
-+ {
-+ FREE_VARIABLES ();
-+ return -1;
-+ }
-+
-+#ifdef WCHAR
-+ /* Allocate wchar_t array for string1 and string2 and
-+ fill them with converted string. */
-+ if (string1 == NULL && string2 == NULL)
-+ {
-+ /* We need seting up buffers here. */
-+
-+ /* We must free wcs buffers in this function. */
-+ cant_free_wcs_buf = 0;
-+
-+ if (csize1 != 0)
-+ {
-+ string1 = REGEX_TALLOC (csize1 + 1, CHAR_T);
-+ mbs_offset1 = REGEX_TALLOC (csize1 + 1, int);
-+ is_binary = REGEX_TALLOC (csize1 + 1, char);
-+ if (!string1 || !mbs_offset1 || !is_binary)
-+ {
-+ FREE_VAR (string1);
-+ FREE_VAR (mbs_offset1);
-+ FREE_VAR (is_binary);
-+ return -2;
-+ }
-+ }
-+ if (csize2 != 0)
-+ {
-+ string2 = REGEX_TALLOC (csize2 + 1, CHAR_T);
-+ mbs_offset2 = REGEX_TALLOC (csize2 + 1, int);
-+ is_binary = REGEX_TALLOC (csize2 + 1, char);
-+ if (!string2 || !mbs_offset2 || !is_binary)
-+ {
-+ FREE_VAR (string1);
-+ FREE_VAR (mbs_offset1);
-+ FREE_VAR (string2);
-+ FREE_VAR (mbs_offset2);
-+ FREE_VAR (is_binary);
-+ return -2;
-+ }
-+ size2 = convert_mbs_to_wcs(string2, cstring2, csize2,
-+ mbs_offset2, is_binary);
-+ string2[size2] = L'\0'; /* for a sentinel */
-+ FREE_VAR (is_binary);
-+ }
-+ }
-+
-+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
-+ pattern to (char*) in regex_compile. */
-+ p = pattern = (CHAR_T*)bufp->buffer;
-+ pend = (CHAR_T*)(bufp->buffer + bufp->used);
-+
-+#endif /* WCHAR */
-+
-+ /* Initialize subexpression text positions to -1 to mark ones that no
-+ start_memory/stop_memory has been seen for. Also initialize the
-+ register information struct. */
-+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
-+ {
-+ regstart[mcnt] = regend[mcnt]
-+ = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
-+
-+ REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
-+ IS_ACTIVE (reg_info[mcnt]) = 0;
-+ MATCHED_SOMETHING (reg_info[mcnt]) = 0;
-+ EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
-+ }
-+
-+ /* We move `string1' into `string2' if the latter's empty -- but not if
-+ `string1' is null. */
-+ if (size2 == 0 && string1 != NULL)
-+ {
-+ string2 = string1;
-+ size2 = size1;
-+ string1 = 0;
-+ size1 = 0;
-+#ifdef WCHAR
-+ mbs_offset2 = mbs_offset1;
-+ csize2 = csize1;
-+ mbs_offset1 = NULL;
-+ csize1 = 0;
-+#endif
-+ }
-+ end1 = string1 + size1;
-+ end2 = string2 + size2;
-+
-+ /* Compute where to stop matching, within the two strings. */
-+#ifdef WCHAR
-+ if (stop <= csize1)
-+ {
-+ mcnt = count_mbs_length(mbs_offset1, stop);
-+ end_match_1 = string1 + mcnt;
-+ end_match_2 = string2;
-+ }
-+ else
-+ {
-+ if (stop > csize1 + csize2)
-+ stop = csize1 + csize2;
-+ end_match_1 = end1;
-+ mcnt = count_mbs_length(mbs_offset2, stop-csize1);
-+ end_match_2 = string2 + mcnt;
-+ }
-+ if (mcnt < 0)
-+ { /* count_mbs_length return error. */
-+ FREE_VARIABLES ();
-+ return -1;
-+ }
-+#else
-+ if (stop <= size1)
-+ {
-+ end_match_1 = string1 + stop;
-+ end_match_2 = string2;
-+ }
-+ else
-+ {
-+ end_match_1 = end1;
-+ end_match_2 = string2 + stop - size1;
-+ }
-+#endif /* WCHAR */
-+
-+ /* `p' scans through the pattern as `d' scans through the data.
-+ `dend' is the end of the input string that `d' points within. `d'
-+ is advanced into the following input string whenever necessary, but
-+ this happens before fetching; therefore, at the beginning of the
-+ loop, `d' can be pointing at the end of a string, but it cannot
-+ equal `string2'. */
-+#ifdef WCHAR
-+ if (size1 > 0 && pos <= csize1)
-+ {
-+ mcnt = count_mbs_length(mbs_offset1, pos);
-+ d = string1 + mcnt;
-+ dend = end_match_1;
-+ }
-+ else
-+ {
-+ mcnt = count_mbs_length(mbs_offset2, pos-csize1);
-+ d = string2 + mcnt;
-+ dend = end_match_2;
-+ }
-+
-+ if (mcnt < 0)
-+ { /* count_mbs_length return error. */
-+ FREE_VARIABLES ();
-+ return -1;
-+ }
-+#else
-+ if (size1 > 0 && pos <= size1)
-+ {
-+ d = string1 + pos;
-+ dend = end_match_1;
-+ }
-+ else
-+ {
-+ d = string2 + pos - size1;
-+ dend = end_match_2;
-+ }
-+#endif /* WCHAR */
-+
-+ DEBUG_PRINT1 ("The compiled pattern is:\n");
-+ DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
-+ DEBUG_PRINT1 ("The string to match is: `");
-+ DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
-+ DEBUG_PRINT1 ("'\n");
-+
-+ /* This loops over pattern commands. It exits by returning from the
-+ function if the match is complete, or it drops through if the match
-+ fails at this starting point in the input data. */
-+ for (;;)
-+ {
-+#ifdef _LIBC
-+ DEBUG_PRINT2 ("\n%p: ", p);
-+#else
-+ DEBUG_PRINT2 ("\n0x%x: ", p);
-+#endif
-+
-+ if (p == pend)
-+ { /* End of pattern means we might have succeeded. */
-+ DEBUG_PRINT1 ("end of pattern ... ");
-+
-+ /* If we haven't matched the entire string, and we want the
-+ longest match, try backtracking. */
-+ if (d != end_match_2)
-+ {
-+ /* 1 if this match ends in the same string (string1 or string2)
-+ as the best previous match. */
-+ boolean same_str_p = (FIRST_STRING_P (match_end)
-+ == MATCHING_IN_FIRST_STRING);
-+ /* 1 if this match is the best seen so far. */
-+ boolean best_match_p;
-+
-+ /* AIX compiler got confused when this was combined
-+ with the previous declaration. */
-+ if (same_str_p)
-+ best_match_p = d > match_end;
-+ else
-+ best_match_p = !MATCHING_IN_FIRST_STRING;
-+
-+ DEBUG_PRINT1 ("backtracking.\n");
-+
-+ if (!FAIL_STACK_EMPTY ())
-+ { /* More failure points to try. */
-+
-+ /* If exceeds best match so far, save it. */
-+ if (!best_regs_set || best_match_p)
-+ {
-+ best_regs_set = true;
-+ match_end = d;
-+
-+ DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
-+
-+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
-+ {
-+ best_regstart[mcnt] = regstart[mcnt];
-+ best_regend[mcnt] = regend[mcnt];
-+ }
-+ }
-+ goto fail;
-+ }
-+
-+ /* If no failure points, don't restore garbage. And if
-+ last match is real best match, don't restore second
-+ best one. */
-+ else if (best_regs_set && !best_match_p)
-+ {
-+ restore_best_regs:
-+ /* Restore best match. It may happen that `dend ==
-+ end_match_1' while the restored d is in string2.
-+ For example, the pattern `x.*y.*z' against the
-+ strings `x-' and `y-z-', if the two strings are
-+ not consecutive in memory. */
-+ DEBUG_PRINT1 ("Restoring best registers.\n");
-+
-+ d = match_end;
-+ dend = ((d >= string1 && d <= end1)
-+ ? end_match_1 : end_match_2);
-+
-+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
-+ {
-+ regstart[mcnt] = best_regstart[mcnt];
-+ regend[mcnt] = best_regend[mcnt];
-+ }
-+ }
-+ } /* d != end_match_2 */
-+
-+ succeed_label:
-+ DEBUG_PRINT1 ("Accepting match.\n");
-+ /* If caller wants register contents data back, do it. */
-+ if (regs && !bufp->no_sub)
-+ {
-+ /* Have the register data arrays been allocated? */
-+ if (bufp->regs_allocated == REGS_UNALLOCATED)
-+ { /* No. So allocate them with malloc. We need one
-+ extra element beyond `num_regs' for the `-1' marker
-+ GNU code uses. */
-+ regs->num_regs = MAX (RE_NREGS, num_regs + 1);
-+ regs->start = TALLOC (regs->num_regs, regoff_t);
-+ regs->end = TALLOC (regs->num_regs, regoff_t);
-+ if (regs->start == NULL || regs->end == NULL)
-+ {
-+ FREE_VARIABLES ();
-+ return -2;
-+ }
-+ bufp->regs_allocated = REGS_REALLOCATE;
-+ }
-+ else if (bufp->regs_allocated == REGS_REALLOCATE)
-+ { /* Yes. If we need more elements than were already
-+ allocated, reallocate them. If we need fewer, just
-+ leave it alone. */
-+ if (regs->num_regs < num_regs + 1)
-+ {
-+ regs->num_regs = num_regs + 1;
-+ RETALLOC (regs->start, regs->num_regs, regoff_t);
-+ RETALLOC (regs->end, regs->num_regs, regoff_t);
-+ if (regs->start == NULL || regs->end == NULL)
-+ {
-+ FREE_VARIABLES ();
-+ return -2;
-+ }
-+ }
-+ }
-+ else
-+ {
-+ /* These braces fend off a "empty body in an else-statement"
-+ warning under GCC when assert expands to nothing. */
-+ assert (bufp->regs_allocated == REGS_FIXED);
-+ }
-+
-+ /* Convert the pointer data in `regstart' and `regend' to
-+ indices. Register zero has to be set differently,
-+ since we haven't kept track of any info for it. */
-+ if (regs->num_regs > 0)
-+ {
-+ regs->start[0] = pos;
-+#ifdef WCHAR
-+ if (MATCHING_IN_FIRST_STRING)
-+ regs->end[0] = mbs_offset1 != NULL ?
-+ mbs_offset1[d-string1] : 0;
-+ else
-+ regs->end[0] = csize1 + (mbs_offset2 != NULL ?
-+ mbs_offset2[d-string2] : 0);
-+#else
-+ regs->end[0] = (MATCHING_IN_FIRST_STRING
-+ ? ((regoff_t) (d - string1))
-+ : ((regoff_t) (d - string2 + size1)));
-+#endif /* WCHAR */
-+ }
-+
-+ /* Go through the first `min (num_regs, regs->num_regs)'
-+ registers, since that is all we initialized. */
-+ for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs);
-+ mcnt++)
-+ {
-+ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
-+ regs->start[mcnt] = regs->end[mcnt] = -1;
-+ else
-+ {
-+ regs->start[mcnt]
-+ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
-+ regs->end[mcnt]
-+ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
-+ }
-+ }
-+
-+ /* If the regs structure we return has more elements than
-+ were in the pattern, set the extra elements to -1. If
-+ we (re)allocated the registers, this is the case,
-+ because we always allocate enough to have at least one
-+ -1 at the end. */
-+ for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++)
-+ regs->start[mcnt] = regs->end[mcnt] = -1;
-+ } /* regs && !bufp->no_sub */
-+
-+ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
-+ nfailure_points_pushed, nfailure_points_popped,
-+ nfailure_points_pushed - nfailure_points_popped);
-+ DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
-+
-+#ifdef WCHAR
-+ if (MATCHING_IN_FIRST_STRING)
-+ mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0;
-+ else
-+ mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) +
-+ csize1;
-+ mcnt -= pos;
-+#else
-+ mcnt = d - pos - (MATCHING_IN_FIRST_STRING
-+ ? string1
-+ : string2 - size1);
-+#endif /* WCHAR */
-+
-+ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
-+
-+ FREE_VARIABLES ();
-+ return mcnt;
-+ }
-+
-+ /* Otherwise match next pattern command. */
-+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
-+ {
-+ /* Ignore these. Used to ignore the n of succeed_n's which
-+ currently have n == 0. */
-+ case no_op:
-+ DEBUG_PRINT1 ("EXECUTING no_op.\n");
-+ break;
-+
-+ case succeed:
-+ DEBUG_PRINT1 ("EXECUTING succeed.\n");
-+ goto succeed_label;
-+
-+ /* Match the next n pattern characters exactly. The following
-+ byte in the pattern defines n, and the n bytes after that
-+ are the characters to match. */
-+ case exactn:
-+#ifdef MBS_SUPPORT
-+ case exactn_bin:
-+#endif
-+ mcnt = *p++;
-+ DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
-+
-+ /* This is written out as an if-else so we don't waste time
-+ testing `translate' inside the loop. */
-+ if (translate)
-+ {
-+ do
-+ {
-+ PREFETCH ();
-+#ifdef WCHAR
-+ if (*d <= 0xff)
-+ {
-+ if ((UCHAR_T) translate[(unsigned char) *d++]
-+ != (UCHAR_T) *p++)
-+ goto fail;
-+ }
-+ else
-+ {
-+ if (*d++ != (CHAR_T) *p++)
-+ goto fail;
-+ }
-+#else
-+ if ((UCHAR_T) translate[(unsigned char) *d++]
-+ != (UCHAR_T) *p++)
-+ goto fail;
-+#endif /* WCHAR */
-+ }
-+ while (--mcnt);
-+ }
-+ else
-+ {
-+ do
-+ {
-+ PREFETCH ();
-+ if (*d++ != (CHAR_T) *p++) goto fail;
-+ }
-+ while (--mcnt);
-+ }
-+ SET_REGS_MATCHED ();
-+ break;
-+
-+
-+ /* Match any character except possibly a newline or a null. */
-+ case anychar:
-+ DEBUG_PRINT1 ("EXECUTING anychar.\n");
-+
-+ PREFETCH ();
-+
-+ if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
-+ || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
-+ goto fail;
-+
-+ SET_REGS_MATCHED ();
-+ DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d);
-+ d++;
-+ break;
-+
-+
-+ case charset:
-+ case charset_not:
-+ {
-+ register UCHAR_T c;
-+#ifdef WCHAR
-+ unsigned int i, char_class_length, coll_symbol_length,
-+ equiv_class_length, ranges_length, chars_length, length;
-+ CHAR_T *workp, *workp2, *charset_top;
-+#define WORK_BUFFER_SIZE 128
-+ CHAR_T str_buf[WORK_BUFFER_SIZE];
-+# ifdef _LIBC
-+ uint32_t nrules;
-+# endif /* _LIBC */
-+#endif /* WCHAR */
-+ boolean negate = (re_opcode_t) *(p - 1) == charset_not;
-+
-+ DEBUG_PRINT2 ("EXECUTING charset%s.\n", negate ? "_not" : "");
-+ PREFETCH ();
-+ c = TRANSLATE (*d); /* The character to match. */
-+#ifdef WCHAR
-+# ifdef _LIBC
-+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
-+# endif /* _LIBC */
-+ charset_top = p - 1;
-+ char_class_length = *p++;
-+ coll_symbol_length = *p++;
-+ equiv_class_length = *p++;
-+ ranges_length = *p++;
-+ chars_length = *p++;
-+ /* p points charset[6], so the address of the next instruction
-+ (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'],
-+ where l=length of char_classes, m=length of collating_symbol,
-+ n=equivalence_class, o=length of char_range,
-+ p'=length of character. */
-+ workp = p;
-+ /* Update p to indicate the next instruction. */
-+ p += char_class_length + coll_symbol_length+ equiv_class_length +
-+ 2*ranges_length + chars_length;
-+
-+ /* match with char_class? */
-+ for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
-+ {
-+ wctype_t wctype;
-+ uintptr_t alignedp = ((uintptr_t)workp
-+ + __alignof__(wctype_t) - 1)
-+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
-+ wctype = *((wctype_t*)alignedp);
-+ workp += CHAR_CLASS_SIZE;
-+# ifdef _LIBC
-+ if (__iswctype((wint_t)c, wctype))
-+ goto char_set_matched;
-+# else
-+ if (iswctype((wint_t)c, wctype))
-+ goto char_set_matched;
-+# endif
-+ }
-+
-+ /* match with collating_symbol? */
-+# ifdef _LIBC
-+ if (nrules != 0)
-+ {
-+ const unsigned char *extra = (const unsigned char *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
-+
-+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;
-+ workp++)
-+ {
-+ int32_t *wextra;
-+ wextra = (int32_t*)(extra + *workp++);
-+ for (i = 0; i < *wextra; ++i)
-+ if (TRANSLATE(d[i]) != wextra[1 + i])
-+ break;
-+
-+ if (i == *wextra)
-+ {
-+ /* Update d, however d will be incremented at
-+ char_set_matched:, we decrement d here. */
-+ d += i - 1;
-+ goto char_set_matched;
-+ }
-+ }
-+ }
-+ else /* (nrules == 0) */
-+# endif
-+ /* If we can't look up collation data, we use wcscoll
-+ instead. */
-+ {
-+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;)
-+ {
-+ const CHAR_T *backup_d = d, *backup_dend = dend;
-+# ifdef _LIBC
-+ length = __wcslen (workp);
-+# else
-+ length = wcslen (workp);
-+# endif
-+
-+ /* If wcscoll(the collating symbol, whole string) > 0,
-+ any substring of the string never match with the
-+ collating symbol. */
-+# ifdef _LIBC
-+ if (__wcscoll (workp, d) > 0)
-+# else
-+ if (wcscoll (workp, d) > 0)
-+# endif
-+ {
-+ workp += length + 1;
-+ continue;
-+ }
-+
-+ /* First, we compare the collating symbol with
-+ the first character of the string.
-+ If it don't match, we add the next character to
-+ the compare buffer in turn. */
-+ for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++)
-+ {
-+ int match;
-+ if (d == dend)
-+ {
-+ if (dend == end_match_2)
-+ break;
-+ d = string2;
-+ dend = end_match_2;
-+ }
-+
-+ /* add next character to the compare buffer. */
-+ str_buf[i] = TRANSLATE(*d);
-+ str_buf[i+1] = '\0';
-+
-+# ifdef _LIBC
-+ match = __wcscoll (workp, str_buf);
-+# else
-+ match = wcscoll (workp, str_buf);
-+# endif
-+ if (match == 0)
-+ goto char_set_matched;
-+
-+ if (match < 0)
-+ /* (str_buf > workp) indicate (str_buf + X > workp),
-+ because for all X (str_buf + X > str_buf).
-+ So we don't need continue this loop. */
-+ break;
-+
-+ /* Otherwise(str_buf < workp),
-+ (str_buf+next_character) may equals (workp).
-+ So we continue this loop. */
-+ }
-+ /* not matched */
-+ d = backup_d;
-+ dend = backup_dend;
-+ workp += length + 1;
-+ }
-+ }
-+ /* match with equivalence_class? */
-+# ifdef _LIBC
-+ if (nrules != 0)
-+ {
-+ const CHAR_T *backup_d = d, *backup_dend = dend;
-+ /* Try to match the equivalence class against
-+ those known to the collate implementation. */
-+ const int32_t *table;
-+ const int32_t *weights;
-+ const int32_t *extra;
-+ const int32_t *indirect;
-+ int32_t idx, idx2;
-+ wint_t *cp;
-+ size_t len;
-+
-+ table = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
-+ weights = (const wint_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
-+ extra = (const wint_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
-+ indirect = (const int32_t *)
-+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
-+
-+ /* Write 1 collating element to str_buf, and
-+ get its index. */
-+ idx2 = 0;
-+
-+ for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++)
-+ {
-+ cp = (wint_t*)str_buf;
-+ if (d == dend)
-+ {
-+ if (dend == end_match_2)
-+ break;
-+ d = string2;
-+ dend = end_match_2;
-+ }
-+ str_buf[i] = TRANSLATE(*(d+i));
-+ str_buf[i+1] = '\0'; /* sentinel */
-+ idx2 = FINDIDX (table, indirect, extra, &cp, 1);
-+ }
-+
-+ /* Update d, however d will be incremented at
-+ char_set_matched:, we decrement d here. */
-+ d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1);
-+ if (d >= dend)
-+ {
-+ if (dend == end_match_2)
-+ d = dend;
-+ else
-+ {
-+ d = string2;
-+ dend = end_match_2;
-+ }
-+ }
-+
-+ len = weights[idx2];
-+
-+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;
-+ workp++)
-+ {
-+ idx = (int32_t)*workp;
-+ /* We already checked idx != 0 in regex_compile. */
-+
-+ if (idx2 != 0 && len == weights[idx])
-+ {
-+ int cnt = 0;
-+ while (cnt < len && (weights[idx + 1 + cnt]
-+ == weights[idx2 + 1 + cnt]))
-+ ++cnt;
-+
-+ if (cnt == len)
-+ goto char_set_matched;
-+ }
-+ }
-+ /* not matched */
-+ d = backup_d;
-+ dend = backup_dend;
-+ }
-+ else /* (nrules == 0) */
-+# endif
-+ /* If we can't look up collation data, we use wcscoll
-+ instead. */
-+ {
-+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;)
-+ {
-+ const CHAR_T *backup_d = d, *backup_dend = dend;
-+# ifdef _LIBC
-+ length = __wcslen (workp);
-+# else
-+ length = wcslen (workp);
-+# endif
-+
-+ /* If wcscoll(the collating symbol, whole string) > 0,
-+ any substring of the string never match with the
-+ collating symbol. */
-+# ifdef _LIBC
-+ if (__wcscoll (workp, d) > 0)
-+# else
-+ if (wcscoll (workp, d) > 0)
-+# endif
-+ {
-+ workp += length + 1;
-+ break;
-+ }
-+
-+ /* First, we compare the equivalence class with
-+ the first character of the string.
-+ If it don't match, we add the next character to
-+ the compare buffer in turn. */
-+ for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++)
-+ {
-+ int match;
-+ if (d == dend)
-+ {
-+ if (dend == end_match_2)
-+ break;
-+ d = string2;
-+ dend = end_match_2;
-+ }
-+
-+ /* add next character to the compare buffer. */
-+ str_buf[i] = TRANSLATE(*d);
-+ str_buf[i+1] = '\0';
-+
-+# ifdef _LIBC
-+ match = __wcscoll (workp, str_buf);
-+# else
-+ match = wcscoll (workp, str_buf);
-+# endif
-+
-+ if (match == 0)
-+ goto char_set_matched;
-+
-+ if (match < 0)
-+ /* (str_buf > workp) indicate (str_buf + X > workp),
-+ because for all X (str_buf + X > str_buf).
-+ So we don't need continue this loop. */
-+ break;
-+
-+ /* Otherwise(str_buf < workp),
-+ (str_buf+next_character) may equals (workp).
-+ So we continue this loop. */
-+ }
-+ /* not matched */
-+ d = backup_d;
-+ dend = backup_dend;
-+ workp += length + 1;
-+ }
-+ }
-+
-+ /* match with char_range? */
-+# ifdef _LIBC
-+ if (nrules != 0)
-+ {
-+ uint32_t collseqval;
-+ const char *collseq = (const char *)
-+ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
-+
-+ collseqval = collseq_table_lookup (collseq, c);
-+
-+ for (; workp < p - chars_length ;)
-+ {
-+ uint32_t start_val, end_val;
-+
-+ /* We already compute the collation sequence value
-+ of the characters (or collating symbols). */
-+ start_val = (uint32_t) *workp++; /* range_start */
-+ end_val = (uint32_t) *workp++; /* range_end */
-+
-+ if (start_val <= collseqval && collseqval <= end_val)
-+ goto char_set_matched;
-+ }
-+ }
-+ else
-+# endif
-+ {
-+ /* We set range_start_char at str_buf[0], range_end_char
-+ at str_buf[4], and compared char at str_buf[2]. */
-+ str_buf[1] = 0;
-+ str_buf[2] = c;
-+ str_buf[3] = 0;
-+ str_buf[5] = 0;
-+ for (; workp < p - chars_length ;)
-+ {
-+ wchar_t *range_start_char, *range_end_char;
-+
-+ /* match if (range_start_char <= c <= range_end_char). */
-+
-+ /* If range_start(or end) < 0, we assume -range_start(end)
-+ is the offset of the collating symbol which is specified
-+ as the character of the range start(end). */
-+
-+ /* range_start */
-+ if (*workp < 0)
-+ range_start_char = charset_top - (*workp++);
-+ else
-+ {
-+ str_buf[0] = *workp++;
-+ range_start_char = str_buf;
-+ }
-+
-+ /* range_end */
-+ if (*workp < 0)
-+ range_end_char = charset_top - (*workp++);
-+ else
-+ {
-+ str_buf[4] = *workp++;
-+ range_end_char = str_buf + 4;
-+ }
-+
-+# ifdef _LIBC
-+ if (__wcscoll (range_start_char, str_buf+2) <= 0
-+ && __wcscoll (str_buf+2, range_end_char) <= 0)
-+# else
-+ if (wcscoll (range_start_char, str_buf+2) <= 0
-+ && wcscoll (str_buf+2, range_end_char) <= 0)
-+# endif
-+ goto char_set_matched;
-+ }
-+ }
-+
-+ /* match with char? */
-+ for (; workp < p ; workp++)
-+ if (c == *workp)
-+ goto char_set_matched;
-+
-+ negate = !negate;
-+
-+ char_set_matched:
-+ if (negate) goto fail;
-+#else
-+ /* Cast to `unsigned' instead of `unsigned char' in case the
-+ bit list is a full 32 bytes long. */
-+ if (c < (unsigned) (*p * BYTEWIDTH)
-+ && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
-+ negate = !negate;
-+
-+ p += 1 + *p;
-+
-+ if (!negate) goto fail;
-+#undef WORK_BUFFER_SIZE
-+#endif /* WCHAR */
-+ SET_REGS_MATCHED ();
-+ d++;
-+ break;
-+ }
-+
-+
-+ /* The beginning of a group is represented by start_memory.
-+ The arguments are the register number in the next byte, and the
-+ number of groups inner to this one in the next. The text
-+ matched within the group is recorded (in the internal
-+ registers data structure) under the register number. */
-+ case start_memory:
-+ DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n",
-+ (long int) *p, (long int) p[1]);
-+
-+ /* Find out if this group can match the empty string. */
-+ p1 = p; /* To send to group_match_null_string_p. */
-+
-+ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
-+ REG_MATCH_NULL_STRING_P (reg_info[*p])
-+ = PREFIX(group_match_null_string_p) (&p1, pend, reg_info);
-+
-+ /* Save the position in the string where we were the last time
-+ we were at this open-group operator in case the group is
-+ operated upon by a repetition operator, e.g., with `(a*)*b'
-+ against `ab'; then we want to ignore where we are now in
-+ the string in case this attempt to match fails. */
-+ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
-+ ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
-+ : regstart[*p];
-+ DEBUG_PRINT2 (" old_regstart: %d\n",
-+ POINTER_TO_OFFSET (old_regstart[*p]));
-+
-+ regstart[*p] = d;
-+ DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
-+
-+ IS_ACTIVE (reg_info[*p]) = 1;
-+ MATCHED_SOMETHING (reg_info[*p]) = 0;
-+
-+ /* Clear this whenever we change the register activity status. */
-+ set_regs_matched_done = 0;
-+
-+ /* This is the new highest active register. */
-+ highest_active_reg = *p;
-+
-+ /* If nothing was active before, this is the new lowest active
-+ register. */
-+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
-+ lowest_active_reg = *p;
-+
-+ /* Move past the register number and inner group count. */
-+ p += 2;
-+ just_past_start_mem = p;
-+
-+ break;
-+
-+
-+ /* The stop_memory opcode represents the end of a group. Its
-+ arguments are the same as start_memory's: the register
-+ number, and the number of inner groups. */
-+ case stop_memory:
-+ DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n",
-+ (long int) *p, (long int) p[1]);
-+
-+ /* We need to save the string position the last time we were at
-+ this close-group operator in case the group is operated
-+ upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
-+ against `aba'; then we want to ignore where we are now in
-+ the string in case this attempt to match fails. */
-+ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
-+ ? REG_UNSET (regend[*p]) ? d : regend[*p]
-+ : regend[*p];
-+ DEBUG_PRINT2 (" old_regend: %d\n",
-+ POINTER_TO_OFFSET (old_regend[*p]));
-+
-+ regend[*p] = d;
-+ DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
-+
-+ /* This register isn't active anymore. */
-+ IS_ACTIVE (reg_info[*p]) = 0;
-+
-+ /* Clear this whenever we change the register activity status. */
-+ set_regs_matched_done = 0;
-+
-+ /* If this was the only register active, nothing is active
-+ anymore. */
-+ if (lowest_active_reg == highest_active_reg)
-+ {
-+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
-+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-+ }
-+ else
-+ { /* We must scan for the new highest active register, since
-+ it isn't necessarily one less than now: consider
-+ (a(b)c(d(e)f)g). When group 3 ends, after the f), the
-+ new highest active register is 1. */
-+ UCHAR_T r = *p - 1;
-+ while (r > 0 && !IS_ACTIVE (reg_info[r]))
-+ r--;
-+
-+ /* If we end up at register zero, that means that we saved
-+ the registers as the result of an `on_failure_jump', not
-+ a `start_memory', and we jumped to past the innermost
-+ `stop_memory'. For example, in ((.)*) we save
-+ registers 1 and 2 as a result of the *, but when we pop
-+ back to the second ), we are at the stop_memory 1.
-+ Thus, nothing is active. */
-+ if (r == 0)
-+ {
-+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
-+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
-+ }
-+ else
-+ highest_active_reg = r;
-+ }
-+
-+ /* If just failed to match something this time around with a
-+ group that's operated on by a repetition operator, try to
-+ force exit from the ``loop'', and restore the register
-+ information for this group that we had before trying this
-+ last match. */
-+ if ((!MATCHED_SOMETHING (reg_info[*p])
-+ || just_past_start_mem == p - 1)
-+ && (p + 2) < pend)
-+ {
-+ boolean is_a_jump_n = false;
-+
-+ p1 = p + 2;
-+ mcnt = 0;
-+ switch ((re_opcode_t) *p1++)
-+ {
-+ case jump_n:
-+ is_a_jump_n = true;
-+ case pop_failure_jump:
-+ case maybe_pop_jump:
-+ case jump:
-+ case dummy_failure_jump:
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ if (is_a_jump_n)
-+ p1 += OFFSET_ADDRESS_SIZE;
-+ break;
-+
-+ default:
-+ /* do nothing */ ;
-+ }
-+ p1 += mcnt;
-+
-+ /* If the next operation is a jump backwards in the pattern
-+ to an on_failure_jump right before the start_memory
-+ corresponding to this stop_memory, exit from the loop
-+ by forcing a failure after pushing on the stack the
-+ on_failure_jump's jump in the pattern, and d. */
-+ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
-+ && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory
-+ && p1[2+OFFSET_ADDRESS_SIZE] == *p)
-+ {
-+ /* If this group ever matched anything, then restore
-+ what its registers were before trying this last
-+ failed match, e.g., with `(a*)*b' against `ab' for
-+ regstart[1], and, e.g., with `((a*)*(b*)*)*'
-+ against `aba' for regend[3].
-+
-+ Also restore the registers for inner groups for,
-+ e.g., `((a*)(b*))*' against `aba' (register 3 would
-+ otherwise get trashed). */
-+
-+ if (EVER_MATCHED_SOMETHING (reg_info[*p]))
-+ {
-+ unsigned r;
-+
-+ EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
-+
-+ /* Restore this and inner groups' (if any) registers. */
-+ for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1);
-+ r++)
-+ {
-+ regstart[r] = old_regstart[r];
-+
-+ /* xx why this test? */
-+ if (old_regend[r] >= regstart[r])
-+ regend[r] = old_regend[r];
-+ }
-+ }
-+ p1++;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
-+
-+ goto fail;
-+ }
-+ }
-+
-+ /* Move past the register number and the inner group count. */
-+ p += 2;
-+ break;
-+
-+
-+ /* \<digit> has been turned into a `duplicate' command which is
-+ followed by the numeric value of <digit> as the register number. */
-+ case duplicate:
-+ {
-+ register const CHAR_T *d2, *dend2;
-+ int regno = *p++; /* Get which register to match against. */
-+ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
-+
-+ /* Can't back reference a group which we've never matched. */
-+ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
-+ goto fail;
-+
-+ /* Where in input to try to start matching. */
-+ d2 = regstart[regno];
-+
-+ /* Where to stop matching; if both the place to start and
-+ the place to stop matching are in the same string, then
-+ set to the place to stop, otherwise, for now have to use
-+ the end of the first string. */
-+
-+ dend2 = ((FIRST_STRING_P (regstart[regno])
-+ == FIRST_STRING_P (regend[regno]))
-+ ? regend[regno] : end_match_1);
-+ for (;;)
-+ {
-+ /* If necessary, advance to next segment in register
-+ contents. */
-+ while (d2 == dend2)
-+ {
-+ if (dend2 == end_match_2) break;
-+ if (dend2 == regend[regno]) break;
-+
-+ /* End of string1 => advance to string2. */
-+ d2 = string2;
-+ dend2 = regend[regno];
-+ }
-+ /* At end of register contents => success */
-+ if (d2 == dend2) break;
-+
-+ /* If necessary, advance to next segment in data. */
-+ PREFETCH ();
-+
-+ /* How many characters left in this segment to match. */
-+ mcnt = dend - d;
-+
-+ /* Want how many consecutive characters we can match in
-+ one shot, so, if necessary, adjust the count. */
-+ if (mcnt > dend2 - d2)
-+ mcnt = dend2 - d2;
-+
-+ /* Compare that many; failure if mismatch, else move
-+ past them. */
-+ if (translate
-+ ? PREFIX(bcmp_translate) (d, d2, mcnt, translate)
-+ : memcmp (d, d2, mcnt*sizeof(UCHAR_T)))
-+ goto fail;
-+ d += mcnt, d2 += mcnt;
-+
-+ /* Do this because we've match some characters. */
-+ SET_REGS_MATCHED ();
-+ }
-+ }
-+ break;
-+
-+
-+ /* begline matches the empty string at the beginning of the string
-+ (unless `not_bol' is set in `bufp'), and, if
-+ `newline_anchor' is set, after newlines. */
-+ case begline:
-+ DEBUG_PRINT1 ("EXECUTING begline.\n");
-+
-+ if (AT_STRINGS_BEG (d))
-+ {
-+ if (!bufp->not_bol) break;
-+ }
-+ else if (d[-1] == '\n' && bufp->newline_anchor)
-+ {
-+ break;
-+ }
-+ /* In all other cases, we fail. */
-+ goto fail;
-+
-+
-+ /* endline is the dual of begline. */
-+ case endline:
-+ DEBUG_PRINT1 ("EXECUTING endline.\n");
-+
-+ if (AT_STRINGS_END (d))
-+ {
-+ if (!bufp->not_eol) break;
-+ }
-+
-+ /* We have to ``prefetch'' the next character. */
-+ else if ((d == end1 ? *string2 : *d) == '\n'
-+ && bufp->newline_anchor)
-+ {
-+ break;
-+ }
-+ goto fail;
-+
-+
-+ /* Match at the very beginning of the data. */
-+ case begbuf:
-+ DEBUG_PRINT1 ("EXECUTING begbuf.\n");
-+ if (AT_STRINGS_BEG (d))
-+ break;
-+ goto fail;
-+
-+
-+ /* Match at the very end of the data. */
-+ case endbuf:
-+ DEBUG_PRINT1 ("EXECUTING endbuf.\n");
-+ if (AT_STRINGS_END (d))
-+ break;
-+ goto fail;
-+
-+
-+ /* on_failure_keep_string_jump is used to optimize `.*\n'. It
-+ pushes NULL as the value for the string on the stack. Then
-+ `pop_failure_point' will keep the current value for the
-+ string, instead of restoring it. To see why, consider
-+ matching `foo\nbar' against `.*\n'. The .* matches the foo;
-+ then the . fails against the \n. But the next thing we want
-+ to do is match the \n against the \n; if we restored the
-+ string value, we would be back at the foo.
-+
-+ Because this is used only in specific cases, we don't need to
-+ check all the things that `on_failure_jump' does, to make
-+ sure the right things get saved on the stack. Hence we don't
-+ share its code. The only reason to push anything on the
-+ stack at all is that otherwise we would have to change
-+ `anychar's code to do something besides goto fail in this
-+ case; that seems worse than this. */
-+ case on_failure_keep_string_jump:
-+ DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
-+
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
-+#ifdef _LIBC
-+ DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
-+#else
-+ DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
-+#endif
-+
-+ PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
-+ break;
-+
-+
-+ /* Uses of on_failure_jump:
-+
-+ Each alternative starts with an on_failure_jump that points
-+ to the beginning of the next alternative. Each alternative
-+ except the last ends with a jump that in effect jumps past
-+ the rest of the alternatives. (They really jump to the
-+ ending jump of the following alternative, because tensioning
-+ these jumps is a hassle.)
-+
-+ Repeats start with an on_failure_jump that points past both
-+ the repetition text and either the following jump or
-+ pop_failure_jump back to this on_failure_jump. */
-+ case on_failure_jump:
-+ on_failure:
-+ DEBUG_PRINT1 ("EXECUTING on_failure_jump");
-+
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
-+#ifdef _LIBC
-+ DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
-+#else
-+ DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
-+#endif
-+
-+ /* If this on_failure_jump comes right before a group (i.e.,
-+ the original * applied to a group), save the information
-+ for that group and all inner ones, so that if we fail back
-+ to this point, the group's information will be correct.
-+ For example, in \(a*\)*\1, we need the preceding group,
-+ and in \(zz\(a*\)b*\)\2, we need the inner group. */
-+
-+ /* We can't use `p' to check ahead because we push
-+ a failure point to `p + mcnt' after we do this. */
-+ p1 = p;
-+
-+ /* We need to skip no_op's before we look for the
-+ start_memory in case this on_failure_jump is happening as
-+ the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
-+ against aba. */
-+ while (p1 < pend && (re_opcode_t) *p1 == no_op)
-+ p1++;
-+
-+ if (p1 < pend && (re_opcode_t) *p1 == start_memory)
-+ {
-+ /* We have a new highest active register now. This will
-+ get reset at the start_memory we are about to get to,
-+ but we will have saved all the registers relevant to
-+ this repetition op, as described above. */
-+ highest_active_reg = *(p1 + 1) + *(p1 + 2);
-+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
-+ lowest_active_reg = *(p1 + 1);
-+ }
-+
-+ DEBUG_PRINT1 (":\n");
-+ PUSH_FAILURE_POINT (p + mcnt, d, -2);
-+ break;
-+
-+
-+ /* A smart repeat ends with `maybe_pop_jump'.
-+ We change it to either `pop_failure_jump' or `jump'. */
-+ case maybe_pop_jump:
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
-+ DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
-+ {
-+ register UCHAR_T *p2 = p;
-+
-+ /* Compare the beginning of the repeat with what in the
-+ pattern follows its end. If we can establish that there
-+ is nothing that they would both match, i.e., that we
-+ would have to backtrack because of (as in, e.g., `a*a')
-+ then we can change to pop_failure_jump, because we'll
-+ never have to backtrack.
-+
-+ This is not true in the case of alternatives: in
-+ `(a|ab)*' we do need to backtrack to the `ab' alternative
-+ (e.g., if the string was `ab'). But instead of trying to
-+ detect that here, the alternative has put on a dummy
-+ failure point which is what we will end up popping. */
-+
-+ /* Skip over open/close-group commands.
-+ If what follows this loop is a ...+ construct,
-+ look at what begins its body, since we will have to
-+ match at least one of that. */
-+ while (1)
-+ {
-+ if (p2 + 2 < pend
-+ && ((re_opcode_t) *p2 == stop_memory
-+ || (re_opcode_t) *p2 == start_memory))
-+ p2 += 3;
-+ else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend
-+ && (re_opcode_t) *p2 == dummy_failure_jump)
-+ p2 += 2 + 2 * OFFSET_ADDRESS_SIZE;
-+ else
-+ break;
-+ }
-+
-+ p1 = p + mcnt;
-+ /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
-+ to the `maybe_finalize_jump' of this case. Examine what
-+ follows. */
-+
-+ /* If we're at the end of the pattern, we can change. */
-+ if (p2 == pend)
-+ {
-+ /* Consider what happens when matching ":\(.*\)"
-+ against ":/". I don't really understand this code
-+ yet. */
-+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
-+ pop_failure_jump;
-+ DEBUG_PRINT1
-+ (" End of pattern: change to `pop_failure_jump'.\n");
-+ }
-+
-+ else if ((re_opcode_t) *p2 == exactn
-+#ifdef MBS_SUPPORT
-+ || (re_opcode_t) *p2 == exactn_bin
-+#endif
-+ || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
-+ {
-+ register UCHAR_T c
-+ = *p2 == (UCHAR_T) endline ? '\n' : p2[2];
-+
-+ if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn
-+#ifdef MBS_SUPPORT
-+ || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin
-+#endif
-+ ) && p1[3+OFFSET_ADDRESS_SIZE] != c)
-+ {
-+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
-+ pop_failure_jump;
-+#ifdef WCHAR
-+ DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n",
-+ (wint_t) c,
-+ (wint_t) p1[3+OFFSET_ADDRESS_SIZE]);
-+#else
-+ DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
-+ (char) c,
-+ (char) p1[3+OFFSET_ADDRESS_SIZE]);
-+#endif
-+ }
-+
-+#ifndef WCHAR
-+ else if ((re_opcode_t) p1[3] == charset
-+ || (re_opcode_t) p1[3] == charset_not)
-+ {
-+ int negate = (re_opcode_t) p1[3] == charset_not;
-+
-+ if (c < (unsigned) (p1[4] * BYTEWIDTH)
-+ && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
-+ negate = !negate;
-+
-+ /* `negate' is equal to 1 if c would match, which means
-+ that we can't change to pop_failure_jump. */
-+ if (!negate)
-+ {
-+ p[-3] = (unsigned char) pop_failure_jump;
-+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
-+ }
-+ }
-+#endif /* not WCHAR */
-+ }
-+#ifndef WCHAR
-+ else if ((re_opcode_t) *p2 == charset)
-+ {
-+ /* We win if the first character of the loop is not part
-+ of the charset. */
-+ if ((re_opcode_t) p1[3] == exactn
-+ && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
-+ && (p2[2 + p1[5] / BYTEWIDTH]
-+ & (1 << (p1[5] % BYTEWIDTH)))))
-+ {
-+ p[-3] = (unsigned char) pop_failure_jump;
-+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
-+ }
-+
-+ else if ((re_opcode_t) p1[3] == charset_not)
-+ {
-+ int idx;
-+ /* We win if the charset_not inside the loop
-+ lists every character listed in the charset after. */
-+ for (idx = 0; idx < (int) p2[1]; idx++)
-+ if (! (p2[2 + idx] == 0
-+ || (idx < (int) p1[4]
-+ && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
-+ break;
-+
-+ if (idx == p2[1])
-+ {
-+ p[-3] = (unsigned char) pop_failure_jump;
-+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
-+ }
-+ }
-+ else if ((re_opcode_t) p1[3] == charset)
-+ {
-+ int idx;
-+ /* We win if the charset inside the loop
-+ has no overlap with the one after the loop. */
-+ for (idx = 0;
-+ idx < (int) p2[1] && idx < (int) p1[4];
-+ idx++)
-+ if ((p2[2 + idx] & p1[5 + idx]) != 0)
-+ break;
-+
-+ if (idx == p2[1] || idx == p1[4])
-+ {
-+ p[-3] = (unsigned char) pop_failure_jump;
-+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
-+ }
-+ }
-+ }
-+#endif /* not WCHAR */
-+ }
-+ p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */
-+ if ((re_opcode_t) p[-1] != pop_failure_jump)
-+ {
-+ p[-1] = (UCHAR_T) jump;
-+ DEBUG_PRINT1 (" Match => jump.\n");
-+ goto unconditional_jump;
-+ }
-+ /* Note fall through. */
-+
-+
-+ /* The end of a simple repeat has a pop_failure_jump back to
-+ its matching on_failure_jump, where the latter will push a
-+ failure point. The pop_failure_jump takes off failure
-+ points put on by this pop_failure_jump's matching
-+ on_failure_jump; we got through the pattern to here from the
-+ matching on_failure_jump, so didn't fail. */
-+ case pop_failure_jump:
-+ {
-+ /* We need to pass separate storage for the lowest and
-+ highest registers, even though we don't care about the
-+ actual values. Otherwise, we will restore only one
-+ register from the stack, since lowest will == highest in
-+ `pop_failure_point'. */
-+ active_reg_t dummy_low_reg, dummy_high_reg;
-+ UCHAR_T *pdummy __attribute__ ((unused)) = NULL;
-+ const CHAR_T *sdummy __attribute__ ((unused)) = NULL;
-+
-+ DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
-+ POP_FAILURE_POINT (sdummy, pdummy,
-+ dummy_low_reg, dummy_high_reg,
-+ reg_dummy, reg_dummy, reg_info_dummy);
-+ }
-+ /* Note fall through. */
-+
-+ unconditional_jump:
-+#ifdef _LIBC
-+ DEBUG_PRINT2 ("\n%p: ", p);
-+#else
-+ DEBUG_PRINT2 ("\n0x%x: ", p);
-+#endif
-+ /* Note fall through. */
-+
-+ /* Unconditionally jump (without popping any failure points). */
-+ case jump:
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
-+ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
-+ p += mcnt; /* Do the jump. */
-+#ifdef _LIBC
-+ DEBUG_PRINT2 ("(to %p).\n", p);
-+#else
-+ DEBUG_PRINT2 ("(to 0x%x).\n", p);
-+#endif
-+ break;
-+
-+
-+ /* We need this opcode so we can detect where alternatives end
-+ in `group_match_null_string_p' et al. */
-+ case jump_past_alt:
-+ DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
-+ goto unconditional_jump;
-+
-+
-+ /* Normally, the on_failure_jump pushes a failure point, which
-+ then gets popped at pop_failure_jump. We will end up at
-+ pop_failure_jump, also, and with a pattern of, say, `a+', we
-+ are skipping over the on_failure_jump, so we have to push
-+ something meaningless for pop_failure_jump to pop. */
-+ case dummy_failure_jump:
-+ DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
-+ /* It doesn't matter what we push for the string here. What
-+ the code at `fail' tests is the value for the pattern. */
-+ PUSH_FAILURE_POINT (NULL, NULL, -2);
-+ goto unconditional_jump;
-+
-+
-+ /* At the end of an alternative, we need to push a dummy failure
-+ point in case we are followed by a `pop_failure_jump', because
-+ we don't want the failure point for the alternative to be
-+ popped. For example, matching `(a|ab)*' against `aab'
-+ requires that we match the `ab' alternative. */
-+ case push_dummy_failure:
-+ DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
-+ /* See comments just above at `dummy_failure_jump' about the
-+ two zeroes. */
-+ PUSH_FAILURE_POINT (NULL, NULL, -2);
-+ break;
-+
-+ /* Have to succeed matching what follows at least n times.
-+ After that, handle like `on_failure_jump'. */
-+ case succeed_n:
-+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
-+ DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
-+
-+ assert (mcnt >= 0);
-+ /* Originally, this is how many times we HAVE to succeed. */
-+ if (mcnt > 0)
-+ {
-+ mcnt--;
-+ p += OFFSET_ADDRESS_SIZE;
-+ STORE_NUMBER_AND_INCR (p, mcnt);
-+#ifdef _LIBC
-+ DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE
-+ , mcnt);
-+#else
-+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE
-+ , mcnt);
-+#endif
-+ }
-+ else if (mcnt == 0)
-+ {
-+#ifdef _LIBC
-+ DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n",
-+ p + OFFSET_ADDRESS_SIZE);
-+#else
-+ DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n",
-+ p + OFFSET_ADDRESS_SIZE);
-+#endif /* _LIBC */
-+
-+#ifdef WCHAR
-+ p[1] = (UCHAR_T) no_op;
-+#else
-+ p[2] = (UCHAR_T) no_op;
-+ p[3] = (UCHAR_T) no_op;
-+#endif /* WCHAR */
-+ goto on_failure;
-+ }
-+ break;
-+
-+ case jump_n:
-+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
-+ DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
-+
-+ /* Originally, this is how many times we CAN jump. */
-+ if (mcnt)
-+ {
-+ mcnt--;
-+ STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt);
-+
-+#ifdef _LIBC
-+ DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE,
-+ mcnt);
-+#else
-+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE,
-+ mcnt);
-+#endif /* _LIBC */
-+ goto unconditional_jump;
-+ }
-+ /* If don't have to jump any more, skip over the rest of command. */
-+ else
-+ p += 2 * OFFSET_ADDRESS_SIZE;
-+ break;
-+
-+ case set_number_at:
-+ {
-+ DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
-+
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
-+ p1 = p + mcnt;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
-+#ifdef _LIBC
-+ DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
-+#else
-+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
-+#endif
-+ STORE_NUMBER (p1, mcnt);
-+ break;
-+ }
-+
-+#if 0
-+ /* The DEC Alpha C compiler 3.x generates incorrect code for the
-+ test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
-+ AT_WORD_BOUNDARY, so this code is disabled. Expanding the
-+ macro and introducing temporary variables works around the bug. */
-+
-+ case wordbound:
-+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
-+ if (AT_WORD_BOUNDARY (d))
-+ break;
-+ goto fail;
-+
-+ case notwordbound:
-+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
-+ if (AT_WORD_BOUNDARY (d))
-+ goto fail;
-+ break;
-+#else
-+ case wordbound:
-+ {
-+ boolean prevchar, thischar;
-+
-+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
-+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
-+ break;
-+
-+ prevchar = WORDCHAR_P (d - 1);
-+ thischar = WORDCHAR_P (d);
-+ if (prevchar != thischar)
-+ break;
-+ goto fail;
-+ }
-+
-+ case notwordbound:
-+ {
-+ boolean prevchar, thischar;
-+
-+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
-+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
-+ goto fail;
-+
-+ prevchar = WORDCHAR_P (d - 1);
-+ thischar = WORDCHAR_P (d);
-+ if (prevchar != thischar)
-+ goto fail;
-+ break;
-+ }
-+#endif
-+
-+ case wordbeg:
-+ DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
-+ if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
-+ && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
-+ break;
-+ goto fail;
-+
-+ case wordend:
-+ DEBUG_PRINT1 ("EXECUTING wordend.\n");
-+ if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
-+ && (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
-+ break;
-+ goto fail;
-+
-+#ifdef emacs
-+ case before_dot:
-+ DEBUG_PRINT1 ("EXECUTING before_dot.\n");
-+ if (PTR_CHAR_POS ((unsigned char *) d) >= point)
-+ goto fail;
-+ break;
-+
-+ case at_dot:
-+ DEBUG_PRINT1 ("EXECUTING at_dot.\n");
-+ if (PTR_CHAR_POS ((unsigned char *) d) != point)
-+ goto fail;
-+ break;
-+
-+ case after_dot:
-+ DEBUG_PRINT1 ("EXECUTING after_dot.\n");
-+ if (PTR_CHAR_POS ((unsigned char *) d) <= point)
-+ goto fail;
-+ break;
-+
-+ case syntaxspec:
-+ DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
-+ mcnt = *p++;
-+ goto matchsyntax;
-+
-+ case wordchar:
-+ DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
-+ mcnt = (int) Sword;
-+ matchsyntax:
-+ PREFETCH ();
-+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
-+ d++;
-+ if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt)
-+ goto fail;
-+ SET_REGS_MATCHED ();
-+ break;
-+
-+ case notsyntaxspec:
-+ DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
-+ mcnt = *p++;
-+ goto matchnotsyntax;
-+
-+ case notwordchar:
-+ DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
-+ mcnt = (int) Sword;
-+ matchnotsyntax:
-+ PREFETCH ();
-+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
-+ d++;
-+ if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt)
-+ goto fail;
-+ SET_REGS_MATCHED ();
-+ break;
-+
-+#else /* not emacs */
-+ case wordchar:
-+ DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
-+ PREFETCH ();
-+ if (!WORDCHAR_P (d))
-+ goto fail;
-+ SET_REGS_MATCHED ();
-+ d++;
-+ break;
-+
-+ case notwordchar:
-+ DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
-+ PREFETCH ();
-+ if (WORDCHAR_P (d))
-+ goto fail;
-+ SET_REGS_MATCHED ();
-+ d++;
-+ break;
-+#endif /* not emacs */
-+
-+ default:
-+ abort ();
-+ }
-+ continue; /* Successfully executed one pattern command; keep going. */
-+
-+
-+ /* We goto here if a matching operation fails. */
-+ fail:
-+ if (!FAIL_STACK_EMPTY ())
-+ { /* A restart point is known. Restore to that state. */
-+ DEBUG_PRINT1 ("\nFAIL:\n");
-+ POP_FAILURE_POINT (d, p,
-+ lowest_active_reg, highest_active_reg,
-+ regstart, regend, reg_info);
-+
-+ /* If this failure point is a dummy, try the next one. */
-+ if (!p)
-+ goto fail;
-+
-+ /* If we failed to the end of the pattern, don't examine *p. */
-+ assert (p <= pend);
-+ if (p < pend)
-+ {
-+ boolean is_a_jump_n = false;
-+
-+ /* If failed to a backwards jump that's part of a repetition
-+ loop, need to pop this failure point and use the next one. */
-+ switch ((re_opcode_t) *p)
-+ {
-+ case jump_n:
-+ is_a_jump_n = true;
-+ case maybe_pop_jump:
-+ case pop_failure_jump:
-+ case jump:
-+ p1 = p + 1;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ p1 += mcnt;
-+
-+ if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
-+ || (!is_a_jump_n
-+ && (re_opcode_t) *p1 == on_failure_jump))
-+ goto fail;
-+ break;
-+ default:
-+ /* do nothing */ ;
-+ }
-+ }
-+
-+ if (d >= string1 && d <= end1)
-+ dend = end_match_1;
-+ }
-+ else
-+ break; /* Matching at this starting point really fails. */
-+ } /* for (;;) */
-+
-+ if (best_regs_set)
-+ goto restore_best_regs;
-+
-+ FREE_VARIABLES ();
-+
-+ return -1; /* Failure to match. */
-+} /* re_match_2 */
-+
-+/* Subroutine definitions for re_match_2. */
-+
-+
-+/* We are passed P pointing to a register number after a start_memory.
-+
-+ Return true if the pattern up to the corresponding stop_memory can
-+ match the empty string, and false otherwise.
-+
-+ If we find the matching stop_memory, sets P to point to one past its number.
-+ Otherwise, sets P to an undefined byte less than or equal to END.
-+
-+ We don't handle duplicates properly (yet). */
-+
-+static boolean
-+PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info)
-+{
-+ int mcnt;
-+ /* Point to after the args to the start_memory. */
-+ UCHAR_T *p1 = *p + 2;
-+
-+ while (p1 < end)
-+ {
-+ /* Skip over opcodes that can match nothing, and return true or
-+ false, as appropriate, when we get to one that can't, or to the
-+ matching stop_memory. */
-+
-+ switch ((re_opcode_t) *p1)
-+ {
-+ /* Could be either a loop or a series of alternatives. */
-+ case on_failure_jump:
-+ p1++;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+
-+ /* If the next operation is not a jump backwards in the
-+ pattern. */
-+
-+ if (mcnt >= 0)
-+ {
-+ /* Go through the on_failure_jumps of the alternatives,
-+ seeing if any of the alternatives cannot match nothing.
-+ The last alternative starts with only a jump,
-+ whereas the rest start with on_failure_jump and end
-+ with a jump, e.g., here is the pattern for `a|b|c':
-+
-+ /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
-+ /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
-+ /exactn/1/c
-+
-+ So, we have to first go through the first (n-1)
-+ alternatives and then deal with the last one separately. */
-+
-+
-+ /* Deal with the first (n-1) alternatives, which start
-+ with an on_failure_jump (see above) that jumps to right
-+ past a jump_past_alt. */
-+
-+ while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] ==
-+ jump_past_alt)
-+ {
-+ /* `mcnt' holds how many bytes long the alternative
-+ is, including the ending `jump_past_alt' and
-+ its number. */
-+
-+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt -
-+ (1 + OFFSET_ADDRESS_SIZE),
-+ reg_info))
-+ return false;
-+
-+ /* Move to right after this alternative, including the
-+ jump_past_alt. */
-+ p1 += mcnt;
-+
-+ /* Break if it's the beginning of an n-th alternative
-+ that doesn't begin with an on_failure_jump. */
-+ if ((re_opcode_t) *p1 != on_failure_jump)
-+ break;
-+
-+ /* Still have to check that it's not an n-th
-+ alternative that starts with an on_failure_jump. */
-+ p1++;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] !=
-+ jump_past_alt)
-+ {
-+ /* Get to the beginning of the n-th alternative. */
-+ p1 -= 1 + OFFSET_ADDRESS_SIZE;
-+ break;
-+ }
-+ }
-+
-+ /* Deal with the last alternative: go back and get number
-+ of the `jump_past_alt' just before it. `mcnt' contains
-+ the length of the alternative. */
-+ EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE);
-+
-+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt, reg_info))
-+ return false;
-+
-+ p1 += mcnt; /* Get past the n-th alternative. */
-+ } /* if mcnt > 0 */
-+ break;
-+
-+
-+ case stop_memory:
-+ assert (p1[1] == **p);
-+ *p = p1 + 2;
-+ return true;
-+
-+
-+ default:
-+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
-+ return false;
-+ }
-+ } /* while p1 < end */
-+
-+ return false;
-+} /* group_match_null_string_p */
-+
-+
-+/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
-+ It expects P to be the first byte of a single alternative and END one
-+ byte past the last. The alternative can contain groups. */
-+
-+static boolean
-+PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info)
-+{
-+ int mcnt;
-+ UCHAR_T *p1 = p;
-+
-+ while (p1 < end)
-+ {
-+ /* Skip over opcodes that can match nothing, and break when we get
-+ to one that can't. */
-+
-+ switch ((re_opcode_t) *p1)
-+ {
-+ /* It's a loop. */
-+ case on_failure_jump:
-+ p1++;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ p1 += mcnt;
-+ break;
-+
-+ default:
-+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
-+ return false;
-+ }
-+ } /* while p1 < end */
-+
-+ return true;
-+} /* alt_match_null_string_p */
-+
-+
-+/* Deals with the ops common to group_match_null_string_p and
-+ alt_match_null_string_p.
-+
-+ Sets P to one after the op and its arguments, if any. */
-+
-+static boolean
-+PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
-+ PREFIX(register_info_type) *reg_info)
-+{
-+ int mcnt;
-+ boolean ret;
-+ int reg_no;
-+ UCHAR_T *p1 = *p;
-+
-+ switch ((re_opcode_t) *p1++)
-+ {
-+ case no_op:
-+ case begline:
-+ case endline:
-+ case begbuf:
-+ case endbuf:
-+ case wordbeg:
-+ case wordend:
-+ case wordbound:
-+ case notwordbound:
-+#ifdef emacs
-+ case before_dot:
-+ case at_dot:
-+ case after_dot:
-+#endif
-+ break;
-+
-+ case start_memory:
-+ reg_no = *p1;
-+ assert (reg_no > 0 && reg_no <= MAX_REGNUM);
-+ ret = PREFIX(group_match_null_string_p) (&p1, end, reg_info);
-+
-+ /* Have to set this here in case we're checking a group which
-+ contains a group and a back reference to it. */
-+
-+ if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
-+ REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
-+
-+ if (!ret)
-+ return false;
-+ break;
-+
-+ /* If this is an optimized succeed_n for zero times, make the jump. */
-+ case jump:
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ if (mcnt >= 0)
-+ p1 += mcnt;
-+ else
-+ return false;
-+ break;
-+
-+ case succeed_n:
-+ /* Get to the number of times to succeed. */
-+ p1 += OFFSET_ADDRESS_SIZE;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+
-+ if (mcnt == 0)
-+ {
-+ p1 -= 2 * OFFSET_ADDRESS_SIZE;
-+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
-+ p1 += mcnt;
-+ }
-+ else
-+ return false;
-+ break;
-+
-+ case duplicate:
-+ if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
-+ return false;
-+ break;
-+
-+ case set_number_at:
-+ p1 += 2 * OFFSET_ADDRESS_SIZE;
-+
-+ default:
-+ /* All other opcodes mean we cannot match the empty string. */
-+ return false;
-+ }
-+
-+ *p = p1;
-+ return true;
-+} /* common_op_match_null_string_p */
-+
-+
-+/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
-+ bytes; nonzero otherwise. */
-+
-+static int
-+PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, register int len,
-+ RE_TRANSLATE_TYPE translate)
-+{
-+ register const UCHAR_T *p1 = (const UCHAR_T *) s1;
-+ register const UCHAR_T *p2 = (const UCHAR_T *) s2;
-+ while (len)
-+ {
-+#ifdef WCHAR
-+ if (((*p1<=0xff)?translate[*p1++]:*p1++)
-+ != ((*p2<=0xff)?translate[*p2++]:*p2++))
-+ return 1;
-+#else /* BYTE */
-+ if (translate[*p1++] != translate[*p2++]) return 1;
-+#endif /* WCHAR */
-+ len--;
-+ }
-+ return 0;
-+}
-+
-+
-+#else /* not INSIDE_RECURSION */
-+
-+/* Entry points for GNU code. */
-+
-+/* re_compile_pattern is the GNU regular expression compiler: it
-+ compiles PATTERN (of length SIZE) and puts the result in BUFP.
-+ Returns 0 if the pattern was valid, otherwise an error string.
-+
-+ Assumes the `allocated' (and perhaps `buffer') and `translate' fields
-+ are set in BUFP on entry.
-+
-+ We call regex_compile to do the actual compilation. */
-+
-+const char *
-+re_compile_pattern (const char *pattern, size_t length,
-+ struct re_pattern_buffer *bufp)
-+{
-+ reg_errcode_t ret;
-+
-+ /* GNU code is written to assume at least RE_NREGS registers will be set
-+ (and at least one extra will be -1). */
-+ bufp->regs_allocated = REGS_UNALLOCATED;
-+
-+ /* And GNU code determines whether or not to get register information
-+ by passing null for the REGS argument to re_match, etc., not by
-+ setting no_sub. */
-+ bufp->no_sub = 0;
-+
-+ /* Match anchors at newline. */
-+ bufp->newline_anchor = 1;
-+
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
-+ else
-+# endif
-+ ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
-+
-+ if (!ret)
-+ return NULL;
-+ return gettext (re_error_msgid[(int) ret]);
-+}
-+#ifdef _LIBC
-+weak_alias (__re_compile_pattern, re_compile_pattern)
-+#endif
-+
-+/* Entry points compatible with 4.2 BSD regex library. We don't define
-+ them unless specifically requested. */
-+
-+#if defined _REGEX_RE_COMP || defined _LIBC
-+
-+/* BSD has one and only one pattern buffer. */
-+static struct re_pattern_buffer re_comp_buf;
-+
-+char *
-+#ifdef _LIBC
-+/* Make these definitions weak in libc, so POSIX programs can redefine
-+ these names if they don't use our functions, and still use
-+ regcomp/regexec below without link errors. */
-+weak_function
-+#endif
-+re_comp (const char *s)
-+{
-+ reg_errcode_t ret;
-+
-+ if (!s)
-+ {
-+ if (!re_comp_buf.buffer)
-+ return (char *) gettext ("No previous regular expression");
-+ return 0;
-+ }
-+
-+ if (!re_comp_buf.buffer)
-+ {
-+ re_comp_buf.buffer = (unsigned char *) malloc (200);
-+ if (re_comp_buf.buffer == NULL)
-+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
-+ re_comp_buf.allocated = 200;
-+
-+ re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
-+ if (re_comp_buf.fastmap == NULL)
-+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
-+ }
-+
-+ /* Since `re_exec' always passes NULL for the `regs' argument, we
-+ don't need to initialize the pattern buffer fields which affect it. */
-+
-+ /* Match anchors at newlines. */
-+ re_comp_buf.newline_anchor = 1;
-+
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ ret = wcs_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-+ else
-+# endif
-+ ret = byte_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
-+
-+ if (!ret)
-+ return NULL;
-+
-+ /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
-+ return (char *) gettext (re_error_msgid[(int) ret]);
-+}
-+
-+
-+int
-+#ifdef _LIBC
-+weak_function
-+#endif
-+re_exec (const char *s)
-+{
-+ const int len = strlen (s);
-+ return
-+ 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
-+}
-+
-+#endif /* _REGEX_RE_COMP */
-+
-+/* POSIX.2 functions. Don't define these for Emacs. */
-+
-+#ifndef emacs
-+
-+/* regcomp takes a regular expression as a string and compiles it.
-+
-+ PREG is a regex_t *. We do not expect any fields to be initialized,
-+ since POSIX says we shouldn't. Thus, we set
-+
-+ `buffer' to the compiled pattern;
-+ `used' to the length of the compiled pattern;
-+ `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
-+ REG_EXTENDED bit in CFLAGS is set; otherwise, to
-+ RE_SYNTAX_POSIX_BASIC;
-+ `newline_anchor' to REG_NEWLINE being set in CFLAGS;
-+ `fastmap' to an allocated space for the fastmap;
-+ `fastmap_accurate' to zero;
-+ `re_nsub' to the number of subexpressions in PATTERN.
-+
-+ PATTERN is the address of the pattern string.
-+
-+ CFLAGS is a series of bits which affect compilation.
-+
-+ If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
-+ use POSIX basic syntax.
-+
-+ If REG_NEWLINE is set, then . and [^...] don't match newline.
-+ Also, regexec will try a match beginning after every newline.
-+
-+ If REG_ICASE is set, then we considers upper- and lowercase
-+ versions of letters to be equivalent when matching.
-+
-+ If REG_NOSUB is set, then when PREG is passed to regexec, that
-+ routine will report only success or failure, and nothing about the
-+ registers.
-+
-+ It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
-+ the return codes and their meanings.) */
-+
-+int
-+regcomp (regex_t *preg, const char *pattern, int cflags)
-+{
-+ reg_errcode_t ret;
-+ reg_syntax_t syntax
-+ = (cflags & REG_EXTENDED) ?
-+ RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
-+
-+ /* regex_compile will allocate the space for the compiled pattern. */
-+ preg->buffer = 0;
-+ preg->allocated = 0;
-+ preg->used = 0;
-+
-+ /* Try to allocate space for the fastmap. */
-+ preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
-+
-+ if (cflags & REG_ICASE)
-+ {
-+ int i;
-+
-+ preg->translate
-+ = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
-+ * sizeof (*(RE_TRANSLATE_TYPE)0));
-+ if (preg->translate == NULL)
-+ return (int) REG_ESPACE;
-+
-+ /* Map uppercase characters to corresponding lowercase ones. */
-+ for (i = 0; i < CHAR_SET_SIZE; i++)
-+ preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
-+ }
-+ else
-+ preg->translate = NULL;
-+
-+ /* If REG_NEWLINE is set, newlines are treated differently. */
-+ if (cflags & REG_NEWLINE)
-+ { /* REG_NEWLINE implies neither . nor [^...] match newline. */
-+ syntax &= ~RE_DOT_NEWLINE;
-+ syntax |= RE_HAT_LISTS_NOT_NEWLINE;
-+ /* It also changes the matching behavior. */
-+ preg->newline_anchor = 1;
-+ }
-+ else
-+ preg->newline_anchor = 0;
-+
-+ preg->no_sub = !!(cflags & REG_NOSUB);
-+
-+ /* POSIX says a null character in the pattern terminates it, so we
-+ can use strlen here in compiling the pattern. */
-+# ifdef MBS_SUPPORT
-+ if (MB_CUR_MAX != 1)
-+ ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
-+ else
-+# endif
-+ ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
-+
-+ /* POSIX doesn't distinguish between an unmatched open-group and an
-+ unmatched close-group: both are REG_EPAREN. */
-+ if (ret == REG_ERPAREN) ret = REG_EPAREN;
-+
-+ if (ret == REG_NOERROR && preg->fastmap)
-+ {
-+ /* Compute the fastmap now, since regexec cannot modify the pattern
-+ buffer. */
-+ if (re_compile_fastmap (preg) == -2)
-+ {
-+ /* Some error occurred while computing the fastmap, just forget
-+ about it. */
-+ free (preg->fastmap);
-+ preg->fastmap = NULL;
-+ }
-+ }
-+
-+ return (int) ret;
-+}
-+#ifdef _LIBC
-+weak_alias (__regcomp, regcomp)
-+#endif
-+
-+
-+/* regexec searches for a given pattern, specified by PREG, in the
-+ string STRING.
-+
-+ If NMATCH is zero or REG_NOSUB was set in the cflags argument to
-+ `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
-+ least NMATCH elements, and we set them to the offsets of the
-+ corresponding matched substrings.
-+
-+ EFLAGS specifies `execution flags' which affect matching: if
-+ REG_NOTBOL is set, then ^ does not match at the beginning of the
-+ string; if REG_NOTEOL is set, then $ does not match at the end.
-+
-+ We return 0 if we find a match and REG_NOMATCH if not. */
-+
-+int
-+regexec (const regex_t *preg, const char *string, size_t nmatch,
-+ regmatch_t pmatch[], int eflags)
-+{
-+ int ret;
-+ struct re_registers regs;
-+ regex_t private_preg;
-+ int len = strlen (string);
-+ boolean want_reg_info = !preg->no_sub && nmatch > 0;
-+
-+ private_preg = *preg;
-+
-+ private_preg.not_bol = !!(eflags & REG_NOTBOL);
-+ private_preg.not_eol = !!(eflags & REG_NOTEOL);
-+
-+ /* The user has told us exactly how many registers to return
-+ information about, via `nmatch'. We have to pass that on to the
-+ matching routines. */
-+ private_preg.regs_allocated = REGS_FIXED;
-+
-+ if (want_reg_info)
-+ {
-+ regs.num_regs = nmatch;
-+ regs.start = TALLOC (nmatch * 2, regoff_t);
-+ if (regs.start == NULL)
-+ return (int) REG_NOMATCH;
-+ regs.end = regs.start + nmatch;
-+ }
-+
-+ /* Perform the searching operation. */
-+ ret = re_search (&private_preg, string, len,
-+ /* start: */ 0, /* range: */ len,
-+ want_reg_info ? &regs : (struct re_registers *) 0);
-+
-+ /* Copy the register information to the POSIX structure. */
-+ if (want_reg_info)
-+ {
-+ if (ret >= 0)
-+ {
-+ unsigned r;
-+
-+ for (r = 0; r < nmatch; r++)
-+ {
-+ pmatch[r].rm_so = regs.start[r];
-+ pmatch[r].rm_eo = regs.end[r];
-+ }
-+ }
-+
-+ /* If we needed the temporary register info, free the space now. */
-+ free (regs.start);
-+ }
-+
-+ /* We want zero return to mean success, unlike `re_search'. */
-+ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
-+}
-+#ifdef _LIBC
-+/* EGLIBC: This is handled in regexec-compat.c. */
-+/*weak_alias (__regexec, regexec)*/
-+#include "regexec-compat.c"
-+#endif
-+
-+
-+/* Returns a message corresponding to an error code, ERRCODE, returned
-+ from either regcomp or regexec. We don't use PREG here. */
-+
-+size_t
-+regerror (int errcode, const regex_t *preg __attribute__ ((unused)),
-+ char *errbuf, size_t errbuf_size)
-+{
-+ const char *msg;
-+ size_t msg_size;
-+
-+ if (errcode < 0
-+ || errcode >= (int) (sizeof (re_error_msgid)
-+ / sizeof (re_error_msgid[0])))
-+ /* Only error codes returned by the rest of the code should be passed
-+ to this routine. If we are given anything else, or if other regex
-+ code generates an invalid error code, then the program has a bug.
-+ Dump core so we can fix it. */
-+ abort ();
-+
-+ msg = gettext (re_error_msgid[errcode]);
-+
-+ msg_size = strlen (msg) + 1; /* Includes the null. */
-+
-+ if (errbuf_size != 0)
-+ {
-+ if (msg_size > errbuf_size)
-+ {
-+#if defined HAVE_MEMPCPY || defined _LIBC
-+ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
-+#else
-+ memcpy (errbuf, msg, errbuf_size - 1);
-+ errbuf[errbuf_size - 1] = 0;
-+#endif
-+ }
-+ else
-+ memcpy (errbuf, msg, msg_size);
-+ }
-+
-+ return msg_size;
-+}
-+#ifdef _LIBC
-+weak_alias (__regerror, regerror)
-+#endif
-+
-+
-+/* Free dynamically allocated space used by PREG. */
-+
-+void
-+regfree (regex_t *preg)
-+{
-+ if (preg->buffer != NULL)
-+ free (preg->buffer);
-+ preg->buffer = NULL;
-+
-+ preg->allocated = 0;
-+ preg->used = 0;
-+
-+ if (preg->fastmap != NULL)
-+ free (preg->fastmap);
-+ preg->fastmap = NULL;
-+ preg->fastmap_accurate = 0;
-+
-+ if (preg->translate != NULL)
-+ free (preg->translate);
-+ preg->translate = NULL;
-+}
-+#ifdef _LIBC
-+weak_alias (__regfree, regfree)
-+#endif
-+
-+#endif /* not emacs */
-+
-+#endif /* not INSIDE_RECURSION */
-+
-+
-+#undef STORE_NUMBER
-+#undef STORE_NUMBER_AND_INCR
-+#undef EXTRACT_NUMBER
-+#undef EXTRACT_NUMBER_AND_INCR
-+
-+#undef DEBUG_PRINT_COMPILED_PATTERN
-+#undef DEBUG_PRINT_DOUBLE_STRING
-+
-+#undef INIT_FAIL_STACK
-+#undef RESET_FAIL_STACK
-+#undef DOUBLE_FAIL_STACK
-+#undef PUSH_PATTERN_OP
-+#undef PUSH_FAILURE_POINTER
-+#undef PUSH_FAILURE_INT
-+#undef PUSH_FAILURE_ELT
-+#undef POP_FAILURE_POINTER
-+#undef POP_FAILURE_INT
-+#undef POP_FAILURE_ELT
-+#undef DEBUG_PUSH
-+#undef DEBUG_POP
-+#undef PUSH_FAILURE_POINT
-+#undef POP_FAILURE_POINT
-+
-+#undef REG_UNSET_VALUE
-+#undef REG_UNSET
-+
-+#undef PATFETCH
-+#undef PATFETCH_RAW
-+#undef PATUNFETCH
-+#undef TRANSLATE
-+
-+#undef INIT_BUF_SIZE
-+#undef GET_BUFFER_SPACE
-+#undef BUF_PUSH
-+#undef BUF_PUSH_2
-+#undef BUF_PUSH_3
-+#undef STORE_JUMP
-+#undef STORE_JUMP2
-+#undef INSERT_JUMP
-+#undef INSERT_JUMP2
-+#undef EXTEND_BUFFER
-+#undef GET_UNSIGNED_NUMBER
-+#undef FREE_STACK_RETURN
-+
-+# undef POINTER_TO_OFFSET
-+# undef MATCHING_IN_FRST_STRING
-+# undef PREFETCH
-+# undef AT_STRINGS_BEG
-+# undef AT_STRINGS_END
-+# undef WORDCHAR_P
-+# undef FREE_VAR
-+# undef FREE_VARIABLES
-+# undef NO_HIGHEST_ACTIVE_REG
-+# undef NO_LOWEST_ACTIVE_REG
-+
-+# undef CHAR_T
-+# undef UCHAR_T
-+# undef COMPILED_BUFFER_VAR
-+# undef OFFSET_ADDRESS_SIZE
-+# undef CHAR_CLASS_SIZE
-+# undef PREFIX
-+# undef ARG_PREFIX
-+# undef PUT_CHAR
-+# undef BYTE
-+# undef WCHAR
-+
-+# define DEFINED_ONCE
-diff --git a/pwd/Makefile b/pwd/Makefile
-index 7f6de03..916d546 100644
---- a/pwd/Makefile
-+++ b/pwd/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for pwd portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := pwd
-
- include ../Makeconfig
-diff --git a/resolv/Makefile b/resolv/Makefile
-index 1dcb75f..2e4b630 100644
---- a/resolv/Makefile
-+++ b/resolv/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for resolv portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := resolv
-
- include ../Makeconfig
-@@ -27,21 +29,22 @@ headers := resolv.h \
- arpa/nameser.h arpa/nameser_compat.h \
- sys/bitypes.h
-
--routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
-- res_hconf res_libc res-state
-+routines-$(OPTION_EGLIBC_INET) \
-+ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \
-+ res_hconf res_libc res-state
-
--tests = tst-aton tst-leaks tst-inet_ntop
--xtests = tst-leaks2
-+tests-$(OPTION_EGLIBC_INET) += tst-aton tst-leaks tst-inet_ntop
-+xtests-$(OPTION_EGLIBC_INET) += tst-leaks2
-
- generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
-
--extra-libs := libresolv libnss_dns
-+extra-libs-$(OPTION_EGLIBC_INET) += libresolv libnss_dns
- ifeq ($(have-thread-library),yes)
--extra-libs += libanl
--routines += gai_sigqueue
-+extra-libs-$(OPTION_EGLIBC_INET_ANL) += libanl
-+routines-$(OPTION_EGLIBC_INET) += gai_sigqueue
- tests += tst-res_hconf_reorder
- endif
--extra-libs-others = $(extra-libs)
-+extra-libs-others-y += $(extra-libs-y)
- libresolv-routines := gethnamaddr res_comp res_debug \
- res_data res_mkquery res_query res_send \
- inet_net_ntop inet_net_pton inet_neta base64 \
-@@ -61,7 +64,7 @@ routines += $(libnss_dns-routines) $(libresolv-routines)
- static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
- endif
-
--ifeq (yesyes,$(build-shared)$(have-thread-library))
-+ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET_ANL))
- tests: $(objpfx)ga_test
- endif
-
-diff --git a/stdio-common/Makefile b/stdio-common/Makefile
-index d0bf0e1..8655801 100644
---- a/stdio-common/Makefile
-+++ b/stdio-common/Makefile
-@@ -18,6 +18,8 @@
- #
- # Specific makefile for stdio-common.
- #
-+include ../option-groups.mak
-+
- subdir := stdio-common
-
- include ../Makeconfig
-@@ -30,7 +32,7 @@ routines := \
- vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
- reg-modifier reg-type \
- printf_size fprintf printf snprintf sprintf asprintf dprintf \
-- vfwprintf vfscanf vfwscanf \
-+ vfscanf \
- fscanf scanf sscanf \
- perror psignal \
- tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
-@@ -41,23 +43,36 @@ routines := \
- isoc99_vsscanf \
- psiginfo
-
--aux := errlist siglist printf-parsemb printf-parsewc fxprintf
-+# Ideally, _itowa and itowa-digits would be in this option group as
-+# well, but it is used unconditionally by printf_fp and printf_fphex,
-+# and it didn't seem straightforward to disentangle it.
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += vfwprintf vfwscanf
-+
-+aux := errlist siglist printf-parsemb fxprintf
-+aux-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += printf-parsewc
-
- tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
- temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
- xbug errnobug \
- bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
-- tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
-+ tfformat tiformat tllformat tstdiomisc tst-printfsz \
- scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
-- scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
-- tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
-- tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
-+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
-+ tst-fseek tst-fmemopen tst-gets \
-+ tst-sprintf tst-rndseek tst-fdopen tst-fphex \
- tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
-- tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
-- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
-- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
-- bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
-+ tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
-+ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 \
-+ scanf16 scanf17 tst-setvbuf1 bug23 bug24 \
-+ bug-vfprintf-nargs tst-sprintf3 \
- bug25 tst-printf-round bug23-2 bug23-3 bug23-4 bug26 tst-fmemopen3
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
-+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-+ += tst-perror bug19a bug20 tst-long-dbl-fphex tst-fphex-wide
-+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += bug18a tst-swscanf tst-wc-printf
-
- test-srcs = tst-unbputc tst-printf
-
-diff --git a/stdio-common/_i18n_number.h b/stdio-common/_i18n_number.h
-index 3c73044..ac62b3a 100644
---- a/stdio-common/_i18n_number.h
-+++ b/stdio-common/_i18n_number.h
-@@ -19,10 +19,13 @@
- #include <stdbool.h>
- #include <wchar.h>
- #include <wctype.h>
-+#include <gnu/option-groups.h>
-
- #include "../locale/outdigits.h"
- #include "../locale/outdigitswc.h"
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+
- static CHAR_T *
- _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
- {
-@@ -115,3 +118,13 @@ _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
-
- return w;
- }
-+
-+#else
-+
-+static CHAR_T *
-+_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
-+{
-+ return w;
-+}
-+
-+#endif
-diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
-index 7b2eb94..8476076 100644
---- a/stdio-common/fxprintf.c
-+++ b/stdio-common/fxprintf.c
-@@ -23,6 +23,7 @@
- #include <wchar.h>
- #include <string.h>
- #include <libioP.h>
-+#include <gnu/option-groups.h>
-
-
- int
-@@ -37,6 +38,7 @@ __fxprintf (FILE *fp, const char *fmt, ...)
- int res;
- if (_IO_fwide (fp, 0) > 0)
- {
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- size_t len = strlen (fmt) + 1;
- wchar_t wfmt[len];
- for (size_t i = 0; i < len; ++i)
-@@ -45,6 +47,9 @@ __fxprintf (FILE *fp, const char *fmt, ...)
- wfmt[i] = fmt[i];
- }
- res = __vfwprintf (fp, wfmt, ap);
-+#else
-+ abort();
-+#endif
- }
- else
- res = _IO_vfprintf (fp, fmt, ap);
-diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
-index 3023b20..bd0df66 100644
---- a/stdio-common/printf_fp.c
-+++ b/stdio-common/printf_fp.c
-@@ -39,6 +39,7 @@
- #include <unistd.h>
- #include <stdlib.h>
- #include <wchar.h>
-+#include <gnu/option-groups.h>
- #include <stdbool.h>
- #include <rounding-mode.h>
-
-@@ -142,6 +143,10 @@ extern mp_size_t __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size,
- extern unsigned int __guess_grouping (unsigned int intdig_max,
- const char *grouping);
-
-+/* Ideally, when OPTION_EGLIBC_LOCALE_CODE is disabled, this should do
-+ all its work in ordinary characters, rather than doing it in wide
-+ characters and then converting at the end. But that is a challenge
-+ for another day. */
-
- static wchar_t *group_number (wchar_t *buf, wchar_t *bufend,
- unsigned int intdig_no, const char *grouping,
-@@ -251,7 +256,14 @@ ___printf_fp (FILE *fp,
- mp_limb_t cy;
-
- /* Nonzero if this is output on a wide character stream. */
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- int wide = info->wide;
-+#else
-+ /* This should never be called on a wide-oriented stream when
-+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
-+ be trusted to figure that out. */
-+ const int wide = 0;
-+#endif
-
- /* Buffer in which we produce the output. */
- wchar_t *wbuffer = NULL;
-@@ -261,6 +273,7 @@ ___printf_fp (FILE *fp,
- p.expsign = 0;
-
- /* Figure out the decimal point character. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
- if (info->extra == 0)
- {
- decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
-@@ -280,7 +293,13 @@ ___printf_fp (FILE *fp,
- /* The decimal point character must not be zero. */
- assert (*decimal != '\0');
- assert (decimalwc != L'\0');
-+#else
-+ /* Hard-code values from 'C' locale. */
-+ decimal = ".";
-+ decimalwc = L'.';
-+#endif
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- if (info->group)
- {
- if (info->extra == 0)
-@@ -324,6 +343,9 @@ ___printf_fp (FILE *fp,
- }
- else
- grouping = NULL;
-+#else
-+ grouping = NULL;
-+#endif
-
- /* Fetch the argument value. */
- #ifndef __NO_LONG_DOUBLE_MATH
-diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
-index 6c3b5e9..f660ce0 100644
---- a/stdio-common/printf_fphex.c
-+++ b/stdio-common/printf_fphex.c
-@@ -28,6 +28,7 @@
- #include <_itoa.h>
- #include <_itowa.h>
- #include <locale/localeinfo.h>
-+#include <gnu/option-groups.h>
- #include <stdbool.h>
- #include <rounding-mode.h>
-
-@@ -139,10 +140,18 @@ __printf_fphex (FILE *fp,
- int done = 0;
-
- /* Nonzero if this is output on a wide character stream. */
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- int wide = info->wide;
-+#else
-+ /* This should never be called on a wide-oriented stream when
-+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
-+ be trusted to figure that out. */
-+ const int wide = 0;
-+#endif
-
-
- /* Figure out the decimal point character. */
-+#if __OPTION_EGLIBC_LOCALE_CODE
- if (info->extra == 0)
- {
- decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
-@@ -156,6 +165,10 @@ __printf_fphex (FILE *fp,
- }
- /* The decimal point character must never be zero. */
- assert (*decimal != '\0' && decimalwc != L'\0');
-+#else
-+ decimal = ".";
-+ decimalwc = L'.';
-+#endif
-
-
- /* Fetch the argument value. */
-diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
-index 7dcd58e..6fb7491 100644
---- a/stdio-common/printf_size.c
-+++ b/stdio-common/printf_size.c
-@@ -23,6 +23,7 @@
- #include <math.h>
- #include <printf.h>
- #include <libioP.h>
-+#include <gnu/option-groups.h>
-
-
- /* This defines make it possible to use the same code for GNU C library and
-@@ -116,7 +117,14 @@ __printf_size (FILE *fp, const struct printf_info *info,
-
- struct printf_info fp_info;
- int done = 0;
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- int wide = info->wide;
-+#else
-+ /* This should never be called on a wide-oriented stream when
-+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
-+ be trusted to figure that out. */
-+ const int wide = 0;
-+#endif
- int res;
-
- /* Fetch the argument value. */
-diff --git a/stdio-common/scanf14.c b/stdio-common/scanf14.c
-index cffccb0..6cc260a 100644
---- a/stdio-common/scanf14.c
-+++ b/stdio-common/scanf14.c
-@@ -3,6 +3,7 @@
- #include <string.h>
- #include <wchar.h>
- #include <libc-internal.h>
-+#include <gnu/option-groups.h>
-
- #define FAIL() \
- do { \
-@@ -48,6 +49,7 @@ main (void)
- /* See explanation above. */
- DIAG_PUSH_NEEDS_COMMENT;
- DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
-+#if __OPTION_EGLIBC_LOCALE_CODE
- if (sscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2)
- FAIL ();
- else
-@@ -57,6 +59,7 @@ main (void)
- memset (lsp, 'x', sizeof L"3.25");
- free (lsp);
- }
-+#endif
- if (sscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2)
- FAIL ();
- else
-diff --git a/stdio-common/tst-popen.c b/stdio-common/tst-popen.c
-index 5def27f..7c9b91e 100644
---- a/stdio-common/tst-popen.c
-+++ b/stdio-common/tst-popen.c
-@@ -19,6 +19,7 @@
- #include <stdio.h>
- #include <string.h>
- #include <wchar.h>
-+#include <gnu/option-groups.h>
-
- static int
- do_test (void)
-@@ -34,12 +35,14 @@ do_test (void)
- return 1;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- /* POSIX says that pipe streams are byte-oriented. */
- if (fwide (f, 0) >= 0)
- {
- puts ("popen did not return byte-oriented stream");
- result = 1;
- }
-+#endif
-
- if (getline (&line, &len, f) != 5)
- {
-diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
-index d5284b9..f1e3d21 100644
---- a/stdio-common/tst-sprintf.c
-+++ b/stdio-common/tst-sprintf.c
-@@ -3,7 +3,7 @@
- #include <locale.h>
- #include <string.h>
- #include <libc-internal.h>
--
-+#include <gnu/option-groups.h>
-
- static int
- do_test (void)
-@@ -11,12 +11,14 @@ do_test (void)
- char buf[100];
- int result = 0;
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- if (sprintf (buf, "%.0ls", L"foo") != 0
- || strlen (buf) != 0)
- {
- puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
- result = 1;
- }
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
-
- #define SIZE (1024*70000)
- #define STR(x) #x
-diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
-index 5548a71..31ed024 100644
---- a/stdio-common/tstdiomisc.c
-+++ b/stdio-common/tstdiomisc.c
-@@ -4,6 +4,7 @@
- #include <string.h>
- #include <wchar.h>
- #include <libc-internal.h>
-+#include <gnu/option-groups.h>
-
- static int
- t1 (void)
-@@ -134,6 +135,7 @@ F (void)
- printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
- buf);
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
- qnanval, qnanval, qnanval, qnanval,
- qnanval, qnanval, qnanval, qnanval);
-@@ -171,6 +173,7 @@ F (void)
- result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
- printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
- wbuf);
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
-
- lqnanval = NAN;
-
-@@ -215,6 +218,7 @@ F (void)
- printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
- buf);
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
- swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
- L"%La %LA %Le %LE %Lf %LF %Lg %LG",
- lqnanval, lqnanval, lqnanval, lqnanval,
-@@ -259,6 +263,7 @@ F (void)
- result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
- printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
- wbuf);
-+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
-
- return result;
- }
-diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
-index 0592e70..f21d973 100644
---- a/stdio-common/vfprintf.c
-+++ b/stdio-common/vfprintf.c
-@@ -29,6 +29,7 @@
- #include <_itoa.h>
- #include <locale/localeinfo.h>
- #include <stdio.h>
-+#include <gnu/option-groups.h>
-
- /* This code is shared between the standard stdio implementation found
- in GNU C library and the libio implementation originally found in
-@@ -140,6 +141,18 @@ typedef wchar_t THOUSANDS_SEP_T;
- # define EOF WEOF
- #endif
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
-+# define MULTIBYTE_SUPPORT (1)
-+#else
-+# define MULTIBYTE_SUPPORT (0)
-+#endif
-+
-+#if __OPTION_EGLIBC_LOCALE_CODE
-+# define LOCALE_SUPPORT (1)
-+#else
-+# define LOCALE_SUPPORT (0)
-+#endif
-+
- #include "_i18n_number.h"
-
- /* Include the shared code for parsing the format string. */
-@@ -1065,8 +1078,11 @@ static const uint8_t jump_table[] =
- # define process_string_arg(fspec) \
- LABEL (form_character): \
- /* Character. */ \
-- if (is_long) \
-- goto LABEL (form_wcharacter); \
-+ if (is_long) \
-+ { \
-+ assert (MULTIBYTE_SUPPORT); \
-+ goto LABEL (form_wcharacter); \
-+ } \
- --width; /* Account for the character itself. */ \
- if (!left) \
- PAD (' '); \
-@@ -1079,6 +1095,7 @@ static const uint8_t jump_table[] =
- break; \
- \
- LABEL (form_wcharacter): \
-+ assert (MULTIBYTE_SUPPORT); \
- { \
- /* Wide character. */ \
- char buf[MB_CUR_MAX]; \
-@@ -1145,6 +1162,7 @@ static const uint8_t jump_table[] =
- } \
- else \
- { \
-+ assert (MULTIBYTE_SUPPORT); \
- const wchar_t *s2 = (const wchar_t *) string; \
- mbstate_t mbstate; \
- \
-@@ -1399,7 +1417,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
- LABEL (flag_quote):
- group = 1;
-
-- if (grouping == (const char *) -1)
-+ if (! LOCALE_SUPPORT)
-+ grouping = NULL;
-+ else if (grouping == (const char *) -1)
- {
- #ifdef COMPILE_WPRINTF
- thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
-@@ -1728,8 +1748,9 @@ printf_positional (_IO_FILE *s, const CHAR_T *format, int readonly_format,
- size_t cnt;
-
- CHAR_T *workstart = NULL;
--
-- if (grouping == (const char *) -1)
-+ if (! LOCALE_SUPPORT)
-+ grouping = NULL;
-+ else if (grouping == (const char *) -1)
- {
- #ifdef COMPILE_WPRINTF
- thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
-diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
-index 0e204e7..66cc0af 100644
---- a/stdio-common/vfscanf.c
-+++ b/stdio-common/vfscanf.c
-@@ -29,6 +29,7 @@
- #include <wctype.h>
- #include <bits/libc-lock.h>
- #include <locale/localeinfo.h>
-+#include <gnu/option-groups.h>
-
- #ifdef __GNUC__
- # define HAVE_LONGLONG
-@@ -133,6 +134,12 @@
- # define WINT_T int
- #endif
-
-+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
-+# define MULTIBYTE_SUPPORT (1)
-+#else
-+# define MULTIBYTE_SUPPORT (0)
-+#endif
-+
- #define encode_error() do { \
- errval = 4; \
- __set_errno (EILSEQ); \
-@@ -316,24 +323,35 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- ARGCHECK (s, format);
-
- {
--#ifndef COMPILE_WSCANF
-+#if __OPTION_EGLIBC_LOCALE_CODE && !defined (COMPILE_WSCANF)
- struct __locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
- #endif
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* Figure out the decimal point character. */
--#ifdef COMPILE_WSCANF
-+# ifdef COMPILE_WSCANF
- decimal = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
--#else
-+# else
- decimal = curnumeric->values[_NL_ITEM_INDEX (DECIMAL_POINT)].string;
--#endif
-+# endif
- /* Figure out the thousands separator character. */
--#ifdef COMPILE_WSCANF
-+# ifdef COMPILE_WSCANF
- thousands = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_THOUSANDS_SEP_WC);
--#else
-+# else
- thousands = curnumeric->values[_NL_ITEM_INDEX (THOUSANDS_SEP)].string;
- if (*thousands == '\0')
- thousands = NULL;
--#endif
-+# endif
-+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
-+ /* Hard-code values from the C locale. */
-+# ifdef COMPILE_WSCANF
-+ decimal = L'.';
-+ thousands = L'\0';
-+# else
-+ decimal = ".";
-+ thousands = NULL;
-+# endif
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
- }
-
- /* Lock the stream. */
-@@ -385,6 +403,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- #ifndef COMPILE_WSCANF
- if (!isascii ((unsigned char) *f))
- {
-+ assert (MULTIBYTE_SUPPORT);
-+
- /* Non-ASCII, may be a multibyte. */
- int len = __mbrlen (f, strlen (f), &state);
- if (len > 0)
-@@ -830,6 +850,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- }
- /* FALLTHROUGH */
- case L_('C'):
-+ assert (MULTIBYTE_SUPPORT);
-+
- if (width == -1)
- width = 1;
-
-@@ -1172,6 +1194,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- /* FALLTHROUGH */
-
- case L_('S'):
-+ assert (MULTIBYTE_SUPPORT);
-+
- {
- #ifndef COMPILE_WSCANF
- mbstate_t cstate;
-@@ -1419,10 +1443,17 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- const char *mbdigits[10];
- const char *mbdigits_extended[10];
- #endif
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* "to_inpunct" is a map from ASCII digits to their
- equivalent in locale. This is defined for locales
- which use an extra digits set. */
- wctrans_t map = __wctrans ("to_inpunct");
-+#else
-+ /* This will always be the case when
-+ OPTION_EGLIBC_LOCALE_CODE is disabled, but the
-+ compiler can't figure that out. */
-+ wctrans_t map = NULL;
-+#endif
- int n;
-
- from_level = 0;
-@@ -2088,6 +2119,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- --width;
- }
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- wctrans_t map;
- if (__builtin_expect ((flags & I18N) != 0, 0)
- /* Hexadecimal floats make no sense, fixing localized
-@@ -2304,6 +2336,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- ;
- #endif
- }
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
-
- /* Have we read any character? If we try to read a number
- in hexadecimal notation and we have read only the `0x'
-@@ -2343,7 +2376,10 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
-
- case L_('['): /* Character class. */
- if (flags & LONG)
-- STRING_ARG (wstr, wchar_t, 100);
-+ {
-+ assert (MULTIBYTE_SUPPORT);
-+ STRING_ARG (wstr, wchar_t, 100);
-+ }
- else
- STRING_ARG (str, char, 100);
-
-@@ -2417,6 +2453,7 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
- if (flags & LONG)
- {
- size_t now = read_in;
-+ assert (MULTIBYTE_SUPPORT);
- #ifdef COMPILE_WSCANF
- if (__glibc_unlikely (inchar () == WEOF))
- input_error ();
-diff --git a/stdlib/Makefile b/stdlib/Makefile
-index 402466a..7e7e304 100644
---- a/stdlib/Makefile
-+++ b/stdlib/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for stdlib routines
- #
-+include ../option-groups.mak
-+
- subdir := stdlib
-
- include ../Makeconfig
-@@ -30,7 +32,7 @@ headers := stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h \
- alloca.h fmtmsg.h \
- bits/stdlib-bsearch.h
-
--routines := \
-+routines-y := \
- atof atoi atol atoll \
- abort \
- bsearch qsort msort \
-@@ -39,7 +41,6 @@ routines := \
- quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
- abs labs llabs \
- div ldiv lldiv \
-- mblen mbstowcs mbtowc wcstombs wctomb \
- random random_r rand rand_r \
- drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
- srand48 seed48 lcong48 \
-@@ -52,9 +53,18 @@ routines := \
- strtof_l strtod_l strtold_l \
- system canonicalize \
- a64l l64a \
-- rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
-- strtoimax strtoumax wcstoimax wcstoumax \
-+ getsubopt xpg_basename \
-+ strtoimax strtoumax \
- getcontext setcontext makecontext swapcontext
-+routines-$(OPTION_EGLIBC_LOCALE_CODE) += \
-+ strfmon strfmon_l
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
-+ mblen mbstowcs mbtowc wcstombs wctomb \
-+ wcstoimax wcstoumax
-+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP))
-+routines-y += rpmatch
-+endif
-+routines-$(OPTION_EGLIBC_FMTMSG) += fmtmsg
- aux = grouping groupingwc tens_in_limb
-
- # These routines will be omitted from the libc shared object.
-@@ -62,20 +72,24 @@ aux = grouping groupingwc tens_in_limb
- # linked against when the shared library will be used.
- static-only-routines = atexit at_quick_exit
-
--test-srcs := tst-fmtmsg
--tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
-+test-srcs-$(OPTION_EGLIBC_FMTMSG) := tst-fmtmsg
-+tests := tst-strtol tst-strtod testrand testsort testdiv \
- test-canon test-canon2 tst-strtoll tst-environ \
- tst-xpg-basename tst-random tst-random2 tst-bsearch \
- tst-limits tst-rand48 bug-strtod tst-setcontext \
-- tst-setcontext2 test-a64l tst-qsort tst-system testmb2 \
-- bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 \
-- tst-rand48-2 tst-makecontext tst-strtod4 tst-strtod5 \
-+ tst-setcontext2 test-a64l tst-qsort tst-system \
-+ bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 \
-+ tst-rand48-2 tst-makecontext \
- tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1 \
- tst-makecontext3 bug-getcontext bug-fmtmsg1 \
- tst-secure-getenv tst-strtod-overflow tst-strtod-round \
- tst-tininess tst-strtod-underflow tst-tls-atexit \
- tst-setcontext3 tst-tls-atexit-nodelete
- tests-static := tst-secure-getenv
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-strtod3 tst-strtod4 tst-strtod5 testmb2
-+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += testmb
-
- modules-names = tst-tls-atexit-lib
-
-@@ -116,8 +130,10 @@ CFLAGS-tst-makecontext2.c = $(stack-align-test-flags)
- tests-special += $(objpfx)isomac.out
-
- ifeq ($(run-built-tests),yes)
-+ifeq (y,$(OPTION_EGLIBC_FMTMSG))
- tests-special += $(objpfx)tst-fmtmsg.out
- endif
-+endif
-
- include ../Rules
-
-diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
-index e13ab1e..63efe41 100644
---- a/stdlib/strtod_l.c
-+++ b/stdlib/strtod_l.c
-@@ -17,6 +17,7 @@
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-+#include <gnu/option-groups.h>
- #include <xlocale.h>
-
- extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
-@@ -548,6 +549,7 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
- /* Used in several places. */
- int cnt;
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- struct __locale_data *current = loc->__locales[LC_NUMERIC];
-
- if (__glibc_unlikely (group))
-@@ -586,6 +588,17 @@ ____STRTOF_INTERNAL (nptr, endptr, group, loc)
- decimal_len = strlen (decimal);
- assert (decimal_len > 0);
- #endif
-+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
-+ /* Hard-code values from the 'C' locale. */
-+ grouping = NULL;
-+#ifdef USE_WIDE_CHAR
-+ decimal = L'.';
-+# define decimal_len 1
-+#else
-+ decimal = ".";
-+ decimal_len = 1;
-+#endif
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
-
- /* Prepare number representation. */
- exponent = 0;
-diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
-index a469208..28fb423 100644
---- a/stdlib/tst-strtod.c
-+++ b/stdlib/tst-strtod.c
-@@ -23,6 +23,7 @@
- #include <errno.h>
- #include <string.h>
- #include <math.h>
-+#include <gnu/option-groups.h>
-
- struct ltest
- {
-@@ -176,7 +177,9 @@ main (int argc, char ** argv)
-
- status |= long_dbl ();
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- status |= locale_test ();
-+#endif
-
- return status ? EXIT_FAILURE : EXIT_SUCCESS;
- }
-@@ -219,6 +222,7 @@ long_dbl (void)
- return 0;
- }
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* Perform a few tests in a locale with thousands separators. */
- static int
- locale_test (void)
-@@ -276,3 +280,4 @@ locale_test (void)
-
- return result;
- }
-+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
-diff --git a/streams/Makefile b/streams/Makefile
-index a8a6162..ceb423f 100644
---- a/streams/Makefile
-+++ b/streams/Makefile
-@@ -18,11 +18,14 @@
- #
- # Makefile for streams.
- #
-+include ../option-groups.mak
-+
- subdir := streams
-
- include ../Makeconfig
-
- headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
--routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
-+routines-$(OPTION_EGLIBC_STREAMS) \
-+ += isastream getmsg getpmsg putmsg putpmsg fattach fdetach
-
- include ../Rules
-diff --git a/string/Makefile b/string/Makefile
-index 8424a61..5988834 100644
---- a/string/Makefile
-+++ b/string/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for string portion of library.
- #
-+include ../option-groups.mak
-+
- subdir := string
-
- include ../Makeconfig
-@@ -39,10 +41,12 @@ routines := strcat strchr strcmp strcoll strcpy strcspn \
- $(addprefix argz-,append count create ctsep next \
- delete extract insert stringify \
- addsep replace) \
-- envz basename \
-+ basename \
- strcoll_l strxfrm_l string-inlines memrchr \
- xpg-strerror strerror_l
-
-+routines-$(OPTION_EGLIBC_ENVZ) += envz
-+
- strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
- stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
- strlen strncmp strncpy strpbrk strrchr strspn memmem \
-@@ -51,10 +55,12 @@ strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
- tests := tester inl-tester noinl-tester testcopy test-ffs \
- tst-strlen stratcliff tst-svc tst-inlcall \
- bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
-- tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
-+ tst-strtok tst-strfry \
- bug-strtok1 $(addprefix test-,$(strop-tests)) \
-- bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
-- tst-strtok_r
-+ tst-strxfrm2 tst-endian tst-svc2 tst-strtok_r
-+tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-strxfrm bug-strcoll1
-
- xtests = tst-strcoll-overflow
-
-diff --git a/string/strcoll_l.c b/string/strcoll_l.c
-index 8f1225f..b36b18c 100644
---- a/string/strcoll_l.c
-+++ b/string/strcoll_l.c
-@@ -24,6 +24,7 @@
- #include <stdint.h>
- #include <string.h>
- #include <sys/param.h>
-+#include <gnu/option-groups.h>
-
- #ifndef STRING_TYPE
- # define STRING_TYPE char
-@@ -260,7 +261,11 @@ int
- STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
- {
- struct __locale_data *current = l->__locales[LC_COLLATE];
-+#if __OPTION_EGLIBC_LOCALE_CODE
- uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
-+#else
-+ const uint_fast32_t nrules = 0;
-+#endif
- /* We don't assign the following values right away since it might be
- unnecessary in case there are no rules. */
- const unsigned char *rulesets;
-diff --git a/string/strerror_l.c b/string/strerror_l.c
-index 2ed78b5..6584813 100644
---- a/string/strerror_l.c
-+++ b/string/strerror_l.c
-@@ -21,6 +21,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <sys/param.h>
-+#include <gnu/option-groups.h>
-
-
- static __thread char *last_value;
-@@ -29,10 +30,14 @@ static __thread char *last_value;
- static const char *
- translate (const char *str, locale_t loc)
- {
-+#if __OPTION_EGLIBC_LOCALE_CODE
- locale_t oldloc = __uselocale (loc);
- const char *res = _(str);
- __uselocale (oldloc);
- return res;
-+#else
-+ return str;
-+#endif
- }
-
-
-diff --git a/string/strxfrm_l.c b/string/strxfrm_l.c
-index 8b61ea2..41fdc22 100644
---- a/string/strxfrm_l.c
-+++ b/string/strxfrm_l.c
-@@ -24,6 +24,7 @@
- #include <stdlib.h>
- #include <string.h>
- #include <sys/param.h>
-+#include <gnu/option-groups.h>
-
- #ifndef STRING_TYPE
- # define STRING_TYPE char
-@@ -669,7 +670,11 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
- {
- locale_data_t l_data;
- struct __locale_data *current = l->__locales[LC_COLLATE];
-+#if __OPTION_EGLIBC_LOCALE_CODE
- l_data.nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
-+#else
-+ l_data.nrules = 0;
-+#endif
-
- /* Handle byte comparison case. */
- if (l_data.nrules == 0)
-diff --git a/string/test-strcmp.c b/string/test-strcmp.c
-index dc4ba6f..a978656 100644
---- a/string/test-strcmp.c
-+++ b/string/test-strcmp.c
-@@ -329,34 +329,6 @@ check (void)
- FOR_EACH_IMPL (impl, 0)
- check_result (impl, s1 + i1, s2 + i2, exp_result);
- }
--
-- /* Test cases where there are multiple zero bytes after the first. */
--
-- for (size_t i = 0; i < 16 + 1; i++)
-- {
-- s1[i] = 0x00;
-- s2[i] = 0x00;
-- }
--
-- for (size_t i = 0; i < 16; i++)
-- {
-- int exp_result;
--
-- for (int val = 0x01; val < 0x100; val++)
-- {
-- for (size_t j = 0; j < i; j++)
-- {
-- s1[j] = val;
-- s2[j] = val;
-- }
--
-- s2[i] = val;
--
-- exp_result = SIMPLE_STRCMP (s1, s2);
-- FOR_EACH_IMPL (impl, 0)
-- check_result (impl, s1, s2, exp_result);
-- }
-- }
- }
-
-
-diff --git a/string/tst-strxfrm.c b/string/tst-strxfrm.c
-index f48cfc0..c3a51f9 100644
---- a/string/tst-strxfrm.c
-+++ b/string/tst-strxfrm.c
-@@ -3,6 +3,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <gnu/option-groups.h>
-
-
- char const string[] = "";
-@@ -64,8 +65,10 @@ do_test (void)
- int result = 0;
-
- result |= test ("C");
-+#if __OPTION_EGLIBC_LOCALE_CODE
- result |= test ("en_US.ISO-8859-1");
- result |= test ("de_DE.UTF-8");
-+#endif
-
- return result;
- }
-diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c
-index d5a1115..19c7f30 100644
---- a/string/tst-strxfrm2.c
-+++ b/string/tst-strxfrm2.c
-@@ -1,6 +1,7 @@
- #include <locale.h>
- #include <stdio.h>
- #include <string.h>
-+#include <gnu/option-groups.h>
-
- static int
- do_test (void)
-@@ -38,6 +39,7 @@ do_test (void)
- res = 1;
- }
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
- {
- puts ("setlocale failed");
-@@ -75,6 +77,7 @@ do_test (void)
- res = 1;
- }
- }
-+#endif
-
- return res;
- }
-diff --git a/sunrpc/Makefile b/sunrpc/Makefile
-index 60caa0a..5bc70ab 100644
---- a/sunrpc/Makefile
-+++ b/sunrpc/Makefile
-@@ -18,6 +18,8 @@
- #
- # Sub-makefile for sunrpc portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := sunrpc
-
- include ../Makeconfig
-@@ -55,7 +57,6 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
- headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
- $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
- headers = rpc/netdb.h
--install-others = $(inst_sysconfdir)/rpc
- generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
- $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
- generated-dirs += rpcsvc
-@@ -65,20 +66,28 @@ headers += $(headers-in-tirpc) $(headers-not-in-tirpc)
- endif
-
- ifeq ($(build-shared),yes)
--need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
-+need-export-routines-$(OPTION_EGLIBC_SUNRPC) := \
-+ auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
- clnt_udp get_myaddr key_call netname pm_getport \
-- rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
-+ rpc_thread svc svc_tcp svc_udp xdr_array xdr \
- xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
- svc_run
-+need-export-routines-y += xcrypt
-+need-export-routines := $(need-export-routines-y)
-
--routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
-+routines-$(OPTION_EGLIBC_SUNRPC) := \
-+ auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
- rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
- pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
- svc_simple xdr_float xdr_rec publickey authdes_prot \
-- des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
-+ key_prot openchild rtime svcauth_des \
- getrpcent getrpcbyname getrpcbynumber \
- getrpcent_r getrpcbyname_r getrpcbynumber_r \
-- clnt_unix svc_unix create_xid $(need-export-routines)
-+ clnt_unix svc_unix create_xid
-+
-+# xdecrypt is also used by nss/nss_files/files-key.c.
-+routines-y += des_crypt des_impl des_soft $(need-export-routines)
-+
- ifneq ($(link-obsolete-rpc),yes)
- # We only add the RPC for compatibility to libc.so.
- shared-only-routines = $(routines)
-@@ -87,25 +96,28 @@ endif
-
- # We do not build rpcinfo anymore. It is not needed for a bootstrap
- # and not wanted on complete systems.
--# others := rpcinfo
--# install-sbin := rpcinfo
--install-bin := rpcgen
-+# others-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
-+# install-sbin-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
-+install-bin-$(OPTION_EGLIBC_SUNRPC) += rpcgen
- rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
- rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
- rpc_tblout.o rpc_sample.o
--extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
--others += rpcgen
-+extra-objs-$(OPTION_EGLIBC_SUNRPC) = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
-+others-$(OPTION_EGLIBC_SUNRPC) += rpcgen
-+
-+install-others-$(OPTION_EGLIBC_SUNRPC) += $(inst_sysconfdir)/rpc
-
--tests = tst-xdrmem tst-xdrmem2 test-rpcent
--xtests := tst-getmyaddr
-+tests-$(OPTION_EGLIBC_SUNRPC) = tst-xdrmem tst-xdrmem2 test-rpcent
-+xtests-$(OPTION_EGLIBC_SUNRPC) := tst-getmyaddr
-
- ifeq ($(have-thread-library),yes)
--xtests += thrsvc
-+xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc
- endif
-
- headers += $(rpcsvc:%.x=rpcsvc/%.h)
--extra-libs := librpcsvc
--extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
-+extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc
-+# Make it in `others' pass, not `lib' pass.
-+extra-libs-others-y += $(extra-libs-y)
- librpcsvc-routines = $(rpcsvc:%.x=x%)
- librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
- omit-deps = $(librpcsvc-routines)
-diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
-index 17c129b..543791a 100644
---- a/sysdeps/arm/Makefile
-+++ b/sysdeps/arm/Makefile
-@@ -37,10 +37,13 @@ ifeq ($(subdir),csu)
- # get offset to rtld_global._dl_hwcap
- gen-as-const-headers += rtld-global-offsets.sym tlsdesc.sym
- aeabi_constants = aeabi_lcsts aeabi_sighandlers aeabi_math
--aeabi_routines = aeabi_assert aeabi_localeconv aeabi_errno_addr \
-+aeabi_routines = aeabi_assert aeabi_errno_addr \
- aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
- aeabi_memmove aeabi_memset \
- aeabi_read_tp libc-aeabi_read_tp
-+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
-+aeabi_routines += aeabi_localeconv
-+endif
-
- sysdep_routines += $(aeabi_constants) $(aeabi_routines)
- static-only-routines += $(aeabi_constants) aeabi_read_tp
-diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
-index 7a0fe8d..a3e2c0a 100644
---- a/sysdeps/generic/ldsodefs.h
-+++ b/sysdeps/generic/ldsodefs.h
-@@ -435,6 +435,12 @@ extern struct rtld_global _rtld_global __rtld_global_attribute__;
- # undef __rtld_global_attribute__
- #endif
-
-+#if __OPTION_EGLIBC_RTLD_DEBUG
-+# define GLRO_dl_debug_mask GLRO(dl_debug_mask)
-+#else
-+# define GLRO_dl_debug_mask 0
-+#endif
-+
- #ifndef SHARED
- # define GLRO(name) _##name
- #else
-@@ -447,8 +453,10 @@ struct rtld_global_ro
- {
- #endif
-
-+#if __OPTION_EGLIBC_RTLD_DEBUG
- /* If nonzero the appropriate debug information is printed. */
- EXTERN int _dl_debug_mask;
-+#endif
- #define DL_DEBUG_LIBS (1 << 0)
- #define DL_DEBUG_IMPCALLS (1 << 1)
- #define DL_DEBUG_BINDINGS (1 << 2)
-diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
-index ea68037..3175cc3 100644
---- a/sysdeps/gnu/Makefile
-+++ b/sysdeps/gnu/Makefile
-@@ -59,7 +59,8 @@ $(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
- endif
-
- ifeq ($(subdir),login)
--sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
-+sysdep_routines-$(OPTION_EGLIBC_UTMPX) \
-+ += setutxent getutxent endutxent getutxid getutxline \
- pututxline utmpxname updwtmpx getutmpx getutmp
-
- sysdep_headers += utmpx.h bits/utmpx.h
-diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
-index 222122d..4509357 100644
---- a/sysdeps/ieee754/ldbl-opt/Makefile
-+++ b/sysdeps/ieee754/ldbl-opt/Makefile
-@@ -11,19 +11,18 @@ libm-routines += s_nexttowardfd
- routines += math_ldbl_opt nldbl-compat
-
- extra-libs += libnldbl
--libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
-+libnldbl-calls = asprintf dprintf fprintf fscanf iovfscanf \
- obstack_printf obstack_vprintf printf scanf snprintf \
-- sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
-- vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
-- vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
-- wprintf wscanf printf_fp printf_size \
-- fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
-- swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
-- vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
-- wprintf_chk asprintf_chk vasprintf_chk dprintf_chk \
-+ sprintf sscanf vasprintf vdprintf vfprintf \
-+ vfscanf vprintf vscanf vsnprintf \
-+ vsprintf vsscanf \
-+ printf_fp printf_size \
-+ fprintf_chk printf_chk snprintf_chk sprintf_chk \
-+ vfprintf_chk vprintf_chk \
-+ vsnprintf_chk vsprintf_chk \
-+ asprintf_chk vasprintf_chk dprintf_chk \
- vdprintf_chk obstack_printf_chk obstack_vprintf_chk \
- syslog syslog_chk vsyslog vsyslog_chk \
-- strfmon strfmon_l \
- strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
- qecvt qfcvt qgcvt qecvt_r qfcvt_r \
- isinf isnan finite signbit scalb log2 lgamma_r ceil \
-@@ -38,9 +37,15 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
- casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
- cabs carg cimag creal clog10 \
- isoc99_scanf isoc99_fscanf isoc99_sscanf \
-- isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
-+ isoc99_vscanf isoc99_vfscanf isoc99_vsscanf
-+libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
-+libnldbl-calls-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += fwprintf fwscanf \
-+ swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
-+ vwprintf vwscanf wprintf wscanf fwprintf_chk swprintf_chk \
-+ vfwprintf_chk vswprintf_chk vwprintf_chk wprintf_chk \
- isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
- isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
-+libnldbl-calls += $(libnldbl-calls-y)
- libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
- libnldbl-inhibit-o = $(object-suffixes)
- libnldbl-static-only-routines = $(libnldbl-routines)
-diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
-index 0198886..55501cd 100644
---- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
-+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
-@@ -26,6 +26,7 @@
- #include <locale/localeinfo.h>
- #include <sys/syslog.h>
- #include <bits/libc-lock.h>
-+#include <gnu/option-groups.h>
-
- #include "nldbl-compat.h"
-
-@@ -33,20 +34,14 @@ libc_hidden_proto (__nldbl_vfprintf)
- libc_hidden_proto (__nldbl_vsscanf)
- libc_hidden_proto (__nldbl_vsprintf)
- libc_hidden_proto (__nldbl_vfscanf)
--libc_hidden_proto (__nldbl_vfwscanf)
- libc_hidden_proto (__nldbl_vdprintf)
--libc_hidden_proto (__nldbl_vswscanf)
--libc_hidden_proto (__nldbl_vfwprintf)
--libc_hidden_proto (__nldbl_vswprintf)
- libc_hidden_proto (__nldbl_vsnprintf)
- libc_hidden_proto (__nldbl_vasprintf)
- libc_hidden_proto (__nldbl_obstack_vprintf)
--libc_hidden_proto (__nldbl___vfwprintf_chk)
- libc_hidden_proto (__nldbl___vsnprintf_chk)
- libc_hidden_proto (__nldbl___vfprintf_chk)
- libc_hidden_proto (__nldbl___vsyslog_chk)
- libc_hidden_proto (__nldbl___vsprintf_chk)
--libc_hidden_proto (__nldbl___vswprintf_chk)
- libc_hidden_proto (__nldbl___vasprintf_chk)
- libc_hidden_proto (__nldbl___vdprintf_chk)
- libc_hidden_proto (__nldbl___obstack_vprintf_chk)
-@@ -54,8 +49,17 @@ libc_hidden_proto (__nldbl___vstrfmon)
- libc_hidden_proto (__nldbl___vstrfmon_l)
- libc_hidden_proto (__nldbl___isoc99_vsscanf)
- libc_hidden_proto (__nldbl___isoc99_vfscanf)
-+
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+libc_hidden_proto (__nldbl_vfwscanf)
-+libc_hidden_proto (__nldbl_vswscanf)
-+libc_hidden_proto (__nldbl_vfwprintf)
-+libc_hidden_proto (__nldbl_vswprintf)
-+libc_hidden_proto (__nldbl___vfwprintf_chk)
-+libc_hidden_proto (__nldbl___vswprintf_chk)
- libc_hidden_proto (__nldbl___isoc99_vswscanf)
- libc_hidden_proto (__nldbl___isoc99_vfwscanf)
-+#endif
-
- static void
- __nldbl_cleanup (void *arg)
-@@ -117,6 +121,7 @@ __nldbl_fprintf (FILE *stream, const char *fmt, ...)
- }
- weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section weak_function
- __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
-@@ -130,6 +135,7 @@ __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -226,6 +232,7 @@ __nldbl_snprintf (char *s, size_t maxlen, const char *fmt, ...)
- return done;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
-@@ -239,6 +246,7 @@ __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section weak_function
-@@ -264,6 +272,7 @@ __nldbl_vdprintf (int d, const char *fmt, va_list arg)
- }
- libc_hidden_def (__nldbl_vdprintf)
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section weak_function
- __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
-@@ -275,6 +284,7 @@ __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
- return res;
- }
- libc_hidden_def (__nldbl_vfwprintf)
-+#endif
-
- int
- attribute_compat_text_section
-@@ -297,6 +307,7 @@ __nldbl_vsnprintf (char *string, size_t maxlen, const char *fmt,
- libc_hidden_def (__nldbl_vsnprintf)
- weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section weak_function
- __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
-@@ -330,6 +341,7 @@ __nldbl_wprintf (const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -419,6 +431,7 @@ __nldbl_scanf (const char *fmt, ...)
- return done;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
-@@ -491,6 +504,7 @@ __nldbl_wscanf (const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -506,6 +520,7 @@ __nldbl___fprintf_chk (FILE *stream, int flag, const char *fmt, ...)
- return done;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
-@@ -519,6 +534,7 @@ __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -563,6 +579,7 @@ __nldbl___sprintf_chk (char *s, int flag, size_t slen, const char *fmt, ...)
- return done;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
-@@ -577,6 +594,7 @@ __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -590,6 +608,7 @@ __nldbl___vfprintf_chk (FILE *s, int flag, const char *fmt, va_list ap)
- }
- libc_hidden_def (__nldbl___vfprintf_chk)
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
-@@ -601,6 +620,7 @@ __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
- return res;
- }
- libc_hidden_def (__nldbl___vfwprintf_chk)
-+#endif
-
- int
- attribute_compat_text_section
-@@ -635,6 +655,7 @@ __nldbl___vsprintf_chk (char *string, int flag, size_t slen, const char *fmt,
- }
- libc_hidden_def (__nldbl___vsprintf_chk)
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
-@@ -668,6 +689,7 @@ __nldbl___wprintf_chk (int flag, const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- int
- attribute_compat_text_section
-@@ -775,6 +797,7 @@ __nldbl___printf_fp (FILE *fp, const struct printf_info *info,
- return ___printf_fp (fp, &info_no_ldbl, args);
- }
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- ssize_t
- attribute_compat_text_section
- __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
-@@ -829,6 +852,7 @@ __nldbl___vstrfmon_l (char *s, size_t maxsize, __locale_t loc,
- return res;
- }
- libc_hidden_def (__nldbl___vstrfmon_l)
-+#endif
-
- void
- attribute_compat_text_section
-@@ -941,6 +965,7 @@ __nldbl___isoc99_scanf (const char *fmt, ...)
- return done;
- }
-
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- int
- attribute_compat_text_section
- __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
-@@ -1014,6 +1039,7 @@ __nldbl___isoc99_wscanf (const wchar_t *fmt, ...)
-
- return done;
- }
-+#endif
-
- #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
- compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
-@@ -1057,6 +1083,7 @@ compat_symbol (libc, __nldbl_printf_size, printf_size, GLIBC_2_1);
- compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
- #endif
- #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
-+# if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
- compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
- compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
- compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
-@@ -1069,6 +1096,7 @@ compat_symbol (libc, __nldbl_vfwscanf, vfwscanf, GLIBC_2_2);
- compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
- compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
- compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
-+# endif
- #endif
- #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
- compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
-diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
-index 0d2c8af..f4cea50 100644
---- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
-+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
-@@ -30,6 +30,7 @@
- #include <math.h>
- #include <monetary.h>
- #include <sys/syslog.h>
-+#include <gnu/option-groups.h>
-
-
- /* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
-@@ -37,19 +38,15 @@
-
- NLDBL_DECL (_IO_vfscanf);
- NLDBL_DECL (vfscanf);
--NLDBL_DECL (vfwscanf);
- NLDBL_DECL (obstack_vprintf);
- NLDBL_DECL (vasprintf);
- NLDBL_DECL (dprintf);
- NLDBL_DECL (vdprintf);
- NLDBL_DECL (fprintf);
- NLDBL_DECL (vfprintf);
--NLDBL_DECL (vfwprintf);
- NLDBL_DECL (vsnprintf);
- NLDBL_DECL (vsprintf);
- NLDBL_DECL (vsscanf);
--NLDBL_DECL (vswprintf);
--NLDBL_DECL (vswscanf);
- NLDBL_DECL (__asprintf);
- NLDBL_DECL (asprintf);
- NLDBL_DECL (__printf_fp);
-@@ -66,12 +63,18 @@ NLDBL_DECL (__isoc99_sscanf);
- NLDBL_DECL (__isoc99_vscanf);
- NLDBL_DECL (__isoc99_vfscanf);
- NLDBL_DECL (__isoc99_vsscanf);
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+NLDBL_DECL (vfwscanf);
-+NLDBL_DECL (vfwprintf);
-+NLDBL_DECL (vswprintf);
-+NLDBL_DECL (vswscanf);
- NLDBL_DECL (__isoc99_wscanf);
- NLDBL_DECL (__isoc99_fwscanf);
- NLDBL_DECL (__isoc99_swscanf);
- NLDBL_DECL (__isoc99_vwscanf);
- NLDBL_DECL (__isoc99_vfwscanf);
- NLDBL_DECL (__isoc99_vswscanf);
-+#endif
-
- /* This one does not exist in the normal interface, only
- __nldbl___vstrfmon really exists. */
-@@ -82,22 +85,23 @@ extern ssize_t __nldbl___vstrfmon (char *, size_t, const char *, va_list)
- since we don't compile with _FORTIFY_SOURCE. */
- extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
- const char *__restrict, _G_va_list);
--extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
-- const wchar_t *__restrict, __gnuc_va_list);
- extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
- const char *__restrict, _G_va_list) __THROW;
- extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
- const char *__restrict, _G_va_list)
- __THROW;
--extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
-- const wchar_t *__restrict, __gnuc_va_list)
-- __THROW;
- extern int __nldbl___vasprintf_chk (char **, int, const char *, _G_va_list)
- __THROW;
- extern int __nldbl___vdprintf_chk (int, int, const char *, _G_va_list);
- extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
- _G_va_list) __THROW;
- extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
--
-+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
-+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
-+ const wchar_t *__restrict, __gnuc_va_list);
-+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
-+ const wchar_t *__restrict, __gnuc_va_list)
-+ __THROW;
-+#endif
-
- #endif /* __NLDBL_COMPAT_H */
-diff --git a/sysdeps/nptl/Makefile b/sysdeps/nptl/Makefile
-index e9339a3..782009b 100644
---- a/sysdeps/nptl/Makefile
-+++ b/sysdeps/nptl/Makefile
-@@ -18,6 +18,9 @@
-
- ifeq ($(subdir),nptl)
- libpthread-sysdep_routines += errno-loc
-+ifeq ($(OPTION_EGLIBC_BIG_MACROS),n)
-+sysdep_routines += small-macros-fns
-+endif
- endif
-
- ifeq ($(subdir),rt)
-diff --git a/sysdeps/nptl/bits/libc-lock.h b/sysdeps/nptl/bits/libc-lock.h
-index 5599cf1..b839378 100644
---- a/sysdeps/nptl/bits/libc-lock.h
-+++ b/sysdeps/nptl/bits/libc-lock.h
-@@ -24,6 +24,14 @@
- #include <stddef.h>
-
-
-+#ifdef _LIBC
-+# include <lowlevellock.h>
-+# include <tls.h>
-+# include <pthread-functions.h>
-+# include <errno.h> /* For EBUSY. */
-+# include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
-+#endif
-+
- /* Mutex type. */
- #if defined _LIBC || defined _IO_MTSAFE_IO
- # if (!IS_IN (libc) && !IS_IN (libpthread)) || !defined _LIBC
-@@ -87,6 +95,15 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
-
- /* Lock the recursive named lock variable. */
- #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern void __libc_lock_lock_recursive_fn (__libc_lock_recursive_t *);
-+libc_hidden_proto (__libc_lock_lock_recursive_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
-+
- # define __libc_lock_lock_recursive(NAME) \
- do { \
- void *self = THREAD_SELF; \
-@@ -97,6 +114,10 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
- } \
- ++(NAME).cnt; \
- } while (0)
-+# else
-+# define __libc_lock_lock_recursive(NAME) \
-+ __libc_lock_lock_recursive_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # define __libc_lock_lock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
-@@ -104,6 +125,14 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
-
- /* Try to lock the recursive named lock variable. */
- #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern int __libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *);
-+libc_hidden_proto (__libc_lock_trylock_recursive_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
- # define __libc_lock_trylock_recursive(NAME) \
- ({ \
- int result = 0; \
-@@ -122,6 +151,10 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
- ++(NAME).cnt; \
- result; \
- })
-+# else
-+# define __libc_lock_trylock_recursive(NAME) \
-+ __libc_lock_trylock_recursive_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # define __libc_lock_trylock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
-@@ -129,6 +162,14 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
-
- /* Unlock the recursive named lock variable. */
- #if defined _LIBC && (IS_IN (libc) || IS_IN (libpthread))
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern void __libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *);
-+libc_hidden_proto (__libc_lock_unlock_recursive_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
- /* We do no error checking here. */
- # define __libc_lock_unlock_recursive(NAME) \
- do { \
-@@ -138,6 +179,10 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t;
- lll_unlock ((NAME).lock, LLL_PRIVATE); \
- } \
- } while (0)
-+# else
-+# define __libc_lock_unlock_recursive(NAME) \
-+ __libc_lock_unlock_recursive_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # define __libc_lock_unlock_recursive(NAME) \
- __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
-diff --git a/sysdeps/nptl/bits/libc-lockP.h b/sysdeps/nptl/bits/libc-lockP.h
-index f55f621..da98869 100644
---- a/sysdeps/nptl/bits/libc-lockP.h
-+++ b/sysdeps/nptl/bits/libc-lockP.h
-@@ -33,6 +33,8 @@
- #include <lowlevellock.h>
- #include <tls.h>
- #include <pthread-functions.h>
-+#include <errno.h> /* For EBUSY. */
-+#include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
-
- #if IS_IN (libpthread)
- /* This gets us the declarations of the __pthread_* internal names,
-@@ -171,10 +173,22 @@ typedef pthread_key_t __libc_key_t;
-
- /* Lock the named lock variable. */
- #if IS_IN (libc) || IS_IN (libpthread)
--# ifndef __libc_lock_lock
--# define __libc_lock_lock(NAME) \
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern void __libc_lock_lock_fn (__libc_lock_t *);
-+libc_hidden_proto (__libc_lock_lock_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
-+# ifndef __libc_lock_lock
-+# define __libc_lock_lock(NAME) \
- ({ lll_lock (NAME, LLL_PRIVATE); 0; })
--# endif
-+# endif
-+# else
-+# define __libc_lock_lock(NAME) \
-+ __libc_lock_lock_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # undef __libc_lock_lock
- # define __libc_lock_lock(NAME) \
-@@ -187,10 +201,22 @@ typedef pthread_key_t __libc_key_t;
-
- /* Try to lock the named lock variable. */
- #if IS_IN (libc) || IS_IN (libpthread)
--# ifndef __libc_lock_trylock
--# define __libc_lock_trylock(NAME) \
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern int __libc_lock_trylock_fn (__libc_lock_t *);
-+libc_hidden_proto (__libc_lock_trylock_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
-+# ifndef __libc_lock_trylock
-+# define __libc_lock_trylock(NAME) \
- lll_trylock (NAME)
--# endif
-+# endif
-+# else
-+# define __libc_lock_trylock(NAME) \
-+ __libc_lock_trylock_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # undef __libc_lock_trylock
- # define __libc_lock_trylock(NAME) \
-@@ -206,8 +232,20 @@ typedef pthread_key_t __libc_key_t;
-
- /* Unlock the named lock variable. */
- #if IS_IN (libc) || IS_IN (libpthread)
-+# if __OPTION_EGLIBC_BIG_MACROS != 1
-+/* EGLIBC: Declare wrapper function for a big macro if either
-+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
-+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
-+extern void __libc_lock_unlock_fn (__libc_lock_t *);
-+libc_hidden_proto (__libc_lock_unlock_fn);
-+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
-+# if __OPTION_EGLIBC_BIG_MACROS
- # define __libc_lock_unlock(NAME) \
- lll_unlock (NAME, LLL_PRIVATE)
-+# else
-+# define __libc_lock_unlock(NAME) \
-+ __libc_lock_unlock_fn (&(NAME))
-+# endif /* __OPTION_EGLIBC_BIG_MACROS */
- #else
- # define __libc_lock_unlock(NAME) \
- __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
-diff --git a/sysdeps/nptl/small-macros-fns.c b/sysdeps/nptl/small-macros-fns.c
-new file mode 100644
-index 0000000..f751053
---- /dev/null
-+++ b/sysdeps/nptl/small-macros-fns.c
-@@ -0,0 +1,72 @@
-+/* EGLIBC: function wrappers for big macros.
-+ Copyright (C) 2009 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public License as
-+ published by the Free Software Foundation; either version 2.1 of the
-+ License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; see the file COPYING.LIB. If not,
-+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ Boston, MA 02111-1307, USA. */
-+
-+#include <gnu/option-groups.h>
-+
-+/* Handle macros from ./bits/libc-lock.h. */
-+#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
-+
-+/* Get the macros for function bodies through a back door. */
-+# undef __OPTION_EGLIBC_BIG_MACROS
-+# define __OPTION_EGLIBC_BIG_MACROS 2
-+# include <bits/libc-lock.h>
-+
-+void
-+__libc_lock_lock_fn (__libc_lock_t *name)
-+{
-+ __libc_lock_lock (*name);
-+}
-+libc_hidden_def (__libc_lock_lock_fn);
-+
-+void
-+__libc_lock_lock_recursive_fn (__libc_lock_recursive_t *name)
-+{
-+ __libc_lock_lock_recursive (*name);
-+}
-+libc_hidden_def (__libc_lock_lock_recursive_fn);
-+
-+int
-+__libc_lock_trylock_fn (__libc_lock_t *name)
-+{
-+ return __libc_lock_trylock (*name);
-+}
-+libc_hidden_def (__libc_lock_trylock_fn);
-+
-+int
-+__libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *name)
-+{
-+ return __libc_lock_trylock_recursive (*name);
-+}
-+libc_hidden_def (__libc_lock_trylock_recursive_fn);
-+
-+void
-+__libc_lock_unlock_fn (__libc_lock_t *name)
-+{
-+ __libc_lock_unlock (*name);
-+}
-+libc_hidden_def (__libc_lock_unlock_fn);
-+
-+void
-+__libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *name)
-+{
-+ __libc_lock_unlock_recursive (*name);
-+}
-+libc_hidden_def (__libc_lock_unlock_recursive_fn);
-+
-+#endif /*defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)*/
-diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c
-index 26e4692..d0a26c8 100644
---- a/sysdeps/unix/sysv/linux/gethostid.c
-+++ b/sysdeps/unix/sysv/linux/gethostid.c
-@@ -21,6 +21,7 @@
- #include <unistd.h>
- #include <netdb.h>
- #include <not-cancel.h>
-+#include <gnu/option-groups.h>
-
- #define HOSTIDFILE "/etc/hostid"
-
-@@ -89,6 +90,7 @@ gethostid (void)
- return id;
- }
-
-+#if __OPTION_EGLIBC_INET
- /* Getting from the file was not successful. An intelligent guess for
- a unique number of a host is its IP address. Return this. */
- if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
-@@ -115,5 +117,9 @@ gethostid (void)
- /* For the return value to be not exactly the IP address we do some
- bit fiddling. */
- return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
-+#else
-+ /* Return an arbitrary value. */
-+ return 0;
-+#endif
- }
- #endif
-diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c
-index 53a8bbb..cb110d4 100644
---- a/sysdeps/unix/sysv/linux/libc_fatal.c
-+++ b/sysdeps/unix/sysv/linux/libc_fatal.c
-@@ -23,6 +23,7 @@
- #include <string.h>
- #include <sys/mman.h>
- #include <sys/uio.h>
-+#include <gnu/option-groups.h>
-
- static bool
- writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
-@@ -40,6 +41,7 @@ writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
- static void
- backtrace_and_maps (int do_abort, bool written, int fd)
- {
-+#if __OPTION_EGLIBC_BACKTRACE
- if (do_abort > 1 && written)
- {
- void *addrs[64];
-@@ -62,6 +64,7 @@ backtrace_and_maps (int do_abort, bool written, int fd)
- close_not_cancel_no_status (fd2);
- }
- }
-+#endif /* __OPTION_EGLIBC_BACKTRACE */
- }
- #define BEFORE_ABORT backtrace_and_maps
-
-diff --git a/time/Makefile b/time/Makefile
-index a411f62..2d022ca 100644
---- a/time/Makefile
-+++ b/time/Makefile
-@@ -18,6 +18,8 @@
- #
- # Makefile for time routines
- #
-+include ../option-groups.mak
-+
- subdir := time
-
- include ../Makeconfig
-@@ -30,15 +32,23 @@ routines := offtime asctime clock ctime ctime_r difftime \
- tzfile getitimer setitimer \
- stime dysize timegm ftime \
- getdate strptime strptime_l \
-- strftime wcsftime strftime_l wcsftime_l \
-+ strftime strftime_l \
- timespec_get
--aux := era alt_digit lc-time-cleanup
-
--tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
-- tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ := wcsftime wcsftime_l
-+aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup
-+
-+tests := test_time clocktest tst-posixtz \
-+ tst-getdate tst-mktime tst-mktime2 tst-strftime \
- tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
- tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime
-
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-strptime tst-ftime_l
-+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-+ += tst_wcsftime
-+
- include ../Rules
-
- tz-cflags = -DTZDIR='"$(zonedir)"' \
-diff --git a/time/strftime_l.c b/time/strftime_l.c
-index b48ef34..bfdd618 100644
---- a/time/strftime_l.c
-+++ b/time/strftime_l.c
-@@ -35,6 +35,10 @@
- # include "../locale/localeinfo.h"
- #endif
-
-+#ifdef _LIBC
-+# include <gnu/option-groups.h>
-+#endif
-+
- #if defined emacs && !defined HAVE_BCOPY
- # define HAVE_MEMCPY 1
- #endif
-@@ -882,7 +886,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
- case L_('C'):
- if (modifier == L_('E'))
- {
--#if HAVE_STRUCT_ERA_ENTRY
-+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
-@@ -955,7 +959,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
-
- if (modifier == L_('O') && 0 <= number_value)
- {
--#ifdef _NL_CURRENT
-+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
- /* Get the locale specific alternate representation of
- the number NUMBER_VALUE. If none exist NULL is returned. */
- const CHAR_T *cp = nl_get_alt_digit (number_value
-@@ -1260,7 +1264,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
- case L_('Y'):
- if (modifier == 'E')
- {
--#if HAVE_STRUCT_ERA_ENTRY
-+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
-@@ -1285,7 +1289,7 @@ __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
- case L_('y'):
- if (modifier == L_('E'))
- {
--#if HAVE_STRUCT_ERA_ENTRY
-+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
- struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
- if (era)
- {
-diff --git a/time/strptime_l.c b/time/strptime_l.c
-index 5640cce..784ccbc 100644
---- a/time/strptime_l.c
-+++ b/time/strptime_l.c
-@@ -29,6 +29,7 @@
-
- #ifdef _LIBC
- # define HAVE_LOCALTIME_R 0
-+# include <gnu/option-groups.h>
- # include "../locale/localeinfo.h"
- #endif
-
-@@ -84,7 +85,7 @@ localtime_r (t, tp)
- if (val < from || val > to) \
- return NULL; \
- } while (0)
--#ifdef _NL_CURRENT
-+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
- # define get_alt_number(from, to, n) \
- ({ \
- __label__ do_normal; \
-@@ -257,8 +258,10 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
- int cnt;
- int cnt_longest;
- size_t val;
-+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
- size_t num_eras;
- struct era_entry *era = NULL;
-+#endif
- enum ptime_locale_status { not, loc, raw } decided_longest;
- struct __strptime_state
- {
-@@ -820,6 +823,7 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
- s.want_xday = 1;
- break;
- case 'C':
-+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
- if (s.decided != raw)
- {
- if (s.era_cnt >= 0)
-@@ -856,10 +860,12 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
-
- s.decided = raw;
- }
-+#endif
- /* The C locale has no era information, so use the
- normal representation. */
- goto match_century;
- case 'y':
-+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
- if (s.decided != raw)
- {
- get_number(0, 9999, 4);
-@@ -918,9 +924,10 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
-
- s.decided = raw;
- }
--
-+#endif
- goto match_year_in_century;
- case 'Y':
-+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
- if (s.decided != raw)
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
-@@ -948,6 +955,7 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
-
- s.decided = raw;
- }
-+#endif
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- s.want_century = 0;
-@@ -1118,6 +1126,7 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
- tm->tm_year = (s.century - 19) * 100;
- }
-
-+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
- if (s.era_cnt != -1)
- {
- era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
-@@ -1132,6 +1141,7 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
- tm->tm_year = era->start_date[0];
- }
- else
-+#endif
- if (s.want_era)
- {
- /* No era found but we have seen an E modifier. Rectify some
-diff --git a/timezone/Makefile b/timezone/Makefile
-index 886b06e..f922684 100644
---- a/timezone/Makefile
-+++ b/timezone/Makefile
-@@ -127,7 +127,7 @@ $(testdata)/XT%: testdata/XT%
-
- $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
- sed -e 's|/bin/bash|/bin/sh|' \
-- -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
-+ -e '/TZDIR=/s|\$$(pwd)|$(zonedir)|' \
- -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
- -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
- -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
-diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
-index 44a4494..db9fc24 100644
---- a/wcsmbs/Makefile
-+++ b/wcsmbs/Makefile
-@@ -18,15 +18,21 @@
- #
- # Sub-makefile for wcsmbs portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := wcsmbs
-
- include ../Makeconfig
-
- headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h
-
--routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
-+# These functions are used by printf_fp.c, even in the plain case; see
-+# comments there for OPTION_EGLIBC_LOCALE_CODE.
-+routines := wmemcpy wmemset
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
- wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstok wcsstr wmemchr \
-- wmemcmp wmemcpy wmemmove wmemset wcpcpy wcpncpy wmempcpy \
-+ wmemcmp wmemmove wcpcpy wcpncpy wmempcpy \
- btowc wctob mbsinit \
- mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \
- mbsnrtowcs wcsnrtombs wcsnlen wcschrnul \
-@@ -38,14 +44,21 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
- wcscoll_l wcsxfrm_l \
- wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
- wcsmbsload mbsrtowcs_l \
-- isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
- isoc99_swscanf isoc99_vswscanf \
- mbrtoc16 c16rtomb
-
--strop-tests := wcscmp wcsncmp wmemcmp wcslen wcschr wcsrchr wcscpy
--tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
-- tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
-- tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
-+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-+ += isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
-+
-+strop-tests := wcscmp wmemcmp wmemcmp wcslen wcschr wcsrchr wcscpy
-+
-+tests := tst-wchar-h
-+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
-+ += tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb tst-c16c32-1
-+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += tst-wcstof wcsmbs-tst1 tst-wcsnlen \
-+ tst-wcpncpy tst-mbsrtowcs \
-+ wcsatcliff $(addprefix test-,$(strop-tests))
-
- include ../Rules
-
-diff --git a/wcsmbs/wcsmbsload.c b/wcsmbs/wcsmbsload.c
-index 6bb49bc..2ab9d07 100644
---- a/wcsmbs/wcsmbsload.c
-+++ b/wcsmbs/wcsmbsload.c
-@@ -21,6 +21,7 @@
- #include <limits.h>
- #include <stdlib.h>
- #include <string.h>
-+#include <gnu/option-groups.h>
-
- #include <locale/localeinfo.h>
- #include <wcsmbsload.h>
-@@ -143,6 +144,7 @@ __wcsmbs_getfct (const char *to, const char *from, size_t *nstepsp)
- })
-
-
-+#if __OPTION_EGLIBC_LOCALE_CODE
- /* Some of the functions here must not be used while setlocale is called. */
- __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
-
-@@ -211,6 +213,17 @@ __wcsmbs_load_conv (struct __locale_data *new_category)
-
- __libc_rwlock_unlock (__libc_setlocale_lock);
- }
-+#else
-+void
-+internal_function
-+__wcsmbs_load_conv (struct __locale_data *new_category)
-+{
-+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, we should never reach
-+ this point: there is no way to change locales, so every locale
-+ passed to get_gconv_fcts should be _nl_C_LC_CTYPE. */
-+ abort ();
-+}
-+#endif
-
-
- /* Clone the current conversion function set. */
-diff --git a/wctype/Makefile b/wctype/Makefile
-index c56f07c..4e8af43 100644
---- a/wctype/Makefile
-+++ b/wctype/Makefile
-@@ -18,14 +18,20 @@
- #
- # Sub-makefile for wctype portion of the library.
- #
-+include ../option-groups.mak
-+
- subdir := wctype
-
- include ../Makeconfig
-
- headers := wctype.h
--routines := wcfuncs wctype iswctype wctrans towctrans \
-- wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
--
--tests := test_wctype test_wcfuncs bug-wctypeh
-+routines := wctrans towctrans towctrans_l
-+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ := wcfuncs wctype iswctype \
-+ wcfuncs_l wctype_l iswctype_l wctrans_l
-+
-+tests :=
-+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
-+ += test_wctype test_wcfuncs bug-wctypeh
-
- include ../Rules
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
new file mode 100644
index 0000000000..50c2e14735
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch
@@ -0,0 +1,80 @@
+From 13bc0e53cc91e102472d532f28b3d44c30d291fc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 3 Aug 2018 09:42:06 -0700
+Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path
+
+it doesn't exist in normal use, and there's no way to pass an
+alternative filename.
+
+Add a fallback of $LOCALEARCHIVE from the environment, and allow
+creation of new locale archives that are not the system archive.
+
+Upstream-Status: Inappropriate (OE-specific)
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/programs/locarchive.c | 35 +++++++++++++++++++++++++----------
+ 1 file changed, 25 insertions(+), 10 deletions(-)
+
+diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
+index f38e835c52..8d8f8699b2 100644
+--- a/locale/programs/locarchive.c
++++ b/locale/programs/locarchive.c
+@@ -340,12 +340,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
+ struct namehashent *oldnamehashtab;
+ struct locarhandle new_ah;
+ size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
+- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)];
+- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1];
++ char *archivefname;
++ char *fname;
++ char *envarchive = getenv("LOCALEARCHIVE");
+
+- if (output_prefix)
+- memcpy (archivefname, output_prefix, prefix_len);
+- strcpy (archivefname + prefix_len, ARCHIVE_NAME);
++ if (envarchive != NULL)
++ {
++ archivefname = xmalloc(strlen(envarchive) + 1);
++ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX"));
++ strcpy (archivefname, envarchive);
++ }
++ else
++ {
++ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME));
++ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1);
++ if (output_prefix)
++ memcpy (archivefname, output_prefix, prefix_len);
++ strcpy (archivefname + prefix_len, ARCHIVE_NAME);
++ }
+ strcpy (stpcpy (fname, archivefname), ".XXXXXX");
+
+ /* Not all of the old file has to be mapped. Change this now this
+@@ -569,10 +581,13 @@ open_archive (struct locarhandle *ah, bool readonly)
+ /* If ah has a non-NULL fname open that otherwise open the default. */
+ if (archivefname == NULL)
+ {
+- archivefname = default_fname;
+- if (output_prefix)
+- memcpy (default_fname, output_prefix, prefix_len);
+- strcpy (default_fname + prefix_len, ARCHIVE_NAME);
++ archivefname = getenv("LOCALEARCHIVE");
++ if (archivefname == NULL) {
++ archivefname = default_fname;
++ if (output_prefix)
++ memcpy (default_fname, output_prefix, prefix_len);
++ strcpy (default_fname + prefix_len, ARCHIVE_NAME);
++ }
+ }
+
+ while (1)
+@@ -585,7 +600,7 @@ open_archive (struct locarhandle *ah, bool readonly)
+ the default locale archive we ignore the failure and
+ list an empty archive, otherwise we print an error
+ and exit. */
+- if (errno == ENOENT && archivefname == default_fname)
++ if (errno == ENOENT)
+ {
+ if (readonly)
+ {
diff --git a/meta/recipes-core/glibc/glibc/0025-eglibc-Install-PIC-archives.patch b/meta/recipes-core/glibc/glibc/0025-eglibc-Install-PIC-archives.patch
deleted file mode 100644
index c359cce9c5..0000000000
--- a/meta/recipes-core/glibc/glibc/0025-eglibc-Install-PIC-archives.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-From 5773417fa91a18cd39fb35c9907d72af0ed9ea33 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 01:57:01 +0000
-Subject: [PATCH 25/27] eglibc: Install PIC archives
-
-Forward port from eglibc
-
-2008-02-07 Joseph Myers <joseph@codesourcery.com>
-
- * Makerules (install-extras, install-map): New variables.
- (installed-libcs): Add libc_pic.a.
- (install-lib): Include _pic.a files for versioned shared
- libraries.
- (install-map-nosubdir, install-extras-nosubdir): Add rules for
- installing extra files.
- (install-no-libc.a-nosubdir): Depend on install-map-nosubdir and
- install-extras-nosubdir.
-
-2008-04-01 Maxim Kuvyrkov <maxim@codesourcery.com>
-
- * Makerules (install-lib): Don't install libpthread_pic.a.
- (install-map): Don't install libpthread_pic.map.
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makerules | 42 ++++++++++++++++++++++++++++++++++++++++--
- 1 file changed, 40 insertions(+), 2 deletions(-)
-
-diff --git a/Makerules b/Makerules
-index 1dd41aa..41778e1 100644
---- a/Makerules
-+++ b/Makerules
-@@ -713,6 +713,9 @@ ifeq ($(build-shared),yes)
- $(common-objpfx)libc.so: $(common-objpfx)libc.map
- endif
- common-generated += libc.so libc_pic.os
-+ifndef subdir
-+install-extras := soinit.o sofini.o
-+endif
- ifdef libc.so-version
- $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
- $(make-link)
-@@ -955,6 +958,7 @@ endif
-
- install: check-install-supported
-
-+installed-libcs := $(installed-libcs) $(inst_libdir)/libc_pic.a
- install: $(installed-libcs)
- $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
- $(make-target-directory)
-@@ -983,6 +987,22 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
- install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
- install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
-
-+# Install the _pic.a files for versioned libraries, and corresponding
-+# .map files.
-+# libpthread_pic.a breaks mklibs, so don't install it and its map.
-+install-lib := $(install-lib) $(install-lib.so-versioned:%.so=%_pic.a)
-+install-lib := $(filter-out libpthread_pic.a,$(install-lib))
-+# Despite having a soname libhurduser and libmachuser do not use symbol
-+# versioning, so don't install the corresponding .map files.
-+ifeq ($(build-shared),yes)
-+install-map := $(patsubst %.so,%.map,\
-+ $(foreach L,$(install-lib.so-versioned),$(notdir $L)))
-+install-map := $(filter-out libhurduser.map libmachuser.map libpthread.map,$(install-map))
-+ifndef subdir
-+install-map := $(install-map) libc.map
-+endif
-+endif
-+
- # For versioned libraries, we install three files:
- # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
- # $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
-@@ -1225,9 +1245,22 @@ $(addprefix $(inst_includedir)/,$(headers-nonh)): $(inst_includedir)/%: \
- endif # headers-nonh
- endif # headers
-
-+ifdef install-map
-+$(addprefix $(inst_libdir)/,$(patsubst lib%.map,lib%_pic.map,$(install-map))): \
-+ $(inst_libdir)/lib%_pic.map: $(common-objpfx)lib%.map $(+force)
-+ $(do-install)
-+endif
-+
-+ifdef install-extras
-+$(addprefix $(inst_libdir)/libc_pic/,$(install-extras)): \
-+ $(inst_libdir)/libc_pic/%.o: $(elf-objpfx)%.os $(+force)
-+ $(do-install)
-+endif
-+
- .PHONY: install-bin-nosubdir install-bin-script-nosubdir \
- install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
-- install-data-nosubdir install-headers-nosubdir
-+ install-data-nosubdir install-headers-nosubdir install-map-nosubdir \
-+ install-extras-nosubdir
- install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
- install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
- install-rootsbin-nosubdir: \
-@@ -1240,6 +1273,10 @@ install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
- install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
- install-others-nosubdir: $(install-others)
- install-others-programs-nosubdir: $(install-others-programs)
-+install-map-nosubdir: $(addprefix $(inst_libdir)/,\
-+ $(patsubst lib%.map,lib%_pic.map,$(install-map)))
-+install-extras-nosubdir: $(addprefix $(inst_libdir)/libc_pic/,\
-+ $(install-extras))
-
- # We need all the `-nosubdir' targets so that `install' in the parent
- # doesn't depend on several things which each iterate over the subdirs.
-@@ -1249,7 +1286,8 @@ install-%:: install-%-nosubdir ;
-
- .PHONY: install install-no-libc.a-nosubdir
- install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
-- install-lib-nosubdir install-others-nosubdir
-+ install-lib-nosubdir install-others-nosubdir \
-+ install-map-nosubdir install-extras-nosubdir
- ifeq ($(build-programs),yes)
- install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
- install-rootsbin-nosubdir install-sbin-nosubdir \
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch b/meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
new file mode 100644
index 0000000000..fb0a609dbb
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch
@@ -0,0 +1,53 @@
+From 50b605dece16606dd9d1c737e579c13725eab11d Mon Sep 17 00:00:00 2001
+From: Mark Hatle <mark.hatle@windriver.com>
+Date: Thu, 18 Aug 2016 14:07:58 -0500
+Subject: [PATCH] elf/dl-deps.c: Make _dl_build_local_scope breadth first
+
+According to the ELF specification:
+
+When resolving symbolic references, the dynamic linker examines the symbol
+tables with a breadth-first search.
+
+This function was using a depth first search. By doing so the conflict
+resolution reported to the prelinker (when LD_TRACE_PRELINKING=1 is set)
+was incorrect. This caused problems when their were various circular
+dependencies between libraries. The problem usually manifested itself by
+the wrong IFUNC being executed.
+
+[BZ# 20488]
+
+Upstream-Status: Submitted [libc-alpha]
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+---
+ elf/dl-deps.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/elf/dl-deps.c b/elf/dl-deps.c
+index 087a49b212..c09f9334f2 100644
+--- a/elf/dl-deps.c
++++ b/elf/dl-deps.c
+@@ -73,13 +73,19 @@ _dl_build_local_scope (struct link_map **list, struct link_map *map)
+ {
+ struct link_map **p = list;
+ struct link_map **q;
++ struct link_map **r;
+
+ *p++ = map;
+ map->l_reserved = 1;
+- if (map->l_initfini)
+- for (q = map->l_initfini + 1; *q; ++q)
+- if (! (*q)->l_reserved)
+- p += _dl_build_local_scope (p, *q);
++
++ for (r = list; r < p; ++r)
++ if ((*r)->l_initfini)
++ for (q = (*r)->l_initfini + 1; *q; ++q)
++ if (! (*q)->l_reserved)
++ {
++ *p++ = *q;
++ (*q)->l_reserved = 1;
++ }
+ return p - list;
+ }
+
diff --git a/meta/recipes-core/glibc/glibc/0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch b/meta/recipes-core/glibc/glibc/0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch
deleted file mode 100644
index 6b611dbde7..0000000000
--- a/meta/recipes-core/glibc/glibc/0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch
+++ /dev/null
@@ -1,556 +0,0 @@
-From ba069b3107f5ad200c4ab95e69cf368e2353b00a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 18 Mar 2015 00:46:50 +0000
-Subject: [PATCH 26/27] eglibc: dl_debug_mask is controlled by
- __OPTION_EGLIBC_RTLD_DEBUG
-
-use GLRO_dl_debug_mask
-
-Singed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- csu/libc-start.c | 4 ++--
- elf/dl-cache.c | 4 ++--
- elf/dl-close.c | 6 +++---
- elf/dl-conflict.c | 2 +-
- elf/dl-deps.c | 6 +++---
- elf/dl-error.c | 2 +-
- elf/dl-fini.c | 4 ++--
- elf/dl-init.c | 4 ++--
- elf/dl-load.c | 16 ++++++++--------
- elf/dl-lookup.c | 14 +++++++-------
- elf/dl-object.c | 2 +-
- elf/dl-open.c | 10 +++++-----
- elf/dl-reloc.c | 2 +-
- elf/dl-version.c | 2 +-
- elf/get-dynamic-info.h | 2 +-
- elf/rtld.c | 22 +++++++++++-----------
- 16 files changed, 51 insertions(+), 51 deletions(-)
-
-diff --git a/csu/libc-start.c b/csu/libc-start.c
-index 0afa7c0..2151fb6 100644
---- a/csu/libc-start.c
-+++ b/csu/libc-start.c
-@@ -238,7 +238,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
-
- /* Call the initializer of the program, if any. */
- #ifdef SHARED
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
- GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
- #endif
- if (init)
-@@ -261,7 +261,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
- #endif
-
- #ifdef SHARED
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
- GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
- #endif
-
-diff --git a/elf/dl-cache.c b/elf/dl-cache.c
-index 862f1d8..dab9c51 100644
---- a/elf/dl-cache.c
-+++ b/elf/dl-cache.c
-@@ -194,7 +194,7 @@ _dl_load_cache_lookup (const char *name)
- const char *best;
-
- /* Print a message if the loading of libs is traced. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
-
- if (cache == NULL)
-@@ -292,7 +292,7 @@ _dl_load_cache_lookup (const char *name)
- }
-
- /* Print our result if wanted. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
- && best != NULL)
- _dl_debug_printf (" trying file=%s\n", best);
-
-diff --git a/elf/dl-close.c b/elf/dl-close.c
-index c897247..b1b4bd5 100644
---- a/elf/dl-close.c
-+++ b/elf/dl-close.c
-@@ -125,7 +125,7 @@ _dl_close_worker (struct link_map *map, bool force)
- dl_close_state = rerun;
-
- /* There are still references to this object. Do nothing more. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
- map->l_name, map->l_direct_opencount);
-
-@@ -269,7 +269,7 @@ _dl_close_worker (struct link_map *map, bool force)
- if (imap->l_init_called)
- {
- /* When debugging print a message first. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
- 0))
- _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
- imap->l_name, nsid);
-@@ -711,7 +711,7 @@ _dl_close_worker (struct link_map *map, bool force)
- free (imap->l_reldeps);
-
- /* Print debugging message. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
- imap->l_name, imap->l_ns);
-
-diff --git a/elf/dl-conflict.c b/elf/dl-conflict.c
-index 47a946e..e6a3f21 100644
---- a/elf/dl-conflict.c
-+++ b/elf/dl-conflict.c
-@@ -32,7 +32,7 @@ _dl_resolve_conflicts (struct link_map *l, ElfW(Rela) *conflict,
- ElfW(Rela) *conflictend)
- {
- #if ! ELF_MACHINE_NO_RELA
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
- _dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
-
- {
-diff --git a/elf/dl-deps.c b/elf/dl-deps.c
-index eee146a..1a4b004 100644
---- a/elf/dl-deps.c
-+++ b/elf/dl-deps.c
-@@ -127,7 +127,7 @@ empty dynamic string token substitution")); \
- else \
- { \
- /* This is for DT_AUXILIARY. */ \
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)) \
- _dl_debug_printf (N_("\
- cannot load auxiliary `%s' because of empty dynamic string token " \
- "substitution\n"), __str); \
-@@ -303,7 +303,7 @@ _dl_map_object_deps (struct link_map *map,
- args.name = name;
-
- /* Say that we are about to load an auxiliary library. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
- 0))
- _dl_debug_printf ("load auxiliary object=%s"
- " requested by file=%s\n",
-@@ -520,7 +520,7 @@ _dl_map_object_deps (struct link_map *map,
- runp->map->l_reserved = 0;
- }
-
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
- && map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
- {
- /* If we are to compute conflicts, we have to build local scope
-diff --git a/elf/dl-error.c b/elf/dl-error.c
-index 0fc3fd8..ea82f4d 100644
---- a/elf/dl-error.c
-+++ b/elf/dl-error.c
-@@ -139,7 +139,7 @@ internal_function
- _dl_signal_cerror (int errcode, const char *objname, const char *occation,
- const char *errstring)
- {
-- if (__builtin_expect (GLRO(dl_debug_mask)
-+ if (__builtin_expect (GLRO_dl_debug_mask
- & ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
- _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
- errstring, receiver ? "continued" : "fatal");
-diff --git a/elf/dl-fini.c b/elf/dl-fini.c
-index 6cfe651..f59f7fe 100644
---- a/elf/dl-fini.c
-+++ b/elf/dl-fini.c
-@@ -234,7 +234,7 @@ _dl_fini (void)
- || l->l_info[DT_FINI] != NULL)
- {
- /* When debugging print a message first. */
-- if (__builtin_expect (GLRO(dl_debug_mask)
-+ if (__builtin_expect (GLRO_dl_debug_mask
- & DL_DEBUG_IMPCALLS, 0))
- _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
- DSO_FILENAME (l->l_name),
-@@ -286,7 +286,7 @@ _dl_fini (void)
- goto again;
- }
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
- _dl_debug_printf ("\nruntime linker statistics:\n"
- " final number of relocations: %lu\n"
- "final number of relocations from cache: %lu\n",
-diff --git a/elf/dl-init.c b/elf/dl-init.c
-index 2f85731..e46e8b6 100644
---- a/elf/dl-init.c
-+++ b/elf/dl-init.c
-@@ -46,7 +46,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
- return;
-
- /* Print a debug message if wanted. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
- _dl_debug_printf ("\ncalling init: %s\n\n",
- DSO_FILENAME (l->l_name));
-
-@@ -96,7 +96,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
- ElfW(Addr) *addrs;
- unsigned int cnt;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
- _dl_debug_printf ("\ncalling preinit: %s\n\n",
- DSO_FILENAME (main_map->l_name));
-
-diff --git a/elf/dl-load.c b/elf/dl-load.c
-index f664f50..8c28744 100644
---- a/elf/dl-load.c
-+++ b/elf/dl-load.c
-@@ -943,7 +943,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
- }
-
- /* Print debugging message. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
-
- /* This is the ELF header. We read it in `open_verify'. */
-@@ -1347,7 +1347,7 @@ cannot enable executable stack as shared object requires");
-
- l->l_entry += l->l_addr;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("\
- dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
- entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
-@@ -1789,7 +1789,7 @@ open_path (const char *name, size_t namelen, int mode,
-
- /* If we are debugging the search for libraries print the path
- now if it hasn't happened now. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)
- && current_what != this_dir->what)
- {
- current_what = this_dir->what;
-@@ -1810,7 +1810,7 @@ open_path (const char *name, size_t namelen, int mode,
- - buf);
-
- /* Print name we try if this is wanted. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
- _dl_debug_printf (" trying file=%s\n", buf);
-
- fd = open_verify (buf, fbp, loader, whatcode, mode,
-@@ -1955,7 +1955,7 @@ _dl_map_object (struct link_map *loader, const char *name,
- }
-
- /* Display information if we are debugging. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES)
- && loader != NULL)
- _dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
- ? "\nfile=%s [%lu]; needed by %s [%lu]\n"
-@@ -1997,7 +1997,7 @@ _dl_map_object (struct link_map *loader, const char *name,
-
- size_t namelen = strlen (name) + 1;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
- _dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
-
- fd = -1;
-@@ -2119,7 +2119,7 @@ _dl_map_object (struct link_map *loader, const char *name,
- #endif
-
- /* Add another newline when we are tracing the library loading. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
- _dl_debug_printf ("\n");
- }
- else
-@@ -2152,7 +2152,7 @@ _dl_map_object (struct link_map *loader, const char *name,
- if (__glibc_unlikely (fd == -1))
- {
- if (trace_mode
-- && __glibc_likely ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) == 0))
-+ && __glibc_likely ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK) == 0))
- {
- /* We haven't found an appropriate library. But since we
- are only interested in the list of libraries this isn't
-diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
-index 11cb44b..588c3e4 100644
---- a/elf/dl-lookup.c
-+++ b/elf/dl-lookup.c
-@@ -302,7 +302,7 @@ do_lookup_unique (const char *undef_name, uint_fast32_t new_hash,
- hash table. */
- if (__glibc_unlikely (tab->size))
- {
-- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
-+ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
- goto success;
- }
- #endif
-@@ -378,7 +378,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
- continue;
-
- /* Print some debugging info if wanted. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS))
- _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
- undef_name, DSO_FILENAME (map->l_name),
- map->l_ns);
-@@ -755,7 +755,7 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
- }
-
- /* Display information if we are debugging. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("\
- \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
- DSO_FILENAME (map->l_name),
-@@ -859,7 +859,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
- {
- if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
- && skip_map == NULL
-- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
-+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
- {
- /* We could find no value for a strong reference. */
- const char *reference_name = undef_map ? undef_map->l_name : "";
-@@ -935,7 +935,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
- if (__glibc_unlikely (current_value.m->l_used == 0))
- current_value.m->l_used = 1;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask)
-+ if (__glibc_unlikely (GLRO_dl_debug_mask
- & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
- _dl_debug_bindings (undef_name, undef_map, ref,
- &current_value, version, type_class, protected);
-@@ -1000,7 +1000,7 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
- {
- const char *reference_name = undef_map->l_name;
-
-- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
- {
- _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
- DSO_FILENAME (reference_name),
-@@ -1014,7 +1014,7 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map,
- _dl_debug_printf_c ("\n");
- }
- #ifdef SHARED
-- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
- {
- int conflict = 0;
- struct sym_val val = { NULL, NULL };
-diff --git a/elf/dl-object.c b/elf/dl-object.c
-index 1d58bbc..938a257 100644
---- a/elf/dl-object.c
-+++ b/elf/dl-object.c
-@@ -98,7 +98,7 @@ _dl_new_object (char *realname, const char *libname, int type,
- new->l_type = type;
- /* If we set the bit now since we know it is never used we avoid
- dirtying the cache line later. */
-- if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
-+ if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
- new->l_used = 1;
- new->l_loader = loader;
- #if NO_TLS_OFFSET != 0
-diff --git a/elf/dl-open.c b/elf/dl-open.c
-index 2db1c02..1288604 100644
---- a/elf/dl-open.c
-+++ b/elf/dl-open.c
-@@ -147,7 +147,7 @@ add_to_global (struct link_map *new)
- ns->_ns_main_searchlist->r_list[new_nlist++] = map;
-
- /* We modify the global scope. Report this. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
- _dl_debug_printf ("\nadd %s [%lu] to global scope\n",
- map->l_name, map->l_ns);
- }
-@@ -251,7 +251,7 @@ dl_open_worker (void *a)
- if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
- {
- /* Let the user know about the opencount. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
- new->l_name, new->l_ns, new->l_direct_opencount);
-
-@@ -302,7 +302,7 @@ dl_open_worker (void *a)
- LIBC_PROBE (map_complete, 3, args->nsid, r, new);
-
- /* Print scope information. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
- _dl_show_scope (new, 0);
-
- /* Only do lazy relocation if `LD_BIND_NOW' is not set. */
-@@ -519,7 +519,7 @@ dl_open_worker (void *a)
- }
-
- /* Print scope information. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
- _dl_show_scope (imap, from_scope);
- }
-
-@@ -577,7 +577,7 @@ TLS generation counter wrapped! Please report this."));
- #endif
-
- /* Let the user know about the opencount. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
- _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
- new->l_name, new->l_ns, new->l_direct_opencount);
- }
-diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
-index 61252d7..4c83815 100644
---- a/elf/dl-reloc.c
-+++ b/elf/dl-reloc.c
-@@ -178,7 +178,7 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
- && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
- lazy = 0;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
- _dl_debug_printf ("\nrelocation processing: %s%s\n",
- DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
-
-diff --git a/elf/dl-version.c b/elf/dl-version.c
-index f6e5cd9..320628c 100644
---- a/elf/dl-version.c
-+++ b/elf/dl-version.c
-@@ -82,7 +82,7 @@ match_symbol (const char *name, Lmid_t ns, ElfW(Word) hash, const char *string,
- int result = 0;
-
- /* Display information about what we are doing while debugging. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS))
- _dl_debug_printf ("\
- checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
- string, DSO_FILENAME (map->l_name),
-diff --git a/elf/get-dynamic-info.h b/elf/get-dynamic-info.h
-index dc8359d..7774fda 100644
---- a/elf/get-dynamic-info.h
-+++ b/elf/get-dynamic-info.h
-@@ -166,7 +166,7 @@ elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp)
- them. Therefore to avoid breaking existing applications the
- best we can do is add a warning during debugging with the
- intent of notifying the user of the problem. */
-- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
-+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
- && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
- _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
- l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
-diff --git a/elf/rtld.c b/elf/rtld.c
-index fc3a2db..59c4637 100644
---- a/elf/rtld.c
-+++ b/elf/rtld.c
-@@ -323,7 +323,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
- }
- #endif
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
- {
- #ifndef HP_TIMING_NONAVAIL
- print_statistics (&rtld_total_time);
-@@ -1701,7 +1701,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- after relocation. */
- struct link_map *l;
-
-- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
- {
- struct r_scope_elem *scope = &main_map->l_searchlist;
-
-@@ -1731,7 +1731,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- _dl_printf ("\n");
- }
- }
-- else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
-+ else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
- {
- /* Look through the dependencies of the main executable
- and determine which of them is not actually
-@@ -1839,7 +1839,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- }
- }
-
-- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
-+ if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
- && rtld_multiple_ref)
- {
- /* Mark the link map as not yet relocated again. */
-@@ -1972,7 +1972,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- if (r_list == r_listend && liblist == liblistend)
- prelinked = true;
-
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
- _dl_debug_printf ("\nprelink checking: %s\n",
- prelinked ? "ok" : "failed");
- }
-@@ -1990,7 +1990,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
- GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
-
- /* Print scope information. */
-- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
-+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
- {
- _dl_debug_printf ("\nInitial object scopes\n");
-
-@@ -2265,7 +2265,7 @@ process_dl_debug (const char *dl_debug)
- if (debopts[cnt].len == len
- && memcmp (dl_debug, debopts[cnt].name, len) == 0)
- {
-- GLRO(dl_debug_mask) |= debopts[cnt].mask;
-+ GLRO_dl_debug_mask |= debopts[cnt].mask;
- any_debug = 1;
- break;
- }
-@@ -2286,7 +2286,7 @@ warning: debug option `%s' unknown; try LD_DEBUG=help\n", copy);
- ++dl_debug;
- }
-
-- if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
- {
- /* In order to get an accurate picture of whether a particular
- DT_NEEDED entry is actually used we have to process both
-@@ -2294,7 +2294,7 @@ warning: debug option `%s' unknown; try LD_DEBUG=help\n", copy);
- GLRO(dl_lazy) = 0;
- }
-
-- if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
-+ if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
- {
- size_t cnt;
-
-@@ -2499,7 +2499,7 @@ process_envvars (enum mode *modep)
- mode = trace;
- GLRO(dl_verbose) = 1;
- #if __OPTION_EGLIBC_RTLD_DEBUG
-- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
-+ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
- #endif
- GLRO(dl_trace_prelink) = &envline[17];
- }
-@@ -2548,7 +2548,7 @@ process_envvars (enum mode *modep)
- {
- unsetenv ("MALLOC_CHECK_");
- #if __OPTION_EGLIBC_RTLD_DEBUG
-- GLRO(dl_debug_mask) = 0;
-+ GLRO_dl_debug_mask = 0;
- #endif
- }
-
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch b/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
new file mode 100644
index 0000000000..998db39b47
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0026-intl-Emit-no-lines-in-bison-generated-files.patch
@@ -0,0 +1,31 @@
+From 99ab34278a6ebec134267412b4f619f43e278dea Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 3 Aug 2018 09:44:00 -0700
+Subject: [PATCH] intl: Emit no lines in bison generated files
+
+Improve reproducibility:
+Do not put any #line preprocessor commands in bison generated files.
+These lines contain absolute paths containing file locations on
+the host build machine.
+
+Upstream-Status: Pending
+
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ intl/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/intl/Makefile b/intl/Makefile
+index 93478d87e8..b27a7935eb 100644
+--- a/intl/Makefile
++++ b/intl/Makefile
+@@ -155,7 +155,7 @@ $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
+
+ CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
+ -D'LOCALE_ALIAS_PATH="$(localedir)"'
+-BISONFLAGS = --yacc --name-prefix=__gettext --output
++BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
+
+ $(inst_localedir)/locale.alias: locale.alias $(+force)
+ $(do-install)
diff --git a/meta/recipes-core/glibc/glibc/0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch b/meta/recipes-core/glibc/glibc/0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch
deleted file mode 100644
index 4106167df5..0000000000
--- a/meta/recipes-core/glibc/glibc/0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From e98779aa56fae0346dff2d0b72acadd0eaf01891 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Wed, 27 May 2015 16:10:50 -0700
-Subject: [PATCH 27/27] eglibc-use-option-groups: Conditionally exclude c++
- tests
-
- Some test programs written in c++ are still included in spite of
- "libc-cxx-tests" being omitted from DISTRO_FEATURES_LIBC.
- All .cc programs are compiled with g++.
- g++ automatically specifies linking against the C++ library.
- This patch conditionally excludes the following tests as well:
-
- bug-atexit3-lib.cc
- tst-cancel24.cc
- tst-cancel24-static.cc
- tst-unique3lib.cc
- tst-unique3lib2.cc
- tst-unique4lib.cc
- tst-unique3.cc
- tst-unique4.cc
-
- Tested with DISTRO_FEATURES_LIBC_remove = " libc-cxx-tests"
-
- [YOCTO #7003]
-
-Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- dlfcn/Makefile | 8 ++++++--
- elf/Makefile | 19 ++++++++++++++-----
- nptl/Makefile | 12 ++++++++++--
- 3 files changed, 30 insertions(+), 9 deletions(-)
-
-diff --git a/dlfcn/Makefile b/dlfcn/Makefile
-index 3827607..920bd58 100644
---- a/dlfcn/Makefile
-+++ b/dlfcn/Makefile
-@@ -39,16 +39,20 @@ ifeq (yes,$(build-shared))
- tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
- bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
- tstatexit bug-dl-leaf tst-rec-dlopen
--endif
--
- tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
-
-+endif
-+
- modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
- defaultmod2 errmsg1mod modatexit modcxaatexit \
- bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
- bug-atexit2-lib bug-dl-leaf-lib \
- bug-dl-leaf-lib-cb moddummy1 moddummy2
-
-+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
-+modules-names += bug-atexit3-lib
-+endif
-+
- failtestmod.so-no-z-defs = yes
- glreflib2.so-no-z-defs = yes
- errmsg1mod.so-no-z-defs = yes
-diff --git a/elf/Makefile b/elf/Makefile
-index 71a18a1..26fe3c5 100644
---- a/elf/Makefile
-+++ b/elf/Makefile
-@@ -17,6 +17,8 @@
-
- # Makefile for elf subdirectory of GNU C Library.
-
-+include ../option-groups.mak
-+
- subdir := elf
-
- include ../Makeconfig
-@@ -145,12 +147,15 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
- unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
- tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
- tst-stackguard1 tst-addr1 tst-thrlock \
-- tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
-- tst-nodelete) \
-+ tst-unique1 tst-unique2 \
- tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
- tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
- tst-nodelete2
- # reldep9
-+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
-+tests += $(if $(CXX),tst-unique3 tst-unique4 tst-nodelete)
-+endif
-+
- ifeq ($(build-hardcoded-path-in-tests),yes)
- tests += tst-dlopen-aout
- LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
-@@ -209,9 +214,6 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
- tst-unique1mod1 tst-unique1mod2 \
- tst-unique2mod1 tst-unique2mod2 \
- tst-auditmod9a tst-auditmod9b \
-- $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
-- tst-nodelete-uniquemod tst-nodelete-rtldmod \
-- tst-nodelete-zmod) \
- tst-initordera1 tst-initorderb1 \
- tst-initordera2 tst-initorderb2 \
- tst-initordera3 tst-initordera4 \
-@@ -220,6 +222,13 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
- tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \
- tst-array5dep tst-null-argv-lib \
- tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod
-+
-+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
-+modules-names += $(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
-+ tst-nodelete-uniquemod tst-nodelete-rtldmod \
-+ tst-nodelete-zmod)
-+endif
-+
- ifeq (yes,$(have-protected-data))
- modules-names += tst-protected1moda tst-protected1modb
- tests += tst-protected1a tst-protected1b
-diff --git a/nptl/Makefile b/nptl/Makefile
-index 596ca3c..50a708b 100644
---- a/nptl/Makefile
-+++ b/nptl/Makefile
-@@ -390,12 +390,20 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
- $(common-objpfx)libc.a
-
- tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
-- tst-cancel21-static tst-cancel24-static tst-cond8-static \
-+ tst-cancel21-static tst-cond8-static \
- tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
- tst-sem12-static
--tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
-+
-+ifeq (y,$(OPTION_EGLIBC_CXX_TESTS))
-+tests-static += tst-cancel24-static
-+endif
-+
-+tests += tst-stackguard1-static tst-cancel21-static \
- tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
- tst-sem11-static tst-sem12-static
-+
-+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24-static
-+
- xtests-static += tst-setuid1-static
-
- # These tests are linked with libc before libpthread
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch b/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
new file mode 100644
index 0000000000..2bfa2aaa06
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch
@@ -0,0 +1,53 @@
+From 3190ada9ecaec915794886a608221655c120f90c Mon Sep 17 00:00:00 2001
+From: Martin Jansa <martin.jansa@gmail.com>
+Date: Mon, 17 Dec 2018 21:36:18 +0000
+Subject: [PATCH] locale: prevent maybe-uninitialized errors with -Os [BZ
+ #19444]
+
+Fixes following error when building for aarch64 with -Os:
+| In file included from strcoll_l.c:43:
+| strcoll_l.c: In function '__strcoll_l':
+| ../locale/weight.h:31:26: error: 'seq2.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+| int_fast32_t i = table[*(*cpp)++];
+| ^~~~~~~~~
+| strcoll_l.c:304:18: note: 'seq2.back_us' was declared here
+| coll_seq seq1, seq2;
+| ^~~~
+| In file included from strcoll_l.c:43:
+| ../locale/weight.h:31:26: error: 'seq1.back_us' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+| int_fast32_t i = table[*(*cpp)++];
+| ^~~~~~~~~
+| strcoll_l.c:304:12: note: 'seq1.back_us' was declared here
+| coll_seq seq1, seq2;
+| ^~~~
+
+ Partial fix for [BZ #19444]
+ * locale/weight.h: Fix build with -Os.
+
+Upstream-Status: Submitted [https://patchwork.ozlabs.org/patch/1014766]
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ locale/weight.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/locale/weight.h b/locale/weight.h
+index 723e1fefda..f5798d379a 100644
+--- a/locale/weight.h
++++ b/locale/weight.h
+@@ -28,7 +28,14 @@ findidx (const int32_t *table,
+ const unsigned char *extra,
+ const unsigned char **cpp, size_t len)
+ {
++ /* With GCC 8 when compiling with -Os the compiler warns that
++ seq1.back_us and seq2.back_us might be used uninitialized.
++ This uninitialized use is impossible for the same reason
++ as described in comments in locale/weightwc.h. */
++ DIAG_PUSH_NEEDS_COMMENT;
++ DIAG_IGNORE_Os_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+ int_fast32_t i = table[*(*cpp)++];
++ DIAG_POP_NEEDS_COMMENT;
+ const unsigned char *cp;
+ const unsigned char *usrc;
+
diff --git a/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch b/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
index 65c227ff20..8042caaeae 100644
--- a/meta/recipes-core/glibc/glibc/0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
+++ b/meta/recipes-core/glibc/glibc/0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch
@@ -1,8 +1,7 @@
-From 5ec1bc5172851278231ce940b68b35ce9cbf8500 Mon Sep 17 00:00:00 2001
+From 5d201a75918a0e181ee6206f701901fdb91baf81 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 00:11:22 +0000
-Subject: [PATCH 06/27] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known
- names
+Subject: [PATCH] readlib: Add OECORE_KNOWN_INTERPRETER_NAMES to known names
This bolts in a hook for OE to pass its own version of interpreter
names into glibc especially for multilib case, where it differs from any
@@ -17,7 +16,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+)
diff --git a/elf/readlib.c b/elf/readlib.c
-index 7fd5b8a..2f5da9f 100644
+index 7383c23249..e97ea9449d 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -51,6 +51,7 @@ static struct known_names interpreters[] =
@@ -28,6 +27,3 @@ index 7fd5b8a..2f5da9f 100644
};
static struct known_names known_libs[] =
---
-2.1.4
-
diff --git a/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
new file mode 100644
index 0000000000..ece792509e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch
@@ -0,0 +1,67 @@
+From baba3c6021340a9070b734f931a15cea4cfe6c31 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 15 May 2020 17:05:45 -0700
+Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64
+
+This helps OE multilibs to not sythesize this header which causes all
+kind of recursions and other issues since wordsize is fundamental header
+and ends up including itself in many case e.g. clang tidy, bpf etc.
+
+Upstream-Status: Inappropriate [ OE-Specific ]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/aarch64/bits/wordsize.h | 8 ++++++--
+ sysdeps/{aarch64 => arm}/bits/wordsize.h | 10 +++++++---
+ 2 files changed, 13 insertions(+), 5 deletions(-)
+ copy sysdeps/{aarch64 => arm}/bits/wordsize.h (80%)
+
+diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h
+index 91da566b74..9a754514b3 100644
+--- a/sysdeps/aarch64/bits/wordsize.h
++++ b/sysdeps/aarch64/bits/wordsize.h
+@@ -17,12 +17,16 @@
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+-#ifdef __LP64__
++#if defined (__aarch64__) && defined (__LP64__)
+ # define __WORDSIZE 64
+-#else
++#elif defined (__aarch64__)
+ # define __WORDSIZE 32
+ # define __WORDSIZE32_SIZE_ULONG 1
+ # define __WORDSIZE32_PTRDIFF_LONG 1
++#else
++# define __WORDSIZE 32
++# define __WORDSIZE32_SIZE_ULONG 0
++# define __WORDSIZE32_PTRDIFF_LONG 0
+ #endif
+
+ #define __WORDSIZE_TIME64_COMPAT32 0
+diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h
+similarity index 80%
+copy from sysdeps/aarch64/bits/wordsize.h
+copy to sysdeps/arm/bits/wordsize.h
+index 91da566b74..34fcdef1f1 100644
+--- a/sysdeps/aarch64/bits/wordsize.h
++++ b/sysdeps/arm/bits/wordsize.h
+@@ -17,12 +17,16 @@
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+-#ifdef __LP64__
++#if defined (__aarch64__) && defined (__LP64__)
+ # define __WORDSIZE 64
+-#else
++#elif defined (__aarch64__)
+ # define __WORDSIZE 32
+ # define __WORDSIZE32_SIZE_ULONG 1
+ # define __WORDSIZE32_PTRDIFF_LONG 1
++#else
++# define __WORDSIZE 32
++# define __WORDSIZE32_SIZE_ULONG 0
++# define __WORDSIZE32_PTRDIFF_LONG 0
+ #endif
+
+ #define __WORDSIZE_TIME64_COMPAT32 0
diff --git a/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch
new file mode 100644
index 0000000000..22df820aed
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch
@@ -0,0 +1,48 @@
+From 60aa53f547911163b42a1c436d695a15c87f34ee Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 7 Aug 2020 14:31:16 -0700
+Subject: [PATCH] powerpc: Do not ask compiler for finding arch
+
+This does not work well in cross compiling environments like OE
+and moreover it uses its own -mcpu/-march options via cflags
+
+Upstream-Status: Inappropriate [ OE-Specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ sysdeps/powerpc/preconfigure | 5 +----
+ sysdeps/powerpc/preconfigure.ac | 5 +----
+ 2 files changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure
+index dfe8e20399..bbff040f0f 100644
+--- a/sysdeps/powerpc/preconfigure
++++ b/sysdeps/powerpc/preconfigure
+@@ -29,10 +29,7 @@ esac
+ # directive which shows up, and try using it.
+ case "${machine}:${submachine}" in
+ *powerpc*:)
+- archcpu=`echo "int foo () { return 0; }" \
+- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \
+- | grep -E "mcpu=|.machine" -m 1 \
+- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"`
++ archcpu=''
+ # Note if you add patterns here you must ensure that an appropriate
+ # directory exists in sysdeps/powerpc. Likewise, if we find a
+ # cpu, don't let the generic configure append extra compiler options.
+diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac
+index 6c63bd8257..3e925f1d48 100644
+--- a/sysdeps/powerpc/preconfigure.ac
++++ b/sysdeps/powerpc/preconfigure.ac
+@@ -29,10 +29,7 @@ esac
+ # directive which shows up, and try using it.
+ case "${machine}:${submachine}" in
+ *powerpc*:)
+- archcpu=`echo "int foo () { return 0; }" \
+- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \
+- | grep -E "mcpu=|[.]machine" -m 1 \
+- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"`
++ archcpu=''
+ # Note if you add patterns here you must ensure that an appropriate
+ # directory exists in sysdeps/powerpc. Likewise, if we find a
+ # cpu, don't let the generic configure append extra compiler options.
diff --git a/meta/recipes-core/glibc/glibc/check-test-wrapper b/meta/recipes-core/glibc/glibc/check-test-wrapper
new file mode 100644
index 0000000000..6ec9b9b29e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/check-test-wrapper
@@ -0,0 +1,80 @@
+#!/usr/bin/env python3
+import sys
+import os
+import subprocess
+import resource
+
+env = os.environ.copy()
+args = sys.argv[1:]
+targettype = args.pop(0)
+
+if targettype == "user":
+ qemuargs = os.environ.get("QEMU_OPTIONS", "").split()
+ if not os.path.exists(qemuargs[0]):
+ # ensure qemu args has a valid absolute path
+ for i in os.environ.get("PATH", "").split(":"):
+ if os.path.exists(os.path.join(i, qemuargs[0])):
+ qemuargs[0] = os.path.join(i, qemuargs[0])
+ break
+ sysroot = os.environ.get("QEMU_SYSROOT", None)
+ if not sysroot:
+ sys.exit(-1)
+ libpaths = [sysroot + "/usr/lib", sysroot + "/lib"]
+
+ if args[0] == "env":
+ args.pop(0)
+ if len(args) == 0:
+ args = ["env"]
+ else:
+ # process options
+ while args[0].startswith("-"):
+ opt = args.pop(0).lstrip("-")
+ if "i" in opt:
+ env.clear()
+ # process environment vars
+ while "=" in args[0]:
+ key, val = args.pop(0).split("=", 1)
+ if key == "LD_LIBRARY_PATH":
+ libpaths += val.split(":")
+ else:
+ env[key] = val
+ if args[0] == "cp":
+ # ignore copies, the filesystem is the same
+ sys.exit(0)
+
+ qemuargs += ["-L", sysroot]
+ qemuargs += ["-E", "LD_LIBRARY_PATH={}".format(":".join(libpaths))]
+ command = qemuargs + args
+
+ # We've seen qemu-arm using up all system memory for some glibc
+ # tests e.g. nptl/tst-pthread-timedlock-lockloop
+ # Cap at 8GB since no test should need more than that
+ # (5GB adds 7 failures for qemuarm glibc test run)
+ limit = 8*1024*1024*1024
+ resource.setrlimit(resource.RLIMIT_AS, (limit, limit))
+
+elif targettype == "ssh":
+ host = os.environ.get("SSH_HOST", None)
+ user = os.environ.get("SSH_HOST_USER", None)
+ port = os.environ.get("SSH_HOST_PORT", None)
+
+ command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"]
+ if port:
+ command += ["-p", str(port)]
+ if not host:
+ sys.exit(-1)
+ command += ["{}@{}".format(user, host) if user else host]
+
+ # wrap and replace quotes for correct transformation on ssh
+ wrapped = " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in ["cd", os.getcwd()]]) + "; "
+ wrapped += " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in args])
+ command += ["sh", "-c", "\"{}\"".format(wrapped)]
+else:
+ sys.exit(-1)
+
+try:
+ r = subprocess.run(command, timeout = 1800, env = env)
+ sys.exit(r.returncode)
+except subprocess.TimeoutExpired:
+ sys.exit(-1)
+
diff --git a/meta/recipes-core/glibc/glibc/etc/ld.so.conf b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
index e69de29bb2..83327c01bf 100644
--- a/meta/recipes-core/glibc/glibc/etc/ld.so.conf
+++ b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
@@ -0,0 +1 @@
+include /etc/ld.so.conf.d/*.conf
diff --git a/meta/recipes-core/glibc/glibc/makedbs.sh b/meta/recipes-core/glibc/glibc/makedbs.sh
new file mode 100755
index 0000000000..7d51a67352
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/makedbs.sh
@@ -0,0 +1,177 @@
+#!/bin/sh
+
+#
+# Make passwd.db, group.db, etc.
+#
+
+VAR_DB=/var/db
+
+# Use make if available
+if [ -x /usr/bin/make -o -x /bin/make ]; then
+ make -C $VAR_DB
+ exit 0
+fi
+
+# No make available, do it in hard way
+
+# passwd.db
+if [ -e /etc/passwd ]; then
+target=$VAR_DB/passwd.db
+echo -n "passwd... "
+awk 'BEGIN { FS=":"; OFS=":" } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print; \
+ printf "=%s ", $$3; print }' /etc/passwd | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# group.db
+if [ -e /etc/group ]; then
+target=$VAR_DB/group.db
+echo -n "group... "
+awk 'BEGIN { FS=":"; OFS=":" } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print; \
+ printf "=%s ", $$3; print; \
+ if ($$4 != "") { \
+ split($$4, grmems, ","); \
+ for (memidx in grmems) { \
+ mem=grmems[memidx]; \
+ if (members[mem] == "") \
+ members[mem]=$$3; \
+ else \
+ members[mem]=members[mem] "," $$3; \
+ } \
+ delete grmems; } } \
+ END { for (mem in members) \
+ printf ":%s %s %s\n", mem, mem, members[mem]; }' /etc/group | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# ethers.db
+if [ -e /etc/ethers ]; then
+target=$VAR_DB/ethers.db
+echo -n "ethers... "
+awk '/^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print; \
+ printf "=%s ", $$2; print }' /etc/ethers | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# protocols.db
+if [ -e /etc/protocols ]; then
+target=$VAR_DB/protocols.db
+echo -n "protocols... "
+awk '/^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print; \
+ printf "=%s ", $$2; print; \
+ for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \
+ { printf ".%s ", $$i; print } }' /etc/protocols | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# rpc.db
+if [ -e /etc/rpc ]; then
+target=$VAR_DB/rpc.db
+echo -n "rpc... "
+awk '/^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print; \
+ printf "=%s ", $$2; print; \
+ for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \
+ { printf ".%s ", $$i; print } }' /etc/rpc | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# services.db
+if [ -e /etc/services ]; then
+target=$VAR_DB/services.db
+echo -n "services... "
+awk 'BEGIN { FS="[ \t/]+" } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { sub(/[ \t]*#.*$$/, "");\
+ printf ":%s/%s ", $$1, $$3; print; \
+ printf ":%s/ ", $$1; print; \
+ printf "=%s/%s ", $$2, $$3; print; \
+ printf "=%s/ ", $$2; print; \
+ for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \
+ { printf ":%s/%s ", $$i, $$3; print; \
+ printf ":%s/ ", $$i; print } }' /etc/services | \
+makedb --quiet -o $target -
+echo "done."
+fi
+
+# shadow.db
+if [ -e /etc/shadow ]; then
+target=$VAR_DB/shadow.db
+echo -n "shadow... "
+awk 'BEGIN { FS=":"; OFS=":" } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print }' /etc/shadow | \
+(umask 077 && makedb --quiet -o $target -)
+echo "done."
+if chgrp shadow $target 2>/dev/null; then
+ chmod g+r $target
+else
+ chown 0 $target; chgrp 0 $target; chmod 600 $target;
+ echo
+ echo "Warning: The shadow password database $target"
+ echo "has been set to be readable only by root. You may want"
+ echo "to make it readable by the \`shadow' group depending"
+ echo "on your configuration."
+ echo
+fi
+fi
+
+# gshadow.db
+if [ -e /etc/gshadow ]; then
+target=$VAR_DB/gshadow.db
+echo -n "gshadow... "
+awk 'BEGIN { FS=":"; OFS=":" } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { printf ".%s ", $$1; print }' /etc/gshadow | \
+(umask 077 && makedb --quiet -o $target -)
+echo "done."
+if chgrp shadow $target 2>/dev/null; then
+ chmod g+r $target
+else
+ chown 0 $target; chgrp 0 $target; chmod 600 $target
+ echo
+ echo "Warning: The shadow group database $target"
+ echo "has been set to be readable only by root. You may want"
+ echo "to make it readable by the \`shadow' group depending"
+ echo "on your configuration."
+ echo
+fi
+fi
+
+# netgroup.db
+if [ -e /etc/netgroup ]; then
+target=$VAR_DB/netgroup.db
+echo -n "netgroup... "
+awk 'BEGIN { ini=1 } \
+ /^[ \t]*$$/ { next } \
+ /^[ \t]*#/ { next } \
+ /^[^#]/ { if (sub(/[ \t]*\\$$/, " ") == 0) end="\n"; \
+ else end=""; \
+ gsub(/[ \t]+/, " "); \
+ sub(/^[ \t]*/, ""); \
+ if (ini == 0) printf "%s%s", $$0, end; \
+ else printf ".%s %s%s", $$1, $$0, end; \
+ ini=end == "" ? 0 : 1; } \
+ END { if (ini==0) printf "\n" }' /etc/netgroup | \
+makedb --quiet -o $target
+echo "done."
+fi
diff --git a/meta/recipes-core/glibc/glibc_2.22.bb b/meta/recipes-core/glibc/glibc_2.22.bb
deleted file mode 100644
index f0e1fad450..0000000000
--- a/meta/recipes-core/glibc/glibc_2.22.bb
+++ /dev/null
@@ -1,135 +0,0 @@
-require glibc.inc
-
-LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
- file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
- file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
-
-DEPENDS += "gperf-native kconfig-frontends-native"
-
-SRCREV ?= "a34d1c6afc86521d6ad17662a3b5362d8481514c"
-
-BRANCH ?= "release/${PV}/master"
-
-GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
-
-SRC_URI = "${GLIBC_GIT_URI};branch=${BRANCH};name=glibc \
- file://0004-Backport-https-sourceware.org-ml-libc-ports-2007-12-.patch \
- file://0005-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
- file://0006-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
- file://0007-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
- file://0008-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
- file://0009-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \
- file://0010-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
- file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
- file://0012-Make-ld-version-output-matching-grok-gold-s-output.patch \
- file://0013-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
- file://0014-Add-unused-attribute.patch \
- file://0015-When-disabling-SSE-also-make-sure-that-fpmath-is-not.patch \
- file://0016-yes-within-the-path-sets-wrong-config-variables.patch \
- file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
- file://0018-eglibc-Cross-building-and-testing-instructions.patch \
- file://0019-eglibc-Bring-Eglibc-option-group-infrastructure-to-g.patch \
- file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
- file://0021-eglibc-cherry-picked-from-http-www.eglibc.org-archiv.patch \
- file://0022-eglibc-Clear-cache-lines-on-ppc8xx.patch \
- file://0023-eglibc-Resolve-__fpscr_values-on-SH4.patch \
- file://0024-eglibc-Forward-port-eglibc-options-groups-support.patch \
- file://0025-eglibc-Install-PIC-archives.patch \
- file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \
- file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \
-"
-
-SRC_URI += "\
- file://etc/ld.so.conf \
- file://generate-supported.mk \
-"
-
-SRC_URI_append_class-nativesdk = "\
- file://0001-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
- file://0002-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
- file://0003-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
-"
-
-S = "${WORKDIR}/git"
-B = "${WORKDIR}/build-${TARGET_SYS}"
-
-PACKAGES_DYNAMIC = ""
-
-# the -isystem in bitbake.conf screws up glibc do_stage
-BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
-TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
-
-GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1"
-
-#
-# We will skip parsing glibc when target system C library selection is not glibc
-# this helps in easing out parsing for non-glibc system libraries
-#
-COMPATIBLE_HOST_libc-musl_class-target = "null"
-COMPATIBLE_HOST_libc-uclibc_class-target = "null"
-
-EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
- --without-cvs --disable-profile \
- --disable-debug --without-gd \
- --enable-clocale=gnu \
- --enable-add-ons \
- --with-headers=${STAGING_INCDIR} \
- --without-selinux \
- --enable-obsolete-rpc \
- --with-kconfig=${STAGING_BINDIR_NATIVE} \
- ${GLIBC_EXTRA_OECONF}"
-
-EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
-EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', '--enable-nscd', '--disable-nscd', d)}"
-
-
-do_patch_append() {
- bb.build.exec_func('do_fix_readlib_c', d)
-}
-
-do_fix_readlib_c () {
- sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
-}
-
-do_configure () {
-# override this function to avoid the autoconf/automake/aclocal/autoheader
-# calls for now
-# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
-# version check and doesn't really help with anything
- (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
- find ${S} -name "configure" | xargs touch
- CPPFLAGS="" oe_runconf
-}
-
-rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
- yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
- rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
-
-do_compile () {
- # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
- unset LDFLAGS
- base_do_compile
- (
- cd ${S}/sunrpc/rpcsvc
- for r in ${rpcsvc}; do
- h=`echo $r|sed -e's,\.x$,.h,'`
- rm -f $h
- ${B}/sunrpc/cross-rpcgen -h $r -o $h || bbwarn "${PN}: unable to generate header for $r"
- done
- )
- echo "Adjust ldd script"
- if [ -n "${RTLDLIST}" ]
- then
- prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
- if [ "${prevrtld}" != "${RTLDLIST}" ]
- then
- sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#"
- fi
- fi
-
-}
-
-require glibc-package.inc
-
-BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-core/glibc/glibc_2.34.bb b/meta/recipes-core/glibc/glibc_2.34.bb
new file mode 100644
index 0000000000..6dc315c349
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc_2.34.bb
@@ -0,0 +1,133 @@
+require glibc.inc
+require glibc-version.inc
+
+CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2021-27645"
+
+# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022
+# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023
+# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024
+# Upstream glibc maintainers dispute there is any issue and have no plans to address it further.
+# "this is being treated as a non-security bug and no real threat."
+CVE_CHECK_WHITELIST += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
+
+# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025
+# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow
+# easier access for another. "ASLR bypass itself is not a vulnerability."
+# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
+CVE_CHECK_WHITELIST += "CVE-2019-1010025"
+
+DEPENDS += "gperf-native bison-native make-native"
+
+NATIVESDKFIXES ?= ""
+NATIVESDKFIXES:class-nativesdk = "\
+ file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
+ file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
+ file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
+ file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
+ file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
+ file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \
+"
+
+SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
+ file://etc/ld.so.conf \
+ file://generate-supported.mk \
+ file://makedbs.sh \
+ \
+ ${NATIVESDKFIXES} \
+ file://0009-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
+ file://0010-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
+ file://0011-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
+ file://0012-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \
+ file://0013-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
+ file://0014-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
+ file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
+ file://0016-yes-within-the-path-sets-wrong-config-variables.patch \
+ file://0017-timezone-re-written-tzselect-as-posix-sh.patch \
+ file://0018-Remove-bash-dependency-for-nscd-init-script.patch \
+ file://0019-eglibc-Cross-building-and-testing-instructions.patch \
+ file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \
+ file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
+ file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
+ file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
+ file://0025-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
+ file://0026-intl-Emit-no-lines-in-bison-generated-files.patch \
+ file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
+ file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
+ file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
+ file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
+ file://0001-CVE-2021-38604.patch \
+ file://0002-CVE-2021-38604.patch \
+ file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
+ "
+S = "${WORKDIR}/git"
+B = "${WORKDIR}/build-${TARGET_SYS}"
+
+PACKAGES_DYNAMIC = ""
+
+# the -isystem in bitbake.conf screws up glibc do_stage
+BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
+TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
+
+GLIBC_BROKEN_LOCALES = ""
+
+GLIBCPIE ??= ""
+
+EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
+ --disable-profile \
+ --disable-debug --without-gd \
+ --enable-clocale=gnu \
+ --with-headers=${STAGING_INCDIR} \
+ --without-selinux \
+ --enable-tunables \
+ --enable-bind-now \
+ --enable-stack-protector=strong \
+ --disable-crypt \
+ --with-default-link \
+ ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
+ ${GLIBCPIE} \
+ ${GLIBC_EXTRA_OECONF}"
+
+EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
+
+EXTRA_OECONF:append:x86 = " --enable-cet"
+EXTRA_OECONF:append:x86-64 = " --enable-cet"
+
+PACKAGECONFIG ??= "nscd memory-tagging"
+PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
+PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
+
+do_patch:append() {
+ bb.build.exec_func('do_fix_readlib_c', d)
+}
+
+do_fix_readlib_c () {
+ sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
+}
+
+do_configure () {
+# override this function to avoid the autoconf/automake/aclocal/autoheader
+# calls for now
+# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
+# version check and doesn't really help with anything
+ (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
+ find ${S} -name "configure" | xargs touch
+ CPPFLAGS="" oe_runconf
+}
+
+LDFLAGS += "-fuse-ld=bfd"
+do_compile () {
+ base_do_compile
+ echo "Adjust ldd script"
+ if [ -n "${RTLDLIST}" ]
+ then
+ prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
+ # remove duplicate entries
+ newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)`
+ echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\""
+ sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#"
+ fi
+}
+
+require glibc-package.inc
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch
index a0fabae3af..f4e38d4256 100644
--- a/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-64-bit-flag-for-ELF64-entries.patch
@@ -9,7 +9,7 @@ Due to this defect, ctypes.util.find_library() python function fails to
detect any library due to the old file format that ldconfig-native
creates. This fix sets architecture-dependent 64bit flags for 64-bit ELF.
-Upstream-status: Inappropriate [embedded specific]
+Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
---
@@ -64,7 +64,7 @@ index 0bf0de3..6e87afc 100644
#undef check_ptr
#define check_ptr(ptr) \
do \
-@@ -290,6 +295,35 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+@@ -290,6 +295,48 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
libc5/libc6. */
*flag = FLAG_ELF;
@@ -73,23 +73,36 @@ index 0bf0de3..6e87afc 100644
+ switch (elf_header->e_machine)
+ {
+ case EM_IA_64:
-+ *flag |= FLAG_IA64_LIB64;
++ /* Intel 64bit libraries are always libc.so.6+. */
++ /* see sysdeps/unix/sysv/linux/ia64/readelflib.c */
++ *flag |= FLAG_IA64_LIB64|FLAG_ELF_LIBC6;
+ break;
+ case EM_X86_64:
-+ *flag |= FLAG_X8664_LIB64;
++ /* X86-64 64bit libraries are always libc.so.6+. */
++ /* see sysdeps/unix/sysv/linux/i386/readelflib.c */
++ *flag |= FLAG_X8664_LIB64|FLAG_ELF_LIBC6;
+ break;
+ case EM_S390:
-+ *flag |= FLAG_S390_LIB64;
++ /* S/390 64bit libraries are always libc.so.6+. */
++ /* see sysdeps/unix/sysv/linux/s390/readelflib.c */
++ *flag |= FLAG_S390_LIB64|FLAG_ELF_LIBC6;
+ break;
+ case EM_PPC64:
-+ *flag |= FLAG_POWERPC_LIB64;
++ /* PowerPC 64bit libraries are always libc.so.6+. */
++ /* see sysdeps/unix/sysv/linux/powerpc/readelflib.c */
++ *flag |= FLAG_POWERPC_LIB64|FLAG_ELF_LIBC6;
+ break;
+ case EM_MIPS:
+ case EM_MIPS_RS3_LE:
-+ *flag |= FLAG_MIPS64_LIBN64;
++ /* n64 libraries are always libc.so.6+. */
++ /* NOTE: This does not correctly distinguish NAN2008 binaries and is possibly broken */
++ /* see sysdeps/unix/sysv/linux/mips/readelflib.c */
++ *flag |= FLAG_MIPS64_LIBN64|FLAG_ELF_LIBC6;
+ break;
+ case EM_AARCH64:
-+ *flag |= FLAG_AARCH64_LIB64;
++ /* AArch64 libraries are always libc.so.6+. */
++ /* see sysdeps/unix/sysv/linux/arm/readelflib.c */
++ *flag |= FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
+ break;
+ default:
+ error(0, 0, "%s is a 64-bit ELF for unknown machine %lx\n",
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch
new file mode 100644
index 0000000000..fc41aee264
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/add-riscv-support.patch
@@ -0,0 +1,79 @@
+From fd50228cc213d2d87f5e3cf1f123acb3fda9b04e Mon Sep 17 00:00:00 2001
+From: Christoph Muellner <cmuellner@linux.com>
+Date: Mon, 28 Jun 2021 00:34:12 +0200
+Subject: [PATCH] ldconfig: Add RISC-V support
+
+ldconfig-native does not support RISC-V at the moment.
+Let's pull the reqired constants from upstream and add
+the required parsing code.
+
+Upstream-Status: Backport
+
+Signed-off-by: Christoph Muellner <cmuellner@linux.com>
+---
+ cache.c | 6 ++++++
+ ldconfig.h | 2 ++
+ readelflib.c | 10 ++++++++++
+ 3 files changed, 18 insertions(+)
+
+diff --git a/cache.c b/cache.c
+index c4f5411..a3b9e70 100644
+--- a/cache.c
++++ b/cache.c
+@@ -125,6 +125,12 @@ print_entry (const char *lib, int flag, unsigned int osversion,
+ case FLAG_AARCH64_LIB64:
+ fputs (",AArch64", stdout);
+ break;
++ case FLAG_RISCV_FLOAT_ABI_SOFT:
++ fputs (",soft-float", stdout);
++ break;
++ case FLAG_RISCV_FLOAT_ABI_DOUBLE:
++ fputs (",double-float", stdout);
++ break;
+ case 0:
+ break;
+ default:
+diff --git a/ldconfig.h b/ldconfig.h
+index 6a8a750..2e5e379 100644
+--- a/ldconfig.h
++++ b/ldconfig.h
+@@ -38,6 +38,8 @@
+ #define FLAG_ARM_LIBHF 0x0900
+ #define FLAG_AARCH64_LIB64 0x0a00
+ #define FLAG_ARM_LIBSF 0x0b00
++#define FLAG_RISCV_FLOAT_ABI_SOFT 0x0f00
++#define FLAG_RISCV_FLOAT_ABI_DOUBLE 0x1000
+
+ /* Name of auxiliary cache. */
+ #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache"
+diff --git a/readelflib.c b/readelflib.c
+index 9ec0a54..a01e1ce 100644
+--- a/readelflib.c
++++ b/readelflib.c
+@@ -33,6 +33,10 @@
+ #define EM_AARCH64 183 /* ARM AARCH64 */
+ #endif
+
++#ifndef EM_RISCV
++#define EM_RISCV 243 /* RISC-V */
++#endif
++
+ #undef check_ptr
+ #define check_ptr(ptr) \
+ do \
+@@ -331,6 +335,12 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
+ /* see sysdeps/unix/sysv/linux/arm/readelflib.c */
+ *flag |= FLAG_AARCH64_LIB64|FLAG_ELF_LIBC6;
+ break;
++ case EM_RISCV:
++ /* RISC-V libraries are always libc.so.6+. */
++ /* NOTE: This does not correctly handle soft-float binaries */
++ /* see sysdeps/unix/sysv/linux/riscv/readelflib.c */
++ *flag |= FLAG_RISCV_FLOAT_ABI_DOUBLE|FLAG_ELF_LIBC6;
++ break;
+ default:
+ error(0, 0, "%s is a 64-bit ELF for unknown machine %lx\n",
+ file_name, (long)elf_header->e_machine);
+--
+2.25.1
+
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
index 52986e61c7..d1835c7a10 100644
--- a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
@@ -400,7 +400,7 @@ Index: ldconfig-native-2.12.1/ldconfig.c
return 0;
}
-+#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org"
++#define REPORT_BUGS_TO "mailing list : poky@lists.yoctoproject.org"
/* Print bug-reporting information in the help message. */
static char *
more_help (int key, const char *text, void *input)
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/no-aux-cache.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/no-aux-cache.patch
new file mode 100644
index 0000000000..c6765ba00d
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/no-aux-cache.patch
@@ -0,0 +1,19 @@
+The ldconfig auxiliary cache is a dictionary where the keys include inode, so
+there is no point in writing these files on the build host.
+
+Upstream-Status: Inappropriate
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+diff --git a/ldconfig.c b/ldconfig.c
+index 2c4eb57..2d6dc92 100644
+--- a/ldconfig.c
++++ b/ldconfig.c
+@@ -1399,8 +1399,6 @@ main (int argc, char **argv)
+ if (opt_build_cache)
+ {
+ save_cache (cache_file);
+- if (aux_cache_file)
+- save_aux_cache (aux_cache_file);
+ }
+
+ return 0;
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
index 93c0b18671..fd1630b73b 100644
--- a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -14,6 +14,8 @@ SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
file://ldconfig-default-to-all-multilib-dirs.patch \
file://endian-ness_handling_fix.patch \
file://add-64-bit-flag-for-ELF64-entries.patch \
+ file://no-aux-cache.patch \
+ file://add-riscv-support.patch \
"
PR = "r2"
diff --git a/meta/recipes-core/glibc/site_config/funcs b/meta/recipes-core/glibc/site_config/funcs
deleted file mode 100644
index ccc85392d7..0000000000
--- a/meta/recipes-core/glibc/site_config/funcs
+++ /dev/null
@@ -1,474 +0,0 @@
-a64l
-abs
-access
-__adjtimex
-alarm
-alphasort
-argz_append
-__argz_count
-argz_create_sep
-argz_insert
-__argz_next
-argz_next
-__argz_stringify
-argz_stringify
-asprintf
-atexit
-atof
-atoi
-bcmp
-bcopy
-bindresvport
-bind_textdomain_codeset
-btowc
-bzero
-calloc
-canonicalize_file_name
-catgets
-cfgetospeed
-cfsetispeed
-cfsetspeed
-chmod
-chown
-chroot
-clock
-close
-closedir
-closelog
-confstr
-connect
-daemon
-dcgettext
-difftime
-dirfd
-dirname
-dngettext
-dup2
-ecvt
-endgrent
-endmntent
-endpwent
-endutent
-endutxent
-epoll_ctl
-err
-ether_hostton
-ether_ntohost
-euidaccess
-execv
-fchdir
-fchmod
-fchmodat
-fchown
-fchownat
-fcntl
-fcvt
-fdatasync
-fdopendir
-feof_unlocked
-fgets_unlocked
-fgetxattr
-finite
-flistxattr
-flock
-flockfile
-fnmatch
-fork
-fpathconf
-__fpending
-fprintf
-free
-freeaddrinfo
-freeifaddrs
-fseeko
-__fsetlocking
-fsetxattr
-fstat64
-fstat
-fstatfs
-fsync
-ftello
-ftime
-ftruncate
-funlockfile
-futimes
-futimesat
-gai_strerror
-gcvt
-getaddrinfo
-getc_unlocked
-getcwd
-getdelim
-getdomainname
-getdtablesize
-getegid
-getenv
-geteuid
-getgid
-getgrent
-getgrent_r
-getgrgid_r
-getgrnam
-getgrnam_r
-getgrouplist
-getgroups
-gethostbyaddr_r
-gethostbyname2
-gethostbyname
-gethostbyname_r
-gethostent
-gethostid
-gethostname
-getifaddrs
-getline
-getloadavg
-getmntent
-getmsg
-getnameinfo
-getnetbyaddr_r
-getnetgrent_r
-getopt
-getopt_long
-getopt_long_only
-getpagesize
-getpass
-getpeername
-getpgrp
-getpid
-getppid
-getprotoent_r
-getpwent
-getpwent_r
-getpwnam
-getpwnam_r
-getpwuid
-getpwuid_r
-getresuid
-getrlimit
-getrusage
-getservbyname
-getservbyname_r
-getservbyport_r
-getservent
-getservent_r
-getspnam
-getspnam_r
-gettimeofday
-getttyent
-getttynam
-getuid
-getusershell
-getutent
-getutid
-getutline
-getutmp
-getutmpx
-getutxent
-getutxid
-getutxline
-getwd
-getxattr
-glob
-gmtime
-gmtime_r
-grantpt
-group_member
-herror
-hstrerror
-iconv
-iconv_open
-if_freenameindex
-if_indextoname
-if_nameindex
-if_nametoindex
-index
-inet_addr
-inet_aton
-inet_ntoa
-inet_ntop
-inet_pton
-initgroups
-innetgr
-iruserok
-isascii
-isatty
-isblank
-isgraph
-isinf
-isnan
-isprint
-isspace
-iswalnum
-iswcntrl
-iswctype
-iswprint
-iswspace
-iswupper
-isxdigit
-kill
-killpg
-lchown
-lckpwdf
-lgetxattr
-link
-listxattr
-llistxattr
-localtime
-localtime_r
-lockf
-lrand48
-lsearch
-lseek64
-lsetxattr
-lstat
-mallinfo
-malloc
-mblen
-mbrlen
-mbrtowc
-mbsinit
-mbsrtowcs
-mbtowc
-memalign
-memchr
-memcmp
-memcpy
-memmove
-mempcpy
-memrchr
-memset
-mkdir
-mkdirat
-mkdtemp
-mkfifo
-mknod
-mkstemp64
-mkstemp
-mktime
-mlock
-mmap
-mtrace
-munlock
-munmap
-nanosleep
-nice
-nl_langinfo
-ntp_adjtime
-ntp_gettime
-_obstack_free
-on_exit
-open64
-open
-openat
-opendir
-openlog
-pathconf
-pipe
-poll
-popen
-posix_memalign
-prctl
-pread
-printf
-__progname
-pselect
-pthread_mutex_lock
-ptsname
-putenv
-putgrent
-putpwent
-putspent
-pututline
-pututxline
-putwc
-pwrite
-qsort
-raise
-rand
-random
-rand_r
-read
-readdir
-readdir_r
-readlink
-realloc
-realpath
-re_comp
-recvmsg
-re_exec
-regcomp
-regexec
-remove
-rename
-re_search
-rmdir
-rpmatch
-rresvport_af
-ruserok
-ruserok_af
-sbrk
-scandir
-sched_setscheduler
-sched_yield
-__secure_getenv
-select
-semctl
-semget
-sendmsg
-setbuf
-setbuffer
-setegid
-setenv
-seteuid
-setgid
-setgroups
-sethostname
-setitimer
-_setjmp
-setjmp
-setlinebuf
-setlocale
-setmntent
-setpgid
-setpgrp
-setpriority
-setregid
-setresgid
-setresuid
-setreuid
-setrlimit
-setsid
-setsockopt
-settimeofday
-setuid
-setutent
-setutxent
-setvbuf
-setxattr
-sgetspent
-shmat
-shmctl
-shmdt
-shmget
-shutdown
-sigaction
-sigaddset
-sigaltstack
-sigblock
-sigemptyset
-sighold
-siginterrupt
-signal
-sigprocmask
-sigset
-sigsetmask
-sigstack
-sigsuspend
-sigvec
-snprintf
-socket
-socketpair
-sprintf
-srand48
-srand
-srandom
-sscanf
-stat
-statfs
-statvfs
-stime
-stpcpy
-strcasecmp
-strcasestr
-strchr
-strchrnul
-strcmp
-strcspn
-strdup
-strerror
-strerror_r
-strftime
-strlen
-strncasecmp
-strncmp
-strndup
-strnlen
-strpbrk
-strptime
-strrchr
-strsep
-strsignal
-strspn
-strstr
-strtod
-strtoimax
-strtok_r
-strtol
-strtoll
-strtoul
-strtoull
-strtoumax
-strverscmp
-strxfrm
-symlink
-sync
-sysconf
-sysctl
-sysinfo
-syslog
-_sys_siglist
-sys_siglist
-system
-tcgetattr
-tcgetpgrp
-tcsetattr
-tcsetpgrp
-time
-timegm
-times
-timezone
-tmpnam
-towlower
-towupper
-truncate
-tsearch
-ttyname
-tzset
-ulimit
-umask
-uname
-unlink
-unsetenv
-unshare
-updwtmp
-updwtmpx
-usleep
-ustat
-utime
-utimes
-utmpname
-utmpxname
-valloc
-vasprintf
-verrx
-vfork
-vfprintf
-vfscanf
-vhangup
-vprintf
-vsnprintf
-vsprintf
-wait3
-wait4
-waitpid
-wcrtomb
-wcscoll
-wcsdup
-wcslen
-wctob
-wctomb
-wctype
-wcwidth
-wmemchr
-wmemcpy
-wmempcpy
diff --git a/meta/recipes-core/glibc/site_config/headers b/meta/recipes-core/glibc/site_config/headers
deleted file mode 100644
index 609ab53797..0000000000
--- a/meta/recipes-core/glibc/site_config/headers
+++ /dev/null
@@ -1,156 +0,0 @@
-aio.h
-alloca.h
-argz.h
-arpa/inet.h
-arpa/nameser.h
-asm/byteorder.h
-asm/ioctls.h
-asm/page.h
-asm/types.h
-assert.h
-byteswap.h
-crypt.h
-ctype.h
-dirent.h
-dlfcn.h
-elf.h
-endian.h
-err.h
-errno.h
-execinfo.h
-fcntl.h
-features.h
-float.h
-fstab.h
-ftw.h
-getopt.h
-glob.h
-grp.h
-iconv.h
-ifaddrs.h
-inttypes.h
-langinfo.h
-lastlog.h
-libgen.h
-libintl.h
-limits.h
-linux/capability.h
-linux/fd.h
-linux/fs.h
-linux/hayesesp.h
-linux/hdreg.h
-linux/icmp.h
-linux/in6.h
-linux/joystick.h
-linux/ptrace.h
-linux/serial.h
-linux/sonypi.h
-linux/unistd.h
-linux/utsname.h
-linux/version.h
-locale.h
-malloc.h
-math.h
-mcheck.h
-memory.h
-mntent.h
-mqueue.h
-netdb.h
-net/if.h
-netinet/ether.h
-netinet/in.h
-netinet/ip6.h
-netinet/ip.h
-netinet/tcp.h
-netinet/udp.h
-netipx/ipx.h
-net/route.h
-paths.h
-poll.h
-pthread.h
-pty.h
-pwd.h
-regex.h
-resolv.h
-rpc/rpc.h
-rpc/types.h
-sched.h
-scsi/scsi.h
-search.h
-semaphore.h
-setjmp.h
-sgtty.h
-shadow.h
-signal.h
-stdarg.h
-stdbool.h
-stdc
-stddef.h
-stdint.h
-stdio.h
-stdlib.h
-string.h
-strings.h
-stropts.h
-sys/bitypes.h
-sys/cdefs.h
-sys/dir.h
-sys/epoll.h
-sysexits.h
-sys/fcntl.h
-sys/file.h
-sys/fsuid.h
-sys/ioctl.h
-sys/ipc.h
-syslog.h
-sys/mman.h
-sys/mount.h
-sys/mtio.h
-sys/param.h
-sys/poll.h
-sys/prctl.h
-sys/ptrace.h
-sys/queue.h
-sys/reg.h
-sys/resource.h
-sys/select.h
-sys/sem.h
-sys/shm.h
-sys/signal.h
-sys/socket.h
-sys/socketvar.h
-sys/soundcard.h
-sys/statfs.h
-sys/stat.h
-sys/statvfs.h
-sys/stropts.h
-sys/swap.h
-sys/sysctl.h
-sys/sysinfo.h
-sys/sysmacros.h
-sys/termios.h
-sys/timeb.h
-sys/time.h
-sys/times.h
-sys/timex.h
-sys/types.h
-sys/uio.h
-sys/un.h
-sys/unistd.h
-sys/user.h
-sys/utsname.h
-sys/vfs.h
-sys/wait.h
-termio.h
-termios.h
-time.h
-ttyent.h
-ulimit.h
-unistd.h
-ustat.h
-utime.h
-utmp.h
-utmpx.h
-values.h
-wchar.h
-wctype.h
diff --git a/meta/recipes-core/glibc/site_config/types b/meta/recipes-core/glibc/site_config/types
deleted file mode 100644
index 178bd85a00..0000000000
--- a/meta/recipes-core/glibc/site_config/types
+++ /dev/null
@@ -1,21 +0,0 @@
-char
-char *
-double
-float
-int
-long
-long double
-long int
-long long
-long long int
-short
-short int
-signed char
-unsigned char
-unsigned int
-unsigned long
-unsigned long int
-unsigned long long int
-unsigned short
-unsigned short int
-void *
diff --git a/meta/recipes-core/ifupdown/files/0001-Define-FNM_EXTMATCH-for-musl.patch b/meta/recipes-core/ifupdown/files/0001-Define-FNM_EXTMATCH-for-musl.patch
new file mode 100644
index 0000000000..7bf02ea536
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/0001-Define-FNM_EXTMATCH-for-musl.patch
@@ -0,0 +1,47 @@
+From ff714d6461569d69b253089110ec659e4ebec248 Mon Sep 17 00:00:00 2001
+From: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
+Date: Tue, 2 Jul 2019 20:10:42 +0200
+Subject: [PATCH] Define FNM_EXTMATCH for musl
+
+Fixes the following compilation errors with musl that does not have
+FNM_EXTMATCH defined:
+
+| main.c: In function 'expand_matches':
+| main.c:700:40: error: 'FNM_EXTMATCH' undeclared (first use in this
+function); did you mean 'FNM_NOMATCH'?
+| 700 | if(fnmatch(pattern, ifa->ifa_name, FNM_EXTMATCH))
+| | ^~~~~~~~~~~~
+| | FNM_NOMATCH
+
+and
+
+| archlinux.c:40:28: error: 'FNM_EXTMATCH' undeclared (first use in this
+function); did you mean 'FNM_NOMATCH'?
+| 40 | if(fnmatch(pattern, buf, FNM_EXTMATCH) == 0) {
+| | ^~~~~~~~~~~~
+| | FNM_NOMATCH
+
+Upstream-Status: Submitted [https://salsa.debian.org/debian/ifupdown/merge_requests/5]
+
+Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
+---
+ archcommon.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/archcommon.h b/archcommon.h
+index fe99950..f257f9d 100644
+--- a/archcommon.h
++++ b/archcommon.h
+@@ -1,5 +1,9 @@
+ #include "header.h"
+
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ bool execable(const char *);
+
+ #define iface_is_link() (!_iface_has(ifd->real_iface, ":."))
+--
+2.17.1
+
diff --git a/meta/recipes-core/ifupdown/files/0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch b/meta/recipes-core/ifupdown/files/0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch
new file mode 100644
index 0000000000..57c8d04fd7
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch
@@ -0,0 +1,23 @@
+From 7ace0656bd325f9e7749f2cde641eddc057bc98a Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Thu, 9 Jan 2020 15:38:06 +0100
+Subject: [PATCH] Makefile: do not use dpkg for determining OS type
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 0ce2fa3..739aef2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION ?= 0.8
+ CFLAGS ?= -Wall -W -Wno-unused-parameter -g -O2
+-ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
++ARCH := linux
+
+ BASEDIR ?= $(DESTDIR)
+
diff --git a/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch b/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch
new file mode 100644
index 0000000000..c751e4fab0
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/0001-ifupdown-skip-wrong-test-case.patch
@@ -0,0 +1,32 @@
+From 98243deface88614e3f332c4a85d04a9abce55ff Mon Sep 17 00:00:00 2001
+From: Zqiang <qiang.zhang@windriver.com>
+Date: Mon, 19 Apr 2021 14:15:45 +0800
+Subject: [PATCH] ifupdown: skip wrong test case
+
+The test parameters of testcase(12-15) file is not right,
+it triggers a test failure, these test items are invalid
+and are skipped directly.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Zqiang <qiang.zhang@windriver.com>
+---
+ tests/testbuild-linux | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/testbuild-linux b/tests/testbuild-linux
+index 1181ea0..5f148eb 100755
+--- a/tests/testbuild-linux
++++ b/tests/testbuild-linux
+@@ -3,7 +3,7 @@
+ dir=tests/linux
+
+ result=true
+-for test in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18; do
++for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+ if [ -e $dir/testcase.$test ]; then
+ args="$(cat $dir/testcase.$test | sed -n 's/^# RUN: //p')"
+ else
+--
+2.17.1
+
diff --git a/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch b/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch
index 8c4d953a28..d1c3d260ed 100644
--- a/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch
+++ b/meta/recipes-core/ifupdown/files/defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch
@@ -1,4 +1,4 @@
-From 7af9db748974cb3a2c6ef8f9e03d7db1f9f8ee16 Mon Sep 17 00:00:00 2001
+From 40257d65b338b6e2ed9d89d6fa7c7b8701a4c311 Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@windriver.com>
Date: Wed, 6 Aug 2014 14:54:12 -0400
Subject: [PATCH 1/2] defn2[c|man]: don't rely on dpkg-architecture to set arch
@@ -12,13 +12,14 @@ arch specific methods, and the end result will be strangeness
like the loopback device not being configured/enabled.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+Upstream-Status: Pending
---
defn2c.pl | 6 +++---
defn2man.pl | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/defn2c.pl b/defn2c.pl
-index c449de2f3d1c..38845e374c76 100755
+index 8798dc2..f2551c7 100755
--- a/defn2c.pl
+++ b/defn2c.pl
@@ -2,9 +2,9 @@
@@ -35,7 +36,7 @@ index c449de2f3d1c..38845e374c76 100755
# declarations
my $address_family = "";
diff --git a/defn2man.pl b/defn2man.pl
-index 6ddcfdd4fe68..c9c4dd046597 100755
+index 6ddcfdd..c9c4dd0 100755
--- a/defn2man.pl
+++ b/defn2man.pl
@@ -2,9 +2,9 @@
@@ -52,5 +53,5 @@ index 6ddcfdd4fe68..c9c4dd046597 100755
# declarations
my $line;
--
-1.9.1
+2.17.1
diff --git a/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch b/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
deleted file mode 100644
index bff352e3af..0000000000
--- a/meta/recipes-core/ifupdown/files/inet-6-.defn-fix-inverted-checks-for-loopback.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From 74152ac74a3e1ea0f3be292aa1eeca5ad1fe69c0 Mon Sep 17 00:00:00 2001
-From: Paul Gortmaker <paul.gortmaker@windriver.com>
-Date: Wed, 6 Aug 2014 15:12:11 -0400
-Subject: [PATCH 2/2] inet[6].defn: fix inverted checks for loopback
-
-Compared to the hurd link.defn for loopback, we see these
-are inverted, meaning that you would only be able to configure
-a loopback device that was _not_ named "lo" (unlikely to exist).
-
-The result was that we'd update /run/network/ifstate for "lo"
-but never actually do anything for up/down, as shown below:
-
-root@localhost:~# ifconfig -s
-Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736329 0 2016 0 5289422 0 0 0 BMRU
-lo 65536 0 18 0 0 0 18 0 0 0 LRU
-root@localhost:~# ifdown lo
-root@localhost:~# echo $?
-0
-root@localhost:~# ifconfig -s
-Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736406 0 2016 0 5289455 0 0 0 BMRU
-lo 65536 0 18 0 0 0 18 0 0 0 LRU
-root@localhost:~# ifconfig lo down
-root@localhost:~# ifconfig -s
-Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
-eth0 1500 0 7736474 0 2016 0 5289481 0 0 0 BMRU
-root@localhost:~#
-
-Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
----
- inet.defn | 12 ++++++------
- inet6.defn | 8 ++++----
- 2 files changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/inet.defn b/inet.defn
-index b176ab4ed03e..5fdfb14a0e1c 100644
---- a/inet.defn
-+++ b/inet.defn
-@@ -6,10 +6,10 @@ method loopback
- This method may be used to define the IPv4 loopback interface.
-
- up
-- ip link set dev %iface% up if (!iface_is_lo())
-+ ip link set dev %iface% up if (iface_is_lo())
-
- down
-- ip link set dev %iface% down if (!iface_is_lo())
-+ ip link set dev %iface% down if (iface_is_lo())
-
- method static
- description
-@@ -212,11 +212,11 @@ method loopback
-
- up
- ifconfig %iface% 127.0.0.1 up \
-- if (!iface_is_lo())
-+ if (iface_is_lo())
-
- down
- ifconfig %iface% down \
-- if (!iface_is_lo())
-+ if (iface_is_lo())
-
- method static
- description
-@@ -371,11 +371,11 @@ method loopback
-
- up
- inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \
-- if (!iface_is_lo())
-+ if (iface_is_lo())
-
- down
- inetutils-ifconfig --interface %iface% --down \
-- if (!iface_is_lo())
-+ if (iface_is_lo())
-
- method static
- description
-diff --git a/inet6.defn b/inet6.defn
-index 09325539cd01..4df64aff38cc 100644
---- a/inet6.defn
-+++ b/inet6.defn
-@@ -33,11 +33,11 @@ method loopback
- description
- This method may be used to define the IPv6 loopback interface.
- up
-- -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo())
-- -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo())
-+ -ip link set dev %iface% up 2>/dev/null if (iface_is_lo())
-+ -ip addr add dev %iface% ::1 2>/dev/null if (iface_is_lo())
- down
-- -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo())
-- -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo())
-+ -ip addr del dev %iface% ::1 2>/dev/null if (iface_is_lo())
-+ -ip link set dev %iface% down 2>/dev/null if (iface_is_lo())
-
- method static
- description
---
-1.9.1
-
diff --git a/meta/recipes-core/ifupdown/files/run-ptest b/meta/recipes-core/ifupdown/files/run-ptest
new file mode 100644
index 0000000000..8694042392
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/run-ptest
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+CURDIR=$(dirname `readlink -f $0`)
+cd $CURDIR/tests && ./testbuild-linux
diff --git a/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
new file mode 100644
index 0000000000..ea88a9086a
--- /dev/null
+++ b/meta/recipes-core/ifupdown/files/tweak-ptest-script.patch
@@ -0,0 +1,54 @@
+Tweak tests of ifupdown to make it work with oe-core ptest framework.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ tests/testbuild-linux | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/tests/testbuild-linux b/tests/testbuild-linux
+index 5f148eb..d9b1698 100755
+--- a/tests/testbuild-linux
++++ b/tests/testbuild-linux
+@@ -1,6 +1,7 @@
+ #!/bin/sh -e
+
+-dir=tests/linux
++curdir=$(dirname `readlink -f $0`)
++dir=$curdir/linux
+
+ result=true
+ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+@@ -12,7 +13,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+ echo "Testcase $test: $args"
+
+ exitcode=0
+- ./ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++ ifup -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+ >$dir/up-res-out.$test 2>$dir/up-res-err.$test || exitcode=$?
+
+ (echo "exit code: $exitcode";
+@@ -20,7 +21,7 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+ echo "====stderr===="; cat $dir/up-res-err.$test) > $dir/up-res.$test
+
+ exitcode=0
+- ./ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
++ ifdown -v --no-act-commands --force -i $dir/testcase.$test --state-dir=$dir/state.$test $args \
+ >$dir/down-res-out.$test 2>$dir/down-res-err.$test || exitcode=$?
+
+ (echo "exit code: $exitcode";
+@@ -28,9 +29,9 @@ for test in 1 2 3 4 5 6 7 8 9 10 11 16 17 18; do
+ echo "====stderr===="; cat $dir/down-res-err.$test) > $dir/down-res.$test
+
+ if diff -ub $dir/up.$test $dir/up-res.$test && diff -ub $dir/down.$test $dir/down-res.$test; then
+- echo "(okay)"
++ echo "PASS: $test"
+ else
+- echo "(failed)"
++ echo "FAIL: $test"
+ result=false
+ fi
+ echo "=========="
+--
+2.17.1
diff --git a/meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb b/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb
index 24eb87bafb..48a7b8fb13 100644
--- a/meta/recipes-core/ifupdown/ifupdown_0.7.48.1.bb
+++ b/meta/recipes-core/ifupdown/ifupdown_0.8.36.bb
@@ -1,4 +1,5 @@
SUMMARY = "ifupdown: basic ifup and ifdown used by initscripts"
+HOMEPAGE = "https://salsa.debian.org/debian/ifupdown"
DESCRIPTION = "High level tools to configure network interfaces \
This package provides the tools ifup and ifdown which may be used to \
configure (or, respectively, deconfigure) network interfaces, based on \
@@ -6,19 +7,21 @@ the file /etc/network/interfaces."
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
-SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/i/ifupdown/ifupdown_0.7.48.1ubuntu5.tar.gz \
- file://defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch \
- file://inet-6-.defn-fix-inverted-checks-for-loopback.patch \
- file://99_network \
- "
+SRC_URI = "git://salsa.debian.org/debian/ifupdown.git;protocol=https;branch=master \
+ file://defn2-c-man-don-t-rely-on-dpkg-architecture-to-set-a.patch \
+ file://99_network \
+ file://0001-Define-FNM_EXTMATCH-for-musl.patch \
+ file://0001-Makefile-do-not-use-dpkg-for-determining-OS-type.patch \
+ file://run-ptest \
+ file://0001-ifupdown-skip-wrong-test-case.patch \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'file://tweak-ptest-script.patch', '', d)} \
+ "
+SRCREV = "c73226073e2b13970ca613b20a13b9c0253bf9da"
-EXTRA_OEMAKE = ""
+S = "${WORKDIR}/git"
-# needed so we don't get default S="${WORKDIR}/ifupdown-${PV}"
-S = "${WORKDIR}/ifupdown-${PV}ubuntu5"
-
-inherit update-rc.d update-alternatives
+inherit ptest update-alternatives
do_compile () {
chmod a+rx *.pl *.sh
@@ -41,14 +44,14 @@ do_install () {
cd ${D}${mandir}/man8 && ln -s ifup.8 ifdown.8
}
+do_install_ptest () {
+ install -d ${D}${PTEST_PATH}/tests
+ cp -r ${S}/tests/testbuild-linux ${D}${PTEST_PATH}/tests/
+ cp -r ${S}/tests/linux ${D}${PTEST_PATH}/tests/
+}
+
ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_${PN} = "ifup ifdown"
+ALTERNATIVE:${PN} = "ifup ifdown"
ALTERNATIVE_LINK_NAME[ifup] = "${base_sbindir}/ifup"
ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown"
-
-INITSCRIPT_NAME = "ifup"
-INITSCRIPT_PARAMS = "start 39 S . stop 39 0 6 1 ."
-
-SRC_URI[md5sum] = "85ba375f3c6f26d34efb2a8575e77fc8"
-SRC_URI[sha256sum] = "08dce14692c07b72b583b86c4d3ace0d9dac1928925144cc3ddde15b694ebbdf"
diff --git a/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Guest_Additions.txt b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Guest_Additions.txt
new file mode 100644
index 0000000000..e7298f2c3c
--- /dev/null
+++ b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Guest_Additions.txt
@@ -0,0 +1,75 @@
+
+Installing VirtualBox Guest Additions
+=====================================
+
+In order to use VirtualBox guest additions, they have to be build
+first. They may have to be rebuilt each time the time you upgrade to
+a new version of VirtualBox.
+
+Make sure VM is configured with an Optical Drive.
+
+Please follow these steps to install the VirtualBox Guest Additions on the
+Build Appliance VM:
+
+1. Boot VM, select root "Terminal" instead of the default "Terminal <2>"
+
+2. Insert Guest additions CD into VM optical drive:
+ VM menu "Devices"->"Optical Drives"-> Select "VBoxGuestAdditions<version>.iso"
+
+3. Find your CDROM device. Typically it is /dev/hda for IDE. You can determine
+ the actual name <cdromedev> by viewing the cdrom info:
+
+ # cat /proc/sys/dev/cdrom/info
+
+ Mount the cdrom drive:
+ # mount -t iso9660 <cdromdev> /media/cdrom
+ i.e.:
+ # mount -t iso9660 /dev/hda /media/cdrom
+
+4. Build the additions:
+
+ First, we need to build of some prerequisite utilities.
+ (This is only needed to be done once)
+
+ # cd /lib/modules/<kernel-version>-yocto-standard/build
+ # make scripts
+
+ Now build the guest additions:
+
+ # /media/cdrom/VBoxLinuxAdditions.run --nox11
+
+ At this point, providing there were no build errors, the guest additions are
+ built and installed.
+
+5. Check if vbox additions running:
+
+ # /etc/init.d/vboxadd status
+
+ If not running, try manually starting:
+
+ # /etc/init.d/vboxadd start
+
+6. Check if additons actually work, in particular folder sharing.
+
+ Host: Devices->Shared Folders->Shared Folder Settings...
+ Add any host folder and name it (i.e. "images")
+
+ Guest VM: create mount point for the shared folder, i.e.:
+
+ # mkdir ~/my-host
+
+ Mount the shared folder: (Watch out for spelling: it's vboxsf NOT vboxfs)
+
+ # mount -t vboxsf images ~/my-host
+
+ Verify mount, should see the contents of the shared folder:
+
+ # ls ~/my-host
+
+
+
+
+
+
+
+
diff --git a/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
new file mode 100644
index 0000000000..a0aede2fbf
--- /dev/null
+++ b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
@@ -0,0 +1,78 @@
+
+Running Toaster in VirtualBox
+=============================
+
+Toaster is launched via the command in VM:
+
+ $ source toaster start webport=<IPADDR:PORT>
+
+The interaction with Toaster web server is done via a host internet
+browser.
+The particular steps depend on the actual networking being used
+by the VirtualBox.
+
+
+Bridged Network
+===============
+
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+It should be something like:
+ inet addr:192.168.1.18
+
+Launch the Toaster web server in VM:
+
+ $ source toaster start webport=192.168.1.18:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://192.168.1.18:8000
+
+
+NAT Network
+===========
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+For NAT network it should be something like:
+ inet addr:10.0.2.15
+
+When using NAT network, the VM web server can be accessed using
+Port Forwarding.
+
+Using the VirtualBox GUI, navigate to:
+ Settings->Network->Adapter1
+
+You should set:
+ Attached to: NAT
+
+Select "Advanced", click on "Port Forwarding"
+
+This will open a new dialog box "Port Forwarding Rules".
+Create a new rule that looks like this:
+
+| Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
++-------+----------+---------+-----------+----------+------------+
+| Rule1 | TCP | | 8000 | | 8000 |
+------------------------------------------------------------------
+
+Now we can launch the Toaster web server in VM:
+
+ $ source toaster start webport=10.0.2.15:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://127.0.0.1:8000
+
+
+
+
+
+
+
+
diff --git a/meta/recipes-core/images/build-appliance-image_12.0.1.bb b/meta/recipes-core/images/build-appliance-image_12.0.1.bb
deleted file mode 100644
index 0a86ba4b3d..0000000000
--- a/meta/recipes-core/images/build-appliance-image_12.0.1.bb
+++ /dev/null
@@ -1,93 +0,0 @@
-SUMMARY = "An image containing the build system itself"
-DESCRIPTION = "An image containing the build system that you can boot and run using either VMware Player or VMware Workstation."
-HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
-
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-
-IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted"
-
-IMAGE_FEATURES += "x11-base package-management splash"
-
-# Ensure there's enough space to do a core-image-sato build, with rm_work enabled
-IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
-
-# Do a quiet boot with limited console messages
-APPEND += "rootfstype=ext4 quiet"
-
-DEPENDS = "zip-native"
-IMAGE_FSTYPES = "vmdk"
-
-inherit core-image
-
-SRCREV ?= "d01cd53429b1c20f01dac97f1b9b659cb9dc9812"
-SRC_URI = "git://git.yoctoproject.org/poky \
- file://Yocto_Build_Appliance.vmx \
- file://Yocto_Build_Appliance.vmxf \
- "
-
-IMAGE_CMD_ext4_append () {
- # We don't need to reserve much space for root, 0.5% is more than enough
- tune2fs -m 0.5 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext4
-}
-
-fakeroot do_populate_poky_src () {
- # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
- # will become invalid in the target.
- rm -rf ${WORKDIR}/git/.git
- rm -f ${WORKDIR}/git/.gitignore
-
- cp -Rp ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
-
- mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
- mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
- cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
-
- # Remove the git2_* tarballs -- this is ok since we still have the git2/.
- rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
-
- echo "/usr/bin" > ${IMAGE_ROOTFS}/home/builder/poky/build/pseudodone
- echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
- mkdir -p ${IMAGE_ROOTFS}/home/builder/pseudo
- echo "export PSEUDO_PREFIX=/usr" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
- echo "export PSEUDO_LOCALSTATEDIR=/home/builder/pseudo" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
- echo "export PSEUDO_LIBDIR=/usr/lib/pseudo/lib64" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
-
- chown builder.builder ${IMAGE_ROOTFS}/home/builder/pseudo
-
- chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/poky
-
- # Allow builder to use sudo to setup tap/tun
- echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
-
- # Use Clearlooks GTK+ theme
- mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
- echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
-}
-
-IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
-
-addtask rootfs after do_unpack
-
-python () {
- # Ensure we run these usually noexec tasks
- d.delVarFlag("do_fetch", "noexec")
- d.delVarFlag("do_unpack", "noexec")
-}
-
-create_bundle_files () {
- cd ${WORKDIR}
- mkdir -p Yocto_Build_Appliance
- cp *.vmx* Yocto_Build_Appliance
- ln -sf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
- zip -r ${DEPLOY_DIR_IMAGE}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
- ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${DEPLOY_DIR_IMAGE}/Yocto_Build_Appliance.zip
-}
-
-python do_bundle_files() {
- bb.build.exec_func('create_bundle_files', d)
-}
-
-addtask bundle_files after do_vmimg before do_build
-do_bundle_files[nostamp] = "1"
diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
new file mode 100644
index 0000000000..94cafdbbe4
--- /dev/null
+++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
@@ -0,0 +1,137 @@
+SUMMARY = "An image containing the build system itself"
+DESCRIPTION = "An image containing the build system that you can boot and run using either VirtualBox, VMware Player or VMware Workstation."
+HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted \
+ kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcpcd \
+ tzdata python3-pip perl-misc"
+
+IMAGE_FEATURES += "x11-base package-management splash"
+
+QB_MEM = '${@bb.utils.contains("DISTRO_FEATURES", "opengl", "-m 512", "-m 256", d)}'
+
+# Ensure there's enough space to do a core-image-sato build, with rm_work enabled
+IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
+
+# Do a quiet boot with limited console messages
+APPEND += "rootfstype=ext4 quiet"
+
+DEPENDS = "zip-native python3-pip-native"
+IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx"
+
+inherit core-image setuptools3
+
+SRCREV ?= "156767d3ed6f044a6b2dd43fc1fea13852e761a2"
+SRC_URI = "git://git.yoctoproject.org/poky;branch=honister \
+ file://Yocto_Build_Appliance.vmx \
+ file://Yocto_Build_Appliance.vmxf \
+ file://README_VirtualBox_Guest_Additions.txt \
+ file://README_VirtualBox_Toaster.txt \
+ "
+RECIPE_NO_UPDATE_REASON = "Recipe is recursive and handled as part of the release process"
+BA_INCLUDE_SOURCES ??= "0"
+
+IMAGE_CMD:ext4:append () {
+ # We don't need to reserve much space for root, 0.5% is more than enough
+ tune2fs -m 0.5 ${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ext4
+}
+
+fakeroot do_populate_poky_src () {
+ # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
+ # will become invalid in the target.
+ rm -rf ${WORKDIR}/git/.git
+ rm -f ${WORKDIR}/git/.gitignore
+
+ cp -R ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
+
+ mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
+ mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
+ if [ ${BA_INCLUDE_SOURCES} != 0 ]; then
+ cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
+ # Remove the git2_* tarballs -- this is ok since we still have the git2/.
+ rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
+ fi
+
+ # Place the README_VirtualBox_Guest_Additions file in builders home folder.
+ cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
+
+ # Place the README_VirtualBox_Toaster file in builders home folder.
+ cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
+
+ echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
+ echo "export LC_ALL=en_US.utf8" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+
+ # Also save (for reference only) the actual SRCREV used to create this image
+ echo "export BA_SRCREV=${SRCREV}" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo 'export PATH=$PATH:/sbin' >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+
+ echo "# If working behind a proxy and using the provided oe-git-proxy script" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "# you need to set ALL_PROXY based on your proxy settings." >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "# Example ALL_PROXY values:" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "# export ALL_PROXY=https://proxy.example.com:8080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+ echo "# export ALL_PROXY=socks://socks.example.com:1080" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
+
+ chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/poky
+ chmod -R ug+rw ${IMAGE_ROOTFS}/home/builder/poky
+
+ # Assume we will need CDROM to install guest additions
+ mkdir -p ${IMAGE_ROOTFS}/media/cdrom
+
+ # Allow builder to use sudo
+ echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
+
+ # Load tap/tun at startup
+ rm -f ${IMAGE_ROOTFS}/sbin/iptables
+ lnr ${IMAGE_ROOTFS}/usr/sbin/iptables ${IMAGE_ROOTFS}/sbin/iptables
+ echo "tun" >> ${IMAGE_ROOTFS}/etc/modules
+
+ # Use Clearlooks GTK+ theme
+ mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
+ echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
+
+ # Install modules needed for toaster
+ export STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}
+ export STAGING_INCDIR=${STAGING_INCDIR_NATIVE}
+ export HOME=${IMAGE_ROOTFS}/home/builder
+ mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
+ pip3_install_params="--user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt"
+ if [ -n "${http_proxy}" ]; then
+ pip3_install_params="${pip3_install_params} --proxy ${http_proxy}"
+ fi
+ pip3 install ${pip3_install_params}
+ chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.local
+ chown -R builder:builder ${IMAGE_ROOTFS}/home/builder/.cache
+}
+
+IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
+
+addtask rootfs after do_unpack
+
+python () {
+ # Ensure we run these usually noexec tasks
+ d.delVarFlag("do_fetch", "noexec")
+ d.delVarFlag("do_unpack", "noexec")
+}
+
+create_bundle_files () {
+ cd ${WORKDIR}
+ mkdir -p Yocto_Build_Appliance
+ cp *.vmx* Yocto_Build_Appliance
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhdx Yocto_Build_Appliance/Yocto_Build_Appliance.vhdx
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.wic.vhd Yocto_Build_Appliance/Yocto_Build_Appliance.vhd
+ zip -r ${IMGDEPLOYDIR}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
+ ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${IMGDEPLOYDIR}/Yocto_Build_Appliance.zip
+}
+create_bundle_files[vardepsexclude] = "DATETIME"
+
+python do_bundle_files() {
+ bb.build.exec_func('create_bundle_files', d)
+}
+
+addtask bundle_files after do_image_wic before do_image_complete
diff --git a/meta/recipes-core/images/core-image-minimal-initramfs.bb b/meta/recipes-core/images/core-image-minimal-initramfs.bb
index 1f0fa9580b..664fe7310e 100644
--- a/meta/recipes-core/images/core-image-minimal-initramfs.bb
+++ b/meta/recipes-core/images/core-image-minimal-initramfs.bb
@@ -3,12 +3,21 @@ DESCRIPTION = "Small image capable of booting a device. The kernel includes \
the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
first 'init' program more efficiently."
-PACKAGE_INSTALL = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi busybox udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+INITRAMFS_SCRIPTS ?= "\
+ initramfs-framework-base \
+ initramfs-module-setup-live \
+ initramfs-module-udev \
+ initramfs-module-install \
+ initramfs-module-install-efi \
+ "
+
+PACKAGE_INSTALL = "${INITRAMFS_SCRIPTS} ${VIRTUAL-RUNTIME_base-utils} udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
# Do not pollute the initrd image with rootfs features
IMAGE_FEATURES = ""
-export IMAGE_BASENAME = "core-image-minimal-initramfs"
+export IMAGE_BASENAME = "${MLPREFIX}core-image-minimal-initramfs"
+IMAGE_NAME_SUFFIX ?= ""
IMAGE_LINGUAS = ""
LICENSE = "MIT"
@@ -17,5 +26,7 @@ IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
inherit core-image
IMAGE_ROOTFS_SIZE = "8192"
+IMAGE_ROOTFS_EXTRA_SPACE = "0"
-BAD_RECOMMENDATIONS += "busybox-syslog"
+# Use the same restriction as initramfs-module-install
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
index 8dd77b3472..84343adcd8 100644
--- a/meta/recipes-core/images/core-image-minimal.bb
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -1,6 +1,6 @@
SUMMARY = "A small image just capable of allowing a device to boot."
-IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
+IMAGE_INSTALL = "packagegroup-core-boot ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
@@ -9,4 +9,4 @@ LICENSE = "MIT"
inherit core-image
IMAGE_ROOTFS_SIZE ?= "8192"
-IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
+IMAGE_ROOTFS_EXTRA_SPACE:append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "", d)}"
diff --git a/meta/recipes-core/images/core-image-ptest-all.bb b/meta/recipes-core/images/core-image-ptest-all.bb
new file mode 100644
index 0000000000..1472451675
--- /dev/null
+++ b/meta/recipes-core/images/core-image-ptest-all.bb
@@ -0,0 +1,25 @@
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "ptest"
+
+require core-image-minimal.bb
+require conf/distro/include/ptest-packagelists.inc
+
+DESCRIPTION += "Also includes ptest packages."
+HOMEPAGE = "https://www.yoctoproject.org/"
+
+# Include the full set of ptests
+IMAGE_INSTALL += "${PTESTS_FAST} ${PTESTS_SLOW}"
+
+# This image is sufficiently large (~1.8GB) that we need to be careful that it fits in a live
+# image (which has a 4GB limit), so nullify the overhead factor (1.3x out of the
+# box) and explicitly add just 1100MB.
+# strace-ptest in particular needs more than 500MB
+IMAGE_OVERHEAD_FACTOR = "1.0"
+IMAGE_ROOTFS_EXTRA_SPACE = "1124288"
+
+# ptests need more memory than standard to avoid the OOM killer
+# also lttng-tools needs /tmp that has at least 2G
+QB_MEM = "-m 4096"
+
+# Sadly at the moment the full set of ptests is not robust enough and sporadically fails in random places
+PTEST_EXPECT_FAILURE = "1"
diff --git a/meta/recipes-core/images/core-image-ptest-fast.bb b/meta/recipes-core/images/core-image-ptest-fast.bb
new file mode 100644
index 0000000000..40df274c4c
--- /dev/null
+++ b/meta/recipes-core/images/core-image-ptest-fast.bb
@@ -0,0 +1,24 @@
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "ptest"
+
+require core-image-minimal.bb
+require conf/distro/include/ptest-packagelists.inc
+
+# Include only fast (< 30 sec) ptests
+IMAGE_INSTALL += "${PTESTS_FAST}"
+
+DESCRIPTION += "Also includes ptest packages with fast execution times to allow for more automated QA."
+HOMEPAGE = "https://www.yoctoproject.org/"
+
+# This image is sufficiently large (~1.8GB) that it can't actually fit in a live
+# image (which has a 4GB limit), so nullify the overhead factor (1.3x out of the
+# box) and explicitly add just 1500MB.
+# strace-ptest in particular needs more than 500MB
+IMAGE_OVERHEAD_FACTOR = "1.0"
+IMAGE_ROOTFS_EXTRA_SPACE = "1524288"
+
+# ptests need more memory than standard to avoid the OOM killer
+QB_MEM = "-m 1024"
+
+# Sadly at the moment the fast set of ptests is not robust enough and sporadically fails in a couple of places
+PTEST_EXPECT_FAILURE = "1"
diff --git a/meta/recipes-core/images/core-image-tiny-initramfs.bb b/meta/recipes-core/images/core-image-tiny-initramfs.bb
new file mode 100644
index 0000000000..47470849ed
--- /dev/null
+++ b/meta/recipes-core/images/core-image-tiny-initramfs.bb
@@ -0,0 +1,44 @@
+# Simple initramfs image artifact generation for tiny images.
+DESCRIPTION = "Tiny image capable of booting a device. The kernel includes \
+the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
+first 'init' program more efficiently. core-image-tiny-initramfs doesn't \
+actually generate an image but rather generates boot and rootfs artifacts \
+that can subsequently be picked up by external image generation tools such as wic."
+
+VIRTUAL-RUNTIME_dev_manager ?= "busybox-mdev"
+
+PACKAGE_INSTALL = "initramfs-live-boot-tiny packagegroup-core-boot dropbear ${VIRTUAL-RUNTIME_base-utils} ${VIRTUAL-RUNTIME_dev_manager} base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
+
+# Do not pollute the initrd image with rootfs features
+IMAGE_FEATURES = ""
+
+export IMAGE_BASENAME = "core-image-tiny-initramfs"
+IMAGE_NAME_SUFFIX ?= ""
+IMAGE_LINGUAS = ""
+
+LICENSE = "MIT"
+
+# don't actually generate an image, just the artifacts needed for one
+IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
+
+inherit core-image
+
+IMAGE_ROOTFS_SIZE = "8192"
+IMAGE_ROOTFS_EXTRA_SPACE = "0"
+
+# Use the same restriction as initramfs-live-install
+COMPATIBLE_HOST = "(i.86|x86_64|aarch64).*-linux"
+
+python tinyinitrd () {
+ # Modify our init file so the user knows we drop to shell prompt on purpose
+ newinit = None
+ with open(d.expand('${IMAGE_ROOTFS}/init'), 'r') as init:
+ newinit = init.read()
+ newinit = newinit.replace('Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell ', 'Poky Tiny Reference Distribution:')
+ with open(d.expand('${IMAGE_ROOTFS}/init'), 'w') as init:
+ init.write(newinit)
+}
+
+IMAGE_PREPROCESS_COMMAND += "tinyinitrd;"
+
+QB_KERNEL_CMDLINE_APPEND += "debugshell=3 init=/bin/busybox sh init"
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuall/interfaces
index 16967763e5..16967763e5 100644
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuall/interfaces
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces
deleted file mode 100644
index 16967763e5..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm64/interfaces
+++ /dev/null
@@ -1,5 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces
deleted file mode 100644
index 16967763e5..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces
+++ /dev/null
@@ -1,5 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces
deleted file mode 100644
index 16967763e5..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces
+++ /dev/null
@@ -1,5 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces
deleted file mode 100644
index f62b9a897d..0000000000
--- a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces
+++ /dev/null
@@ -1,8 +0,0 @@
-# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
-
-# The loopback interface
-auto lo
-iface lo inet loopback
-
-
-
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
index 733ae41f20..741da324d0 100644
--- a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
@@ -29,13 +29,13 @@ do_install () {
install -m 0755 ${WORKDIR}/nfsroot ${D}${sysconfdir}/network/if-pre-up.d
}
-do_install_append_qemuall () {
+do_install:append:qemuall () {
# Disable network manager on machines that commonly do NFS booting
touch ${D}${sysconfdir}/network/nm-disabled-eth0
}
-PACKAGE_ARCH_qemuall = "${MACHINE_ARCH}"
-RDEPENDS_${PN} = "netbase"
-RCONFLICTS_${PN} = "netbase (< 1:5.0)"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+RDEPENDS:${PN} = "netbase"
+RCONFLICTS:${PN} = "netbase (< 1:5.0)"
-CONFFILES_${PN} = "${sysconfdir}/network/interfaces"
+CONFFILES:${PN} = "${sysconfdir}/network/interfaces"
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
index 7a0b4d4406..b351985a61 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
@@ -27,7 +27,7 @@ do
# Try sleeping here to avoid getting kernel messages
# obscuring/confusing user
sleep 5
- echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]"
+ echo "Found drive at /dev/${device}. Do you want to install this image there? [y/n]"
read answer
if [ "$answer" = "y" ] ; then
break
@@ -69,7 +69,7 @@ umount /dev/${device}* 2> /dev/null || /bin/true
mkdir -p /tmp
cat /proc/mounts > /etc/mtab
-disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted /dev/${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
testfs_size=$((disk_size*testfs_ratio/100))
rootfs_size=$((disk_size-boot_size-testfs_size))
@@ -171,19 +171,19 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
fi
if [ -d /run/media/$1/loader ]; then
- GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
- # copy config files for gummiboot
+ SYSTEMDBOOT_CFGS="/ssd/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /ssd
# delete the install entry
rm -f /ssd/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
# Add the test label
echo -ne "title test\nlinux /test-kernel\noptions root=$testfs rw $rootwait quiet\n" > /ssd/loader/entries/test.conf
fi
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index a3ed74b989..f667518b89 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -8,8 +8,19 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# We need 20 Mb for the boot partition
-boot_size=20
+# figure out how big of a boot partition we need
+boot_size=$(du -ms /run/media/$1/ | awk '{print $1}')
+# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot
+if [ -e /run/media/$1/$2 ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') ))
+fi
+# remove initrd from size since its not currently installed
+if [ -e /run/media/$1/initrd ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') ))
+fi
+# add 10M to provide some extra space for users and account
+# for rounding in the above subtractions
+boot_size=$(( boot_size + 10 ))
# 5% for swap
swap_ratio=5
@@ -22,6 +33,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -29,7 +42,13 @@ esac
echo "Searching for hard drives ..."
-for device in `ls /sys/block/`; do
+# Some eMMC devices have special sub devices such as mmcblk0boot0 etc
+# we're currently only interested in the root device so pick them wisely
+devices=`ls /sys/block/ | grep -v mmcblk` || true
+mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true
+devices="$devices $mmc_devices"
+
+for device in $devices; do
case $device in
loop*)
# skip loop device
@@ -78,17 +97,23 @@ for hdname in $hdnamelist; do
cat /sys/block/$hdname/device/uevent
fi
echo
- # Get user choice
- while true; do
- echo -n "Do you want to install this image there? [y/n] "
- read answer
- if [ "$answer" = "y" -o "$answer" = "n" ]; then
+done
+
+# Get user choice
+while true; do
+ echo "Please select an install target or press n to exit ($hdnamelist ): "
+ read answer
+ if [ "$answer" = "n" ]; then
+ echo "Installation manually aborted."
+ exit 1
+ fi
+ for hdname in $hdnamelist; do
+ if [ "$answer" = "$hdname" ]; then
+ TARGET_DEVICE_NAME=$answer
break
fi
- echo "Please answer y or n"
done
- if [ "$answer" = "y" ]; then
- TARGET_DEVICE_NAME=$hdname
+ if [ -n "$TARGET_DEVICE_NAME" ]; then
break
fi
done
@@ -114,9 +139,13 @@ rm -f /etc/udev/scripts/mount*
umount ${device}* 2> /dev/null || /bin/true
mkdir -p /tmp
-cat /proc/mounts > /etc/mtab
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+# Create /etc/mtab if not present
+if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then
+ ln -sf /proc/mounts /etc/mtab
+fi
+
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
swap_size=$((disk_size*swap_ratio/100))
rootfs_size=$((disk_size-boot_size-swap_size))
@@ -130,10 +159,17 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
+
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+ rootwait="rootwait"
+fi
+
bootfs=${device}${part_prefix}1
rootfs=${device}${part_prefix}2
swap=${device}${part_prefix}3
@@ -154,18 +190,25 @@ parted ${device} mkpart boot fat32 0% $boot_size
parted ${device} set 1 boot on
echo "Creating rootfs partition on $rootfs"
-parted ${device} mkpart root ext3 $rootfs_start $rootfs_end
+parted ${device} mkpart root ext4 $rootfs_start $rootfs_end
echo "Creating swap partition on $swap"
parted ${device} mkpart swap linux-swap $swap_start 100%
parted ${device} print
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs -o ! -e $rootfs -o ! -e $swap ]; do
+ C=$(( C + 1 ))
+ sleep 1
+done
+
echo "Formatting $bootfs to vfat..."
mkfs.vfat $bootfs
-echo "Formatting $rootfs to ext3..."
-mkfs.ext3 $rootfs
+echo "Formatting $rootfs to ext4..."
+mkfs.ext4 $rootfs
echo "Formatting swap partition...($swap)"
mkswap $swap
@@ -180,8 +223,8 @@ mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
echo "Copying rootfs files..."
cp -a /src_root/* /tgt_root
if [ -d /tgt_root/etc/ ] ; then
- boot_uuid=$(blkid -o value -s UUID ${device}1)
- swap_part_uuid=$(blkid -o value -s PARTUUID ${device}3)
+ boot_uuid=$(blkid -o value -s UUID ${bootfs})
+ swap_part_uuid=$(blkid -o value -s PARTUUID ${swap})
echo "/dev/disk/by-partuuid/$swap_part_uuid swap swap defaults 0 0" >> /tgt_root/etc/fstab
echo "UUID=$boot_uuid /boot vfat defaults 1 2" >> /tgt_root/etc/fstab
# We dont want udev to mount our root device while we're booting...
@@ -202,7 +245,7 @@ mkdir -p $EFIDIR
cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
- root_part_uuid=$(blkid -o value -s PARTUUID ${device}2)
+ root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
GRUBCFG="$EFIDIR/grub.cfg"
cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
# Update grub config for the installed image
@@ -212,37 +255,48 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
sed -i "/initrd /d" $GRUBCFG
# Delete any LABEL= strings
sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
- # Delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GRUBCFG
- # Add the root= and other standard boot options
- sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG
+ # Replace root= and add additional standard boot options
+ # We use root as a sentinel value, as vmlinuz is no longer guaranteed
+ sed -i "s/ root=[^ ]*/ root=PARTUUID=$root_part_uuid rw $rootwait quiet /g" $GRUBCFG
fi
if [ -d /run/media/$1/loader ]; then
- GUMMIBOOT_CFGS="/boot/loader/entries/*.conf"
- # copy config files for gummiboot
+ rootuuid=$(blkid -o value -s PARTUUID ${rootfs})
+ SYSTEMDBOOT_CFGS="/boot/loader/entries/*.conf"
+ # copy config files for systemd-boot
cp -dr /run/media/$1/loader /boot
# delete the install entry
rm -f /boot/loader/entries/install.conf
# delete the initrd lines
- sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ sed -i "/initrd /d" $SYSTEMDBOOT_CFGS
# delete any LABEL= strings
- sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ LABEL=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# delete any root= strings
- sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ sed -i "s/ root=[^ ]*/ /" $SYSTEMDBOOT_CFGS
# add the root= and other standard boot options
- sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $GUMMIBOOT_CFGS
+ sed -i "s@options *@options root=PARTUUID=$rootuuid rw $rootwait quiet @" $SYSTEMDBOOT_CFGS
fi
umount /tgt_root
-cp /run/media/$1/vmlinuz /boot
+# copy any extra files needed for ESP
+if [ -d /run/media/$1/esp ]; then
+ cp -r /run/media/$1/esp/* /boot
+fi
+
+# Copy kernel artifacts. To add more artifacts just add to types
+# For now just support kernel types already being used by something in OE-core
+for types in bzImage zImage vmlinux vmlinuz fitImage; do
+ for kernel in `find /run/media/$1/ -name $types*`; do
+ cp $kernel /boot
+ done
+done
umount /boot
sync
-echo "Remove your installation media, and press ENTER"
+echo "Installation successful. Remove your installation media and press ENTER to reboot."
read enter
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index f9e9768e43..e71579631b 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -7,8 +7,19 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-# We need 20 Mb for the boot partition
-boot_size=20
+# figure out how big of a boot partition we need
+boot_size=$(du -ms /run/media/$1/ | awk '{print $1}')
+# remove rootfs.img ($2) from the size if it exists, as its not installed to /boot
+if [ -e /run/media/$1/$2 ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/$2 | awk '{print $1}') ))
+fi
+# remove initrd from size since its not currently installed
+if [ -e /run/media/$1/initrd ]; then
+ boot_size=$(( boot_size - $( du -ms /run/media/$1/initrd | awk '{print $1}') ))
+fi
+# add 10M to provide some extra space for users and account
+# for rounding in the above subtractions
+boot_size=$(( boot_size + 10 ))
# 5% for the swap
swap_ratio=5
@@ -21,6 +32,8 @@ live_dev_name=${live_dev_name#\/dev/}
case $live_dev_name in
mmcblk*)
;;
+ nvme*)
+ ;;
*)
live_dev_name=${live_dev_name%%[0-9]*}
;;
@@ -28,7 +41,13 @@ esac
echo "Searching for hard drives ..."
-for device in `ls /sys/block/`; do
+# Some eMMC devices have special sub devices such as mmcblk0boot0 etc
+# we're currently only interested in the root device so pick them wisely
+devices=`ls /sys/block/ | grep -v mmcblk` || true
+mmc_devices=`ls /sys/block/ | grep "mmcblk[0-9]\{1,\}$"` || true
+devices="$devices $mmc_devices"
+
+for device in $devices; do
case $device in
loop*)
# skip loop device
@@ -72,17 +91,23 @@ for hdname in $hdnamelist; do
cat /sys/block/$hdname/device/uevent
fi
echo
- # Get user choice
- while true; do
- echo -n "Do you want to install this image there? [y/n] "
- read answer
- if [ "$answer" = "y" -o "$answer" = "n" ]; then
+done
+
+# Get user choice
+while true; do
+ echo "Please select an install target or press n to exit ($hdnamelist ): "
+ read answer
+ if [ "$answer" = "n" ]; then
+ echo "Installation manually aborted."
+ exit 1
+ fi
+ for hdname in $hdnamelist; do
+ if [ "$answer" = "$hdname" ]; then
+ TARGET_DEVICE_NAME=$answer
break
fi
- echo "Please answer y or n"
done
- if [ "$answer" = "y" ]; then
- TARGET_DEVICE_NAME=$hdname
+ if [ -n "$TARGET_DEVICE_NAME" ]; then
break
fi
done
@@ -112,13 +137,13 @@ if [ ! -b /dev/loop0 ] ; then
fi
mkdir -p /tmp
-if [ ! -L /etc/mtab ]; then
- cat /proc/mounts > /etc/mtab
+if [ ! -L /etc/mtab ] && [ -e /proc/mounts ]; then
+ ln -sf /proc/mounts /etc/mtab
fi
-disk_size=$(parted ${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
+disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
-grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
+grub_version=$(grub-install -V|sed 's/.* \([0-9]\).*/\1/')
if [ $grub_version -eq 0 ] ; then
bios_boot_size=0
@@ -141,11 +166,17 @@ swap_start=$((rootfs_end))
# 2) they are detected asynchronously (need rootwait)
rootwait=""
part_prefix=""
-if [ ! "${device#mmcblk}" = "${device}" ]; then
+if [ ! "${device#/dev/mmcblk}" = "${device}" ] || \
+ [ ! "${device#/dev/nvme}" = "${device}" ]; then
part_prefix="p"
rootwait="rootwait"
fi
+# USB devices also require rootwait
+if [ -n `readlink /dev/disk/by-id/usb* | grep $TARGET_DEVICE_NAME` ]; then
+ rootwait="rootwait"
+fi
+
if [ $grub_version -eq 0 ] ; then
bios_boot=''
bootfs=${device}${part_prefix}1
@@ -183,7 +214,7 @@ fi
echo "Creating rootfs partition on $rootfs"
[ $grub_version -eq 0 ] && pname='primary' || pname='root'
-parted ${device} mkpart $pname ext3 $rootfs_start $rootfs_end
+parted ${device} mkpart $pname ext4 $rootfs_start $rootfs_end
echo "Creating swap partition on $swap"
[ $grub_version -eq 0 ] && pname='primary' || pname='swap'
@@ -191,11 +222,18 @@ parted ${device} mkpart $pname linux-swap $swap_start 100%
parted ${device} print
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs -o ! -e $rootfs -o ! -e $swap ]; do
+ C=$(( C + 1 ))
+ sleep 1
+done
+
echo "Formatting $bootfs to ext3..."
mkfs.ext3 $bootfs
-echo "Formatting $rootfs to ext3..."
-mkfs.ext3 $rootfs
+echo "Formatting $rootfs to ext4..."
+mkfs.ext4 $rootfs
echo "Formatting swap partition...($swap)"
mkswap $swap
@@ -211,13 +249,13 @@ echo "Copying rootfs files..."
cp -a /src_root/* /tgt_root
if [ -d /tgt_root/etc/ ] ; then
if [ $grub_version -ne 0 ] ; then
- boot_uuid=$(blkid -o value -s UUID ${device}2)
- swap_part_uuid=$(blkid -o value -s PARTUUID ${device}4)
+ boot_uuid=$(blkid -o value -s UUID ${bootfs})
+ swap_part_uuid=$(blkid -o value -s PARTUUID ${swap})
bootdev="UUID=$boot_uuid"
swapdev=/dev/disk/by-partuuid/$swap_part_uuid
else
- bootdev=${device}2
- swapdev=${device}4
+ bootdev=${bootfs}
+ swapdev=${swap}
fi
echo "$swapdev swap swap defaults 0 0" >> /tgt_root/etc/fstab
echo "$bootdev /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab
@@ -229,19 +267,46 @@ fi
umount /tgt_root
umount /src_root
+echo "Looking for kernels to use as boot target.."
+# Find kernel to boot to
+# Give user options if multiple are found
+kernels="$(find /run/media/$1/ -type f \
+ -name bzImage* -o -name zImage* \
+ -o -name vmlinux* -o -name vmlinuz* \
+ -o -name fitImage* \
+ | sed s:.*/::)"
+if [ -n "$(echo $kernels)" ]; then
+ # only one kernel entry if no space
+ if [ -z "$(echo $kernels | grep " ")" ]; then
+ kernel=$kernels
+ echo "$kernel will be used as the boot target"
+ else
+ echo "Which kernel do we want to boot by default? The following kernels were found:"
+ echo $kernels
+ read answer
+ kernel=$answer
+ fi
+else
+ echo "No kernels found, exiting..."
+ exit 1
+fi
+
# Handling of the target boot partition
mount $bootfs /boot
echo "Preparing boot partition..."
+
if [ -f /etc/grub.d/00_header -a $grub_version -ne 0 ] ; then
echo "Preparing custom grub2 menu..."
- root_part_uuid=$(blkid -o value -s PARTUUID ${device}3)
- boot_uuid=$(blkid -o value -s UUID ${device}2)
+ root_part_uuid=$(blkid -o value -s PARTUUID ${rootfs})
+ boot_uuid=$(blkid -o value -s UUID ${bootfs})
GRUBCFG="/boot/grub/grub.cfg"
mkdir -p $(dirname $GRUBCFG)
cat >$GRUBCFG <<_EOF
+timeout=5
+default=0
menuentry "Linux" {
search --no-floppy --fs-uuid $boot_uuid --set root
- linux /vmlinuz root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet
+ linux /$kernel root=PARTUUID=$root_part_uuid $rootwait rw $5 $3 $4 quiet
}
_EOF
chmod 0444 $GRUBCFG
@@ -255,10 +320,16 @@ if [ $grub_version -eq 0 ] ; then
echo "timeout 30" >> /boot/grub/menu.lst
echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
echo "root (hd0,0)" >> /boot/grub/menu.lst
- echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
+ echo "kernel /$kernel root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
fi
-cp /run/media/$1/vmlinuz /boot/
+# Copy kernel artifacts. To add more artifacts just add to types
+# For now just support kernel types already being used by something in OE-core
+for types in bzImage zImage vmlinux vmlinuz fitImage; do
+ for kernel in `find /run/media/$1/ -name $types*`; do
+ cp $kernel /boot
+ done
+done
umount /boot
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index d852c5737f..b20660b60a 100644..100755
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -2,7 +2,7 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-ROOT_MOUNT="/rootfs/"
+ROOT_MOUNT="/rootfs"
ROOT_IMAGE="rootfs.img"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"
@@ -28,8 +28,7 @@ udev_daemon() {
_UDEV_DAEMON=`udev_daemon`
early_setup() {
- mkdir -p /proc
- mkdir -p /sys
+ mkdir -p /proc /sys /run /var/run
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs none /dev
@@ -37,9 +36,6 @@ early_setup() {
# support modular kernel
modprobe isofs 2> /dev/null
- mkdir -p /run
- mkdir -p /var/run
-
$_UDEV_DAEMON --daemon
udevadm trigger --action=add
}
@@ -80,7 +76,13 @@ read_args() {
boot_live_root() {
# Watches the udev event queue, and exits if all current events are handled
udevadm settle --timeout=3 --quiet
- killall "${_UDEV_DAEMON##*/}" 2>/dev/null
+ # Kills the current udev running processes, which survived after
+ # device node creation events were handled, to avoid unexpected behavior
+ killall -9 "${_UDEV_DAEMON##*/}" 2>/dev/null
+
+ # Don't run systemd-update-done on systemd-based live systems
+ # because it triggers a slow rebuild of ldconfig caches.
+ touch ${ROOT_MOUNT}/etc/.updated ${ROOT_MOUNT}/var/.updated
# Allow for identification of the real root even after boot
mkdir -p ${ROOT_MOUNT}/media/realroot
@@ -89,8 +91,11 @@ boot_live_root() {
# Move the mount points of some filesystems over to
# the corresponding directories under the real root filesystem.
for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
- mkdir -p ${ROOT_MOUNT}/media/${dir##*/}
- mount -n --move $dir ${ROOT_MOUNT}/media/${dir##*/}
+ # Parse any OCT or HEX encoded chars such as spaces
+ # in the mount points to actual ASCII chars
+ dir=`printf $dir`
+ mkdir -p "${ROOT_MOUNT}/media/${dir##*/}"
+ mount -n --move "$dir" "${ROOT_MOUNT}/media/${dir##*/}"
done
mount -n --move /proc ${ROOT_MOUNT}/proc
mount -n --move /sys ${ROOT_MOUNT}/sys
@@ -169,8 +174,8 @@ mount_and_boot() {
# determine which unification filesystem to use
union_fs_type=""
- if grep -q -w "overlayfs" /proc/filesystems; then
- union_fs_type="overlayfs"
+ if grep -q -w "overlay" /proc/filesystems; then
+ union_fs_type="overlay"
elif grep -q -w "aufs" /proc/filesystems; then
union_fs_type="aufs"
else
@@ -179,14 +184,15 @@ mount_and_boot() {
# make a union mount if possible
case $union_fs_type in
- "overlayfs")
+ "overlay")
mkdir -p /rootfs.ro /rootfs.rw
if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then
rm -rf /rootfs.ro /rootfs.rw
fatal "Could not move rootfs mount point"
else
mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
- mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
+ mkdir -p /rootfs.rw/upperdir /rootfs.rw/work
+ mount -t overlay overlay -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw/upperdir,workdir=/rootfs.rw/work" $ROOT_MOUNT
mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
@@ -214,11 +220,7 @@ mount_and_boot() {
boot_live_root
}
-case $label in
- boot)
- mount_and_boot
- ;;
- install|install-efi)
+if [ "$label" != "boot" -a -f $label.sh ] ; then
if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
else
@@ -226,10 +228,8 @@ case $label in
fi
# If we're getting here, we failed...
- fatal "Installation image failed"
- ;;
- *)
- # Not sure what boot label is provided. Try to boot to avoid locking up.
- mount_and_boot
- ;;
-esac
+ fatal "Target $label failed"
+fi
+
+mount_and_boot
+
diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
index 7ae7969f5e..ab460ac797 100644
--- a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
@@ -9,8 +9,13 @@ S = "${WORKDIR}"
do_install() {
install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init
+
+ # Create device nodes expected by some kernels in initramfs
+ # before even executing /init.
+ install -d ${D}/dev
+ mknod -m 622 ${D}/dev/console c 5 1
}
inherit allarch
-FILES_${PN} += " /init "
+FILES:${PN} += "/init /dev/console"
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/exec b/meta/recipes-core/initrdscripts/initramfs-framework/exec
new file mode 100644
index 0000000000..a8e2432bb6
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/exec
@@ -0,0 +1,29 @@
+#!/bin/sh
+# Copyright (C) 2017 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+EXEC_DIR=/exec.d # place to look for modules
+
+exec_enabled() {
+ return 0
+}
+
+exec_run() {
+ if [ ! -d $EXEC_DIR ]; then
+ msg "No contents to exec in $EXEC_DIR. Starting shell ..."
+ sh
+ fi
+
+ # Load and run modules
+ for m in $EXEC_DIR/*; do
+ # Skip backup files
+ if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then
+ continue
+ fi
+
+ debug "Starting $m"
+
+ # process module
+ ./$m
+ done
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
index 325f47be40..717383ebac 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/finish
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -8,26 +8,6 @@ finish_enabled() {
finish_run() {
if [ -n "$ROOTFS_DIR" ]; then
- if [ -n "$bootparam_rootdelay" ]; then
- debug "Sleeping for $rootdelay second(s) to wait root to settle..."
- sleep $bootparam_rootdelay
- fi
-
- if [ -n "$bootparam_root" ]; then
- debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
-
- if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
- root_uuid=`echo $bootparam_root | cut -c6-`
- bootparam_root="/dev/disk/by-uuid/$root_uuid"
- fi
-
- if [ -e "$bootparam_root" ]; then
- mount $bootparam_root $ROOTFS_DIR
- else
- debug "root '$bootparam_root' doesn't exist."
- fi
- fi
-
if [ ! -d $ROOTFS_DIR/dev ]; then
fatal "ERROR: There's no '/dev' on rootfs."
fi
@@ -40,7 +20,7 @@ finish_run() {
mount --move /sys $ROOTFS_DIR/sys
cd $ROOTFS_DIR
- exec switch_root -c /dev/console $ROOTFS_DIR /sbin/init
+ exec switch_root -c /dev/console $ROOTFS_DIR ${bootparam_init:-/sbin/init}
else
debug "No rootfs has been set"
fi
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init
index e8f4713b52..567694aff7 100755
--- a/meta/recipes-core/initrdscripts/initramfs-framework/init
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/init
@@ -58,9 +58,13 @@ fatal() {
echo $1 >/dev/console
echo >/dev/console
+ if [ -n "$bootparam_init_fatal_sh" ]; then
+ sh
+ else
while [ "true" ]; do
sleep 3600
done
+ fi
}
# Variables shared amoung modules
@@ -68,23 +72,41 @@ ROOTFS_DIR="/rootfs" # where to do the switch root
MODULE_PRE_HOOKS="" # functions to call before running each module
MODULE_POST_HOOKS="" # functions to call after running each module
MODULES_DIR=/init.d # place to look for modules
+EFI_DIR=/sys/firmware/efi # place to store device firmware information
# make mount stop complaining about missing /etc/fstab
touch /etc/fstab
-# initialize /proc, /sys and /var/lock
-mkdir -p /proc /sys /var/lock
+# initialize /proc, /sys, /run/lock and /var/lock
+mkdir -p /proc /sys /run/lock /var/lock
mount -t proc proc /proc
mount -t sysfs sysfs /sys
+if [ -d $EFI_DIR ];then
+ mount -t efivarfs none /sys/firmware/efi/efivars
+fi
+
# populate bootparam environment
for p in `cat /proc/cmdline`; do
+ if [ -n "$quoted" ]; then
+ value="$value $p"
+ if [ "`echo $p | sed -e 's/\"$//'`" != "$p" ]; then
+ eval "bootparam_${quoted}=${value}"
+ unset quoted
+ fi
+ continue
+ fi
+
opt=`echo $p | cut -d'=' -f1`
- opt=`echo $opt | tr '.-' '__'`
+ opt=`echo $opt | sed -e 'y/.-/__/'`
if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
eval "bootparam_${opt}=true"
else
value="`echo $p | cut -d'=' -f2-`"
+ if [ "`echo $value | sed -e 's/^\"//'`" != "$value" ]; then
+ quoted=${opt}
+ continue
+ fi
eval "bootparam_${opt}=\"${value}\""
fi
done
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/lvm b/meta/recipes-core/initrdscripts/initramfs-framework/lvm
new file mode 100644
index 0000000000..7deeccb9a2
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/lvm
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+lvm_enabled() {
+ if ! lvscan |grep -i -w "inactive" &>/dev/null;then
+ return 1
+ fi
+ return 0
+}
+
+lvm_run() {
+ lvm pvscan --cache --activate ay
+ udevadm trigger --action=add
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/mdev b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
index a5df1d717a..9814d9764a 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/mdev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Copyright (C) 2011, 2017 O.S. Systems Software LTDA.
# Licensed on MIT
mdev_enabled() {
@@ -25,6 +25,6 @@ mdev_run() {
# load modules for devices
find /sys -name modalias | while read m; do
- load_kernel_module $(cat $m)
+ load_kernel_module $(cat "$m")
done
}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
new file mode 100644
index 0000000000..e67ee4c25d
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+nfsrootfs_enabled() {
+ if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then
+ return 1
+ fi
+ return 0
+}
+
+nfsrootfs_run() {
+ local nfs_opts
+ local location
+ local flags
+ local server_ip
+
+ nfs_opts=""
+ if [ "${bootparam_nfsroot#*,}" != "${bootparam_nfsroot}" ]; then
+ nfs_opts="-o ${bootparam_nfsroot#*,}"
+ fi
+
+ location="${bootparam_nfsroot%%,*}"
+ if [ "${location#*:}" = "${location}" ]; then
+ # server-ip not given. Get server ip from ip option
+ server_ip=""
+ if [ "${bootparam_ip#*:}" != "${bootparam_ip}" ]; then
+ server_ip=$(echo "$bootparam_ip" | cut -d: -f2)
+ fi
+
+ if [ -z "$server_ip" ]; then
+ fatal "Server IP is not set. Update ip or nfsroot options."
+ fi
+ location=${server_ip}:${location}
+ fi
+
+ flags="-o nolock"
+ if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
+ if [ -n "$bootparam_rootflags" ]; then
+ bootparam_rootflags="$bootparam_rootflags,"
+ fi
+ bootparam_rootflags="${bootparam_rootflags}ro"
+ fi
+ if [ -n "$bootparam_rootflags" ]; then
+ flags="$flags -o $bootparam_rootflags"
+ fi
+
+ mount -t nfs ${flags} ${nfs_opts} ${location} ${ROOTFS_DIR}
+}
+
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/rootfs b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
new file mode 100644
index 0000000000..e0efbe6ebe
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/rootfs
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+rootfs_enabled() {
+ return 0
+}
+
+rootfs_run() {
+ if [ -z "$ROOTFS_DIR" ]; then
+ return
+ fi
+ C=0
+ delay=${bootparam_rootdelay:-1}
+ timeout=${bootparam_roottimeout:-5}
+ while ! mountpoint -q $ROOTFS_DIR; do
+ if [ $(( $C * $delay )) -gt $timeout ]; then
+ fatal "root '$bootparam_root' doesn't exist or does not contain a /dev."
+ fi
+
+ if [ -n "$bootparam_root" ]; then
+ debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
+
+ if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
+ root_uuid=`echo $bootparam_root | cut -c6-`
+ bootparam_root="/dev/disk/by-uuid/$root_uuid"
+ elif [ "`echo ${bootparam_root} | cut -c1-9`" = "PARTUUID=" ]; then
+ root_partuuid=`echo $bootparam_root | cut -c10-`
+ bootparam_root="/dev/disk/by-partuuid/$root_partuuid"
+ elif [ "`echo ${bootparam_root} | cut -c1-10`" = "PARTLABEL=" ]; then
+ root_partlabel=`echo $bootparam_root | cut -c11-`
+ bootparam_root="/dev/disk/by-partlabel/$root_partlabel"
+ elif [ "`echo ${bootparam_root} | cut -c1-6`" = "LABEL=" ]; then
+ root_label=`echo $bootparam_root | cut -c7-`
+ bootparam_root="/dev/disk/by-label/$root_label"
+ fi
+
+ if [ -e "$bootparam_root" ]; then
+ flags=""
+ if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
+ if [ -n "$bootparam_rootflags" ]; then
+ bootparam_rootflags="$bootparam_rootflags,"
+ fi
+ bootparam_rootflags="${bootparam_rootflags}ro"
+ fi
+ if [ -n "$bootparam_rootflags" ]; then
+ flags="$flags -o$bootparam_rootflags"
+ fi
+ if [ -n "$bootparam_rootfstype" ]; then
+ flags="$flags -t$bootparam_rootfstype"
+ fi
+ mount $flags $bootparam_root $ROOTFS_DIR
+ if mountpoint -q $ROOTFS_DIR; then
+ break
+ else
+ # It is unlikely to change, but keep trying anyway.
+ # Perhaps we pick a different device next time.
+ umount $ROOTFS_DIR
+ fi
+ fi
+ fi
+ debug "Sleeping for $delay second(s) to wait root to settle..."
+ sleep $delay
+ C=$(( $C + 1 ))
+ done
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/setup-live b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
new file mode 100644
index 0000000000..7e92f93322
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/setup-live
@@ -0,0 +1,64 @@
+#!/bin/sh
+# Copyright (C) 2011 O.S. Systems Software LTDA.
+# Licensed on MIT
+
+setup_enabled() {
+ return 0
+}
+
+setup_run() {
+ROOT_IMAGE="rootfs.img"
+ISOLINUX=""
+ROOT_DISK=""
+shelltimeout=30
+
+ if [ -z "$bootparam_root" -o "$bootparam_root" = "/dev/ram0" ]; then
+ echo "Waiting for removable media..."
+ C=0
+ while true
+ do
+ for i in `ls /run/media 2>/dev/null`; do
+ if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
+ found="yes"
+ ROOT_DISK="$i"
+ break
+ elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
+ found="yes"
+ ISOLINUX="isolinux"
+ ROOT_DISK="$i"
+ break
+ fi
+ done
+ if [ "$found" = "yes" ]; then
+ break;
+ fi
+ # don't wait for more than $shelltimeout seconds, if it's set
+ if [ -n "$shelltimeout" ]; then
+ echo -n " " $(( $shelltimeout - $C ))
+ if [ $C -ge $shelltimeout ]; then
+ echo "..."
+ echo "Mounted filesystems"
+ mount | grep media
+ echo "Available block devices"
+ cat /proc/partitions
+ fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell "
+ fi
+ C=$(( C + 1 ))
+ fi
+ sleep 1
+ done
+ # The existing rootfs module has no support for rootfs images. Assign the rootfs image.
+ bootparam_root="/run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE"
+ fi
+
+ if [ "$bootparam_LABEL" != "boot" -a -f /init.d/$bootparam_LABEL.sh ] ; then
+ if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
+ ./init.d/$bootparam_LABEL.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
+ else
+ fatal "Could not find $bootparam_LABEL script"
+ fi
+
+ # If we're getting here, we failed...
+ fatal "Target $bootparam_LABEL failed"
+ fi
+}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
index bb462dc448..4898b89246 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework/udev
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -6,6 +6,7 @@ udev_shutdown_hook_handler() {
status=$1
module=$2
if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then
+ udevadm settle
killall `basename $_UDEV_DAEMON` 2>/dev/null
fi
}
@@ -38,6 +39,10 @@ udev_run() {
add_module_pre_hook "udev_shutdown_hook_handler"
mkdir -p /run
+ mkdir -p /var/run
+
+ # Workaround if console=null, systemd-udevd needs valid stdin, stdout and stderr to work
+ sh -c "exec 4< /dev/console" || { exec 0> /dev/null; exec 1> /dev/null; exec 2> /dev/null; }
$_UDEV_DAEMON --daemon
udevadm trigger --action=add
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
index 6c37b9aef6..9e8c1dc3ab 100644
--- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -1,18 +1,24 @@
SUMMARY = "Modular initramfs system"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-RDEPENDS_${PN} += "busybox"
+RDEPENDS:${PN} += "${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
-PR = "r2"
+PR = "r4"
inherit allarch
SRC_URI = "file://init \
+ file://exec \
+ file://nfsrootfs \
+ file://rootfs \
file://finish \
file://mdev \
file://udev \
file://e2fs \
- file://debug"
+ file://debug \
+ file://lvm \
+ "
S = "${WORKDIR}"
@@ -21,8 +27,13 @@ do_install() {
# base
install -m 0755 ${WORKDIR}/init ${D}/init
+ install -m 0755 ${WORKDIR}/nfsrootfs ${D}/init.d/85-nfsrootfs
+ install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs
install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
+ # exec
+ install -m 0755 ${WORKDIR}/exec ${D}/init.d/89-exec
+
# mdev
install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev
@@ -35,6 +46,9 @@ do_install() {
# debug
install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug
+ # lvm
+ install -m 0755 ${WORKDIR}/lvm ${D}/init.d/09-lvm
+
# Create device nodes expected by some kernels in initramfs
# before even executing /init.
install -d ${D}/dev
@@ -42,25 +56,54 @@ do_install() {
}
PACKAGES = "${PN}-base \
+ initramfs-module-exec \
initramfs-module-mdev \
initramfs-module-udev \
initramfs-module-e2fs \
- initramfs-module-debug"
-
-FILES_${PN}-base = "/init /init.d/99-finish /dev"
-
-SUMMARY_initramfs-module-mdev = "initramfs support for mdev"
-RDEPENDS_initramfs-module-mdev = "${PN}-base"
-FILES_initramfs-module-mdev = "/init.d/01-mdev"
-
-SUMMARY_initramfs-module-udev = "initramfs support for udev"
-RDEPENDS_initramfs-module-udev = "${PN}-base udev"
-FILES_initramfs-module-udev = "/init.d/01-udev"
-
-SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
-RDEPENDS_initramfs-module-e2fs = "${PN}-base"
-FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
-
-SUMMARY_initramfs-module-debug = "initramfs dynamic debug support"
-RDEPENDS_initramfs-module-debug = "${PN}-base"
-FILES_initramfs-module-debug = "/init.d/00-debug"
+ initramfs-module-nfsrootfs \
+ initramfs-module-rootfs \
+ initramfs-module-debug \
+ initramfs-module-lvm \
+ "
+
+FILES:${PN}-base = "/init /init.d/99-finish /dev"
+
+# 99-finish in base depends on some other module which mounts
+# the rootfs, like 90-rootfs. To replace that default, use
+# BAD_RECOMMENDATIONS += "initramfs-module-rootfs" in your
+# initramfs recipe and install something else, or install
+# something that runs earlier (for example, a 89-my-rootfs)
+# and mounts the rootfs. Then 90-rootfs will proceed immediately.
+RRECOMMENDS:${PN}-base += "initramfs-module-rootfs"
+
+SUMMARY:initramfs-module-exec = "initramfs support for easy execution of applications"
+RDEPENDS:initramfs-module-exec = "${PN}-base"
+FILES:initramfs-module-exec = "/init.d/89-exec"
+
+SUMMARY:initramfs-module-mdev = "initramfs support for mdev"
+RDEPENDS:initramfs-module-mdev = "${PN}-base busybox-mdev"
+FILES:initramfs-module-mdev = "/init.d/01-mdev"
+
+SUMMARY:initramfs-module-udev = "initramfs support for udev"
+RDEPENDS:initramfs-module-udev = "${PN}-base udev"
+FILES:initramfs-module-udev = "/init.d/01-udev"
+
+SUMMARY:initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
+RDEPENDS:initramfs-module-e2fs = "${PN}-base"
+FILES:initramfs-module-e2fs = "/init.d/10-e2fs"
+
+SUMMARY:initramfs-module-nfsrootfs = "initramfs support for locating and mounting the root partition via nfs"
+RDEPENDS:initramfs-module-nfsrootfs = "${PN}-base"
+FILES:initramfs-module-nfsrootfs = "/init.d/85-nfsrootfs"
+
+SUMMARY:initramfs-module-rootfs = "initramfs support for locating and mounting the root partition"
+RDEPENDS:initramfs-module-rootfs = "${PN}-base"
+FILES:initramfs-module-rootfs = "/init.d/90-rootfs"
+
+SUMMARY:initramfs-module-debug = "initramfs dynamic debug support"
+RDEPENDS:initramfs-module-debug = "${PN}-base"
+FILES:initramfs-module-debug = "/init.d/00-debug"
+
+SUMMARY:initramfs-module-lvm = "initramfs lvm rootfs support"
+RDEPENDS:initramfs-module-lvm = "${PN}-base"
+FILES:initramfs-module-lvm = "/init.d/09-lvm"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb
new file mode 100644
index 0000000000..59a530506a
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot-tiny_1.0.bb
@@ -0,0 +1,21 @@
+SUMMARY = "Live image init script"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+DEPENDS = "virtual/kernel"
+RDEPENDS:${PN} = "busybox-mdev"
+SRC_URI = "file://init-live.sh"
+
+PR = "r12"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
+ install -d ${D}/dev
+ mknod -m 622 ${D}/dev/console c 5 1
+}
+
+FILES:${PN} += " /init /dev "
+
+# Due to kernel dependency
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
index 57b30254a6..8f56d7ab90 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -2,7 +2,7 @@ SUMMARY = "Live image init script"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
DEPENDS = "virtual/kernel"
-RDEPENDS_${PN} = "udev udev-extraconf"
+RDEPENDS:${PN} = "udev udev-extraconf"
SRC_URI = "file://init-live.sh"
PR = "r12"
@@ -15,7 +15,7 @@ do_install() {
mknod -m 622 ${D}/dev/console c 5 1
}
-FILES_${PN} += " /init /dev "
+FILES:${PN} += " /init /dev "
# Due to kernel dependency
PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
index c03bd2d765..495eccbeda 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
@@ -3,7 +3,7 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://init-install-efi-testfs.sh"
-RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools"
+RDEPENDS:${PN} = "parted e2fsprogs-mke2fs dosfstools"
S = "${WORKDIR}"
@@ -12,5 +12,5 @@ do_install() {
}
INHIBIT_DEFAULT_DEPS = "1"
-FILES_${PN} = " /install-efi.sh "
+FILES:${PN} = " /install-efi.sh "
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
index 32c1fce76b..ecbd567d6c 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
@@ -5,7 +5,8 @@ SRC_URI = "file://init-install-efi.sh"
PR = "r1"
-RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid"
+RDEPENDS:${PN} = "parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
S = "${WORKDIR}"
@@ -19,6 +20,6 @@ do_install() {
#inherit allarch
INHIBIT_DEFAULT_DEPS = "1"
-FILES_${PN} = " /install-efi.sh "
+FILES:${PN} = " /install-efi.sh "
-COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
+COMPATIBLE_HOST = "(i.86.*|x86_64.*|aarch64.*)-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
index 937bfd4d38..d347e323b3 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
@@ -3,7 +3,7 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = "file://init-install-testfs.sh"
-RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
+RDEPENDS:${PN} = "grub parted e2fsprogs-mke2fs"
S = "${WORKDIR}"
@@ -12,5 +12,5 @@ do_install() {
}
INHIBIT_DEFAULT_DEPS = "1"
-FILES_${PN} = " /install.sh "
+FILES:${PN} = " /install.sh "
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
index 88b3b30197..674d49ecdf 100644
--- a/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -7,7 +7,8 @@ PR = "r9"
S = "${WORKDIR}"
-RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid"
+RDEPENDS:${PN} = "grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
do_install() {
install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh
@@ -19,6 +20,6 @@ do_install() {
#inherit allarch
INHIBIT_DEFAULT_DEPS = "1"
-FILES_${PN} = " /install.sh "
+FILES:${PN} = " /install.sh "
-COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
+COMPATIBLE_HOST = "(i.86.*|x86_64.*|aarch64.*)-linux"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
new file mode 100644
index 0000000000..fb19484555
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
@@ -0,0 +1,18 @@
+SUMMARY = "initramfs-framework module for EFI installation option"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS:${PN} = "initramfs-framework-base parted e2fsprogs-mke2fs dosfstools util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
+
+PR = "r4"
+
+SRC_URI = "file://init-install-efi.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/init.d/install-efi.sh
+}
+
+FILES:${PN} = "/init.d/install-efi.sh"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb
new file mode 100644
index 0000000000..4d48d54e9e
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb
@@ -0,0 +1,23 @@
+SUMMARY = "initramfs-framework module for installation option"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS:${PN} = "initramfs-framework-base grub parted e2fsprogs-mke2fs util-linux-blkid ${VIRTUAL-RUNTIME_base-utils}"
+RRECOMMENDS:${PN} = "${VIRTUAL-RUNTIME_base-utils-syslog}"
+
+# The same restriction as grub
+COMPATIBLE_HOST = '(x86_64.*|i.86.*|arm.*|aarch64.*)-(linux.*|freebsd.*)'
+COMPATIBLE_HOST:armv7a = 'null'
+COMPATIBLE_HOST:armv7ve = 'null'
+
+PR = "r1"
+
+SRC_URI = "file://init-install.sh"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/init-install.sh ${D}/init.d/install.sh
+}
+
+FILES:${PN} = "/init.d/install.sh"
diff --git a/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
new file mode 100644
index 0000000000..d8ce024b83
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb
@@ -0,0 +1,20 @@
+SUMMARY = "initramfs-framework module for live booting"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+RDEPENDS:${PN} = "initramfs-framework-base udev-extraconf"
+
+PR = "r4"
+
+inherit allarch
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/initramfs-framework:"
+SRC_URI = "file://setup-live"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -d ${D}/init.d
+ install -m 0755 ${WORKDIR}/setup-live ${D}/init.d/80-setup-live
+}
+
+FILES:${PN} = "/init.d/80-setup-live"
diff --git a/meta/recipes-core/initscripts/init-system-helpers_1.60.bb b/meta/recipes-core/initscripts/init-system-helpers_1.60.bb
new file mode 100644
index 0000000000..46952e4685
--- /dev/null
+++ b/meta/recipes-core/initscripts/init-system-helpers_1.60.bb
@@ -0,0 +1,41 @@
+SUMMARY = "helper tools for all init systems"
+DESCRIPTION = "This package contains helper tools that are necessary for switching between \
+the various init systems that Debian contains (e. g. sysvinit or \
+systemd). An example is deb-systemd-helper, a script that enables systemd unit \
+files without depending on a running systemd. \
+\
+It also includes the \"service\", \"invoke-rc.d\", and \"update-rc.d\" scripts which \
+provide an abstraction for enabling, disabling, starting, and stopping \
+services for all supported Debian init systems as specified by the policy. \
+\
+While this package is maintained by pkg-systemd-maintainers, it is NOT \
+specific to systemd at all. Maintainers of other init systems are welcome to \
+include their helpers in this package."
+HOMEPAGE = "https://salsa.debian.org/debian/init-system-helpers"
+SECTION = "base"
+LICENSE = "BSD-3-Clause & GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=ee2b1830fcfead84d07bc060ec43e072"
+
+SRCREV = "dbd9197569c0935029acd5c9b02b84c68fd937ee"
+SRC_URI = "git://salsa.debian.org/debian/init-system-helpers.git;protocol=https;branch=master"
+
+S = "${WORKDIR}/git"
+
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+do_install() {
+ install -d -m 0755 ${D}${sbindir}
+ install -m 0755 ${S}/script/invoke-rc.d ${D}${sbindir}
+ install -m 0755 ${S}/script/service ${D}${sbindir}
+}
+
+PACKAGES += "${PN}-invoke-rc.d ${PN}-service"
+
+FILES:${PN} = ""
+FILES:${PN}-invoke-rc.d = "${sbindir}/invoke-rc.d"
+FILES:${PN}-service = "${sbindir}/service"
+
+ALLOW_EMPTY:${PN} = "1"
+
+RRECOMMENDS:${PN} += "${PN}-invoke-rc.d ${PN}-service"
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh b/meta/recipes-core/initscripts/initscripts-1.0/alignment.sh
index b577b9a03a..b577b9a03a 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/alignment.sh
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
index df553bc079..591591f87f 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -8,7 +8,10 @@
# Short-Description: Misc and other.
### END INIT INFO
+TIMESTAMP_FILE=/etc/timestamp
+
. /etc/default/rcS
+[ -f /etc/default/timestamp ] && . /etc/default/timestamp
#
# Put a nologin file in /etc to prevent people from logging in before
# system startup is complete.
@@ -64,10 +67,10 @@ fi
# If the timestamp is more recent than the current time,
# use the timestamp instead.
test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
-if test -e /etc/timestamp
+if test -e "$TIMESTAMP_FILE"
then
SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
- read TIMESTAMP < /etc/timestamp
+ read TIMESTAMP < "$TIMESTAMP_FILE"
if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
# format the timestamp as date expects it (2m2d2H2M4Y.2S)
TS_YR=${TIMESTAMP%??????????}
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
index dfee2afaad..a63e71b780 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
@@ -69,12 +69,12 @@ fi
# before fsck, since fsck can be quite memory-hungry.
#
test "$VERBOSE" != no && echo "Activating swap"
-swapon -a 2> /dev/null
+[ -x /sbin/swapon ] && swapon -a
#
# Check the root filesystem.
#
-if test -f /fastboot || test $rootcheck = no
+if test -f /fastboot || test "$rootcheck" = "no"
then
test $rootcheck = yes && echo "Fast boot, no filesystem check"
else
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
index a97b0681e1..2b9eba64cf 100644..100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
@@ -8,8 +8,8 @@
### END INIT INFO
if [ -f /var/log/dmesg ]; then
- if [ -f /usr/sbin/logrotate ]; then
- logrotate -f /etc/logrotate-dmesg.conf
+ if LOGPATH=$(which logrotate); then
+ $LOGPATH -f /etc/logrotate-dmesg.conf
else
mv -f /var/log/dmesg /var/log/dmesg.old
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
index 94bae420c0..2839d57cbe 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -19,21 +19,27 @@
test "$VERBOSE" != no && echo "Mounting local filesystems..."
mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
-#
-# We might have mounted something over /dev, see if /dev/initctl is there.
-#
-if test ! -p /dev/initctl
-then
- rm -f /dev/initctl
- mknod -m 600 /dev/initctl p
+
+# We might have mounted something over /run; see if
+# /dev/initctl is present. Look for
+# /sbin/init.sysvinit to verify that sysvinit (and
+# not busybox or systemd) is installed as default init).
+INITCTL="/dev/initctl"
+if [ ! -p "$INITCTL" ] && [ "${INIT_SYSTEM}" = "sysvinit" ]; then
+ # Create new control channel
+ rm -f "$INITCTL"
+ mknod -m 600 "$INITCTL" p
+
+ # Reopen control channel.
+ PID="$(pidof -s /sbin/init || echo 1)"
+ [ -n "$PID" ] && kill -s USR1 "$PID"
fi
-kill -USR1 1
#
# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
#
-swapon -a 2> /dev/null
+[ -x /sbin/swapon ] && swapon -a
: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
index fe6c19605f..be9f5970fa 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
@@ -67,9 +67,12 @@ if test "$rpcbind" = yes
then
if test -x /usr/sbin/rpcbind
then
- echo -n "Starting rpcbind... "
- start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
- sleep 2
+ service rpcbind status > /dev/null
+ if [ $? != 0 ]; then
+ echo -n "Starting rpcbind..."
+ start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
+ sleep 2
+ fi
fi
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
index 904037eeaa..b56b72f833 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -9,10 +9,10 @@
### END INIT INFO
# Get ROOT_DIR
-DIRNAME=`dirname $0`
-ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
+DIRNAME="$(dirname "$0")"
+ROOT_DIR="$(echo "$DIRNAME" | sed -ne 's:/etc/.*::p')"
-[ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS
+[ -e "${ROOT_DIR}/etc/default/rcS" ] && . "${ROOT_DIR}/etc/default/rcS"
# When running populate-volatile.sh at rootfs time, disable cache.
[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no
# If rootfs is read-only, disable cache.
@@ -25,52 +25,62 @@ COREDEF="00_core"
[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
create_file() {
+ EXEC=""
+ if [ -z "$2" ]; then
+ EXEC="
+ touch \"$1\";
+ "
+ else
+ EXEC="
+ cp \"$2\" \"$1\";
+ "
+ fi
EXEC="
- touch \"$1\";
- chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
- chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
+ ${EXEC}
+ chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
+ chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
- [ -e "$1" ] && {
+ if [ -e "$1" ]; then
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
- } || {
+ else
if [ -z "$ROOT_DIR" ]; then
- eval $EXEC &
+ eval "$EXEC"
else
# Creating some files at rootfs time may fail and should fail,
# but these failures should not be logged to make sure the do_rootfs
# process doesn't fail. This does no harm, as this script will
# run on target to set up the correct files and directories.
- eval $EXEC > /dev/null 2>&1
+ eval "$EXEC" > /dev/null 2>&1
fi
- }
+ fi
}
mk_dir() {
EXEC="
mkdir -p \"$1\";
- chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
- chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
+ chown ${TUSER}:${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\";
+ chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" "
test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
- [ -e "$1" ] && {
+ if [ -e "$1" ]; then
[ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
- } || {
+ else
if [ -z "$ROOT_DIR" ]; then
- eval $EXEC
+ eval "$EXEC"
else
# For the same reason with create_file(), failures should
# not be logged.
- eval $EXEC > /dev/null 2>&1
+ eval "$EXEC" > /dev/null 2>&1
fi
- }
+ fi
}
link_file() {
EXEC="
if [ -L \"$2\" ]; then
- [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
+ [ \"\$(readlink \"$2\")\" != \"$1\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
elif [ -d \"$2\" ]; then
if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
cp -a $2/* $1 2>/dev/null;
@@ -86,11 +96,11 @@ link_file() {
test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
if [ -z "$ROOT_DIR" ]; then
- eval $EXEC &
+ eval "$EXEC"
else
# For the same reason with create_file(), failures should
# not be logged.
- eval $EXEC > /dev/null 2>&1
+ eval "$EXEC" > /dev/null 2>&1
fi
}
@@ -102,17 +112,16 @@ check_requirements() {
}
CFGFILE="$1"
- [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0
TMP_INTERMED="${TMPROOT}/tmp.$$"
TMP_DEFINED="${TMPROOT}/tmpdefined.$$"
TMP_COMBINED="${TMPROOT}/tmpcombined.$$"
- sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/passwd | sort | uniq > "${TMP_DEFINED}"
- cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 2 > "${TMP_INTERMED}"
+ sed 's@\(^:\)*:.*@\1@' "${ROOT_DIR}/etc/passwd" | sort | uniq > "${TMP_DEFINED}"
+ grep -v "^#" "${CFGFILE}" | cut -s -d " " -f 2 > "${TMP_INTERMED}"
cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
- NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`"
- NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`"
+ NR_DEFINED_USERS="$(wc -l < "${TMP_DEFINED}")"
+ NR_COMBINED_USERS="$(wc -l < "${TMP_COMBINED}")"
[ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && {
echo "Undefined users:"
@@ -122,12 +131,12 @@ check_requirements() {
}
- sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/group | sort | uniq > "${TMP_DEFINED}"
- cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 3 > "${TMP_INTERMED}"
+ sed 's@\(^:\)*:.*@\1@' "${ROOT_DIR}/etc/group" | sort | uniq > "${TMP_DEFINED}"
+ grep -v "^#" "${CFGFILE}" | cut -s -d " " -f 3 > "${TMP_INTERMED}"
cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
- NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`"
- NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`"
+ NR_DEFINED_GROUPS="$(wc -l < "${TMP_DEFINED}")"
+ NR_COMBINED_GROUPS="$(wc -l < "${TMP_COMBINED}")"
[ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && {
echo "Undefined groups:"
@@ -144,15 +153,18 @@ check_requirements() {
apply_cfgfile() {
CFGFILE="$1"
+ SKIP_REQUIREMENTS="$2"
- check_requirements "${CFGFILE}" || {
+ [ "${VERBOSE}" != "no" ] && echo "Applying ${CFGFILE}"
+
+ [ "${SKIP_REQUIREMENTS}" = "yes" ] || check_requirements "${CFGFILE}" || {
echo "Skipping ${CFGFILE}"
return 1
}
- cat ${CFGFILE} | grep -v "^#" | \
- while read LINE; do
- eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
+ sed 's/#.*//' "${CFGFILE}" | \
+ while read -r TTYPE TUSER TGROUP TMODE TNAME TLTARGET; do
+ test -z "${TLTARGET}" && continue
TNAME=${ROOT_DIR}${TNAME}
[ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
@@ -163,21 +175,33 @@ apply_cfgfile() {
continue
}
+ [ "${TTYPE}" = "b" ] && {
+ TSOURCE="$TLTARGET"
+ [ "${VERBOSE}" != "no" ] && echo "Creating mount-bind -${TNAME}- from -${TSOURCE}-."
+ mount --bind "${TSOURCE}" "${TNAME}"
+ EXEC="
+ mount --bind \"${TSOURCE}\" \"${TNAME}\""
+ test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
+ continue
+ }
+
[ -L "${TNAME}" ] && {
[ "${VERBOSE}" != "no" ] && echo "Found link."
- NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'`
- echo ${NEWNAME} | grep -v "^/" >/dev/null && {
- TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}"
+ NEWNAME=$(ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/')
+ if echo "${NEWNAME}" | grep -v "^/" >/dev/null; then
+ TNAME="$(echo "${TNAME}" | sed -e 's@\(.*\)/.*@\1@')/${NEWNAME}"
[ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-."
- } || {
+ else
TNAME="${NEWNAME}"
[ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-."
- }
+ fi
}
case "${TTYPE}" in
"f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
- create_file "${TNAME}" &
+ TSOURCE="$TLTARGET"
+ [ "${TSOURCE}" = "none" ] && TSOURCE=""
+ create_file "${TNAME}" "${TSOURCE}"
;;
"d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
mk_dir "${TNAME}"
@@ -193,7 +217,7 @@ apply_cfgfile() {
clearcache=0
exec 9</proc/cmdline
-while read line <&9
+while read -r line <&9
do
case "$line" in
*clearcache*) clearcache=1
@@ -204,16 +228,43 @@ do
done
exec 9>&-
-if test -e ${ROOT_DIR}/etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
+if test -e "${ROOT_DIR}/etc/volatile.cache" -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
then
- sh ${ROOT_DIR}/etc/volatile.cache
+ sh "${ROOT_DIR}/etc/volatile.cache"
else
- rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build
- for file in `ls -1 "${CFGDIR}" | sort`; do
- apply_cfgfile "${CFGDIR}/${file}"
+ rm -f "${ROOT_DIR}/etc/volatile.cache" "${ROOT_DIR}/etc/volatile.cache.build"
+
+ # Apply the core file with out checking requirements. ${TMPROOT} is
+ # needed by check_requirements but is setup by this file, so it must be
+ # processed first and without being checked.
+ [ -e "${CFGDIR}/${COREDEF}" ] && apply_cfgfile "${CFGDIR}/${COREDEF}" "yes"
+
+ # Fast path: check_requirements is slow and most of the time doesn't
+ # find any problems. If there are a lot of config files, it is much
+ # faster to to concatenate them all together and process them once to
+ # avoid the overhead of calling check_requirements repeatedly
+ TMP_FILE="${TMPROOT}/tmp_volatile.$$"
+ rm -f "$TMP_FILE"
+
+ CFGFILES="$(ls -1 "${CFGDIR}" | grep -v "^${COREDEF}\$" | sort)"
+ for file in ${CFGFILES}; do
+ cat "${CFGDIR}/${file}" >> "$TMP_FILE"
done
- [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache
+ if check_requirements "$TMP_FILE"
+ then
+ apply_cfgfile "$TMP_FILE" "yes"
+ else
+ # Slow path: One or more config files failed requirements.
+ # Process each one individually so the offending one can be
+ # skipped
+ for file in ${CFGFILES}; do
+ apply_cfgfile "${CFGDIR}/${file}"
+ done
+ fi
+ rm "$TMP_FILE"
+
+ [ -e "${ROOT_DIR}/etc/volatile.cache.build" ] && sync && mv "${ROOT_DIR}/etc/volatile.cache.build" "${ROOT_DIR}/etc/volatile.cache"
fi
if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ]
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
index 1a0328d63e..bd445ddb07 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -31,8 +31,13 @@ if [ "$1" = "start" ] ; then
if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
mkdir -p /var/volatile/lib
- cp -a /var/lib/* /var/volatile/lib
- mount --bind /var/volatile/lib /var/lib
+ mkdir -p /var/volatile/.lib-work
+ # Try to mount using overlay, which is much faster than copying
+ # files. If that fails, fallback to the slower copy
+ if ! mount -t overlay overlay -olowerdir=/var/lib,upperdir=/var/volatile/lib,workdir=/var/volatile/.lib-work /var/lib > /dev/null 2>&1; then
+ cp -a /var/lib/* /var/volatile/lib
+ mount --bind /var/volatile/lib /var/lib
+ fi
fi
fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
index b038fc59d4..ffa1eee43d 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
@@ -9,5 +9,9 @@
# Description:
### END INIT INFO
+TIMESTAMP_FILE=/etc/timestamp
+
+[ -f /etc/default/timestamp ] && . /etc/default/timestamp
+
# Update the timestamp
-date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
+date -u +%4Y%2m%2d%2H%2M%2S 2>/dev/null > "$TIMESTAMP_FILE"
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
index 0cfe76e230..4871ee94e5 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
@@ -21,3 +21,15 @@ fi
if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then
mount -t debugfs debugfs /sys/kernel/debug
fi
+
+if [ -e /sys/kernel/config ] && grep -q configfs /proc/filesystems; then
+ mount -t configfs configfs /sys/kernel/config
+fi
+
+if [ -e /sys/firmware/efi/efivars ] && grep -q efivarfs /proc/filesystems; then
+ mount -t efivarfs efivarfs /sys/firmware/efi/efivars
+fi
+
+if ! [ -e /dev/zero ] && [ -e /dev ] && grep -q devtmpfs /proc/filesystems; then
+ mount -n -t devtmpfs devtmpfs /dev
+fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountfs b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
index 61324c630b..7fb5c58b3e 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/umountfs
+++ b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
@@ -12,7 +12,7 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin
echo "Deactivating swap..."
-swapoff -a
+[ -x /sbin/swapoff ] && swapoff -a
# We leave /proc mounted.
echo "Unmounting local filesystems..."
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
index 297245d0e4..cd8a4be05f 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/volatiles
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -1,12 +1,14 @@
# This configuration file lists filesystem objects that should get verified
# during startup and be created if missing.
#
-# Every line must either be a comment starting with #
-# or a definition of format:
+# Entries have the following format:
# <type> <owner> <group> <mode> <path> <linksource>
# where the items are separated by whitespace !
#
-# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
+# The # character introduces a comment lasting until end of line.
+# Blank lines are ignored.
+#
+# <type> : d|f|l|b : (d)irectory|(f)ile|(l)ink|(b)ind
#
# A linking example:
# l root root 0777 /var/test /tmp/testfile
@@ -25,7 +27,6 @@ d root root 1777 /run/lock none
d root root 0755 /var/volatile/log none
d root root 1777 /var/volatile/tmp none
l root root 1777 /var/lock /run/lock
-l root root 0755 /var/log /var/volatile/log
l root root 0755 /var/run /run
l root root 1777 /var/tmp /var/volatile/tmp
l root root 1777 /tmp /var/tmp
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
index f90de6e4da..e4c4813220 100644
--- a/meta/recipes-core/initscripts/initscripts_1.0.bb
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -1,4 +1,5 @@
SUMMARY = "SysV init scripts"
+HOMEPAGE = "https://github.com/fedora-sysv/initscripts"
DESCRIPTION = "Initscripts provide the basic system startup initialization scripts for the system. These scripts include actions such as filesystem mounting, fsck, RTC manipulation and other actions routinely performed at system startup. In addition, the scripts are also used during system shutdown to reverse the actions performed at startup."
SECTION = "base"
LICENSE = "GPLv2"
@@ -38,23 +39,25 @@ SRC_URI = "file://functions \
S = "${WORKDIR}"
-SRC_URI_append_arm = " file://alignment.sh"
+SRC_URI:append:arm = " file://alignment.sh"
+SRC_URI:append:armeb = " file://alignment.sh"
KERNEL_VERSION = ""
-inherit update-alternatives
-DEPENDS_append = " update-rc.d-native"
-DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+DEPENDS:append = " update-rc.d-native"
+PACKAGE_WRITE_DEPS:append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
-PACKAGES =+ "${PN}-functions"
-RDEPENDS_${PN} = "${PN}-functions \
- ${@bb.utils.contains('DISTRO_FEATURES','selinux','bash','',d)} \
+PACKAGES =+ "${PN}-functions ${PN}-sushell"
+RDEPENDS:${PN} = "initd-functions \
+ ${@bb.utils.contains('DISTRO_FEATURES','selinux','${PN}-sushell','',d)} \
+ init-system-helpers-service \
"
-FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
-
-ALTERNATIVE_PRIORITY_${PN}-functions = "90"
-ALTERNATIVE_${PN}-functions = "functions"
-ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
+# Recommend pn-functions so that it will be a preferred default provider for initd-functions
+RRECOMMENDS:${PN} = "${PN}-functions"
+RPROVIDES:${PN}-functions = "initd-functions"
+RCONFLICTS:${PN}-functions = "lsbinitscripts"
+FILES:${PN}-functions = "${sysconfdir}/init.d/functions*"
+FILES:${PN}-sushell = "${base_sbindir}/sushell"
HALTARGS ?= "-d -f"
@@ -102,6 +105,10 @@ do_install () {
install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
+ if [ ${@ oe.types.boolean('${VOLATILE_LOG_DIR}') } = True ]; then
+ sed -i -e '\@^d root root 0755 /var/volatile/log none$@ a\l root root 0755 /var/log /var/volatile/log' \
+ ${D}${sysconfdir}/default/volatiles/00_core
+ fi
install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
@@ -123,22 +130,22 @@ do_install () {
#
update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
update-rc.d -r ${D} sendsigs start 20 0 6 .
- update-rc.d -r ${D} urandom start 30 S 0 6 .
+ update-rc.d -r ${D} urandom start 38 S 0 6 .
update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
update-rc.d -r ${D} umountfs start 40 0 6 .
update-rc.d -r ${D} reboot start 90 6 .
update-rc.d -r ${D} halt start 90 0 .
update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
update-rc.d -r ${D} banner.sh start 02 S .
- update-rc.d -r ${D} checkroot.sh start 06 S .
+ update-rc.d -r ${D} checkroot.sh start 05 S .
update-rc.d -r ${D} mountall.sh start 03 S .
update-rc.d -r ${D} hostname.sh start 39 S .
update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
- update-rc.d -r ${D} bootmisc.sh start 55 S .
+ update-rc.d -r ${D} bootmisc.sh start 36 S .
update-rc.d -r ${D} sysfs.sh start 02 S .
update-rc.d -r ${D} populate-volatile.sh start 37 S .
update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
- update-rc.d -r ${D} devpts.sh start 38 S .
+ update-rc.d -r ${D} devpts.sh start 06 S .
if [ "${TARGET_ARCH}" = "arm" ]; then
update-rc.d -r ${D} alignment.sh start 06 S .
fi
@@ -163,8 +170,8 @@ MASKED_SCRIPTS = " \
sysfs \
urandom"
-pkg_postinst_${PN} () {
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+pkg_postinst:${PN} () {
+ if type systemctl >/dev/null 2>/dev/null; then
if [ -n "$D" ]; then
OPTS="--root=$D"
fi
@@ -179,4 +186,4 @@ pkg_postinst_${PN} () {
fi
}
-CONFFILES_${PN} += "${sysconfdir}/init.d/checkroot.sh"
+CONFFILES:${PN} += "${sysconfdir}/init.d/checkroot.sh"
diff --git a/meta/recipes-core/jpeg/jpeg_9a.bb b/meta/recipes-core/jpeg/jpeg_9a.bb
deleted file mode 100644
index ea2e65d61a..0000000000
--- a/meta/recipes-core/jpeg/jpeg_9a.bb
+++ /dev/null
@@ -1,29 +0,0 @@
-SUMMARY = "libjpeg is a library for handling the JPEG (JFIF) image format"
-DESCRIPTION = "libjpeg contains a library for handling the JPEG (JFIF) image format, as well as related programs for accessing the libjpeg functions."
-HOMEPAGE = "http://www.ijg.org/"
-
-LICENSE ="BSD-3-Clause"
-LIC_FILES_CHKSUM = "file://README;md5=ea93a8a2fed10106b63bc21679edacb9"
-
-SECTION = "libs"
-
-SRC_URI = "http://www.ijg.org/files/jpegsrc.v${PV}.tar.gz \
- "
-
-SRC_URI[md5sum] = "3353992aecaee1805ef4109aadd433e7"
-SRC_URI[sha256sum] = "3a753ea48d917945dd54a2d97de388aa06ca2eb1066cbfdc6652036349fe05a7"
-
-inherit autotools
-
-PACKAGES =+ "jpeg-tools "
-DESCRIPTION_jpeg-tools = "The jpeg-tools package includes the client programs for access libjpeg functionality. These tools allow for the compression, decompression, transformation and display of JPEG files."
-FILES_jpeg-tools = "${bindir}/*"
-
-BBCLASSEXTEND = "native"
-
-pkg_postinst_${PN}_linuxstdbase () {
- if [ ! -e $D${libdir}/libjpeg.so.62 ]; then
- JPEG=`find $D${libdir} -type f -name libjpeg.so.\*.\*.\*`
- ln -sf `basename $JPEG` $D${libdir}/libjpeg.so.62
- fi
-}
diff --git a/meta/recipes-core/kbd/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch b/meta/recipes-core/kbd/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch
deleted file mode 100644
index 8bfcb0c7af..0000000000
--- a/meta/recipes-core/kbd/kbd/0003-Only-inluclude-kernel-headers-with-glibc.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 3c5c7acc7ef874b919b26583d3892e21b907833f Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Wed, 20 Aug 2014 09:00:03 +0200
-Subject: [PATCH 3/4] Only inluclude kernel headers with glibc
-
-This fixes compile errors with musl libc
-
-Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
-Upstream-Status: Pending
----
- src/resizecons.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/resizecons.c b/src/resizecons.c
-index 5f84845..691dfcc 100644
---- a/src/resizecons.c
-+++ b/src/resizecons.c
-@@ -80,7 +80,7 @@
- #include <sys/ioctl.h>
- #if (__GNU_LIBRARY__ >= 6)
- #include <sys/perm.h>
--#else
-+#elif defined(__GLIBC__)
- #include <linux/types.h>
- #include <linux/termios.h>
- #endif
---
-2.1.0
-
diff --git a/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch b/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch
deleted file mode 100644
index be7f324acc..0000000000
--- a/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-In file included from keymap.h:5:0,
- from ksyms.c:6:
-./keymap/common.h:65:38: error: unknown type name 'va_list'
- const char *format, va_list args),
- ^
-./keymap/common.h:66:3: error: expected ';', ',' or ')' before 'const'
- const void *data);
- ^
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Index: kbd-2.0.0/src/libkeymap/contextP.h
-===================================================================
---- kbd-2.0.0.orig/src/libkeymap/contextP.h 2013-08-13 06:46:23.000000000 -0700
-+++ kbd-2.0.0/src/libkeymap/contextP.h 2013-11-05 22:33:49.200528226 -0800
-@@ -2,7 +2,7 @@
- #define LK_CONTEXTP_H
-
- #include "keymap.h"
--
-+#include <stdarg.h>
- /**
- * @brief Copy of struct kbdiacruc.
- */
-Index: kbd-2.0.0/src/libkeymap/keymap/common.h
-===================================================================
---- kbd-2.0.0.orig/src/libkeymap/keymap/common.h 2013-08-13 06:46:23.000000000 -0700
-+++ kbd-2.0.0/src/libkeymap/keymap/common.h 2013-11-05 22:33:59.964528438 -0800
-@@ -6,6 +6,7 @@
- */
-
- #include <keymap/context.h>
-+#include <stdarg.h>
-
- /** Initializes the structures necessary to read and/or parse keymap.
- *
diff --git a/meta/recipes-core/kbd/kbd_2.0.2.bb b/meta/recipes-core/kbd/kbd_2.0.2.bb
deleted file mode 100644
index 136dc7ac0e..0000000000
--- a/meta/recipes-core/kbd/kbd_2.0.2.bb
+++ /dev/null
@@ -1,36 +0,0 @@
-SUMMARY = "Keytable files and keyboard utilities"
-# everything minus console-fonts is GPLv2+
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=a5fcc36121d93e1f69d96a313078c8b5"
-DEPENDS = "libcheck"
-
-inherit autotools gettext ptest pkgconfig
-
-RREPLACES_${PN} = "console-tools"
-RPROVIDES_${PN} = "console-tools"
-RCONFLICTS_${PN} = "console-tools"
-
-SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
- file://uclibc-stdarg.patch \
- file://0003-Only-inluclude-kernel-headers-with-glibc.patch \
- "
-
-SRC_URI[md5sum] = "87475eb78b1d6e6ab06686dd323ad4ba"
-SRC_URI[sha256sum] = "9dfddabf96012e329c4bebb96a21aeef7c3872f624e96e8156ba542b82aeb912"
-
-PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
-PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
-
-PACKAGES += "${PN}-consolefonts ${PN}-keymaps ${PN}-unimaps ${PN}-consoletrans"
-
-FILES_${PN}-consolefonts = "${datadir}/consolefonts"
-FILES_${PN}-consoletrans = "${datadir}/consoletrans"
-FILES_${PN}-keymaps = "${datadir}/keymaps"
-FILES_${PN}-unimaps = "${datadir}/unimaps"
-
-inherit update-alternatives
-
-ALTERNATIVE_${PN} = "chvt deallocvt fgconsole openvt"
-ALTERNATIVE_PRIORITY = "100"
-
-BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/kbd/kbd_2.4.0.bb b/meta/recipes-core/kbd/kbd_2.4.0.bb
new file mode 100644
index 0000000000..7cb45eff77
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd_2.4.0.bb
@@ -0,0 +1,46 @@
+SUMMARY = "Keytable files and keyboard utilities"
+HOMEPAGE = "http://www.kbd-project.org/"
+DESCRIPTION = "The kbd project contains tools for managing Linux console (Linux console, virtual terminals, keyboard, etc.) – mainly, what they do is loading console fonts and keyboard maps."
+# everything minus console-fonts is GPLv2+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a"
+
+inherit autotools gettext pkgconfig
+
+DEPENDS += "flex-native"
+
+RREPLACES:${PN} = "console-tools"
+RPROVIDES:${PN} = "console-tools"
+RCONFLICTS:${PN} = "console-tools"
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
+ "
+
+SRC_URI[sha256sum] = "55f0740458cfd3a84e775e50d7e8b92dc01846db1edad8e2411ccc293ece9b9f"
+
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
+ "
+
+PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
+
+PACKAGES += "${PN}-consolefonts ${PN}-keymaps ${PN}-unimaps ${PN}-consoletrans"
+
+FILES:${PN}-consolefonts = "${datadir}/consolefonts"
+FILES:${PN}-consoletrans = "${datadir}/consoletrans"
+FILES:${PN}-keymaps = "${datadir}/keymaps"
+FILES:${PN}-unimaps = "${datadir}/unimaps"
+
+do_install:append () {
+ if [ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'yes', '', d)} = yes ] \
+ && [ -f ${D}${sysconfdir}/pam.d/vlock ]; then
+ mv -f ${D}${sysconfdir}/pam.d/vlock ${D}${sysconfdir}/pam.d/vlock.kbd
+ fi
+}
+
+inherit update-alternatives
+
+ALTERNATIVE:${PN} = "chvt deallocvt fgconsole openvt showkey \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'vlock','', d)}"
+ALTERNATIVE_PRIORITY = "100"
+
+BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/libcgroup/libcgroup/module.patch b/meta/recipes-core/libcgroup/libcgroup/module.patch
new file mode 100644
index 0000000000..d8ff9b1479
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup/module.patch
@@ -0,0 +1,36 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 76f0879056ce7e3f0123c277f2303954d0b6cead Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= <kloczek@github.com>
+Date: Wed, 12 May 2021 20:36:02 +0000
+Subject: [PATCH 2/2] automake: build PAM module as unversioned DSO
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+PAM modules should be build as unversioned DSO.
+Add -avoid-version to pam_cgroup_la_LDFLAGS
+
+Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
+Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
+---
+ src/pam/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/pam/Makefile.am b/src/pam/Makefile.am
+index bd5a91d..4b0b2a9 100644
+--- a/src/pam/Makefile.am
++++ b/src/pam/Makefile.am
+@@ -4,7 +4,7 @@ if WITH_PAM
+
+ pamlib_LTLIBRARIES = pam_cgroup.la
+ pam_cgroup_la_SOURCES = pam_cgroup.c
+-pam_cgroup_la_LDFLAGS = -module
++pam_cgroup_la_LDFLAGS = -module -avoid-version
+ pam_cgroup_la_LIBADD = $(top_builddir)/src/libcgroup.la -lpam
+
+ endif
+--
+2.32.0
+
diff --git a/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
new file mode 100644
index 0000000000..531a562967
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup/musl-decls-compat.patch
@@ -0,0 +1,284 @@
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+From 26f2889113789c176273bd24fcd1592a8064c346 Mon Sep 17 00:00:00 2001
+From: "Anthony G. Basile" <blueness@gentoo.org>
+Date: Tue, 6 Jul 2021 07:54:47 -0600
+Subject: [PATCH 1/2] Replace __BEGIN_DECLS and __END_DECLS with extern "C".
+
+The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
+glibc and uClibc, but not musl. We replace them by the more general
+extern "C" { ... } block exposed only if we have __cplusplus.
+
+Forward ported from a patch by Anthony G. Basile <blueness@gentoo.org>.
+
+Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
+Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
+---
+ include/libcgroup/config.h | 8 ++++++--
+ include/libcgroup/error.h | 8 ++++++--
+ include/libcgroup/groups.h | 8 ++++++--
+ include/libcgroup/init.h | 8 ++++++--
+ include/libcgroup/iterators.h | 8 ++++++--
+ include/libcgroup/log.h | 8 ++++++--
+ include/libcgroup/tasks.h | 8 ++++++--
+ src/bindings/libcgroup.p | 8 --------
+ src/daemon/cgrulesengd.h | 8 ++++++--
+ src/libcgroup-internal.h | 8 ++++++--
+ src/tools/tools-common.h | 8 ++++++--
+ 11 files changed, 60 insertions(+), 28 deletions(-)
+
+diff --git a/include/libcgroup/config.h b/include/libcgroup/config.h
+index 9aaa390..f835009 100644
+--- a/include/libcgroup/config.h
++++ b/include/libcgroup/config.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_config 5. Configuration
+@@ -128,6 +130,8 @@ int cgroup_config_create_template_group(
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /*_LIBCGROUP_CONFIG_H*/
+diff --git a/include/libcgroup/error.h b/include/libcgroup/error.h
+index 1dfdde9..14a6e16 100644
+--- a/include/libcgroup/error.h
++++ b/include/libcgroup/error.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_errors 6. Error handling
+@@ -99,6 +101,8 @@ int cgroup_get_last_errno(void);
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_INIT_H */
+diff --git a/include/libcgroup/groups.h b/include/libcgroup/groups.h
+index 201558f..39ec3cd 100644
+--- a/include/libcgroup/groups.h
++++ b/include/libcgroup/groups.h
+@@ -11,7 +11,9 @@
+ #include <stdbool.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * Flags for cgroup_delete_cgroup_ext().
+@@ -587,6 +589,8 @@ char *cgroup_get_cgroup_name(struct cgroup *cgroup);
+ */
+
+
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_GROUPS_H */
+diff --git a/include/libcgroup/init.h b/include/libcgroup/init.h
+index 5150f2f..ea2dcc9 100644
+--- a/include/libcgroup/init.h
++++ b/include/libcgroup/init.h
+@@ -9,7 +9,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_init 1. Initialization
+@@ -58,6 +60,8 @@ int cgroup_get_subsys_mount_point(const char *controller, char **mount_point);
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_INIT_H */
+diff --git a/include/libcgroup/iterators.h b/include/libcgroup/iterators.h
+index c6d453d..b3ba3af 100644
+--- a/include/libcgroup/iterators.h
++++ b/include/libcgroup/iterators.h
+@@ -11,7 +11,9 @@
+ #include <features.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_iterators 3. Iterators
+@@ -423,6 +425,8 @@ int cgroup_get_subsys_mount_point_end(void **handle);
+ * @}
+ */
+
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_ITERATORS_H */
+diff --git a/include/libcgroup/log.h b/include/libcgroup/log.h
+index 0dd03b4..f693473 100644
+--- a/include/libcgroup/log.h
++++ b/include/libcgroup/log.h
+@@ -11,7 +11,9 @@
+
+ #include <stdarg.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /**
+ * @defgroup group_log 7. Logging
+@@ -142,6 +144,8 @@ extern int cgroup_parse_log_level_str(const char *levelstr);
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_LOG_H */
+diff --git a/include/libcgroup/tasks.h b/include/libcgroup/tasks.h
+index aad438a..8553c30 100644
+--- a/include/libcgroup/tasks.h
++++ b/include/libcgroup/tasks.h
+@@ -12,7 +12,9 @@
+ #include <stdbool.h>
+ #endif
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ /** Flags for cgroup_change_cgroup_uid_gid(). */
+ enum cgflags {
+@@ -204,6 +206,8 @@ int cgroup_register_unchanged_process(pid_t pid, int flags);
+ * @}
+ * @}
+ */
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _LIBCGROUP_TASKS_H */
+diff --git a/src/daemon/cgrulesengd.h b/src/daemon/cgrulesengd.h
+index e273b4b..0b12076 100644
+--- a/src/daemon/cgrulesengd.h
++++ b/src/daemon/cgrulesengd.h
+@@ -17,7 +17,9 @@
+
+ #include <features.h>
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ #include "config.h"
+ #include "libcgroup.h"
+@@ -119,7 +121,9 @@ void cgre_flash_templates(int signum);
+ */
+ void cgre_catch_term(int signum);
+
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* _CGRULESENGD_H */
+
+diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h
+index 1dfc92b..edc5abb 100644
+--- a/src/libcgroup-internal.h
++++ b/src/libcgroup-internal.h
+@@ -16,7 +16,9 @@
+
+ #define __LIBCG_INTERNAL
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ #include "config.h"
+ #include <dirent.h>
+@@ -407,6 +409,8 @@ int cgroupv2_controller_enabled(const char * const cg_name,
+
+ #endif /* UNIT_TEST */
+
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif
+diff --git a/src/tools/tools-common.h b/src/tools/tools-common.h
+index 292c408..e3541b1 100644
+--- a/src/tools/tools-common.h
++++ b/src/tools/tools-common.h
+@@ -18,7 +18,9 @@
+
+ #define __TOOLS_COMMON
+
+-__BEGIN_DECLS
++#ifdef __cplusplus
++extern "C" {
++#endif
+ #include "config.h"
+ #include <libcgroup.h>
+ #include "../libcgroup-internal.h"
+@@ -136,6 +138,8 @@ int parse_r_flag(const char * const program_name,
+
+ #endif /* UNIT_TEST */
+
+-__END_DECLS
++#ifdef __cplusplus
++} /* extern "C" */
++#endif
+
+ #endif /* TOOLS_COMMON */
+--
+2.32.0
+
diff --git a/meta/recipes-core/libcgroup/libcgroup_0.41.bb b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
deleted file mode 100644
index 52ba1d760f..0000000000
--- a/meta/recipes-core/libcgroup/libcgroup_0.41.bb
+++ /dev/null
@@ -1,38 +0,0 @@
-SUMMARY = "Linux control group abstraction library"
-DESCRIPTION = "libcgroup is a library that abstracts the control group file system \
-in Linux. Control groups allow you to limit, account and isolate resource usage \
-(CPU, memory, disk I/O, etc.) of groups of processes."
-SECTION = "libs"
-LICENSE = "LGPLv2.1"
-LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
-
-inherit autotools pkgconfig
-
-DEPENDS = "bison-native flex-native ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
-
-SRC_URI = "${SOURCEFORGE_MIRROR}/project/libcg/${BPN}/v0.41/${BPN}-${PV}.tar.bz2"
-
-SRC_URI[md5sum] = "3dea9d50b8a5b73ff0bf1cdcb210f63f"
-SRC_URI[sha256sum] = "e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51"
-
-EXTRA_OECONF = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes', '--enable-pam=no', d)}"
-
-PACKAGES =+ "cgroups-pam-plugin"
-FILES_cgroups-pam-plugin = "${base_libdir}/security/pam_cgroup.so*"
-FILES_${PN}-dbg += "${base_libdir}/security/.debug"
-FILES_${PN}-dev += "${base_libdir}/security/*.la"
-
-do_install_append() {
- # Moving libcgroup to base_libdir
- if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
- mkdir -p ${D}/${base_libdir}/
- mv -f ${D}${libdir}/libcgroup.so.* ${D}${base_libdir}/
- rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
- ln -sf ${rel_lib_prefix}${base_libdir}/libcgroup.so.1 ${D}${libdir}/libcgroup.so
- fi
- # pam modules in ${base_libdir}/security/ should be binary .so files, not symlinks.
- if [ -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ]; then
- mv -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ${D}${base_libdir}/security/pam_cgroup.so
- rm -f ${D}${base_libdir}/security/pam_cgroup.so.*
- fi
-}
diff --git a/meta/recipes-core/libcgroup/libcgroup_2.0.bb b/meta/recipes-core/libcgroup/libcgroup_2.0.bb
new file mode 100644
index 0000000000..a58dd88ea5
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup_2.0.bb
@@ -0,0 +1,35 @@
+SUMMARY = "Linux control group abstraction library"
+HOMEPAGE = "http://libcg.sourceforge.net/"
+DESCRIPTION = "libcgroup is a library that abstracts the control group file system \
+in Linux. Control groups allow you to limit, account and isolate resource usage \
+(CPU, memory, disk I/O, etc.) of groups of processes."
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
+
+inherit autotools pkgconfig
+
+DEPENDS = "bison-native flex-native"
+
+SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.bz2 \
+ file://musl-decls-compat.patch \
+ file://module.patch"
+
+SRC_URI[sha256sum] = "11a2fbf0e42f46089f406b8b0dca7fef04aec2f21600b70e402c5db3661305d7"
+UPSTREAM_CHECK_URI = "https://github.com/libcgroup/libcgroup/releases/"
+
+DEPENDS:append:libc-musl = " fts "
+EXTRA_OEMAKE:append:libc-musl = " LIBS=-lfts"
+
+PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
+PACKAGECONFIG[pam] = "--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes,--enable-pam=no,libpam"
+
+PACKAGES =+ "cgroups-pam-plugin"
+FILES:cgroups-pam-plugin = "${base_libdir}/security/pam_cgroup.so*"
+FILES:${PN}-dev += "${base_libdir}/security/*.la"
+FILES:${PN}-staticdev += "${base_libdir}/security/pam_cgroup.a"
+
+do_install:append() {
+ # Until we ship the test suite, this library isn't useful
+ rm -f ${D}${libdir}/libcgroupfortesting.*
+}
diff --git a/meta/recipes-core/libxcrypt/files/fix_cflags_handling.patch b/meta/recipes-core/libxcrypt/files/fix_cflags_handling.patch
new file mode 100644
index 0000000000..0772998c72
--- /dev/null
+++ b/meta/recipes-core/libxcrypt/files/fix_cflags_handling.patch
@@ -0,0 +1,33 @@
+From fd9a46695594c3cd836ecb7d959f03f605e69a2f Mon Sep 17 00:00:00 2001
+From: Richard Purdie <richard.purdie@linuxfoundation.org>
+Date: Fri, 30 Apr 2021 10:35:02 +0100
+Subject: [PATCH] libxcrypt: Update to 4.4.19 release and fix symbol version
+
+If you pass CFLAGS with a leading space, " " gets passed to popen and convinces
+gcc to try and open a file called " ". This results in a confusing error message
+like:
+
+x86_64-pokysdk-linux-gcc: error: : No such file or directory
+
+Avoid this by stripping empty elements out of CFLAGS.
+
+Upstream-Status: Submitted [https://github.com/besser82/libxcrypt/pull/126]
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+
+---
+ build-aux/compute-symver-floor | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/build-aux/compute-symver-floor b/build-aux/compute-symver-floor
+index 4ec82e1..8117342 100644
+--- a/build-aux/compute-symver-floor
++++ b/build-aux/compute-symver-floor
+@@ -36,6 +36,8 @@ sub preprocessor_check {
+ die "C compiler not available\n" unless @CC;
+
+ @CFLAGS = sh_split($ENV{CFLAGS} // q{});
++ # Remove empty elements, particularly leading ones which cause issues with popen below
++ @CFLAGS = grep {$_} @CFLAGS;
+
+ # Remove empty elements, particularly leading ones which
+ # cause issues with popen below.
diff --git a/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.26.bb b/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.26.bb
new file mode 100644
index 0000000000..ec9f9f4fa3
--- /dev/null
+++ b/meta/recipes-core/libxcrypt/libxcrypt-compat_4.4.26.bb
@@ -0,0 +1,18 @@
+#
+# This provides libcrypto.so.1 which contains obsolete APIs, needed for uninative in particular
+#
+
+require libxcrypt.inc
+
+PROVIDES = ""
+AUTO_LIBNAME_PKGS = ""
+EXCLUDE_FROM_WORLD = "1"
+
+API = "--enable-obsolete-api"
+
+do_install:append () {
+ rm -rf ${D}${includedir}
+ rm -rf ${D}${libdir}/pkgconfig
+ rm -rf ${D}${datadir}
+}
+
diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc
new file mode 100644
index 0000000000..ea877bbbb6
--- /dev/null
+++ b/meta/recipes-core/libxcrypt/libxcrypt.inc
@@ -0,0 +1,35 @@
+SUMMARY = "Extended cryptographic library (from glibc)"
+DESCRIPTION = "Forked code from glibc libary to extract only crypto part."
+HOMEPAGE = "https://github.com/besser82/libxcrypt"
+SECTION = "libs"
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://LICENSING;md5=29c5f9af198623cdce52a77f85695164 \
+ file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c \
+ "
+
+inherit autotools pkgconfig
+
+SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH}"
+SRCREV = "8ff7a8c5019cbd50419f7d0a8cd691eb99d6b086"
+SRCBRANCH ?= "develop"
+
+SRC_URI += "file://fix_cflags_handling.patch"
+
+PROVIDES = "virtual/crypt"
+
+FILES:${PN} = "${libdir}/libcrypt*.so.* \
+ ${libdir}/libcrypt-*.so \
+ ${libdir}/libowcrypt*.so.* \
+ ${libdir}/libowcrypt-*.so \
+"
+
+S = "${WORKDIR}/git"
+
+BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
+TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir} -Wno-error"
+CPPFLAGS:append:class-nativesdk = " -Wno-error"
+
+API = "--disable-obsolete-api"
+EXTRA_OECONF += "${API}"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/libxcrypt/libxcrypt_4.4.26.bb b/meta/recipes-core/libxcrypt/libxcrypt_4.4.26.bb
new file mode 100644
index 0000000000..79dba2f6dc
--- /dev/null
+++ b/meta/recipes-core/libxcrypt/libxcrypt_4.4.26.bb
@@ -0,0 +1,2 @@
+require libxcrypt.inc
+
diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc
deleted file mode 100644
index 1c3c37d509..0000000000
--- a/meta/recipes-core/libxml/libxml2.inc
+++ /dev/null
@@ -1,78 +0,0 @@
-SUMMARY = "XML C Parser Library and Toolkit"
-DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat."
-HOMEPAGE = "http://www.xmlsoft.org/"
-BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2"
-SECTION = "libs"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \
- file://hash.c;beginline=6;endline=15;md5=96f7296605eae807670fb08947829969 \
- file://list.c;beginline=4;endline=13;md5=cdbfa3dee51c099edb04e39f762ee907 \
- file://trio.c;beginline=5;endline=14;md5=6c025753c86d958722ec76e94cae932e"
-
-DEPENDS =+ "zlib"
-
-SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
- file://libxml-64bit.patch \
- file://ansidecl.patch \
- file://runtest.patch \
- file://run-ptest \
- file://libxml2-CVE-2014-0191-fix.patch \
- file://python-sitepackages-dir.patch \
- file://libxml-m4-use-pkgconfig.patch \
- file://configure.ac-fix-cross-compiling-warning.patch \
- file://0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch \
- "
-
-BINCONFIG = "${bindir}/xml2-config"
-
-inherit autotools pkgconfig binconfig-disabled pythonnative ptest
-
-RDEPENDS_${PN}-ptest += "python-core"
-
-RDEPENDS_${PN}-python += "python-core"
-
-RDEPENDS_${PN}-ptest_append_libc-glibc += "glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
-
-# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header
-do_configure_prepend () {
- sed -i -e '/.*ansidecl.h.*/d' ${S}/configure.ac
-}
-
-export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
-
-PACKAGECONFIG ??= "python"
-
-PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python"
-# WARNING: zlib is require for RPM use
-EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
-EXTRA_OECONF_class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
-EXTRA_OECONF_class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
-EXTRA_OECONF_linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
-
-# required for pythong binding
-export HOST_SYS
-export BUILD_SYS
-export STAGING_LIBDIR
-export STAGING_INCDIR
-
-export LDFLAGS += "-ldl"
-
-python populate_packages_prepend () {
- # autonamer would call this libxml2-2, but we don't want that
- if d.getVar('DEBIAN_NAMES', True):
- d.setVar('PKG_libxml2', '${MLPREFIX}libxml2')
-}
-
-PACKAGES += "${PN}-utils ${PN}-python"
-
-FILES_${PN}-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug"
-FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
-FILES_${PN}-dev += "${libdir}/xml2Conf.sh ${libdir}/cmake/*"
-FILES_${PN}-utils += "${bindir}/*"
-FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}"
-
-do_install_ptest () {
- cp -r ${WORKDIR}/xmlconf ${D}${PTEST_PATH}
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch b/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
deleted file mode 100644
index 96d58f9dd6..0000000000
--- a/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From 213f1fe0d76d30eaed6e5853057defc43e6df2c9 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <veillard@redhat.com>
-Date: Tue, 14 Apr 2015 17:41:48 +0800
-Subject: [PATCH] CVE-2015-1819 Enforce the reader to run in constant memory
-
-One of the operation on the reader could resolve entities
-leading to the classic expansion issue. Make sure the
-buffer used for xmlreader operation is bounded.
-Introduce a new allocation type for the buffers for this effect.
-
-Upstream-Status: Backport
-
-Signed-off-by: Yue Tao <Yue.Tao@windriver.com>
-Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
----
- buf.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
- include/libxml/tree.h | 3 ++-
- xmlreader.c | 20 +++++++++++++++++++-
- 3 files changed, 63 insertions(+), 3 deletions(-)
-
-diff --git a/buf.c b/buf.c
-index 6efc7b6..07922ff 100644
---- a/buf.c
-+++ b/buf.c
-@@ -27,6 +27,7 @@
- #include <libxml/tree.h>
- #include <libxml/globals.h>
- #include <libxml/tree.h>
-+#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
- #include "buf.h"
-
- #define WITH_BUFFER_COMPAT
-@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
- if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
- (scheme == XML_BUFFER_ALLOC_EXACT) ||
- (scheme == XML_BUFFER_ALLOC_HYBRID) ||
-- (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
-+ (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
-+ (scheme == XML_BUFFER_ALLOC_BOUNDED)) {
- buf->alloc = scheme;
- if (buf->buffer)
- buf->buffer->alloc = scheme;
-@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
- size = buf->use + len + 100;
- #endif
-
-+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+ /*
-+ * Used to provide parsing limits
-+ */
-+ if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
-+ (buf->size >= XML_MAX_TEXT_LENGTH)) {
-+ xmlBufMemoryError(buf, "buffer error: text too long\n");
-+ return(0);
-+ }
-+ if (size >= XML_MAX_TEXT_LENGTH)
-+ size = XML_MAX_TEXT_LENGTH;
-+ }
- if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
- size_t start_buf = buf->content - buf->contentIO;
-
-@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
- CHECK_COMPAT(buf)
-
- if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
-+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+ /*
-+ * Used to provide parsing limits
-+ */
-+ if (size >= XML_MAX_TEXT_LENGTH) {
-+ xmlBufMemoryError(buf, "buffer error: text too long\n");
-+ return(0);
-+ }
-+ }
-
- /* Don't resize if we don't have to */
- if (size < buf->size)
-@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
-
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
-+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+ /*
-+ * Used to provide parsing limits
-+ */
-+ if (needSize >= XML_MAX_TEXT_LENGTH) {
-+ xmlBufMemoryError(buf, "buffer error: text too long\n");
-+ return(-1);
-+ }
-+ }
- if (!xmlBufResize(buf, needSize)){
- xmlBufMemoryError(buf, "growing buffer");
- return XML_ERR_NO_MEMORY;
-@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
- }
- needSize = buf->use + len + 2;
- if (needSize > buf->size){
-+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+ /*
-+ * Used to provide parsing limits
-+ */
-+ if (needSize >= XML_MAX_TEXT_LENGTH) {
-+ xmlBufMemoryError(buf, "buffer error: text too long\n");
-+ return(-1);
-+ }
-+ }
- if (!xmlBufResize(buf, needSize)){
- xmlBufMemoryError(buf, "growing buffer");
- return XML_ERR_NO_MEMORY;
-diff --git a/include/libxml/tree.h b/include/libxml/tree.h
-index 2f90717..4a9b3bc 100644
---- a/include/libxml/tree.h
-+++ b/include/libxml/tree.h
-@@ -76,7 +76,8 @@ typedef enum {
- XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
- XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
- XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
-- XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
-+ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
-+ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
- } xmlBufferAllocationScheme;
-
- /**
-diff --git a/xmlreader.c b/xmlreader.c
-index f19e123..471e7e2 100644
---- a/xmlreader.c
-+++ b/xmlreader.c
-@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
- "xmlNewTextReader : malloc failed\n");
- return(NULL);
- }
-+ /* no operation on a reader should require a huge buffer */
-+ xmlBufSetAllocationScheme(ret->buffer,
-+ XML_BUFFER_ALLOC_BOUNDED);
- ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
- if (ret->sax == NULL) {
- xmlBufFree(ret->buffer);
-@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
- return(((xmlNsPtr) node)->href);
- case XML_ATTRIBUTE_NODE:{
- xmlAttrPtr attr = (xmlAttrPtr) node;
-+ const xmlChar *ret;
-
- if ((attr->children != NULL) &&
- (attr->children->type == XML_TEXT_NODE) &&
-@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
- "xmlTextReaderSetup : malloc failed\n");
- return (NULL);
- }
-+ xmlBufSetAllocationScheme(reader->buffer,
-+ XML_BUFFER_ALLOC_BOUNDED);
- } else
- xmlBufEmpty(reader->buffer);
- xmlBufGetNodeContent(reader->buffer, node);
-- return(xmlBufContent(reader->buffer));
-+ ret = xmlBufContent(reader->buffer);
-+ if (ret == NULL) {
-+ /* error on the buffer best to reallocate */
-+ xmlBufFree(reader->buffer);
-+ reader->buffer = xmlBufCreateSize(100);
-+ xmlBufSetAllocationScheme(reader->buffer,
-+ XML_BUFFER_ALLOC_BOUNDED);
-+ ret = BAD_CAST "";
-+ }
-+ return(ret);
- }
- break;
- }
-@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
- "xmlTextReaderSetup : malloc failed\n");
- return (-1);
- }
-+ /* no operation on a reader should require a huge buffer */
-+ xmlBufSetAllocationScheme(reader->buffer,
-+ XML_BUFFER_ALLOC_BOUNDED);
- if (reader->sax == NULL)
- reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
- if (reader->sax == NULL) {
---
-1.7.9.5
-
diff --git a/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch b/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
new file mode 100644
index 0000000000..6d9ede6194
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch
@@ -0,0 +1,86 @@
+From ea1993d1d9a18c5e61b9cb271892b0a48f508d32 Mon Sep 17 00:00:00 2001
+From: Peter Kjellerstedt <pkj@axis.com>
+Date: Fri, 9 Jun 2017 17:50:46 +0200
+Subject: [PATCH] Make ptest run the python tests if python is enabled
+
+One of the tests (tstLastError.py) needed a minor correction. It might
+be due to the fact that the tests are forced to run with Python 3.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ Makefile.am | 2 +-
+ python/Makefile.am | 9 +++++++++
+ python/tests/Makefile.am | 10 ++++++++++
+ 3 files changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index b428452b..dc18d6dd 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -203,9 +203,9 @@ install-ptest:
+ install $(check_PROGRAMS) $(DESTDIR))
+ cp -r $(srcdir)/test $(DESTDIR)
+ cp -r $(srcdir)/result $(DESTDIR)
+- cp -r $(srcdir)/python $(DESTDIR)
+ cp Makefile $(DESTDIR)
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
++ $(MAKE) -C python install-ptest
+
+ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
+ testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
+diff --git a/python/Makefile.am b/python/Makefile.am
+index 34aed96c..ba3ec6a4 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -48,7 +48,16 @@ GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
+
+ $(GENERATED): $(srcdir)/generator.py $(API_DESC)
+ $(PYTHON) $(srcdir)/generator.py $(srcdir)
++
++install-ptest:
++ cp -r $(srcdir) $(DESTDIR)
++ sed -e 's|^Makefile:|_Makefile:|' \
++ -e 's|^\(tests test:\) all|\1|' Makefile >$(DESTDIR)/python/Makefile
++ $(MAKE) -C tests install-ptest
++else
++install-ptest:
+ endif
+
++.PHONY: tests test
+ tests test: all
+ cd tests && $(MAKE) tests
+diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
+index 227e24df..3568c2d2 100644
+--- a/python/tests/Makefile.am
++++ b/python/tests/Makefile.am
+@@ -59,6 +59,11 @@ XMLS= \
+ CLEANFILES = core tmp.xml *.pyc
+
+ if WITH_PYTHON
++install-ptest:
++ cp -r $(srcdir) $(DESTDIR)/python
++ sed -e 's|^Makefile:|_Makefile:|' \
++ -e 's|^\(srcdir = \).*|\1.|' Makefile >$(DESTDIR)/python/tests/Makefile
++
+ tests: $(PYTESTS)
+ @for f in $(XMLS) ; do test -f $$f || $(LN_S) $(srcdir)/$$f . ; done
+ @echo "## running Python regression tests"
+@@ -70,9 +75,14 @@ tests: $(PYTESTS)
+ if [ "$$?" -ne 0 ] ; then \
+ echo "-- $$test" ; \
+ echo "$$log" ; \
++ echo "FAIL: $$test"; \
+ exit 1 ; \
++ else \
++ echo "PASS: $$test"; \
+ fi ; \
+ done)
+ else
++install-ptest:
++
+ tests:
+ endif
+--
+2.25.1
+
diff --git a/meta/recipes-core/libxml/libxml2/0001-threads-Define-pthread-definitions-for-glibc-complia.patch b/meta/recipes-core/libxml/libxml2/0001-threads-Define-pthread-definitions-for-glibc-complia.patch
deleted file mode 100644
index c653a81af3..0000000000
--- a/meta/recipes-core/libxml/libxml2/0001-threads-Define-pthread-definitions-for-glibc-complia.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 6750cc564a17c812555cca587660240ccffaaed3 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 4 Apr 2015 08:50:40 -0700
-Subject: [PATCH] threads: Define pthread* definitions for glibc compliant libs
-
-This code is assuming glibc but not explicitly saying it
-so lets make it so. Fixes following on musl
-
-threads.c:80:27: error: macro "pthread_equal" requires 2 arguments, but
-only 1 given
-| extern int pthread_equal ()
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- threads.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-Index: libxml2-2.9.2/threads.c
-===================================================================
---- libxml2-2.9.2.orig/threads.c
-+++ libxml2-2.9.2/threads.c
-@@ -47,7 +47,7 @@
- #ifdef HAVE_PTHREAD_H
-
- static int libxml_is_threaded = -1;
--#ifdef __GNUC__
-+#if defined(__GNUC__) && defined(__GLIBC__)
- #ifdef linux
- #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
- extern int pthread_once (pthread_once_t *__once_control,
diff --git a/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
deleted file mode 100644
index 10a8112b58..0000000000
--- a/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <veillard@redhat.com>
-Date: Thu, 23 Oct 2014 11:35:36 +0800
-Subject: Fix missing entities after CVE-2014-3660 fix
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=738805
-
-The fix for CVE-2014-3660 introduced a regression in some case
-where entity substitution is required and the entity is used
-first in anotther entity referenced from an attribute value
-
-Upstream-Status: Backport
-
-diff --git a/parser.c b/parser.c
-index 67c9dfd..a8d1b67 100644
---- a/parser.c
-+++ b/parser.c
-@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
- * far more secure as the parser will only process data coming from
- * the document entity by default.
- */
-- if ((ent->checked == 0) &&
-+ if (((ent->checked == 0) ||
-+ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
- ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
- (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
- unsigned long oldnbent = ctxt->nbentities;
---
-cgit v0.10.1
-
diff --git a/meta/recipes-core/libxml/libxml2/ansidecl.patch b/meta/recipes-core/libxml/libxml2/ansidecl.patch
deleted file mode 100644
index 2452d780d5..0000000000
--- a/meta/recipes-core/libxml/libxml2/ansidecl.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Sadly cmake is broken. If it sees this reference and ansidecl is present, it will add a
-dependency upon it, even if HAVE_ANSIDEC_H is never set.
-
-The easiest solution is to remove these lines, otherwise recipes like libzypp can have a
-dependency on the ansidecl.h header via cmake. This can lead to odd results if the
-header is removed (clean binutils) and then the code is recompiled.
-
-RP 2012/7/10
-
-Upstream-Status: Inappropriate [its really a cmake bug]
-
-Index: libxml2-2.8.0/include/libxml/xmlversion.h.in
-===================================================================
---- libxml2-2.8.0.orig/include/libxml/xmlversion.h.in 2012-07-10 11:51:52.460750573 +0000
-+++ libxml2-2.8.0/include/libxml/xmlversion.h.in 2012-07-10 11:52:41.436749397 +0000
-@@ -401,9 +401,6 @@
- #endif
-
- #ifdef __GNUC__
--#ifdef HAVE_ANSIDECL_H
--#include <ansidecl.h>
--#endif
-
- /**
- * ATTRIBUTE_UNUSED:
diff --git a/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch b/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch
deleted file mode 100644
index 2f8079b052..0000000000
--- a/meta/recipes-core/libxml/libxml2/configure.ac-fix-cross-compiling-warning.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-configure.ac: fix cross compiling warning
-
-There is a warning while cross compiling which triggered a
-failure by do_qa_configure
-...
-|configure:12652: checking for gzread in -lz
-|configure:12677: mips-poky-linux-gcc -meb -mabi=32 -mhard-float
- -L/lib conftest.c -lz >&5
-|ld: warning: library search path "/lib" is unsafe for cross-compilation
-...
-
-While do the lib checking, do not add '-L${Z_DIR}/lib' to LDFLAGS could fix it.
-
-Upstream-Status: Inappropriate [oe specific]
-Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
----
- configure.ac | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 9a90600..0bac8a4 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -391,8 +391,6 @@ if test "$with_zlib" = "no"; then
- echo "Disabling compression support"
- else
- AC_CHECK_HEADERS(zlib.h,
-- [SAVE_LDFLAGS="${LDFLAGS}"
-- LDFLAGS="-L${Z_DIR}/lib"
- AC_CHECK_LIB(z, gzread,[
- AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
- WITH_ZLIB=1
-@@ -406,8 +404,7 @@ else
- esac]
- else
- Z_LIBS="-lz"
-- fi])
-- LDFLAGS="${SAVE_LDFLAGS}"])
-+ fi]))
- fi
-
- AC_SUBST(Z_CFLAGS)
---
-1.9.1
-
diff --git a/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch b/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch
new file mode 100644
index 0000000000..ad719d4f5f
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/fix-execution-of-ptests.patch
@@ -0,0 +1,33 @@
+From 395c0f53ec226aaabedb166e6b3a7f8590b95a5f Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Sat, 11 May 2019 20:39:15 +0800
+Subject: [PATCH] Make sure that Makefile doesn't try to compile these tests
+ again on the target where the source dependencies won't be available.
+
+Upstream-Status: Inappropriate [cross-compile specific]
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+
+Rebase to 2.9.9
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ Makefile.am | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 8f4e43d..5edb930 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -211,8 +211,7 @@ install-ptest:
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
+ $(MAKE) -C python install-ptest
+
+-runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
+- testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
++runtests:
+ [ -d test ] || $(LN_S) $(srcdir)/test .
+ [ -d result ] || $(LN_S) $(srcdir)/result .
+ $(CHECKER) ./runtest$(EXEEXT) && \
+--
+2.7.4
+
diff --git a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch
index 1147017b61..fd8e469dd3 100644
--- a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch
+++ b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch
@@ -1,14 +1,19 @@
-Upstream-Status: Backport [from debian: bugs.debian.org/439843]
+From 056b14345b1abd76a761ab14538f1bc21302781a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Sat, 11 May 2019 20:26:51 +0800
+Subject: [PATCH] libxml 64bit
+Upstream-Status: Backport [from debian: bugs.debian.org/439843]
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
- libxml.h | 3 +++
+ libxml.h | 3 +++
1 file changed, 3 insertions(+)
---- libxml2-2.6.29.orig/libxml.h
-+++ libxml2-2.6.29/libxml.h
-@@ -11,10 +11,13 @@
-
- #ifndef NO_LARGEFILE_SOURCE
+diff --git a/libxml.h b/libxml.h
+index 64e30f7..4e80d90 100644
+--- a/libxml.h
++++ b/libxml.h
+@@ -15,6 +15,9 @@
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
@@ -18,5 +23,6 @@ Upstream-Status: Backport [from debian: bugs.debian.org/439843]
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
- #endif
-
+--
+2.7.4
+
diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
index 0fc84070ed..90fa193775 100644
--- a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
+++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
@@ -1,15 +1,31 @@
-AM_PATH_XML2 uses xml-config which we disable through
+From f57da62218cf72c1342da82abafdac6b0a2e4997 Mon Sep 17 00:00:00 2001
+From: Tony Tascioglu <tony.tascioglu@windriver.com>
+Date: Fri, 14 May 2021 11:50:35 -0400
+Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through
+
binconfig-disabled.bbclass, so port it to use pkg-config instead.
Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@intel.com>
+Rebase to 2.9.9
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
+Updated to apply cleanly to v2.9.12
+
+Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
+---
+ libxml.m4 | 190 ++----------------------------------------------------
+ 1 file changed, 5 insertions(+), 185 deletions(-)
+
diff --git a/libxml.m4 b/libxml.m4
-index 68cd824..5fa0a9b 100644
+index 09de9fe2..1c535853 100644
--- a/libxml.m4
+++ b/libxml.m4
-@@ -1,188 +1,12 @@
+@@ -1,192 +1,12 @@
-# Configure paths for LIBXML2
+-# Simon Josefsson 2020-02-12
+-# Fix autoconf 2.70+ warnings
-# Mike Hommey 2004-06-19
-# use CPPFLAGS instead of CFLAGS
-# Toshio Kuratomi 2001-04-21
@@ -69,7 +85,8 @@ index 68cd824..5fa0a9b 100644
-dnl (Also sanity checks the results of xml2-config to some extent)
-dnl
- rm -f conf.xmltest
-- AC_TRY_RUN([
+- AC_RUN_IFELSE(
+- [AC_LANG_SOURCE([[
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
@@ -139,12 +156,12 @@ index 68cd824..5fa0a9b 100644
- printf("*** being found. The easiest way to fix this is to remove the old version\n");
- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
-- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+- printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n");
- printf("*** so that the correct libraries are found at run-time))\n");
- }
- return 1;
-}
--],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+-]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$ac_save_LIBS"
- fi
@@ -169,10 +186,11 @@ index 68cd824..5fa0a9b 100644
- echo "*** Could not run libxml test program, checking why..."
- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
- LIBS="$LIBS $XML_LIBS"
-- AC_TRY_LINK([
+- AC_LINK_IFELSE(
+- [AC_LANG_PROGRAM([[
-#include <libxml/xmlversion.h>
-#include <stdio.h>
--], [ LIBXML_TEST_VERSION; return 0;],
+-]], [[ LIBXML_TEST_VERSION; return 0;]])],
- [ echo "*** The test program compiled, but did not run. This usually means"
- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
@@ -183,14 +201,14 @@ index 68cd824..5fa0a9b 100644
- echo "*** If you have an old version installed, it is best to remove it, although"
- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
- [ echo "*** The test program failed to compile or link. See the file config.log for the"
-- echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
+- echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$ac_save_LIBS"
- fi
- fi
-+ verdep=ifelse([$1], [], [], [>= $1])
++ verdep=ifelse([$1], [], [], [">= $1"])
+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
- XML_CPPFLAGS=""
@@ -202,3 +220,6 @@ index 68cd824..5fa0a9b 100644
- AC_SUBST(XML_LIBS)
- rm -f conf.xmltest
])
+--
+2.7.4
+
diff --git a/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch
deleted file mode 100644
index 1c05ae649e..0000000000
--- a/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From: Daniel Veillard <veillard@redhat.com>
-Date: Tue, 22 Apr 2014 15:30:56 +0800
-Subject: Do not fetch external parameter entities
-
-Unless explicitely asked for when validating or replacing entities
-with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
-
-Upstream-Status: Backport
-Reference: https://access.redhat.com/security/cve/CVE-2014-0191
-
-Signed-off-by: Daniel Veillard <veillard@redhat.com>
-Signed-off-by: Maxin B. John <maxin.john@enea.com>
----
-diff -Naur libxml2-2.9.1-orig/parser.c libxml2-2.9.1/parser.c
---- libxml2-2.9.1-orig/parser.c 2013-04-16 15:39:18.000000000 +0200
-+++ libxml2-2.9.1/parser.c 2014-05-07 13:35:46.883687946 +0200
-@@ -2595,6 +2595,20 @@
- xmlCharEncoding enc;
-
- /*
-+ * Note: external parsed entities will not be loaded, it is
-+ * not required for a non-validating parser, unless the
-+ * option of validating, or substituting entities were
-+ * given. Doing so is far more secure as the parser will
-+ * only process data coming from the document entity by
-+ * default.
-+ */
-+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
-+ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
-+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
-+ (ctxt->validate == 0))
-+ return;
-+
-+ /*
- * handle the extra spaces added before and after
- * c.f. http://www.w3.org/TR/REC-xml#as-PE
- * this is done independently.
diff --git a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
index e83c8325e5..956ff3f33e 100644
--- a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
+++ b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
@@ -1,4 +1,7 @@
-Allow us to pass in PYTHON_SITE_PACKAGES
+From b038c3452667ed17ddb0e791cd7bdc7f8774ac29 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Sat, 11 May 2019 20:35:20 +0800
+Subject: [PATCH] Allow us to pass in PYTHON_SITE_PACKAGES
The python binary used when building for nativesdk doesn't give us the
correct path here so we need to be able to specify it ourselves.
@@ -6,16 +9,18 @@ correct path here so we need to be able to specify it ourselves.
Upstream-Status: Inappropriate [config]
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-Rebase to 2.9.2
+Rebase to 2.9.9
+
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
+index ca911f3..3bbd654 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -813,7 +813,8 @@ dnl
+@@ -808,7 +808,8 @@ dnl
PYTHON_VERSION=
PYTHON_INCLUDES=
@@ -26,5 +31,5 @@ diff --git a/configure.ac b/configure.ac
pythondir=
if test "$with_python" != "no" ; then
--
-1.9.1
+2.7.4
diff --git a/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch b/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch
new file mode 100644
index 0000000000..e80c46054e
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/remove-fuzz-from-ptests.patch
@@ -0,0 +1,43 @@
+From e49a0d4a8f3f725d6f683854e1cad36a3cd02962 Mon Sep 17 00:00:00 2001
+From: Tony Tascioglu <tony.tascioglu@windriver.com>
+Date: Wed, 19 May 2021 19:43:56 -0400
+Subject: [PATCH] Remove fuzz testing from executing with ptests.
+
+Upstream version 2.9.12 introduced new fuzz-testing and a corresponding
+folder fuzz. These tests are not required for ptests of this package.
+
+This patch removes the fuzz testing targets from the Makefile.
+Otherwise, running the ptests will fail due to the invalid directory.
+
+Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
+---
+ Makefile.am | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index a9284b95..3d7b344d 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2,9 +2,9 @@
+
+ ACLOCAL_AMFLAGS = -I m4
+
+-SUBDIRS = include . doc example fuzz xstc $(PYTHON_SUBDIR)
++SUBDIRS = include . doc example xstc $(PYTHON_SUBDIR)
+
+-DIST_SUBDIRS = include . doc example fuzz python xstc
++DIST_SUBDIRS = include . doc example python xstc
+
+ AM_CPPFLAGS = -I$(top_builddir)/include -I$(srcdir)/include
+
+@@ -210,7 +210,6 @@ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
+ $(CHECKER) ./runxmlconf$(EXEEXT)
+ @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
+ $(MAKE) tests ; fi)
+- @cd fuzz; $(MAKE) tests
+
+ check: all runtests
+
+--
+2.25.1
+
diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest
index 473d0b67a7..c313d83263 100644
--- a/meta/recipes-core/libxml/libxml2/run-ptest
+++ b/meta/recipes-core/libxml/libxml2/run-ptest
@@ -1,3 +1,4 @@
#!/bin/sh
+export LC_ALL=en_US.UTF-8
make -k runtests
diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch
index 397ab20c30..c7a90cd3dc 100644
--- a/meta/recipes-core/libxml/libxml2/runtest.patch
+++ b/meta/recipes-core/libxml/libxml2/runtest.patch
@@ -1,37 +1,53 @@
-Add 'install-ptest' rule.
+From 6172ccd1e74bc181f5298f19e240234e12876abe Mon Sep 17 00:00:00 2001
+From: Tony Tascioglu <tony.tascioglu@windriver.com>
+Date: Tue, 11 May 2021 11:57:46 -0400
+Subject: [PATCH] Add 'install-ptest' rule.
+
Print a standard result line for each test.
Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Upstream-Status: Pending
-diff -uNr a/Makefile.am b/Makefile.am
---- a/Makefile.am 2013-04-17 14:51:42.633386477 +0200
-+++ b/Makefile.am 2013-04-19 14:47:51.544720568 +0200
-@@ -202,10 +202,19 @@
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
+---
+ Makefile.am | 9 +++
+ runsuite.c | 1 +
+ runtest.c | 2 +
+ runxmlconf.c | 1 +
+ testapi.c | 122 ++++++++++++++++++++++++++-------------
+ testchar.c | 156 +++++++++++++++++++++++++++++++++++---------------
+ testdict.c | 1 +
+ testlimits.c | 1 +
+ testrecurse.c | 2 +
+ 9 files changed, 210 insertions(+), 85 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 05d1671f..ae622745 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -198,6 +198,15 @@ runxmlconf_LDADD= $(LDADDS)
#testOOM_DEPENDENCIES = $(DEPS)
#testOOM_LDADD= $(LDADDS)
+install-ptest:
+ @(if [ -d .libs ] ; then cd .libs; fi; \
-+ install $(noinst_PROGRAMS) $(DESTDIR))
++ install $(check_PROGRAMS) $(DESTDIR))
+ cp -r $(srcdir)/test $(DESTDIR)
+ cp -r $(srcdir)/result $(DESTDIR)
+ cp -r $(srcdir)/python $(DESTDIR)
+ cp Makefile $(DESTDIR)
+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
+
- runtests:
+ runtests: runtest$(EXEEXT) testrecurse$(EXEEXT) testapi$(EXEEXT) \
+ testchar$(EXEEXT) testdict$(EXEEXT) runxmlconf$(EXEEXT)
[ -d test ] || $(LN_S) $(srcdir)/test .
- [ -d result ] || $(LN_S) $(srcdir)/result .
-- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
-+ ./runtest$(EXEEXT) ; ./testrecurse$(EXEEXT) ; ./testapi$(EXEEXT) ; ./testchar$(EXEEXT) ; ./testdict$(EXEEXT) ; ./runxmlconf$(EXEEXT)
- @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
- $(MAKE) tests ; fi)
-
-diff -uNr a/runsuite.c b/runsuite.c
---- a/runsuite.c 2013-04-12 16:17:11.462823238 +0200
-+++ b/runsuite.c 2013-04-17 14:07:24.352693211 +0200
-@@ -1162,6 +1162,7 @@
+diff --git a/runsuite.c b/runsuite.c
+index d24b5ec3..f7ff2521 100644
+--- a/runsuite.c
++++ b/runsuite.c
+@@ -1147,6 +1147,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
if (logfile != NULL)
fclose(logfile);
@@ -39,18 +55,19 @@ diff -uNr a/runsuite.c b/runsuite.c
return(ret);
}
#else /* !SCHEMAS */
-diff -uNr a/runtest.c b/runtest.c
---- a/runtest.c 2013-04-16 13:19:15.087997290 +0200
-+++ b/runtest.c 2013-04-17 14:08:29.529949655 +0200
-@@ -4386,6 +4386,7 @@
- err++;
- }
- }
+diff --git a/runtest.c b/runtest.c
+index ffa98d04..470f95cb 100644
+--- a/runtest.c
++++ b/runtest.c
+@@ -4508,6 +4508,7 @@ launchTests(testDescPtr tst) {
+ xmlCharEncCloseFunc(ebcdicHandler);
+ xmlCharEncCloseFunc(eucJpHandler);
+
+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
return(err);
}
-@@ -4455,6 +4456,7 @@
+@@ -4588,6 +4589,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
@@ -58,10 +75,11 @@ diff -uNr a/runtest.c b/runtest.c
return(ret);
}
-diff -uNr a/runxmlconf.c b/runxmlconf.c
---- a/runxmlconf.c 2013-04-16 12:53:49.900982990 +0200
-+++ b/runxmlconf.c 2013-04-17 14:09:21.111778104 +0200
-@@ -595,6 +595,7 @@
+diff --git a/runxmlconf.c b/runxmlconf.c
+index 70f61017..e882b3a1 100644
+--- a/runxmlconf.c
++++ b/runxmlconf.c
+@@ -595,6 +595,7 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
if (logfile != NULL)
fclose(logfile);
@@ -69,15 +87,15 @@ diff -uNr a/runxmlconf.c b/runxmlconf.c
return(ret);
}
-diff -uNr a/testapi.c b/testapi.c
---- a/testapi.c 2013-04-12 16:16:57.763417659 +0200
-+++ b/testapi.c 2013-04-17 14:10:28.876924881 +0200
-@@ -1245,49 +1245,91 @@
+diff --git a/testapi.c b/testapi.c
+index ff8b470d..52b51d78 100644
+--- a/testapi.c
++++ b/testapi.c
+@@ -1246,49 +1246,91 @@ static int
testlibxml2(void)
{
int test_ret = 0;
-+ int ret = 0;
-
+-
- test_ret += test_HTMLparser();
- test_ret += test_HTMLtree();
- test_ret += test_SAX2();
@@ -117,6 +135,8 @@ diff -uNr a/testapi.c b/testapi.c
- test_ret += test_xpath();
- test_ret += test_xpathInternals();
- test_ret += test_xpointer();
++ int ret = 0;
++
+ test_ret += (ret = test_HTMLparser());
+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL");
+ test_ret += (ret = test_HTMLtree());
@@ -203,10 +223,11 @@ diff -uNr a/testapi.c b/testapi.c
return(test_ret);
}
-diff -uNr a/testchar.c b/testchar.c
---- a/testchar.c 2013-04-17 10:50:30.250147418 +0200
-+++ b/testchar.c 2013-04-18 16:11:28.455733800 +0200
-@@ -23,7 +23,7 @@
+diff --git a/testchar.c b/testchar.c
+index 6866a175..7bce0132 100644
+--- a/testchar.c
++++ b/testchar.c
+@@ -23,7 +23,7 @@ static void errorHandler(void *unused, xmlErrorPtr err) {
char document1[100] = "<doc>XXXX</doc>";
char document2[100] = "<doc foo='XXXX'/>";
@@ -215,7 +236,7 @@ diff -uNr a/testchar.c b/testchar.c
int len, char *data, int forbid1, int forbid2) {
int i;
xmlDocPtr res;
-@@ -37,33 +37,41 @@
+@@ -37,33 +37,41 @@ static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
res = xmlReadMemory(document, len, "test", NULL, 0);
if ((i == forbid1) || (i == forbid2)) {
@@ -225,7 +246,7 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Byte 0x%02X: %c\n",
i, i);
+ return(1);
-+ }
++ }
}
else if ((i == '<') || (i == '&')) {
@@ -233,8 +254,8 @@ diff -uNr a/testchar.c b/testchar.c
+ if ((lastError == 0) || (res != NULL)) {
fprintf(stderr,
"Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
-+ return(1);
-+ }
++ return(1);
++ }
}
else if (((i < 0x20) || (i >= 0x80)) &&
(i != 0x9) && (i != 0xA) && (i != 0xD)) {
@@ -242,8 +263,8 @@ diff -uNr a/testchar.c b/testchar.c
+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
-+ return(1);
-+ }
++ return(1);
++ }
}
else if (res == NULL) {
fprintf(stderr,
@@ -253,7 +274,7 @@ diff -uNr a/testchar.c b/testchar.c
if (res != NULL)
xmlFreeDoc(res);
}
-+ return(0);
++ return(0);
}
-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
@@ -261,7 +282,7 @@ diff -uNr a/testchar.c b/testchar.c
int len, char *data) {
int i, j;
xmlDocPtr res;
-@@ -80,10 +88,12 @@
+@@ -80,10 +88,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
@@ -271,11 +292,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
-+ }
++ }
}
/*
-@@ -91,10 +101,12 @@
+@@ -91,10 +101,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
@@ -285,11 +306,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
-+ }
++ }
}
/*
-@@ -102,10 +114,12 @@
+@@ -102,10 +114,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
@@ -299,11 +320,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
+ return(1);
-+ }
++ }
}
/*
-@@ -113,10 +127,12 @@
+@@ -113,10 +127,12 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
@@ -313,25 +334,25 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
+ return(1);
-+ }
++ }
}
/*
-@@ -125,11 +141,13 @@
+@@ -125,11 +141,13 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
else if ((lastError != 0) || (res == NULL)) {
fprintf(stderr,
"Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
-+ return(1);
++ return(1);
}
if (res != NULL)
xmlFreeDoc(res);
}
}
-+ return(0);
++ return(0);
}
/**
-@@ -141,9 +159,10 @@
+@@ -141,9 +159,10 @@ static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
* CDATA in text or in attribute values.
*/
@@ -343,7 +364,7 @@ diff -uNr a/testchar.c b/testchar.c
/*
* Set up a parsing context using the first document as
-@@ -152,7 +171,7 @@
+@@ -152,7 +171,7 @@ static void testDocumentRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
@@ -352,7 +373,7 @@ diff -uNr a/testchar.c b/testchar.c
}
printf("testing 1 byte char in document: 1");
-@@ -163,7 +182,7 @@
+@@ -163,7 +182,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
@@ -361,7 +382,7 @@ diff -uNr a/testchar.c b/testchar.c
data, -1, -1);
printf(" 2");
fflush(stdout);
-@@ -172,7 +191,7 @@
+@@ -172,7 +191,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
@@ -370,7 +391,7 @@ diff -uNr a/testchar.c b/testchar.c
data + 3, -1, -1);
printf(" 3");
-@@ -183,7 +202,7 @@
+@@ -183,7 +202,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at beginning of area */
@@ -379,7 +400,7 @@ diff -uNr a/testchar.c b/testchar.c
data, '\'', -1);
printf(" 4");
fflush(stdout);
-@@ -192,7 +211,7 @@
+@@ -192,7 +211,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 1 byte injection at end of area */
@@ -388,7 +409,7 @@ diff -uNr a/testchar.c b/testchar.c
data + 3, '\'', -1);
printf(" done\n");
-@@ -204,7 +223,7 @@
+@@ -204,7 +223,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
@@ -397,7 +418,7 @@ diff -uNr a/testchar.c b/testchar.c
data);
printf(" 2");
fflush(stdout);
-@@ -213,7 +232,7 @@
+@@ -213,7 +232,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
@@ -406,7 +427,7 @@ diff -uNr a/testchar.c b/testchar.c
data + 2);
printf(" 3");
-@@ -224,7 +243,7 @@
+@@ -224,7 +243,7 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at beginning of area */
@@ -415,7 +436,7 @@ diff -uNr a/testchar.c b/testchar.c
data);
printf(" 4");
fflush(stdout);
-@@ -233,14 +252,15 @@
+@@ -233,14 +252,15 @@ static void testDocumentRanges(void) {
data[2] = ' ';
data[3] = ' ';
/* test 2 byte injection at end of area */
@@ -433,7 +454,7 @@ diff -uNr a/testchar.c b/testchar.c
int i = 0;
int len, c;
-@@ -255,19 +275,25 @@
+@@ -255,19 +275,25 @@ static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
c = xmlCurrentChar(ctxt, &len);
if ((i == 0) || (i >= 0x80)) {
/* we must see an error there */
@@ -441,20 +462,20 @@ diff -uNr a/testchar.c b/testchar.c
+ if (lastError != XML_ERR_INVALID_CHAR) {
fprintf(stderr,
"Failed to detect invalid char for Byte 0x%02X\n", i);
-+ return(1);
-+ }
++ return(1);
++ }
} else if (i == 0xD) {
- if ((c != 0xA) || (len != 1))
+ if ((c != 0xA) || (len != 1)) {
fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
+ return(1);
-+ }
++ }
} else if ((c != i) || (len != 1)) {
fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
-+ return(1);
++ return(1);
}
}
-+ return(0);
++ return(0);
}
-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
@@ -462,7 +483,7 @@ diff -uNr a/testchar.c b/testchar.c
int i, j;
int len, c;
-@@ -284,10 +310,12 @@
+@@ -284,10 +310,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
/* if first bit of first char is set, then second bit must too */
if ((i & 0x80) && ((i & 0x40) == 0)) {
@@ -471,12 +492,12 @@ diff -uNr a/testchar.c b/testchar.c
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
i, j);
-+ return(1);
-+ }
++ return(1);
++ }
}
/*
-@@ -295,10 +323,12 @@
+@@ -295,10 +323,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* bits must be 10
*/
else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
@@ -485,12 +506,12 @@ diff -uNr a/testchar.c b/testchar.c
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
-+ return(1);
-+ }
++ return(1);
++ }
}
/*
-@@ -306,10 +336,12 @@
+@@ -306,10 +336,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* than 0x80, i.e. one of bits 5 to 1 of i must be set
*/
else if ((i & 0x80) && ((i & 0x1E) == 0)) {
@@ -499,12 +520,12 @@ diff -uNr a/testchar.c b/testchar.c
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
i, j, c);
-+ return(1);
-+ }
++ return(1);
++ }
}
/*
-@@ -317,10 +349,12 @@
+@@ -317,10 +349,12 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
* at least 3 bytes, but we give only 2 !
*/
else if ((i & 0xE0) == 0xE0) {
@@ -513,12 +534,12 @@ diff -uNr a/testchar.c b/testchar.c
fprintf(stderr,
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
i, j);
-+ return(1);
-+ }
++ return(1);
++ }
}
/*
-@@ -329,6 +363,7 @@
+@@ -329,6 +363,7 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
else if ((lastError != 0) || (len != 2)) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
@@ -526,7 +547,7 @@ diff -uNr a/testchar.c b/testchar.c
}
/*
-@@ -338,12 +373,14 @@
+@@ -338,12 +373,14 @@ static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
@@ -534,7 +555,7 @@ diff -uNr a/testchar.c b/testchar.c
}
}
}
-+ return(0);
++ return(0);
}
-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
@@ -542,7 +563,7 @@ diff -uNr a/testchar.c b/testchar.c
int i, j, k, K;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
-@@ -368,20 +405,24 @@
+@@ -368,20 +405,24 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* at least 4 bytes, but we give only 3 !
*/
if ((i & 0xF0) == 0xF0) {
@@ -552,7 +573,7 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
-+ }
++ }
}
/*
@@ -565,11 +586,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
-+ }
++ }
}
/*
-@@ -390,10 +431,12 @@
+@@ -390,10 +431,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
* the 6th byte of data[1] must be set
*/
else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
@@ -579,11 +600,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
+ return(1);
-+ }
++ }
}
/*
-@@ -401,10 +444,12 @@
+@@ -401,10 +444,12 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000))) {
@@ -593,28 +614,28 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
value, i, j, K);
+ return(1);
-+ }
++ }
}
/*
-@@ -414,6 +459,7 @@
+@@ -414,6 +459,7 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
-+ return(1);
++ return(1);
}
/*
-@@ -423,13 +469,15 @@
+@@ -423,13 +469,15 @@ static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
-+ return(1);
++ return(1);
}
}
}
}
-+ return(0);
++ return(0);
}
-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
@@ -622,7 +643,7 @@ diff -uNr a/testchar.c b/testchar.c
int i, j, k, K, l, L;
int len, c;
unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
-@@ -458,10 +506,12 @@
+@@ -458,10 +506,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* at least 5 bytes, but we give only 4 !
*/
if ((i & 0xF8) == 0xF8) {
@@ -632,11 +653,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, data[3]);
+ return(1);
-+ }
++ }
}
/*
-@@ -469,10 +519,12 @@
+@@ -469,10 +519,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
*/
else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
((L & 0xC0) != 0x80)) {
@@ -646,11 +667,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
-+ }
++ }
}
/*
-@@ -481,10 +533,12 @@
+@@ -481,10 +533,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* the 6 or 5th byte of j must be set
*/
else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
@@ -660,11 +681,11 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
i, j, K, L);
+ return(1);
-+ }
++ }
}
/*
-@@ -493,10 +547,12 @@
+@@ -493,10 +547,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
else if (((value > 0xD7FF) && (value <0xE000)) ||
((value > 0xFFFD) && (value <0x10000)) ||
(value > 0x10FFFF)) {
@@ -674,33 +695,33 @@ diff -uNr a/testchar.c b/testchar.c
"Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
value, i, j, K, L);
+ return(1);
-+ }
++ }
}
/*
-@@ -506,6 +562,7 @@
+@@ -506,6 +562,7 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
i, j, K);
-+ return(1);
++ return(1);
}
/*
-@@ -515,11 +572,13 @@
+@@ -515,11 +572,13 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
fprintf(stderr,
"Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
i, j, data[2], value, c);
-+ return(1);
++ return(1);
}
}
}
}
}
-+ return(0);
++ return(0);
}
/**
-@@ -530,11 +589,12 @@
+@@ -530,11 +589,12 @@ static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
* cover the full range of UTF-8 chars accepted by XML-1.0
*/
@@ -714,7 +735,7 @@ diff -uNr a/testchar.c b/testchar.c
memset(data, 0, 5);
-@@ -545,17 +605,19 @@
+@@ -545,17 +605,19 @@ static void testCharRanges(void) {
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
fprintf(stderr, "Failed to allocate parser context\n");
@@ -725,17 +746,17 @@ diff -uNr a/testchar.c b/testchar.c
XML_CHAR_ENCODING_NONE);
if (buf == NULL) {
fprintf(stderr, "Failed to allocate input buffer\n");
-+ test_ret = 1;
++ test_ret = 1;
goto error;
}
input = xmlNewInputStream(ctxt);
if (input == NULL) {
xmlFreeParserInputBuffer(buf);
-+ test_ret = 1;
++ test_ret = 1;
goto error;
}
input->filename = NULL;
-@@ -567,25 +629,28 @@
+@@ -567,25 +629,28 @@ static void testCharRanges(void) {
printf("testing char range: 1");
fflush(stdout);
@@ -768,7 +789,7 @@ diff -uNr a/testchar.c b/testchar.c
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
-@@ -602,8 +667,9 @@
+@@ -602,8 +667,9 @@ int main(void) {
/*
* Run the tests
*/
@@ -780,30 +801,33 @@ diff -uNr a/testchar.c b/testchar.c
/*
* Cleanup function for the XML library.
-diff -uNr a/testdict.c b/testdict.c
---- a/testdict.c 2013-04-16 15:08:42.971177193 +0200
-+++ b/testdict.c 2013-04-18 15:59:00.699482439 +0200
-@@ -440,5 +440,6 @@
+diff --git a/testdict.c b/testdict.c
+index 40bebd05..114b9347 100644
+--- a/testdict.c
++++ b/testdict.c
+@@ -440,5 +440,6 @@ int main(void)
clean_strings();
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
-diff -uNr a/testlimits.c b/testlimits.c
---- a/testlimits.c 2013-04-12 16:16:36.180354177 +0200
-+++ b/testlimits.c 2013-04-17 14:03:17.203092987 +0200
-@@ -1630,5 +1630,6 @@
+diff --git a/testlimits.c b/testlimits.c
+index 059116a6..f0bee68d 100644
+--- a/testlimits.c
++++ b/testlimits.c
+@@ -1634,5 +1634,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
-diff -uNr a/testrecurse.c b/testrecurse.c
---- a/testrecurse.c 2013-04-16 13:19:49.366536295 +0200
-+++ b/testrecurse.c 2013-04-17 14:06:27.367091622 +0200
-@@ -892,6 +892,7 @@
+diff --git a/testrecurse.c b/testrecurse.c
+index 0cbe25a6..3ecadb40 100644
+--- a/testrecurse.c
++++ b/testrecurse.c
+@@ -892,6 +892,7 @@ launchTests(testDescPtr tst) {
err++;
}
}
@@ -811,10 +835,13 @@ diff -uNr a/testrecurse.c b/testrecurse.c
return(err);
}
-@@ -961,5 +962,6 @@
+@@ -961,5 +962,6 @@ main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlCleanupParser();
xmlMemoryDump();
+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL");
return(ret);
}
+--
+2.25.1
+
diff --git a/meta/recipes-core/libxml/libxml2_2.9.12.bb b/meta/recipes-core/libxml/libxml2_2.9.12.bb
new file mode 100644
index 0000000000..c387587dfd
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2_2.9.12.bb
@@ -0,0 +1,109 @@
+SUMMARY = "XML C Parser Library and Toolkit"
+DESCRIPTION = "The XML Parser Library allows for manipulation of XML files. Libxml2 exports Push and Pull type parser interfaces for both XML and HTML. It can do DTD validation at parse time, on a parsed document instance or with an arbitrary DTD. Libxml2 includes complete XPath, XPointer and Xinclude implementations. It also has a SAX like interface, which is designed to be compatible with Expat."
+HOMEPAGE = "http://www.xmlsoft.org/"
+BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2"
+SECTION = "libs"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \
+ file://hash.c;beginline=6;endline=15;md5=e77f77b12cb69e203d8b4090a0eee879 \
+ file://list.c;beginline=4;endline=13;md5=b9c25b021ccaf287e50060602d20f3a7 \
+ file://trio.c;beginline=5;endline=14;md5=cd4f61e27f88c1d43df112966b1cd28f"
+
+DEPENDS = "zlib virtual/libiconv"
+
+SRC_URI = "http://www.xmlsoft.org/sources/libxml2-${PV}.tar.gz;name=libtar \
+ http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=testtar \
+ file://libxml-64bit.patch \
+ file://runtest.patch \
+ file://run-ptest \
+ file://python-sitepackages-dir.patch \
+ file://libxml-m4-use-pkgconfig.patch \
+ file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
+ file://fix-execution-of-ptests.patch \
+ file://remove-fuzz-from-ptests.patch \
+ "
+
+SRC_URI[libtar.sha256sum] = "c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92"
+SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
+
+BINCONFIG = "${bindir}/xml2-config"
+
+PACKAGECONFIG ??= "python \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+"
+PACKAGECONFIG[python] = "--with-python=${PYTHON},--without-python,python3"
+PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
+
+inherit autotools pkgconfig binconfig-disabled ptest
+
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
+
+RDEPENDS:${PN}-ptest += "bash make ${@bb.utils.contains('PACKAGECONFIG', 'python', 'libgcc python3-core python3-logging python3-shell python3-stringold python3-threading python3-unittest ${PN}-python', '', d)}"
+
+RDEPENDS:${PN}-python += "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-core', '', d)}"
+
+RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-gconv-ebcdic-us \
+ glibc-gconv-ibm1141 \
+ glibc-gconv-iso8859-5 \
+ glibc-gconv-euc-jp \
+ locale-base-en-us \
+ "
+
+export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
+
+# WARNING: zlib is required for RPM use
+EXTRA_OECONF = "--without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
+EXTRA_OECONF:class-native = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
+EXTRA_OECONF:class-nativesdk = "--without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
+EXTRA_OECONF:linuxstdbase = "--with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
+
+python populate_packages:prepend () {
+ # autonamer would call this libxml2-2, but we don't want that
+ if d.getVar('DEBIAN_NAMES'):
+ d.setVar('PKG:libxml2', '${MLPREFIX}libxml2')
+}
+
+PACKAGE_BEFORE_PN += "${PN}-utils"
+PACKAGES += "${PN}-python"
+
+FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
+FILES:${PN}-dev += "${libdir}/xml2Conf.sh"
+FILES:${PN}-utils = "${bindir}/*"
+FILES:${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
+
+do_configure:prepend () {
+ # executables take longer to package: these should not be executable
+ find ${S}/xmlconf/ -type f -exec chmod -x {} \+
+}
+
+do_compile_ptest() {
+ oe_runmake check-am
+}
+
+do_install_ptest () {
+ cp -r ${S}/xmlconf ${D}${PTEST_PATH}
+ if [ "${@bb.utils.filter('PACKAGECONFIG', 'python', d)}" ]; then
+ sed -i -e 's|^\(PYTHON = \).*|\1${USRBINPATH}/${PYTHON_PN}|' \
+ ${D}${PTEST_PATH}/python/tests/Makefile
+ grep -lrZ '#!/usr/bin/python' ${D}${PTEST_PATH}/python |
+ xargs -0 sed -i -e 's|/usr/bin/python|${USRBINPATH}/${PYTHON_PN}|'
+ fi
+ #Remove build host references from various Makefiles
+ find "${D}${PTEST_PATH}" -name Makefile -type f -exec \
+ sed -i \
+ -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
+ -e 's|${DEBUG_PREFIX_MAP}||g' \
+ -e 's:${HOSTTOOLS_DIR}/::g' \
+ -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+ -e 's:${RECIPE_SYSROOT}::g' \
+ -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
+ -e '/^RELDATE/d' \
+ {} +
+}
+
+do_install:append:class-native () {
+ # Docs are not needed in the native case
+ rm ${D}${datadir}/gtk-doc -rf
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/libxml/libxml2_2.9.2.bb b/meta/recipes-core/libxml/libxml2_2.9.2.bb
deleted file mode 100644
index 79a395cea1..0000000000
--- a/meta/recipes-core/libxml/libxml2_2.9.2.bb
+++ /dev/null
@@ -1,11 +0,0 @@
-require libxml2.inc
-
-SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar \
- file://72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch \
- file://0001-threads-Define-pthread-definitions-for-glibc-complia.patch \
- "
-
-SRC_URI[libtar.md5sum] = "9e6a9aca9d155737868b3dc5fd82f788"
-SRC_URI[libtar.sha256sum] = "5178c30b151d044aefb1b08bf54c3003a0ac55c59c866763997529d60770d5bc"
-SRC_URI[testtar.md5sum] = "ae3d1ebe000a3972afa104ca7f0e1b4a"
-SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
diff --git a/meta/recipes-core/meta/build-sysroots.bb b/meta/recipes-core/meta/build-sysroots.bb
new file mode 100644
index 0000000000..ad22a75eb2
--- /dev/null
+++ b/meta/recipes-core/meta/build-sysroots.bb
@@ -0,0 +1,42 @@
+INHIBIT_DEFAULT_DEPS = "1"
+LICENSE = "MIT"
+
+STANDALONE_SYSROOT = "${STAGING_DIR}/${MACHINE}"
+STANDALONE_SYSROOT_NATIVE = "${STAGING_DIR}/${BUILD_ARCH}"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+EXCLUDE_FROM_WORLD = "1"
+
+inherit nopackages
+deltask fetch
+deltask unpack
+deltask patch
+deltask prepare_recipe_sysroot
+deltask populate_lic
+deltask configure
+deltask compile
+deltask install
+deltask populate_sysroot
+
+python do_build_native_sysroot () {
+ targetsysroot = d.getVar("STANDALONE_SYSROOT")
+ nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
+ import os
+ os.environ['PATH'] = "%s/bin:%s/usr/bin:%s" % (nativesysroot, nativesysroot, os.environ['PATH'])
+ staging_populate_sysroot_dir(targetsysroot, nativesysroot, True, d)
+}
+do_build_native_sysroot[cleandirs] = "${STANDALONE_SYSROOT_NATIVE}"
+do_build_native_sysroot[nostamp] = "1"
+addtask do_build_native_sysroot before do_build
+
+python do_build_target_sysroot () {
+ targetsysroot = d.getVar("STANDALONE_SYSROOT")
+ nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
+ import os
+ os.environ['PATH'] = "%s/bin:%s/usr/bin:%s" % (nativesysroot, nativesysroot, os.environ['PATH'])
+ staging_populate_sysroot_dir(targetsysroot, nativesysroot, False, d)
+}
+do_build_target_sysroot[cleandirs] = "${STANDALONE_SYSROOT}"
+do_build_target_sysroot[nostamp] = "1"
+addtask do_build_target_sysroot before do_build
+
+do_clean[cleandirs] += "${STANDALONE_SYSROOT} ${STANDALONE_SYSROOT_NATIVE}"
diff --git a/meta/recipes-core/meta/buildtools-extended-tarball.bb b/meta/recipes-core/meta/buildtools-extended-tarball.bb
new file mode 100644
index 0000000000..83e3fddccc
--- /dev/null
+++ b/meta/recipes-core/meta/buildtools-extended-tarball.bb
@@ -0,0 +1,49 @@
+require recipes-core/meta/buildtools-tarball.bb
+
+DESCRIPTION = "SDK type target for building a standalone tarball containing build-essentials, python3, chrpath, \
+ make, git and tar. The tarball can be used to run bitbake builds on systems which don't meet the \
+ usual version requirements and have ancient compilers."
+SUMMARY = "Standalone tarball for running builds on systems with inadequate software and ancient compilers"
+LICENSE = "MIT"
+
+# Add nativesdk equivalent of build-essentials
+TOOLCHAIN_HOST_TASK += "\
+ nativesdk-automake \
+ nativesdk-autoconf \
+ nativesdk-binutils \
+ nativesdk-binutils-symlinks \
+ nativesdk-cpp \
+ nativesdk-cpp-symlinks \
+ nativesdk-gcc \
+ nativesdk-gcc-symlinks \
+ nativesdk-g++ \
+ nativesdk-g++-symlinks \
+ nativesdk-gettext \
+ nativesdk-libatomic \
+ nativesdk-libgcc \
+ nativesdk-libgomp-dev \
+ nativesdk-libstdc++ \
+ nativesdk-libstdc++-dev \
+ nativesdk-libstdc++-staticdev \
+ nativesdk-libtool \
+ nativesdk-pkgconfig \
+ nativesdk-glibc-utils \
+ nativesdk-glibc-gconv-ibm850 \
+ nativesdk-glibc-gconv-iso8859-1 \
+ nativesdk-glibc-gconv-utf-16 \
+ nativesdk-glibc-gconv-cp1250 \
+ nativesdk-glibc-gconv-cp1251 \
+ nativesdk-glibc-gconv-cp1252 \
+ nativesdk-glibc-gconv-euc-jp \
+ nativesdk-glibc-gconv-libjis \
+ nativesdk-libxcrypt-dev \
+ nativesdk-parted \
+ nativesdk-dosfstools \
+ nativesdk-gptfdisk \
+ "
+# gconv-cp1250, cp1251 and euc-jp needed for iconv to work in vim builds
+# also copied list from uninative
+
+TOOLCHAIN_OUTPUTNAME = "${SDK_ARCH}-buildtools-extended-nativesdk-standalone-${DISTRO_VERSION}"
+
+SDK_TITLE = "Extended Build tools"
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
index 840434ccd2..fb28930656 100644
--- a/meta/recipes-core/meta/buildtools-tarball.bb
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -1,18 +1,19 @@
-DESCRIPTION = "SDK type target for building a standalone tarball containing python, chrpath, make, git and tar. The \
+DESCRIPTION = "SDK type target for building a standalone tarball containing python3, chrpath, make, git and tar. The \
tarball can be used to run bitbake builds on systems which don't meet the usual version requirements."
SUMMARY = "Standalone tarball for running builds on systems with inadequate software"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TOOLCHAIN_TARGET_TASK ?= ""
TOOLCHAIN_HOST_TASK ?= "\
- nativesdk-python-core \
- nativesdk-python-modules \
- nativesdk-python-misc \
- nativesdk-python-git \
- nativesdk-python-pexpect \
+ nativesdk-sdk-provides-dummy \
+ nativesdk-python3-core \
+ nativesdk-python3-modules \
+ nativesdk-python3-misc \
+ nativesdk-python3-git \
+ nativesdk-python3-jinja2 \
+ nativesdk-python3-testtools \
+ nativesdk-python3-subunit \
nativesdk-ncurses-terminfo-base \
nativesdk-chrpath \
nativesdk-tar \
@@ -23,11 +24,24 @@ TOOLCHAIN_HOST_TASK ?= "\
nativesdk-make \
nativesdk-wget \
nativesdk-ca-certificates \
+ nativesdk-texinfo \
+ nativesdk-libnss-nis \
+ nativesdk-rpcsvc-proto \
+ nativesdk-patch \
+ nativesdk-mtools \
+ nativesdk-zstd \
+ nativesdk-lz4 \
"
-SDK_PACKAGE_ARCHS =+ "buildtools-dummy-${SDKPKGSUFFIX}"
+MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
+PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}"
+PACKAGE_ARCHS = ""
+TARGET_ARCH = "none"
+TARGET_OS = "none"
-TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"
+SDK_PACKAGE_ARCHS += "buildtools-dummy-${SDKPKGSUFFIX}"
+
+TOOLCHAIN_OUTPUTNAME ?= "${SDK_ARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"
SDK_TITLE = "Build tools"
@@ -35,11 +49,18 @@ RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
EXCLUDE_FROM_WORLD = "1"
-inherit meta
inherit populate_sdk
-inherit toolchain-scripts
+inherit toolchain-scripts-base
+inherit nopackages
+
+deltask install
+deltask populate_sysroot
+
+do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}"
+
+REAL_MULTIMACH_TARGET_SYS = "none"
-create_sdk_files_append () {
+create_sdk_files:append () {
rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-*
rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
rm -f ${SDK_OUTPUT}/${SDKPATH}/version-*
@@ -47,13 +68,46 @@ create_sdk_files_append () {
# Generate new (mini) sdk-environment-setup file
script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
touch $script
- echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
- # In order for the self-extraction script to correctly extract and set up things,
- # we need a 'OECORE_NATIVE_SYSROOT=xxx' line in environment setup script.
- # However, buildtools-tarball is inherently a tool set instead of a fully functional SDK,
- # so instead of exporting the variable, we use a comment here.
- echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
+ echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:${SDKPATHNATIVE}${sbindir_nativesdk}:${SDKPATHNATIVE}${base_bindir_nativesdk}:${SDKPATHNATIVE}${base_sbindir_nativesdk}:$PATH' >> $script
+ echo 'export OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
+ echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
+ echo 'export SSL_CERT_FILE="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
+
toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
- echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
+ cat >> $script <<EOF
+if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
+ for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
+ . \$envfile
+ done
+fi
+# We have to unset this else it can confuse oe-selftest and other tools
+# which may also use the overlapping namespace.
+unset OECORE_NATIVE_SYSROOT
+EOF
+
+ if [ "${SDKMACHINE}" = "i686" ]; then
+ echo 'export NO32LIBS="0"' >>$script
+ echo 'echo "$BB_ENV_EXTRAWHITE" | grep -q "NO32LIBS"' >>$script
+ echo '[ $? != 0 ] && export BB_ENV_EXTRAWHITE="NO32LIBS $BB_ENV_EXTRAWHITE"' >>$script
+ fi
+}
+
+# buildtools-tarball doesn't need config site
+TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
+
+# The recipe doesn't need any default deps
+INHIBIT_DEFAULT_DEPS = "1"
+
+python do_testsdk() {
+ import oeqa.sdk.testsdk
+ testsdk = oeqa.sdk.testsdk.TestSDK()
+
+ cases_path = os.path.join(os.path.abspath(os.path.dirname(oeqa.sdk.testsdk.__file__)), "buildtools-cases")
+ testsdk.context_executor_class.default_cases = cases_path
+
+ testsdk.run(d)
}
+addtask testsdk
+do_testsdk[nostamp] = "1"
+do_testsdk[depends] += "xz-native:do_populate_sysroot"
diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb
new file mode 100644
index 0000000000..e5822cee58
--- /dev/null
+++ b/meta/recipes-core/meta/cve-update-db-native.bb
@@ -0,0 +1,229 @@
+SUMMARY = "Updates the NVD CVE database"
+LICENSE = "MIT"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+inherit native
+
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_install
+deltask do_populate_sysroot
+
+NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-"
+
+python () {
+ if not bb.data.inherits_class("cve-check", d):
+ raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
+}
+
+python do_fetch() {
+ """
+ Update NVD database with json data feed
+ """
+ import bb.utils
+ import bb.progress
+ import sqlite3, urllib, urllib.parse, gzip
+ from datetime import date
+
+ bb.utils.export_proxies(d)
+
+ YEAR_START = 2002
+
+ db_file = d.getVar("CVE_CHECK_DB_FILE")
+ db_dir = os.path.dirname(db_file)
+
+ if os.path.exists("{0}-journal".format(db_file)):
+ # If a journal is present the last update might have been interrupted. In that case,
+ # just wipe any leftovers and force the DB to be recreated.
+ os.remove("{0}-journal".format(db_file))
+
+ if os.path.exists(db_file):
+ os.remove(db_file)
+
+ # Don't refresh the database more than once an hour
+ try:
+ import time
+ if time.time() - os.path.getmtime(db_file) < (60*60):
+ bb.debug(2, "Recently updated, skipping")
+ return
+ except OSError:
+ pass
+
+ bb.utils.mkdirhier(db_dir)
+
+ # Connect to database
+ conn = sqlite3.connect(db_file)
+ c = conn.cursor()
+
+ initialize_db(c)
+
+ with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
+ total_years = date.today().year + 1 - YEAR_START
+ for i, year in enumerate(range(YEAR_START, date.today().year + 1)):
+ bb.debug(2, "Updating %d" % year)
+ ph.update((float(i + 1) / total_years) * 100)
+ year_url = (d.getVar('NVDCVE_URL')) + str(year)
+ meta_url = year_url + ".meta"
+ json_url = year_url + ".json.gz"
+
+ # Retrieve meta last modified date
+ try:
+ response = urllib.request.urlopen(meta_url)
+ except urllib.error.URLError as e:
+ cve_f.write('Warning: CVE db update error, Unable to fetch CVE data.\n\n')
+ bb.warn("Failed to fetch CVE data (%s)" % e.reason)
+ return
+
+ if response:
+ for l in response.read().decode("utf-8").splitlines():
+ key, value = l.split(":", 1)
+ if key == "lastModifiedDate":
+ last_modified = value
+ break
+ else:
+ bb.warn("Cannot parse CVE metadata, update failed")
+ return
+
+ # Compare with current db last modified date
+ c.execute("select DATE from META where YEAR = ?", (year,))
+ meta = c.fetchone()
+ if not meta or meta[0] != last_modified:
+ bb.debug(2, "Updating entries")
+ # Clear products table entries corresponding to current year
+ c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,))
+
+ # Update db with current year json file
+ try:
+ response = urllib.request.urlopen(json_url)
+ if response:
+ update_db(c, gzip.decompress(response.read()).decode('utf-8'))
+ c.execute("insert or replace into META values (?, ?)", [year, last_modified])
+ except urllib.error.URLError as e:
+ cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
+ bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
+ return
+ else:
+ bb.debug(2, "Already up to date (last modified %s)" % last_modified)
+ # Update success, set the date to cve_check file.
+ if year == date.today().year:
+ cve_f.write('CVE database update : %s\n\n' % date.today())
+
+ conn.commit()
+ conn.close()
+}
+
+do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
+do_fetch[file-checksums] = ""
+do_fetch[vardeps] = ""
+
+def initialize_db(c):
+ c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
+
+ c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
+ SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
+
+ c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
+ VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
+ VERSION_END TEXT, OPERATOR_END TEXT)")
+ c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);")
+
+def parse_node_and_insert(c, node, cveId):
+ # Parse children node if needed
+ for child in node.get('children', ()):
+ parse_node_and_insert(c, child, cveId)
+
+ def cpe_generator():
+ for cpe in node.get('cpe_match', ()):
+ if not cpe['vulnerable']:
+ return
+ cpe23 = cpe.get('cpe23Uri')
+ if not cpe23:
+ return
+ cpe23 = cpe23.split(':')
+ if len(cpe23) < 6:
+ return
+ vendor = cpe23[3]
+ product = cpe23[4]
+ version = cpe23[5]
+
+ if cpe23[6] == '*' or cpe23[6] == '-':
+ version_suffix = ""
+ else:
+ version_suffix = "_" + cpe23[6]
+
+ if version != '*' and version != '-':
+ # Version is defined, this is a '=' match
+ yield [cveId, vendor, product, version + version_suffix, '=', '', '']
+ elif version == '-':
+ # no version information is available
+ yield [cveId, vendor, product, version, '', '', '']
+ else:
+ # Parse start version, end version and operators
+ op_start = ''
+ op_end = ''
+ v_start = ''
+ v_end = ''
+
+ if 'versionStartIncluding' in cpe:
+ op_start = '>='
+ v_start = cpe['versionStartIncluding']
+
+ if 'versionStartExcluding' in cpe:
+ op_start = '>'
+ v_start = cpe['versionStartExcluding']
+
+ if 'versionEndIncluding' in cpe:
+ op_end = '<='
+ v_end = cpe['versionEndIncluding']
+
+ if 'versionEndExcluding' in cpe:
+ op_end = '<'
+ v_end = cpe['versionEndExcluding']
+
+ if op_start or op_end or v_start or v_end:
+ yield [cveId, vendor, product, v_start, op_start, v_end, op_end]
+ else:
+ # This is no version information, expressed differently.
+ # Save processing by representing as -.
+ yield [cveId, vendor, product, '-', '', '', '']
+
+ c.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator())
+
+def update_db(c, jsondata):
+ import json
+ root = json.loads(jsondata)
+
+ for elt in root['CVE_Items']:
+ if not elt['impact']:
+ continue
+
+ accessVector = None
+ cveId = elt['cve']['CVE_data_meta']['ID']
+ cveDesc = elt['cve']['description']['description_data'][0]['value']
+ date = elt['lastModifiedDate']
+ try:
+ accessVector = elt['impact']['baseMetricV2']['cvssV2']['accessVector']
+ cvssv2 = elt['impact']['baseMetricV2']['cvssV2']['baseScore']
+ except KeyError:
+ cvssv2 = 0.0
+ try:
+ accessVector = accessVector or elt['impact']['baseMetricV3']['cvssV3']['attackVector']
+ cvssv3 = elt['impact']['baseMetricV3']['cvssV3']['baseScore']
+ except KeyError:
+ accessVector = accessVector or "UNKNOWN"
+ cvssv3 = 0.0
+
+ c.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
+ [cveId, cveDesc, cvssv2, cvssv3, date, accessVector])
+
+ configurations = elt['configurations']['nodes']
+ for config in configurations:
+ parse_node_and_insert(c, config, cveId)
+
+
+do_fetch[nostamp] = "1"
+
+EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/recipes-core/meta/dummy-sdk-package.inc b/meta/recipes-core/meta/dummy-sdk-package.inc
new file mode 100644
index 0000000000..bd26e39ad3
--- /dev/null
+++ b/meta/recipes-core/meta/dummy-sdk-package.inc
@@ -0,0 +1,31 @@
+SUMMARY = "Dummy packages which handle excluding packages from the sdk, e.g. ensuring perl is excluded from buildtools"
+LICENSE = "MIT"
+
+PACKAGE_ARCH = "all"
+
+inherit allarch
+
+python() {
+ # Put the package somewhere separate to ensure it's never used except
+ # when we want it
+ # (note that we have to do this in anonymous python here to avoid
+ # allarch.bbclass disabling itself)
+ d.setVar('PACKAGE_ARCH', '${DUMMYARCH}')
+}
+
+ALLOW_EMPTY:${PN} = "1"
+
+PR[vardeps] += "DUMMYPROVIDES"
+PR[vardeps] += "DUMMYPROVIDES_PACKAGES"
+
+DUMMYPROVIDES_PACKAGES ??= ""
+DUMMYPROVIDES_PACKAGES_MULTILIB = "${@' '.join([multilib_pkg_extend(d, pkg) for pkg in d.getVar('DUMMYPROVIDES_PACKAGES').split()])}"
+DUMMYPROVIDES += "${DUMMYPROVIDES_PACKAGES_MULTILIB}"
+
+python populate_packages:prepend() {
+ p = d.getVar("PN")
+ d.appendVar("RPROVIDES:%s" % p, "${DUMMYPROVIDES}")
+ d.appendVar("RCONFLICTS:%s" % p, "${DUMMYPROVIDES}")
+ d.appendVar("RREPLACES:%s" % p, "${DUMMYPROVIDES_PACKAGES_MULTILIB}")
+}
+
diff --git a/meta/recipes-core/meta/meta-environment-extsdk.bb b/meta/recipes-core/meta/meta-environment-extsdk.bb
index d9e596143f..706312b0d6 100644
--- a/meta/recipes-core/meta/meta-environment-extsdk.bb
+++ b/meta/recipes-core/meta/meta-environment-extsdk.bb
@@ -4,9 +4,9 @@ require meta-environment.bb
PN = "meta-environment-extsdk-${MACHINE}"
-create_sdk_files_append() {
- local sysroot=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_TARGET', True), d.getVar('TOPDIR', True))}
- local sdkpathnative=${SDKPATH}/${@os.path.relpath(d.getVar('STAGING_DIR_NATIVE',True), d.getVar('TOPDIR', True))}
+create_sdk_files:append() {
+ local sysroot=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${MACHINE}
+ local sdkpathnative=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${BUILD_ARCH}
toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative
}
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
index 49d45f6ec4..7118fb2aef 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -1,6 +1,4 @@
SUMMARY = "Package of environment files for SDK"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
LICENSE = "MIT"
PR = "r8"
@@ -11,7 +9,9 @@ MODIFYTOS = "0"
REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
inherit toolchain-scripts
-TOOLCHAIN_NEED_CONFIGSITE_CACHE_append = " zlib"
+TOOLCHAIN_NEED_CONFIGSITE_CACHE:append = " zlib"
+# Need to expand here before cross-candian changes HOST_ARCH -> SDK_ARCH
+TOOLCHAIN_CONFIGSITE_NOCACHE := "${TOOLCHAIN_CONFIGSITE_NOCACHE}"
SDK_DIR = "${WORKDIR}/sdk"
SDK_OUTPUT = "${SDK_DIR}/image"
@@ -21,31 +21,37 @@ inherit cross-canadian
do_generate_content[cleandirs] = "${SDK_OUTPUT}"
do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
+# Need to ensure we have the virtual mappings and site files for all multtilib variants
+do_generate_content[depends] = "${@oe.utils.build_depends_string(all_multilib_tune_values(d, 'TOOLCHAIN_NEED_CONFIGSITE_CACHE'), 'do_populate_sysroot')}"
python do_generate_content() {
# Handle multilibs in the SDK environment, siteconfig, etc files...
localdata = bb.data.createCopy(d)
# make sure we only use the WORKDIR value from 'd', or it can change
- localdata.setVar('WORKDIR', d.getVar('WORKDIR', True))
+ localdata.setVar('WORKDIR', d.getVar('WORKDIR'))
# make sure we only use the SDKTARGETSYSROOT value from 'd'
- localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT', True))
+ localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT'))
localdata.setVar('libdir', d.getVar('target_libdir', False))
# Process DEFAULTTUNE
bb.build.exec_func("create_sdk_files", localdata)
- variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+ variants = d.getVar("MULTILIB_VARIANTS") or ""
for item in variants.split():
# Load overrides from 'd' to avoid having to reset the value...
overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
localdata.setVar("OVERRIDES", overrides)
localdata.setVar("MLPREFIX", item + "-")
- bb.data.update_data(localdata)
bb.build.exec_func("create_sdk_files", localdata)
}
addtask generate_content before do_install after do_compile
+python () {
+ sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
+ d.appendVarFlag("do_generate_content", "file-checksums", " " + " ".join(searched))
+}
+
create_sdk_files() {
# Setup site file for external use
toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
@@ -54,6 +60,8 @@ create_sdk_files() {
# Add version information
toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
+
+ toolchain_create_post_relocate_script ${SDK_OUTPUT}/${SDKPATH}/post-relocate-setup.sh ${SDKPATH}
}
do_install() {
@@ -63,13 +71,13 @@ do_install() {
PN = "meta-environment-${MACHINE}"
PACKAGES = "${PN}"
-FILES_${PN}= " \
+FILES:${PN}= " \
${SDKPATH}/* \
"
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_populate_sysroot
diff --git a/meta/recipes-core/meta/meta-extsdk-toolchain.bb b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
new file mode 100644
index 0000000000..0df681ac73
--- /dev/null
+++ b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
@@ -0,0 +1,29 @@
+SUMMARY = "Extensible SDK toolchain meta-recipe"
+DESCRIPTION = "Meta-recipe for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
+LICENSE = "MIT"
+
+DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
+
+do_populate_sysroot[deptask] = "do_populate_sysroot"
+
+# NOTE: There is logic specific to this recipe in setscene_depvalid()
+# within sstate.bbclass, so if you copy or rename this and expect the same
+# functionality you'll need to modify that as well.
+
+LOCKED_SIGS_INDIR = "${WORKDIR}/locked-sigs"
+
+addtask do_locked_sigs after do_populate_sysroot
+SSTATETASKS += "do_locked_sigs"
+do_locked_sigs[sstate-inputdirs] = "${LOCKED_SIGS_INDIR}"
+do_locked_sigs[sstate-outputdirs] = "${STAGING_DIR}/${PACKAGE_ARCH}/${PN}/locked-sigs"
+# If a taskhash changes we need to use the latest hash changes. With unihash we may not rebuild.
+# eSDK which uses this is nostamp anyway
+do_locked_sigs[nostamp] = "1"
+
+python do_locked_sigs() {
+ import oe.copy_buildsystem
+ outdir = os.path.join(d.getVar('LOCKED_SIGS_INDIR'))
+ bb.utils.mkdirhier(outdir)
+ sigfile = os.path.join(outdir, 'locked-sigs-extsdk-toolchain.inc')
+ oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
+}
diff --git a/meta/recipes-core/meta/meta-go-toolchain.bb b/meta/recipes-core/meta/meta-go-toolchain.bb
new file mode 100644
index 0000000000..c24518efe3
--- /dev/null
+++ b/meta/recipes-core/meta/meta-go-toolchain.bb
@@ -0,0 +1,12 @@
+SUMMARY = "Meta package for building a installable Go toolchain"
+LICENSE = "MIT"
+
+inherit populate_sdk
+
+TOOLCHAIN_HOST_TASK:append = " \
+ packagegroup-go-cross-canadian-${MACHINE} \
+"
+
+TOOLCHAIN_TARGET_TASK:append = " \
+ ${@multilib_pkg_extend(d, 'packagegroup-go-sdk-target')} \
+"
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index 2f92912816..39317d50e0 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -1,17 +1,21 @@
SUMMARY = "Integrated Development Environment support"
DESCRIPTION = "Meta package for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
+DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native cmake-native"
PR = "r3"
+RM_WORK_EXCLUDE += "${PN}"
-inherit meta toolchain-scripts
+inherit toolchain-scripts nopackages
do_populate_ide_support () {
toolchain_create_tree_env_script
}
-do_populate_ide_support[nostamp] = "1"
+python () {
+ sitefiles, searched = siteinfo_get_files(d, sysrootcache=False)
+ d.setVar("CONFIG_SITE", " ".join(sitefiles))
+ d.appendVarFlag("do_populate_ide_support", "file-checksums", " " + " ".join(searched))
+}
+
addtask populate_ide_support before do_build after do_install
diff --git a/meta/recipes-core/meta/meta-toolchain.bb b/meta/recipes-core/meta/meta-toolchain.bb
index ba9fd88805..b02b0665e6 100644
--- a/meta/recipes-core/meta/meta-toolchain.bb
+++ b/meta/recipes-core/meta/meta-toolchain.bb
@@ -3,7 +3,4 @@ LICENSE = "MIT"
PR = "r7"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-
inherit populate_sdk
diff --git a/meta/recipes-core/meta/meta-world-pkgdata.bb b/meta/recipes-core/meta/meta-world-pkgdata.bb
new file mode 100644
index 0000000000..b299861375
--- /dev/null
+++ b/meta/recipes-core/meta/meta-world-pkgdata.bb
@@ -0,0 +1,53 @@
+SUMMARY = "Pulls in pkgdata for world"
+LICENSE = "MIT"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+addtask do_allpackagedata before do_build
+do_allpackagedata() {
+ :
+}
+do_allpackagedata[recrdeptask] = "do_packagedata do_allpackagedata"
+do_allpackagedata[noexec] = "1"
+
+WORLD_PKGDATADIR = "${D}/world-pkgdata"
+
+addtask do_collect_packagedata after do_allpackagedata
+SSTATETASKS += "do_collect_packagedata"
+do_collect_packagedata[sstate-inputdirs] = "${WORLD_PKGDATADIR}"
+do_collect_packagedata[sstate-outputdirs] = "${STAGING_DIR_HOST}/world-pkgdata"
+
+python do_collect_packagedata() {
+ import oe.copy_buildsystem
+ outdir = os.path.join(d.getVar('WORLD_PKGDATADIR'))
+ bb.utils.mkdirhier(outdir)
+ sigfile = os.path.join(outdir, 'locked-sigs-pkgdata.inc')
+ oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
+}
+
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_install
+
+do_prepare_recipe_sysroot[deptask] = ""
+
+WORLD_PKGDATA_EXCLUDE ?= ""
+
+python calculate_extra_depends() {
+ exclude = '${WORLD_PKGDATA_EXCLUDE}'.split()
+ for p in world_target:
+ if p == self_pn:
+ continue
+
+ if p in exclude:
+ continue
+
+ deps.append(p)
+}
+
+PACKAGES = ""
diff --git a/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
index d971c3ca3d..4909401c5a 100644
--- a/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
+++ b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
@@ -1,19 +1,43 @@
-SUMMARY = "Dummy package which ensures perl is excluded from buildtools"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+DUMMYARCH = "buildtools-dummy-${SDKPKGSUFFIX}"
-inherit nativesdk
-
-# Put it somewhere separate to ensure it's never used except when we want it
-PACKAGE_ARCH = "buildtools-dummy-${SDKPKGSUFFIX}"
+DUMMYPROVIDES_PACKAGES = "\
+ nativesdk-perl \
+ nativesdk-libxml-parser-perl \
+ nativesdk-perl-module-bytes \
+ nativesdk-perl-module-carp \
+ nativesdk-perl-module-constant \
+ nativesdk-perl-module-data-dumper \
+ nativesdk-perl-module-errno \
+ nativesdk-perl-module-exporter \
+ nativesdk-perl-module-file-basename \
+ nativesdk-perl-module-file-compare \
+ nativesdk-perl-module-file-copy \
+ nativesdk-perl-module-file-find \
+ nativesdk-perl-module-file-glob \
+ nativesdk-perl-module-file-path \
+ nativesdk-perl-module-file-spec \
+ nativesdk-perl-module-file-stat \
+ nativesdk-perl-module-file-temp \
+ nativesdk-perl-module-getopt-long \
+ nativesdk-perl-module-io-file \
+ nativesdk-perl-module-list-util \
+ nativesdk-perl-module-overloading \
+ nativesdk-perl-module-posix \
+ nativesdk-perl-module-scalar-util \
+ nativesdk-perl-module-strict \
+ nativesdk-perl-module-text-parsewords \
+ nativesdk-perl-module-thread-queue \
+ nativesdk-perl-module-threads \
+ nativesdk-perl-module-warnings \
+ nativesdk-perl-module-vars \
+"
-PERLPACKAGES = "nativesdk-perl \
- nativesdk-perl-module-file-path"
+DUMMYPROVIDES = "\
+ /usr/bin/perl \
+ "
-ALLOW_EMPTY_${PN} = "1"
+PR = "r2"
-python populate_packages_prepend() {
- d.appendVar('RPROVIDES_${PN}', '${PERLPACKAGES}')
- d.appendVar('RCONFLICTS_${PN}', '${PERLPACKAGES}')
-}
+require dummy-sdk-package.inc
+inherit nativesdk
diff --git a/meta/recipes-core/meta/nativesdk-sdk-provides-dummy.bb b/meta/recipes-core/meta/nativesdk-sdk-provides-dummy.bb
new file mode 100644
index 0000000000..1d71f373a4
--- /dev/null
+++ b/meta/recipes-core/meta/nativesdk-sdk-provides-dummy.bb
@@ -0,0 +1,17 @@
+DUMMYARCH = "sdk-provides-dummy-${SDKPKGSUFFIX}"
+
+DUMMYPROVIDES_PACKAGES = "\
+ pkgconfig \
+"
+
+DUMMYPROVIDES = "\
+ /bin/sh \
+ /bin/bash \
+ /usr/bin/env \
+ libGL.so()(64bit) \
+ libGL.so \
+"
+
+require dummy-sdk-package.inc
+
+inherit nativesdk
diff --git a/meta/recipes-core/meta/package-index.bb b/meta/recipes-core/meta/package-index.bb
index 3c46b49977..98c5bcb372 100644
--- a/meta/recipes-core/meta/package-index.bb
+++ b/meta/recipes-core/meta/package-index.bb
@@ -4,18 +4,16 @@ LICENSE = "MIT"
INHIBIT_DEFAULT_DEPS = "1"
PACKAGES = ""
-do_fetch[noexec] = "1"
-do_unpack[noexec] = "1"
-do_patch[noexec] = "1"
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-do_install[noexec] = "1"
-do_package[noexec] = "1"
-do_packagedata[noexec] = "1"
-do_package_write_ipk[noexec] = "1"
-do_package_write_rpm[noexec] = "1"
-do_package_write_deb[noexec] = "1"
-do_populate_sysroot[noexec] = "1"
+inherit nopackages
+
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
+deltask do_install
+deltask do_populate_lic
+deltask do_populate_sysroot
do_package_index[nostamp] = "1"
do_package_index[depends] += "${PACKAGEINDEXDEPS}"
diff --git a/meta/recipes-core/meta/signing-keys.bb b/meta/recipes-core/meta/signing-keys.bb
new file mode 100644
index 0000000000..03463f95f5
--- /dev/null
+++ b/meta/recipes-core/meta/signing-keys.bb
@@ -0,0 +1,81 @@
+# Copyright (C) 2015 Intel Corporation
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Makes public keys of the signing keys available"
+LICENSE = "MIT"
+
+
+inherit allarch deploy
+
+EXCLUDE_FROM_WORLD = "1"
+INHIBIT_DEFAULT_DEPS = "1"
+
+SYSROOT_DIRS += "${sysconfdir}/pki"
+
+PACKAGES =+ "${PN}-ipk ${PN}-rpm ${PN}-packagefeed"
+
+FILES:${PN}-rpm = "${sysconfdir}/pki/rpm-gpg"
+FILES:${PN}-ipk = "${sysconfdir}/pki/ipk-gpg"
+FILES:${PN}-packagefeed = "${sysconfdir}/pki/packagefeed-gpg"
+
+python do_get_public_keys () {
+ from oe.gpg_sign import get_signer
+
+ if d.getVar("RPM_SIGN_PACKAGES"):
+ # Export public key of the rpm signing key
+ signer = get_signer(d, d.getVar('RPM_GPG_BACKEND'))
+ signer.export_pubkey(os.path.join(d.expand('${B}'), 'rpm-key'),
+ d.getVar('RPM_GPG_NAME'))
+
+ if d.getVar("IPK_SIGN_PACKAGES"):
+ # Export public key of the ipk signing key
+ signer = get_signer(d, d.getVar('IPK_GPG_BACKEND'))
+ signer.export_pubkey(os.path.join(d.expand('${B}'), 'ipk-key'),
+ d.getVar('IPK_GPG_NAME'))
+
+ if d.getVar('PACKAGE_FEED_SIGN') == '1':
+ # Export public key of the feed signing key
+ signer = get_signer(d, d.getVar('PACKAGE_FEED_GPG_BACKEND'))
+ signer.export_pubkey(os.path.join(d.expand('${B}'), 'pf-key'),
+ d.getVar('PACKAGE_FEED_GPG_NAME'))
+}
+do_get_public_keys[cleandirs] = "${B}"
+addtask get_public_keys before do_install
+do_get_public_keys[depends] += "gnupg-native:do_populate_sysroot"
+
+do_install () {
+ if [ -f "${B}/rpm-key" ]; then
+ install -D -m 0644 "${B}/rpm-key" "${D}${sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+ if [ -f "${B}/ipk-key" ]; then
+ install -D -m 0644 "${B}/ipk-key" "${D}${sysconfdir}/pki/ipk-gpg/IPK-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+ if [ -f "${B}/pf-key" ]; then
+ install -D -m 0644 "${B}/pf-key" "${D}${sysconfdir}/pki/packagefeed-gpg/PACKAGEFEED-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+}
+
+do_deploy () {
+ if [ -f "${B}/rpm-key" ]; then
+ install -D -m 0644 "${B}/rpm-key" "${DEPLOYDIR}/RPM-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+ if [ -f "${B}/ipk-key" ]; then
+ install -D -m 0644 "${B}/ipk-key" "${DEPLOYDIR}/IPK-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+ if [ -f "${B}/pf-key" ]; then
+ install -D -m 0644 "${B}/pf-key" "${DEPLOYDIR}/PACKAGEFEED-GPG-KEY-${DISTRO}-${DISTRO_CODENAME}"
+ fi
+}
+do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
+# clear stamp-extra-info since MACHINE_ARCH is normally put there by
+# deploy.bbclass
+do_deploy[stamp-extra-info] = ""
+addtask deploy after do_get_public_keys
+
+# Delete unnecessary tasks. In particular, "do_unpack" _must_ be deleted because
+# it cleans ${B} and will wipe any keys exported by do_get_public_keys.
+deltask do_fetch
+deltask do_unpack
+deltask do_patch
+deltask do_configure
+deltask do_compile
diff --git a/meta/recipes-core/meta/target-sdk-provides-dummy.bb b/meta/recipes-core/meta/target-sdk-provides-dummy.bb
new file mode 100644
index 0000000000..e3beeb796c
--- /dev/null
+++ b/meta/recipes-core/meta/target-sdk-provides-dummy.bb
@@ -0,0 +1,61 @@
+DUMMYARCH = "sdk-provides-dummy-target"
+
+DUMMYPROVIDES_PACKAGES = "\
+ busybox \
+ busybox-dev \
+ busybox-src \
+ coreutils \
+ coreutils-dev \
+ coreutils-src \
+ bash \
+ bash-dev \
+ bash-src \
+ perl \
+ perl-dev \
+ perl-src \
+ perl-module-re \
+ perl-module-strict \
+ perl-module-vars \
+ perl-module-text-wrap \
+ libxml-parser-perl \
+ perl-module-bytes \
+ perl-module-carp \
+ perl-module-config \
+ perl-module-constant \
+ perl-module-data-dumper \
+ perl-module-errno \
+ perl-module-exporter \
+ perl-module-file-basename \
+ perl-module-file-compare \
+ perl-module-file-copy \
+ perl-module-file-find \
+ perl-module-file-glob \
+ perl-module-file-path \
+ perl-module-file-stat \
+ perl-module-file-temp \
+ perl-module-getopt-long \
+ perl-module-io-file \
+ perl-module-overload \
+ perl-module-overloading \
+ perl-module-posix \
+ perl-module-thread-queue \
+ perl-module-threads \
+ perl-module-warnings \
+ perl-module-warnings-register \
+ pkgconfig \
+ pkgconfig-dev \
+ pkgconfig-src \
+"
+
+DUMMYPROVIDES = "\
+ /bin/sh \
+ /bin/bash \
+ /usr/bin/env \
+ /usr/bin/perl \
+ libperl.so.5 \
+ libperl.so.5()(64bit) \
+"
+
+require dummy-sdk-package.inc
+
+SSTATE_DUPWHITELIST += "${PKGDATA_DIR}/${PN} ${PKGDATA_DIR}/runtime/${PN}"
diff --git a/meta/recipes-core/meta/testexport-tarball.bb b/meta/recipes-core/meta/testexport-tarball.bb
new file mode 100644
index 0000000000..7cb84a0104
--- /dev/null
+++ b/meta/recipes-core/meta/testexport-tarball.bb
@@ -0,0 +1,69 @@
+DESCRIPTION = "SDK type target for standalone tarball containing packages defined by TEST_EXPORT_TOOLS. The \
+ tarball can be used to run missing programs on testing systems which don't have such tools.\
+ This recipe is almost the same as buildtools-tarball"
+SUMMARY = "Standalone tarball for test systems with missing software"
+LICENSE = "MIT"
+
+TEST_EXPORT_SDK_PACKAGES ??= ""
+
+TOOLCHAIN_TARGET_TASK ?= ""
+
+TOOLCHAIN_HOST_TASK ?= "${TEST_EXPORT_SDK_PACKAGES} nativesdk-sdk-provides-dummy"
+
+MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
+PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}"
+PACKAGE_ARCHS = ""
+TARGET_ARCH = "none"
+TARGET_OS = "none"
+
+SDK_PACKAGE_ARCHS += "testexport-tools-${SDKPKGSUFFIX}"
+
+TOOLCHAIN_OUTPUTNAME ?= "${TEST_EXPORT_SDK_NAME}"
+
+SDK_TITLE = "Testexport tools"
+
+RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
+
+EXCLUDE_FROM_WORLD = "1"
+
+inherit populate_sdk
+inherit toolchain-scripts-base
+inherit nopackages
+
+deltask install
+deltask populate_sysroot
+
+do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}"
+
+REAL_MULTIMACH_TARGET_SYS = "none"
+
+create_sdk_files:append () {
+ rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-*
+ rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
+ rm -f ${SDK_OUTPUT}/${SDKPATH}/version-*
+
+ # Generate new (mini) sdk-environment-setup file
+ script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
+ touch $script
+ echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
+ # In order for the self-extraction script to correctly extract and set up things,
+ # we need a 'OECORE_NATIVE_SYSROOT=xxx' line in environment setup script.
+ # However, testexport-tarball is inherently a tool set instead of a fully functional SDK,
+ # so instead of exporting the variable, we use a comment here.
+ echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
+ toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
+
+ echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
+
+ if [ "${SDKMACHINE}" = "i686" ]; then
+ echo 'export NO32LIBS="0"' >>$script
+ echo 'echo "$BB_ENV_EXTRAWHITE" | grep -q "NO32LIBS"' >>$script
+ echo '[ $? != 0 ] && export BB_ENV_EXTRAWHITE="NO32LIBS $BB_ENV_EXTRAWHITE"' >>$script
+ fi
+}
+
+# testexport-tarball doesn't need config site
+TOOLCHAIN_NEED_CONFIGSITE_CACHE = ""
+
+# The recipe doesn't need any default deps
+INHIBIT_DEFAULT_DEPS = "1"
diff --git a/meta/recipes-core/meta/uninative-tarball.bb b/meta/recipes-core/meta/uninative-tarball.bb
index 41f7927e19..a21d08b591 100644
--- a/meta/recipes-core/meta/uninative-tarball.bb
+++ b/meta/recipes-core/meta/uninative-tarball.bb
@@ -1,33 +1,53 @@
SUMMARY = "libc and patchelf tarball for use with uninative.bbclass"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TOOLCHAIN_TARGET_TASK = ""
+# ibm850 - mcopy from mtools
+# iso8859-1 - guile
+# utf-16, cp1252 - binutils-windres
TOOLCHAIN_HOST_TASK = "\
nativesdk-glibc \
+ nativesdk-glibc-dbg \
+ nativesdk-glibc-gconv-ibm850 \
+ nativesdk-glibc-gconv-iso8859-1 \
+ nativesdk-glibc-gconv-utf-16 \
+ nativesdk-glibc-gconv-cp1252 \
+ nativesdk-glibc-gconv-euc-jp \
+ nativesdk-glibc-gconv-libjis \
nativesdk-patchelf \
+ nativesdk-libxcrypt \
+ nativesdk-libxcrypt-compat \
+ nativesdk-libnss-nis \
+ nativesdk-sdk-provides-dummy \
"
INHIBIT_DEFAULT_DEPS = "1"
-TOOLCHAIN_OUTPUTNAME ?= "${BUILD_ARCH}-nativesdk-libc"
+MULTIMACH_TARGET_SYS = "${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
+PACKAGE_ARCH = "${SDK_ARCH}_${SDK_OS}"
+PACKAGE_ARCHS = ""
+TARGET_ARCH = "none"
+TARGET_OS = "none"
+
+TOOLCHAIN_OUTPUTNAME ?= "${SDK_ARCH}-nativesdk-libc"
RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
EXCLUDE_FROM_WORLD = "1"
-inherit meta
inherit populate_sdk
+inherit nopackages
deltask install
-deltask package
-deltask packagedata
+deltask populate_sysroot
+
+do_populate_sdk[stamp-extra-info] = "${PACKAGE_ARCH}"
SDK_DEPENDS += "patchelf-native"
SDK_PACKAGING_FUNC = ""
+REAL_MULTIMACH_TARGET_SYS = "none"
fakeroot create_sdk_files() {
cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
@@ -39,12 +59,13 @@ fakeroot create_sdk_files() {
}
-fakeroot tar_sdk() {
- mkdir -p ${SDK_DEPLOY}
+fakeroot archive_sdk() {
cd ${SDK_OUTPUT}/${SDKPATH}
- mv sysroots/${SDK_SYS} ./${BUILD_SYS}
+
+ DEST="./${SDK_ARCH}-${SDK_OS}"
+ mv sysroots/${SDK_SYS} $DEST
rm sysroots -rf
- patchelf --set-interpreter ${@''.join('a' for n in xrange(1024))} ./${BUILD_SYS}/usr/bin/patchelf
- mv ./${BUILD_SYS}/usr/bin/patchelf ./${BUILD_SYS}/usr/bin/patchelf-uninative
- tar ${SDKTAROPTS} -c -j --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
+ patchelf --set-interpreter ${@''.join('a' for n in range(1024))} $DEST/usr/bin/patchelf
+ mv $DEST/usr/bin/patchelf $DEST/usr/bin/patchelf-uninative
+ ${SDK_ARCHIVE_CMD}
}
diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
new file mode 100644
index 0000000000..ba0916cb56
--- /dev/null
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -0,0 +1,27 @@
+SUMMARY = "A meta recipe to build native tools used by wic."
+
+LICENSE = "MIT"
+
+DEPENDS = "\
+ parted-native gptfdisk-native dosfstools-native \
+ mtools-native bmap-tools-native grub-native cdrtools-native \
+ btrfs-tools-native squashfs-tools-native pseudo-native \
+ e2fsprogs-native util-linux-native tar-native\
+ "
+DEPENDS:append:x86 = " syslinux-native syslinux grub-efi systemd-boot"
+DEPENDS:append:x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
+DEPENDS:append:x86-x32 = " syslinux-native syslinux grub-efi"
+DEPENDS:append:aarch64 = " grub-efi systemd-boot"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+inherit nopackages
+
+# The sysroot of wic-tools is needed for wic, but if rm_work is enabled, it will
+# be removed before wic has a chance to use it, hence the exclusion below.
+RM_WORK_EXCLUDE += "${PN}"
+
+python do_build_sysroot () {
+ bb.build.exec_func("extend_recipe_sysroot", d)
+}
+addtask do_build_sysroot after do_prepare_recipe_sysroot before do_build
diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
new file mode 100644
index 0000000000..cf8af0da3c
--- /dev/null
+++ b/meta/recipes-core/musl/bsd-headers.bb
@@ -0,0 +1,31 @@
+# Copyright (C) 2016 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "BSD compatible headers"
+LICENSE = "BSD-3-Clause & BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://sys-queue.h;beginline=1;endline=32;md5=c6352b0f03bb448600456547d334b56f"
+SECTION = "devel"
+
+SRC_URI = "file://sys-queue.h \
+ file://sys-tree.h \
+ file://sys-cdefs.h \
+ "
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+S = "${WORKDIR}"
+
+do_install() {
+ install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h
+ install -Dm 0644 ${S}/sys-tree.h ${D}${includedir}/sys/tree.h
+ install -Dm 0644 ${S}/sys-cdefs.h ${D}${includedir}/sys/cdefs.h
+}
+#
+# We will skip parsing for non-musl systems
+#
+
+COMPATIBLE_HOST = ".*-musl.*"
+RDEPENDS:${PN}-dev = ""
+RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/bsd-headers/sys-cdefs.h b/meta/recipes-core/musl/bsd-headers/sys-cdefs.h
new file mode 100644
index 0000000000..209a623c0f
--- /dev/null
+++ b/meta/recipes-core/musl/bsd-headers/sys-cdefs.h
@@ -0,0 +1,26 @@
+#warning usage of non-standard #include <sys/cdefs.h> is deprecated
+
+#undef __P
+#undef __PMT
+
+#define __P(args) args
+#define __PMT(args) args
+
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+
+#if defined(__GNUC__) && !defined(__cplusplus)
+# define __THROW __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__)) fct
+#else
+# define __THROW
+# define __NTH(fct) fct
+#endif
diff --git a/meta/recipes-core/musl/bsd-headers/sys-queue.h b/meta/recipes-core/musl/bsd-headers/sys-queue.h
new file mode 100644
index 0000000000..99d01a55b1
--- /dev/null
+++ b/meta/recipes-core/musl/bsd-headers/sys-queue.h
@@ -0,0 +1,846 @@
+/* $NetBSD: queue.h,v 1.68 2014/11/19 08:10:01 uebayasi Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define _SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list. Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction. Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * Include the definition of NULL only on NetBSD because sys/null.h
+ * is not available elsewhere. This conditional makes the header
+ * portable and it can simply be dropped verbatim into any system.
+ * The caveat is that on other systems some other header
+ * must provide NULL before the macros can be used.
+ */
+#ifdef __NetBSD__
+#include <sys/null.h>
+#endif
+
+#if defined(QUEUEDEBUG)
+# if defined(_KERNEL)
+# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
+# else
+# include <err.h>
+# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
+# endif
+#endif
+
+/*
+ * Singly-linked List definitions.
+ */
+#define SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List access methods.
+ */
+#define SLIST_FIRST(head) ((head)->slh_first)
+#define SLIST_END(head) NULL
+#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+#define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; \
+ (var) != SLIST_END(head); \
+ (var) = (var)->field.sle_next)
+
+#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = SLIST_FIRST((head)); \
+ (var) != SLIST_END(head) && \
+ ((tvar) = SLIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+/*
+ * Singly-linked List functions.
+ */
+#define SLIST_INIT(head) do { \
+ (head)->slh_first = SLIST_END(head); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_REMOVE_AFTER(slistelm, field) do { \
+ (slistelm)->field.sle_next = \
+ SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (/*CONSTCOND*/0)
+
+#define SLIST_REMOVE(head, elm, type, field) do { \
+ if ((head)->slh_first == (elm)) { \
+ SLIST_REMOVE_HEAD((head), field); \
+ } \
+ else { \
+ struct type *curelm = (head)->slh_first; \
+ while(curelm->field.sle_next != (elm)) \
+ curelm = curelm->field.sle_next; \
+ curelm->field.sle_next = \
+ curelm->field.sle_next->field.sle_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List access methods.
+ */
+#define LIST_FIRST(head) ((head)->lh_first)
+#define LIST_END(head) NULL
+#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head))
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = ((head)->lh_first); \
+ (var) != LIST_END(head); \
+ (var) = ((var)->field.le_next))
+
+#define LIST_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = LIST_FIRST((head)); \
+ (var) != LIST_END(head) && \
+ ((tvar) = LIST_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define LIST_MOVE(head1, head2) do { \
+ LIST_INIT((head2)); \
+ if (!LIST_EMPTY((head1))) { \
+ (head2)->lh_first = (head1)->lh_first; \
+ LIST_INIT((head1)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+/*
+ * List functions.
+ */
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
+ if ((head)->lh_first && \
+ (head)->lh_first->field.le_prev != &(head)->lh_first) \
+ QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_LIST_OP(elm, field) \
+ if ((elm)->field.le_next && \
+ (elm)->field.le_next->field.le_prev != \
+ &(elm)->field.le_next) \
+ QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \
+ __FILE__, __LINE__); \
+ if (*(elm)->field.le_prev != (elm)) \
+ QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \
+ (elm)->field.le_next = (void *)1L; \
+ (elm)->field.le_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
+#define QUEUEDEBUG_LIST_OP(elm, field)
+#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
+#endif
+
+#define LIST_INIT(head) do { \
+ (head)->lh_first = LIST_END(head); \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ QUEUEDEBUG_LIST_OP((listelm), field) \
+ if (((elm)->field.le_next = (listelm)->field.le_next) != \
+ LIST_END(head)) \
+ (listelm)->field.le_next->field.le_prev = \
+ &(elm)->field.le_next; \
+ (listelm)->field.le_next = (elm); \
+ (elm)->field.le_prev = &(listelm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ QUEUEDEBUG_LIST_OP((listelm), field) \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ (elm)->field.le_next = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &(elm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
+ if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
+ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+ (head)->lh_first = (elm); \
+ (elm)->field.le_prev = &(head)->lh_first; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_REMOVE(elm, field) do { \
+ QUEUEDEBUG_LIST_OP((elm), field) \
+ if ((elm)->field.le_next != NULL) \
+ (elm)->field.le_next->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = (elm)->field.le_next; \
+ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
+} while (/*CONSTCOND*/0)
+
+#define LIST_REPLACE(elm, elm2, field) do { \
+ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
+ (elm2)->field.le_next->field.le_prev = \
+ &(elm2)->field.le_next; \
+ (elm2)->field.le_prev = (elm)->field.le_prev; \
+ *(elm2)->field.le_prev = (elm2); \
+ QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Simple queue definitions.
+ */
+#define SIMPLEQ_HEAD(name, type) \
+struct name { \
+ struct type *sqh_first; /* first element */ \
+ struct type **sqh_last; /* addr of last next element */ \
+}
+
+#define SIMPLEQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).sqh_first }
+
+#define SIMPLEQ_ENTRY(type) \
+struct { \
+ struct type *sqe_next; /* next element */ \
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
+#define SIMPLEQ_END(head) NULL
+#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head))
+#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
+
+#define SIMPLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->sqh_first); \
+ (var) != SIMPLEQ_END(head); \
+ (var) = ((var)->field.sqe_next))
+
+#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
+ for ((var) = ((head)->sqh_first); \
+ (var) != SIMPLEQ_END(head) && \
+ ((next = ((var)->field.sqe_next)), 1); \
+ (var) = (next))
+
+/*
+ * Simple queue functions.
+ */
+#define SIMPLEQ_INIT(head) do { \
+ (head)->sqh_first = NULL; \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (head)->sqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.sqe_next = NULL; \
+ *(head)->sqh_last = (elm); \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (listelm)->field.sqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
+ if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
+ == NULL) \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
+ if ((head)->sqh_first == (elm)) { \
+ SIMPLEQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->sqh_first; \
+ while (curelm->field.sqe_next != (elm)) \
+ curelm = curelm->field.sqe_next; \
+ if ((curelm->field.sqe_next = \
+ curelm->field.sqe_next->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(curelm)->field.sqe_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_CONCAT(head1, head2) do { \
+ if (!SIMPLEQ_EMPTY((head2))) { \
+ *(head1)->sqh_last = (head2)->sqh_first; \
+ (head1)->sqh_last = (head2)->sqh_last; \
+ SIMPLEQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_LAST(head, type, field) \
+ (SIMPLEQ_EMPTY((head)) ? \
+ NULL : \
+ ((struct type *)(void *) \
+ ((char *)((head)->sqh_last) - offsetof(struct type, field))))
+
+/*
+ * Tail queue definitions.
+ */
+#define _TAILQ_HEAD(name, type, qual) \
+struct name { \
+ qual type *tqh_first; /* first element */ \
+ qual type *qual *tqh_last; /* addr of last next element */ \
+}
+#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
+
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { TAILQ_END(head), &(head).tqh_first }
+
+#define _TAILQ_ENTRY(type, qual) \
+struct { \
+ qual type *tqe_next; /* next element */ \
+ qual type *qual *tqe_prev; /* address of previous next element */\
+}
+#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
+
+/*
+ * Tail queue access methods.
+ */
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+#define TAILQ_END(head) (NULL)
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head))
+
+
+#define TAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->tqh_first); \
+ (var) != TAILQ_END(head); \
+ (var) = ((var)->field.tqe_next))
+
+#define TAILQ_FOREACH_SAFE(var, head, field, next) \
+ for ((var) = ((head)->tqh_first); \
+ (var) != TAILQ_END(head) && \
+ ((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
+
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
+ (var) != TAILQ_END(head); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
+ for ((var) = TAILQ_LAST((head), headname); \
+ (var) != TAILQ_END(head) && \
+ ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
+
+/*
+ * Tail queue functions.
+ */
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
+ if ((head)->tqh_first && \
+ (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
+ QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
+ if (*(head)->tqh_last != NULL) \
+ QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_TAILQ_OP(elm, field) \
+ if ((elm)->field.tqe_next && \
+ (elm)->field.tqe_next->field.tqe_prev != \
+ &(elm)->field.tqe_next) \
+ QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \
+ __FILE__, __LINE__); \
+ if (*(elm)->field.tqe_prev != (elm)) \
+ QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \
+ if ((elm)->field.tqe_next == NULL && \
+ (head)->tqh_last != &(elm)->field.tqe_next) \
+ QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
+ (head), (elm), __FILE__, __LINE__);
+#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \
+ (elm)->field.tqe_next = (void *)1L; \
+ (elm)->field.tqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
+#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
+#define QUEUEDEBUG_TAILQ_OP(elm, field)
+#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
+#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
+#endif
+
+#define TAILQ_INIT(head) do { \
+ (head)->tqh_first = TAILQ_END(head); \
+ (head)->tqh_last = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_HEAD(head, elm, field) do { \
+ QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
+ if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
+ (head)->tqh_first->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (head)->tqh_first = (elm); \
+ (elm)->field.tqe_prev = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_TAIL(head, elm, field) do { \
+ QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
+ (elm)->field.tqe_next = TAILQ_END(head); \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ QUEUEDEBUG_TAILQ_OP((listelm), field) \
+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \
+ TAILQ_END(head)) \
+ (elm)->field.tqe_next->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (listelm)->field.tqe_next = (elm); \
+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ QUEUEDEBUG_TAILQ_OP((listelm), field) \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ (elm)->field.tqe_next = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REMOVE(head, elm, field) do { \
+ QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
+ QUEUEDEBUG_TAILQ_OP((elm), field) \
+ if (((elm)->field.tqe_next) != TAILQ_END(head)) \
+ (elm)->field.tqe_next->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
+ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do { \
+ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \
+ TAILQ_END(head)) \
+ (elm2)->field.tqe_next->field.tqe_prev = \
+ &(elm2)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm2)->field.tqe_next; \
+ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
+ *(elm2)->field.tqe_prev = (elm2); \
+ QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
+} while (/*CONSTCOND*/0)
+
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue declarations.
+ */
+#define STAILQ_HEAD(name, type) \
+struct name { \
+ struct type *stqh_first; /* first element */ \
+ struct type **stqh_last; /* addr of last next element */ \
+}
+
+#define STAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).stqh_first }
+
+#define STAILQ_ENTRY(type) \
+struct { \
+ struct type *stqe_next; /* next element */ \
+}
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define STAILQ_FIRST(head) ((head)->stqh_first)
+#define STAILQ_END(head) NULL
+#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head))
+
+/*
+ * Singly-linked Tail queue functions.
+ */
+#define STAILQ_INIT(head) do { \
+ (head)->stqh_first = NULL; \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (head)->stqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.stqe_next = NULL; \
+ *(head)->stqh_last = (elm); \
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (listelm)->field.stqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_REMOVE(head, elm, type, field) do { \
+ if ((head)->stqh_first == (elm)) { \
+ STAILQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->stqh_first; \
+ while (curelm->field.stqe_next != (elm)) \
+ curelm = curelm->field.stqe_next; \
+ if ((curelm->field.stqe_next = \
+ curelm->field.stqe_next->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(curelm)->field.stqe_next; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->stqh_first); \
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
+#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+
+#define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_LAST(head, type, field) \
+ (STAILQ_EMPTY((head)) ? \
+ NULL : \
+ ((struct type *)(void *) \
+ ((char *)((head)->stqh_last) - offsetof(struct type, field))))
+
+
+#ifndef _KERNEL
+/*
+ * Circular queue definitions. Do not use. We still keep the macros
+ * for compatibility but because of pointer aliasing issues their use
+ * is discouraged!
+ */
+
+/*
+ * __launder_type(): We use this ugly hack to work around the the compiler
+ * noticing that two types may not alias each other and elide tests in code.
+ * We hit this in the CIRCLEQ macros when comparing 'struct name *' and
+ * 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC
+ * 4.8) declare these comparisons as always false, causing the code to
+ * not run as designed.
+ *
+ * This hack is only to be used for comparisons and thus can be fully const.
+ * Do not use for assignment.
+ *
+ * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
+ * this by changing the head/tail sentinal values, but see the note above
+ * this one.
+ */
+static __inline const void * __launder_type(const void *);
+static __inline const void *
+__launder_type(const void *__x)
+{
+ __asm __volatile("" : "+r" (__x));
+ return __x;
+}
+
+#if defined(QUEUEDEBUG)
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \
+ if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \
+ (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \
+ __FILE__, __LINE__); \
+ if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \
+ (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \
+ __FILE__, __LINE__);
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \
+ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \
+ if ((head)->cqh_last != (elm)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \
+ (elm), __FILE__, __LINE__); \
+ } else { \
+ if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \
+ (elm), __FILE__, __LINE__); \
+ } \
+ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \
+ if ((head)->cqh_first != (elm)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \
+ (elm), __FILE__, __LINE__); \
+ } else { \
+ if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \
+ QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \
+ (elm), __FILE__, __LINE__); \
+ }
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \
+ (elm)->field.cqe_next = (void *)1L; \
+ (elm)->field.cqe_prev = (void *)1L;
+#else
+#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
+#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
+#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
+#endif
+
+#define CIRCLEQ_HEAD(name, type) \
+struct name { \
+ struct type *cqh_first; /* first element */ \
+ struct type *cqh_last; /* last element */ \
+}
+
+#define CIRCLEQ_HEAD_INITIALIZER(head) \
+ { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define CIRCLEQ_ENTRY(type) \
+struct { \
+ struct type *cqe_next; /* next element */ \
+ struct type *cqe_prev; /* previous element */ \
+}
+
+/*
+ * Circular queue functions.
+ */
+#define CIRCLEQ_INIT(head) do { \
+ (head)->cqh_first = CIRCLEQ_END(head); \
+ (head)->cqh_last = CIRCLEQ_END(head); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
+ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \
+ (elm)->field.cqe_prev = (listelm); \
+ if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \
+ (listelm)->field.cqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
+ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
+ QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
+ (elm)->field.cqe_next = (listelm); \
+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
+ if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \
+ (listelm)->field.cqe_prev = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
+ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
+ (elm)->field.cqe_next = (head)->cqh_first; \
+ (elm)->field.cqe_prev = CIRCLEQ_END(head); \
+ if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (head)->cqh_first->field.cqe_prev = (elm); \
+ (head)->cqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
+ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
+ (elm)->field.cqe_next = CIRCLEQ_END(head); \
+ (elm)->field.cqe_prev = (head)->cqh_last; \
+ if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (head)->cqh_last->field.cqe_next = (elm); \
+ (head)->cqh_last = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_REMOVE(head, elm, field) do { \
+ QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
+ QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
+ if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_last = (elm)->field.cqe_prev; \
+ else \
+ (elm)->field.cqe_next->field.cqe_prev = \
+ (elm)->field.cqe_prev; \
+ if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
+ (head)->cqh_first = (elm)->field.cqe_next; \
+ else \
+ (elm)->field.cqe_prev->field.cqe_next = \
+ (elm)->field.cqe_next; \
+ QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->cqh_first); \
+ (var) != CIRCLEQ_ENDC(head); \
+ (var) = ((var)->field.cqe_next))
+
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
+ for ((var) = ((head)->cqh_last); \
+ (var) != CIRCLEQ_ENDC(head); \
+ (var) = ((var)->field.cqe_prev))
+
+/*
+ * Circular queue access methods.
+ */
+#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
+#define CIRCLEQ_LAST(head) ((head)->cqh_last)
+/* For comparisons */
+#define CIRCLEQ_ENDC(head) (__launder_type(head))
+/* For assignments */
+#define CIRCLEQ_END(head) ((void *)(head))
+#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
+#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
+#define CIRCLEQ_EMPTY(head) \
+ (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
+ (((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
+ ? ((head)->cqh_first) \
+ : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field) \
+ (((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
+ ? ((head)->cqh_last) \
+ : (elm->field.cqe_prev))
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_QUEUE_H_ */
diff --git a/meta/recipes-core/musl/bsd-headers/sys-tree.h b/meta/recipes-core/musl/bsd-headers/sys-tree.h
new file mode 100644
index 0000000000..eaea56aae3
--- /dev/null
+++ b/meta/recipes-core/musl/bsd-headers/sys-tree.h
@@ -0,0 +1,761 @@
+/* $NetBSD: tree.h,v 1.20 2013/09/14 13:20:45 joerg Exp $ */
+/* $OpenBSD: tree.h,v 1.13 2011/07/09 00:19:45 pirofti Exp $ */
+/*
+ * Copyright 2002 Niels Provos <provos@citi.umich.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_TREE_H_
+#define _SYS_TREE_H_
+
+/*
+ * This file defines data structures for different types of trees:
+ * splay trees and red-black trees.
+ *
+ * A splay tree is a self-organizing data structure. Every operation
+ * on the tree causes a splay to happen. The splay moves the requested
+ * node to the root of the tree and partly rebalances it.
+ *
+ * This has the benefit that request locality causes faster lookups as
+ * the requested nodes move to the top of the tree. On the other hand,
+ * every lookup causes memory writes.
+ *
+ * The Balance Theorem bounds the total access time for m operations
+ * and n inserts on an initially empty tree as O((m + n)lg n). The
+ * amortized cost for a sequence of m accesses to a splay tree is O(lg n);
+ *
+ * A red-black tree is a binary search tree with the node color as an
+ * extra attribute. It fulfills a set of conditions:
+ * - every search path from the root to a leaf consists of the
+ * same number of black nodes,
+ * - each red node (except for the root) has a black parent,
+ * - each leaf node is black.
+ *
+ * Every operation on a red-black tree is bounded as O(lg n).
+ * The maximum height of a red-black tree is 2lg (n+1).
+ */
+
+#define SPLAY_HEAD(name, type) \
+struct name { \
+ struct type *sph_root; /* root of the tree */ \
+}
+
+#define SPLAY_INITIALIZER(root) \
+ { NULL }
+
+#define SPLAY_INIT(root) do { \
+ (root)->sph_root = NULL; \
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ENTRY(type) \
+struct { \
+ struct type *spe_left; /* left element */ \
+ struct type *spe_right; /* right element */ \
+}
+
+#define SPLAY_LEFT(elm, field) (elm)->field.spe_left
+#define SPLAY_RIGHT(elm, field) (elm)->field.spe_right
+#define SPLAY_ROOT(head) (head)->sph_root
+#define SPLAY_EMPTY(head) (SPLAY_ROOT(head) == NULL)
+
+/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */
+#define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \
+ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
+ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
+ (head)->sph_root = tmp; \
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ROTATE_LEFT(head, tmp, field) do { \
+ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
+ SPLAY_LEFT(tmp, field) = (head)->sph_root; \
+ (head)->sph_root = tmp; \
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKLEFT(head, tmp, field) do { \
+ SPLAY_LEFT(tmp, field) = (head)->sph_root; \
+ tmp = (head)->sph_root; \
+ (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_LINKRIGHT(head, tmp, field) do { \
+ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
+ tmp = (head)->sph_root; \
+ (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
+} while (/*CONSTCOND*/ 0)
+
+#define SPLAY_ASSEMBLE(head, node, left, right, field) do { \
+ SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
+ SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
+ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
+ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+
+#define SPLAY_PROTOTYPE(name, type, field, cmp) \
+void name##_SPLAY(struct name *, struct type *); \
+void name##_SPLAY_MINMAX(struct name *, int); \
+struct type *name##_SPLAY_INSERT(struct name *, struct type *); \
+struct type *name##_SPLAY_REMOVE(struct name *, struct type *); \
+ \
+/* Finds the node with the same key as elm */ \
+static __inline struct type * \
+name##_SPLAY_FIND(struct name *head, struct type *elm) \
+{ \
+ if (SPLAY_EMPTY(head)) \
+ return(NULL); \
+ name##_SPLAY(head, elm); \
+ if ((cmp)(elm, (head)->sph_root) == 0) \
+ return (head->sph_root); \
+ return (NULL); \
+} \
+ \
+static __inline __unused struct type * \
+name##_SPLAY_NEXT(struct name *head, struct type *elm) \
+{ \
+ name##_SPLAY(head, elm); \
+ if (SPLAY_RIGHT(elm, field) != NULL) { \
+ elm = SPLAY_RIGHT(elm, field); \
+ while (SPLAY_LEFT(elm, field) != NULL) { \
+ elm = SPLAY_LEFT(elm, field); \
+ } \
+ } else \
+ elm = NULL; \
+ return (elm); \
+} \
+ \
+static __unused __inline struct type * \
+name##_SPLAY_MIN_MAX(struct name *head, int val) \
+{ \
+ name##_SPLAY_MINMAX(head, val); \
+ return (SPLAY_ROOT(head)); \
+}
+
+/* Main splay operation.
+ * Moves node close to the key of elm to top
+ */
+#define SPLAY_GENERATE(name, type, field, cmp) \
+struct type * \
+name##_SPLAY_INSERT(struct name *head, struct type *elm) \
+{ \
+ if (SPLAY_EMPTY(head)) { \
+ SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
+ } else { \
+ int __comp; \
+ name##_SPLAY(head, elm); \
+ __comp = (cmp)(elm, (head)->sph_root); \
+ if(__comp < 0) { \
+ SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
+ SPLAY_RIGHT(elm, field) = (head)->sph_root; \
+ SPLAY_LEFT((head)->sph_root, field) = NULL; \
+ } else if (__comp > 0) { \
+ SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
+ SPLAY_LEFT(elm, field) = (head)->sph_root; \
+ SPLAY_RIGHT((head)->sph_root, field) = NULL; \
+ } else \
+ return ((head)->sph_root); \
+ } \
+ (head)->sph_root = (elm); \
+ return (NULL); \
+} \
+ \
+struct type * \
+name##_SPLAY_REMOVE(struct name *head, struct type *elm) \
+{ \
+ struct type *__tmp; \
+ if (SPLAY_EMPTY(head)) \
+ return (NULL); \
+ name##_SPLAY(head, elm); \
+ if ((cmp)(elm, (head)->sph_root) == 0) { \
+ if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \
+ (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
+ } else { \
+ __tmp = SPLAY_RIGHT((head)->sph_root, field); \
+ (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
+ name##_SPLAY(head, elm); \
+ SPLAY_RIGHT((head)->sph_root, field) = __tmp; \
+ } \
+ return (elm); \
+ } \
+ return (NULL); \
+} \
+ \
+void \
+name##_SPLAY(struct name *head, struct type *elm) \
+{ \
+ struct type __node, *__left, *__right, *__tmp; \
+ int __comp; \
+\
+ SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+ __left = __right = &__node; \
+\
+ while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \
+ if (__comp < 0) { \
+ __tmp = SPLAY_LEFT((head)->sph_root, field); \
+ if (__tmp == NULL) \
+ break; \
+ if ((cmp)(elm, __tmp) < 0){ \
+ SPLAY_ROTATE_RIGHT(head, __tmp, field); \
+ if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+ break; \
+ } \
+ SPLAY_LINKLEFT(head, __right, field); \
+ } else if (__comp > 0) { \
+ __tmp = SPLAY_RIGHT((head)->sph_root, field); \
+ if (__tmp == NULL) \
+ break; \
+ if ((cmp)(elm, __tmp) > 0){ \
+ SPLAY_ROTATE_LEFT(head, __tmp, field); \
+ if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+ break; \
+ } \
+ SPLAY_LINKRIGHT(head, __left, field); \
+ } \
+ } \
+ SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
+} \
+ \
+/* Splay with either the minimum or the maximum element \
+ * Used to find minimum or maximum element in tree. \
+ */ \
+void name##_SPLAY_MINMAX(struct name *head, int __comp) \
+{ \
+ struct type __node, *__left, *__right, *__tmp; \
+\
+ SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
+ __left = __right = &__node; \
+\
+ while (1) { \
+ if (__comp < 0) { \
+ __tmp = SPLAY_LEFT((head)->sph_root, field); \
+ if (__tmp == NULL) \
+ break; \
+ if (__comp < 0){ \
+ SPLAY_ROTATE_RIGHT(head, __tmp, field); \
+ if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
+ break; \
+ } \
+ SPLAY_LINKLEFT(head, __right, field); \
+ } else if (__comp > 0) { \
+ __tmp = SPLAY_RIGHT((head)->sph_root, field); \
+ if (__tmp == NULL) \
+ break; \
+ if (__comp > 0) { \
+ SPLAY_ROTATE_LEFT(head, __tmp, field); \
+ if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
+ break; \
+ } \
+ SPLAY_LINKRIGHT(head, __left, field); \
+ } \
+ } \
+ SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
+}
+
+#define SPLAY_NEGINF -1
+#define SPLAY_INF 1
+
+#define SPLAY_INSERT(name, x, y) name##_SPLAY_INSERT(x, y)
+#define SPLAY_REMOVE(name, x, y) name##_SPLAY_REMOVE(x, y)
+#define SPLAY_FIND(name, x, y) name##_SPLAY_FIND(x, y)
+#define SPLAY_NEXT(name, x, y) name##_SPLAY_NEXT(x, y)
+#define SPLAY_MIN(name, x) (SPLAY_EMPTY(x) ? NULL \
+ : name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))
+#define SPLAY_MAX(name, x) (SPLAY_EMPTY(x) ? NULL \
+ : name##_SPLAY_MIN_MAX(x, SPLAY_INF))
+
+#define SPLAY_FOREACH(x, name, head) \
+ for ((x) = SPLAY_MIN(name, head); \
+ (x) != NULL; \
+ (x) = SPLAY_NEXT(name, head, x))
+
+/* Macros that define a red-black tree */
+#define RB_HEAD(name, type) \
+struct name { \
+ struct type *rbh_root; /* root of the tree */ \
+}
+
+#define RB_INITIALIZER(root) \
+ { NULL }
+
+#define RB_INIT(root) do { \
+ (root)->rbh_root = NULL; \
+} while (/*CONSTCOND*/ 0)
+
+#define RB_BLACK 0
+#define RB_RED 1
+#define RB_ENTRY(type) \
+struct { \
+ struct type *rbe_left; /* left element */ \
+ struct type *rbe_right; /* right element */ \
+ struct type *rbe_parent; /* parent element */ \
+ int rbe_color; /* node color */ \
+}
+
+#define RB_LEFT(elm, field) (elm)->field.rbe_left
+#define RB_RIGHT(elm, field) (elm)->field.rbe_right
+#define RB_PARENT(elm, field) (elm)->field.rbe_parent
+#define RB_COLOR(elm, field) (elm)->field.rbe_color
+#define RB_ROOT(head) (head)->rbh_root
+#define RB_EMPTY(head) (RB_ROOT(head) == NULL)
+
+#define RB_SET(elm, parent, field) do { \
+ RB_PARENT(elm, field) = parent; \
+ RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
+ RB_COLOR(elm, field) = RB_RED; \
+} while (/*CONSTCOND*/ 0)
+
+#define RB_SET_BLACKRED(black, red, field) do { \
+ RB_COLOR(black, field) = RB_BLACK; \
+ RB_COLOR(red, field) = RB_RED; \
+} while (/*CONSTCOND*/ 0)
+
+#ifndef RB_AUGMENT
+#define RB_AUGMENT(x) do {} while (/*CONSTCOND*/ 0)
+#endif
+
+#define RB_ROTATE_LEFT(head, elm, tmp, field) do { \
+ (tmp) = RB_RIGHT(elm, field); \
+ if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \
+ RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
+ } \
+ RB_AUGMENT(elm); \
+ if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
+ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
+ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
+ else \
+ RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
+ } else \
+ (head)->rbh_root = (tmp); \
+ RB_LEFT(tmp, field) = (elm); \
+ RB_PARENT(elm, field) = (tmp); \
+ RB_AUGMENT(tmp); \
+ if ((RB_PARENT(tmp, field))) \
+ RB_AUGMENT(RB_PARENT(tmp, field)); \
+} while (/*CONSTCOND*/ 0)
+
+#define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \
+ (tmp) = RB_LEFT(elm, field); \
+ if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
+ RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
+ } \
+ RB_AUGMENT(elm); \
+ if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \
+ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
+ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
+ else \
+ RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
+ } else \
+ (head)->rbh_root = (tmp); \
+ RB_RIGHT(tmp, field) = (elm); \
+ RB_PARENT(elm, field) = (tmp); \
+ RB_AUGMENT(tmp); \
+ if ((RB_PARENT(tmp, field))) \
+ RB_AUGMENT(RB_PARENT(tmp, field)); \
+} while (/*CONSTCOND*/ 0)
+
+/* Generates prototypes and inline functions */
+#define RB_PROTOTYPE(name, type, field, cmp) \
+ RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \
+ RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *); \
+attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
+attr struct type *name##_RB_REMOVE(struct name *, struct type *); \
+attr struct type *name##_RB_INSERT(struct name *, struct type *); \
+attr struct type *name##_RB_FIND(struct name *, struct type *); \
+attr struct type *name##_RB_NFIND(struct name *, struct type *); \
+attr struct type *name##_RB_NEXT(struct type *); \
+attr struct type *name##_RB_PREV(struct type *); \
+attr struct type *name##_RB_MINMAX(struct name *, int); \
+ \
+
+/* Main rb operation.
+ * Moves node close to the key of elm to top
+ */
+#define RB_GENERATE(name, type, field, cmp) \
+ RB_GENERATE_INTERNAL(name, type, field, cmp,)
+#define RB_GENERATE_STATIC(name, type, field, cmp) \
+ RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \
+attr void \
+name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \
+{ \
+ struct type *parent, *gparent, *tmp; \
+ while ((parent = RB_PARENT(elm, field)) != NULL && \
+ RB_COLOR(parent, field) == RB_RED) { \
+ gparent = RB_PARENT(parent, field); \
+ if (parent == RB_LEFT(gparent, field)) { \
+ tmp = RB_RIGHT(gparent, field); \
+ if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
+ RB_COLOR(tmp, field) = RB_BLACK; \
+ RB_SET_BLACKRED(parent, gparent, field);\
+ elm = gparent; \
+ continue; \
+ } \
+ if (RB_RIGHT(parent, field) == elm) { \
+ RB_ROTATE_LEFT(head, parent, tmp, field);\
+ tmp = parent; \
+ parent = elm; \
+ elm = tmp; \
+ } \
+ RB_SET_BLACKRED(parent, gparent, field); \
+ RB_ROTATE_RIGHT(head, gparent, tmp, field); \
+ } else { \
+ tmp = RB_LEFT(gparent, field); \
+ if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
+ RB_COLOR(tmp, field) = RB_BLACK; \
+ RB_SET_BLACKRED(parent, gparent, field);\
+ elm = gparent; \
+ continue; \
+ } \
+ if (RB_LEFT(parent, field) == elm) { \
+ RB_ROTATE_RIGHT(head, parent, tmp, field);\
+ tmp = parent; \
+ parent = elm; \
+ elm = tmp; \
+ } \
+ RB_SET_BLACKRED(parent, gparent, field); \
+ RB_ROTATE_LEFT(head, gparent, tmp, field); \
+ } \
+ } \
+ RB_COLOR(head->rbh_root, field) = RB_BLACK; \
+} \
+ \
+attr void \
+name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
+{ \
+ struct type *tmp; \
+ while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
+ elm != RB_ROOT(head)) { \
+ if (RB_LEFT(parent, field) == elm) { \
+ tmp = RB_RIGHT(parent, field); \
+ if (RB_COLOR(tmp, field) == RB_RED) { \
+ RB_SET_BLACKRED(tmp, parent, field); \
+ RB_ROTATE_LEFT(head, parent, tmp, field);\
+ tmp = RB_RIGHT(parent, field); \
+ } \
+ if ((RB_LEFT(tmp, field) == NULL || \
+ RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+ (RB_RIGHT(tmp, field) == NULL || \
+ RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+ RB_COLOR(tmp, field) = RB_RED; \
+ elm = parent; \
+ parent = RB_PARENT(elm, field); \
+ } else { \
+ if (RB_RIGHT(tmp, field) == NULL || \
+ RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
+ struct type *oleft; \
+ if ((oleft = RB_LEFT(tmp, field)) \
+ != NULL) \
+ RB_COLOR(oleft, field) = RB_BLACK;\
+ RB_COLOR(tmp, field) = RB_RED; \
+ RB_ROTATE_RIGHT(head, tmp, oleft, field);\
+ tmp = RB_RIGHT(parent, field); \
+ } \
+ RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+ RB_COLOR(parent, field) = RB_BLACK; \
+ if (RB_RIGHT(tmp, field)) \
+ RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
+ RB_ROTATE_LEFT(head, parent, tmp, field);\
+ elm = RB_ROOT(head); \
+ break; \
+ } \
+ } else { \
+ tmp = RB_LEFT(parent, field); \
+ if (RB_COLOR(tmp, field) == RB_RED) { \
+ RB_SET_BLACKRED(tmp, parent, field); \
+ RB_ROTATE_RIGHT(head, parent, tmp, field);\
+ tmp = RB_LEFT(parent, field); \
+ } \
+ if ((RB_LEFT(tmp, field) == NULL || \
+ RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
+ (RB_RIGHT(tmp, field) == NULL || \
+ RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
+ RB_COLOR(tmp, field) = RB_RED; \
+ elm = parent; \
+ parent = RB_PARENT(elm, field); \
+ } else { \
+ if (RB_LEFT(tmp, field) == NULL || \
+ RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
+ struct type *oright; \
+ if ((oright = RB_RIGHT(tmp, field)) \
+ != NULL) \
+ RB_COLOR(oright, field) = RB_BLACK;\
+ RB_COLOR(tmp, field) = RB_RED; \
+ RB_ROTATE_LEFT(head, tmp, oright, field);\
+ tmp = RB_LEFT(parent, field); \
+ } \
+ RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
+ RB_COLOR(parent, field) = RB_BLACK; \
+ if (RB_LEFT(tmp, field)) \
+ RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
+ RB_ROTATE_RIGHT(head, parent, tmp, field);\
+ elm = RB_ROOT(head); \
+ break; \
+ } \
+ } \
+ } \
+ if (elm) \
+ RB_COLOR(elm, field) = RB_BLACK; \
+} \
+ \
+attr struct type * \
+name##_RB_REMOVE(struct name *head, struct type *elm) \
+{ \
+ struct type *child, *parent, *old = elm; \
+ int color; \
+ if (RB_LEFT(elm, field) == NULL) \
+ child = RB_RIGHT(elm, field); \
+ else if (RB_RIGHT(elm, field) == NULL) \
+ child = RB_LEFT(elm, field); \
+ else { \
+ struct type *left; \
+ elm = RB_RIGHT(elm, field); \
+ while ((left = RB_LEFT(elm, field)) != NULL) \
+ elm = left; \
+ child = RB_RIGHT(elm, field); \
+ parent = RB_PARENT(elm, field); \
+ color = RB_COLOR(elm, field); \
+ if (child) \
+ RB_PARENT(child, field) = parent; \
+ if (parent) { \
+ if (RB_LEFT(parent, field) == elm) \
+ RB_LEFT(parent, field) = child; \
+ else \
+ RB_RIGHT(parent, field) = child; \
+ RB_AUGMENT(parent); \
+ } else \
+ RB_ROOT(head) = child; \
+ if (RB_PARENT(elm, field) == old) \
+ parent = elm; \
+ (elm)->field = (old)->field; \
+ if (RB_PARENT(old, field)) { \
+ if (RB_LEFT(RB_PARENT(old, field), field) == old)\
+ RB_LEFT(RB_PARENT(old, field), field) = elm;\
+ else \
+ RB_RIGHT(RB_PARENT(old, field), field) = elm;\
+ RB_AUGMENT(RB_PARENT(old, field)); \
+ } else \
+ RB_ROOT(head) = elm; \
+ RB_PARENT(RB_LEFT(old, field), field) = elm; \
+ if (RB_RIGHT(old, field)) \
+ RB_PARENT(RB_RIGHT(old, field), field) = elm; \
+ if (parent) { \
+ left = parent; \
+ do { \
+ RB_AUGMENT(left); \
+ } while ((left = RB_PARENT(left, field)) != NULL); \
+ } \
+ goto color; \
+ } \
+ parent = RB_PARENT(elm, field); \
+ color = RB_COLOR(elm, field); \
+ if (child) \
+ RB_PARENT(child, field) = parent; \
+ if (parent) { \
+ if (RB_LEFT(parent, field) == elm) \
+ RB_LEFT(parent, field) = child; \
+ else \
+ RB_RIGHT(parent, field) = child; \
+ RB_AUGMENT(parent); \
+ } else \
+ RB_ROOT(head) = child; \
+color: \
+ if (color == RB_BLACK) \
+ name##_RB_REMOVE_COLOR(head, parent, child); \
+ return (old); \
+} \
+ \
+/* Inserts a node into the RB tree */ \
+attr struct type * \
+name##_RB_INSERT(struct name *head, struct type *elm) \
+{ \
+ struct type *tmp; \
+ struct type *parent = NULL; \
+ int comp = 0; \
+ tmp = RB_ROOT(head); \
+ while (tmp) { \
+ parent = tmp; \
+ comp = (cmp)(elm, parent); \
+ if (comp < 0) \
+ tmp = RB_LEFT(tmp, field); \
+ else if (comp > 0) \
+ tmp = RB_RIGHT(tmp, field); \
+ else \
+ return (tmp); \
+ } \
+ RB_SET(elm, parent, field); \
+ if (parent != NULL) { \
+ if (comp < 0) \
+ RB_LEFT(parent, field) = elm; \
+ else \
+ RB_RIGHT(parent, field) = elm; \
+ RB_AUGMENT(parent); \
+ } else \
+ RB_ROOT(head) = elm; \
+ name##_RB_INSERT_COLOR(head, elm); \
+ return (NULL); \
+} \
+ \
+/* Finds the node with the same key as elm */ \
+attr struct type * \
+name##_RB_FIND(struct name *head, struct type *elm) \
+{ \
+ struct type *tmp = RB_ROOT(head); \
+ int comp; \
+ while (tmp) { \
+ comp = cmp(elm, tmp); \
+ if (comp < 0) \
+ tmp = RB_LEFT(tmp, field); \
+ else if (comp > 0) \
+ tmp = RB_RIGHT(tmp, field); \
+ else \
+ return (tmp); \
+ } \
+ return (NULL); \
+} \
+ \
+/* Finds the first node greater than or equal to the search key */ \
+attr struct type * \
+name##_RB_NFIND(struct name *head, struct type *elm) \
+{ \
+ struct type *tmp = RB_ROOT(head); \
+ struct type *res = NULL; \
+ int comp; \
+ while (tmp) { \
+ comp = cmp(elm, tmp); \
+ if (comp < 0) { \
+ res = tmp; \
+ tmp = RB_LEFT(tmp, field); \
+ } \
+ else if (comp > 0) \
+ tmp = RB_RIGHT(tmp, field); \
+ else \
+ return (tmp); \
+ } \
+ return (res); \
+} \
+ \
+/* ARGSUSED */ \
+attr struct type * \
+name##_RB_NEXT(struct type *elm) \
+{ \
+ if (RB_RIGHT(elm, field)) { \
+ elm = RB_RIGHT(elm, field); \
+ while (RB_LEFT(elm, field)) \
+ elm = RB_LEFT(elm, field); \
+ } else { \
+ if (RB_PARENT(elm, field) && \
+ (elm == RB_LEFT(RB_PARENT(elm, field), field))) \
+ elm = RB_PARENT(elm, field); \
+ else { \
+ while (RB_PARENT(elm, field) && \
+ (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
+ elm = RB_PARENT(elm, field); \
+ elm = RB_PARENT(elm, field); \
+ } \
+ } \
+ return (elm); \
+} \
+ \
+/* ARGSUSED */ \
+attr struct type * \
+name##_RB_PREV(struct type *elm) \
+{ \
+ if (RB_LEFT(elm, field)) { \
+ elm = RB_LEFT(elm, field); \
+ while (RB_RIGHT(elm, field)) \
+ elm = RB_RIGHT(elm, field); \
+ } else { \
+ if (RB_PARENT(elm, field) && \
+ (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
+ elm = RB_PARENT(elm, field); \
+ else { \
+ while (RB_PARENT(elm, field) && \
+ (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
+ elm = RB_PARENT(elm, field); \
+ elm = RB_PARENT(elm, field); \
+ } \
+ } \
+ return (elm); \
+} \
+ \
+attr struct type * \
+name##_RB_MINMAX(struct name *head, int val) \
+{ \
+ struct type *tmp = RB_ROOT(head); \
+ struct type *parent = NULL; \
+ while (tmp) { \
+ parent = tmp; \
+ if (val < 0) \
+ tmp = RB_LEFT(tmp, field); \
+ else \
+ tmp = RB_RIGHT(tmp, field); \
+ } \
+ return (parent); \
+}
+
+#define RB_NEGINF -1
+#define RB_INF 1
+
+#define RB_INSERT(name, x, y) name##_RB_INSERT(x, y)
+#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
+#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
+#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
+#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
+#define RB_PREV(name, x, y) name##_RB_PREV(y)
+#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
+#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)
+
+#define RB_FOREACH(x, name, head) \
+ for ((x) = RB_MIN(name, head); \
+ (x) != NULL; \
+ (x) = name##_RB_NEXT(x))
+
+#define RB_FOREACH_FROM(x, name, y) \
+ for ((x) = (y); \
+ ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
+ (x) = (y))
+
+#define RB_FOREACH_SAFE(x, name, head, y) \
+ for ((x) = RB_MIN(name, head); \
+ ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \
+ (x) = (y))
+
+#define RB_FOREACH_REVERSE(x, name, head) \
+ for ((x) = RB_MAX(name, head); \
+ (x) != NULL; \
+ (x) = name##_RB_PREV(x))
+
+#define RB_FOREACH_REVERSE_FROM(x, name, y) \
+ for ((x) = (y); \
+ ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
+ (x) = (y))
+
+#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \
+ for ((x) = RB_MAX(name, head); \
+ ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \
+ (x) = (y))
+
+#endif /* _SYS_TREE_H_ */
diff --git a/meta/recipes-core/musl/gcompat_git.bb b/meta/recipes-core/musl/gcompat_git.bb
new file mode 100644
index 0000000000..6e5cc11d5d
--- /dev/null
+++ b/meta/recipes-core/musl/gcompat_git.bb
@@ -0,0 +1,54 @@
+# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "A library which provides glibc-compatible APIs for use on musl libc systems"
+HOMEPAGE = "https://git.adelielinux.org/adelie/gcompat"
+
+LICENSE = "NCSA"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=eb33ef4af05a9c7602843afb7adfe792"
+
+SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current"
+
+PV = "1.0.0+1.1+git${SRCPV}"
+SRCREV = "af5a49e489fdc04b9cf02547650d7aeaccd43793"
+
+S = "${WORKDIR}/git"
+
+inherit pkgconfig linuxloader siteinfo
+
+DEPENDS += "musl-obstack"
+
+GLIBC_LDSO = "${@get_glibc_loader(d)}"
+MUSL_LDSO = "${@get_musl_loader(d)}"
+
+EXTRA_OEMAKE = "LINKER_PATH=${MUSL_LDSO} \
+ LOADER_NAME=`basename ${GLIBC_LDSO}` \
+ "
+
+do_configure () {
+ :
+}
+
+do_compile () {
+ oe_runmake
+}
+
+do_install () {
+ oe_runmake install 'DESTDIR=${D}'
+ if [ "${SITEINFO_BITS}" = "64" ]; then
+ install -d ${D}/lib64
+ lnr ${D}${GLIBC_LDSO} ${D}/lib64/`basename ${GLIBC_LDSO}`
+ fi
+}
+
+FILES:${PN} += "/lib64"
+
+INSANE_SKIP:${PN} = "libdir"
+
+RPROVIDES:${PN} += "musl-glibc-compat"
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+
+UPSTREAM_CHECK_COMMITS = "1"
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
new file mode 100644
index 0000000000..748dacf312
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -0,0 +1,35 @@
+# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "file://stack_chk.c;beginline=1;endline=30;md5=97e59d9deee678a9332c9ddb2ab6360d"
+SECTION = "libs"
+
+# Sourced from https://github.com/intel/linux-sgx/blob/master/sdk/compiler-rt/stack_chk.c
+SRC_URI = "file://stack_chk.c"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils \
+ virtual/${TARGET_PREFIX}gcc \
+"
+
+do_configure[noexec] = "1"
+
+S = "${WORKDIR}"
+
+do_compile() {
+ ${CC} ${CPPFLAGS} ${CFLAGS} -fPIE -c stack_chk.c -o stack_chk.o
+ ${AR} r libssp_nonshared.a stack_chk.o
+}
+do_install() {
+ install -Dm 0644 ${B}/libssp_nonshared.a ${D}${base_libdir}/libssp_nonshared.a
+}
+#
+# We will skip parsing for non-musl systems
+#
+COMPATIBLE_HOST = ".*-musl.*"
+RDEPENDS:${PN}-staticdev = ""
+RDEPENDS:${PN}-dev = ""
+RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/libssp-nonshared/stack_chk.c b/meta/recipes-core/musl/libssp-nonshared/stack_chk.c
new file mode 100644
index 0000000000..097aae24b6
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared/stack_chk.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011-2021 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+extern void __attribute__((noreturn)) __stack_chk_fail(void);
+
+void
+__attribute__((noreturn))
+__attribute__((visibility ("hidden")))
+__stack_chk_fail_local (void)
+{
+ __stack_chk_fail ();
+}
diff --git a/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch b/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch
new file mode 100644
index 0000000000..1fdc9f739d
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch
@@ -0,0 +1,49 @@
+From a530eed9e7e6872e10fe92efaf1e9739471c30ca Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 30 May 2021 08:30:28 -0700
+Subject: [PATCH] meson: Add option to pass cpu
+
+This helps with cross compile setups, where host_cpu != target_cpu
+therefore detecting it on the fly will end up with wrong cpu to build
+for
+
+Upstream-Status: Submitted [https://github.com/kaniini/libucontext/pull/28]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ meson.build | 6 +++++-
+ meson_options.txt | 4 +++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index e863780..2b4bdbd 100644
+--- a/meson.build
++++ b/meson.build
+@@ -6,7 +6,11 @@ project(
+ version : run_command('head', files('VERSION')).stdout()
+ )
+
+-cpu = host_machine.cpu_family()
++cpu = get_option('cpu')
++if cpu == ''
++ cpu = host_machine.cpu_family()
++endif
++
+ if cpu == 'sh4'
+ cpu = 'sh'
+ endif
+diff --git a/meson_options.txt b/meson_options.txt
+index d4201d1..864d83c 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,4 +1,6 @@
+ option('freestanding', type : 'boolean', value : false,
+ description: 'Do not use system headers')
+ option('export_unprefixed', type : 'boolean', value : true,
+- description: 'Export POSIX 2004 ucontext names as alises')
+\ No newline at end of file
++ description: 'Export POSIX 2004 ucontext names as alises')
++option('cpu', type : 'string', value : '',
++ description: 'Target CPU architecture for cross compile')
+--
+2.31.1
+
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_git.bb
new file mode 100644
index 0000000000..1a8d1c4b21
--- /dev/null
+++ b/meta/recipes-core/musl/libucontext_git.bb
@@ -0,0 +1,54 @@
+# Copyright (C) 2019 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "ucontext implementation featuring glibc-compatible ABI"
+HOMEPAGE = "https://github.com/kaniini/libucontext"
+LICENSE = "ISC"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=6eed01fa0e673c76f5a5715438f65b1d"
+SECTION = "libs"
+DEPENDS = ""
+
+PV = "1.1+${SRCPV}"
+SRCREV = "335ee864ef6f4a5d4b525453fd9dbfb3507cfecc"
+SRC_URI = "git://github.com/kaniini/libucontext;branch=master \
+ file://0001-meson-Add-option-to-pass-cpu.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
+valid_archs = " \
+ x86 x86_64 \
+ ppc ppc64 \
+ mips mips64 \
+ arm aarch64 \
+ s390x \
+"
+
+def map_kernel_arch(a, d):
+ import re
+
+ valid_archs = d.getVar('valid_archs').split()
+
+ if a in valid_archs: return a
+ elif re.match('(i.86|athlon)$', a): return 'x86'
+ elif re.match('x86.64$', a): return 'x86_64'
+ elif re.match('armeb$', a): return 'arm'
+ elif re.match('aarch64$', a): return 'aarch64'
+ elif re.match('aarch64_be$', a): return 'aarch64'
+ elif re.match('aarch64_ilp32$', a): return 'aarch64'
+ elif re.match('aarch64_be_ilp32$', a): return 'aarch64'
+ elif re.match('mips(isa|)(32|)(r6|)(el|)$', a): return 'mips'
+ elif re.match('mips(isa|)64(r6|)(el|)$', a): return 'mips64'
+ elif re.match('p(pc64|owerpc64)(le)', a): return 'ppc64'
+ elif re.match('p(pc|owerpc)', a): return 'ppc'
+ elif re.match('riscv64$', a): return 'riscv64'
+ elif re.match('riscv32$', a): return 'riscv32'
+ else:
+ if not d.getVar("TARGET_OS").startswith("linux"):
+ return a
+ bb.error("cannot map '%s' to a linux kernel architecture" % a)
+
+EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
+inherit meson
diff --git a/meta/recipes-core/musl/musl-obstack.bb b/meta/recipes-core/musl/musl-obstack.bb
new file mode 100644
index 0000000000..3748047496
--- /dev/null
+++ b/meta/recipes-core/musl/musl-obstack.bb
@@ -0,0 +1,22 @@
+# Copyright (C) 2019 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "A standalone library to implement GNU libc's obstack"
+DESCRIPTION = "copy + paste of the obstack functions and macros found in GNU gcc libiberty library for use with musl libc"
+HOMEPAGE = "https://github.com/pullmoll/musl-obstack"
+LICENSE = "GPL-2.0+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3d23e4eef8243efcaab6f0a438078932"
+SECTION = "libs"
+
+PV = "1.1"
+SRCREV = "d2ad66b0df44a4b784956f7f7f2717131ddc05f4"
+SRC_URI = "git://github.com/pullmoll/musl-obstack;branch=master"
+
+UPSTREAM_CHECK_COMMITS = "1"
+
+inherit autotools pkgconfig
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
diff --git a/meta/recipes-core/musl/musl-utils.bb b/meta/recipes-core/musl/musl-utils.bb
new file mode 100644
index 0000000000..fa49d1da04
--- /dev/null
+++ b/meta/recipes-core/musl/musl-utils.bb
@@ -0,0 +1,27 @@
+# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "getconf, getent and iconv implementations for musl"
+HOMEPAGE = "https://git.alpinelinux.org/cgit/aports/tree/main/musl"
+LICENSE = "BSD-2-Clause & GPL-2.0+"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9d08215e611db87b357e8674b4b42564"
+SECTION = "utils"
+
+# Date of the commit in SRCREV
+PV = "20170421"
+
+SRCREV = "fb5630138ccabbbc14a19d372096a04e42573c7d"
+SRC_URI = "git://github.com/boltlinux/musl-utils;branch=master"
+
+UPSTREAM_CHECK_COMMITS = "1"
+
+inherit autotools
+
+S = "${WORKDIR}/git"
+
+PACKAGES =+ "${PN}-iconv"
+
+FILES:${PN}-iconv = "${bindir}/iconv"
+
+COMPATIBLE_HOST = ".*-musl.*"
+
diff --git a/meta/recipes-core/musl/musl.inc b/meta/recipes-core/musl/musl.inc
new file mode 100644
index 0000000000..66468e92ff
--- /dev/null
+++ b/meta/recipes-core/musl/musl.inc
@@ -0,0 +1,31 @@
+# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+SUMMARY = "An implementation of the standard library for Linux-based systems"
+DESCRIPTION = "A new standard library to power a new generation of Linux-based devices. \
+musl is lightweight, fast, simple, free, and strives to be correct in the sense of \
+standards-conformance and safety."
+
+HOMEPAGE = "http://www.musl-libc.org/"
+LICENSE = "MIT"
+SECTION = "libs"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=b03f1cc25363d094011f8f4fd8bcfb68"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+FILES_SOLIBSDEV = ""
+FILES:${PN} += "${libdir}/lib*${SOLIBSDEV}"
+INSANE_SKIP:${PN} = "dev-so"
+
+# Doesn't compile in MIPS16e mode due to use of hand-written
+# assembly
+MIPS_INSTRUCTION_SET = "mips"
+
+# thumb1 is unsupported
+ARM_INSTRUCTION_SET:armv5 = "arm"
+ARM_INSTRUCTION_SET:armv4 = "arm"
+
+# Enable out of tree build
+B = "${WORKDIR}/build"
+
+do_configure[cleandirs] = "${B}"
diff --git a/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch b/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
new file mode 100644
index 0000000000..ba00efe7b3
--- /dev/null
+++ b/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
@@ -0,0 +1,69 @@
+From 0ec74744a4cba7c5fdfaa2685995119a4fca0260 Mon Sep 17 00:00:00 2001
+From: Amarnath Valluri <amarnath.valluri@intel.com>
+Date: Wed, 18 Jan 2017 16:14:37 +0200
+Subject: [PATCH] Make dynamic linker a relative symlink to libc
+
+absolute symlink into $(libdir) fails to load in a cross build
+environment, especially when executing qemu in usermode to run target
+applications, which cross build systems often do, since not everything
+can be computed during cross builds, qemu in usermode often comes to aid
+in such situations to feed into cross builds.
+
+V2:
+ Make use of 'ln -r' to create relative symlinks, as most fo the distros
+ shipping coreutils 8.16+
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
+---
+Upstream-Status: Pending
+---
+ Makefile | 2 +-
+ tools/install.sh | 8 +++++---
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc
+ $(INSTALL) -D -m 644 $< $@
+
+ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
+- $(INSTALL) -D -l $(libdir)/libc.so $@ || true
++ $(INSTALL) -D -r $(DESTDIR)$(libdir)/libc.so $@ || true
+
+ install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+
+--- a/tools/install.sh
++++ b/tools/install.sh
+@@ -6,18 +6,20 @@
+ #
+
+ usage() {
+-printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2
++printf "usage: %s [-D] [-l] [-r] [-m mode] src dest\n" "$0" 1>&2
+ exit 1
+ }
+
+ mkdirp=
+ symlink=
++symlinkflags="-s"
+ mode=755
+
+-while getopts Dlm: name ; do
++while getopts Dlrm: name ; do
+ case "$name" in
+ D) mkdirp=yes ;;
+ l) symlink=yes ;;
++r) symlink=yes; symlinkflags="$symlinkflags -r" ;;
+ m) mode=$OPTARG ;;
+ ?) usage ;;
+ esac
+@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM H
+ umask 077
+
+ if test "$symlink" ; then
+-ln -s "$1" "$tmp"
++ln $symlinkflags "$1" "$tmp"
+ else
+ cat < "$1" > "$tmp"
+ chmod "$mode" "$tmp"
diff --git a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
new file mode 100644
index 0000000000..0aeb5eb5c2
--- /dev/null
+++ b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
@@ -0,0 +1,54 @@
+From 5a2886f81dbca3f2ed28eebe7d27d471da278db8 Mon Sep 17 00:00:00 2001
+From: Serhey Popovych <serhe.popovych@gmail.com>
+Date: Tue, 11 Dec 2018 05:44:20 -0500
+Subject: [PATCH] ldso: Use syslibdir and libdir as default pathes to libdirs
+
+In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search
+libraries /lib:/usr/local/lib:/usr/lib.
+
+However this path isn't relevant in case when library is put in dirs
+like lib64 or libx32.
+
+Adjust CFLAGS_ALL to pass syslibdir as SYSLIBDIR and libdir as LIBDIR
+preprocessor macroses to construct default ldso library search path
+in ldso/dynlink.c::SYS_PATH_DFLT.
+
+Upstream-Status: Pending
+Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
+---
+ Makefile | 3 ++-
+ ldso/dynlink.c | 4 +++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+--- a/Makefile
++++ b/Makefile
+@@ -47,7 +47,8 @@ CFLAGS_AUTO = -Os -pipe
+ CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
+
+ CFLAGS_ALL = $(CFLAGS_C99FSE)
+-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
++CFLAGS_ALL += -D_XOPEN_SOURCE=700 -DSYSLIBDIR='"$(syslibdir)"' -DLIBDIR='"$(libdir)"'
++CFLAGS_ALL += -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/include -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
+ CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
+
+ LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
+--- a/ldso/dynlink.c
++++ b/ldso/dynlink.c
+@@ -29,6 +29,8 @@
+ #define realloc __libc_realloc
+ #define free __libc_free
+
++#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR
++
+ static void error(const char *, ...);
+
+ #define MAXP2(a,b) (-(-(a)&-(b)))
+@@ -1094,7 +1096,7 @@ static struct dso *load_library(const ch
+ sys_path = "";
+ }
+ }
+- if (!sys_path) sys_path = "/lib:/usr/local/lib:/usr/lib";
++ if (!sys_path) sys_path = SYS_PATH_DFLT;
+ fd = path_open(name, sys_path, buf, sizeof buf);
+ }
+ pathname = buf;
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
new file mode 100644
index 0000000000..03ab0a449f
--- /dev/null
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -0,0 +1,87 @@
+# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+require musl.inc
+inherit linuxloader
+
+SRCREV = "b76f37fd5625d038141b52184956fb4b7838e9a5"
+
+BASEVER = "1.2.2"
+
+PV = "${BASEVER}+git${SRCPV}"
+
+# mirror is at git://github.com/kraj/musl.git
+
+SRC_URI = "git://git.musl-libc.org/musl;branch=master \
+ file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
+ file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
+ "
+
+S = "${WORKDIR}/git"
+
+PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"
+
+DEPENDS = "virtual/${TARGET_PREFIX}binutils \
+ virtual/${TARGET_PREFIX}gcc \
+ libgcc-initial \
+ linux-libc-headers \
+ bsd-headers \
+ libssp-nonshared \
+ "
+GLIBC_LDSO = "${@get_glibc_loader(d)}"
+MUSL_LDSO_ARCH = "${@get_musl_loader_arch(d)}"
+
+export CROSS_COMPILE="${TARGET_PREFIX}"
+
+LDFLAGS += "-Wl,-soname,libc.so"
+
+# When compiling for Thumb or Thumb2, frame pointers _must_ be disabled since the
+# Thumb frame pointer in r7 clashes with musl's use of inline asm to make syscalls
+# (where r7 is used for the syscall NR). In most cases, frame pointers will be
+# disabled automatically due to the optimisation level, but append an explicit
+# -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame
+# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.
+CFLAGS:append:arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
+
+CONFIGUREOPTS = " \
+ --prefix=${prefix} \
+ --exec-prefix=${exec_prefix} \
+ --bindir=${bindir} \
+ --libdir=${libdir} \
+ --includedir=${includedir} \
+ --syslibdir=/lib \
+"
+
+do_configure() {
+ ${S}/configure ${CONFIGUREOPTS}
+}
+
+do_compile() {
+ oe_runmake
+}
+
+do_install() {
+ oe_runmake install DESTDIR='${D}'
+ install -d ${D}${bindir} ${D}/lib ${D}${sysconfdir}
+ echo "${base_libdir}" > ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path
+ echo "${libdir}" >> ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path
+ rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
+ lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd
+}
+
+FILES:${PN} += "/lib/ld-musl-${MUSL_LDSO_ARCH}.so.1 ${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path"
+FILES:${PN}-staticdev = "${libdir}/libc.a"
+FILES:${PN}-dev =+ "${libdir}/libcrypt.a ${libdir}/libdl.a ${libdir}/libm.a \
+ ${libdir}/libpthread.a ${libdir}/libresolv.a \
+ ${libdir}/librt.a ${libdir}/libutil.a ${libdir}/libxnet.a \
+ "
+
+RDEPENDS:${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev"
+RPROVIDES:${PN}-dev += "libc-dev virtual-libc-dev"
+RPROVIDES:${PN} += "ldd libsegfault rtld(GNU_HASH)"
+
+LEAD_SONAME = "libc.so"
+INSANE_SKIP:${PN}-dev = "staticdev"
+INSANE_SKIP:${PN} = "libdir"
+
+UPSTREAM_CHECK_COMMITS = "1"
diff --git a/meta/recipes-core/ncurses/files/0001-tic-hang.patch b/meta/recipes-core/ncurses/files/0001-tic-hang.patch
new file mode 100644
index 0000000000..f98a943e5c
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/0001-tic-hang.patch
@@ -0,0 +1,43 @@
+From 168ba7a681be73ac024438e33e14fde1d5aea97d Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Fri, 30 Mar 2018 10:02:24 +0800
+Subject: [PATCH 1/2] tic hang
+
+Upstream-Status: Inappropriate [configuration]
+
+'tic' of some linux distributions (e.g. fedora 11) hang in an infinite
+loop when processing the original file.
+
+Signed-off-by: anonymous
+
+Rebase to 6.1
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ misc/terminfo.src | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/misc/terminfo.src b/misc/terminfo.src
+index 84f4810..6b385ec 100644
+--- a/misc/terminfo.src
++++ b/misc/terminfo.src
+@@ -5562,12 +5562,11 @@ konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm,
+ # The value for kbs (see konsole-vt100) reflects local customization rather
+ # than the settings used for XFree86 xterm.
+ konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm,
+- kend=\EOF, khome=\EOH, use=konsole+pcfkeys,
+- use=konsole-vt100,
+-
+-konsole+pcfkeys|konsole subset of xterm+pcfkeys,
+- kcbt=\E[Z, use=xterm+pcc2, use=xterm+pcf0,
+- use=xterm+pce2,
++ kend=\EOF, kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R,
++ kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~,
++ kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~,
++ kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR, kf4=\EOS,
++ khome=\EOH, use=konsole-vt100,
+
+ # Obsolete: vt100.keymap
+ # KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but
+--
+1.8.3.1
+
diff --git a/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch b/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch
new file mode 100644
index 0000000000..66f26c06ab
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/0002-configure-reproducible.patch
@@ -0,0 +1,33 @@
+From ec87e53066a9942e9aaba817d71268342f5e83b9 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Wed, 16 Aug 2017 14:45:27 +0800
+Subject: [PATCH] configure: reproducible
+
+"configure" enforces -U for ar flags, breaking deterministic builds.
+The flag was added to fix some vaguely specified "recent POSIX binutil
+build problems" in 2015.
+
+Upstream-Status: Pending
+Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
+
+Rebase to 6.1
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
+---
+ configure | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure b/configure
+index 421cf859..a1b7840d 100755
+--- a/configure
++++ b/configure
+@@ -5072,7 +5072,7 @@ else
+ ;;
+ (*)
+ cf_cv_ar_flags=unknown
+- for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv
++ for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
+ do
+
+ # check if $ARFLAGS already contains this choice
diff --git a/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch b/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch
new file mode 100644
index 0000000000..a15694d4d4
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch
@@ -0,0 +1,30 @@
+From 10cd0c12a6e14fb4f0498c299c1dd32720b710da Mon Sep 17 00:00:00 2001
+From: Nathan Rossi <nathan@nathanrossi.com>
+Date: Mon, 14 Dec 2020 13:39:02 +1000
+Subject: [PATCH] gen-pkgconfig.in: Do not include LDFLAGS in generated pc
+ files
+
+Including the LDFLAGS in the pkgconfig output is problematic as OE
+includes build host specific paths and options (e.g. uninative and
+'-Wl,--dynamic-linker=').
+
+Upstream-Status: Inappropriate [OE Specific]
+Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
+
+---
+ misc/gen-pkgconfig.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/misc/gen-pkgconfig.in b/misc/gen-pkgconfig.in
+index a45dd54f..85273054 100644
+--- a/misc/gen-pkgconfig.in
++++ b/misc/gen-pkgconfig.in
+@@ -83,7 +83,7 @@ if [ "$includedir" != "/usr/include" ]; then
+ fi
+
+ lib_flags=
+-for opt in -L$libdir @EXTRA_PKG_LDFLAGS@ @LIBS@
++for opt in -L$libdir @LIBS@
+ do
+ case $opt in
+ -l*) # LIBS is handled specially below
diff --git a/meta/recipes-core/ncurses/ncurses-5.9/config.cache b/meta/recipes-core/ncurses/ncurses-5.9/config.cache
deleted file mode 100644
index 6a9217d5bb..0000000000
--- a/meta/recipes-core/ncurses/ncurses-5.9/config.cache
+++ /dev/null
@@ -1,4 +0,0 @@
-#! /bin/sh
-
-cf_cv_func_nanosleep=yes
-cf_cv_func_mkstemp=yes
diff --git a/meta/recipes-core/ncurses/ncurses-5.9/tic-hang.patch b/meta/recipes-core/ncurses/ncurses-5.9/tic-hang.patch
deleted file mode 100644
index cba89d26f5..0000000000
--- a/meta/recipes-core/ncurses/ncurses-5.9/tic-hang.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Upstream-Status: Inappropriate [configuration]
-
-'tic' of some linux distributions (e.g. fedora 11) hang in an infinite
-loop when processing the original file.
-
-Index: ncurses-5.7/misc/terminfo.src
-===================================================================
---- ncurses-5.7.orig/misc/terminfo.src
-+++ ncurses-5.7/misc/terminfo.src
-@@ -3706,12 +3706,11 @@ konsole-xf3x|KDE console window with key
- # The value for kbs reflects local customization rather than the settings used
- # for XFree86 xterm.
- konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm,
-- kend=\EOF, khome=\EOH, use=konsole+pcfkeys,
-- use=konsole-vt100,
--# Konsole does not implement shifted cursor-keys.
--konsole+pcfkeys|konsole subset of xterm+pcfkeys,
-- kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2,
-- use=xterm+pcf0,
-+ kend=\EOF, kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R,
-+ kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~,
-+ kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~,
-+ kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR, kf4=\EOS,
-+ khome=\EOH, use=konsole-vt100,
- # KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but
- # it is still useful for deriving the other entries.
- konsole-vt100|KDE console window with vt100 (sic) keyboard,
diff --git a/meta/recipes-core/ncurses/ncurses.inc b/meta/recipes-core/ncurses/ncurses.inc
index ffd80ee7c7..64cce329aa 100644
--- a/meta/recipes-core/ncurses/ncurses.inc
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -2,21 +2,24 @@ SUMMARY = "The New Curses library"
DESCRIPTION = "SVr4 and XSI-Curses compatible curses library and terminfo tools including tic, infocmp, captoinfo. Supports color, multiple highlights, forms-drawing characters, and automatic recognition of keypad and function-key sequences. Extensions include resizable windows and mouse support on both xterm and Linux console using the gpm library."
HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc180a8c44ca642e97c35452fab5f66"
+LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=5526f2f3a29edc95538b368a4771edda"
SECTION = "libs"
DEPENDS = "ncurses-native"
-DEPENDS_class-native = ""
-INC_PR = "r15"
+DEPENDS:class-native = ""
-BINCONFIG = "${bindir}/ncurses-config"
+BINCONFIG = "${bindir}/ncurses5-config ${bindir}/ncursesw5-config \
+ ${bindir}/ncurses6-config ${bindir}/ncursesw6-config"
inherit autotools binconfig-disabled multilib_header pkgconfig
# Upstream has useful patches at times at ftp://invisible-island.net/ncurses/
-SRC_URI = "ftp://invisible-island.net/${BPN}/current/${BP}-${REVISION}.tgz"
+SRC_URI = "git://salsa.debian.org/debian/ncurses.git;protocol=https;branch=master"
EXTRA_AUTORECONF = "-I m4"
-CONFIG_SITE =+ "${WORKDIR}/config.cache"
+
+CACHED_CONFIGUREVARS = "cf_cv_func_nanosleep=yes"
+
+EXTRASITECONFIG = "CFLAGS='${CFLAGS} -I${SYSROOT_DESTDIR}${includedir}'"
# Whether to enable separate widec libraries; must be 'true' or 'false'
#
@@ -29,17 +32,17 @@ ENABLE_WIDEC ?= "true"
BUILD_CPPFLAGS += "-D_GNU_SOURCE"
# natives don't generally look in base_libdir
-base_libdir_class-native = "${libdir}"
+base_libdir:class-native = "${libdir}"
# Display corruption occurs on 64 bit hosts without these settings
# This was derrived from the upstream debian ncurses which uses
# these settings for 32 and 64 bit hosts.
EXCONFIG_ARGS = ""
-EXCONFIG_ARGS_class-native = " \
+EXCONFIG_ARGS:class-native = " \
--disable-lp64 \
--with-chtype='long' \
--with-mmask-t='long'"
-EXCONFIG_ARGS_class-nativesdk = " \
+EXCONFIG_ARGS:class-nativesdk = " \
--disable-lp64 \
--with-chtype='long' \
--with-mmask-t='long'"
@@ -52,11 +55,12 @@ PACKAGES_DYNAMIC = "^${PN}-lib.*"
# because the sstate had a hard coded search path. Until this is fixed
# another way this is deemed good enough.
EX_TERMCAP = ""
-EX_TERMCAP_class-native = ":/etc/termcap:/usr/share/misc/termcap"
-EX_TERMCAP_class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap"
+EX_TERMCAP:class-native = ":/etc/termcap:/usr/share/misc/termcap"
+EX_TERMCAP:class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap"
EX_TERMINFO = ""
-EX_TERMINFO_class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
-EX_TERMINFO_class-nativesdk = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
+EX_TERMINFO:class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
+EX_TERMINFO:class-nativesdk = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
+EX_TERMLIB ?= "tinfo"
# Helper function for do_configure to allow multiple configurations
# $1 the directory to run configure in
@@ -66,7 +70,6 @@ ncurses_configure() {
cd $1
shift
oe_runconf \
- --disable-static \
--without-debug \
--without-ada \
--without-gpm \
@@ -79,12 +82,14 @@ ncurses_configure() {
--disable-big-core \
--program-prefix= \
--with-ticlib \
- --with-termlib=tinfo \
+ --with-termlib=${EX_TERMLIB} \
--enable-sigwinch \
--enable-pc-files \
--disable-rpath-hack \
${EXCONFIG_ARGS} \
--with-manpage-format=normal \
+ --without-manpage-renames \
+ --disable-stripping \
"$@" || return 1
cd ..
}
@@ -146,9 +151,14 @@ do_test() {
# Split original _install_opts to two parts.
# One is the options to install contents, the other is the parameters \
# when running command "make install"
-_install_opts = "\
- install.libs install.includes install.man \
-"
+# Note that install.libs will also implicitly install header files,
+# so we do not need to explicitly specify install.includes.
+# Doing so could in fact result in a race condition, as both targets
+# (install.libs and install.includes) would install the same headers
+# at the same time
+
+_install_opts = " install.libs install.man "
+
_install_cfgs = "\
DESTDIR='${D}' \
PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
@@ -195,7 +205,10 @@ do_install() {
ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
fi
- rm -f ${D}${libdir}/terminfo
+ # When changing ${libdir} to e.g. /usr/lib/myawesomelib/ ncurses
+ # still installs '/usr/lib/terminfo', so try to rm both
+ # the proper path and a slightly hardcoded one
+ rm -f ${D}${libdir}/terminfo ${D}${prefix}/lib/terminfo
# create linker scripts for libcurses.so and libncurses to
# link against -ltinfo when needed. Some builds might break
@@ -221,7 +234,7 @@ do_install() {
if [ ! -d "${D}${base_libdir}" ]; then
# Setting base_libdir to libdir as is done in the -native
# case will skip this code
- mkdir ${D}${base_libdir}
+ mkdir -p ${D}${base_libdir}
mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir}
! ${ENABLE_WIDEC} || \
mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir}
@@ -245,13 +258,13 @@ do_install() {
oe_multilib_header curses.h
}
-python populate_packages_prepend () {
+python populate_packages:prepend () {
libdir = d.expand("${libdir}")
base_libdir = d.expand("${base_libdir}")
pnbase = d.expand("${PN}-lib%s")
- do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
+ do_split_packages(d, libdir, r'^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
if libdir is not base_libdir:
- do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
+ do_split_packages(d, base_libdir, r'^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
}
@@ -259,48 +272,60 @@ inherit update-alternatives
ALTERNATIVE_PRIORITY = "100"
-ALTERNATIVE_ncurses-tools_class-target = "clear reset"
+ALTERNATIVE:ncurses-tools:class-target = "clear reset"
+ALTERNATIVE:ncurses-terminfo:class-target = "st st-256color"
+
+ALTERNATIVE_LINK_NAME[st] = "${datadir}/terminfo/s/st"
+
+ALTERNATIVE_LINK_NAME[st-256color] = "${datadir}/terminfo/s/st-256color"
BBCLASSEXTEND = "native nativesdk"
PACKAGES += " \
${PN}-tools \
- ${PN}-terminfo \
${PN}-terminfo-base \
+ ${PN}-terminfo \
"
-FILES_${PN} = "\
+FILES:${PN} = "\
${bindir}/tput \
${bindir}/tset \
${bindir}/ncurses5-config \
${bindir}/ncursesw5-config \
+ ${bindir}/ncurses6-config \
+ ${bindir}/ncursesw6-config \
${datadir}/tabset \
"
# This keeps only tput/tset in ncurses
# clear/reset are in already busybox
-FILES_${PN}-tools = "\
+FILES:${PN}-tools = "\
${bindir}/tic \
${bindir}/toe \
${bindir}/infotocap \
${bindir}/captoinfo \
${bindir}/infocmp \
- ${bindir}/clear${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
- ${bindir}/reset${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
+ ${bindir}/clear${@['', '.${BPN}']['${CLASSOVERRIDE}' == 'class-target']} \
+ ${bindir}/reset${@['', '.${BPN}']['${CLASSOVERRIDE}' == 'class-target']} \
${bindir}/tack \
${bindir}/tabs \
"
# 'reset' is a symlink to 'tset' which is in the 'ncurses' package
-RDEPENDS_${PN}-tools = "${PN}"
+RDEPENDS:${PN}-tools = "${PN} ${PN}-terminfo-base"
-FILES_${PN}-terminfo = "\
+FILES:${PN}-terminfo = "\
${datadir}/terminfo \
"
-FILES_${PN}-terminfo-base = "\
+FILES:${PN}-terminfo-base = "\
${sysconfdir}/terminfo \
"
-RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo"
-RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base"
+RSUGGESTS:${PN}-libtinfo = "${PN}-terminfo"
+RRECOMMENDS:${PN}-libtinfo = "${PN}-terminfo-base"
+
+# Putting terminfo into the sysroot adds around 2800 files to
+# each recipe specific sysroot. We can live without this, particularly
+# as many recipes may have native and target copies.
+SYSROOT_DIRS:remove = "${datadir}"
diff --git a/meta/recipes-core/ncurses/ncurses_5.9.bb b/meta/recipes-core/ncurses/ncurses_5.9.bb
deleted file mode 100644
index 54d27a951b..0000000000
--- a/meta/recipes-core/ncurses/ncurses_5.9.bb
+++ /dev/null
@@ -1,12 +0,0 @@
-require ncurses.inc
-
-REVISION = "20150329"
-
-PR = "${INC_PR}.1"
-
-SRC_URI += "file://tic-hang.patch \
- file://config.cache \
-"
-S = "${WORKDIR}/${BP}-${REVISION}"
-SRC_URI[md5sum] = "cee991d09e69e60ebedef424804c52d4"
-SRC_URI[sha256sum] = "5b64f40e4dce73e3aa83d15bd9257c6eff8790ec41150f0938bd87c0eb75828f"
diff --git a/meta/recipes-core/ncurses/ncurses_6.3.bb b/meta/recipes-core/ncurses/ncurses_6.3.bb
new file mode 100644
index 0000000000..f0256dad22
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses_6.3.bb
@@ -0,0 +1,14 @@
+require ncurses.inc
+
+SRC_URI += "file://0001-tic-hang.patch \
+ file://0002-configure-reproducible.patch \
+ file://0003-gen-pkgconfig.in-Do-not-include-LDFLAGS-in-generated.patch \
+ "
+# commit id corresponds to the revision in package version
+SRCREV = "51d0fd9cc3edb975f04224f29f777f8f448e8ced"
+S = "${WORKDIR}/git"
+EXTRA_OECONF += "--with-abi-version=5"
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)$"
+
+# This is needed when using patchlevel versions like 6.1+20181013
+#CVE_VERSION = "${@d.getVar("PV").split('+')[0]}.${@d.getVar("PV").split('+')[1]}"
diff --git a/meta/recipes-core/netbase/netbase/hosts b/meta/recipes-core/netbase/netbase/hosts
deleted file mode 100644
index 2f332451b5..0000000000
--- a/meta/recipes-core/netbase/netbase/hosts
+++ /dev/null
@@ -1,2 +0,0 @@
-127.0.0.1 localhost.localdomain localhost
-
diff --git a/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch b/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch
deleted file mode 100644
index 35ce21e36d..0000000000
--- a/meta/recipes-core/netbase/netbase/netbase-add-rpcbind-as-an-alias-to-sunrpc.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-netbase: add rpcbind as an alias to sunrpc
-
-the patch comes from:
-https://bugs.archlinux.org/task/20273
-
-Upstream-Status: Pending
-
-Signed-off-by: Li Wang <li.wang@windriver.com>
----
- etc-rpc | 2 +-
- etc-services | 4 ++--
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/etc-rpc b/etc-rpc
-index 1b30625..9a9a81a 100644
---- a/etc-rpc
-+++ b/etc-rpc
-@@ -1,7 +1,7 @@
- # This file contains user readable names that can be used in place of rpc
- # program numbers.
-
--portmapper 100000 portmap sunrpc
-+portmapper 100000 portmap sunrpc rpcbind
- rstatd 100001 rstat rstat_svc rup perfmeter
- rusersd 100002 rusers
- nfs 100003 nfsprog
-diff --git a/etc-services b/etc-services
-index 9d64a52..a19f7c8 100644
---- a/etc-services
-+++ b/etc-services
-@@ -72,8 +72,8 @@ pop2 109/tcp postoffice pop-2 # POP version 2
- pop2 109/udp pop-2
- pop3 110/tcp pop-3 # POP version 3
- pop3 110/udp pop-3
--sunrpc 111/tcp portmapper # RPC 4.0 portmapper
--sunrpc 111/udp portmapper
-+sunrpc 111/tcp portmapper rpcbind # RPC 4.0 portmapper
-+sunrpc 111/udp portmapper rpcbind
- auth 113/tcp authentication tap ident
- sftp 115/tcp
- uucp-path 117/tcp
---
-1.7.9.5
-
diff --git a/meta/recipes-core/netbase/netbase_5.3.bb b/meta/recipes-core/netbase/netbase_5.3.bb
deleted file mode 100644
index ccd89ff84f..0000000000
--- a/meta/recipes-core/netbase/netbase_5.3.bb
+++ /dev/null
@@ -1,24 +0,0 @@
-SUMMARY = "Basic TCP/IP networking support"
-DESCRIPTION = "This package provides the necessary infrastructure for basic TCP/IP based networking"
-HOMEPAGE = "http://packages.debian.org/netbase"
-SECTION = "base"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
-PE = "1"
-
-SRC_URI = "${DEBIAN_MIRROR}/main/n/netbase/netbase_${PV}.tar.xz \
- file://netbase-add-rpcbind-as-an-alias-to-sunrpc.patch \
- file://hosts"
-
-SRC_URI[md5sum] = "2637a27fd3de02a278d2b5be7e6558c1"
-SRC_URI[sha256sum] = "81f6c69795044d62b8ad959cf9daf049d0545fd466c52860ad3f933b1e97b88b"
-
-do_install () {
- install -d ${D}/${mandir}/man8 ${D}${sysconfdir}
- install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
- install -m 0644 etc-rpc ${D}${sysconfdir}/rpc
- install -m 0644 etc-protocols ${D}${sysconfdir}/protocols
- install -m 0644 etc-services ${D}${sysconfdir}/services
-}
-
-CONFFILES_${PN} = "${sysconfdir}/hosts"
diff --git a/meta/recipes-core/netbase/netbase_6.3.bb b/meta/recipes-core/netbase/netbase_6.3.bb
new file mode 100644
index 0000000000..0a7a9d71ed
--- /dev/null
+++ b/meta/recipes-core/netbase/netbase_6.3.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Basic TCP/IP networking support"
+DESCRIPTION = "This package provides the necessary infrastructure for basic TCP/IP based networking"
+HOMEPAGE = "http://packages.debian.org/netbase"
+SECTION = "base"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
+PE = "1"
+
+SRC_URI = "${DEBIAN_MIRROR}/main/n/${BPN}/${BPN}_${PV}.tar.xz"
+
+inherit allarch
+
+SRC_URI[sha256sum] = "7c42a6a1cafa0c64103c71cab6431fc8613179b2449a1a00e55e3584e860d81c"
+
+UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/netbase/"
+
+do_install () {
+ install -d ${D}${sysconfdir}
+ install -m 0644 ${S}/etc/rpc ${D}${sysconfdir}/rpc
+ install -m 0644 ${S}/etc/protocols ${D}${sysconfdir}/protocols
+ install -m 0644 ${S}/etc/services ${D}${sysconfdir}/services
+ install -m 0644 ${S}/etc/ethertypes ${D}${sysconfdir}/ethertypes
+}
diff --git a/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
new file mode 100644
index 0000000000..c220fb8437
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix-rs6000-crt0.patch
@@ -0,0 +1,41 @@
+Upstream-Status: Inappropriate [OE-Specific]
+
+Make install tries to perform install for all variants, but some of them use the same
+name for crt0 in specific, so performing all of them results in an error during
+do_install, we simply modify the name of the objects so the installation can proceed
+and leave it to the user to select which object files to use.
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
+
+Index: newlib-3.0.0/libgloss/rs6000/Makefile.in
+===================================================================
+--- newlib-3.0.0.orig/libgloss/rs6000/Makefile.in
++++ newlib-3.0.0/libgloss/rs6000/Makefile.in
+@@ -358,7 +358,7 @@ install-sim:
+ set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+
+ install-mvme:
+- set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++ set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mvme-$$x; done
+
+ install-solaris:
+ set -e; for x in ${SOLARIS_CRT0} ${SOLARIS_BSP} ${SOLARIS_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+@@ -367,15 +367,15 @@ install-linux:
+ set -e; for x in ${LINUX_CRT0} ${LINUX_BSP} ${LINUX_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+
+ install-yellowknife:
+- set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++ set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/yellowknife-$$x; done
+ set -e; for x in ${YELLOWKNIFE_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+
+ install-ads:
+- set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++ set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/ads-$$x; done
+ set -e; for x in ${ADS_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+
+ install-mbx:
+- set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
++ set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/mbx-$$x; done
+ set -e; for x in ${MBX_SCRIPTS} ${MBX_SPECS}; do ${INSTALL_DATA} $(srcdir)/$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
+
+ install-xil:
diff --git a/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch b/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch
new file mode 100644
index 0000000000..7645be7314
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss/fix_makefile_include_arm_h.patch
@@ -0,0 +1,30 @@
+Upstream-Status: Inappropriate [OE-Specific]
+
+When trying to build libgloss for an arm target, the build system
+complains about missing some include files:
+
+| fatal error: acle-compiat.h: No such file or directory
+| #include "acle-compat.h"
+| ^~~~~~~~~~~~~~~
+| compilation terminated.
+
+These include files come from the newlib source, but since we
+are building libgloss separately from newlib, libgloss is unaware
+of where they are, this patch fixes the INCLUDES so the build system
+can find such files.
+
+Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
+
+Index: newlib-3.0.0/libgloss/config/default.mh
+===================================================================
+--- newlib-3.0.0.orig/libgloss/config/default.mh
++++ newlib-3.0.0/libgloss/config/default.mh
+@@ -1,7 +1,7 @@
+ NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi`
+ NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi`
+
+-INCLUDES = -I. -I$(srcdir)/..
++INCLUDES = -I. -I$(srcdir)/.. -I$(srcdir)/../newlib/libc/machine/arm
+ # Note that when building the library, ${MULTILIB} is not the way multilib
+ # options are passed; they're passed in $(CFLAGS).
+ CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS}
diff --git a/meta/recipes-core/newlib/libgloss_4.1.0.bb b/meta/recipes-core/newlib/libgloss_4.1.0.bb
new file mode 100644
index 0000000000..8c8ee91395
--- /dev/null
+++ b/meta/recipes-core/newlib/libgloss_4.1.0.bb
@@ -0,0 +1,33 @@
+require newlib.inc
+
+DEPENDS += "newlib"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/libgloss:"
+
+SRC_URI:append:powerpc = " file://fix-rs6000-crt0.patch"
+SRC_URI:append:arm = " file://fix_makefile_include_arm_h.patch"
+
+do_configure() {
+ ${S}/libgloss/configure ${EXTRA_OECONF}
+}
+
+do_install:prepend() {
+ # install doesn't create this itself, avoid install error
+ install -d ${D}${prefix}/${TARGET_SYS}/lib
+}
+
+do_install:append() {
+ # Move libs to default directories so they can be picked up later
+ install -d ${D}${libdir}
+ mv -v ${D}${prefix}/${TARGET_SYS}/lib/* ${D}${libdir}
+
+ # Remove original directory
+ rmdir -p --ignore-fail-on-non-empty ${D}${prefix}/${TARGET_SYS}/lib
+}
+
+# Split packages correctly
+FILES:${PN} += "${libdir}/*.ld ${libdir}/*.specs"
+FILES:${PN}-dev += "${libdir}/cpu-init/*"
+
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
diff --git a/meta/recipes-core/newlib/newlib.inc b/meta/recipes-core/newlib/newlib.inc
new file mode 100644
index 0000000000..23cd172008
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib.inc
@@ -0,0 +1,54 @@
+SUMMARY = "Newlib is a C library intended for use on embedded systems"
+HOMEPAGE = "https://sourceware.org/newlib/"
+DESCRIPTION = "C library intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products."
+SECTION = "libs"
+
+LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2 & BSD-2-Clause & tcl"
+LIC_FILES_CHKSUM = " \
+ file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING.LIBGLOSS;md5=7b7615de0ecda0ff8d705966ac3b8950 \
+ file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
+ file://COPYING.NEWLIB;md5=b8dda70da54e0efb49b1074f349d7749 \
+ file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
+ file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0 \
+ "
+
+SRC_URI = "https://sourceware.org/pub/newlib/newlib-${PV}.tar.gz"
+SRC_URI[sha256sum] = "f296e372f51324224d387cc116dc37a6bd397198756746f93a2b02e9a5d40154"
+
+INHIBIT_DEFAULT_DEPS = "1"
+DEPENDS = "virtual/${TARGET_PREFIX}gcc"
+
+S = "${WORKDIR}/newlib-${PV}"
+B = "${WORKDIR}/build"
+
+## disable stdlib
+TARGET_CC_ARCH:append = " -nostdlib"
+
+EXTRA_OECONF = " \
+ --build=${BUILD_SYS} \
+ --target=${TARGET_SYS} \
+ --host=${HOST_SYS} \
+ --prefix=${prefix} \
+ --exec-prefix=${exec_prefix} \
+ --bindir=${bindir} \
+ --libdir=${libdir} \
+ --includedir=${includedir} \
+ --enable-languages=c \
+ --with-newlib \
+ --with-gnu-as \
+ --with-gnu-ld \
+ --disable-multilib \
+ --disable-newlib-supplied-syscalls \
+ "
+
+do_configure[cleandirs] = "${B}"
+
+do_install() {
+ oe_runmake install DESTDIR='${D}'
+}
+
+COMPATIBLE_HOST:libc-musl:class-target = "null"
+COMPATIBLE_HOST:libc-glibc:class-target = "null"
diff --git a/meta/recipes-core/newlib/newlib_4.1.0.bb b/meta/recipes-core/newlib/newlib_4.1.0.bb
new file mode 100644
index 0000000000..0542c596ba
--- /dev/null
+++ b/meta/recipes-core/newlib/newlib_4.1.0.bb
@@ -0,0 +1,20 @@
+require newlib.inc
+
+PROVIDES += "virtual/libc virtual/libiconv virtual/libintl"
+
+do_configure() {
+ export CC_FOR_TARGET="${CC}"
+ ${S}/configure ${EXTRA_OECONF}
+}
+
+do_install:append() {
+ # Move include files and libs to default directories so they can be picked up later
+ mv -v ${D}${prefix}/${TARGET_SYS}/lib ${D}${libdir}
+ mv -v ${D}${prefix}/${TARGET_SYS}/include ${D}${includedir}
+
+ # Remove original directory
+ rmdir ${D}${prefix}/${TARGET_SYS}
+}
+
+# No rpm package is actually created but -dev depends on it, avoid dnf error
+RDEPENDS:${PN}-dev:libc-newlib = ""
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
index cc431d2cdc..38ee4f993b 100644
--- a/meta/recipes-core/os-release/os-release.bb
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -1,9 +1,8 @@
inherit allarch
SUMMARY = "Operating system identification"
-DESCRIPTION = "The /etc/os-release file contains operating system identification data."
+DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
INHIBIT_DEFAULT_DEPS = "1"
do_fetch[noexec] = "1"
@@ -14,6 +13,7 @@ do_configure[noexec] = "1"
# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME
# HOME_URL SUPPORT_URL BUG_REPORT_URL
OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME"
+OS_RELEASE_UNQUOTED_FIELDS = "ID VERSION_ID VARIANT_ID"
ID = "${DISTRO}"
NAME = "${DISTRO_NAME}"
@@ -23,27 +23,31 @@ PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
BUILD_ID ?= "${DATETIME}"
BUILD_ID[vardepsexclude] = "DATETIME"
+def sanitise_value(ver):
+ # unquoted fields like VERSION_ID should be (from os-release(5)):
+ # lower-case string (mostly numeric, no spaces or other characters
+ # outside of 0-9, a-z, ".", "_" and "-")
+ ret = ver.replace('+', '-').replace(' ','_')
+ return ret.lower()
+
python do_compile () {
- import shutil
with open(d.expand('${B}/os-release'), 'w') as f:
- for field in d.getVar('OS_RELEASE_FIELDS', True).split():
- value = d.getVar(field, True)
+ for field in d.getVar('OS_RELEASE_FIELDS').split():
+ unquotedFields = d.getVar('OS_RELEASE_UNQUOTED_FIELDS').split()
+ value = d.getVar(field)
if value:
- f.write('{0}={1}\n'.format(field, value))
- if d.getVar('RPM_SIGN_PACKAGES', True) == '1':
- rpm_gpg_pubkey = d.getVar('RPM_GPG_PUBKEY', True)
- os.mkdir('${B}/rpm-gpg')
- distro_version = self.d.getVar('DISTRO_VERSION', True) or "oe.0"
- shutil.copy2(rpm_gpg_pubkey, d.expand('${B}/rpm-gpg/RPM-GPG-KEY-%s' % distro_version))
+ if field in unquotedFields:
+ value = sanitise_value(value)
+ f.write('{0}={1}\n'.format(field, value))
+ else:
+ f.write('{0}="{1}"\n'.format(field, value))
}
do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
do_install () {
- install -d ${D}${sysconfdir}
- install -m 0644 os-release ${D}${sysconfdir}/
-
- if [ -d "rpm-gpg" ]; then
- install -d "${D}${sysconfdir}/pki"
- cp -r "rpm-gpg" "${D}${sysconfdir}/pki/"
- fi
+ install -d ${D}${nonarch_libdir} ${D}${sysconfdir}
+ install -m 0644 os-release ${D}${nonarch_libdir}/
+ lnr ${D}${nonarch_libdir}/os-release ${D}${sysconfdir}/os-release
}
+
+FILES:${PN} += "${nonarch_libdir}/os-release"
diff --git a/meta/recipes-core/ovmf/ovmf-shell-image.bb b/meta/recipes-core/ovmf/ovmf-shell-image.bb
new file mode 100644
index 0000000000..50c4517da3
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf-shell-image.bb
@@ -0,0 +1,21 @@
+DESCRIPTION = "boot image with UEFI shell and tools"
+COMPATIBLE_HOST:class-target='(i.86|x86_64).*'
+
+# For this image recipe, only the wic format with a
+# single vfat partition makes sense. Because we have no
+# boot loader and no rootfs partition, not additional
+# tools are needed for this .wks file.
+IMAGE_FSTYPES:forcevariable = 'wic'
+WKS_FILE = "ovmf/ovmf-shell-image.wks"
+WKS_FILE_DEPENDS = ""
+
+inherit image
+
+# We want a minimal image with just ovmf-shell-efi unpacked in it. We
+# avoid installing unnecessary stuff as much as possible, but some
+# things still get through and need to be removed.
+PACKAGE_INSTALL = "ovmf-shell-efi"
+LINGUAS_INSTALL = ""
+do_image () {
+ rm -rf `ls -d ${IMAGE_ROOTFS}/* | grep -v efi`
+}
diff --git a/meta/recipes-core/ovmf/ovmf/0001-Fix-VLA-parameter-warning.patch b/meta/recipes-core/ovmf/ovmf/0001-Fix-VLA-parameter-warning.patch
new file mode 100644
index 0000000000..d658123b81
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-Fix-VLA-parameter-warning.patch
@@ -0,0 +1,51 @@
+From 498627ebda6271b59920f43a0b9b6187edeb7b09 Mon Sep 17 00:00:00 2001
+From: Adrian Herrera <adr.her.arc.95@gmail.com>
+Date: Mon, 22 Mar 2021 21:06:47 +0000
+Subject: [PATCH] Fix VLA parameter warning
+
+Make VLA buffer types consistent in declarations and definitions.
+Resolves build crash when using -Werror due to "vla-parameter" warning.
+
+Upstream-Status: Submitted [https://github.com/google/brotli/pull/893]
+Signed-off-by: Adrian Herrera <adr.her.arc.95@gmail.com>
+---
+ c/dec/decode.c | 6 ++++--
+ c/enc/encode.c | 5 +++--
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c b/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
+index 114c505..bb6f1ab 100644
+--- a/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
++++ b/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c
+@@ -2030,8 +2030,10 @@ static BROTLI_NOINLINE BrotliDecoderErrorCode SafeProcessCommands(
+ }
+
+ BrotliDecoderResult BrotliDecoderDecompress(
+- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size,
+- uint8_t* decoded_buffer) {
++ size_t encoded_size,
++ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
++ size_t* decoded_size,
++ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) {
+ BrotliDecoderState s;
+ BrotliDecoderResult result;
+ size_t total_out = 0;
+diff --git a/c/enc/encode.c b/c/enc/encode.c
+index 68548ef..ab0a490 100644
+--- a/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
++++ c/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c
+@@ -1470,8 +1470,9 @@ static size_t MakeUncompressedStream(
+
+ BROTLI_BOOL BrotliEncoderCompress(
+ int quality, int lgwin, BrotliEncoderMode mode, size_t input_size,
+- const uint8_t* input_buffer, size_t* encoded_size,
+- uint8_t* encoded_buffer) {
++ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
++ size_t* encoded_size,
++ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) {
+ BrotliEncoderState* s;
+ size_t out_size = *encoded_size;
+ const uint8_t* input_start = input_buffer;
+--
+2.31.1
+
diff --git a/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch b/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch
new file mode 100644
index 0000000000..89d9ffab5e
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-ovmf-update-path-to-native-BaseTools.patch
@@ -0,0 +1,33 @@
+From 1125f5a02c2f327aeffe2d6b66a9d816ad2eeec0 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Thu, 9 Jun 2016 02:23:01 -0700
+Subject: [PATCH 1/6] ovmf: update path to native BaseTools
+
+BaseTools is a set of utilities to build EDK-based firmware. These utilities
+are used during the build process. Thus, they need to be built natively.
+When cross-compiling, we need to provide a path to the location of these
+tools. The BBAKE_EDK_TOOLS_PATH string is used as a pattern to be replaced
+with the appropriate location before building.
+
+Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Upstream-Status: Pending
+---
+ OvmfPkg/build.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
+index 91b1442ade..1858dae31a 100755
+--- a/OvmfPkg/build.sh
++++ b/OvmfPkg/build.sh
+@@ -24,7 +24,7 @@ then
+ # this assumes svn pulls have the same root dir
+ # export EDK_TOOLS_PATH=`pwd`/../BaseTools
+ # This version is for the tools source in edk2
+- export EDK_TOOLS_PATH=`pwd`/BaseTools
++ export EDK_TOOLS_PATH=BBAKE_EDK_TOOLS_PATH/BaseTools
+ echo $EDK_TOOLS_PATH
+ source edksetup.sh BaseTools
+ else
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
new file mode 100644
index 0000000000..f6141c8af5
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
@@ -0,0 +1,66 @@
+From 19d4c7f9812062a683b3ba60b35aac0461190456 Mon Sep 17 00:00:00 2001
+From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
+Date: Fri, 26 Jul 2019 17:34:26 -0400
+Subject: [PATCH 2/6] BaseTools: makefile: adjust to build in under bitbake
+
+Prepend the build flags with those of bitbake. This is to build
+using the bitbake native sysroot include and library directories.
+
+Signed-off-by: Ricardo Neri <ricardo.neri@linux.intel.com>
+Upstream-Status: Pending
+---
+ BaseTools/Source/C/Makefiles/header.makefile | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
+index 0df728f327..1299d47c87 100644
+--- a/BaseTools/Source/C/Makefiles/header.makefile
++++ b/BaseTools/Source/C/Makefiles/header.makefile
+@@ -75,35 +75,36 @@ $(error Bad HOST_ARCH)
+ endif
+
+ INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
+-BUILD_CPPFLAGS = $(INCLUDE)
++BUILD_CPPFLAGS += $(INCLUDE)
+
+ # keep EXTRA_OPTFLAGS last
+ BUILD_OPTFLAGS = -O2 $(EXTRA_OPTFLAGS)
+
+ ifeq ($(DARWIN),Darwin)
+ # assume clang or clang compatible flags on OS X
+-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
++BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \
+ -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
+ else
+ ifeq ($(CXX), llvm)
+-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
++BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
+ -fno-delete-null-pointer-checks -Wall -Werror \
+ -Wno-deprecated-declarations -Wno-self-assign \
+ -Wno-unused-result -nostdlib -g
+ else
+-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
++BUILD_CFLAGS += -MD -fshort-wchar -fno-strict-aliasing -fwrapv \
+ -fno-delete-null-pointer-checks -Wall -Werror \
+ -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \
+ -Wno-unused-result -nostdlib -g
+ endif
+ endif
+ ifeq ($(CXX), llvm)
+-BUILD_LFLAGS =
+-BUILD_CXXFLAGS = -Wno-deprecated-register -Wno-unused-result
++BUILD_LFLAGS = $(LDFLAGS)
++BUILD_CXXFLAGS += -Wno-deprecated-register -Wno-unused-result
+ else
+-BUILD_LFLAGS =
+-BUILD_CXXFLAGS = -Wno-unused-result
++BUILD_LFLAGS = $(LDFLAGS)
++BUILD_CXXFLAGS += -Wno-unused-result
+ endif
++
+ ifeq ($(HOST_ARCH), IA32)
+ #
+ # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386, but gcc defaults
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch b/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch
new file mode 100644
index 0000000000..d710429899
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0003-ovmf-Update-to-latest.patch
@@ -0,0 +1,45 @@
+From 67267d8cc31df16a3608cad1a17c5f1470ef8bbd Mon Sep 17 00:00:00 2001
+From: Steve Langasek <steve.langasek@ubuntu.com>
+Date: Sat, 10 Jun 2017 01:39:36 -0700
+Subject: [PATCH 3/6] ovmf: Update to latest
+
+Description: pass -fno-stack-protector to all GCC toolchains
+ The upstream build rules inexplicably pass -fno-stack-protector only
+ when building for i386 and amd64. Add this essential argument to the
+ generic rules for gcc 4.4 and later.
+Last-Updated: 2016-04-12
+Upstream-Status: Pending
+---
+ BaseTools/Conf/tools_def.template | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
+index 498696e583..36241b6ede 100755
+--- a/BaseTools/Conf/tools_def.template
++++ b/BaseTools/Conf/tools_def.template
+@@ -1897,10 +1897,10 @@ DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv
+ # GCC Build Flag for included header file list generation
+ DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps
+
+-DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
++DEFINE GCC48_ALL_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -ffunction-sections -fdata-sections -fno-stack-protector -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+ DEFINE GCC48_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-n,-q,--gc-sections -z common-page-size=0x20
+-DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -fno-stack-protector -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
+-DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
++DEFINE GCC48_IA32_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m32 -march=i586 -malign-double -D EFI32 -fno-asynchronous-unwind-tables -Wno-address
++DEFINE GCC48_X64_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address
+ DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+ DEFINE GCC48_IA32_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
+ DEFINE GCC48_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(GCC_DLINK2_FLAGS_COMMON)
+@@ -1909,7 +1909,7 @@ DEFINE GCC48_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF
+ DEFINE GCC48_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
+ DEFINE GCC48_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
+ DEFINE GCC48_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
+-DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
++DEFINE GCC48_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARM_CC_FLAGS) -mword-relocations
+ DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
+ DEFINE GCC48_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
+ DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch b/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch
new file mode 100644
index 0000000000..dfb8a73398
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0004-Strip-build-paths.patch
@@ -0,0 +1,32 @@
+From b7cfe97895e0586d14403ba98e62a0cd9373da96 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Mon, 14 Jun 2021 19:55:08 +0200
+Subject: [PATCH 4/6] Strip build paths
+
+Pass --zero to GenFw in release builds so that the sections that link back to
+the intermediate binaries (containing build paths) are removed.
+
+Upstream-Status: Pending (discussion at https://bugzilla.tianocore.org/show_bug.cgi?id=3256)
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ OvmfPkg/OvmfPkgIa32.dsc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
+index 33fbd76790..06c6d5ce60 100644
+--- a/OvmfPkg/OvmfPkgIa32.dsc
++++ b/OvmfPkg/OvmfPkgIa32.dsc
+@@ -91,6 +91,8 @@
+
+ !include NetworkPkg/NetworkBuildOptions.dsc.inc
+
++ RELEASE_*_*_GENFW_FLAGS = --zero
++
+ [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
+ GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+ XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch b/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch
new file mode 100644
index 0000000000..e467d6f152
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0005-debug-prefix-map.patch
@@ -0,0 +1,104 @@
+From 860bb1979f3578bb83257076fe0f3bd33f9d68bf Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Mon, 14 Jun 2021 19:56:28 +0200
+Subject: [PATCH 5/6] debug prefix map
+
+We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in
+ --debug-prefix-map to nasm (we carry a patch to nasm for this). The
+tools definitions file is built by ovmf-native so we need to pass this in
+at target build time when we know the right values so we use the environment.
+
+By using determininistc file paths during the ovmf build, it removes the
+opportunitity for gcc/ld to change the output binaries due to path lengths
+overflowing section sizes and causing small changes in the binary output.
+Previously we relied on the stripped output being the same which isn't always
+the case if the size of the debug symbols varies.
+
+Upstream-Status: Pending [gcc parts may be upstreamable, nasm patch isn't upstream yet]
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ BaseTools/Conf/tools_def.template | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
+index 36241b6ede..947fbf2e8d 100755
+--- a/BaseTools/Conf/tools_def.template
++++ b/BaseTools/Conf/tools_def.template
+@@ -1863,7 +1863,7 @@ NOOPT_*_*_OBJCOPY_ADDDEBUGFLAG = --add-gnu-debuglink=$(DEBUG_DIR)/$(MODULE_N
+ *_*_*_DTCPP_PATH = DEF(DTCPP_BIN)
+ *_*_*_DTC_PATH = DEF(DTC_BIN)
+
+-DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common
++DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -include AutoGen.h -fno-common ENV(GCC_PREFIX_MAP)
+ DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe
+ DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
+ DEFINE GCC_ARM_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
+@@ -1881,8 +1881,8 @@ DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _Ref
+ DEFINE GCC_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
+ DEFINE GCC_AARCH64_ASLDLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_FLAGS)
+ DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
+-DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h
+-DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
++DEFINE GCC_ASM_FLAGS = -c -x assembler -imacros AutoGen.h ENV(GCC_PREFIX_MAP)
++DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h ENV(GCC_PREFIX_MAP)
+ DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include $(MODULE_NAME)StrDefs.h
+ DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
+ DEFINE GCC_ASLCC_FLAGS = -x c
+@@ -2027,7 +2027,7 @@ DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include A
+ *_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
+ *_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+ *_GCC48_IA32_OBJCOPY_FLAGS =
+-*_GCC48_IA32_NASM_FLAGS = -f elf32
++*_GCC48_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os
+ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
+@@ -2055,7 +2055,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
+ *_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
+ *_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+ *_GCC48_X64_OBJCOPY_FLAGS =
+-*_GCC48_X64_NASM_FLAGS = -f elf64
++*_GCC48_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os
+ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable
+@@ -2167,7 +2167,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
+ *_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
+ *_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+ *_GCC49_IA32_OBJCOPY_FLAGS =
+-*_GCC49_IA32_NASM_FLAGS = -f elf32
++*_GCC49_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os
+ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+@@ -2195,7 +2195,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
+ *_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
+ *_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+ *_GCC49_X64_OBJCOPY_FLAGS =
+-*_GCC49_X64_NASM_FLAGS = -f elf64
++*_GCC49_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os
+ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
+@@ -2313,7 +2313,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
+ *_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie
+ *_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+ *_GCC5_IA32_OBJCOPY_FLAGS =
+-*_GCC5_IA32_NASM_FLAGS = -f elf32
++*_GCC5_IA32_NASM_FLAGS = -f elf32 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os
+ DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
+@@ -2345,7 +2345,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,
+ *_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
+ *_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+ *_GCC5_X64_OBJCOPY_FLAGS =
+-*_GCC5_X64_NASM_FLAGS = -f elf64
++*_GCC5_X64_NASM_FLAGS = -f elf64 ENV(NASM_PREFIX_MAP)
+
+ DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os
+ DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch b/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch
new file mode 100644
index 0000000000..343c21b541
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0006-reproducible.patch
@@ -0,0 +1,180 @@
+From 27ed9962f5cb3afcc44d6c96c53277132a999712 Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Mon, 14 Jun 2021 19:57:30 +0200
+Subject: [PATCH 6/6] reproducible
+
+This patch fixes various things which make the build more reproducible. Some changes
+here only change intermediate artefacts but that means when you have two build trees
+giving differing results, the differences can be isolated more easily. The issues here
+usually become apparent with longer paths.
+
+This was all debugged with:
+TMPDIR = "${TOPDIR}/tmp"
+vs.
+TMPDIR = "${TOPDIR}/tmp-inital-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath-mylongpath"
+
+The patch specifically:
+
+ * Sorts output in GNUmakefile
+ * Always generates indirect flags files used to avoid pathlength issues else the
+ compile commands suddenly change when using longer paths
+ * Sorts the AutoGenTimeStamp file contents
+ * Makes the TargetDescBlock objects from BuildEngine sortable to allow the makefile fix
+ * Fix ElfConvert within GenFw so that only the basename of the binary being converted
+ is used, else the output from "GenFw XXX.bin" differs from "GenFw /long/path/XXX.bin"
+ with sufficiently long paths
+
+Upstream-Status: Pending [At least some of this might be interesting to upstream]
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+---
+ BaseTools/Source/C/GenFw/Elf64Convert.c | 8 ++++---
+ .../Source/Python/AutoGen/BuildEngine.py | 3 +++
+ BaseTools/Source/Python/AutoGen/GenMake.py | 24 +++++++++----------
+ .../Source/Python/AutoGen/ModuleAutoGen.py | 5 +++-
+ 4 files changed, 24 insertions(+), 16 deletions(-)
+
+diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
+index d097db8632..a87ae6f3d0 100644
+--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
++++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
+@@ -14,6 +14,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
+ #ifndef __GNUC__
+ #include <windows.h>
+ #include <io.h>
++#else
++#define _GNU_SOURCE
+ #endif
+ #include <assert.h>
+ #include <stdio.h>
+@@ -769,7 +771,7 @@ ScanSections64 (
+ }
+ mCoffOffset = mDebugOffset + sizeof(EFI_IMAGE_DEBUG_DIRECTORY_ENTRY) +
+ sizeof(EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY) +
+- strlen(mInImageName) + 1;
++ strlen(basename(mInImageName)) + 1;
+
+ mCoffOffset = CoffAlign(mCoffOffset);
+ if (SectionCount == 0) {
+@@ -1608,7 +1610,7 @@ WriteDebug64 (
+ EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *Dir;
+ EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *Nb10;
+
+- Len = strlen(mInImageName) + 1;
++ Len = strlen(basename(mInImageName)) + 1;
+
+ Dir = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY*)(mCoffFile + mDebugOffset);
+ Dir->Type = EFI_IMAGE_DEBUG_TYPE_CODEVIEW;
+@@ -1618,7 +1620,7 @@ WriteDebug64 (
+
+ Nb10 = (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY*)(Dir + 1);
+ Nb10->Signature = CODEVIEW_SIGNATURE_NB10;
+- strcpy ((char *)(Nb10 + 1), mInImageName);
++ strcpy ((char *)(Nb10 + 1), basename(mInImageName));
+
+
+ NtHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(mCoffFile + mNtHdrOffset);
+diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Source/Python/AutoGen/BuildEngine.py
+index 722fead75a..8f1c236970 100644
+--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
++++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
+@@ -70,6 +70,9 @@ class TargetDescBlock(object):
+ else:
+ return str(Other) == self.Target.Path
+
++ def __lt__(self, other):
++ return str(self) < str(other)
++
+ def AddInput(self, Input):
+ if Input not in self.Inputs:
+ self.Inputs.append(Input)
+diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
+index 961b2ab1c3..23c1592025 100755
+--- a/BaseTools/Source/Python/AutoGen/GenMake.py
++++ b/BaseTools/Source/Python/AutoGen/GenMake.py
+@@ -575,7 +575,7 @@ cleanlib:
+ os.remove(RespFileList)
+
+ # convert source files and binary files to build targets
+- self.ResultFileList = [str(T.Target) for T in MyAgo.CodaTargetList]
++ self.ResultFileList = sorted([str(T.Target) for T in MyAgo.CodaTargetList])
+ if len(self.ResultFileList) == 0 and len(MyAgo.SourceFileList) != 0:
+ EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
+ ExtraData="[%s]" % str(MyAgo))
+@@ -726,7 +726,7 @@ cleanlib:
+ OutputFile = ''
+ DepsFileList = []
+
+- for Cmd in self.GenFfsList:
++ for Cmd in sorted(self.GenFfsList):
+ if Cmd[2]:
+ for CopyCmd in Cmd[2]:
+ Src, Dst = CopyCmd
+@@ -759,7 +759,7 @@ cleanlib:
+ self.BuildTargetList.append('\t%s' % CmdString)
+
+ self.ParseSecCmd(DepsFileList, Cmd[1])
+- for SecOutputFile, SecDepsFile, SecCmd in self.FfsOutputFileList :
++ for SecOutputFile, SecDepsFile, SecCmd in sorted(self.FfsOutputFileList):
+ self.BuildTargetList.append('%s : %s' % (self.ReplaceMacro(SecOutputFile), self.ReplaceMacro(SecDepsFile)))
+ self.BuildTargetList.append('\t%s' % self.ReplaceMacro(SecCmd))
+ self.FfsOutputFileList = []
+@@ -798,13 +798,13 @@ cleanlib:
+
+ def CommandExceedLimit(self):
+ FlagDict = {
+- 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : False},
+- 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : False},
+- 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : False},
+- 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : False},
+- 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : False},
+- 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : False},
+- 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : False},
++ 'CC' : { 'Macro' : '$(CC_FLAGS)', 'Value' : True},
++ 'PP' : { 'Macro' : '$(PP_FLAGS)', 'Value' : True},
++ 'APP' : { 'Macro' : '$(APP_FLAGS)', 'Value' : True},
++ 'ASLPP' : { 'Macro' : '$(ASLPP_FLAGS)', 'Value' : True},
++ 'VFRPP' : { 'Macro' : '$(VFRPP_FLAGS)', 'Value' : True},
++ 'ASM' : { 'Macro' : '$(ASM_FLAGS)', 'Value' : True},
++ 'ASLCC' : { 'Macro' : '$(ASLCC_FLAGS)', 'Value' : True},
+ }
+
+ RespDict = {}
+@@ -1007,9 +1007,9 @@ cleanlib:
+ if not self.ObjTargetDict.get(T.Target.SubDir):
+ self.ObjTargetDict[T.Target.SubDir] = set()
+ self.ObjTargetDict[T.Target.SubDir].add(NewFile)
+- for Type in self._AutoGenObject.Targets:
++ for Type in sorted(self._AutoGenObject.Targets):
+ resp_file_number = 0
+- for T in self._AutoGenObject.Targets[Type]:
++ for T in sorted(self._AutoGenObject.Targets[Type]):
+ # Generate related macros if needed
+ if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
+ self.FileListMacros[T.FileListMacro] = []
+diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+index d70b0d7ae8..25dca9a6df 100755
+--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
++++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+@@ -1484,6 +1484,9 @@ class ModuleAutoGen(AutoGen):
+ for File in Files:
+ if File.lower().endswith('.pdb'):
+ AsBuiltInfDict['binary_item'].append('DISPOSABLE|' + File)
++
++ AsBuiltInfDict['binary_item'] = sorted(AsBuiltInfDict['binary_item'])
++
+ HeaderComments = self.Module.HeaderComments
+ StartPos = 0
+ for Index in range(len(HeaderComments)):
+@@ -1759,7 +1762,7 @@ class ModuleAutoGen(AutoGen):
+ if os.path.exists (self.TimeStampPath):
+ os.remove (self.TimeStampPath)
+
+- SaveFileOnChange(self.TimeStampPath, "\n".join(FileSet), False)
++ SaveFileOnChange(self.TimeStampPath, "\n".join(sorted(FileSet)), False)
+
+ # Ignore generating makefile when it is a binary module
+ if self.IsBinaryModule:
+--
+2.32.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks b/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks
new file mode 100644
index 0000000000..1d2f16bd33
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks
@@ -0,0 +1,4 @@
+# short-description: Create an EFI disk image with just the EFI system partition
+
+part / --source rootfs --ondisk sda --fstype=vfat --align 1024
+bootloader --ptable gpt --timeout=5
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
new file mode 100644
index 0000000000..ce3b650ddf
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -0,0 +1,264 @@
+SUMMARY = "OVMF - UEFI firmware for Qemu and KVM"
+DESCRIPTION = "OVMF is an EDK II based project to enable UEFI support for \
+Virtual Machines. OVMF contains sample UEFI firmware for QEMU and KVM"
+HOMEPAGE = "https://github.com/tianocore/tianocore.github.io/wiki/OVMF"
+LICENSE = "BSD-2-Clause-Patent"
+LICENSE:class-target = "${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'BSD-2-Clause-Patent & OpenSSL', 'BSD-2-Clause-Patent', d)}"
+LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=06357ddc23f46577c2aeaeaf7b776d65"
+
+# Enabling Secure Boot adds a dependency on OpenSSL and implies
+# compiling OVMF twice, so it is disabled by default. Distros
+# may change that default.
+PACKAGECONFIG ??= ""
+PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm', 'tpm', '', d)}"
+PACKAGECONFIG += "${@bb.utils.contains('MACHINE_FEATURES', 'tpm2', 'tpm', '', d)}"
+PACKAGECONFIG[secureboot] = ",,,"
+PACKAGECONFIG[tpm] = "-D TPM_ENABLE=TRUE,-D TPM_ENABLE=FALSE,,"
+
+SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \
+ file://0001-ovmf-update-path-to-native-BaseTools.patch \
+ file://0002-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
+ file://0003-ovmf-Update-to-latest.patch \
+ file://0004-Strip-build-paths.patch \
+ file://0005-debug-prefix-map.patch \
+ file://0006-reproducible.patch \
+ file://0001-Fix-VLA-parameter-warning.patch \
+ "
+
+PV = "edk2-stable202108"
+SRCREV = "7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5"
+UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>edk2-stable.*)"
+
+inherit deploy
+
+PARALLEL_MAKE = ""
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "nasm-native acpica-native ovmf-native util-linux-native"
+
+EDK_TOOLS_DIR="edk2_basetools"
+
+# OVMF has trouble building with the default optimization of -O2.
+BUILD_OPTIMIZATION="-pipe"
+
+# OVMF supports IA only, although it could conceivably support ARM someday.
+COMPATIBLE_HOST:class-target='(i.86|x86_64).*'
+
+# Additional build flags for OVMF with Secure Boot.
+# Fedora also uses "-D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD".
+OVMF_SECURE_BOOT_EXTRA_FLAGS ??= ""
+OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE ${OVMF_SECURE_BOOT_EXTRA_FLAGS}"
+
+export PYTHON_COMMAND = "${HOSTTOOLS_DIR}/python3"
+
+do_patch[postfuncs] += "fix_basetools_location"
+fix_basetools_location () {
+}
+fix_basetools_location:class-target() {
+ # Replaces the fake path inserted by 0002-ovmf-update-path-to-native-BaseTools.patch.
+ # Necessary for finding the actual BaseTools from ovmf-native.
+ sed -i -e 's#BBAKE_EDK_TOOLS_PATH#${STAGING_BINDIR_NATIVE}/${EDK_TOOLS_DIR}#' ${S}/OvmfPkg/build.sh
+}
+
+do_patch[postfuncs] += "fix_iasl"
+fix_iasl() {
+}
+fix_iasl:class-native() {
+ # iasl is not installed under /usr/bin when building with OE.
+ sed -i -e 's#/usr/bin/iasl#${STAGING_BINDIR_NATIVE}/iasl#' ${S}/BaseTools/Conf/tools_def.template
+}
+
+# Inject CC and friends into the build. LINKER already is in GNUmakefile.
+# Must be idempotent and thus remove old assignments that were inserted
+# earlier.
+do_patch[postfuncs] += "fix_toolchain"
+fix_toolchain() {
+ sed -i \
+ -e '/^\(CC\|CXX\|AS\|AR\|LD\|LINKER\) =/d' \
+ -e '/^APPLICATION/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}\nLINKER = $(CC)' \
+ ${S}/BaseTools/Source/C/Makefiles/app.makefile
+ sed -i \
+ -e '/^\(CC\|CXX\|AS\|AR\|LD\)/d' \
+ -e '/^VFR_CPPFLAGS/a CC = ${CC}\nCXX = ${CXX}\nAS = ${AS}\nAR = ${AR}\nLD = ${LD}' \
+ ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+}
+fix_toolchain:append:class-native() {
+ # This tools_def.template is going to be used by the target ovmf and
+ # defines which compilers to use. For the GCC toolchain definitions,
+ # that will be ${HOST_PREFIX}gcc. However, "make" doesn't need that
+ # prefix.
+ #
+ # Injecting ENV(HOST_PREFIX) matches exporting that value as env
+ # variable in do_compile:class-target.
+ sed -i \
+ -e 's#\(ENV\|DEF\)(GCC.*_PREFIX)#ENV(HOST_PREFIX)#' \
+ -e 's#ENV(HOST_PREFIX)make#make#' \
+ ${S}/BaseTools/Conf/tools_def.template
+ sed -i \
+ -e '/^\(LFLAGS\|CFLAGS\) +=/d' \
+ -e '/^LINKER/a LFLAGS += ${BUILD_LDFLAGS}\nCFLAGS += ${BUILD_CFLAGS}' \
+ ${S}/BaseTools/Source/C/Makefiles/app.makefile \
+ ${S}/BaseTools/Source/C/VfrCompile/GNUmakefile
+ # Linking with gold fails:
+ # internal error in do_layout, at ../../gold/object.cc:1821
+ # make: *** [.../OUTPUT/Facs.acpi] Error 1
+ # We intentionally hard-code the use of ld.bfd regardless of DISTRO_FEATURES
+ # to make ovmf-native reusable across distros.
+ sed -i \
+ -e 's#^\(DEFINE GCC.*DLINK.*FLAGS *=\)#\1 -fuse-ld=bfd#' \
+ -e 's#-flto#-fno-lto#g' \
+ -e 's#-DUSING_LTO##g' \
+ ${S}/BaseTools/Conf/tools_def.template
+}
+
+# We disable lto above since the results are not reproducible and make it hard to compare
+# binary build aretfacts to debug reproducibility problems.
+# Surprisingly, if you disable lto, you see compiler warnings which are fatal. We therefore
+# have to hack warnings overrides into GCC_PREFIX_MAP to allow it to build.
+
+# We want to pass ${DEBUG_PREFIX_MAP} to gcc commands and also pass in
+# --debug-prefix-map to nasm (we carry a patch to nasm for this). The
+# tools definitions are built by ovmf-native so we need to pass this in
+# at target build time when we know the right values.
+export NASM_PREFIX_MAP = "--debug-prefix-map=${WORKDIR}=/usr/src/debug/ovmf/${EXTENDPE}${PV}-${PR}"
+export GCC_PREFIX_MAP = "${DEBUG_PREFIX_MAP} -Wno-stringop-overflow -Wno-maybe-uninitialized"
+
+GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')"
+
+fixup_target_tools() {
+ case ${1} in
+ 4.4.*)
+ FIXED_GCCVER=GCC44
+ ;;
+ 4.5.*)
+ FIXED_GCCVER=GCC45
+ ;;
+ 4.6.*)
+ FIXED_GCCVER=GCC46
+ ;;
+ 4.7.*)
+ FIXED_GCCVER=GCC47
+ ;;
+ 4.8.*)
+ FIXED_GCCVER=GCC48
+ ;;
+ 4.9.*)
+ FIXED_GCCVER=GCC49
+ ;;
+ *)
+ FIXED_GCCVER=GCC5
+ ;;
+ esac
+ echo ${FIXED_GCCVER}
+}
+
+do_compile:class-native() {
+ oe_runmake -C ${S}/BaseTools
+}
+
+do_compile:class-target() {
+ export LFLAGS="${LDFLAGS}"
+ PARALLEL_JOBS="${@oe.utils.parallel_make_argument(d, '-n %d')}"
+ OVMF_ARCH="X64"
+ if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+ OVMF_ARCH="IA32"
+ fi
+
+ # The build for the target uses BaseTools/Conf/tools_def.template
+ # from ovmf-native to find the compiler, which depends on
+ # exporting HOST_PREFIX.
+ export HOST_PREFIX="${HOST_PREFIX}"
+
+ # BaseTools/Conf gets copied to Conf, but only if that does not
+ # exist yet. To ensure that an updated template gets used during
+ # incremental builds, we need to remove the copy before we start.
+ rm -f `ls ${S}/Conf/*.txt | grep -v ReadMe.txt`
+
+ # ${WORKDIR}/ovmf is a well-known location where do_install and
+ # do_deploy will be able to find the files.
+ rm -rf ${WORKDIR}/ovmf
+ mkdir ${WORKDIR}/ovmf
+ OVMF_DIR_SUFFIX="X64"
+ if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+ OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
+ fi
+ FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
+ bbnote FIXED_GCCVER is ${FIXED_GCCVER}
+ build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
+
+ bbnote "Building without Secure Boot."
+ rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
+ ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS}
+ ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd
+ ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd
+ ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd
+ ln ${build_dir}/${OVMF_ARCH}/Shell.efi ${WORKDIR}/ovmf/
+
+ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then
+ # Repeat build with the Secure Boot flags.
+ bbnote "Building with Secure Boot."
+ rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
+ ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${PACKAGECONFIG_CONFARGS} ${OVMF_SECURE_BOOT_FLAGS}
+ ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd
+ ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd
+ ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/
+ fi
+}
+
+do_install:class-native() {
+ install -d ${D}/${bindir}/edk2_basetools
+ cp -r ${S}/BaseTools ${D}/${bindir}/${EDK_TOOLS_DIR}
+}
+
+do_install:class-target() {
+ # Content for UEFI shell iso. We install the EFI shell as
+ # bootx64/ia32.efi because then it can be started even when the
+ # firmware itself does not contain it.
+ install -d ${D}/efi/boot
+ install ${WORKDIR}/ovmf/Shell.efi ${D}/efi/boot/boot${@ "ia32" if "${TARGET_ARCH}" != "x86_64" else "x64"}.efi
+ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then
+ install ${WORKDIR}/ovmf/EnrollDefaultKeys.efi ${D}
+ fi
+}
+
+# This always gets packaged because ovmf-shell-image depends on it.
+# This allows testing that recipe in all configurations because it
+# can always be part of a world build.
+#
+# However, EnrollDefaultKeys.efi is only included when Secure Boot is enabled.
+PACKAGES =+ "ovmf-shell-efi"
+FILES:ovmf-shell-efi = " \
+ EnrollDefaultKeys.efi \
+ efi/ \
+"
+
+DEPLOYDEP = ""
+DEPLOYDEP:class-target = "qemu-system-native:do_populate_sysroot"
+DEPLOYDEP:class-target += " ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'openssl-native:do_populate_sysroot', '', d)}"
+do_deploy[depends] += "${DEPLOYDEP}"
+
+do_deploy() {
+}
+do_deploy:class-target() {
+ # For use with "runqemu ovmf".
+ for i in \
+ ovmf \
+ ovmf.code \
+ ovmf.vars \
+ ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'ovmf.secboot ovmf.secboot.code', '', d)} \
+ ; do
+ qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd ${DEPLOYDIR}/$i.qcow2
+ done
+
+ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then
+ # Create a test Platform Key and first Key Exchange Key to use with EnrollDefaultKeys
+ openssl req -new -x509 -newkey rsa:2048 -keyout ${DEPLOYDIR}/OvmfPkKek1.key \
+ -out ${DEPLOYDIR}/OvmfPkKek1.crt -nodes -days 20 -subj "/CN=OVMFSecBootTest"
+ openssl x509 -in ${DEPLOYDIR}/OvmfPkKek1.crt -out ${DEPLOYDIR}/OvmfPkKek1.pem -outform PEM
+ fi
+}
+addtask do_deploy after do_compile before do_build
+
+BBCLASSEXTEND = "native"
+TOOLCHAIN = "gcc"
diff --git a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
index 0c6a530be6..39e5002bb7 100644
--- a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
+++ b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
@@ -4,13 +4,14 @@
SUMMARY = "Host packages for the standalone SDK or external toolchain"
PR = "r12"
-LICENSE = "MIT"
inherit packagegroup nativesdk
PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
-RDEPENDS_${PN} = "\
+# autoconf pulls in nativesdk-perl but perl-module-integer is needed to
+# build some recent linux kernels (5.14+) for arm
+RDEPENDS:${PN} = "\
nativesdk-pkgconfig \
nativesdk-qemu \
nativesdk-qemu-helper \
@@ -22,11 +23,16 @@ RDEPENDS_${PN} = "\
nativesdk-automake \
nativesdk-shadow \
nativesdk-makedevs \
- nativesdk-smartpm \
- nativesdk-postinst-intercept \
+ nativesdk-cmake \
+ nativesdk-meson \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'nativesdk-wayland', '', d)} \
+ nativesdk-sdk-provides-dummy \
+ nativesdk-bison \
+ nativesdk-flex \
+ nativesdk-perl-module-integer \
"
-RDEPENDS_${PN}_darwin = "\
+RDEPENDS:${PN}:darwin = "\
nativesdk-pkgconfig \
nativesdk-opkg \
nativesdk-libtool \
diff --git a/meta/recipes-core/packagegroups/packagegroup-base.bb b/meta/recipes-core/packagegroups/packagegroup-base.bb
index 9e40b28528..7489ef61b0 100644
--- a/meta/recipes-core/packagegroups/packagegroup-base.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-base.bb
@@ -1,5 +1,4 @@
SUMMARY = "Merge machine and distro options to create a basic machine task/package"
-LICENSE = "MIT"
PR = "r83"
#
@@ -8,9 +7,7 @@ PR = "r83"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit packagegroup
-inherit bluetooth
-PROVIDES = "${PACKAGES}"
PACKAGES = ' \
packagegroup-base \
packagegroup-base-extended \
@@ -22,7 +19,6 @@ PACKAGES = ' \
${@bb.utils.contains("MACHINE_FEATURES", "apm", "packagegroup-base-apm", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "ext2", "packagegroup-base-ext2", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "vfat", "packagegroup-base-vfat", "", d)} \
- ${@bb.utils.contains("MACHINE_FEATURES", "irda", "packagegroup-base-irda", "",d)} \
${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "packagegroup-base-keyboard", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "pci", "packagegroup-base-pci", "",d)} \
${@bb.utils.contains("MACHINE_FEATURES", "pcmcia", "packagegroup-base-pcmcia", "", d)} \
@@ -51,11 +47,10 @@ VIRTUAL-RUNTIME_keymaps ?= "keymaps"
#
# packagegroup-base contain stuff needed for base system (machine related)
#
-RDEPENDS_packagegroup-base = "\
+RDEPENDS:packagegroup-base = "\
packagegroup-distro-base \
packagegroup-machine-base \
\
- sysfsutils \
module-init-tools \
${@bb.utils.contains('MACHINE_FEATURES', 'apm', 'packagegroup-base-apm', '',d)} \
${@bb.utils.contains('MACHINE_FEATURES', 'acpi', 'packagegroup-base-acpi', '',d)} \
@@ -65,7 +60,6 @@ RDEPENDS_packagegroup-base = "\
${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'packagegroup-base-alsa', '',d)} \
${@bb.utils.contains('COMBINED_FEATURES', 'ext2', 'packagegroup-base-ext2', '',d)} \
${@bb.utils.contains('COMBINED_FEATURES', 'vfat', 'packagegroup-base-vfat', '',d)} \
- ${@bb.utils.contains('COMBINED_FEATURES', 'irda', 'packagegroup-base-irda', '',d)} \
${@bb.utils.contains('COMBINED_FEATURES', 'pci', 'packagegroup-base-pci', '',d)} \
${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'packagegroup-base-pcmcia', '',d)} \
${@bb.utils.contains('COMBINED_FEATURES', 'usbgadget', 'packagegroup-base-usbgadget', '',d)} \
@@ -85,7 +79,7 @@ RDEPENDS_packagegroup-base = "\
"
-RRECOMMENDS_packagegroup-base = "\
+RRECOMMENDS:packagegroup-base = "\
kernel-module-nls-utf8 \
kernel-module-input \
kernel-module-uinput \
@@ -94,7 +88,7 @@ RRECOMMENDS_packagegroup-base = "\
kernel-module-rtc-sysfs \
kernel-module-unix"
-RDEPENDS_packagegroup-base-extended = "\
+RDEPENDS:packagegroup-base-extended = "\
packagegroup-base \
${ADD_WIFI} \
${ADD_BT} \
@@ -111,87 +105,88 @@ python __anonymous () {
# If Distro want wifi and machine feature wifi/pci/pcmcia/usbhost (one of them)
# then include packagegroup-base-wifi in packagegroup-base
- distro_features = set(d.getVar("DISTRO_FEATURES", True).split())
- machine_features= set(d.getVar("MACHINE_FEATURES", True).split())
+ distro_features = set(d.getVar("DISTRO_FEATURES").split())
+ machine_features= set(d.getVar("MACHINE_FEATURES").split())
if "bluetooth" in distro_features and not "bluetooth" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features):
- d.setVar("ADD_BT", "packagegroup-base-bluetooth")
+ d.setVar("ADD_BT", "${MLPREFIX}packagegroup-base-bluetooth")
if "wifi" in distro_features and not "wifi" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features):
- d.setVar("ADD_WIFI", "packagegroup-base-wifi")
+ d.setVar("ADD_WIFI", "${MLPREFIX}packagegroup-base-wifi")
if "3g" in distro_features and not "3g" in machine_features and ("pcmcia" in machine_features or "pci" in machine_features or "usbhost" in machine_features):
- d.setVar("ADD_3G", "packagegroup-base-3g")
+ d.setVar("ADD_3G", "${MLPREFIX}packagegroup-base-3g")
if "nfc" in distro_features and not "nfc" in machine_features and ("usbhost" in machine_features):
- d.setVar("ADD_NFC", "packagegroup-base-nfc")
+ d.setVar("ADD_NFC", "${MLPREFIX}packagegroup-base-nfc")
}
#
# packages added by distribution
#
-SUMMARY_packagegroup-distro-base = "${DISTRO} extras"
+SUMMARY:packagegroup-distro-base = "${DISTRO} extras"
DEPENDS_packagegroup-distro-base = "${DISTRO_EXTRA_DEPENDS}"
-RDEPENDS_packagegroup-distro-base = "${DISTRO_EXTRA_RDEPENDS}"
-RRECOMMENDS_packagegroup-distro-base = "${DISTRO_EXTRA_RRECOMMENDS}"
+RDEPENDS:packagegroup-distro-base = "${DISTRO_EXTRA_RDEPENDS}"
+RRECOMMENDS:packagegroup-distro-base = "${DISTRO_EXTRA_RRECOMMENDS}"
#
# packages added by machine config
#
-SUMMARY_packagegroup-machine-base = "${MACHINE} extras"
-SUMMARY_packagegroup-machine-base = "Extra packages required to fully support ${MACHINE} hardware"
-RDEPENDS_packagegroup-machine-base = "${MACHINE_EXTRA_RDEPENDS}"
-RRECOMMENDS_packagegroup-machine-base = "${MACHINE_EXTRA_RRECOMMENDS}"
+SUMMARY:packagegroup-machine-base = "${MACHINE} extras"
+SUMMARY:packagegroup-machine-base = "Extra packages required to fully support ${MACHINE} hardware"
+RDEPENDS:packagegroup-machine-base = "${MACHINE_EXTRA_RDEPENDS}"
+RRECOMMENDS:packagegroup-machine-base = "${MACHINE_EXTRA_RRECOMMENDS}"
-SUMMARY_packagegroup-base-keyboard = "Keyboard support"
-RDEPENDS_packagegroup-base-keyboard = "\
+SUMMARY:packagegroup-base-keyboard = "Keyboard support"
+RDEPENDS:packagegroup-base-keyboard = "\
${VIRTUAL-RUNTIME_keymaps}"
-SUMMARY_packagegroup-base-pci = "PCI bus support"
-RDEPENDS_packagegroup-base-pci = "\
+SUMMARY:packagegroup-base-pci = "PCI bus support"
+RDEPENDS:packagegroup-base-pci = "\
pciutils"
-SUMMARY_packagegroup-base-acpi = "ACPI support"
-RDEPENDS_packagegroup-base-acpi = "\
- acpid \
- libacpi "
+SUMMARY:packagegroup-base-acpi = "ACPI support"
+RDEPENDS:packagegroup-base-acpi = "\
+ acpid"
-SUMMARY_packagegroup-base-apm = "APM support"
-RDEPENDS_packagegroup-base-apm = "\
+SUMMARY:packagegroup-base-apm = "APM support"
+RDEPENDS:packagegroup-base-apm = "\
${VIRTUAL-RUNTIME_apm} \
apmd"
-SUMMARY_packagegroup-base-ext2 = "ext2 filesystem support"
-RDEPENDS_packagegroup-base-ext2 = "\
- hdparm \
- e2fsprogs \
+SUMMARY:packagegroup-base-ext2 = "ext2 filesystem support"
+RDEPENDS:packagegroup-base-ext2 = "\
e2fsprogs-e2fsck \
e2fsprogs-mke2fs"
-SUMMARY_packagegroup-base-vfat = "FAT filesystem support"
-RRECOMMENDS_packagegroup-base-vfat = "\
+RRECOMMENDS:packagegroup-base-ext2 = "\
+ hdparm \
+ e2fsprogs"
+
+SUMMARY:packagegroup-base-vfat = "FAT filesystem support"
+RRECOMMENDS:packagegroup-base-vfat = "\
kernel-module-msdos \
kernel-module-vfat \
kernel-module-nls-iso8859-1 \
kernel-module-nls-cp437 \
dosfstools"
-SUMMARY_packagegroup-base-alsa = "ALSA sound support"
-RDEPENDS_packagegroup-base-alsa = "\
+SUMMARY:packagegroup-base-alsa = "ALSA sound support"
+RDEPENDS:packagegroup-base-alsa = "\
alsa-utils-alsactl \
- alsa-utils-alsamixer \
+ alsa-utils-amixer \
${VIRTUAL-RUNTIME_alsa-state}"
-RRECOMMENDS_packagegroup-base-alsa = "\
+RRECOMMENDS:packagegroup-base-alsa = "\
kernel-module-snd-mixer-oss \
kernel-module-snd-pcm-oss"
-SUMMARY_packagegroup-base-pcmcia = "PC card slot support"
-RDEPENDS_packagegroup-base-pcmcia = "\
+SUMMARY:packagegroup-base-pcmcia = "PC card slot support"
+RDEPENDS:packagegroup-base-pcmcia = "\
pcmciautils \
"
-RRECOMMENDS_packagegroup-base-pcmcia = "\
+RRECOMMENDS:packagegroup-base-pcmcia = "\
kernel-module-pcmcia \
kernel-module-airo-cs \
kernel-module-pcnet-cs \
@@ -202,13 +197,12 @@ RRECOMMENDS_packagegroup-base-pcmcia = "\
${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'kernel-module-orinoco-cs', '',d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'kernel-module-spectrum-cs', '',d)}"
-SUMMARY_packagegroup-base-bluetooth = "Bluetooth support"
-RDEPENDS_packagegroup-base-bluetooth = "\
- ${BLUEZ} \
- ${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'libasound-module-bluez', '',d)} \
+SUMMARY:packagegroup-base-bluetooth = "Bluetooth support"
+RDEPENDS:packagegroup-base-bluetooth = "\
+ bluez5 \
"
-RRECOMMENDS_packagegroup-base-bluetooth = "\
+RRECOMMENDS:packagegroup-base-bluetooth = "\
kernel-module-bluetooth \
kernel-module-l2cap \
kernel-module-rfcomm \
@@ -224,36 +218,19 @@ RRECOMMENDS_packagegroup-base-bluetooth = "\
${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-dtl1-cs', '',d)} \
"
-SUMMARY_packagegroup-base-irda = "IrDA support"
-RDEPENDS_packagegroup-base-irda = "\
- irda-utils"
-
-RRECOMMENDS_packagegroup-base-irda = "\
- kernel-module-pxaficp-ir \
- kernel-module-irda \
- kernel-module-ircomm \
- kernel-module-ircomm-tty \
- kernel-module-irlan \
- ${@bb.utils.contains('DISTRO_FEATURES', 'ppp', 'kernel-module-irnet', '',d)} \
- kernel-module-irport \
- kernel-module-irtty \
- kernel-module-irtty-sir \
- kernel-module-sir-dev \
- ${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-ir-usb', '',d)} "
-
-SUMMARY_packagegroup-base-usbgadget = "USB gadget support"
-RRECOMMENDS_packagegroup-base-usbgadget = "\
+SUMMARY:packagegroup-base-usbgadget = "USB gadget support"
+RRECOMMENDS:packagegroup-base-usbgadget = "\
kernel-module-pxa27x_udc \
kernel-module-gadgetfs \
kernel-module-g-file-storage \
kernel-module-g-serial \
kernel-module-g-ether"
-SUMMARY_packagegroup-base-usbhost = "USB host support"
-RDEPENDS_packagegroup-base-usbhost = "\
+SUMMARY:packagegroup-base-usbhost = "USB host support"
+RDEPENDS:packagegroup-base-usbhost = "\
usbutils "
-RRECOMMENDS_packagegroup-base-usbhost = "\
+RRECOMMENDS:packagegroup-base-usbhost = "\
kernel-module-uhci-hcd \
kernel-module-ohci-hcd \
kernel-module-ehci-hcd \
@@ -267,37 +244,36 @@ RRECOMMENDS_packagegroup-base-usbhost = "\
kernel-module-usbserial \
kernel-module-usb-storage "
-SUMMARY_packagegroup-base-ppp = "PPP dial-up protocol support"
-RDEPENDS_packagegroup-base-ppp = "\
+SUMMARY:packagegroup-base-ppp = "PPP dial-up protocol support"
+RDEPENDS:packagegroup-base-ppp = "\
ppp \
ppp-dialin"
-RRECOMMENDS_packagegroup-base-ppp = "\
+RRECOMMENDS:packagegroup-base-ppp = "\
kernel-module-ppp-async \
kernel-module-ppp-deflate \
kernel-module-ppp-generic \
kernel-module-ppp-mppe \
kernel-module-slhc"
-SUMMARY_packagegroup-base-ipsec = "IPSEC support"
-RDEPENDS_packagegroup-base-ipsec = "\
+SUMMARY:packagegroup-base-ipsec = "IPSEC support"
+RDEPENDS:packagegroup-base-ipsec = "\
"
-RRECOMMENDS_packagegroup-base-ipsec = "\
+RRECOMMENDS:packagegroup-base-ipsec = "\
kernel-module-ipsec"
#
# packagegroup-base-wifi contain everything needed to get WiFi working
# WEP/WPA connection needs to be supported out-of-box
#
-SUMMARY_packagegroup-base-wifi = "WiFi support"
-RDEPENDS_packagegroup-base-wifi = "\
- ${VIRTUAL-RUNTIME_wireless-tools} \
- ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'hostap-utils', '',d)} \
- ${@bb.utils.contains('COMBINED_FEATURES', 'pci', 'hostap-utils', '',d)} \
+SUMMARY:packagegroup-base-wifi = "WiFi support"
+RDEPENDS:packagegroup-base-wifi = "\
+ iw \
+ wireless-regdb-static \
wpa-supplicant"
-RRECOMMENDS_packagegroup-base-wifi = "\
+RRECOMMENDS:packagegroup-base-wifi = "\
${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-zd1211rw', '',d)} \
kernel-module-ieee80211-crypt \
kernel-module-ieee80211-crypt-ccmp \
@@ -311,59 +287,59 @@ RRECOMMENDS_packagegroup-base-wifi = "\
kernel-module-aes-generic \
kernel-module-aes"
-SUMMARY_packagegroup-base-nfc = "Near Field Communication support"
-RDEPENDS_packagegroup-base-nfc = "\
+SUMMARY:packagegroup-base-nfc = "Near Field Communication support"
+RDEPENDS:packagegroup-base-nfc = "\
neard"
-RRECOMMENDS_packagegroup-base-nfc = "\
+RRECOMMENDS:packagegroup-base-nfc = "\
kernel-module-nfc"
-SUMMARY_packagegroup-base-3g = "Cellular data support"
-RDEPENDS_packagegroup-base-3g = "\
+SUMMARY:packagegroup-base-3g = "Cellular data support"
+RDEPENDS:packagegroup-base-3g = "\
ofono"
-RRECOMMENDS_packagegroup-base-3g = "\
+RRECOMMENDS:packagegroup-base-3g = "\
kernel-module-cdc-acm \
kernel-module-cdc-wdm"
-SUMMARY_packagegroup-base-smbfs = "SMB network filesystem support"
-RRECOMMENDS_packagegroup-base-smbfs = "\
+SUMMARY:packagegroup-base-smbfs = "SMB network filesystem support"
+RRECOMMENDS:packagegroup-base-smbfs = "\
kernel-module-cifs \
kernel-module-smbfs"
-SUMMARY_packagegroup-base-cramfs = "cramfs filesystem support"
-RRECOMMENDS_packagegroup-base-cramfs = "\
+SUMMARY:packagegroup-base-cramfs = "cramfs filesystem support"
+RRECOMMENDS:packagegroup-base-cramfs = "\
kernel-module-cramfs"
#
# packagegroup-base-nfs provides ONLY client support - server is in nfs-utils package
#
-SUMMARY_packagegroup-base-nfs = "NFS network filesystem support"
-RDEPENDS_packagegroup-base-nfs = "\
+SUMMARY:packagegroup-base-nfs = "NFS network filesystem support"
+RDEPENDS:packagegroup-base-nfs = "\
rpcbind"
-RRECOMMENDS_packagegroup-base-nfs = "\
+RRECOMMENDS:packagegroup-base-nfs = "\
kernel-module-nfs "
-SUMMARY_packagegroup-base-zeroconf = "Zeroconf support"
-RDEPENDS_packagegroup-base-zeroconf = "\
+SUMMARY:packagegroup-base-zeroconf = "Zeroconf support"
+RDEPENDS:packagegroup-base-zeroconf = "\
avahi-daemon"
-RDEPENDS_packagegroup-base-zeroconf_append_libc-glibc = "\
+RDEPENDS:packagegroup-base-zeroconf:append:libc-glibc = "\
libnss-mdns \
"
-SUMMARY_packagegroup-base-ipv6 = "IPv6 support"
-RDEPENDS_packagegroup-base-ipv6 = "\
+SUMMARY:packagegroup-base-ipv6 = "IPv6 support"
+RDEPENDS:packagegroup-base-ipv6 = "\
"
-RRECOMMENDS_packagegroup-base-ipv6 = "\
+RRECOMMENDS:packagegroup-base-ipv6 = "\
kernel-module-ipv6 "
-SUMMARY_packagegroup-base-serial = "Serial port support"
-RDEPENDS_packagegroup-base-serial = "\
+SUMMARY:packagegroup-base-serial = "Serial port support"
+RDEPENDS:packagegroup-base-serial = "\
setserial \
lrzsz "
-SUMMARY_packagegroup-base-phone = "Cellular telephony (voice) support"
-RDEPENDS_packagegroup-base-phone = "\
+SUMMARY:packagegroup-base-phone = "Cellular telephony (voice) support"
+RDEPENDS:packagegroup-base-phone = "\
ofono"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
index 09f537372e..faf7bc0026 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -4,38 +4,31 @@
SUMMARY = "Minimal boot requirements"
DESCRIPTION = "The minimal set of packages required to boot the system"
-LICENSE = "MIT"
PR = "r17"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit packagegroup
-#
-# Set by the machine configuration with packages essential for device bootup
-#
-MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
-MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
-
# Distro can override the following VIRTUAL-RUNTIME providers:
VIRTUAL-RUNTIME_dev_manager ?= "udev"
-VIRTUAL-RUNTIME_login_manager ?= "busybox"
-VIRTUAL-RUNTIME_init_manager ?= "sysvinit"
-VIRTUAL-RUNTIME_initscripts ?= "initscripts"
VIRTUAL-RUNTIME_keymaps ?= "keymaps"
-SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', 'busybox-hwclock', '', d)} \
+EFI_PROVIDER ??= "grub-efi"
+
+SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', '${VIRTUAL-RUNTIME_base-utils-hwclock}', '', d)} \
modutils-initscripts \
init-ifupdown \
${VIRTUAL-RUNTIME_initscripts} \
"
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
base-files \
base-passwd \
- busybox \
+ ${VIRTUAL-RUNTIME_base-utils} \
${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
+ ${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER} kernel", "", d)} \
netbase \
${VIRTUAL-RUNTIME_login_manager} \
${VIRTUAL-RUNTIME_init_manager} \
@@ -43,5 +36,6 @@ RDEPENDS_${PN} = "\
${VIRTUAL-RUNTIME_update-alternatives} \
${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
-RRECOMMENDS_${PN} = "\
+RRECOMMENDS:${PN} = "\
+ ${VIRTUAL-RUNTIME_base-utils-syslog} \
${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS}"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
index 74ed247512..32f4ac3586 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
@@ -4,11 +4,10 @@
#
SUMMARY = "Essential build dependencies"
-LICENSE = "MIT"
inherit packagegroup
-RDEPENDS_packagegroup-core-buildessential = "\
+RDEPENDS:packagegroup-core-buildessential = "\
autoconf \
automake \
binutils \
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb b/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb
index e7b013d406..4e91aaf47b 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb
@@ -1,9 +1,8 @@
SUMMARY = "Remote debugging tools for Eclipse integration"
-LICENSE = "MIT"
inherit packagegroup
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
gdbserver \
tcf-agent \
openssh-sftp-server \
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
index 247a30e063..35beb3fc05 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
@@ -3,15 +3,17 @@
#
SUMMARY = "NFS package groups"
-LICENSE = "MIT"
PR = "r2"
inherit packagegroup
-PACKAGES = "${PN}-server"
+PACKAGES = "${PN}-server ${PN}-client"
-SUMMARY_${PN}-server = "NFS server"
-RDEPENDS_${PN}-server = "\
+SUMMARY:${PN}-client = "NFS client"
+RDEPENDS:${PN}-client = "nfs-utils-client"
+
+SUMMARY:${PN}-server = "NFS server"
+RDEPENDS:${PN}-server = "\
nfs-utils \
nfs-utils-client \
"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
index 3badd0ecf0..d70aff22c7 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
@@ -3,7 +3,6 @@
#
SUMMARY = "Software development tools"
-LICENSE = "MIT"
PR = "r9"
PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -12,12 +11,11 @@ inherit packagegroup
#PACKAGEFUNCS =+ 'generate_sdk_pkgs'
-RDEPENDS_packagegroup-core-sdk = "\
+RDEPENDS:packagegroup-core-sdk = "\
packagegroup-core-buildessential \
coreutils \
ccache \
diffutils \
- intltool \
perl-module-re \
perl-module-text-wrap \
findutils \
@@ -28,22 +26,22 @@ RDEPENDS_packagegroup-core-sdk = "\
tcl"
SANITIZERS = "libasan-dev libubsan-dev"
-SANITIZERS_aarch64 = ""
-SANITIZERS_mips = ""
-SANITIZERS_mips64 = ""
-SANITIZERS_mips64n32 = ""
-SANITIZERS_powerpc64 = ""
-SANITIZERS_sparc = ""
-SANITIZERS_libc-musl = ""
+SANITIZERS:arc = ""
+SANITIZERS:microblaze = ""
+SANITIZERS:mipsarch = ""
+SANITIZERS:nios2 = ""
+SANITIZERS:riscv64 = ""
+SANITIZERS:riscv32 = ""
+SANITIZERS:libc-musl = ""
-RRECOMMENDS_packagegroup-core-sdk = "\
+RRECOMMENDS:packagegroup-core-sdk = "\
libgomp \
libgomp-dev \
${SANITIZERS}"
#python generate_sdk_pkgs () {
# poky_pkgs = read_pkgdata('packagegroup-core', d)['PACKAGES']
-# pkgs = d.getVar('PACKAGES', True).split()
+# pkgs = d.getVar('PACKAGES').split()
# for pkg in poky_pkgs.split():
# newpkg = pkg.replace('packagegroup-core', 'packagegroup-core-sdk')
#
@@ -55,7 +53,7 @@ RRECOMMENDS_packagegroup-core-sdk = "\
# # the package depchain code
# spkgdata = read_subpkgdata(pkg, d)
#
-# rdepends = explode_deps(spkgdata.get('RDEPENDS_%s' % pkg) or '')
+# rdepends = explode_deps(spkgdata.get('RDEPENDS:%s' % pkg) or '')
# rreclist = []
#
# for depend in rdepends:
@@ -65,16 +63,16 @@ RRECOMMENDS_packagegroup-core-sdk = "\
# rreclist.append('%s-dev' % name)
# else:
# deppkgdata = read_subpkgdata(name, d)
-# rdepends2 = explode_deps(deppkgdata.get('RDEPENDS_%s' % name) or '')
+# rdepends2 = explode_deps(deppkgdata.get('RDEPENDS:%s' % name) or '')
# for depend in rdepends2:
# split_depend = depend.split(' (')
# name = split_depend[0].strip()
# if packaged('%s-dev' % name, d):
# rreclist.append('%s-dev' % name)
#
-# oldrrec = d.getVar('RRECOMMENDS_%s' % newpkg, False) or ''
-# d.setVar('RRECOMMENDS_%s' % newpkg, oldrrec + ' ' + ' '.join(rreclist))
-# # bb.note('RRECOMMENDS_%s = "%s"' % (newpkg, d.getVar('RRECOMMENDS_%s' % newpkg, False)))
+# oldrrec = d.getVar('RRECOMMENDS:%s' % newpkg, False) or ''
+# d.setVar('RRECOMMENDS:%s' % newpkg, oldrrec + ' ' + ' '.join(rreclist))
+# # bb.note('RRECOMMENDS:%s = "%s"' % (newpkg, d.getVar('RRECOMMENDS:%s' % newpkg, False)))
#
# # bb.note('pkgs is %s' % pkgs)
# d.setVar('PACKAGES', ' '.join(pkgs))
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
index e99946f0a7..4f844ad925 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
@@ -1,7 +1,6 @@
SUMMARY = "Dropbear SSH client/server"
-LICENSE = "MIT"
PR = "r1"
inherit packagegroup
-RDEPENDS_${PN} = "dropbear"
+RDEPENDS:${PN} = "dropbear"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
index 32d20e6214..846df12bc7 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
@@ -1,7 +1,6 @@
SUMMARY = "OpenSSH SSH client/server"
-LICENSE = "MIT"
PR = "r1"
inherit packagegroup
-RDEPENDS_${PN} = "openssh"
+RDEPENDS:${PN} = "openssh"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
index 37f5e43a7d..5ebcbcec82 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
@@ -1,13 +1,21 @@
SUMMARY = "Target packages for the standalone SDK"
PR = "r8"
-LICENSE = "MIT"
+
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
inherit packagegroup
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
libgcc \
libgcc-dev \
+ libatomic \
+ libatomic-dev \
libstdc++ \
libstdc++-dev \
${LIBC_DEPENDENCIES} \
"
+
+RRECOMMENDS:${PN}:mingw32 = "\
+ libssp \
+ libssp-dev \
+ "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
index 82347b975d..c75850aa64 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
@@ -3,18 +3,22 @@
#
SUMMARY = "Debugging tools"
-LICENSE = "MIT"
+
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
inherit packagegroup
PR = "r3"
MTRACE = ""
-MTRACE_libc-glibc = "libc-mtrace"
+MTRACE:libc-glibc = "libc-mtrace"
+
+STRACE = "strace"
+STRACE:riscv32 = ""
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
gdb \
gdbserver \
- strace \
${MTRACE} \
+ ${STRACE} \
"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
index 80f593379b..84eb46b9c2 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
@@ -3,7 +3,6 @@
#
SUMMARY = "Profiling tools"
-LICENSE = "MIT"
PR = "r3"
@@ -11,14 +10,14 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit packagegroup
-PROFILE_TOOLS_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'sysprof', '', d)}"
-# sysprof doesn't support aarch64
-PROFILE_TOOLS_X_aarch64 = ""
+PROFILE_TOOLS_X = ""
+# sysprof doesn't support aarch64 and nios2
+PROFILE_TOOLS_X:aarch64 = ""
+PROFILE_TOOLS_X:nios2 = ""
PROFILE_TOOLS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-analyze', '', d)}"
-RRECOMMENDS_${PN} = "\
- perf \
- trace-cmd \
+RRECOMMENDS:${PN} = "\
+ ${PERF} \
blktrace \
${PROFILE_TOOLS_X} \
${PROFILE_TOOLS_SYSTEMD} \
@@ -26,56 +25,49 @@ RRECOMMENDS_${PN} = "\
PROFILETOOLS = "\
powertop \
- latencytop \
"
+PERF = "perf"
+PERF:libc-musl = ""
+PERF:libc-musl:arm = "perf"
+PERF:riscv32 = ""
-# systemtap needs elfutils which is not fully buildable on uclibc
-# hence we exclude it from uclibc based builds
+# systemtap needs elfutils which is not fully buildable on some arches/libcs
SYSTEMTAP = "systemtap"
-SYSTEMTAP_libc-uclibc = ""
-SYSTEMTAP_mips = ""
-SYSTEMTAP_mips64 = ""
-SYSTEMTAP_mips64n32 = ""
-SYSTEMTAP_aarch64 = ""
-
-# lttng-ust uses sched_getcpu() which is not there on uclibc
-# for some of the architectures it can be patched to call the
-# syscall directly but for x86_64 __NR_getcpu is a vsyscall
-# which means we can not use syscall() to call it. So we ignore
-# it for x86_64/uclibc
-
-LTTNGUST = "lttng-ust"
-LTTNGUST_libc-uclibc = ""
-LTTNGUST_aarch64 = ""
+SYSTEMTAP:libc-musl = ""
+SYSTEMTAP:nios2 = ""
+SYSTEMTAP:riscv64 = ""
+SYSTEMTAP:riscv32 = ""
LTTNGTOOLS = "lttng-tools"
-LTTNGTOOLS_aarch64 = ""
-
-LTTNGMODULES = "lttng-modules"
-LTTNGMODULES_aarch64 = ""
+LTTNGTOOLS:arc = ""
+LTTNGTOOLS:riscv32 = ""
BABELTRACE = "babeltrace"
-BABELTRACE_aarch64 = ""
+BABELTRACE2 = "babeltrace2"
-# valgrind does not work on mips
+# valgrind does not work on the following configurations/architectures
VALGRIND = "valgrind"
-VALGRIND_libc-uclibc = ""
-VALGRIND_mips = ""
-VALGRIND_mips64 = ""
-VALGRIND_mips64n32 = ""
-VALGRIND_arm = ""
-VALGRIND_aarch64 = ""
-
-# exmap-console
-# exmap-server
-
-RDEPENDS_${PN} = "\
+VALGRIND:libc-musl = ""
+VALGRIND:mipsarch = ""
+VALGRIND:nios2 = ""
+VALGRIND:arc = ""
+VALGRIND:armv4 = ""
+VALGRIND:armv5 = ""
+VALGRIND:armv6 = ""
+VALGRIND:armeb = ""
+VALGRIND:aarch64 = ""
+VALGRIND:riscv64 = ""
+VALGRIND:riscv32 = ""
+VALGRIND:powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', '', 'valgrind', d)}"
+VALGRIND:linux-gnux32 = ""
+VALGRIND:linux-gnun32 = ""
+
+RDEPENDS:${PN} = "\
${PROFILETOOLS} \
- ${LTTNGUST} \
${LTTNGTOOLS} \
- ${LTTNGMODULES} \
${BABELTRACE} \
+ ${BABELTRACE2} \
${SYSTEMTAP} \
${VALGRIND} \
"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
index 95b3988b31..94405fd8fe 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
@@ -3,7 +3,6 @@
#
SUMMARY = "Testing tools/applications"
-LICENSE = "MIT"
PR = "r2"
@@ -11,17 +10,19 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit packagegroup
-# kexec-tools doesn't work on Mips
+# kexec-tools doesn't work on e5500-64b, microblaze and nios2 yet
KEXECTOOLS ?= "kexec"
-KEXECTOOLS_mips ?= ""
-KEXECTOOLS_mipsel ?= ""
-KEXECTOOLS_powerpc ?= ""
-KEXECTOOLS_e5500-64b ?= ""
-KEXECTOOLS_aarch64 ?= ""
+KEXECTOOLS:e5500-64b ?= ""
+KEXECTOOLS:microblaze ?= ""
+KEXECTOOLS:nios2 ?= ""
+KEXECTOOLS:riscv64 ?= ""
+KEXECTOOLS:riscv32 ?= ""
+
+GSTEXAMPLES ?= "gst-examples"
+GSTEXAMPLES:riscv64 = ""
X11GLTOOLS = "\
mesa-demos \
- piglit \
"
3GTOOLS = "\
@@ -29,20 +30,15 @@ X11GLTOOLS = "\
"
X11TOOLS = "\
- fstests \
- gst-player-bin \
+ ${GSTEXAMPLES} \
x11perf \
xrestop \
xwininfo \
xprop \
- xvideo-tests \
"
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
blktool \
- tslib-calibrate \
- tslib-tests \
- lrzsz \
${KEXECTOOLS} \
alsa-utils-amixer \
alsa-utils-aplay \
diff --git a/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb b/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb
index 180dd96f72..49c075eb11 100644
--- a/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb
@@ -1,6 +1,5 @@
SUMMARY = "Host SDK package for cross canadian toolchain"
PN = "packagegroup-cross-canadian-${MACHINE}"
-LICENSE = "MIT"
inherit cross-canadian packagegroup
@@ -11,9 +10,15 @@ BINUTILS = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}"
GCC = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
GDB = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
-RDEPENDS_${PN} = "\
+RDEPENDS:${PN} = "\
${@all_multilib_tune_values(d, 'BINUTILS')} \
${@all_multilib_tune_values(d, 'GCC')} \
${@all_multilib_tune_values(d, 'GDB')} \
meta-environment-${MACHINE} \
"
+
+# When TUNE_ARCH changes but MACHINE does not (for example when a machine definition is updated),
+# cross-canadian.bbclass prevents variable dependency propagation to TRANSLATED_TARGET_ARCH
+# This will result in erroneous reuse of previous sstate packages. The following line
+# establishes a direct dependency instead.
+do_package[vardeps] += "TUNE_ARCH"
diff --git a/meta/recipes-core/packagegroups/packagegroup-go-cross-canadian.bb b/meta/recipes-core/packagegroups/packagegroup-go-cross-canadian.bb
new file mode 100644
index 0000000000..d0596efe7a
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-go-cross-canadian.bb
@@ -0,0 +1,12 @@
+SUMMARY = "Host SDK package for Go cross canadian toolchain"
+PN = "packagegroup-go-cross-canadian-${MACHINE}"
+
+inherit cross-canadian packagegroup
+
+PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
+
+GO = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+RDEPENDS:${PN} = " \
+ ${@all_multilib_tune_values(d, 'GO')} \
+"
diff --git a/meta/recipes-core/packagegroups/packagegroup-go-sdk-target.bb b/meta/recipes-core/packagegroups/packagegroup-go-sdk-target.bb
new file mode 100644
index 0000000000..61629d273c
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-go-sdk-target.bb
@@ -0,0 +1,12 @@
+SUMMARY = "Target packages for the Go SDK"
+
+inherit packagegroup goarch
+
+RDEPENDS:${PN} = " \
+ go \
+ go-runtime \
+ go-runtime-dev \
+ go-runtime-staticdev \
+"
+
+COMPATIBLE_HOST = "^(?!riscv32).*"
diff --git a/meta/recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb b/meta/recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb
new file mode 100644
index 0000000000..0d4f5ec9ef
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-rust-cross-canadian.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Host SDK package for Rust cross canadian toolchain"
+PN = "packagegroup-rust-cross-canadian-${MACHINE}"
+
+inherit cross-canadian packagegroup
+
+PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
+
+RUST="rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+CARGO="cargo-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+RUST_TOOLS="rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
+
+RDEPENDS:${PN} = " \
+ ${@all_multilib_tune_values(d, 'RUST')} \
+ ${@all_multilib_tune_values(d, 'CARGO')} \
+ rust-cross-canadian-src \
+ ${@all_multilib_tune_values(d, 'RUST_TOOLS')} \
+"
+
diff --git a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
index 7d5a41adfc..9523aadd15 100644
--- a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -5,12 +5,16 @@
SUMMARY = "Self-hosting"
DESCRIPTION = "Packages required to run the build system"
PR = "r13"
-LICENSE = "MIT"
-inherit packagegroup distro_features_check
+PACKAGE_ARCH = "${TUNE_PKGARCH}"
+
+inherit packagegroup features_check
# rdepends on libx11-dev
REQUIRED_DISTRO_FEATURES = "x11"
+# rdepends on libgl
+REQUIRED_DISTRO_FEATURES += "opengl"
+
PACKAGES = "\
packagegroup-self-hosted \
packagegroup-self-hosted-debug \
@@ -20,7 +24,7 @@ PACKAGES = "\
packagegroup-self-hosted-host-tools \
"
-RDEPENDS_packagegroup-self-hosted = "\
+RDEPENDS:packagegroup-self-hosted = "\
packagegroup-self-hosted-debug \
packagegroup-self-hosted-sdk \
packagegroup-self-hosted-extended \
@@ -28,33 +32,26 @@ RDEPENDS_packagegroup-self-hosted = "\
packagegroup-self-hosted-host-tools \
"
-# midori depends on webkit-gtk which could not build for mips64
-MIDORI = "midori"
-MIDORI_mips64 = ""
-MIDORI_mips64n32 = ""
-
-RDEPENDS_packagegroup-self-hosted-host-tools = "\
- connman \
- connman-plugin-ethernet \
- dhcp-client \
+RDEPENDS:packagegroup-self-hosted-host-tools = "\
e2fsprogs \
e2fsprogs-e2fsck \
e2fsprogs-mke2fs \
e2fsprogs-tune2fs \
hdparm \
iptables \
- lsb \
+ lsb-release \
mc \
mc-fish \
mc-helpers \
mc-helpers-perl \
- mc-helpers-python \
parted \
- pseudo \
+ ${PSEUDO} \
screen \
"
+PSEUDO = "pseudo"
+PSEUDO:libc-musl = ""
-RRECOMMENDS_packagegroup-self-hosted-host-tools = "\
+RRECOMMENDS:packagegroup-self-hosted-host-tools = "\
kernel-module-tun \
kernel-module-iptable-raw \
kernel-module-iptable-nat \
@@ -62,7 +59,7 @@ RRECOMMENDS_packagegroup-self-hosted-host-tools = "\
kernel-module-iptable-filter \
"
-RDEPENDS_packagegroup-self-hosted-sdk = "\
+RDEPENDS:packagegroup-self-hosted-sdk = "\
autoconf \
automake \
binutils \
@@ -72,35 +69,36 @@ RDEPENDS_packagegroup-self-hosted-sdk = "\
cpp \
cpp-symlinks \
distcc \
- glibc-gconv-ibm850 \
file \
findutils \
g++ \
g++-symlinks \
gcc \
gcc-symlinks \
- intltool \
ldd \
less \
- libssp \
- libssp-dev \
- libssp-staticdev \
libstdc++ \
libstdc++-dev \
libtool \
make \
- mktemp \
perl-module-re \
perl-module-text-wrap \
pkgconfig \
quilt \
sed \
"
-# glibc-utils: for rpcgen
-RDEPENDS_packagegroup-self-hosted-sdk_append_libc-glibc = "\
+RDEPENDS:packagegroup-self-hosted-sdk:append:mingw32 = "\
+ libssp \
+ libssp-dev \
+ libssp-staticdev \
+ "
+# rpcsvc-proto: for rpcgen
+RDEPENDS:packagegroup-self-hosted-sdk:append:libc-glibc = "\
+ glibc-gconv-ibm850 \
glibc-utils \
+ rpcsvc-proto \
"
-RDEPENDS_packagegroup-self-hosted-debug = " \
+RDEPENDS:packagegroup-self-hosted-debug = " \
gdb \
gdbserver \
rsync \
@@ -108,9 +106,8 @@ RDEPENDS_packagegroup-self-hosted-debug = " \
tcf-agent"
-RDEPENDS_packagegroup-self-hosted-extended = "\
+RDEPENDS:packagegroup-self-hosted-extended = "\
bzip2 \
- chkconfig \
chrpath \
cpio \
curl \
@@ -128,12 +125,9 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
groff \
gzip \
settings-daemon \
- hicolor-icon-theme \
- sato-icon-theme \
libaio \
libusb1 \
libxml2 \
- lrzsz \
lsof \
lzo \
man \
@@ -143,25 +137,23 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
mtools \
ncurses \
ncurses-terminfo-base \
- neon \
nfs-utils \
nfs-utils-client \
openssl \
+ openssh-scp \
openssh-sftp-server \
+ openssh-ssh \
opkg \
opkg-utils \
patch \
perl \
perl-dev \
+ perl-misc \
perl-modules \
perl-pod \
- ${PTH} \
- python \
- python-compiler \
- python-git \
- python-misc \
- python-modules \
- python-rpm \
+ python3 \
+ python3-modules \
+ python3-git \
quota \
readline \
rpm \
@@ -172,7 +164,6 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
sysstat \
tar \
tcl \
- texi2html \
texinfo \
unzip \
usbutils \
@@ -186,22 +177,16 @@ RDEPENDS_packagegroup-self-hosted-extended = "\
"
-RDEPENDS_packagegroup-self-hosted-graphics = "\
+RDEPENDS:packagegroup-self-hosted-graphics = "\
builder \
libgl \
libgl-dev \
libglu \
libglu-dev \
- libsdl \
- libsdl-dev \
libx11-dev \
- python-pygtk \
- gtk-theme-clearlooks \
+ adwaita-icon-theme \
xdg-utils \
- ${MIDORI} \
- leafpad \
+ l3afpad \
pcmanfm \
vte \
"
-PTH = "pth"
-PTH_libc-uclibc = ""
diff --git a/meta/recipes-core/psplash/files/0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch b/meta/recipes-core/psplash/files/0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch
deleted file mode 100644
index 93b3c6bc73..0000000000
--- a/meta/recipes-core/psplash/files/0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 8f5de12cc75bfaa8400adf32f30c015d8f813540 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 22 Aug 2015 07:12:20 -0700
-Subject: [PATCH] psplash-fb: Convert psplash_fb_plot_pixel() to a static
- inline
-
-This function is not used outside psplash-fb.c and by making it
-static inline we keep the performance and also make it portable across
-multiple compilers and gcc versions
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- psplash-fb.c | 2 +-
- psplash-fb.h | 8 --------
- 2 files changed, 1 insertion(+), 9 deletions(-)
-
-diff --git a/psplash-fb.c b/psplash-fb.c
-index bd9cd9d..6d235db 100644
---- a/psplash-fb.c
-+++ b/psplash-fb.c
-@@ -260,7 +260,7 @@ psplash_fb_new (int angle)
-
- #define OFFSET(fb,x,y) (((y) * (fb)->stride) + ((x) * ((fb)->bpp >> 3)))
-
--inline void
-+static inline void
- psplash_fb_plot_pixel (PSplashFB *fb,
- int x,
- int y,
-diff --git a/psplash-fb.h b/psplash-fb.h
-index 42592ed..c6c3144 100644
---- a/psplash-fb.h
-+++ b/psplash-fb.h
-@@ -57,14 +57,6 @@ psplash_fb_destroy (PSplashFB *fb);
- PSplashFB*
- psplash_fb_new (int angle);
-
--inline void
--psplash_fb_plot_pixel (PSplashFB *fb,
-- int x,
-- int y,
-- uint8 red,
-- uint8 green,
-- uint8 blue);
--
- void
- psplash_fb_draw_rect (PSplashFB *fb,
- int x,
---
-2.1.4
-
diff --git a/meta/recipes-core/psplash/files/psplash-init b/meta/recipes-core/psplash/files/psplash-init
index 66c85e9335..e0f80bcdc0 100755
--- a/meta/recipes-core/psplash/files/psplash-init
+++ b/meta/recipes-core/psplash/files/psplash-init
@@ -7,6 +7,15 @@
# Default-Stop:
### END INIT INFO
+. /etc/default/rcS
+export PSPLASH_FIFO_DIR
+
+if [ ! -e /dev/fb0 ]; then
+ echo "Framebuffer /dev/fb0 not detected"
+ echo "Boot splashscreen disabled"
+ exit 0;
+fi
+
read CMDLINE < /proc/cmdline
for x in $CMDLINE; do
case $x in
@@ -17,8 +26,10 @@ for x in $CMDLINE; do
esac
done
-export TMPDIR=/mnt/.psplash
-mount tmpfs -t tmpfs $TMPDIR -o,size=40k
+[ -d $PSPLASH_FIFO_DIR ] || mkdir -p $PSPLASH_FIFO_DIR
+if ! mountpoint -q $PSPLASH_FIFO_DIR; then
+ mount tmpfs -t tmpfs $PSPLASH_FIFO_DIR -o,size=40k
+fi
rotation=0
if [ -e /etc/rotation ]; then
diff --git a/meta/recipes-core/psplash/files/psplash-start.service b/meta/recipes-core/psplash/files/psplash-start.service
new file mode 100644
index 0000000000..36c2bb38e0
--- /dev/null
+++ b/meta/recipes-core/psplash/files/psplash-start.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Start psplash boot splash screen
+DefaultDependencies=no
+RequiresMountsFor=/run
+
+[Service]
+Type=notify
+ExecStart=/usr/bin/psplash
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/meta/recipes-core/psplash/files/psplash-systemd.service b/meta/recipes-core/psplash/files/psplash-systemd.service
new file mode 100644
index 0000000000..082207f232
--- /dev/null
+++ b/meta/recipes-core/psplash/files/psplash-systemd.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Start psplash-systemd progress communication helper
+DefaultDependencies=no
+After=psplash-start.service
+Requires=psplash-start.service
+RequiresMountsFor=/run
+
+[Service]
+ExecStart=/usr/bin/psplash-systemd
+RemainAfterExit=yes
+
+[Install]
+WantedBy=sysinit.target
diff --git a/meta/recipes-core/psplash/psplash_git.bb b/meta/recipes-core/psplash/psplash_git.bb
index b3b64799ae..09038266b6 100644
--- a/meta/recipes-core/psplash/psplash_git.bb
+++ b/meta/recipes-core/psplash/psplash_git.bb
@@ -3,25 +3,28 @@ DESCRIPTION = "PSplash is a userspace graphical boot splash screen for mainly em
HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/psplash"
SECTION = "base"
LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=16;md5=840fb2356b10a85bed78dd09dc7745c6"
+LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=8f232c1e95929eacab37f00900580224"
+DEPENDS = "gdk-pixbuf-native"
-SRCREV = "14c8f7b705de944beb4de3f296506d80871e410f"
+SRCREV = "fdbd111d6bab2fbbae62a041123fc6b644aa97aa"
PV = "0.1+git${SRCPV}"
PR = "r15"
-SRC_URI = "git://git.yoctoproject.org/${BPN} \
- file://0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch \
+SRC_URI = "git://git.yoctoproject.org/${BPN};branch=master \
file://psplash-init \
+ file://psplash-start.service \
+ file://psplash-systemd.service \
${SPLASH_IMAGES}"
+UPSTREAM_CHECK_COMMITS = "1"
SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
python __anonymous() {
- oldpkgs = d.getVar("PACKAGES", True).split()
- splashfiles = d.getVar('SPLASH_IMAGES', True).split()
+ oldpkgs = d.getVar("PACKAGES").split()
+ splashfiles = d.getVar('SPLASH_IMAGES').split()
+ mlprefix = d.getVar('MLPREFIX') or ''
pkgs = []
localpaths = []
- haspng = False
for uri in splashfiles:
fetcher = bb.fetch2.Fetch([uri], d)
flocal = os.path.basename(fetcher.localpath(uri))
@@ -39,66 +42,78 @@ python __anonymous() {
bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
else:
pkgs.append(outname)
- if flocal.endswith(".png"):
- haspng = True
localpaths.append(flocal)
- # Set these so that we have less work to do in do_compile and do_install_append
+ # Set these so that we have less work to do in do_compile and do_install:append
d.setVar("SPLASH_INSTALL", " ".join(pkgs))
d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
+ for p in pkgs:
+ d.prependVar("PACKAGES", "%s%s " % (mlprefix, p))
- if haspng:
- d.appendVar("DEPENDS", " gdk-pixbuf-native")
-
- d.prependVar("PACKAGES", "%s " % (" ".join(pkgs)))
- mlprefix = d.getVar('MLPREFIX', True) or ''
- pn = d.getVar('PN', True) or ''
+ pn = d.getVar('PN') or ''
for p in pkgs:
ep = '%s%s' % (mlprefix, p)
epsplash = '%s%s' % (mlprefix, 'psplash')
- d.setVar("FILES_%s" % ep, "${bindir}/%s" % p)
- d.setVar("ALTERNATIVE_%s" % ep, 'psplash')
+ d.setVar("FILES:%s" % ep, "${bindir}/%s" % p)
+ d.setVar("ALTERNATIVE:%s" % ep, 'psplash')
d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
- d.appendVar("RDEPENDS_%s" % ep, " %s" % pn)
+ d.appendVar("RDEPENDS:%s" % ep, " %s" % pn)
if p == "psplash-default":
- d.appendVar("RRECOMMENDS_%s" % pn, " %s" % ep)
+ d.appendVar("RRECOMMENDS:%s" % pn, " %s" % ep)
}
S = "${WORKDIR}/git"
-inherit autotools pkgconfig update-rc.d update-alternatives
+inherit autotools pkgconfig update-rc.d update-alternatives systemd
+
+PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
+
+PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
python do_compile () {
import shutil
+ import subprocess
# Build a separate executable for each splash image
- workdir = d.getVar('WORKDIR', True)
- convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
- destfile = "%s/psplash-poky-img.h" % d.getVar('S', True)
- localfiles = d.getVar('SPLASH_LOCALPATHS', True).split()
- outputfiles = d.getVar('SPLASH_INSTALL', True).split()
+ workdir = d.getVar('WORKDIR')
+ convertscript = "%s/make-image-header.sh" % d.getVar('S')
+ destfile = "%s/psplash-poky-img.h" % d.getVar('B')
+ localfiles = d.getVar('SPLASH_LOCALPATHS').split()
+ outputfiles = d.getVar('SPLASH_INSTALL').split()
for localfile, outputfile in zip(localfiles, outputfiles):
if localfile.endswith(".png"):
- outp = oe.utils.getstatusoutput('%s %s POKY' % (convertscript, os.path.join(workdir, localfile)))
- print(outp[1])
+ if subprocess.call([ convertscript, os.path.join(workdir, localfile), 'POKY' ], cwd=workdir):
+ bb.fatal("Error calling convert script '%s'" % (convertscript))
fbase = os.path.splitext(localfile)[0]
- shutil.copyfile("%s-img.h" % fbase, destfile)
+ shutil.copyfile(os.path.join(workdir, "%s-img.h" % fbase), destfile)
else:
shutil.copyfile(os.path.join(workdir, localfile), destfile)
# For some reason just updating the header is not enough, we have to touch the .c
# file in order to get it to rebuild
- os.utime("%s/psplash.c" % d.getVar('S', True), None)
+ os.utime("%s/psplash.c" % d.getVar('S'), None)
bb.build.exec_func("oe_runmake", d)
shutil.copyfile("psplash", outputfile)
}
-do_install_append() {
- install -d ${D}/mnt/.psplash/
- install -d ${D}${sysconfdir}/init.d/
- install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
+do_install:append() {
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/init.d/
+ install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
+
+ # make fifo for psplash
+ install -d ${D}/mnt
+ mkfifo ${D}/mnt/psplash_fifo
+ fi
+
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -d ${D}${systemd_system_unitdir}
+ install -m 644 ${WORKDIR}/psplash-start.service ${D}/${systemd_system_unitdir}
+ install -m 644 ${WORKDIR}/psplash-systemd.service ${D}/${systemd_system_unitdir}
+ fi
+
install -d ${D}${bindir}
for i in ${SPLASH_INSTALL} ; do
install -m 0755 $i ${D}${bindir}/$i
@@ -106,17 +121,10 @@ do_install_append() {
rm -f ${D}${bindir}/psplash
}
-FILES_${PN} += "/mnt/.psplash"
+SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
+SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'psplash-start.service psplash-systemd.service', '', d)}"
INITSCRIPT_NAME = "psplash.sh"
INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
-DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
-pkg_postinst_${PN} () {
- if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
- if [ -n "$D" ]; then
- OPTS="--root=$D"
- fi
- systemctl $OPTS mask psplash.service
- fi
-}
+FILES:${PN} += "/mnt"
diff --git a/meta/recipes-core/readline/files/config-dirent-symbols.patch b/meta/recipes-core/readline/files/config-dirent-symbols.patch
deleted file mode 100644
index cfff03c0f8..0000000000
--- a/meta/recipes-core/readline/files/config-dirent-symbols.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Fix the names of the STRUCT_DIRENT_D symbols to match the names used by both
-configure and the source code.
-
-Upstream-Status: Submitted (http://lists.gnu.org/archive/html/bug-readline/2014-05/msg00008.html)
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From e48656811550774892fd4e0f4b3c7d418422da52 Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@intel.com>
-Date: Tue, 27 May 2014 22:32:31 +0100
-Subject: [PATCH] config.h.in: fix names of STRUCT_DIRENT_D symbols
-
----
- config.h.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/config.h.in b/config.h.in
-index a67e43e..a42acc5 100644
---- a/config.h.in
-+++ b/config.h.in
-@@ -244,9 +244,9 @@
-
- #undef HAVE_GETPW_DECLS
-
--#undef STRUCT_DIRENT_HAS_D_INO
-+#undef HAVE_STRUCT_DIRENT_D_INO
-
--#undef STRUCT_DIRENT_HAS_D_FILENO
-+#undef HAVE_STRUCT_DIRENT_D_FILENO
-
- #undef HAVE_BSD_SIGNALS
-
---
-1.7.10.4
-
diff --git a/meta/recipes-core/base-files/base-files/inputrc b/meta/recipes-core/readline/files/inputrc
index b5c4c8af24..b5c4c8af24 100644
--- a/meta/recipes-core/base-files/base-files/inputrc
+++ b/meta/recipes-core/readline/files/inputrc
diff --git a/meta/recipes-core/readline/readline-5.2/configure-fix.patch b/meta/recipes-core/readline/readline-5.2/configure-fix.patch
deleted file mode 100644
index be60a9861e..0000000000
--- a/meta/recipes-core/readline/readline-5.2/configure-fix.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Upstream-Status: Pending
-
-Without this it fails to link against libtermcap causing various missing symbols
-issues.
-
-RP - 8/10/08
-
-Index: readline-5.2/configure.in
-===================================================================
---- readline-5.2.orig/configure.in 2008-10-08 09:58:52.000000000 +0100
-+++ readline-5.2/configure.in 2008-10-08 09:59:03.000000000 +0100
-@@ -211,10 +211,10 @@
- AC_MSG_CHECKING(configuration for building shared libraries)
- eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
-
--# case "$SHLIB_LIBS" in
--# *curses*|*termcap*|*termlib*) ;;
--# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
--# esac
-+ case "$SHLIB_LIBS" in
-+ *curses*|*termcap*|*termlib*) ;;
-+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
-+ esac
-
- AC_SUBST(SHOBJ_CC)
- AC_SUBST(SHOBJ_CFLAGS)
diff --git a/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch b/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch
deleted file mode 100644
index 3166b470f2..0000000000
--- a/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-This support script ends up hardcoding unnecessary rpaths into the libraries. We
-will search $libdir automatically so this is just wastes space. There may be some
-cases this is necessary but our use cases aren't one of them.
-
-Upstream-Status: Inappropriate
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
-
-Index: readline-5.2/support/shobj-conf
-===================================================================
---- readline-5.2.orig/support/shobj-conf
-+++ readline-5.2/support/shobj-conf
-@@ -110,7 +110,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
- SHOBJ_LD='${CC}'
- SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
-
-- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
-+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
- SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
- ;;
-
diff --git a/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch b/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch
deleted file mode 100644
index 54d1ac6eb9..0000000000
--- a/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 8ef852a5be72c75e17f2510bea52455f809b56ce Mon Sep 17 00:00:00 2001
-From: Chet Ramey <chet.ramey@case.edu>
-Date: Fri, 28 Mar 2014 14:07:42 -0400
-Subject: [PATCH 04/10] Readline-6.3 patch 2
-
-Fixes multi-key issue identified in this thread:
-http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html
-
-Upstream-Status: Backport
-
-Signed-off-by: Saul Wold <sgw@linux.intel.com>
----
- readline.c | 3 ++-
- 1 files changed, 2 insertions(+), 1 deletions(-)
-
-diff --git a/readline.c b/readline.c
-index eb4eae3..abb29a0 100644
---- a/readline.c
-+++ b/readline.c
-@@ -744,7 +744,8 @@ _rl_dispatch_callback (cxt)
- r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
-
- RL_CHECK_SIGNALS ();
-- if (r == 0) /* success! */
-+ /* We only treat values < 0 specially to simulate recursion. */
-+ if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
- {
- _rl_keyseq_chain_dispose ();
- RL_UNSETSTATE (RL_STATE_MULTIKEY);
---
-1.8.3.1
-
diff --git a/meta/recipes-core/readline/readline-6.3/readline63-003 b/meta/recipes-core/readline/readline-6.3/readline63-003
deleted file mode 100644
index 98a9d810b6..0000000000
--- a/meta/recipes-core/readline/readline-6.3/readline63-003
+++ /dev/null
@@ -1,43 +0,0 @@
-readline: Security Advisory - readline - CVE-2014-2524
-
-Upstream-Status: Backport
-
-Signed-off-by: Yue Tao <yue.tao@windriver.com>
-
- READLINE PATCH REPORT
- =====================
-
-Readline-Release: 6.3
-Patch-ID: readline63-003
-
-Bug-Reported-by:
-Bug-Reference-ID:
-Bug-Reference-URL:
-
-Bug-Description:
-
-There are debugging functions in the readline release that are theoretically
-exploitable as security problems. They are not public functions, but have
-global linkage.
-
-Patch (apply with `patch -p0'):
-
-*** ../readline-6.3/util.c 2013-09-02 13:36:12.000000000 -0400
---- util.c 2014-03-20 10:25:53.000000000 -0400
-***************
-*** 477,480 ****
---- 479,483 ----
- }
-
-+ #if defined (DEBUG)
- #if defined (USE_VARARGS)
- static FILE *_rl_tracefp;
-***************
-*** 539,542 ****
---- 542,546 ----
- }
- #endif
-+ #endif /* DEBUG */
-
-
-
diff --git a/meta/recipes-core/readline/readline-6.3/configure-fix.patch b/meta/recipes-core/readline/readline-8.1/configure-fix.patch
index ef3104f8a6..ef3104f8a6 100644
--- a/meta/recipes-core/readline/readline-6.3/configure-fix.patch
+++ b/meta/recipes-core/readline/readline-8.1/configure-fix.patch
diff --git a/meta/recipes-core/readline/files/norpath.patch b/meta/recipes-core/readline/readline-8.1/norpath.patch
index 5d71582b70..5d71582b70 100644
--- a/meta/recipes-core/readline/files/norpath.patch
+++ b/meta/recipes-core/readline/readline-8.1/norpath.patch
diff --git a/meta/recipes-core/readline/readline-8.1/rl-native.map b/meta/recipes-core/readline/readline-8.1/rl-native.map
new file mode 100644
index 0000000000..5e7d49cdd2
--- /dev/null
+++ b/meta/recipes-core/readline/readline-8.1/rl-native.map
@@ -0,0 +1,12 @@
+READLINE_6.3 {
+ rl_change_environment;
+ rl_clear_history;
+ rl_executing_key;
+ rl_executing_keyseq;
+ rl_filename_stat_hook;
+ rl_history_substr_search_backward;
+ rl_history_substr_search_forward;
+ rl_input_available_hook;
+ rl_print_last_kbd_macro;
+ rl_signal_event_hook;
+};
diff --git a/meta/recipes-core/readline/readline.inc b/meta/recipes-core/readline/readline.inc
index 3f662c3070..569e4ff6e9 100644
--- a/meta/recipes-core/readline/readline.inc
+++ b/meta/recipes-core/readline/readline.inc
@@ -4,6 +4,7 @@ command lines as they are typed in. Both Emacs and vi editing modes are availabl
additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \
lines, and perform csh-like history expansion on previous commands."
SECTION = "libs"
+HOMEPAGE = "https://tiswww.case.edu/php/chet/readline/rltop.html"
# GPLv2+ (< 6.0), GPLv3+ (>= 6.0)
LICENSE = "GPLv3+"
@@ -11,29 +12,46 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
DEPENDS += "ncurses"
-SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
- file://configure-fix.patch \
- file://config-dirent-symbols.patch \
- file://norpath.patch"
+SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive"
+SRC_URI += "file://inputrc"
inherit autotools texinfo
EXTRA_AUTORECONF += "--exclude=autoheader"
+EXTRA_OECONF += "bash_cv_termcap_lib=ncurses"
LEAD_SONAME = "libreadline.so"
-do_configure_prepend () {
+do_configure:prepend () {
if [ ! -e ${S}/acinclude.m4 ]; then
cat ${S}/aclocal.m4 > ${S}/acinclude.m4
fi
}
-do_install_append () {
+do_install:append () {
# Make install doesn't properly install these
oe_libinstall -so -C shlib libhistory ${D}${libdir}
oe_libinstall -so -C shlib libreadline ${D}${libdir}
rmdir ${D}${bindir}
+ rm -rf ${D}${datadir}/${BPN}/*.c
+ rmdir ${D}${datadir}/${BPN} || true
+
+ install -m 0755 -d ${D}${sysconfdir}
+ install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc
}
BBCLASSEXTEND = "native nativesdk"
+
+CONFFILES:${PN} += "${sysconfdir}/inputrc"
+
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE:${PN}-doc = "history.3"
+ALTERNATIVE_LINK_NAME[history.3] = "${mandir}/man3/history.3"
+
+# OpenSuse injects versions into libreadline leading to conficits between our native one and theirs
+# see their spec file for where this is injected. Extra versioning is harmless so we just do the same.
+SRC_URI:append:class-native = " file://rl-native.map"
+LDFLAGS:append:class-native = " -Wl,--version-script=${WORKDIR}/rl-native.map"
diff --git a/meta/recipes-core/readline/readline_5.2.bb b/meta/recipes-core/readline/readline_5.2.bb
deleted file mode 100644
index c1007a2311..0000000000
--- a/meta/recipes-core/readline/readline_5.2.bb
+++ /dev/null
@@ -1,84 +0,0 @@
-SUMMARY = "Library for editing typed command lines"
-DESCRIPTION = "The GNU Readline library provides a set of functions for use by applications that allow users to edit \
-command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes \
-additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \
-lines, and perform csh-like history expansion on previous commands."
-SECTION = "libs"
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=03b36fdd84f74b8d8189a202b980b67f"
-
-DEPENDS += "ncurses"
-
-PR = "r9"
-
-SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-001;name=patch1;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-002;name=patch2;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-003;name=patch3;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-004;name=patch4;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-005;name=patch5;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-006;name=patch6;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-007;name=patch7;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-008;name=patch8;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-009;name=patch9;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-010;name=patch10;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-011;name=patch11;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-012;name=patch12;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-013;name=patch13;apply=yes;striplevel=0 \
- ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-014;name=patch14;apply=yes;striplevel=0 \
- file://configure-fix.patch \
- file://config-dirent-symbols.patch \
- file://fix-redundant-rpath.patch"
-
-SRC_URI[archive.md5sum] = "e39331f32ad14009b9ff49cc10c5e751"
-SRC_URI[archive.sha256sum] = "12e88d96aee2cd1192500356f0535540db499282ca7f76339fb4228c31249f45"
-
-SRC_URI[patch1.md5sum] = "9d4d41622aa9b230c57f68548ce87d8f"
-SRC_URI[patch1.sha256sum] = "eac304c369154059f93049ada328739faaf40338d3cb1fb4b544c93d5ce3f8d5"
-SRC_URI[patch2.md5sum] = "f03e512d14206e37f7d6a748b56b9476"
-SRC_URI[patch2.sha256sum] = "9deacaef25507a0c2ae0b661bf9342559b59a2954d66ea3c5f5bcd900fdfcf78"
-SRC_URI[patch3.md5sum] = "252b42d8750f1a94b6bdf086612dceb2"
-SRC_URI[patch3.sha256sum] = "2a55d2ecb1c9b0147aeb193a6323616ab31c1c525a83b2db3a994b15594ba934"
-SRC_URI[patch4.md5sum] = "a32333c2e603a3ed250514e91050e552"
-SRC_URI[patch4.sha256sum] = "a03b65633781efa7c3aae5d57162985e7b7a3c10acf0f2621be610e16f27e5f2"
-SRC_URI[patch5.md5sum] = "8106796c09b789523a3a78ab69c04b6d"
-SRC_URI[patch5.sha256sum] = "06001896514148a757ea6edbbd40c4fc4331dc653847244386c37b138b150f64"
-SRC_URI[patch6.md5sum] = "512188e2bf0837f7eca19dbf71f182ae"
-SRC_URI[patch6.sha256sum] = "dfef3e982c0adf8bb5a9b7d0468ec8f5f18138b325e28759437464de5be71013"
-SRC_URI[patch7.md5sum] = "ac17aca62eb6fb398c9f2fe9de540aff"
-SRC_URI[patch7.sha256sum] = "775b028c7b761397ac6ae1bdfbac7e896dc3b9b3adc2f91312499180ca13bdd1"
-SRC_URI[patch8.md5sum] = "2484c392db021905f112cf97a94dfd4c"
-SRC_URI[patch8.sha256sum] = "a21b4e0bf0530b878bad24d5be23d18a9e03a75a31ae30844dc0933bb3d77ecd"
-SRC_URI[patch9.md5sum] = "fc6eb35d07914fae5c57d49c12483ff7"
-SRC_URI[patch9.sha256sum] = "138d5e0f0709a47a2d1621295a3dd5e3cc73b63b5cc28dab03abc4e94fe95ecf"
-SRC_URI[patch10.md5sum] = "7a2bf3dc7ac7680b1461a5701100e91b"
-SRC_URI[patch10.sha256sum] = "83f8c1aadb86b1a2fad8821a9c6be72a8de5afd7fd9fde58a30b3b57d939693e"
-SRC_URI[patch11.md5sum] = "ef6cef6822663470f6ac8c517c5a7ec6"
-SRC_URI[patch11.sha256sum] = "08ad3384ab0906e6fa4cc417eb8c43ff59375bcead15fd5c8e31730f0413b3d6"
-SRC_URI[patch12.md5sum] = "e3e9f441c8111589855bc363e5640f6c"
-SRC_URI[patch12.sha256sum] = "20f0243be2299c23213492cc2c19cfd15cc528d2b566a76a2de58306bb9e4c9e"
-SRC_URI[patch13.md5sum] = "3e2e5f543ed268a68fd1fa839faade1a"
-SRC_URI[patch13.sha256sum] = "0cc649516a5bdfa61c5e56937407570288b6972d75aa1bd060ad30ebe98144d5"
-SRC_URI[patch14.md5sum] = "a1be30e1c6f1099bb5fcef00a2631fb8"
-SRC_URI[patch14.sha256sum] = "6f1a68320d01522ca1ea5a737124ecc8739f3dcbfea2dee21e3ccf839a21a817"
-
-inherit autotools
-
-EXTRA_AUTORECONF += "--exclude=autoheader"
-
-LEAD_SONAME = "libreadline.so"
-
-do_configure_prepend () {
- if [ ! -e ${S}/acinclude.m4 ]; then
- cat ${S}/aclocal.m4 > ${S}/acinclude.m4
- fi
-}
-
-do_install_append () {
- # Make install doesn't properly install these
- oe_libinstall -so -C shlib libhistory ${D}${libdir}
- oe_libinstall -so -C shlib libreadline ${D}${libdir}
-}
-
-BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/readline/readline_6.3.bb b/meta/recipes-core/readline/readline_6.3.bb
deleted file mode 100644
index 55964a6cf8..0000000000
--- a/meta/recipes-core/readline/readline_6.3.bb
+++ /dev/null
@@ -1,8 +0,0 @@
-require readline.inc
-
-SRC_URI += "file://readline63-003 \
- file://readline-dispatch-multikey.patch"
-
-SRC_URI[archive.md5sum] = "33c8fb279e981274f485fd91da77e94a"
-SRC_URI[archive.sha256sum] = "56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"
-
diff --git a/meta/recipes-core/readline/readline_8.1.bb b/meta/recipes-core/readline/readline_8.1.bb
new file mode 100644
index 0000000000..0786a08163
--- /dev/null
+++ b/meta/recipes-core/readline/readline_8.1.bb
@@ -0,0 +1,7 @@
+require readline.inc
+
+SRC_URI += "file://configure-fix.patch \
+ file://norpath.patch"
+
+SRC_URI[archive.md5sum] = "e9557dd5b1409f5d7b37ef717c64518e"
+SRC_URI[archive.sha256sum] = "f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02"
diff --git a/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb b/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb
index b9f40f4335..72f8069e61 100644
--- a/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb
+++ b/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb
@@ -3,8 +3,8 @@ DESCRIPTION = "Tools for working with the sysfs virtual filesystem. The tool 's
HOMEPAGE = "http://linux-diag.sourceforge.net/Sysfsutils.html"
LICENSE = "GPLv2 & LGPLv2.1"
-LICENSE_${PN} = "GPLv2"
-LICENSE_libsysfs = "LGPLv2.1"
+LICENSE:${PN} = "GPLv2"
+LICENSE:libsysfs = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=3d06403ea54c7574a9e581c6478cc393 \
file://cmd/GPL;md5=d41d4e2e1e108554e0388ea4aecd8d27 \
file://lib/LGPL;md5=b75d069791103ffe1c0d6435deeff72e"
@@ -17,13 +17,15 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/linux-diag/sysfsutils-${PV}.tar.gz \
SRC_URI[md5sum] = "14e7dcd0436d2f49aa403f67e1ef7ddc"
SRC_URI[sha256sum] = "e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a"
+
+UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/linux-diag/files/sysfsutils/"
+UPSTREAM_CHECK_REGEX = "/sysfsutils/(?P<pver>(\d+[\.\-_]*)+)/"
+
S = "${WORKDIR}/sysfsutils-${PV}"
inherit autotools
PACKAGES =+ "libsysfs"
-FILES_libsysfs = "${libdir}/lib*${SOLIBS}"
-FILES_libsysfs-dev = "${libdir}/lib*${SOLIBSDEV} ${includedir}"
-FILES_libsysfs-staticdev = "${libdir}/lib*.a"
+FILES:libsysfs = "${libdir}/lib*${SOLIBS}"
export libdir = "${base_libdir}"
diff --git a/meta/recipes-core/systemd/systemd-boot_249.5.bb b/meta/recipes-core/systemd/systemd-boot_249.5.bb
new file mode 100644
index 0000000000..b3d4e31e08
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-boot_249.5.bb
@@ -0,0 +1,74 @@
+require systemd.inc
+FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
+
+require conf/image-uefi.conf
+
+DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native python3-jinja2-native"
+
+inherit meson pkgconfig gettext
+inherit deploy
+
+LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
+
+do_write_config[vardeps] += "CC OBJCOPY"
+do_write_config:append() {
+ cat >${WORKDIR}/meson-${PN}.cross <<EOF
+[binaries]
+efi_cc = ${@meson_array('CC', d)}
+objcopy = ${@meson_array('OBJCOPY', d)}
+EOF
+}
+
+# need to use ${HOST_PREFIX} here, otherwise ld.bfd could be used from HOSTTOOLS_NONFATAL
+EFI_LD = "${HOST_PREFIX}ld.bfd"
+
+EXTRA_OEMESON += "-Defi=true \
+ -Dgnu-efi=true \
+ -Defi-includedir=${STAGING_INCDIR}/efi \
+ -Defi-libdir=${STAGING_LIBDIR} \
+ -Defi-ld=${EFI_LD} \
+ -Dman=false \
+ --cross-file ${WORKDIR}/meson-${PN}.cross \
+ "
+
+# install to the image as boot*.efi if its the EFI_PROVIDER,
+# otherwise install as the full name.
+# This allows multiple bootloaders to coexist in a single image.
+python __anonymous () {
+ import re
+ target = d.getVar('TARGET_ARCH')
+ prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
+ systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
+ d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
+ prefix = "systemd-" if prefix == "" else ""
+ d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
+}
+
+FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
+
+RDEPENDS:${PN} += "virtual-systemd-bootconf"
+
+# Imported from the old gummiboot recipe
+TUNE_CCARGS:remove = "-mfpmath=sse"
+
+COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
+COMPATIBLE_HOST:x86-x32 = "null"
+
+do_compile() {
+ ninja \
+ src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
+ src/boot/efi/linux${EFI_ARCH}.efi.stub
+}
+
+do_install() {
+ install -d ${D}${EFI_FILES_PATH}
+ install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
+}
+
+do_deploy () {
+ install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
+ install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
+}
+
+addtask deploy before do_build after do_compile
+
diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
new file mode 100644
index 0000000000..19637546a9
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
@@ -0,0 +1,32 @@
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+SUMMARY = "Basic systemd-boot configuration files"
+
+RPROVIDES:${PN} += "virtual-systemd-bootconf"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+inherit systemd-boot-cfg
+
+S = "${WORKDIR}"
+
+LABELS = "boot"
+
+ROOT ?= "root=/dev/sda2"
+APPEND:append = " ${ROOT}"
+
+python do_configure() {
+ bb.build.exec_func('build_efi_cfg', d)
+}
+
+do_configure[vardeps] += "APPEND"
+
+do_install() {
+ install -d ${D}/boot
+ install -d ${D}/boot/loader
+ install -d ${D}/boot/loader/entries
+ install loader.conf ${D}/boot/loader/
+ rm loader.conf
+ install *.conf ${D}/boot/loader/entries/
+}
+
+FILES:${PN} = "/boot/loader/* /boot/loader/entries/*"
diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 0b8ff09b2b..55ebf99117 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -1,17 +1,20 @@
SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
-
+HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
PR = "r29"
-DEPENDS = "systemd-systemctl-native"
+PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
S = "${WORKDIR}"
-inherit allarch
+inherit features_check
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+ALLOW_EMPTY:${PN} = "1"
-ALLOW_EMPTY_${PN} = "1"
+REQUIRED_DISTRO_FEATURES = "systemd"
SYSTEMD_DISABLED_SYSV_SERVICES = " \
busybox-udhcpc \
@@ -22,22 +25,25 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \
syslog.busybox \
"
-pkg_postinst_${PN} () {
- cd $D${sysconfdir}/init.d
+pkg_postinst:${PN} () {
- echo "Disabling the following sysv scripts: "
+ cd $D${sysconfdir}/init.d || exit 0
- OPTS=""
+ echo "Disabling the following sysv scripts: "
if [ -n "$D" ]; then
OPTS="--root=$D"
+ else
+ OPTS=""
fi
for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
- if [ \( -e $i -o $i.sh \) -a ! \( -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service \) ] ; then
- echo -n "$i: " ; systemctl ${OPTS} mask $i.service
+ if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then
+ echo -n "$i: "
+ systemctl $OPTS mask $i.service
fi
- done ; echo
+ done
+ echo
}
-RDPEPENDS_${PN} = "systemd"
+RDEPENDS:${PN} = "systemd"
diff --git a/meta/recipes-core/systemd/systemd-conf/journald.conf b/meta/recipes-core/systemd/systemd-conf/journald.conf
new file mode 100644
index 0000000000..fd4d969fa7
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/journald.conf
@@ -0,0 +1,3 @@
+[Journal]
+ForwardToSyslog=yes
+RuntimeMaxUse=64M
diff --git a/meta/recipes-core/systemd/systemd-conf/logind.conf b/meta/recipes-core/systemd/systemd-conf/logind.conf
new file mode 100644
index 0000000000..bf7f6920fa
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/logind.conf
@@ -0,0 +1,2 @@
+[Login]
+KillUserProcesses=yes
diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf b/meta/recipes-core/systemd/systemd-conf/system.conf
new file mode 100644
index 0000000000..554cab26c2
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/system.conf
@@ -0,0 +1,2 @@
+[Manager]
+DefaultMemoryAccounting=yes
diff --git a/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall b/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall
new file mode 100644
index 0000000000..741be27cb4
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/system.conf-qemuall
@@ -0,0 +1,3 @@
+[Manager]
+# Change DefaultTimeoutStartSec from 90s to 240s
+DefaultTimeoutStartSec = 240s
diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network
new file mode 100644
index 0000000000..7406287248
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/wired.network
@@ -0,0 +1,13 @@
+[Match]
+Type=ether
+Name=!veth*
+KernelCommandLine=!nfsroot
+KernelCommandLine=!ip
+
+[Network]
+DHCP=yes
+
+[DHCP]
+UseMTU=yes
+RouteMetric=10
+ClientIdentifier=mac
diff --git a/meta/recipes-core/systemd/systemd-conf_1.0.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb
new file mode 100644
index 0000000000..53af7c616a
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb
@@ -0,0 +1,43 @@
+SUMMARY = "Systemd system configuration"
+DESCRIPTION = "Systemd may require slightly different configuration for \
+different machines. For example, qemu machines require a longer \
+DefaultTimeoutStartSec setting."
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+PE = "1"
+
+PACKAGECONFIG ??= "dhcp-ethernet"
+PACKAGECONFIG[dhcp-ethernet] = ""
+
+SRC_URI = "\
+ file://journald.conf \
+ file://logind.conf \
+ file://system.conf \
+ file://system.conf-qemuall \
+ file://wired.network \
+"
+
+do_install() {
+ install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
+ install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
+ install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_system_unitdir}.conf.d/00-${PN}.conf
+
+ if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then
+ install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network
+ fi
+}
+
+# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
+do_install:append:qemuall() {
+ install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_system_unitdir}.conf.d/01-${PN}.conf
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES:${PN} = "\
+ ${systemd_unitdir}/journald.conf.d/ \
+ ${systemd_unitdir}/logind.conf.d/ \
+ ${systemd_system_unitdir}.conf.d/ \
+ ${systemd_unitdir}/network/ \
+"
diff --git a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb
new file mode 100644
index 0000000000..12f27d6ae3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb
@@ -0,0 +1,13 @@
+SUMMARY = "Machine specific systemd units"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+PR = "r19"
+
+inherit systemd
+SYSTEMD_SERVICE:${PN} = ""
+
+ALLOW_EMPTY:${PN} = "1"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index 768b1308f2..7ca951cdbd 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -1,22 +1,29 @@
SUMMARY = "Serial terminal support for systemd"
+HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/"
LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
PR = "r5"
-SERIAL_CONSOLE ?= "115200 ttyS0"
+SERIAL_CONSOLES ?= "115200;ttyS0"
+SERIAL_TERM ?= "linux"
SRC_URI = "file://serial-getty@.service"
S = "${WORKDIR}"
+# As this package is tied to systemd, only build it when we're also building systemd.
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "systemd"
+
do_install() {
if [ ! -z "${SERIAL_CONSOLES}" ] ; then
default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
- install -d ${D}${systemd_unitdir}/system/
+ install -d ${D}${systemd_system_unitdir}/
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
- install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
- sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service
+ install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/
+ sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service
+ sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service
tmp="${SERIAL_CONSOLES}"
for entry in $tmp ; do
@@ -24,28 +31,22 @@ do_install() {
ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
if [ "$baudrate" = "$default_baudrate" ] ; then
# enable the service
- ln -sf ${systemd_unitdir}/system/serial-getty@.service \
+ ln -sf ${systemd_system_unitdir}/serial-getty@.service \
${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
else
# install custom service file for the non-default baudrate
- install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
- sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
+ install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
+ sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
# enable the service
- ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \
+ ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \
${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
fi
done
fi
}
-RDEPENDS_${PN} = "systemd"
-
# This is a machine specific file
-FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
+FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
-# As this package is tied to systemd, only build it when we're also building systemd.
-python () {
- if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
- raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
-}
+ALLOW_EMPTY:${PN} = "1"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
index 182167befe..b16fe1188e 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
+++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-2.1+
+#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
@@ -9,8 +11,9 @@
Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
-BindsTo=dev-%i.device
-After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
+PartOf=dev-%i.device
+ConditionPathExists=/dev/%i
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
After=rc-local.service
# If additional gettys are spawned during boot then we should make
@@ -19,12 +22,17 @@ After=rc-local.service
Before=getty.target
IgnoreOnIsolate=yes
+# IgnoreOnIsolate causes issues with sulogin, if someone isolates
+# rescue.target or starts rescue.service from multi-user.target or
+# graphical.target.
+Conflicts=rescue.service
+Before=rescue.service
+
[Service]
-Environment="TERM=xterm"
-ExecStart=-/sbin/agetty -8 -L --keep-baud %I @BAUDRATE@ $TERM
+Environment="TERM=@TERM@"
+ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
Type=idle
Restart=always
-RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb
index fbdc9c0a18..fadc8433d8 100644
--- a/meta/recipes-core/systemd/systemd-systemctl-native.bb
+++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb
@@ -1,7 +1,7 @@
SUMMARY = "Wrapper for enabling systemd services"
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
PR = "r6"
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index 6e163bd5c2..6324319a45 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -1,182 +1,340 @@
-#!/bin/sh
-echo "Started $0 $*"
-
-ROOT=
-
-# parse command line params
-action=
-while [ $# != 0 ]; do
- opt="$1"
-
- case "$opt" in
- enable)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
- disable)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
- mask)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
- preset)
- shift
-
- action="$opt"
- services="$1"
- cmd_args="1"
- shift
- ;;
- --root=*)
- ROOT=${opt##--root=}
- cmd_args="0"
- shift
- ;;
- *)
- if [ "$cmd_args" = "1" ]; then
- services="$services $opt"
- shift
- else
- echo "'$opt' is an unkown option; exiting with error"
- exit 1
- fi
- ;;
- esac
-done
-if [ "$action" = "preset" -a "$service_file" = "" ]; then
- services=$(for f in `find $ROOT/etc/systemd/system $ROOT/lib/systemd/system $ROOT/usr/lib/systemd/system -type f 2>1`; do basename $f; done)
- services="$services $opt"
- presetall=1
-fi
-
-for service in $services; do
- if [ "$presetall" = "1" ]; then
- action="preset"
- fi
- if [ "$action" = "mask" ]; then
- if [ ! -d $ROOT/etc/systemd/system/ ]; then
- mkdir -p $ROOT/etc/systemd/system/
- fi
- cmd="ln -s /dev/null $ROOT/etc/systemd/system/$service"
- echo "$cmd"
- $cmd
- exit 0
- fi
-
- service_base_file=`echo $service | sed 's/\(@\).*\(\.[^.]\+\)/\1\2/'`
- if [ -z `echo $service | sed '/@/p;d'` ]; then
- echo "Try to find location of $service..."
- service_template=false
- else
- echo "Try to find location of template $service_base_file of instance $service..."
- service_template=true
- if [ -z `echo $service | sed 's/^.\+@\(.*\)\.[^.]\+/\1/'` ]; then
- instance_specified=false
- else
- instance_specified=true
- fi
- fi
-
- # find service file
- for p in $ROOT/etc/systemd/system \
- $ROOT/lib/systemd/system \
- $ROOT/usr/lib/systemd/system; do
- if [ -e $p/$service_base_file ]; then
- service_file=$p/$service_base_file
- service_file=${service_file##$ROOT}
- fi
- done
- if [ -z "$service_file" ]; then
- echo "'$service_base_file' couldn't be found; exiting with error"
- exit 1
- fi
- echo "Found $service in $service_file"
-
- # If any new unit types are added to systemd they should be added
- # to this regular expression.
- unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)$'
- if [ "$action" = "preset" ]; then
- action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
- if [ -z "$action" ]; then
- globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
- if [ -n "$globalpreset" ]; then
- action="$globalpreset"
- else
- action="enable"
- fi
- fi
- fi
- # create the required symbolic links
- wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
- | tr ',' '\n' \
- | grep "$unit_types_re")
-
- for r in $wanted_by; do
- echo "WantedBy=$r found in $service"
- if [ "$action" = "enable" ]; then
- enable_service=$service
- if [ "$service_template" = true -a "$instance_specified" = false ]; then
- default_instance=$(sed '/^DefaultInstance[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file")
- if [ -z $default_instance ]; then
- echo "Template unit without instance or DefaultInstance directive, nothing to enable"
- continue
- else
- echo "Found DefaultInstance $default_instance, enabling it"
- enable_service=$(echo $service | sed "s/@/@$default_instance/")
- fi
- fi
- mkdir -p $ROOT/etc/systemd/system/$r.wants
- ln -s $service_file $ROOT/etc/systemd/system/$r.wants/$enable_service
- echo "Enabled $enable_service for $wanted_by."
- else
- if [ "$service_template" = true -a "$instance_specified" = false ]; then
- disable_service="$ROOT/etc/systemd/system/$r.wants/`echo $service | sed 's/@/@*/'`"
- else
- disable_service="$ROOT/etc/systemd/system/$r.wants/$service"
- fi
- rm -f $disable_service
- [ -d $ROOT/etc/systemd/system/$r.wants ] && rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants
- echo "Disabled ${disable_service##$ROOT/etc/systemd/system/$r.wants/} for $wanted_by."
- fi
- done
-
- # create the required symbolic 'Alias' links
- alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
- | tr ',' '\n' \
- | grep "$unit_types_re")
-
- for r in $alias; do
- if [ "$action" = "enable" ]; then
- mkdir -p $ROOT/etc/systemd/system
- ln -s $service_file $ROOT/etc/systemd/system/$r
- echo "Enabled $service for $alias."
- else
- rm -f $ROOT/etc/systemd/system/$r
- echo "Disabled $service for $alias."
- fi
- done
-
- # call us for the other required scripts
- also=$(sed '/^Also[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
- | tr ',' '\n')
- for a in $also; do
- echo "Also=$a found in $service"
- if [ "$action" = "enable" ]; then
- $0 --root=$ROOT enable $a
- fi
- done
-done
+#!/usr/bin/env python3
+"""systemctl: subset of systemctl used for image construction
+
+Mask/preset systemd units
+"""
+
+import argparse
+import fnmatch
+import os
+import re
+import sys
+
+from collections import namedtuple
+from pathlib import Path
+
+version = 1.0
+
+ROOT = Path("/")
+SYSCONFDIR = Path("etc")
+BASE_LIBDIR = Path("lib")
+LIBDIR = Path("usr", "lib")
+
+locations = list()
+
+
+class SystemdFile():
+ """Class representing a single systemd configuration file"""
+ def __init__(self, root, path):
+ self.sections = dict()
+ self._parse(root, path)
+ dirname = os.path.basename(path.name) + ".d"
+ for location in locations:
+ for path2 in sorted((root / location / "system" / dirname).glob("*.conf")):
+ self._parse(root, path2)
+
+ def _parse(self, root, path):
+ """Parse a systemd syntax configuration file
+
+ Args:
+ path: A pathlib.Path object pointing to the file
+
+ """
+ skip_re = re.compile(r"^\s*([#;]|$)")
+ section_re = re.compile(r"^\s*\[(?P<section>.*)\]")
+ kv_re = re.compile(r"^\s*(?P<key>[^\s]+)\s*=\s*(?P<value>.*)")
+ section = None
+
+ if path.is_symlink():
+ try:
+ path.resolve()
+ except FileNotFoundError:
+ # broken symlink, try relative to root
+ path = root / Path(os.readlink(str(path))).relative_to(ROOT)
+
+ with path.open() as f:
+ for line in f:
+ if skip_re.match(line):
+ continue
+
+ line = line.strip()
+ m = section_re.match(line)
+ if m:
+ if m.group('section') not in self.sections:
+ section = dict()
+ self.sections[m.group('section')] = section
+ else:
+ section = self.sections[m.group('section')]
+ continue
+
+ while line.endswith("\\"):
+ line += f.readline().rstrip("\n")
+
+ m = kv_re.match(line)
+ k = m.group('key')
+ v = m.group('value')
+ if k not in section:
+ section[k] = list()
+ section[k].extend(v.split())
+
+ def get(self, section, prop):
+ """Get a property from section
+
+ Args:
+ section: Section to retrieve property from
+ prop: Property to retrieve
+
+ Returns:
+ List representing all properties of type prop in section.
+
+ Raises:
+ KeyError: if ``section`` or ``prop`` not found
+ """
+ return self.sections[section][prop]
+
+
+class Presets():
+ """Class representing all systemd presets"""
+ def __init__(self, scope, root):
+ self.directives = list()
+ self._collect_presets(scope, root)
+
+ def _parse_presets(self, presets):
+ """Parse presets out of a set of preset files"""
+ skip_re = re.compile(r"^\s*([#;]|$)")
+ directive_re = re.compile(r"^\s*(?P<action>enable|disable)\s+(?P<unit_name>(.+))")
+
+ Directive = namedtuple("Directive", "action unit_name")
+ for preset in presets:
+ with preset.open() as f:
+ for line in f:
+ m = directive_re.match(line)
+ if m:
+ directive = Directive(action=m.group('action'),
+ unit_name=m.group('unit_name'))
+ self.directives.append(directive)
+ elif skip_re.match(line):
+ pass
+ else:
+ sys.exit("Unparsed preset line in {}".format(preset))
+
+ def _collect_presets(self, scope, root):
+ """Collect list of preset files"""
+ presets = dict()
+ for location in locations:
+ paths = (root / location / scope).glob("*.preset")
+ for path in paths:
+ # earlier names override later ones
+ if path.name not in presets:
+ presets[path.name] = path
+
+ self._parse_presets([v for k, v in sorted(presets.items())])
+
+ def state(self, unit_name):
+ """Return state of preset for unit_name
+
+ Args:
+ presets: set of presets
+ unit_name: name of the unit
+
+ Returns:
+ None: no matching preset
+ `enable`: unit_name is enabled
+ `disable`: unit_name is disabled
+ """
+ for directive in self.directives:
+ if fnmatch.fnmatch(unit_name, directive.unit_name):
+ return directive.action
+
+ return None
+
+
+def add_link(path, target):
+ try:
+ path.parent.mkdir(parents=True)
+ except FileExistsError:
+ pass
+ if not path.is_symlink():
+ print("ln -s {} {}".format(target, path))
+ path.symlink_to(target)
+
+
+class SystemdUnitNotFoundError(Exception):
+ def __init__(self, path, unit):
+ self.path = path
+ self.unit = unit
+
+
+class SystemdUnit():
+ def __init__(self, root, unit):
+ self.root = root
+ self.unit = unit
+ self.config = None
+
+ def _path_for_unit(self, unit):
+ for location in locations:
+ path = self.root / location / "system" / unit
+ if path.exists() or path.is_symlink():
+ return path
+
+ raise SystemdUnitNotFoundError(self.root, unit)
+
+ def _process_deps(self, config, service, location, prop, dirstem):
+ systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+
+ target = ROOT / location.relative_to(self.root)
+ try:
+ for dependent in config.get('Install', prop):
+ wants = systemdir / "{}.{}".format(dependent, dirstem) / service
+ add_link(wants, target)
+
+ except KeyError:
+ pass
+
+ def enable(self, caller_unit=None):
+ # if we're enabling an instance, first extract the actual instance
+ # then figure out what the template unit is
+ template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit)
+ if template:
+ instance = template.group('instance')
+ unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
+ else:
+ instance = None
+ unit = self.unit
+
+ path = self._path_for_unit(unit)
+
+ if path.is_symlink():
+ # ignore aliases
+ return
+
+ config = SystemdFile(self.root, path)
+ if instance == "":
+ try:
+ default_instance = config.get('Install', 'DefaultInstance')[0]
+ except KeyError:
+ # no default instance, so nothing to enable
+ return
+
+ service = self.unit.replace("@.",
+ "@{}.".format(default_instance))
+ else:
+ service = self.unit
+
+ self._process_deps(config, service, path, 'WantedBy', 'wants')
+ self._process_deps(config, service, path, 'RequiredBy', 'requires')
+
+ try:
+ for also in config.get('Install', 'Also'):
+ try:
+ if caller_unit != also:
+ SystemdUnit(self.root, also).enable(unit)
+ except SystemdUnitNotFoundError as e:
+ sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit))
+
+ except KeyError:
+ pass
+
+ systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+ target = ROOT / path.relative_to(self.root)
+ try:
+ for dest in config.get('Install', 'Alias'):
+ alias = systemdir / dest
+ add_link(alias, target)
+
+ except KeyError:
+ pass
+
+ def mask(self):
+ systemdir = self.root / SYSCONFDIR / "systemd" / "system"
+ add_link(systemdir / self.unit, "/dev/null")
+
+
+def collect_services(root):
+ """Collect list of service files"""
+ services = set()
+ for location in locations:
+ paths = (root / location / "system").glob("*")
+ for path in paths:
+ if path.is_dir():
+ continue
+ services.add(path.name)
+
+ return services
+
+
+def preset_all(root):
+ presets = Presets('system-preset', root)
+ services = collect_services(root)
+
+ for service in services:
+ state = presets.state(service)
+
+ if state == "enable" or state is None:
+ try:
+ SystemdUnit(root, service).enable()
+ except SystemdUnitNotFoundError:
+ sys.exit("Error: Systemctl preset_all issue in %s" % service)
+
+ # If we populate the systemd links we also create /etc/machine-id, which
+ # allows systemd to boot with the filesystem read-only before generating
+ # a real value and then committing it back.
+ #
+ # For the stateless configuration, where /etc is generated at runtime
+ # (for example on a tmpfs), this script shouldn't run at all and we
+ # allow systemd to completely populate /etc.
+ (root / SYSCONFDIR / "machine-id").touch()
+
+
+def main():
+ if sys.version_info < (3, 4, 0):
+ sys.exit("Python 3.4 or greater is required")
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('command', nargs='?', choices=['enable', 'mask',
+ 'preset-all'])
+ parser.add_argument('service', nargs=argparse.REMAINDER)
+ parser.add_argument('--root')
+ parser.add_argument('--preset-mode',
+ choices=['full', 'enable-only', 'disable-only'],
+ default='full')
+
+ args = parser.parse_args()
+
+ root = Path(args.root) if args.root else ROOT
+
+ locations.append(SYSCONFDIR / "systemd")
+ # Handle the usrmerge case by ignoring /lib when it's a symlink
+ if not (root / BASE_LIBDIR).is_symlink():
+ locations.append(BASE_LIBDIR / "systemd")
+ locations.append(LIBDIR / "systemd")
+
+ command = args.command
+ if not command:
+ parser.print_help()
+ return 0
+
+ if command == "mask":
+ for service in args.service:
+ try:
+ SystemdUnit(root, service).mask()
+ except SystemdUnitNotFoundError as e:
+ sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit))
+ elif command == "enable":
+ for service in args.service:
+ try:
+ SystemdUnit(root, service).enable()
+ except SystemdUnitNotFoundError as e:
+ sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit))
+ elif command == "preset-all":
+ if len(args.service) != 0:
+ sys.exit("Too many arguments.")
+ if args.preset_mode != "enable-only":
+ sys.exit("Only enable-only is supported as preset-mode.")
+ preset_all(root)
+ else:
+ raise RuntimeError()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
new file mode 100644
index 0000000000..53ffe8d293
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd.inc
@@ -0,0 +1,22 @@
+SUMMARY = "A System and service manager"
+HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
+
+DESCRIPTION = "systemd is a system and service manager for Linux, compatible with \
+SysV and LSB init scripts. systemd provides aggressive parallelization \
+capabilities, uses socket and D-Bus activation for starting services, \
+offers on-demand starting of daemons, keeps track of processes using \
+Linux cgroups, supports snapshotting and restoring of the system \
+state, maintains mount and automount points and implements an \
+elaborate transactional dependency-based service control logic. It can \
+work as a drop-in replacement for sysvinit."
+
+LICENSE = "GPLv2 & LGPLv2.1"
+LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
+ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
+
+SRCREV = "00b0393e65252bf631670604f58b844780b08c50"
+SRCBRANCH = "v249-stable"
+SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH} \
+"
+
+S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf
new file mode 100644
index 0000000000..6b224ba9b9
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf
@@ -0,0 +1,6 @@
+[Service]
+# By running with these options instead of root, networkd is allowed to request
+# a hostname change via DBUS when policykit is not present
+User=systemd-network
+Group=systemd-hostname
+AmbientCapabilities=CAP_SYS_ADMIN
diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-core-mount-add-dependencies-to-dynamically-mo.patch b/meta/recipes-core/systemd/systemd/0001-Revert-core-mount-add-dependencies-to-dynamically-mo.patch
deleted file mode 100644
index d69cfe0bd8..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-Revert-core-mount-add-dependencies-to-dynamically-mo.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From eb7a760052667c5a35637901de9359c377263804 Mon Sep 17 00:00:00 2001
-From: Colin Walters <walters@verbum.org>
-Date: Tue, 24 Feb 2015 10:12:28 -0500
-Subject: [PATCH] Revert "core/mount: add dependencies to dynamically mounted
- mounts too"
-
-This reverts commit 06e97888883e2cc12eb6514e80c7f0014295f59b.
-
-This patch was imported from Fedora (http://pkgs.fedoraproject.org/cgit/systemd.git/commit/?h=f22&id=9bbe0e92dc59d5a42258c729b105a7d9901eb35e).
-
-It fixes an issue where mount points not listed in fstab are immediately
-unmounted after a call to mount.
-
-Upstream-Status: Inappropriate [fixed upstream]
-
-Signed-off-by: Joshua Lock <joshua.lock@collabora.co.uk>
----
- src/core/mount.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/core/mount.c b/src/core/mount.c
-index 40037e7..cddb5e2 100644
---- a/src/core/mount.c
-+++ b/src/core/mount.c
-@@ -295,7 +295,7 @@ static int mount_add_device_links(Mount *m) {
-
- assert(m);
-
-- p = get_mount_parameters(m);
-+ p = get_mount_parameters_fragment(m);
- if (!p)
- return 0;
-
---
-1.8.3.1
-
diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
new file mode 100644
index 0000000000..d3af734e06
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
@@ -0,0 +1,81 @@
+From 08cd165f5db0e68a499b80c4b1744a4206948259 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Thu, 21 Feb 2019 16:23:24 +0800
+Subject: [PATCH] binfmt: Don't install dependency links at install time for
+ the binfmt services
+
+use [Install] blocks so that they get created when the service is enabled
+like a traditional service.
+
+The [Install] blocks were rejected upstream as they don't have a way to
+"enable" it on install without static symlinks which can't be disabled,
+only masked. We however can do that in a postinst.
+
+Upstream-Status: Denied
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ units/meson.build | 6 ++----
+ units/proc-sys-fs-binfmt_misc.automount | 3 +++
+ units/systemd-binfmt.service.in | 4 ++++
+ 3 files changed, 9 insertions(+), 4 deletions(-)
+
+diff --git a/units/meson.build b/units/meson.build
+index 17e9ead9c1..e5502be620 100644
+--- a/units/meson.build
++++ b/units/meson.build
+@@ -59,8 +59,7 @@ units = [
+ ['poweroff.target', '',
+ (with_runlevels ? 'runlevel0.target' : '')],
+ ['printer.target', ''],
+- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT',
+- 'sysinit.target.wants/'],
++ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'],
+ ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
+ ['reboot.target', '',
+ 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')],
+@@ -178,8 +177,7 @@ in_units = [
+ ['rescue.service', ''],
+ ['serial-getty@.service', ''],
+ ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'],
+- ['systemd-binfmt.service', 'ENABLE_BINFMT',
+- 'sysinit.target.wants/'],
++ ['systemd-binfmt.service', 'ENABLE_BINFMT'],
+ ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'],
+ ['systemd-boot-check-no-failures.service', ''],
+ ['systemd-coredump@.service', 'ENABLE_COREDUMP'],
+diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
+index 172c8757ab..f65d8930c6 100644
+--- a/units/proc-sys-fs-binfmt_misc.automount
++++ b/units/proc-sys-fs-binfmt_misc.automount
+@@ -19,3 +19,6 @@ ConditionPathIsReadWrite=/proc/sys/
+
+ [Automount]
+ Where=/proc/sys/fs/binfmt_misc
++
++[Install]
++WantedBy=sysinit.target
+diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
+index fdafce7ff7..4efc05e495 100644
+--- a/units/systemd-binfmt.service.in
++++ b/units/systemd-binfmt.service.in
+@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm
+ Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
+ DefaultDependencies=no
+ Conflicts=shutdown.target
++Wants=proc-sys-fs-binfmt_misc.automount
+ After=proc-sys-fs-binfmt_misc.automount
+ After=proc-sys-fs-binfmt_misc.mount
+ Before=sysinit.target shutdown.target
+@@ -30,3 +31,6 @@ RemainAfterExit=yes
+ ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt
+ ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister
+ TimeoutSec=90s
++
++[Install]
++WantedBy=sysinit.target
diff --git a/meta/recipes-core/systemd/systemd/0001-meson-use-partial_dependency-to-get-include-director.patch b/meta/recipes-core/systemd/systemd/0001-meson-use-partial_dependency-to-get-include-director.patch
new file mode 100644
index 0000000000..51ee5d8623
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-meson-use-partial_dependency-to-get-include-director.patch
@@ -0,0 +1,46 @@
+From 260e871fda979f040c94d2011545e8122bed68ca Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex@linutronix.de>
+Date: Mon, 18 Oct 2021 10:13:07 +0200
+Subject: [PATCH] meson: use partial_dependency() to get include directory
+
+Getting the variable directly from pkg-config is prone to host
+contamination when building in sysroots as the
+compiler starts looking for the headers on the host in addition to
+the sysroot.
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/21027]
+Signed-off-by: Alexander Kanavin <alex@linutronix.de>
+---
+ meson.build | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index df53c6156d..38fb37dd75 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2618,18 +2618,17 @@ endif
+
+ if conf.get('ENABLE_LOCALED') == 1
+ if conf.get('HAVE_XKBCOMMON') == 1
+- # logind will load libxkbcommon.so dynamically on its own
+- deps = [libdl]
+- extra_includes = [libxkbcommon.get_pkgconfig_variable('includedir')]
++ # logind will load libxkbcommon.so dynamically on its own, but we still
++ # need to specify where the headers are
++ deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
+ else
+ deps = []
+- extra_includes = []
+ endif
+
+ executable(
+ 'systemd-localed',
+ systemd_localed_sources,
+- include_directories : includes + extra_includes,
++ include_directories : includes,
+ link_with : [libshared],
+ dependencies : deps,
+ install_rpath : rootlibexecdir,
+--
+2.20.1
+
diff --git a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch
new file mode 100644
index 0000000000..752824688f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch
@@ -0,0 +1,42 @@
+From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 29 Sep 2020 18:01:41 -0700
+Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash
+
+This complements the commit
+https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/core/systemd.pc.in | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in
+index b5cc8f9..21dbf30 100644
+--- a/src/core/systemd.pc.in
++++ b/src/core/systemd.pc.in
+@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_dir}
+ tmpfiles_dir=${prefix}/lib/tmpfiles.d
+ tmpfilesdir=${tmpfiles_dir}
+
+-sysusers_dir=${rootprefix}/lib/sysusers.d
++sysusers_dir=${prefix}/lib/sysusers.d
+ sysusersdir=${sysusers_dir}
+
+-sysctl_dir=${rootprefix}/lib/sysctl.d
++sysctl_dir=${prefix}/lib/sysctl.d
+ sysctldir=${sysctl_dir}
+
+-binfmt_dir=${rootprefix}/lib/binfmt.d
++binfmt_dir=${prefix}/lib/binfmt.d
+ binfmtdir=${binfmt_dir}
+
+-modules_load_dir=${rootprefix}/lib/modules-load.d
++modules_load_dir=${prefix}/lib/modules-load.d
+ modulesloaddir=${modules_load_dir}
+
+ catalog_dir=${prefix}/lib/systemd/catalog
+--
+2.25.1
+
diff --git a/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch
new file mode 100644
index 0000000000..3af1daac9c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch
@@ -0,0 +1,29 @@
+From 1adde6721ead386ccee6efe48038d6944b96319a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 24 May 2021 18:26:27 -0700
+Subject: [PATCH] test-parse-argument: Include signal.h
+
+Fixes
+src/test/test-parse-argument.c:49:29: error: use of undeclared identifier 'SIGABRT'
+
+Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/19718]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/test/test-parse-argument.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c
+index 4081a9f25a..820d69f092 100644
+--- a/src/test/test-parse-argument.c
++++ b/src/test/test-parse-argument.c
+@@ -3,6 +3,7 @@
+ #include "parse-argument.h"
+ #include "stdio-util.h"
+ #include "tests.h"
++#include <signal.h>
+
+ static void test_parse_json_argument(void) {
+ log_info("/* %s */", __func__);
+--
+2.31.1
+
diff --git a/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch
deleted file mode 100644
index b6ab5effc2..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 100e50604efc4032001a2de6a6b47853c0003817 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:29:15 +0000
-Subject: [PATCH 01/11] units: Prefer getty to agetty in console setup systemd
- units
-
-Upstream-Status: Inappropriate [configuration specific]
-
-Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- units/getty@.service.m4 | 2 +-
- units/serial-getty@.service.m4 | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
-index 46164ab..bdf6ec8 100644
---- a/units/getty@.service.m4
-+++ b/units/getty@.service.m4
-@@ -27,7 +27,7 @@ ConditionPathExists=/dev/tty0
-
- [Service]
- # the VT is cleared by TTYVTDisallocate
--ExecStart=-/sbin/agetty --noclear %I $TERM
-+ExecStart=-/sbin/getty -L %I $TERM
- Type=idle
- Restart=always
- RestartSec=0
-diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
-index 4522d0d..e6d499d 100644
---- a/units/serial-getty@.service.m4
-+++ b/units/serial-getty@.service.m4
-@@ -22,7 +22,7 @@ Before=getty.target
- IgnoreOnIsolate=yes
-
- [Service]
--ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
-+ExecStart=-/sbin/getty -L 115200 %I $TERM
- Type=idle
- Restart=always
- UtmpIdentifier=%I
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
new file mode 100644
index 0000000000..f233ee6621
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
@@ -0,0 +1,163 @@
+From 30bd749c6777701496124272b59e1283252c3267 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 13:41:41 +0800
+Subject: [PATCH] don't use glibc-specific qsort_r
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+[Rebased for v247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ src/basic/sort-util.h | 14 --------------
+ src/shared/format-table.c | 36 ++++++++++++++++++++++++------------
+ src/shared/hwdb-util.c | 19 ++++++++++++++-----
+ 3 files changed, 38 insertions(+), 31 deletions(-)
+
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index 49586a4a24..d92a5ab0ed 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -55,18 +55,4 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f
+ _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
+ })
+
+-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
+- if (nmemb <= 1)
+- return;
+-
+- assert(base);
+- qsort_r(base, nmemb, size, compar, userdata);
+-}
+-
+-#define typesafe_qsort_r(p, n, func, userdata) \
+- ({ \
+- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
+- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
+- })
+-
+ int cmp_int(const int *a, const int *b);
+diff --git a/src/shared/format-table.c b/src/shared/format-table.c
+index 4c4e4593d8..17b329f315 100644
+--- a/src/shared/format-table.c
++++ b/src/shared/format-table.c
+@@ -1282,30 +1282,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
+ return CMP(index_a, index_b);
+ }
+
+-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
++static Table *user_table;
++static int table_data_compare(const void *x, const void *y) {
++ const size_t *a = x, *b=y;
+ int r;
+
+- assert(t);
+- assert(t->sort_map);
++ assert(user_table);
++ assert(user_table->sort_map);
+
+ /* Make sure the header stays at the beginning */
+- if (*a < t->n_columns && *b < t->n_columns)
++ if (*a < user_table->n_columns && *b < user_table->n_columns)
+ return 0;
+- if (*a < t->n_columns)
++ if (*a < user_table->n_columns)
+ return -1;
+- if (*b < t->n_columns)
++ if (*b < user_table->n_columns)
+ return 1;
+
+ /* Order other lines by the sorting map */
+- for (size_t i = 0; i < t->n_sort_map; i++) {
++ for (size_t i = 0; i < user_table->n_sort_map; i++) {
+ TableData *d, *dd;
+
+- d = t->data[*a + t->sort_map[i]];
+- dd = t->data[*b + t->sort_map[i]];
++ d = user_table->data[*a + user_table->sort_map[i]];
++ dd = user_table->data[*b + user_table->sort_map[i]];
+
+ r = cell_data_compare(d, *a, dd, *b);
+ if (r != 0)
+- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
++ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
+ }
+
+ /* Order identical lines by the order there were originally added in */
+@@ -1944,7 +1946,12 @@ int table_print(Table *t, FILE *f) {
+ for (size_t i = 0; i < n_rows; i++)
+ sorted[i] = i * t->n_columns;
+
+- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
++ if (n_rows <= 1)
++ return 0;
++ assert(sorted);
++ user_table = t;
++ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
++ user_table = NULL;
+ }
+
+ if (t->display_map)
+@@ -2572,7 +2579,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
+ for (size_t i = 0; i < n_rows; i++)
+ sorted[i] = i * t->n_columns;
+
+- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
++ if (n_rows <= 1)
++ return 0;
++ assert(sorted);
++ user_table = t;
++ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
++ user_table = NULL;
+ }
+
+ if (t->display_map)
+diff --git a/src/shared/hwdb-util.c b/src/shared/hwdb-util.c
+index d7626aed95..2003fac7c3 100644
+--- a/src/shared/hwdb-util.c
++++ b/src/shared/hwdb-util.c
+@@ -127,9 +127,13 @@ static struct trie* trie_free(struct trie *trie) {
+
+ DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
+
+-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) {
+- return strcmp(trie->strings->buf + a->key_off,
+- trie->strings->buf + b->key_off);
++static struct trie *trie_node_add_value_trie;
++static int trie_values_cmp(const void *v1, const void *v2) {
++ const struct trie_value_entry *a = v1;
++ const struct trie_value_entry *b = v2;
++
++ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off,
++ trie_node_add_value_trie->strings->buf + b->key_off);
+ }
+
+ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
+@@ -157,7 +161,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
+ .value_off = v,
+ };
+
+- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
++ trie_node_add_value_trie = trie;
++ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
++ trie_node_add_value_trie = NULL;
++
+ if (val) {
+ /* At this point we have 2 identical properties on the same match-string.
+ * Since we process files in order, we just replace the previous value. */
+@@ -183,7 +190,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
+ .line_number = line_number,
+ };
+ node->values_count++;
+- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie);
++ trie_node_add_value_trie = trie;
++ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
++ trie_node_add_value_trie = NULL;
+ return 0;
+ }
+
diff --git a/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch b/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch
deleted file mode 100644
index 1cf7840976..0000000000
--- a/meta/recipes-core/systemd/systemd/0002-shared-missing.h-fall-back-to-insecure-getenv.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 03baade6db2cf83b44a157818ba827d725449bb0 Mon Sep 17 00:00:00 2001
-From: Emil Renner Berthing <systemd@esmil.dk>
-Date: Thu, 18 Sep 2014 15:24:47 +0200
-Subject: [PATCH 02/11] shared/missing.h: fall back to insecure getenv
-
----
- src/shared/missing.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/shared/missing.h b/src/shared/missing.h
-index b33a70c..11cca04 100644
---- a/src/shared/missing.h
-+++ b/src/shared/missing.h
-@@ -366,7 +366,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
- # ifdef HAVE___SECURE_GETENV
- # define secure_getenv __secure_getenv
- # else
--# error "neither secure_getenv nor __secure_getenv are available"
-+# define secure_getenv getenv
- # endif
- #endif
-
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch
deleted file mode 100644
index c14cc6fdd6..0000000000
--- a/meta/recipes-core/systemd/systemd/0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 184a89caacfa00f07e7275bca592bd7dda1b541e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:03:44 +0000
-Subject: [PATCH 03/11] binfmt: Don't install dependency links at install time
- for the binfmt services
-
-use [Install] blocks so that they get created when the service is enabled
-like a traditional service.
-
-The [Install] blocks were rejected upstream as they don't have a way to
-"enable"
-it on install without static symlinks which can't be disabled, only
-masked. We
-however can do that in a postinst.
-
-Upstream-Status: Denied
-
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makefile.am | 4 ----
- units/proc-sys-fs-binfmt_misc.automount | 3 +++
- units/systemd-binfmt.service.in | 5 +++++
- 3 files changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index ba63f68..0fb3f9f 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -4838,10 +4838,6 @@ INSTALL_DIRS += \
- $(prefix)/lib/binfmt.d \
- $(sysconfdir)/binfmt.d
-
--SYSINIT_TARGET_WANTS += \
-- systemd-binfmt.service \
-- proc-sys-fs-binfmt_misc.automount
--
- endif
-
- EXTRA_DIST += \
-diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
-index 6be3893..709adef 100644
---- a/units/proc-sys-fs-binfmt_misc.automount
-+++ b/units/proc-sys-fs-binfmt_misc.automount
-@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/
-
- [Automount]
- Where=/proc/sys/fs/binfmt_misc
-+
-+[Install]
-+WantedBy=sysinit.target
-diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
-index 34a5d52..617462b 100644
---- a/units/systemd-binfmt.service.in
-+++ b/units/systemd-binfmt.service.in
-@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
- Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt
- DefaultDependencies=no
- Conflicts=shutdown.target
-+Wants=proc-sys-fs-binfmt_misc.automount
-+
- After=proc-sys-fs-binfmt_misc.automount
- Before=sysinit.target shutdown.target
- ConditionPathIsReadWrite=/proc/sys/
-@@ -24,3 +26,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d
- Type=oneshot
- RemainAfterExit=yes
- ExecStart=@rootlibexecdir@/systemd-binfmt
-+
-+[Install]
-+WantedBy=sysinit.target
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch
new file mode 100644
index 0000000000..c6204786b3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch
@@ -0,0 +1,41 @@
+From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 5 Sep 2015 06:31:47 +0000
+Subject: [PATCH] implment systemd-sysv-install for OE
+
+Use update-rc.d for enabling/disabling and status command
+to check the status of the sysv service
+
+Upstream-Status: Inappropriate [OE-Specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/systemctl/systemd-sysv-install.SKELETON | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
+index 8c16cf99913f..9f078a121469 100755
+--- a/src/systemctl/systemd-sysv-install.SKELETON
++++ b/src/systemctl/systemd-sysv-install.SKELETON
+@@ -32,17 +32,17 @@ case "$1" in
+ enable)
+ # call the command to enable SysV init script $NAME here
+ # (consider optional $ROOT)
+- echo "IMPLEMENT ME: enabling SysV init.d script $NAME"
++ update-rc.d -f $NAME defaults
+ ;;
+ disable)
+ # call the command to disable SysV init script $NAME here
+ # (consider optional $ROOT)
+- echo "IMPLEMENT ME: disabling SysV init.d script $NAME"
++ update-rc.d -f $NAME remove
+ ;;
+ is-enabled)
+ # exit with 0 if $NAME is enabled, non-zero if it is disabled
+ # (consider optional $ROOT)
+- echo "IMPLEMENT ME: checking SysV init.d script $NAME"
++ /etc/init.d/$NAME status
+ ;;
+ *)
+ usage ;;
diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
new file mode 100644
index 0000000000..a51ab0ab2e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
@@ -0,0 +1,76 @@
+From 4dba0a3b1372ce34d8b6e150a108123a1b2b0b96 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 13:55:12 +0800
+Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
+
+Make it work with musl where comparison_fn_t and __compare_fn_t
+is not provided.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[Rebased for v244]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+---
+ src/basic/missing_type.h | 9 +++++++++
+ src/basic/sort-util.h | 1 +
+ src/core/kmod-setup.c | 1 +
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ 4 files changed, 12 insertions(+)
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index f6233090a9..aeaf6ad5ec 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,12 @@
+ #if !HAVE_CHAR16_T
+ #define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef __COMPAR_FN_T
++#define __COMPAR_FN_T
++typedef int (*__compar_fn_t)(const void *, const void *);
++#endif
+diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
+index d92a5ab0ed..a63867c716 100644
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
+ __compar_d_fn_t compar, void *arg);
+diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
+index 8a7f82812a..a56f12f47f 100644
+--- a/src/core/kmod-setup.c
++++ b/src/core/kmod-setup.c
+@@ -10,6 +10,7 @@
+ #include "kmod-setup.h"
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ #if HAVE_KMOD
+ #include "module-util.h"
+diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
+index ce8d47ccc3..00845f9776 100644
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -28,6 +28,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
new file mode 100644
index 0000000000..3c07f6005f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch
@@ -0,0 +1,433 @@
+From 842d231165f0d564c51d93650820e4fa7f097c3e Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+diff --git a/meson.build b/meson.build
+index b5a51b6d0d..11cf56efee 100644
+--- a/meson.build
++++ b/meson.build
+@@ -656,6 +656,7 @@ endif
+ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'valgrind/memcheck.h',
+ 'valgrind/valgrind.h',
+diff --git a/src/basic/meson.build b/src/basic/meson.build
+index 452b965db3..4e64d883dc 100644
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -321,6 +321,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
+new file mode 100644
+index 0000000000..49437e5445
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
+new file mode 100644
+index 0000000000..47be7522d7
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
+index 6dc1e72312..cea76b36cf 100644
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,13 +1,13 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
+ #include "memory-util.h"
++#include "parse-printf-format.h"
+
+ #define snprintf_ok(buf, len, fmt, ...) \
+ ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len))
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index fd3fd7ef9c..e8e6ad555b 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -21,6 +20,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
diff --git a/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch b/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch
deleted file mode 100644
index dddb7da690..0000000000
--- a/meta/recipes-core/systemd/systemd/0004-configure-Check-for-additional-features-that-uclibc-.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 4e2e8dbf3f23ab7dca32286cc0f37bff6ac49e22 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:05:45 +0000
-Subject: [PATCH 04/11] configure: Check for additional features that uclibc
- doesnt support
-
-This helps in supporting uclibc which does not have all features that
-glibc might have
-
-Upstream-Status: Denied [no desire for uclibc support]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- configure.ac | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 9a2235b..a5b2e6e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -103,6 +103,24 @@ AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't s
-
- M4_DEFINES=
-
-+# check for few functions not implemented in uClibc
-+
-+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate)
-+
-+# check for %ms format support - assume always no if cross compiling
-+
-+AC_MSG_CHECKING([whether %ms format is supported by *scanf])
-+
-+AC_LINK_IFELSE(
-+ [AC_LANG_PROGRAM([
-+ #include <stdio.h>
-+ ],[
-+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ;
-+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ;
-+ return (rc==3)?0:1;])],
-+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])],
-+ [AC_MSG_RESULT([no])])
-+
- # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
- m4_ifdef([GTK_DOC_CHECK], [
- GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch
deleted file mode 100644
index 85279d68c2..0000000000
--- a/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:10:37 +0000
-Subject: [PATCH 05/11] nspawn: Use execvpe only when libc supports it
-
-Upstream-Status: Denied [no desire for uclibc support]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/nspawn/nspawn.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index 0d8d199..b597edb 100644
---- a/src/nspawn/nspawn.c
-+++ b/src/nspawn/nspawn.c
-@@ -129,6 +129,8 @@ typedef enum Volatile {
- VOLATILE_STATE,
- } Volatile;
-
-+#include "config.h"
-+
- static char *arg_directory = NULL;
- static char *arg_template = NULL;
- static char *arg_user = NULL;
-@@ -4257,7 +4259,12 @@ int main(int argc, char *argv[]) {
- a[0] = (char*) "/sbin/init";
- execve(a[0], a, env_use);
- } else if (argc > optind)
-+#ifdef HAVE_EXECVPE
- execvpe(argv[optind], argv + optind, env_use);
-+#else
-+ environ = env_use;
-+ execvp(argv[optind], argv + optind);
-+#endif /* HAVE_EXECVPE */
- else {
- chdir(home ? home : "/root");
- execle("/bin/bash", "-bash", NULL, env_use);
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
new file mode 100644
index 0000000000..1b9e194667
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch
@@ -0,0 +1,694 @@
+From 95c61768e1f8d76a7bd28355429fc4b7b428ad61 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 14:18:21 +0800
+Subject: [PATCH] src/basic/missing.h: check for missing strndupa
+
+include missing.h for definition of strndupa
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[rebased for systemd 244]
+[Rebased for v247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ meson.build | 1 +
+ src/backlight/backlight.c | 1 +
+ src/basic/cgroup-util.c | 1 +
+ src/basic/env-util.c | 1 +
+ src/basic/log.c | 1 +
+ src/basic/missing_stdlib.h | 12 ++++++++++++
+ src/basic/mkdir.c | 1 +
+ src/basic/mountpoint-util.c | 1 +
+ src/basic/parse-util.c | 1 +
+ src/basic/path-lookup.c | 1 +
+ src/basic/percent-util.c | 1 +
+ src/basic/proc-cmdline.c | 1 +
+ src/basic/procfs-util.c | 1 +
+ src/basic/time-util.c | 1 +
+ src/boot/bless-boot.c | 1 +
+ src/core/dbus-cgroup.c | 1 +
+ src/core/dbus-execute.c | 1 +
+ src/core/dbus-util.c | 1 +
+ src/core/execute.c | 1 +
+ src/core/kmod-setup.c | 1 +
+ src/core/service.c | 1 +
+ src/coredump/coredump-vacuum.c | 1 +
+ src/journal-remote/journal-remote-main.c | 1 +
+ src/journal/journalctl.c | 1 +
+ src/libsystemd/sd-bus/bus-message.c | 1 +
+ src/libsystemd/sd-bus/bus-objects.c | 1 +
+ src/libsystemd/sd-bus/bus-socket.c | 1 +
+ src/libsystemd/sd-bus/sd-bus.c | 1 +
+ src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
+ src/libsystemd/sd-journal/sd-journal.c | 1 +
+ src/locale/keymap-util.c | 1 +
+ src/login/pam_systemd.c | 1 +
+ src/network/generator/network-generator.c | 1 +
+ src/nspawn/nspawn-settings.c | 1 +
+ src/nss-mymachines/nss-mymachines.c | 1 +
+ src/portable/portable.c | 1 +
+ src/resolve/resolvectl.c | 1 +
+ src/shared/bus-get-properties.c | 1 +
+ src/shared/bus-unit-procs.c | 1 +
+ src/shared/bus-unit-util.c | 1 +
+ src/shared/bus-util.c | 1 +
+ src/shared/dns-domain.c | 1 +
+ src/shared/journal-importer.c | 1 +
+ src/shared/logs-show.c | 1 +
+ src/shared/pager.c | 1 +
+ src/shared/uid-range.c | 1 +
+ src/socket-proxy/socket-proxyd.c | 1 +
+ src/test/test-hexdecoct.c | 1 +
+ src/udev/udev-builtin-path_id.c | 1 +
+ src/udev/udev-event.c | 1 +
+ src/udev/udev-rules.c | 1 +
+ 51 files changed, 62 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 11cf56efee..5bd6602e03 100644
+--- a/meson.build
++++ b/meson.build
+@@ -480,6 +480,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
+ endforeach
+
+ foreach ident : [
++ ['strndupa' , '''#include <string.h>'''],
+ ['memfd_create', '''#include <sys/mman.h>'''],
+ ['gettid', '''#include <sys/types.h>
+ #include <unistd.h>'''],
+diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
+index 7c0970a60c..c129ff0f4f 100644
+--- a/src/backlight/backlight.c
++++ b/src/backlight/backlight.c
+@@ -19,6 +19,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static int help(void) {
+ _cleanup_free_ char *link = NULL;
+diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
+index 1ff6160dc8..c9efd862a2 100644
+--- a/src/basic/cgroup-util.c
++++ b/src/basic/cgroup-util.c
+@@ -38,6 +38,7 @@
+ #include "unit-name.h"
+ #include "user-util.h"
+ #include "xattr-util.h"
++#include "missing_stdlib.h"
+
+ static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
+ _cleanup_free_ char *fs = NULL;
+diff --git a/src/basic/env-util.c b/src/basic/env-util.c
+index 1ca445dab4..1f5a212d4e 100644
+--- a/src/basic/env-util.c
++++ b/src/basic/env-util.c
+@@ -18,6 +18,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ /* We follow bash for the character set. Different shells have different rules. */
+ #define VALID_BASH_ENV_NAME_CHARS \
+diff --git a/src/basic/log.c b/src/basic/log.c
+index fb183ea9e7..82e7bdff60 100644
+--- a/src/basic/log.c
++++ b/src/basic/log.c
+@@ -36,6 +36,7 @@
+ #include "terminal-util.h"
+ #include "time-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
+index 8c76f93eb2..9068bfb4f0 100644
+--- a/src/basic/missing_stdlib.h
++++ b/src/basic/missing_stdlib.h
+@@ -11,3 +11,15 @@
+ # error "neither secure_getenv nor __secure_getenv are available"
+ # endif
+ #endif
++
++/* string.h */
++#if ! HAVE_STRNDUPA
++#define strndupa(s, n) \
++ ({ \
++ const char *__old = (s); \
++ size_t __len = strnlen(__old, (n)); \
++ char *__new = (char *)alloca(__len + 1); \
++ __new[__len] = '\0'; \
++ (char *)memcpy(__new, __old, __len); \
++ })
++#endif
+diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
+index f91f8f7a08..fb31596216 100644
+--- a/src/basic/mkdir.c
++++ b/src/basic/mkdir.c
+@@ -14,6 +14,7 @@
+ #include "stat-util.h"
+ #include "stdio-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ int mkdir_safe_internal(
+ const char *path,
+diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
+index e7a5a99551..3cc157f248 100644
+--- a/src/basic/mountpoint-util.c
++++ b/src/basic/mountpoint-util.c
+@@ -11,6 +11,7 @@
+ #include "missing_stat.h"
+ #include "missing_syscall.h"
+ #include "mkdir.h"
++#include "missing_stdlib.h"
+ #include "mountpoint-util.h"
+ #include "parse-util.h"
+ #include "path-util.h"
+diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
+index b79c885dfd..6dabda5691 100644
+--- a/src/basic/parse-util.c
++++ b/src/basic/parse-util.c
+@@ -19,6 +19,7 @@
+ #include "stat-util.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ int parse_boolean(const char *v) {
+ if (!v)
+diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
+index 05eb17d66c..b6026aab28 100644
+--- a/src/basic/path-lookup.c
++++ b/src/basic/path-lookup.c
+@@ -15,6 +15,7 @@
+ #include "strv.h"
+ #include "tmpfile-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ int xdg_user_runtime_dir(char **ret, const char *suffix) {
+ const char *e;
+diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c
+index 06f20fd61e..8159d721bb 100644
+--- a/src/basic/percent-util.c
++++ b/src/basic/percent-util.c
+@@ -3,6 +3,7 @@
+ #include "percent-util.h"
+ #include "string-util.h"
+ #include "parse-util.h"
++#include "missing_stdlib.h"
+
+ static int parse_parts_value_whole(const char *p, const char *symbol) {
+ const char *pc, *n;
+diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
+index 410b8a3eb5..f2c4355609 100644
+--- a/src/basic/proc-cmdline.c
++++ b/src/basic/proc-cmdline.c
+@@ -15,6 +15,7 @@
+ #include "string-util.h"
+ #include "util.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ int proc_cmdline(char **ret) {
+ const char *e;
+diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
+index 9234ccaf85..8c57094225 100644
+--- a/src/basic/procfs-util.c
++++ b/src/basic/procfs-util.c
+@@ -11,6 +11,7 @@
+ #include "procfs-util.h"
+ #include "stdio-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ int procfs_tasks_get_limit(uint64_t *ret) {
+ _cleanup_free_ char *value = NULL;
+diff --git a/src/basic/time-util.c b/src/basic/time-util.c
+index 5d162e8ffe..1cde8e4262 100644
+--- a/src/basic/time-util.c
++++ b/src/basic/time-util.c
+@@ -26,6 +26,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "time-util.h"
++#include "missing_stdlib.h"
+
+ static clockid_t map_clock_id(clockid_t c) {
+
+diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
+index 3fc319ca27..90064c90f3 100644
+--- a/src/boot/bless-boot.c
++++ b/src/boot/bless-boot.c
+@@ -18,6 +18,7 @@
+ #include "util.h"
+ #include "verbs.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ static char **arg_path = NULL;
+
+diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
+index 84c3caf3a5..0fa84eaa38 100644
+--- a/src/core/dbus-cgroup.c
++++ b/src/core/dbus-cgroup.c
+@@ -20,6 +20,7 @@
+ #include "parse-util.h"
+ #include "path-util.h"
+ #include "percent-util.h"
++#include "missing_stdlib.h"
+
+ BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
+
+diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
+index 902e074bd2..ac15b944e6 100644
+--- a/src/core/dbus-execute.c
++++ b/src/core/dbus-execute.c
+@@ -42,6 +42,7 @@
+ #include "unit-printf.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
+ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
+diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
+index ca9b399d8c..b864480a8c 100644
+--- a/src/core/dbus-util.c
++++ b/src/core/dbus-util.c
+@@ -9,6 +9,7 @@
+ #include "unit-printf.h"
+ #include "user-util.h"
+ #include "unit.h"
++#include "missing_stdlib.h"
+
+ int bus_property_get_triggered_unit(
+ sd_bus *bus,
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 2a337b55a2..2a64675c5f 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -98,6 +98,7 @@
+ #include "unit-serialize.h"
+ #include "user-util.h"
+ #include "utmp-wtmp.h"
++#include "missing_stdlib.h"
+
+ #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
+ #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
+diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
+index a56f12f47f..6b8729ef67 100644
+--- a/src/core/kmod-setup.c
++++ b/src/core/kmod-setup.c
+@@ -11,6 +11,7 @@
+ #include "macro.h"
+ #include "string-util.h"
+ #include "missing_type.h"
++#include "missing_stdlib.h"
+
+ #if HAVE_KMOD
+ #include "module-util.h"
+diff --git a/src/core/service.c b/src/core/service.c
+index 701c145565..4ddc20ed7e 100644
+--- a/src/core/service.c
++++ b/src/core/service.c
+@@ -41,6 +41,7 @@
+ #include "unit.h"
+ #include "utf8.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
+ [SERVICE_DEAD] = UNIT_INACTIVE,
+diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
+index 95c3fca661..d4a9f27b08 100644
+--- a/src/coredump/coredump-vacuum.c
++++ b/src/coredump/coredump-vacuum.c
+@@ -16,6 +16,7 @@
+ #include "string-util.h"
+ #include "time-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
+ #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
+diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
+index ae1d43756a..24de98c9f3 100644
+--- a/src/journal-remote/journal-remote-main.c
++++ b/src/journal-remote/journal-remote-main.c
+@@ -24,6 +24,7 @@
+ #include "stat-util.h"
+ #include "string-table.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
+ #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
+diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
+index 3eac97510d..db6913bc7a 100644
+--- a/src/journal/journalctl.c
++++ b/src/journal/journalctl.c
+@@ -72,6 +72,7 @@
+ #include "unit-name.h"
+ #include "user-util.h"
+ #include "varlink.h"
++#include "missing_stdlib.h"
+
+ #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
+ #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
+diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
+index 20f7396c74..3471311ef5 100644
+--- a/src/libsystemd/sd-bus/bus-message.c
++++ b/src/libsystemd/sd-bus/bus-message.c
+@@ -20,6 +20,7 @@
+ #include "strv.h"
+ #include "time-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
+
+diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
+index bfd42aea7d..daefc56e3e 100644
+--- a/src/libsystemd/sd-bus/bus-objects.c
++++ b/src/libsystemd/sd-bus/bus-objects.c
+@@ -12,6 +12,7 @@
+ #include "set.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ static int node_vtable_get_userdata(
+ sd_bus *bus,
+diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
+index 378774fe8b..2694c177d5 100644
+--- a/src/libsystemd/sd-bus/bus-socket.c
++++ b/src/libsystemd/sd-bus/bus-socket.c
+@@ -27,6 +27,7 @@
+ #include "string-util.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
+index a32e2f5e20..97fd3aec82 100644
+--- a/src/libsystemd/sd-bus/sd-bus.c
++++ b/src/libsystemd/sd-bus/sd-bus.c
+@@ -42,6 +42,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ #define log_debug_bus_message(m) \
+ do { \
+diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
+index 13c08fe295..9aae83486e 100644
+--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
++++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
+@@ -14,6 +14,7 @@
+ #include "string-util.h"
+ #include "time-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ #define MAX_SIZE (2*1024*1024)
+
+diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
+index b3240177cb..7e3ae2d24f 100644
+--- a/src/libsystemd/sd-journal/sd-journal.c
++++ b/src/libsystemd/sd-journal/sd-journal.c
+@@ -40,6 +40,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "syslog-util.h"
++#include "missing_stdlib.h"
+
+ #define JOURNAL_FILES_MAX 7168
+
+diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
+index d2f0566dbc..3b7746557e 100644
+--- a/src/locale/keymap-util.c
++++ b/src/locale/keymap-util.c
+@@ -24,6 +24,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_stdlib.h"
+
+ static bool startswith_comma(const char *s, const char *prefix) {
+ s = startswith(s, prefix);
+diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
+index f8bd17eefe..9633fbc152 100644
+--- a/src/login/pam_systemd.c
++++ b/src/login/pam_systemd.c
+@@ -31,6 +31,7 @@
+ #include "locale-util.h"
+ #include "login-util.h"
+ #include "macro.h"
++#include "missing_stdlib.h"
+ #include "pam-util.h"
+ #include "parse-util.h"
+ #include "path-util.h"
+diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
+index 60e074e99b..a728e3b7a1 100644
+--- a/src/network/generator/network-generator.c
++++ b/src/network/generator/network-generator.c
+@@ -13,6 +13,7 @@
+ #include "string-table.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ /*
+ # .network
+diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
+index 3847fe4ec4..3696b57baa 100644
+--- a/src/nspawn/nspawn-settings.c
++++ b/src/nspawn/nspawn-settings.c
+@@ -17,6 +17,7 @@
+ #include "strv.h"
+ #include "user-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ Settings *settings_new(void) {
+ Settings *s;
+diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
+index 44715bb3e5..bc1e688b5e 100644
+--- a/src/nss-mymachines/nss-mymachines.c
++++ b/src/nss-mymachines/nss-mymachines.c
+@@ -21,6 +21,7 @@
+ #include "nss-util.h"
+ #include "signal-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ static void setup_logging(void) {
+ /* We need a dummy function because log_parse_environment is a macro. */
+diff --git a/src/portable/portable.c b/src/portable/portable.c
+index 4cf5fb4f0a..577dc5c8d7 100644
+--- a/src/portable/portable.c
++++ b/src/portable/portable.c
+@@ -34,6 +34,7 @@
+ #include "strv.h"
+ #include "tmpfile-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile");
+
+diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
+index 7d13ed3905..ddc37115b8 100644
+--- a/src/resolve/resolvectl.c
++++ b/src/resolve/resolvectl.c
+@@ -41,6 +41,7 @@
+ #include "terminal-util.h"
+ #include "utf8.h"
+ #include "verbs.h"
++#include "missing_stdlib.h"
+
+ static int arg_family = AF_UNSPEC;
+ static int arg_ifindex = 0;
+diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
+index feb6d3807f..eb11d29e50 100644
+--- a/src/shared/bus-get-properties.c
++++ b/src/shared/bus-get-properties.c
+@@ -4,6 +4,7 @@
+ #include "rlimit-util.h"
+ #include "stdio-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ int bus_property_get_bool(
+ sd_bus *bus,
+diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
+index 6f4a71138c..4a46de2c1b 100644
+--- a/src/shared/bus-unit-procs.c
++++ b/src/shared/bus-unit-procs.c
+@@ -10,6 +10,7 @@
+ #include "sort-util.h"
+ #include "string-util.h"
+ #include "terminal-util.h"
++#include "missing_stdlib.h"
+
+ struct CGroupInfo {
+ char *cgroup_path;
+diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
+index d3a5b25d18..003594e2d7 100644
+--- a/src/shared/bus-unit-util.c
++++ b/src/shared/bus-unit-util.c
+@@ -47,6 +47,7 @@
+ #include "unit-def.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
+ assert(message);
+diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
+index 64ca67993c..31e3d148ea 100644
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -21,6 +21,7 @@
+ #include "path-util.h"
+ #include "socket-util.h"
+ #include "stdio-util.h"
++#include "missing_stdlib.h"
+
+ static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+ sd_event *e = userdata;
+diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
+index 787bb8fec9..009589a16f 100644
+--- a/src/shared/dns-domain.c
++++ b/src/shared/dns-domain.c
+@@ -17,6 +17,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
+ const char *n;
+diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
+index 9e11dc09c1..f9954c1520 100644
+--- a/src/shared/journal-importer.c
++++ b/src/shared/journal-importer.c
+@@ -15,6 +15,7 @@
+ #include "parse-util.h"
+ #include "string-util.h"
+ #include "unaligned.h"
++#include "missing_stdlib.h"
+
+ enum {
+ IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
+diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
+index e63c59bd94..dd9773c009 100644
+--- a/src/shared/logs-show.c
++++ b/src/shared/logs-show.c
+@@ -41,6 +41,7 @@
+ #include "utf8.h"
+ #include "util.h"
+ #include "web-util.h"
++#include "missing_stdlib.h"
+
+ /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
+ #define PRINT_LINE_THRESHOLD 3
+diff --git a/src/shared/pager.c b/src/shared/pager.c
+index 4bbad7e37b..eefcdd068c 100644
+--- a/src/shared/pager.c
++++ b/src/shared/pager.c
+@@ -26,6 +26,7 @@
+ #include "strv.h"
+ #include "terminal-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static pid_t pager_pid = 0;
+
+diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c
+index 5d5bf7f21d..f1002ffa6c 100644
+--- a/src/shared/uid-range.c
++++ b/src/shared/uid-range.c
+@@ -9,6 +9,7 @@
+ #include "sort-util.h"
+ #include "uid-range.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
+ assert(range);
+diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
+index 6e3ee0d76b..7727e33d95 100644
+--- a/src/socket-proxy/socket-proxyd.c
++++ b/src/socket-proxy/socket-proxyd.c
+@@ -26,6 +26,7 @@
+ #include "socket-util.h"
+ #include "string-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ #define BUFFER_SIZE (256 * 1024)
+
+diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
+index c9d318b8d1..fcb8d40805 100644
+--- a/src/test/test-hexdecoct.c
++++ b/src/test/test-hexdecoct.c
+@@ -6,6 +6,7 @@
+ #include "hexdecoct.h"
+ #include "macro.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ static void test_hexchar(void) {
+ assert_se(hexchar(0xa) == 'a');
+diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
+index 65c40de4c8..4ef9a0c6c8 100644
+--- a/src/udev/udev-builtin-path_id.c
++++ b/src/udev/udev-builtin-path_id.c
+@@ -22,6 +22,7 @@
+ #include "sysexits.h"
+ #include "udev-builtin.h"
+ #include "udev-util.h"
++#include "missing_stdlib.h"
+
+ _printf_(2,3)
+ static void path_prepend(char **path, const char *fmt, ...) {
+diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
+index b28089be71..a7e2232299 100644
+--- a/src/udev/udev-event.c
++++ b/src/udev/udev-event.c
+@@ -34,6 +34,7 @@
+ #include "udev-util.h"
+ #include "udev-watch.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ typedef struct Spawn {
+ sd_device *device;
+diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
+index bf997fc0ed..e3f5f1f2e2 100644
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -33,6 +33,7 @@
+ #include "udev-util.h"
+ #include "user-util.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
+
diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
new file mode 100644
index 0000000000..951bebc901
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
@@ -0,0 +1,382 @@
+From f95192d87a46a2191cf4ebd47c64e04b138d7fac Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 26 Oct 2017 22:10:42 -0700
+Subject: [PATCH] Include netinet/if_ether.h
+
+Fixes
+/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr'
+ struct ethhdr {
+ ^~~~~~
+
+and related arphdr, arpreq, and arpreq_old errors
+/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr'
+ struct arphdr {
+ ^~~~~~
+
+The latter requires removing some includes of net/if_arp.h to avoid
+conflicting with netinet/if_ether.h.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+[rebased for systemd 247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ src/basic/linux/in6.h | 14 +++++++-------
+ src/libsystemd-network/sd-dhcp6-client.c | 1 -
+ src/libsystemd/sd-netlink/netlink-types.c | 1 +
+ src/machine/machine-dbus.c | 1 +
+ src/network/netdev/bond.c | 1 +
+ src/network/netdev/bridge.c | 1 +
+ src/network/netdev/macsec.c | 1 +
+ src/network/netdev/netdev-gperf.gperf | 1 +
+ src/network/netdev/netdev.c | 1 +
+ src/network/networkd-bridge-vlan.c | 1 +
+ src/network/networkd-dhcp-common.c | 4 +++-
+ src/network/networkd-dhcp-server.c | 4 ++--
+ src/network/networkd-dhcp4.c | 2 +-
+ src/network/networkd-dhcp6.c | 2 +-
+ src/network/networkd-link.c | 2 +-
+ src/network/networkd-network.c | 1 +
+ src/network/networkd-route.c | 1 +
+ src/network/networkd-setlink.c | 2 +-
+ src/network/test-network-tables.c | 1 +
+ src/shared/ethtool-util.c | 1 +
+ src/shared/ethtool-util.h | 1 +
+ src/udev/net/link-config.c | 1 +
+ src/udev/udev-builtin-net_setup_link.c | 1 +
+ 23 files changed, 31 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h
+index 5ad396a57e..1dc007fe13 100644
+--- a/src/basic/linux/in6.h
++++ b/src/basic/linux/in6.h
+@@ -1,10 +1,10 @@
+ /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+ /*
+- * Types and definitions for AF_INET6
+- * Linux INET6 implementation
++ * Types and definitions for AF_INET6
++ * Linux INET6 implementation
+ *
+ * Authors:
+- * Pedro Roque <roque@di.fc.ul.pt>
++ * Pedro Roque <roque@di.fc.ul.pt>
+ *
+ * Sources:
+ * IPv6 Program Interfaces for BSD Systems
+@@ -19,8 +19,8 @@
+ * 2 of the License, or (at your option) any later version.
+ */
+
+-#ifndef _UAPI_LINUX_IN6_H
+-#define _UAPI_LINUX_IN6_H
++#ifndef _LINUX_IN6_H
++#define _LINUX_IN6_H
+
+ #include <linux/types.h>
+ #include <linux/libc-compat.h>
+@@ -97,7 +97,7 @@ struct in6_flowlabel_req {
+
+
+ /*
+- * Bitmask constant declarations to help applications select out the
++ * Bitmask constant declarations to help applications select out the
+ * flow label and priority fields.
+ *
+ * Note that this are in host byte order while the flowinfo field of
+@@ -298,4 +298,4 @@ struct in6_flowlabel_req {
+ * ...
+ * MRT6_MAX
+ */
+-#endif /* _UAPI_LINUX_IN6_H */
++#endif /* _LINUX_IN6_H */
+diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
+index f99c12620b..4966d62656 100644
+--- a/src/libsystemd-network/sd-dhcp6-client.c
++++ b/src/libsystemd-network/sd-dhcp6-client.c
+@@ -5,7 +5,6 @@
+
+ #include <errno.h>
+ #include <sys/ioctl.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_infiniband.h>
+
+ #include "sd-dhcp6-client.h"
+diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
+index beb926d40b..41de212242 100644
+--- a/src/libsystemd/sd-netlink/netlink-types.c
++++ b/src/libsystemd/sd-netlink/netlink-types.c
+@@ -3,6 +3,7 @@
+ #include <netinet/in.h>
+ #include <stdint.h>
+ #include <sys/socket.h>
++#include <netinet/if_ether.h>
+ #include <linux/can/vxcan.h>
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
+index 0022a980c5..fc22e51409 100644
+--- a/src/machine/machine-dbus.c
++++ b/src/machine/machine-dbus.c
+@@ -3,6 +3,7 @@
+ #include <errno.h>
+ #include <sys/mount.h>
+ #include <sys/wait.h>
++#include <netinet/if_ether.h>
+
+ /* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the POSIX
+diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
+index a7a4adce45..eb111a6c48 100644
+--- a/src/network/netdev/bond.c
++++ b/src/network/netdev/bond.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include "alloc-util.h"
+ #include "bond.h"
+ #include "bond-util.h"
+diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
+index 99fb9e1c3c..ecc6ca91bf 100644
+--- a/src/network/netdev/bridge.c
++++ b/src/network/netdev/bridge.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <net/if.h>
+
+ #include "bridge.h"
+diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
+index 77c5f8c4e7..04be1b4ab2 100644
+--- a/src/network/netdev/macsec.c
++++ b/src/network/netdev/macsec.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <netinet/in.h>
+ #include <linux/if_ether.h>
+ #include <linux/if_macsec.h>
+diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
+index 9dd081425e..130e5b3d3c 100644
+--- a/src/network/netdev/netdev-gperf.gperf
++++ b/src/network/netdev/netdev-gperf.gperf
+@@ -3,6 +3,7 @@
+ #if __GNUC__ >= 7
+ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
+ #endif
++#include <netinet/if_ether.h>
+ #include <stddef.h>
+ #include "bareudp.h"
+ #include "batadv.h"
+diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
+index 53534d4873..1cfda9469f 100644
+--- a/src/network/netdev/netdev.c
++++ b/src/network/netdev/netdev.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <unistd.h>
+diff --git a/src/network/networkd-bridge-vlan.c b/src/network/networkd-bridge-vlan.c
+index 3153bf6984..687a26b057 100644
+--- a/src/network/networkd-bridge-vlan.c
++++ b/src/network/networkd-bridge-vlan.c
+@@ -4,6 +4,7 @@
+ ***/
+
+ #include <netinet/in.h>
++#include <netinet/if_ether.h>
+ #include <linux/if_bridge.h>
+ #include <stdbool.h>
+
+diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
+index 249d780887..edd2e9adf8 100644
+--- a/src/network/networkd-dhcp-common.c
++++ b/src/network/networkd-dhcp-common.c
+@@ -1,7 +1,8 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
++#include <net/if_arp.h>
++#include <net/if.h>
+
+ #include "bus-error.h"
+ #include "dhcp-identifier.h"
+@@ -13,6 +14,7 @@
+ #include "networkd-dhcp-common.h"
+ #include "networkd-link.h"
+ #include "networkd-manager.h"
++#include <netinet/if_ether.h>
+ #include "networkd-network.h"
+ #include "parse-util.h"
+ #include "socket-util.h"
+diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
+index 9e2faa5675..fd8d817569 100644
+--- a/src/network/networkd-dhcp-server.c
++++ b/src/network/networkd-dhcp-server.c
+@@ -1,8 +1,8 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
+-#include <linux/if_arp.h>
+-#include <linux/if.h>
++#include <net/if_arp.h>
++#include <net/if.h>
+
+ #include "sd-dhcp-server.h"
+
+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
+index f80adcdbcf..3311e2a718 100644
+--- a/src/network/networkd-dhcp4.c
++++ b/src/network/networkd-dhcp4.c
+@@ -1,9 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <netinet/in.h>
+ #include <netinet/ip.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
+
+ #include "escape.h"
+ #include "alloc-util.h"
+diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
+index 2b72b618fc..d0d4cfb384 100644
+--- a/src/network/networkd-dhcp6.c
++++ b/src/network/networkd-dhcp6.c
+@@ -3,9 +3,9 @@
+ Copyright © 2014 Intel Corporation. All rights reserved.
+ ***/
+
++#include <netinet/if_ether.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
+
+ #include "sd-dhcp6-client.h"
+
+diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
+index 20675f2306..2884511ff3 100644
+--- a/src/network/networkd-link.c
++++ b/src/network/networkd-link.c
+@@ -1,9 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <net/if.h>
++#include <netinet/if_ether.h>
+ #include <netinet/in.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
+ #include <linux/if_link.h>
+ #include <linux/netdevice.h>
+ #include <sys/socket.h>
+diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
+index 850b4f449e..6f85d41328 100644
+--- a/src/network/networkd-network.c
++++ b/src/network/networkd-network.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <linux/netdevice.h>
+diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
+index 791fd64c39..a2825c920d 100644
+--- a/src/network/networkd-route.c
++++ b/src/network/networkd-route.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/in.h>
+ #include <linux/icmpv6.h>
+ #include <linux/ipv6_route.h>
+ #include <linux/nexthop.h>
+diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
+index 13c4cedd10..6558d551ab 100644
+--- a/src/network/networkd-setlink.c
++++ b/src/network/networkd-setlink.c
+@@ -1,8 +1,8 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+ #include <netinet/in.h>
++#include <net/if_arp.h>
+ #include <linux/if.h>
+-#include <linux/if_arp.h>
+
+ #include "missing_network.h"
+ #include "netlink-util.h"
+diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
+index f55e524ae9..83d5c7cef3 100644
+--- a/src/network/test-network-tables.c
++++ b/src/network/test-network-tables.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include "bond.h"
+ #include "dhcp6-internal.h"
+ #include "dhcp6-protocol.h"
+diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
+index f77f6943ca..0e1506e04b 100644
+--- a/src/shared/ethtool-util.c
++++ b/src/shared/ethtool-util.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <net/if.h>
+ #include <sys/ioctl.h>
+ #include <linux/ethtool.h>
+diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h
+index 7d28766624..e98a25418b 100644
+--- a/src/shared/ethtool-util.h
++++ b/src/shared/ethtool-util.h
+@@ -3,6 +3,7 @@
+
+ #include <macro.h>
+ #include <net/ethernet.h>
++#include <netinet/if_ether.h>
+ #include <linux/ethtool.h>
+
+ #include "conf-parser.h"
+diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
+index 8dfe23691b..e269856337 100644
+--- a/src/udev/net/link-config.c
++++ b/src/udev/net/link-config.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include <linux/netdevice.h>
+ #include <netinet/ether.h>
+ #include <unistd.h>
+diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
+index 5964e30bf1..52a18d7a7f 100644
+--- a/src/udev/udev-builtin-net_setup_link.c
++++ b/src/udev/udev-builtin-net_setup_link.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
++#include <netinet/if_ether.h>
+ #include "alloc-util.h"
+ #include "device-util.h"
+ #include "errno-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch b/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch
deleted file mode 100644
index 631dd77465..0000000000
--- a/meta/recipes-core/systemd/systemd/0006-journal-Use-posix-fallocate-only-if-available.patch
+++ /dev/null
@@ -1,96 +0,0 @@
-From 34a61b6c9eed3fad360066fb63132ebc7e0aaaa6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:12:48 +0000
-Subject: [PATCH 06/11] journal: Use posix fallocate only if available
-
-Some architecture ports in uclibc did not support it in past
-
-Upstream-Status: Denied [no desire for uclibc support]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- src/journal/journal-file.c | 16 +++++++++++++++-
- src/journal/journald-kmsg.c | 15 ++++++++++++++-
- 2 files changed, 29 insertions(+), 2 deletions(-)
-
-diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
-index 2845e05..9431171 100644
---- a/src/journal/journal-file.c
-+++ b/src/journal/journal-file.c
-@@ -36,6 +36,8 @@
- #include "compress.h"
- #include "fsprg.h"
-
-+#include "config.h"
-+
- #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
- #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
-
-@@ -354,7 +356,7 @@ static int journal_file_fstat(JournalFile *f) {
-
- static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
- uint64_t old_size, new_size;
-- int r;
-+ int r = 0;
-
- assert(f);
-
-@@ -418,9 +420,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
- /* Note that the glibc fallocate() fallback is very
- inefficient, hence we try to minimize the allocation area
- as we can. */
-+#ifdef HAVE_POSIX_FALLOCATE
- r = posix_fallocate(f->fd, old_size, new_size - old_size);
- if (r != 0)
- return -r;
-+#else
-+ /* Write something every 512 bytes to make sure the block is allocated */
-+ uint64_t len = new_size - old_size;
-+ uint64_t offset = old_size;
-+ for (offset += (len-1) % 512; len > 0; offset += 512) {
-+ len -= 512;
-+ if (pwrite(f->fd, "", 1, offset) != 1)
-+ return -errno;
-+ }
-+
-+#endif /* HAVE_POSIX_FALLOCATE */
-
- f->header->arena_size = htole64(new_size - le64toh(f->header->header_size));
-
-diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
-index c4216c4..a998ed5 100644
---- a/src/journal/journald-kmsg.c
-+++ b/src/journal/journald-kmsg.c
-@@ -436,6 +436,7 @@ fail:
- int server_open_kernel_seqnum(Server *s) {
- _cleanup_close_ int fd;
- uint64_t *p;
-+ int r = 0;
-
- assert(s);
-
-@@ -449,7 +450,19 @@ int server_open_kernel_seqnum(Server *s) {
- return 0;
- }
-
-- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
-+#ifdef HAVE_POSIX_FALLOCATE
-+ r = posix_fallocate(fd, 0, sizeof(uint64_t));
-+#else
-+ /* Use good old method to write zeros into the journal file
-+ perhaps very inefficient yet working. */
-+ char *buf = alloca(sizeof(uint64_t));
-+ off_t oldpos = lseek(fd, 0, SEEK_CUR);
-+ bzero(buf, sizeof(uint64_t));
-+ lseek(fd, 0, SEEK_SET);
-+ r = write(fd, buf, sizeof(uint64_t));
-+ lseek(fd, oldpos, SEEK_SET);
-+#endif /* HAVE_POSIX_FALLOCATE */
-+ if (r < 0) {
- log_error_errno(errno, "Failed to allocate sequential number file, ignoring: %m");
- return 0;
- }
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
new file mode 100644
index 0000000000..46d0c7acef
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
@@ -0,0 +1,153 @@
+From 9c0d0b61ffa4019b299e4c47f376ae823879dbf3 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 14:56:21 +0800
+Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
+
+If the standard library doesn't provide brace
+expansion users just won't get it.
+
+Dont use GNU GLOB extentions on non-glibc systems
+
+Conditionalize use of GLOB_ALTDIRFUNC
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/glob-util.c | 12 ++++++++++++
+ src/test/test-glob-util.c | 16 ++++++++++++++++
+ src/tmpfiles/tmpfiles.c | 10 ++++++++++
+ 3 files changed, 38 insertions(+)
+
+diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
+index e026b29478..815e56ef68 100644
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -12,6 +12,12 @@
+ #include "path-util.h"
+ #include "strv.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ static void closedir_wrapper(void* v) {
+ (void) closedir(v);
+ }
+@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
++#ifdef GLOB_ALTDIRFUNC
+ /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+ assert(!(flags & GLOB_ALTDIRFUNC));
+
+@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ pglob->gl_lstat = lstat;
+ if (!pglob->gl_stat)
+ pglob->gl_stat = stat;
++#endif
+
+ errno = 0;
++#ifdef GLOB_ALTDIRFUNC
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
++#else
++ k = glob(path, flags, NULL, pglob);
++#endif
+ if (k == GLOB_NOMATCH)
+ return -ENOENT;
+ if (k == GLOB_NOSPACE)
+diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
+index 50b4924679..09c0a20aee 100644
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -12,6 +12,12 @@
+ #include "rm-rf.h"
+ #include "tmpfile-util.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ static void test_glob_exists(void) {
+ log_info("/* %s */", __func__);
+
+@@ -41,11 +47,13 @@ static void test_glob_no_dot(void) {
+ const char *fn;
+
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_closedir = closedir_wrapper,
+ .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+ .gl_opendir = (void *(*)(const char *)) opendir,
+ .gl_lstat = lstat,
+ .gl_stat = stat,
++#endif
+ };
+
+ int r;
+@@ -55,11 +63,19 @@ static void test_glob_no_dot(void) {
+ assert_se(mkdtemp(template));
+
+ fn = strjoina(template, "/*");
++#ifdef GLOB_ALTDIRFUNC
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
++#else
++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
++#endif
+ assert_se(r == GLOB_NOMATCH);
+
+ fn = strjoina(template, "/.*");
++#ifdef GLOB_ALTDIRFUNC
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
++#else
++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
++#endif
+ assert_se(r == GLOB_NOMATCH);
+
+ (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
+diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
+index 7e85c50634..145c48a685 100644
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -66,6 +66,12 @@
+ #include "umask-util.h"
+ #include "user-util.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
+ * them in the file system. This is intended to be used to create
+ * properly owned directories beneath /tmp, /var/tmp, /run, which are
+@@ -1990,7 +1996,9 @@ finish:
+
+ static int glob_item(Item *i, action_t action) {
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_opendir = (void *(*)(const char *)) opendir_nomod,
++#endif
+ };
+ int r = 0, k;
+ char **fn;
+@@ -2010,7 +2018,9 @@ static int glob_item(Item *i, action_t action) {
+
+ static int glob_item_recursively(Item *i, fdaction_t action) {
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_opendir = (void *(*)(const char *)) opendir_nomod,
++#endif
+ };
+ int r = 0, k;
+ char **fn;
diff --git a/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch
deleted file mode 100644
index 29c20c010f..0000000000
--- a/meta/recipes-core/systemd/systemd/0007-util-Use-mkostemp-only-if-libc-supports-it.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From f771407d3e0288ca0c06a894194d3ddad69b9a8e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:17:05 +0000
-Subject: [PATCH 07/11] util: Use mkostemp only if libc supports it
-
-Upstream-Status: Denied [no desire for uclibc support]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/shared/util.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/src/shared/util.c b/src/shared/util.c
-index dc65280..72f4665 100644
---- a/src/shared/util.c
-+++ b/src/shared/util.c
-@@ -97,6 +97,8 @@
- #include "def.h"
- #include "sparse-endian.h"
-
-+#include "config.h"
-+
- int saved_argc = 0;
- char **saved_argv = NULL;
-
-@@ -6682,7 +6684,13 @@ int mkostemp_safe(char *pattern, int flags) {
-
- u = umask(077);
-
-+#ifdef HAVE_MKOSTEMP
- fd = mkostemp(pattern, flags);
-+#else
-+ fd = mkstemp(pattern);
-+ if (fd >= 0) fcntl(fd, F_SETFD, flags);
-+#endif /* HAVE_MKOSTEMP */
-+
- if (fd < 0)
- return -errno;
-
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
new file mode 100644
index 0000000000..9540f967bb
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
@@ -0,0 +1,57 @@
+From 45b78e3dc3edead4fc9883dd5a9877f473367bf7 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:00:06 +0800
+Subject: [PATCH] add missing FTW_ macros for musl
+
+This is to avoid build failures like below for musl.
+
+ locale-util.c:296:24: error: 'FTW_STOP' undeclared
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ src/basic/missing_type.h | 20 ++++++++++++++++++++
+ src/shared/mount-setup.c | 1 +
+ 2 files changed, 21 insertions(+)
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index aeaf6ad5ec..3df1084ef2 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *);
+ #define __COMPAR_FN_T
+ typedef int (*__compar_fn_t)(const void *, const void *);
+ #endif
++
++#ifndef FTW_ACTIONRETVAL
++#define FTW_ACTIONRETVAL 16
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef FTW_STOP
++#define FTW_STOP 1
++#endif
++
++#ifndef FTW_SKIP_SUBTREE
++#define FTW_SKIP_SUBTREE 2
++#endif
++
++#ifndef FTW_SKIP_SIBLINGS
++#define FTW_SKIP_SIBLINGS 3
++#endif
+diff --git a/src/shared/mount-setup.c b/src/shared/mount-setup.c
+index ef3527e9a7..c1cab40eb8 100644
+--- a/src/shared/mount-setup.c
++++ b/src/shared/mount-setup.c
+@@ -32,6 +32,7 @@
+ #include "strv.h"
+ #include "user-util.h"
+ #include "virt.h"
++#include "missing_type.h"
+
+ typedef enum MountMode {
+ MNT_NONE = 0,
diff --git a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
deleted file mode 100644
index 5297625c93..0000000000
--- a/meta/recipes-core/systemd/systemd/0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From b45ea3bfd6635744c8a6b74d0ac701b44bb1d294 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:19:37 +0000
-Subject: [PATCH 08/11] util: bypass unimplemented _SC_PHYS_PAGES system
- configuration API on uclibc
-
-Upstream-Status: Inappropriate [uclibc-specific]
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/shared/util.c | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
-
-diff --git a/src/shared/util.c b/src/shared/util.c
-index 72f4665..cbbe3b1 100644
---- a/src/shared/util.c
-+++ b/src/shared/util.c
-@@ -6793,10 +6793,25 @@ uint64_t physical_memory(void) {
- /* We return this as uint64_t in case we are running as 32bit
- * process on a 64bit kernel with huge amounts of memory */
-
-+#ifdef __UCLIBC__
-+ char line[128];
-+ FILE *f = fopen("/proc/meminfo", "r");
-+ if (f == NULL)
-+ return 0;
-+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
-+ if (sscanf(line, "MemTotal: %l kB", &mem) == 1) {
-+ mem *= 1024;
-+ break;
-+ }
-+ }
-+ fclose(f);
-+ return (uint64_t) mem;
-+#else
- mem = sysconf(_SC_PHYS_PAGES);
- assert(mem > 0);
-
- return (uint64_t) mem * (uint64_t) page_size();
-+#endif
- }
-
- void hexdump(FILE *f, const void *p, size_t s) {
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
new file mode 100644
index 0000000000..35d24b334d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
@@ -0,0 +1,43 @@
+From 943b4258b870c65caaa56fe4dad0d9c7281fdb1d Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:03:47 +0800
+Subject: [PATCH] fix missing of __register_atfork for non-glibc builds
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/process-util.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/basic/process-util.c b/src/basic/process-util.c
+index 14259ea8df..18681838ef 100644
+--- a/src/basic/process-util.c
++++ b/src/basic/process-util.c
+@@ -18,6 +18,9 @@
+ #if HAVE_VALGRIND_VALGRIND_H
+ #include <valgrind/valgrind.h>
+ #endif
++#ifndef __GLIBC__
++#include <pthread.h>
++#endif
+
+ #include "alloc-util.h"
+ #include "architecture.h"
+@@ -1202,11 +1205,15 @@ void reset_cached_pid(void) {
+ cached_pid = CACHED_PID_UNSET;
+ }
+
++#ifdef __GLIBC__
+ /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
+ * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
+ * libpthread, as it is part of glibc anyway. */
+ extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
+ extern void* __dso_handle _weak_;
++#else
++#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
++#endif
+
+ pid_t getpid_cached(void) {
+ static bool installed = false;
diff --git a/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch
deleted file mode 100644
index 9ea3e83e52..0000000000
--- a/meta/recipes-core/systemd/systemd/0009-sysv-generator-add-support-for-executing-scripts-und.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 8791b5b3934c55694872b6915a67340683ead91b Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:22:52 +0000
-Subject: [PATCH 09/11] sysv-generator: add support for executing scripts under
- /etc/rcS.d/
-
-To be compatible, all services translated from scripts under /etc/rcS.d would
-run before services translated from scripts under /etc/rcN.d.
-
-Upstream-Status: Inappropriate [OE specific]
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/sysv-generator/sysv-generator.c | 50 ++++++++++++++++++++++++++++---------
- 1 file changed, 38 insertions(+), 12 deletions(-)
-
-diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
-index bd67f32..6756cc6 100644
---- a/src/sysv-generator/sysv-generator.c
-+++ b/src/sysv-generator/sysv-generator.c
-@@ -42,7 +42,8 @@
-
- typedef enum RunlevelType {
- RUNLEVEL_UP,
-- RUNLEVEL_DOWN
-+ RUNLEVEL_DOWN,
-+ RUNLEVEL_SYSINIT
- } RunlevelType;
-
- static const struct {
-@@ -57,6 +58,9 @@ static const struct {
- { "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP },
- { "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP },
-
-+ /* Debian style rcS.d, also adopted by OE */
-+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT},
-+
- /* Standard SysV runlevels for shutdown */
- { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
- { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
-@@ -65,7 +69,7 @@ static const struct {
- directories in this order, and we want to make sure that
- sysv_start_priority is known when we first load the
- unit. And that value we only know from S links. Hence
-- UP must be read before DOWN */
-+ UP/SYSINIT must be read before DOWN */
- };
-
- typedef struct SysvStub {
-@@ -81,6 +85,8 @@ typedef struct SysvStub {
- char **conflicts;
- bool has_lsb;
- bool reload;
-+ bool default_dependencies;
-+ bool from_rcsd;
- } SysvStub;
-
- const char *arg_dest = "/tmp";
-@@ -183,6 +189,9 @@ static int generate_unit_file(SysvStub *s) {
- "Description=%s\n",
- s->path, s->description);
-
-+ if (!s->default_dependencies)
-+ fprintf(f, "DefaultDependencies=no\n");
-+
- if (!isempty(before))
- fprintf(f, "Before=%s\n", before);
- if (!isempty(after))
-@@ -704,18 +713,30 @@ static int fix_order(SysvStub *s, Hashmap *all_services) {
- if (s->has_lsb && other->has_lsb)
- continue;
-
-- if (other->sysv_start_priority < s->sysv_start_priority) {
-- r = strv_extend(&s->after, other->name);
-+ /* All scripts under /etc/rcS.d should execute before scripts under
-+ * /etc/rcN.d */
-+ if (!other->from_rcsd && s->from_rcsd) {
-+ r = strv_extend(&s->before, other->name);
- if (r < 0)
- return log_oom();
-- }
-- else if (other->sysv_start_priority > s->sysv_start_priority) {
-- r = strv_extend(&s->before, other->name);
-+ } else if (other->from_rcsd && !s->from_rcsd) {
-+ r = strv_extend(&s->after, other->name);
- if (r < 0)
- return log_oom();
-- }
-- else
-- continue;
-+ } else {
-+ if (other->sysv_start_priority < s->sysv_start_priority) {
-+ r = strv_extend(&s->after, other->name);
-+ if (r < 0)
-+ return log_oom();
-+ }
-+ else if (other->sysv_start_priority > s->sysv_start_priority) {
-+ r = strv_extend(&s->before, other->name);
-+ if (r < 0)
-+ return log_oom();
-+ }
-+ else
-+ continue;
-+ }
-
- /* FIXME: Maybe we should compare the name here lexicographically? */
- }
-@@ -778,6 +799,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
- return log_oom();
-
- service->sysv_start_priority = -1;
-+ service->default_dependencies = true;
-+ service->from_rcsd = false;
- service->name = name;
- service->path = fpath;
-
-@@ -864,9 +887,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
-
- if (de->d_name[0] == 'S') {
-
-- if (rcnd_table[i].type == RUNLEVEL_UP) {
-+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
- service->sysv_start_priority =
- MAX(a*10 + b, service->sysv_start_priority);
-+ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true;
-+ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false;
- }
-
- r = set_ensure_allocated(&runlevel_services[i], NULL);
-@@ -878,7 +903,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
- goto finish;
-
- } else if (de->d_name[0] == 'K' &&
-- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
-+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
-+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
-
- r = set_ensure_allocated(&shutdown_services, NULL);
- if (r < 0)
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch
deleted file mode 100644
index 76a9481a42..0000000000
--- a/meta/recipes-core/systemd/systemd/0010-Make-root-s-home-directory-configurable.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From 3dc731c1d270e2e143de621db9bd898299fd849d Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:24:49 +0000
-Subject: [PATCH 10/11] Make root's home directory configurable
-
-OpenEmbedded has a configurable home directory for root. Allow
-systemd to be built using its idea of what root's home directory
-should be.
-
-Upstream-Status: Denied
-Upstream wants to have a unified hierarchy where everyone is
-using the same root folder.
-https://github.com/systemd/systemd/issues/541
-
-Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makefile.am | 2 ++
- configure.ac | 7 +++++++
- src/core/unit-printf.c | 2 +-
- src/nspawn/nspawn.c | 4 ++--
- src/shared/util.c | 4 ++--
- units/console-shell.service.m4.in | 4 ++--
- units/emergency.service.in | 4 ++--
- units/rescue.service.in | 4 ++--
- 8 files changed, 20 insertions(+), 11 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index 0fb3f9f..4623963 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -199,7 +199,8 @@ AM_CPPFLAGS = \
- -DKEXEC=\"$(KEXEC)\" \
- -DLIBDIR=\"$(libdir)\" \
- -DROOTLIBDIR=\"$(rootlibdir)\" \
- -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
-+ -DROOTHOMEDIR=\"$(roothomedir)\" \
- -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
- -I $(top_srcdir)/src \
- -I $(top_builddir)/src/shared \
-@@ -6342,6 +6343,7 @@ EXTRA_DIST += \
- substitutions = \
- '|rootlibexecdir=$(rootlibexecdir)|' \
- '|rootbindir=$(rootbindir)|' \
-+ '|roothomedir=$(roothomedir)|' \
- '|bindir=$(bindir)|' \
- '|SYSTEMCTL=$(rootbindir)/systemctl|' \
- '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
-diff --git a/configure.ac b/configure.ac
-index a5b2e6e..55bb7d8 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1428,6 +1428,11 @@ AC_ARG_WITH([rootlibdir],
- [],
- [with_rootlibdir=${libdir}])
-
-+AC_ARG_WITH([roothomedir],
-+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
-+ [],
-+ [with_roothomedir=/root])
-+
- AC_ARG_WITH([pamlibdir],
- AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
- [],
-@@ -1518,6 +1523,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
- AC_SUBST([pamconfdir], [$with_pamconfdir])
- AC_SUBST([rootprefix], [$with_rootprefix])
- AC_SUBST([rootlibdir], [$with_rootlibdir])
-+AC_SUBST([roothomedir], [$with_roothomedir])
-
- AC_CONFIG_FILES([
- Makefile po/Makefile.in
-@@ -1617,6 +1623,7 @@ AC_MSG_RESULT([
- include_prefix: ${INCLUDE_PREFIX}
- lib dir: ${libdir}
- rootlib dir: ${with_rootlibdir}
-+ root home dir: ${with_roothomedir}
- SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
- SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
- Build Python: ${PYTHON}
-diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
-index 97135db..14d12f1 100644
---- a/src/core/unit-printf.c
-+++ b/src/core/unit-printf.c
-@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char
- * best of it if we can, but fail if we can't */
-
- if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
-- n = strdup("/root");
-+ n = strdup(ROOTHOMEDIR);
- else
- return -ENOTSUP;
-
-diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
-index b597edb..0b32673 100644
---- a/src/nspawn/nspawn.c
-+++ b/src/nspawn/nspawn.c
-@@ -4192,7 +4192,7 @@ int main(int argc, char *argv[]) {
- if (r < 0)
- _exit(EXIT_FAILURE);
-
-- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
-+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) ||
- (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
- (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) {
- log_oom();
-@@ -4266,7 +4266,7 @@ int main(int argc, char *argv[]) {
- execvp(argv[optind], argv + optind);
- #endif /* HAVE_EXECVPE */
- else {
-- chdir(home ? home : "/root");
-+ chdir(home ? home : ROOTHOMEDIR);
- execle("/bin/bash", "-bash", NULL, env_use);
- execle("/bin/sh", "-sh", NULL, env_use);
- }
-diff --git a/src/shared/util.c b/src/shared/util.c
-index cbbe3b1..a0e3cc5 100644
---- a/src/shared/util.c
-+++ b/src/shared/util.c
-@@ -4609,7 +4609,7 @@ int get_user_creds(
- *gid = 0;
-
- if (home)
-- *home = "/root";
-+ *home = ROOTHOMEDIR;
-
- if (shell)
- *shell = "/bin/sh";
-@@ -5611,7 +5611,7 @@ int get_home_dir(char **_h) {
- /* Hardcode home directory for root to avoid NSS */
- u = getuid();
- if (u == 0) {
-- h = strdup("/root");
-+ h = strdup(ROOTHOMEDIR);
- if (!h)
- return -ENOMEM;
-
-diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in
-index 5c80722..efde5f0 100644
---- a/units/console-shell.service.m4.in
-+++ b/units/console-shell.service.m4.in
-@@ -15,8 +15,8 @@ After=rc-local.service
- Before=getty.target
-
- [Service]
--Environment=HOME=/root
--WorkingDirectory=/root
-+Environment=HOME=@roothomedir@
-+WorkingDirectory=@roothomedir@
- ExecStart=-@SULOGIN@
- ExecStopPost=-@SYSTEMCTL@ poweroff
- Type=idle
-diff --git a/units/emergency.service.in b/units/emergency.service.in
-index 2695d7b..7f47b73 100644
---- a/units/emergency.service.in
-+++ b/units/emergency.service.in
-@@ -14,8 +14,8 @@ Conflicts=rescue.service
- Before=shutdown.target
-
- [Service]
--Environment=HOME=/root
--WorkingDirectory=/root
-+Environment=HOME=@roothomedir@
-+WorkingDirectory=@roothomedir@
- ExecStartPre=-/bin/plymouth quit
- ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'
- ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
-diff --git a/units/rescue.service.in b/units/rescue.service.in
-index de73fee..47f3593 100644
---- a/units/rescue.service.in
-+++ b/units/rescue.service.in
-@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service
- Before=shutdown.target
-
- [Service]
--Environment=HOME=/root
--WorkingDirectory=/root
-+Environment=HOME=@roothomedir@
-+WorkingDirectory=@roothomedir@
- ExecStartPre=-/bin/plymouth quit
- ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.'
- ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --fail --no-block default"
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
new file mode 100644
index 0000000000..a0d8402288
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
@@ -0,0 +1,104 @@
+From cceb2bba69b371868e89d435c5406b67cdd84d57 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+diff --git a/src/basic/format-util.h b/src/basic/format-util.h
+index b7e18768e3..3195ab205d 100644
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
+ # define PRI_TIMEX "li"
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
+index 23d108d5df..3e6fb438d7 100644
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -43,7 +43,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ if (setrlimit(resource, &fixed) < 0)
+ return -errno;
+@@ -308,13 +308,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ s = strdup("infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+
+ if (!s)
+ return -ENOMEM;
+@@ -405,7 +405,7 @@ int rlimit_nofile_safe(void) {
+
+ rl.rlim_cur = FD_SETSIZE;
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 2a64675c5f..dca1e0e3b6 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -5391,9 +5391,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
diff --git a/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch
deleted file mode 100644
index e562bca100..0000000000
--- a/meta/recipes-core/systemd/systemd/0011-systemd-user-avoid-using-system-auth.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 7e202f71785bf5a67c8a4f6b58d3585608fbfdc4 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 05:26:25 +0000
-Subject: [PATCH 11/11] systemd-user: avoid using system-auth
-
-In OE, we don't provide system-auth, instead, we use common-* files.
-So modify systemd-user file to use common-* files.
-
-Upstream-Status: Inappropriate [oe specific]
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/login/systemd-user | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/login/systemd-user b/src/login/systemd-user
-index 8112d74..99635af 100644
---- a/src/login/systemd-user
-+++ b/src/login/systemd-user
-@@ -2,5 +2,5 @@
- #
- # Used by systemd --user instances.
-
--account include system-auth
--session include system-auth
-+account include common-account
-+session include common-session
---
-2.1.4
-
diff --git a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
new file mode 100644
index 0000000000..1aee0fd7c5
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
@@ -0,0 +1,39 @@
+From c1ee5661fa24bf540a4880a9d528da8752be033b Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 28 Feb 2018 21:25:22 -0800
+Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/test/test-sizeof.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
+index e36bee4e8f..4403c0aa52 100644
+--- a/src/test/test-sizeof.c
++++ b/src/test/test-sizeof.c
+@@ -55,8 +55,10 @@ int main(void) {
+ info(unsigned);
+ info(long unsigned);
+ info(long long unsigned);
++#ifdef __GLIBC__
+ info(__syscall_ulong_t);
+ info(__syscall_slong_t);
++#endif
+
+ info(float);
+ info(double);
+@@ -74,7 +76,9 @@ int main(void) {
+ info(ssize_t);
+ info(time_t);
+ info(usec_t);
++#ifdef __GLIBC__
+ info(__time_t);
++#endif
+ info(pid_t);
+ info(uid_t);
+ info(gid_t);
diff --git a/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
new file mode 100644
index 0000000000..fefa6cbaaa
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch
@@ -0,0 +1,98 @@
+From ca9b1277fb4eb89bc2ca92440a280e318e882b66 Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <armccurdy@gmail.com>
+Date: Tue, 10 Oct 2017 14:33:30 -0700
+Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
+
+Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
+thing to do and it's not portable (not supported by musl). See:
+
+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
+ http://www.openwall.com/lists/musl/2015/02/05/2
+
+Note that laccess() is never passing AT_EACCESS so a lot of the
+discussion in the links above doesn't apply. Note also that
+(currently) all systemd callers of laccess() pass mode as F_OK, so
+only check for existence of a file, not access permissions.
+Therefore, in this case, the only distiction between faccessat()
+with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
+for broken symlinks; laccess() on a broken symlink will succeed with
+(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
+
+The laccess() macros was added to systemd some time ago and it's not
+clear if or why it needs to return success for broken symlinks. Maybe
+just historical and not actually necessary or desired behaviour?
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
+
+---
+ src/basic/fs-util.h | 23 +++++++++++++++++++++--
+ src/shared/base-filesystem.c | 6 +++---
+ 2 files changed, 24 insertions(+), 5 deletions(-)
+
+diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
+index 7f15b558ca..4263298cad 100644
+--- a/src/basic/fs-util.h
++++ b/src/basic/fs-util.h
+@@ -47,8 +47,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
+ int fd_warn_permissions(const char *path, int fd);
+ int stat_warn_permissions(const char *path, const struct stat *st);
+
+-#define laccess(path, mode) \
+- (faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) < 0 ? -errno : 0)
++/*
++ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
++ do and it's not portable (not supported by musl). See:
++
++ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
++ http://www.openwall.com/lists/musl/2015/02/05/2
++
++ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
++ the links above doesn't apply. Note also that (currently) all systemd callers
++ of laccess() pass mode as F_OK, so only check for existence of a file, not
++ access permissions. Therefore, in this case, the only distiction between
++ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
++ behaviour for broken symlinks; laccess() on a broken symlink will succeed
++ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
++
++ The laccess() macros was added to systemd some time ago and it's not clear if
++ or why it needs to return success for broken symlinks. Maybe just historical
++ and not actually necessary or desired behaviour?
++*/
++
++#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0)
+
+ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
+ int touch(const char *path);
+diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
+index 016eb7b82a..b1967f9f2f 100644
+--- a/src/shared/base-filesystem.c
++++ b/src/shared/base-filesystem.c
+@@ -53,7 +53,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+ return log_error_errno(errno, "Failed to open root file system: %m");
+
+ for (size_t i = 0; i < ELEMENTSOF(table); i++) {
+- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
++ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
+ continue;
+
+ if (table[i].target) {
+@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+
+ /* check if one of the targets exists */
+ NULSTR_FOREACH(s, table[i].target) {
+- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
++ if (faccessat(fd, s, F_OK, 0) < 0)
+ continue;
+
+ /* check if a specific file exists at the target path */
+@@ -72,7 +72,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
+ if (!p)
+ return log_oom();
+
+- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
++ if (faccessat(fd, p, F_OK, 0) < 0)
+ continue;
+ }
+
diff --git a/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch b/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch
deleted file mode 100644
index ccd675798c..0000000000
--- a/meta/recipes-core/systemd/systemd/0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch
+++ /dev/null
@@ -1,185 +0,0 @@
-From 2abf886295b979bce6d3f0a240f6f5ecfd70ba37 Mon Sep 17 00:00:00 2001
-From: Randy Witt <randy.e.witt@linux.intel.com>
-Date: Wed, 4 Mar 2015 18:32:40 -0800
-Subject: [PATCH] tmpfiles.c: Honor ordering within files as the docs say.
-
-Previously, globs would always get processed first followed by any other
-items in arbitrary order. This is contrary to the documentation which
-states "Otherwise, the files/directories are processed in the order they
-are listed."
-
-To fix this, remove the separate "globs" hashmap, and instead use only one
-marking each entry as a glob or not. There should be little overhead
-from doing this, considering the only time nested processing will occur
-is for processing of globs which are not of type "X".
-
-Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
----
- src/tmpfiles/tmpfiles.c | 53 ++++++++++++++++++++++---------------------------
- 1 file changed, 24 insertions(+), 29 deletions(-)
-
-diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
-index 917bb3c..0b6d226 100644
---- a/src/tmpfiles/tmpfiles.c
-+++ b/src/tmpfiles/tmpfiles.c
-@@ -116,6 +116,7 @@ typedef struct Item {
- bool force:1;
-
- bool done:1;
-+ bool glob:1;
- } Item;
-
- typedef struct ItemArray {
-@@ -137,7 +138,7 @@ static const char conf_file_dirs[] = CONF_DIRS_NULSTR("tmpfiles");
-
- #define MAX_DEPTH 256
-
--static Hashmap *items = NULL, *globs = NULL;
-+static OrderedHashmap *items = NULL;
- static Set *unix_sockets = NULL;
-
- static bool needs_glob(ItemType t) {
-@@ -176,17 +177,17 @@ static bool takes_ownership(ItemType t) {
- RECURSIVE_REMOVE_PATH);
- }
-
--static struct Item* find_glob(Hashmap *h, const char *match) {
-+static struct Item* find_glob(OrderedHashmap *h, const char *match) {
- ItemArray *j;
- Iterator i;
-
-- HASHMAP_FOREACH(j, h, i) {
-+ ORDERED_HASHMAP_FOREACH(j, h, i) {
- unsigned n;
-
- for (n = 0; n < j->count; n++) {
- Item *item = j->items + n;
-
-- if (fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0)
-+ if (item->glob && fnmatch(item->path, match, FNM_PATHNAME|FNM_PERIOD) == 0)
- return item;
- }
- }
-@@ -391,12 +392,12 @@ static int dir_cleanup(
- }
-
- /* Is there an item configured for this path? */
-- if (hashmap_get(items, sub_path)) {
-+ if (ordered_hashmap_get(items, sub_path)) {
- log_debug("Ignoring \"%s\": a separate entry exists.", sub_path);
- continue;
- }
-
-- if (find_glob(globs, sub_path)) {
-+ if (find_glob(items, sub_path)) {
- log_debug("Ignoring \"%s\": a separate glob exists.", sub_path);
- continue;
- }
-@@ -1378,7 +1379,7 @@ static int process_item(Item *i) {
- PATH_FOREACH_PREFIX(prefix, i->path) {
- ItemArray *j;
-
-- j = hashmap_get(items, prefix);
-+ j = ordered_hashmap_get(items, prefix);
- if (j) {
- int s;
-
-@@ -1505,7 +1506,6 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
- _cleanup_free_ char *action = NULL, *mode = NULL, *user = NULL, *group = NULL, *age = NULL, *path = NULL;
- _cleanup_(item_free_contents) Item i = {};
- ItemArray *existing;
-- Hashmap *h;
- int r, c = -1, pos;
- bool force = false, boot = false;
-
-@@ -1739,9 +1739,9 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
- i.age_set = true;
- }
-
-- h = needs_glob(i.type) ? globs : items;
-+ i.glob = needs_glob(i.type);
-
-- existing = hashmap_get(h, i.path);
-+ existing = ordered_hashmap_get(items, i.path);
- if (existing) {
- unsigned n;
-
-@@ -1752,7 +1752,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
- }
- } else {
- existing = new0(ItemArray, 1);
-- r = hashmap_put(h, i.path, existing);
-+ r = ordered_hashmap_put(items, i.path, existing);
- if (r < 0)
- return log_oom();
- }
-@@ -1911,14 +1911,20 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
- }
-
- /* we have to determine age parameter for each entry of type X */
-- HASHMAP_FOREACH(i, globs, iterator) {
-+ ORDERED_HASHMAP_FOREACH(i, items, iterator) {
- Iterator iter;
- Item *j, *candidate_item = NULL;
-+ int number = 0;
-
-+ if (!i->glob)
-+ continue;
- if (i->type != IGNORE_DIRECTORY_PATH)
- continue;
-
-- HASHMAP_FOREACH(j, items, iter) {
-+ ORDERED_HASHMAP_FOREACH(j, items, iter) {
-+ number++;
-+ if (j == i)
-+ continue;
- if (j->type != CREATE_DIRECTORY && j->type != TRUNCATE_DIRECTORY && j->type != CREATE_SUBVOLUME)
- continue;
-
-@@ -1964,10 +1970,9 @@ int main(int argc, char *argv[]) {
-
- mac_selinux_init(NULL);
-
-- items = hashmap_new(&string_hash_ops);
-- globs = hashmap_new(&string_hash_ops);
-+ items = ordered_hashmap_new(&string_hash_ops);
-
-- if (!items || !globs) {
-+ if (!items) {
- r = log_oom();
- goto finish;
- }
-@@ -2000,27 +2005,17 @@ int main(int argc, char *argv[]) {
- }
- }
-
-- HASHMAP_FOREACH(a, globs, iterator) {
-- k = process_item_array(a);
-- if (k < 0 && r == 0)
-- r = k;
-- }
--
-- HASHMAP_FOREACH(a, items, iterator) {
-+ ORDERED_HASHMAP_FOREACH(a, items, iterator) {
- k = process_item_array(a);
- if (k < 0 && r == 0)
- r = k;
- }
-
- finish:
-- while ((a = hashmap_steal_first(items)))
-- item_array_free(a);
--
-- while ((a = hashmap_steal_first(globs)))
-+ while ((a = ordered_hashmap_steal_first(items)))
- item_array_free(a);
-
-- hashmap_free(items);
-- hashmap_free(globs);
-+ ordered_hashmap_free(items);
-
- free(arg_include_prefixes);
- free(arg_exclude_prefixes);
---
-1.9.3
-
diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
new file mode 100644
index 0000000000..f9f3af1505
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
@@ -0,0 +1,32 @@
+From 792f4718ebd5a156729be89a5b47e52dc4b62975 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 27 May 2018 08:36:44 -0700
+Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
+
+Fixes builds with musl, even though systemd is adamant about
+using non-posix basename implementation, we have a way out
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/machine/machine-dbus.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
+index fc22e51409..1fed07b941 100644
+--- a/src/machine/machine-dbus.c
++++ b/src/machine/machine-dbus.c
+@@ -11,6 +11,11 @@
+ #include <libgen.h>
+ #undef basename
+
++#if !defined(__GLIBC__)
++#include <string.h>
++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
++#endif
++
+ #include "alloc-util.h"
+ #include "bus-common-errors.h"
+ #include "bus-get-properties.h"
diff --git a/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
new file mode 100644
index 0000000000..fb901e6653
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
@@ -0,0 +1,39 @@
+From 101f5ceea7e575622c4f07d2972aeb4d6b082e4b Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 4 Jul 2018 15:00:44 +0800
+Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
+
+On musl, disabling buffering when writing to oom_score_adj will
+cause the following error.
+
+ Failed to adjust OOM setting: Invalid argument
+
+This error appears for systemd-udevd.service and dbus.service.
+This is because kernel receives '-' instead of the whole '-900'
+if buffering is disabled.
+
+This is libc implementation specific, as glibc does not have this issue.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/process-util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/basic/process-util.c b/src/basic/process-util.c
+index 18681838ef..0fa71ccce0 100644
+--- a/src/basic/process-util.c
++++ b/src/basic/process-util.c
+@@ -1606,7 +1606,7 @@ int set_oom_score_adjust(int value) {
+ sprintf(t, "%i", value);
+
+ return write_string_file("/proc/self/oom_score_adj", t,
+- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
++ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
+ }
+
+ int pidfd_get_pid(int fd, pid_t *ret) {
diff --git a/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
new file mode 100644
index 0000000000..ece115df8e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
@@ -0,0 +1,60 @@
+From 01ac079433b999a4747acf7be6a3b5fa182c3faf Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/libsystemd/sd-bus/bus-error.c | 5 +++++
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index 7483b46a11..c49be29e46 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -404,7 +404,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
+index e8e6ad555b..8ca5271d02 100644
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
diff --git a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
new file mode 100644
index 0000000000..62a6c23e44
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
@@ -0,0 +1,33 @@
+From df2470912f3197aa441b6751feace1454c7d1f84 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:18:00 +0800
+Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
+
+for currently unknown reasons they get exported to the shared libries
+even without being listed in the sym file
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/libsystemd/sd-bus/bus-error.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
+index c49be29e46..90731bd7e7 100644
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -55,8 +55,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
+ };
+
+ /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */
+-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
+-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
++extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
++extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
+
+ /* Additional maps registered with sd_bus_error_add_map() are in this
+ * NULL terminated array */
diff --git a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
new file mode 100644
index 0000000000..b6b1dc35b2
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
@@ -0,0 +1,28 @@
+From e27ecb188503159a3f11bb1179ba1892cd080843 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:27:54 +0800
+Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition
+
+Fix the following compile failure:
+src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/missing_type.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 3df1084ef2..697aa7f58a 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -13,6 +13,7 @@
+
+ #ifndef __GLIBC__
+ typedef int (*comparison_fn_t)(const void *, const void *);
++typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
+ #endif
+
+ #ifndef __COMPAR_FN_T
diff --git a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
new file mode 100644
index 0000000000..fea347242a
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch
@@ -0,0 +1,30 @@
+From 748c4cf040856857f24f4aeef6d996bd58573bd3 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index ab851306ba..5547cad875 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
+ #ifndef PR_CAP_AMBIENT
diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
new file mode 100644
index 0000000000..9a84d9c04a
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
@@ -0,0 +1,24 @@
+From 647447e220e7e47e214c8258c7d4fbdb0da058aa Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <alex.kiernan@gmail.com>
+Date: Fri, 7 Aug 2020 15:19:27 +0000
+Subject: [PATCH] Handle missing LOCK_EX
+
+Upstream-Status: Inappropriate [musl specific]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+
+---
+ src/partition/makefs.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/partition/makefs.c b/src/partition/makefs.c
+index 7c94fbfedb..42f966722d 100644
+--- a/src/partition/makefs.c
++++ b/src/partition/makefs.c
+@@ -6,6 +6,7 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <sys/file.h>
+
+ #include "alloc-util.h"
+ #include "blockdev-util.h"
diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
new file mode 100644
index 0000000000..5d3e8d4e84
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
@@ -0,0 +1,38 @@
+From 85cf3d58ff1a9696f0754feffae7d81b8d1d9a43 Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <alex.kiernan@gmail.com>
+Date: Fri, 7 Aug 2020 15:20:17 +0000
+Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un *
+
+| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns':
+| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types]
+| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
+| | ^~~~~~
+| | |
+| | struct sockaddr_un *
+| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22,
+| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21:
+| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
+| 384 | int connect (int, const struct sockaddr *, socklen_t);
+| | ^~~~~~~~~~~~~~~~~~~~~~~
+| cc1: some warnings being treated as errors
+
+Upstream-Status: Inappropriate [musl specific]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+
+---
+ src/nspawn/nspawn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index 575b9da447..ff08ed23cc 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -5354,7 +5354,7 @@ static int cant_be_in_netns(void) {
+ if (fd < 0)
+ return log_error_errno(errno, "Failed to allocate udev control socket: %m");
+
+- if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
++ if (connect(fd, (struct sockaddr *)&sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
+
+ if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
diff --git a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
new file mode 100644
index 0000000000..c0286244dd
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
@@ -0,0 +1,31 @@
+From 9770c5873836e702c2a58cf3b439198415c82c28 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 16:53:06 +0800
+Subject: [PATCH] test-json.c: define M_PIl
+
+Fix the following compile failure:
+src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/test/test-json.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/test/test-json.c b/src/test/test-json.c
+index 1d4b11945e..572c8cf9d0 100644
+--- a/src/test/test-json.c
++++ b/src/test/test-json.c
+@@ -13,6 +13,10 @@
+ #include "tests.h"
+ #include "util.h"
+
++#ifndef M_PIl
++#define M_PIl 3.141592653589793238462643383279502884L
++#endif
++
+ static void test_tokenizer(const char *data, ...) {
+ unsigned line = 0, column = 0;
+ void *state = NULL;
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
new file mode 100644
index 0000000000..9028e147bf
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
@@ -0,0 +1,392 @@
+From 26da484391e20b36eb65c98872d1145261028c7a Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Fri, 1 Mar 2019 15:22:15 +0800
+Subject: [PATCH] do not disable buffer in writing files
+
+Do not disable buffer in writing files, otherwise we get
+failure at boot for musl like below.
+
+ [!!!!!!] Failed to allocate manager object.
+
+And there will be other failures, critical or not critical.
+This is specific to musl.
+
+Upstream-Status: Inappropriate [musl]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/cgroup-util.c | 10 +++++-----
+ src/basic/procfs-util.c | 4 ++--
+ src/basic/sysctl-util.c | 2 +-
+ src/basic/util.c | 2 +-
+ src/binfmt/binfmt.c | 6 +++---
+ src/core/main.c | 4 ++--
+ src/core/smack-setup.c | 8 ++++----
+ src/hibernate-resume/hibernate-resume.c | 2 +-
+ src/libsystemd/sd-device/sd-device.c | 2 +-
+ src/nspawn/nspawn-cgroup.c | 2 +-
+ src/nspawn/nspawn.c | 6 +++---
+ src/shared/cgroup-setup.c | 4 ++--
+ src/shared/mount-util.c | 4 ++--
+ src/shared/smack-util.c | 2 +-
+ src/sleep/sleep.c | 8 ++++----
+ src/vconsole/vconsole-setup.c | 2 +-
+ 16 files changed, 34 insertions(+), 34 deletions(-)
+
+diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
+index c9efd862a2..b3708ea925 100644
+--- a/src/basic/cgroup-util.c
++++ b/src/basic/cgroup-util.c
+@@ -766,7 +766,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+
+ sc = strstrip(contents);
+ if (isempty(sc)) {
+- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, agent, 0);
+ if (r < 0)
+ return r;
+ } else if (!path_equal(sc, agent))
+@@ -784,7 +784,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
+
+ sc = strstrip(contents);
+ if (streq(sc, "0")) {
+- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "1", 0);
+ if (r < 0)
+ return r;
+
+@@ -811,7 +811,7 @@ int cg_uninstall_release_agent(const char *controller) {
+ if (r < 0)
+ return r;
+
+- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "0", 0);
+ if (r < 0)
+ return r;
+
+@@ -821,7 +821,7 @@ int cg_uninstall_release_agent(const char *controller) {
+ if (r < 0)
+ return r;
+
+- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "", 0);
+ if (r < 0)
+ return r;
+
+@@ -1651,7 +1651,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
+ if (r < 0)
+ return r;
+
+- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
++ return write_string_file(p, value, 0);
+ }
+
+ int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
+diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
+index 8c57094225..0cf6ec752b 100644
+--- a/src/basic/procfs-util.c
++++ b/src/basic/procfs-util.c
+@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
+ * decrease it, as threads-max is the much more relevant sysctl. */
+ if (limit > pid_max-1) {
+ sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
+- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
+ if (r < 0)
+ return r;
+ }
+
+ sprintf(buffer, "%" PRIu64, limit);
+- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
+ if (r < 0) {
+ uint64_t threads_max;
+
+diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
+index 8913e6ff85..29e6ec0755 100644
+--- a/src/basic/sysctl-util.c
++++ b/src/basic/sysctl-util.c
+@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
+
+ log_debug("Setting '%s' to '%s'", p, value);
+
+- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
+ }
+
+ int sysctl_read(const char *property, char **ret) {
+diff --git a/src/basic/util.c b/src/basic/util.c
+index 955b18bd2a..6d89c90176 100644
+--- a/src/basic/util.c
++++ b/src/basic/util.c
+@@ -234,7 +234,7 @@ void disable_coredumps(void) {
+ if (detect_container() > 0)
+ return;
+
+- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
+ if (r < 0)
+ log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
+ }
+diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
+index 29530bb691..3ecf6a45a2 100644
+--- a/src/binfmt/binfmt.c
++++ b/src/binfmt/binfmt.c
+@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
+ if (!fn)
+ return log_oom();
+
+- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ return write_string_file(fn, "-1", 0);
+ }
+
+ static int apply_rule(const char *rule) {
+@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
+
+ (void) delete_rule(rule);
+
+- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to add binary format: %m");
+
+@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) {
+ }
+
+ /* Flush out all rules */
+- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
+
+ STRV_FOREACH(f, files) {
+ k = apply_file(*f, true);
+diff --git a/src/core/main.c b/src/core/main.c
+index c64c73883e..1ac185e946 100644
+--- a/src/core/main.c
++++ b/src/core/main.c
+@@ -1402,7 +1402,7 @@ static int bump_unix_max_dgram_qlen(void) {
+ if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
+ return 0;
+
+- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
+ if (r < 0)
+ return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
+ "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
+@@ -1679,7 +1679,7 @@ static void initialize_core_pattern(bool skip_setup) {
+ if (getpid_cached() != 1)
+ return;
+
+- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
+ }
+diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
+index 79c4808473..b111ce0a11 100644
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -323,17 +323,17 @@ int mac_smack_setup(bool *loaded_policy) {
+ }
+
+ #ifdef SMACK_RUN_LABEL
+- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
+- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
+ r = write_string_file("/sys/fs/smackfs/netlabel",
+- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
+- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
+ #endif
+diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
+index 58e35e403e..1d0beb4008 100644
+--- a/src/hibernate-resume/hibernate-resume.c
++++ b/src/hibernate-resume/hibernate-resume.c
+@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
+ return EXIT_FAILURE;
+ }
+
+- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume", major_minor, 0);
+ if (r < 0) {
+ log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
+ return EXIT_FAILURE;
+diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
+index 388128bf33..695f535ff4 100644
+--- a/src/libsystemd/sd-device/sd-device.c
++++ b/src/libsystemd/sd-device/sd-device.c
+@@ -2096,7 +2096,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
+ if (!value)
+ return -ENOMEM;
+
+- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
+ if (r < 0) {
+ /* On failure, clear cache entry, as we do not know how it fails. */
+ device_remove_cached_sysattr_value(device, sysattr);
+diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
+index cb01b25bc6..e92051268b 100644
+--- a/src/nspawn/nspawn-cgroup.c
++++ b/src/nspawn/nspawn-cgroup.c
+@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
+ fn = strjoina(tree, cgroup, "/cgroup.procs");
+
+ sprintf(pid_string, PID_FMT, pid);
+- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
+ if (r < 0) {
+ log_error_errno(r, "Failed to move process: %m");
+ goto finish;
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index ff08ed23cc..e7c4a874a9 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -2751,7 +2751,7 @@ static int reset_audit_loginuid(void) {
+ if (streq(p, "4294967295"))
+ return 0;
+
+- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
+ if (r < 0) {
+ log_error_errno(r,
+ "Failed to reset audit login UID. This probably means that your kernel is too\n"
+@@ -4148,7 +4148,7 @@ static int setup_uid_map(
+ return log_oom();
+
+ xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
+- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, s, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write UID map: %m");
+
+@@ -4158,7 +4158,7 @@ static int setup_uid_map(
+ return log_oom();
+
+ xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
+- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, s, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write GID map: %m");
+
+diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
+index f197f715c7..077f893177 100644
+--- a/src/shared/cgroup-setup.c
++++ b/src/shared/cgroup-setup.c
+@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
+
+ xsprintf(c, PID_FMT "\n", pid);
+
+- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, c, 0);
+ if (r < 0)
+ return r;
+
+@@ -799,7 +799,7 @@ int cg_enable_everywhere(
+ return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
+ }
+
+- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_stream(f, s, 0);
+ if (r < 0) {
+ log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
+ FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
+diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c
+index 594efea989..d243b45bc4 100644
+--- a/src/shared/mount-util.c
++++ b/src/shared/mount-util.c
+@@ -1019,13 +1019,13 @@ static int make_userns(uid_t uid_shift, uid_t uid_range) {
+ xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, uid_shift, uid_range);
+
+ xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
+- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, line, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write UID map: %m");
+
+ /* We always assign the same UID and GID ranges */
+ xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
+- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, line, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write GID map: %m");
+
+diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
+index 3362ee3924..80c0f2a52e 100644
+--- a/src/shared/smack-util.c
++++ b/src/shared/smack-util.c
+@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
+ return 0;
+
+ p = procfs_file_alloca(pid, "attr/current");
+- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(p, label, 0);
+ if (r < 0)
+ return r;
+
+diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
+index a3aeb24633..d3e68e1b94 100644
+--- a/src/sleep/sleep.c
++++ b/src/sleep/sleep.c
+@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+ assert(hibernate_location->swap);
+
+ xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
+- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume", resume_str, 0);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
+ hibernate_location->swap->device, resume_str);
+@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+ }
+
+ xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
+- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
+ hibernate_location->swap->device, offset_str);
+@@ -90,7 +90,7 @@ static int write_mode(char **modes) {
+ STRV_FOREACH(mode, modes) {
+ int k;
+
+- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
++ k = write_string_file("/sys/power/disk", *mode, 0);
+ if (k >= 0)
+ return 0;
+
+@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **states) {
+ STRV_FOREACH(state, states) {
+ int k;
+
+- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
++ k = write_string_stream(*f, *state, 0);
+ if (k >= 0)
+ return 0;
+ log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
+diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
+index d1c3febdd5..1cc68694d1 100644
+--- a/src/vconsole/vconsole-setup.c
++++ b/src/vconsole/vconsole-setup.c
+@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
+ static int toggle_utf8_sysfs(bool utf8) {
+ int r;
+
+- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
+
diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
new file mode 100644
index 0000000000..152a36229c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
@@ -0,0 +1,58 @@
+From 5fa412dcebe89fd9f6f6003163f17e0dc719df34 Mon Sep 17 00:00:00 2001
+From: Scott Murray <scott.murray@konsulko.com>
+Date: Fri, 13 Sep 2019 19:26:27 -0400
+Subject: [PATCH] Handle __cpu_mask usage
+
+Fixes errors:
+
+src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
+src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function)
+
+__cpu_mask is an internal type of glibc's cpu_set implementation, not
+part of the POSIX definition, which is problematic when building with
+musl, which does not define a matching type. From inspection of musl's
+sched.h, however, it is clear that the corresponding type would be
+unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So,
+add a typedef to cpu-set-util.h defining __cpu_mask appropriately.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/shared/cpu-set-util.h | 2 ++
+ src/test/test-sizeof.c | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
+index 3c63a58826..4c2d4347fc 100644
+--- a/src/shared/cpu-set-util.h
++++ b/src/shared/cpu-set-util.h
+@@ -6,6 +6,8 @@
+ #include "macro.h"
+ #include "missing_syscall.h"
+
++typedef unsigned long __cpu_mask;
++
+ /* This wraps the libc interface with a variable to keep the allocated size. */
+ typedef struct CPUSet {
+ cpu_set_t *set;
+diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
+index 4403c0aa52..e7e4ae112d 100644
+--- a/src/test/test-sizeof.c
++++ b/src/test/test-sizeof.c
+@@ -1,6 +1,5 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <sched.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
+@@ -10,6 +9,7 @@
+ #include <float.h>
+
+ #include "time-util.h"
++#include "cpu-set-util.h"
+
+ /* Print information about various types. Useful when diagnosing
+ * gcc diagnostics on an unfamiliar architecture. */
diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
new file mode 100644
index 0000000000..95df83c94b
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
@@ -0,0 +1,171 @@
+From 4835f3ca2e277abd93e2d4a74ecfd7401f32862b Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <alex.kiernan@gmail.com>
+Date: Tue, 10 Mar 2020 11:05:20 +0000
+Subject: [PATCH] Handle missing gshadow
+
+gshadow usage is now present in the userdb code. Mask all uses of it to
+allow compilation on musl
+
+Upstream-Status: Inappropriate [musl specific]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[Rebased for v247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/user-record-nss.h | 4 ++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
+index 88b8fc2f8f..a819d41bac 100644
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -331,8 +331,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -348,6 +350,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -363,6 +366,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ assert(ret_sgrp);
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -427,7 +435,9 @@ int nss_group_record_by_name(
+ struct group grp, *result;
+ bool incomplete = false;
+ size_t buflen = 4096;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ assert(name);
+@@ -457,6 +467,7 @@ int nss_group_record_by_name(
+ buf = mfree(buf);
+ }
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -468,6 +479,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -484,7 +498,9 @@ int nss_group_record_by_gid(
+ struct group grp, *result;
+ bool incomplete = false;
+ size_t buflen = 4096;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ assert(ret);
+@@ -512,6 +528,7 @@ int nss_group_record_by_gid(
+ buf = mfree(buf);
+ }
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -523,6 +540,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h
+index 22ab04d6ee..4e52e7a911 100644
+--- a/src/shared/user-record-nss.h
++++ b/src/shared/user-record-nss.h
+@@ -2,7 +2,11 @@
+ #pragma once
+
+ #include <grp.h>
++#if ENABLE_GSHADOW
+ #include <gshadow.h>
++#else
++struct sgrp;
++#endif
+ #include <pwd.h>
+ #include <shadow.h>
+
+diff --git a/src/shared/userdb.c b/src/shared/userdb.c
+index 91ac7c3832..20881ece84 100644
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1047,13 +1047,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
+-
++#endif
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1066,6 +1068,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
+ }
+
+ r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
++#else
++ r = nss_group_to_group_record(gr, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
diff --git a/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
new file mode 100644
index 0000000000..167f724add
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch
@@ -0,0 +1,34 @@
+From e90f18da3d2aef07ddd7d312ca8b34ff0324208e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 12 Apr 2021 23:44:53 -0700
+Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl
+
+musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64
+unlike glibc where these are provided by libc headers, therefore define
+them here in case they are undefined
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/basic/missing_syscall.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
+index 9e3a165857..4d59b3e7b0 100644
+--- a/src/basic/missing_syscall.h
++++ b/src/basic/missing_syscall.h
+@@ -20,6 +20,12 @@
+ #include <asm/sgidefs.h>
+ #endif
+
++#ifndef _MIPS_SIM_ABI32
++#define _MIPS_SIM_ABI32 1
++#define _MIPS_SIM_NABI32 2
++#define _MIPS_SIM_ABI64 3
++#endif
++
+ #include "missing_keyctl.h"
+ #include "missing_stat.h"
+ #include "missing_syscall_def.h"
diff --git a/meta/recipes-core/systemd/systemd/99-default.preset b/meta/recipes-core/systemd/systemd/99-default.preset
new file mode 100644
index 0000000000..1f29b50597
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/99-default.preset
@@ -0,0 +1 @@
+disable *
diff --git a/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf
new file mode 100644
index 0000000000..f4d0271cdb
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf
@@ -0,0 +1,11 @@
+<?xml version="1.0"?> <!--*-nxml-*-->
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+ <policy group="systemd-hostname">
+ <allow own="org.freedesktop.hostname1"/>
+ <allow send_destination="org.freedesktop.hostname1"/>
+ <allow receive_sender="org.freedesktop.hostname1"/>
+ </policy>
+</busconfig>
diff --git a/meta/recipes-core/systemd/systemd/qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch b/meta/recipes-core/systemd/systemd/qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch
deleted file mode 100644
index c7e171152a..0000000000
--- a/meta/recipes-core/systemd/systemd/qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Upstream-Status: Inappropriate [Specific case QEMU/AB]
-
-From 7b8c4e0a67a79a75e1bd77df3a452a5497322108 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linux.intel.com>
-Date: Thu, 27 Aug 2015 17:58:26 -0500
-Subject: [PATCH] core/device.c: Change the default device timeout to 240 sec.
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
----
- src/core/device.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/core/device.c b/src/core/device.c
-index e7efcf0..4ed8f08 100644
---- a/src/core/device.c
-+++ b/src/core/device.c
-@@ -110,7 +110,7 @@ static void device_init(Unit *u) {
- * indefinitely for plugged in devices, something which cannot
- * happen for the other units since their operations time out
- * anyway. */
-- u->job_timeout = u->manager->default_timeout_start_usec;
-+ u->job_timeout = (240 * USEC_PER_SEC);
-
- u->ignore_on_isolate = true;
- u->ignore_on_snapshot = true;
---
-1.9.1
-
diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest
deleted file mode 100644
index a2d61c2894..0000000000
--- a/meta/recipes-core/systemd/systemd/run-ptest
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-tar -C test -xJf test/sys.tar.xz
-make test/rules-test.sh.log
-make test/udev-test.pl.log
diff --git a/meta/recipes-core/systemd/systemd/systemd-pager.sh b/meta/recipes-core/systemd/systemd/systemd-pager.sh
new file mode 100644
index 0000000000..86e3e0ab78
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pager.sh
@@ -0,0 +1,7 @@
+# Systemd expect a color capable pager, however the less provided
+# by busybox is not. This make many interaction with systemd pretty
+# annoying. As a workaround we disable the systemd pager if less
+# is not the GNU version.
+if ! less -V > /dev/null 2>&1 ; then
+ export SYSTEMD_PAGER=
+fi
diff --git a/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch b/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch
deleted file mode 100644
index a40b1b9d3f..0000000000
--- a/meta/recipes-core/systemd/systemd/tmpfiles-pam.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Upstream-Status: Submitted
-Signed-off-by: Ross Burton <ross.burton@intel.com>
-
-From 0802aaaa9784813d318d045c79533a044eedf542 Mon Sep 17 00:00:00 2001
-From: Ross Burton <ross.burton@intel.com>
-Date: Tue, 3 Mar 2015 11:32:29 +0000
-Subject: [PATCH] tmpfiles.d: only copy /etc/pam.d if PAM is present
-
-If HAVE_PAM isn't set then don't attempt to copy /etc/pam.d from the factory, as
-it doesn't get installed.
-
-Signed-off-by: Ross Burton <ross.burton@intel.com>
----
- tmpfiles.d/etc.conf.m4 | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/tmpfiles.d/etc.conf.m4 b/tmpfiles.d/etc.conf.m4
-index 9b0e080..ab5cd16 100644
---- a/tmpfiles.d/etc.conf.m4
-+++ b/tmpfiles.d/etc.conf.m4
-@@ -14,4 +14,6 @@ m4_ifdef(`ENABLE_RESOLVED',
- L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
- )m4_dnl
- C /etc/nsswitch.conf - - - -
-+m4_ifdef(`HAVE_PAM',
- C /etc/pam.d - - - -
-+)m4_dnl
---
-1.7.10.4
-
diff --git a/meta/recipes-core/systemd/systemd_219.bb b/meta/recipes-core/systemd/systemd_219.bb
deleted file mode 100644
index a64dbac360..0000000000
--- a/meta/recipes-core/systemd/systemd_219.bb
+++ /dev/null
@@ -1,420 +0,0 @@
-SUMMARY = "A System and service manager"
-HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
-
-DESCRIPTION = "systemd is a system and service manager for Linux, compatible with \
-SysV and LSB init scripts. systemd provides aggressive parallelization \
-capabilities, uses socket and D-Bus activation for starting services, \
-offers on-demand starting of daemons, keeps track of processes using \
-Linux cgroups, supports snapshotting and restoring of the system \
-state, maintains mount and automount points and implements an \
-elaborate transactional dependency-based service control logic. It can \
-work as a drop-in replacement for sysvinit."
-
-LICENSE = "GPLv2 & LGPLv2.1 & MIT"
-LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
- file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \
- file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed"
-
-PROVIDES = "udev"
-
-PE = "1"
-
-DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
-
-SECTION = "base/shell"
-
-inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext
-
-SRCREV = "85a6fabdd3e43cfab0fc6359e9f2a9e368d4a3ed"
-
-PV = "219-stable+git${SRCPV}"
-
-SRC_URI = "git://github.com/systemd/systemd-stable;branch=v219-stable;protocol=git \
- file://0002-shared-missing.h-fall-back-to-insecure-getenv.patch \
- file://0003-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
- file://0004-configure-Check-for-additional-features-that-uclibc-.patch \
- file://0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch \
- file://0006-journal-Use-posix-fallocate-only-if-available.patch \
- file://0007-util-Use-mkostemp-only-if-libc-supports-it.patch \
- file://0008-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch \
- file://0009-sysv-generator-add-support-for-executing-scripts-und.patch \
- file://0010-Make-root-s-home-directory-configurable.patch \
- file://0011-systemd-user-avoid-using-system-auth.patch \
- file://0012-systemd-tmpfiles.c-Honor-ordering-within-files-as-th.patch \
- file://0014-Revert-rules-remove-firmware-loading-rules.patch \
- file://0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch \
- file://tmpfiles-pam.patch \
- file://0001-Revert-core-mount-add-dependencies-to-dynamically-mo.patch \
- file://touchscreen.rules \
- file://00-create-volatile.conf \
- file://init \
- file://run-ptest \
- "
-SRC_URI_append_qemuall = "file://qemuall_io_latency-core-device.c-Change-the-default-device-timeout-to-2.patch"
-
-S = "${WORKDIR}/git"
-
-SRC_URI_append_libc-uclibc = "\
- file://0001-units-Prefer-getty-to-agetty-in-console-setup-system.patch \
- "
-LDFLAGS_append_libc-uclibc = " -lrt"
-
-GTKDOC_DOCDIR = "${S}/docs/"
-
-PACKAGECONFIG ??= "xz ldconfig \
- ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
- "
-
-PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl"
-# Sign the journal for anti-tampering
-PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
-# regardless of PACKAGECONFIG, libgcrypt is always required to expand
-# the AM_PATH_LIBGCRYPT autoconf macro
-DEPENDS += "libgcrypt"
-# Compress the journal
-PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
-PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup"
-PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd"
-PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils"
-PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
-PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
-PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn"
-PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit"
-PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
-PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam"
-# Verify keymaps on locale change
-PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
-# Update NAT firewall rules
-PACKAGECONFIG[iptc] = "--enable-libiptc,--disable-libiptc,iptables"
-PACKAGECONFIG[ldconfig] = "--enable-ldconfig,--disable-ldconfig,,"
-PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux"
-PACKAGECONFIG[valgrind] = "ac_cv_header_valgrind_memcheck_h=yes ac_cv_header_valgrind_valgrind_h=yes ,ac_cv_header_valgrind_memcheck_h=no ac_cv_header_valgrind_valgrind_h=no ,valgrind"
-
-CACHED_CONFIGUREVARS += "ac_cv_path_KILL=${base_bindir}/kill"
-CACHED_CONFIGUREVARS += "ac_cv_path_KMOD=${base_bindir}/kmod"
-CACHED_CONFIGUREVARS += "ac_cv_path_QUOTACHECK=${sbindir}/quotacheck"
-CACHED_CONFIGUREVARS += "ac_cv_path_QUOTAON=${sbindir}/quotaon"
-CACHED_CONFIGUREVARS += "ac_cv_path_SULOGIN=${base_sbindir}/sulogin"
-
-# Helper variables to clarify locations. This mirrors the logic in systemd's
-# build system.
-rootprefix ?= "${base_prefix}"
-rootlibdir ?= "${base_libdir}"
-rootlibexecdir = "${rootprefix}/lib"
-
-CACHED_CONFIGUREVARS_class-target = "\
- ac_cv_path_MOUNT_PATH=${base_bindir}/mount \
- ac_cv_path_UMOUNT_PATH=${base_bindir}/umount \
- ac_cv_path_KMOD=${base_bindir}/kmod \
- ac_cv_path_KILL=${base_bindir}/kill \
- ac_cv_path_SULOGIN=${base_sbindir}/sulogin \
- ac_cv_path_KEXEC=${sbindir}/kexec \
- ac_cv_path_QUOTACHECK=${sbindir}/quotacheck \
- ac_cv_path_QUOTAON=${sbindir}/quotaon \
- "
-
-EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
- --with-rootlibdir=${rootlibdir} \
- --with-roothomedir=${ROOT_HOME} \
- --disable-coredump \
- --disable-introspection \
- --disable-kdbus \
- --enable-split-usr \
- --without-python \
- --with-sysvrcnd-path=${sysconfdir} \
- --with-firmware-path=/lib/firmware \
- "
-# uclibc does not have NSS
-EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
-
-do_configure_prepend() {
- export NM="${HOST_PREFIX}gcc-nm"
- export AR="${HOST_PREFIX}gcc-ar"
- export RANLIB="${HOST_PREFIX}gcc-ranlib"
- export KMOD="${base_bindir}/kmod"
- if [ -d ${S}/units.pre_sed ] ; then
- cp -r ${S}/units.pre_sed ${S}/units
- else
- cp -r ${S}/units ${S}/units.pre_sed
- fi
- sed -i '/ln --relative --help/d' ${S}/configure.ac
- sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
- sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
-}
-
-do_install() {
- autotools_do_install
- install -d ${D}/${base_sbindir}
- # Provided by a separate recipe
- rm ${D}${systemd_unitdir}/system/serial-getty* -f
-
- # Provide support for initramfs
- [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
- [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
-
- # Create machine-id
- # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
- touch ${D}${sysconfdir}/machine-id
-
-
- install -d ${D}${sysconfdir}/udev/rules.d/
- install -d ${D}${sysconfdir}/tmpfiles.d
- install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
-
- install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
-
- if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
- sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
- fi
-
- chown root:systemd-journal ${D}/${localstatedir}/log/journal
-
- # Delete journal README, as log can be symlinked inside volatile.
- rm -f ${D}/${localstatedir}/log/README
-
- # Create symlinks for systemd-update-utmp-runlevel.service
- install -d ${D}${systemd_unitdir}/system/graphical.target.wants
- install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
- install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
- install -d ${D}${systemd_unitdir}/system/reboot.target.wants
- install -d ${D}${systemd_unitdir}/system/rescue.target.wants
- ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
- ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
- ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
- ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
- ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
-
- # Enable journal to forward message to syslog daemon
- sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
- # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
- # for existence else it fails
- if [ -s ${D}${libdir}/tmpfiles.d/systemd.conf ]; then
- ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
- fi
-}
-
-do_install_ptest () {
- install -d ${D}${PTEST_PATH}/test
- cp -rf ${S}/test/* ${D}${PTEST_PATH}/test
- install -m 0755 ${B}/test-udev ${D}${PTEST_PATH}/
- install -d ${D}${PTEST_PATH}/build-aux
- cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
- cp -rf ${B}/rules ${D}${PTEST_PATH}/
- # This directory needs to be there for udev-test.pl to work.
- install -d ${D}${libdir}/udev/rules.d
- cp ${B}/Makefile ${D}${PTEST_PATH}/
- cp ${S}/test/sys.tar.xz ${D}${PTEST_PATH}/test
- sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/test/udev-test.pl
- sed -i 's#${S}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
- sed -i 's#${B}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
-}
-
-python populate_packages_prepend (){
- systemdlibdir = d.getVar("rootlibdir", True)
- do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
-}
-PACKAGES_DYNAMIC += "^lib(udev|systemd).*"
-
-PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \
- ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh libgudev"
-
-SYSTEMD_PACKAGES = "${PN}-binfmt"
-SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
-
-USERADD_PACKAGES = "${PN}"
-USERADD_PARAM_${PN} += "--system systemd-journal-gateway; --system systemd-timesync"
-GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
-
-FILES_${PN}-analyze = "${bindir}/systemd-analyze"
-
-FILES_${PN}-initramfs = "/init"
-RDEPENDS_${PN}-initramfs = "${PN}"
-
-FILES_libgudev = "${libdir}/libgudev*${SOLIBS}"
-
-RDEPENDS_${PN}-ptest += "perl python bash"
-FILES_${PN}-ptest += "${libdir}/udev/rules.d"
-
-FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug"
-
-FILES_${PN}-gui = "${bindir}/systemadm"
-
-FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
- ${systemd_unitdir}/system/systemd-vconsole-setup.service \
- ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
-
-RDEPENDS_${PN}-kernel-install += "bash"
-FILES_${PN}-kernel-install = "${bindir}/kernel-install \
- ${sysconfdir}/kernel/ \
- ${exec_prefix}/lib/kernel \
- "
-FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
- "
-
-FILES_${PN}-zsh = "${datadir}/zsh/site-functions"
-
-FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
- ${exec_prefix}/lib/binfmt.d \
- ${rootlibexecdir}/systemd/systemd-binfmt \
- ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
- ${systemd_unitdir}/system/systemd-binfmt.service"
-RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
-
-RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
-
-CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \
- ${sysconfdir}/systemd/logind.conf \
- ${sysconfdir}/systemd/system.conf \
- ${sysconfdir}/systemd/user.conf"
-
-FILES_${PN} = " ${base_bindir}/* \
- ${datadir}/bash-completion \
- ${datadir}/dbus-1/services \
- ${datadir}/dbus-1/system-services \
- ${datadir}/polkit-1 \
- ${datadir}/${BPN} \
- ${datadir}/factory \
- ${sysconfdir}/bash_completion.d/ \
- ${sysconfdir}/dbus-1/ \
- ${sysconfdir}/machine-id \
- ${sysconfdir}/modules-load.d/ \
- ${sysconfdir}/pam.d/ \
- ${sysconfdir}/sysctl.d/ \
- ${sysconfdir}/systemd/ \
- ${sysconfdir}/tmpfiles.d/ \
- ${sysconfdir}/xdg/ \
- ${sysconfdir}/init.d/README \
- ${rootlibexecdir}/systemd/* \
- ${systemd_unitdir}/* \
- ${base_libdir}/security/*.so \
- ${libdir}/libnss_* \
- /cgroup \
- ${bindir}/systemd* \
- ${bindir}/busctl \
- ${bindir}/localectl \
- ${bindir}/hostnamectl \
- ${bindir}/timedatectl \
- ${bindir}/bootctl \
- ${bindir}/kernel-install \
- ${exec_prefix}/lib/tmpfiles.d/*.conf \
- ${exec_prefix}/lib/systemd \
- ${exec_prefix}/lib/modules-load.d \
- ${exec_prefix}/lib/sysctl.d \
- ${exec_prefix}/lib/sysusers.d \
- ${localstatedir} \
- ${nonarch_base_libdir}/udev/rules.d/70-uaccess.rules \
- ${nonarch_base_libdir}/udev/rules.d/71-seat.rules \
- ${nonarch_base_libdir}/udev/rules.d/73-seat-late.rules \
- ${nonarch_base_libdir}/udev/rules.d/99-systemd.rules \
- "
-
-FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
-FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
-
-RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
-RDEPENDS_${PN} += "volatile-binds"
-
-RRECOMMENDS_${PN} += "systemd-serialgetty systemd-vconsole-setup \
- systemd-compat-units udev-hwdb \
- util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \
- kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
- os-release \
-"
-
-PACKAGES =+ "udev-dbg udev udev-hwdb"
-
-FILES_udev-dbg += "${nonarch_base_libdir}/udev/.debug"
-
-RPROVIDES_udev = "hotplug"
-
-RDEPENDS_udev-hwdb += "udev"
-
-FILES_udev += "${base_sbindir}/udevd \
- ${rootlibexecdir}/systemd/systemd-udevd \
- ${rootlibexecdir}/udev/accelerometer \
- ${rootlibexecdir}/udev/ata_id \
- ${rootlibexecdir}/udev/cdrom_id \
- ${rootlibexecdir}/udev/collect \
- ${rootlibexecdir}/udev/findkeyboards \
- ${rootlibexecdir}/udev/keyboard-force-release.sh \
- ${rootlibexecdir}/udev/keymap \
- ${rootlibexecdir}/udev/mtd_probe \
- ${rootlibexecdir}/udev/scsi_id \
- ${rootlibexecdir}/udev/v4l_id \
- ${rootlibexecdir}/udev/keymaps \
- ${rootlibexecdir}/udev/rules.d/*.rules \
- ${sysconfdir}/udev \
- ${sysconfdir}/init.d/systemd-udevd \
- ${systemd_unitdir}/system/*udev* \
- ${systemd_unitdir}/system/*.wants/*udev* \
- ${base_bindir}/udevadm \
- ${datadir}/bash-completion/completions/udevadm \
- "
-
-FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
-
-INITSCRIPT_PACKAGES = "udev"
-INITSCRIPT_NAME_udev = "systemd-udevd"
-INITSCRIPT_PARAMS_udev = "start 03 S ."
-
-python __anonymous() {
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
-# TODO:
-# u-a for runlevel and telinit
-
-ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel"
-
-ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd"
-ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
-ALTERNATIVE_PRIORITY[init] ?= "300"
-
-ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
-ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
-ALTERNATIVE_PRIORITY[halt] ?= "300"
-
-ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
-ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
-ALTERNATIVE_PRIORITY[reboot] ?= "300"
-
-ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
-ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
-ALTERNATIVE_PRIORITY[shutdown] ?= "300"
-
-ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
-ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
-ALTERNATIVE_PRIORITY[poweroff] ?= "300"
-
-ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
-ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
-ALTERNATIVE_PRIORITY[runlevel] ?= "300"
-
-pkg_postinst_udev-hwdb () {
- if test -n "$D"; then
- ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
- --root $D
- else
- udevadm hwdb --update
- fi
-}
-
-pkg_prerm_udev-hwdb () {
- if test -n "$D"; then
- exit 1
- fi
-
- rm -f ${sysconfdir}/udev/hwdb.bin
-}
-
-# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
-# that we don't build both udev and systemd in world builds.
-python () {
- if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
- raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
-}
diff --git a/meta/recipes-core/systemd/systemd_249.5.bb b/meta/recipes-core/systemd/systemd_249.5.bb
new file mode 100644
index 0000000000..c0c1f9bcfc
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd_249.5.bb
@@ -0,0 +1,792 @@
+require systemd.inc
+
+PROVIDES = "udev"
+
+PE = "1"
+
+DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native"
+
+SECTION = "base/shell"
+
+inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check
+
+# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
+# that we don't build both udev and systemd in world builds.
+REQUIRED_DISTRO_FEATURES = "systemd"
+
+SRC_URI += "file://touchscreen.rules \
+ file://00-create-volatile.conf \
+ ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
+ file://init \
+ file://99-default.preset \
+ file://systemd-pager.sh \
+ file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
+ file://0003-implment-systemd-sysv-install-for-OE.patch \
+ file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
+ file://0001-test-parse-argument-Include-signal.h.patch \
+ file://0001-meson-use-partial_dependency-to-get-include-director.patch \
+ "
+
+# patches needed by musl
+SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
+SRC_URI_MUSL = "\
+ file://0002-don-t-use-glibc-specific-qsort_r.patch \
+ file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \
+ file://0004-add-fallback-parse_printf_format-implementation.patch \
+ file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
+ file://0006-Include-netinet-if_ether.h.patch \
+ file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
+ file://0008-add-missing-FTW_-macros-for-musl.patch \
+ file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
+ file://0010-Use-uintmax_t-for-handling-rlim_t.patch \
+ file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
+ file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
+ file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
+ file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
+ file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
+ file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
+ file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \
+ file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \
+ file://0019-Handle-missing-LOCK_EX.patch \
+ file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \
+ file://0021-test-json.c-define-M_PIl.patch \
+ file://0022-do-not-disable-buffer-in-writing-files.patch \
+ file://0025-Handle-__cpu_mask-usage.patch \
+ file://0026-Handle-missing-gshadow.patch \
+ file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
+ "
+
+PAM_PLUGINS = " \
+ pam-plugin-unix \
+ pam-plugin-loginuid \
+ pam-plugin-keyinit \
+"
+
+PACKAGECONFIG ??= " \
+ ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
+ backlight \
+ binfmt \
+ gshadow \
+ hibernate \
+ hostnamed \
+ idn \
+ ima \
+ kmod \
+ localed \
+ logind \
+ machined \
+ myhostname \
+ networkd \
+ nss \
+ nss-mymachines \
+ nss-resolve \
+ quotacheck \
+ randomseed \
+ resolved \
+ set-time-epoch \
+ sysusers \
+ sysvinit \
+ timedated \
+ timesyncd \
+ userdb \
+ utmp \
+ vconsole \
+ wheel-group \
+ zstd \
+"
+
+PACKAGECONFIG:remove:libc-musl = " \
+ gshadow \
+ idn \
+ localed \
+ myhostname \
+ nss \
+ nss-mymachines \
+ nss-resolve \
+ sysusers \
+ userdb \
+ utmp \
+"
+
+# https://github.com/seccomp/libseccomp/issues/347
+PACKAGECONFIG:remove:mipsarch = "seccomp"
+
+CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
+
+# Some of the dependencies are weak-style recommends - if not available at runtime,
+# systemd won't fail but the library-related feature will be skipped with a warning.
+
+# Use the upstream systemd serial-getty@.service and rely on
+# systemd-getty-generator instead of using the OE-core specific
+# systemd-serialgetty.bb - not enabled by default.
+PACKAGECONFIG[serial-getty-generator] = ""
+
+PACKAGECONFIG[acl] = "-Dacl=true,-Dacl=false,acl"
+PACKAGECONFIG[audit] = "-Daudit=true,-Daudit=false,audit"
+PACKAGECONFIG[backlight] = "-Dbacklight=true,-Dbacklight=false"
+PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false"
+PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2"
+PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid"
+PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
+PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup"
+PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device"
+PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
+PACKAGECONFIG[efi] = "-Defi=true,-Defi=false"
+PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi"
+PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
+PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
+PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false"
+PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false"
+# Sign the journal for anti-tampering
+PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt"
+PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls"
+PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
+PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false"
+PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
+PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
+PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
+# importd requires journal-upload/xz/zlib/bzip2/gcrypt
+PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false"
+# Update NAT firewall rules
+PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
+PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl"
+PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod"
+PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
+PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn"
+PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2"
+PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
+PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
+PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
+PACKAGECONFIG[machined] = "-Dmachined=true,-Dmachined=false"
+PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native"
+PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
+PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
+PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
+PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false"
+PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
+PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
+PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false"
+PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
+PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
+PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
+PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
+# If polkit is disabled and networkd+hostnamed are in use, enabling this option and
+# using dbus-broker will allow networkd to be authorized to change the
+# hostname without acquiring additional privileges
+PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
+PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
+PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode"
+PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
+PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
+PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
+PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
+PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
+PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
+PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
+PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
+PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
+# When enabled use reproducble build timestamp if set as time epoch,
+# or build time if not. When disabled, time epoch is unset.
+def build_epoch(d):
+ epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
+ return '-Dtime-epoch=%d' % int(epoch)
+PACKAGECONFIG[set-time-epoch] = "${@build_epoch(d)},-Dtime-epoch=0"
+PACKAGECONFIG[timedated] = "-Dtimedated=true,-Dtimedated=false"
+PACKAGECONFIG[timesyncd] = "-Dtimesyncd=true,-Dtimesyncd=false"
+PACKAGECONFIG[usrmerge] = "-Dsplit-usr=false,-Dsplit-usr=true"
+PACKAGECONFIG[sbinmerge] = "-Dsplit-bin=false,-Dsplit-bin=true"
+PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
+PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
+PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
+PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
+PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false"
+PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
+# Verify keymaps on locale change
+PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
+PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
+PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
+PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd"
+
+# Helper variables to clarify locations. This mirrors the logic in systemd's
+# build system.
+rootprefix ?= "${root_prefix}"
+rootlibdir ?= "${base_libdir}"
+rootlibexecdir = "${rootprefix}/lib"
+
+# This links udev statically with systemd helper library.
+# Otherwise udev package would depend on systemd package (which has the needed shared library),
+# and always pull it into images.
+EXTRA_OEMESON += "-Dlink-udev-shared=false"
+
+EXTRA_OEMESON += "-Dnobody-user=nobody \
+ -Dnobody-group=nobody \
+ -Drootlibdir=${rootlibdir} \
+ -Drootprefix=${rootprefix} \
+ -Ddefault-locale=C \
+ -Dmode=release \
+ -Dsystem-alloc-uid-min=101 \
+ -Dsystem-uid-max=999 \
+ -Dsystem-alloc-gid-min=101 \
+ -Dsystem-gid-max=999 \
+ "
+
+# Hardcode target binary paths to avoid using paths from sysroot
+EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
+ -Dkmod-path=${base_bindir}/kmod \
+ -Dmount-path=${base_bindir}/mount \
+ -Dquotacheck-path=${sbindir}/quotacheck \
+ -Dquotaon-path=${sbindir}/quotaon \
+ -Dsulogin-path=${base_sbindir}/sulogin \
+ -Dnologin-path=${base_sbindir}/nologin \
+ -Dumount-path=${base_bindir}/umount"
+
+do_install() {
+ meson_do_install
+ install -d ${D}/${base_sbindir}
+ if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
+ # Provided by a separate recipe
+ rm ${D}${systemd_system_unitdir}/serial-getty* -f
+ fi
+
+ # Provide support for initramfs
+ [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
+ [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
+
+ install -d ${D}${sysconfdir}/udev/rules.d/
+ install -d ${D}${sysconfdir}/tmpfiles.d
+ for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
+ install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
+ done
+
+ install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
+
+ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
+ sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
+ install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_system_unitdir}d-sysv-install
+ fi
+
+ if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then
+ # /var/log is typically a symbolic link to inside /var/volatile,
+ # which is expected to be empty.
+ rm -rf ${D}${localstatedir}/log
+ else
+ chown root:systemd-journal ${D}${localstatedir}/log/journal
+
+ # journal-remote creates this at start
+ rm -rf ${D}${localstatedir}/log/journal/remote
+ fi
+
+ install -d ${D}${systemd_system_unitdir}/graphical.target.wants
+ install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
+ install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
+ install -d ${D}${systemd_system_unitdir}/reboot.target.wants
+ install -d ${D}${systemd_system_unitdir}/rescue.target.wants
+
+ # Create symlinks for systemd-update-utmp-runlevel.service
+ if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service
+ ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service
+ fi
+
+ # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
+ # for existence else it fails
+ if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then
+ ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)}
+ fi
+ if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
+ echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
+ echo 'd /run/systemd/resolve 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
+ echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
+ ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
+ else
+ sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
+ ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
+ fi
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
+ rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
+ rm -r ${D}${sysconfdir}/X11
+ fi
+
+ # If polkit is setup fixup permissions and ownership
+ if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
+ if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
+ chmod 700 ${D}${datadir}/polkit-1/rules.d
+ chown polkitd:root ${D}${datadir}/polkit-1/rules.d
+ fi
+ fi
+
+ # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
+ # request hostname changes via DBUS without elevating its privileges
+ if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
+ install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
+ install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
+ install -d ${D}${datadir}/dbus-1/system.d/
+ install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
+ fi
+
+ # create link for existing udev rules
+ ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
+
+ # duplicate udevadm for postinst script
+ install -d ${D}${libexecdir}
+ ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
+
+ # install default policy for presets
+ # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
+ install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_system_unitdir}-preset/99-default.preset
+
+ # add a profile fragment to disable systemd pager with busybox less
+ install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
+}
+
+python populate_packages:prepend (){
+ systemdlibdir = d.getVar("rootlibdir")
+ do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
+}
+PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
+
+PACKAGE_BEFORE_PN = "\
+ ${PN}-gui \
+ ${PN}-vconsole-setup \
+ ${PN}-initramfs \
+ ${PN}-analyze \
+ ${PN}-kernel-install \
+ ${PN}-rpm-macros \
+ ${PN}-binfmt \
+ ${PN}-zsh-completion \
+ ${PN}-container \
+ ${PN}-journal-gatewayd \
+ ${PN}-journal-upload \
+ ${PN}-journal-remote \
+ ${PN}-extra-utils \
+ ${PN}-udev-rules \
+ udev \
+ udev-hwdb \
+"
+
+SUMMARY:${PN}-container = "Tools for containers and VMs"
+DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
+
+SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events"
+DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default."
+
+SUMMARY:${PN}-journal-upload = "Send journal messages over the network"
+DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
+
+SUMMARY:${PN}-journal-remote = "Receive journal messages over the network"
+DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
+
+SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
+"
+SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service"
+
+USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
+ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
+ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
+"
+GROUPADD_PARAM:${PN} = "-r systemd-journal;"
+GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
+USERADD_PARAM:${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy"
+USERADD_PARAM:${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
+USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
+USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
+
+FILES:${PN}-analyze = "${bindir}/systemd-analyze"
+
+FILES:${PN}-initramfs = "/init"
+RDEPENDS:${PN}-initramfs = "${PN}"
+
+FILES:${PN}-gui = "${bindir}/systemadm"
+
+FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
+ ${systemd_system_unitdir}/systemd-vconsole-setup.service \
+ ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service"
+
+RDEPENDS:${PN}-kernel-install += "bash"
+FILES:${PN}-kernel-install = "${bindir}/kernel-install \
+ ${sysconfdir}/kernel/ \
+ ${exec_prefix}/lib/kernel \
+ "
+FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
+ "
+
+FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions"
+
+FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
+ ${exec_prefix}/lib/binfmt.d \
+ ${rootlibexecdir}/systemd/systemd-binfmt \
+ ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \
+ ${systemd_system_unitdir}/systemd-binfmt.service"
+RRECOMMENDS:${PN}-binfmt = "kernel-module-binfmt-misc"
+
+RRECOMMENDS:${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
+
+
+FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
+ ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
+ ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
+ ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
+ ${datadir}/systemd/gatewayd/browse.html \
+ "
+SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
+
+FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
+ ${systemd_system_unitdir}/systemd-journal-upload.service \
+ ${sysconfdir}/systemd/journal-upload.conf \
+ "
+SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service"
+
+FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
+ ${sysconfdir}/systemd/journal-remote.conf \
+ ${systemd_system_unitdir}/systemd-journal-remote.service \
+ ${systemd_system_unitdir}/systemd-journal-remote.socket \
+ "
+SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket"
+
+
+FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
+ ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
+ ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
+ ${base_bindir}/machinectl \
+ ${bindir}/systemd-nspawn \
+ ${nonarch_libdir}/systemd/import-pubring.gpg \
+ ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.import1.busname \
+ ${systemd_system_unitdir}/busnames.target.wants/org.freedesktop.machine1.busname \
+ ${systemd_system_unitdir}/local-fs.target.wants/var-lib-machines.mount \
+ ${systemd_system_unitdir}/machines.target.wants/var-lib-machines.mount \
+ ${systemd_system_unitdir}/remote-fs.target.wants/var-lib-machines.mount \
+ ${systemd_system_unitdir}/machine.slice \
+ ${systemd_system_unitdir}/machines.target \
+ ${systemd_system_unitdir}/org.freedesktop.import1.busname \
+ ${systemd_system_unitdir}/org.freedesktop.machine1.busname \
+ ${systemd_system_unitdir}/systemd-importd.service \
+ ${systemd_system_unitdir}/systemd-machined.service \
+ ${systemd_system_unitdir}/dbus-org.freedesktop.machine1.service \
+ ${systemd_system_unitdir}/var-lib-machines.mount \
+ ${rootlibexecdir}/systemd/systemd-import \
+ ${rootlibexecdir}/systemd/systemd-importd \
+ ${rootlibexecdir}/systemd/systemd-machined \
+ ${rootlibexecdir}/systemd/systemd-pull \
+ ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
+ ${exec_prefix}/lib/tmpfiles.d/README \
+ ${systemd_system_unitdir}/systemd-nspawn@.service \
+ ${libdir}/libnss_mymachines.so.2 \
+ ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
+ ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
+ ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.machine1.conf \
+ ${datadir}/polkit-1/actions/org.freedesktop.import1.policy \
+ ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
+ "
+
+# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox.
+RRECOMMENDS:${PN}-container += "\
+ ${PN}-journal-gatewayd \
+ ${PN}-journal-remote \
+ ${PN}-journal-upload \
+ kernel-module-dm-mod \
+ kernel-module-loop \
+ kernel-module-tun \
+ tar \
+ "
+
+FILES:${PN}-extra-utils = "\
+ ${base_bindir}/systemd-escape \
+ ${base_bindir}/systemd-inhibit \
+ ${bindir}/systemd-detect-virt \
+ ${bindir}/systemd-dissect \
+ ${bindir}/systemd-path \
+ ${bindir}/systemd-run \
+ ${bindir}/systemd-cat \
+ ${bindir}/systemd-delta \
+ ${bindir}/systemd-cgls \
+ ${bindir}/systemd-cgtop \
+ ${bindir}/systemd-stdio-bridge \
+ ${bindir}/systemd-sysext \
+ ${base_bindir}/systemd-ask-password \
+ ${base_bindir}/systemd-tty-ask-password-agent \
+ ${systemd_system_unitdir}/systemd-ask-password-console.path \
+ ${systemd_system_unitdir}/systemd-ask-password-console.service \
+ ${systemd_system_unitdir}/systemd-ask-password-wall.path \
+ ${systemd_system_unitdir}/systemd-ask-password-wall.service \
+ ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \
+ ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \
+ ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \
+ ${rootlibexecdir}/systemd/systemd-resolve-host \
+ ${rootlibexecdir}/systemd/systemd-ac-power \
+ ${rootlibexecdir}/systemd/systemd-activate \
+ ${rootlibexecdir}/systemd/systemd-bus-proxyd \
+ ${systemd_system_unitdir}/systemd-bus-proxyd.service \
+ ${systemd_system_unitdir}/systemd-bus-proxyd.socket \
+ ${rootlibexecdir}/systemd/systemd-socket-proxyd \
+ ${rootlibexecdir}/systemd/systemd-reply-password \
+ ${rootlibexecdir}/systemd/systemd-sleep \
+ ${rootlibexecdir}/systemd/system-sleep \
+ ${systemd_system_unitdir}/systemd-hibernate.service \
+ ${systemd_system_unitdir}/systemd-hybrid-sleep.service \
+ ${systemd_system_unitdir}/systemd-suspend.service \
+ ${systemd_system_unitdir}/sleep.target \
+ ${rootlibexecdir}/systemd/systemd-initctl \
+ ${systemd_system_unitdir}/systemd-initctl.service \
+ ${systemd_system_unitdir}/systemd-initctl.socket \
+ ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \
+ ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
+ ${rootlibexecdir}/systemd/systemd-cgroups-agent \
+"
+
+FILES:${PN}-udev-rules = "\
+ ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
+ ${rootlibexecdir}/udev/rules.d/71-seat.rules \
+ ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
+ ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
+"
+
+CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \
+ ${sysconfdir}/systemd/journald.conf \
+ ${sysconfdir}/systemd/logind.conf \
+ ${sysconfdir}/systemd/networkd.conf \
+ ${sysconfdir}/systemd/pstore.conf \
+ ${sysconfdir}/systemd/resolved.conf \
+ ${sysconfdir}/systemd/sleep.conf \
+ ${sysconfdir}/systemd/system.conf \
+ ${sysconfdir}/systemd/timesyncd.conf \
+ ${sysconfdir}/systemd/user.conf \
+"
+
+FILES:${PN} = " ${base_bindir}/* \
+ ${base_sbindir}/shutdown \
+ ${base_sbindir}/halt \
+ ${base_sbindir}/poweroff \
+ ${base_sbindir}/runlevel \
+ ${base_sbindir}/telinit \
+ ${base_sbindir}/resolvconf \
+ ${base_sbindir}/reboot \
+ ${base_sbindir}/init \
+ ${datadir}/dbus-1/services \
+ ${datadir}/dbus-1/system-services \
+ ${datadir}/polkit-1 \
+ ${datadir}/${BPN} \
+ ${datadir}/factory \
+ ${sysconfdir}/dbus-1/ \
+ ${sysconfdir}/modules-load.d/ \
+ ${sysconfdir}/pam.d/ \
+ ${sysconfdir}/profile.d/ \
+ ${sysconfdir}/sysctl.d/ \
+ ${sysconfdir}/systemd/ \
+ ${sysconfdir}/tmpfiles.d/ \
+ ${sysconfdir}/xdg/ \
+ ${sysconfdir}/init.d/README \
+ ${sysconfdir}/resolv-conf.systemd \
+ ${sysconfdir}/X11/xinit/xinitrc.d/* \
+ ${rootlibexecdir}/systemd/* \
+ ${libdir}/pam.d \
+ ${nonarch_libdir}/pam.d \
+ ${systemd_unitdir}/* \
+ ${base_libdir}/security/*.so \
+ /cgroup \
+ ${bindir}/systemd* \
+ ${bindir}/busctl \
+ ${bindir}/coredumpctl \
+ ${bindir}/localectl \
+ ${bindir}/hostnamectl \
+ ${bindir}/resolvectl \
+ ${bindir}/timedatectl \
+ ${bindir}/bootctl \
+ ${bindir}/oomctl \
+ ${exec_prefix}/lib/tmpfiles.d/*.conf \
+ ${exec_prefix}/lib/systemd \
+ ${exec_prefix}/lib/modules-load.d \
+ ${exec_prefix}/lib/sysctl.d \
+ ${exec_prefix}/lib/sysusers.d \
+ ${exec_prefix}/lib/environment.d \
+ ${localstatedir} \
+ ${rootlibexecdir}/modprobe.d/systemd.conf \
+ ${rootlibexecdir}/modprobe.d/README \
+ ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \
+ ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \
+ ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
+ ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \
+ "
+
+FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
+
+RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck"
+RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
+RDEPENDS:${PN} += "volatile-binds"
+
+RRECOMMENDS:${PN} += "systemd-extra-utils \
+ udev-hwdb \
+ e2fsprogs-e2fsck \
+ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
+ os-release \
+ systemd-conf \
+"
+
+INSANE_SKIP:${PN} += "dev-so libdir"
+INSANE_SKIP:${PN}-dbg += "libdir"
+INSANE_SKIP:${PN}-doc += " libdir"
+
+RPROVIDES:udev = "hotplug"
+
+RDEPENDS:udev-hwdb += "udev"
+
+FILES:udev += "${base_sbindir}/udevd \
+ ${rootlibexecdir}/systemd/network/99-default.link \
+ ${rootlibexecdir}/systemd/systemd-udevd \
+ ${rootlibexecdir}/udev/accelerometer \
+ ${rootlibexecdir}/udev/ata_id \
+ ${rootlibexecdir}/udev/cdrom_id \
+ ${rootlibexecdir}/udev/collect \
+ ${rootlibexecdir}/udev/dmi_memory_id \
+ ${rootlibexecdir}/udev/fido_id \
+ ${rootlibexecdir}/udev/findkeyboards \
+ ${rootlibexecdir}/udev/keyboard-force-release.sh \
+ ${rootlibexecdir}/udev/keymap \
+ ${rootlibexecdir}/udev/mtd_probe \
+ ${rootlibexecdir}/udev/scsi_id \
+ ${rootlibexecdir}/udev/v4l_id \
+ ${rootlibexecdir}/udev/keymaps \
+ ${rootlibexecdir}/udev/rules.d/50-udev-default.rules \
+ ${rootlibexecdir}/udev/rules.d/60-autosuspend.rules \
+ ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
+ ${rootlibexecdir}/udev/rules.d/60-block.rules \
+ ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
+ ${rootlibexecdir}/udev/rules.d/60-drm.rules \
+ ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
+ ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
+ ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
+ ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
+ ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
+ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
+ ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
+ ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
+ ${rootlibexecdir}/udev/rules.d/60-serial.rules \
+ ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
+ ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
+ ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
+ ${rootlibexecdir}/udev/rules.d/70-memory.rules \
+ ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
+ ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
+ ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
+ ${rootlibexecdir}/udev/rules.d/75-net-description.rules \
+ ${rootlibexecdir}/udev/rules.d/75-probe_mtd.rules \
+ ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
+ ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
+ ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
+ ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \
+ ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
+ ${rootlibexecdir}/udev/rules.d/README \
+ ${sysconfdir}/udev \
+ ${sysconfdir}/init.d/systemd-udevd \
+ ${systemd_system_unitdir}/*udev* \
+ ${systemd_system_unitdir}/*.wants/*udev* \
+ ${base_bindir}/systemd-hwdb \
+ ${base_bindir}/udevadm \
+ ${base_sbindir}/udevadm \
+ ${libexecdir}/${MLPREFIX}udevadm \
+ ${datadir}/bash-completion/completions/udevadm \
+ ${systemd_system_unitdir}/systemd-hwdb-update.service \
+ "
+
+FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
+ "
+
+RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
+
+INITSCRIPT_PACKAGES = "udev"
+INITSCRIPT_NAME:udev = "systemd-udevd"
+INITSCRIPT_PARAMS:udev = "start 03 S ."
+
+python __anonymous() {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+
+ if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
+ bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")
+
+ if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
+ bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
+}
+
+python do_warn_musl() {
+ if d.getVar('TCLIBC') == "musl":
+ bb.warn("Using systemd with musl is not recommended since it is not supported upstream and some patches are known to be problematic.")
+}
+addtask warn_musl before do_configure
+
+ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
+
+ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
+ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
+ALTERNATIVE_PRIORITY[resolv-conf] ?= "50"
+
+ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
+ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
+ALTERNATIVE_PRIORITY[halt] ?= "300"
+
+ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
+ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
+ALTERNATIVE_PRIORITY[reboot] ?= "300"
+
+ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
+ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
+ALTERNATIVE_PRIORITY[shutdown] ?= "300"
+
+ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
+ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
+ALTERNATIVE_PRIORITY[poweroff] ?= "300"
+
+ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
+ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
+ALTERNATIVE_PRIORITY[runlevel] ?= "300"
+
+pkg_postinst:${PN}:libc-glibc () {
+ sed -e '/^hosts:/s/\s*\<myhostname\>//' \
+ -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
+ -i $D${sysconfdir}/nsswitch.conf
+}
+
+pkg_prerm:${PN}:libc-glibc () {
+ sed -e '/^hosts:/s/\s*\<myhostname\>//' \
+ -e '/^hosts:/s/\s*myhostname//' \
+ -i $D${sysconfdir}/nsswitch.conf
+}
+
+PACKAGE_WRITE_DEPS += "qemu-native"
+pkg_postinst:udev-hwdb () {
+ if test -n "$D"; then
+ $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
+ else
+ udevadm hwdb --update
+ fi
+}
+
+pkg_prerm:udev-hwdb () {
+ rm -f $D${sysconfdir}/udev/hwdb.bin
+}
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
deleted file mode 100644
index 7b342901e1..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Upstream-Status: Inappropriate [configuration]
-
-# The src Makefile was checking for libcrypt.a on the host, not in the
-# build environment. This patch checks for $LCRYPT in the environment
-# and uses it if it's there.
-# - jdike@linux.intel.com
-
-Index: sysvinit-2.88dsf/src/Makefile
-===================================================================
---- sysvinit-2.88dsf.orig/src/Makefile
-+++ sysvinit-2.88dsf/src/Makefile
-@@ -85,9 +85,13 @@ else
- endif
-
- # Additional libs for GNU libc.
-+ifneq ($(LCRYPT),)
-+ SULOGINLIBS += $(LCRYPT)
-+else
- ifneq ($(wildcard /usr/lib*/libcrypt.a),)
- SULOGINLIBS += -lcrypt
- endif
-+endif
-
- all: $(BIN) $(SBIN) $(USRBIN)
-
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
new file mode 100644
index 0000000000..699a1ead1a
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# busybox' getty does this itself, util-linux' agetty needs extra help
+getty="/sbin/getty"
+case $(readlink -f "${getty}") in
+ */busybox*)
+ ;;
+ *)
+ if [ -x "/usr/bin/setsid" ] ; then
+ setsid="/usr/bin/setsid"
+ fi
+ ;;
+esac
+
+if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
+ ${setsid:-} ${getty} -L $1 $2 $3
+fi
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index 49b1326a26..bfcf51c35a 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -1,10 +1,11 @@
SUMMARY = "Inittab configuration for SysVinit"
LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
PR = "r10"
-SRC_URI = "file://inittab"
+SRC_URI = "file://inittab \
+ file://start_getty"
S = "${WORKDIR}"
@@ -15,16 +16,20 @@ do_compile() {
}
do_install() {
- install -d ${D}${sysconfdir}
+ install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
+ install -d ${D}${base_bindir}
+ install -m 0755 ${WORKDIR}/start_getty ${D}${base_bindir}/start_getty
+ sed -e 's,/usr/bin,${bindir},g' -i ${D}${base_bindir}/start_getty
set -x
tmp="${SERIAL_CONSOLES}"
for i in $tmp
do
j=`echo ${i} | sed s/\;/\ /g`
- label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
- echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
+ l=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
+ label=`echo $l | sed 's/.*\(....\)/\1/'`
+ echo "$label:12345:respawn:${base_bindir}/start_getty ${j} vt102" >> ${D}${sysconfdir}/inittab
done
if [ "${USE_VT}" = "1" ]; then
@@ -48,24 +53,30 @@ EOF
fi
}
-pkg_postinst_${PN} () {
+pkg_postinst:${PN} () {
+# run this on host and on target
+if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
+ exit 0
+fi
+}
+
+pkg_postinst_ontarget:${PN} () {
# run this on the target
-if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
+if [ -e /proc/consoles ]; then
tmp="${SERIAL_CONSOLES_CHECK}"
for i in $tmp
do
- j=`echo ${i} | sed s/^.*\;//g`
+ j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
+ k=`echo ${i} | sed s/^.*\://g`
if [ -z "`grep ${j} /proc/consoles`" ]; then
- sed -i /^.*${j}$/d /etc/inittab
+ if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
+ sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
+ fi
fi
done
kill -HUP 1
else
- if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
- exit 0
- else
- exit 1
- fi
+ exit 1
fi
}
@@ -73,11 +84,10 @@ fi
# Set PACKAGE_ARCH appropriately.
PACKAGE_ARCH = "${MACHINE_ARCH}"
-FILES_${PN} = "${sysconfdir}/inittab"
-CONFFILES_${PN} = "${sysconfdir}/inittab"
+FILES:${PN} = "${sysconfdir}/inittab ${base_bindir}/start_getty"
+CONFFILES:${PN} = "${sysconfdir}/inittab"
USE_VT ?= "1"
SYSVINIT_ENABLED_GETTYS ?= "1"
-
-
+RCONFLICTS:${PN} = "busybox-inittab"
diff --git a/meta/recipes-core/sysvinit/sysvinit/0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch b/meta/recipes-core/sysvinit/sysvinit/0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch
deleted file mode 100644
index f35c15cb31..0000000000
--- a/meta/recipes-core/sysvinit/sysvinit/0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 36ac97bfe51797458442a6035219a504a42e703a Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 21 Aug 2015 10:56:40 -0700
-Subject: [PATCH] This fixes an issue that clang reports about mutliple output
- files
-
-Issue is that we are passing .h file to link step as seen below.
-
-| arm-oe-linux-gnueabi-clang -march=armv7-a -mthumb -mfloat-abi=hard
--mfpu=neon-vfpv4 -mtune=cortex-a7 -D__extern_always_inline=inline
--no-integrated-as
---sysroot=/mnt/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-glibc/sysroots/raspberrypi2
--Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed halt.o ifdown.o hddown.o
-utmp.o reboot.h -o halt
-| clang-3.7: error: cannot specify -o when generating multiple output
-files
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/Makefile | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/Makefile b/src/Makefile
-index e77ed5f..a6f9f40 100644
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -103,9 +103,9 @@ all: $(BIN) $(SBIN) $(USRBIN)
- init: LDLIBS += $(INITLIBS) $(STATIC)
- init: init.o init_utmp.o
-
--halt: halt.o ifdown.o hddown.o utmp.o reboot.h
-+halt: halt.o ifdown.o hddown.o utmp.o
-
--last: last.o oldutmp.h
-+last: last.o
-
- mesg: mesg.o
-
-@@ -120,7 +120,7 @@ sulogin: sulogin.o
-
- wall: dowall.o wall.o
-
--shutdown: dowall.o shutdown.o utmp.o reboot.h
-+shutdown: dowall.o shutdown.o utmp.o
-
- bootlogd: LDLIBS += -lutil
- bootlogd: bootlogd.o
---
-2.1.4
-
diff --git a/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch b/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch
new file mode 100644
index 0000000000..60fbd87534
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch
@@ -0,0 +1,50 @@
+From c710a3accd1fabdb671274e1a458405282d51e0c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 6 Aug 2018 15:38:58 -0700
+Subject: [PATCH] include sys/sysmacros.h for major/minor definitions
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Upstream-Status: Pending
+
+---
+ src/bootlogd.c | 1 +
+ src/mountpoint.c | 1 +
+ src/shutdown.c | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/src/bootlogd.c b/src/bootlogd.c
+index 787db87..8b07903 100644
+--- a/src/bootlogd.c
++++ b/src/bootlogd.c
+@@ -29,6 +29,7 @@
+ #include <sys/types.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/ioctl.h>
+ #include <sys/utsname.h>
+ #include <time.h>
+diff --git a/src/mountpoint.c b/src/mountpoint.c
+index 5f20522..94df7a1 100644
+--- a/src/mountpoint.c
++++ b/src/mountpoint.c
+@@ -25,6 +25,7 @@
+
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+diff --git a/src/shutdown.c b/src/shutdown.c
+index b744a2c..40b7faf 100644
+--- a/src/shutdown.c
++++ b/src/shutdown.c
+@@ -40,6 +40,7 @@
+ #endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <sys/wait.h>
+ #ifdef __linux__
+ #include <sys/sysmacros.h> /* brought in my LFS patch */
diff --git a/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch
new file mode 100644
index 0000000000..5c39fb001b
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/crypt-lib.patch
@@ -0,0 +1,38 @@
+From c3a068cf24a22bea7349849ec111ae8d91a54db4 Mon Sep 17 00:00:00 2001
+From: Jeff Dike <jdike@x86_64.user-mode-linux.org>
+Date: Wed, 14 Jul 2010 14:35:52 -0400
+Subject: [PATCH] sysvinit - Remove sulogin dependency on /usr/lib*/libcrypt.a
+
+Upstream-Status: Inappropriate [configuration]
+
+# The src Makefile was checking for libcrypt.a on the host, not in the
+# build environment. This patch checks for $LCRYPT in the environment
+# and uses it if it's there.
+# - jdike@linux.intel.com
+
+---
+ src/Makefile | 11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 5b1a5a2..b686394 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -97,15 +97,8 @@ else
+ endif
+
+ # Additional libs for GNU libc.
+-ifneq ($(wildcard $(ROOT)/usr/lib*/libcrypt.*),)
+- SULOGINLIBS += -lcrypt
+-endif
+-
+-# Additional libs for GNU libc / multiarch on Debian based systems.
+-ifneq ($(wildcard $(ROOT)/usr/lib/*/libcrypt.*),)
+-ifneq ($(findstring -lcrypt, $(SULOGINLIBS)), -lcrypt)
+- SULOGINLIBS += -lcrypt
+-endif
++ifneq ($(LCRYPT),)
++ SULOGINLIBS += $(LCRYPT)
+ endif
+
+ all: $(BIN) $(SBIN) $(USRBIN)
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch b/meta/recipes-core/sysvinit/sysvinit/install.patch
index 6c4225a678..90563a6294 100644
--- a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
+++ b/meta/recipes-core/sysvinit/sysvinit/install.patch
@@ -1,10 +1,19 @@
+From 5e35aa105e7a2e85db2a89fee4114090b1ac55be Mon Sep 17 00:00:00 2001
+From: Qing He <qing.he@intel.com>
+Date: Fri, 18 Jun 2010 09:40:30 +0800
+Subject: [PATCH] sysvinit: upgrade to version 2.88dsf
+
Upstream-Status: Pending
+---
+ src/Makefile | 53 +++++++++++++++++++++++++++++-----------------------
+ 1 file changed, 30 insertions(+), 23 deletions(-)
+
diff --git a/src/Makefile b/src/Makefile
-index e2b8028..3e11e92 100644
+index 1b368dc..5b1a5a2 100644
--- a/src/Makefile
+++ b/src/Makefile
-@@ -65,7 +65,14 @@ else
+@@ -77,7 +77,14 @@ else
INSTALL_DATA = install -m 644
endif
INSTALL_DIR = install -m 755 -d
@@ -20,10 +29,10 @@ index e2b8028..3e11e92 100644
ifeq ($(WITH_SELINUX),yes)
SELINUX_DEF = -DWITH_SELINUX
-@@ -138,39 +145,39 @@ clobber: cleanobjs
+@@ -191,43 +198,43 @@ clobber: cleanobjs
distclean: clobber
- install:
+ install: all
- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
- $(INSTALL_DIR) $(ROOT)/usr/bin/
+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
@@ -40,16 +49,15 @@ index e2b8028..3e11e92 100644
- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
done
-- # $(INSTALL_DIR) $(ROOT)/etc/
-- # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
+ # $(INSTALL_DIR) $(ROOT)/etc/
+ $(INSTALL_DIR) $(ROOT)/etc/inittab.d
+ # $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/
- ln -sf halt $(ROOT)/sbin/reboot
- ln -sf halt $(ROOT)/sbin/poweroff
- ln -sf init $(ROOT)/sbin/telinit
- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
- ln -sf last $(ROOT)/usr/bin/lastb; \
-+ # $(INSTALL_DIR) $(ROOT)$(sysconfdir)/
-+ # $(INSTALL_EXEC) initscript.sample $(ROOT)$(sysconfdir)/
+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
+ ln -sf init $(ROOT)$(base_sbindir)/telinit
@@ -67,17 +75,23 @@ index e2b8028..3e11e92 100644
+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
- for i in $(MAN1); do \
-- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
-+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man1/; \
+ for man in $(MAN1); do \
+- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
+- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
++ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man1/; \
++ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man1/$$man ; \
done
- for i in $(MAN5); do \
-- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
-+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man5/; \
+ for man in $(MAN5); do \
+- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
+- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
++ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man5/; \
++ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man5/$$man ; \
done
- for i in $(MAN8); do \
-- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
-+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man8/; \
+ for man in $(MAN8); do \
+- $(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
+- sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
++ $(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man8/; \
++ sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man8/$$man ; \
done
ifeq ($(ROOT),)
#
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch
index 5b5dfdc001..494aa0e012 100644
--- a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
+++ b/meta/recipes-core/sysvinit/sysvinit/pidof-add-m-option.patch
@@ -1,4 +1,7 @@
-pidof: add -m option
+From 6c490ea6579a132fabb7dbd25387bb521f820371 Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Wed, 24 Jul 2013 17:07:22 +0800
+Subject: [PATCH] pidof: add -m option
When used with -o, will also omit any processes that have the same
argv[0] and argv[1] as any explicitly omitted process ids. This can be
@@ -11,23 +14,25 @@ Upstream-Status: backport
Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+
---
- man/pidof.8 | 6 ++++++
- src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
+ man/pidof.8 | 6 +++++
+ src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/man/pidof.8 b/man/pidof.8
+index ebe5f55..2fdc4d3 100644
--- a/man/pidof.8
+++ b/man/pidof.8
-@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
- .RB [ \-c ]
+@@ -25,6 +25,7 @@ pidof -- find the process ID of a running program.
.RB [ \-n ]
.RB [ \-x ]
+ .RB [ \-z ]
+.RB [ \-m ]
.RB [ \-o
- .IR omitpid[,omitpid..] ]
+ .IR omitpid[,omitpid...] ]
.RB [ \-o
-@@ -63,6 +64,11 @@ shells running the named scripts.
+@@ -76,6 +77,11 @@ is shown. The default separator is a space.
Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
program, in other words the calling shell or shell script.
@@ -40,10 +45,10 @@ diff --git a/man/pidof.8 b/man/pidof.8
.TP
.B 0
diff --git a/src/killall5.c b/src/killall5.c
-index 5937d98..e73885e 100644
+index 8b5cb38..a664954 100644
--- a/src/killall5.c
+++ b/src/killall5.c
-@@ -118,6 +118,7 @@ typedef struct _s_nfs
+@@ -126,6 +126,7 @@ typedef struct _s_nfs
/* List of processes. */
PROC *plist;
@@ -51,7 +56,7 @@ index 5937d98..e73885e 100644
/* List of processes to omit. */
OMIT *omit;
-@@ -345,6 +346,20 @@ static void clear_mnt(void)
+@@ -361,6 +362,20 @@ static void clear_mnt(void)
}
}
@@ -70,9 +75,9 @@ index 5937d98..e73885e 100644
+}
+
/*
- * Check if path is ia shadow off a NFS partition.
+ * Check if path is a shadow off a NFS partition.
*/
-@@ -452,6 +467,7 @@ int readproc(int do_stat)
+@@ -486,6 +501,7 @@ int readproc(int do_stat)
DIR *dir;
FILE *fp;
PROC *p, *n;
@@ -80,7 +85,7 @@ index 5937d98..e73885e 100644
struct dirent *d;
struct stat st;
char path[PATH_MAX+1];
-@@ -624,6 +640,17 @@ int readproc(int do_stat)
+@@ -733,6 +749,17 @@ int readproc(int do_stat)
p->next = plist;
plist = p;
p->pid = pid;
@@ -98,7 +103,7 @@ index 5937d98..e73885e 100644
}
closedir(dir);
-@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
+@@ -944,6 +971,26 @@ PIDQ_HEAD *pidof(char *prog)
return q;
}
@@ -125,42 +130,42 @@ index 5937d98..e73885e 100644
/* Give usage message and exit. */
void usage(void)
{
-@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
- #define PIDOF_SINGLE 0x01
+@@ -994,6 +1041,7 @@ void nsyslog(int pri, char *fmt, ...)
#define PIDOF_OMIT 0x02
#define PIDOF_NETFS 0x04
+ #define PIDOF_QUIET 0x08
+#define PIDOF_OMIT_OMIT_MATCHES 0x08
/*
* Pidof functionality.
-@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
- struct stat st;
+@@ -1011,6 +1059,7 @@ int main_pidof(int argc, char **argv)
char tmp[512];
+ char sep = ' ';
+ olist = (PROC*)0;
omit = (OMIT*)0;
nlist = (NFS*)0;
opterr = 0;
-@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
+@@ -1018,7 +1067,7 @@ int main_pidof(int argc, char **argv)
if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
flags |= PIDOF_NETFS;
-- while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
-+ while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
+- while ((opt = getopt(argc,argv,"qhco:d:sxzn")) != EOF) switch (opt) {
++ while ((opt = getopt(argc,argv,"qhcmo:d:sxzn")) != EOF) switch (opt) {
case '?':
nsyslog(LOG_ERR,"invalid options on command line!\n");
closelog();
-@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
- case 'x':
- scripts_too++;
- break;
+@@ -1069,6 +1118,9 @@ int main_pidof(int argc, char **argv)
+ case 'z':
+ list_dz_processes = TRUE;
+ break;
+ case 'm':
+ flags |= PIDOF_OMIT_OMIT_MATCHES;
+ break;
case 'n':
flags |= PIDOF_NETFS;
break;
-@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
+@@ -1100,10 +1152,13 @@ int main_pidof(int argc, char **argv)
pid_t spid = 0;
while ((p = get_next_from_pid_q(q))) {
if ((flags & PIDOF_OMIT) && omit) {
@@ -176,14 +181,11 @@ index 5937d98..e73885e 100644
}
/*
-@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
- if (!first)
+@@ -1145,6 +1200,7 @@ int main_pidof(int argc, char **argv)
printf("\n");
+ }
+ clear_omit();
clear_mnt();
closelog();
---
-1.8.1.2
-
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index 7ca41ae1ae..41196ec90b 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -17,6 +17,7 @@
. /etc/default/rcS
export VERBOSE
+export PSPLASH_FIFO_DIR
startup_progress() {
step=$(($step + $step_change))
@@ -26,11 +27,8 @@ startup_progress() {
progress=$progress_size
fi
#echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
- #if type psplash-write >/dev/null 2>&1; then
- # TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
- #fi
- if [ -e /mnt/.psplash/psplash_fifo ]; then
- echo "PROGRESS $progress" > /mnt/.psplash/psplash_fifo
+ if type psplash-write >/dev/null 2>&1; then
+ psplash-write "PROGRESS $progress" || true
fi
}
@@ -66,7 +64,7 @@ startup() {
stty onlcr 0>&1
# Limit stack size for startup scripts
- [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
+ [ "$STACK_SIZE" = "" ] || ulimit -S -s $STACK_SIZE
# Now find out what the current and what the previous runlevel are.
@@ -162,6 +160,9 @@ startup() {
#
[ -f $previous_start ] && [ ! -f $stop ] && continue
fi
+ if [ x"${PSPLASH_TEXT_UPDATES}" = x"yes" ]; then
+ psplash-write "MSG $(basename $i .sh | cut -c 4-)" || true
+ fi
case "$runlevel" in
0|6)
startup $i stop
@@ -176,7 +177,6 @@ startup() {
#Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; then
if type psplash-write >/dev/null 2>&1; then
- TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
- umount -l /mnt/.psplash
+ psplash-write "QUIT" || true
fi
fi
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS-default b/meta/recipes-core/sysvinit/sysvinit/rcS-default
index 709cdf6ec5..f7c4a2f841 100644
--- a/meta/recipes-core/sysvinit/sysvinit/rcS-default
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS-default
@@ -27,3 +27,10 @@ VOLATILE_ENABLE_CACHE=yes
# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
# Normally you should not change this value.
ROOTFS_READ_ONLY=no
+# rcS is also used when using busybox init and shares initscripts, some initscripts
+# need to have specific behavior depending on init system
+INIT_SYSTEM=sysvinit
+# set the psplash fifo directory
+PSPLASH_FIFO_DIR=/mnt
+# psplash textual updates knob
+PSPLASH_TEXT_UPDATES=#PSPLASH_TEXT#
diff --git a/meta/recipes-core/sysvinit/sysvinit/realpath.patch b/meta/recipes-core/sysvinit/sysvinit/realpath.patch
new file mode 100644
index 0000000000..859fd8baad
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/realpath.patch
@@ -0,0 +1,59 @@
+From eb158c97f19d473d01befe96359a7f93ae834517 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 19 Nov 2015 00:10:03 +0000
+Subject: [PATCH] Fix build on musl use realpath() API its available on all
+ libcs
+
+realpath() API doesnt work on systems with PATH_MAX set to be unlimited e.g. GNU/Hurd
+However for Linux it should always work
+
+Upstream-Status: Inappropriate[Linux specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/killall5.c | 4 ++--
+ src/mountpoint.c | 1 +
+ src/wall.c | 1 +
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/killall5.c b/src/killall5.c
+index a664954..9798423 100644
+--- a/src/killall5.c
++++ b/src/killall5.c
+@@ -977,9 +977,9 @@ int matches(PROC *o, PROC *p)
+ char *oargv1, *pargv1;
+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
+ if (o->argv1 && p->argv1) {
+- if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
++ if ((oargv1 = realpath(o->argv1, NULL)) == NULL)
+ oargv1 = strdup(o->argv1);
+- if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
++ if ((pargv1 = realpath(p->argv1, NULL)) == NULL)
+ pargv1 = strdup(p->argv1);
+ if (! strcmp(oargv1, pargv1)) {
+ ret = 1;
+diff --git a/src/mountpoint.c b/src/mountpoint.c
+index b24335e..5f20522 100644
+--- a/src/mountpoint.c
++++ b/src/mountpoint.c
+@@ -23,6 +23,7 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+diff --git a/src/wall.c b/src/wall.c
+index d3a2c70..00826e9 100644
+--- a/src/wall.c
++++ b/src/wall.c
+@@ -30,6 +30,7 @@
+ #include <pwd.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#include <time.h>
+ #include "init.h"
+
+
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_3.00.bb
index 5dfe39e233..264944797d 100644
--- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_3.00.bb
@@ -4,33 +4,36 @@ HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/"
SECTION = "base"
LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
- file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
-PR = "r14"
+ file://COPYRIGHT;endline=15;md5=a1d3b3526501d3546d530bbe6ab6cdbe \
+ "
-RDEPENDS_${PN} = "${PN}-inittab"
+RDEPENDS:${PN} = "${PN}-inittab"
-SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.bz2 \
+SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.xz \
file://install.patch \
file://crypt-lib.patch \
file://pidof-add-m-option.patch \
- file://0001-This-fixes-an-issue-that-clang-reports-about-mutlipl.patch \
+ file://realpath.patch \
+ file://0001-include-sys-sysmacros.h-for-major-minor-defines-in-g.patch \
file://rcS-default \
file://rc \
file://rcS \
file://bootlogd.init \
file://01_bootlogd \
-"
-
-SRC_URI[md5sum] = "6eda8a97b86e0a6f59dabbf25202aa6f"
-SRC_URI[sha256sum] = "60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519"
+ "
+SRC_URI[sha256sum] = "ed6bc20adb6735389841e7d3eb8650fa750c76af20bf4ed73b1330a4d4c14017"
S = "${WORKDIR}/sysvinit-${PV}"
-B = "${S}/src"
-inherit update-alternatives
-DEPENDS_append = " update-rc.d-native base-passwd"
+inherit update-alternatives features_check
+DEPENDS:append = " update-rc.d-native base-passwd virtual/crypt"
+do_package_setscene[depends] = "${MLPREFIX}base-passwd:do_populate_sysroot"
+
+PACKAGECONFIG[psplash-text-updates] = ",,"
+
+REQUIRED_DISTRO_FEATURES = "sysvinit"
-ALTERNATIVE_${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last lastb mesg utmpdump wall"
+ALTERNATIVE:${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last lastb mesg utmpdump wall"
ALTERNATIVE_PRIORITY = "200"
@@ -38,21 +41,24 @@ ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
ALTERNATIVE_PRIORITY[init] = "50"
ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
+ALTERNATIVE_PRIORITY[mountpoint] = "20"
+
ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
-ALTERNATIVE_${PN}-pidof = "pidof"
+ALTERNATIVE:${PN}-pidof = "pidof"
ALTERNATIVE_LINK_NAME[pidof] = "${base_bindir}/pidof"
-ALTERNATIVE_${PN}-sulogin = "sulogin"
+ALTERNATIVE:${PN}-sulogin = "sulogin"
ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
-ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1"
+ALTERNATIVE:${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 sulogin.8 utmpdump.1"
ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
+ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
@@ -60,13 +66,13 @@ ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
-FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*"
-FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5"
-FILES_sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit"
+FILES:${PN} += "${base_sbindir}/* ${base_bindir}/*"
+FILES:sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5"
+FILES:sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit"
-RDEPENDS_${PN} += "sysvinit-pidof initscripts-functions"
+RDEPENDS:${PN} += "sysvinit-pidof initd-functions base-passwd"
-CFLAGS_prepend = "-D_GNU_SOURCE "
+CFLAGS:prepend = "-D_GNU_SOURCE "
export LCRYPT = "-lcrypt"
EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
'base_sbindir=${base_sbindir}' \
@@ -74,7 +80,8 @@ EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
'sbindir=${sbindir}' \
'sysconfdir=${sysconfdir}' \
'includedir=${includedir}' \
- 'mandir=${mandir}'"
+ 'mandir=${mandir}' \
+ MNTPOINT=yes"
do_install () {
oe_runmake 'ROOT=${D}' install
@@ -86,7 +93,10 @@ do_install () {
install -d ${D}${sysconfdir}/rc$level.d
done
- install -m 0644 ${WORKDIR}/rcS-default ${D}${sysconfdir}/default/rcS
+ sed -e \
+ 's:#PSPLASH_TEXT#:${@bb.utils.contains("PACKAGECONFIG","psplash-text-updates","yes","no", d)}:g' \
+ ${WORKDIR}/rcS-default > ${D}${sysconfdir}/default/rcS
+ chmod 0644 ${D}${sysconfdir}/default/rcS
install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd
@@ -98,11 +108,10 @@ do_install () {
install -d ${D}${sysconfdir}/default/volatiles
install -m 0644 ${WORKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles
- chown root.shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
+ chown root:shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
-}
-python () {
- if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
- raise bb.parse.SkipPackage("'sysvinit' not in DISTRO_FEATURES")
+ # Already provided by e2fsprogs; sysvinit's version is a copy from there
+ rm ${D}${base_sbindir}/logsave
+ rm ${D}${mandir}/man8/logsave.8
}
diff --git a/meta/recipes-core/uclibc/site_config/funcs b/meta/recipes-core/uclibc/site_config/funcs
deleted file mode 100644
index ccc85392d7..0000000000
--- a/meta/recipes-core/uclibc/site_config/funcs
+++ /dev/null
@@ -1,474 +0,0 @@
-a64l
-abs
-access
-__adjtimex
-alarm
-alphasort
-argz_append
-__argz_count
-argz_create_sep
-argz_insert
-__argz_next
-argz_next
-__argz_stringify
-argz_stringify
-asprintf
-atexit
-atof
-atoi
-bcmp
-bcopy
-bindresvport
-bind_textdomain_codeset
-btowc
-bzero
-calloc
-canonicalize_file_name
-catgets
-cfgetospeed
-cfsetispeed
-cfsetspeed
-chmod
-chown
-chroot
-clock
-close
-closedir
-closelog
-confstr
-connect
-daemon
-dcgettext
-difftime
-dirfd
-dirname
-dngettext
-dup2
-ecvt
-endgrent
-endmntent
-endpwent
-endutent
-endutxent
-epoll_ctl
-err
-ether_hostton
-ether_ntohost
-euidaccess
-execv
-fchdir
-fchmod
-fchmodat
-fchown
-fchownat
-fcntl
-fcvt
-fdatasync
-fdopendir
-feof_unlocked
-fgets_unlocked
-fgetxattr
-finite
-flistxattr
-flock
-flockfile
-fnmatch
-fork
-fpathconf
-__fpending
-fprintf
-free
-freeaddrinfo
-freeifaddrs
-fseeko
-__fsetlocking
-fsetxattr
-fstat64
-fstat
-fstatfs
-fsync
-ftello
-ftime
-ftruncate
-funlockfile
-futimes
-futimesat
-gai_strerror
-gcvt
-getaddrinfo
-getc_unlocked
-getcwd
-getdelim
-getdomainname
-getdtablesize
-getegid
-getenv
-geteuid
-getgid
-getgrent
-getgrent_r
-getgrgid_r
-getgrnam
-getgrnam_r
-getgrouplist
-getgroups
-gethostbyaddr_r
-gethostbyname2
-gethostbyname
-gethostbyname_r
-gethostent
-gethostid
-gethostname
-getifaddrs
-getline
-getloadavg
-getmntent
-getmsg
-getnameinfo
-getnetbyaddr_r
-getnetgrent_r
-getopt
-getopt_long
-getopt_long_only
-getpagesize
-getpass
-getpeername
-getpgrp
-getpid
-getppid
-getprotoent_r
-getpwent
-getpwent_r
-getpwnam
-getpwnam_r
-getpwuid
-getpwuid_r
-getresuid
-getrlimit
-getrusage
-getservbyname
-getservbyname_r
-getservbyport_r
-getservent
-getservent_r
-getspnam
-getspnam_r
-gettimeofday
-getttyent
-getttynam
-getuid
-getusershell
-getutent
-getutid
-getutline
-getutmp
-getutmpx
-getutxent
-getutxid
-getutxline
-getwd
-getxattr
-glob
-gmtime
-gmtime_r
-grantpt
-group_member
-herror
-hstrerror
-iconv
-iconv_open
-if_freenameindex
-if_indextoname
-if_nameindex
-if_nametoindex
-index
-inet_addr
-inet_aton
-inet_ntoa
-inet_ntop
-inet_pton
-initgroups
-innetgr
-iruserok
-isascii
-isatty
-isblank
-isgraph
-isinf
-isnan
-isprint
-isspace
-iswalnum
-iswcntrl
-iswctype
-iswprint
-iswspace
-iswupper
-isxdigit
-kill
-killpg
-lchown
-lckpwdf
-lgetxattr
-link
-listxattr
-llistxattr
-localtime
-localtime_r
-lockf
-lrand48
-lsearch
-lseek64
-lsetxattr
-lstat
-mallinfo
-malloc
-mblen
-mbrlen
-mbrtowc
-mbsinit
-mbsrtowcs
-mbtowc
-memalign
-memchr
-memcmp
-memcpy
-memmove
-mempcpy
-memrchr
-memset
-mkdir
-mkdirat
-mkdtemp
-mkfifo
-mknod
-mkstemp64
-mkstemp
-mktime
-mlock
-mmap
-mtrace
-munlock
-munmap
-nanosleep
-nice
-nl_langinfo
-ntp_adjtime
-ntp_gettime
-_obstack_free
-on_exit
-open64
-open
-openat
-opendir
-openlog
-pathconf
-pipe
-poll
-popen
-posix_memalign
-prctl
-pread
-printf
-__progname
-pselect
-pthread_mutex_lock
-ptsname
-putenv
-putgrent
-putpwent
-putspent
-pututline
-pututxline
-putwc
-pwrite
-qsort
-raise
-rand
-random
-rand_r
-read
-readdir
-readdir_r
-readlink
-realloc
-realpath
-re_comp
-recvmsg
-re_exec
-regcomp
-regexec
-remove
-rename
-re_search
-rmdir
-rpmatch
-rresvport_af
-ruserok
-ruserok_af
-sbrk
-scandir
-sched_setscheduler
-sched_yield
-__secure_getenv
-select
-semctl
-semget
-sendmsg
-setbuf
-setbuffer
-setegid
-setenv
-seteuid
-setgid
-setgroups
-sethostname
-setitimer
-_setjmp
-setjmp
-setlinebuf
-setlocale
-setmntent
-setpgid
-setpgrp
-setpriority
-setregid
-setresgid
-setresuid
-setreuid
-setrlimit
-setsid
-setsockopt
-settimeofday
-setuid
-setutent
-setutxent
-setvbuf
-setxattr
-sgetspent
-shmat
-shmctl
-shmdt
-shmget
-shutdown
-sigaction
-sigaddset
-sigaltstack
-sigblock
-sigemptyset
-sighold
-siginterrupt
-signal
-sigprocmask
-sigset
-sigsetmask
-sigstack
-sigsuspend
-sigvec
-snprintf
-socket
-socketpair
-sprintf
-srand48
-srand
-srandom
-sscanf
-stat
-statfs
-statvfs
-stime
-stpcpy
-strcasecmp
-strcasestr
-strchr
-strchrnul
-strcmp
-strcspn
-strdup
-strerror
-strerror_r
-strftime
-strlen
-strncasecmp
-strncmp
-strndup
-strnlen
-strpbrk
-strptime
-strrchr
-strsep
-strsignal
-strspn
-strstr
-strtod
-strtoimax
-strtok_r
-strtol
-strtoll
-strtoul
-strtoull
-strtoumax
-strverscmp
-strxfrm
-symlink
-sync
-sysconf
-sysctl
-sysinfo
-syslog
-_sys_siglist
-sys_siglist
-system
-tcgetattr
-tcgetpgrp
-tcsetattr
-tcsetpgrp
-time
-timegm
-times
-timezone
-tmpnam
-towlower
-towupper
-truncate
-tsearch
-ttyname
-tzset
-ulimit
-umask
-uname
-unlink
-unsetenv
-unshare
-updwtmp
-updwtmpx
-usleep
-ustat
-utime
-utimes
-utmpname
-utmpxname
-valloc
-vasprintf
-verrx
-vfork
-vfprintf
-vfscanf
-vhangup
-vprintf
-vsnprintf
-vsprintf
-wait3
-wait4
-waitpid
-wcrtomb
-wcscoll
-wcsdup
-wcslen
-wctob
-wctomb
-wctype
-wcwidth
-wmemchr
-wmemcpy
-wmempcpy
diff --git a/meta/recipes-core/uclibc/site_config/headers b/meta/recipes-core/uclibc/site_config/headers
deleted file mode 100644
index 609ab53797..0000000000
--- a/meta/recipes-core/uclibc/site_config/headers
+++ /dev/null
@@ -1,156 +0,0 @@
-aio.h
-alloca.h
-argz.h
-arpa/inet.h
-arpa/nameser.h
-asm/byteorder.h
-asm/ioctls.h
-asm/page.h
-asm/types.h
-assert.h
-byteswap.h
-crypt.h
-ctype.h
-dirent.h
-dlfcn.h
-elf.h
-endian.h
-err.h
-errno.h
-execinfo.h
-fcntl.h
-features.h
-float.h
-fstab.h
-ftw.h
-getopt.h
-glob.h
-grp.h
-iconv.h
-ifaddrs.h
-inttypes.h
-langinfo.h
-lastlog.h
-libgen.h
-libintl.h
-limits.h
-linux/capability.h
-linux/fd.h
-linux/fs.h
-linux/hayesesp.h
-linux/hdreg.h
-linux/icmp.h
-linux/in6.h
-linux/joystick.h
-linux/ptrace.h
-linux/serial.h
-linux/sonypi.h
-linux/unistd.h
-linux/utsname.h
-linux/version.h
-locale.h
-malloc.h
-math.h
-mcheck.h
-memory.h
-mntent.h
-mqueue.h
-netdb.h
-net/if.h
-netinet/ether.h
-netinet/in.h
-netinet/ip6.h
-netinet/ip.h
-netinet/tcp.h
-netinet/udp.h
-netipx/ipx.h
-net/route.h
-paths.h
-poll.h
-pthread.h
-pty.h
-pwd.h
-regex.h
-resolv.h
-rpc/rpc.h
-rpc/types.h
-sched.h
-scsi/scsi.h
-search.h
-semaphore.h
-setjmp.h
-sgtty.h
-shadow.h
-signal.h
-stdarg.h
-stdbool.h
-stdc
-stddef.h
-stdint.h
-stdio.h
-stdlib.h
-string.h
-strings.h
-stropts.h
-sys/bitypes.h
-sys/cdefs.h
-sys/dir.h
-sys/epoll.h
-sysexits.h
-sys/fcntl.h
-sys/file.h
-sys/fsuid.h
-sys/ioctl.h
-sys/ipc.h
-syslog.h
-sys/mman.h
-sys/mount.h
-sys/mtio.h
-sys/param.h
-sys/poll.h
-sys/prctl.h
-sys/ptrace.h
-sys/queue.h
-sys/reg.h
-sys/resource.h
-sys/select.h
-sys/sem.h
-sys/shm.h
-sys/signal.h
-sys/socket.h
-sys/socketvar.h
-sys/soundcard.h
-sys/statfs.h
-sys/stat.h
-sys/statvfs.h
-sys/stropts.h
-sys/swap.h
-sys/sysctl.h
-sys/sysinfo.h
-sys/sysmacros.h
-sys/termios.h
-sys/timeb.h
-sys/time.h
-sys/times.h
-sys/timex.h
-sys/types.h
-sys/uio.h
-sys/un.h
-sys/unistd.h
-sys/user.h
-sys/utsname.h
-sys/vfs.h
-sys/wait.h
-termio.h
-termios.h
-time.h
-ttyent.h
-ulimit.h
-unistd.h
-ustat.h
-utime.h
-utmp.h
-utmpx.h
-values.h
-wchar.h
-wctype.h
diff --git a/meta/recipes-core/uclibc/site_config/types b/meta/recipes-core/uclibc/site_config/types
deleted file mode 100644
index 178bd85a00..0000000000
--- a/meta/recipes-core/uclibc/site_config/types
+++ /dev/null
@@ -1,21 +0,0 @@
-char
-char *
-double
-float
-int
-long
-long double
-long int
-long long
-long long int
-short
-short int
-signed char
-unsigned char
-unsigned int
-unsigned long
-unsigned long int
-unsigned long long int
-unsigned short
-unsigned short int
-void *
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc
deleted file mode 100644
index 8b9e41c64d..0000000000
--- a/meta/recipes-core/uclibc/uclibc-config.inc
+++ /dev/null
@@ -1,142 +0,0 @@
-DEPENDS += "kern-tools-native"
-inherit cml1
-#
-# Set the ARCH environment variable for uClibc compilation.
-# Return value must match one of the architectures known to uClibc:
-# libc/sysdeps/*/*
-#
-
-valid_archs = "\
-alpha \
-arm \
-avr32 \
-bfin \
-c6x \
-cris \
-e1 \
-frv \
-h8300 \
-hppa \
-i386 \
-i960 \
-ia64 \
-m68k \
-microblaze \
-mips \
-nios \
-nios2 \
-powerpc \
-sh \
-sh64 \
-sparc \
-v850 \
-vax \
-x86_64 \
-xtensa \
-"
-def map_uclibc_arch(a, d):
- """Return the uClibc architecture for the given TARGET_ARCH."""
- import re
-
- valid_archs = d.getVar('valid_archs', True).split()
-
- if re.match('^(arm|sa110).*', a):
- return 'arm'
- elif re.match('^(i.86|athlon)$', a):
- return 'i386'
- elif re.match('^mips.*', a):
- return 'mips'
- elif re.match('^parisc.*', a):
- return 'hppa'
- elif re.match('^ppc.*', a):
- return 'powerpc'
- elif re.match('^s390.*', a):
- return 's390'
- elif re.match('^sh.*', a):
- return 'sh'
- elif re.match('^(sun|sparc).*', a):
- return 'sparc'
- elif re.match('^xtensa.*', a):
- return 'xtensa'
- elif a in valid_archs:
- return a
- else:
- bb.error("cannot map '%s' to a uClibc architecture" % a)
-
-export UCLIBC_ARCH = "${@map_uclibc_arch(d.getVar('TARGET_ARCH', True), d)}"
-
-def map_uclibc_abi(o, d):
- """Return the uClibc ABI for the given TARGET_OS."""
- import re
-
- arch = d.getVar('TARGET_ARCH', True)
- if map_uclibc_arch(d.getVar('TARGET_ARCH', True), d) == "arm":
- if re.match('.*eabi$', o):
- return 'ARM_EABI'
- else:
- return 'ARM_OABI'
- # FIXME: This is inaccurate! Handle o32, n32, n64
- elif re.match('^mips.*64$', arch):
- return 'MIPS_N64_ABI'
- elif re.match('^mips.*', arch):
- return 'MIPS_O32_ABI'
- return ""
-
-export UCLIBC_ABI = "${@map_uclibc_abi(d.getVar('TARGET_OS', True), d)}"
-
-def map_uclibc_endian(a, d):
- """Return the uClibc endianess for the given TARGET_ARCH."""
- import re
-
- # Always BE
- if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a):
- return 'BIG'
- # Possibly BE
- elif re.match('^(((arm|sa110).*eb)|h8300.*eb|(parisc|hppa).*eb|mips|mips64|sh.*eb|xtensa.*eb)$', a):
- return 'BIG'
- return 'LITTLE'
-
-export UCLIBC_ENDIAN = "${@map_uclibc_endian(d.getVar('TARGET_ARCH', True), d)}"
-
-# internal helper
-def uclibc_cfg(feature, features, tokens, cnf, rem):
- if type(tokens) == type(""):
- tokens = [tokens]
- rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
- if type(features) == type([]) and feature in features:
- cnf.extend([token + '=y' for token in tokens])
- else:
- cnf.extend(['# ' + token + ' is not set' for token in tokens])
-
-# Map distro features to config settings
-def features_to_uclibc_settings(d):
- cnf, rem = ([], [])
- distro_features = d.getVar('DISTRO_FEATURES', True).split()
- uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem)
- uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem)
- uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem)
- uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem)
- uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem)
- uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem)
- uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem)
- uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem)
- uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem)
- return "\n".join(cnf), "\n".join(rem)
-# X, Y = ${@features_to_uclibc_settings(d)}
-# unfortunately doesn't seem to work with bitbake, workaround:
-def features_to_uclibc_conf(d):
- cnf, rem = features_to_uclibc_settings(d)
- return cnf
-def features_to_uclibc_del(d):
- cnf, rem = features_to_uclibc_settings(d)
- return rem
-
-# returns all the elements from the src uri that are .cfg files
-def find_cfgs(d):
- sources=src_patches(d, True)
- sources_list=[]
- for s in sources:
- if s.endswith('.cfg'):
- sources_list.append(s)
-
- return sources_list
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
deleted file mode 100644
index 14a577f432..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-SRCREV = "ca1c74d67dd115d059a875150e10b8560a9c35a8"
-
-PV = "0.9.33+git${SRCPV}"
-
-FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:"
-
-SRC_URI = "git://uclibc.org/uClibc.git;branch=master \
- file://uClibc.machine \
- file://uClibc.distro \
- file://obstack.cfg \
- file://locale.cfg \
- file://0001-Disable-lrount_tes-function.patch \
- file://0002-Add-implementation-for-copysignl-for-ppc.patch \
- file://0003-Add-argp-implementation.patch \
- file://0004-Dont-support-localised-optimizations-this-helps-to-h.patch \
- file://0005-Always-use-O2-for-compiling-fork.c.patch \
- file://0006-ldso-limited-support-for-ORIGIN-in-rpath.patch \
- file://0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \
-"
-S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Disable-lrount_tes-function.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Disable-lrount_tes-function.patch
deleted file mode 100644
index 506f146a79..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0001-Disable-lrount_tes-function.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 14b865b3438d0df29b4969148678d8fa8943e1ef Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 16 Aug 2015 20:49:33 -0700
-Subject: [PATCH 1/7] Disable lrount_tes() function
-
-Its not used anyway, avoids some strict compiler warnings
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- test/math/libm-test.inc | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc
-index f50b48b..6d70a95 100644
---- a/test/math/libm-test.inc
-+++ b/test/math/libm-test.inc
-@@ -3470,7 +3470,6 @@ logb_test (void)
- }
-
-
--#if 0
- static void
- lround_test (void)
- {
-@@ -3605,7 +3604,6 @@ llround_test (void)
-
- END (llround);
- }
--#endif
-
- static void
- modf_test (void)
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0002-Add-implementation-for-copysignl-for-ppc.patch b/meta/recipes-core/uclibc/uclibc-git/0002-Add-implementation-for-copysignl-for-ppc.patch
deleted file mode 100644
index d4275c997e..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0002-Add-implementation-for-copysignl-for-ppc.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From 5d362074e5975b150a35bcfa77eab1bfa4e30de7 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 16 Aug 2015 20:50:56 -0700
-Subject: [PATCH 2/7] Add implementation for copysignl for ppc
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- libc/sysdeps/linux/powerpc/Makefile.arch | 2 +-
- libc/sysdeps/linux/powerpc/copysignl.c | 89 ++++++++++++++++++++++++++++++++
- 2 files changed, 90 insertions(+), 1 deletion(-)
- create mode 100644 libc/sysdeps/linux/powerpc/copysignl.c
-
-diff --git a/libc/sysdeps/linux/powerpc/Makefile.arch b/libc/sysdeps/linux/powerpc/Makefile.arch
-index 4fbcb11..7c09c87 100644
---- a/libc/sysdeps/linux/powerpc/Makefile.arch
-+++ b/libc/sysdeps/linux/powerpc/Makefile.arch
-@@ -5,7 +5,7 @@
- # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- #
-
--CSRC-y := __syscall_error.c ioctl.c
-+CSRC-y := __syscall_error.c ioctl.c copysignl.c
-
- SSRC-y := \
- __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
-diff --git a/libc/sysdeps/linux/powerpc/copysignl.c b/libc/sysdeps/linux/powerpc/copysignl.c
-new file mode 100644
-index 0000000..000f653
---- /dev/null
-+++ b/libc/sysdeps/linux/powerpc/copysignl.c
-@@ -0,0 +1,89 @@
-+/* s_copysignl.c -- long double version of s_copysign.c.
-+ * Conversion to long double by Ulrich Drepper,
-+ * Cygnus Support, drepper@cygnus.com.
-+ */
-+
-+/*
-+ * ====================================================
-+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-+ *
-+ * Developed at SunPro, a Sun Microsystems, Inc. business.
-+ * Permission to use, copy, modify, and distribute this
-+ * software is freely granted, provided that this notice
-+ * is preserved.
-+ * ====================================================
-+ */
-+
-+/*
-+ * copysignl(long double x, long double y)
-+ * copysignl(x,y) returns a value with the magnitude of x and
-+ * with the sign bit of y.
-+ */
-+
-+#include <endian.h>
-+#include <stdint.h>
-+
-+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
-+
-+typedef union
-+{
-+ long double value;
-+ struct
-+ {
-+ int sign_exponent:16;
-+ unsigned int empty:16;
-+ uint32_t msw;
-+ uint32_t lsw;
-+ } parts;
-+} ieee_long_double_shape_type;
-+
-+#endif
-+
-+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
-+
-+typedef union
-+{
-+ long double value;
-+ struct
-+ {
-+ uint32_t lsw;
-+ uint32_t msw;
-+ int sign_exponent:16;
-+ unsigned int empty:16;
-+ } parts;
-+} ieee_long_double_shape_type;
-+
-+#endif
-+
-+/* Get int from the exponent of a long double. */
-+
-+#define GET_LDOUBLE_EXP(exp,d) \
-+do { \
-+ ieee_long_double_shape_type ge_u; \
-+ ge_u.value = (d); \
-+ (exp) = ge_u.parts.sign_exponent; \
-+} while (0)
-+
-+/* Set exponent of a long double from an int. */
-+
-+#define SET_LDOUBLE_EXP(d,exp) \
-+do { \
-+ ieee_long_double_shape_type se_u; \
-+ se_u.value = (d); \
-+ se_u.parts.sign_exponent = (exp); \
-+ (d) = se_u.value; \
-+} while (0)
-+
-+long double copysignl(long double x, long double y);
-+libc_hidden_proto(copysignl);
-+
-+long double copysignl(long double x, long double y)
-+{
-+ uint32_t es1,es2;
-+ GET_LDOUBLE_EXP(es1,x);
-+ GET_LDOUBLE_EXP(es2,y);
-+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
-+ return x;
-+}
-+
-+libc_hidden_def(copysignl);
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch b/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
deleted file mode 100644
index ee9448337c..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0003-Add-argp-implementation.patch
+++ /dev/null
@@ -1,5811 +0,0 @@
-From eaae816fb22929469aa4cc3402b91b512fc69549 Mon Sep 17 00:00:00 2001
-From: Salvatore Cro <salvatore.cro@st.com>
-Date: Sun, 16 Aug 2015 20:53:37 -0700
-Subject: [PATCH 3/7] Add argp implementation
-
-Argp is an advanced support for parsing unix-style argument vectors.
-In addition to the common getopt interface, it provides automatic
-response
-to `--help' and `--version' options and use of custom parser in
-conjunction
-with argp native option parser, among others.
-Argp support is required by elfutils package and prelink.
-
-In uClibc argp functionalities has been moved from C library to
-libuargp.so
-Further the libc.so linker script contains an AS_NEEDED entry so that
-it doesn't need to link libuargp.so explicitely.
-
-Signed-off-by: Salvatore Cro <salvatore.cro@st.com>
-Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
-Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- Makefile.in | 9 +
- Makerules | 7 +-
- Rules.mak | 13 +
- extra/Configs/Config.in | 17 +
- include/argp.h | 566 ++++++++
- libc/sysdeps/linux/common/bits/getopt_int.h | 136 ++
- libc/unistd/getopt.c | 19 +-
- libuargp/Makefile | 14 +
- libuargp/Makefile.in | 73 ++
- libuargp/argp-ba.c | 26 +
- libuargp/argp-eexst.c | 32 +
- libuargp/argp-fmtstream.c | 439 +++++++
- libuargp/argp-fmtstream.h | 314 +++++
- libuargp/argp-fs-xinl.c | 44 +
- libuargp/argp-help.c | 1882 +++++++++++++++++++++++++++
- libuargp/argp-parse.c | 949 ++++++++++++++
- libuargp/argp-pv.c | 25 +
- libuargp/argp-pvh.c | 32 +
- libuargp/argp-xinl.c | 35 +
- test/argp/Makefile | 7 +
- test/argp/Makefile.in | 12 +
- test/argp/argp-ex1.c | 15 +
- test/argp/argp-ex2.c | 45 +
- test/argp/argp-ex3.c | 153 +++
- test/argp/argp-ex4.c | 167 +++
- test/argp/argp-test.c | 209 +++
- test/argp/bug-argp1.c | 26 +
- test/argp/tst-argp1.c | 118 ++
- test/argp/tst-argp2.c | 101 ++
- 29 files changed, 5481 insertions(+), 4 deletions(-)
- create mode 100644 include/argp.h
- create mode 100644 libc/sysdeps/linux/common/bits/getopt_int.h
- create mode 100644 libuargp/Makefile
- create mode 100644 libuargp/Makefile.in
- create mode 100644 libuargp/argp-ba.c
- create mode 100644 libuargp/argp-eexst.c
- create mode 100644 libuargp/argp-fmtstream.c
- create mode 100644 libuargp/argp-fmtstream.h
- create mode 100644 libuargp/argp-fs-xinl.c
- create mode 100644 libuargp/argp-help.c
- create mode 100644 libuargp/argp-parse.c
- create mode 100644 libuargp/argp-pv.c
- create mode 100644 libuargp/argp-pvh.c
- create mode 100644 libuargp/argp-xinl.c
- create mode 100644 test/argp/Makefile
- create mode 100644 test/argp/Makefile.in
- create mode 100644 test/argp/argp-ex1.c
- create mode 100644 test/argp/argp-ex2.c
- create mode 100644 test/argp/argp-ex3.c
- create mode 100644 test/argp/argp-ex4.c
- create mode 100644 test/argp/argp-test.c
- create mode 100644 test/argp/bug-argp1.c
- create mode 100644 test/argp/tst-argp1.c
- create mode 100644 test/argp/tst-argp2.c
-
-diff --git a/Makefile.in b/Makefile.in
-index 04671a4..a450af9 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -39,6 +39,7 @@ include $(top_srcdir)libresolv/Makefile.in
- include $(top_srcdir)libutil/Makefile.in
- include $(top_srcdir)libpthread/Makefile.in
- include $(top_srcdir)librt/Makefile.in
-+include $(top_srcdir)libuargp/Makefile.in
- include $(top_srcdir)libubacktrace/Makefile.in
-
- # last included to catch all the objects added by others (locales/threads)
-@@ -262,6 +263,7 @@ HEADERS_RM- += sgtty.h
- endif
- HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h
- HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h
-+HEADERS_RM-$(UCLIBC_HAS_ARGP) += argp.h
- HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h
- HEADERS_RM-$(UCLIBC_HAS_CRYPT) += crypt.h
- HEADERS_RM-$(UCLIBC_HAS_EPOLL) += sys/epoll.h
-@@ -386,6 +388,13 @@ else
- -$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
- endif
- echo "$(UBACKTRACE_ASNEEDED)" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so
-+ifeq ($(UCLIBC_HAS_ARGP),y)
-+# Add the AS_NEEDED entry for libuargp.so
-+ if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \
-+ echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
-+ fi
-+endif
-+
- ifeq ($(UCLIBC_HAS_THREADS),y)
- ifneq ($(LINUXTHREADS_OLD),y)
- ifeq ($(HARDWIRED_ABSPATH),y)
-diff --git a/Makerules b/Makerules
-index d6f7e24..e70050d 100644
---- a/Makerules
-+++ b/Makerules
-@@ -48,6 +48,7 @@ $(eval $(call add_IS_IN_lib,libresolv,$(libresolv-a-y) $(libresolv-so-y)))
- $(eval $(call add_IS_IN_lib,librt,$(librt-a-y) $(librt-so-y)))
- $(eval $(call add_IS_IN_lib,libutil,$(libutil-a-y) $(libutil-so-y)))
- $(eval $(call add_IS_IN_lib,libubacktrace,$(libubacktrace-a-y) $(libubacktrace-so-y)))
-+$(eval $(call add_IS_IN_lib,libuargp,$(libuargp-a-y) $(libuargp-so-y)))
-
- shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
- $(libcrypt-so-y) $(libdl-so-y) \
-@@ -55,12 +56,12 @@ shared_objs = $(libc-y:.o=.os) $(libc-shared-y) $(libc-nonshared-y) \
- $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
- $(libresolv-so-y) $(librt-so-y) \
- $(ldso-y) \
-- $(libutil-so-y) $(libubacktrace-so-y)
-+ $(libutil-so-y) $(libubacktrace-so-y) $(libuargp-so-y)
-
- ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
- $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
- $(libpthread-a-y) $(libthread_db-a-y) \
-- $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
-+ $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) $(libuargp-a-y)
- ifeq ($(DOPIC),y)
- ar_objs := $(ar_objs:.o=.os)
- endif
-@@ -498,7 +499,7 @@ files.dep := $(libc-a-y) $(libc-so-y) $(libc-nonshared-y) \
- $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
- $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
- $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
-- $(libubacktrace-a-y) $(libubacktrace-so-y)
-+ $(libubacktrace-a-y) $(libubacktrace-so-y) $(libuargp-so-y) $(libuargp-a-y)
- .depends.dep := \
- $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
- $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
-diff --git a/Rules.mak b/Rules.mak
-index de9ffb3..a2baf58 100644
---- a/Rules.mak
-+++ b/Rules.mak
-@@ -602,6 +602,19 @@ export UBACKTRACE_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --
- else
- export UBACKTRACE_ASNEEDED:=""
- endif
-+ifeq ($(UCLIBC_HAS_ARGP),y)
-+ifeq ($(HARDWIRED_ABSPATH),y)
-+# Only used in installed libc.so linker script
-+UARGP_FULL_NAME := $(subst //,/,$(RUNTIME_PREFIX)$(MULTILIB_DIR)/libuargp.so.$(MAJOR_VERSION))
-+else
-+UARGP_FULL_NAME := libuargp.so.$(MAJOR_VERSION)
-+endif
-+export UARGP_ASNEEDED:=$(shell $(CC) -Wl,--help 2>/dev/null | grep -q -- --as-needed && \
-+ echo "GROUP ( AS_NEEDED ( $(UARGP_FULL_NAME) ) )" || \
-+ echo "GROUP ( $(UARGP_FULL_NAME) )")
-+else
-+export UARGP_ASNEEDED:=""
-+endif
- endif
-
- # Add a bunch of extra pedantic annoyingly strict checks
-diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
-index 242e45a..b36d4c9 100644
---- a/extra/Configs/Config.in
-+++ b/extra/Configs/Config.in
-@@ -1943,6 +1943,23 @@ config UCLIBC_HAS_GNU_GETSUBOPT
- Answer Y if you want to include getsubopt().
-
- Most people will answer Y.
-+
-+config UCLIBC_HAS_ARGP
-+ bool "Support argp (as standalone shared object)"
-+ default n
-+ help
-+ Argp is an interface for parsing unix-style argument vectors. Unlike
-+ the common getopt interface, it provides many advanced features in
-+ addition to parsing options, such as automatic output in response to
-+ `--help' and `--version' options.
-+ A library can export an argp option parser, which programs can easily
-+ use in conjunction with their own option parser.
-+ A new shared object "libuargp" is created. The "libc.so" linker script
-+ contains the AS_NEEDED entry for getting the libuargp linked automatically.
-+ Argp support is needed by elfutils libdw.
-+
-+ Most people can safely answer N.
-+
- endmenu
-
-
-diff --git a/include/argp.h b/include/argp.h
-new file mode 100644
-index 0000000..9d53728
---- /dev/null
-+++ b/include/argp.h
-@@ -0,0 +1,566 @@
-+/* Hierarchial argument parsing, layered over getopt.
-+ Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifndef _ARGP_H
-+#define _ARGP_H
-+
-+#include <stdio.h>
-+#include <ctype.h>
-+#include <limits.h>
-+
-+#define __need_error_t
-+#include <errno.h>
-+
-+#ifndef __const
-+# define __const const
-+#endif
-+
-+#ifndef __THROW
-+# define __THROW
-+#endif
-+#ifndef __NTH
-+# define __NTH(fct) fct __THROW
-+#endif
-+
-+#ifndef __attribute__
-+/* This feature is available in gcc versions 2.5 and later. */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
-+# define __attribute__(Spec) /* empty */
-+# endif
-+/* The __-protected variants of `format' and `printf' attributes
-+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
-+# define __format__ format
-+# define __printf__ printf
-+# endif
-+#endif
-+
-+/* GCC 2.95 and later have "__restrict"; C99 compilers have
-+ "restrict", and "configure" may have defined "restrict". */
-+#ifndef __restrict
-+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
-+# if defined restrict || 199901L <= __STDC_VERSION__
-+# define __restrict restrict
-+# else
-+# define __restrict
-+# endif
-+# endif
-+#endif
-+
-+#ifndef __error_t_defined
-+typedef int error_t;
-+# define __error_t_defined
-+#endif
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/* A description of a particular option. A pointer to an array of
-+ these is passed in the OPTIONS field of an argp structure. Each option
-+ entry can correspond to one long option and/or one short option; more
-+ names for the same option can be added by following an entry in an option
-+ array with options having the OPTION_ALIAS flag set. */
-+struct argp_option
-+{
-+ /* The long option name. For more than one name for the same option, you
-+ can use following options with the OPTION_ALIAS flag set. */
-+ __const char *name;
-+
-+ /* What key is returned for this option. If > 0 and printable, then it's
-+ also accepted as a short option. */
-+ int key;
-+
-+ /* If non-NULL, this is the name of the argument associated with this
-+ option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
-+ __const char *arg;
-+
-+ /* OPTION_ flags. */
-+ int flags;
-+
-+ /* The doc string for this option. If both NAME and KEY are 0, This string
-+ will be printed outdented from the normal option column, making it
-+ useful as a group header (it will be the first thing printed in its
-+ group); in this usage, it's conventional to end the string with a `:'. */
-+ __const char *doc;
-+
-+ /* The group this option is in. In a long help message, options are sorted
-+ alphabetically within each group, and the groups presented in the order
-+ 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with
-+ if this field 0 will inherit the group number of the previous entry, or
-+ zero if it's the first one, unless its a group header (NAME and KEY both
-+ 0), in which case, the previous entry + 1 is the default. Automagic
-+ options such as --help are put into group -1. */
-+ int group;
-+};
-+
-+/* The argument associated with this option is optional. */
-+#define OPTION_ARG_OPTIONAL 0x1
-+
-+/* This option isn't displayed in any help messages. */
-+#define OPTION_HIDDEN 0x2
-+
-+/* This option is an alias for the closest previous non-alias option. This
-+ means that it will be displayed in the same help entry, and will inherit
-+ fields other than NAME and KEY from the aliased option. */
-+#define OPTION_ALIAS 0x4
-+
-+/* This option isn't actually an option (and so should be ignored by the
-+ actual option parser), but rather an arbitrary piece of documentation that
-+ should be displayed in much the same manner as the options. If this flag
-+ is set, then the option NAME field is displayed unmodified (e.g., no `--'
-+ prefix is added) at the left-margin (where a *short* option would normally
-+ be displayed), and the documentation string in the normal place. For
-+ purposes of sorting, any leading whitespace and punctuation is ignored,
-+ except that if the first non-whitespace character is not `-', this entry
-+ is displayed after all options (and OPTION_DOC entries with a leading `-')
-+ in the same group. */
-+#define OPTION_DOC 0x8
-+
-+/* This option shouldn't be included in `long' usage messages (but is still
-+ included in help messages). This is mainly intended for options that are
-+ completely documented in an argp's ARGS_DOC field, in which case including
-+ the option in the generic usage list would be redundant. For instance,
-+ if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
-+ distinguish these two cases, -x should probably be marked
-+ OPTION_NO_USAGE. */
-+#define OPTION_NO_USAGE 0x10
-+
-+struct argp; /* fwd declare this type */
-+struct argp_state; /* " */
-+struct argp_child; /* " */
-+
-+/* The type of a pointer to an argp parsing function. */
-+typedef error_t (*argp_parser_t) (int __key, char *__arg,
-+ struct argp_state *__state);
-+
-+/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
-+ returns will simply be ignored. For user keys, this error will be turned
-+ into EINVAL (if the call to argp_parse is such that errors are propagated
-+ back to the user instead of exiting); returning EINVAL itself would result
-+ in an immediate stop to parsing in *all* cases. */
-+#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */
-+
-+/* Special values for the KEY argument to an argument parsing function.
-+ ARGP_ERR_UNKNOWN should be returned if they aren't understood.
-+
-+ The sequence of keys to a parsing function is either (where each
-+ uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
-+
-+ INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all
-+ or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed
-+ or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized
-+
-+ The third case is where every parser returned ARGP_KEY_UNKNOWN for an
-+ argument, in which case parsing stops at that argument (returning the
-+ unparsed arguments to the caller of argp_parse if requested, or stopping
-+ with an error message if not).
-+
-+ If an error occurs (either detected by argp, or because the parsing
-+ function returned an error value), then the parser is called with
-+ ARGP_KEY_ERROR, and no further calls are made. */
-+
-+/* This is not an option at all, but rather a command line argument. If a
-+ parser receiving this key returns success, the fact is recorded, and the
-+ ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the
-+ argument, a parser function decrements the NEXT field of the state it's
-+ passed, the option won't be considered processed; this is to allow you to
-+ actually modify the argument (perhaps into an option), and have it
-+ processed again. */
-+#define ARGP_KEY_ARG 0
-+/* There are remaining arguments not parsed by any parser, which may be found
-+ starting at (STATE->argv + STATE->next). If success is returned, but
-+ STATE->next left untouched, it's assumed that all arguments were consume,
-+ otherwise, the parser should adjust STATE->next to reflect any arguments
-+ consumed. */
-+#define ARGP_KEY_ARGS 0x1000006
-+/* There are no more command line arguments at all. */
-+#define ARGP_KEY_END 0x1000001
-+/* Because it's common to want to do some special processing if there aren't
-+ any non-option args, user parsers are called with this key if they didn't
-+ successfully process any non-option arguments. Called just before
-+ ARGP_KEY_END (where more general validity checks on previously parsed
-+ arguments can take place). */
-+#define ARGP_KEY_NO_ARGS 0x1000002
-+/* Passed in before any parsing is done. Afterwards, the values of each
-+ element of the CHILD_INPUT field, if any, in the state structure is
-+ copied to each child's state to be the initial value of the INPUT field. */
-+#define ARGP_KEY_INIT 0x1000003
-+/* Use after all other keys, including SUCCESS & END. */
-+#define ARGP_KEY_FINI 0x1000007
-+/* Passed in when parsing has successfully been completed (even if there are
-+ still arguments remaining). */
-+#define ARGP_KEY_SUCCESS 0x1000004
-+/* Passed in if an error occurs. */
-+#define ARGP_KEY_ERROR 0x1000005
-+
-+/* An argp structure contains a set of options declarations, a function to
-+ deal with parsing one, documentation string, a possible vector of child
-+ argp's, and perhaps a function to filter help output. When actually
-+ parsing options, getopt is called with the union of all the argp
-+ structures chained together through their CHILD pointers, with conflicts
-+ being resolved in favor of the first occurrence in the chain. */
-+struct argp
-+{
-+ /* An array of argp_option structures, terminated by an entry with both
-+ NAME and KEY having a value of 0. */
-+ __const struct argp_option *options;
-+
-+ /* What to do with an option from this structure. KEY is the key
-+ associated with the option, and ARG is any associated argument (NULL if
-+ none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be
-+ returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
-+ parsing is stopped immediately, and that value is returned from
-+ argp_parse(). For special (non-user-supplied) values of KEY, see the
-+ ARGP_KEY_ definitions below. */
-+ argp_parser_t parser;
-+
-+ /* A string describing what other arguments are wanted by this program. It
-+ is only used by argp_usage to print the `Usage:' message. If it
-+ contains newlines, the strings separated by them are considered
-+ alternative usage patterns, and printed on separate lines (lines after
-+ the first are prefix by ` or: ' instead of `Usage:'). */
-+ __const char *args_doc;
-+
-+ /* If non-NULL, a string containing extra text to be printed before and
-+ after the options in a long help message (separated by a vertical tab
-+ `\v' character). */
-+ __const char *doc;
-+
-+ /* A vector of argp_children structures, terminated by a member with a 0
-+ argp field, pointing to child argps should be parsed with this one. Any
-+ conflicts are resolved in favor of this argp, or early argps in the
-+ CHILDREN list. This field is useful if you use libraries that supply
-+ their own argp structure, which you want to use in conjunction with your
-+ own. */
-+ __const struct argp_child *children;
-+
-+ /* If non-zero, this should be a function to filter the output of help
-+ messages. KEY is either a key from an option, in which case TEXT is
-+ that option's help text, or a special key from the ARGP_KEY_HELP_
-+ defines, below, describing which other help text TEXT is. The function
-+ should return either TEXT, if it should be used as-is, a replacement
-+ string, which should be malloced, and will be freed by argp, or NULL,
-+ meaning `print nothing'. The value for TEXT is *after* any translation
-+ has been done, so if any of the replacement text also needs translation,
-+ that should be done by the filter function. INPUT is either the input
-+ supplied to argp_parse, or NULL, if argp_help was called directly. */
-+ char *(*help_filter) (int __key, __const char *__text, void *__input);
-+
-+ /* If non-zero the strings used in the argp library are translated using
-+ the domain described by this string. Otherwise the currently installed
-+ default domain is used. */
-+ const char *argp_domain;
-+};
-+
-+/* Possible KEY arguments to a help filter function. */
-+#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */
-+#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */
-+#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */
-+#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation;
-+ TEXT is NULL for this key. */
-+/* Explanatory note emitted when duplicate option arguments have been
-+ suppressed. */
-+#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
-+#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
-+
-+/* When an argp has a non-zero CHILDREN field, it should point to a vector of
-+ argp_child structures, each of which describes a subsidiary argp. */
-+struct argp_child
-+{
-+ /* The child parser. */
-+ __const struct argp *argp;
-+
-+ /* Flags for this child. */
-+ int flags;
-+
-+ /* If non-zero, an optional header to be printed in help output before the
-+ child options. As a side-effect, a non-zero value forces the child
-+ options to be grouped together; to achieve this effect without actually
-+ printing a header string, use a value of "". */
-+ __const char *header;
-+
-+ /* Where to group the child options relative to the other (`consolidated')
-+ options in the parent argp; the values are the same as the GROUP field
-+ in argp_option structs, but all child-groupings follow parent options at
-+ a particular group level. If both this field and HEADER are zero, then
-+ they aren't grouped at all, but rather merged with the parent options
-+ (merging the child's grouping levels with the parents). */
-+ int group;
-+};
-+
-+/* Parsing state. This is provided to parsing functions called by argp,
-+ which may examine and, as noted, modify fields. */
-+struct argp_state
-+{
-+ /* The top level ARGP being parsed. */
-+ __const struct argp *root_argp;
-+
-+ /* The argument vector being parsed. May be modified. */
-+ int argc;
-+ char **argv;
-+
-+ /* The index in ARGV of the next arg that to be parsed. May be modified. */
-+ int next;
-+
-+ /* The flags supplied to argp_parse. May be modified. */
-+ unsigned flags;
-+
-+ /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
-+ number of the current arg, starting at zero, and incremented after each
-+ such call returns. At all other times, this is the number of such
-+ arguments that have been processed. */
-+ unsigned arg_num;
-+
-+ /* If non-zero, the index in ARGV of the first argument following a special
-+ `--' argument (which prevents anything following being interpreted as an
-+ option). Only set once argument parsing has proceeded past this point. */
-+ int quoted;
-+
-+ /* An arbitrary pointer passed in from the user. */
-+ void *input;
-+ /* Values to pass to child parsers. This vector will be the same length as
-+ the number of children for the current parser. */
-+ void **child_inputs;
-+
-+ /* For the parser's use. Initialized to 0. */
-+ void *hook;
-+
-+ /* The name used when printing messages. This is initialized to ARGV[0],
-+ or PROGRAM_INVOCATION_NAME if that is unavailable. */
-+ char *name;
-+
-+ /* Streams used when argp prints something. */
-+ FILE *err_stream; /* For errors; initialized to stderr. */
-+ FILE *out_stream; /* For information; initialized to stdout. */
-+
-+ void *pstate; /* Private, for use by argp. */
-+};
-+
-+/* Flags for argp_parse (note that the defaults are those that are
-+ convenient for program command line parsing): */
-+
-+/* Don't ignore the first element of ARGV. Normally (and always unless
-+ ARGP_NO_ERRS is set) the first element of the argument vector is
-+ skipped for option parsing purposes, as it corresponds to the program name
-+ in a command line. */
-+#define ARGP_PARSE_ARGV0 0x01
-+
-+/* Don't print error messages for unknown options to stderr; unless this flag
-+ is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
-+ name in the error messages. This flag implies ARGP_NO_EXIT (on the
-+ assumption that silent exiting upon errors is bad behaviour). */
-+#define ARGP_NO_ERRS 0x02
-+
-+/* Don't parse any non-option args. Normally non-option args are parsed by
-+ calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
-+ as the value. Since it's impossible to know which parse function wants to
-+ handle it, each one is called in turn, until one returns 0 or an error
-+ other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
-+ argp_parse returns prematurely (but with a return value of 0). If all
-+ args have been parsed without error, all parsing functions are called one
-+ last time with a key of ARGP_KEY_END. This flag needn't normally be set,
-+ as the normal behavior is to stop parsing as soon as some argument can't
-+ be handled. */
-+#define ARGP_NO_ARGS 0x04
-+
-+/* Parse options and arguments in the same order they occur on the command
-+ line -- normally they're rearranged so that all options come first. */
-+#define ARGP_IN_ORDER 0x08
-+
-+/* Don't provide the standard long option --help, which causes usage and
-+ option help information to be output to stdout, and exit (0) called. */
-+#define ARGP_NO_HELP 0x10
-+
-+/* Don't exit on errors (they may still result in error messages). */
-+#define ARGP_NO_EXIT 0x20
-+
-+/* Use the gnu getopt `long-only' rules for parsing arguments. */
-+#define ARGP_LONG_ONLY 0x40
-+
-+/* Turns off any message-printing/exiting options. */
-+#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
-+
-+/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
-+ FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the
-+ index in ARGV of the first unparsed option is returned in it. If an
-+ unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
-+ routine returned a non-zero value, it is returned; otherwise 0 is
-+ returned. This function may also call exit unless the ARGP_NO_HELP flag
-+ is set. INPUT is a pointer to a value to be passed in to the parser. */
-+extern error_t argp_parse (__const struct argp *__restrict __argp,
-+ int __argc, char **__restrict __argv,
-+ unsigned __flags, int *__restrict __arg_index,
-+ void *__restrict __input);
-+
-+/* Global variables. */
-+
-+/* If defined or set by the user program to a non-zero value, then a default
-+ option --version is added (unless the ARGP_NO_HELP flag is used), which
-+ will print this string followed by a newline and exit (unless the
-+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
-+extern __const char *argp_program_version;
-+
-+/* If defined or set by the user program to a non-zero value, then a default
-+ option --version is added (unless the ARGP_NO_HELP flag is used), which
-+ calls this function with a stream to print the version to and a pointer to
-+ the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
-+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
-+extern void (*argp_program_version_hook) (FILE *__restrict __stream,
-+ struct argp_state *__restrict
-+ __state);
-+
-+/* If defined or set by the user program, it should point to string that is
-+ the bug-reporting address for the program. It will be printed by
-+ argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
-+ standard help messages), embedded in a sentence that says something like
-+ `Report bugs to ADDR.'. */
-+extern __const char *argp_program_bug_address;
-+
-+/* The exit status that argp will use when exiting due to a parsing error.
-+ If not defined or set by the user program, this defaults to EX_USAGE from
-+ <sysexits.h>. */
-+extern error_t argp_err_exit_status;
-+
-+/* Flags for argp_help. */
-+#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
-+#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
-+#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */
-+#define ARGP_HELP_LONG 0x08 /* a long help message. */
-+#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */
-+#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */
-+#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
-+#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */
-+#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to
-+ reflect ARGP_LONG_ONLY mode. */
-+
-+/* These ARGP_HELP flags are only understood by argp_state_help. */
-+#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */
-+#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */
-+
-+/* The standard thing to do after a program command line parsing error, if an
-+ error message has already been printed. */
-+#define ARGP_HELP_STD_ERR \
-+ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
-+/* The standard thing to do after a program command line parsing error, if no
-+ more specific error message has been printed. */
-+#define ARGP_HELP_STD_USAGE \
-+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
-+/* The standard thing to do in response to a --help option. */
-+#define ARGP_HELP_STD_HELP \
-+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
-+ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
-+
-+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
-+ ARGP_HELP_*. */
-+extern void argp_help (__const struct argp *__restrict __argp,
-+ FILE *__restrict __stream,
-+ unsigned __flags, char *__restrict __name);
-+
-+/* The following routines are intended to be called from within an argp
-+ parsing routine (thus taking an argp_state structure as the first
-+ argument). They may or may not print an error message and exit, depending
-+ on the flags in STATE -- in any case, the caller should be prepared for
-+ them *not* to exit, and should return an appropiate error after calling
-+ them. [argp_usage & argp_error should probably be called argp_state_...,
-+ but they're used often enough that they should be short] */
-+
-+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
-+ from the set ARGP_HELP_*. */
-+extern void argp_state_help (__const struct argp_state *__restrict __state,
-+ FILE *__restrict __stream,
-+ unsigned int __flags);
-+/* Possibly output the standard usage message for ARGP to stderr and exit. */
-+extern void argp_usage (__const struct argp_state *__state);
-+
-+/* If appropriate, print the printf string FMT and following args, preceded
-+ by the program name and `:', to stderr, and followed by a `Try ... --help'
-+ message, then exit (1). */
-+extern void argp_error (__const struct argp_state *__restrict __state,
-+ __const char *__restrict __fmt, ...)
-+ __attribute__ ((__format__ (__printf__, 2, 3)));
-+/* Similar to the standard gnu error-reporting function error(), but will
-+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
-+ to STATE->err_stream. This is useful for argument parsing code that is
-+ shared between program startup (when exiting is desired) and runtime
-+ option parsing (when typically an error code is returned instead). The
-+ difference between this function and argp_error is that the latter is for
-+ *parsing errors*, and the former is for other problems that occur during
-+ parsing but don't reflect a (syntactic) problem with the input. */
-+extern void argp_failure (__const struct argp_state *__restrict __state,
-+ int __status, int __errnum,
-+ __const char *__restrict __fmt, ...)
-+ __attribute__ ((__format__ (__printf__, 4, 5)));
-+/* Returns true if the option OPT is a valid short option. */
-+extern int _option_is_short (__const struct argp_option *__opt) __THROW;
-+extern int __option_is_short (__const struct argp_option *__opt) __THROW;
-+
-+/* Returns true if the option OPT is in fact the last (unused) entry in an
-+ options array. */
-+extern int _option_is_end (__const struct argp_option *__opt) __THROW;
-+extern int __option_is_end (__const struct argp_option *__opt) __THROW;
-+
-+/* Return the input field for ARGP in the parser corresponding to STATE; used
-+ by the help routines. */
-+/* We think this should not be exported */
-+extern void *__argp_input (__const struct argp *__restrict __argp,
-+ __const struct argp_state *__restrict __state)
-+ __THROW;
-+
-+#ifdef __USE_EXTERN_INLINES
-+
-+# ifndef ARGP_EI
-+# define ARGP_EI __extern_inline
-+# endif
-+
-+ARGP_EI void
-+argp_usage (__const struct argp_state *__state)
-+{
-+ argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
-+}
-+
-+ARGP_EI int
-+__NTH (__option_is_short (__const struct argp_option *__opt))
-+{
-+ if (__opt->flags & OPTION_DOC)
-+ return 0;
-+ else
-+ {
-+ int __key = __opt->key;
-+ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
-+ }
-+}
-+
-+ARGP_EI int
-+__NTH (__option_is_end (__const struct argp_option *__opt))
-+{
-+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
-+}
-+#endif /* Use extern inlines. */
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif /* argp.h */
-diff --git a/libc/sysdeps/linux/common/bits/getopt_int.h b/libc/sysdeps/linux/common/bits/getopt_int.h
-new file mode 100644
-index 0000000..291edfe
---- /dev/null
-+++ b/libc/sysdeps/linux/common/bits/getopt_int.h
-@@ -0,0 +1,136 @@
-+/* Internal declarations for getopt.
-+ Copyright (C) 1989-1994,1996-1999,2001,2003,2004
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifndef _GETOPT_INT_H
-+#define _GETOPT_INT_H 1
-+
-+extern int _getopt_internal (int ___argc, char *const *___argv,
-+ const char *__shortopts,
-+ const struct option *__longopts, int *__longind,
-+ int __long_only) attribute_hidden;
-+
-+
-+/* Reentrant versions which can handle parsing multiple argument
-+ vectors at the same time. */
-+
-+/* For __ordering member */
-+enum {
-+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
-+};
-+
-+/* Data type for reentrant functions. */
-+
-+struct _getopt_data
-+{
-+ /* These have exactly the same meaning as the corresponding global
-+ variables, except that they are used for the reentrant
-+ versions of getopt. */
-+ int optind;
-+ int opterr;
-+ char *optarg;
-+ smalluint optopt; /* we store characters here, a byte is enough */
-+
-+ /* Internal members. */
-+
-+ /* True if the internal members have been initialized. */
-+ smallint __initialized;
-+
-+ /* Describe how to deal with options that follow non-option ARGV-elements.
-+
-+ If the caller did not specify anything,
-+ the default is REQUIRE_ORDER if the environment variable
-+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
-+
-+ REQUIRE_ORDER means don't recognize them as options;
-+ stop option processing when the first non-option is seen.
-+ This is what Unix does.
-+ This mode of operation is selected by either setting the environment
-+ variable POSIXLY_CORRECT, or using `+' as the first character
-+ of the list of option characters.
-+
-+ PERMUTE is the default. We permute the contents of ARGV as we
-+ scan, so that eventually all the non-options are at the end.
-+ This allows options to be given in any order, even with programs
-+ that were not written to expect this.
-+
-+ RETURN_IN_ORDER is an option available to programs that were
-+ written to expect options and other ARGV-elements in any order
-+ and that care about the ordering of the two. We describe each
-+ non-option ARGV-element as if it were the argument of an option
-+ with character code 1. Using `-' as the first character of the
-+ list of option characters selects this mode of operation.
-+
-+ The special argument `--' forces an end of option-scanning regardless
-+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
-+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
-+ smallint __ordering;
-+
-+ /* If the POSIXLY_CORRECT environment variable is set. */
-+ smallint __posixly_correct;
-+
-+ /* The next char to be scanned in the option-element
-+ in which the last option character we returned was found.
-+ This allows us to pick up the scan where we left off.
-+
-+ If this is zero, or a null string, it means resume the scan
-+ by advancing to the next ARGV-element. */
-+ char *__nextchar;
-+
-+
-+ /* Handle permutation of arguments. */
-+
-+ /* Describe the part of ARGV that contains non-options that have
-+ been skipped. `first_nonopt' is the index in ARGV of the first
-+ of them; `last_nonopt' is the index after the last of them. */
-+
-+ int __first_nonopt;
-+ int __last_nonopt;
-+
-+#if defined _LIBC && defined USE_NONOPTION_FLAGS
-+ int __nonoption_flags_max_len;
-+ int __nonoption_flags_len;
-+# endif
-+};
-+
-+/* The initializer is necessary to set OPTIND and OPTERR to their
-+ default values and to clear the initialization flag. */
-+#define _GETOPT_DATA_INITIALIZER { 1, 1 }
-+
-+#if 0 /* first is static on uClibc, the others not used */
-+extern int _getopt_internal_r (int ___argc, char *const *___argv,
-+ const char *__shortopts,
-+ const struct option *__longopts, int *__longind,
-+ int __long_only, struct _getopt_data *__data);
-+#endif
-+#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
-+#ifndef __need_getopt
-+extern int _getopt_long_r (int ___argc, char *const *___argv,
-+ const char *__shortopts,
-+ const struct option *__longopts, int *__longind,
-+ struct _getopt_data *__data);
-+
-+extern int _getopt_long_only_r (int ___argc, char *const *___argv,
-+ const char *__shortopts,
-+ const struct option *__longopts,
-+ int *__longind,
-+ struct _getopt_data *__data);
-+#endif
-+#endif
-+#endif /* getopt_int.h */
-diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c
-index f63482b..db5e12c 100644
---- a/libc/unistd/getopt.c
-+++ b/libc/unistd/getopt.c
-@@ -105,7 +105,7 @@
- they can distinguish the relative order of options and other arguments. */
-
- #include <getopt.h>
--#include "getopt_int.h"
-+#include <bits/getopt_int.h>
-
-
- /* For communication from `getopt' to the caller.
-@@ -1170,6 +1170,15 @@ getopt_long (int argc, char *const *argv, const char *options,
- return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
- }
-
-+int
-+_getopt_long_r (int argc, char *const *argv, const char *options,
-+ const struct option *long_options, int *opt_index,
-+ struct _getopt_data *d)
-+{
-+ return _getopt_internal_r (argc, argv, options, long_options, opt_index,
-+ 0, d);
-+}
-+
- /* Like getopt_long, but '-' as well as '--' can indicate a long option.
- If an option that starts with '-' (not '--') doesn't match a long option,
- but does match a short option, it is parsed as a short option
-@@ -1183,4 +1192,12 @@ getopt_long_only (int argc, char *const *argv, const char *options,
- }
- #endif /* __UCLIBC_HAS_GETOPT_LONG__ */
-
-+int
-+_getopt_long_only_r (int argc, char *const *argv, const char *options,
-+ const struct option *long_options, int *opt_index,
-+ struct _getopt_data *d)
-+{
-+ return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d);
-+}
-+
- #endif /* Not ELIDE_CODE. */
-diff --git a/libuargp/Makefile b/libuargp/Makefile
-new file mode 100644
-index 0000000..45acdd9
---- /dev/null
-+++ b/libuargp/Makefile
-@@ -0,0 +1,14 @@
-+# Makefile for uClibc (libuargp)
-+#
-+# Copyright (C) 2010 STMicroelectronics Ltd
-+# Author(s): Filippo Arcidiacono <filippo.arcidiacono at st.com>
-+#
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+top_srcdir=../
-+top_builddir=../
-+include $(top_builddir)Rules.mak
-+all: libs
-+include Makefile.in
-+include $(top_srcdir)Makerules
-diff --git a/libuargp/Makefile.in b/libuargp/Makefile.in
-new file mode 100644
-index 0000000..1498abb
---- /dev/null
-+++ b/libuargp/Makefile.in
-@@ -0,0 +1,73 @@
-+# Makefile for uClibc (libuargp)
-+#
-+# Copyright (C) 2009, 2010 STMicroelectronics Ltd.
-+# Author(s): Salvatore Cro <salvatore.cro at st.com>
-+# - First implementation, embedded into libc
-+# Filippo Arcidiacono <filippo.arcidiacono at st.com>
-+# - Reworked for stand-alone libuargp implementation
-+
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+#
-+
-+CFLAGS-libuargp := -DNOT_IN_libc -DIS_IN_libuargp $(SSP_ALL_CFLAGS)
-+
-+LDFLAGS-libuargp.so := $(LDFLAGS)
-+
-+LIBS-libuargp.so := $(LIBS)
-+
-+libuargp_FULL_NAME := libuargp-$(VERSION).so
-+
-+libuargp_DIR := $(top_srcdir)libuargp
-+libuargp_OUT := $(top_builddir)libuargp
-+
-+libuargp_SRC-y :=
-+libuargp_SRC-$(UCLIBC_HAS_ARGP) := $(addsuffix .c,$(addprefix argp-, ba \
-+ eexst fmtstream fs-xinl help parse pv pvh xinl))
-+
-+CFLAGS-argp-xinl.c = -fgnu89-inline
-+
-+libuargp_SRC := $(addprefix $(libuargp_DIR)/,$(libuargp_SRC-y))
-+libuargp_OBJ := $(patsubst $(libuargp_DIR)/%.c,$(libuargp_OUT)/%.o,$(libuargp_SRC))
-+
-+libuargp_SRCS := $(libuargp_SRC)
-+libuargp_OBJS := $(libuargp_OBJ)
-+
-+ifeq ($(DOPIC),y)
-+libuargp-a-y := $(libuargp_OBJS:.o=.os)
-+else
-+libuargp-a-y := $(libuargp_OBJS)
-+endif
-+libuargp-so-y := $(libuargp_OBJS:.o=.os)
-+
-+lib-a-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.a
-+lib-so-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.so
-+
-+objclean-y += CLEAN_libuargp
-+
-+ifeq ($(DOMULTI),n)
-+ifeq ($(DOPIC),y)
-+$(top_builddir)lib/libuargp.so: $(top_builddir)lib/libuargp.a $(libc.depend)
-+else
-+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp_so.a $(libc.depend)
-+endif
-+ $(call link.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
-+else
-+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp.oS $(libc.depend)
-+ $(call linkm.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
-+endif
-+
-+$(libuargp_OUT)/libuargp_so.a: $(libuargp-so-y)
-+ $(Q)$(RM) $@
-+ $(do_ar)
-+
-+$(libuargp_OUT)/libuargp.oS: $(libuargp_SRCS)
-+ $(Q)$(RM) $@
-+ $(compile-m)
-+
-+$(top_builddir)lib/libuargp.a: $(libuargp-a-y)
-+ $(Q)$(INSTALL) -d $(dir $@)
-+ $(Q)$(RM) $@
-+ $(do_ar)
-+
-+CLEAN_libuargp:
-+ $(do_rm) $(addprefix $(libuargp_OUT)/*., o os oS a)
-diff --git a/libuargp/argp-ba.c b/libuargp/argp-ba.c
-new file mode 100644
-index 0000000..3522b02
---- /dev/null
-+++ b/libuargp/argp-ba.c
-@@ -0,0 +1,26 @@
-+/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
-+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* If set by the user program, it should point to string that is the
-+ bug-reporting address for the program. It will be printed by argp_help if
-+ the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
-+ messages), embedded in a sentence that says something like `Report bugs to
-+ ADDR.'. */
-+const char *argp_program_bug_address;
-diff --git a/libuargp/argp-eexst.c b/libuargp/argp-eexst.c
-new file mode 100644
-index 0000000..445b68d
---- /dev/null
-+++ b/libuargp/argp-eexst.c
-@@ -0,0 +1,32 @@
-+/* Default definition for ARGP_ERR_EXIT_STATUS
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <sysexits.h>
-+
-+#include <argp.h>
-+
-+/* The exit status that argp will use when exiting due to a parsing error.
-+ If not defined or set by the user program, this defaults to EX_USAGE from
-+ <sysexits.h>. */
-+error_t argp_err_exit_status = EX_USAGE;
-diff --git a/libuargp/argp-fmtstream.c b/libuargp/argp-fmtstream.c
-new file mode 100644
-index 0000000..75227f9
---- /dev/null
-+++ b/libuargp/argp-fmtstream.c
-@@ -0,0 +1,439 @@
-+/* Word-wrapping and line-truncating streams
-+ Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+/* This package emulates glibc `line_wrap_stream' semantics for systems that
-+ don't have that. */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <errno.h>
-+#include <stdarg.h>
-+#include <ctype.h>
-+
-+#include "argp-fmtstream.h"
-+
-+#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
-+
-+#ifndef isblank
-+#define isblank(ch) ((ch)==' ' || (ch)=='\t')
-+#endif
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+# include <wchar.h>
-+# include <libio/libioP.h>
-+# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
-+#else
-+# define __vsnprintf(s, l, f, a) vsnprintf (s, l, f, a)
-+#endif
-+
-+#define INIT_BUF_SIZE 200
-+#define PRINTF_SIZE_GUESS 150
-+
-+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
-+ written on it with LMARGIN spaces and limits them to RMARGIN columns
-+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
-+ replacing the whitespace before them with a newline and WMARGIN spaces.
-+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
-+ Returns NULL if there was an error. */
-+argp_fmtstream_t
-+__argp_make_fmtstream (FILE *stream,
-+ size_t lmargin, size_t rmargin, ssize_t wmargin)
-+{
-+ argp_fmtstream_t fs;
-+
-+ fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream));
-+ if (fs != NULL)
-+ {
-+ fs->stream = stream;
-+
-+ fs->lmargin = lmargin;
-+ fs->rmargin = rmargin;
-+ fs->wmargin = wmargin;
-+ fs->point_col = 0;
-+ fs->point_offs = 0;
-+
-+ fs->buf = (char *) malloc (INIT_BUF_SIZE);
-+ if (! fs->buf)
-+ {
-+ free (fs);
-+ fs = 0;
-+ }
-+ else
-+ {
-+ fs->p = fs->buf;
-+ fs->end = fs->buf + INIT_BUF_SIZE;
-+ }
-+ }
-+
-+ return fs;
-+}
-+#if 0
-+/* Not exported. */
-+#ifdef weak_alias
-+weak_alias (__argp_make_fmtstream, argp_make_fmtstream)
-+#endif
-+#endif
-+
-+/* Flush FS to its stream, and free it (but don't close the stream). */
-+void
-+__argp_fmtstream_free (argp_fmtstream_t fs)
-+{
-+ __argp_fmtstream_update (fs);
-+ if (fs->p > fs->buf)
-+ {
-+#ifdef USE_IN_LIBIO
-+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-+#else
-+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
-+#endif
-+ }
-+ free (fs->buf);
-+ free (fs);
-+}
-+#if 0
-+/* Not exported. */
-+#ifdef weak_alias
-+weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
-+#endif
-+#endif
-+
-+/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
-+ end of its buffer. This code is mostly from glibc stdio/linewrap.c. */
-+void
-+__argp_fmtstream_update (argp_fmtstream_t fs)
-+{
-+ char *buf, *nl;
-+ size_t len;
-+
-+ /* Scan the buffer for newlines. */
-+ buf = fs->buf + fs->point_offs;
-+ while (buf < fs->p)
-+ {
-+ size_t r;
-+
-+ if (fs->point_col == 0 && fs->lmargin != 0)
-+ {
-+ /* We are starting a new line. Print spaces to the left margin. */
-+ const size_t pad = fs->lmargin;
-+ if (fs->p + pad < fs->end)
-+ {
-+ /* We can fit in them in the buffer by moving the
-+ buffer text up and filling in the beginning. */
-+ memmove (buf + pad, buf, fs->p - buf);
-+ fs->p += pad; /* Compensate for bigger buffer. */
-+ memset (buf, ' ', pad); /* Fill in the spaces. */
-+ buf += pad; /* Don't bother searching them. */
-+ }
-+ else
-+ {
-+ /* No buffer space for spaces. Must flush. */
-+ size_t i;
-+ for (i = 0; i < pad; i++)
-+ {
-+#ifdef USE_IN_LIBIO
-+ if (_IO_fwide (fs->stream, 0) > 0)
-+ putwc_unlocked (L' ', fs->stream);
-+ else
-+#endif
-+ putc_unlocked (' ', fs->stream);
-+ }
-+ }
-+ fs->point_col = pad;
-+ }
-+
-+ len = fs->p - buf;
-+ nl = memchr (buf, '\n', len);
-+
-+ if (fs->point_col < 0)
-+ fs->point_col = 0;
-+
-+ if (!nl)
-+ {
-+ /* The buffer ends in a partial line. */
-+
-+ if (fs->point_col + len < fs->rmargin)
-+ {
-+ /* The remaining buffer text is a partial line and fits
-+ within the maximum line width. Advance point for the
-+ characters to be written and stop scanning. */
-+ fs->point_col += len;
-+ break;
-+ }
-+ else
-+ /* Set the end-of-line pointer for the code below to
-+ the end of the buffer. */
-+ nl = fs->p;
-+ }
-+ else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
-+ {
-+ /* The buffer contains a full line that fits within the maximum
-+ line width. Reset point and scan the next line. */
-+ fs->point_col = 0;
-+ buf = nl + 1;
-+ continue;
-+ }
-+
-+ /* This line is too long. */
-+ r = fs->rmargin - 1;
-+
-+ if (fs->wmargin < 0)
-+ {
-+ /* Truncate the line by overwriting the excess with the
-+ newline and anything after it in the buffer. */
-+ if (nl < fs->p)
-+ {
-+ memmove (buf + (r - fs->point_col), nl, fs->p - nl);
-+ fs->p -= buf + (r - fs->point_col) - nl;
-+ /* Reset point for the next line and start scanning it. */
-+ fs->point_col = 0;
-+ buf += r + 1; /* Skip full line plus \n. */
-+ }
-+ else
-+ {
-+ /* The buffer ends with a partial line that is beyond the
-+ maximum line width. Advance point for the characters
-+ written, and discard those past the max from the buffer. */
-+ fs->point_col += len;
-+ fs->p -= fs->point_col - r;
-+ break;
-+ }
-+ }
-+ else
-+ {
-+ /* Do word wrap. Go to the column just past the maximum line
-+ width and scan back for the beginning of the word there.
-+ Then insert a line break. */
-+
-+ char *p, *nextline;
-+ int i;
-+
-+ p = buf + (r + 1 - fs->point_col);
-+ while (p >= buf && !isblank (*p))
-+ --p;
-+ nextline = p + 1; /* This will begin the next line. */
-+
-+ if (nextline > buf)
-+ {
-+ /* Swallow separating blanks. */
-+ if (p >= buf)
-+ do
-+ --p;
-+ while (p >= buf && isblank (*p));
-+ nl = p + 1; /* The newline will replace the first blank. */
-+ }
-+ else
-+ {
-+ /* A single word that is greater than the maximum line width.
-+ Oh well. Put it on an overlong line by itself. */
-+ p = buf + (r + 1 - fs->point_col);
-+ /* Find the end of the long word. */
-+ do
-+ ++p;
-+ while (p < nl && !isblank (*p));
-+ if (p == nl)
-+ {
-+ /* It already ends a line. No fussing required. */
-+ fs->point_col = 0;
-+ buf = nl + 1;
-+ continue;
-+ }
-+ /* We will move the newline to replace the first blank. */
-+ nl = p;
-+ /* Swallow separating blanks. */
-+ do
-+ ++p;
-+ while (isblank (*p));
-+ /* The next line will start here. */
-+ nextline = p;
-+ }
-+
-+ /* Note: There are a bunch of tests below for
-+ NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall
-+ at the end of the buffer, and NEXTLINE is in fact empty (and so
-+ we need not be careful to maintain its contents). */
-+
-+ if ((nextline == buf + len + 1
-+ ? fs->end - nl < fs->wmargin + 1
-+ : nextline - (nl + 1) < fs->wmargin)
-+ && fs->p > nextline)
-+ {
-+ /* The margin needs more blanks than we removed. */
-+ if (fs->end - fs->p > fs->wmargin + 1)
-+ /* Make some space for them. */
-+ {
-+ size_t mv = fs->p - nextline;
-+ memmove (nl + 1 + fs->wmargin, nextline, mv);
-+ nextline = nl + 1 + fs->wmargin;
-+ len = nextline + mv - buf;
-+ *nl++ = '\n';
-+ }
-+ else
-+ /* Output the first line so we can use the space. */
-+ {
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ __fxprintf (fs->stream, "%.*s\n",
-+ (int) (nl - fs->buf), fs->buf);
-+#else
-+ if (nl > fs->buf)
-+ fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
-+ putc_unlocked ('\n', fs->stream);
-+#endif
-+
-+ len += buf - fs->buf;
-+ nl = buf = fs->buf;
-+ }
-+ }
-+ else
-+ /* We can fit the newline and blanks in before
-+ the next word. */
-+ *nl++ = '\n';
-+
-+ if (nextline - nl >= fs->wmargin
-+ || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin))
-+ /* Add blanks up to the wrap margin column. */
-+ for (i = 0; i < fs->wmargin; ++i)
-+ *nl++ = ' ';
-+ else
-+ for (i = 0; i < fs->wmargin; ++i)
-+#ifdef USE_IN_LIBIO
-+ if (_IO_fwide (fs->stream, 0) > 0)
-+ putwc_unlocked (L' ', fs->stream);
-+ else
-+#endif
-+ putc_unlocked (' ', fs->stream);
-+
-+ /* Copy the tail of the original buffer into the current buffer
-+ position. */
-+ if (nl < nextline)
-+ memmove (nl, nextline, buf + len - nextline);
-+ len -= nextline - buf;
-+
-+ /* Continue the scan on the remaining lines in the buffer. */
-+ buf = nl;
-+
-+ /* Restore bufp to include all the remaining text. */
-+ fs->p = nl + len;
-+
-+ /* Reset the counter of what has been output this line. If wmargin
-+ is 0, we want to avoid the lmargin getting added, so we set
-+ point_col to a magic value of -1 in that case. */
-+ fs->point_col = fs->wmargin ? fs->wmargin : -1;
-+ }
-+ }
-+
-+ /* Remember that we've scanned as far as the end of the buffer. */
-+ fs->point_offs = fs->p - fs->buf;
-+}
-+
-+/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by
-+ growing the buffer, or by flushing it. True is returned iff we succeed. */
-+int
-+__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
-+{
-+ if ((size_t) (fs->end - fs->p) < amount)
-+ {
-+ ssize_t wrote;
-+
-+ /* Flush FS's buffer. */
-+ __argp_fmtstream_update (fs);
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
-+ wrote = fs->p - fs->buf;
-+#else
-+ wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
-+#endif
-+ if (wrote == fs->p - fs->buf)
-+ {
-+ fs->p = fs->buf;
-+ fs->point_offs = 0;
-+ }
-+ else
-+ {
-+ fs->p -= wrote;
-+ fs->point_offs -= wrote;
-+ memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf);
-+ return 0;
-+ }
-+
-+ if ((size_t) (fs->end - fs->buf) < amount)
-+ /* Gotta grow the buffer. */
-+ {
-+ size_t old_size = fs->end - fs->buf;
-+ size_t new_size = old_size + amount;
-+ char *new_buf;
-+
-+ if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size)))
-+ {
-+ __set_errno (ENOMEM);
-+ return 0;
-+ }
-+
-+ fs->buf = new_buf;
-+ fs->end = new_buf + new_size;
-+ fs->p = fs->buf;
-+ }
-+ }
-+
-+ return 1;
-+}
-+
-+ssize_t
-+__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
-+{
-+ int out;
-+ size_t avail;
-+ size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
-+
-+ do
-+ {
-+ va_list args;
-+
-+ if (! __argp_fmtstream_ensure (fs, size_guess))
-+ return -1;
-+
-+ va_start (args, fmt);
-+ avail = fs->end - fs->p;
-+ out = __vsnprintf (fs->p, avail, fmt, args);
-+ va_end (args);
-+ if ((size_t) out >= avail)
-+ size_guess = out + 1;
-+ }
-+ while ((size_t) out >= avail);
-+
-+ fs->p += out;
-+
-+ return out;
-+}
-+#if 0
-+/* Not exported. */
-+#ifdef weak_alias
-+weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
-+#endif
-+#endif
-+
-+#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
-diff --git a/libuargp/argp-fmtstream.h b/libuargp/argp-fmtstream.h
-new file mode 100644
-index 0000000..ca7c834
---- /dev/null
-+++ b/libuargp/argp-fmtstream.h
-@@ -0,0 +1,314 @@
-+/* Word-wrapping and line-truncating streams.
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+/* This package emulates glibc `line_wrap_stream' semantics for systems that
-+ don't have that. If the system does have it, it is just a wrapper for
-+ that. This header file is only used internally while compiling argp, and
-+ shouldn't be installed. */
-+
-+#ifndef _ARGP_FMTSTREAM_H
-+#define _ARGP_FMTSTREAM_H
-+
-+#include <stdio.h>
-+#include <string.h>
-+#include <unistd.h>
-+
-+#ifndef __attribute__
-+/* This feature is available in gcc versions 2.5 and later. */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
-+# define __attribute__(Spec) /* empty */
-+# endif
-+/* The __-protected variants of `format' and `printf' attributes
-+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
-+# define __format__ format
-+# define __printf__ printf
-+# endif
-+#endif
-+
-+#if 0 /* uClibc: disabled */
-+#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
-+ || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
-+/* line_wrap_stream is available, so use that. */
-+#define ARGP_FMTSTREAM_USE_LINEWRAP
-+#endif
-+#else
-+/* line_wrap stream NOT available */
-+# undef ARGP_FMTSTREAM_USE_LINEWRAP
-+#endif
-+
-+#ifdef ARGP_FMTSTREAM_USE_LINEWRAP
-+/* Just be a simple wrapper for line_wrap_stream; the semantics are
-+ *slightly* different, as line_wrap_stream doesn't actually make a new
-+ object, it just modifies the given stream (reversibly) to do
-+ line-wrapping. Since we control who uses this code, it doesn't matter. */
-+
-+#include <linewrap.h>
-+
-+typedef FILE *argp_fmtstream_t;
-+
-+#define argp_make_fmtstream line_wrap_stream
-+#define __argp_make_fmtstream line_wrap_stream
-+#define argp_fmtstream_free line_unwrap_stream
-+#define __argp_fmtstream_free line_unwrap_stream
-+
-+#define __argp_fmtstream_putc(fs,ch) putc(ch,fs)
-+#define argp_fmtstream_putc(fs,ch) putc(ch,fs)
-+#define __argp_fmtstream_puts(fs,str) fputs(str,fs)
-+#define argp_fmtstream_puts(fs,str) fputs(str,fs)
-+#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
-+#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
-+#define __argp_fmtstream_printf fprintf
-+#define argp_fmtstream_printf fprintf
-+
-+#define __argp_fmtstream_lmargin line_wrap_lmargin
-+#define argp_fmtstream_lmargin line_wrap_lmargin
-+#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin
-+#define argp_fmtstream_set_lmargin line_wrap_set_lmargin
-+#define __argp_fmtstream_rmargin line_wrap_rmargin
-+#define argp_fmtstream_rmargin line_wrap_rmargin
-+#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin
-+#define argp_fmtstream_set_rmargin line_wrap_set_rmargin
-+#define __argp_fmtstream_wmargin line_wrap_wmargin
-+#define argp_fmtstream_wmargin line_wrap_wmargin
-+#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin
-+#define argp_fmtstream_set_wmargin line_wrap_set_wmargin
-+#define __argp_fmtstream_point line_wrap_point
-+#define argp_fmtstream_point line_wrap_point
-+
-+#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
-+/* Guess we have to define our own version. */
-+
-+#ifndef __const
-+#define __const const
-+#endif
-+
-+struct argp_fmtstream
-+{
-+ FILE *stream; /* The stream we're outputting to. */
-+
-+ size_t lmargin, rmargin; /* Left and right margins. */
-+ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */
-+
-+ /* Point in buffer to which we've processed for wrapping, but not output. */
-+ size_t point_offs;
-+ /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */
-+ ssize_t point_col;
-+
-+ char *buf; /* Output buffer. */
-+ char *p; /* Current end of text in BUF. */
-+ char *end; /* Absolute end of BUF. */
-+};
-+
-+typedef struct argp_fmtstream *argp_fmtstream_t;
-+
-+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
-+ written on it with LMARGIN spaces and limits them to RMARGIN columns
-+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
-+ replacing the whitespace before them with a newline and WMARGIN spaces.
-+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
-+ Returns NULL if there was an error. */
-+extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
-+ size_t __lmargin,
-+ size_t __rmargin,
-+ ssize_t __wmargin);
-+extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
-+ size_t __lmargin,
-+ size_t __rmargin,
-+ ssize_t __wmargin);
-+
-+/* Flush __FS to its stream, and free it (but don't close the stream). */
-+extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
-+extern void argp_fmtstream_free (argp_fmtstream_t __fs);
-+
-+extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
-+ __const char *__fmt, ...)
-+ __attribute__ ((__format__ (printf, 2, 3)));
-+extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
-+ __const char *__fmt, ...)
-+ __attribute__ ((__format__ (printf, 2, 3)));
-+
-+extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
-+extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
-+
-+extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
-+extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
-+
-+extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
-+ __const char *__str, size_t __len);
-+extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
-+ __const char *__str, size_t __len);
-+
-+/* Access macros for various bits of state. */
-+#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
-+#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin)
-+#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin)
-+#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
-+#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
-+#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
-+
-+/* Set __FS's left margin to LMARGIN and return the old value. */
-+extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
-+ size_t __lmargin);
-+extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
-+ size_t __lmargin);
-+
-+/* Set __FS's right margin to __RMARGIN and return the old value. */
-+extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
-+ size_t __rmargin);
-+extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
-+ size_t __rmargin);
-+
-+/* Set __FS's wrap margin to __WMARGIN and return the old value. */
-+extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
-+ size_t __wmargin);
-+extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
-+ size_t __wmargin);
-+
-+/* Return the column number of the current output point in __FS. */
-+extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
-+extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
-+
-+/* Internal routines. */
-+extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
-+extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
-+extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
-+extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
-+
-+#ifdef __OPTIMIZE__
-+/* Inline versions of above routines. */
-+
-+#if !_LIBC
-+#define __argp_fmtstream_putc argp_fmtstream_putc
-+#define __argp_fmtstream_puts argp_fmtstream_puts
-+#define __argp_fmtstream_write argp_fmtstream_write
-+#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
-+#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
-+#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
-+#define __argp_fmtstream_point argp_fmtstream_point
-+#define __argp_fmtstream_update _argp_fmtstream_update
-+#define __argp_fmtstream_ensure _argp_fmtstream_ensure
-+#endif
-+
-+#ifndef ARGP_FS_EI
-+#define ARGP_FS_EI __extern_inline
-+#endif
-+
-+ARGP_FS_EI size_t
-+__argp_fmtstream_write (argp_fmtstream_t __fs,
-+ __const char *__str, size_t __len)
-+{
-+ if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
-+ {
-+ memcpy (__fs->p, __str, __len);
-+ __fs->p += __len;
-+ return __len;
-+ }
-+ else
-+ return 0;
-+}
-+
-+ARGP_FS_EI int
-+__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
-+{
-+ size_t __len = strlen (__str);
-+ if (__len)
-+ {
-+ size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
-+ return __wrote == __len ? 0 : -1;
-+ }
-+ else
-+ return 0;
-+}
-+
-+ARGP_FS_EI int
-+__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
-+{
-+ if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
-+ return *__fs->p++ = __ch;
-+ else
-+ return EOF;
-+}
-+
-+/* Set __FS's left margin to __LMARGIN and return the old value. */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
-+{
-+ size_t __old;
-+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+ __argp_fmtstream_update (__fs);
-+ __old = __fs->lmargin;
-+ __fs->lmargin = __lmargin;
-+ return __old;
-+}
-+
-+/* Set __FS's right margin to __RMARGIN and return the old value. */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
-+{
-+ size_t __old;
-+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+ __argp_fmtstream_update (__fs);
-+ __old = __fs->rmargin;
-+ __fs->rmargin = __rmargin;
-+ return __old;
-+}
-+
-+/* Set FS's wrap margin to __WMARGIN and return the old value. */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
-+{
-+ size_t __old;
-+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+ __argp_fmtstream_update (__fs);
-+ __old = __fs->wmargin;
-+ __fs->wmargin = __wmargin;
-+ return __old;
-+}
-+
-+/* Return the column number of the current output point in __FS. */
-+ARGP_FS_EI size_t
-+__argp_fmtstream_point (argp_fmtstream_t __fs)
-+{
-+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
-+ __argp_fmtstream_update (__fs);
-+ return __fs->point_col >= 0 ? __fs->point_col : 0;
-+}
-+
-+#if !_LIBC
-+#undef __argp_fmtstream_putc
-+#undef __argp_fmtstream_puts
-+#undef __argp_fmtstream_write
-+#undef __argp_fmtstream_set_lmargin
-+#undef __argp_fmtstream_set_rmargin
-+#undef __argp_fmtstream_set_wmargin
-+#undef __argp_fmtstream_point
-+#undef __argp_fmtstream_update
-+#undef __argp_fmtstream_ensure
-+#endif
-+
-+#endif /* __OPTIMIZE__ */
-+
-+#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
-+
-+#endif /* argp-fmtstream.h */
-diff --git a/libuargp/argp-fs-xinl.c b/libuargp/argp-fs-xinl.c
-new file mode 100644
-index 0000000..473cbbd
---- /dev/null
-+++ b/libuargp/argp-fs-xinl.c
-@@ -0,0 +1,44 @@
-+/* Real definitions for extern inline functions in argp-fmtstream.h
-+ Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#define ARGP_FS_EI
-+#undef __OPTIMIZE__
-+#define __OPTIMIZE__ 1
-+#include "argp-fmtstream.h"
-+
-+#if 0
-+/* Not exported. */
-+/* Add weak aliases. */
-+#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
-+
-+weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
-+weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
-+weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
-+weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
-+weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
-+weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
-+weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
-+
-+#endif
-+#endif
-diff --git a/libuargp/argp-help.c b/libuargp/argp-help.c
-new file mode 100644
-index 0000000..58a5e6e
---- /dev/null
-+++ b/libuargp/argp-help.c
-@@ -0,0 +1,1882 @@
-+/* Hierarchial argument parsing help output
-+ Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
-+ Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifndef _GNU_SOURCE
-+# define _GNU_SOURCE 1
-+#endif
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+/* AIX requires this to be the first thing in the file. */
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H || defined _LIBC
-+# include <alloca.h>
-+# else
-+# ifdef _AIX
-+#pragma alloca
-+# else
-+# ifndef alloca /* predefined by HP cc +Olibcalls */
-+char *alloca ();
-+# endif
-+# endif
-+# endif
-+#endif
-+
-+#include <stddef.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <assert.h>
-+#include <stdarg.h>
-+#include <ctype.h>
-+#include <limits.h>
-+#ifdef _LIBC
-+# include <wchar.h>
-+#endif
-+
-+#include <features.h>
-+#ifndef _
-+/* This is for other GNU distributions with internationalized messages. */
-+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
-+# include <libintl.h>
-+# ifdef _LIBC
-+# undef dgettext
-+# define dgettext(domain, msgid) \
-+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
-+# endif
-+# else
-+# define dgettext(domain, msgid) (msgid)
-+# endif
-+#endif
-+
-+#ifndef _LIBC
-+# if HAVE_STRERROR_R
-+# if !HAVE_DECL_STRERROR_R
-+char *strerror_r (int errnum, char *buf, size_t buflen);
-+# endif
-+# else
-+# if !HAVE_DECL_STRERROR
-+char *strerror (int errnum);
-+# endif
-+# endif
-+#endif
-+
-+#include <argp.h>
-+#include "argp-fmtstream.h"
-+#include <stdbool.h>
-+#include <stdint.h>
-+
-+#ifndef SIZE_MAX
-+# define SIZE_MAX ((size_t) -1)
-+#endif
-+
-+/* User-selectable (using an environment variable) formatting parameters.
-+
-+ These may be specified in an environment variable called `ARGP_HELP_FMT',
-+ with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2
-+ Where VALn must be a positive integer. The list of variables is in the
-+ UPARAM_NAMES vector, below. */
-+
-+/* Default parameters. */
-+#define DUP_ARGS 0 /* True if option argument can be duplicated. */
-+#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */
-+#define SHORT_OPT_COL 2 /* column in which short options start */
-+#define LONG_OPT_COL 6 /* column in which long options start */
-+#define DOC_OPT_COL 2 /* column in which doc options start */
-+#define OPT_DOC_COL 29 /* column in which option text starts */
-+#define HEADER_COL 1 /* column in which group headers are printed */
-+#define USAGE_INDENT 12 /* indentation of wrapped usage lines */
-+#define RMARGIN 79 /* right margin used for wrapping */
-+
-+/* User-selectable (using an environment variable) formatting parameters.
-+ They must all be of type `int' for the parsing code to work. */
-+struct uparams
-+{
-+ /* If true, arguments for an option are shown with both short and long
-+ options, even when a given option has both, e.g. `-x ARG, --longx=ARG'.
-+ If false, then if an option has both, the argument is only shown with
-+ the long one, e.g., `-x, --longx=ARG', and a message indicating that
-+ this really means both is printed below the options. */
-+ int dup_args;
-+
-+ /* This is true if when DUP_ARGS is false, and some duplicate arguments have
-+ been suppressed, an explanatory message should be printed. */
-+ int dup_args_note;
-+
-+ /* Various output columns. */
-+ int short_opt_col;
-+ int long_opt_col;
-+ int doc_opt_col;
-+ int opt_doc_col;
-+ int header_col;
-+ int usage_indent;
-+ int rmargin;
-+};
-+
-+/* This is a global variable, as user options are only ever read once. */
-+static struct uparams uparams = {
-+ DUP_ARGS, DUP_ARGS_NOTE,
-+ SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
-+ USAGE_INDENT, RMARGIN
-+};
-+
-+/* A particular uparam, and what the user name is. */
-+struct uparam_name
-+{
-+ const char name[14]; /* User name. */
-+ bool is_bool; /* Whether it's `boolean'. */
-+ uint8_t uparams_offs; /* Location of the (int) field in UPARAMS. */
-+};
-+
-+/* The name-field mappings we know about. */
-+static const struct uparam_name uparam_names[] =
-+{
-+ { "dup-args", true, offsetof (struct uparams, dup_args) },
-+ { "dup-args-note", true, offsetof (struct uparams, dup_args_note) },
-+ { "short-opt-col", false, offsetof (struct uparams, short_opt_col) },
-+ { "long-opt-col", false, offsetof (struct uparams, long_opt_col) },
-+ { "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) },
-+ { "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) },
-+ { "header-col", false, offsetof (struct uparams, header_col) },
-+ { "usage-indent", false, offsetof (struct uparams, usage_indent) },
-+ { "rmargin", false, offsetof (struct uparams, rmargin) }
-+};
-+#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
-+
-+/* Read user options from the environment, and fill in UPARAMS appropiately. */
-+static void
-+fill_in_uparams (const struct argp_state *state)
-+{
-+ const char *var = getenv ("ARGP_HELP_FMT");
-+
-+#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
-+
-+ if (var)
-+ /* Parse var. */
-+ while (*var)
-+ {
-+ SKIPWS (var);
-+
-+ if (isalpha (*var))
-+ {
-+ size_t var_len;
-+ const struct uparam_name *un;
-+ int unspec = 0, val = 0;
-+ const char *arg = var;
-+
-+ while (isalnum (*arg) || *arg == '-' || *arg == '_')
-+ arg++;
-+ var_len = arg - var;
-+
-+ SKIPWS (arg);
-+
-+ if (*arg == '\0' || *arg == ',')
-+ unspec = 1;
-+ else if (*arg == '=')
-+ {
-+ arg++;
-+ SKIPWS (arg);
-+ }
-+
-+ if (unspec)
-+ {
-+ if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
-+ {
-+ val = 0;
-+ var += 3;
-+ var_len -= 3;
-+ }
-+ else
-+ val = 1;
-+ }
-+ else if (isdigit (*arg))
-+ {
-+ val = atoi (arg);
-+ while (isdigit (*arg))
-+ arg++;
-+ SKIPWS (arg);
-+ }
-+
-+ un = uparam_names;
-+ size_t u;
-+ for (u = 0; u < nuparam_names; ++un, ++u)
-+ if (strlen (un->name) == var_len
-+ && strncmp (var, un->name, var_len) == 0)
-+ {
-+ if (unspec && !un->is_bool)
-+ argp_failure (state, 0, 0,
-+ dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain,
-+ "\
-+%.*s: ARGP_HELP_FMT parameter requires a value"),
-+ (int) var_len, var);
-+ else
-+ *(int *)((char *)&uparams + un->uparams_offs) = val;
-+ break;
-+ }
-+ if (u == nuparam_names)
-+ argp_failure (state, 0, 0,
-+ dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain, "\
-+%.*s: Unknown ARGP_HELP_FMT parameter"),
-+ (int) var_len, var);
-+
-+ var = arg;
-+ if (*var == ',')
-+ var++;
-+ }
-+ else if (*var)
-+ {
-+ argp_failure (state, 0, 0,
-+ dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain,
-+ "Garbage in ARGP_HELP_FMT: %s"), var);
-+ break;
-+ }
-+ }
-+}
-+
-+/* Returns true if OPT hasn't been marked invisible. Visibility only affects
-+ whether OPT is displayed or used in sorting, not option shadowing. */
-+#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN))
-+
-+/* Returns true if OPT is an alias for an earlier option. */
-+#define oalias(opt) ((opt)->flags & OPTION_ALIAS)
-+
-+/* Returns true if OPT is an documentation-only entry. */
-+#define odoc(opt) ((opt)->flags & OPTION_DOC)
-+
-+/* Returns true if OPT is the end-of-list marker for a list of options. */
-+#define oend(opt) __option_is_end (opt)
-+
-+/* Returns true if OPT has a short option. */
-+#define oshort(opt) __option_is_short (opt)
-+
-+/*
-+ The help format for a particular option is like:
-+
-+ -xARG, -yARG, --long1=ARG, --long2=ARG Documentation...
-+
-+ Where ARG will be omitted if there's no argument, for this option, or
-+ will be surrounded by "[" and "]" appropiately if the argument is
-+ optional. The documentation string is word-wrapped appropiately, and if
-+ the list of options is long enough, it will be started on a separate line.
-+ If there are no short options for a given option, the first long option is
-+ indented slighly in a way that's supposed to make most long options appear
-+ to be in a separate column.
-+
-+ For example, the following output (from ps):
-+
-+ -p PID, --pid=PID List the process PID
-+ --pgrp=PGRP List processes in the process group PGRP
-+ -P, -x, --no-parent Include processes without parents
-+ -Q, --all-fields Don't elide unusable fields (normally if there's
-+ some reason ps can't print a field for any
-+ process, it's removed from the output entirely)
-+ -r, --reverse, --gratuitously-long-reverse-option
-+ Reverse the order of any sort
-+ --session[=SID] Add the processes from the session SID (which
-+ defaults to the sid of the current process)
-+
-+ Here are some more options:
-+ -f ZOT, --foonly=ZOT Glork a foonly
-+ -z, --zaza Snit a zar
-+
-+ -?, --help Give this help list
-+ --usage Give a short usage message
-+ -V, --version Print program version
-+
-+ The struct argp_option array for the above could look like:
-+
-+ {
-+ {"pid", 'p', "PID", 0, "List the process PID"},
-+ {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"},
-+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
-+ {0, 'x', 0, OPTION_ALIAS},
-+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
-+ " if there's some reason ps can't"
-+ " print a field for any process, it's"
-+ " removed from the output entirely)" },
-+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
-+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
-+ {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL,
-+ "Add the processes from the session"
-+ " SID (which defaults to the sid of"
-+ " the current process)" },
-+
-+ {0,0,0,0, "Here are some more options:"},
-+ {"foonly", 'f', "ZOT", 0, "Glork a foonly"},
-+ {"zaza", 'z', 0, 0, "Snit a zar"},
-+
-+ {0}
-+ }
-+
-+ Note that the last three options are automatically supplied by argp_parse,
-+ unless you tell it not to with ARGP_NO_HELP.
-+
-+*/
-+
-+/* Returns true if CH occurs between BEG and END. */
-+static int
-+find_char (char ch, char *beg, char *end)
-+{
-+ while (beg < end)
-+ if (*beg == ch)
-+ return 1;
-+ else
-+ beg++;
-+ return 0;
-+}
-+
-+struct hol_cluster; /* fwd decl */
-+
-+struct hol_entry
-+{
-+ /* First option. */
-+ const struct argp_option *opt;
-+ /* Number of options (including aliases). */
-+ unsigned num;
-+
-+ /* A pointers into the HOL's short_options field, to the first short option
-+ letter for this entry. The order of the characters following this point
-+ corresponds to the order of options pointed to by OPT, and there are at
-+ most NUM. A short option recorded in a option following OPT is only
-+ valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's
-+ probably been shadowed by some other entry). */
-+ char *short_options;
-+
-+ /* Entries are sorted by their group first, in the order:
-+ 1, 2, ..., n, 0, -m, ..., -2, -1
-+ and then alphabetically within each group. The default is 0. */
-+ int group;
-+
-+ /* The cluster of options this entry belongs to, or 0 if none. */
-+ struct hol_cluster *cluster;
-+
-+ /* The argp from which this option came. */
-+ const struct argp *argp;
-+};
-+
-+/* A cluster of entries to reflect the argp tree structure. */
-+struct hol_cluster
-+{
-+ /* A descriptive header printed before options in this cluster. */
-+ const char *header;
-+
-+ /* Used to order clusters within the same group with the same parent,
-+ according to the order in which they occurred in the parent argp's child
-+ list. */
-+ int index;
-+
-+ /* How to sort this cluster with respect to options and other clusters at the
-+ same depth (clusters always follow options in the same group). */
-+ int group;
-+
-+ /* The cluster to which this cluster belongs, or 0 if it's at the base
-+ level. */
-+ struct hol_cluster *parent;
-+
-+ /* The argp from which this cluster is (eventually) derived. */
-+ const struct argp *argp;
-+
-+ /* The distance this cluster is from the root. */
-+ int depth;
-+
-+ /* Clusters in a given hol are kept in a linked list, to make freeing them
-+ possible. */
-+ struct hol_cluster *next;
-+};
-+
-+/* A list of options for help. */
-+struct hol
-+{
-+ /* An array of hol_entry's. */
-+ struct hol_entry *entries;
-+ /* The number of entries in this hol. If this field is zero, the others
-+ are undefined. */
-+ unsigned num_entries;
-+
-+ /* A string containing all short options in this HOL. Each entry contains
-+ pointers into this string, so the order can't be messed with blindly. */
-+ char *short_options;
-+
-+ /* Clusters of entries in this hol. */
-+ struct hol_cluster *clusters;
-+};
-+
-+/* Create a struct hol from the options in ARGP. CLUSTER is the
-+ hol_cluster in which these entries occur, or 0, if at the root. */
-+static struct hol *
-+make_hol (const struct argp *argp, struct hol_cluster *cluster)
-+{
-+ char *so;
-+ const struct argp_option *o;
-+ const struct argp_option *opts = argp->options;
-+ struct hol_entry *entry;
-+ unsigned num_short_options = 0;
-+ struct hol *hol = malloc (sizeof (struct hol));
-+
-+ assert (hol);
-+
-+ hol->num_entries = 0;
-+ hol->clusters = 0;
-+
-+ if (opts)
-+ {
-+ int cur_group = 0;
-+
-+ /* The first option must not be an alias. */
-+ assert (! oalias (opts));
-+
-+ /* Calculate the space needed. */
-+ for (o = opts; ! oend (o); o++)
-+ {
-+ if (! oalias (o))
-+ hol->num_entries++;
-+ if (oshort (o))
-+ num_short_options++; /* This is an upper bound. */
-+ }
-+
-+ hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
-+ hol->short_options = malloc (num_short_options + 1);
-+
-+ assert (hol->entries && hol->short_options);
-+#if SIZE_MAX <= UINT_MAX
-+ assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
-+#endif
-+
-+ /* Fill in the entries. */
-+ so = hol->short_options;
-+ for (o = opts, entry = hol->entries; ! oend (o); entry++)
-+ {
-+ entry->opt = o;
-+ entry->num = 0;
-+ entry->short_options = so;
-+ entry->group = cur_group =
-+ o->group
-+ ? o->group
-+ : ((!o->name && !o->key)
-+ ? cur_group + 1
-+ : cur_group);
-+ entry->cluster = cluster;
-+ entry->argp = argp;
-+
-+ do
-+ {
-+ entry->num++;
-+ if (oshort (o) && ! find_char (o->key, hol->short_options, so))
-+ /* O has a valid short option which hasn't already been used.*/
-+ *so++ = o->key;
-+ o++;
-+ }
-+ while (! oend (o) && oalias (o));
-+ }
-+ *so = '\0'; /* null terminated so we can find the length */
-+ }
-+
-+ return hol;
-+}
-+
-+/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the
-+ associated argp child list entry), INDEX, and PARENT, and return a pointer
-+ to it. ARGP is the argp that this cluster results from. */
-+static struct hol_cluster *
-+hol_add_cluster (struct hol *hol, int group, const char *header, int index,
-+ struct hol_cluster *parent, const struct argp *argp)
-+{
-+ struct hol_cluster *cl = malloc (sizeof (struct hol_cluster));
-+ if (cl)
-+ {
-+ cl->group = group;
-+ cl->header = header;
-+
-+ cl->index = index;
-+ cl->parent = parent;
-+ cl->argp = argp;
-+ cl->depth = parent ? parent->depth + 1 : 0;
-+
-+ cl->next = hol->clusters;
-+ hol->clusters = cl;
-+ }
-+ return cl;
-+}
-+
-+/* Free HOL and any resources it uses. */
-+static void
-+hol_free (struct hol *hol)
-+{
-+ struct hol_cluster *cl = hol->clusters;
-+
-+ while (cl)
-+ {
-+ struct hol_cluster *next = cl->next;
-+ free (cl);
-+ cl = next;
-+ }
-+
-+ if (hol->num_entries > 0)
-+ {
-+ free (hol->entries);
-+ free (hol->short_options);
-+ }
-+
-+ free (hol);
-+}
-+
-+static int
-+hol_entry_short_iterate (const struct hol_entry *entry,
-+ int (*func)(const struct argp_option *opt,
-+ const struct argp_option *real,
-+ const char *domain, void *cookie),
-+ const char *domain, void *cookie)
-+{
-+ unsigned nopts;
-+ int val = 0;
-+ const struct argp_option *opt, *real = entry->opt;
-+ char *so = entry->short_options;
-+
-+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
-+ if (oshort (opt) && *so == opt->key)
-+ {
-+ if (!oalias (opt))
-+ real = opt;
-+ if (ovisible (opt))
-+ val = (*func)(opt, real, domain, cookie);
-+ so++;
-+ }
-+
-+ return val;
-+}
-+
-+static __inline__ int
-+__attribute__ ((always_inline))
-+hol_entry_long_iterate (const struct hol_entry *entry,
-+ int (*func)(const struct argp_option *opt,
-+ const struct argp_option *real,
-+ const char *domain, void *cookie),
-+ const char *domain, void *cookie)
-+{
-+ unsigned nopts;
-+ int val = 0;
-+ const struct argp_option *opt, *real = entry->opt;
-+
-+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
-+ if (opt->name)
-+ {
-+ if (!oalias (opt))
-+ real = opt;
-+ if (ovisible (opt))
-+ val = (*func)(opt, real, domain, cookie);
-+ }
-+
-+ return val;
-+}
-+
-+/* Iterator that returns true for the first short option. */
-+static __inline__ int
-+until_short (const struct argp_option *opt, const struct argp_option *real,
-+ const char *domain, void *cookie)
-+{
-+ return oshort (opt) ? opt->key : 0;
-+}
-+
-+/* Returns the first valid short option in ENTRY, or 0 if there is none. */
-+static char
-+hol_entry_first_short (const struct hol_entry *entry)
-+{
-+ return hol_entry_short_iterate (entry, until_short,
-+ entry->argp->argp_domain, 0);
-+}
-+
-+/* Returns the first valid long option in ENTRY, or 0 if there is none. */
-+static const char *
-+hol_entry_first_long (const struct hol_entry *entry)
-+{
-+ const struct argp_option *opt;
-+ unsigned num;
-+ for (opt = entry->opt, num = entry->num; num > 0; opt++, num--)
-+ if (opt->name && ovisible (opt))
-+ return opt->name;
-+ return 0;
-+}
-+
-+/* Returns the entry in HOL with the long option name NAME, or 0 if there is
-+ none. */
-+static struct hol_entry *
-+hol_find_entry (struct hol *hol, const char *name)
-+{
-+ struct hol_entry *entry = hol->entries;
-+ unsigned num_entries = hol->num_entries;
-+
-+ while (num_entries-- > 0)
-+ {
-+ const struct argp_option *opt = entry->opt;
-+ unsigned num_opts = entry->num;
-+
-+ while (num_opts-- > 0)
-+ if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0)
-+ return entry;
-+ else
-+ opt++;
-+
-+ entry++;
-+ }
-+
-+ return 0;
-+}
-+
-+/* If an entry with the long option NAME occurs in HOL, set it's special
-+ sort position to GROUP. */
-+static void
-+hol_set_group (struct hol *hol, const char *name, int group)
-+{
-+ struct hol_entry *entry = hol_find_entry (hol, name);
-+ if (entry)
-+ entry->group = group;
-+}
-+
-+/* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1.
-+ EQ is what to return if GROUP1 and GROUP2 are the same. */
-+static int
-+group_cmp (int group1, int group2, int eq)
-+{
-+ if (group1 == group2)
-+ return eq;
-+ else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0))
-+ return group1 - group2;
-+ else
-+ return group2 - group1;
-+}
-+
-+/* Compare clusters CL1 & CL2 by the order that they should appear in
-+ output. */
-+static int
-+hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
-+{
-+ /* If one cluster is deeper than the other, use its ancestor at the same
-+ level, so that finding the common ancestor is straightforward. */
-+ while (cl1->depth > cl2->depth)
-+ cl1 = cl1->parent;
-+ while (cl2->depth > cl1->depth)
-+ cl2 = cl2->parent;
-+
-+ /* Now reduce both clusters to their ancestors at the point where both have
-+ a common parent; these can be directly compared. */
-+ while (cl1->parent != cl2->parent)
-+ cl1 = cl1->parent, cl2 = cl2->parent;
-+
-+ return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index);
-+}
-+
-+/* Return the ancestor of CL that's just below the root (i.e., has a parent
-+ of 0). */
-+static struct hol_cluster *
-+hol_cluster_base (struct hol_cluster *cl)
-+{
-+ while (cl->parent)
-+ cl = cl->parent;
-+ return cl;
-+}
-+
-+/* Return true if CL1 is a child of CL2. */
-+static int
-+hol_cluster_is_child (const struct hol_cluster *cl1,
-+ const struct hol_cluster *cl2)
-+{
-+ while (cl1 && cl1 != cl2)
-+ cl1 = cl1->parent;
-+ return cl1 == cl2;
-+}
-+
-+/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
-+ that should be used for comparisons, and returns true iff it should be
-+ treated as a non-option. */
-+static int
-+canon_doc_option (const char **name)
-+{
-+ int non_opt;
-+ /* Skip initial whitespace. */
-+ while (isspace (**name))
-+ (*name)++;
-+ /* Decide whether this looks like an option (leading `-') or not. */
-+ non_opt = (**name != '-');
-+ /* Skip until part of name used for sorting. */
-+ while (**name && !isalnum (**name))
-+ (*name)++;
-+ return non_opt;
-+}
-+
-+/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help
-+ listing. */
-+static int
-+hol_entry_cmp (const struct hol_entry *entry1,
-+ const struct hol_entry *entry2)
-+{
-+ /* The group numbers by which the entries should be ordered; if either is
-+ in a cluster, then this is just the group within the cluster. */
-+ int group1 = entry1->group, group2 = entry2->group;
-+
-+ if (entry1->cluster != entry2->cluster)
-+ {
-+ /* The entries are not within the same cluster, so we can't compare them
-+ directly, we have to use the appropiate clustering level too. */
-+ if (! entry1->cluster)
-+ /* ENTRY1 is at the `base level', not in a cluster, so we have to
-+ compare it's group number with that of the base cluster in which
-+ ENTRY2 resides. Note that if they're in the same group, the
-+ clustered option always comes laster. */
-+ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
-+ else if (! entry2->cluster)
-+ /* Likewise, but ENTRY2's not in a cluster. */
-+ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
-+ else
-+ /* Both entries are in clusters, we can just compare the clusters. */
-+ return hol_cluster_cmp (entry1->cluster, entry2->cluster);
-+ }
-+ else if (group1 == group2)
-+ /* The entries are both in the same cluster and group, so compare them
-+ alphabetically. */
-+ {
-+ int short1 = hol_entry_first_short (entry1);
-+ int short2 = hol_entry_first_short (entry2);
-+ int doc1 = odoc (entry1->opt);
-+ int doc2 = odoc (entry2->opt);
-+ const char *long1 = hol_entry_first_long (entry1);
-+ const char *long2 = hol_entry_first_long (entry2);
-+
-+ if (doc1)
-+ doc1 = long1 != NULL && canon_doc_option (&long1);
-+ if (doc2)
-+ doc2 = long2 != NULL && canon_doc_option (&long2);
-+
-+ if (doc1 != doc2)
-+ /* `documentation' options always follow normal options (or
-+ documentation options that *look* like normal options). */
-+ return doc1 - doc2;
-+ else if (!short1 && !short2 && long1 && long2)
-+ /* Only long options. */
-+ return strcasecmp (long1, long2);
-+ else
-+ /* Compare short/short, long/short, short/long, using the first
-+ character of long options. Entries without *any* valid
-+ options (such as options with OPTION_HIDDEN set) will be put
-+ first, but as they're not displayed, it doesn't matter where
-+ they are. */
-+ {
-+ char first1 = short1 ? short1 : long1 ? *long1 : 0;
-+ char first2 = short2 ? short2 : long2 ? *long2 : 0;
-+#ifdef _tolower
-+ int lower_cmp = _tolower (first1) - _tolower (first2);
-+#else
-+ int lower_cmp = tolower (first1) - tolower (first2);
-+#endif
-+ /* Compare ignoring case, except when the options are both the
-+ same letter, in which case lower-case always comes first. */
-+ return lower_cmp ? lower_cmp : first2 - first1;
-+ }
-+ }
-+ else
-+ /* Within the same cluster, but not the same group, so just compare
-+ groups. */
-+ return group_cmp (group1, group2, 0);
-+}
-+
-+/* Version of hol_entry_cmp with correct signature for qsort. */
-+static int
-+hol_entry_qcmp (const void *entry1_v, const void *entry2_v)
-+{
-+ return hol_entry_cmp (entry1_v, entry2_v);
-+}
-+
-+/* Sort HOL by group and alphabetically by option name (with short options
-+ taking precedence over long). Since the sorting is for display purposes
-+ only, the shadowing of options isn't effected. */
-+static void
-+hol_sort (struct hol *hol)
-+{
-+ if (hol->num_entries > 0)
-+ qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry),
-+ hol_entry_qcmp);
-+}
-+
-+/* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow
-+ any in MORE with the same name. */
-+static void
-+hol_append (struct hol *hol, struct hol *more)
-+{
-+ struct hol_cluster **cl_end = &hol->clusters;
-+
-+ /* Steal MORE's cluster list, and add it to the end of HOL's. */
-+ while (*cl_end)
-+ cl_end = &(*cl_end)->next;
-+ *cl_end = more->clusters;
-+ more->clusters = 0;
-+
-+ /* Merge entries. */
-+ if (more->num_entries > 0)
-+ {
-+ if (hol->num_entries == 0)
-+ {
-+ hol->num_entries = more->num_entries;
-+ hol->entries = more->entries;
-+ hol->short_options = more->short_options;
-+ more->num_entries = 0; /* Mark MORE's fields as invalid. */
-+ }
-+ else
-+ /* Append the entries in MORE to those in HOL, taking care to only add
-+ non-shadowed SHORT_OPTIONS values. */
-+ {
-+ unsigned left;
-+ char *so, *more_so;
-+ struct hol_entry *e;
-+ unsigned num_entries = hol->num_entries + more->num_entries;
-+ struct hol_entry *entries =
-+ malloc (num_entries * sizeof (struct hol_entry));
-+ unsigned hol_so_len = strlen (hol->short_options);
-+ char *short_options =
-+ malloc (hol_so_len + strlen (more->short_options) + 1);
-+
-+ assert (entries && short_options);
-+#if SIZE_MAX <= UINT_MAX
-+ assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
-+#endif
-+
-+ mempcpy (mempcpy (entries, hol->entries,
-+ hol->num_entries * sizeof (struct hol_entry)),
-+ more->entries,
-+ more->num_entries * sizeof (struct hol_entry));
-+
-+ mempcpy (short_options, hol->short_options, hol_so_len);
-+
-+ /* Fix up the short options pointers from HOL. */
-+ for (e = entries, left = hol->num_entries; left > 0; e++, left--)
-+ e->short_options += (short_options - hol->short_options);
-+
-+ /* Now add the short options from MORE, fixing up its entries
-+ too. */
-+ so = short_options + hol_so_len;
-+ more_so = more->short_options;
-+ for (left = more->num_entries; left > 0; e++, left--)
-+ {
-+ int opts_left;
-+ const struct argp_option *opt;
-+
-+ e->short_options = so;
-+
-+ for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--)
-+ {
-+ int ch = *more_so;
-+ if (oshort (opt) && ch == opt->key)
-+ /* The next short option in MORE_SO, CH, is from OPT. */
-+ {
-+ if (! find_char (ch, short_options,
-+ short_options + hol_so_len))
-+ /* The short option CH isn't shadowed by HOL's options,
-+ so add it to the sum. */
-+ *so++ = ch;
-+ more_so++;
-+ }
-+ }
-+ }
-+
-+ *so = '\0';
-+
-+ free (hol->entries);
-+ free (hol->short_options);
-+
-+ hol->entries = entries;
-+ hol->num_entries = num_entries;
-+ hol->short_options = short_options;
-+ }
-+ }
-+
-+ hol_free (more);
-+}
-+
-+/* Inserts enough spaces to make sure STREAM is at column COL. */
-+static void
-+indent_to (argp_fmtstream_t stream, unsigned col)
-+{
-+ int needed = col - __argp_fmtstream_point (stream);
-+ while (needed-- > 0)
-+ __argp_fmtstream_putc (stream, ' ');
-+}
-+
-+/* Output to STREAM either a space, or a newline if there isn't room for at
-+ least ENSURE characters before the right margin. */
-+static void
-+space (argp_fmtstream_t stream, size_t ensure)
-+{
-+ if (__argp_fmtstream_point (stream) + ensure
-+ >= __argp_fmtstream_rmargin (stream))
-+ __argp_fmtstream_putc (stream, '\n');
-+ else
-+ __argp_fmtstream_putc (stream, ' ');
-+}
-+
-+/* If the option REAL has an argument, we print it in using the printf
-+ format REQ_FMT or OPT_FMT depending on whether it's a required or
-+ optional argument. */
-+static void
-+arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
-+ const char *domain, argp_fmtstream_t stream)
-+{
-+ if (real->arg)
-+ {
-+ if (real->flags & OPTION_ARG_OPTIONAL)
-+ __argp_fmtstream_printf (stream, opt_fmt,
-+ dgettext (domain, real->arg));
-+ else
-+ __argp_fmtstream_printf (stream, req_fmt,
-+ dgettext (domain, real->arg));
-+ }
-+}
-+
-+/* Helper functions for hol_entry_help. */
-+
-+/* State used during the execution of hol_help. */
-+struct hol_help_state
-+{
-+ /* PREV_ENTRY should contain the previous entry printed, or 0. */
-+ struct hol_entry *prev_entry;
-+
-+ /* If an entry is in a different group from the previous one, and SEP_GROUPS
-+ is true, then a blank line will be printed before any output. */
-+ int sep_groups;
-+
-+ /* True if a duplicate option argument was suppressed (only ever set if
-+ UPARAMS.dup_args is false). */
-+ int suppressed_dup_arg;
-+};
-+
-+/* Some state used while printing a help entry (used to communicate with
-+ helper functions). See the doc for hol_entry_help for more info, as most
-+ of the fields are copied from its arguments. */
-+struct pentry_state
-+{
-+ const struct hol_entry *entry;
-+ argp_fmtstream_t stream;
-+ struct hol_help_state *hhstate;
-+
-+ /* True if nothing's been printed so far. */
-+ int first;
-+
-+ /* If non-zero, the state that was used to print this help. */
-+ const struct argp_state *state;
-+};
-+
-+/* If a user doc filter should be applied to DOC, do so. */
-+static const char *
-+filter_doc (const char *doc, int key, const struct argp *argp,
-+ const struct argp_state *state)
-+{
-+ if (argp && argp->help_filter)
-+ /* We must apply a user filter to this output. */
-+ {
-+ void *input = __argp_input (argp, state);
-+ return (*argp->help_filter) (key, doc, input);
-+ }
-+ else
-+ /* No filter. */
-+ return doc;
-+}
-+
-+/* Prints STR as a header line, with the margin lines set appropiately, and
-+ notes the fact that groups should be separated with a blank line. ARGP is
-+ the argp that should dictate any user doc filtering to take place. Note
-+ that the previous wrap margin isn't restored, but the left margin is reset
-+ to 0. */
-+static void
-+print_header (const char *str, const struct argp *argp,
-+ struct pentry_state *pest)
-+{
-+ const char *tstr = dgettext (argp->argp_domain, str);
-+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state);
-+
-+ if (fstr)
-+ {
-+ if (*fstr)
-+ {
-+ if (pest->hhstate->prev_entry)
-+ /* Precede with a blank line. */
-+ __argp_fmtstream_putc (pest->stream, '\n');
-+ indent_to (pest->stream, uparams.header_col);
-+ __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col);
-+ __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col);
-+ __argp_fmtstream_puts (pest->stream, fstr);
-+ __argp_fmtstream_set_lmargin (pest->stream, 0);
-+ __argp_fmtstream_putc (pest->stream, '\n');
-+ }
-+
-+ pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */
-+ }
-+
-+ if (fstr != tstr)
-+ free ((char *) fstr);
-+}
-+
-+/* Inserts a comma if this isn't the first item on the line, and then makes
-+ sure we're at least to column COL. If this *is* the first item on a line,
-+ prints any pending whitespace/headers that should precede this line. Also
-+ clears FIRST. */
-+static void
-+comma (unsigned col, struct pentry_state *pest)
-+{
-+ if (pest->first)
-+ {
-+ const struct hol_entry *pe = pest->hhstate->prev_entry;
-+ const struct hol_cluster *cl = pest->entry->cluster;
-+
-+ if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group)
-+ __argp_fmtstream_putc (pest->stream, '\n');
-+
-+ if (cl && cl->header && *cl->header
-+ && (!pe
-+ || (pe->cluster != cl
-+ && !hol_cluster_is_child (pe->cluster, cl))))
-+ /* If we're changing clusters, then this must be the start of the
-+ ENTRY's cluster unless that is an ancestor of the previous one
-+ (in which case we had just popped into a sub-cluster for a bit).
-+ If so, then print the cluster's header line. */
-+ {
-+ int old_wm = __argp_fmtstream_wmargin (pest->stream);
-+ print_header (cl->header, cl->argp, pest);
-+ __argp_fmtstream_set_wmargin (pest->stream, old_wm);
-+ }
-+
-+ pest->first = 0;
-+ }
-+ else
-+ __argp_fmtstream_puts (pest->stream, ", ");
-+
-+ indent_to (pest->stream, col);
-+}
-+
-+/* Print help for ENTRY to STREAM. */
-+static void
-+hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
-+ argp_fmtstream_t stream, struct hol_help_state *hhstate)
-+{
-+ unsigned num;
-+ const struct argp_option *real = entry->opt, *opt;
-+ char *so = entry->short_options;
-+ int have_long_opt = 0; /* We have any long options. */
-+ /* Saved margins. */
-+ int old_lm = __argp_fmtstream_set_lmargin (stream, 0);
-+ int old_wm = __argp_fmtstream_wmargin (stream);
-+ /* PEST is a state block holding some of our variables that we'd like to
-+ share with helper functions. */
-+ struct pentry_state pest = { entry, stream, hhstate, 1, state };
-+
-+ if (! odoc (real))
-+ for (opt = real, num = entry->num; num > 0; opt++, num--)
-+ if (opt->name && ovisible (opt))
-+ {
-+ have_long_opt = 1;
-+ break;
-+ }
-+
-+ /* First emit short options. */
-+ __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */
-+ for (opt = real, num = entry->num; num > 0; opt++, num--)
-+ if (oshort (opt) && opt->key == *so)
-+ /* OPT has a valid (non shadowed) short option. */
-+ {
-+ if (ovisible (opt))
-+ {
-+ comma (uparams.short_opt_col, &pest);
-+ __argp_fmtstream_putc (stream, '-');
-+ __argp_fmtstream_putc (stream, *so);
-+ if (!have_long_opt || uparams.dup_args)
-+ arg (real, " %s", "[%s]",
-+ state == NULL ? NULL : state->root_argp->argp_domain,
-+ stream);
-+ else if (real->arg)
-+ hhstate->suppressed_dup_arg = 1;
-+ }
-+ so++;
-+ }
-+
-+ /* Now, long options. */
-+ if (odoc (real))
-+ /* A `documentation' option. */
-+ {
-+ __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
-+ for (opt = real, num = entry->num; num > 0; opt++, num--)
-+ if (opt->name && ovisible (opt))
-+ {
-+ comma (uparams.doc_opt_col, &pest);
-+ /* Calling gettext here isn't quite right, since sorting will
-+ have been done on the original; but documentation options
-+ should be pretty rare anyway... */
-+ __argp_fmtstream_puts (stream,
-+ dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain,
-+ opt->name));
-+ }
-+ }
-+ else
-+ /* A real long option. */
-+ {
-+ __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
-+ for (opt = real, num = entry->num; num > 0; opt++, num--)
-+ if (opt->name && ovisible (opt))
-+ {
-+ comma (uparams.long_opt_col, &pest);
-+ __argp_fmtstream_printf (stream, "--%s", opt->name);
-+ arg (real, "=%s", "[=%s]",
-+ state == NULL ? NULL : state->root_argp->argp_domain, stream);
-+ }
-+ }
-+
-+ /* Next, documentation strings. */
-+ __argp_fmtstream_set_lmargin (stream, 0);
-+
-+ if (pest.first)
-+ {
-+ /* Didn't print any switches, what's up? */
-+ if (!oshort (real) && !real->name)
-+ /* This is a group header, print it nicely. */
-+ print_header (real->doc, entry->argp, &pest);
-+ else
-+ /* Just a totally shadowed option or null header; print nothing. */
-+ goto cleanup; /* Just return, after cleaning up. */
-+ }
-+ else
-+ {
-+ const char *tstr = real->doc ? dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain,
-+ real->doc) : 0;
-+ const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
-+ if (fstr && *fstr)
-+ {
-+ unsigned int col = __argp_fmtstream_point (stream);
-+
-+ __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col);
-+ __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col);
-+
-+ if (col > (unsigned int) (uparams.opt_doc_col + 3))
-+ __argp_fmtstream_putc (stream, '\n');
-+ else if (col >= (unsigned int) uparams.opt_doc_col)
-+ __argp_fmtstream_puts (stream, " ");
-+ else
-+ indent_to (stream, uparams.opt_doc_col);
-+
-+ __argp_fmtstream_puts (stream, fstr);
-+ }
-+ if (fstr && fstr != tstr)
-+ free ((char *) fstr);
-+
-+ /* Reset the left margin. */
-+ __argp_fmtstream_set_lmargin (stream, 0);
-+ __argp_fmtstream_putc (stream, '\n');
-+ }
-+
-+ hhstate->prev_entry = entry;
-+
-+cleanup:
-+ __argp_fmtstream_set_lmargin (stream, old_lm);
-+ __argp_fmtstream_set_wmargin (stream, old_wm);
-+}
-+
-+/* Output a long help message about the options in HOL to STREAM. */
-+static void
-+hol_help (struct hol *hol, const struct argp_state *state,
-+ argp_fmtstream_t stream)
-+{
-+ unsigned num;
-+ struct hol_entry *entry;
-+ struct hol_help_state hhstate = { 0, 0, 0 };
-+
-+ for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--)
-+ hol_entry_help (entry, state, stream, &hhstate);
-+
-+ if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
-+ {
-+ const char *tstr = dgettext (state == NULL ? NULL
-+ : state->root_argp->argp_domain, "\
-+Mandatory or optional arguments to long options are also mandatory or \
-+optional for any corresponding short options.");
-+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
-+ state ? state->root_argp : 0, state);
-+ if (fstr && *fstr)
-+ {
-+ __argp_fmtstream_putc (stream, '\n');
-+ __argp_fmtstream_puts (stream, fstr);
-+ __argp_fmtstream_putc (stream, '\n');
-+ }
-+ if (fstr && fstr != tstr)
-+ free ((char *) fstr);
-+ }
-+}
-+
-+/* Helper functions for hol_usage. */
-+
-+/* If OPT is a short option without an arg, append its key to the string
-+ pointer pointer to by COOKIE, and advance the pointer. */
-+static int
-+add_argless_short_opt (const struct argp_option *opt,
-+ const struct argp_option *real,
-+ const char *domain, void *cookie)
-+{
-+ char **snao_end = cookie;
-+ if (!(opt->arg || real->arg)
-+ && !((opt->flags | real->flags) & OPTION_NO_USAGE))
-+ *(*snao_end)++ = opt->key;
-+ return 0;
-+}
-+
-+/* If OPT is a short option with an arg, output a usage entry for it to the
-+ stream pointed at by COOKIE. */
-+static int
-+usage_argful_short_opt (const struct argp_option *opt,
-+ const struct argp_option *real,
-+ const char *domain, void *cookie)
-+{
-+ argp_fmtstream_t stream = cookie;
-+ const char *arg = opt->arg;
-+ int flags = opt->flags | real->flags;
-+
-+ if (! arg)
-+ arg = real->arg;
-+
-+ if (arg && !(flags & OPTION_NO_USAGE))
-+ {
-+ arg = dgettext (domain, arg);
-+
-+ if (flags & OPTION_ARG_OPTIONAL)
-+ __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg);
-+ else
-+ {
-+ /* Manually do line wrapping so that it (probably) won't
-+ get wrapped at the embedded space. */
-+ space (stream, 6 + strlen (arg));
-+ __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg);
-+ }
-+ }
-+
-+ return 0;
-+}
-+
-+/* Output a usage entry for the long option opt to the stream pointed at by
-+ COOKIE. */
-+static int
-+usage_long_opt (const struct argp_option *opt,
-+ const struct argp_option *real,
-+ const char *domain, void *cookie)
-+{
-+ argp_fmtstream_t stream = cookie;
-+ const char *arg = opt->arg;
-+ int flags = opt->flags | real->flags;
-+
-+ if (! arg)
-+ arg = real->arg;
-+
-+ if (! (flags & OPTION_NO_USAGE))
-+ {
-+ if (arg)
-+ {
-+ arg = dgettext (domain, arg);
-+ if (flags & OPTION_ARG_OPTIONAL)
-+ __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg);
-+ else
-+ __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg);
-+ }
-+ else
-+ __argp_fmtstream_printf (stream, " [--%s]", opt->name);
-+ }
-+
-+ return 0;
-+}
-+
-+/* Print a short usage description for the arguments in HOL to STREAM. */
-+static void
-+hol_usage (struct hol *hol, argp_fmtstream_t stream)
-+{
-+ if (hol->num_entries > 0)
-+ {
-+ unsigned nentries;
-+ struct hol_entry *entry;
-+ char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1);
-+ char *snao_end = short_no_arg_opts;
-+
-+ /* First we put a list of short options without arguments. */
-+ for (entry = hol->entries, nentries = hol->num_entries
-+ ; nentries > 0
-+ ; entry++, nentries--)
-+ hol_entry_short_iterate (entry, add_argless_short_opt,
-+ entry->argp->argp_domain, &snao_end);
-+ if (snao_end > short_no_arg_opts)
-+ {
-+ *snao_end++ = 0;
-+ __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts);
-+ }
-+
-+ /* Now a list of short options *with* arguments. */
-+ for (entry = hol->entries, nentries = hol->num_entries
-+ ; nentries > 0
-+ ; entry++, nentries--)
-+ hol_entry_short_iterate (entry, usage_argful_short_opt,
-+ entry->argp->argp_domain, stream);
-+
-+ /* Finally, a list of long options (whew!). */
-+ for (entry = hol->entries, nentries = hol->num_entries
-+ ; nentries > 0
-+ ; entry++, nentries--)
-+ hol_entry_long_iterate (entry, usage_long_opt,
-+ entry->argp->argp_domain, stream);
-+ }
-+}
-+
-+/* Make a HOL containing all levels of options in ARGP. CLUSTER is the
-+ cluster in which ARGP's entries should be clustered, or 0. */
-+static struct hol *
-+argp_hol (const struct argp *argp, struct hol_cluster *cluster)
-+{
-+ const struct argp_child *child = argp->children;
-+ struct hol *hol = make_hol (argp, cluster);
-+ if (child)
-+ while (child->argp)
-+ {
-+ struct hol_cluster *child_cluster =
-+ ((child->group || child->header)
-+ /* Put CHILD->argp within its own cluster. */
-+ ? hol_add_cluster (hol, child->group, child->header,
-+ child - argp->children, cluster, argp)
-+ /* Just merge it into the parent's cluster. */
-+ : cluster);
-+ hol_append (hol, argp_hol (child->argp, child_cluster)) ;
-+ child++;
-+ }
-+ return hol;
-+}
-+
-+/* Calculate how many different levels with alternative args strings exist in
-+ ARGP. */
-+static size_t
-+argp_args_levels (const struct argp *argp)
-+{
-+ size_t levels = 0;
-+ const struct argp_child *child = argp->children;
-+
-+ if (argp->args_doc && strchr (argp->args_doc, '\n'))
-+ levels++;
-+
-+ if (child)
-+ while (child->argp)
-+ levels += argp_args_levels ((child++)->argp);
-+
-+ return levels;
-+}
-+
-+/* Print all the non-option args documented in ARGP to STREAM. Any output is
-+ preceded by a space. LEVELS is a pointer to a byte vector the length
-+ returned by argp_args_levels; it should be initialized to zero, and
-+ updated by this routine for the next call if ADVANCE is true. True is
-+ returned as long as there are more patterns to output. */
-+static int
-+argp_args_usage (const struct argp *argp, const struct argp_state *state,
-+ char **levels, int advance, argp_fmtstream_t stream)
-+{
-+ char *our_level = *levels;
-+ int multiple = 0;
-+ const struct argp_child *child = argp->children;
-+ const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
-+ const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
-+
-+ if (fdoc)
-+ {
-+ const char *cp = fdoc;
-+ nl = strchrnul (cp, '\n');
-+ if (*nl != '\0')
-+ /* This is a `multi-level' args doc; advance to the correct position
-+ as determined by our state in LEVELS, and update LEVELS. */
-+ {
-+ int i;
-+ multiple = 1;
-+ for (i = 0; i < *our_level; i++)
-+ cp = nl + 1, nl = strchrnul (cp, '\n');
-+ (*levels)++;
-+ }
-+
-+ /* Manually do line wrapping so that it (probably) won't get wrapped at
-+ any embedded spaces. */
-+ space (stream, 1 + nl - cp);
-+
-+ __argp_fmtstream_write (stream, cp, nl - cp);
-+ }
-+ if (fdoc && fdoc != tdoc)
-+ free ((char *)fdoc); /* Free user's modified doc string. */
-+
-+ if (child)
-+ while (child->argp)
-+ advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
-+
-+ if (advance && multiple)
-+ {
-+ /* Need to increment our level. */
-+ if (*nl)
-+ /* There's more we can do here. */
-+ {
-+ (*our_level)++;
-+ advance = 0; /* Our parent shouldn't advance also. */
-+ }
-+ else if (*our_level > 0)
-+ /* We had multiple levels, but used them up; reset to zero. */
-+ *our_level = 0;
-+ }
-+
-+ return !advance;
-+}
-+
-+/* Print the documentation for ARGP to STREAM; if POST is false, then
-+ everything preceeding a `\v' character in the documentation strings (or
-+ the whole string, for those with none) is printed, otherwise, everything
-+ following the `\v' character (nothing for strings without). Each separate
-+ bit of documentation is separated a blank line, and if PRE_BLANK is true,
-+ then the first is as well. If FIRST_ONLY is true, only the first
-+ occurrence is output. Returns true if anything was output. */
-+static int
-+argp_doc (const struct argp *argp, const struct argp_state *state,
-+ int post, int pre_blank, int first_only,
-+ argp_fmtstream_t stream)
-+{
-+ const char *text;
-+ const char *inp_text;
-+ void *input = 0;
-+ int anything = 0;
-+ size_t inp_text_limit = 0;
-+ const char *doc = dgettext (argp->argp_domain, argp->doc);
-+ const struct argp_child *child = argp->children;
-+
-+ if (doc)
-+ {
-+ char *vt = strchr (doc, '\v');
-+ inp_text = post ? (vt ? vt + 1 : 0) : doc;
-+ inp_text_limit = (!post && vt) ? (vt - doc) : 0;
-+ }
-+ else
-+ inp_text = 0;
-+
-+ if (argp->help_filter)
-+ /* We have to filter the doc strings. */
-+ {
-+ if (inp_text_limit)
-+ /* Copy INP_TEXT so that it's nul-terminated. */
-+ inp_text = strndup (inp_text, inp_text_limit);
-+ input = __argp_input (argp, state);
-+ text =
-+ (*argp->help_filter) (post
-+ ? ARGP_KEY_HELP_POST_DOC
-+ : ARGP_KEY_HELP_PRE_DOC,
-+ inp_text, input);
-+ }
-+ else
-+ text = (const char *) inp_text;
-+
-+ if (text)
-+ {
-+ if (pre_blank)
-+ __argp_fmtstream_putc (stream, '\n');
-+
-+ if (text == inp_text && inp_text_limit)
-+ __argp_fmtstream_write (stream, inp_text, inp_text_limit);
-+ else
-+ __argp_fmtstream_puts (stream, text);
-+
-+ if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream))
-+ __argp_fmtstream_putc (stream, '\n');
-+
-+ anything = 1;
-+ }
-+
-+ if (text && text != inp_text)
-+ free ((char *) text); /* Free TEXT returned from the help filter. */
-+ if (inp_text && inp_text_limit && argp->help_filter)
-+ free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */
-+
-+ if (post && argp->help_filter)
-+ /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
-+ {
-+ text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
-+ if (text)
-+ {
-+ if (anything || pre_blank)
-+ __argp_fmtstream_putc (stream, '\n');
-+ __argp_fmtstream_puts (stream, text);
-+ free ((char *) text);
-+ if (__argp_fmtstream_point (stream)
-+ > __argp_fmtstream_lmargin (stream))
-+ __argp_fmtstream_putc (stream, '\n');
-+ anything = 1;
-+ }
-+ }
-+
-+ if (child)
-+ while (child->argp && !(first_only && anything))
-+ anything |=
-+ argp_doc ((child++)->argp, state,
-+ post, anything || pre_blank, first_only,
-+ stream);
-+
-+ return anything;
-+}
-+
-+/* Output a usage message for ARGP to STREAM. If called from
-+ argp_state_help, STATE is the relevent parsing state. FLAGS are from the
-+ set ARGP_HELP_*. NAME is what to use wherever a `program name' is
-+ needed. */
-+static void
-+_help (const struct argp *argp, const struct argp_state *state, FILE *stream,
-+ unsigned flags, char *name)
-+{
-+ int anything = 0; /* Whether we've output anything. */
-+ struct hol *hol = 0;
-+ argp_fmtstream_t fs;
-+
-+ if (! stream)
-+ return;
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ flockfile (stream);
-+#endif
-+
-+ fill_in_uparams (state);
-+
-+ fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
-+ if (! fs)
-+ {
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ funlockfile (stream);
-+#endif
-+ return;
-+ }
-+
-+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
-+ {
-+ hol = argp_hol (argp, 0);
-+
-+ /* If present, these options always come last. */
-+ hol_set_group (hol, "help", -1);
-+ hol_set_group (hol, "version", -1);
-+
-+ hol_sort (hol);
-+ }
-+
-+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE))
-+ /* Print a short `Usage:' message. */
-+ {
-+ int first_pattern = 1, more_patterns;
-+ size_t num_pattern_levels = argp_args_levels (argp);
-+ char *pattern_levels = alloca (num_pattern_levels);
-+
-+ memset (pattern_levels, 0, num_pattern_levels);
-+
-+ do
-+ {
-+ int old_lm;
-+ int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent);
-+ char *levels = pattern_levels;
-+
-+ if (first_pattern)
-+ __argp_fmtstream_printf (fs, "%s %s",
-+ dgettext (argp->argp_domain, "Usage:"),
-+ name);
-+ else
-+ __argp_fmtstream_printf (fs, "%s %s",
-+ dgettext (argp->argp_domain, " or: "),
-+ name);
-+
-+ /* We set the lmargin as well as the wmargin, because hol_usage
-+ manually wraps options with newline to avoid annoying breaks. */
-+ old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent);
-+
-+ if (flags & ARGP_HELP_SHORT_USAGE)
-+ /* Just show where the options go. */
-+ {
-+ if (hol->num_entries > 0)
-+ __argp_fmtstream_puts (fs, dgettext (argp->argp_domain,
-+ " [OPTION...]"));
-+ }
-+ else
-+ /* Actually print the options. */
-+ {
-+ hol_usage (hol, fs);
-+ flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */
-+ }
-+
-+ more_patterns = argp_args_usage (argp, state, &levels, 1, fs);
-+
-+ __argp_fmtstream_set_wmargin (fs, old_wm);
-+ __argp_fmtstream_set_lmargin (fs, old_lm);
-+
-+ __argp_fmtstream_putc (fs, '\n');
-+ anything = 1;
-+
-+ first_pattern = 0;
-+ }
-+ while (more_patterns);
-+ }
-+
-+ if (flags & ARGP_HELP_PRE_DOC)
-+ anything |= argp_doc (argp, state, 0, 0, 1, fs);
-+
-+ if (flags & ARGP_HELP_SEE)
-+ {
-+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\
-+Try `%s --help' or `%s --usage' for more information.\n"),
-+ name, name);
-+ anything = 1;
-+ }
-+
-+ if (flags & ARGP_HELP_LONG)
-+ /* Print a long, detailed help message. */
-+ {
-+ /* Print info about all the options. */
-+ if (hol->num_entries > 0)
-+ {
-+ if (anything)
-+ __argp_fmtstream_putc (fs, '\n');
-+ hol_help (hol, state, fs);
-+ anything = 1;
-+ }
-+ }
-+
-+ if (flags & ARGP_HELP_POST_DOC)
-+ /* Print any documentation strings at the end. */
-+ anything |= argp_doc (argp, state, 1, anything, 0, fs);
-+
-+ if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address)
-+ {
-+ if (anything)
-+ __argp_fmtstream_putc (fs, '\n');
-+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain,
-+ "Report bugs to %s.\n"),
-+ argp_program_bug_address);
-+ anything = 1;
-+ }
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ funlockfile (stream);
-+#endif
-+
-+ if (hol)
-+ hol_free (hol);
-+
-+ __argp_fmtstream_free (fs);
-+}
-+
-+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
-+ ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */
-+void argp_help (const struct argp *argp, FILE *stream,
-+ unsigned flags, char *name)
-+{
-+ _help (argp, 0, stream, flags, name);
-+}
-+
-+char *
-+__argp_short_program_name (void)
-+{
-+# ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
-+/*
-+ * uClibc provides both program_invocation_name and
-+ * program_invocation_short_name
-+ */
-+ return (char *) program_invocation_short_name;
-+# else
-+ /* FIXME: What now? Miles suggests that it is better to use NULL,
-+ but currently the value is passed on directly to fputs_unlocked,
-+ so that requires more changes. */
-+# if __GNUC__
-+# warning No reasonable value to return
-+# endif /* __GNUC__ */
-+ return "";
-+# endif
-+}
-+
-+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
-+ from the set ARGP_HELP_*. */
-+void
-+argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
-+{
-+ if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream)
-+ {
-+ if (state && (state->flags & ARGP_LONG_ONLY))
-+ flags |= ARGP_HELP_LONG_ONLY;
-+
-+ _help (state ? state->root_argp : 0, state, stream, flags,
-+ state ? state->name : __argp_short_program_name ());
-+
-+ if (!state || ! (state->flags & ARGP_NO_EXIT))
-+ {
-+ if (flags & ARGP_HELP_EXIT_ERR)
-+ exit (argp_err_exit_status);
-+ if (flags & ARGP_HELP_EXIT_OK)
-+ exit (0);
-+ }
-+ }
-+}
-+
-+/* If appropriate, print the printf string FMT and following args, preceded
-+ by the program name and `:', to stderr, and followed by a `Try ... --help'
-+ message, then exit (1). */
-+void
-+argp_error (const struct argp_state *state, const char *fmt, ...)
-+{
-+ if (!state || !(state->flags & ARGP_NO_ERRS))
-+ {
-+ FILE *stream = state ? state->err_stream : stderr;
-+
-+ if (stream)
-+ {
-+ va_list ap;
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ flockfile (stream);
-+#endif
-+
-+ va_start (ap, fmt);
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ char *buf;
-+
-+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
-+ buf = NULL;
-+
-+ __fxprintf (stream, "%s: %s\n",
-+ state ? state->name : __argp_short_program_name (), buf);
-+
-+ free (buf);
-+#else
-+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
-+ stream);
-+ putc_unlocked (':', stream);
-+ putc_unlocked (' ', stream);
-+
-+ vfprintf (stream, fmt, ap);
-+
-+ putc_unlocked ('\n', stream);
-+#endif
-+
-+ argp_state_help (state, stream, ARGP_HELP_STD_ERR);
-+
-+ va_end (ap);
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ funlockfile (stream);
-+#endif
-+ }
-+ }
-+}
-+
-+/* Similar to the standard gnu error-reporting function error(), but will
-+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
-+ to STATE->err_stream. This is useful for argument parsing code that is
-+ shared between program startup (when exiting is desired) and runtime
-+ option parsing (when typically an error code is returned instead). The
-+ difference between this function and argp_error is that the latter is for
-+ *parsing errors*, and the former is for other problems that occur during
-+ parsing but don't reflect a (syntactic) problem with the input. */
-+void
-+argp_failure (const struct argp_state *state, int status, int errnum,
-+ const char *fmt, ...)
-+{
-+ if (!state || !(state->flags & ARGP_NO_ERRS))
-+ {
-+ FILE *stream = state ? state->err_stream : stderr;
-+
-+ if (stream)
-+ {
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ flockfile (stream);
-+#endif
-+
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ __fxprintf (stream, "%s",
-+ state ? state->name : __argp_short_program_name ());
-+#else
-+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
-+ stream);
-+#endif
-+
-+ if (fmt)
-+ {
-+ va_list ap;
-+
-+ va_start (ap, fmt);
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ char *buf;
-+
-+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
-+ buf = NULL;
-+
-+ __fxprintf (stream, ": %s", buf);
-+
-+ free (buf);
-+#else
-+ putc_unlocked (':', stream);
-+ putc_unlocked (' ', stream);
-+
-+ vfprintf (stream, fmt, ap);
-+#endif
-+
-+ va_end (ap);
-+ }
-+
-+ if (errnum)
-+ {
-+#if (defined _LIBC && defined USE_IN_LIBIO) || defined HAVE_STRERROR_R
-+ char buf[200];
-+#endif
-+#if defined _LIBC && defined USE_IN_LIBIO
-+ __fxprintf (stream, ": %s",
-+ strerror_r (errnum, buf, sizeof (buf)));
-+#else
-+ putc_unlocked (':', stream);
-+ putc_unlocked (' ', stream);
-+# ifdef HAVE_STRERROR_R
-+ fputs (strerror_r (errnum, buf, sizeof (buf)), stream);
-+# else
-+ fputs (strerror (errnum), stream);
-+# endif
-+#endif
-+ }
-+
-+#ifdef USE_IN_LIBIO
-+ if (_IO_fwide (stream, 0) > 0)
-+ putwc_unlocked (L'\n', stream);
-+ else
-+#endif
-+ putc_unlocked ('\n', stream);
-+
-+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
-+ funlockfile (stream);
-+#endif
-+
-+ if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
-+ exit (status);
-+ }
-+ }
-+}
-diff --git a/libuargp/argp-parse.c b/libuargp/argp-parse.c
-new file mode 100644
-index 0000000..86b2b24
---- /dev/null
-+++ b/libuargp/argp-parse.c
-@@ -0,0 +1,949 @@
-+/* Hierarchial argument parsing, layered over getopt
-+ Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA.
-+
-+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
-+*/
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+/* AIX requires this to be the first thing in the file. */
-+#ifndef __GNUC__
-+# if HAVE_ALLOCA_H || defined _LIBC
-+# include <alloca.h>
-+# else
-+# ifdef _AIX
-+#pragma alloca
-+# else
-+# ifndef alloca /* predefined by HP cc +Olibcalls */
-+char *alloca ();
-+# endif
-+# endif
-+# endif
-+#endif
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <limits.h>
-+#include <getopt.h>
-+#include <bits/getopt_int.h>
-+
-+#include <features.h>
-+#ifndef _
-+/* This is for other GNU distributions with internationalized messages.
-+ When compiling libc, the _ macro is predefined. */
-+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
-+# include <libintl.h>
-+# ifdef _LIBC
-+# undef dgettext
-+# define dgettext(domain, msgid) \
-+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
-+# endif
-+# else
-+# define dgettext(domain, msgid) (msgid)
-+# define gettext(msgid) (msgid)
-+# endif
-+#endif
-+#ifndef N_
-+# define N_(msgid) (msgid)
-+#endif
-+
-+#include <argp.h>
-+
-+/* Getopt return values. */
-+#define KEY_END (-1) /* The end of the options. */
-+#define KEY_ARG 1 /* A non-option argument. */
-+#define KEY_ERR '?' /* An error parsing the options. */
-+
-+/* The meta-argument used to prevent any further arguments being interpreted
-+ as options. */
-+#define QUOTE "--"
-+
-+/* The number of bits we steal in a long-option value for our own use. */
-+#define GROUP_BITS CHAR_BIT
-+
-+/* The number of bits available for the user value. */
-+#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
-+#define USER_MASK ((1 << USER_BITS) - 1)
-+
-+/* EZ alias for ARGP_ERR_UNKNOWN. */
-+#define EBADKEY ARGP_ERR_UNKNOWN
-+
-+/* Default options. */
-+
-+/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
-+ for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
-+ you can force the program to continue by attaching a debugger and setting
-+ it to 0 yourself. */
-+static volatile int _argp_hang;
-+
-+#define OPT_PROGNAME -2
-+#define OPT_USAGE -3
-+#define OPT_HANG -4
-+
-+static const struct argp_option argp_default_options[] =
-+{
-+ {"help", '?', 0, 0, N_("Give this help list"), -1},
-+ {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")},
-+ {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
-+ {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
-+ N_("Hang for SECS seconds (default 3600)")},
-+ {0, 0}
-+};
-+
-+static error_t
-+argp_default_parser (int key, char *arg, struct argp_state *state)
-+{
-+ switch (key)
-+ {
-+ case '?':
-+ argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP);
-+ break;
-+ case OPT_USAGE:
-+ argp_state_help (state, state->out_stream,
-+ ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
-+ break;
-+
-+ case OPT_PROGNAME: /* Set the program name. */
-+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME
-+ program_invocation_name = arg;
-+#endif
-+ /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
-+ __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
-+ to be that, so we have to be a bit careful here.] */
-+
-+ /* Update what we use for messages. */
-+ state->name = strrchr (arg, '/');
-+ if (state->name)
-+ state->name++;
-+ else
-+ state->name = arg;
-+
-+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
-+ program_invocation_short_name = state->name;
-+#endif
-+
-+ if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS))
-+ == ARGP_PARSE_ARGV0)
-+ /* Update what getopt uses too. */
-+ state->argv[0] = arg;
-+
-+ break;
-+
-+ case OPT_HANG:
-+ _argp_hang = atoi (arg ? arg : "3600");
-+ while (_argp_hang-- > 0)
-+ sleep (1);
-+ break;
-+
-+ default:
-+ return EBADKEY;
-+ }
-+ return 0;
-+}
-+
-+static const struct argp argp_default_argp =
-+ {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"};
-+
-+
-+static const struct argp_option argp_version_options[] =
-+{
-+ {"version", 'V', 0, 0, N_("Print program version"), -1},
-+ {0, 0}
-+};
-+
-+static error_t
-+argp_version_parser (int key, char *arg, struct argp_state *state)
-+{
-+ switch (key)
-+ {
-+ case 'V':
-+ if (argp_program_version_hook)
-+ (*argp_program_version_hook) (state->out_stream, state);
-+ else if (argp_program_version)
-+ fprintf (state->out_stream, "%s\n", argp_program_version);
-+ else
-+ argp_error (state, dgettext (state->root_argp->argp_domain,
-+ "(PROGRAM ERROR) No version known!?"));
-+ if (! (state->flags & ARGP_NO_EXIT))
-+ exit (0);
-+ break;
-+ default:
-+ return EBADKEY;
-+ }
-+ return 0;
-+}
-+
-+static const struct argp argp_version_argp =
-+ {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"};
-+
-+/* Returns the offset into the getopt long options array LONG_OPTIONS of a
-+ long option with called NAME, or -1 if none is found. Passing NULL as
-+ NAME will return the number of options. */
-+static int
-+find_long_option (struct option *long_options, const char *name)
-+{
-+ struct option *l = long_options;
-+ while (l->name != NULL)
-+ if (name != NULL && strcmp (l->name, name) == 0)
-+ return l - long_options;
-+ else
-+ l++;
-+ if (name == NULL)
-+ return l - long_options;
-+ else
-+ return -1;
-+}
-+
-+
-+/* The state of a `group' during parsing. Each group corresponds to a
-+ particular argp structure from the tree of such descending from the top
-+ level argp passed to argp_parse. */
-+struct group
-+{
-+ /* This group's parsing function. */
-+ argp_parser_t parser;
-+
-+ /* Which argp this group is from. */
-+ const struct argp *argp;
-+
-+ /* Points to the point in SHORT_OPTS corresponding to the end of the short
-+ options for this group. We use it to determine from which group a
-+ particular short options is from. */
-+ char *short_end;
-+
-+ /* The number of non-option args sucessfully handled by this parser. */
-+ unsigned args_processed;
-+
-+ /* This group's parser's parent's group. */
-+ struct group *parent;
-+ unsigned parent_index; /* And the our position in the parent. */
-+
-+ /* These fields are swapped into and out of the state structure when
-+ calling this group's parser. */
-+ void *input, **child_inputs;
-+ void *hook;
-+};
-+
-+/* Call GROUP's parser with KEY and ARG, swapping any group-specific info
-+ from STATE before calling, and back into state afterwards. If GROUP has
-+ no parser, EBADKEY is returned. */
-+static error_t
-+group_parse (struct group *group, struct argp_state *state, int key, char *arg)
-+{
-+ if (group->parser)
-+ {
-+ error_t err;
-+ state->hook = group->hook;
-+ state->input = group->input;
-+ state->child_inputs = group->child_inputs;
-+ state->arg_num = group->args_processed;
-+ err = (*group->parser)(key, arg, state);
-+ group->hook = state->hook;
-+ return err;
-+ }
-+ else
-+ return EBADKEY;
-+}
-+
-+struct parser
-+{
-+ const struct argp *argp;
-+
-+ /* SHORT_OPTS is the getopt short options string for the union of all the
-+ groups of options. */
-+ char *short_opts;
-+ /* LONG_OPTS is the array of getop long option structures for the union of
-+ all the groups of options. */
-+ struct option *long_opts;
-+ /* OPT_DATA is the getopt data used for the re-entrant getopt. */
-+ struct _getopt_data opt_data;
-+
-+ /* States of the various parsing groups. */
-+ struct group *groups;
-+ /* The end of the GROUPS array. */
-+ struct group *egroup;
-+ /* An vector containing storage for the CHILD_INPUTS field in all groups. */
-+ void **child_inputs;
-+
-+ /* True if we think using getopt is still useful; if false, then
-+ remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is
-+ cleared whenever getopt returns KEY_END, but may be set again if the user
-+ moves the next argument pointer backwards. */
-+ int try_getopt;
-+
-+ /* State block supplied to parsing routines. */
-+ struct argp_state state;
-+
-+ /* Memory used by this parser. */
-+ void *storage;
-+};
-+
-+/* The next usable entries in the various parser tables being filled in by
-+ convert_options. */
-+struct parser_convert_state
-+{
-+ struct parser *parser;
-+ char *short_end;
-+ struct option *long_end;
-+ void **child_inputs_end;
-+};
-+
-+/* Converts all options in ARGP (which is put in GROUP) and ancestors
-+ into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
-+ CVT->LONG_END are the points at which new options are added. Returns the
-+ next unused group entry. CVT holds state used during the conversion. */
-+static struct group *
-+convert_options (const struct argp *argp,
-+ struct group *parent, unsigned parent_index,
-+ struct group *group, struct parser_convert_state *cvt)
-+{
-+ /* REAL is the most recent non-alias value of OPT. */
-+ const struct argp_option *real = argp->options;
-+ const struct argp_child *children = argp->children;
-+
-+ if (real || argp->parser)
-+ {
-+ const struct argp_option *opt;
-+
-+ if (real)
-+ for (opt = real; !__option_is_end (opt); opt++)
-+ {
-+ if (! (opt->flags & OPTION_ALIAS))
-+ /* OPT isn't an alias, so we can use values from it. */
-+ real = opt;
-+
-+ if (! (real->flags & OPTION_DOC))
-+ /* A real option (not just documentation). */
-+ {
-+ if (__option_is_short (opt))
-+ /* OPT can be used as a short option. */
-+ {
-+ *cvt->short_end++ = opt->key;
-+ if (real->arg)
-+ {
-+ *cvt->short_end++ = ':';
-+ if (real->flags & OPTION_ARG_OPTIONAL)
-+ *cvt->short_end++ = ':';
-+ }
-+ *cvt->short_end = '\0'; /* keep 0 terminated */
-+ }
-+
-+ if (opt->name
-+ && find_long_option (cvt->parser->long_opts, opt->name) < 0)
-+ /* OPT can be used as a long option. */
-+ {
-+ cvt->long_end->name = opt->name;
-+ cvt->long_end->has_arg =
-+ (real->arg
-+ ? (real->flags & OPTION_ARG_OPTIONAL
-+ ? optional_argument
-+ : required_argument)
-+ : no_argument);
-+ cvt->long_end->flag = 0;
-+ /* we add a disambiguating code to all the user's
-+ values (which is removed before we actually call
-+ the function to parse the value); this means that
-+ the user loses use of the high 8 bits in all his
-+ values (the sign of the lower bits is preserved
-+ however)... */
-+ cvt->long_end->val =
-+ ((opt->key | real->key) & USER_MASK)
-+ + (((group - cvt->parser->groups) + 1) << USER_BITS);
-+
-+ /* Keep the LONG_OPTS list terminated. */
-+ (++cvt->long_end)->name = NULL;
-+ }
-+ }
-+ }
-+
-+ group->parser = argp->parser;
-+ group->argp = argp;
-+ group->short_end = cvt->short_end;
-+ group->args_processed = 0;
-+ group->parent = parent;
-+ group->parent_index = parent_index;
-+ group->input = 0;
-+ group->hook = 0;
-+ group->child_inputs = 0;
-+
-+ if (children)
-+ /* Assign GROUP's CHILD_INPUTS field some space from
-+ CVT->child_inputs_end.*/
-+ {
-+ unsigned num_children = 0;
-+ while (children[num_children].argp)
-+ num_children++;
-+ group->child_inputs = cvt->child_inputs_end;
-+ cvt->child_inputs_end += num_children;
-+ }
-+
-+ parent = group++;
-+ }
-+ else
-+ parent = 0;
-+
-+ if (children)
-+ {
-+ unsigned index = 0;
-+ while (children->argp)
-+ group =
-+ convert_options (children++->argp, parent, index++, group, cvt);
-+ }
-+
-+ return group;
-+}
-+
-+/* Find the merged set of getopt options, with keys appropiately prefixed. */
-+static void
-+parser_convert (struct parser *parser, const struct argp *argp, int flags)
-+{
-+ struct parser_convert_state cvt;
-+
-+ cvt.parser = parser;
-+ cvt.short_end = parser->short_opts;
-+ cvt.long_end = parser->long_opts;
-+ cvt.child_inputs_end = parser->child_inputs;
-+
-+ if (flags & ARGP_IN_ORDER)
-+ *cvt.short_end++ = '-';
-+ else if (flags & ARGP_NO_ARGS)
-+ *cvt.short_end++ = '+';
-+ *cvt.short_end = '\0';
-+
-+ cvt.long_end->name = NULL;
-+
-+ parser->argp = argp;
-+
-+ if (argp)
-+ parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
-+ else
-+ parser->egroup = parser->groups; /* No parsers at all! */
-+}
-+
-+/* Lengths of various parser fields which we will allocated. */
-+struct parser_sizes
-+{
-+ size_t short_len; /* Getopt short options string. */
-+ size_t long_len; /* Getopt long options vector. */
-+ size_t num_groups; /* Group structures we allocate. */
-+ size_t num_child_inputs; /* Child input slots. */
-+};
-+
-+/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
-+ argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
-+ the maximum lengths of the resulting merged getopt short options string and
-+ long-options array, respectively. */
-+static void
-+calc_sizes (const struct argp *argp, struct parser_sizes *szs)
-+{
-+ const struct argp_child *child = argp->children;
-+ const struct argp_option *opt = argp->options;
-+
-+ if (opt || argp->parser)
-+ {
-+ szs->num_groups++;
-+ if (opt)
-+ {
-+ int num_opts = 0;
-+ while (!__option_is_end (opt++))
-+ num_opts++;
-+ szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
-+ szs->long_len += num_opts;
-+ }
-+ }
-+
-+ if (child)
-+ while (child->argp)
-+ {
-+ calc_sizes ((child++)->argp, szs);
-+ szs->num_child_inputs++;
-+ }
-+}
-+
-+
-+extern char * __argp_short_program_name (void);
-+/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */
-+static error_t
-+parser_init (struct parser *parser, const struct argp *argp,
-+ int argc, char **argv, int flags, void *input)
-+{
-+ error_t err = 0;
-+ struct group *group;
-+ struct parser_sizes szs;
-+ struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER;
-+
-+ szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1;
-+ szs.long_len = 0;
-+ szs.num_groups = 0;
-+ szs.num_child_inputs = 0;
-+
-+ if (argp)
-+ calc_sizes (argp, &szs);
-+
-+ /* Lengths of the various bits of storage used by PARSER. */
-+#define GLEN (szs.num_groups + 1) * sizeof (struct group)
-+#define CLEN (szs.num_child_inputs * sizeof (void *))
-+#define LLEN ((szs.long_len + 1) * sizeof (struct option))
-+#define SLEN (szs.short_len + 1)
-+
-+ parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
-+ if (! parser->storage)
-+ return ENOMEM;
-+
-+ parser->groups = parser->storage;
-+ parser->child_inputs = parser->storage + GLEN;
-+ parser->long_opts = parser->storage + GLEN + CLEN;
-+ parser->short_opts = parser->storage + GLEN + CLEN + LLEN;
-+ parser->opt_data = opt_data;
-+
-+ memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *));
-+ parser_convert (parser, argp, flags);
-+
-+ memset (&parser->state, 0, sizeof (struct argp_state));
-+ parser->state.root_argp = parser->argp;
-+ parser->state.argc = argc;
-+ parser->state.argv = argv;
-+ parser->state.flags = flags;
-+ parser->state.err_stream = stderr;
-+ parser->state.out_stream = stdout;
-+ parser->state.next = 0; /* Tell getopt to initialize. */
-+ parser->state.pstate = parser;
-+
-+ parser->try_getopt = 1;
-+
-+ /* Call each parser for the first time, giving it a chance to propagate
-+ values to child parsers. */
-+ if (parser->groups < parser->egroup)
-+ parser->groups->input = input;
-+ for (group = parser->groups;
-+ group < parser->egroup && (!err || err == EBADKEY);
-+ group++)
-+ {
-+ if (group->parent)
-+ /* If a child parser, get the initial input value from the parent. */
-+ group->input = group->parent->child_inputs[group->parent_index];
-+
-+ if (!group->parser
-+ && group->argp->children && group->argp->children->argp)
-+ /* For the special case where no parsing function is supplied for an
-+ argp, propagate its input to its first child, if any (this just
-+ makes very simple wrapper argps more convenient). */
-+ group->child_inputs[0] = group->input;
-+
-+ err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
-+ }
-+ if (err == EBADKEY)
-+ err = 0; /* Some parser didn't understand. */
-+
-+ if (err)
-+ return err;
-+
-+ if (parser->state.flags & ARGP_NO_ERRS)
-+ {
-+ parser->opt_data.opterr = 0;
-+ if (parser->state.flags & ARGP_PARSE_ARGV0)
-+ /* getopt always skips ARGV[0], so we have to fake it out. As long
-+ as OPTERR is 0, then it shouldn't actually try to access it. */
-+ parser->state.argv--, parser->state.argc++;
-+ }
-+ else
-+ parser->opt_data.opterr = 1; /* Print error messages. */
-+
-+ if (parser->state.argv == argv && argv[0])
-+ /* There's an argv[0]; use it for messages. */
-+ {
-+ char *short_name = strrchr (argv[0], '/');
-+ parser->state.name = short_name ? short_name + 1 : argv[0];
-+ }
-+ else
-+ parser->state.name = __argp_short_program_name ();
-+
-+ return 0;
-+}
-+
-+/* Free any storage consumed by PARSER (but not PARSER itself). */
-+static error_t
-+parser_finalize (struct parser *parser,
-+ error_t err, int arg_ebadkey, int *end_index)
-+{
-+ struct group *group;
-+
-+ if (err == EBADKEY && arg_ebadkey)
-+ /* Suppress errors generated by unparsed arguments. */
-+ err = 0;
-+
-+ if (! err)
-+ {
-+ if (parser->state.next == parser->state.argc)
-+ /* We successfully parsed all arguments! Call all the parsers again,
-+ just a few more times... */
-+ {
-+ for (group = parser->groups;
-+ group < parser->egroup && (!err || err==EBADKEY);
-+ group++)
-+ if (group->args_processed == 0)
-+ err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
-+ for (group = parser->egroup - 1;
-+ group >= parser->groups && (!err || err==EBADKEY);
-+ group--)
-+ err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
-+
-+ if (err == EBADKEY)
-+ err = 0; /* Some parser didn't understand. */
-+
-+ /* Tell the user that all arguments are parsed. */
-+ if (end_index)
-+ *end_index = parser->state.next;
-+ }
-+ else if (end_index)
-+ /* Return any remaining arguments to the user. */
-+ *end_index = parser->state.next;
-+ else
-+ /* No way to return the remaining arguments, they must be bogus. */
-+ {
-+ if (!(parser->state.flags & ARGP_NO_ERRS)
-+ && parser->state.err_stream)
-+ fprintf (parser->state.err_stream,
-+ dgettext (parser->argp->argp_domain,
-+ "%s: Too many arguments\n"),
-+ parser->state.name);
-+ err = EBADKEY;
-+ }
-+ }
-+
-+ /* Okay, we're all done, with either an error or success; call the parsers
-+ to indicate which one. */
-+
-+ if (err)
-+ {
-+ /* Maybe print an error message. */
-+ if (err == EBADKEY)
-+ /* An appropriate message describing what the error was should have
-+ been printed earlier. */
-+ argp_state_help (&parser->state, parser->state.err_stream,
-+ ARGP_HELP_STD_ERR);
-+
-+ /* Since we didn't exit, give each parser an error indication. */
-+ for (group = parser->groups; group < parser->egroup; group++)
-+ group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
-+ }
-+ else
-+ /* Notify parsers of success, and propagate back values from parsers. */
-+ {
-+ /* We pass over the groups in reverse order so that child groups are
-+ given a chance to do there processing before passing back a value to
-+ the parent. */
-+ for (group = parser->egroup - 1
-+ ; group >= parser->groups && (!err || err == EBADKEY)
-+ ; group--)
-+ err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
-+ if (err == EBADKEY)
-+ err = 0; /* Some parser didn't understand. */
-+ }
-+
-+ /* Call parsers once more, to do any final cleanup. Errors are ignored. */
-+ for (group = parser->egroup - 1; group >= parser->groups; group--)
-+ group_parse (group, &parser->state, ARGP_KEY_FINI, 0);
-+
-+ if (err == EBADKEY)
-+ err = EINVAL;
-+
-+ free (parser->storage);
-+
-+ return err;
-+}
-+
-+/* Call the user parsers to parse the non-option argument VAL, at the current
-+ position, returning any error. The state NEXT pointer is assumed to have
-+ been adjusted (by getopt) to point after this argument; this function will
-+ adjust it correctly to reflect however many args actually end up being
-+ consumed. */
-+static error_t
-+parser_parse_arg (struct parser *parser, char *val)
-+{
-+ /* Save the starting value of NEXT, first adjusting it so that the arg
-+ we're parsing is again the front of the arg vector. */
-+ int index = --parser->state.next;
-+ error_t err = EBADKEY;
-+ struct group *group;
-+ int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */
-+
-+ /* Try to parse the argument in each parser. */
-+ for (group = parser->groups
-+ ; group < parser->egroup && err == EBADKEY
-+ ; group++)
-+ {
-+ parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */
-+ key = ARGP_KEY_ARG;
-+ err = group_parse (group, &parser->state, key, val);
-+
-+ if (err == EBADKEY)
-+ /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */
-+ {
-+ parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */
-+ key = ARGP_KEY_ARGS;
-+ err = group_parse (group, &parser->state, key, 0);
-+ }
-+ }
-+
-+ if (! err)
-+ {
-+ if (key == ARGP_KEY_ARGS)
-+ /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't
-+ changed by the user, *all* arguments should be considered
-+ consumed. */
-+ parser->state.next = parser->state.argc;
-+
-+ if (parser->state.next > index)
-+ /* Remember that we successfully processed a non-option
-+ argument -- but only if the user hasn't gotten tricky and set
-+ the clock back. */
-+ (--group)->args_processed += (parser->state.next - index);
-+ else
-+ /* The user wants to reparse some args, give getopt another try. */
-+ parser->try_getopt = 1;
-+ }
-+
-+ return err;
-+}
-+
-+/* Call the user parsers to parse the option OPT, with argument VAL, at the
-+ current position, returning any error. */
-+static error_t
-+parser_parse_opt (struct parser *parser, int opt, char *val)
-+{
-+ /* The group key encoded in the high bits; 0 for short opts or
-+ group_number + 1 for long opts. */
-+ int group_key = opt >> USER_BITS;
-+ error_t err = EBADKEY;
-+
-+ if (group_key == 0)
-+ /* A short option. By comparing OPT's position in SHORT_OPTS to the
-+ various starting positions in each group's SHORT_END field, we can
-+ determine which group OPT came from. */
-+ {
-+ struct group *group;
-+ char *short_index = strchr (parser->short_opts, opt);
-+
-+ if (short_index)
-+ for (group = parser->groups; group < parser->egroup; group++)
-+ if (group->short_end > short_index)
-+ {
-+ err = group_parse (group, &parser->state, opt,
-+ parser->opt_data.optarg);
-+ break;
-+ }
-+ }
-+ else
-+ /* A long option. We use shifts instead of masking for extracting
-+ the user value in order to preserve the sign. */
-+ err =
-+ group_parse (&parser->groups[group_key - 1], &parser->state,
-+ (opt << GROUP_BITS) >> GROUP_BITS,
-+ parser->opt_data.optarg);
-+
-+ if (err == EBADKEY)
-+ /* At least currently, an option not recognized is an error in the
-+ parser, because we pre-compute which parser is supposed to deal
-+ with each option. */
-+ {
-+ static const char bad_key_err[] =
-+ N_("(PROGRAM ERROR) Option should have been recognized!?");
-+ if (group_key == 0)
-+ argp_error (&parser->state, "-%c: %s", opt,
-+ dgettext (parser->argp->argp_domain, bad_key_err));
-+ else
-+ {
-+ struct option *long_opt = parser->long_opts;
-+ while (long_opt->val != opt && long_opt->name)
-+ long_opt++;
-+ argp_error (&parser->state, "--%s: %s",
-+ long_opt->name ? long_opt->name : "???",
-+ dgettext (parser->argp->argp_domain, bad_key_err));
-+ }
-+ }
-+
-+ return err;
-+}
-+
-+/* Parse the next argument in PARSER (as indicated by PARSER->state.next).
-+ Any error from the parsers is returned, and *ARGP_EBADKEY indicates
-+ whether a value of EBADKEY is due to an unrecognized argument (which is
-+ generally not fatal). */
-+static error_t
-+parser_parse_next (struct parser *parser, int *arg_ebadkey)
-+{
-+ int opt;
-+ error_t err = 0;
-+
-+ if (parser->state.quoted && parser->state.next < parser->state.quoted)
-+ /* The next argument pointer has been moved to before the quoted
-+ region, so pretend we never saw the quoting `--', and give getopt
-+ another chance. If the user hasn't removed it, getopt will just
-+ process it again. */
-+ parser->state.quoted = 0;
-+
-+ if (parser->try_getopt && !parser->state.quoted)
-+ /* Give getopt a chance to parse this. */
-+ {
-+ /* Put it back in OPTIND for getopt. */
-+ parser->opt_data.optind = parser->state.next;
-+ /* Distinguish KEY_ERR from a real option. */
-+ parser->opt_data.optopt = KEY_END;
-+ if (parser->state.flags & ARGP_LONG_ONLY)
-+ opt = _getopt_long_only_r (parser->state.argc, parser->state.argv,
-+ parser->short_opts, parser->long_opts, 0,
-+ &parser->opt_data);
-+ else
-+ opt = _getopt_long_r (parser->state.argc, parser->state.argv,
-+ parser->short_opts, parser->long_opts, 0,
-+ &parser->opt_data);
-+ /* And see what getopt did. */
-+ parser->state.next = parser->opt_data.optind;
-+
-+ if (opt == KEY_END)
-+ /* Getopt says there are no more options, so stop using
-+ getopt; we'll continue if necessary on our own. */
-+ {
-+ parser->try_getopt = 0;
-+ if (parser->state.next > 1
-+ && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
-+ == 0)
-+ /* Not only is this the end of the options, but it's a
-+ `quoted' region, which may have args that *look* like
-+ options, so we definitely shouldn't try to use getopt past
-+ here, whatever happens. */
-+ parser->state.quoted = parser->state.next;
-+ }
-+ else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END)
-+ /* KEY_ERR can have the same value as a valid user short
-+ option, but in the case of a real error, getopt sets OPTOPT
-+ to the offending character, which can never be KEY_END. */
-+ {
-+ *arg_ebadkey = 0;
-+ return EBADKEY;
-+ }
-+ }
-+ else
-+ opt = KEY_END;
-+
-+ if (opt == KEY_END)
-+ {
-+ /* We're past what getopt considers the options. */
-+ if (parser->state.next >= parser->state.argc
-+ || (parser->state.flags & ARGP_NO_ARGS))
-+ /* Indicate that we're done. */
-+ {
-+ *arg_ebadkey = 1;
-+ return EBADKEY;
-+ }
-+ else
-+ /* A non-option arg; simulate what getopt might have done. */
-+ {
-+ opt = KEY_ARG;
-+ parser->opt_data.optarg = parser->state.argv[parser->state.next++];
-+ }
-+ }
-+
-+ if (opt == KEY_ARG)
-+ /* A non-option argument; try each parser in turn. */
-+ err = parser_parse_arg (parser, parser->opt_data.optarg);
-+ else
-+ err = parser_parse_opt (parser, opt, parser->opt_data.optarg);
-+
-+ if (err == EBADKEY)
-+ *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);
-+
-+ return err;
-+}
-+
-+/* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
-+ FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the
-+ index in ARGV of the first unparsed option is returned in it. If an
-+ unknown option is present, EINVAL is returned; if some parser routine
-+ returned a non-zero value, it is returned; otherwise 0 is returned. */
-+error_t
-+argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
-+ int *end_index, void *input)
-+{
-+ error_t err;
-+ struct parser parser;
-+
-+ /* If true, then err == EBADKEY is a result of a non-option argument failing
-+ to be parsed (which in some cases isn't actually an error). */
-+ int arg_ebadkey = 0;
-+
-+ if (! (flags & ARGP_NO_HELP))
-+ /* Add our own options. */
-+ {
-+ struct argp_child *child = alloca (4 * sizeof (struct argp_child));
-+ struct argp *top_argp = alloca (sizeof (struct argp));
-+
-+ /* TOP_ARGP has no options, it just serves to group the user & default
-+ argps. */
-+ memset (top_argp, 0, sizeof (*top_argp));
-+ top_argp->children = child;
-+
-+ memset (child, 0, 4 * sizeof (struct argp_child));
-+
-+ if (argp)
-+ (child++)->argp = argp;
-+ (child++)->argp = &argp_default_argp;
-+ if (argp_program_version || argp_program_version_hook)
-+ (child++)->argp = &argp_version_argp;
-+ child->argp = 0;
-+
-+ argp = top_argp;
-+ }
-+
-+ /* Construct a parser for these arguments. */
-+ err = parser_init (&parser, argp, argc, argv, flags, input);
-+
-+ if (! err)
-+ /* Parse! */
-+ {
-+ while (! err)
-+ err = parser_parse_next (&parser, &arg_ebadkey);
-+ err = parser_finalize (&parser, err, arg_ebadkey, end_index);
-+ }
-+
-+ return err;
-+}
-+
-+/* Return the input field for ARGP in the parser corresponding to STATE; used
-+ by the help routines. */
-+void *
-+__argp_input (const struct argp *argp, const struct argp_state *state)
-+{
-+ if (state)
-+ {
-+ struct group *group;
-+ struct parser *parser = state->pstate;
-+
-+ for (group = parser->groups; group < parser->egroup; group++)
-+ if (group->argp == argp)
-+ return group->input;
-+ }
-+
-+ return 0;
-+}
-diff --git a/libuargp/argp-pv.c b/libuargp/argp-pv.c
-new file mode 100644
-index 0000000..f1227b5
---- /dev/null
-+++ b/libuargp/argp-pv.c
-@@ -0,0 +1,25 @@
-+/* Default definition for ARGP_PROGRAM_VERSION.
-+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+/* If set by the user program to a non-zero value, then a default option
-+ --version is added (unless the ARGP_NO_HELP flag is used), which will
-+ print this this string followed by a newline and exit (unless the
-+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
-+const char *argp_program_version;
-diff --git a/libuargp/argp-pvh.c b/libuargp/argp-pvh.c
-new file mode 100644
-index 0000000..1f1d962
---- /dev/null
-+++ b/libuargp/argp-pvh.c
-@@ -0,0 +1,32 @@
-+/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
-+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <argp.h>
-+
-+/* If set by the user program to a non-zero value, then a default option
-+ --version is added (unless the ARGP_NO_HELP flag is used), which calls
-+ this function with a stream to print the version to and a pointer to the
-+ current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
-+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
-+void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
-diff --git a/libuargp/argp-xinl.c b/libuargp/argp-xinl.c
-new file mode 100644
-index 0000000..f1d3000
---- /dev/null
-+++ b/libuargp/argp-xinl.c
-@@ -0,0 +1,35 @@
-+/* Real definitions for extern inline functions in argp.h
-+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#if defined _LIBC || defined HAVE_FEATURES_H
-+# include <features.h>
-+#endif
-+
-+#ifndef __USE_EXTERN_INLINES
-+# define __USE_EXTERN_INLINES 1
-+#endif
-+#define ARGP_EI
-+#undef __OPTIMIZE__
-+#define __OPTIMIZE__ 1
-+#include <argp.h>
-diff --git a/test/argp/Makefile b/test/argp/Makefile
-new file mode 100644
-index 0000000..616fe71
---- /dev/null
-+++ b/test/argp/Makefile
-@@ -0,0 +1,7 @@
-+# uClibc argp tests
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+
-+top_builddir=../../
-+include ../Rules.mak
-+-include Makefile.in
-+include ../Test.mak
-diff --git a/test/argp/Makefile.in b/test/argp/Makefile.in
-new file mode 100644
-index 0000000..d81b359
---- /dev/null
-+++ b/test/argp/Makefile.in
-@@ -0,0 +1,12 @@
-+# uClibc argp tests
-+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-+
-+TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \
-+ bug-argp1 tst-argp1 tst-argp2
-+
-+EXTRA_LDFLAGS = -luargp
-+
-+OPTS_argp-ex3 = ARG1 ARG2
-+OPTS_argp-ex4 = ARG1 string1 string2 string3
-+OPTS_bug-argp1 = -- --help
-+
-diff --git a/test/argp/argp-ex1.c b/test/argp/argp-ex1.c
-new file mode 100644
-index 0000000..7bb5f22
---- /dev/null
-+++ b/test/argp/argp-ex1.c
-@@ -0,0 +1,15 @@
-+/* Argp example #1 -- a minimal program using argp */
-+
-+/* This is (probably) the smallest possible program that
-+ uses argp. It won't do much except give an error
-+ messages and exit when there are any arguments, and print
-+ a (rather pointless) messages for --help. */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+int main (int argc, char **argv)
-+{
-+ argp_parse (0, argc, argv, 0, 0, 0);
-+ exit (0);
-+}
-diff --git a/test/argp/argp-ex2.c b/test/argp/argp-ex2.c
-new file mode 100644
-index 0000000..c49fbac
---- /dev/null
-+++ b/test/argp/argp-ex2.c
-@@ -0,0 +1,45 @@
-+/* Argp example #2 -- a pretty minimal program using argp */
-+
-+/* This program doesn't use any options or arguments, but uses
-+ argp to be compliant with the GNU standard command line
-+ format.
-+
-+ In addition to making sure no arguments are given, and
-+ implementing a --help option, this example will have a
-+ --version option, and will put the given documentation string
-+ and bug address in the --help output, as per GNU standards.
-+
-+ The variable ARGP contains the argument parser specification;
-+ adding fields to this structure is the way most parameters are
-+ passed to argp_parse (the first three fields are usually used,
-+ but not in this small program). There are also two global
-+ variables that argp knows about defined here,
-+ ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are
-+ global variables because they will almost always be constant
-+ for a given program, even if it uses different argument
-+ parsers for various tasks). */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+ "argp-ex2 1.0";
-+const char *argp_program_bug_address =
-+ "<bug-gnu-utils@@gnu.org>";
-+
-+/* Program documentation. */
-+static char doc[] =
-+ "Argp example #2 -- a pretty minimal program using argp";
-+
-+/* Our argument parser. The @code{options}, @code{parser}, and
-+ @code{args_doc} fields are zero because we have neither options or
-+ arguments; @code{doc} and @code{argp_program_bug_address} will be
-+ used in the output for @samp{--help}, and the @samp{--version}
-+ option will print out @code{argp_program_version}. */
-+static struct argp argp = { 0, 0, 0, doc };
-+
-+int main (int argc, char **argv)
-+{
-+ argp_parse (&argp, argc, argv, 0, 0, 0);
-+ exit (0);
-+}
-diff --git a/test/argp/argp-ex3.c b/test/argp/argp-ex3.c
-new file mode 100644
-index 0000000..24d5c50
---- /dev/null
-+++ b/test/argp/argp-ex3.c
-@@ -0,0 +1,153 @@
-+/* Argp example #3 -- a program with options and arguments using argp */
-+
-+/* This program uses the same features as example 2, and uses options and
-+ arguments.
-+
-+ We now use the first four fields in ARGP, so here's a description of them:
-+ OPTIONS -- A pointer to a vector of struct argp_option (see below)
-+ PARSER -- A function to parse a single option, called by argp
-+ ARGS_DOC -- A string describing how the non-option arguments should look
-+ DOC -- A descriptive string about this program; if it contains a
-+ vertical tab character (\v), the part after it will be
-+ printed *following* the options
-+
-+ The function PARSER takes the following arguments:
-+ KEY -- An integer specifying which option this is (taken
-+ from the KEY field in each struct argp_option), or
-+ a special key specifying something else; the only
-+ special keys we use here are ARGP_KEY_ARG, meaning
-+ a non-option argument, and ARGP_KEY_END, meaning
-+ that all arguments have been parsed
-+ ARG -- For an option KEY, the string value of its
-+ argument, or NULL if it has none
-+ STATE-- A pointer to a struct argp_state, containing
-+ various useful information about the parsing state; used here
-+ are the INPUT field, which reflects the INPUT argument to
-+ argp_parse, and the ARG_NUM field, which is the number of the
-+ current non-option argument being parsed
-+ It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the
-+ given KEY wasn't recognized, or an errno value indicating some other
-+ error.
-+
-+ Note that in this example, main uses a structure to communicate with the
-+ parse_opt function, a pointer to which it passes in the INPUT argument to
-+ argp_parse. Of course, it's also possible to use global variables
-+ instead, but this is somewhat more flexible.
-+
-+ The OPTIONS field contains a pointer to a vector of struct argp_option's;
-+ that structure has the following fields (if you assign your option
-+ structures using array initialization like this example, unspecified
-+ fields will be defaulted to 0, and need not be specified):
-+ NAME -- The name of this option's long option (may be zero)
-+ KEY -- The KEY to pass to the PARSER function when parsing this option,
-+ *and* the name of this option's short option, if it is a
-+ printable ascii character
-+ ARG -- The name of this option's argument, if any
-+ FLAGS -- Flags describing this option; some of them are:
-+ OPTION_ARG_OPTIONAL -- The argument to this option is optional
-+ OPTION_ALIAS -- This option is an alias for the
-+ previous option
-+ OPTION_HIDDEN -- Don't show this option in --help output
-+ DOC -- A documentation string for this option, shown in --help output
-+
-+ An options vector should be terminated by an option with all fields zero. */
-+
-+#include <stdlib.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+ "argp-ex3 1.0";
-+const char *argp_program_bug_address =
-+ "<bug-gnu-utils@@gnu.org>";
-+
-+/* Program documentation. */
-+static char doc[] =
-+ "Argp example #3 -- a program with options and arguments using argp";
-+
-+/* A description of the arguments we accept. */
-+static char args_doc[] = "ARG1 ARG2";
-+
-+/* The options we understand. */
-+static struct argp_option options[] = {
-+ {"verbose", 'v', 0, 0, "Produce verbose output" },
-+ {"quiet", 'q', 0, 0, "Don't produce any output" },
-+ {"silent", 's', 0, OPTION_ALIAS },
-+ {"output", 'o', "FILE", 0,
-+ "Output to FILE instead of standard output" },
-+ { 0 }
-+};
-+
-+/* Used by @code{main} to communicate with @code{parse_opt}. */
-+struct arguments
-+{
-+ char *args[2]; /* @var{arg1} & @var{arg2} */
-+ int silent, verbose;
-+ char *output_file;
-+};
-+
-+/* Parse a single option. */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+ /* Get the @var{input} argument from @code{argp_parse}, which we
-+ know is a pointer to our arguments structure. */
-+ struct arguments *arguments = state->input;
-+
-+ switch (key)
-+ {
-+ case 'q': case 's':
-+ arguments->silent = 1;
-+ break;
-+ case 'v':
-+ arguments->verbose = 1;
-+ break;
-+ case 'o':
-+ arguments->output_file = arg;
-+ break;
-+
-+ case ARGP_KEY_ARG:
-+ if (state->arg_num >= 2)
-+ /* Too many arguments. */
-+ argp_usage (state);
-+
-+ arguments->args[state->arg_num] = arg;
-+
-+ break;
-+
-+ case ARGP_KEY_END:
-+ if (state->arg_num < 2)
-+ /* Not enough arguments. */
-+ argp_usage (state);
-+ break;
-+
-+ default:
-+ return ARGP_ERR_UNKNOWN;
-+ }
-+ return 0;
-+}
-+
-+/* Our argp parser. */
-+static struct argp argp = { options, parse_opt, args_doc, doc };
-+
-+int main (int argc, char **argv)
-+{
-+ struct arguments arguments;
-+
-+ /* Default values. */
-+ arguments.silent = 0;
-+ arguments.verbose = 0;
-+ arguments.output_file = "-";
-+
-+ /* Parse our arguments; every option seen by @code{parse_opt} will
-+ be reflected in @code{arguments}. */
-+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
-+
-+ printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n"
-+ "VERBOSE = %s\nSILENT = %s\n",
-+ arguments.args[0], arguments.args[1],
-+ arguments.output_file,
-+ arguments.verbose ? "yes" : "no",
-+ arguments.silent ? "yes" : "no");
-+
-+ exit (0);
-+}
-diff --git a/test/argp/argp-ex4.c b/test/argp/argp-ex4.c
-new file mode 100644
-index 0000000..c77c7ef
---- /dev/null
-+++ b/test/argp/argp-ex4.c
-@@ -0,0 +1,167 @@
-+/* Argp example #4 -- a program with somewhat more complicated options */
-+
-+/* This program uses the same features as example 3, but has more
-+ options, and somewhat more structure in the -help output. It
-+ also shows how you can `steal' the remainder of the input
-+ arguments past a certain point, for programs that accept a
-+ list of items. It also shows the special argp KEY value
-+ ARGP_KEY_NO_ARGS, which is only given if no non-option
-+ arguments were supplied to the program.
-+
-+ For structuring the help output, two features are used,
-+ *headers* which are entries in the options vector with the
-+ first four fields being zero, and a two part documentation
-+ string (in the variable DOC), which allows documentation both
-+ before and after the options; the two parts of DOC are
-+ separated by a vertical-tab character ('\v', or '\013'). By
-+ convention, the documentation before the options is just a
-+ short string saying what the program does, and that afterwards
-+ is longer, describing the behavior in more detail. All
-+ documentation strings are automatically filled for output,
-+ although newlines may be included to force a line break at a
-+ particular point. All documentation strings are also passed to
-+ the `gettext' function, for possible translation into the
-+ current locale. */
-+
-+#include <stdlib.h>
-+#include <error.h>
-+#include <argp.h>
-+
-+const char *argp_program_version =
-+ "argp-ex4 1.0";
-+const char *argp_program_bug_address =
-+ "<bug-gnu-utils@@prep.ai.mit.edu>";
-+
-+/* Program documentation. */
-+static char doc[] =
-+ "Argp example #4 -- a program with somewhat more complicated\
-+options\
-+\vThis part of the documentation comes *after* the options;\
-+ note that the text is automatically filled, but it's possible\
-+ to force a line-break, e.g.\n<-- here.";
-+
-+/* A description of the arguments we accept. */
-+static char args_doc[] = "ARG1 [STRING...]";
-+
-+/* Keys for options without short-options. */
-+#define OPT_ABORT 1 /* --abort */
-+
-+/* The options we understand. */
-+static struct argp_option options[] = {
-+ {"verbose", 'v', 0, 0, "Produce verbose output" },
-+ {"quiet", 'q', 0, 0, "Don't produce any output" },
-+ {"silent", 's', 0, OPTION_ALIAS },
-+ {"output", 'o', "FILE", 0,
-+ "Output to FILE instead of standard output" },
-+
-+ {0,0,0,0, "The following options should be grouped together:" },
-+ {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL,
-+ "Repeat the output COUNT (default 10) times"},
-+ {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"},
-+
-+ { 0 }
-+};
-+
-+/* Used by @code{main} to communicate with @code{parse_opt}. */
-+struct arguments
-+{
-+ char *arg1; /* @var{arg1} */
-+ char **strings; /* [@var{string}@dots{}] */
-+ int silent, verbose, abort; /* @samp{-s}, @samp{-v}, @samp{--abort} */
-+ char *output_file; /* @var{file} arg to @samp{--output} */
-+ int repeat_count; /* @var{count} arg to @samp{--repeat} */
-+};
-+
-+/* Parse a single option. */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+ /* Get the @code{input} argument from @code{argp_parse}, which we
-+ know is a pointer to our arguments structure. */
-+ struct arguments *arguments = state->input;
-+
-+ switch (key)
-+ {
-+ case 'q': case 's':
-+ arguments->silent = 1;
-+ break;
-+ case 'v':
-+ arguments->verbose = 1;
-+ break;
-+ case 'o':
-+ arguments->output_file = arg;
-+ break;
-+ case 'r':
-+ arguments->repeat_count = arg ? atoi (arg) : 10;
-+ break;
-+ case OPT_ABORT:
-+ arguments->abort = 1;
-+ break;
-+
-+ case ARGP_KEY_NO_ARGS:
-+ argp_usage (state);
-+
-+ case ARGP_KEY_ARG:
-+ /* Here we know that @code{state->arg_num == 0}, since we
-+ force argument parsing to end before any more arguments can
-+ get here. */
-+ arguments->arg1 = arg;
-+
-+ /* Now we consume all the rest of the arguments.
-+ @code{state->next} is the index in @code{state->argv} of the
-+ next argument to be parsed, which is the first @var{string}
-+ we're interested in, so we can just use
-+ @code{&state->argv[state->next]} as the value for
-+ arguments->strings.
-+
-+ @emph{In addition}, by setting @code{state->next} to the end
-+ of the arguments, we can force argp to stop parsing here and
-+ return. */
-+ arguments->strings = &state->argv[state->next];
-+ state->next = state->argc;
-+
-+ break;
-+
-+ default:
-+ return ARGP_ERR_UNKNOWN;
-+ }
-+ return 0;
-+}
-+
-+/* Our argp parser. */
-+static struct argp argp = { options, parse_opt, args_doc, doc };
-+
-+int main (int argc, char **argv)
-+{
-+ int i, j;
-+ struct arguments arguments;
-+
-+ /* Default values. */
-+ arguments.silent = 0;
-+ arguments.verbose = 0;
-+ arguments.output_file = "-";
-+ arguments.repeat_count = 1;
-+ arguments.abort = 0;
-+
-+ /* Parse our arguments; every option seen by @code{parse_opt} will be
-+ reflected in @code{arguments}. */
-+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
-+
-+ if (arguments.abort)
-+ error (10, 0, "ABORTED");
-+
-+ for (i = 0; i < arguments.repeat_count; i++)
-+ {
-+ printf ("ARG1 = %s\n", arguments.arg1);
-+ printf ("STRINGS = ");
-+ for (j = 0; arguments.strings[j]; j++)
-+ printf (j == 0 ? "%s" : ", %s", arguments.strings[j]);
-+ printf ("\n");
-+ printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n",
-+ arguments.output_file,
-+ arguments.verbose ? "yes" : "no",
-+ arguments.silent ? "yes" : "no");
-+ }
-+
-+ exit (0);
-+}
-diff --git a/test/argp/argp-test.c b/test/argp/argp-test.c
-new file mode 100644
-index 0000000..b3d573b
---- /dev/null
-+++ b/test/argp/argp-test.c
-@@ -0,0 +1,209 @@
-+/* Test program for argp argument parser
-+ Copyright (C) 1997 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#ifdef HAVE_CONFIG_H
-+#include <config.h>
-+#endif
-+
-+#include <stdlib.h>
-+#include <time.h>
-+#include <string.h>
-+#include <argp.h>
-+
-+const char *argp_program_version = "argp-test 1.0";
-+
-+struct argp_option sub_options[] =
-+{
-+ {"subopt1", 's', 0, 0, "Nested option 1"},
-+ {"subopt2", 'S', 0, 0, "Nested option 2"},
-+
-+ { 0, 0, 0, 0, "Some more nested options:", 10},
-+ {"subopt3", 'p', 0, 0, "Nested option 3"},
-+
-+ {"subopt4", 'q', 0, 0, "Nested option 4", 1},
-+
-+ {0}
-+};
-+
-+static const char sub_args_doc[] = "STRING...\n-";
-+static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
-+
-+static error_t
-+sub_parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+ switch (key)
-+ {
-+ case ARGP_KEY_NO_ARGS:
-+ printf ("NO SUB ARGS\n");
-+ break;
-+ case ARGP_KEY_ARG:
-+ printf ("SUB ARG: %s\n", arg);
-+ break;
-+
-+ case 's' : case 'S': case 'p': case 'q':
-+ printf ("SUB KEY %c\n", key);
-+ break;
-+
-+ default:
-+ return ARGP_ERR_UNKNOWN;
-+ }
-+ return 0;
-+}
-+
-+static char *
-+sub_help_filter (int key, const char *text, void *input)
-+{
-+ if (key == ARGP_KEY_HELP_EXTRA)
-+ return strdup ("This is some extra text from the sub parser (note that it \
-+is preceded by a blank line).");
-+ else
-+ return (char *)text;
-+}
-+
-+static struct argp sub_argp = {
-+ sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter
-+};
-+
-+/* Structure used to communicate with the parsing functions. */
-+struct params
-+{
-+ unsigned foonly; /* Value parsed for foonly. */
-+ unsigned foonly_default; /* Default value for it. */
-+};
-+
-+#define OPT_PGRP 1
-+#define OPT_SESS 2
-+
-+struct argp_option options[] =
-+{
-+ {"pid", 'p', "PID", 0, "List the process PID"},
-+ {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"},
-+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
-+ {0, 'x', 0, OPTION_ALIAS},
-+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
-+ " if there's some reason ps can't"
-+ " print a field for any process, it's"
-+ " removed from the output entirely)" },
-+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
-+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
-+ {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL,
-+ "Add the processes from the session"
-+ " SID (which defaults to the sid of"
-+ " the current process)" },
-+
-+ {0,0,0,0, "Here are some more options:"},
-+ {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"},
-+ {"zaza", 'z', 0, 0, "Snit a zar"},
-+
-+ {0}
-+};
-+
-+static const char args_doc[] = "STRING";
-+static const char doc[] = "Test program for argp."
-+ "\vThis doc string comes after the options."
-+ "\nHey! Some manual formatting!"
-+ "\nThe current time is: %s";
-+
-+static void
-+popt (int key, char *arg)
-+{
-+ char buf[10];
-+ if (isprint (key))
-+ sprintf (buf, "%c", key);
-+ else
-+ sprintf (buf, "%d", key);
-+ if (arg)
-+ printf ("KEY %s: %s\n", buf, arg);
-+ else
-+ printf ("KEY %s\n", buf);
-+}
-+
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+ struct params *params = state->input;
-+
-+ switch (key)
-+ {
-+ case ARGP_KEY_NO_ARGS:
-+ printf ("NO ARGS\n");
-+ break;
-+
-+ case ARGP_KEY_ARG:
-+ if (state->arg_num > 0)
-+ return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */
-+ printf ("ARG: %s\n", arg);
-+ break;
-+
-+ case 'f':
-+ if (arg)
-+ params->foonly = atoi (arg);
-+ else
-+ params->foonly = params->foonly_default;
-+ popt (key, arg);
-+ break;
-+
-+ case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q':
-+ case 'r': case OPT_SESS: case 'z':
-+ popt (key, arg);
-+ break;
-+
-+ default:
-+ return ARGP_ERR_UNKNOWN;
-+ }
-+ return 0;
-+}
-+
-+static char *
-+help_filter (int key, const char *text, void *input)
-+{
-+ char *new_text;
-+ struct params *params = input;
-+
-+ if (key == ARGP_KEY_HELP_POST_DOC && text)
-+ {
-+ time_t now = time (0);
-+ asprintf (&new_text, text, ctime (&now));
-+ }
-+ else if (key == 'f')
-+ /* Show the default for the --foonly option. */
-+ asprintf (&new_text, "%s (ZOT defaults to %x)",
-+ text, params->foonly_default);
-+ else
-+ new_text = (char *)text;
-+
-+ return new_text;
-+}
-+
-+static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
-+static struct argp argp = {
-+ options, parse_opt, args_doc, doc, argp_children, help_filter
-+};
-+
-+int
-+main (int argc, char **argv)
-+{
-+ struct params params;
-+ params.foonly = 0;
-+ params.foonly_default = random ();
-+ argp_parse (&argp, argc, argv, 0, 0, &params);
-+ printf ("After parsing: foonly = %x\n", params.foonly);
-+ return 0;
-+}
-diff --git a/test/argp/bug-argp1.c b/test/argp/bug-argp1.c
-new file mode 100644
-index 0000000..a28cf4b
---- /dev/null
-+++ b/test/argp/bug-argp1.c
-@@ -0,0 +1,26 @@
-+#include <argp.h>
-+
-+
-+static const struct argp_option test_options[] =
-+{
-+ { NULL, 'a', NULL, OPTION_DOC, NULL },
-+ { NULL, 'b', NULL, OPTION_DOC, NULL },
-+ { NULL, 0, NULL, 0, NULL }
-+};
-+
-+static struct argp test_argp =
-+{
-+ test_options
-+};
-+
-+
-+static int
-+do_test (int argc, char *argv[])
-+{
-+ int i;
-+ argp_parse (&test_argp, argc, argv, 0, &i, NULL);
-+ return 0;
-+}
-+
-+#define TEST_FUNCTION do_test (argc, argv)
-+#include "../test-skeleton.c"
-diff --git a/test/argp/tst-argp1.c b/test/argp/tst-argp1.c
-new file mode 100644
-index 0000000..827daca
---- /dev/null
-+++ b/test/argp/tst-argp1.c
-@@ -0,0 +1,118 @@
-+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <argp.h>
-+
-+
-+
-+
-+#define OPT_TO_THREAD 300
-+#define OPT_TO_PROCESS 301
-+#define OPT_SYNC_SIGNAL 302
-+#define OPT_SYNC_JOIN 303
-+#define OPT_TOPLEVEL 304
-+
-+
-+static const struct argp_option test_options[] =
-+ {
-+ { NULL, 0, NULL, 0, "\
-+This is a test for threads so we allow ther user to selection the number of \
-+threads which are used at any one time. Independently the total number of \
-+rounds can be selected. This is the total number of threads which will have \
-+run when the process terminates:" },
-+ { "threads", 't', "NUMBER", 0, "Number of threads used at once" },
-+ { "starts", 's', "NUMBER", 0, "Total number of working threads" },
-+ { "toplevel", OPT_TOPLEVEL, "NUMBER", 0,
-+ "Number of toplevel threads which start the other threads; this \
-+implies --sync-join" },
-+
-+ { NULL, 0, NULL, 0, "\
-+Each thread can do one of two things: sleep or do work. The latter is 100% \
-+CPU bound. The work load is the probability a thread does work. All values \
-+from zero to 100 (inclusive) are valid. How often each thread repeats this \
-+can be determined by the number of rounds. The work cost determines how long \
-+each work session (not sleeping) takes. If it is zero a thread would \
-+effectively nothing. By setting the number of rounds to zero the thread \
-+does no work at all and pure thread creation times can be measured." },
-+ { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" },
-+ { "workcost", 'c', "NUMBER", 0,
-+ "Factor in the cost of each round of working" },
-+ { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" },
-+
-+ { NULL, 0, NULL, 0, "\
-+There are a number of different methods how thread creation can be \
-+synchronized. Synchronization is necessary since the number of concurrently \
-+running threads is limited." },
-+ { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0,
-+ "Synchronize using a signal (default)" },
-+ { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" },
-+
-+ { NULL, 0, NULL, 0, "\
-+One parameter for each threads execution is the size of the stack. If this \
-+parameter is not used the system's default stack size is used. If many \
-+threads are used the stack size should be chosen quite small." },
-+ { "stacksize", 'S', "BYTES", 0, "Size of threads stack" },
-+ { "guardsize", 'g', "BYTES", 0,
-+ "Size of stack guard area; must fit into the stack" },
-+
-+ { NULL, 0, NULL, 0, "Signal options:" },
-+ { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" },
-+ { "to-process", OPT_TO_PROCESS, NULL, 0,
-+ "Send signal to process (default)" },
-+
-+ { NULL, 0, NULL, 0, "Administrative options:" },
-+ { "progress", 'p', NULL, 0, "Show signs of progress" },
-+ { "timing", 'T', NULL, 0,
-+ "Measure time from startup to the last thread finishing" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+/* Prototype for option handler. */
-+static error_t parse_opt (int key, char *arg, struct argp_state *state);
-+
-+/* Data structure to communicate with argp functions. */
-+static struct argp argp =
-+{
-+ test_options, parse_opt
-+};
-+
-+
-+static int
-+do_test (void)
-+{
-+ int argc = 2;
-+ char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL };
-+ int remaining;
-+
-+ /* Parse and process arguments. */
-+ argp_parse (&argp, argc, argv, 0, &remaining, NULL);
-+
-+ return 0;
-+}
-+
-+
-+/* Handle program arguments. */
-+static error_t
-+parse_opt (int key, char *arg, struct argp_state *state)
-+{
-+ return ARGP_ERR_UNKNOWN;
-+}
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
-diff --git a/test/argp/tst-argp2.c b/test/argp/tst-argp2.c
-new file mode 100644
-index 0000000..705cdca
---- /dev/null
-+++ b/test/argp/tst-argp2.c
-@@ -0,0 +1,101 @@
-+/* Copyright (C) 2007 Free Software Foundation, Inc.
-+ This file is part of the GNU C Library.
-+ Contributed by Jakub Jelinek <jakub at redhat.com>, 2007.
-+
-+ The GNU C Library is free software; you can redistribute it and/or
-+ modify it under the terms of the GNU Lesser General Public
-+ License as published by the Free Software Foundation; either
-+ version 2.1 of the License, or (at your option) any later version.
-+
-+ The GNU C Library is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ Lesser General Public License for more details.
-+
-+ You should have received a copy of the GNU Lesser General Public
-+ License along with the GNU C Library; if not, write to the Free
-+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-+ 02111-1307 USA. */
-+
-+#include <argp.h>
-+
-+static const struct argp_option opt1[] =
-+ {
-+ { "opt1", '1', "NUMBER", 0, "Option 1" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+static const struct argp_option opt2[] =
-+ {
-+ { "opt2", '2', "NUMBER", 0, "Option 2" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+static const struct argp_option opt3[] =
-+ {
-+ { "opt3", '3', "NUMBER", 0, "Option 3" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+static const struct argp_option opt4[] =
-+ {
-+ { "opt4", '4', "NUMBER", 0, "Option 4" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+static const struct argp_option opt5[] =
-+ {
-+ { "opt5", '5', "NUMBER", 0, "Option 5" },
-+ { NULL, 0, NULL, 0, NULL }
-+ };
-+
-+static struct argp argp5 =
-+ {
-+ opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
-+ };
-+
-+static struct argp argp4 =
-+ {
-+ opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
-+ };
-+
-+static struct argp argp3 =
-+ {
-+ opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
-+ };
-+
-+static struct argp_child children2[] =
-+ {
-+ { &argp4, 0, "child3", 3 },
-+ { &argp5, 0, "child4", 4 },
-+ { NULL, 0, NULL, 0 }
-+ };
-+
-+static struct argp argp2 =
-+ {
-+ opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
-+ };
-+
-+static struct argp_child children1[] =
-+ {
-+ { &argp2, 0, "child1", 1 },
-+ { &argp3, 0, "child2", 2 },
-+ { NULL, 0, NULL, 0 }
-+ };
-+
-+static struct argp argp1 =
-+ {
-+ opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
-+ };
-+
-+
-+static int
-+do_test (void)
-+{
-+ argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
-+ return 0;
-+}
-+
-+
-+#define TEST_FUNCTION do_test ()
-+#include "../test-skeleton.c"
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch b/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch
deleted file mode 100644
index 629e13c762..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0004-Dont-support-localised-optimizations-this-helps-to-h.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 31785c544abe8b215dbb2264fb11ee7051515797 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 16 Aug 2015 20:58:59 -0700
-Subject: [PATCH 4/7] Dont support localised optimizations this helps to have a
- global -O level
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- libpthread/nptl/pthread_mutex_timedlock.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/libpthread/nptl/pthread_mutex_timedlock.c b/libpthread/nptl/pthread_mutex_timedlock.c
-index 04187f6..f56f6c5 100644
---- a/libpthread/nptl/pthread_mutex_timedlock.c
-+++ b/libpthread/nptl/pthread_mutex_timedlock.c
-@@ -28,7 +28,9 @@
- * error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
- */
- int
-+#ifndef __OPTIMIZE__
- attribute_optimize("Os")
-+#endif
- pthread_mutex_timedlock (
- pthread_mutex_t *mutex,
- const struct timespec *abstime)
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch b/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch
deleted file mode 100644
index ad9b246ab5..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0005-Always-use-O2-for-compiling-fork.c.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 883debc22e30a947fe5858cc07ee5aebd3d07a2e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 16 Aug 2015 20:59:56 -0700
-Subject: [PATCH 5/7] Always use -O2 for compiling fork.c
-
-When compiling in thumb mode for arm with -Os gcc gives up since it can
-not find registers to spill. So we use -O2 option for compiling fork.c
-It may be addressable in gcc.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
-index 0ea0b29..0767e9c 100644
---- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
-+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
-@@ -21,3 +21,9 @@ ASFLAGS-pt-vfork.S = -marm
- CFLAGS-OMIT-pt-vfork.S = -mthumb
- ASFLAGS-vfork.S = -marm
- CFLAGS-OMIT-vfork.S = -mthumb
-+
-+# For arm fork.c does not compile with -Os when compiling
-+# in thumb1 mode
-+ifeq ($(COMPILE_IN_THUMB_MODE),y)
-+CFLAGS-fork.c = -O2
-+endif
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch b/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch
deleted file mode 100644
index f0d87371bc..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0006-ldso-limited-support-for-ORIGIN-in-rpath.patch
+++ /dev/null
@@ -1,233 +0,0 @@
-From b40c129ed2d53b69463883a5422dd4a012a398f9 Mon Sep 17 00:00:00 2001
-From: Junling Zheng <zhengjunling@huawei.com>
-Date: Fri, 3 Apr 2015 05:02:27 +0000
-Subject: [PATCH 6/7] ldso: limited support for $ORIGIN in rpath
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Derived from:
-http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html
-
-However, the above patch introduced '_dl_strchr' in ldso/ldso/dl-elf.c,
-and caused the following undefined referencing compiling error:
-
- | .../libdl.a(libdl.os): In function `search_for_named_library':
- | .../dl-elf.c:156: undefined reference to `_dl_strchr'
- | collect2: error: ld returned 1 exit status
-
-This problem would be reproduced through compiling gdb in static mode
-using uclibc.
-
-So, add the definition of '_dl_strchr' to fix it. The '_dl_strstr' is
-added as well.
-
-Upstream-Status: Submitted
-
-Signed-off-by: Timo Teräs <timo.teras at iki.fi>
-Signed-off-by: Junling Zheng <zhengjunling@huawei.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
-Upstream-Status: Pending
-
- ldso/include/dl-string.h | 2 ++
- ldso/ldso/dl-elf.c | 79 +++++++++++++++++++++++++-----------------------
- ldso/ldso/ldso.c | 18 +++++++++--
- 3 files changed, 59 insertions(+), 40 deletions(-)
-
-diff --git a/ldso/include/dl-string.h b/ldso/include/dl-string.h
-index aacad10..14ae617 100644
---- a/ldso/include/dl-string.h
-+++ b/ldso/include/dl-string.h
-@@ -204,7 +204,9 @@ static __always_inline char * _dl_get_last_path_component(char *path)
- # define _dl_strcat strcat
- # define _dl_strcpy strcpy
- # define _dl_strcmp strcmp
-+# define _dl_strchr strchr
- # define _dl_strrchr strrchr
-+# define _dl_strstr strstr
- # define _dl_memcpy memcpy
- # define _dl_memcmp memcmp
- # define _dl_memset memset
-diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
-index 5631905..6ab7afe 100644
---- a/ldso/ldso/dl-elf.c
-+++ b/ldso/ldso/dl-elf.c
-@@ -133,56 +133,60 @@ _dl_protect_relro (struct elf_resolve *l)
- * in uClibc/ldso/util/ldd.c */
- static struct elf_resolve *
- search_for_named_library(const char *name, unsigned rflags, const char *path_list,
-- struct dyn_elf **rpnt)
-+ struct dyn_elf **rpnt, const char* origin)
- {
-- char *path, *path_n, *mylibname;
-+ char *mylibname;
-+ const char *p, *pn;
- struct elf_resolve *tpnt;
-- int done;
-+ int plen;
-
- if (path_list==NULL)
- return NULL;
-
-- /* We need a writable copy of this string, but we don't
-- * need this allocated permanently since we don't want
-- * to leak memory, so use alloca to put path on the stack */
-- done = _dl_strlen(path_list);
-- path = alloca(done + 1);
--
- /* another bit of local storage */
- mylibname = alloca(2050);
-
-- _dl_memcpy(path, path_list, done+1);
--
- /* Unlike ldd.c, don't bother to eliminate double //s */
-
- /* Replace colons with zeros in path_list */
- /* : at the beginning or end of path maps to CWD */
- /* :: anywhere maps CWD */
- /* "" maps to CWD */
-- done = 0;
-- path_n = path;
-- do {
-- if (*path == 0) {
-- *path = ':';
-- done = 1;
-+ for (p = path_list; p != NULL; p = pn) {
-+ pn = _dl_strchr(p + 1, ':');
-+ if (pn != NULL) {
-+ plen = pn - p;
-+ pn++;
-+ } else
-+ plen = _dl_strlen(p);
-+
-+ if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) {
-+ int olen;
-+ if (rflags && plen != 7)
-+ continue;
-+ if (origin == NULL)
-+ continue;
-+ for (olen = _dl_strlen(origin) - 1; olen >= 0 && origin[olen] != '/'; olen--)
-+ ;
-+ if (olen <= 0)
-+ continue;
-+ _dl_memcpy(&mylibname[0], origin, olen);
-+ _dl_memcpy(&mylibname[olen], p + 7, plen - 7);
-+ mylibname[olen + plen - 7] = 0;
-+ } else if (plen != 0) {
-+ _dl_memcpy(mylibname, p, plen);
-+ mylibname[plen] = 0;
-+ } else {
-+ _dl_strcpy(mylibname, ".");
- }
-- if (*path == ':') {
-- *path = 0;
-- if (*path_n)
-- _dl_strcpy(mylibname, path_n);
-- else
-- _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */
-- _dl_strcat(mylibname, "/");
-- _dl_strcat(mylibname, name);
-+ _dl_strcat(mylibname, "/");
-+ _dl_strcat(mylibname, name);
- #ifdef __LDSO_SAFE_RUNPATH__
-- if (*mylibname == '/')
-+ if (*mylibname == '/')
- #endif
-- if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
-- return tpnt;
-- path_n = path+1;
-- }
-- path++;
-- } while (!done);
-+ if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
-+ return tpnt;
-+ }
- return NULL;
- }
-
-@@ -234,7 +238,8 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- if (pnt) {
- pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
- _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt);
-- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
-+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt,
-+ tpnt->libname)) != NULL)
- return tpnt1;
- }
- #endif
-@@ -243,7 +248,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
- if (_dl_library_path) {
- _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
-- if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt)) != NULL)
-+ if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt, NULL)) != NULL)
- {
- return tpnt1;
- }
-@@ -257,7 +262,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- if (pnt) {
- pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
- _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt);
-- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
-+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, NULL)) != NULL)
- return tpnt1;
- }
- #endif
-@@ -291,7 +296,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- /* Look for libraries wherever the shared library loader
- * was installed */
- _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath);
-- tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt);
-+ tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt, NULL);
- if (tpnt1 != NULL)
- return tpnt1;
- #endif
-@@ -304,7 +309,7 @@ struct elf_resolve *_dl_load_shared_library(unsigned rflags, struct dyn_elf **rp
- #ifndef __LDSO_CACHE_SUPPORT__
- ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib"
- #endif
-- , rpnt);
-+ , rpnt, NULL);
- if (tpnt1 != NULL)
- return tpnt1;
-
-diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
-index f38f9e3..3812908 100644
---- a/ldso/ldso/ldso.c
-+++ b/ldso/ldso/ldso.c
-@@ -402,6 +402,20 @@ static ptrdiff_t _dl_build_local_scope (struct elf_resolve **list,
- p += _dl_build_local_scope (p, q->tpnt);
- return p - list;
- }
-+
-+static void _dl_setup_progname(const char *argv0)
-+{
-+ char image[PATH_MAX];
-+ ssize_t s;
-+
-+ s = _dl_readlink("/proc/self/exe", image, sizeof(image));
-+ if (s > 0 && image[0] == '/') {
-+ image[s] = 0;
-+ _dl_progname = _dl_strdup(image);
-+ } else if (argv0) {
-+ _dl_progname = argv0;
-+ }
-+}
-
- void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
-@@ -454,9 +468,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
- * been fixed up by now. Still no function calls outside of this
- * library, since the dynamic resolver is not yet ready.
- */
-- if (argv[0]) {
-- _dl_progname = argv[0];
-- }
-+ _dl_setup_progname(argv[0]);
-
- #ifdef __DSBT__
- _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX];
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch b/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
deleted file mode 100644
index ee932c3803..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/0007-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 90516af9f776f9c2835b47fc52775dcb307a85ac Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 23 Jun 2012 15:59:01 -0700
-Subject: [PATCH 7/7] nptl/atfork: Hide pthread_atfork in shared versions
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
----
- libpthread/nptl/Makefile.in | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
-index 55eeba2..8cb8fa9 100644
---- a/libpthread/nptl/Makefile.in
-+++ b/libpthread/nptl/Makefile.in
-@@ -16,6 +16,7 @@ libc-shared-routines-y = forward.c libc-cancellation.c
- libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
- libpthread-shared-only-routines-y = version.c
- libpthread-static-only-routines-y = pthread_atfork.c
-+
- libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
- libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
- libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
-@@ -201,7 +202,7 @@ CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
- CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
-
- CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
--
-+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
- #
- # The rest of this file is uClibc specific.
- #
---
-2.1.4
-
diff --git a/meta/recipes-core/uclibc/uclibc-git/locale.cfg b/meta/recipes-core/uclibc/uclibc-git/locale.cfg
deleted file mode 100644
index fc66435163..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/locale.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-UCLIBC_HAS_LOCALE=y
-UCLIBC_HAS_XLOCALE=y
-UCLIBC_BUILD_MINIMAL_LOCALE=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/obstack.cfg b/meta/recipes-core/uclibc/uclibc-git/obstack.cfg
deleted file mode 100644
index 36bf9d6e4a..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/obstack.cfg
+++ /dev/null
@@ -1 +0,0 @@
-UCLIBC_HAS_OBSTACK=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
deleted file mode 100644
index 6575482b34..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# General Library Settings
-#
-# HAVE_NO_PIC is not set
-# DOPIC is not set
-# HAVE_NO_SHARED is not set
-# ARCH_HAS_NO_LDSO is not set
-HAVE_SHARED=y
-# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
-LDSO_LDD_SUPPORT=y
-LDSO_CACHE_SUPPORT=y
-# LDSO_PRELOAD_FILE_SUPPORT is not set
-LDSO_BASE_FILENAME="ld.so"
-# UCLIBC_STATIC_LDCONFIG is not set
-LDSO_RUNPATH=y
-UCLIBC_CTOR_DTOR=y
-LDSO_GNU_HASH_SUPPORT=y
-# HAS_NO_THREADS is not set
-UCLIBC_HAS_THREADS=y
-UCLIBC_HAS_THREADS_NATIVE=y
-PTHREADS_DEBUG_SUPPORT=y
-# LINUXTHREADS_OLD is not set
-UCLIBC_HAS_LFS=y
-# MALLOC is not set
-# MALLOC_SIMPLE is not set
-MALLOC_STANDARD=y
-MALLOC_GLIBC_COMPAT=y
-UCLIBC_DYNAMIC_ATEXIT=y
-COMPAT_ATEXIT=y
-UCLIBC_SUSV3_LEGACY=y
-UCLIBC_SUSV3_LEGACY_MACROS=y
-UCLIBC_SUSV4_LEGACY=y
-UCLIBC_HAS_SHADOW=y
-UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
-UCLIBC_HAS___PROGNAME=y
-UNIX98PTY_ONLY=y
-ASSUME_DEVPTS=y
-UCLIBC_HAS_LIBUTIL=y
-UCLIBC_HAS_TM_EXTENSIONS=y
-UCLIBC_HAS_TZ_CACHING=y
-UCLIBC_HAS_TZ_FILE=y
-UCLIBC_HAS_TZ_FILE_READ_MANY=y
-UCLIBC_TZ_FILE_PATH="/etc/TZ"
-
-#
-# Advanced Library Settings
-#
-UCLIBC_PWD_BUFFER_SIZE=256
-UCLIBC_GRP_BUFFER_SIZE=256
-
-#
-# Networking Support
-#
-UCLIBC_HAS_IPV6=y
-UCLIBC_HAS_RPC=y
-UCLIBC_HAS_FULL_RPC=y
-UCLIBC_HAS_REENTRANT_RPC=y
-UCLIBC_USE_NETLINK=y
-UCLIBC_SUPPORT_AI_ADDRCONFIG=y
-
-UCLIBC_HAS_BSD_RES_CLOSE=y
-UCLIBC_HAS_LIBRESOLV_STUB=y
-UCLIBC_HAS_LIBNSL_STUB=y
-
-#
-# String and Stdio Support
-#
-UCLIBC_HAS_STRING_GENERIC_OPT=y
-UCLIBC_HAS_STRING_ARCH_OPT=y
-UCLIBC_HAS_CTYPE_TABLES=y
-UCLIBC_HAS_CTYPE_SIGNED=y
-# UCLIBC_HAS_CTYPE_UNSAFE is not set
-UCLIBC_HAS_CTYPE_CHECKED=y
-# UCLIBC_HAS_CTYPE_ENFORCED is not set
-UCLIBC_HAS_WCHAR=y
-# UCLIBC_HAS_LOCALE is not set
-UCLIBC_HAS_HEXADECIMAL_FLOATS=y
-UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
-UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
-UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
-# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
-UCLIBC_HAS_STDIO_BUFSIZ_256=y
-# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
-# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
-UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
-# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
-# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
-UCLIBC_HAS_STDIO_GETC_MACRO=y
-UCLIBC_HAS_STDIO_PUTC_MACRO=y
-UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
-# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
-UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
-UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
-UCLIBC_HAS_PRINTF_M_SPEC=y
-UCLIBC_HAS_ERRNO_MESSAGES=y
-# UCLIBC_HAS_SYS_ERRLIST is not set
-UCLIBC_HAS_SIGNUM_MESSAGES=y
-# UCLIBC_HAS_SYS_SIGLIST is not set
-UCLIBC_HAS_GNU_GETOPT=y
-UCLIBC_HAS_GNU_GETSUBOPT=y
-
-#
-# Big and Tall
-#
-UCLIBC_HAS_REGEX=y
-# UCLIBC_HAS_REGEX_OLD is not set
-UCLIBC_HAS_FNMATCH=y
-# UCLIBC_HAS_FNMATCH_OLD is not set
-UCLIBC_HAS_WORDEXP=y
-UCLIBC_HAS_NFTW=y
-UCLIBC_HAS_FTW=y
-UCLIBC_HAS_FTS=y
-UCLIBC_HAS_GLOB=y
-UCLIBC_HAS_GNU_GLOB=y
-
-#
-# Library Installation Options
-#
-SHARED_LIB_LOADER_PREFIX="/lib"
-RUNTIME_PREFIX="/"
-DEVEL_PREFIX="//usr"
-MULTILIB_DIR="lib"
-
-#
-# Security options
-#
-# UCLIBC_BUILD_PIE is not set
-# UCLIBC_HAS_ARC4RANDOM is not set
-# HAVE_NO_SSP is not set
-# UCLIBC_HAS_SSP is not set
-UCLIBC_BUILD_RELRO=y
-UCLIBC_BUILD_NOW=y
-UCLIBC_BUILD_NOEXECSTACK=y
-
-#
-# uClibc development/debugging options
-#
-CROSS_COMPILER_PREFIX=""
-UCLIBC_EXTRA_CFLAGS=""
-# DODEBUG is not set
-# DODEBUG_PT is not set
-# DOSTRIP is not set
-# DOASSERTS is not set
-# SUPPORT_LD_DEBUG is not set
-# SUPPORT_LD_DEBUG_EARLY is not set
-# UCLIBC_MALLOC_DEBUGGING is not set
-UCLIBC_HAS_BACKTRACE=y
-WARNINGS="-Wall"
-# EXTRA_WARNINGS is not set
-# DOMULTI is not set
-# UCLIBC_MJN3_ONLY is not set
-
-# math stuff for perl
-DO_C99_MATH=y
-UCLIBC_HAS_LONG_DOUBLE_MATH=y
-UCLIBC_HAS_FENV=y
-UCLIBC_LINUX_MODULE_26=y
-# UCLIBC_LINUX_MODULE_24 is not set
-UCLIBC_LINUX_SPECIFIC=y
-UCLIBC_HAS_REALTIME=y
-UCLIBC_HAS_ADVANCED_REALTIME=y
-UCLIBC_HAS_NETWORK_SUPPORT=y
-UCLIBC_HAS_SOCKET=y
-UCLIBC_HAS_BSD_ERR=y
-UCLIBC_HAS_SYSLOG=y
-UCLIBC_HAS_CRYPT=y
-UCLIBC_HAS_CRYPT_IMPL=y
-UCLIBC_HAS_GNU_ERROR=y
-UCLIBC_HAS_PTY=y
-UCLIBC_BSD_SPECIFIC=y
-UCLIBC_HAS_EPOLL=y
-UCLIBC_HAS_FLOATS=y
-
-# The below option is needed for ARM since depending
-# upong what intruction set is chosen this will be
-# enabled. As such it is harmless and will be punted
-# by menuconfig for other arches.
-
-# COMPILE_IN_THUMB_MODE is not set
-
-# needed by systemd
-UCLIBC_HAS_UTMPX=y
-UCLIBC_LINUX_MODULE_26=y
-UCLIBC_HAS_RESOLVER_SUPPORT=y
-# needed for LTP
-UCLIBC_SUSV4_LEGACY=y
-UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
-DO_XSI_MATH=y
-UCLIBC_SV4_DEPRECATED=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/uClibc.machine
deleted file mode 100644
index 595f444dac..0000000000
--- a/meta/recipes-core/uclibc/uclibc-git/uClibc.machine
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Version: 0.9.32-git
-# Mon Jul 19 01:34:29 2010
-#
-#
-# Using ELF file format
-#
-FORCE_OPTIONS_FOR_ARCH=y
-ARCH_HAS_MMU=y
-ARCH_USE_MMU=y
-KERNEL_HEADERS="/usr/include"
-HAVE_DOT_CONFIG=y
-
diff --git a/meta/recipes-core/uclibc/uclibc-initial_git.bb b/meta/recipes-core/uclibc/uclibc-initial_git.bb
deleted file mode 100644
index c937ccb108..0000000000
--- a/meta/recipes-core/uclibc/uclibc-initial_git.bb
+++ /dev/null
@@ -1,36 +0,0 @@
-SECTION = "base"
-require uclibc.inc
-require uclibc-git.inc
-
-DEPENDS = "linux-libc-headers ncurses-native virtual/${TARGET_PREFIX}gcc-initial libgcc-initial kern-tools-native"
-PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
-
-PACKAGES = ""
-PACKAGES_DYNAMIC = ""
-
-STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
-STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
-
-do_install() {
- # Install initial headers into the cross dir
- make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
- install_headers install_startfiles
-
- # add links to linux-libc-headers: final uclibc build need this.
- for t in linux asm asm-generic; do
- if [ -d ${D}${includedir}/$t ]; then
- rm -rf ${D}${includedir}/$t
- fi
- ln -sf ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
- done
-
-}
-do_compile() {
- :
-}
-
-do_siteconfig () {
- :
-}
-
-do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
diff --git a/meta/recipes-core/uclibc/uclibc-package.inc b/meta/recipes-core/uclibc/uclibc-package.inc
deleted file mode 100644
index c1815f9a31..0000000000
--- a/meta/recipes-core/uclibc/uclibc-package.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-# Ensure the uclibc-dev package is processed before uclibc-staticdev to allow
-# *_nonshared.a libraries to be packaged in the uclibc-dev package.
-PACKAGES = "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db uclibc-argp uclibc-backtrace uclibc-libcrypt uclibc-libintl uclibc-libnsl uclibc-libresolv uclibc-libm uclibc-libdl uclibc-libutil uclibc-libpthread uclibc-librt ${PN}-dbg ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
-
-FILES_uclibc-libcrypt = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so"
-FILES_uclibc-libintl = "${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so"
-FILES_uclibc-libnsl = "${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so"
-FILES_uclibc-libresolv = "${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so"
-FILES_uclibc-libm = "${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so"
-FILES_uclibc-libdl = "${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so"
-FILES_uclibc-libutil = "${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so"
-FILES_uclibc-libpthread = "${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so"
-FILES_uclibc-librt = "${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so"
-
-FILES_ldd = "${bindir}/ldd"
-FILES_uclibc-utils = "${bindir} ${sbindir}"
-FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
-FILES_uclibc-gconv = "${libdir}/gconv"
-FILES_uclibc-thread-db = "${base_libdir}/libthread_db*"
-FILES_uclibc-argp = "${base_libdir}/libuargp-*.so ${base_libdir}/libuargp*.so.*"
-FILES_uclibc-backtrace = "${base_libdir}/libubacktrace-*.so ${base_libdir}/libubacktrace*.so.*"
-
-# The last line (gdb and lib1) is for uclinux-uclibc builds
-uclibc_baselibs = "${base_libdir}/ld*.so.* ${base_libdir}/ld*.so \
- ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \
- ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \
- "
-FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
-FILES_${PN}-dev += "\
- ${libdir}/lib*.so \
- ${libdir}/*_nonshared.a \
- ${libdir}/[S]*crt[1in].o \
- ${libdir}/crtreloc*.o \
- ${includedir}/*.h ${includedir}/*/*.h \
- "
-FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
- ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
deleted file mode 100644
index 533aa3d95e..0000000000
--- a/meta/recipes-core/uclibc/uclibc.inc
+++ /dev/null
@@ -1,168 +0,0 @@
-SUMMARY = "C library for embedded systems"
-DESCRIPTION = "The name uClibc is an abbreviation for 'the \
-microcontroller C library'. For simplicity, uClibc is pronounced \
-'yew-see-lib-see'. The goal of uClibc is to provide as much \
-functionality as possible in a small amount of space, and it is intended \
-primarily for embedded use. It is also highly configurable in supported \
-features, at the cost of ABI differences for different configurations. \
-uClibc has been designed from the ground up to be a C library for \
-embedded Linux. It is NOT compatible with binaries linked against glibc."
-
-LICENSE = "LGPLv2.1+"
-SECTION = "libs"
-LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
- file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \
-file://${S}/test/regex/testregex.c;beginline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960"
-PR = "r9"
-
-require uclibc-config.inc
-
-PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
-TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
-
-# siteconfig.bbclass runs configure which needs a working compiler
-# For the compiler to work we need a working libc yet libc isn't
-# in the sysroots directory at this point. This means the libc.so
-# linker script won't work as the --sysroot setting isn't correct.
-# Here we create a hacked up libc linker script and pass in the right
-# flags to let configure work. Ugly.
-EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
-siteconfig_do_siteconfig_gencache_prepend = " \
-mkdir -p ${WORKDIR}/site_config_libc; \
-cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
-sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
-"
-
-# For now, we will skip building of a gcc package if it is a uclibc one
-# and our build is not a uclibc one, and we skip a glibc one if our build
-# is a uclibc build.
-COMPATIBLE_HOST = ".*-uclibc.*"
-
-INHIBIT_DEFAULT_DEPS = "1"
-
-# do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in
-# the CFLAGS (when building the utils).
-OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}'"
-EXTRA_OEMAKE = "${OEMAKE_NO_CC} \
- 'HOSTCC=${BUILD_CC}' \
- 'HOST_CFLAGS=${BUILD_CFLAGS}' \
- 'CC=${CC}' \
- ARCH=${UCLIBC_ARCH}"
-
-EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
-
-# enable verbose output:
-export V="2"
-
-# -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
-# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
-#
-CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
-UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
-
-do_compile_prepend () {
- unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
- oe_runmake pregen
-}
-
-configmangle = '/^KERNEL_HEADERS/d; \
- /^RUNTIME_PREFIX/d; \
- /^DEVEL_PREFIX/d; \
- /^SHARED_LIB_LOADER_PREFIX/d; \
- /^UCLIBC_EXTRA_CFLAGS/d; \
- s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
- ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][d.getVar("ARM_INSTRUCTION_SET", True) != "arm"]} \
- ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][d.getVar("USE_NLS", True) == "yes"]} \
- ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][d.getVar("TARGET_ARCH", True) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
- /^CROSS/d; \
- /^TARGET_ARCH=/d; \
- /^TARGET_/s,^\([^=]*\).*,# \1 is not set,g; \
- s,^DOSTRIP.*,# DOSTRIP is not set,g; \
- /_[EO]*ABI/d; \
- /HAS_FPU/d; \
- ${@["","s,.*MULTILIB_DIR.*,MULTILIB_DIR=\"${baselib}\",;"][d.getVar("baselib", True) != "lib"]} \
- '
-OE_FEATURES := "${@features_to_uclibc_conf(d)}"
-OE_DEL := "${@features_to_uclibc_del(d)}"
-python () {
- if "${OE_DEL}":
- d.setVar('configmangle_append', "${OE_DEL}" + "\n")
-
- # by default uclibc uses mips1 ISA for o32 ABI
- # if we use TARGET_CC_ARCH="-march=mips32" we end up
- # with conflicting march options to gcc. Here we
- # ask for MIPS32 ISA to match the chosen arch
- tune = d.getVar("DEFAULTTUNE", True)
- if tune.startswith('mips32'):
- import re
- tune = re.sub('(el)*(-nf)*', '', tune)
- d.setVar('configmangle_append',
- "/^### MIPS32_CHECK$/a\\\nCONFIG_MIPS_ISA_%s=y\n\n" % (tune.upper()))
- if "${OE_FEATURES}":
- d.setVar('configmangle_append',
- "/^### DISTRO FEATURES$/a\\\n%s\n\n" %
- ("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
- d.setVar('configmangle_append',
- "/^### CROSS$/a\\\n%s\n" %
- ("\\n".join(["CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
- "UCLIBC_EXTRA_CFLAGS=\"${UCLIBC_EXTRA_CFLAGS}\"",
- "KERNEL_HEADERS=\"${STAGING_INCDIR}\"",
- "RUNTIME_PREFIX=\"/\"",
- "DEVEL_PREFIX=\"/${prefix}\"",
- "SHARED_LIB_LOADER_PREFIX=\"/lib\"",
- ])
- ))
- d.setVar('configmangle_append',
- "/^### TGT$/a\\\nTARGET_ARCH=\"%s\"\\nTARGET_%s=y\n" %
- ("${UCLIBC_ARCH}", "${UCLIBC_ARCH}"))
- d.setVar('configmangle_append',
- "/^### FPU$/a\\\n%s\n\n" % (["UCLIBC_HAS_FPU=y","# UCLIBC_HAS_FPU is not set"][d.getVar('TARGET_FPU', True) in [ 'soft' ]]))
- if "${UCLIBC_ENDIAN}":
- d.setVar('configmangle_append',
- "/^### ABI$/a\\\nARCH_WANTS_%s_ENDIAN=y\n\n" % ("${UCLIBC_ENDIAN}"))
- if "${UCLIBC_ABI}":
- d.setVar('configmangle_append',
- "/^### ABI$/a\\\nCONFIG_%s=y\n\n" % ("${UCLIBC_ABI}"))
-}
-
-python do_patch_append() {
- import subprocess
- subprocess.call("ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux", shell=True)
- subprocess.call("ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm", shell=True)
-}
-
-do_configure() {
- rm -f ${S}/.config
-
- # OpenEmbedded splits the uClibc.config in two parts:
- # uClibc.machine, uClibc.distro
- echo "### uClibc.machine ###" >${S}/merged.config
- cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
- echo "### uClibc.distro ###" >>${S}/merged.config
- cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
- echo "### CROSS" >>${S}/merged.config
- echo "### TGT" >>${S}/merged.config
- echo "### MMU" >>${S}/merged.config
- echo "### FPU" >>${S}/merged.config
- echo "### ABI" >>${S}/merged.config
- echo "### DISTRO FEATURES" >>${S}/merged.config
- echo "### MIPS32_CHECK" >>${S}/merged.config
-
- # Mangle the resulting .config depending on OE variables
- sed -i -e '${configmangle}' ${S}/merged.config
- cp ${S}/merged.config .config
- merge_config.sh -r -n -m .config ${@" ".join(find_cfgs(d))}
- cml1_do_configure
-
-}
-
-do_install() {
- oe_runmake PREFIX=${D} install
- rm -rf ${D}${includedir}/iconv.h
-}
-
-# build ldd, ldconfig and friends but only for full uclibc
-do_install_append_pn-uclibc () {
- oe_runmake PREFIX=${D} "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" -C utils utils_install
-}
-
diff --git a/meta/recipes-core/uclibc/uclibc_git.bb b/meta/recipes-core/uclibc/uclibc_git.bb
deleted file mode 100644
index fd02b3d612..0000000000
--- a/meta/recipes-core/uclibc/uclibc_git.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-require uclibc.inc
-require uclibc-package.inc
-require uclibc-git.inc
-
-STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
-STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
-
-PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
-
-DEPENDS = "virtual/${TARGET_PREFIX}binutils \
- virtual/${TARGET_PREFIX}gcc-initial \
- virtual/${TARGET_PREFIX}libc-initial \
- linux-libc-headers ncurses-native \
- libgcc-initial kern-tools-native"
-
-RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
-RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
-# uclibc does not really have libsegfault but then using the one from glibc is also not
-# going to work. So we pretend that we have it to make bitbake not pull other recipes
-# to satisfy this dependency for the images/tasks
-
-RPROVIDES_${PN} += "libsegfault rtld(GNU_HASH)"
diff --git a/meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch b/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
index fe2ba5328d..fe2ba5328d 100644
--- a/meta/recipes-core/systemd/systemd/0014-Revert-rules-remove-firmware-loading-rules.patch
+++ b/meta/recipes-core/udev/eudev/0014-Revert-rules-remove-firmware-loading-rules.patch
diff --git a/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
index 3e3aa278bd..db333e9376 100644
--- a/meta/recipes-core/systemd/systemd/0015-Revert-udev-remove-userspace-firmware-loading-suppor.patch
+++ b/meta/recipes-core/udev/eudev/Revert-udev-remove-userspace-firmware-loading-suppor.patch
@@ -1,105 +1,43 @@
-From 7f074def4e32045353ba4336d703e17b8de7ec4e Mon Sep 17 00:00:00 2001
-From: Jonathan Liu <net147@gmail.com>
-Date: Thu, 19 Mar 2015 15:01:33 +1100
+From e415372cc7a2f52e70e1cfa8c6c1f633b411355d Mon Sep 17 00:00:00 2001
+From: Lauren Post <lauren.post@nxp.com>
+Date: Wed, 8 Jun 2016 06:51:56 -0500
Subject: [PATCH] Revert "udev: remove userspace firmware loading support"
-This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca.
-Userspace firmware loading support is needed for Linux < 3.7.
+This reverts commit 3b717594600fa717cdf9bcfd0c7c1b703b245482.
+
+Conflicts:
+ configure.ac
+ src/udev/udevd.c
Upstream-Status: Inappropriate [OE specific]
-Signed-off-by: Jonathan Liu <net147@gmail.com>
+Signed-off-by: Lauren Post <lauren.post@nxp.com>
---
- Makefile.am | 12 +++
- README | 9 ++-
- TODO | 1 +
- configure.ac | 20 +++++
+ configure.ac | 39 +++++++++-
+ rules/Makefile.am | 5 ++
+ src/udev/Makefile.am | 10 +++
src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++
src/udev/udev-builtin.c | 3 +
src/udev/udev.h | 6 ++
src/udev/udevd.c | 13 ++++
- 8 files changed, 214 insertions(+), 4 deletions(-)
+ 7 files changed, 227 insertions(+), 3 deletions(-)
create mode 100644 src/udev/udev-builtin-firmware.c
-diff --git a/Makefile.am b/Makefile.am
-index bf04d31..9394700 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -3678,6 +3678,18 @@ libudev_core_la_LIBADD = \
- $(BLKID_LIBS) \
- $(KMOD_LIBS)
-
-+libudev_core_la_CPPFLAGS = \
-+ $(AM_CPPFLAGS) \
-+ -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
-+
-+if ENABLE_FIRMWARE
-+libudev_core_la_SOURCES += \
-+ src/udev/udev-builtin-firmware.c
-+
-+dist_udevrules_DATA += \
-+ rules/50-firmware.rules
-+endif
-+
- if HAVE_KMOD
- libudev_core_la_SOURCES += \
- src/udev/udev-builtin-kmod.c
-diff --git a/README b/README
-index c722092..db382d2 100644
---- a/README
-+++ b/README
-@@ -36,7 +36,8 @@ LICENSE:
- - except src/udev/* which is (currently still) GPLv2, GPLv2+
-
- REQUIREMENTS:
-- Linux kernel >= 3.7
-+ Linux kernel >= 3.0
-+ Linux kernel >= 3.3 for loop device partition support features with nspawn
- Linux kernel >= 3.8 for Smack support
-
- Kernel Config Options:
-@@ -51,14 +52,14 @@ REQUIREMENTS:
- CONFIG_PROC_FS
- CONFIG_FHANDLE (libudev, mount and bind mount handling)
-
-- udev will fail to work with the legacy sysfs layout:
-+ Udev will fail to work with the legacy layout:
- CONFIG_SYSFS_DEPRECATED=n
-
- Legacy hotplug slows down the system and confuses udev:
- CONFIG_UEVENT_HELPER_PATH=""
-
-- Userspace firmware loading is not supported and should
-- be disabled in the kernel:
-+ Userspace firmware loading is deprecated, will go away, and
-+ sometimes causes problems:
- CONFIG_FW_LOADER_USER_HELPER=n
-
- Some udev rules and virtualization detection relies on it:
-diff --git a/TODO b/TODO
-index 255a4f2..407bdd0 100644
---- a/TODO
-+++ b/TODO
-@@ -727,6 +727,7 @@ Features:
- * ExecOnFailure=/usr/bin/foo
-
- * udev:
-+ - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n)
- - move to LGPL
- - kill scsi_id
- - add trigger --subsystem-match=usb/usb_device device
diff --git a/configure.ac b/configure.ac
-index 97a29d6..13b80ce 100644
+index 8691891..65028c2 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -1245,6 +1245,25 @@ fi
- AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
+@@ -238,9 +238,42 @@ AC_CHECK_DECL([unshare],
+ [#include <sched.h>])
# ------------------------------------------------------------------------------
+-AC_PATH_TOOL(GPERF, gperf)
+-if test -z "$GPERF" ; then
+- AC_MSG_ERROR([*** gperf not found])
+AC_ARG_WITH(firmware-path,
+ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
-+ [Firmware search path (default="")]),
-+ [], [with_firmware_path=""])
++ [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
++ [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
+OLD_IFS=$IFS
+IFS=:
+for i in $with_firmware_path; do
@@ -115,17 +53,76 @@ index 97a29d6..13b80ce 100644
+AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
+
+# ------------------------------------------------------------------------------
- AC_ARG_ENABLE([gudev],
- AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
- [], [enable_gudev=yes])
-@@ -1533,6 +1552,7 @@ AC_MSG_RESULT([
- Build Python: ${PYTHON}
- Installation Python: ${PYTHON_BINARY}
- sphinx binary: ${SPHINX_BUILD}
-+ firmware path: ${FIRMWARE_PATH}
- PAM modules dir: ${with_pamlibdir}
- PAM configuration dir: ${with_pamconfdir}
- D-Bus policy dir: ${with_dbuspolicydir}
++AC_ARG_ENABLE([gudev],
++ AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
++ [], [enable_gudev=yes])
++AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
++AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
++
++# ------------------------------------------------------------------------------
++AC_ARG_ENABLE([keymap],
++ AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
++ [], [enable_keymap=yes])
++
++if test "x$enable_keymap" = "xyes"; then
++ AC_PATH_TOOL(GPERF, gperf)
++ if test -z "$GPERF" ; then
++ AC_MSG_ERROR([*** gperf not found])
++ fi
++ AC_DEFINE([ENABLE_KEYMAP], [1], [Define if we are enabling rule generator])
+ fi
+
+ # ------------------------------------------------------------------------------
+diff --git a/rules/Makefile.am b/rules/Makefile.am
+index 24c099c..d714ae3 100644
+--- a/rules/Makefile.am
++++ b/rules/Makefile.am
+@@ -22,6 +22,11 @@ dist_udevrules_DATA += \
+ 80-net-name-slot.rules
+ endif
+
++if ENABLE_FIRMWARE
++dist_udevrules_DATA += \
++ 50-firmware.rules
++endif
++
+ if HAVE_BLKID
+ dist_udevrules_DATA += \
+ 60-persistent-storage.rules
+diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am
+index 401af01..742fbc8 100644
+--- a/src/udev/Makefile.am
++++ b/src/udev/Makefile.am
+@@ -53,12 +53,18 @@ libudev_core_la_SOURCES = \
+ udev-ctrl.c \
+ udev-builtin.c \
+ udev-builtin-btrfs.c \
++ udev-builtin-firmware.c \
+ udev-builtin-hwdb.c \
+ udev-builtin-input_id.c \
+ udev-builtin-net_id.c \
+ udev-builtin-path_id.c \
+ udev-builtin-usb_id.c
+
++if ENABLE_FIRMWARE
++libudev_core_la_SOURCES += \
++ udev-builtin-firmware.c
++endif
++
+ include_HEADERS = \
+ udev.h
+
+@@ -86,6 +92,10 @@ libudev_core_la_LIBADD += \
+ $(KMOD_LIBS)
+ endif
+
++libudev_core_la_CPPFLAGS = \
++ $(AM_CPPFLAGS) \
++ -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
++
+ #
+ # Extras
+ #
diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c
new file mode 100644
index 0000000..bd8c2fb
@@ -287,7 +284,7 @@ index 0000000..bd8c2fb
+ .run_once = true,
+};
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
-index 1950ec2..f21c0b6 100644
+index 74b3bdc..3657106 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -34,6 +34,9 @@ static const struct udev_builtin *builtins[] = {
@@ -301,10 +298,10 @@ index 1950ec2..f21c0b6 100644
[UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
[UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
diff --git a/src/udev/udev.h b/src/udev/udev.h
-index dece6ec..f7ee1e7 100644
+index 198cb2c..01a1e9c 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
-@@ -151,6 +151,9 @@ enum udev_builtin_cmd {
+@@ -149,6 +149,9 @@ enum udev_builtin_cmd {
UDEV_BUILTIN_BLKID,
#endif
UDEV_BUILTIN_BTRFS,
@@ -314,7 +311,7 @@ index dece6ec..f7ee1e7 100644
UDEV_BUILTIN_HWDB,
UDEV_BUILTIN_INPUT_ID,
UDEV_BUILTIN_KEYBOARD,
-@@ -179,6 +182,9 @@ struct udev_builtin {
+@@ -173,6 +176,9 @@ struct udev_builtin {
extern const struct udev_builtin udev_builtin_blkid;
#endif
extern const struct udev_builtin udev_builtin_btrfs;
@@ -325,20 +322,20 @@ index dece6ec..f7ee1e7 100644
extern const struct udev_builtin udev_builtin_input_id;
extern const struct udev_builtin udev_builtin_keyboard;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
-index 99d4c89..71af1e1 100644
+index b1de97a..35655d8 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
-@@ -99,6 +99,9 @@ struct event {
- dev_t devnum;
- int ifindex;
+@@ -101,6 +101,9 @@ struct event {
bool is_block;
+ usec_t start_usec;
+ bool warned;
+#ifdef HAVE_FIRMWARE
+ bool nodelay;
+#endif
};
static inline struct event *node_to_event(struct udev_list_node *node) {
-@@ -472,6 +475,10 @@ static int event_queue_insert(struct udev_device *dev) {
+@@ -491,6 +494,10 @@ static int event_queue_insert(struct udev_device *dev) {
event->devnum = udev_device_get_devnum(dev);
event->is_block = streq("block", udev_device_get_subsystem(dev));
event->ifindex = udev_device_get_ifindex(dev);
@@ -349,7 +346,7 @@ index 99d4c89..71af1e1 100644
log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev),
udev_device_get_action(dev), udev_device_get_subsystem(dev));
-@@ -548,6 +555,12 @@ static bool is_devpath_busy(struct event *event) {
+@@ -566,6 +573,12 @@ static bool is_devpath_busy(struct event *event) {
return true;
}
@@ -363,5 +360,5 @@ index 99d4c89..71af1e1 100644
if (event->devpath[common] == '/') {
event->delaying_seqnum = loop_event->seqnum;
--
-2.3.3
+1.9.1
diff --git a/meta/recipes-core/udev/udev/devfs-udev.rules b/meta/recipes-core/udev/eudev/devfs-udev.rules
index 0ba1ad4e7f..0ba1ad4e7f 100644
--- a/meta/recipes-core/udev/udev/devfs-udev.rules
+++ b/meta/recipes-core/udev/eudev/devfs-udev.rules
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/eudev/init
index 0ab028b391..c60dbbf6d5 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/eudev/init
@@ -14,25 +14,7 @@ export TZ=/etc/localtime
[ -d /sys/class ] || exit 1
[ -r /proc/mounts ] || exit 1
[ -x @UDEVD@ ] || exit 1
-SYSCONF_CACHED="/etc/udev/cache.data"
-SYSCONF_TMP="/dev/shm/udev.cache"
-DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
-# A list of files which are used as a criteria to judge whether the udev cache could be reused.
-CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
-[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
-
-# List of files whose metadata (size/mtime/name) will be included in cached
-# system state.
-META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
-
-# Command to compute system configuration.
-sysconf_cmd () {
- cat -- $CMP_FILE_LIST
- stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
-}
-
-[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
[ -f /etc/default/rcS ] && . /etc/default/rcS
@@ -66,42 +48,11 @@ case "$1" in
# /var/volatile/tmp directory to be available.
mkdir -m 1777 -p /var/volatile/tmp
- # Cache handling.
- if [ "$DEVCACHE" != "" ]; then
- if [ -e $DEVCACHE ]; then
- sysconf_cmd > "$SYSCONF_TMP"
- if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then
- tar xmf $DEVCACHE -C / -m
- not_first_boot=1
- [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
- [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
- [ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN"
- else
- # Output detailed reason why the cached /dev is not used
- cat <<EOF
-udev: Not using udev cache because of changes detected in the following files:
-udev: $CMP_FILE_LIST
-udev: $META_FILE_LIST
-udev: The udev cache will be regenerated. To identify the detected changes,
-udev: compare the cached sysconf at $SYSCONF_CACHED
-udev: against the current sysconf at $SYSCONF_TMP
-EOF
- touch "$DEVCACHE_REGEN"
- fi
- else
- if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
- # If rootfs is not read-only, it's possible that a new udev cache would be generated;
- # otherwise, we do not bother to read files.
- touch "$DEVCACHE_REGEN"
- fi
- fi
- fi
-
# make_extra_nodes
kill_udevd > "/dev/null" 2>&1
# trigger the sorted events
- [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
+ [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
@UDEVD@ -d
udevadm control --env=STARTUP=1
diff --git a/meta/recipes-core/udev/udev/links.conf b/meta/recipes-core/udev/eudev/links.conf
index 8fff922db6..8fff922db6 100644
--- a/meta/recipes-core/udev/udev/links.conf
+++ b/meta/recipes-core/udev/eudev/links.conf
diff --git a/meta/recipes-core/udev/udev/local.rules b/meta/recipes-core/udev/eudev/local.rules
index d502cdd6ba..d502cdd6ba 100644
--- a/meta/recipes-core/udev/udev/local.rules
+++ b/meta/recipes-core/udev/eudev/local.rules
diff --git a/meta/recipes-core/udev/udev/permissions.rules b/meta/recipes-core/udev/eudev/permissions.rules
index 205b733292..bfdff4f8ce 100644
--- a/meta/recipes-core/udev/udev/permissions.rules
+++ b/meta/recipes-core/udev/eudev/permissions.rules
@@ -10,9 +10,9 @@ SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver"
# devices needed to load the drivers providing them
-KERNEL=="tun", OPTIONS+="ignore_remove"
-KERNEL=="ppp", OPTIONS+="ignore_remove"
-KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove"
+KERNEL=="tun", OPTIONS+="ignore:remove"
+KERNEL=="ppp", OPTIONS+="ignore:remove"
+KERNEL=="loop[0-9]*", OPTIONS+="ignore:remove"
# default permissions for block devices
SUBSYSTEM=="block", GROUP="disk"
diff --git a/meta/recipes-core/udev/udev/run.rules b/meta/recipes-core/udev/eudev/run.rules
index 75d71375bb..75d71375bb 100644
--- a/meta/recipes-core/udev/udev/run.rules
+++ b/meta/recipes-core/udev/eudev/run.rules
diff --git a/meta/recipes-core/udev/udev/udev.rules b/meta/recipes-core/udev/eudev/udev.rules
index a19d4a0bf6..a19d4a0bf6 100644
--- a/meta/recipes-core/udev/udev/udev.rules
+++ b/meta/recipes-core/udev/eudev/udev.rules
diff --git a/meta/recipes-core/udev/eudev_3.2.10.bb b/meta/recipes-core/udev/eudev_3.2.10.bb
new file mode 100644
index 0000000000..347495cbdb
--- /dev/null
+++ b/meta/recipes-core/udev/eudev_3.2.10.bb
@@ -0,0 +1,97 @@
+SUMMARY = "eudev is a fork of systemd's udev"
+HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev"
+DESCRIPTION = "eudev is Gentoo's fork of udev, systemd's device file manager for the Linux kernel. It manages device nodes in /dev and handles all user space actions when adding or removing devices."
+LICENSE = "GPLv2.0+ & LGPL-2.1+"
+LICENSE:libudev = "LGPL-2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+DEPENDS = "glib-2.0 glib-2.0-native gperf-native kmod libxslt-native util-linux"
+
+PROVIDES = "udev"
+
+SRC_URI = "https://dev.gentoo.org/~blueness/${BPN}/${BP}.tar.gz \
+ file://0014-Revert-rules-remove-firmware-loading-rules.patch \
+ file://Revert-udev-remove-userspace-firmware-loading-suppor.patch \
+ file://devfs-udev.rules \
+ file://init \
+ file://links.conf \
+ file://local.rules \
+ file://permissions.rules \
+ file://run.rules \
+ file://udev.rules \
+"
+
+SRC_URI[md5sum] = "60b135a189523f333cea5f71a3345c8d"
+SRC_URI[sha256sum] = "87bb028d470fd1b85169349b44c55d5b733733dc2d50ddf1196e026725ead034"
+
+inherit autotools update-rc.d qemu pkgconfig features_check
+
+CONFLICT_DISTRO_FEATURES = "systemd"
+
+EXTRA_OECONF = " \
+ --sbindir=${base_sbindir} \
+ --with-rootlibdir=${base_libdir} \
+ --with-rootlibexecdir=${nonarch_base_libdir}/udev \
+ --with-rootprefix= \
+"
+
+PACKAGECONFIG ??= "hwdb"
+PACKAGECONFIG[hwdb] = "--enable-hwdb,--disable-hwdb"
+
+do_install:append() {
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
+ sed -i s%@UDEVD@%${base_sbindir}/udevd% ${D}${sysconfdir}/init.d/udev
+
+ install -d ${D}${sysconfdir}/udev/rules.d
+ install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
+
+ # Use classic network interface naming scheme
+ touch ${D}${sysconfdir}/udev/rules.d/80-net-name-slot.rules
+
+ # hid2hci has moved to bluez4. removed in udev as of version 169
+ rm -f ${D}${base_libdir}/udev/hid2hci
+
+ # duplicate udevadm for postinst script
+ install -d ${D}${libexecdir}
+ ln ${D}${bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
+}
+
+do_install:prepend:class-target () {
+ # Remove references to buildmachine
+ sed -i -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
+ ${B}/src/udev/keyboard-keys-from-name.h
+}
+
+INITSCRIPT_NAME = "udev"
+INITSCRIPT_PARAMS = "start 04 S ."
+
+PACKAGES =+ "libudev"
+PACKAGES =+ "eudev-hwdb"
+
+
+FILES:${PN} += "${libexecdir} ${nonarch_base_libdir}/udev ${bindir}/udevadm"
+FILES:${PN}-dev = "${datadir}/pkgconfig/udev.pc \
+ ${includedir}/libudev.h ${libdir}/libudev.so \
+ ${includedir}/udev.h ${libdir}/libudev.la \
+ ${libdir}/libudev.a ${libdir}/pkgconfig/libudev.pc"
+FILES:libudev = "${base_libdir}/libudev.so.*"
+FILES:eudev-hwdb = "${sysconfdir}/udev/hwdb.d"
+
+RDEPENDS:eudev-hwdb += "eudev"
+
+RPROVIDES:${PN} = "hotplug udev"
+RPROVIDES:eudev-hwdb += "udev-hwdb"
+
+PACKAGE_WRITE_DEPS += "qemu-native"
+pkg_postinst:eudev-hwdb () {
+ if test -n "$D"; then
+ $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX}
+ else
+ udevadm hwdb --update
+ fi
+}
+
+pkg_prerm:eudev-hwdb () {
+ rm -f $D${sysconfdir}/udev/hwdb.bin
+}
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index 3eea910854..b23731870e 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,11 +4,29 @@
#
# Attempt to mount any added block devices and umount any removed devices
+BASE_INIT="`readlink -f "@base_sbindir@/init"`"
+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+ # systemd as init uses systemd-mount to mount block devices
+ MOUNT="/usr/bin/systemd-mount"
+ UMOUNT="/usr/bin/systemd-umount"
+
+ if [ -x $MOUNT ] && [ -x $UMOUNT ];
+ then
+ logger "Using systemd-mount to finish mount"
+ else
+ logger "Linux init is using systemd, so please install systemd-mount to finish mount"
+ exit 1
+ fi
+else
+ MOUNT="/bin/mount"
+ UMOUNT="/bin/umount"
+fi
-MOUNT="/bin/mount"
PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
-for line in `grep -v ^# /etc/udev/mount.blacklist`
+
+for line in `grep -h -v ^# /etc/udev/mount.blacklist /etc/udev/mount.blacklist.d/*`
do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
then
@@ -17,22 +35,79 @@ do
fi
done
-automount() {
+automount_systemd() {
+ name="`basename "$DEVNAME"`"
+
+ # Skip already mounted partitions
+ if [ -f /run/systemd/transient/run-media-$name.mount ]; then
+ logger "mount.sh/automount" "/run/media/$name already mounted"
+ return
+ fi
+
+ # Skip the partition which are already in /etc/fstab
+ grep "^[[:space:]]*$DEVNAME" /etc/fstab && return
+ for n in LABEL PARTLABEL UUID PARTUUID; do
+ tmp="$(lsblk -o $n $DEVNAME | sed -e '1d')"
+ test -z "$tmp" && continue
+ tmp="$n=$tmp"
+ grep "^[[:space:]]*$tmp" /etc/fstab && return
+ done
+
+ [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+ MOUNT="$MOUNT -o silent"
+
+ # If filesystemtype is vfat, change the ownership group to 'disk', and
+ # grant it with w/r/x permissions.
+ case $ID_FS_TYPE in
+ vfat|fat)
+ MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`"
+ ;;
+ swap)
+ return ;;
+ # TODO
+ *)
+ ;;
+ esac
+
+ if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+ then
+ #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
+ rm_dir "/run/media/$name"
+ else
+ logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
+ touch "/tmp/.automount-$name"
+ fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
+ if [ -x "$PMOUNT" ]; then
+ $PMOUNT $DEVNAME 2> /dev/null
+ elif [ -x $MOUNT ]; then
+ $MOUNT $DEVNAME 2> /dev/null
+ fi
+
+ # If the device isn't mounted at this point, it isn't
+ # configured in fstab
+ grep -q "^$DEVNAME " /proc/mounts && return
+
! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
# Silent util-linux's version of mounting auto
if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
then
MOUNT="$MOUNT -o silent"
fi
-
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with w/r/x permissions.
case $ID_FS_TYPE in
vfat|fat)
MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`"
;;
+ swap)
+ return ;;
# TODO
*)
;;
@@ -63,28 +138,24 @@ name="`basename "$DEVNAME"`"
[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
- if [ -x "$PMOUNT" ]; then
- $PMOUNT $DEVNAME 2> /dev/null
- elif [ -x $MOUNT ]; then
- $MOUNT $DEVNAME 2> /dev/null
- fi
-
- # If the device isn't mounted at this point, it isn't
- # configured in fstab (note the root filesystem can show up as
- # /dev/root in /proc/mounts, so check the device number too)
- if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
- grep -q "^$DEVNAME " /proc/mounts || automount
- fi
+ # Note the root filesystem can show up as /dev/root in /proc/mounts,
+ # so check the device number too
+ if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
+ if [ "`basename $MOUNT`" = "systemd-mount" ];then
+ automount_systemd
+ else
+ automount
+ fi
+ fi
fi
-
if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
- for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
- do
- $UMOUNT $mnt
- done
-
- # Remove empty directories from auto-mounter
- name="`basename "$DEVNAME"`"
- test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
+ for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
+ do
+ $UMOUNT $mnt
+ done
+
+ # Remove empty directories from auto-mounter
+ name="`basename "$DEVNAME"`"
+ test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
fi
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
index 6fbd92548a..2ba35b0df6 100644
--- a/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -1,8 +1,8 @@
SUMMARY = "Extra machine specific configuration files"
+HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev"
DESCRIPTION = "Extra machine specific configuration files for udev, specifically blacklist information."
LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
- file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
SRC_URI = " \
file://automount.rules \
@@ -23,19 +23,23 @@ do_install() {
install -m 0644 ${WORKDIR}/autonet.rules ${D}${sysconfdir}/udev/rules.d/autonet.rules
install -m 0644 ${WORKDIR}/localextra.rules ${D}${sysconfdir}/udev/rules.d/localextra.rules
+ install -d ${D}${sysconfdir}/udev/mount.blacklist.d
install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/
install -d ${D}${sysconfdir}/udev/scripts/
install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
+ sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh
+ sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh
+
install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts
}
-FILES_${PN} = "${sysconfdir}/udev"
-RDEPENDS_${PN} = "udev"
-CONFFILES_${PN} = "${sysconfdir}/udev/mount.blacklist"
+FILES:${PN} = "${sysconfdir}/udev"
+RDEPENDS:${PN} = "udev"
+CONFFILES:${PN} = "${sysconfdir}/udev/mount.blacklist"
# to replace udev-extra-rules from meta-oe
-RPROVIDES_${PN} = "udev-extra-rules"
-RREPLACES_${PN} = "udev-extra-rules"
-RCONFLICTS_${PN} = "udev-extra-rules"
+RPROVIDES:${PN} = "udev-extra-rules"
+RREPLACES:${PN} = "udev-extra-rules"
+RCONFLICTS:${PN} = "udev-extra-rules"
diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
deleted file mode 100644
index a00dad5db2..0000000000
--- a/meta/recipes-core/udev/udev.inc
+++ /dev/null
@@ -1,111 +0,0 @@
-SUMMARY = "/dev/ and hotplug management daemon"
-DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \
-/dev/, handles hotplug events and loads drivers at boot time."
-HOMEPAGE = "http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html"
-LICENSE = "GPLv2.0+ & LGPLv2.1+"
-LICENSE_${PN} = "GPLv2.0+"
-LICENSE_libudev = "LGPLv2.1+"
-LICENSE_libgudev = "LGPLv2.1+"
-LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://src/COPYING;md5=17c4e5fb495e6707ac92a3864926f979 \
- file://src/gudev/COPYING;md5=fb494485a7d0505308cb68e4997cc266"
-
-LDFLAGS += "-lrt"
-
-DEPENDS = "glib-2.0 libusb usbutils pciutils glib-2.0-native gperf-native libxslt-native util-linux"
-RPROVIDES_${PN} = "hotplug"
-
-SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
- file://0001-Fixing-keyboard_force_release.sh-shell-script-path.patch \
- file://avoid-mouse-autosuspend.patch \
- file://run.rules \
- file://udev.rules \
- file://devfs-udev.rules \
- file://links.conf \
- file://permissions.rules \
- file://local.rules \
- file://udev-cache \
- file://udev-cache.default \
- file://add-install-ptest.patch \
- file://fix_rule-syntax-regex-ptest.patch \
- file://run-ptest \
- file://init"
-
-inherit autotools pkgconfig update-rc.d ptest
-RDEPENDS_${PN}-ptest += "make perl python"
-
-libexecdir = "${base_libdir}"
-EXTRA_OECONF = "--disable-introspection \
- --with-rootlibdir=${base_libdir} \
- --with-pci-ids-path=${datadir}/pci.ids \
- ac_cv_file__usr_share_pci_ids=no \
- ac_cv_file__usr_share_hwdata_pci_ids=no \
- ac_cv_file__usr_share_misc_pci_ids=yes \
- --sbindir=${base_sbindir} \
- --libexecdir=${nonarch_base_libdir} \
- --with-rootlibdir=${base_libdir} \
- --with-rootprefix= \
- --without-systemdsystemunitdir \
- "
-
-PACKAGES =+ "udev-cache"
-PACKAGES =+ "libudev"
-PACKAGES =+ "libgudev"
-
-INITSCRIPT_PACKAGES = "udev udev-cache"
-INITSCRIPT_NAME_udev = "udev"
-INITSCRIPT_PARAMS_udev = "start 04 S ."
-INITSCRIPT_NAME_udev-cache = "udev-cache"
-INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
-
-FILES_${PN} += "${libexecdir} ${libdir}/ConsoleKit ${nonarch_base_libdir}/udev ${bindir}/udevadm"
-RRECOMMENDS_${PN} += "udev-cache"
-
-# udev-utils has been removed as a package. Note that udev conflicts with udev-utils so that
-# udev-utils is removed from systems on upgrade.
-RCONFLICTS_${PN} += "udev-utils"
-RREPLACES_${PN} += "udev-utils"
-
-FILES_${PN}-dbg += "${libexecdir}/.debug"
-FILES_${PN}-dbg += "${base_libdir}/udev/.debug/"
-FILES_${PN}-dbg += "${base_libdir}/udev/.debug/*"
-FILES_${PN}-dbg += "${nonarch_base_libdir}/udev/.debug/*"
-FILES_${PN}-dev = "${datadir}/pkgconfig/udev.pc \
- ${includedir}/libudev.h ${libdir}/libudev.so ${libdir}/libudev.la \
- ${libdir}/libudev.a ${libdir}/pkgconfig/libudev.pc \
- ${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
- ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
-FILES_libudev = "${base_libdir}/libudev.so.*"
-FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
-FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
-
-do_install_append () {
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
- install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
- sed -i s%@UDEVD@%${nonarch_base_libdir}/udev/udevd% ${D}${sysconfdir}/init.d/udev
- sed -i s%@UDEVD@%${nonarch_base_libdir}/udev/udevd% ${D}${sysconfdir}/init.d/udev-cache
-
- install -d ${D}${sysconfdir}/default
- install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
-
- touch ${D}${sysconfdir}/udev/cache.data
-
- install -d ${D}${sysconfdir}/udev/rules.d/
-
- install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
-
- # hid2hci has moved to bluez4. removed in udev as of version 169
- rm -f ${D}${base_libdir}/udev/hid2hci
-
- echo 'udev_run="/var/run/udev"' >> ${D}${sysconfdir}/udev/udev.conf
-}
-
-# As systemd also builds udev, skip this package if we're doing a systemd build.
-python () {
- if bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
- raise bb.parse.SkipPackage("'systemd' in DISTRO_FEATURES")
-}
-do_compile_ptest() {
- oe_runmake test-udev
-}
diff --git a/meta/recipes-core/udev/udev/0001-Fixing-keyboard_force_release.sh-shell-script-path.patch b/meta/recipes-core/udev/udev/0001-Fixing-keyboard_force_release.sh-shell-script-path.patch
deleted file mode 100644
index 41deafa918..0000000000
--- a/meta/recipes-core/udev/udev/0001-Fixing-keyboard_force_release.sh-shell-script-path.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 0f8290c943da298abd269ca60fd8375dfb219971 Mon Sep 17 00:00:00 2001
-From: Alexandru DAMIAN <alexandru.damian@intel.com>
-Date: Thu, 12 Jul 2012 12:54:48 +0300
-Subject: [PATCH] Fixing keyboard_force_release.sh shell script path
-
-With the introduction of rootprefix, the keyboard-force-release.sh.in
-was modified to be executed with @rootprefix@/bin/sh, which is wrong
-because @rootprefix@ defaults to /usr (which is correct), but the
-shell is always at /bin/sh (IEEE Std 1003.2-1992).
-
-Therefore the interpreter for shell scripts needs to be /bin/sh at all times.
-
-The upstream moved to configurable root prefix, this patch taclkes a
-transition bug, and will not be applied upstream.
-
-Upstream-Status: Inappropriate [legacy version]
-
-Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
----
- src/keymap/keyboard-force-release.sh.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/keymap/keyboard-force-release.sh.in b/src/keymap/keyboard-force-release.sh.in
-index dd040ce..597a3a6 100755
---- a/src/keymap/keyboard-force-release.sh.in
-+++ b/src/keymap/keyboard-force-release.sh.in
-@@ -1,4 +1,4 @@
--#!@rootprefix@/bin/sh -e
-+#!/bin/sh -e
- # read list of scancodes, convert hex to decimal and
- # append to the atkbd force_release sysfs attribute
- # $1 sysfs devpath for serioX
---
-1.7.9.5
-
diff --git a/meta/recipes-core/udev/udev/add-install-ptest.patch b/meta/recipes-core/udev/udev/add-install-ptest.patch
deleted file mode 100644
index bfc2e9409d..0000000000
--- a/meta/recipes-core/udev/udev/add-install-ptest.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-Adjustements for ptest:
-
-- Add 'install-ptest' rule.
-- Print a standard result line for each test.
-- Replace the use of "tree" with "find".
-
-Signed-off-by: Björn Stenberg <bjst@enea.com>
-Signed-off-by: Alexandra Safta <alst@enea.com>
-Upstream-Status: Pending
-
-Add missing files for rule-syntax-check
-- Add rule-syntax-check.py
-- Add the deployed udev rules to the testdata
-
-Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
-Upstream-Status: Pending
---- a/Makefile.am 2012-03-18 16:28:14.000000000 +0100
-+++ b/Makefile.am 2013-02-18 10:03:36.531101244 +0100
-@@ -708,3 +708,18 @@
- for i in src/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/libudev/; done
- for i in src/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done
- for i in src/gudev/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/gudev/; done
-+
-+RULES = rules/* src/accelerometer/61-accelerometer.rules \
-+ src/cdrom_id/60-cdrom_id.rules \
-+ src/keymap/95-keyboard-force-release.rules src/keymap/95-keymap.rules \
-+ src/mtd_probe/75-probe_mtd.rules src/v4l_id/60-persistent-v4l.rules
-+
-+install-ptest:
-+ install test-udev $(DESTDIR)
-+ cp Makefile $(DESTDIR)
-+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
-+ install -d $(DESTDIR)/test $(DESTDIR)/rules
-+ (cd $(top_srcdir) && install $(TESTS) $(DESTDIR)/test)
-+ (cd $(top_srcdir) && install test/rule-syntax-check.py $(DESTDIR)/test)
-+ (cd $(top_srcdir) && install $(RULES) $(DESTDIR)/rules)
-+ cp $(top_srcdir)/test/sys.tar.xz $(DESTDIR)/test/
---- a/test/udev-test.pl 2012-03-18 16:43:36.000000000 +0100
-+++ b/test/udev-test.pl 2013-02-18 10:31:29.706357321 +0100
-@@ -1459,11 +1459,13 @@
- print "add: error";
- if ($rules->{exp_add_error}) {
- print " as expected\n";
-+ print "XFAIL: TEST $number: $rules->{desc}: add\n";
- } else {
- print "\n";
-- system("tree $udev_root");
-+ system("find $udev_root");
- print "\n";
- $error++;
-+ print "FAIL: TEST $number: $rules->{desc}: add\n";
- sleep(1);
- }
- }
-@@ -1479,15 +1481,18 @@
- print "remove: error";
- if ($rules->{exp_rem_error}) {
- print " as expected\n";
-+ print "XFAIL: TEST $number: $rules->{desc}: remove\n";
- } else {
- print "\n";
-- system("tree $udev_root");
-+ system("find $udev_root");
- print "\n";
- $error++;
-+ print "FAIL: TEST $number: $rules->{desc}: remove\n";
- sleep(1);
- }
- } else {
- print "remove: ok\n";
-+ print "PASS: TEST $number: $rules->{desc}: remove\n";
- }
-
- print "\n";
---- a/configure.ac 2013-11-28 09:14:02.814248826 +0100
-+++ b/configure.ac 2013-11-28 09:14:34.260874296 +0100
-@@ -6,7 +6,7 @@
- [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html])
- AC_CONFIG_SRCDIR([src/udevd.c])
- AC_CONFIG_AUX_DIR([build-aux])
--AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
-+AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
- AC_USE_SYSTEM_EXTENSIONS
- AC_SYS_LARGEFILE
- AC_CONFIG_MACRO_DIR([m4])
-
diff --git a/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch b/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch
deleted file mode 100644
index 2c31b33b02..0000000000
--- a/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Source: http://cgit.freedesktop.org/systemd/systemd/commit/rules/42-usb-hid-pm.rules?id=e0386cf2809219bbdd30895f46f1f567b56902b6
-
-Some USB ports on external hubs may be reported as "fixed". We only want
-to auto-enable this on ports that are internal to the machine, so check
-the parent state as well.
-
-Upstream-Status: backport
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-2013/09/13
-
-Index: udev-182/rules/42-usb-hid-pm.rules
-===================================================================
---- udev-182.orig/rules/42-usb-hid-pm.rules
-+++ udev-182/rules/42-usb-hid-pm.rules
-@@ -46,4 +46,9 @@ ACTION=="add", SUBSYSTEM=="usb", ATTRS{i
- ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}="0002", TEST=="power/control", ATTR{power/control}="auto"
-
- # USB HID devices that are internal to the machine should also be safe to autosuspend
-+# And skip it for devices which are external but say "fixed"
-+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="removable", GOTO="usb_hid_pm_end"
-+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="unknown", GOTO="usb_hid_pm_end"
- ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
-+LABEL="usb_hid_pm_end"
-+
diff --git a/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch b/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch
deleted file mode 100644
index 548a241d8a..0000000000
--- a/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-The rule-syntax-check script fails with errors like this:
-
-Invalid line /lib/udev/rules.d/95-keymap.rules:49: ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j"
-(' clause:', 'ATTR{[dmi/id]product_name}=="W3J"')
-()
-
-
-Move line comment from end of rules file to its own line, the regex used to
-test correct syntax choke on it.
-
-The rule-syntax-check.py uses regex which errournessly complains on ATTR rules
-of the form ATTR{[dmi/id]board_name}=="30B7"
-Use the regex from systemd's script which allow [] characters and additional
-compare operators
-
-The Makefile passes rules-test.sh script a build host path to the testdata.
-Ignore the argument and use a relative path instead.
-
-
-Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
-Upstream status pending
-Upstream status Inappropriate (cross environment path)
-
-diff -Naur udev-182.orig/src/keymap/95-keymap.rules udev-182/src/keymap/95-keymap.rules
---- udev-182.orig/src/keymap/95-keymap.rules 2012-02-07 00:01:55.154640792 +0100
-+++ udev-182/src/keymap/95-keymap.rules 2015-01-24 20:58:40.156930520 +0100
-@@ -94,7 +94,8 @@
- ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www"
- ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill"
- # HP Pavillion dv6315ea has empty DMI_VENDOR
--ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play
-+# "quick play"
-+ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media"
-
- # Gateway clone of Acer Aspire One AOA110/AOA150
- ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer"
-diff -Naur udev-182.orig/test/rule-syntax-check.py udev-182/test/rule-syntax-check.py
---- udev-182.orig/test/rule-syntax-check.py 2012-02-15 20:10:12.872333342 +0100
-+++ udev-182/test/rule-syntax-check.py 2015-01-24 21:08:00.496049600 +0100
-@@ -28,7 +28,7 @@
- no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
- args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
- no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
--args_assign = re.compile('(ATTR|ENV|IMPORT){([a-zA-Z0-9/_.*%-]+)}\s*=\s*"([^"]*)"$')
-+args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([][a-zA-Z0-9/_.*%-]+)}\s*(=|==|\+=)\s*"([^"]*)"$')
-
- result = 0
- buffer = ''
---- udev-182.orig/test/rules-test.sh 2012-01-29 01:15:46.000000000 +0100
-+++ udev-182/test/rules-test.sh 2015-01-24 17:53:51.201858658 +0100
-@@ -4,7 +4,7 @@
- # (C) 2010 Canonical Ltd.
- # Author: Martin Pitt <martin.pitt@ubuntu.com>
-
--[ -n "$srcdir" ] || srcdir=`dirname $0`/..
-+srcdir=`dirname $0`/..
-
- # skip if we don't have python
- type python >/dev/null 2>&1 || {
diff --git a/meta/recipes-core/udev/udev/run-ptest b/meta/recipes-core/udev/udev/run-ptest
deleted file mode 100644
index 0e39806b01..0000000000
--- a/meta/recipes-core/udev/udev/run-ptest
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-tar -C test/ -xJf test/sys.tar.xz
-make -k check-TESTS
-make test-sys-distclean
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
deleted file mode 100644
index dcfff1cb45..0000000000
--- a/meta/recipes-core/udev/udev/udev-cache
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh -e
-
-### BEGIN INIT INFO
-# Provides: udev-cache
-# Required-Start: mountall
-# Required-Stop:
-# Default-Start: S
-# Default-Stop:
-# Short-Description: cache /dev to speedup the udev next boot
-### END INIT INFO
-
-export TZ=/etc/localtime
-
-[ -r /proc/mounts ] || exit 1
-[ -x @UDEVD@ ] || exit 1
-[ -d /sys/class ] || exit 1
-
-[ -f /etc/default/rcS ] && . /etc/default/rcS
-DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
-SYSCONF_CACHED="/etc/udev/cache.data"
-SYSCONF_TMP="/dev/shm/udev.cache"
-DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen
-
-# A list of files which are used as a criteria to judge whether the udev cache could be reused.
-CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices"
-[ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags"
-
-# List of files whose metadata (size/mtime/name) will be included in cached
-# system state.
-META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*"
-
-# Command to compute system configuration.
-sysconf_cmd () {
- cat -- $CMP_FILE_LIST
- stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}'
-}
-
-[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
-
-if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
- [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
- exit 0
-fi
-
-[ "$DEVCACHE" != "" ] || exit 0
-[ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... "
-if ! [ -e "$DEVCACHE_REGEN" ]; then
- [ "${VERBOSE}" == "no" ] || echo "not found."
- exit 0
-fi
-[ "${VERBOSE}" == "no" ] || echo "found."
-echo "Populating dev cache"
-
-err_cleanup () {
- echo "udev-cache: update failed!"
- udevadm control --start-exec-queue
- rm -f -- "$SYSCONF_TMP" "$DEVCACHE_TMP" "$DEVCACHE" "$SYSCONF_CACHED"
-}
-
-(
- set -e
- trap 'err_cleanup' EXIT
- udevadm control --stop-exec-queue
- sysconf_cmd > "$SYSCONF_TMP"
- find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
- | xargs tar cf "${DEVCACHE_TMP}"
- gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
- rm -f "${DEVCACHE_TMP}"
- mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
- udevadm control --start-exec-queue
- rm -f "$DEVCACHE_REGEN"
- trap - EXIT
-) &
-
-exit 0
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
deleted file mode 100644
index a3b732698d..0000000000
--- a/meta/recipes-core/udev/udev/udev-cache.default
+++ /dev/null
@@ -1,5 +0,0 @@
-# Default for /etc/init.d/udev
-
-# Comment this out to disable device cache
-DEVCACHE="/etc/udev-cache.tar.gz"
-PROBE_PLATFORM_BUS="yes"
diff --git a/meta/recipes-core/udev/udev_182.bb b/meta/recipes-core/udev/udev_182.bb
deleted file mode 100644
index b216352035..0000000000
--- a/meta/recipes-core/udev/udev_182.bb
+++ /dev/null
@@ -1,9 +0,0 @@
-include udev.inc
-
-PR = "r9"
-
-# module-init-tools from kmod_git will provide libkmod runtime
-DEPENDS += "module-init-tools"
-
-SRC_URI[md5sum] = "1b964456177fbf48023dfee7db3a708d"
-SRC_URI[sha256sum] = "7857ed19fafd8f3ca8de410194e8c7336e9eb8a20626ea8a4ba6449b017faba4"
diff --git a/meta/recipes-core/update-rc.d/update-rc.d/add-verbose.patch b/meta/recipes-core/update-rc.d/update-rc.d/add-verbose.patch
deleted file mode 100644
index fb443ff15e..0000000000
--- a/meta/recipes-core/update-rc.d/update-rc.d/add-verbose.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-Upstream-Status: Pending
-
---- update-rc.d/update-rc.d.org 2005-01-03 00:30:47.000000000 +0200
-+++ update-rc.d/update-rc.d 2007-12-01 19:41:08.000000000 +0200
-@@ -19,6 +19,7 @@
- notreally=0
- force=0
- dostart=0
-+verbose=0
-
- usage()
- {
-@@ -28,6 +29,7 @@
- update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] .
- -n: not really
- -f: force
-+ -v: verbose
- -r: alternate root path (default is /)
- -s: invoke start methods if appropriate to current runlevel
- EOF
-@@ -69,7 +71,7 @@
- lev=`echo $2 | cut -d/ -f1`
- nn=`echo $2 | cut -d/ -f2`
- fn="${etcd}${lev}.d/${startstop}${nn}${bn}"
-- echo " $fn -> ../init.d/$bn"
-+ [ $verbose -eq 1 ] && echo " $fn -> ../init.d/$bn"
- if [ $notreally -eq 0 ]; then
- mkdir -p `dirname $fn`
- ln -s ../init.d/$bn $fn
-@@ -89,7 +91,7 @@
- exit 0
- fi
-
-- echo " Adding system startup for $initd/$bn ..."
-+ echo " Adding system startup for $initd/$bn."
-
- for i in $startlinks; do
- dolink S $i
-@@ -105,6 +107,10 @@
- shift
- continue
- ;;
-+ -v) verbose=1
-+ shift
-+ continue
-+ ;;
- -f) force=1
- shift
- continue
diff --git a/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch b/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch
deleted file mode 100644
index 075171a5a3..0000000000
--- a/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-Check if symlinks are valid
-
-When using root option and $initd/$bn is a symlink, the script would fail because
-the symlink points to a path on target. For example:
-
-/path/to/target/rootfs/etc/init.d/syslog -> /etc/init.d/syslog.busybox
-
-Hence, [ -f /path/to/target/rootfs/etc/init.d/syslog ] condition would return
-false.
-
-This patch adds the posibility to check whether the file the symlink points to
-actually exists in rootfs path and then continue.
-
-Upstream-Status: Pending
-
-Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
-Signed-off-by: Christopher Larson <chris_larson@mentor.com>
-
-Index: git/update-rc.d
-===================================================================
---- git.orig/update-rc.d
-+++ git/update-rc.d
-@@ -147,13 +147,34 @@ fi
- bn=$1
- shift
-
-+sn=$initd/$bn
-+if [ -L "$sn" -a -n "$root" ]; then
-+ if which readlink >/dev/null; then
-+ while true; do
-+ linksn="$(readlink "$sn")"
-+ if [ -z "$linksn" ]; then
-+ break
-+ fi
-+
-+ sn="$linksn"
-+ case "$sn" in
-+ /*) sn="$root$sn" ;;
-+ *) sn="$initd/$sn" ;;
-+ esac
-+ done
-+ else
-+ echo "update-rc.d: readlink tool not present, cannot check whether \
-+ $sn symlink points to a valid file." >&2
-+ fi
-+fi
-+
- if [ $1 != "remove" ]; then
-- if [ ! -f "$initd/$bn" ]; then
-+ if [ ! -f "$sn" ]; then
- echo "update-rc.d: $initd/$bn: file does not exist" >&2
- exit 1
- fi
- else
-- if [ -f "$initd/$bn" ]; then
-+ if [ -f "$sn" ]; then
- if [ $force -eq 1 ]; then
- echo "update-rc.d: $initd/$bn exists during rc.d purge (continuing)" >&2
- else
diff --git a/meta/recipes-core/update-rc.d/update-rc.d/fix-to-handle-priority-numbers-correctly.patch b/meta/recipes-core/update-rc.d/update-rc.d/fix-to-handle-priority-numbers-correctly.patch
deleted file mode 100644
index 85bc234a27..0000000000
--- a/meta/recipes-core/update-rc.d/update-rc.d/fix-to-handle-priority-numbers-correctly.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Upstream-Status: Pending
-
-Fix to handle priority numbers correctly.
-Previously, if the priority number is '08' or '09', for example,
-the script cannot handle them correctly as these numbers are treated
-as octal numbers.
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- update-rc.d | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/update-rc.d b/update-rc.d
-index ec50d15..c70b859 100644
---- a/update-rc.d
-+++ b/update-rc.d
-@@ -205,7 +205,7 @@ case $1 in
- exit 1
- fi
- shift
-- NN=`printf %02d $1`
-+ NN=`printf %02d $(expr $1 + 0)`
- shift
- while [ "x$1" != "x." ]; do
- if [ $# -eq 0 ]; then
---
-1.7.9.5
-
diff --git a/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb b/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb
deleted file mode 100644
index c15cb78033..0000000000
--- a/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb
+++ /dev/null
@@ -1,31 +0,0 @@
-SUMMARY = "manage symlinks in /etc/rcN.d"
-DESCRIPTION = "update-rc.d is a utilities that allows the management of symlinks to the initscripts in the /etc/rcN.d directory structure."
-SECTION = "base"
-
-LICENSE = "GPLv2+"
-LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=148a48321b10eb37c1fa3ee02b940a75"
-
-PR = "r5"
-
-# Revision corresponding to tag update-rc.d_0.7
-SRCREV = "eca680ddf28d024954895f59a241a622dd575c11"
-
-SRC_URI = "git://github.com/philb/update-rc.d.git \
- file://add-verbose.patch \
- file://check-if-symlinks-are-valid.patch \
- file://fix-to-handle-priority-numbers-correctly.patch \
- "
-
-S = "${WORKDIR}/git"
-
-inherit allarch
-
-do_compile() {
-}
-
-do_install() {
- install -d ${D}${sbindir}
- install -m 0755 ${S}/update-rc.d ${D}${sbindir}/update-rc.d
-}
-
-BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb b/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb
new file mode 100644
index 0000000000..daee5c224b
--- /dev/null
+++ b/meta/recipes-core/update-rc.d/update-rc.d_0.8.bb
@@ -0,0 +1,26 @@
+SUMMARY = "manage symlinks in /etc/rcN.d"
+HOMEPAGE = "http://github.com/philb/update-rc.d/"
+DESCRIPTION = "update-rc.d is a utility that allows the management of symlinks to the initscripts in the /etc/rcN.d directory structure."
+SECTION = "base"
+
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=d40a07c27f535425934bb5001f2037d9"
+
+SRC_URI = "git://git.yoctoproject.org/update-rc.d;branch=master"
+SRCREV = "8636cf478d426b568c1be11dbd9346f67e03adac"
+
+UPSTREAM_CHECK_COMMITS = "1"
+
+S = "${WORKDIR}/git"
+
+inherit allarch
+
+do_compile() {
+}
+
+do_install() {
+ install -d ${D}${sbindir}
+ install -m 0755 ${S}/update-rc.d ${D}${sbindir}/update-rc.d
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb
new file mode 100644
index 0000000000..5d759aed94
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.37.2.bb
@@ -0,0 +1,16 @@
+# To allow util-linux to optionally build-depend on cryptsetup, libuuid is
+# split out of the main recipe, as it's needed by cryptsetup
+
+require util-linux.inc
+
+inherit autotools gettext pkgconfig
+
+S = "${WORKDIR}/util-linux-${PV}"
+EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
+LICENSE = "BSD-3-Clause"
+
+do_install:append() {
+ rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
+}
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index a4072bc6cf..1e3cd28801 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -1,268 +1,40 @@
SUMMARY = "A suite of basic system administration utilities"
+HOMEPAGE = "https://en.wikipedia.org/wiki/Util-linux"
DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
commonly found on most Linux systems. Some of the more important utilities include \
disk partitioning, kernel message management, filesystem creation, and system login."
SECTION = "base"
-LICENSE = "GPLv2+ & LGPLv2.1+ & BSD"
+LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause"
+LICENSE:${PN}-libblkid = "LGPLv2.1+"
+LICENSE:${PN}-libfdisk = "LGPLv2.1+"
+LICENSE:${PN}-libmount = "LGPLv2.1+"
+LICENSE:${PN}-libsmartcols = "LGPLv2.1+"
-LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c \
+LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://Documentation/licenses/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://Documentation/licenses/COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \
- file://Documentation/licenses/COPYING.BSD-3;md5=58dcd8452651fc8b07d1f65ce07ca8af \
- file://Documentation/licenses/COPYING.UCB;md5=263860f8968d8bafa5392cab74285262 \
- file://libuuid/COPYING;md5=b442ffb762cf8d3e9df1b99e0bb4af70 \
- file://libmount/COPYING;md5=fb93f01d4361069c5616327705373b16 \
- file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16"
-
-inherit autotools gettext pkgconfig systemd update-alternatives python-dir
-DEPENDS = "zlib ncurses"
-DEPENDS_append_class-native = " lzo-native"
-DEPENDS_append_class-nativesdk = " lzo-native"
+ file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+ file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
+ file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
+ file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
+ file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
+ file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
+ file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
+ file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
+ file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
+"
+FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
+MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
+ file://configure-sbindir.patch \
+ file://runuser.pamd \
+ file://runuser-l.pamd \
+ file://ptest.patch \
+ file://run-ptest \
+ file://display_testname_for_subtest.patch \
+ file://avoid_parallel_tests.patch \
"
-PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \
- util-linux-swaponoff util-linux-losetup util-linux-umount \
- util-linux-mount util-linux-readprofile util-linux-uuidd \
- util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
- util-linux-mkfs util-linux-mcookie util-linux-reset \
- util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \
- util-linux-partx ${PN}-bash-completion util-linux-hwclock \
- util-linux-findfs util-linux-getopt util-linux-sulogin"
-PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}"
-
-PACKAGES_DYNAMIC = "^util-linux-lib.*"
-
-SHARED_EXTRA_OECONF = "--disable-use-tty-group \
- --disable-makeinstall-chown \
- --enable-kill --enable-last --enable-mesg --enable-partx \
- --enable-raw --enable-reset --disable-login \
- --disable-vipw --disable-newgrp --disable-chfn-chsh \
- --enable-write --enable-mount \
- --enable-libuuid --enable-libblkid --enable-fsck --without-udev \
- usrsbin_execdir='${sbindir}' \
-"
-
-EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
-
-PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
-PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
-
-# Respect the systemd feature for uuidd
-PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemd --without-systemdsystemunitdir,systemd"
-
-# Build setpriv requires libcap-ng
-PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
-
-# Build python bindings for libmount
-PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python"
-
-FILES_${PN}-bash-completion += "${datadir}/bash-completion"
-FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
-
-FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.la"
-FILES_${PN}-dbg += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/.debug/"
-
-FILES_util-linux-agetty = "${base_sbindir}/agetty"
-FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}"
-FILES_util-linux-fstrim = "${base_sbindir}/fstrim"
-FILES_util-linux-cfdisk = "${base_sbindir}/cfdisk"
-FILES_util-linux-sfdisk = "${sbindir}/sfdisk"
-FILES_util-linux-swaponoff = "${base_sbindir}/swapon.${BPN} ${base_sbindir}/swapoff.${BPN}"
-FILES_util-linux-losetup = "${base_sbindir}/losetup.${BPN}"
-FILES_util-linux-mount = "${base_bindir}/mount.${BPN}"
-FILES_util-linux-mcookie = "${bindir}/mcookie"
-FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
-FILES_util-linux-readprofile = "${sbindir}/readprofile.${BPN}"
-FILES_util-linux-uuidgen = "${bindir}/uuidgen"
-FILES_util-linux-uuidd = "${sbindir}/uuidd"
-FILES_util-linux-reset = "${base_bindir}/reset"
-FILES_util-linux-partx = "${sbindir}/partx"
-FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
-FILES_util-linux-findfs = "${sbindir}/findfs"
-FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}"
-
-FILES_util-linux-pylibmount = "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.so \
- ${libdir}/${PYTHON_DIR}/dist-packages/libmount/__init__.*"
-FILES_util-linux-lscpu = "${bindir}/lscpu"
-
-FILES_util-linux-fsck = "${base_sbindir}/fsck*"
-FILES_util-linux-mkfs = "${sbindir}/mkfs"
-
-FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs"
-FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
-
-FILES_util-linux-sulogin = "${base_sbindir}/sulogin*"
-
-# Util-linux' blkid replaces the e2fsprogs one
-FILES_util-linux-blkid = "${base_sbindir}/blkid*"
-RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
-RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
-
-# reset calls 'tput'
-RDEPENDS_util-linux-reset += "ncurses"
-
-RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin"
-RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs "
-
-RRECOMMENDS_${PN}_class-native = ""
-RRECOMMENDS_${PN}_class-nativesdk = ""
-RDEPENDS_${PN}_class-native = ""
-RDEPENDS_${PN}_class-nativesdk = ""
-
-RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev"
-
-#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
-SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service"
-SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable"
-SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service"
-SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable"
-
-do_compile () {
- set -e
- oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'
-}
-
-do_install () {
- # with ccache the timestamps on compiled files may
- # end up earlier than on their inputs, this allows
- # for the resultant compilation in the install step.
- oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \
- 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \
- 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
-
- mkdir -p ${D}${base_bindir}
-
- sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
- sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root"
- binprogs_a="dmesg getopt kill more umount mount login reset su"
-
- if [ "${base_sbindir}" != "${sbindir}" ]; then
- mkdir -p ${D}${base_sbindir}
- for p in $sbinprogs $sbinprogs_a; do
- if [ -f "${D}${sbindir}/$p" ]; then
- mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
- fi
- done
- fi
-
- if [ "${base_bindir}" != "${bindir}" ]; then
- mkdir -p ${D}${base_bindir}
- for p in $binprogs_a; do
- if [ -f "${D}${bindir}/$p" ]; then
- mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
- fi
- done
- fi
-
- install -d ${D}${sysconfdir}/default/
- echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
-
- rm -f ${D}${bindir}/chkdupexe
-}
-
-# reset and nologin causes a conflict with ncurses-native and shadow-native
-do_install_append_class-native () {
- rm -f ${D}${base_bindir}/reset
- rm -f ${D}${base_sbindir}/nologin
-}
-
-ALTERNATIVE_PRIORITY = "100"
-
-ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root"
-ALTERNATIVE_${PN} += "mkfs.minix hexdump last lastb logger mesg renice wall"
-ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject"
-
-ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
-ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
-ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
-ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
-ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
-ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
-ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
-ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
-ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
-
-ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3"
-
-ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
-ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
-ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
-ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
-ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
-ALTERNATIVE_LINK_NAME[reset.1] = "${mandir}/man1/reset.1"
-ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
-ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
-ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
-ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
-ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
-ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
-ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
-ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
-ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
-
-ALTERNATIVE_util-linux-hwclock = "hwclock"
-# There seems to be problem, atleast on nslu2, with these, untill they are
-# fixed the busybox ones have higher priority
-ALTERNATIVE_PRIORITY[hwclock] = "10"
-ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
-
-ALTERNATIVE_util-linux-fdisk = "fdisk"
-ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
-
-ALTERNATIVE_util-linux-agetty = "getty"
-ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
-ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
-
-ALTERNATIVE_util-linux-mount = "mount"
-ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
-
-ALTERNATIVE_util-linux-umount = "umount"
-ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
-
-ALTERNATIVE_util-linux-readprofile = "readprofile"
-ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
-
-ALTERNATIVE_util-linux-losetup = "losetup"
-ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
-
-ALTERNATIVE_util-linux-swaponoff = "swapoff swapon"
-ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
-ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
-
-ALTERNATIVE_util-linux-fsck = "fsck.minix fsck"
-ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix"
-ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
-
-ALTERNATIVE_util-linux-blkid = "blkid"
-ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
-
-ALTERNATIVE_util-linux-reset = "reset"
-ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
-ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
-
-ALTERNATIVE_util-linux-getopt = "getopt"
-ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
-
-ALTERNATIVE_util-linux-sulogin = "sulogin"
-ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
-
-BBCLASSEXTEND = "native nativesdk"
-
-python do_package_prepend () {
- if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
- alt_name = "su"
- d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
- d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
-}
-
-python populate_packages_prepend() {
- do_split_packages(d, '${base_libdir}', '^lib(.*)\.so\..*$',
- output_pattern='util-linux-lib%s',
- description='util-linux lib%s',
- extra_depends='', prepend=True, allow_links=True)
-}
+SRC_URI[sha256sum] = "6a0764c1aae7fb607ef8a6dd2c0f6c47d5e5fd27aa08820abaad9ec14e28e9d9"
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
new file mode 100644
index 0000000000..f1cbdb3beb
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
@@ -0,0 +1,29 @@
+From ee3c7812e1efa6719af68b994804f0e6caceabd8 Mon Sep 17 00:00:00 2001
+From: Tudor Florea <tudor.florea@enea.com>
+Date: Mon, 14 Jun 2021 14:00:31 +0200
+Subject: [PATCH] util-linux: Add ptest
+
+Ptest needs buildtest-TESTS and runtest-TESTS targets.
+serial-tests is required to generate those targets.
+Revert run.sh script accordingly to serialize running tests
+
+Signed-off-by: Tudor Florea <tudor.florea@enea.com>
+Upstream-Status: Inappropriate
+
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5664f9f..075ef27 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
+ dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
+ dnl the compiler (like LT_INIT) to avoid autoconf errors.
+ AC_USE_SYSTEM_EXTENSIONS
+-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
++AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
+
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
+ [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
index a5b1ff12e5..e475289f65 100644
--- a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
+++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -5,11 +5,11 @@ Signed-off-by: Phil Blundell <pb@pbcl.net>
Signed-off-by: Saul Wold <sgw@linux.intel.com
Upstream-Status: Inappropriate [configuration]
-Index: util-linux-2.22.1/configure.ac
+Index: util-linux-2.31/configure.ac
===================================================================
---- util-linux-2.22.1.orig/configure.ac
-+++ util-linux-2.22.1/configure.ac
-@@ -73,7 +73,10 @@ AC_SUBST([localstatedir])
+--- util-linux-2.31.orig/configure.ac
++++ util-linux-2.31/configure.ac
+@@ -89,7 +89,10 @@ AC_SUBST([runstatedir])
usrbin_execdir='${exec_prefix}/bin'
AC_SUBST([usrbin_execdir])
@@ -20,4 +20,4 @@ Index: util-linux-2.22.1/configure.ac
+fi
AC_SUBST([usrsbin_execdir])
- case $libdir in
+ AS_CASE([$libdir],
diff --git a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
new file mode 100644
index 0000000000..417ca1d98f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -0,0 +1,25 @@
+Display testname for subtest
+
+Signed-off-by: Tudor Florea <tudor.florea@enea.com>
+Upstream-Status: Pending
+
+---
+ tests/functions.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/functions.sh b/tests/functions.sh
+index 5246605..b24dc15 100644
+--- a/tests/functions.sh
++++ b/tests/functions.sh
+@@ -320,7 +320,7 @@ function ts_init_subtest {
+
+ if [ "$TS_PARSABLE" != "yes" ]; then
+ [ $TS_NSUBTESTS -eq 1 ] && echo
+- printf "%16s: %-27s ..." "" "$TS_SUBNAME"
++ printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME"
+ fi
+ }
+
+--
+2.8.3
+
diff --git a/meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch b/meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch
deleted file mode 100644
index adb271ce0d..0000000000
--- a/meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 774f55f9dd22c01e4041a183d8dff14811f29114 Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Fri, 4 Apr 2014 17:33:04 +0800
-Subject: [PATCH] sys-utils/Makemodule.am: fix parallel build issue
-
-The rule SETARCH_MAN_LINKS is used for the files under the sys-utils
-dir, for example:
-
-echo ".so man8/setarch.8" > sys-utils/linux32.8
-
-but it depends on nothing so that the sys-utils dir may not exist, we
-can create the sys-utils dir to fix problem.
-
-Upstream-Status: Pending
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- sys-utils/Makemodule.am | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
-index 6265282..62ead37 100644
---- a/sys-utils/Makemodule.am
-+++ b/sys-utils/Makemodule.am
-@@ -124,6 +124,7 @@ man_MANS += $(SETARCH_MAN_LINKS)
- CLEANFILES += $(SETARCH_MAN_LINKS)
-
- $(SETARCH_MAN_LINKS):
-+ $(MKDIR_P) sys-utils
- $(AM_V_GEN)echo ".so man8/setarch.8" > $@
-
- install-exec-hook-setarch:
---
-1.8.2.1
-
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch b/meta/recipes-core/util-linux/util-linux/ptest.patch
new file mode 100644
index 0000000000..ba2bd3f6ac
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -0,0 +1,24 @@
+From af073c13ef184ca75811df688e0a0a25827b36c3 Mon Sep 17 00:00:00 2001
+From: Tudor Florea <tudor.florea@enea.com>
+Date: Thu, 3 Dec 2015 04:08:00 +0100
+Subject: [PATCH] Define TESTS variable
+
+Signed-off-by: Tudor Florea <tudor.florea@enea.com>
+Upstream-Status: Pending
+
+---
+ Makefile.am | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile.am b/Makefile.am
+index 886598d..1cf4346 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -57,6 +57,7 @@ systemdsystemunit_DATA =
+ dist_bashcompletion_DATA =
+ check_PROGRAMS =
+ dist_check_SCRIPTS =
++TESTS = $(check_PROGRAMS)
+
+ PATHFILES =
+ ADOCFILES_COMMON =
diff --git a/meta/recipes-core/util-linux/util-linux/run-ptest b/meta/recipes-core/util-linux/util-linux/run-ptest
new file mode 100644
index 0000000000..3a910be121
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+
+# When udevd (from eudev) is running most eject/mount tests will fail because
+# of automount. We need to stop udevd before executing util-linux's tests.
+# The systemd-udevd daemon doesn't change the outcome of util-linux's tests.
+UDEV_PID="`pidof "@base_sbindir@/udevd"`"
+if [ "x$UDEV_PID" != "x" ]; then
+ /etc/init.d/udev stop
+fi
+
+current_path=$(readlink -f $0)
+export bindir=$(dirname $current_path)
+export PATH=$bindir/bin:$PATH
+
+./tests/run.sh --use-system-commands --parsable --show-diff | sed -u '{
+ s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
+ s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
+ s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
+ }'
+
+if [ "x$UDEV_PID" != "x" ]; then
+ /etc/init.d/udev start
+fi
diff --git a/meta/recipes-core/util-linux/util-linux/runuser-l.pamd b/meta/recipes-core/util-linux/util-linux/runuser-l.pamd
new file mode 100644
index 0000000000..4b368ccf5d
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/runuser-l.pamd
@@ -0,0 +1,3 @@
+auth include runuser
+session optional pam_keyinit.so force revoke
+session include runuser
diff --git a/meta/recipes-core/util-linux/util-linux/runuser.pamd b/meta/recipes-core/util-linux/util-linux/runuser.pamd
new file mode 100644
index 0000000000..48d133b9e7
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/runuser.pamd
@@ -0,0 +1,4 @@
+auth sufficient pam_rootok.so
+session optional pam_keyinit.so revoke
+session required pam_limits.so
+session required pam_unix.so
diff --git a/meta/recipes-core/util-linux/util-linux/uclibc-__progname-conflict.patch b/meta/recipes-core/util-linux/util-linux/uclibc-__progname-conflict.patch
deleted file mode 100644
index 5031a7313e..0000000000
--- a/meta/recipes-core/util-linux/util-linux/uclibc-__progname-conflict.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-configure should include errno.h instead of argp.h when
-checking for presence of program_invocation_short_name
-uclibc defines this to be const char* unlike util-linux-ng
-which defines this to be char* so this error goes unnoticed
-on glibc/eglibc systems.
-
-here is the error it fixes
-
-in file included from mountP.h:14:0,
- from cache.c:29:
-/home/kraj/work/slugos/build/tmp-slugos-uclibc/sysroots/nslu2le/usr/include/errno.h:55:46: error: conflicting types for '__progname'
-../../../include/c.h:118:14: note: previous declaration of '__progname' was here
-make[3]: *** [cache.lo] Error 1
-
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Signed-off-by: Jonathan Liu <net147@gmail.com>
-
-Upstream-Status: Pending
-Index: util-linux-2.22.1/configure.ac
-===================================================================
---- util-linux-2.22.1.orig/configure.ac
-+++ util-linux-2.22.1/configure.ac
-@@ -372,7 +372,7 @@ esac
-
- AC_MSG_CHECKING([whether program_invocation_short_name is defined])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-- #include <argp.h>
-+ #include <errno.h>
- ]], [[
- program_invocation_short_name = "test";
- ]])], [
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch b/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch
deleted file mode 100644
index 68bf22de8c..0000000000
--- a/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From f220d809be1baa654503bf6ff52f3630b0d7015c Mon Sep 17 00:00:00 2001
-From: Robert Yang <liezhi.yang@windriver.com>
-Date: Wed, 26 Mar 2014 01:30:29 +0000
-Subject: [PATCH] sun.c: use qsort() to instead of qsort_r()
-
-qsort_r() was added to glibc in version 2.8, so there is no qsort_r() on
-the host like CentOS 5.x.
-
-Upstream-Status: Inappropriate [Other]
-
-Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
----
- libfdisk/src/sun.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-Index: util-linux-2.24.2/libfdisk/src/sun.c
-===================================================================
---- util-linux-2.24.2.orig/libfdisk/src/sun.c
-+++ util-linux-2.24.2/libfdisk/src/sun.c
-@@ -431,10 +431,9 @@ static int sun_verify_disklabel(struct f
- }
- verify_sun_starts = starts;
-
-- qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
-- (int (*)(const void *,const void *,void *)) verify_sun_cmp,
-- verify_sun_starts);
--
-+ qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
-+ (int (*)(const void *,const void *)) verify_sun_cmp);
-+
- if (array[0] == -1) {
- fdisk_info(cxt, _("No partitions defined."));
- return 0;
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
deleted file mode 100644
index 1f496dee21..0000000000
--- a/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-Support older hosts with latest util-linux-native
-
-mkostemp is not defined on older machines. So we detect this and
-provide a define that uses mkstemp instead.
-
-O_CLOEXEC is not defined on older machines. It is however defined
-in the 'c.h' header. Fix up the users to include 'c.h'.
-
-fdisks/fdisksunlabel.c was modified to use qsort_r, however
-this is not defined on older hosts. Revert:
- commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
- fdisk: (sun): use ask API, remove global variable
-
-Upstream-Status: Inappropriate [other]
-Patches revert upstream changes in order to support older
-machines.
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- configure.ac | 1 +
- include/c.h | 7 +++++++
- 2 files changed, 8 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index eb3680b..93e015f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -318,6 +318,7 @@ AC_CHECK_FUNCS([ \
- llseek \
- lseek64 \
- mempcpy \
-+ mkostemp \
- nanosleep \
- open_memstream \
- personality \
-diff --git a/include/c.h b/include/c.h
-index e423e8b..cf33b94 100644
---- a/include/c.h
-+++ b/include/c.h
-@@ -233,6 +233,13 @@ static inline int dirfd(DIR *d)
- #endif
-
- /*
-+ * mkostemp replacement
-+ */
-+#ifndef HAVE_MKOSTEMP
-+#define mkostemp(template, flags) mkstemp(template)
-+#endif
-+
-+/*
- * MAXHOSTNAMELEN replacement
- */
- static inline size_t get_hostname_max(void)
---
-1.9.1
-
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch b/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch
deleted file mode 100644
index 5773d7ea1b..0000000000
--- a/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Upstream-Status: Inappropriate [embedded specific]
-
-The FHS indicates that /etc must be capable of being mounted R/O.
-
-The FHS also indicates that lock files belong in /var/lock, and /var must
-be R/W as soon as possible during boot.
-
-This patch moves the mtab lock file from the potentially R/O /etc, to the
-R/W /var/lock area. This lock file is used when mounting disks and making
-other mount adjustments. The _PATH_MOUNTED_TMP is not adjusted, as failing
-to write to this file does not cause any functional limitations.
-
-(Note, if /etc is R/O, then /etc/mtab should be a symlink to /proc/mounts)
-
-Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-
---- util-linux-ng-2.16/include/pathnames.h.orig
-+++ util-linux-ng-2.16/include/pathnames.h
-@@ -90,7 +90,7 @@
- # endif
- #endif
-
--#define _PATH_MOUNTED_LOCK _PATH_MOUNTED "~"
-+#define _PATH_MOUNTED_LOCK "/var/lock/mtab~"
- #define _PATH_MOUNTED_TMP _PATH_MOUNTED ".tmp"
-
- #ifndef _PATH_DEV
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch b/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
deleted file mode 100644
index 6717a75a90..0000000000
--- a/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Upstream-Status: Pending
-
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- login-utils/login.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/login-utils/login.c b/login-utils/login.c
-index ebb76f5..38c881b 100644
---- a/login-utils/login.c
-+++ b/login-utils/login.c
-@@ -1110,6 +1110,7 @@ int main(int argc, char **argv)
- char *buff;
- int childArgc = 0;
- int retcode;
-+ struct sigaction act;
-
- char *pwdbuf = NULL;
- struct passwd *pwd = NULL, _pwd;
-@@ -1123,7 +1124,9 @@ int main(int argc, char **argv)
- timeout = (unsigned int)getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);
-
- signal(SIGALRM, timedout);
-- siginterrupt(SIGALRM, 1); /* we have to interrupt syscalls like ioctl() */
-+ (void) sigaction(SIGALRM, NULL, &act);
-+ act.sa_flags &= ~SA_RESTART;
-+ sigaction(SIGALRM, &act, NULL);
- alarm(timeout);
- signal(SIGQUIT, SIG_IGN);
- signal(SIGINT, SIG_IGN);
---
-1.9.1
-
diff --git a/meta/recipes-core/util-linux/util-linux_2.26.2.bb b/meta/recipes-core/util-linux/util-linux_2.26.2.bb
deleted file mode 100644
index fc7dc6e094..0000000000
--- a/meta/recipes-core/util-linux/util-linux_2.26.2.bb
+++ /dev/null
@@ -1,30 +0,0 @@
-MAJOR_VERSION = "2.26"
-require util-linux.inc
-
-# To support older hosts, we need to patch and/or revert
-# some upstream changes. Only do this for native packages.
-OLDHOST = ""
-OLDHOST_class-native = "file://util-linux-native.patch \
- file://util-linux-native-qsort.patch \
- "
-
-SRC_URI += "file://util-linux-ng-replace-siginterrupt.patch \
- file://util-linux-ng-2.16-mount_lock_path.patch \
- file://uclibc-__progname-conflict.patch \
- file://configure-sbindir.patch \
- file://fix-parallel-build.patch \
- ${OLDHOST} \
-"
-SRC_URI[md5sum] = "9bdf368c395f1b70325d0eb22c7f48fb"
-SRC_URI[sha256sum] = "0e29bda142528a48a0a953c39ff63093651a4809042e1790fbd6aa8663fd9666"
-
-CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
-
-EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \
- --disable-fallocate \
- --disable-use-tty-group \
-"
-EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \
- --disable-fallocate \
- --disable-use-tty-group \
-"
diff --git a/meta/recipes-core/util-linux/util-linux_2.37.2.bb b/meta/recipes-core/util-linux/util-linux_2.37.2.bb
new file mode 100644
index 0000000000..d609c30067
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux_2.37.2.bb
@@ -0,0 +1,320 @@
+require util-linux.inc
+
+#gtk-doc is not enabled as it requires xmlto which requires util-linux
+inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest
+DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
+
+PACKAGES =+ "${PN}-swaponoff"
+PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
+
+python util_linux_binpackages () {
+ def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
+ pn = d.getVar('PN')
+ d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
+
+ if d.getVar('ALTERNATIVE:' + pkg):
+ return
+ if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
+ d.setVar('ALTERNATIVE:' + pkg, modulename)
+
+ bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
+ for dir in bindirs:
+ do_split_packages(d, root=dir,
+ file_regex=r'(.*)', output_pattern='${PN}-%s',
+ description='${PN} %s',
+ hook=pkg_hook, extra_depends='')
+
+ # There are some symlinks for some binaries which we have ignored
+ # above. Add them to the package owning the binary they are
+ # pointing to
+ extras = {}
+ dvar = d.getVar('PKGD')
+ for root in bindirs:
+ for walkroot, dirs, files in os.walk(dvar + root):
+ for f in files:
+ file = os.path.join(walkroot, f)
+ if not os.path.islink(file):
+ continue
+
+ pkg = os.path.basename(os.readlink(file))
+ extras.setdefault(pkg, [])
+ extras[pkg].append(file.replace(dvar, '', 1))
+
+ pn = d.getVar('PN')
+ for pkg, links in extras.items():
+ of = d.getVar('FILES:' + pn + '-' + pkg)
+ links = of + " " + " ".join(sorted(links))
+ d.setVar('FILES:' + pn + '-' + pkg, links)
+}
+
+# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
+PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
+
+# skip libuuid as it will be packaged by the util-linux-libuuid recipe
+python util_linux_libpackages() {
+ do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
+ output_pattern='${PN}-lib%s',
+ description='${PN} lib%s',
+ extra_depends='', prepend=True, allow_links=True)
+}
+
+PACKAGESPLITFUNCS =+ "util_linux_libpackages"
+
+PACKAGES_DYNAMIC = "^${PN}-.*"
+
+CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
+UTIL_LINUX_LIBDIR = "${libdir}"
+UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
+EXTRA_OECONF = "\
+ --enable-libuuid --enable-libblkid \
+ \
+ --enable-fsck --enable-kill --enable-last --enable-mesg \
+ --enable-mount --enable-partx --enable-raw --enable-rfkill \
+ --enable-unshare --enable-write \
+ \
+ --disable-bfs --disable-login \
+ --disable-makeinstall-chown --disable-minix --disable-newgrp \
+ --disable-use-tty-group --disable-vipw --disable-raw \
+ \
+ --without-udev \
+ \
+ usrsbin_execdir='${sbindir}' \
+ --libdir='${UTIL_LINUX_LIBDIR}' \
+"
+
+EXTRA_OECONF:append:class-target = " --enable-setpriv"
+EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
+EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
+EXTRA_OECONF:append = " --disable-hwclock-gplv3"
+
+# enable pcre2 for native/nativesdk to match host distros
+# this helps to keep same expectations when using the SDK or
+# build host versions during development
+#
+PACKAGECONFIG ?= "pcre2"
+PACKAGECONFIG:class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}"
+# inherit manpages requires this to be present, however util-linux does not have
+# configuration options, and installs manpages always
+PACKAGECONFIG[manpages] = ""
+PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
+# Respect the systemd feature for uuidd
+PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
+# Build python bindings for libmount
+PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
+# Readline support
+PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
+# PCRE support in hardlink
+PACKAGECONFIG[pcre2] = ",,libpcre2"
+PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
+PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
+
+EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
+
+ALLOW_EMPTY:${PN} = "1"
+FILES:${PN} = ""
+FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
+FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
+FILES:${PN}-mount = "${sysconfdir}/default/mountall"
+FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
+FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
+CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
+FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
+ ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
+ ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
+
+# Util-linux' blkid replaces the e2fsprogs one
+RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
+RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
+
+RRECOMMENDS:${PN}:class-native = ""
+RRECOMMENDS:${PN}:class-nativesdk = ""
+RDEPENDS:${PN}:class-native = ""
+RDEPENDS:${PN}:class-nativesdk = ""
+
+RDEPENDS:${PN} += " util-linux-libuuid"
+RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
+
+RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
+
+RDEPENDS:${PN}-bash-completion += "${PN}-lsblk"
+RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod mdadm procps sed socat which xz"
+RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop"
+RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
+ALLOW_EMPTY:${PN}-swaponoff = "1"
+
+#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
+SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
+SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
+SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
+SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
+
+do_install () {
+ # with ccache the timestamps on compiled files may
+ # end up earlier than on their inputs, this allows
+ # for the resultant compilation in the install step.
+ oe_runmake 'CC=${CC}' 'LD=${LD}' \
+ 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
+
+ mkdir -p ${D}${base_bindir}
+
+ sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
+ sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
+ binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
+
+ if [ "${base_sbindir}" != "${sbindir}" ]; then
+ mkdir -p ${D}${base_sbindir}
+ for p in $sbinprogs $sbinprogs_a; do
+ if [ -f "${D}${sbindir}/$p" ]; then
+ mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
+ fi
+ done
+ fi
+
+ if [ "${base_bindir}" != "${bindir}" ]; then
+ mkdir -p ${D}${base_bindir}
+ for p in $binprogs_a; do
+ if [ -f "${D}${bindir}/$p" ]; then
+ mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
+ fi
+ done
+ fi
+
+ install -d ${D}${sysconfdir}/default/
+ echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
+
+ rm -f ${D}${bindir}/chkdupexe
+}
+
+do_install:append:class-target () {
+ if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
+ install -d ${D}${sysconfdir}/pam.d
+ install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
+ install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
+ # Required for "su -" aka "su --login" because
+ # otherwise it uses "other", which has "auth pam_deny.so"
+ # and thus prevents the operation.
+ ln -s su ${D}${sysconfdir}/pam.d/su-l
+ fi
+}
+# nologin causes a conflict with shadow-native
+# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
+do_install:append:class-native () {
+ rm -f ${D}${base_sbindir}/nologin
+ rm -f ${D}${base_bindir}/kill
+}
+
+# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
+# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
+do_install:append () {
+ rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
+}
+
+ALTERNATIVE_PRIORITY = "80"
+
+ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
+ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
+ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
+ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
+ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
+ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
+ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
+ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
+ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
+ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
+ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
+ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
+ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
+ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
+ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
+ALTERNATIVE:${PN}-agetty = "getty"
+ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
+ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
+ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
+ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
+ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
+ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
+ALTERNATIVE:${PN}-last = "last lastb"
+ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
+ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
+ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
+ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
+ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
+ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
+ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie"
+ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
+ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
+ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
+ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
+ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
+ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
+ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit"
+ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
+ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
+ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
+ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
+ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
+ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
+ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
+ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
+ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
+ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
+ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
+ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
+ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
+ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
+ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
+ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
+ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
+ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
+
+ALTERNATIVE:${PN}-doc = "\
+blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
+mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
+"
+ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
+
+ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
+ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
+ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
+ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
+ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
+ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
+ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
+ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
+ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
+ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
+ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
+ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
+ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
+ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
+ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
+ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
+ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
+ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
+ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
+
+BBCLASSEXTEND = "native nativesdk"
+
+PTEST_BINDIR = "1"
+do_compile_ptest() {
+ oe_runmake buildtest-TESTS
+}
+
+do_install_ptest() {
+ mkdir -p ${D}${PTEST_PATH}/tests/ts
+ find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
+ find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
+ find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
+
+ cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
+ cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
+ cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
+ cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
+
+ sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
+
+ # chfn needs PAM
+ if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
+ rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
+ fi
+}
diff --git a/meta/recipes-core/volatile-binds/files/mount-copybind b/meta/recipes-core/volatile-binds/files/mount-copybind
index 2aeaf84ddb..aad022c6e4 100755
--- a/meta/recipes-core/volatile-binds/files/mount-copybind
+++ b/meta/recipes-core/volatile-binds/files/mount-copybind
@@ -8,7 +8,10 @@ if [ $# -lt 2 ]; then
exit 1
fi
+# e.g. /var/volatile/lib
spec=$1
+
+# e.g. /var/lib
mountpoint=$2
if [ $# -gt 2 ]; then
@@ -20,15 +23,58 @@ fi
[ -n "$options" ] && options=",$options"
mkdir -p "${spec%/*}"
+
if [ -d "$mountpoint" ]; then
- if [ ! -d "$spec" ]; then
+
+ if [ -d "$spec" ]; then
+ specdir_existed=yes
+ else
+ specdir_existed=no
mkdir "$spec"
- cp -pPR "$mountpoint"/. "$spec/"
+ # If the $spec directory is created we need to take care that
+ # the selinux context is correct
+ if command -v selinuxenabled > /dev/null 2>&1; then
+ if selinuxenabled; then
+ restorecon "$spec"
+ fi
+ fi
+ fi
+
+ # Fast version of calculating `dirname ${spec}`/.`basename ${spec}`-work
+ overlay_workdir="${spec%/*}/.${spec##*/}-work"
+ mkdir "${overlay_workdir}"
+
+ # Try to mount using overlay, which is must faster than copying files.
+ # If that fails, fall back to slower copy.
+ if command -v selinuxenabled > /dev/null 2>&1; then
+ if selinuxenabled; then
+ mountcontext=",rootcontext=$(matchpathcon -n $mountpoint)"
+ fi
+ fi
+ if ! mount -t overlay overlay -olowerdir="$mountpoint",upperdir="$spec",workdir="$overlay_workdir""$mountcontext" "$mountpoint" > /dev/null 2>&1; then
+
+ if [ "$specdir_existed" != "yes" ]; then
+ cp -aPR "$mountpoint"/. "$spec/"
+ fi
+
+ mount -o "bind$options" "$spec" "$mountpoint"
+ # restore the selinux context.
+ if command -v selinuxenabled > /dev/null 2>&1; then
+ if selinuxenabled; then
+ restorecon -R "$mountpoint"
+ fi
+ fi
fi
elif [ -f "$mountpoint" ]; then
if [ ! -f "$spec" ]; then
- cp -pP "$mountpoint" "$spec"
+ cp -aP "$mountpoint" "$spec"
fi
-fi
-mount -o "bind$options" "$spec" "$mountpoint"
+ mount -o "bind$options" "$spec" "$mountpoint"
+ # restore the selinux context.
+ if command -v selinuxenabled > /dev/null 2>&1; then
+ if selinuxenabled; then
+ restorecon -R "$mountpoint"
+ fi
+ fi
+fi
diff --git a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
index b23355a714..e2ad39f258 100644
--- a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
+++ b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
@@ -10,7 +10,6 @@ ConditionPathIsReadWrite=!@where@
[Service]
Type=oneshot
RemainAfterExit=Yes
-StandardOutput=syslog
TimeoutSec=0
ExecStart=/sbin/mount-copybind @what@ @where@
ExecStop=/bin/umount @where@
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb
index fee7275e32..d5c5538cd7 100644
--- a/meta/recipes-core/volatile-binds/volatile-binds.bb
+++ b/meta/recipes-core/volatile-binds/volatile-binds.bb
@@ -11,12 +11,15 @@ SRC_URI = "\
S = "${WORKDIR}"
-inherit allarch systemd distro_features_check
+inherit allarch systemd features_check
REQUIRED_DISTRO_FEATURES = "systemd"
VOLATILE_BINDS ?= "\
/var/volatile/lib /var/lib\n\
+ /var/volatile/cache /var/cache\n\
+ /var/volatile/spool /var/spool\n\
+ /var/volatile/srv /srv\n\
"
VOLATILE_BINDS[type] = "list"
VOLATILE_BINDS[separator] = "\n"
@@ -30,9 +33,9 @@ def volatile_systemd_services(d):
services.append("%s.service" % what[1:].replace("/", "-"))
return " ".join(services)
-SYSTEMD_SERVICE_${PN} = "${@volatile_systemd_services(d)}"
+SYSTEMD_SERVICE:${PN} = "${@volatile_systemd_services(d)}"
-FILES_${PN} += "${systemd_unitdir}/system/*.service"
+FILES:${PN} += "${systemd_system_unitdir}/*.service ${servicedir}"
do_compile () {
while read spec mountpoint; do
@@ -46,7 +49,7 @@ do_compile () {
-e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
volatile-binds.service.in >$servicefile
done <<END
-${@d.getVar('VOLATILE_BINDS', True).replace("\\n", "\n")}
+${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")}
END
if [ -e var-volatile-lib.service ]; then
@@ -61,11 +64,18 @@ do_compile[dirs] = "${WORKDIR}"
do_install () {
install -d ${D}${base_sbindir}
+ install -d ${D}${servicedir}
install -m 0755 mount-copybind ${D}${base_sbindir}/
- install -d ${D}${systemd_unitdir}/system
- for service in ${SYSTEMD_SERVICE_volatile-binds}; do
- install -m 0644 $service ${D}${systemd_unitdir}/system/
+ install -d ${D}${systemd_system_unitdir}
+ for service in ${SYSTEMD_SERVICE:${PN}}; do
+ install -m 0644 $service ${D}${systemd_system_unitdir}/
done
+
+ # Suppress attempts to process some tmpfiles that are not temporary.
+ #
+ install -d ${D}${sysconfdir}/tmpfiles.d ${D}/var/cache
+ ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf
+ ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf
}
do_install[dirs] = "${WORKDIR}"
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch b/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch
deleted file mode 100644
index 61eea8238a..0000000000
--- a/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-Add 'ptest' target to Makefile, to run tests without checking dependencies.
-
-Signed-off-by: Anders Roxell <anders.roxell@enea.com>
-Upstream-Status: Pending
----
-diff -uNr a/Makefile.in b/Makefile.in
---- a/Makefile.in 2013-06-10 13:48:14.321959162 +0200
-+++ b/Makefile.in 2013-06-10 13:49:36.686476448 +0200
-@@ -83,6 +83,9 @@
- test: all teststatic testshared
-
- teststatic: static
-+ @make runteststatic
-+
-+runteststatic:
- @TMPST=tmpst_$$; \
- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
- echo ' *** zlib test OK ***'; \
-@@ -92,6 +95,9 @@
- rm -f $$TMPST
-
- testshared: shared
-+ @make runtestshared
-+
-+runtestshared:
- @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
- LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
- DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
-@@ -105,6 +111,9 @@
- rm -f $$TMPSH
-
- test64: all64
-+ @make runtestall64
-+
-+runtestall64:
- @TMP64=tmp64_$$; \
- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
- echo ' *** zlib 64-bit test OK ***'; \
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch b/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch
deleted file mode 100644
index 403b4825c9..0000000000
--- a/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-
-When /etc/ld.so.cache is writeable by user running bitbake then it creates invalid cache
-(in my case libstdc++.so cannot be found after building zlib(-native) and I have to call
-touch */libstdc++.so && /sbin/ldconfig to fix it.
-
-So remove ldconfig call from make install-libs
-
-Upstream-Status: Inappropriate [disable feature]
-
-diff -uNr zlib-1.2.6.orig/Makefile.in zlib-1.2.6/Makefile.in
---- zlib-1.2.6.orig/Makefile.in 2012-01-28 23:48:50.000000000 +0100
-+++ zlib-1.2.6/Makefile.in 2012-02-13 15:38:20.577700723 +0100
-@@ -199,7 +199,6 @@
- rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
-- ($(LDCONFIG) || true) >/dev/null 2>&1; \
- fi
- cp zlib.3 $(DESTDIR)$(man3dir)
- chmod 644 $(DESTDIR)$(man3dir)/zlib.3
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/run-ptest b/meta/recipes-core/zlib/zlib-1.2.8/run-ptest
deleted file mode 100644
index 884d9dc699..0000000000
--- a/meta/recipes-core/zlib/zlib-1.2.8/run-ptest
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-make -k runteststatic runtestshared | sed -r -e 's/^(\s+\*+ (.+?) test OK \*+)/\1\nPASS: \2/' -e 's/^(\s+\*+ (.+?) test FAILED \*+)/\1\nFAIL: \2/'
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch b/meta/recipes-core/zlib/zlib/ldflags-tests.patch
index 650794f504..286390665f 100644
--- a/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
+++ b/meta/recipes-core/zlib/zlib/ldflags-tests.patch
@@ -1,7 +1,7 @@
Obey LDFLAGS for tests
-Signed-off-by: Christopher Larson <chris_larson@mentor.com>
-Upstream-status: Pending
+Upstream-Status: Submitted [https://github.com/madler/zlib/pull/409]
+Signed-off-by: Ross Burton <ross.burton@intel.com>
--- zlib-1.2.8.orig/Makefile.in
+++ zlib-1.2.8/Makefile.in
diff --git a/meta/recipes-core/zlib/zlib/run-ptest b/meta/recipes-core/zlib/zlib/run-ptest
new file mode 100644
index 0000000000..065863ef75
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib/run-ptest
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if ./examplesh ; then
+ echo "PASS: zlib"
+else
+ echo "FAIL: zlib"
+fi
diff --git a/meta/recipes-core/zlib/zlib_1.2.8.bb b/meta/recipes-core/zlib/zlib_1.2.11.bb
index 9470adb1be..1c06aa0ab5 100644
--- a/meta/recipes-core/zlib/zlib_1.2.8.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.11.bb
@@ -4,32 +4,29 @@ library which is used by many different programs."
HOMEPAGE = "http://zlib.net/"
SECTION = "libs"
LICENSE = "Zlib"
-LIC_FILES_CHKSUM = "file://zlib.h;beginline=4;endline=23;md5=fde612df1e5933c428b73844a0c494fd"
+LIC_FILES_CHKSUM = "file://zlib.h;beginline=6;endline=23;md5=5377232268e952e9ef63bc555f7aa6c0"
-SRC_URI = "http://www.zlib.net/${BPN}-${PV}.tar.xz \
- file://remove.ldconfig.call.patch \
- file://Makefile-runtests.patch \
+SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
file://ldflags-tests.patch \
file://run-ptest \
"
+UPSTREAM_CHECK_URI = "http://zlib.net/"
-SRC_URI[md5sum] = "28f1205d8dd2001f26fec1e8c2cebe37"
-SRC_URI[sha256sum] = "831df043236df8e9a7667b9e3bb37e1fcb1220a0f163b6de2626774b9590d057"
+SRC_URI[md5sum] = "85adef240c5f370b308da8c938951a68"
+SRC_URI[sha256sum] = "4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066"
-RDEPENDS_${PN}-ptest += "make"
+CFLAGS += "-D_REENTRANT"
-inherit ptest
+RDEPENDS:${PN}-ptest += "make"
-do_configure (){
- ./configure --prefix=${prefix} --shared --libdir=${libdir}
-}
+inherit ptest
-do_compile (){
- oe_runmake
+do_configure() {
+ LDCONFIG=true ./configure --prefix=${prefix} --shared --libdir=${libdir} --uname=GNU
}
-do_compile_ptest() {
- oe_runmake static shared
+do_compile() {
+ oe_runmake shared
}
do_install() {
@@ -37,16 +34,12 @@ do_install() {
}
do_install_ptest() {
- install ${B}/Makefile ${D}${PTEST_PATH}
- install ${B}/example ${D}${PTEST_PATH}
- install ${B}/minigzip ${D}${PTEST_PATH}
- install ${B}/examplesh ${D}${PTEST_PATH}
- install ${B}/minigzipsh ${D}${PTEST_PATH}
+ install ${B}/examplesh ${D}${PTEST_PATH}
}
# Move zlib shared libraries for target builds to $base_libdir so the library
# can be used in early boot before $prefix is mounted.
-do_install_append_class-target() {
+do_install:append:class-target() {
if [ ${base_libdir} != ${libdir} ]
then
mkdir -p ${D}/${base_libdir}