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/fstab12
-rw-r--r--meta/recipes-core/base-files/base-files/host.conf2
-rw-r--r--meta/recipes-core/base-files/base-files/inputrc61
-rw-r--r--meta/recipes-core/base-files/base-files/issue0
-rw-r--r--meta/recipes-core/base-files/base-files/issue.net0
-rw-r--r--meta/recipes-core/base-files/base-files/licenses/GPL-2340
-rw-r--r--meta/recipes-core/base-files/base-files/motd0
-rw-r--r--meta/recipes-core/base-files/base-files/nsswitch.conf19
-rw-r--r--meta/recipes-core/base-files/base-files/profile36
-rw-r--r--meta/recipes-core/base-files/base-files/rotation1
-rw-r--r--meta/recipes-core/base-files/base-files/share/dot.bashrc16
-rw-r--r--meta/recipes-core/base-files/base-files/share/dot.profile10
-rw-r--r--meta/recipes-core/base-files/base-files/shells2
-rw-r--r--meta/recipes-core/base-files/base-files/usbd0
-rw-r--r--meta/recipes-core/base-files/base-files_3.0.14.bb178
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/add_shutdown.patch19
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/disable-docs.patch24
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/input.patch22
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/nobash.patch15
-rw-r--r--meta/recipes-core/base-passwd/base-passwd/noshadow.patch14
-rw-r--r--meta/recipes-core/base-passwd/base-passwd_3.5.29.bb102
-rw-r--r--meta/recipes-core/busybox/busybox.inc412
-rw-r--r--meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch40
-rw-r--r--meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch41
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch37
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch71
-rw-r--r--meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch137
-rw-r--r--meta/recipes-core/busybox/busybox/defconfig1020
-rw-r--r--meta/recipes-core/busybox/busybox/fail_on_no_media.patch31
-rw-r--r--meta/recipes-core/busybox/busybox/get_header_tar.patch22
-rw-r--r--meta/recipes-core/busybox/busybox/libarchive-open_zipped-does-not-need-to-check-extens.patch66
-rw-r--r--meta/recipes-core/busybox/busybox/login-utilities.cfg13
-rw-r--r--meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch71
-rw-r--r--meta/recipes-core/busybox/busybox/recognize_connmand.patch21
-rw-r--r--meta/recipes-core/busybox/busybox/unbreak_noncompressed_tar.patch23
-rw-r--r--meta/recipes-core/busybox/busybox_1.22.1.bb50
-rw-r--r--meta/recipes-core/busybox/busybox_git.bb46
-rwxr-xr-xmeta/recipes-core/busybox/files/busybox-cron39
-rwxr-xr-xmeta/recipes-core/busybox/files/busybox-httpd44
-rw-r--r--meta/recipes-core/busybox/files/busybox-klogd.service.in8
-rw-r--r--meta/recipes-core/busybox/files/busybox-syslog.default25
-rw-r--r--meta/recipes-core/busybox/files/busybox-syslog.service.in13
-rwxr-xr-xmeta/recipes-core/busybox/files/busybox-udhcpd43
-rw-r--r--meta/recipes-core/busybox/files/default.script4
-rw-r--r--meta/recipes-core/busybox/files/find-touchscreen.sh9
-rw-r--r--meta/recipes-core/busybox/files/hwclock.sh83
-rw-r--r--meta/recipes-core/busybox/files/inetd33
-rw-r--r--meta/recipes-core/busybox/files/inetd.conf20
-rwxr-xr-xmeta/recipes-core/busybox/files/mdev19
-rw-r--r--meta/recipes-core/busybox/files/mdev.conf37
-rwxr-xr-xmeta/recipes-core/busybox/files/mount.busybox3
-rw-r--r--meta/recipes-core/busybox/files/run-ptest7
-rw-r--r--meta/recipes-core/busybox/files/simple.script88
-rw-r--r--meta/recipes-core/busybox/files/syslog77
-rw-r--r--meta/recipes-core/busybox/files/syslog-startup.conf13
-rw-r--r--meta/recipes-core/busybox/files/syslog.conf1
-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.22/date-tz-crash.patch43
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch22
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch31
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/fix-selinux-flask.patch39
-rw-r--r--meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch31
-rw-r--r--meta/recipes-core/coreutils/coreutils_6.9.bb106
-rw-r--r--meta/recipes-core/coreutils/coreutils_8.22.bb108
-rw-r--r--meta/recipes-core/dbus-wait/dbus-wait_git.bb17
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch15
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch48
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.102/no-examples.patch15
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.102/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-core/dbus/dbus-glib-0.102/test-install-makefile.patch48
-rw-r--r--meta/recipes-core/dbus/dbus-glib.inc44
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.100.2.bb5
-rw-r--r--meta/recipes-core/dbus/dbus-glib_0.102.bb8
-rw-r--r--meta/recipes-core/dbus/dbus-test_1.8.2.bb60
-rw-r--r--meta/recipes-core/dbus/dbus-test_1.8.6.bb59
-rw-r--r--meta/recipes-core/dbus/dbus.inc169
-rw-r--r--meta/recipes-core/dbus/dbus/CVE-2015-0245-prevent-forged-ActivationFailure.patch48
-rw-r--r--meta/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch104
-rw-r--r--meta/recipes-core/dbus/dbus/dbus-1.init123
-rw-r--r--meta/recipes-core/dbus/dbus/os-test.patch35
-rw-r--r--meta/recipes-core/dbus/dbus/python-config.patch25
-rwxr-xr-xmeta/recipes-core/dbus/dbus/run-ptest10
-rw-r--r--meta/recipes-core/dbus/dbus/tmpdir.patch44
-rw-r--r--meta/recipes-core/dbus/dbus_1.8.2.bb4
-rw-r--r--meta/recipes-core/dbus/dbus_1.8.6.bb4
-rw-r--r--meta/recipes-core/dropbear/dropbear-2013.58/build_test.patch229
-rw-r--r--meta/recipes-core/dropbear/dropbear.inc106
-rw-r--r--meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch23
-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.patch28
-rw-r--r--meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch22
-rw-r--r--meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch140
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear4
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear.socket10
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbear@.service11
-rw-r--r--meta/recipes-core/dropbear/dropbear/dropbearkey.service8
-rwxr-xr-xmeta/recipes-core/dropbear/dropbear/init113
-rw-r--r--meta/recipes-core/dropbear/dropbear/run-ptest2
-rw-r--r--meta/recipes-core/dropbear/dropbear_2014.63.bb4
-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_2.1.0.bb5
-rw-r--r--meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb44
-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-error_print_progname.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.18.3.2/parallel.patch36
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING4
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in454
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template53
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgzbin0 -> 37591 bytes
-rwxr-xr-xmeta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath690
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch43
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin19
-rw-r--r--meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb32
-rw-r--r--meta/recipes-core/gettext/gettext_0.16.1.bb109
-rw-r--r--meta/recipes-core/gettext/gettext_0.18.3.2.bb106
-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/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/ptest-paths.patch30
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/run-ptest3
-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.40.0.bb22
-rw-r--r--meta/recipes-core/glib-2.0/glib.inc102
-rw-r--r--meta/recipes-core/glib-networking/glib-networking_2.38.0.bb32
-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.20.bb52
-rw-r--r--meta/recipes-core/glibc/glibc-collateral.inc12
-rw-r--r--meta/recipes-core/glibc/glibc-common.inc9
-rw-r--r--meta/recipes-core/glibc/glibc-initial.inc78
-rw-r--r--meta/recipes-core/glibc/glibc-initial_2.20.bb11
-rw-r--r--meta/recipes-core/glibc/glibc-ld.inc56
-rw-r--r--meta/recipes-core/glibc/glibc-locale.inc96
-rw-r--r--meta/recipes-core/glibc/glibc-locale_2.20.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace.inc13
-rw-r--r--meta/recipes-core/glibc/glibc-mtrace_2.20.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-options.inc162
-rw-r--r--meta/recipes-core/glibc/glibc-package.inc158
-rw-r--r--meta/recipes-core/glibc/glibc-scripts.inc16
-rw-r--r--meta/recipes-core/glibc/glibc-scripts_2.20.bb1
-rw-r--r--meta/recipes-core/glibc/glibc-testing.inc79
-rw-r--r--meta/recipes-core/glibc/glibc.inc92
-rw-r--r--meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch56
-rw-r--r--meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch33
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch339
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch215
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2014-9402_endless-loop-in-getaddr_r.patch65
-rw-r--r--meta/recipes-core/glibc/glibc/CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch43
-rw-r--r--meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch529
-rw-r--r--meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch17
-rw-r--r--meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch20
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch85
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch109
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch68
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch54
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch42
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch16578
-rw-r--r--meta/recipes-core/glibc/glibc/eglibc.patch602
-rw-r--r--meta/recipes-core/glibc/glibc/etc/ld.so.conf0
-rw-r--r--meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch38
-rw-r--r--meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch29
-rw-r--r--meta/recipes-core/glibc/glibc/fsl-ppc-no-fsqrt.patch100
-rw-r--r--meta/recipes-core/glibc/glibc/generate-supported.mk11
-rw-r--r--meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch1516
-rw-r--r--meta/recipes-core/glibc/glibc/grok_gold.patch34
-rw-r--r--meta/recipes-core/glibc/glibc/initgroups_keys.patch20
-rw-r--r--meta/recipes-core/glibc/glibc/ld-search-order.patch56
-rw-r--r--meta/recipes-core/glibc/glibc/mips-rld-map-check.patch27
-rw-r--r--meta/recipes-core/glibc/glibc/multilib_readlib.patch19
-rw-r--r--meta/recipes-core/glibc/glibc/option-groups.patch1397
-rw-r--r--meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch184
-rw-r--r--meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch365
-rw-r--r--meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch47
-rw-r--r--meta/recipes-core/glibc/glibc/relocatable_sdk.patch108
-rw-r--r--meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch41
-rw-r--r--meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch38
-rw-r--r--meta/recipes-core/glibc/glibc_2.20.bb165
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch331
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/README8
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch454
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch47
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch113
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch24
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch37
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2bin0 -> 21491 bytes
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch471
-rw-r--r--meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch36
-rw-r--r--meta/recipes-core/glibc/ldconfig-native_2.12.1.bb33
-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/images/build-appliance-image_8.0.bb93
-rw-r--r--meta/recipes-core/images/core-image-base.bb8
-rw-r--r--meta/recipes-core/images/core-image-minimal-dev.bb7
-rw-r--r--meta/recipes-core/images/core-image-minimal-initramfs.bb21
-rw-r--r--meta/recipes-core/images/core-image-minimal-mtdutils.bb7
-rw-r--r--meta/recipes-core/images/core-image-minimal.bb12
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright11
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init90
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces31
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot39
-rw-r--r--meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/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.bb39
-rw-r--r--meta/recipes-core/initrdscripts/files/init-boot.sh10
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh199
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-efi.sh230
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install-testfs.sh220
-rw-r--r--meta/recipes-core/initrdscripts/files/init-install.sh218
-rw-r--r--meta/recipes-core/initrdscripts/files/init-live.sh235
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb14
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/debug82
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/e2fs28
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/finish47
-rwxr-xr-xmeta/recipes-core/initrdscripts/initramfs-framework/init140
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/mdev30
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework/udev45
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb59
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb17
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb14
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb22
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb14
-rw-r--r--meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb22
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch347
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh13
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/banner.sh24
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh81
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkfs.sh50
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/checkroot.sh148
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/devpts5
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/devpts.sh28
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh17
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/functions91
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/halt29
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/hostname.sh22
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf9
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountall.sh39
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh88
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh222
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh38
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/reboot15
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh20
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh13
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/sendsigs21
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/single24
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh23
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/umountfs24
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh33
-rwxr-xr-xmeta/recipes-core/initscripts/initscripts-1.0/urandom49
-rw-r--r--meta/recipes-core/initscripts/initscripts-1.0/volatiles36
-rw-r--r--meta/recipes-core/initscripts/initscripts_1.0.bb169
-rw-r--r--meta/recipes-core/jpeg/jpeg-8d/debian-libjpeg7_7-1.diff1070
-rw-r--r--meta/recipes-core/jpeg/jpeg-8d/fix_for_automake_1.12.1.patch44
-rw-r--r--meta/recipes-core/jpeg/jpeg_8d.bb51
-rw-r--r--meta/recipes-core/kbd/kbd/uclibc-stdarg.patch36
-rw-r--r--meta/recipes-core/kbd/kbd_2.0.2.bb35
-rw-r--r--meta/recipes-core/libcgroup/libcgroup_0.41.bb41
-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/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch30
-rw-r--r--meta/recipes-core/libxml/libxml2/ansidecl.patch25
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-64bit.patch22
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch204
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch37
-rw-r--r--meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch147
-rw-r--r--meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch21
-rw-r--r--meta/recipes-core/libxml/libxml2/run-ptest3
-rw-r--r--meta/recipes-core/libxml/libxml2/runtest.patch820
-rw-r--r--meta/recipes-core/libxml/libxml2_2.9.1.bb9
-rw-r--r--meta/recipes-core/meta/buildtools-tarball.bb55
-rw-r--r--meta/recipes-core/meta/meta-environment.bb77
-rw-r--r--meta/recipes-core/meta/meta-ide-support.bb17
-rw-r--r--meta/recipes-core/meta/meta-toolchain.bb9
-rw-r--r--meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb18
-rw-r--r--meta/recipes-core/meta/package-index.bb28
-rw-r--r--meta/recipes-core/meta/uninative-tarball.bb48
-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.inc296
-rw-r--r--meta/recipes-core/ncurses/ncurses_5.9.bb10
-rw-r--r--meta/recipes-core/ncurses/site_config/headers5
-rw-r--r--meta/recipes-core/netbase/netbase/hosts2
-rw-r--r--meta/recipes-core/netbase/netbase_5.2.bb23
-rw-r--r--meta/recipes-core/os-release/os-release.bb36
-rw-r--r--meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb33
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-base.bb366
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-boot.bb47
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb29
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb10
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-nfs.bb17
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-sdk.bb80
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb7
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb7
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb15
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb20
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb84
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb58
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb18
-rw-r--r--meta/recipes-core/packagegroups/packagegroup-self-hosted.bb205
-rwxr-xr-xmeta/recipes-core/psplash/files/psplash-init29
-rw-r--r--meta/recipes-core/psplash/files/psplash-poky-img.h1259
-rw-r--r--meta/recipes-core/psplash/psplash_git.bb121
-rw-r--r--meta/recipes-core/readline/files/config-dirent-symbols.patch34
-rw-r--r--meta/recipes-core/readline/files/norpath.patch21
-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/configure-fix.patch35
-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.inc41
-rw-r--r--meta/recipes-core/readline/readline_5.2.bb86
-rw-r--r--meta/recipes-core/readline/readline_6.3.bb8
-rw-r--r--meta/recipes-core/sysfsutils/sysfsutils-2.1.0/obsolete_automake_macros.patch15
-rw-r--r--meta/recipes-core/sysfsutils/sysfsutils-2.1.0/separatebuild.patch65
-rw-r--r--meta/recipes-core/sysfsutils/sysfsutils-2.1.0/sysfsutils-2.0.0-class-dup.patch23
-rw-r--r--meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb29
-rw-r--r--meta/recipes-core/systemd/systemd-compat-units.bb41
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb49
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service37
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb15
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl153
-rw-r--r--meta/recipes-core/systemd/systemd/00-create-volatile.conf7
-rw-r--r--meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch180
-rw-r--r--meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch138
-rw-r--r--meta/recipes-core/systemd/systemd/0001-build-sys-configure-the-list-of-system-users-files-a.patch176
-rw-r--r--meta/recipes-core/systemd/systemd/0001-build-sys-do-not-install-tmpfiles-and-sysusers-files.patch56
-rw-r--r--meta/recipes-core/systemd/systemd/0001-journal-Fix-navigating-backwards-missing-entries.patch33
-rw-r--r--meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch29
-rw-r--r--meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch26
-rw-r--r--meta/recipes-core/systemd/systemd/0001-tmpfiles-make-resolv.conf-entry-conditional-on-resol.patch142
-rw-r--r--meta/recipes-core/systemd/systemd/binfmt-install.patch56
-rw-r--r--meta/recipes-core/systemd/systemd/init104
-rw-r--r--meta/recipes-core/systemd/systemd/optional_secure_getenv.patch19
-rw-r--r--meta/recipes-core/systemd/systemd/run-ptest5
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch32
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch29
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch92
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/touchscreen.rules18
-rw-r--r--meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch19
-rw-r--r--meta/recipes-core/systemd/systemd_216.bb392
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch25
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch83
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch189
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/inittab30
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb82
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/01_bootlogd1
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/bootlogd.init98
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rc182
-rwxr-xr-xmeta/recipes-core/sysvinit/sysvinit/rcS34
-rw-r--r--meta/recipes-core/sysvinit/sysvinit/rcS-default29
-rw-r--r--meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb102
-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.inc29
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Add-eventfd_read-and-eventfd_write.patch120
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch75
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch319
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch44
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch28
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch74
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch33
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/0002-wire-setns-syscall.patch68
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/argp-headers.patch583
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/argp-support.patch5192
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch21
-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/orign_path.patch186
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch113
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch19
-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-git/uclibc_enable_log2_test.patch35
-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.inc167
-rw-r--r--meta/recipes-core/uclibc/uclibc_git.bb22
-rw-r--r--meta/recipes-core/udev/udev-extraconf/automount.rules19
-rw-r--r--meta/recipes-core/udev/udev-extraconf/autonet.rules19
-rw-r--r--meta/recipes-core/udev/udev-extraconf/localextra.rules23
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.blacklist5
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh90
-rw-r--r--meta/recipes-core/udev/udev-extraconf/network.sh54
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb39
-rw-r--r--meta/recipes-core/udev/udev.inc106
-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/devfs-udev.rules108
-rw-r--r--meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch59
-rw-r--r--meta/recipes-core/udev/udev/init140
-rw-r--r--meta/recipes-core/udev/udev/links.conf21
-rw-r--r--meta/recipes-core/udev/udev/local.rules22
-rw-r--r--meta/recipes-core/udev/udev/permissions.rules131
-rw-r--r--meta/recipes-core/udev/udev/run-ptest5
-rw-r--r--meta/recipes-core/udev/udev/run.rules14
-rw-r--r--meta/recipes-core/udev/udev/udev-cache38
-rw-r--r--meta/recipes-core/udev/udev/udev-cache.default5
-rw-r--r--meta/recipes-core/udev/udev/udev.rules116
-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/util-linux/util-linux.inc276
-rw-r--r--meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch176
-rw-r--r--meta/recipes-core/util-linux/util-linux/MCONFIG223
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch18
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_unsupported_find_opts.patch38
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch57
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch20
-rw-r--r--meta/recipes-core/util-linux/util-linux/configure-sbindir.patch23
-rw-r--r--meta/recipes-core/util-linux/util-linux/defines.h10
-rw-r--r--meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch17
-rw-r--r--meta/recipes-core/util-linux/util-linux/fix-configure.patch20
-rw-r--r--meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch35
-rw-r--r--meta/recipes-core/util-linux/util-linux/make_include17
-rw-r--r--meta/recipes-core/util-linux/util-linux/ptest.patch16
-rw-r--r--meta/recipes-core/util-linux/util-linux/run-ptest10
-rw-r--r--meta/recipes-core/util-linux/util-linux/swapargs.h3
-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-ensure-the-existence-of-directory-for-PAT.patch34
-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.patch73
-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.patch27
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.24.2.bb36
-rw-r--r--meta/recipes-core/volatile-binds/files/COPYING.MIT17
-rwxr-xr-xmeta/recipes-core/volatile-binds/files/mount-copybind34
-rw-r--r--meta/recipes-core/volatile-binds/files/volatile-binds.service.in19
-rw-r--r--meta/recipes-core/volatile-binds/volatile-binds.bb69
-rw-r--r--meta/recipes-core/zlib/site_config/headers1
-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/ldflags-tests.patch45
-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_1.2.8.bb61
486 files changed, 64612 insertions, 0 deletions
diff --git a/meta/recipes-core/base-files/base-files/filesystems b/meta/recipes-core/base-files/base-files/filesystems
new file mode 100644
index 0000000000..7e6c41c38f
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/filesystems
@@ -0,0 +1,8 @@
1ext4
2ext3
3ext2
4vfat
5fat
6btrfs
7minix
8*
diff --git a/meta/recipes-core/base-files/base-files/fstab b/meta/recipes-core/base-files/base-files/fstab
new file mode 100644
index 0000000000..739b844bfc
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/fstab
@@ -0,0 +1,12 @@
1# stock fstab - you probably want to override this with a machine specific one
2
3/dev/root / auto defaults 1 1
4proc /proc proc defaults 0 0
5devpts /dev/pts devpts mode=0620,gid=5 0 0
6usbdevfs /proc/bus/usb usbdevfs noauto 0 0
7tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
8tmpfs /var/volatile tmpfs defaults 0 0
9
10# uncomment this if your device has a SD/MMC/Transflash slot
11#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
12
diff --git a/meta/recipes-core/base-files/base-files/host.conf b/meta/recipes-core/base-files/base-files/host.conf
new file mode 100644
index 0000000000..1a8c1e1517
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/host.conf
@@ -0,0 +1,2 @@
1order hosts,bind
2multi on
diff --git a/meta/recipes-core/base-files/base-files/inputrc b/meta/recipes-core/base-files/base-files/inputrc
new file mode 100644
index 0000000000..b5c4c8af24
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/inputrc
@@ -0,0 +1,61 @@
1# /etc/inputrc - global inputrc for libreadline
2# See readline(3readline) and `info rluserman' for more information.
3
4# Be 8 bit clean.
5set input-meta on
6set output-meta on
7
8# To allow the use of 8bit-characters like the german umlauts, comment out
9# the line below. However this makes the meta key not work as a meta key,
10# which is annoying to those which don't need to type in 8-bit characters.
11
12# set convert-meta off
13
14# try to enable the application keypad when it is called. Some systems
15# need this to enable the arrow keys.
16# set enable-keypad on
17
18# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
19
20# do not bell on tab-completion
21# set bell-style none
22
23# some defaults / modifications for the emacs mode
24$if mode=emacs
25
26# allow the use of the Home/End keys
27# "\e[1~": beginning-of-line
28# "\e[4~": end-of-line
29
30# allow the use of the Delete/Insert keys
31# "\e[3~": delete-char
32# "\e[2~": quoted-insert
33
34# mappings for "page up" and "page down" to step to the beginning/end
35# of the history
36# "\e[5~": beginning-of-history
37# "\e[6~": end-of-history
38
39# alternate mappings for "page up" and "page down" to search the history
40# "\e[5~": history-search-backward
41# "\e[6~": history-search-forward
42
43# # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
44# "\e[5C": forward-word
45# "\e[5D": backward-word
46# "\e\e[C": forward-word
47# "\e\e[D": backward-word
48
49# $if term=rxvt
50# "\e[8~": end-of-line
51# $endif
52
53# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
54# "\eOH": beginning-of-line
55# "\eOF": end-of-line
56
57# for freebsd console
58# "\e[H": beginning-of-line
59# "\e[F": end-of-line
60
61$endif
diff --git a/meta/recipes-core/base-files/base-files/issue b/meta/recipes-core/base-files/base-files/issue
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/issue
diff --git a/meta/recipes-core/base-files/base-files/issue.net b/meta/recipes-core/base-files/base-files/issue.net
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/issue.net
diff --git a/meta/recipes-core/base-files/base-files/licenses/GPL-2 b/meta/recipes-core/base-files/base-files/licenses/GPL-2
new file mode 100644
index 0000000000..d60c31a97a
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/licenses/GPL-2
@@ -0,0 +1,340 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
281
282 How to Apply These Terms to Your New Programs
283
284 If you develop a new program, and you want it to be of the greatest
285possible use to the public, the best way to achieve this is to make it
286free software which everyone can redistribute and change under these terms.
287
288 To do so, attach the following notices to the program. It is safest
289to attach them to the start of each source file to most effectively
290convey the exclusion of warranty; and each file should have at least
291the "copyright" line and a pointer to where the full notice is found.
292
293 <one line to give the program's name and a brief idea of what it does.>
294 Copyright (C) <year> <name of author>
295
296 This program is free software; you can redistribute it and/or modify
297 it under the terms of the GNU General Public License as published by
298 the Free Software Foundation; either version 2 of the License, or
299 (at your option) any later version.
300
301 This program is distributed in the hope that it will be useful,
302 but WITHOUT ANY WARRANTY; without even the implied warranty of
303 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 GNU General Public License for more details.
305
306 You should have received a copy of the GNU General Public License
307 along with this program; if not, write to the Free Software
308 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
310
311Also add information on how to contact you by electronic and paper mail.
312
313If the program is interactive, make it output a short notice like this
314when it starts in an interactive mode:
315
316 Gnomovision version 69, Copyright (C) year name of author
317 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318 This is free software, and you are welcome to redistribute it
319 under certain conditions; type `show c' for details.
320
321The hypothetical commands `show w' and `show c' should show the appropriate
322parts of the General Public License. Of course, the commands you use may
323be called something other than `show w' and `show c'; they could even be
324mouse-clicks or menu items--whatever suits your program.
325
326You should also get your employer (if you work as a programmer) or your
327school, if any, to sign a "copyright disclaimer" for the program, if
328necessary. Here is a sample; alter the names:
329
330 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331 `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
333 <signature of Ty Coon>, 1 April 1989
334 Ty Coon, President of Vice
335
336This General Public License does not permit incorporating your program into
337proprietary programs. If your program is a subroutine library, you may
338consider it more useful to permit linking proprietary applications with the
339library. If this is what you want to do, use the GNU Library General
340Public License instead of this License.
diff --git a/meta/recipes-core/base-files/base-files/motd b/meta/recipes-core/base-files/base-files/motd
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/motd
diff --git a/meta/recipes-core/base-files/base-files/nsswitch.conf b/meta/recipes-core/base-files/base-files/nsswitch.conf
new file mode 100644
index 0000000000..06f03d22a6
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/nsswitch.conf
@@ -0,0 +1,19 @@
1# /etc/nsswitch.conf
2#
3# Example configuration of GNU Name Service Switch functionality.
4# If you have the `glibc-doc' and `info' packages installed, try:
5# `info libc "Name Service Switch"' for information about this file.
6
7passwd: compat
8group: compat
9shadow: compat
10
11hosts: files dns
12networks: files
13
14protocols: db files
15services: db files
16ethers: db files
17rpc: db files
18
19netgroup: nis
diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile
new file mode 100644
index 0000000000..88ab8d877b
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/profile
@@ -0,0 +1,36 @@
1# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
2# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
3
4PATH="/usr/local/bin:/usr/bin:/bin"
5EDITOR="/bin/vi" # needed for packages like cron
6test -z "$TERM" && TERM="vt100" # Basic terminal capab. For screen etc.
7
8if [ ! -e /etc/localtime -a ! -e /etc/TZ ]; then
9 TZ="UTC" # Time Zone. Look at http://theory.uwinnipeg.ca/gnu/glibc/libc_303.html
10 # for an explanation of how to set this to your local timezone.
11 export TZ
12fi
13
14if [ "$HOME" = "ROOTHOME" ]; then
15 PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
16fi
17if [ "$PS1" ]; then
18# works for bash and ash (no other shells known to be in use here)
19 PS1='\u@\h:\w\$ '
20fi
21
22if [ -d /etc/profile.d ]; then
23 for i in /etc/profile.d/* ; do
24 . $i
25 done
26 unset i
27fi
28
29if [ -x /usr/bin/resize ];then
30 /usr/bin/resize >/dev/null
31fi
32
33export PATH PS1 OPIEDIR QPEDIR QTDIR EDITOR TERM
34
35umask 022
36
diff --git a/meta/recipes-core/base-files/base-files/rotation b/meta/recipes-core/base-files/base-files/rotation
new file mode 100644
index 0000000000..c227083464
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/rotation
@@ -0,0 +1 @@
0 \ No newline at end of file
diff --git a/meta/recipes-core/base-files/base-files/share/dot.bashrc b/meta/recipes-core/base-files/base-files/share/dot.bashrc
new file mode 100644
index 0000000000..4be63686c2
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/share/dot.bashrc
@@ -0,0 +1,16 @@
1# ~/.bashrc: executed by bash(1) for non-login shells.
2
3export PS1='\h:\w\$ '
4umask 022
5
6# You may uncomment the following lines if you want `ls' to be colorized:
7# export LS_OPTIONS='--color=auto'
8# eval `dircolors`
9# alias ls='ls $LS_OPTIONS'
10# alias ll='ls $LS_OPTIONS -l'
11# alias l='ls $LS_OPTIONS -lA'
12#
13# Some more alias to avoid making mistakes:
14# alias rm='rm -i'
15# alias cp='cp -i'
16# alias mv='mv -i'
diff --git a/meta/recipes-core/base-files/base-files/share/dot.profile b/meta/recipes-core/base-files/base-files/share/dot.profile
new file mode 100644
index 0000000000..979793e8b5
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/share/dot.profile
@@ -0,0 +1,10 @@
1# ~/.profile: executed by Bourne-compatible login shells.
2
3if [ -f ~/.bashrc ]; then
4 . ~/.bashrc
5fi
6
7# path set by /etc/profile
8# export PATH
9
10mesg n
diff --git a/meta/recipes-core/base-files/base-files/shells b/meta/recipes-core/base-files/base-files/shells
new file mode 100644
index 0000000000..3f639874d8
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/shells
@@ -0,0 +1,2 @@
1# /etc/shells: valid login shells
2/bin/sh
diff --git a/meta/recipes-core/base-files/base-files/usbd b/meta/recipes-core/base-files/base-files/usbd
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files/usbd
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
new file mode 100644
index 0000000000..9021103158
--- /dev/null
+++ b/meta/recipes-core/base-files/base-files_3.0.14.bb
@@ -0,0 +1,178 @@
1SUMMARY = "Miscellaneous files for the base system"
2DESCRIPTION = "The base-files package creates the basic system directory structure and provides a small set of key configuration files for the system."
3SECTION = "base"
4PR = "r89"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://licenses/GPL-2;md5=94d55d512a9ba36caa9b7df079bae19f"
7# Removed all license related tasks in this recipe as license.bbclass
8# now deals with this. In order to get accurate licensing on to the image:
9# Set COPY_LIC_MANIFEST to just copy just the license.manifest to the image
10# For the manifest and the license text for each package:
11# Set COPY_LIC_MANIFEST and COPY_LIC_DIRS
12
13SRC_URI = "file://rotation \
14 file://nsswitch.conf \
15 file://motd \
16 file://inputrc \
17 file://host.conf \
18 file://profile \
19 file://shells \
20 file://fstab \
21 file://filesystems \
22 file://issue.net \
23 file://issue \
24 file://usbd \
25 file://share/dot.bashrc \
26 file://share/dot.profile \
27 file://licenses/GPL-2 \
28 "
29S = "${WORKDIR}"
30
31INHIBIT_DEFAULT_DEPS = "1"
32
33docdir_append = "/${P}"
34dirs1777 = "/tmp ${localstatedir}/volatile/tmp"
35dirs2775 = ""
36dirs755 = "/bin /boot /dev ${sysconfdir} ${sysconfdir}/default \
37 ${sysconfdir}/skel /lib /mnt /proc ${ROOT_HOME} /run /sbin \
38 ${prefix} ${bindir} ${docdir} /usr/games ${includedir} \
39 ${libdir} ${sbindir} ${datadir} \
40 ${datadir}/common-licenses ${datadir}/dict ${infodir} \
41 ${mandir} ${datadir}/misc ${localstatedir} \
42 ${localstatedir}/backups ${localstatedir}/lib \
43 /sys ${localstatedir}/lib/misc ${localstatedir}/spool \
44 ${localstatedir}/volatile \
45 ${localstatedir}/volatile/log \
46 /home ${prefix}/src ${localstatedir}/local \
47 /media"
48
49dirs755-lsb = "/srv \
50 ${prefix}/local ${prefix}/local/bin ${prefix}/local/games \
51 ${prefix}/local/include ${prefix}/local/lib ${prefix}/local/sbin \
52 ${prefix}/local/share ${prefix}/local/src \
53 ${prefix}/lib/locale"
54dirs2775-lsb = "/var/mail"
55
56volatiles = "log tmp"
57conffiles = "${sysconfdir}/debian_version ${sysconfdir}/host.conf \
58 ${sysconfdir}/inputrc ${sysconfdir}/issue /${sysconfdir}/issue.net \
59 ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile \
60 ${sysconfdir}/default"
61
62#
63# set standard hostname, might be a candidate for a DISTRO variable? :M:
64#
65hostname = "openembedded"
66
67BASEFILESISSUEINSTALL ?= "do_install_basefilesissue"
68
69# In previous versions of base-files, /run was a softlink to /var/run and the
70# directory was located in /var/volatlie/run. Also, /var/lock was a softlink
71# to /var/volatile/lock which is where the real directory was located. Now,
72# /run and /run/lock are the real directories. If we are upgrading, we may
73# need to remove the symbolic links first before we create the directories.
74# Otherwise the directory creation will fail and we will have circular symbolic
75# links.
76#
77pkg_preinst_${PN} () {
78 #!/bin/sh -e
79 if [ x"$D" = "x" ]; then
80 if [ -h "/var/lock" ]; then
81 # Remove the symbolic link
82 rm -f /var/lock
83 fi
84
85 if [ -h "/run" ]; then
86 # Remove the symbolic link
87 rm -f /run
88 fi
89 fi
90}
91
92do_install () {
93 for d in ${dirs755}; do
94 install -m 0755 -d ${D}$d
95 done
96 for d in ${dirs1777}; do
97 install -m 1777 -d ${D}$d
98 done
99 for d in ${dirs2775}; do
100 install -m 2775 -d ${D}$d
101 done
102 for d in ${volatiles}; do
103 ln -sf volatile/$d ${D}${localstatedir}/$d
104 done
105
106 ln -snf ../run ${D}${localstatedir}/run
107 ln -snf ../run/lock ${D}${localstatedir}/lock
108
109 ${BASEFILESISSUEINSTALL}
110
111 rotation=`cat ${WORKDIR}/rotation`
112 if [ "$rotation" != "0" ]; then
113 install -m 0644 ${WORKDIR}/rotation ${D}${sysconfdir}/rotation
114 fi
115
116 install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
117 install -m 0644 ${WORKDIR}/filesystems ${D}${sysconfdir}/filesystems
118 install -m 0644 ${WORKDIR}/usbd ${D}${sysconfdir}/default/usbd
119 install -m 0644 ${WORKDIR}/profile ${D}${sysconfdir}/profile
120 sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}${sysconfdir}/profile
121 install -m 0644 ${WORKDIR}/shells ${D}${sysconfdir}/shells
122 install -m 0755 ${WORKDIR}/share/dot.profile ${D}${sysconfdir}/skel/.profile
123 install -m 0755 ${WORKDIR}/share/dot.bashrc ${D}${sysconfdir}/skel/.bashrc
124 install -m 0644 ${WORKDIR}/inputrc ${D}${sysconfdir}/inputrc
125 install -m 0644 ${WORKDIR}/nsswitch.conf ${D}${sysconfdir}/nsswitch.conf
126 install -m 0644 ${WORKDIR}/host.conf ${D}${sysconfdir}/host.conf
127 install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd
128
129 if [ "/usr/bin" != "${bindir}" ]; then
130 sed -i "s,/usr/bin/resize,${bindir}/resize," ${D}${sysconfdir}/profile
131 fi
132
133 ln -sf /proc/mounts ${D}${sysconfdir}/mtab
134}
135
136DISTRO_VERSION[vardepsexclude] += "DATE"
137do_install_basefilesissue () {
138 if [ "${hostname}" != "" ]; then
139 if [ -n "${MACHINE}" -a "${hostname}" = "openembedded" ]; then
140 echo ${MACHINE} > ${D}${sysconfdir}/hostname
141 else
142 echo ${hostname} > ${D}${sysconfdir}/hostname
143 fi
144 fi
145
146 install -m 644 ${WORKDIR}/issue* ${D}${sysconfdir}
147 if [ -n "${DISTRO_NAME}" ]; then
148 printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue
149 printf "${DISTRO_NAME} " >> ${D}${sysconfdir}/issue.net
150 if [ -n "${DISTRO_VERSION}" ]; then
151 printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue
152 printf "${DISTRO_VERSION} " >> ${D}${sysconfdir}/issue.net
153 fi
154 printf "\\\n \\\l\n" >> ${D}${sysconfdir}/issue
155 echo >> ${D}${sysconfdir}/issue
156 echo "%h" >> ${D}${sysconfdir}/issue.net
157 echo >> ${D}${sysconfdir}/issue.net
158 fi
159}
160
161do_install_append_linuxstdbase() {
162 for d in ${dirs755-lsb}; do
163 install -m 0755 -d ${D}$d
164 done
165
166 for d in ${dirs2775-lsb}; do
167 install -m 2775 -d ${D}$d
168 done
169}
170
171PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
172FILES_${PN} = "/"
173FILES_${PN}-doc = "${docdir} ${datadir}/common-licenses"
174
175PACKAGE_ARCH = "${MACHINE_ARCH}"
176
177CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]} ${sysconfdir}/shells"
178
diff --git a/meta/recipes-core/base-passwd/base-passwd/add_shutdown.patch b/meta/recipes-core/base-passwd/base-passwd/add_shutdown.patch
new file mode 100644
index 0000000000..eb75559c49
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/add_shutdown.patch
@@ -0,0 +1,19 @@
1
2We need to have a shutdown group to allow the shutdown icon
3to work correctly. Any users that want to use shutdown like
4the xuser should be added to this group.
5
6Upstream-Status: Inapporpriate [Embedded]
7
8Signed-off-by: Saul Wold <sgw@linux.intel.com>
9Index: base-passwd-3.5.26/group.master
10===================================================================
11--- base-passwd-3.5.26.orig/group.master
12+++ base-passwd-3.5.26/group.master
13@@ -36,5 +36,6 @@ sasl:*:45:
14 plugdev:*:46:
15 staff:*:50:
16 games:*:60:
17+shutdown:*:70:
18 users:*:100:
19 nogroup:*:65534:
diff --git a/meta/recipes-core/base-passwd/base-passwd/disable-docs.patch b/meta/recipes-core/base-passwd/base-passwd/disable-docs.patch
new file mode 100644
index 0000000000..14c08b7484
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/disable-docs.patch
@@ -0,0 +1,24 @@
1Disable documentation for now as it uses tools currently not supported
2by OE-Core. It uses sgmltools and po4a.
3
4Upstream-Status: Inappropriate [OE-Core specific]
5Signed-off-by: Saul Wold <sgw@linux.intel.com>
6
7Index: base-passwd-3.5.28/Makefile.in
8===================================================================
9--- base-passwd-3.5.28.orig/Makefile.in
10+++ base-passwd-3.5.28/Makefile.in
11@@ -25,13 +25,10 @@ gen_configure = config.cache config.stat
12 confdefhs.h config.h Makefile
13
14 all: update-passwd
15- $(MAKE) -C doc all
16- $(MAKE) -C man all
17
18 install: all
19 mkdir -p $(DESTDIR)$(sbindir)
20 $(INSTALL) update-passwd $(DESTDIR)$(sbindir)/
21- $(MAKE) -C man install
22
23 update-passwd.o: version.h
24
diff --git a/meta/recipes-core/base-passwd/base-passwd/input.patch b/meta/recipes-core/base-passwd/base-passwd/input.patch
new file mode 100644
index 0000000000..f1bfc2f604
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/input.patch
@@ -0,0 +1,22 @@
1Add an input group for the /dev/input/* devices.
2
3Upstream-Status: Invalid [configuration]
4
5Signed-off-by: Darren Hart <dvhart@linux.intel.com>
6
7---
8 group.master | 1 +
9 1 file changed, 1 insertion(+)
10
11Index: base-passwd-3.5.26/group.master
12===================================================================
13--- base-passwd-3.5.26.orig/group.master
14+++ base-passwd-3.5.26/group.master
15@@ -12,6 +12,7 @@ uucp:*:10:
16 man:*:12:
17 proxy:*:13:
18 kmem:*:15:
19+input:*:19:
20 dialout:*:20:
21 fax:*:21:
22 voice:*:22:
diff --git a/meta/recipes-core/base-passwd/base-passwd/nobash.patch b/meta/recipes-core/base-passwd/base-passwd/nobash.patch
new file mode 100644
index 0000000000..eed87db6cb
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/nobash.patch
@@ -0,0 +1,15 @@
1use /bin/sh instead of /bin/bash, since the latter may not be included in
2some images such as minimal
3
4Upstream-Status: Invalid [configuration]
5
6Signed-off-by: Scott Garman <scott.a.garman@intel.com>
7
8--- base-passwd/passwd.master~nobash
9+++ base-passwd/passwd.master
10@@ -1,4 +1,4 @@
11-root:*:0:0:root:/root:/bin/bash
12+root:*:0:0:root:/root:/bin/sh
13 daemon:*:1:1:daemon:/usr/sbin:/bin/sh
14 bin:*:2:2:bin:/bin:/bin/sh
15 sys:*:3:3:sys:/dev:/bin/sh
diff --git a/meta/recipes-core/base-passwd/base-passwd/noshadow.patch b/meta/recipes-core/base-passwd/base-passwd/noshadow.patch
new file mode 100644
index 0000000000..e1cded61d6
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd/noshadow.patch
@@ -0,0 +1,14 @@
1remove "*" for root since we don't have a /etc/shadow so far.
2
3Upstream-Status: Invalid [configuration]
4
5Signed-off-by: Scott Garman <scott.a.garman@intel.com>
6
7--- base-passwd/passwd.master~nobash
8+++ base-passwd/passwd.master
9@@ -1,4 +1,4 @@
10-root:*:0:0:root:/root:/bin/sh
11+root::0:0:root:/root:/bin/sh
12 daemon:*:1:1:daemon:/usr/sbin:/bin/sh
13 bin:*:2:2:bin:/bin:/bin/sh
14 sys:*:3:3:sys:/dev:/bin/sh
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
new file mode 100644
index 0000000000..ec8f2afb22
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -0,0 +1,102 @@
1SUMMARY = "Base system master password/group files"
2DESCRIPTION = "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."
3SECTION = "base"
4LICENSE = "GPLv2+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
6
7SRC_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/base-passwd_${PV}.tar.gz \
8 file://add_shutdown.patch \
9 file://nobash.patch \
10 file://noshadow.patch \
11 file://input.patch \
12 file://disable-docs.patch \
13 "
14
15SRC_URI[md5sum] = "6beccac48083fe8ae5048acd062e5421"
16SRC_URI[sha256sum] = "f0b66388b2c8e49c15692439d2bee63bcdd4bbbf7a782c7f64accc55986b6a36"
17
18inherit autotools
19
20SSTATEPOSTINSTFUNCS += "base_passwd_sstate_postinst"
21
22do_install () {
23 install -d -m 755 ${D}${sbindir}
24 install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/
25 install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8
26 install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/
27 install -p -m 644 ${S}/man/update-passwd.pl.8 \
28 ${D}${mandir}/pl/man8/update-passwd.8
29 gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/*
30 install -d -m 755 ${D}${datadir}/base-passwd
31 install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/
32 sed -i 's#:/root:#:${ROOT_HOME}:#' ${D}${datadir}/base-passwd/passwd.master
33 install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/
34
35 install -d -m 755 ${D}${docdir}/${BPN}
36 install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPN}/
37 gzip -9 ${D}${docdir}/${BPN}/*
38 install -p -m 644 ${S}/README ${D}${docdir}/${BPN}/
39 install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
40}
41
42base_passwd_sstate_postinst() {
43 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
44 then
45 # Staging does not copy ${sysconfdir} files into the
46 # target sysroot, so we need to do so manually. We
47 # put these files in the target sysroot so they can
48 # be used by recipes which use custom user/group
49 # permissions.
50 # Install passwd.master and group.master to sysconfdir and mv
51 # them to make sure they are atomically install.
52 install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
53 for i in passwd group; do
54 install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \
55 ${STAGING_DIR_TARGET}${sysconfdir}/
56 mv ${STAGING_DIR_TARGET}${sysconfdir}/$i.master ${STAGING_DIR_TARGET}${sysconfdir}/$i
57 done
58 fi
59}
60
61python populate_packages_prepend() {
62 # Add in the preinst function for ${PN}
63 # We have to do this here as prior to this, passwd/group.master
64 # would be unavailable. We need to create these files at preinst
65 # time before the files from the package may be available, hence
66 # storing the data from the files in the preinst directly.
67
68 f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r')
69 passwd = "".join(f.readlines())
70 f.close()
71 f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r')
72 group = "".join(f.readlines())
73 f.close()
74
75 preinst = """#!/bin/sh
76mkdir -p $D${sysconfdir}
77if [ ! -e $D${sysconfdir}/passwd ]; then
78\tcat << EOF > $D${sysconfdir}/passwd
79""" + passwd + """EOF
80fi
81if [ ! -e $D${sysconfdir}/group ]; then
82\tcat << EOF > $D${sysconfdir}/group
83""" + group + """EOF
84fi
85"""
86 d.setVar('pkg_preinst_${PN}', preinst)
87}
88
89addtask do_package after do_populate_sysroot
90
91ALLOW_EMPTY_${PN} = "1"
92
93PACKAGES =+ "${PN}-update"
94FILES_${PN}-update = "${sbindir}/* ${datadir}/${PN}"
95
96pkg_postinst_${PN}-update () {
97#!/bin/sh
98if [ -n "$D" ]; then
99 exit 0
100fi
101${sbindir}/update-passwd
102}
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
new file mode 100644
index 0000000000..deb2ee4606
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -0,0 +1,412 @@
1SUMMARY = "Tiny versions of many common UNIX utilities in a single small executable"
2DESCRIPTION = "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."
3HOMEPAGE = "http://www.busybox.net"
4BUGTRACKER = "https://bugs.busybox.net/"
5
6DEPENDS += "kern-tools-native"
7
8# bzip2 applet in busybox is based on lightly-modified bzip2 source
9# the GPL is version 2 only
10LICENSE = "GPLv2 & bzip2"
11LIC_FILES_CHKSUM = "file://LICENSE;md5=de10de48642ab74318e893a61105afbb"
12
13SECTION = "base"
14
15# Whether to split the suid apps into a seperate binary
16BUSYBOX_SPLIT_SUID ?= "1"
17
18export EXTRA_CFLAGS = "${CFLAGS}"
19export EXTRA_LDFLAGS = "${LDFLAGS}"
20export EXTRA_OEMAKE += "'LD=${CCLD}'"
21
22PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}-hwclock"
23
24FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
25FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
26FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
27FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
28FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
29FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
30
31INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd ${PN}-mdev ${PN}-hwclock"
32
33INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
34INITSCRIPT_NAME_${PN}-hwclock = "hwclock.sh"
35INITSCRIPT_NAME_${PN}-mdev = "mdev"
36INITSCRIPT_PARAMS_${PN}-mdev = "start 03 S ."
37INITSCRIPT_NAME_${PN}-syslog = "syslog"
38INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
39
40SYSTEMD_PACKAGES = "${PN}-syslog"
41SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
42
43CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
44CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
45
46RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
47
48inherit cml1 systemd update-rc.d ptest
49
50# internal helper
51def busybox_cfg(feature, tokens, cnf, rem):
52 if type(tokens) == type(""):
53 tokens = [tokens]
54 rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
55 if feature:
56 cnf.extend([token + '=y' for token in tokens])
57 else:
58 cnf.extend(['# ' + token + ' is not set' for token in tokens])
59
60# Map distro features to config settings
61def features_to_busybox_settings(d):
62 cnf, rem = ([], [])
63 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IPV6', cnf, rem)
64 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_LFS', cnf, rem)
65 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'largefile', True, False, d), 'CONFIG_FDISK_SUPPORT_LARGE_DISKS', cnf, rem)
66 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'nls', True, False, d), 'CONFIG_LOCALE_SUPPORT', cnf, rem)
67 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV4', cnf, rem)
68 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d), 'CONFIG_FEATURE_IFUPDOWN_IPV6', cnf, rem)
69 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'wifi', True, False, d), 'CONFIG_RFKILL', cnf, rem)
70 busybox_cfg(bb.utils.contains('DISTRO_FEATURES', 'bluetooth', True, False, d), 'CONFIG_RFKILL', cnf, rem)
71 return "\n".join(cnf), "\n".join(rem)
72
73# X, Y = ${@features_to_uclibc_settings(d)}
74# unfortunately doesn't seem to work with bitbake, workaround:
75def features_to_busybox_conf(d):
76 cnf, rem = features_to_busybox_settings(d)
77 return cnf
78def features_to_busybox_del(d):
79 cnf, rem = features_to_busybox_settings(d)
80 return rem
81
82configmangle = '/CROSS_COMPILER_PREFIX/d; \
83 /CONFIG_EXTRA_CFLAGS/d; \
84 '
85OE_FEATURES := "${@features_to_busybox_conf(d)}"
86OE_DEL := "${@features_to_busybox_del(d)}"
87DO_IPv4 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv4', 1, 0, d)}"
88DO_IPv6 := "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 1, 0, d)}"
89
90python () {
91 if "${OE_DEL}":
92 d.setVar('configmangle_append', "${OE_DEL}" + "\n")
93 if "${OE_FEATURES}":
94 d.setVar('configmangle_append',
95 "/^### DISTRO FEATURES$/a\\\n%s\n\n" %
96 ("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
97 d.setVar('configmangle_append',
98 "/^### CROSS$/a\\\n%s\n" %
99 ("\\n".join(["CONFIG_CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
100 "CONFIG_EXTRA_CFLAGS=\"${CFLAGS}\" \"${HOST_CC_ARCH}\""
101 ])
102 ))
103}
104
105do_prepare_config () {
106 sed -e 's#@DATADIR@#${datadir}#g' \
107 < ${WORKDIR}/defconfig > ${S}/.config
108 sed -i -e '/CONFIG_STATIC/d' .config
109 echo "# CONFIG_STATIC is not set" >> .config
110 for i in 'CROSS' 'DISTRO FEATURES'; do echo "### $i"; done >> \
111 ${S}/.config
112 sed -i -e '${configmangle}' ${S}/.config
113 if test ${DO_IPv4} -eq 0 && test ${DO_IPv6} -eq 0; then
114 # disable networking applets
115 mv ${S}/.config ${S}/.config.oe-tmp
116 awk 'BEGIN{net=0}
117 /^# Networking Utilities/{net=1}
118 /^#$/{if(net){net=net+1}}
119 {if(net==2&&$0 !~ /^#/&&$1){print("# "$1" is not set")}else{print}}' \
120 ${S}/.config.oe-tmp > ${S}/.config
121 fi
122 sed -i 's/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"/CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -b"/' ${S}/.config
123}
124
125# returns all the elements from the src uri that are .cfg files
126def find_cfgs(d):
127 sources=src_patches(d, True)
128 sources_list=[]
129 for s in sources:
130 if s.endswith('.cfg'):
131 sources_list.append(s)
132
133 return sources_list
134
135do_configure () {
136 do_prepare_config
137 merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
138 cml1_do_configure
139}
140
141do_compile() {
142 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
143 if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
144 # split the .config into two parts, and make two busybox binaries
145 cp .config .config.orig
146 oe_runmake busybox.cfg.suid
147 oe_runmake busybox.cfg.nosuid
148 for i in `cat busybox.cfg.suid busybox.cfg.nosuid`; do
149 echo "# $i is not set" >> .config.disable.apps
150 done
151 merge_config.sh -m .config.orig .config.disable.apps
152 cp .config .config.nonapps
153 for s in suid nosuid; do
154 cat busybox.cfg.$s | while read item; do
155 grep -w "$item" .config.orig
156 done > .config.app.$s
157 merge_config.sh -m .config.nonapps .config.app.$s
158 oe_runmake busybox_unstripped
159 mv busybox_unstripped busybox.$s
160 oe_runmake busybox.links
161 mv busybox.links busybox.links.$s
162 done
163 # copy .config.orig back to .config, because the install process may check this file
164 cp .config.orig .config
165 # cleanup
166 rm .config.orig .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
167 else
168 oe_runmake busybox_unstripped
169 cp busybox_unstripped busybox
170 oe_runmake busybox.links
171 fi
172}
173
174do_install () {
175 if [ "${prefix}" != "/usr" ]; then
176 sed -i "s:^/usr/:${prefix}/:" busybox.links*
177 fi
178 if [ "${base_sbindir}" != "/sbin" ]; then
179 sed -i "s:^/sbin/:${base_sbindir}/:" busybox.links*
180 fi
181
182 install -d ${D}${sysconfdir}/init.d
183
184 if ! grep -q "CONFIG_FEATURE_INDIVIDUAL=y" ${B}/.config; then
185 # Install /bin/busybox, and the /bin/sh link so the postinst script
186 # can run. Let update-alternatives handle the rest.
187 install -d ${D}${base_bindir}
188 if [ "${BUSYBOX_SPLIT_SUID}" = "1" ]; then
189 install -m 4755 ${B}/busybox.suid ${D}${base_bindir}
190 install -m 0755 ${B}/busybox.nosuid ${D}${base_bindir}
191 install -m 0644 ${S}/busybox.links.suid ${D}${sysconfdir}
192 install -m 0644 ${S}/busybox.links.nosuid ${D}${sysconfdir}
193 if grep -q "CONFIG_FEATURE_SH_IS_ASH=y" ${B}/.config; then
194 ln -sf busybox.nosuid ${D}${base_bindir}/sh
195 fi
196 # Keep a default busybox for people who want to invoke busybox directly.
197 # This is also useful for the on device upgrade. Because we want
198 # to use the busybox command in postinst.
199 ln -sf busybox.nosuid ${D}${base_bindir}/busybox
200 else
201 if grep -q "CONFIG_FEATURE_SUID=y" ${B}/.config; then
202 install -m 4755 ${B}/busybox ${D}${base_bindir}
203 else
204 install -m 0755 ${B}/busybox ${D}${base_bindir}
205 fi
206 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
207 if grep -q "CONFIG_FEATURE_SH_IS_ASH=y" ${B}/.config; then
208 ln -sf busybox ${D}${base_bindir}/sh
209 fi
210 # We make this symlink here to eliminate the error when upgrading together
211 # with busybox-syslog. Without this symlink, the opkg may think of the
212 # busybox.nosuid as obsolete and remove it, resulting in dead links like
213 # /bin/sed -> /bin/busybox.nosuid. This will make upgrading busybox-syslog fail.
214 # This symlink will be safely deleted in postinst, thus no negative effect.
215 ln -sf busybox ${D}${base_bindir}/busybox.nosuid
216 fi
217 else
218 install -d ${D}${base_bindir} ${D}${base_sbindir}
219 install -d ${D}${libdir} ${D}${bindir} ${D}${sbindir}
220 cat busybox.links | while read FILE; do
221 NAME=`basename "$FILE"`
222 install -m 0755 "0_lib/$NAME" "${D}$FILE.${BPN}"
223 done
224 # add suid bit where needed
225 for i in `grep -E "APPLET.*BB_SUID_((MAYBE|REQUIRE))" include/applets.h | grep -v _BB_SUID_DROP | cut -f 3 -d '(' | cut -f 1 -d ','`; do
226 find ${D} -name $i.${BPN} -exec chmod a+s {} \;
227 done
228 install -m 0755 0_lib/libbusybox.so.${PV} ${D}${libdir}/libbusybox.so.${PV}
229 ln -sf sh.${BPN} ${D}${base_bindir}/sh
230 ln -sf ln.${BPN} ${D}${base_bindir}/ln
231 ln -sf test.${BPN} ${D}${bindir}/test
232 if [ -f ${D}/linuxrc.${BPN} ]; then
233 mv ${D}/linuxrc.${BPN} ${D}/linuxrc
234 fi
235 install -m 0644 ${S}/busybox.links ${D}${sysconfdir}
236 fi
237
238 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
239 install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${BPN}
240 install -m 644 ${WORKDIR}/syslog-startup.conf ${D}${sysconfdir}/syslog-startup.conf.${BPN}
241 install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/syslog.conf.${BPN}
242 fi
243 if grep "CONFIG_CROND=y" ${B}/.config; then
244 install -m 0755 ${WORKDIR}/busybox-cron ${D}${sysconfdir}/init.d/
245 fi
246 if grep "CONFIG_HTTPD=y" ${B}/.config; then
247 install -m 0755 ${WORKDIR}/busybox-httpd ${D}${sysconfdir}/init.d/
248 install -d ${D}/srv/www
249 fi
250 if grep "CONFIG_UDHCPD=y" ${B}/.config; then
251 install -m 0755 ${WORKDIR}/busybox-udhcpd ${D}${sysconfdir}/init.d/
252 fi
253 if grep "CONFIG_HWCLOCK=y" ${B}/.config; then
254 install -m 0755 ${WORKDIR}/hwclock.sh ${D}${sysconfdir}/init.d/
255 fi
256 if grep "CONFIG_UDHCPC=y" ${B}/.config; then
257 install -d ${D}${sysconfdir}/udhcpc.d
258 install -d ${D}${datadir}/udhcpc
259 install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
260 install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
261 fi
262 if grep "CONFIG_INETD=y" ${B}/.config; then
263 install -m 0755 ${WORKDIR}/inetd ${D}${sysconfdir}/init.d/inetd.${BPN}
264 sed -i "s:/usr/sbin/:${sbindir}/:" ${D}${sysconfdir}/init.d/inetd.${BPN}
265 install -m 0644 ${WORKDIR}/inetd.conf ${D}${sysconfdir}/
266 fi
267 if grep "CONFIG_MDEV=y" ${B}/.config; then
268 install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
269 if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
270 install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
271 install -d ${D}${sysconfdir}/mdev
272 install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
273 fi
274 fi
275
276 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
277 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
278 install -d ${D}${systemd_unitdir}/system
279 sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-syslog.service.in \
280 > ${D}${systemd_unitdir}/system/busybox-syslog.service
281 if [ -f ${WORKDIR}/busybox-syslog.default ] ; then
282 install -d ${D}${sysconfdir}/default
283 install -m 0644 ${WORKDIR}/busybox-syslog.default ${D}${sysconfdir}/default/busybox-syslog
284 fi
285 ln -sf /dev/null ${D}${systemd_unitdir}/system/syslog.service
286 fi
287 if grep -q "CONFIG_KLOGD=y" ${B}/.config; then
288 install -d ${D}${systemd_unitdir}/system
289 sed 's,@base_sbindir@,${base_sbindir},g' < ${WORKDIR}/busybox-klogd.service.in \
290 > ${D}${systemd_unitdir}/system/busybox-klogd.service
291 fi
292 fi
293
294 # Remove the sysvinit specific configuration file for systemd systems to avoid confusion
295 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
296 rm -f ${D}${sysconfdir}/syslog-startup.conf.${BPN}
297 fi
298}
299
300inherit update-alternatives
301
302ALTERNATIVE_PRIORITY = "50"
303
304ALTERNATIVE_${PN}-syslog += "syslog-conf"
305ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
306
307python () {
308 if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
309 pn = d.getVar('PN', True)
310 d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-init')
311 d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (d.getVar('sysconfdir', True)))
312 d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
313 d.appendVar('ALTERNATIVE_%s-syslog' % (pn), ' syslog-startup-conf')
314 d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-startup-conf', '%s/syslog-startup.conf' % (d.getVar('sysconfdir', True)))
315 d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-startup-conf', '%s/syslog-startup.conf.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
316}
317
318python do_package_prepend () {
319 # We need to load the full set of busybox provides from the /etc/busybox.links
320 # Use this to see the update-alternatives with the right information
321
322 dvar = d.getVar('D', True)
323 pn = d.getVar('PN', True)
324 def set_alternative_vars(links, target):
325 f = open('%s%s' % (dvar, links), 'r')
326 for alt_link_name in f:
327 alt_link_name = alt_link_name.strip()
328 alt_name = os.path.basename(alt_link_name)
329 # Match coreutils
330 if alt_name == '[':
331 alt_name = 'lbracket'
332 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
333 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
334 if os.path.exists('%s%s' % (dvar, target)):
335 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, target)
336 f.close()
337 return
338
339 if os.path.exists('%s/etc/busybox.links' % (dvar)):
340 set_alternative_vars("/etc/busybox.links", "/bin/busybox")
341 else:
342 set_alternative_vars("/etc/busybox.links.nosuid", "/bin/busybox.nosuid")
343 set_alternative_vars("/etc/busybox.links.suid", "/bin/busybox.suid")
344}
345
346pkg_postinst_${PN} () {
347 # This part of code is dedicated to the on target upgrade problem.
348 # It's known that if we don't make appropriate symlinks before update-alternatives calls,
349 # there will be errors indicating missing commands such as 'sed'.
350 # These symlinks will later be updated by update-alternatives calls.
351 test -n 2 > /dev/null || alias test='busybox test'
352 if test "x$D" = "x"; then
353 # Remove busybox.nosuid if it's a symlink, because this situation indicates
354 # that we're installing or upgrading to a one-binary busybox.
355 if test -h /bin/busybox.nosuid; then
356 rm -f /bin/busybox.nosuid
357 fi
358 for suffix in "" ".nosuid" ".suid"; do
359 if test -e /etc/busybox.links$suffix; then
360 while read link; do
361 if test ! -e "$link"; then
362 case "$link" in
363 /*/*/*)
364 to="../../bin/busybox$suffix"
365 ;;
366 /bin/*)
367 to="busybox$suffix"
368 ;;
369 /*/*)
370 to="../bin/busybox$suffix"
371 ;;
372 esac
373 # we can use busybox here because even if we are using splitted busybox
374 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
375 busybox rm -f $link
376 busybox ln -s $to $link
377 fi
378 done < /etc/busybox.links$suffix
379 fi
380 done
381 fi
382}
383
384pkg_prerm_${PN} () {
385 # This is so you can make busybox commit suicide - removing busybox with no other packages
386 # providing its files, this will make update-alternatives work, but the update-rc.d part
387 # for syslog, httpd and/or udhcpd will fail if there is no other package providing sh
388 tmpdir=`mktemp -d /tmp/busyboxrm-XXXXXX`
389 ln -s /bin/busybox $tmpdir/[
390 ln -s /bin/busybox $tmpdir/test
391 ln -s /bin/busybox $tmpdir/head
392 ln -s /bin/busybox $tmpdir/sh
393 ln -s /bin/busybox $tmpdir/basename
394 ln -s /bin/busybox $tmpdir/echo
395 ln -s /bin/busybox $tmpdir/mv
396 ln -s /bin/busybox $tmpdir/ln
397 ln -s /bin/busybox $tmpdir/dirname
398 ln -s /bin/busybox $tmpdir/rm
399 ln -s /bin/busybox $tmpdir/sed
400 ln -s /bin/busybox $tmpdir/sort
401 ln -s /bin/busybox $tmpdir/grep
402 export PATH=$PATH:$tmpdir
403}
404
405pkg_prerm_${PN}-syslog () {
406 # remove syslog
407 if test "x$D" = "x"; then
408 if test "$1" = "upgrade" -o "$1" = "remove"; then
409 /etc/init.d/syslog stop
410 fi
411 fi
412}
diff --git a/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch b/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch
new file mode 100644
index 0000000000..3da38bb4ca
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch
@@ -0,0 +1,40 @@
1From 28389e59701c2408e87e886c358f8e1766c677f7 Mon Sep 17 00:00:00 2001
2From: Drew Moseley <drew_moseley@mentor.com>
3Date: Sat, 29 Mar 2014 11:13:16 -0400
4Subject: [PATCH] build system: Specify '-nostldlib' when linking to .o files.
5
6For certain cross build scenarios the LD variable is overridden
7to use the gcc executive to ensure all the target tuning parameters
8are used. In these cases, the executive errors out as shown below
9but since this step is only linking to a .o file the standard libs
10are not needed.
11
12 $ make LD=gcc applets/built-in.o
13 LD applets/built-in.o
14 /usr/bin/ld: cannot find -lgcc_s
15 /usr/bin/ld: cannot find -lgcc_s
16 collect2: ld returned 1 exit status
17 make[1]: *** [applets/built-in.o] Error 1
18 make: *** [applets_dir] Error 2
19
20Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
21---
22 scripts/Makefile.build | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/scripts/Makefile.build b/scripts/Makefile.build
26index 5685b5b..eba69f6 100644
27--- a/scripts/Makefile.build
28+++ b/scripts/Makefile.build
29@@ -256,7 +256,7 @@ ifdef builtin-target
30 quiet_cmd_link_o_target = LD $@
31 # If the list of objects to link is empty, just create an empty built-in.o
32 cmd_link_o_target = $(if $(strip $(obj-y)),\
33- $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
34+ $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\
35 rm -f $@; $(AR) rcs $@)
36
37 $(builtin-target): $(obj-y) FORCE
38--
391.7.9.5
40
diff --git a/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch b/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch
new file mode 100644
index 0000000000..4e76067b3c
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/CVE-2014-9645_busybox_reject_module_names_with_slashes.patch
@@ -0,0 +1,41 @@
1Upstream-status: Backport
2http://git.busybox.net/busybox/commit/?id=4e314faa0aecb66717418e9a47a4451aec59262b
3
4CVE-2014-9645 fix.
5
6[YOCTO #7257]
7
8Signed-off-by: Armin Kuster <akuster@mvista.com>
9
10From 4e314faa0aecb66717418e9a47a4451aec59262b Mon Sep 17 00:00:00 2001
11From: Denys Vlasenko <vda.linux@googlemail.com>
12Date: Thu, 20 Nov 2014 17:24:33 +0000
13Subject: modprobe,rmmod: reject module names with slashes
14
15function old new delta
16add_probe 86 113 +27
17
18Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
19---
20Index: busybox-1.22.1/modutils/modprobe.c
21===================================================================
22--- busybox-1.22.1.orig/modutils/modprobe.c
23+++ busybox-1.22.1/modutils/modprobe.c
24@@ -238,6 +238,17 @@ static void add_probe(const char *name)
25 {
26 struct module_entry *m;
27
28+ /*
29+ * get_or_add_modentry() strips path from name and works
30+ * on remaining basename.
31+ * This would make "rmmod dir/name" and "modprobe dir/name"
32+ * to work like "rmmod name" and "modprobe name",
33+ * which is wrong, and can be abused via implicit modprobing:
34+ * "ifconfig /usbserial up" tries to modprobe netdev-/usbserial.
35+ */
36+ if (strchr(name, '/'))
37+ bb_error_msg_and_die("malformed module name '%s'", name);
38+
39 m = get_or_add_modentry(name);
40 if (!(option_mask32 & (OPT_REMOVE | OPT_SHOW_DEPS))
41 && (m->flags & MODULE_FLAG_LOADED)
diff --git a/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch b/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch
new file mode 100644
index 0000000000..de2dbcceb1
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/busybox-appletlib-dependency.patch
@@ -0,0 +1,37 @@
1Upstream-Status: Pending
2
3# copy commit message from OE as the patch comment:
4# commit 98c24291aa165f53423c27ae033831ce0b3bb676
5# Author: Roman I Khimov <khimov@altell.ru>
6# Date: Thu Mar 26 23:03:58 2009 +0000
7#
8# busybox: update appletlib dependency patch
9#
10# Previous version still failed from time to time on clean-start builds
11# with 4 bitbake threads and '-j16'. Building busybox as sole target worked
12# well.
13#
14# The reason is that previous version introduced a race between applets make
15# processes spawned from top-level Makefile and from libbb Makefile.
16#
17# Fix it with high-level dependency that doesn't create races.
18#
19# Signed-off-by: Koen Kooi <koen@openembedded.org>
20#
21# above comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-06
22
23Index: busybox-1.13.2/Makefile
24===================================================================
25--- busybox-1.13.2.orig/Makefile 2009-03-19 15:44:37.419270265 +0300
26+++ busybox-1.13.2/Makefile 2009-03-19 15:45:57.737521296 +0300
27@@ -471,6 +471,10 @@
28 util-linux/ \
29 util-linux/volume_id/ \
30
31+# Lib interdeps
32+# libbb uses headers generated in applets
33+libbb: applets
34+
35 endif # KBUILD_EXTMOD
36
37 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
new file mode 100644
index 0000000000..fc7b778be1
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/busybox-cross-menuconfig.patch
@@ -0,0 +1,71 @@
1From: Jason Wessel <jason.wessel@windriver.com>
2Date: Sun, 3 Mar 2013 12:31:40 -0600
3Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location
4
5Upstream-status: Submitted
6
7[ based on: https://lkml.org/lkml/2013/3/3/103 ]
8
9This patch syncs up with the way the menuconfig ncurses / curses
10is detected and the HOST_EXTRACFLAGS works in the Linux kernel
11and it allows the menuconfig to work with a sysroot version
12of the curses libraries.
13
14---
15
16In some cross build environments such as the Yocto Project build
17environment it provides an ncurses library that is compiled
18differently than the host's version. This causes display corruption
19problems when the host's curses includes are used instead of the
20includes from the provided compiler are overridden. There is a second
21case where there is no curses libraries at all on the host system and
22menuconfig will just fail entirely.
23
24The solution is simply to allow an override variable in
25check-lxdialog.sh for environments such as the Yocto Project. Adding
26a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
27compiling and linking against the right headers and libraries.
28
29Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
30cc: Michal Marek <mmarek@suse.cz>
31cc: linux-kbuild@vger.kernel.org
32---
33 scripts/kconfig/lxdialog/Makefile | 2 +-
34 scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++
35 2 files changed, 9 insertions(+), 1 deletion(-)
36
37--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
38+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
39@@ -4,6 +4,10 @@
40 # What library to link
41 ldflags()
42 {
43+ if [ x"$CROSS_CURSES_LIB" != x ]; then
44+ echo "$CROSS_CURSES_LIB"
45+ exit
46+ fi
47 for ext in so a dylib ; do
48 for lib in ncursesw ncurses curses ; do
49 $cc -print-file-name=lib${lib}.${ext} | grep -q /
50@@ -19,6 +23,10 @@ ldflags()
51 # Where is ncurses.h?
52 ccflags()
53 {
54+ if [ x"$CROSS_CURSES_INC" != x ]; then
55+ echo "$CROSS_CURSES_INC"
56+ exit
57+ fi
58 if [ -f /usr/include/ncursesw/ncurses.h ]; then
59 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"'
60 elif [ -f /usr/include/ncursesw/curses.h ]; then
61--- a/scripts/kconfig/lxdialog/Makefile
62+++ b/scripts/kconfig/lxdialog/Makefile
63@@ -5,7 +5,7 @@ check-lxdialog := $(srctree)/$(src)/che
64
65 # Use reursively expanded variables so we do not call gcc unless
66 # we really need to do so. (Do not call gcc as part of make mrproper)
67-HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
68+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
69 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
70
71 HOST_EXTRACFLAGS += -DLOCALE
diff --git a/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch b/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch
new file mode 100644
index 0000000000..4c9ce3b711
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/busybox-udhcpc-no_deconfig.patch
@@ -0,0 +1,137 @@
1From 53626cd06a3ef05ed847daea802ef0aa9661caa7 Mon Sep 17 00:00:00 2001
2From: Anders Darander <anders@chargestorm.se>
3Date: Thu, 3 Nov 2011 08:51:31 +0100
4Subject: [PATCH] busybox-udhcpc-no_deconfig.patch
5
6Upstream-Status: Pending
7
8Add a new option -D to the udhcpc client that allows for
9dhcp renewal to occur without having to down the interface
10in the process.
11
12Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com>
13
14Updated to latest Busybox 1.17.3
15
16Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
17
18Updated to Busybox 1.18.4
19option spec is changed
20
21Signed-off-by: Qing He <qing.he@intel.com>
22
23Updated to Busybox 1.19.3
24
25Signed-off-by: Anders Darander <anders@chargestorm.se>
26
27Fixed options -b, -a and -P.
28
29Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
30---
31 networking/udhcp/dhcpc.c | 29 +++++++++++++++++++++--------
32 1 files changed, 21 insertions(+), 8 deletions(-)
33
34Index: busybox-1.20.2/networking/udhcp/dhcpc.c
35===================================================================
36--- busybox-1.20.2.orig/networking/udhcp/dhcpc.c
37+++ busybox-1.20.2/networking/udhcp/dhcpc.c
38@@ -29,6 +29,9 @@
39 #include <netpacket/packet.h>
40 #include <linux/filter.h>
41
42+/* option whether to down the interface when reconfiguring */
43+static int allow_deconfig = 1;
44+
45 /* "struct client_config_t client_config" is in bb_common_bufsiz1 */
46
47
48@@ -81,8 +84,9 @@ enum {
49 OPT_x = 1 << 18,
50 OPT_f = 1 << 19,
51 OPT_B = 1 << 20,
52+ OPT_D = 1 << 21,
53 /* The rest has variable bit positions, need to be clever */
54- OPTBIT_B = 20,
55+ OPTBIT_D = 21,
56 USE_FOR_MMU( OPTBIT_b,)
57 IF_FEATURE_UDHCPC_ARPING(OPTBIT_a,)
58 IF_FEATURE_UDHCP_PORT( OPTBIT_P,)
59@@ -1040,7 +1044,8 @@ static void perform_renew(void)
60 state = RENEW_REQUESTED;
61 break;
62 case RENEW_REQUESTED: /* impatient are we? fine, square 1 */
63- udhcp_run_script(NULL, "deconfig");
64+ if (allow_deconfig)
65+ udhcp_run_script(NULL, "deconfig");
66 case REQUESTING:
67 case RELEASED:
68 change_listen_mode(LISTEN_RAW);
69@@ -1064,7 +1069,8 @@ static void perform_release(uint32_t ser
70 bb_info_msg("Unicasting a release of %s to %s",
71 inet_ntoa(temp_addr), buffer);
72 send_release(server_addr, requested_ip); /* unicast */
73- udhcp_run_script(NULL, "deconfig");
74+ if (allow_deconfig)
75+ udhcp_run_script(NULL, "deconfig");
76 }
77 bb_info_msg("Entering released state");
78
79@@ -1215,7 +1221,7 @@ int udhcpc_main(int argc UNUSED_PARAM, c
80 /* O,x: list; -T,-t,-A take numeric param */
81 opt_complementary = "O::x::T+:t+:A+" IF_UDHCP_VERBOSE(":vv") ;
82 IF_LONG_OPTS(applet_long_options = udhcpc_longopts;)
83- opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fB"
84+ opt = getopt32(argv, "CV:H:h:F:i:np:qRr:s:T:t:SA:O:ox:fBD"
85 USE_FOR_MMU("b")
86 IF_FEATURE_UDHCPC_ARPING("a")
87 IF_FEATURE_UDHCP_PORT("P:")
88@@ -1316,6 +1322,9 @@ int udhcpc_main(int argc UNUSED_PARAM, c
89 logmode |= LOGMODE_SYSLOG;
90 }
91
92+ if (opt & OPT_D)
93+ allow_deconfig = 0;
94+
95 /* Make sure fd 0,1,2 are open */
96 bb_sanitize_stdio();
97 /* Equivalent of doing a fflush after every \n */
98@@ -1330,7 +1339,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
99 srand(monotonic_us());
100
101 state = INIT_SELECTING;
102- udhcp_run_script(NULL, "deconfig");
103+ if (allow_deconfig)
104+ udhcp_run_script(NULL, "deconfig");
105 change_listen_mode(LISTEN_RAW);
106 packet_num = 0;
107 timeout = 0;
108@@ -1484,7 +1494,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
109 }
110 /* Timed out, enter init state */
111 bb_info_msg("Lease lost, entering init state");
112- udhcp_run_script(NULL, "deconfig");
113+ if (allow_deconfig)
114+ udhcp_run_script(NULL, "deconfig");
115 state = INIT_SELECTING;
116 client_config.first_secs = 0; /* make secs field count from 0 */
117 /*timeout = 0; - already is */
118@@ -1667,7 +1678,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
119 send_decline(/*xid,*/ server_addr, packet.yiaddr);
120
121 if (state != REQUESTING)
122- udhcp_run_script(NULL, "deconfig");
123+ if (allow_deconfig)
124+ udhcp_run_script(NULL, "deconfig");
125 change_listen_mode(LISTEN_RAW);
126 state = INIT_SELECTING;
127 client_config.first_secs = 0; /* make secs field count from 0 */
128@@ -1711,7 +1723,8 @@ int udhcpc_main(int argc UNUSED_PARAM, c
129 bb_info_msg("Received DHCP NAK");
130 udhcp_run_script(&packet, "nak");
131 if (state != REQUESTING)
132- udhcp_run_script(NULL, "deconfig");
133+ if (allow_deconfig)
134+ udhcp_run_script(NULL, "deconfig");
135 change_listen_mode(LISTEN_RAW);
136 sleep(3); /* avoid excessive network traffic */
137 state = INIT_SELECTING;
diff --git a/meta/recipes-core/busybox/busybox/defconfig b/meta/recipes-core/busybox/busybox/defconfig
new file mode 100644
index 0000000000..8394067bed
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/defconfig
@@ -0,0 +1,1020 @@
1#
2# Automatically generated make config: don't edit
3# Busybox version: 1.20.2
4# Mon Aug 20 17:01:45 2012
5#
6CONFIG_HAVE_DOT_CONFIG=y
7
8#
9# Busybox Settings
10#
11
12#
13# General Configuration
14#
15# CONFIG_DESKTOP is not set
16# CONFIG_EXTRA_COMPAT is not set
17# CONFIG_INCLUDE_SUSv2 is not set
18# CONFIG_USE_PORTABLE_CODE is not set
19CONFIG_PLATFORM_LINUX=y
20CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
21# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
22# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
23CONFIG_SHOW_USAGE=y
24# CONFIG_FEATURE_VERBOSE_USAGE is not set
25CONFIG_FEATURE_COMPRESS_USAGE=y
26# CONFIG_FEATURE_INSTALLER is not set
27# CONFIG_INSTALL_NO_USR is not set
28# CONFIG_LOCALE_SUPPORT is not set
29# CONFIG_UNICODE_SUPPORT is not set
30# CONFIG_UNICODE_USING_LOCALE is not set
31# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
32CONFIG_SUBST_WCHAR=0
33CONFIG_LAST_SUPPORTED_WCHAR=0
34# CONFIG_UNICODE_COMBINING_WCHARS is not set
35# CONFIG_UNICODE_WIDE_WCHARS is not set
36# CONFIG_UNICODE_BIDI_SUPPORT is not set
37# CONFIG_UNICODE_NEUTRAL_TABLE is not set
38# CONFIG_UNICODE_PRESERVE_BROKEN is not set
39CONFIG_LONG_OPTS=y
40CONFIG_FEATURE_DEVPTS=y
41# CONFIG_FEATURE_CLEAN_UP is not set
42CONFIG_FEATURE_UTMP=y
43# CONFIG_FEATURE_WTMP is not set
44CONFIG_FEATURE_PIDFILE=y
45CONFIG_FEATURE_SUID=y
46CONFIG_FEATURE_SUID_CONFIG=y
47CONFIG_FEATURE_SUID_CONFIG_QUIET=y
48# CONFIG_SELINUX is not set
49# CONFIG_FEATURE_PREFER_APPLETS is not set
50CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
51CONFIG_FEATURE_SYSLOG=y
52CONFIG_FEATURE_HAVE_RPC=y
53
54#
55# Build Options
56#
57# CONFIG_STATIC is not set
58# CONFIG_PIE is not set
59# CONFIG_NOMMU is not set
60# CONFIG_BUILD_LIBBUSYBOX is not set
61# CONFIG_FEATURE_INDIVIDUAL is not set
62# CONFIG_FEATURE_SHARED_BUSYBOX is not set
63CONFIG_LFS=y
64# CONFIG_CROSS_COMPILER_PREFIX is not set
65CONFIG_SYSROOT=""
66# CONFIG_EXTRA_CFLAGS is not set
67CONFIG_EXTRA_LDFLAGS=""
68CONFIG_EXTRA_LDLIBS=""
69
70#
71# Debugging Options
72#
73# CONFIG_DEBUG is not set
74# CONFIG_DEBUG_PESSIMIZE is not set
75# CONFIG_WERROR is not set
76CONFIG_NO_DEBUG_LIB=y
77# CONFIG_DMALLOC is not set
78# CONFIG_EFENCE is not set
79
80#
81# Installation Options ("make install" behavior)
82#
83CONFIG_INSTALL_APPLET_SYMLINKS=y
84# CONFIG_INSTALL_APPLET_HARDLINKS is not set
85# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
86# CONFIG_INSTALL_APPLET_DONT is not set
87# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
88# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
89# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
90CONFIG_PREFIX="./_install"
91
92#
93# Busybox Library Tuning
94#
95CONFIG_FEATURE_SYSTEMD=y
96CONFIG_FEATURE_RTMINMAX=y
97CONFIG_PASSWORD_MINLEN=6
98CONFIG_MD5_SMALL=1
99CONFIG_FEATURE_FAST_TOP=y
100# CONFIG_FEATURE_ETC_NETWORKS is not set
101CONFIG_FEATURE_USE_TERMIOS=y
102CONFIG_FEATURE_EDITING=y
103CONFIG_FEATURE_EDITING_MAX_LEN=1024
104# CONFIG_FEATURE_EDITING_VI is not set
105CONFIG_FEATURE_EDITING_HISTORY=15
106CONFIG_FEATURE_EDITING_SAVEHISTORY=y
107# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
108# CONFIG_FEATURE_REVERSE_SEARCH is not set
109CONFIG_FEATURE_TAB_COMPLETION=y
110CONFIG_FEATURE_USERNAME_COMPLETION=y
111CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
112# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
113CONFIG_FEATURE_NON_POSIX_CP=y
114# CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set
115CONFIG_FEATURE_COPYBUF_KB=4
116CONFIG_FEATURE_SKIP_ROOTFS=y
117CONFIG_MONOTONIC_SYSCALL=y
118CONFIG_IOCTL_HEX2STR_ERROR=y
119CONFIG_FEATURE_HWIB=y
120
121#
122# Applets
123#
124
125#
126# Archival Utilities
127#
128CONFIG_FEATURE_SEAMLESS_XZ=y
129CONFIG_FEATURE_SEAMLESS_LZMA=y
130CONFIG_FEATURE_SEAMLESS_BZ2=y
131CONFIG_FEATURE_SEAMLESS_GZ=y
132CONFIG_FEATURE_SEAMLESS_Z=y
133CONFIG_AR=y
134# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
135# CONFIG_FEATURE_AR_CREATE is not set
136CONFIG_BUNZIP2=y
137# CONFIG_BZIP2 is not set
138CONFIG_CPIO=y
139# CONFIG_FEATURE_CPIO_O is not set
140# CONFIG_FEATURE_CPIO_P is not set
141# CONFIG_DPKG is not set
142# CONFIG_DPKG_DEB is not set
143# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
144CONFIG_GUNZIP=y
145CONFIG_GZIP=y
146# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
147CONFIG_GZIP_FAST=0
148# CONFIG_LZOP is not set
149# CONFIG_LZOP_COMPR_HIGH is not set
150# CONFIG_RPM2CPIO is not set
151# CONFIG_RPM is not set
152CONFIG_TAR=y
153CONFIG_FEATURE_TAR_CREATE=y
154CONFIG_FEATURE_TAR_AUTODETECT=y
155CONFIG_FEATURE_TAR_FROM=y
156CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
157# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
158CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
159# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
160# CONFIG_FEATURE_TAR_TO_COMMAND is not set
161# CONFIG_FEATURE_TAR_UNAME_GNAME is not set
162CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
163# CONFIG_FEATURE_TAR_SELINUX is not set
164# CONFIG_UNCOMPRESS is not set
165# CONFIG_UNLZMA is not set
166# CONFIG_FEATURE_LZMA_FAST is not set
167# CONFIG_LZMA is not set
168# CONFIG_UNXZ is not set
169# CONFIG_XZ is not set
170CONFIG_UNZIP=y
171
172#
173# Coreutils
174#
175CONFIG_BASENAME=y
176CONFIG_CAT=y
177CONFIG_DATE=y
178# CONFIG_FEATURE_DATE_ISOFMT is not set
179# CONFIG_FEATURE_DATE_NANO is not set
180CONFIG_FEATURE_DATE_COMPAT=y
181# CONFIG_HOSTID is not set
182CONFIG_ID=y
183CONFIG_GROUPS=y
184CONFIG_TEST=y
185CONFIG_FEATURE_TEST_64=y
186CONFIG_TOUCH=y
187CONFIG_FEATURE_TOUCH_SUSV3=y
188CONFIG_TR=y
189CONFIG_FEATURE_TR_CLASSES=y
190# CONFIG_FEATURE_TR_EQUIV is not set
191# CONFIG_BASE64 is not set
192CONFIG_WHO=y
193CONFIG_USERS=y
194# CONFIG_CAL is not set
195# CONFIG_CATV is not set
196CONFIG_CHGRP=y
197CONFIG_CHMOD=y
198CONFIG_CHOWN=y
199# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set
200CONFIG_CHROOT=y
201# CONFIG_CKSUM is not set
202# CONFIG_COMM is not set
203CONFIG_CP=y
204# CONFIG_FEATURE_CP_LONG_OPTIONS is not set
205CONFIG_CUT=y
206CONFIG_DD=y
207CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
208# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set
209# CONFIG_FEATURE_DD_IBS_OBS is not set
210CONFIG_DF=y
211# CONFIG_FEATURE_DF_FANCY is not set
212CONFIG_DIRNAME=y
213# CONFIG_DOS2UNIX is not set
214# CONFIG_UNIX2DOS is not set
215CONFIG_DU=y
216CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
217CONFIG_ECHO=y
218CONFIG_FEATURE_FANCY_ECHO=y
219CONFIG_ENV=y
220CONFIG_FEATURE_ENV_LONG_OPTIONS=y
221# CONFIG_EXPAND is not set
222# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set
223CONFIG_EXPR=y
224CONFIG_EXPR_MATH_SUPPORT_64=y
225CONFIG_FALSE=y
226# CONFIG_FOLD is not set
227# CONFIG_FSYNC is not set
228CONFIG_HEAD=y
229# CONFIG_FEATURE_FANCY_HEAD is not set
230# CONFIG_INSTALL is not set
231# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set
232CONFIG_LN=y
233CONFIG_LOGNAME=y
234CONFIG_LS=y
235CONFIG_FEATURE_LS_FILETYPES=y
236CONFIG_FEATURE_LS_FOLLOWLINKS=y
237CONFIG_FEATURE_LS_RECURSIVE=y
238CONFIG_FEATURE_LS_SORTFILES=y
239CONFIG_FEATURE_LS_TIMESTAMPS=y
240CONFIG_FEATURE_LS_USERNAME=y
241CONFIG_FEATURE_LS_COLOR=y
242# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set
243CONFIG_MD5SUM=y
244CONFIG_MKDIR=y
245CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y
246CONFIG_MKFIFO=y
247CONFIG_MKNOD=y
248CONFIG_MV=y
249# CONFIG_FEATURE_MV_LONG_OPTIONS is not set
250# CONFIG_NICE is not set
251CONFIG_NOHUP=y
252CONFIG_OD=y
253# CONFIG_PRINTENV is not set
254CONFIG_PRINTF=y
255CONFIG_PWD=y
256CONFIG_READLINK=y
257CONFIG_FEATURE_READLINK_FOLLOW=y
258CONFIG_REALPATH=y
259CONFIG_RM=y
260CONFIG_RMDIR=y
261# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set
262CONFIG_SEQ=y
263# CONFIG_SHA1SUM is not set
264# CONFIG_SHA256SUM is not set
265# CONFIG_SHA512SUM is not set
266CONFIG_SLEEP=y
267CONFIG_FEATURE_FANCY_SLEEP=y
268# CONFIG_FEATURE_FLOAT_SLEEP is not set
269CONFIG_SORT=y
270CONFIG_FEATURE_SORT_BIG=y
271# CONFIG_SPLIT is not set
272# CONFIG_FEATURE_SPLIT_FANCY is not set
273CONFIG_STAT=y
274CONFIG_FEATURE_STAT_FORMAT=y
275CONFIG_STTY=y
276# CONFIG_SUM is not set
277CONFIG_SYNC=y
278# CONFIG_TAC is not set
279CONFIG_TAIL=y
280CONFIG_FEATURE_FANCY_TAIL=y
281CONFIG_TEE=y
282# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
283CONFIG_TRUE=y
284CONFIG_TTY=y
285CONFIG_UNAME=y
286# CONFIG_UNEXPAND is not set
287# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set
288CONFIG_UNIQ=y
289CONFIG_USLEEP=y
290# CONFIG_UUDECODE is not set
291# CONFIG_UUENCODE is not set
292CONFIG_WC=y
293# CONFIG_FEATURE_WC_LARGE is not set
294CONFIG_WHOAMI=y
295CONFIG_YES=y
296
297#
298# Common options for cp and mv
299#
300# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
301
302#
303# Common options for ls, more and telnet
304#
305CONFIG_FEATURE_AUTOWIDTH=y
306
307#
308# Common options for df, du, ls
309#
310CONFIG_FEATURE_HUMAN_READABLE=y
311
312#
313# Common options for md5sum, sha1sum, sha256sum, sha512sum
314#
315CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
316
317#
318# Console Utilities
319#
320CONFIG_CHVT=y
321# CONFIG_FGCONSOLE is not set
322CONFIG_CLEAR=y
323CONFIG_DEALLOCVT=y
324CONFIG_DUMPKMAP=y
325# CONFIG_KBD_MODE is not set
326CONFIG_LOADFONT=y
327CONFIG_LOADKMAP=y
328CONFIG_OPENVT=y
329CONFIG_RESET=y
330# CONFIG_RESIZE is not set
331# CONFIG_FEATURE_RESIZE_PRINT is not set
332CONFIG_SETCONSOLE=y
333# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set
334# CONFIG_SETFONT is not set
335# CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set
336CONFIG_DEFAULT_SETFONT_DIR=""
337# CONFIG_SETKEYCODES is not set
338# CONFIG_SETLOGCONS is not set
339# CONFIG_SHOWKEY is not set
340
341#
342# Common options for loadfont and setfont
343#
344# CONFIG_FEATURE_LOADFONT_PSF2 is not set
345# CONFIG_FEATURE_LOADFONT_RAW is not set
346
347#
348# Debian Utilities
349#
350CONFIG_MKTEMP=y
351# CONFIG_PIPE_PROGRESS is not set
352CONFIG_RUN_PARTS=y
353CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
354# CONFIG_FEATURE_RUN_PARTS_FANCY is not set
355CONFIG_START_STOP_DAEMON=y
356CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
357CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
358CONFIG_WHICH=y
359
360#
361# Editors
362#
363CONFIG_PATCH=y
364CONFIG_VI=y
365CONFIG_FEATURE_VI_MAX_LEN=1024
366CONFIG_FEATURE_VI_8BIT=y
367CONFIG_FEATURE_VI_COLON=y
368CONFIG_FEATURE_VI_YANKMARK=y
369CONFIG_FEATURE_VI_SEARCH=y
370# CONFIG_FEATURE_VI_REGEX_SEARCH is not set
371CONFIG_FEATURE_VI_USE_SIGNALS=y
372# CONFIG_FEATURE_VI_DOT_CMD is not set
373# CONFIG_FEATURE_VI_READONLY is not set
374# CONFIG_FEATURE_VI_SETOPTS is not set
375# CONFIG_FEATURE_VI_SET is not set
376CONFIG_FEATURE_VI_WIN_RESIZE=y
377# CONFIG_FEATURE_VI_ASK_TERMINAL is not set
378CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
379CONFIG_AWK=y
380CONFIG_FEATURE_AWK_LIBM=y
381CONFIG_CMP=y
382CONFIG_DIFF=y
383# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set
384CONFIG_FEATURE_DIFF_DIR=y
385# CONFIG_ED is not set
386CONFIG_SED=y
387CONFIG_FEATURE_ALLOW_EXEC=y
388
389#
390# Finding Utilities
391#
392CONFIG_FIND=y
393CONFIG_FEATURE_FIND_PRINT0=y
394CONFIG_FEATURE_FIND_MTIME=y
395CONFIG_FEATURE_FIND_MMIN=y
396CONFIG_FEATURE_FIND_PERM=y
397CONFIG_FEATURE_FIND_TYPE=y
398CONFIG_FEATURE_FIND_XDEV=y
399CONFIG_FEATURE_FIND_MAXDEPTH=y
400CONFIG_FEATURE_FIND_NEWER=y
401# CONFIG_FEATURE_FIND_INUM is not set
402CONFIG_FEATURE_FIND_EXEC=y
403CONFIG_FEATURE_FIND_USER=y
404CONFIG_FEATURE_FIND_GROUP=y
405CONFIG_FEATURE_FIND_NOT=y
406CONFIG_FEATURE_FIND_DEPTH=y
407CONFIG_FEATURE_FIND_PAREN=y
408CONFIG_FEATURE_FIND_SIZE=y
409CONFIG_FEATURE_FIND_PRUNE=y
410# CONFIG_FEATURE_FIND_DELETE is not set
411CONFIG_FEATURE_FIND_PATH=y
412CONFIG_FEATURE_FIND_REGEX=y
413# CONFIG_FEATURE_FIND_CONTEXT is not set
414# CONFIG_FEATURE_FIND_LINKS is not set
415CONFIG_GREP=y
416CONFIG_FEATURE_GREP_EGREP_ALIAS=y
417CONFIG_FEATURE_GREP_FGREP_ALIAS=y
418CONFIG_FEATURE_GREP_CONTEXT=y
419CONFIG_XARGS=y
420# CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION is not set
421# CONFIG_FEATURE_XARGS_SUPPORT_QUOTES is not set
422# CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT is not set
423# CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM is not set
424
425#
426# Init Utilities
427#
428# CONFIG_BOOTCHARTD is not set
429# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set
430# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set
431CONFIG_HALT=y
432# CONFIG_FEATURE_CALL_TELINIT is not set
433CONFIG_TELINIT_PATH=""
434# CONFIG_INIT is not set
435# CONFIG_FEATURE_USE_INITTAB is not set
436# CONFIG_FEATURE_KILL_REMOVED is not set
437CONFIG_FEATURE_KILL_DELAY=0
438# CONFIG_FEATURE_INIT_SCTTY is not set
439# CONFIG_FEATURE_INIT_SYSLOG is not set
440# CONFIG_FEATURE_EXTRA_QUIET is not set
441# CONFIG_FEATURE_INIT_COREDUMPS is not set
442# CONFIG_FEATURE_INITRD is not set
443CONFIG_INIT_TERMINAL_TYPE=""
444# CONFIG_MESG is not set
445# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set
446
447#
448# Login/Password Management Utilities
449#
450# CONFIG_ADD_SHELL is not set
451# CONFIG_REMOVE_SHELL is not set
452# CONFIG_FEATURE_SHADOWPASSWDS is not set
453# CONFIG_USE_BB_PWD_GRP is not set
454# CONFIG_USE_BB_SHADOW is not set
455CONFIG_USE_BB_CRYPT=y
456# CONFIG_USE_BB_CRYPT_SHA is not set
457# CONFIG_ADDUSER is not set
458# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set
459# CONFIG_FEATURE_CHECK_NAMES is not set
460CONFIG_FIRST_SYSTEM_ID=100
461CONFIG_LAST_SYSTEM_ID=999
462# CONFIG_ADDGROUP is not set
463# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set
464# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set
465# CONFIG_DELUSER is not set
466# CONFIG_DELGROUP is not set
467# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
468# CONFIG_GETTY is not set
469# CONFIG_LOGIN is not set
470# CONFIG_LOGIN_SESSION_AS_CHILD is not set
471# CONFIG_PAM is not set
472# CONFIG_LOGIN_SCRIPTS is not set
473# CONFIG_FEATURE_NOLOGIN is not set
474# CONFIG_FEATURE_SECURETTY is not set
475# CONFIG_PASSWD is not set
476# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
477# CONFIG_CRYPTPW is not set
478# CONFIG_CHPASSWD is not set
479CONFIG_FEATURE_DEFAULT_PASSWD_ALGO=""
480# CONFIG_SU is not set
481# CONFIG_FEATURE_SU_SYSLOG is not set
482# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
483# CONFIG_SULOGIN is not set
484# CONFIG_VLOCK is not set
485
486#
487# Linux Ext2 FS Progs
488#
489CONFIG_CHATTR=y
490CONFIG_FSCK=y
491# CONFIG_LSATTR is not set
492# CONFIG_TUNE2FS is not set
493
494#
495# Linux Module Utilities
496#
497# CONFIG_MODINFO is not set
498# CONFIG_MODPROBE_SMALL is not set
499# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set
500# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set
501CONFIG_INSMOD=y
502CONFIG_RMMOD=y
503CONFIG_LSMOD=y
504# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
505CONFIG_MODPROBE=y
506# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
507CONFIG_DEPMOD=y
508
509#
510# Options common to multiple modutils
511#
512# CONFIG_FEATURE_2_4_MODULES is not set
513# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
514# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
515# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
516# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
517# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
518# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
519CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
520CONFIG_FEATURE_MODUTILS_ALIAS=y
521CONFIG_FEATURE_MODUTILS_SYMBOLS=y
522CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
523CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
524
525#
526# Linux System Utilities
527#
528# CONFIG_BLOCKDEV is not set
529# CONFIG_MDEV is not set
530# CONFIG_FEATURE_MDEV_CONF is not set
531# CONFIG_FEATURE_MDEV_RENAME is not set
532# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
533# CONFIG_FEATURE_MDEV_EXEC is not set
534# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
535# CONFIG_REV is not set
536# CONFIG_ACPID is not set
537# CONFIG_FEATURE_ACPID_COMPAT is not set
538# CONFIG_BLKID is not set
539# CONFIG_FEATURE_BLKID_TYPE is not set
540CONFIG_DMESG=y
541CONFIG_FEATURE_DMESG_PRETTY=y
542CONFIG_FBSET=y
543CONFIG_FEATURE_FBSET_FANCY=y
544CONFIG_FEATURE_FBSET_READMODE=y
545# CONFIG_FDFLUSH is not set
546# CONFIG_FDFORMAT is not set
547CONFIG_FDISK=y
548# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
549CONFIG_FEATURE_FDISK_WRITABLE=y
550# CONFIG_FEATURE_AIX_LABEL is not set
551# CONFIG_FEATURE_SGI_LABEL is not set
552# CONFIG_FEATURE_SUN_LABEL is not set
553# CONFIG_FEATURE_OSF_LABEL is not set
554# CONFIG_FEATURE_GPT_LABEL is not set
555# CONFIG_FEATURE_FDISK_ADVANCED is not set
556# CONFIG_FINDFS is not set
557CONFIG_FLOCK=y
558# CONFIG_FREERAMDISK is not set
559# CONFIG_FSCK_MINIX is not set
560# CONFIG_MKFS_EXT2 is not set
561# CONFIG_MKFS_MINIX is not set
562# CONFIG_FEATURE_MINIX2 is not set
563# CONFIG_MKFS_REISER is not set
564# CONFIG_MKFS_VFAT is not set
565# CONFIG_GETOPT is not set
566# CONFIG_FEATURE_GETOPT_LONG is not set
567CONFIG_HEXDUMP=y
568# CONFIG_FEATURE_HEXDUMP_REVERSE is not set
569# CONFIG_HD is not set
570CONFIG_HWCLOCK=y
571CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
572CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y
573# CONFIG_IPCRM is not set
574# CONFIG_IPCS is not set
575CONFIG_LOSETUP=y
576# CONFIG_LSPCI is not set
577# CONFIG_LSUSB is not set
578CONFIG_MKSWAP=y
579# CONFIG_FEATURE_MKSWAP_UUID is not set
580CONFIG_MORE=y
581CONFIG_MOUNT=y
582# CONFIG_FEATURE_MOUNT_FAKE is not set
583# CONFIG_FEATURE_MOUNT_VERBOSE is not set
584# CONFIG_FEATURE_MOUNT_HELPERS is not set
585# CONFIG_FEATURE_MOUNT_LABEL is not set
586CONFIG_FEATURE_MOUNT_NFS=y
587# CONFIG_FEATURE_MOUNT_CIFS is not set
588CONFIG_FEATURE_MOUNT_FLAGS=y
589CONFIG_FEATURE_MOUNT_FSTAB=y
590CONFIG_PIVOT_ROOT=y
591CONFIG_RDATE=y
592# CONFIG_RDEV is not set
593# CONFIG_READPROFILE is not set
594# CONFIG_RTCWAKE is not set
595# CONFIG_SCRIPT is not set
596# CONFIG_SCRIPTREPLAY is not set
597# CONFIG_SETARCH is not set
598CONFIG_SWAPONOFF=y
599CONFIG_FEATURE_SWAPON_PRI=y
600CONFIG_SWITCH_ROOT=y
601CONFIG_UMOUNT=y
602CONFIG_FEATURE_UMOUNT_ALL=y
603
604#
605# Common options for mount/umount
606#
607CONFIG_FEATURE_MOUNT_LOOP=y
608CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
609# CONFIG_FEATURE_MTAB_SUPPORT is not set
610# CONFIG_VOLUMEID is not set
611# CONFIG_FEATURE_VOLUMEID_EXT is not set
612# CONFIG_FEATURE_VOLUMEID_BTRFS is not set
613# CONFIG_FEATURE_VOLUMEID_REISERFS is not set
614# CONFIG_FEATURE_VOLUMEID_FAT is not set
615# CONFIG_FEATURE_VOLUMEID_HFS is not set
616# CONFIG_FEATURE_VOLUMEID_JFS is not set
617# CONFIG_FEATURE_VOLUMEID_XFS is not set
618# CONFIG_FEATURE_VOLUMEID_NTFS is not set
619# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
620# CONFIG_FEATURE_VOLUMEID_UDF is not set
621# CONFIG_FEATURE_VOLUMEID_LUKS is not set
622# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
623# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
624# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
625# CONFIG_FEATURE_VOLUMEID_SYSV is not set
626# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
627# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
628
629#
630# Miscellaneous Utilities
631#
632# CONFIG_CONSPY is not set
633CONFIG_LESS=y
634CONFIG_FEATURE_LESS_MAXLINES=9999999
635CONFIG_FEATURE_LESS_BRACKETS=y
636CONFIG_FEATURE_LESS_FLAGS=y
637# CONFIG_FEATURE_LESS_MARKS is not set
638# CONFIG_FEATURE_LESS_REGEXP is not set
639# CONFIG_FEATURE_LESS_WINCH is not set
640# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set
641# CONFIG_FEATURE_LESS_DASHCMD is not set
642# CONFIG_FEATURE_LESS_LINENUMS is not set
643# CONFIG_NANDWRITE is not set
644# CONFIG_NANDDUMP is not set
645# CONFIG_SETSERIAL is not set
646# CONFIG_UBIATTACH is not set
647# CONFIG_UBIDETACH is not set
648# CONFIG_UBIMKVOL is not set
649# CONFIG_UBIRMVOL is not set
650# CONFIG_UBIRSVOL is not set
651# CONFIG_UBIUPDATEVOL is not set
652# CONFIG_ADJTIMEX is not set
653# CONFIG_BBCONFIG is not set
654# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
655# CONFIG_BEEP is not set
656CONFIG_FEATURE_BEEP_FREQ=0
657CONFIG_FEATURE_BEEP_LENGTH_MS=0
658# CONFIG_CHAT is not set
659# CONFIG_FEATURE_CHAT_NOFAIL is not set
660# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
661# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set
662# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set
663# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set
664# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set
665# CONFIG_FEATURE_CHAT_CLR_ABORT is not set
666# CONFIG_CHRT is not set
667# CONFIG_CROND is not set
668# CONFIG_FEATURE_CROND_D is not set
669# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set
670CONFIG_FEATURE_CROND_DIR=""
671# CONFIG_CRONTAB is not set
672CONFIG_DC=y
673# CONFIG_FEATURE_DC_LIBM is not set
674# CONFIG_DEVFSD is not set
675# CONFIG_DEVFSD_MODLOAD is not set
676# CONFIG_DEVFSD_FG_NP is not set
677# CONFIG_DEVFSD_VERBOSE is not set
678# CONFIG_FEATURE_DEVFS is not set
679# CONFIG_DEVMEM is not set
680# CONFIG_EJECT is not set
681# CONFIG_FEATURE_EJECT_SCSI is not set
682# CONFIG_FBSPLASH is not set
683# CONFIG_FLASHCP is not set
684# CONFIG_FLASH_LOCK is not set
685# CONFIG_FLASH_UNLOCK is not set
686# CONFIG_FLASH_ERASEALL is not set
687# CONFIG_IONICE is not set
688# CONFIG_INOTIFYD is not set
689# CONFIG_LAST is not set
690# CONFIG_FEATURE_LAST_SMALL is not set
691# CONFIG_FEATURE_LAST_FANCY is not set
692# CONFIG_HDPARM is not set
693# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set
694# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set
695# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set
696# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set
697# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set
698# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set
699# CONFIG_MAKEDEVS is not set
700# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
701# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
702# CONFIG_MAN is not set
703CONFIG_MICROCOM=y
704# CONFIG_MOUNTPOINT is not set
705# CONFIG_MT is not set
706# CONFIG_RAIDAUTORUN is not set
707# CONFIG_READAHEAD is not set
708CONFIG_RFKILL=y
709# CONFIG_RUNLEVEL is not set
710# CONFIG_RX is not set
711# CONFIG_SETSID is not set
712CONFIG_STRINGS=y
713# CONFIG_TASKSET is not set
714# CONFIG_FEATURE_TASKSET_FANCY is not set
715CONFIG_TIME=y
716# CONFIG_TIMEOUT is not set
717# CONFIG_TTYSIZE is not set
718# CONFIG_VOLNAME is not set
719# CONFIG_WALL is not set
720# CONFIG_WATCHDOG is not set
721
722#
723# Networking Utilities
724#
725# CONFIG_NAMEIF is not set
726# CONFIG_FEATURE_NAMEIF_EXTENDED is not set
727# CONFIG_NBDCLIENT is not set
728CONFIG_NC=y
729# CONFIG_NC_SERVER is not set
730# CONFIG_NC_EXTRA is not set
731# CONFIG_NC_110_COMPAT is not set
732CONFIG_PING=y
733CONFIG_PING6=y
734CONFIG_FEATURE_FANCY_PING=y
735# CONFIG_WHOIS is not set
736CONFIG_FEATURE_IPV6=y
737# CONFIG_FEATURE_UNIX_LOCAL is not set
738CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
739# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
740# CONFIG_ARP is not set
741# CONFIG_ARPING is not set
742# CONFIG_BRCTL is not set
743# CONFIG_FEATURE_BRCTL_FANCY is not set
744# CONFIG_FEATURE_BRCTL_SHOW is not set
745# CONFIG_DNSD is not set
746# CONFIG_ETHER_WAKE is not set
747# CONFIG_FAKEIDENTD is not set
748# CONFIG_FTPD is not set
749# CONFIG_FEATURE_FTP_WRITE is not set
750# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set
751# CONFIG_FTPGET is not set
752# CONFIG_FTPPUT is not set
753# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set
754CONFIG_HOSTNAME=y
755# CONFIG_HTTPD is not set
756# CONFIG_FEATURE_HTTPD_RANGES is not set
757# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set
758# CONFIG_FEATURE_HTTPD_SETUID is not set
759# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set
760# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set
761# CONFIG_FEATURE_HTTPD_CGI is not set
762# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set
763# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set
764# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set
765# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set
766# CONFIG_FEATURE_HTTPD_PROXY is not set
767# CONFIG_FEATURE_HTTPD_GZIP is not set
768CONFIG_IFCONFIG=y
769CONFIG_FEATURE_IFCONFIG_STATUS=y
770# CONFIG_FEATURE_IFCONFIG_SLIP is not set
771# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
772CONFIG_FEATURE_IFCONFIG_HW=y
773# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
774# CONFIG_IFENSLAVE is not set
775# CONFIG_IFPLUGD is not set
776CONFIG_IFUPDOWN=y
777CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
778# CONFIG_FEATURE_IFUPDOWN_IP is not set
779# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set
780CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN=y
781CONFIG_FEATURE_IFUPDOWN_IPV4=y
782CONFIG_FEATURE_IFUPDOWN_IPV6=y
783CONFIG_FEATURE_IFUPDOWN_MAPPING=y
784CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y
785# CONFIG_INETD is not set
786# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
787# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
788# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
789# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
790# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
791# CONFIG_FEATURE_INETD_RPC is not set
792CONFIG_IP=y
793CONFIG_FEATURE_IP_ADDRESS=y
794CONFIG_FEATURE_IP_LINK=y
795CONFIG_FEATURE_IP_ROUTE=y
796CONFIG_FEATURE_IP_TUNNEL=y
797# CONFIG_FEATURE_IP_RULE is not set
798# CONFIG_FEATURE_IP_SHORT_FORMS is not set
799# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
800# CONFIG_IPADDR is not set
801# CONFIG_IPLINK is not set
802# CONFIG_IPROUTE is not set
803# CONFIG_IPTUNNEL is not set
804# CONFIG_IPRULE is not set
805# CONFIG_IPCALC is not set
806# CONFIG_FEATURE_IPCALC_FANCY is not set
807# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set
808CONFIG_NETSTAT=y
809# CONFIG_FEATURE_NETSTAT_WIDE is not set
810# CONFIG_FEATURE_NETSTAT_PRG is not set
811CONFIG_NSLOOKUP=y
812# CONFIG_NTPD is not set
813# CONFIG_FEATURE_NTPD_SERVER is not set
814# CONFIG_PSCAN is not set
815CONFIG_ROUTE=y
816# CONFIG_SLATTACH is not set
817# CONFIG_TCPSVD is not set
818CONFIG_TELNET=y
819# CONFIG_FEATURE_TELNET_TTYPE is not set
820CONFIG_FEATURE_TELNET_AUTOLOGIN=y
821# CONFIG_TELNETD is not set
822# CONFIG_FEATURE_TELNETD_STANDALONE is not set
823# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set
824CONFIG_TFTP=y
825# CONFIG_TFTPD is not set
826
827#
828# Common options for tftp/tftpd
829#
830CONFIG_FEATURE_TFTP_GET=y
831CONFIG_FEATURE_TFTP_PUT=y
832# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
833# CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set
834# CONFIG_TFTP_DEBUG is not set
835CONFIG_TRACEROUTE=y
836# CONFIG_TRACEROUTE6 is not set
837# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
838# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
839# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
840# CONFIG_TUNCTL is not set
841# CONFIG_FEATURE_TUNCTL_UG is not set
842# CONFIG_UDHCPC6 is not set
843CONFIG_UDHCPD=y
844# CONFIG_DHCPRELAY is not set
845CONFIG_DUMPLEASES=y
846# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
847# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
848CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
849CONFIG_UDHCPC=y
850CONFIG_FEATURE_UDHCPC_ARPING=y
851# CONFIG_FEATURE_UDHCP_PORT is not set
852CONFIG_UDHCP_DEBUG=0
853# CONFIG_FEATURE_UDHCP_RFC3397 is not set
854# CONFIG_FEATURE_UDHCP_8021Q is not set
855CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
856CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
857CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
858# CONFIG_UDPSVD is not set
859# CONFIG_VCONFIG is not set
860CONFIG_WGET=y
861CONFIG_FEATURE_WGET_STATUSBAR=y
862CONFIG_FEATURE_WGET_AUTHENTICATION=y
863CONFIG_FEATURE_WGET_LONG_OPTIONS=y
864CONFIG_FEATURE_WGET_TIMEOUT=y
865# CONFIG_ZCIP is not set
866
867#
868# Print Utilities
869#
870# CONFIG_LPD is not set
871# CONFIG_LPR is not set
872# CONFIG_LPQ is not set
873
874#
875# Mail Utilities
876#
877# CONFIG_MAKEMIME is not set
878CONFIG_FEATURE_MIME_CHARSET=""
879# CONFIG_POPMAILDIR is not set
880# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set
881# CONFIG_REFORMIME is not set
882# CONFIG_FEATURE_REFORMIME_COMPAT is not set
883# CONFIG_SENDMAIL is not set
884
885#
886# Process Utilities
887#
888# CONFIG_IOSTAT is not set
889# CONFIG_LSOF is not set
890# CONFIG_MPSTAT is not set
891# CONFIG_NMETER is not set
892# CONFIG_PMAP is not set
893# CONFIG_POWERTOP is not set
894# CONFIG_PSTREE is not set
895# CONFIG_PWDX is not set
896# CONFIG_SMEMCAP is not set
897CONFIG_UPTIME=y
898# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set
899CONFIG_FREE=y
900CONFIG_FUSER=y
901CONFIG_KILL=y
902CONFIG_KILLALL=y
903# CONFIG_KILLALL5 is not set
904# CONFIG_PGREP is not set
905CONFIG_PIDOF=y
906# CONFIG_FEATURE_PIDOF_SINGLE is not set
907# CONFIG_FEATURE_PIDOF_OMIT is not set
908# CONFIG_PKILL is not set
909CONFIG_PS=y
910CONFIG_FEATURE_PS_WIDE=y
911CONFIG_FEATURE_PS_LONG=y
912# CONFIG_FEATURE_PS_TIME is not set
913# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
914# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
915CONFIG_RENICE=y
916CONFIG_BB_SYSCTL=y
917CONFIG_TOP=y
918CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
919CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
920# CONFIG_FEATURE_TOP_SMP_CPU is not set
921# CONFIG_FEATURE_TOP_DECIMALS is not set
922# CONFIG_FEATURE_TOP_SMP_PROCESS is not set
923# CONFIG_FEATURE_TOPMEM is not set
924# CONFIG_FEATURE_SHOW_THREADS is not set
925CONFIG_WATCH=y
926
927#
928# Runit Utilities
929#
930# CONFIG_RUNSV is not set
931# CONFIG_RUNSVDIR is not set
932# CONFIG_FEATURE_RUNSVDIR_LOG is not set
933# CONFIG_SV is not set
934CONFIG_SV_DEFAULT_SERVICE_DIR=""
935# CONFIG_SVLOGD is not set
936# CONFIG_CHPST is not set
937# CONFIG_SETUIDGID is not set
938# CONFIG_ENVUIDGID is not set
939# CONFIG_ENVDIR is not set
940# CONFIG_SOFTLIMIT is not set
941# CONFIG_CHCON is not set
942# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
943# CONFIG_GETENFORCE is not set
944# CONFIG_GETSEBOOL is not set
945# CONFIG_LOAD_POLICY is not set
946# CONFIG_MATCHPATHCON is not set
947# CONFIG_RESTORECON is not set
948# CONFIG_RUNCON is not set
949# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
950# CONFIG_SELINUXENABLED is not set
951# CONFIG_SETENFORCE is not set
952# CONFIG_SETFILES is not set
953# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
954# CONFIG_SETSEBOOL is not set
955# CONFIG_SESTATUS is not set
956
957#
958# Shells
959#
960CONFIG_ASH=y
961CONFIG_ASH_BASH_COMPAT=y
962# CONFIG_ASH_IDLE_TIMEOUT is not set
963CONFIG_ASH_JOB_CONTROL=y
964CONFIG_ASH_ALIAS=y
965CONFIG_ASH_GETOPTS=y
966CONFIG_ASH_BUILTIN_ECHO=y
967CONFIG_ASH_BUILTIN_PRINTF=y
968CONFIG_ASH_BUILTIN_TEST=y
969# CONFIG_ASH_CMDCMD is not set
970# CONFIG_ASH_MAIL is not set
971CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
972# CONFIG_ASH_RANDOM_SUPPORT is not set
973CONFIG_ASH_EXPAND_PRMT=y
974# CONFIG_CTTYHACK is not set
975# CONFIG_HUSH is not set
976# CONFIG_HUSH_BASH_COMPAT is not set
977# CONFIG_HUSH_BRACE_EXPANSION is not set
978# CONFIG_HUSH_HELP is not set
979# CONFIG_HUSH_INTERACTIVE is not set
980# CONFIG_HUSH_SAVEHISTORY is not set
981# CONFIG_HUSH_JOB is not set
982# CONFIG_HUSH_TICK is not set
983# CONFIG_HUSH_IF is not set
984# CONFIG_HUSH_LOOPS is not set
985# CONFIG_HUSH_CASE is not set
986# CONFIG_HUSH_FUNCTIONS is not set
987# CONFIG_HUSH_LOCAL is not set
988# CONFIG_HUSH_RANDOM_SUPPORT is not set
989# CONFIG_HUSH_EXPORT_N is not set
990# CONFIG_HUSH_MODE_X is not set
991# CONFIG_MSH is not set
992CONFIG_FEATURE_SH_IS_ASH=y
993# CONFIG_FEATURE_SH_IS_HUSH is not set
994# CONFIG_FEATURE_SH_IS_NONE is not set
995# CONFIG_FEATURE_BASH_IS_ASH is not set
996# CONFIG_FEATURE_BASH_IS_HUSH is not set
997CONFIG_FEATURE_BASH_IS_NONE=y
998CONFIG_SH_MATH_SUPPORT=y
999# CONFIG_SH_MATH_SUPPORT_64 is not set
1000CONFIG_FEATURE_SH_EXTRA_QUIET=y
1001# CONFIG_FEATURE_SH_STANDALONE is not set
1002# CONFIG_FEATURE_SH_NOFORK is not set
1003CONFIG_FEATURE_SH_HISTFILESIZE=y
1004
1005#
1006# System Logging Utilities
1007#
1008CONFIG_SYSLOGD=y
1009CONFIG_FEATURE_ROTATE_LOGFILE=y
1010CONFIG_FEATURE_REMOTE_LOG=y
1011CONFIG_FEATURE_SYSLOGD_DUP=y
1012CONFIG_FEATURE_SYSLOGD_CFG=y
1013CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
1014CONFIG_FEATURE_IPC_SYSLOG=y
1015CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=64
1016CONFIG_LOGREAD=y
1017CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
1018CONFIG_KLOGD=y
1019CONFIG_FEATURE_KLOGD_KLOGCTL=y
1020CONFIG_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
new file mode 100644
index 0000000000..6745f169fe
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/fail_on_no_media.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Pending
2
3The current behaviour of busybox is to try all fstype when automounting
4even when no media exists. The util-linux mount command bails when no
5media exists, so change the behaviour of busybox to do the same.
6
7It could also be argued that the KERN_INFO message from btrfs could be
8removed, but that would be harder to accomplish.
9
10Signed-off-by: Saul Wold <sgw@linux.intel.com>
11
12
13Index: busybox-1.20.2/util-linux/mount.c
14===================================================================
15--- busybox-1.20.2.orig/util-linux/mount.c
16+++ busybox-1.20.2/util-linux/mount.c
17@@ -598,7 +598,13 @@ static int mount_it_now(struct mntent *m
18 break;
19 errno = errno_save;
20 }
21-
22+ /*
23+ * Break if there is no media, no point retrying for all
24+ * fs types since there is no media available
25+ */
26+ if (rc == -1 && errno == ENOMEDIUM) {
27+ bb_perror_msg_and_die("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
28+ }
29 if (!rc || (vfsflags & MS_RDONLY) || (errno != EACCES && errno != EROFS))
30 break;
31 if (!(vfsflags & MS_SILENT))
diff --git a/meta/recipes-core/busybox/busybox/get_header_tar.patch b/meta/recipes-core/busybox/busybox/get_header_tar.patch
new file mode 100644
index 0000000000..0e528ff91f
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/get_header_tar.patch
@@ -0,0 +1,22 @@
1Upstream-Status: Pending
2
3# copy commit message from OE as the patch comment:
4# commit 5a0e1d473ca7aca5ffefffe9a2ec44ae7a1f35bc
5# Author: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
6# Date: Wed Feb 11 22:40:21 2009 +0100
7#
8# busybox: fix tar problem with filenames that are exactly 100 bytes
9#
10# above comment added by Kevin Tian <kevin.tian@intel.com>, 2010-07-06
11
12--- busybox-1.13.2/archival/libarchive/get_header_tar.c.orig 2008-11-09 18:28:02.000000000 +0100
13+++ busybox-1.13.2/archival/libarchive/get_header_tar.c 2009-02-11 22:34:52.000000000 +0100
14@@ -252,6 +252,8 @@
15 file_header->name = concat_path_file(tar.prefix, tar.name);
16 } else
17 file_header->name = xstrdup(tar.name);
18+ if (strlen(file_header->name) > 100)
19+ file_header->name[100] = 0;
20 }
21
22 /* Set bits 12-15 of the files mode */
diff --git a/meta/recipes-core/busybox/busybox/libarchive-open_zipped-does-not-need-to-check-extens.patch b/meta/recipes-core/busybox/busybox/libarchive-open_zipped-does-not-need-to-check-extens.patch
new file mode 100644
index 0000000000..cf914339cd
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/libarchive-open_zipped-does-not-need-to-check-extens.patch
@@ -0,0 +1,66 @@
1Upstream-status: Backport
2http://git.busybox.net/busybox/commit/?h=1_22_stable&id=28dd64a0e1a9cffcde7799f2849b66c0e16bb9cc
3
4From 28dd64a0e1a9cffcde7799f2849b66c0e16bb9cc Mon Sep 17 00:00:00 2001
5From: Denys Vlasenko <vda.linux@googlemail.com>
6Date: Fri, 10 Jan 2014 14:06:57 +0100
7Subject: [PATCH] libarchive: open_zipped() does not need to check extensions for e.g. gzip
8
9We only need to check for signature-less extensions,
10currently only .lzma. The rest can be happily autodetected.
11
12This fixes "zcat FILE_WITHOUT_GZ_EXT" case, among others.
13
14Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
15(cherry picked from commit 7c47b560a8fc97956dd8132bd7f1863d83c19866)
16Signed-off-by: Mike Frysinger <vapier@gentoo.org>
17---
18 archival/libarchive/open_transformer.c | 23 +++++++++++------------
19 1 file changed, 11 insertions(+), 12 deletions(-)
20
21diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
22index 4e98264..1aeba13 100644
23--- a/archival/libarchive/open_transformer.c
24+++ b/archival/libarchive/open_transformer.c
25@@ -182,27 +182,26 @@ int FAST_FUNC setup_unzip_on_fd(int fd, int fail_if_not_detected)
26
27 int FAST_FUNC open_zipped(const char *fname)
28 {
29- char *sfx;
30 int fd;
31
32 fd = open(fname, O_RDONLY);
33 if (fd < 0)
34 return fd;
35
36- sfx = strrchr(fname, '.');
37- if (sfx) {
38- sfx++;
39- if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
40- /* .lzma has no header/signature, just trust it */
41+ if (ENABLE_FEATURE_SEAMLESS_LZMA) {
42+ /* .lzma has no header/signature, can only detect it by extension */
43+ char *sfx = strrchr(fname, '.');
44+ if (sfx && strcmp(sfx+1, "lzma") == 0) {
45 open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma");
46- else
47- if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
48- || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
49- || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
50- ) {
51- setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
52+ return fd;
53 }
54 }
55+ if ((ENABLE_FEATURE_SEAMLESS_GZ)
56+ || (ENABLE_FEATURE_SEAMLESS_BZ2)
57+ || (ENABLE_FEATURE_SEAMLESS_XZ)
58+ ) {
59+ setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
60+ }
61
62 return fd;
63 }
64--
651.9.1
66
diff --git a/meta/recipes-core/busybox/busybox/login-utilities.cfg b/meta/recipes-core/busybox/busybox/login-utilities.cfg
new file mode 100644
index 0000000000..cc9b2db502
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/login-utilities.cfg
@@ -0,0 +1,13 @@
1CONFIG_FEATURE_SHADOWPASSWDS=y
2CONFIG_ADDUSER=y
3CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
4CONFIG_ADDGROUP=y
5CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y
6CONFIG_DELUSER=y
7CONFIG_DELGROUP=y
8CONFIG_GETTY=y
9CONFIG_LOGIN=y
10CONFIG_PASSWD=y
11CONFIG_SU=y
12CONFIG_SULOGIN=y
13CONFIG_VLOCK=y
diff --git a/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch b/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch
new file mode 100644
index 0000000000..63d49481a3
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/lzop-add-overflow-check.patch
@@ -0,0 +1,71 @@
1Upstream-status: Backport
2http://git.busybox.net/busybox/commit/?h=1_22_stable&id=5698ff93233b47218a677fd7facd8cc90211d1a4
3
4From 5698ff93233b47218a677fd7facd8cc90211d1a4 Mon Sep 17 00:00:00 2001
5From: Denys Vlasenko <vda.linux@googlemail.com>
6Date: Mon, 30 Jun 2014 10:14:34 +0200
7Subject: [PATCH] lzop: add overflow check
8
9See CVE-2014-4607
10http://www.openwall.com/lists/oss-security/2014/06/26/20
11
12function old new delta
13lzo1x_decompress_safe 1010 1031 +21
14
15Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
16Signed-off-by: Mike Frysinger <vapier@gentoo.org>
17(cherry picked from commit a9dc7c2f59dc5e92870d2d46316ea5c1f14740e3)
18---
19 archival/libarchive/liblzo.h | 2 ++
20 archival/libarchive/lzo1x_d.c | 3 +++
21 2 files changed, 5 insertions(+)
22
23diff --git a/archival/libarchive/liblzo.h b/archival/libarchive/liblzo.h
24index 843997c..4596620 100644
25--- a/archival/libarchive/liblzo.h
26+++ b/archival/libarchive/liblzo.h
27@@ -76,11 +76,13 @@
28 # define TEST_IP (ip < ip_end)
29 # define NEED_IP(x) \
30 if ((unsigned)(ip_end - ip) < (unsigned)(x)) goto input_overrun
31+# define TEST_IV(x) if ((x) > (unsigned)0 - (511)) goto input_overrun
32
33 # undef TEST_OP /* don't need both of the tests here */
34 # define TEST_OP 1
35 # define NEED_OP(x) \
36 if ((unsigned)(op_end - op) < (unsigned)(x)) goto output_overrun
37+# define TEST_OV(x) if ((x) > (unsigned)0 - (511)) goto output_overrun
38
39 #define HAVE_ANY_OP 1
40
41diff --git a/archival/libarchive/lzo1x_d.c b/archival/libarchive/lzo1x_d.c
42index 9bc1270..40b167e 100644
43--- a/archival/libarchive/lzo1x_d.c
44+++ b/archival/libarchive/lzo1x_d.c
45@@ -92,6 +92,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
46 ip++;
47 NEED_IP(1);
48 }
49+ TEST_IV(t);
50 t += 15 + *ip++;
51 }
52 /* copy literals */
53@@ -224,6 +225,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
54 ip++;
55 NEED_IP(1);
56 }
57+ TEST_IV(t);
58 t += 31 + *ip++;
59 }
60 #if defined(COPY_DICT)
61@@ -265,6 +267,7 @@ int lzo1x_decompress_safe(const uint8_t* in, unsigned in_len,
62 ip++;
63 NEED_IP(1);
64 }
65+ TEST_IV(t);
66 t += 7 + *ip++;
67 }
68 #if defined(COPY_DICT)
69--
701.9.1
71
diff --git a/meta/recipes-core/busybox/busybox/recognize_connmand.patch b/meta/recipes-core/busybox/busybox/recognize_connmand.patch
new file mode 100644
index 0000000000..f42c74caad
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/recognize_connmand.patch
@@ -0,0 +1,21 @@
1This adds connmand to the list of know dhcp clients
2
3Upstream-Status: Inappropriate [OE-Core]
4
5Signed-off-by: Saul Wold <sgw@linux.intel.com>
6
7Index: busybox-1.22.1/networking/ifupdown.c
8===================================================================
9--- busybox-1.22.1.orig/networking/ifupdown.c
10+++ busybox-1.22.1/networking/ifupdown.c
11@@ -521,6 +521,10 @@ struct dhcp_client_t {
12 };
13
14 static const struct dhcp_client_t ext_dhcp_clients[] = {
15+ { "connmand",
16+ "true",
17+ "true",
18+ },
19 { "dhcpcd",
20 "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %client%]][[ -l %leasetime%]] %iface%",
21 "dhcpcd -k %iface%",
diff --git a/meta/recipes-core/busybox/busybox/unbreak_noncompressed_tar.patch b/meta/recipes-core/busybox/busybox/unbreak_noncompressed_tar.patch
new file mode 100644
index 0000000000..3c3c23a54a
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/unbreak_noncompressed_tar.patch
@@ -0,0 +1,23 @@
1
2This patch allows tar to continue correctly when it does not detect
3a compressed format. This allows tar to then untar a non-compressed
4tar file.
5
6See this thread for details: http://lists.busybox.net/pipermail/busybox/2014-January/080389.html
7
8Upstream-Status: Inappropriate [Upstream has different fix with additional functionality]
9Signed-off-by: Saul Wold <sgw@linux.intel.com>
10
11Index: busybox-1.22.1/archival/libarchive/open_transformer.c
12===================================================================
13--- busybox-1.22.1.orig/archival/libarchive/open_transformer.c
14+++ busybox-1.22.1/archival/libarchive/open_transformer.c
15@@ -200,7 +200,7 @@ int FAST_FUNC open_zipped(const char *fn
16 || (ENABLE_FEATURE_SEAMLESS_BZ2)
17 || (ENABLE_FEATURE_SEAMLESS_XZ)
18 ) {
19- setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
20+ setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 0);
21 }
22
23 return fd;
diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.22.1.bb
new file mode 100644
index 0000000000..1b1eaf35ac
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
@@ -0,0 +1,50 @@
1require busybox.inc
2
3PR = "r32"
4
5SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
6 file://get_header_tar.patch \
7 file://busybox-appletlib-dependency.patch \
8 file://busybox-udhcpc-no_deconfig.patch \
9 file://find-touchscreen.sh \
10 file://busybox-cron \
11 file://busybox-httpd \
12 file://busybox-udhcpd \
13 file://default.script \
14 file://simple.script \
15 file://hwclock.sh \
16 file://mount.busybox \
17 file://syslog \
18 file://syslog-startup.conf \
19 file://syslog.conf \
20 file://busybox-syslog.default \
21 file://mdev \
22 file://mdev.conf \
23 file://umount.busybox \
24 file://defconfig \
25 file://busybox-syslog.service.in \
26 file://busybox-klogd.service.in \
27 file://fail_on_no_media.patch \
28 file://run-ptest \
29 file://inetd.conf \
30 file://inetd \
31 file://login-utilities.cfg \
32 file://0001-build-system-Specify-nostldlib-when-linking-to-.o-fi.patch \
33 file://recognize_connmand.patch \
34 file://busybox-cross-menuconfig.patch \
35 file://CVE-2014-9645_busybox_reject_module_names_with_slashes.patch \
36 file://lzop-add-overflow-check.patch \
37 file://libarchive-open_zipped-does-not-need-to-check-extens.patch \
38 file://unbreak_noncompressed_tar.patch \
39"
40
41SRC_URI[tarball.md5sum] = "337d1a15ab1cb1d4ed423168b1eb7d7e"
42SRC_URI[tarball.sha256sum] = "ae0b029d0a9e4dd71a077a790840e496dd838998e4571b87b60fed7462b6678b"
43
44EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
45
46do_install_ptest () {
47 cp -r ${B}/testsuite ${D}${PTEST_PATH}/
48 cp ${B}/.config ${D}${PTEST_PATH}/
49 ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
50}
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
new file mode 100644
index 0000000000..f2cc119400
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox_git.bb
@@ -0,0 +1,46 @@
1require busybox.inc
2
3SRCREV = "d9e0c438e10e2155513e5d26498af472c5137d65"
4# Lookout for PV bump too when SRCREV is changed
5PV = "1.22.1+git${SRCPV}"
6
7S = "${WORKDIR}/git"
8
9SRC_URI = "git://busybox.net/busybox.git \
10 file://get_header_tar.patch \
11 file://busybox-appletlib-dependency.patch \
12 file://busybox-udhcpc-no_deconfig.patch \
13 file://find-touchscreen.sh \
14 file://busybox-cron \
15 file://busybox-httpd \
16 file://busybox-udhcpd \
17 file://default.script \
18 file://simple.script \
19 file://hwclock.sh \
20 file://mount.busybox \
21 file://syslog \
22 file://syslog-startup.conf \
23 file://syslog.conf \
24 file://busybox-syslog.default \
25 file://mdev \
26 file://mdev.conf \
27 file://umount.busybox \
28 file://defconfig \
29 file://busybox-syslog.service.in \
30 file://busybox-klogd.service.in \
31 file://fail_on_no_media.patch \
32 file://run-ptest \
33 file://inetd.conf \
34 file://inetd \
35 file://login-utilities.cfg \
36"
37
38EXTRA_OEMAKE += "V=1 ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} SKIP_STRIP=y"
39
40do_install_ptest () {
41 cp -r ${B}/testsuite ${D}${PTEST_PATH}/
42 cp ${B}/.config ${D}${PTEST_PATH}/
43 ln -s /bin/busybox ${D}${PTEST_PATH}/busybox
44}
45
46DEFAULT_PREFERENCE = "-1"
diff --git a/meta/recipes-core/busybox/files/busybox-cron b/meta/recipes-core/busybox/files/busybox-cron
new file mode 100755
index 0000000000..f0e6b15629
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-cron
@@ -0,0 +1,39 @@
1#!/bin/sh
2DAEMON=/usr/sbin/crond
3NAME=crond
4DESC="Busybox Periodic Command Scheduler"
5ARGS="-c /etc/cron/crontabs"
6
7test -f $DAEMON || exit 0
8
9set -e
10
11case "$1" in
12 start)
13 echo -n "starting $DESC: $NAME... "
14 start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
15 echo "done."
16 ;;
17 stop)
18 echo -n "stopping $DESC: $NAME... "
19 start-stop-daemon -K -n $NAME
20 echo "done."
21 ;;
22 restart)
23 echo -n "restarting $DESC: $NAME... "
24 $0 stop
25 $0 start
26 echo "done."
27 ;;
28 reload)
29 echo -n "reloading $DESC: $NAME... "
30 killall -HUP $(basename ${DAEMON})
31 echo "done."
32 ;;
33 *)
34 echo "Usage: $0 {start|stop|restart|reload}"
35 exit 1
36 ;;
37esac
38
39exit 0
diff --git a/meta/recipes-core/busybox/files/busybox-httpd b/meta/recipes-core/busybox/files/busybox-httpd
new file mode 100755
index 0000000000..c8348e54a7
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-httpd
@@ -0,0 +1,44 @@
1#!/bin/sh
2DAEMON=/usr/sbin/httpd
3NAME=httpd
4DESC="Busybox HTTP Daemon"
5HTTPROOT="/srv/www"
6ARGS="-h $HTTPROOT"
7
8test -f $DAEMON || exit 0
9
10set -e
11
12case "$1" in
13 start)
14 echo -n "starting $DESC: $NAME... "
15 if [ ! -d $HTTPROOT ]; then
16 echo "$HTTPROOT is missing."
17 exit 1
18 fi
19 start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
20 echo "done."
21 ;;
22 stop)
23 echo -n "stopping $DESC: $NAME... "
24 start-stop-daemon -K -n $NAME
25 echo "done."
26 ;;
27 restart)
28 echo "restarting $DESC: $NAME... "
29 $0 stop
30 $0 start
31 echo "done."
32 ;;
33 reload)
34 echo -n "reloading $DESC: $NAME... "
35 killall -HUP $(basename ${DAEMON})
36 echo "done."
37 ;;
38 *)
39 echo "Usage: $0 {start|stop|restart|reload}"
40 exit 1
41 ;;
42esac
43
44exit 0
diff --git a/meta/recipes-core/busybox/files/busybox-klogd.service.in b/meta/recipes-core/busybox/files/busybox-klogd.service.in
new file mode 100644
index 0000000000..d7c77558f3
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-klogd.service.in
@@ -0,0 +1,8 @@
1[Unit]
2Description=Kernel Logging Service
3
4[Service]
5ExecStart=@base_sbindir@/klogd -n
6
7[Install]
8WantedBy=multi-user.target
diff --git a/meta/recipes-core/busybox/files/busybox-syslog.default b/meta/recipes-core/busybox/files/busybox-syslog.default
new file mode 100644
index 0000000000..e516caf518
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-syslog.default
@@ -0,0 +1,25 @@
1OPTIONS="-C"
2# The above option means syslogd will log to 16K shm circular buffer.
3# You could use `logread' to read it.
4
5# All available options are:
6# -O FILE : Log to FILE (default:/var/log/messages)
7# -l N : Log only messages more urgent than prio N (1-8)
8# -S : Smaller output
9# -s SIZE : Max size (KB) before rotation (default:200KB, 0=off)
10# -b N : N rotated logs to keep (default:1, max=99, 0=purge)
11# -R HOST[:PORT]: Log to HOST:PORT (default PORT:514)
12# -L : Log locally and via network
13# -D : Drop duplicates
14# -C[size_kb] : Log to shared mem buffer (use logread to read it)
15# -f FILE : Use FILE as config (default:/etc/syslog.conf)
16# -m MIN : Minutes between mark lines (default:20, 0=off)
17# -K : Log to kernel printk buffer (use dmesg to read it)
18
19# Example 1:
20# Log to local file /var/log/mylog
21# OPTIONS="-O /var/log/mylog"
22#
23# Example 2:
24# Log to remote host
25# OPTIONS="-R 192.168.1.1:601"
diff --git a/meta/recipes-core/busybox/files/busybox-syslog.service.in b/meta/recipes-core/busybox/files/busybox-syslog.service.in
new file mode 100644
index 0000000000..2e04321385
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-syslog.service.in
@@ -0,0 +1,13 @@
1[Unit]
2Description=System Logging Service
3Wants=busybox-klogd.service
4
5[Service]
6EnvironmentFile=-/etc/default/busybox-syslog
7ExecStart=@base_sbindir@/syslogd -n $OPTIONS
8Sockets=syslog.socket
9
10[Install]
11WantedBy=multi-user.target
12Also=busybox-klogd.service
13Alias=syslog.service
diff --git a/meta/recipes-core/busybox/files/busybox-udhcpd b/meta/recipes-core/busybox/files/busybox-udhcpd
new file mode 100755
index 0000000000..c43903e8dc
--- /dev/null
+++ b/meta/recipes-core/busybox/files/busybox-udhcpd
@@ -0,0 +1,43 @@
1#!/bin/sh
2DAEMON=/usr/sbin/udhcpd
3NAME=udhcpd
4DESC="Busybox UDHCP Server"
5ARGS="/etc/udhcpd.conf"
6
7test -f $DAEMON || exit 1
8
9set -e
10
11case "$1" in
12 start)
13 echo -n "starting $DESC: $NAME... "
14 if [ ! -f /etc/udhcpd.conf ]; then
15 echo "error: /etc/udhcpd.conf is missing."
16 exit 1
17 fi
18 /sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
19 echo "done."
20 ;;
21 stop)
22 echo -n "stopping $DESC: $NAME... "
23 /sbin/start-stop-daemon -K -n $NAME
24 echo "done."
25 ;;
26 restart)
27 echo "restarting $DESC: $NAME... "
28 $0 stop
29 $0 start
30 echo "done."
31 ;;
32 reload)
33 echo -n "reloading $DESC: $NAME... "
34 killall -HUP $(basename ${DAEMON})
35 echo "done."
36 ;;
37 *)
38 echo "Usage: $0 {start|stop|restart|reload}"
39 exit 1
40 ;;
41esac
42
43exit 0
diff --git a/meta/recipes-core/busybox/files/default.script b/meta/recipes-core/busybox/files/default.script
new file mode 100644
index 0000000000..f2ac987a27
--- /dev/null
+++ b/meta/recipes-core/busybox/files/default.script
@@ -0,0 +1,4 @@
1#!/bin/sh
2
3exec run-parts -a "$1" /etc/udhcpc.d
4
diff --git a/meta/recipes-core/busybox/files/find-touchscreen.sh b/meta/recipes-core/busybox/files/find-touchscreen.sh
new file mode 100644
index 0000000000..1582ea891c
--- /dev/null
+++ b/meta/recipes-core/busybox/files/find-touchscreen.sh
@@ -0,0 +1,9 @@
1#!/bin/sh
2
3if [ `egrep "input:.*-e0.*,3,.*a0,1,.*18,.*" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
4 ln -sf /dev/input/$MDEV /dev/input/touchscreen0
5fi
6
7if [ `egrep "ads7846" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
8 ln -sf /dev/input/$MDEV /dev/input/touchscreen0
9fi
diff --git a/meta/recipes-core/busybox/files/hwclock.sh b/meta/recipes-core/busybox/files/hwclock.sh
new file mode 100644
index 0000000000..be5f94d86c
--- /dev/null
+++ b/meta/recipes-core/busybox/files/hwclock.sh
@@ -0,0 +1,83 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: hwclock
4# Required-Start:
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Set system clock
9# Description: Set system clock to hardware clock, according to the UTC
10# setting in /etc/default/rcS (see also rcS(5)).
11### END INIT INFO
12#
13# WARNING: If your hardware clock is not in UTC/GMT, this script
14# must know the local time zone. This information is
15# stored in /etc/localtime. This might be a problem if
16# your /etc/localtime is a symlink to something in
17# /usr/share/zoneinfo AND /usr isn't in the root
18# partition! The workaround is to define TZ either
19# in /etc/default/rcS, or in the proper place below.
20
21[ ! -x /sbin/hwclock ] && exit 0
22
23[ -f /etc/default/rcS ] && . /etc/default/rcS
24
25[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
26case "$1" in
27 start)
28 if [ "$VERBOSE" != no ]
29 then
30 echo "System time was `date`."
31 echo "Setting the System Clock using the Hardware Clock as reference..."
32 fi
33
34 if [ "$HWCLOCKACCESS" != no ]
35 then
36 if [ -z "$TZ" ]
37 then
38 hwclock $tz --hctosys
39 else
40 TZ="$TZ" hwclock $tz --hctosys
41 fi
42 fi
43
44 if [ "$VERBOSE" != no ]
45 then
46 echo "System Clock set. System local time is now `date`."
47 fi
48 ;;
49 stop|restart|reload|force-reload)
50 #
51 # Updates the Hardware Clock with the System Clock time.
52 # This will *override* any changes made to the Hardware Clock.
53 #
54 # WARNING: If you disable this, any changes to the system
55 # clock will not be carried across reboots.
56 #
57 if [ "$VERBOSE" != no ]
58 then
59 echo "Saving the System Clock time to the Hardware Clock..."
60 fi
61 if [ "$HWCLOCKACCESS" != no ]
62 then
63 hwclock $tz --systohc
64 fi
65 if [ "$VERBOSE" != no ]
66 then
67 echo "Hardware Clock updated to `date`."
68 fi
69 exit 0
70 ;;
71 show)
72 if [ "$HWCLOCKACCESS" != no ]
73 then
74 hwclock $tz --show
75 fi
76 ;;
77 *)
78 echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
79 echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
80 echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
81 exit 1
82 ;;
83esac
diff --git a/meta/recipes-core/busybox/files/inetd b/meta/recipes-core/busybox/files/inetd
new file mode 100644
index 0000000000..cf50bcd546
--- /dev/null
+++ b/meta/recipes-core/busybox/files/inetd
@@ -0,0 +1,33 @@
1#!/bin/sh
2#
3# start/stop inetd super server.
4
5if ! [ -x /usr/sbin/inetd ]; then
6 exit 0
7fi
8
9case "$1" in
10 start)
11 echo -n "Starting internet superserver:"
12 echo -n " inetd" ; start-stop-daemon -S -x /usr/sbin/inetd > /dev/null
13 echo "."
14 ;;
15 stop)
16 echo -n "Stopping internet superserver:"
17 echo -n " inetd" ; start-stop-daemon -K -x /usr/sbin/inetd > /dev/null
18 echo "."
19 ;;
20 restart)
21 echo -n "Restarting internet superserver:"
22 echo -n " inetd "
23 killall -HUP inetd
24 echo "."
25 ;;
26 *)
27 echo "Usage: /etc/init.d/inetd {start|stop|restart}"
28 exit 1
29 ;;
30esac
31
32exit 0
33
diff --git a/meta/recipes-core/busybox/files/inetd.conf b/meta/recipes-core/busybox/files/inetd.conf
new file mode 100644
index 0000000000..b02fe850c9
--- /dev/null
+++ b/meta/recipes-core/busybox/files/inetd.conf
@@ -0,0 +1,20 @@
1# /etc/inetd.conf: see inetd(8) for further informations.
2#
3# Internet server configuration database
4#
5# If you want to disable an entry so it isn't touched during
6# package updates just comment it out with a single '#' character.
7#
8# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
9#
10#:INTERNAL: Internal services
11#echo stream tcp nowait root internal
12#echo dgram udp wait root internal
13#chargen stream tcp nowait root internal
14#chargen dgram udp wait root internal
15#discard stream tcp nowait root internal
16#discard dgram udp wait root internal
17#daytime stream tcp nowait root internal
18#daytime dgram udp wait root internal
19#time stream tcp nowait root internal
20#time dgram udp wait root internal
diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
new file mode 100755
index 0000000000..96252477e0
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mdev
@@ -0,0 +1,19 @@
1#!/bin/sh
2
3mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
4mkdir /dev/pts /dev/shm
5chmod 777 /dev/shm
6mount -t devpts devpts /dev/pts
7touch /dev/mdev.seq
8echo "/sbin/mdev" > /proc/sys/kernel/hotplug
9mdev -s
10
11#
12# We might have mounted something over /dev, see if /dev/initctl is there.
13#
14if test ! -p /dev/initctl
15then
16 rm -f /dev/initctl
17 mknod -m 600 /dev/initctl p
18fi
19
diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
new file mode 100644
index 0000000000..e688911ff1
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -0,0 +1,37 @@
1console 0:0 0600
2cpu_dma_latency 0:0 0660
3fb0:0 44 0660
4full 0:0 0666
5initctl 0:0 0600
6ircomm[0-9].* 0:20 0660
7kmem 0:15 0640
8kmsg 0:0 0660
9log 0:0 0666
10loop[0-9].* 0:6 0640
11mem 0:15 0640
12network_latency 0:0 0660
13network_throughput 0:0 0660
14null 0:0 0666
15port 0:15 0640
16ptmx 0:5 0666
17ram[0-9].* 0:6 0640
18random 0:0 0666
19sda 0:6 0640
20tty 0:5 0666
21tty.* 0:0 0620
22urandom 0:0 0666
23usbdev.* 0:0 0660 */etc/mdev/usb.sh
24vcs.* 0:5 0660
25zero 0:0 0666
26
27snd/pcm.* 0:0 0660
28snd/control.* 0:0 0660
29snd/timer 0:0 0660
30snd/seq 0:0 0660
31snd/mini.* 0:00 0660
32
33input/event.* 0:0 0660 @/etc/mdev/find-touchscreen.sh
34input/mice 0:0 0660
35input/mouse.* 0:0 0660
36
37tun[0-9]* 0:0 0660 =net/
diff --git a/meta/recipes-core/busybox/files/mount.busybox b/meta/recipes-core/busybox/files/mount.busybox
new file mode 100755
index 0000000000..fef945b7b2
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mount.busybox
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3exec /bin/busybox mount $@
diff --git a/meta/recipes-core/busybox/files/run-ptest b/meta/recipes-core/busybox/files/run-ptest
new file mode 100644
index 0000000000..3608a8eb65
--- /dev/null
+++ b/meta/recipes-core/busybox/files/run-ptest
@@ -0,0 +1,7 @@
1#!/bin/sh
2
3current_dir=$(readlink -f $0)
4export bindir=$(dirname $current_dir)
5
6cd testsuite || exit 1
7./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
new file mode 100644
index 0000000000..757e487b97
--- /dev/null
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -0,0 +1,88 @@
1#!/bin/sh
2
3# udhcpc script edited by Tim Riker <Tim@Rikers.org>
4
5[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
6
7RESOLV_CONF="/etc/resolv.conf"
8[ -n "$subnet" ] && NETMASK="netmask $subnet"
9
10# return 0 if root is mounted on a network filesystem
11root_is_nfs() {
12 sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
13 grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
14}
15
16have_bin_ip=0
17if [ -x /sbin/ip ]; then
18 have_bin_ip=1
19 BROADCAST="broadcast +"
20fi
21
22[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
23
24case "$1" in
25 deconfig)
26 if [ -x /sbin/resolvconf ]; then
27 /sbin/resolvconf -d "${interface}.udhcpc"
28 fi
29 if ! root_is_nfs ; then
30 if [ $have_bin_ip -eq 1 ]; then
31 ip addr flush dev $interface
32 ip link set dev $interface up
33 else
34 /sbin/ifconfig $interface 0.0.0.0
35 fi
36 fi
37 ;;
38
39 renew|bound)
40 if [ $have_bin_ip -eq 1 ]; then
41 ip addr add dev $interface local $ip/$mask $BROADCAST
42 else
43 /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
44 fi
45
46 if [ -n "$router" ] ; then
47 if ! root_is_nfs ; then
48 if [ $have_bin_ip -eq 1 ]; then
49 while ip route del default 2>/dev/null ; do
50 :
51 done
52 else
53 while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
54 :
55 done
56 fi
57 fi
58
59 metric=0
60 for i in $router ; do
61 if [ $have_bin_ip -eq 1 ]; then
62 ip route add default via $i metric $metric
63 else
64 route add default gw $i dev $interface metric $metric 2>/dev/null
65 fi
66 metric=$(($metric + 1))
67 done
68 fi
69
70 # Update resolver configuration file
71 R=""
72 [ -n "$domain" ] && R="domain $domain
73"
74 for i in $dns; do
75 echo "$0: Adding DNS $i"
76 R="${R}nameserver $i
77"
78 done
79
80 if [ -x /sbin/resolvconf ]; then
81 echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
82 else
83 echo -n "$R" > "$RESOLV_CONF"
84 fi
85 ;;
86esac
87
88exit 0
diff --git a/meta/recipes-core/busybox/files/syslog b/meta/recipes-core/busybox/files/syslog
new file mode 100644
index 0000000000..89c4d12e9c
--- /dev/null
+++ b/meta/recipes-core/busybox/files/syslog
@@ -0,0 +1,77 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: sysklogd
4# Required-Start: $remote_fs $time
5# Required-Stop: $remote_fs $time
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: System logger
9### END INIT INFO
10
11set -e
12
13if [ -f /etc/syslog-startup.conf ]; then
14 . /etc/syslog-startup.conf
15 LOG_LOCAL=0
16 LOG_REMOTE=0
17 for D in $DESTINATION; do
18 if [ "$D" = "buffer" ]; then
19 SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
20 LOG_LOCAL=1
21 elif [ "$D" = "file" ]; then
22 if [ -n "$LOGFILE" ]; then
23 SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
24 fi
25 if [ -n "$ROTATESIZE" ]; then
26 SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
27 fi
28 if [ -n "$ROTATEGENS" ]; then
29 SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
30 fi
31 LOG_LOCAL=1
32 elif [ "$D" = "remote" ]; then
33 SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
34 LOG_REMOTE=1
35 fi
36 done
37 if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
38 SYSLOG_ARGS="$SYSLOG_ARGS -L"
39 fi
40 if [ "$REDUCE" = "yes" ]; then
41 SYSLOG_ARGS="$SYSLOG_ARGS -S"
42 fi
43 if [ "$DROPDUPLICATES" = "yes" ]; then
44 SYSLOG_ARGS="$SYSLOG_ARGS -D"
45 fi
46 if [ -n "$LOGLEVEL" ]; then
47 SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
48 fi
49else
50 # default: log to 16K shm circular buffer
51 SYSLOG_ARGS="-C"
52fi
53
54case "$1" in
55 start)
56 echo -n "Starting syslogd/klogd: "
57 start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
58 start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
59 echo "done"
60 ;;
61 stop)
62 echo -n "Stopping syslogd/klogd: "
63 start-stop-daemon -K -n syslogd
64 start-stop-daemon -K -n klogd
65 echo "done"
66 ;;
67 restart)
68 $0 stop
69 $0 start
70 ;;
71 *)
72 echo "Usage: syslog { start | stop | restart }" >&2
73 exit 1
74 ;;
75esac
76
77exit 0
diff --git a/meta/recipes-core/busybox/files/syslog-startup.conf b/meta/recipes-core/busybox/files/syslog-startup.conf
new file mode 100644
index 0000000000..fda450aa0d
--- /dev/null
+++ b/meta/recipes-core/busybox/files/syslog-startup.conf
@@ -0,0 +1,13 @@
1# This configuration file is used by the busybox syslog init script,
2# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
3
4DESTINATION=file # log destinations (buffer file remote)
5LOGFILE=/var/log/messages # where to log (file)
6REMOTE=loghost:514 # where to log (syslog remote)
7REDUCE=no # reduce-size logging
8DROPDUPLICATES=no # whether to drop duplicate log entries
9#ROTATESIZE=0 # rotate log if grown beyond X [kByte]
10#ROTATEGENS=3 # keep X generations of rotated logs
11BUFFERSIZE=64 # size of circular buffer [kByte]
12FOREGROUND=no # run in foreground (don't use!)
13#LOGLEVEL=5 # local log level (between 1 and 8)
diff --git a/meta/recipes-core/busybox/files/syslog.conf b/meta/recipes-core/busybox/files/syslog.conf
new file mode 100644
index 0000000000..75bb6309ab
--- /dev/null
+++ b/meta/recipes-core/busybox/files/syslog.conf
@@ -0,0 +1 @@
# /etc/syslog.conf Configuration file for busybox's syslogd utility
diff --git a/meta/recipes-core/busybox/files/umount.busybox b/meta/recipes-core/busybox/files/umount.busybox
new file mode 100755
index 0000000000..f3731626e6
--- /dev/null
+++ b/meta/recipes-core/busybox/files/umount.busybox
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3exec /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
new file mode 100644
index 0000000000..32692ab4b9
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/Makevars
@@ -0,0 +1,41 @@
1# Makefile variables for PO directory in any package using GNU gettext.
2
3# Usually the message domain is the same as the package name.
4DOMAIN = $(PACKAGE)
5
6# These two variables depend on the location of this directory.
7subdir = po
8top_builddir = ..
9
10# These options get passed to xgettext.
11XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
12
13# This is the copyright holder that gets inserted into the header of the
14# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
15# package. (Note that the msgstr strings, extracted from the package's
16# sources, belong to the copyright holder of the package.) Translators are
17# expected to transfer the copyright for their translations to this person
18# or entity, or to disclaim their copyright. The empty string stands for
19# the public domain; in this case the translators are expected to disclaim
20# their copyright.
21COPYRIGHT_HOLDER = Free Software Foundation, Inc.
22
23# This is the email address or URL to which the translators shall report
24# bugs in the untranslated strings:
25# - Strings which are not entire sentences, see the maintainer guidelines
26# in the GNU gettext documentation, section 'Preparing Strings'.
27# - Strings which use unclear terms or require additional context to be
28# understood.
29# - Strings which make invalid assumptions about notation of date, time or
30# money.
31# - Pluralisation problems.
32# - Incorrect English spelling.
33# - Incorrect formatting.
34# It can be your email address, or a mailing list address where translators
35# can write to without being subscribed, or the URL of a web page through
36# which the translators can contact you.
37MSGID_BUGS_ADDRESS =
38
39# This is the list of locale categories, beyond LC_MESSAGES, for which the
40# message catalogs shall be used. It is usually empty.
41EXTRA_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
new file mode 100644
index 0000000000..c287014767
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/codepage.patch
@@ -0,0 +1,17 @@
1Upstream-Status: Pending
2
3#
4# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
5#
6
7--- console-tools-0.3.2/contrib/codepage.c~codepage
8+++ console-tools-0.3.2/contrib/codepage.c
9@@ -229,7 +229,7 @@
10 return 0;
11
12 fprintf(stderr, "\
13-Warning: CP format is a hack!\n
14+Warning: CP format is a hack!\n\
15 The files produced may or may not be usable!\n");
16
17 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
new file mode 100644
index 0000000000..c93f511950
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/compile.patch
@@ -0,0 +1,12 @@
1Upstream-Status: Pending
2
3--- console-tools-0.3.2/kbdtools/showkey.c~compile 1999-08-25 17:20:08.000000000 -0400
4+++ console-tools-0.3.2/kbdtools/showkey.c 2004-05-09 03:03:23.000000000 -0400
5@@ -264,7 +264,6 @@
6 break;
7 case cmd_keymap:
8 printf(")\n");
9- default:
10 }
11 }
12
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
new file mode 100644
index 0000000000..15c100c908
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/configure.patch
@@ -0,0 +1,29 @@
1Upstream-Status: Pending
2
3--- console-tools-0.3.2/configure.in~configure
4+++ console-tools-0.3.2/configure.in
5@@ -2,13 +2,14 @@
6 dnl Process this file with autoconf to produce a configure script.
7
8 # Initialize
9-AC_INIT(kbdtools/loadkeys.y)
10+AC_INIT
11+AC_CONFIG_SRCDIR([kbdtools/loadkeys.y])
12
13 define(ct_unicodedata_default,/usr/share/unidata/UnicodeData-2.txt)
14 ct_localdatadir_default=/usr/local/share # iff --enable-localdatadir without specific dir
15
16 #AC_CONFIG_AUX_DIR(autoconf)
17-AC_CANONICAL_SYSTEM
18+AC_CANONICAL_TARGET([])
19 AM_INIT_AUTOMAKE(console-tools, 0.3.2)
20
21 # Defaults
22@@ -25,7 +26,6 @@
23 # i18n stuff
24 ALL_LINGUAS="cs de ru ga fr"
25 AM_GNU_GETTEXT
26-AC_OUTPUT_COMMANDS([sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
27
28 AC_DEFINE_UNQUOTED(LOCALEDIR, "/usr/share/locale")
29
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
new file mode 100644
index 0000000000..be61eb846b
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/fix-libconsole-linking.patch
@@ -0,0 +1,56 @@
1Fix the following error detected with i586-pokymllib32-linux-gcc (the
2multilib x86-64 lib32 compiler):
3 ../lib/ctutils/.libs/libctutils.so: undefined reference to `get_kernel_sfm'
4 collect2: error: ld returned 1 exit status
5
6It seems that libctutils.so (the library that uses get_kernel_sfm) must
7be stated before libconsole.so (the library that exports the function) when
8using multilib gcc
9
10Upstream-Status: Pending
11Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
12
13Index: console-tools-0.3.2/fontfiletools/Makefile.am
14===================================================================
15--- console-tools-0.3.2.orig/fontfiletools/Makefile.am
16+++ console-tools-0.3.2/fontfiletools/Makefile.am
17@@ -10,5 +10,5 @@ EXTRA_DIST = fonts2virfont.c virfont.h
18
19 # libconsole is needed by ctutils
20 LDADD = ../lib/ctlocal/libctlocal.a ../lib/cfont/libcfont.la \
21- ../lib/console/libconsole.la \
22- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
23+ ../lib/ctutils/libctutils.la \
24+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
25Index: console-tools-0.3.2/vttools/Makefile.am
26===================================================================
27--- console-tools-0.3.2.orig/vttools/Makefile.am
28+++ console-tools-0.3.2/vttools/Makefile.am
29@@ -7,9 +7,9 @@ bin_PROGRAMS = chvt deallocvt writevt fg
30 vcstime vt-is-UTF8 openvt @RESIZECONS@
31 EXTRA_PROGRAMS = resizecons
32
33-LDADD = ../lib/ctlocal/libctlocal.a ../lib/console/libconsole.la \
34+LDADD = ../lib/ctlocal/libctlocal.a ../lib/ctutils/libctutils.la \
35 ../lib/cfont/libcfont.la \
36- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
37+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
38
39 vcstime_LDADD = ../lib/ctlocal/libctlocal.a
40 screendump_LDADD = ../lib/ctlocal/libctlocal.a
41Index: console-tools-0.3.2/kbdtools/Makefile.am
42===================================================================
43--- console-tools-0.3.2.orig/kbdtools/Makefile.am
44+++ console-tools-0.3.2/kbdtools/Makefile.am
45@@ -15,9 +15,9 @@ EXTRA_PROGRAMS = getkeycodes setkeycodes
46 loadkeys_SOURCES = loadkeys.y analyze.l
47
48 YFLAGS = -d
49-LDADD = ../lib/ctlocal/libctlocal.a ../lib/console/libconsole.la \
50+LDADD = ../lib/ctlocal/libctlocal.a ../lib/ctutils/libctutils.la \
51 ../lib/cfont/libcfont.la \
52- ../lib/ctutils/libctutils.la ../lib/generic/libctgeneric.la
53+ ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
54
55 loadkeys_LDADD = $(LDADD) @LEXLIB@
56
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
new file mode 100644
index 0000000000..f370be8592
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/kbdrate.patch
@@ -0,0 +1,75 @@
1Patch from Matthias Goebl <oe@m.goebl.net>
2Added via OE bugtracker: bug #478
3
4Upstream-Status: Pending
5
6--- console-tools-0.3.2/kbdtools/kbd_mode.c.orig
7+++ console-tools-0.3.2/kbdtools/kbd_mode.c
8@@ -29,11 +29,16 @@
9 OPT("-u --unicode ", _("UTF-8 mode (UNICODE)"));
10 OPT("-s --scancode ", _("scancode mode (RAW)"));
11 OPT(" --mode={8bit,keycode,unicode,scancode} ", _("set mode"));
12+ OPT("-r --rate=RATE ", _("set repeat rate (default: 33)"));
13+ OPT("-d --delay=DELAY ", _("set repeat delay (default: 250)"));
14
15 OPT("-h --help ", HELPDESC);
16 OPT("-V --version ", VERSIONDESC);
17 }
18
19+int rate=-1;
20+int delay=-1;
21+
22 static int parse_cmdline (int argc, char *argv[])
23 {
24 int mode = -1;
25@@ -46,11 +51,13 @@
26 { "mode" , required_argument, NULL, 'm' },
27 { "scancode" , no_argument, NULL, 's' },
28 { "unicode" , no_argument, NULL, 'u' },
29+ { "rate" , required_argument, NULL, 'r' },
30+ { "delay" , required_argument, NULL, 'd' },
31 { NULL, 0, NULL, 0 }
32 };
33 int c;
34
35- while ( (c = getopt_long (argc, argv, "Vhaksu", long_opts, NULL)) != EOF)
36+ while ( (c = getopt_long (argc, argv, "Vhaksur:d:", long_opts, NULL)) != EOF)
37 switch (c) {
38 case 'h':
39 usage ();
40@@ -58,6 +65,14 @@
41 case 'V':
42 version ();
43 exit(0);
44+ case 'r':
45+ rate = atoi(optarg);
46+ mode = -2;
47+ break;
48+ case 'd':
49+ delay = atoi(optarg);
50+ mode = -2;
51+ break;
52 case 'a':
53 mode = K_XLATE;
54 break;
55@@ -129,6 +144,20 @@
56 exit(0);
57 }
58
59+ if ( rate != -1 || delay != -1 )
60+ {
61+ struct kbd_repeat kbd_rep;
62+ kbd_rep.delay = delay;
63+ kbd_rep.period = rate;
64+ if (ioctl(fd, KDKBDREP, &kbd_rep))
65+ {
66+ fprintf(stderr, progname);
67+ perror(_(": error setting keyboard repeat mode\n"));
68+ exit(1);
69+ }
70+ if(mode==-2) exit(0);
71+ }
72+
73 if (ioctl(fd, KDSKBMODE, mode))
74 {
75 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
new file mode 100644
index 0000000000..18d47a94f7
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/lcmessage.m4
@@ -0,0 +1,24 @@
1# Check whether LC_MESSAGES is available in <locale.h>.
2# Ulrich Drepper <drepper@cygnus.com>, 1995.
3#
4# This file can be copied and used freely without restrictions. It can
5# be used in projects which are not available under the GNU General Public
6# License or the GNU Library General Public License but which still want
7# to provide support for the GNU gettext functionality.
8# Please note that the actual code of the GNU gettext library is covered
9# by the GNU Library General Public License, and the rest of the GNU
10# gettext package package is covered by the GNU General Public License.
11# They are *not* in the public domain.
12
13# serial 2
14
15AC_DEFUN([AM_LC_MESSAGES],
16 [if test $ac_cv_header_locale_h = yes; then
17 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
18 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
19 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
20 if test $am_cv_val_LC_MESSAGES = yes; then
21 AC_DEFINE(HAVE_LC_MESSAGES, 1,
22 [Define if your <locale.h> file defines LC_MESSAGES.])
23 fi
24 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
new file mode 100644
index 0000000000..a6735a53ff
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/no-dep-on-libfl.patch
@@ -0,0 +1,19 @@
1No reason to link with libfl since 'loadkeys' implements
2its own yywrap()/yylex() functions.
3
4Upstream-Status: Pending
5Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se>
6
7Index: console-tools-0.3.2/kbdtools/Makefile.am
8===================================================================
9--- console-tools-0.3.2.orig/kbdtools/Makefile.am
10+++ console-tools-0.3.2/kbdtools/Makefile.am
11@@ -19,8 +19,6 @@ LDADD = ../lib/ctlocal/libctlocal.a ../l
12 ../lib/cfont/libcfont.la \
13 ../lib/console/libconsole.la ../lib/generic/libctgeneric.la
14
15-loadkeys_LDADD = $(LDADD) @LEXLIB@
16-
17 bin_SCRIPTS = mk_modmap
18
19 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
new file mode 100644
index 0000000000..2ed609219c
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/nodocs.patch
@@ -0,0 +1,22 @@
1The docs need tools we don't have to build so disable them.
2
3Also remove intl since the Makefile doesn't work with 3.82 and we
4don't want to build libintl anyway.
5
6Upstream-Status: Inappropriate [configuration]
7RP 2012/10/17
8
9Index: console-tools-0.3.2/Makefile.am
10===================================================================
11--- console-tools-0.3.2.orig/Makefile.am 1999-04-15 01:33:24.000000000 +0000
12+++ console-tools-0.3.2/Makefile.am 2012-10-17 11:48:14.107069145 +0000
13@@ -1,7 +1,7 @@
14 # -*- makefile -*-
15 AUTOMAKE_OPTIONS = foreign
16
17-SUBDIRS = lib fontfiletools vttools kbdtools screenfonttools contrib doc \
18- compat include examples po intl
19+SUBDIRS = lib fontfiletools vttools kbdtools screenfonttools contrib \
20+ compat include examples po
21
22 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
new file mode 100644
index 0000000000..0c95068a36
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools-0.3.2/uclibc-fileno.patch
@@ -0,0 +1,49 @@
1Fixing the locale issues isn't enough, console-tools also does a couple of
2other pretty stupid things (like FILE *f; f->_fileno instead of fileno(f)),
3
4Upstream-Status: Pending
5
6--- console-tools-0.3.2/lib/cfont/fontstruct.c.ark 2005-05-22 19:12:38.000000000 +0000
7+++ console-tools-0.3.2/lib/cfont/fontstruct.c 2005-05-22 19:13:23.000000000 +0000
8@@ -50,8 +50,7 @@
9 * get filesize
10 */
11
12- /* FIXME: should not use _fileno ! */
13- if (fstat(fontfile->_fileno, &stbuf) == -1)
14+ if (fstat(fileno(fontfile), &stbuf) == -1)
15 goto rsf_return_error;
16
17 if (S_ISREG(stbuf.st_mode))
18@@ -211,8 +210,7 @@
19 * get filesize
20 */
21
22- /* FIXME: should not use _fileno ! */
23- if (fstat(fontfile->_fileno, &stbuf) == -1)
24+ if (fstat(fileno(fontfile), &stbuf) == -1)
25 goto rfg_return_error;
26
27 if (S_ISREG(stbuf.st_mode))
28--- console-tools-0.3.2/lib/console/acm.c.ark 2005-05-22 19:17:15.000000000 +0000
29+++ console-tools-0.3.2/lib/console/acm.c 2005-05-22 19:17:23.000000000 +0000
30@@ -30,7 +30,7 @@
31 lct_boolean parse_failed = False;
32 lct_boolean is_unicode;
33
34- if (fstat(fp->_fileno, &stbuf))
35+ if (fstat(fileno(fp), &stbuf))
36 perror(_("Cannot stat ACM file")), exit(1);
37
38 /* first try a wg15-charmap (glibc) file format */
39--- console-tools-0.3.2/include/lct/local.h.ark 2005-05-22 19:08:54.000000000 +0000
40+++ console-tools-0.3.2/include/lct/local.h 2005-05-22 19:09:12.000000000 +0000
41@@ -8,7 +8,7 @@
42 #include <locale.h>
43
44
45-#ifdef HAVE_LOCALE_H
46+#if defined(HAVE_LOCALE_H) && defined(HAVE_LIBINTL_H)
47 # include <libintl.h>
48 # define _(String) gettext (String)
49 # 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
new file mode 100644
index 0000000000..c60a5a05bb
--- /dev/null
+++ b/meta/recipes-core/console-tools/console-tools_0.3.2.bb
@@ -0,0 +1,37 @@
1SECTION = "base"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://COPYING.kbd;md5=9b2d91511d3d80d4d20ac6e6b0137fe9"
4SUMMARY = "Allows you to set-up and manipulate the Linux console"
5DESCRIPTION = "Provides tools that enable the set-up and manipulation of the linux console and console-font files."
6PR = "r8"
7
8SRC_URI = "${SOURCEFORGE_MIRROR}/lct/console-tools-${PV}.tar.gz \
9 file://codepage.patch \
10 file://configure.patch \
11 file://compile.patch \
12 file://kbdrate.patch \
13 file://uclibc-fileno.patch \
14 file://nodocs.patch \
15 file://fix-libconsole-linking.patch \
16 file://no-dep-on-libfl.patch \
17 file://lcmessage.m4 \
18 file://Makevars"
19
20SRC_URI[md5sum] = "bf21564fc38b3af853ef724babddbacd"
21SRC_URI[sha256sum] = "eea6b441672dacd251079fc85ed322e196282e0e66c16303ec64c3a2b1c126c2"
22
23do_configure_prepend () {
24 mkdir -p ${S}/m4
25 cp ${WORKDIR}/lcmessage.m4 ${S}/m4/
26 rm -f ${S}/acinclude.m4
27 cp ${WORKDIR}/Makevars ${S}/po/
28}
29
30inherit autotools gettext update-alternatives
31
32ALTERNATIVE_PRIORITY = "100"
33
34bindir_progs = "chvt deallocvt fgconsole openvt"
35ALTERNATIVE_${PN} = "${bindir_progs}"
36
37RDEPENDS_${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
new file mode 100644
index 0000000000..5452b46bbc
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-6.9-cp-i-u.patch
@@ -0,0 +1,120 @@
1Upstream-Status: Inappropriate [legacy version]
2
3This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
4
5The package is stated as being Licensed as GPLv2+.
6
7Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
8
9----
10
11When "cp -i --update old new" would do nothing because "new" is
12newer than "old", cp would nonetheless prompt for whether it is
13ok to overwrite "new". Then, regardless of the response (because
14of the --update option), cp would do nothing.
15
16The following patch eliminates the unnecessary prompt in that case.
17
18diff --git a/src/copy.c b/src/copy.c
19index b7bf73b..0e549d2 100644
20--- a/src/copy.c
21+++ b/src/copy.c
22@@ -1210,6 +1210,30 @@ copy_internal (char const *src_name, char const *dst_name,
23 return false;
24 }
25
26+ if (!S_ISDIR (src_mode) && x->update)
27+ {
28+ /* When preserving time stamps (but not moving within a file
29+ system), don't worry if the destination time stamp is
30+ less than the source merely because of time stamp
31+ truncation. */
32+ int options = ((x->preserve_timestamps
33+ && ! (x->move_mode
34+ && dst_sb.st_dev == src_sb.st_dev))
35+ ? UTIMECMP_TRUNCATE_SOURCE
36+ : 0);
37+
38+ if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
39+ {
40+ /* We're using --update and the destination is not older
41+ than the source, so do not copy or move. Pretend the
42+ rename succeeded, so the caller (if it's mv) doesn't
43+ end up removing the source file. */
44+ if (rename_succeeded)
45+ *rename_succeeded = true;
46+ return true;
47+ }
48+ }
49+
50 /* When there is an existing destination file, we may end up
51 returning early, and hence not copying/moving the file.
52 This may be due to an interactive `negative' reply to the
53@@ -1302,30 +1326,6 @@ copy_internal (char const *src_name, char const *dst_name,
54 return false;
55 }
56 }
57-
58- if (x->update)
59- {
60- /* When preserving time stamps (but not moving within a file
61- system), don't worry if the destination time stamp is
62- less than the source merely because of time stamp
63- truncation. */
64- int options = ((x->preserve_timestamps
65- && ! (x->move_mode
66- && dst_sb.st_dev == src_sb.st_dev))
67- ? UTIMECMP_TRUNCATE_SOURCE
68- : 0);
69-
70- if (0 <= utimecmp (dst_name, &dst_sb, &src_sb, options))
71- {
72- /* We're using --update and the destination is not older
73- than the source, so do not copy or move. Pretend the
74- rename succeeded, so the caller (if it's mv) doesn't
75- end up removing the source file. */
76- if (rename_succeeded)
77- *rename_succeeded = true;
78- return true;
79- }
80- }
81 }
82
83 if (x->move_mode)
84diff --git a/tests/mv/update b/tests/mv/update
85index 0c06024..6c3d149 100755
86--- a/tests/mv/update
87+++ b/tests/mv/update
88@@ -1,7 +1,7 @@
89 #!/bin/sh
90 # make sure --update works as advertised
91
92-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
93+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
94
95 # This program is free software; you can redistribute it and/or modify
96 # it under the terms of the GNU General Public License as published by
97@@ -46,11 +46,16 @@ fi
98
99 fail=0
100
101-for cp_or_mv in cp mv; do
102- # This is a no-op.
103- $cp_or_mv --update old new || fail=1
104- case "`cat new`" in new) ;; *) fail=1 ;; esac
105- case "`cat old`" in old) ;; *) fail=1 ;; esac
106+for interactive in '' -i; do
107+ for cp_or_mv in cp mv; do
108+ # This is a no-op, with no prompt.
109+ # With coreutils-6.9 and earlier, using --update with -i would
110+ # mistakenly elicit a prompt.
111+ $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1
112+ test -s out && fail=1
113+ case "`cat new`" in new) ;; *) fail=1 ;; esac
114+ case "`cat old`" in old) ;; *) fail=1 ;; esac
115+ done
116 done
117
118 # This will actually perform the rename.
119--
1201.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
new file mode 100644
index 0000000000..8273d78eb3
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-build-with-acl.patch
@@ -0,0 +1,28 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Fix the following issue so that coreutils can build with ACL:
4
5configure: WARNING: libacl development library was not found or not usable.
6configure: WARNING: GNU coreutils will be built without ACL support.
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 m4/acl.m4 | 2 +-
11 1 files changed, 1 insertions(+), 1 deletions(-)
12
13diff --git a/m4/acl.m4 b/m4/acl.m4
14index d6a448a..a9d4836 100644
15--- a/m4/acl.m4
16+++ b/m4/acl.m4
17@@ -159,7 +159,7 @@ AC_DEFUN([gl_ACL_GET_FILE],
18 ]])],
19 [gl_cv_func_working_acl_get_file=yes],
20 [gl_cv_func_working_acl_get_file=no],
21- [gl_cv_func_working_acl_get_file=cross-compiling])])
22+ [gl_cv_func_working_acl_get_file=yes])])
23
24 AS_IF([test $gl_cv_func_working_acl_get_file = yes], [$1], [$2])
25 ])
26--
271.7.7
28
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
new file mode 100644
index 0000000000..88f61fa108
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-install.patch
@@ -0,0 +1,101 @@
1Upstream-Status: Inappropriate [legacy version]
2
3The install command doesn't over write the dangling symlink, for
4example:
5
6$ install fileA /tmp/fileA
7
8If /tmp/fileA is a dangling symlink, there would be an error:
9
10install: cannot create regular file '/tmp/fileA': File exists
11
12This is because of the following code in copy.c:
13
14 if (!new_dst)
15 {
16 if (XSTAT (x, dst_name, &dst_sb) != 0)
17 {
18 if (errno != ENOENT)
19 {
20 error (0, errno, _("cannot stat %s"), quote (dst_name));
21 return false;
22 }
23 else
24 {
25 new_dst = true;
26 }
27 }
28
29XSTAT() use stat() for dst_name(the dangling symlink /tmp/fileA) when
30install.c invokes it, and stat will set errno to ENOENT, and then
31new_dst will be set to true which means that /tmp/fileA doesn't exist,
32then we will create /tmp/fileA without remove it first, so the error
33comes.
34
35This is fixed in a way which adds the member cmd_install in
36struct cp_options to make sure my change only affected to the install
37command and use lstat to fix the problem.
38
39Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
40Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
41
42---
43 src/copy.c | 10 +++++++++-
44 src/copy.h | 3 +++
45 src/install.c | 1 +
46 3 files changed, 13 insertions(+), 1 deletions(-)
47
48diff --git a/src/copy.c b/src/copy.c
49--- a/src/copy.c
50+++ b/src/copy.c
51@@ -1029,6 +1029,7 @@ copy_internal (char const *src_name, char const *dst_name,
52 bool delayed_ok;
53 bool copied_as_regular = false;
54 bool preserve_metadata;
55+ int dst_stat_result;
56
57 if (x->move_mode && rename_succeeded)
58 *rename_succeeded = false;
59@@ -1069,7 +1070,14 @@ copy_internal (char const *src_name, char const *dst_name,
60
61 if (!new_dst)
62 {
63- if (XSTAT (x, dst_name, &dst_sb) != 0)
64+ if ( x->cmd_install && ( x->backup_type == no_backups))
65+ dst_stat_result = lstat (dst_name, &dst_sb);
66+ else
67+ {
68+ dst_stat_result = XSTAT (x, dst_name, &dst_sb);
69+ }
70+
71+ if (dst_stat_result != 0)
72 {
73 if (errno != ENOENT)
74 {
75diff --git a/src/copy.h b/src/copy.h
76--- a/src/copy.h
77+++ b/src/copy.h
78@@ -114,6 +114,9 @@ struct cp_options
79 If that fails, then resort to copying. */
80 bool move_mode;
81
82+ /* For the install command */
83+ bool cmd_install;
84+
85 /* Whether this process has appropriate privileges to chown a file
86 whose owner is not the effective user ID. */
87 bool chown_privileges;
88diff --git a/src/install.c b/src/install.c
89--- a/src/install.c
90+++ b/src/install.c
91@@ -149,6 +149,7 @@ cp_option_init (struct cp_options *x)
92 x->hard_link = false;
93 x->interactive = I_UNSPECIFIED;
94 x->move_mode = false;
95+ x->cmd_install = true;
96 x->chown_privileges = chown_privileges ();
97 x->one_file_system = false;
98 x->preserve_ownership = false;
99--
1001.7.0.1
101
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
new file mode 100644
index 0000000000..3ae5a2faeb
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-fix-texinfo.patch
@@ -0,0 +1,375 @@
1From 170be4023bbf9e9698a709e03265945588ac8e01 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Tue, 26 Nov 2013 00:21:50 +0800
4Subject: [PATCH] doc/coreutils.texi: Use '@item' instead of '@itemx'
5
6Use '@item' instead of '@itemx' in several places, as Texinfo 5 refuses
7to process an '@itemx' that is not preceded by an '@item'. Ensure that
8node extended names in menus and sectioning are consistent, and that
9ordering and presence of nodes in menus and in the actual text are
10consistent as well.
11
12Upstream-Status: Backport [From: coreutils.7620.n7.nabble.com, bug#11828]
13
14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15---
16 doc/coreutils.texi | 82 +++++++++++++++++++++++++++---------------------------
17 1 file changed, 41 insertions(+), 41 deletions(-)
18
19diff --git a/doc/coreutils.texi b/doc/coreutils.texi
20index 588147f..2dae3fe 100644
21--- a/doc/coreutils.texi
22+++ b/doc/coreutils.texi
23@@ -555,7 +555,7 @@ symbolic link to a directory. @xref{Target directory}.
24 @end macro
25
26 @macro optSi
27-@itemx --si
28+@item --si
29 @opindex --si
30 @cindex SI output
31 Append an SI-style abbreviation to each size, such as @samp{M} for
32@@ -578,7 +578,7 @@ Use the @option{--si} option if you prefer powers of 1000.
33 @end macro
34
35 @macro optStripTrailingSlashes
36-@itemx @w{@kbd{--strip-trailing-slashes}}
37+@item @w{@kbd{--strip-trailing-slashes}}
38 @opindex --strip-trailing-slashes
39 @cindex stripping trailing slashes
40 Remove any trailing slashes from each @var{source} argument.
41@@ -2496,7 +2496,7 @@ by 1048576.
42 However, if @var{n} starts with a @samp{-},
43 print all but the last @var{n} bytes of each file.
44
45-@itemx -n @var{n}
46+@item -n @var{n}
47 @itemx --lines=@var{n}
48 @opindex -n
49 @opindex --lines
50@@ -2633,7 +2633,7 @@ This option is the same as @option{--follow=name --retry}. That is, tail
51 will attempt to reopen a file when it is removed. Should this fail, tail
52 will keep trying until it becomes accessible again.
53
54-@itemx --retry
55+@item --retry
56 @opindex --retry
57 This option is useful mainly when following by name (i.e., with
58 @option{--follow=name}).
59@@ -2641,7 +2641,7 @@ Without this option, when tail encounters a file that doesn't
60 exist or is otherwise inaccessible, it reports that fact and
61 never checks it again.
62
63-@itemx --sleep-interval=@var{number}
64+@item --sleep-interval=@var{number}
65 @opindex --sleep-interval
66 Change the number of seconds to wait between iterations (the default is 1.0).
67 During one iteration, every specified file is checked to see if it has
68@@ -2651,7 +2651,7 @@ Historical implementations of @command{tail} have required that
69 an arbitrary floating point number (using a period before any
70 fractional digits).
71
72-@itemx --pid=@var{pid}
73+@item --pid=@var{pid}
74 @opindex --pid
75 When following by name or by descriptor, you may specify the process ID,
76 @var{pid}, of the sole writer of all @var{file} arguments. Then, shortly
77@@ -2674,7 +2674,7 @@ terminate until long after the real writer has terminated.
78 Note that @option{--pid} cannot be supported on some systems; @command{tail}
79 will print a warning if this is the case.
80
81-@itemx --max-unchanged-stats=@var{n}
82+@item --max-unchanged-stats=@var{n}
83 @opindex --max-unchanged-stats
84 When tailing a file by name, if there have been @var{n} (default
85 n=@value{DEFAULT_MAX_N_UNCHANGED_STATS_BETWEEN_OPENS}) consecutive
86@@ -2686,7 +2686,7 @@ number of seconds between when tail prints the last pre-rotation lines
87 and when it prints the lines that have accumulated in the new log file.
88 This option is meaningful only when following by name.
89
90-@itemx -n @var{n}
91+@item -n @var{n}
92 @itemx --lines=@var{n}
93 @opindex -n
94 @opindex --lines
95@@ -2817,7 +2817,7 @@ option.
96 @opindex --numeric-suffixes
97 Use digits in suffixes rather than lower-case letters.
98
99-@itemx --verbose
100+@item --verbose
101 @opindex --verbose
102 Write a diagnostic to standard error just before each output file is opened.
103
104@@ -3055,7 +3055,7 @@ Print only the newline counts.
105 @opindex --max-line-length
106 Print only the maximum line lengths.
107
108-@itemx --files0-from=@var{FILE}
109+@item --files0-from=@var{FILE}
110 @opindex --files0-from=@var{FILE}
111 @cindex including files from @command{du}
112 Rather than processing files named on the command line, process those
113@@ -3250,7 +3250,7 @@ an MD5 checksum inconsistent with the associated file, or if no valid
114 line is found, @command{md5sum} exits with nonzero status. Otherwise,
115 it exits successfully.
116
117-@itemx --status
118+@item --status
119 @opindex --status
120 @cindex verifying MD5 checksums
121 This option is useful only when verifying checksums.
122@@ -5837,7 +5837,7 @@ command line unless the @option{--dereference-command-line} (@option{-H}),
123 If a command line argument specifies a symbolic link, show information
124 for the file the link references rather than for the link itself.
125
126-@itemx --dereference-command-line-symlink-to-dir
127+@item --dereference-command-line-symlink-to-dir
128 @opindex --dereference-command-line-symlink-to-dir
129 @cindex symbolic links, dereferencing
130 Do not dereference symbolic links, with one exception:
131@@ -7015,15 +7015,15 @@ If specified, the @var{attribute_list} must be a comma-separated list
132 of one or more of the following strings:
133
134 @table @samp
135-@itemx mode
136+@item mode
137 Preserve the file mode bits and access control lists.
138-@itemx ownership
139+@item ownership
140 Preserve the owner and group. On most modern systems,
141 only users with appropriate privileges may change the owner of a file,
142 and ordinary users
143 may preserve the group ownership of a file only if they happen to be
144 a member of the desired group.
145-@itemx timestamps
146+@item timestamps
147 Preserve the times of last access and last modification, when possible.
148 In general, it is not possible to preserve these attributes
149 when the affected file is a symbolic link.
150@@ -7031,12 +7031,12 @@ However, FreeBSD now provides the @code{lutimes} function, which makes
151 it possibile even for symbolic links. However, this implementation does
152 not yet take advantage of that.
153 @c FIXME: once we provide lutimes support, update the above.
154-@itemx links
155+@item links
156 Preserve in the destination files
157 any links between corresponding source files.
158 @c Give examples illustrating how hard links are preserved.
159 @c Also, show how soft links map to hard links with -L and -H.
160-@itemx all
161+@item all
162 Preserve all file attributes.
163 Equivalent to specifying all of the above.
164 @end table
165@@ -7049,12 +7049,12 @@ mode bits of the corresponding source file, minus the bits set in the
166 umask and minus the set-user-ID and set-group-ID bits.
167 @xref{File permissions}.
168
169-@itemx @w{@kbd{--no-preserve}=@var{attribute_list}}
170+@item @w{@kbd{--no-preserve}=@var{attribute_list}}
171 @cindex file information, preserving
172 Do not preserve the specified attributes. The @var{attribute_list}
173 has the same form as for @option{--preserve}.
174
175-@itemx --parents
176+@item --parents
177 @opindex --parents
178 @cindex parent directories and @command{cp}
179 Form the name of each destination file by appending to the target
180@@ -7070,7 +7070,7 @@ cp --parents a/b/c existing_dir
181 copies the file @file{a/b/c} to @file{existing_dir/a/b/c}, creating
182 any missing intermediate directories.
183
184-@itemx @w{@kbd{--reply}=@var{how}}
185+@item @w{@kbd{--reply}=@var{how}}
186 @opindex --reply
187 @cindex interactivity
188 @c FIXME: remove in 2008
189@@ -7742,7 +7742,7 @@ Prompt whether to overwrite each existing destination file, regardless
190 of its permissions.
191 If the response is not affirmative, the file is skipped.
192
193-@itemx @w{@kbd{--reply}=@var{how}}
194+@item @w{@kbd{--reply}=@var{how}}
195 @opindex --reply
196 @cindex interactivity
197 @c FIXME: remove in 2008
198@@ -7847,7 +7847,7 @@ files are named or if a recursive removal is requested. Ignore any
199 previous @option{--force} (@option{-f}) option. Equivalent to
200 @option{--interactive=once}.
201
202-@itemx --interactive [=@var{when}]
203+@item --interactive [=@var{when}]
204 @opindex --interactive
205 Specify when to issue an interactive prompt. @var{when} may be
206 omitted, or one of:
207@@ -7866,7 +7866,7 @@ removal is requested. Equivalent to @option{-I}.
208 Specifying @option{--interactive} and no @var{when} is equivalent to
209 @option{--interactive=always}.
210
211-@itemx --one-file-system
212+@item --one-file-system
213 @opindex --one-file-system
214 @cindex one file system, restricting @command{rm} to
215 When removing a hierarchy recursively, skip any directory that is on a
216@@ -7884,7 +7884,7 @@ warn about and skip directories on other file systems.
217 Of course, this will not save your @file{/home} if it and your
218 chroot happen to be on the same file system.
219
220-@itemx --preserve-root
221+@item --preserve-root
222 @opindex --preserve-root
223 @cindex root directory, disallow recursive destruction
224 Fail upon any attempt to remove the root directory, @file{/},
225@@ -7892,7 +7892,7 @@ when used with the @option{--recursive} option.
226 This is the default behavior.
227 @xref{Treating / specially}.
228
229-@itemx --no-preserve-root
230+@item --no-preserve-root
231 @opindex --no-preserve-root
232 @cindex root directory, allow recursive destruction
233 Do not treat @file{/} specially when removing recursively.
234@@ -8874,7 +8874,7 @@ actually changes.
235 Do not print error messages about files whose ownership cannot be
236 changed.
237
238-@itemx @w{@kbd{--from}=@var{old-owner}}
239+@item @w{@kbd{--from}=@var{old-owner}}
240 @opindex --from
241 @cindex symbolic links, changing owner
242 Change a @var{file}'s ownership only if it has current attributes specified
243@@ -8928,14 +8928,14 @@ is a symbolic link.
244 By default, no diagnostic is issued for symbolic links encountered
245 during a recursive traversal, but see @option{--verbose}.
246
247-@itemx --preserve-root
248+@item --preserve-root
249 @opindex --preserve-root
250 @cindex root directory, disallow recursive modification
251 Fail upon any attempt to recursively change the root directory, @file{/}.
252 Without @option{--recursive}, this option has no effect.
253 @xref{Treating / specially}.
254
255-@itemx --no-preserve-root
256+@item --no-preserve-root
257 @opindex --no-preserve-root
258 @cindex root directory, allow recursive modification
259 Cancel the effect of any preceding @option{--preserve-root} option.
260@@ -9054,14 +9054,14 @@ is a symbolic link.
261 By default, no diagnostic is issued for symbolic links encountered
262 during a recursive traversal, but see @option{--verbose}.
263
264-@itemx --preserve-root
265+@item --preserve-root
266 @opindex --preserve-root
267 @cindex root directory, disallow recursive modification
268 Fail upon any attempt to recursively change the root directory, @file{/}.
269 Without @option{--recursive}, this option has no effect.
270 @xref{Treating / specially}.
271
272-@itemx --no-preserve-root
273+@item --no-preserve-root
274 @opindex --no-preserve-root
275 @cindex root directory, allow recursive modification
276 Cancel the effect of any preceding @option{--preserve-root} option.
277@@ -9175,14 +9175,14 @@ actually changes.
278 Do not print error messages about files whose permissions cannot be
279 changed.
280
281-@itemx --preserve-root
282+@item --preserve-root
283 @opindex --preserve-root
284 @cindex root directory, disallow recursive modification
285 Fail upon any attempt to recursively change the root directory, @file{/}.
286 Without @option{--recursive}, this option has no effect.
287 @xref{Treating / specially}.
288
289-@itemx --no-preserve-root
290+@item --no-preserve-root
291 @opindex --no-preserve-root
292 @cindex root directory, allow recursive modification
293 Cancel the effect of any preceding @option{--preserve-root} option.
294@@ -9603,7 +9603,7 @@ The program accepts the following options. Also see @ref{Common options}.
295 @opindex --all
296 Show counts for all files, not just directories.
297
298-@itemx --apparent-size
299+@item --apparent-size
300 @opindex --apparent-size
301 Print apparent sizes, rather than disk usage. The apparent size of a
302 file is the number of bytes reported by @code{wc -c} on regular files,
303@@ -9654,7 +9654,7 @@ Does not affect other symbolic links. This is helpful for finding
304 out the disk usage of directories, such as @file{/usr/tmp}, which
305 are often symbolic links.
306
307-@itemx --files0-from=@var{FILE}
308+@item --files0-from=@var{FILE}
309 @opindex --files0-from=@var{FILE}
310 @cindex including files from @command{du}
311 Rather than processing files named on the command line, process those
312@@ -9733,7 +9733,7 @@ Output a null byte at the end of each line, rather than a newline.
313 This option enables other programs to parse the output of @command{du}
314 even when that output would contain file names with embedded newlines.
315
316-@itemx --si
317+@item --si
318 @opindex --si
319 @cindex SI output
320 Append an SI-style abbreviation to each size, such as @samp{MB} for
321@@ -9754,13 +9754,13 @@ Display only a total for each argument.
322 Report the size of each directory separately, not including the sizes
323 of subdirectories.
324
325-@itemx --time
326+@item --time
327 @opindex --time
328 @cindex last modified dates, displaying in @command{du}
329 Show time of the most recent modification of any file in the directory,
330 or any of its subdirectories.
331
332-@itemx --time=ctime
333+@item --time=ctime
334 @itemx --time=status
335 @itemx --time=use
336 @opindex --time
337@@ -9770,7 +9770,7 @@ or any of its subdirectories.
338 Show the most recent status change time (the @samp{ctime} in the inode) of
339 any file in the directory, instead of the modification time.
340
341-@itemx --time=atime
342+@item --time=atime
343 @itemx --time=access
344 @opindex --time
345 @opindex atime@r{, show the most recent}
346@@ -9911,7 +9911,7 @@ $ stat --format=%d:%i / /usr
347 2057:2
348 @end example
349
350-@itemx --printf=@var{format}
351+@item --printf=@var{format}
352 @opindex --printf=@var{format}
353 @cindex output format
354 Use @var{format} rather than the default format.
355@@ -12240,7 +12240,7 @@ Overrides all other options.
356 @opindex -s
357 Ignored; for compatibility with other versions of @command{who}.
358
359-@itemx -u
360+@item -u
361 @opindex -u
362 @cindex idle time
363 After the login time, print the number of hours and minutes that the
364@@ -12254,7 +12254,7 @@ user has been idle. @samp{.} means the user was active in the last minute.
365 List only the entries that correspond to processes via which the
366 system is waiting for a user to login. The user name is always @samp{LOGIN}.
367
368-@itemx --lookup
369+@item --lookup
370 @opindex --lookup
371 Attempt to canonicalize hostnames found in utmp through a DNS lookup. This
372 is not the default because it can cause significant delays on systems with
373--
3741.8.3.1
375
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
new file mode 100644
index 0000000000..653722348a
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-i18n.patch
@@ -0,0 +1,4051 @@
1Upstream-Status: Inappropriate [legacy version]
2
3This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
4
5The package is stated as being Licensed as GPLv2+.
6
7The comment indicates that the purpose is lin18nux/lsb compliance.
8
9Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
10
11--- /dev/null 2007-03-01 09:16:39.219409909 +0000
12+++ coreutils-6.8+/tests/sort/sort-mb-tests 2007-03-01 15:08:24.000000000 +0000
13@@ -0,0 +1,58 @@
14+#! /bin/sh
15+case $# in
16+ 0) xx='../../src/sort';;
17+ *) xx="$1";;
18+esac
19+test "$VERBOSE" && echo=echo || echo=:
20+$echo testing program: $xx
21+errors=0
22+test "$srcdir" || srcdir=.
23+test "$VERBOSE" && $xx --version 2> /dev/null
24+
25+export LC_ALL=en_US.UTF-8
26+locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77
27+errors=0
28+
29+$xx -t ï¼  -k2 -n mb1.I > mb1.O
30+code=$?
31+if test $code != 0; then
32+ $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2
33+ errors=`expr $errors + 1`
34+else
35+ cmp mb1.O $srcdir/mb1.X > /dev/null 2>&1
36+ case $? in
37+ 0) if test "$VERBOSE"; then $echo "passed mb1"; fi;;
38+ 1) $echo "Test mb1 failed: files mb1.O and $srcdir/mb1.X differ" 1>&2
39+ (diff -c mb1.O $srcdir/mb1.X) 2> /dev/null
40+ errors=`expr $errors + 1`;;
41+ 2) $echo "Test mb1 may have failed." 1>&2
42+ $echo The command "cmp mb1.O $srcdir/mb1.X" failed. 1>&2
43+ errors=`expr $errors + 1`;;
44+ esac
45+fi
46+
47+$xx -t ï¼  -k4 -n mb2.I > mb2.O
48+code=$?
49+if test $code != 0; then
50+ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2
51+ errors=`expr $errors + 1`
52+else
53+ cmp mb2.O $srcdir/mb2.X > /dev/null 2>&1
54+ case $? in
55+ 0) if test "$VERBOSE"; then $echo "passed mb2"; fi;;
56+ 1) $echo "Test mb2 failed: files mb2.O and $srcdir/mb2.X differ" 1>&2
57+ (diff -c mb2.O $srcdir/mb2.X) 2> /dev/null
58+ errors=`expr $errors + 1`;;
59+ 2) $echo "Test mb2 may have failed." 1>&2
60+ $echo The command "cmp mb2.O $srcdir/mb2.X" failed. 1>&2
61+ errors=`expr $errors + 1`;;
62+ esac
63+fi
64+
65+if test $errors = 0; then
66+ $echo Passed all 113 tests. 1>&2
67+else
68+ $echo Failed $errors tests. 1>&2
69+fi
70+test $errors = 0 || errors=1
71+exit $errors
72--- /dev/null 2007-03-01 09:16:39.219409909 +0000
73+++ coreutils-6.8+/tests/sort/mb2.I 2007-03-01 15:08:24.000000000 +0000
74@@ -0,0 +1,4 @@
75+Apple@AA10@@20
76+Banana@AA5@@30
77+Citrus@AA20@@5
78+Cherry@AA30@@10
79--- /dev/null 2007-03-01 09:16:39.219409909 +0000
80+++ coreutils-6.8+/tests/sort/mb2.X 2007-03-01 15:08:24.000000000 +0000
81@@ -0,0 +1,4 @@
82+Citrus@AA20@@5
83+Cherry@AA30@@10
84+Apple@AA10@@20
85+Banana@AA5@@30
86--- /dev/null 2007-03-01 09:16:39.219409909 +0000
87+++ coreutils-6.8+/tests/sort/mb1.I 2007-03-01 15:08:24.000000000 +0000
88@@ -0,0 +1,4 @@
89+Appleï¼ 10
90+Bananaï¼ 5
91+Citrusï¼ 20
92+Cherryï¼ 30
93--- /dev/null 2007-03-01 09:16:39.219409909 +0000
94+++ coreutils-6.8+/tests/sort/mb1.X 2007-03-01 15:08:24.000000000 +0000
95@@ -0,0 +1,4 @@
96+Bananaï¼ 5
97+Appleï¼ 10
98+Citrusï¼ 20
99+Cherryï¼ 30
100--- coreutils-6.8+/tests/sort/Makefile.am.i18n 2007-01-24 07:47:37.000000000 +0000
101+++ coreutils-6.8+/tests/sort/Makefile.am 2007-03-01 15:09:59.000000000 +0000
102@@ -66,15 +66,17 @@
103 bigfield.O bigfield.E
104 ##test-files-end
105
106-EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
107-noinst_SCRIPTS = $x-tests
108+run_gen += mb1.0 mb2.0
109+
110+EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X
111+noinst_SCRIPTS = $x-tests # $x-mb-tests
112 TESTS_ENVIRONMENT = \
113 CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
114 PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH"
115
116 editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g'
117
118-TESTS = $x-tests
119+TESTS = $x-tests $x-mb-tests
120
121 mk_script = $(srcdir)/../mk-script
122 $(srcdir)/$x-tests: $(mk_script) Test.pm Makefile.am
123--- coreutils-6.8+/lib/linebuffer.h.i18n 2005-05-14 07:44:24.000000000 +0100
124+++ coreutils-6.8+/lib/linebuffer.h 2007-03-01 15:08:24.000000000 +0000
125@@ -22,6 +22,11 @@
126
127 # include <stdio.h>
128
129+/* Get mbstate_t. */
130+# if HAVE_WCHAR_H
131+# include <wchar.h>
132+# endif
133+
134 /* A `struct linebuffer' holds a line of text. */
135
136 struct linebuffer
137@@ -29,6 +34,9 @@
138 size_t size; /* Allocated. */
139 size_t length; /* Used. */
140 char *buffer;
141+# if HAVE_WCHAR_H
142+ mbstate_t state;
143+# endif
144 };
145
146 /* Initialize linebuffer LINEBUFFER for use. */
147--- coreutils-6.8+/src/expand.c.i18n 2007-01-14 15:41:28.000000000 +0000
148+++ coreutils-6.8+/src/expand.c 2007-03-01 15:08:24.000000000 +0000
149@@ -38,11 +38,28 @@
150 #include <stdio.h>
151 #include <getopt.h>
152 #include <sys/types.h>
153+
154+/* Get mbstate_t, mbrtowc(), wcwidth(). */
155+#if HAVE_WCHAR_H
156+# include <wchar.h>
157+#endif
158+
159 #include "system.h"
160 #include "error.h"
161 #include "quote.h"
162 #include "xstrndup.h"
163
164+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
165+ installation; work around this configuration error. */
166+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
167+# define MB_LEN_MAX 16
168+#endif
169+
170+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
171+#if HAVE_MBRTOWC && defined mbstate_t
172+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
173+#endif
174+
175 /* The official name of this program (e.g., no `g' prefix). */
176 #define PROGRAM_NAME "expand"
177
178@@ -183,6 +200,7 @@
179 stops = num_start + len - 1;
180 }
181 }
182+
183 else
184 {
185 error (0, 0, _("tab size contains invalid character(s): %s"),
186@@ -365,6 +383,142 @@
187 }
188 }
189
190+#if HAVE_MBRTOWC
191+static void
192+expand_multibyte (void)
193+{
194+ FILE *fp; /* Input strem. */
195+ mbstate_t i_state; /* Current shift state of the input stream. */
196+ mbstate_t i_state_bak; /* Back up the I_STATE. */
197+ mbstate_t o_state; /* Current shift state of the output stream. */
198+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
199+ char *bufpos; /* Next read position of BUF. */
200+ size_t buflen = 0; /* The length of the byte sequence in buf. */
201+ wchar_t wc; /* A gotten wide character. */
202+ size_t mblength; /* The byte size of a multibyte character
203+ which shows as same character as WC. */
204+ int tab_index = 0; /* Index in `tab_list' of next tabstop. */
205+ int column = 0; /* Column on screen of the next char. */
206+ int next_tab_column; /* Column the next tab stop is on. */
207+ int convert = 1; /* If nonzero, perform translations. */
208+
209+ fp = next_file ((FILE *) NULL);
210+ if (fp == NULL)
211+ return;
212+
213+ memset (&o_state, '\0', sizeof(mbstate_t));
214+ memset (&i_state, '\0', sizeof(mbstate_t));
215+
216+ for (;;)
217+ {
218+ /* Refill the buffer BUF. */
219+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
220+ {
221+ memmove (buf, bufpos, buflen);
222+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
223+ bufpos = buf;
224+ }
225+
226+ /* No character is left in BUF. */
227+ if (buflen < 1)
228+ {
229+ fp = next_file (fp);
230+
231+ if (fp == NULL)
232+ break; /* No more files. */
233+ else
234+ {
235+ memset (&i_state, '\0', sizeof(mbstate_t));
236+ continue;
237+ }
238+ }
239+
240+ /* Get a wide character. */
241+ i_state_bak = i_state;
242+ mblength = mbrtowc (&wc, bufpos, buflen, &i_state);
243+
244+ switch (mblength)
245+ {
246+ case (size_t)-1: /* illegal byte sequence. */
247+ case (size_t)-2:
248+ mblength = 1;
249+ i_state = i_state_bak;
250+ if (convert)
251+ {
252+ ++column;
253+ if (convert_entire_line == 0)
254+ convert = 0;
255+ }
256+ putchar (*bufpos);
257+ break;
258+
259+ case 0: /* null. */
260+ mblength = 1;
261+ if (convert && convert_entire_line == 0)
262+ convert = 0;
263+ putchar ('\0');
264+ break;
265+
266+ default:
267+ if (wc == L'\n') /* LF. */
268+ {
269+ tab_index = 0;
270+ column = 0;
271+ convert = 1;
272+ putchar ('\n');
273+ }
274+ else if (wc == L'\t' && convert) /* Tab. */
275+ {
276+ if (tab_size == 0)
277+ {
278+ /* Do not let tab_index == first_free_tab;
279+ stop when it is 1 less. */
280+ while (tab_index < first_free_tab - 1
281+ && column >= tab_list[tab_index])
282+ tab_index++;
283+ next_tab_column = tab_list[tab_index];
284+ if (tab_index < first_free_tab - 1)
285+ tab_index++;
286+ if (column >= next_tab_column)
287+ next_tab_column = column + 1;
288+ }
289+ else
290+ next_tab_column = column + tab_size - column % tab_size;
291+
292+ while (column < next_tab_column)
293+ {
294+ putchar (' ');
295+ ++column;
296+ }
297+ }
298+ else /* Others. */
299+ {
300+ if (convert)
301+ {
302+ if (wc == L'\b')
303+ {
304+ if (column > 0)
305+ --column;
306+ }
307+ else
308+ {
309+ int width; /* The width of WC. */
310+
311+ width = wcwidth (wc);
312+ column += (width > 0) ? width : 0;
313+ if (convert_entire_line == 0)
314+ convert = 0;
315+ }
316+ }
317+ fwrite (bufpos, sizeof(char), mblength, stdout);
318+ }
319+ }
320+ buflen -= mblength;
321+ bufpos += mblength;
322+ }
323+}
324+#endif
325+
326 int
327 main (int argc, char **argv)
328 {
329@@ -429,7 +583,12 @@
330
331 file_list = (optind < argc ? &argv[optind] : stdin_argv);
332
333- expand ();
334+#if HAVE_MBRTOWC
335+ if (MB_CUR_MAX > 1)
336+ expand_multibyte ();
337+ else
338+#endif
339+ expand ();
340
341 if (have_read_stdin && fclose (stdin) != 0)
342 error (EXIT_FAILURE, errno, "-");
343--- coreutils-6.8+/src/join.c.i18n 2007-01-14 15:41:28.000000000 +0000
344+++ coreutils-6.8+/src/join.c 2007-03-01 15:08:24.000000000 +0000
345@@ -23,16 +23,30 @@
346 #include <sys/types.h>
347 #include <getopt.h>
348
349+/* Get mbstate_t, mbrtowc(), mbrtowc(), wcwidth(). */
350+#if HAVE_WCHAR_H
351+# include <wchar.h>
352+#endif
353+
354+/* Get iswblank(), towupper. */
355+#if HAVE_WCTYPE_H
356+# include <wctype.h>
357+#endif
358+
359 #include "system.h"
360 #include "error.h"
361 #include "hard-locale.h"
362 #include "linebuffer.h"
363-#include "memcasecmp.h"
364 #include "quote.h"
365 #include "stdio--.h"
366 #include "xmemcoll.h"
367 #include "xstrtol.h"
368
369+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
370+#if HAVE_MBRTOWC && defined mbstate_t
371+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
372+#endif
373+
374 /* The official name of this program (e.g., no `g' prefix). */
375 #define PROGRAM_NAME "join"
376
377@@ -104,10 +118,12 @@
378 /* Last element in `outlist', where a new element can be added. */
379 static struct outlist *outlist_end = &outlist_head;
380
381-/* Tab character separating fields. If negative, fields are separated
382- by any nonempty string of blanks, otherwise by exactly one
383- tab character whose value (when cast to unsigned char) equals TAB. */
384-static int tab = -1;
385+/* Tab character separating fields. If NULL, fields are separated
386+ by any nonempty string of blanks. */
387+static char *tab = NULL;
388+
389+/* The number of bytes used for tab. */
390+static size_t tablen = 0;
391
392 static struct option const longopts[] =
393 {
394@@ -190,6 +206,8 @@
395
396 /* Fill in the `fields' structure in LINE. */
397
398+/* Fill in the `fields' structure in LINE. */
399+
400 static void
401 xfields (struct line *line)
402 {
403@@ -199,10 +217,11 @@
404 if (ptr == lim)
405 return;
406
407- if (0 <= tab)
408+ if (tab != NULL)
409 {
410+ unsigned char t = tab[0];
411 char *sep;
412- for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1)
413+ for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1)
414 extract_field (line, ptr, sep - ptr);
415 }
416 else
417@@ -229,6 +248,148 @@
418 extract_field (line, ptr, lim - ptr);
419 }
420
421+#if HAVE_MBRTOWC
422+static void
423+xfields_multibyte (struct line *line)
424+{
425+ char *ptr = line->buf.buffer;
426+ char const *lim = ptr + line->buf.length - 1;
427+ wchar_t wc = 0;
428+ size_t mblength = 1;
429+ mbstate_t state, state_bak;
430+
431+ memset (&state, 0, sizeof (mbstate_t));
432+
433+ if (ptr == lim)
434+ return;
435+
436+ if (tab != NULL)
437+ {
438+ unsigned char t = tab[0];
439+ char *sep = ptr;
440+ for (; ptr < lim; ptr = sep + mblength)
441+ {
442+ sep = ptr;
443+ while (sep < lim)
444+ {
445+ state_bak = state;
446+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
447+
448+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
449+ {
450+ mblength = 1;
451+ state = state_bak;
452+ }
453+ mblength = (mblength < 1) ? 1 : mblength;
454+
455+ if (mblength == tablen && !memcmp (sep, tab, mblength))
456+ break;
457+ else
458+ {
459+ sep += mblength;
460+ continue;
461+ }
462+ }
463+
464+ if (sep == lim)
465+ break;
466+
467+ extract_field (line, ptr, sep - ptr);
468+ }
469+ }
470+ else
471+ {
472+ /* Skip leading blanks before the first field. */
473+ while(ptr < lim)
474+ {
475+ state_bak = state;
476+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
477+
478+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
479+ {
480+ mblength = 1;
481+ state = state_bak;
482+ break;
483+ }
484+ mblength = (mblength < 1) ? 1 : mblength;
485+
486+ if (!iswblank(wc))
487+ break;
488+ ptr += mblength;
489+ }
490+
491+ do
492+ {
493+ char *sep;
494+ state_bak = state;
495+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
496+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
497+ {
498+ mblength = 1;
499+ state = state_bak;
500+ break;
501+ }
502+ mblength = (mblength < 1) ? 1 : mblength;
503+
504+ sep = ptr + mblength;
505+ while (sep != lim)
506+ {
507+ state_bak = state;
508+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
509+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
510+ {
511+ mblength = 1;
512+ state = state_bak;
513+ break;
514+ }
515+ mblength = (mblength < 1) ? 1 : mblength;
516+
517+ if (iswblank (wc))
518+ break;
519+
520+ sep += mblength;
521+ }
522+
523+ extract_field (line, ptr, sep - ptr);
524+ if (sep == lim)
525+ return;
526+
527+ state_bak = state;
528+ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state);
529+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
530+ {
531+ mblength = 1;
532+ state = state_bak;
533+ break;
534+ }
535+ mblength = (mblength < 1) ? 1 : mblength;
536+
537+ ptr = sep + mblength;
538+ while (ptr != lim)
539+ {
540+ state_bak = state;
541+ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state);
542+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
543+ {
544+ mblength = 1;
545+ state = state_bak;
546+ break;
547+ }
548+ mblength = (mblength < 1) ? 1 : mblength;
549+
550+ if (!iswblank (wc))
551+ break;
552+
553+ ptr += mblength;
554+ }
555+ }
556+ while (ptr != lim);
557+ }
558+
559+ extract_field (line, ptr, lim - ptr);
560+}
561+#endif
562+
563 /* Read a line from FP into LINE and split it into fields.
564 Return true if successful. */
565
566@@ -249,6 +410,11 @@
567 line->nfields_allocated = 0;
568 line->nfields = 0;
569 line->fields = NULL;
570+#if HAVE_MBRTOWC
571+ if (MB_CUR_MAX > 1)
572+ xfields_multibyte (line);
573+ else
574+#endif
575 xfields (line);
576 return true;
577 }
578@@ -303,56 +469,114 @@
579 keycmp (struct line const *line1, struct line const *line2)
580 {
581 /* Start of field to compare in each file. */
582- char *beg1;
583- char *beg2;
584-
585- size_t len1;
586- size_t len2; /* Length of fields to compare. */
587+ char *beg[2];
588+ char *copy[2];
589+ size_t len[2]; /* Length of fields to compare. */
590 int diff;
591+ int i, j;
592
593 if (join_field_1 < line1->nfields)
594 {
595- beg1 = line1->fields[join_field_1].beg;
596- len1 = line1->fields[join_field_1].len;
597+ beg[0] = line1->fields[join_field_1].beg;
598+ len[0] = line1->fields[join_field_1].len;
599 }
600 else
601 {
602- beg1 = NULL;
603- len1 = 0;
604+ beg[0] = NULL;
605+ len[0] = 0;
606 }
607
608 if (join_field_2 < line2->nfields)
609 {
610- beg2 = line2->fields[join_field_2].beg;
611- len2 = line2->fields[join_field_2].len;
612+ beg[1] = line2->fields[join_field_2].beg;
613+ len[1] = line2->fields[join_field_2].len;
614 }
615 else
616 {
617- beg2 = NULL;
618- len2 = 0;
619+ beg[1] = NULL;
620+ len[1] = 0;
621 }
622
623- if (len1 == 0)
624- return len2 == 0 ? 0 : -1;
625- if (len2 == 0)
626+ if (len[0] == 0)
627+ return len[1] == 0 ? 0 : -1;
628+ if (len[1] == 0)
629 return 1;
630
631 if (ignore_case)
632 {
633- /* FIXME: ignore_case does not work with NLS (in particular,
634- with multibyte chars). */
635- diff = memcasecmp (beg1, beg2, MIN (len1, len2));
636+#ifdef HAVE_MBRTOWC
637+ if (MB_CUR_MAX > 1)
638+ {
639+ size_t mblength;
640+ wchar_t wc, uwc;
641+ mbstate_t state, state_bak;
642+
643+ memset (&state, '\0', sizeof (mbstate_t));
644+
645+ for (i = 0; i < 2; i++)
646+ {
647+ copy[i] = alloca (len[i] + 1);
648+
649+ for (j = 0; j < MIN (len[0], len[1]);)
650+ {
651+ state_bak = state;
652+ mblength = mbrtowc (&wc, beg[i] + j, len[i] - j, &state);
653+
654+ switch (mblength)
655+ {
656+ case (size_t) -1:
657+ case (size_t) -2:
658+ state = state_bak;
659+ /* Fall through */
660+ case 0:
661+ mblength = 1;
662+ break;
663+
664+ default:
665+ uwc = towupper (wc);
666+
667+ if (uwc != wc)
668+ {
669+ mbstate_t state_wc;
670+
671+ memset (&state_wc, '\0', sizeof (mbstate_t));
672+ wcrtomb (copy[i] + j, uwc, &state_wc);
673+ }
674+ else
675+ memcpy (copy[i] + j, beg[i] + j, mblength);
676+ }
677+ j += mblength;
678+ }
679+ copy[i][j] = '\0';
680+ }
681+ }
682+ else
683+#endif
684+ {
685+ for (i = 0; i < 2; i++)
686+ {
687+ copy[i] = alloca (len[i] + 1);
688+
689+ for (j = 0; j < MIN (len[0], len[1]); j++)
690+ copy[i][j] = toupper (beg[i][j]);
691+
692+ copy[i][j] = '\0';
693+ }
694+ }
695 }
696 else
697 {
698- if (hard_LC_COLLATE)
699- return xmemcoll (beg1, len1, beg2, len2);
700- diff = memcmp (beg1, beg2, MIN (len1, len2));
701+ copy[0] = (unsigned char *) beg[0];
702+ copy[1] = (unsigned char *) beg[1];
703 }
704
705+ if (hard_LC_COLLATE)
706+ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]);
707+ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1]));
708+
709 if (diff)
710 return diff;
711- return len1 < len2 ? -1 : len1 != len2;
712+ return len[0] - len[1];
713 }
714
715 /* Print field N of LINE if it exists and is nonempty, otherwise
716@@ -377,11 +601,18 @@
717
718 /* Print the join of LINE1 and LINE2. */
719
720+#define PUT_TAB_CHAR \
721+ do \
722+ { \
723+ (tab != NULL) ? \
724+ fwrite(tab, sizeof(char), tablen, stdout) : putchar (' '); \
725+ } \
726+ while (0)
727+
728 static void
729 prjoin (struct line const *line1, struct line const *line2)
730 {
731 const struct outlist *outlist;
732- char output_separator = tab < 0 ? ' ' : tab;
733
734 outlist = outlist_head.next;
735 if (outlist)
736@@ -397,12 +628,12 @@
737 if (o->file == 0)
738 {
739 if (line1 == &uni_blank)
740- {
741+ {
742 line = line2;
743 field = join_field_2;
744 }
745 else
746- {
747+ {
748 line = line1;
749 field = join_field_1;
750 }
751@@ -416,7 +647,7 @@
752 o = o->next;
753 if (o == NULL)
754 break;
755- putchar (output_separator);
756+ PUT_TAB_CHAR;
757 }
758 putchar ('\n');
759 }
760@@ -434,23 +665,23 @@
761 prfield (join_field_1, line1);
762 for (i = 0; i < join_field_1 && i < line1->nfields; ++i)
763 {
764- putchar (output_separator);
765+ PUT_TAB_CHAR;
766 prfield (i, line1);
767 }
768 for (i = join_field_1 + 1; i < line1->nfields; ++i)
769 {
770- putchar (output_separator);
771+ PUT_TAB_CHAR;
772 prfield (i, line1);
773 }
774
775 for (i = 0; i < join_field_2 && i < line2->nfields; ++i)
776 {
777- putchar (output_separator);
778+ PUT_TAB_CHAR;
779 prfield (i, line2);
780 }
781 for (i = join_field_2 + 1; i < line2->nfields; ++i)
782 {
783- putchar (output_separator);
784+ PUT_TAB_CHAR;
785 prfield (i, line2);
786 }
787 putchar ('\n');
788@@ -859,20 +1090,41 @@
789
790 case 't':
791 {
792- unsigned char newtab = optarg[0];
793- if (! newtab)
794+ char *newtab;
795+ size_t newtablen;
796+ if (! optarg[0])
797 error (EXIT_FAILURE, 0, _("empty tab"));
798- if (optarg[1])
799+ newtab = xstrdup (optarg);
800+#if HAVE_MBRTOWC
801+ if (MB_CUR_MAX > 1)
802+ {
803+ mbstate_t state;
804+
805+ memset (&state, 0, sizeof (mbstate_t));
806+ newtablen = mbrtowc (NULL, newtab,
807+ strnlen (newtab, MB_LEN_MAX),
808+ &state);
809+ if (newtablen == (size_t) 0
810+ || newtablen == (size_t) -1
811+ || newtablen == (size_t) -2)
812+ newtablen = 1;
813+ }
814+ else
815+#endif
816+ newtablen = 1;
817+
818+ if (newtablen == 1 && newtab[1])
819+ {
820+ if (STREQ (newtab, "\\0"))
821+ newtab[0] = '\0';
822+ }
823+ if (tab != NULL && strcmp (tab, newtab))
824 {
825- if (STREQ (optarg, "\\0"))
826- newtab = '\0';
827- else
828- error (EXIT_FAILURE, 0, _("multi-character tab %s"),
829- quote (optarg));
830+ free (newtab);
831+ error (EXIT_FAILURE, 0, _("incompatible tabs"));
832 }
833- if (0 <= tab && tab != newtab)
834- error (EXIT_FAILURE, 0, _("incompatible tabs"));
835 tab = newtab;
836+ tablen = newtablen;
837 }
838 break;
839
840--- coreutils-6.8+/src/uniq.c.i18n 2007-01-14 15:41:28.000000000 +0000
841+++ coreutils-6.8+/src/uniq.c 2007-03-01 15:08:24.000000000 +0000
842@@ -23,6 +23,16 @@
843 #include <getopt.h>
844 #include <sys/types.h>
845
846+/* Get mbstate_t, mbrtowc(). */
847+#if HAVE_WCHAR_H
848+# include <wchar.h>
849+#endif
850+
851+/* Get isw* functions. */
852+#if HAVE_WCTYPE_H
853+# include <wctype.h>
854+#endif
855+
856 #include "system.h"
857 #include "argmatch.h"
858 #include "linebuffer.h"
859@@ -32,7 +42,19 @@
860 #include "quote.h"
861 #include "xmemcoll.h"
862 #include "xstrtol.h"
863-#include "memcasecmp.h"
864+#include "xmemcoll.h"
865+
866+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
867+ installation; work around this configuration error. */
868+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
869+# define MB_LEN_MAX 16
870+#endif
871+
872+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
873+#if HAVE_MBRTOWC && defined mbstate_t
874+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
875+#endif
876+
877
878 /* The official name of this program (e.g., no `g' prefix). */
879 #define PROGRAM_NAME "uniq"
880@@ -109,6 +131,10 @@
881 /* Select whether/how to delimit groups of duplicate lines. */
882 static enum delimit_method delimit_groups;
883
884+/* Function pointers. */
885+static char *
886+(*find_field) (struct linebuffer *line);
887+
888 static struct option const longopts[] =
889 {
890 {"count", no_argument, NULL, 'c'},
891@@ -198,7 +224,7 @@
892 return a pointer to the beginning of the line's field to be compared. */
893
894 static char *
895-find_field (const struct linebuffer *line)
896+find_field_uni (struct linebuffer *line)
897 {
898 size_t count;
899 char *lp = line->buffer;
900@@ -219,6 +245,83 @@
901 return lp + i;
902 }
903
904+#if HAVE_MBRTOWC
905+
906+# define MBCHAR_TO_WCHAR(WC, MBLENGTH, LP, POS, SIZE, STATEP, CONVFAIL) \
907+ do \
908+ { \
909+ mbstate_t state_bak; \
910+ \
911+ CONVFAIL = 0; \
912+ state_bak = *STATEP; \
913+ \
914+ MBLENGTH = mbrtowc (&WC, LP + POS, SIZE - POS, STATEP); \
915+ \
916+ switch (MBLENGTH) \
917+ { \
918+ case (size_t)-2: \
919+ case (size_t)-1: \
920+ *STATEP = state_bak; \
921+ CONVFAIL++; \
922+ /* Fall through */ \
923+ case 0: \
924+ MBLENGTH = 1; \
925+ } \
926+ } \
927+ while (0)
928+
929+static char *
930+find_field_multi (struct linebuffer *line)
931+{
932+ size_t count;
933+ char *lp = line->buffer;
934+ size_t size = line->length - 1;
935+ size_t pos;
936+ size_t mblength;
937+ wchar_t wc;
938+ mbstate_t *statep;
939+ int convfail;
940+
941+ pos = 0;
942+ statep = &(line->state);
943+
944+ /* skip fields. */
945+ for (count = 0; count < skip_fields && pos < size; count++)
946+ {
947+ while (pos < size)
948+ {
949+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
950+
951+ if (convfail || !iswblank (wc))
952+ {
953+ pos += mblength;
954+ break;
955+ }
956+ pos += mblength;
957+ }
958+
959+ while (pos < size)
960+ {
961+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
962+
963+ if (!convfail && iswblank (wc))
964+ break;
965+
966+ pos += mblength;
967+ }
968+ }
969+
970+ /* skip fields. */
971+ for (count = 0; count < skip_chars && pos < size; count++)
972+ {
973+ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail);
974+ pos += mblength;
975+ }
976+
977+ return lp + pos;
978+}
979+#endif
980+
981 /* Return false if two strings OLD and NEW match, true if not.
982 OLD and NEW point not to the beginnings of the lines
983 but rather to the beginnings of the fields to compare.
984@@ -227,6 +330,8 @@
985 static bool
986 different (char *old, char *new, size_t oldlen, size_t newlen)
987 {
988+ char *copy_old, *copy_new;
989+
990 if (check_chars < oldlen)
991 oldlen = check_chars;
992 if (check_chars < newlen)
993@@ -234,14 +339,92 @@
994
995 if (ignore_case)
996 {
997- /* FIXME: This should invoke strcoll somehow. */
998- return oldlen != newlen || memcasecmp (old, new, oldlen);
999+ size_t i;
1000+
1001+ copy_old = alloca (oldlen + 1);
1002+ copy_new = alloca (oldlen + 1);
1003+
1004+ for (i = 0; i < oldlen; i++)
1005+ {
1006+ copy_old[i] = toupper (old[i]);
1007+ copy_new[i] = toupper (new[i]);
1008+ }
1009 }
1010- else if (hard_LC_COLLATE)
1011- return xmemcoll (old, oldlen, new, newlen) != 0;
1012 else
1013- return oldlen != newlen || memcmp (old, new, oldlen);
1014+ {
1015+ copy_old = (char *)old;
1016+ copy_new = (char *)new;
1017+ }
1018+
1019+ return xmemcoll (copy_old, oldlen, copy_new, newlen);
1020+}
1021+
1022+#if HAVE_MBRTOWC
1023+static int
1024+different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate)
1025+{
1026+ size_t i, j, chars;
1027+ const char *str[2];
1028+ char *copy[2];
1029+ size_t len[2];
1030+ mbstate_t state[2];
1031+ size_t mblength;
1032+ wchar_t wc, uwc;
1033+ mbstate_t state_bak;
1034+
1035+ str[0] = old;
1036+ str[1] = new;
1037+ len[0] = oldlen;
1038+ len[1] = newlen;
1039+ state[0] = oldstate;
1040+ state[1] = newstate;
1041+
1042+ for (i = 0; i < 2; i++)
1043+ {
1044+ copy[i] = alloca (len[i] + 1);
1045+
1046+ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++)
1047+ {
1048+ state_bak = state[i];
1049+ mblength = mbrtowc (&wc, str[i] + j, len[i] - j, &(state[i]));
1050+
1051+ switch (mblength)
1052+ {
1053+ case (size_t)-1:
1054+ case (size_t)-2:
1055+ state[i] = state_bak;
1056+ /* Fall through */
1057+ case 0:
1058+ mblength = 1;
1059+ break;
1060+
1061+ default:
1062+ if (ignore_case)
1063+ {
1064+ uwc = towupper (wc);
1065+
1066+ if (uwc != wc)
1067+ {
1068+ mbstate_t state_wc;
1069+
1070+ memset (&state_wc, '\0', sizeof(mbstate_t));
1071+ wcrtomb (copy[i] + j, uwc, &state_wc);
1072+ }
1073+ else
1074+ memcpy (copy[i] + j, str[i] + j, mblength);
1075+ }
1076+ else
1077+ memcpy (copy[i] + j, str[i] + j, mblength);
1078+ }
1079+ j += mblength;
1080+ }
1081+ copy[i][j] = '\0';
1082+ len[i] = j;
1083+ }
1084+
1085+ return xmemcoll (copy[0], len[0], copy[1], len[1]);
1086 }
1087+#endif
1088
1089 /* Output the line in linebuffer LINE to standard output
1090 provided that the switches say it should be output.
1091@@ -295,15 +478,43 @@
1092 {
1093 char *prevfield IF_LINT (= NULL);
1094 size_t prevlen IF_LINT (= 0);
1095+#if HAVE_MBRTOWC
1096+ mbstate_t prevstate;
1097+
1098+ memset (&prevstate, '\0', sizeof (mbstate_t));
1099+#endif
1100
1101 while (!feof (stdin))
1102 {
1103 char *thisfield;
1104 size_t thislen;
1105+#if HAVE_MBRTOWC
1106+ mbstate_t thisstate;
1107+#endif
1108+
1109 if (readlinebuffer (thisline, stdin) == 0)
1110 break;
1111 thisfield = find_field (thisline);
1112 thislen = thisline->length - 1 - (thisfield - thisline->buffer);
1113+#if HAVE_MBRTOWC
1114+ if (MB_CUR_MAX > 1)
1115+ {
1116+ thisstate = thisline->state;
1117+
1118+ if (prevline->length == 0 || different_multi
1119+ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate))
1120+ {
1121+ fwrite (thisline->buffer, sizeof (char),
1122+ thisline->length, stdout);
1123+
1124+ SWAP_LINES (prevline, thisline);
1125+ prevfield = thisfield;
1126+ prevlen = thislen;
1127+ prevstate = thisstate;
1128+ }
1129+ }
1130+ else
1131+#endif
1132 if (prevline->length == 0
1133 || different (thisfield, prevfield, thislen, prevlen))
1134 {
1135@@ -322,17 +533,26 @@
1136 size_t prevlen;
1137 uintmax_t match_count = 0;
1138 bool first_delimiter = true;
1139+#if HAVE_MBRTOWC
1140+ mbstate_t prevstate;
1141+#endif
1142
1143 if (readlinebuffer (prevline, stdin) == 0)
1144 goto closefiles;
1145 prevfield = find_field (prevline);
1146 prevlen = prevline->length - 1 - (prevfield - prevline->buffer);
1147+#if HAVE_MBRTOWC
1148+ prevstate = prevline->state;
1149+#endif
1150
1151 while (!feof (stdin))
1152 {
1153 bool match;
1154 char *thisfield;
1155 size_t thislen;
1156+#if HAVE_MBRTOWC
1157+ mbstate_t thisstate;
1158+#endif
1159 if (readlinebuffer (thisline, stdin) == 0)
1160 {
1161 if (ferror (stdin))
1162@@ -341,6 +561,15 @@
1163 }
1164 thisfield = find_field (thisline);
1165 thislen = thisline->length - 1 - (thisfield - thisline->buffer);
1166+#if HAVE_MBRTOWC
1167+ if (MB_CUR_MAX > 1)
1168+ {
1169+ thisstate = thisline->state;
1170+ match = !different_multi (thisfield, prevfield,
1171+ thislen, prevlen, thisstate, prevstate);
1172+ }
1173+ else
1174+#endif
1175 match = !different (thisfield, prevfield, thislen, prevlen);
1176 match_count += match;
1177
1178@@ -373,6 +602,9 @@
1179 SWAP_LINES (prevline, thisline);
1180 prevfield = thisfield;
1181 prevlen = thislen;
1182+#if HAVE_MBRTOWC
1183+ prevstate = thisstate;
1184+#endif
1185 if (!match)
1186 match_count = 0;
1187 }
1188@@ -417,6 +649,19 @@
1189
1190 atexit (close_stdout);
1191
1192+#if HAVE_MBRTOWC
1193+ if (MB_CUR_MAX > 1)
1194+ {
1195+ find_field = find_field_multi;
1196+ }
1197+ else
1198+#endif
1199+ {
1200+ find_field = find_field_uni;
1201+ }
1202+
1203+
1204+
1205 skip_chars = 0;
1206 skip_fields = 0;
1207 check_chars = SIZE_MAX;
1208--- coreutils-6.8+/src/fold.c.i18n 2007-02-23 12:01:47.000000000 +0000
1209+++ coreutils-6.8+/src/fold.c 2007-03-01 15:08:24.000000000 +0000
1210@@ -23,11 +23,33 @@
1211 #include <getopt.h>
1212 #include <sys/types.h>
1213
1214+/* Get mbstate_t, mbrtowc(), wcwidth(). */
1215+#if HAVE_WCHAR_H
1216+# include <wchar.h>
1217+#endif
1218+
1219+/* Get iswprint(), iswblank(), wcwidth(). */
1220+#if HAVE_WCTYPE_H
1221+# include <wctype.h>
1222+#endif
1223+
1224 #include "system.h"
1225 #include "error.h"
1226 #include "quote.h"
1227 #include "xstrtol.h"
1228
1229+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
1230+ installation; work around this configuration error. */
1231+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
1232+# undef MB_LEN_MAX
1233+# define MB_LEN_MAX 16
1234+#endif
1235+
1236+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
1237+#if HAVE_MBRTOWC && defined mbstate_t
1238+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
1239+#endif
1240+
1241 #define TAB_WIDTH 8
1242
1243 /* The official name of this program (e.g., no `g' prefix). */
1244@@ -35,23 +57,44 @@
1245
1246 #define AUTHORS "David MacKenzie"
1247
1248+#define FATAL_ERROR(Message) \
1249+ do \
1250+ { \
1251+ error (0, 0, (Message)); \
1252+ usage (2); \
1253+ } \
1254+ while (0)
1255+
1256+enum operating_mode
1257+{
1258+ /* Fold texts by columns that are at the given positions. */
1259+ column_mode,
1260+
1261+ /* Fold texts by bytes that are at the given positions. */
1262+ byte_mode,
1263+
1264+ /* Fold texts by characters that are at the given positions. */
1265+ character_mode,
1266+};
1267+
1268 /* The name this program was run with. */
1269 char *program_name;
1270
1271+/* The argument shows current mode. (Default: column_mode) */
1272+static enum operating_mode operating_mode;
1273+
1274 /* If nonzero, try to break on whitespace. */
1275 static bool break_spaces;
1276
1277-/* If nonzero, count bytes, not column positions. */
1278-static bool count_bytes;
1279-
1280 /* If nonzero, at least one of the files we read was standard input. */
1281 static bool have_read_stdin;
1282
1283-static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::";
1284+static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::";
1285
1286 static struct option const longopts[] =
1287 {
1288 {"bytes", no_argument, NULL, 'b'},
1289+ {"characters", no_argument, NULL, 'c'},
1290 {"spaces", no_argument, NULL, 's'},
1291 {"width", required_argument, NULL, 'w'},
1292 {GETOPT_HELP_OPTION_DECL},
1293@@ -81,6 +124,7 @@
1294 "), stdout);
1295 fputs (_("\
1296 -b, --bytes count bytes rather than columns\n\
1297+ -c, --characters count characters rather than columns\n\
1298 -s, --spaces break at spaces\n\
1299 -w, --width=WIDTH use WIDTH columns instead of 80\n\
1300 "), stdout);
1301@@ -98,7 +142,7 @@
1302 static size_t
1303 adjust_column (size_t column, char c)
1304 {
1305- if (!count_bytes)
1306+ if (operating_mode != byte_mode)
1307 {
1308 if (c == '\b')
1309 {
1310@@ -121,30 +165,14 @@
1311 to stdout, with maximum line length WIDTH.
1312 Return true if successful. */
1313
1314-static bool
1315-fold_file (char const *filename, size_t width)
1316+static void
1317+fold_text (FILE *istream, size_t width, int *saved_errno)
1318 {
1319- FILE *istream;
1320 int c;
1321 size_t column = 0; /* Screen column where next char will go. */
1322 size_t offset_out = 0; /* Index in `line_out' for next char. */
1323 static char *line_out = NULL;
1324 static size_t allocated_out = 0;
1325- int saved_errno;
1326-
1327- if (STREQ (filename, "-"))
1328- {
1329- istream = stdin;
1330- have_read_stdin = true;
1331- }
1332- else
1333- istream = fopen (filename, "r");
1334-
1335- if (istream == NULL)
1336- {
1337- error (0, errno, "%s", filename);
1338- return false;
1339- }
1340
1341 while ((c = getc (istream)) != EOF)
1342 {
1343@@ -172,6 +200,15 @@
1344 bool found_blank = false;
1345 size_t logical_end = offset_out;
1346
1347+ /* If LINE_OUT has no wide character,
1348+ put a new wide character in LINE_OUT
1349+ if column is bigger than width. */
1350+ if (offset_out == 0)
1351+ {
1352+ line_out[offset_out++] = c;
1353+ continue;
1354+ }
1355+
1356 /* Look for the last blank. */
1357 while (logical_end)
1358 {
1359@@ -218,11 +255,225 @@
1360 line_out[offset_out++] = c;
1361 }
1362
1363- saved_errno = errno;
1364+ *saved_errno = errno;
1365+
1366+ if (offset_out)
1367+ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
1368+
1369+ free(line_out);
1370+}
1371+
1372+#if HAVE_MBRTOWC
1373+static void
1374+fold_multibyte_text (FILE *istream, size_t width, int *saved_errno)
1375+{
1376+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
1377+ size_t buflen = 0; /* The length of the byte sequence in buf. */
1378+ char *bufpos; /* Next read position of BUF. */
1379+ wint_t wc; /* A gotten wide character. */
1380+ size_t mblength; /* The byte size of a multibyte character which shows
1381+ as same character as WC. */
1382+ mbstate_t state, state_bak; /* State of the stream. */
1383+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
1384+
1385+ char *line_out = NULL;
1386+ size_t offset_out = 0; /* Index in `line_out' for next char. */
1387+ size_t allocated_out = 0;
1388+
1389+ int increment;
1390+ size_t column = 0;
1391+
1392+ size_t last_blank_pos;
1393+ size_t last_blank_column;
1394+ int is_blank_seen;
1395+ int last_blank_increment;
1396+ int is_bs_following_last_blank;
1397+ size_t bs_following_last_blank_num;
1398+ int is_cr_after_last_blank;
1399+
1400+#define CLEAR_FLAGS \
1401+ do \
1402+ { \
1403+ last_blank_pos = 0; \
1404+ last_blank_column = 0; \
1405+ is_blank_seen = 0; \
1406+ is_bs_following_last_blank = 0; \
1407+ bs_following_last_blank_num = 0; \
1408+ is_cr_after_last_blank = 0; \
1409+ } \
1410+ while (0)
1411+
1412+#define START_NEW_LINE \
1413+ do \
1414+ { \
1415+ putchar ('\n'); \
1416+ column = 0; \
1417+ offset_out = 0; \
1418+ CLEAR_FLAGS; \
1419+ } \
1420+ while (0)
1421+
1422+ CLEAR_FLAGS;
1423+ memset (&state, '\0', sizeof(mbstate_t));
1424+
1425+ for (;; bufpos += mblength, buflen -= mblength)
1426+ {
1427+ if (buflen < MB_LEN_MAX && !feof (istream) && !ferror (istream))
1428+ {
1429+ memmove (buf, bufpos, buflen);
1430+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, istream);
1431+ bufpos = buf;
1432+ }
1433+
1434+ if (buflen < 1)
1435+ break;
1436+
1437+ /* Get a wide character. */
1438+ convfail = 0;
1439+ state_bak = state;
1440+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state);
1441+
1442+ switch (mblength)
1443+ {
1444+ case (size_t)-1:
1445+ case (size_t)-2:
1446+ convfail++;
1447+ state = state_bak;
1448+ /* Fall through. */
1449+
1450+ case 0:
1451+ mblength = 1;
1452+ break;
1453+ }
1454+
1455+rescan:
1456+ if (operating_mode == byte_mode) /* byte mode */
1457+ increment = mblength;
1458+ else if (operating_mode == character_mode) /* character mode */
1459+ increment = 1;
1460+ else /* column mode */
1461+ {
1462+ if (convfail)
1463+ increment = 1;
1464+ else
1465+ {
1466+ switch (wc)
1467+ {
1468+ case L'\n':
1469+ fwrite (line_out, sizeof(char), offset_out, stdout);
1470+ START_NEW_LINE;
1471+ continue;
1472+
1473+ case L'\b':
1474+ increment = (column > 0) ? -1 : 0;
1475+ break;
1476+
1477+ case L'\r':
1478+ increment = -1 * column;
1479+ break;
1480+
1481+ case L'\t':
1482+ increment = 8 - column % 8;
1483+ break;
1484+
1485+ default:
1486+ increment = wcwidth (wc);
1487+ increment = (increment < 0) ? 0 : increment;
1488+ }
1489+ }
1490+ }
1491+
1492+ if (column + increment > width && break_spaces && last_blank_pos)
1493+ {
1494+ fwrite (line_out, sizeof(char), last_blank_pos, stdout);
1495+ putchar ('\n');
1496+
1497+ offset_out = offset_out - last_blank_pos;
1498+ column = column - last_blank_column + ((is_cr_after_last_blank)
1499+ ? last_blank_increment : bs_following_last_blank_num);
1500+ memmove (line_out, line_out + last_blank_pos, offset_out);
1501+ CLEAR_FLAGS;
1502+ goto rescan;
1503+ }
1504+
1505+ if (column + increment > width && column != 0)
1506+ {
1507+ fwrite (line_out, sizeof(char), offset_out, stdout);
1508+ START_NEW_LINE;
1509+ goto rescan;
1510+ }
1511+
1512+ if (allocated_out < offset_out + mblength)
1513+ {
1514+ allocated_out += 1024;
1515+ line_out = xrealloc (line_out, allocated_out);
1516+ }
1517+
1518+ memcpy (line_out + offset_out, bufpos, mblength);
1519+ offset_out += mblength;
1520+ column += increment;
1521+
1522+ if (is_blank_seen && !convfail && wc == L'\r')
1523+ is_cr_after_last_blank = 1;
1524+
1525+ if (is_bs_following_last_blank && !convfail && wc == L'\b')
1526+ ++bs_following_last_blank_num;
1527+ else
1528+ is_bs_following_last_blank = 0;
1529+
1530+ if (break_spaces && !convfail && iswblank (wc))
1531+ {
1532+ last_blank_pos = offset_out;
1533+ last_blank_column = column;
1534+ is_blank_seen = 1;
1535+ last_blank_increment = increment;
1536+ is_bs_following_last_blank = 1;
1537+ bs_following_last_blank_num = 0;
1538+ is_cr_after_last_blank = 0;
1539+ }
1540+ }
1541+
1542+ *saved_errno = errno;
1543
1544 if (offset_out)
1545 fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
1546
1547+ free(line_out);
1548+}
1549+#endif
1550+
1551+/* Fold file FILENAME, or standard input if FILENAME is "-",
1552+ to stdout, with maximum line length WIDTH.
1553+ Return 0 if successful, 1 if an error occurs. */
1554+
1555+static bool
1556+fold_file (char *filename, size_t width)
1557+{
1558+ FILE *istream;
1559+ int saved_errno;
1560+
1561+ if (STREQ (filename, "-"))
1562+ {
1563+ istream = stdin;
1564+ have_read_stdin = 1;
1565+ }
1566+ else
1567+ istream = fopen (filename, "r");
1568+
1569+ if (istream == NULL)
1570+ {
1571+ error (0, errno, "%s", filename);
1572+ return 1;
1573+ }
1574+
1575+ /* Define how ISTREAM is being folded. */
1576+#if HAVE_MBRTOWC
1577+ if (MB_CUR_MAX > 1)
1578+ fold_multibyte_text (istream, width, &saved_errno);
1579+ else
1580+#endif
1581+ fold_text (istream, width, &saved_errno);
1582+
1583 if (ferror (istream))
1584 {
1585 error (0, saved_errno, "%s", filename);
1586@@ -255,7 +506,8 @@
1587
1588 atexit (close_stdout);
1589
1590- break_spaces = count_bytes = have_read_stdin = false;
1591+ operating_mode = column_mode;
1592+ break_spaces = have_read_stdin = false;
1593
1594 while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
1595 {
1596@@ -264,7 +516,15 @@
1597 switch (optc)
1598 {
1599 case 'b': /* Count bytes rather than columns. */
1600- count_bytes = true;
1601+ if (operating_mode != column_mode)
1602+ FATAL_ERROR (_("only one way of folding may be specified"));
1603+ operating_mode = byte_mode;
1604+ break;
1605+
1606+ case 'c':
1607+ if (operating_mode != column_mode)
1608+ FATAL_ERROR (_("only one way of folding may be specified"));
1609+ operating_mode = character_mode;
1610 break;
1611
1612 case 's': /* Break at word boundaries. */
1613--- coreutils-6.8+/src/sort.c.i18n 2007-02-24 11:23:23.000000000 +0000
1614+++ coreutils-6.8+/src/sort.c 2007-03-01 15:10:57.000000000 +0000
1615@@ -23,10 +23,19 @@
1616
1617 #include <config.h>
1618
1619+#include <assert.h>
1620 #include <getopt.h>
1621 #include <sys/types.h>
1622 #include <sys/wait.h>
1623 #include <signal.h>
1624+#if HAVE_WCHAR_H
1625+# include <wchar.h>
1626+#endif
1627+/* Get isw* functions. */
1628+#if HAVE_WCTYPE_H
1629+# include <wctype.h>
1630+#endif
1631+
1632 #include "system.h"
1633 #include "argmatch.h"
1634 #include "error.h"
1635@@ -116,14 +125,38 @@
1636 /* Thousands separator; if -1, then there isn't one. */
1637 static int thousands_sep;
1638
1639+static int force_general_numcompare = 0;
1640+
1641 /* Nonzero if the corresponding locales are hard. */
1642 static bool hard_LC_COLLATE;
1643-#if HAVE_NL_LANGINFO
1644+#if HAVE_LANGINFO_CODESET
1645 static bool hard_LC_TIME;
1646 #endif
1647
1648 #define NONZERO(x) ((x) != 0)
1649
1650+/* get a multibyte character's byte length. */
1651+#define GET_BYTELEN_OF_CHAR(LIM, PTR, MBLENGTH, STATE) \
1652+ do \
1653+ { \
1654+ wchar_t wc; \
1655+ mbstate_t state_bak; \
1656+ \
1657+ state_bak = STATE; \
1658+ mblength = mbrtowc (&wc, PTR, LIM - PTR, &STATE); \
1659+ \
1660+ switch (MBLENGTH) \
1661+ { \
1662+ case (size_t)-1: \
1663+ case (size_t)-2: \
1664+ STATE = state_bak; \
1665+ /* Fall through. */ \
1666+ case 0: \
1667+ MBLENGTH = 1; \
1668+ } \
1669+ } \
1670+ while (0)
1671+
1672 /* The kind of blanks for '-b' to skip in various options. */
1673 enum blanktype { bl_start, bl_end, bl_both };
1674
1675@@ -261,13 +294,11 @@
1676 they were read if all keys compare equal. */
1677 static bool stable;
1678
1679-/* If TAB has this value, blanks separate fields. */
1680-enum { TAB_DEFAULT = CHAR_MAX + 1 };
1681-
1682-/* Tab character separating fields. If TAB_DEFAULT, then fields are
1683+/* Tab character separating fields. If tab_length is 0, then fields are
1684 separated by the empty string between a non-blank character and a blank
1685 character. */
1686-static int tab = TAB_DEFAULT;
1687+static char tab[MB_LEN_MAX + 1];
1688+static size_t tab_length = 0;
1689
1690 /* Flag to remove consecutive duplicate lines from the output.
1691 Only the last of a sequence of equal lines will be output. */
1692@@ -639,6 +670,44 @@
1693 update_proc (pid);
1694 }
1695
1696+/* Function pointers. */
1697+static void
1698+(*inittables) (void);
1699+static char *
1700+(*begfield) (const struct line*, const struct keyfield *);
1701+static char *
1702+(*limfield) (const struct line*, const struct keyfield *);
1703+static int
1704+(*getmonth) (char const *, size_t);
1705+static int
1706+(*keycompare) (const struct line *, const struct line *);
1707+static int
1708+(*numcompare) (const char *, const char *);
1709+
1710+/* Test for white space multibyte character.
1711+ Set LENGTH the byte length of investigated multibyte character. */
1712+#if HAVE_MBRTOWC
1713+static int
1714+ismbblank (const char *str, size_t len, size_t *length)
1715+{
1716+ size_t mblength;
1717+ wchar_t wc;
1718+ mbstate_t state;
1719+
1720+ memset (&state, '\0', sizeof(mbstate_t));
1721+ mblength = mbrtowc (&wc, str, len, &state);
1722+
1723+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
1724+ {
1725+ *length = 1;
1726+ return 0;
1727+ }
1728+
1729+ *length = (mblength < 1) ? 1 : mblength;
1730+ return iswblank (wc);
1731+}
1732+#endif
1733+
1734 /* Clean up any remaining temporary files. */
1735
1736 static void
1737@@ -978,7 +1047,7 @@
1738 free (node);
1739 }
1740
1741-#if HAVE_NL_LANGINFO
1742+#if HAVE_LANGINFO_CODESET
1743
1744 static int
1745 struct_month_cmp (const void *m1, const void *m2)
1746@@ -993,7 +1062,7 @@
1747 /* Initialize the character class tables. */
1748
1749 static void
1750-inittables (void)
1751+inittables_uni (void)
1752 {
1753 size_t i;
1754
1755@@ -1005,7 +1074,7 @@
1756 fold_toupper[i] = toupper (i);
1757 }
1758
1759-#if HAVE_NL_LANGINFO
1760+#if HAVE_LANGINFO_CODESET
1761 /* If we're not in the "C" locale, read different names for months. */
1762 if (hard_LC_TIME)
1763 {
1764@@ -1031,6 +1100,64 @@
1765 #endif
1766 }
1767
1768+#if HAVE_MBRTOWC
1769+static void
1770+inittables_mb (void)
1771+{
1772+ int i, j, k, l;
1773+ char *name, *s;
1774+ size_t s_len, mblength;
1775+ char mbc[MB_LEN_MAX];
1776+ wchar_t wc, pwc;
1777+ mbstate_t state_mb, state_wc;
1778+
1779+ for (i = 0; i < MONTHS_PER_YEAR; i++)
1780+ {
1781+ s = (char *) nl_langinfo (ABMON_1 + i);
1782+ s_len = strlen (s);
1783+ monthtab[i].name = name = (char *) xmalloc (s_len + 1);
1784+ monthtab[i].val = i + 1;
1785+
1786+ memset (&state_mb, '\0', sizeof (mbstate_t));
1787+ memset (&state_wc, '\0', sizeof (mbstate_t));
1788+
1789+ for (j = 0; j < s_len;)
1790+ {
1791+ if (!ismbblank (s + j, s_len - j, &mblength))
1792+ break;
1793+ j += mblength;
1794+ }
1795+
1796+ for (k = 0; j < s_len;)
1797+ {
1798+ mblength = mbrtowc (&wc, (s + j), (s_len - j), &state_mb);
1799+ assert (mblength != (size_t)-1 && mblength != (size_t)-2);
1800+ if (mblength == 0)
1801+ break;
1802+
1803+ pwc = towupper (wc);
1804+ if (pwc == wc)
1805+ {
1806+ memcpy (mbc, s + j, mblength);
1807+ j += mblength;
1808+ }
1809+ else
1810+ {
1811+ j += mblength;
1812+ mblength = wcrtomb (mbc, pwc, &state_wc);
1813+ assert (mblength != (size_t)0 && mblength != (size_t)-1);
1814+ }
1815+
1816+ for (l = 0; l < mblength; l++)
1817+ name[k++] = mbc[l];
1818+ }
1819+ name[k] = '\0';
1820+ }
1821+ qsort ((void *) monthtab, MONTHS_PER_YEAR,
1822+ sizeof (struct month), struct_month_cmp);
1823+}
1824+#endif
1825+
1826 /* Specify the amount of main memory to use when sorting. */
1827 static void
1828 specify_sort_size (char const *s)
1829@@ -1241,7 +1368,7 @@
1830 by KEY in LINE. */
1831
1832 static char *
1833-begfield (const struct line *line, const struct keyfield *key)
1834+begfield_uni (const struct line *line, const struct keyfield *key)
1835 {
1836 char *ptr = line->text, *lim = ptr + line->length - 1;
1837 size_t sword = key->sword;
1838@@ -1251,10 +1378,10 @@
1839 /* The leading field separator itself is included in a field when -t
1840 is absent. */
1841
1842- if (tab != TAB_DEFAULT)
1843+ if (tab_length)
1844 while (ptr < lim && sword--)
1845 {
1846- while (ptr < lim && *ptr != tab)
1847+ while (ptr < lim && *ptr != tab[0])
1848 ++ptr;
1849 if (ptr < lim)
1850 ++ptr;
1851@@ -1282,11 +1409,70 @@
1852 return ptr;
1853 }
1854
1855+#if HAVE_MBRTOWC
1856+static char *
1857+begfield_mb (const struct line *line, const struct keyfield *key)
1858+{
1859+ int i;
1860+ char *ptr = line->text, *lim = ptr + line->length - 1;
1861+ size_t sword = key->sword;
1862+ size_t schar = key->schar;
1863+ size_t mblength;
1864+ mbstate_t state;
1865+
1866+ memset (&state, '\0', sizeof(mbstate_t));
1867+
1868+ if (tab_length)
1869+ while (ptr < lim && sword--)
1870+ {
1871+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
1872+ {
1873+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1874+ ptr += mblength;
1875+ }
1876+ if (ptr < lim)
1877+ {
1878+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1879+ ptr += mblength;
1880+ }
1881+ }
1882+ else
1883+ while (ptr < lim && sword--)
1884+ {
1885+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
1886+ ptr += mblength;
1887+ if (ptr < lim)
1888+ {
1889+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1890+ ptr += mblength;
1891+ }
1892+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
1893+ ptr += mblength;
1894+ }
1895+
1896+ if (key->skipsblanks)
1897+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
1898+ ptr += mblength;
1899+
1900+ for (i = 0; i < schar; i++)
1901+ {
1902+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1903+
1904+ if (ptr + mblength > lim)
1905+ break;
1906+ else
1907+ ptr += mblength;
1908+ }
1909+
1910+ return ptr;
1911+}
1912+#endif
1913+
1914 /* Return the limit of (a pointer to the first character after) the field
1915 in LINE specified by KEY. */
1916
1917 static char *
1918-limfield (const struct line *line, const struct keyfield *key)
1919+limfield_uni (const struct line *line, const struct keyfield *key)
1920 {
1921 char *ptr = line->text, *lim = ptr + line->length - 1;
1922 size_t eword = key->eword, echar = key->echar;
1923@@ -1299,10 +1485,10 @@
1924 `beginning' is the first character following the delimiting TAB.
1925 Otherwise, leave PTR pointing at the first `blank' character after
1926 the preceding field. */
1927- if (tab != TAB_DEFAULT)
1928+ if (tab_length)
1929 while (ptr < lim && eword--)
1930 {
1931- while (ptr < lim && *ptr != tab)
1932+ while (ptr < lim && *ptr != tab[0])
1933 ++ptr;
1934 if (ptr < lim && (eword | echar))
1935 ++ptr;
1936@@ -1348,10 +1534,10 @@
1937 */
1938
1939 /* Make LIM point to the end of (one byte past) the current field. */
1940- if (tab != TAB_DEFAULT)
1941+ if (tab_length)
1942 {
1943 char *newlim;
1944- newlim = memchr (ptr, tab, lim - ptr);
1945+ newlim = memchr (ptr, tab[0], lim - ptr);
1946 if (newlim)
1947 lim = newlim;
1948 }
1949@@ -1384,6 +1570,107 @@
1950 return ptr;
1951 }
1952
1953+#if HAVE_MBRTOWC
1954+static char *
1955+limfield_mb (const struct line *line, const struct keyfield *key)
1956+{
1957+ char *ptr = line->text, *lim = ptr + line->length - 1;
1958+ size_t eword = key->eword, echar = key->echar;
1959+ int i;
1960+ size_t mblength;
1961+ mbstate_t state;
1962+
1963+ memset (&state, '\0', sizeof(mbstate_t));
1964+
1965+ if (tab_length)
1966+ while (ptr < lim && eword--)
1967+ {
1968+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0)
1969+ {
1970+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1971+ ptr += mblength;
1972+ }
1973+ if (ptr < lim && (eword | echar))
1974+ {
1975+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1976+ ptr += mblength;
1977+ }
1978+ }
1979+ else
1980+ while (ptr < lim && eword--)
1981+ {
1982+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
1983+ ptr += mblength;
1984+ if (ptr < lim)
1985+ {
1986+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
1987+ ptr += mblength;
1988+ }
1989+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength))
1990+ ptr += mblength;
1991+ }
1992+
1993+
1994+# ifdef POSIX_UNSPECIFIED
1995+ /* Make LIM point to the end of (one byte past) the current field. */
1996+ if (tab_length)
1997+ {
1998+ char *newlim, *p;
1999+
2000+ newlim = NULL;
2001+ for (p = ptr; p < lim;)
2002+ {
2003+ if (memcmp (p, tab, tab_length) == 0)
2004+ {
2005+ newlim = p;
2006+ break;
2007+ }
2008+
2009+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
2010+ p += mblength;
2011+ }
2012+ }
2013+ else
2014+ {
2015+ char *newlim;
2016+ newlim = ptr;
2017+
2018+ while (newlim < lim && ismbblank (newlim, lim - newlim, &mblength))
2019+ newlim += mblength;
2020+ if (ptr < lim)
2021+ {
2022+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
2023+ ptr += mblength;
2024+ }
2025+ while (newlim < lim && !ismbblank (newlim, lim - newlim, &mblength))
2026+ newlim += mblength;
2027+ lim = newlim;
2028+ }
2029+# endif
2030+
2031+ /* If we're skipping leading blanks, don't start counting characters
2032+ * until after skipping past any leading blanks. */
2033+ if (key->skipsblanks)
2034+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength))
2035+ ptr += mblength;
2036+
2037+ memset (&state, '\0', sizeof(mbstate_t));
2038+
2039+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */
2040+ for (i = 0; i < echar; i++)
2041+ {
2042+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state);
2043+
2044+ if (ptr + mblength > lim)
2045+ break;
2046+ else
2047+ ptr += mblength;
2048+ }
2049+
2050+ return ptr;
2051+}
2052+#endif
2053+
2054 /* Fill BUF reading from FP, moving buf->left bytes from the end
2055 of buf->buf to the beginning first. If EOF is reached and the
2056 file wasn't terminated by a newline, supply one. Set up BUF's line
2057@@ -1466,8 +1753,24 @@
2058 else
2059 {
2060 if (key->skipsblanks)
2061- while (blanks[to_uchar (*line_start)])
2062- line_start++;
2063+ {
2064+#if HAVE_MBRTOWC
2065+ if (MB_CUR_MAX > 1)
2066+ {
2067+ size_t mblength;
2068+ mbstate_t state;
2069+ memset (&state, '\0', sizeof(mbstate_t));
2070+ while (line_start < line->keylim &&
2071+ ismbblank (line_start,
2072+ line->keylim - line_start,
2073+ &mblength))
2074+ line_start += mblength;
2075+ }
2076+ else
2077+#endif
2078+ while (blanks[to_uchar (*line_start)])
2079+ line_start++;
2080+ }
2081 line->keybeg = line_start;
2082 }
2083 }
2084@@ -1500,7 +1803,7 @@
2085 hideously fast. */
2086
2087 static int
2088-numcompare (const char *a, const char *b)
2089+numcompare_uni (const char *a, const char *b)
2090 {
2091 while (blanks[to_uchar (*a)])
2092 a++;
2093@@ -1510,6 +1813,25 @@
2094 return strnumcmp (a, b, decimal_point, thousands_sep);
2095 }
2096
2097+#if HAVE_MBRTOWC
2098+static int
2099+numcompare_mb (const char *a, const char *b)
2100+{
2101+ size_t mblength, len;
2102+ len = strlen (a); /* okay for UTF-8 */
2103+ while (*a && ismbblank (a, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
2104+ {
2105+ a += mblength;
2106+ len -= mblength;
2107+ }
2108+ len = strlen (b); /* okay for UTF-8 */
2109+ while (*b && ismbblank (b, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength))
2110+ b += mblength;
2111+
2112+ return strnumcmp (a, b, decimal_point, thousands_sep);
2113+}
2114+#endif /* HAV_EMBRTOWC */
2115+
2116 static int
2117 general_numcompare (const char *sa, const char *sb)
2118 {
2119@@ -1543,7 +1865,7 @@
2120 Return 0 if the name in S is not recognized. */
2121
2122 static int
2123-getmonth (char const *month, size_t len)
2124+getmonth_uni (char const *month, size_t len)
2125 {
2126 size_t lo = 0;
2127 size_t hi = MONTHS_PER_YEAR;
2128@@ -1698,11 +2020,79 @@
2129 return diff;
2130 }
2131
2132+#if HAVE_MBRTOWC
2133+static int
2134+getmonth_mb (const char *s, size_t len)
2135+{
2136+ char *month;
2137+ register size_t i;
2138+ register int lo = 0, hi = MONTHS_PER_YEAR, result;
2139+ char *tmp;
2140+ size_t wclength, mblength;
2141+ const char **pp;
2142+ const wchar_t **wpp;
2143+ wchar_t *month_wcs;
2144+ mbstate_t state;
2145+
2146+ while (len > 0 && ismbblank (s, len, &mblength))
2147+ {
2148+ s += mblength;
2149+ len -= mblength;
2150+ }
2151+
2152+ if (len == 0)
2153+ return 0;
2154+
2155+ month = (char *) alloca (len + 1);
2156+
2157+ tmp = (char *) alloca (len + 1);
2158+ memcpy (tmp, s, len);
2159+ tmp[len] = '\0';
2160+ pp = (const char **)&tmp;
2161+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t));
2162+ memset (&state, '\0', sizeof(mbstate_t));
2163+
2164+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state);
2165+ assert (wclength != (size_t)-1 && *pp == NULL);
2166+
2167+ for (i = 0; i < wclength; i++)
2168+ {
2169+ month_wcs[i] = towupper(month_wcs[i]);
2170+ if (iswblank (month_wcs[i]))
2171+ {
2172+ month_wcs[i] = L'\0';
2173+ break;
2174+ }
2175+ }
2176+
2177+ wpp = (const wchar_t **)&month_wcs;
2178+
2179+ mblength = wcsrtombs (month, wpp, len + 1, &state);
2180+ assert (mblength != (-1) && *wpp == NULL);
2181+
2182+ do
2183+ {
2184+ int ix = (lo + hi) / 2;
2185+
2186+ if (strncmp (month, monthtab[ix].name, strlen (monthtab[ix].name)) < 0)
2187+ hi = ix;
2188+ else
2189+ lo = ix;
2190+ }
2191+ while (hi - lo > 1);
2192+
2193+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name))
2194+ ? monthtab[lo].val : 0);
2195+
2196+ return result;
2197+}
2198+#endif
2199+
2200 /* Compare two lines A and B trying every key in sequence until there
2201 are no more keys or a difference is found. */
2202
2203 static int
2204-keycompare (const struct line *a, const struct line *b)
2205+keycompare_uni (const struct line *a, const struct line *b)
2206 {
2207 struct keyfield const *key = keylist;
2208
2209@@ -1875,6 +2265,179 @@
2210 return key->reverse ? -diff : diff;
2211 }
2212
2213+#if HAVE_MBRTOWC
2214+static int
2215+keycompare_mb (const struct line *a, const struct line *b)
2216+{
2217+ struct keyfield *key = keylist;
2218+
2219+ /* For the first iteration only, the key positions have been
2220+ precomputed for us. */
2221+ char *texta = a->keybeg;
2222+ char *textb = b->keybeg;
2223+ char *lima = a->keylim;
2224+ char *limb = b->keylim;
2225+
2226+ size_t mblength_a, mblength_b;
2227+ wchar_t wc_a, wc_b;
2228+ mbstate_t state_a, state_b;
2229+
2230+ int diff;
2231+
2232+ memset (&state_a, '\0', sizeof(mbstate_t));
2233+ memset (&state_b, '\0', sizeof(mbstate_t));
2234+
2235+ for (;;)
2236+ {
2237+ unsigned char *translate = (unsigned char *) key->translate;
2238+ bool const *ignore = key->ignore;
2239+
2240+ /* Find the lengths. */
2241+ size_t lena = lima <= texta ? 0 : lima - texta;
2242+ size_t lenb = limb <= textb ? 0 : limb - textb;
2243+
2244+ /* Actually compare the fields. */
2245+ if (key->random)
2246+ diff = compare_random (texta, lena, textb, lenb);
2247+ else if (key->numeric | key->general_numeric)
2248+ {
2249+ char savea = *lima, saveb = *limb;
2250+
2251+ *lima = *limb = '\0';
2252+ if (force_general_numcompare)
2253+ diff = general_numcompare (texta, textb);
2254+ else
2255+ diff = ((key->numeric ? numcompare : general_numcompare)
2256+ (texta, textb));
2257+ *lima = savea, *limb = saveb;
2258+ }
2259+ else if (key->month)
2260+ diff = getmonth (texta, lena) - getmonth (textb, lenb);
2261+ else
2262+ {
2263+ if (ignore || translate)
2264+ {
2265+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1);
2266+ char *copy_b = copy_a + lena + 1;
2267+ size_t new_len_a, new_len_b;
2268+ size_t i, j;
2269+
2270+ /* Ignore and/or translate chars before comparing. */
2271+# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \
2272+ do \
2273+ { \
2274+ wchar_t uwc; \
2275+ char mbc[MB_LEN_MAX]; \
2276+ mbstate_t state_wc; \
2277+ \
2278+ for (NEW_LEN = i = 0; i < LEN;) \
2279+ { \
2280+ mbstate_t state_bak; \
2281+ \
2282+ state_bak = STATE; \
2283+ MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \
2284+ \
2285+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \
2286+ || MBLENGTH == 0) \
2287+ { \
2288+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \
2289+ STATE = state_bak; \
2290+ if (!ignore) \
2291+ COPY[NEW_LEN++] = TEXT[i++]; \
2292+ continue; \
2293+ } \
2294+ \
2295+ if (ignore) \
2296+ { \
2297+ if ((ignore == nonprinting && !iswprint (WC)) \
2298+ || (ignore == nondictionary \
2299+ && !iswalnum (WC) && !iswblank (WC))) \
2300+ { \
2301+ i += MBLENGTH; \
2302+ continue; \
2303+ } \
2304+ } \
2305+ \
2306+ if (translate) \
2307+ { \
2308+ \
2309+ uwc = towupper(WC); \
2310+ if (WC == uwc) \
2311+ { \
2312+ memcpy (mbc, TEXT + i, MBLENGTH); \
2313+ i += MBLENGTH; \
2314+ } \
2315+ else \
2316+ { \
2317+ i += MBLENGTH; \
2318+ WC = uwc; \
2319+ memset (&state_wc, '\0', sizeof (mbstate_t)); \
2320+ \
2321+ MBLENGTH = wcrtomb (mbc, WC, &state_wc); \
2322+ assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \
2323+ } \
2324+ \
2325+ for (j = 0; j < MBLENGTH; j++) \
2326+ COPY[NEW_LEN++] = mbc[j]; \
2327+ } \
2328+ else \
2329+ for (j = 0; j < MBLENGTH; j++) \
2330+ COPY[NEW_LEN++] = TEXT[i++]; \
2331+ } \
2332+ COPY[NEW_LEN] = '\0'; \
2333+ } \
2334+ while (0)
2335+ IGNORE_CHARS (new_len_a, lena, texta, copy_a,
2336+ wc_a, mblength_a, state_a);
2337+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b,
2338+ wc_b, mblength_b, state_b);
2339+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b);
2340+ }
2341+ else if (lena == 0)
2342+ diff = - NONZERO (lenb);
2343+ else if (lenb == 0)
2344+ goto greater;
2345+ else
2346+ diff = xmemcoll (texta, lena, textb, lenb);
2347+ }
2348+
2349+ if (diff)
2350+ goto not_equal;
2351+
2352+ key = key->next;
2353+ if (! key)
2354+ break;
2355+
2356+ /* Find the beginning and limit of the next field. */
2357+ if (key->eword != -1)
2358+ lima = limfield (a, key), limb = limfield (b, key);
2359+ else
2360+ lima = a->text + a->length - 1, limb = b->text + b->length - 1;
2361+
2362+ if (key->sword != -1)
2363+ texta = begfield (a, key), textb = begfield (b, key);
2364+ else
2365+ {
2366+ texta = a->text, textb = b->text;
2367+ if (key->skipsblanks)
2368+ {
2369+ while (texta < lima && ismbblank (texta, lima - texta, &mblength_a))
2370+ texta += mblength_a;
2371+ while (textb < limb && ismbblank (textb, limb - textb, &mblength_b))
2372+ textb += mblength_b;
2373+ }
2374+ }
2375+ }
2376+
2377+ return 0;
2378+
2379+greater:
2380+ diff = 1;
2381+not_equal:
2382+ return key->reverse ? -diff : diff;
2383+}
2384+#endif
2385+
2386 /* Compare two lines A and B, returning negative, zero, or positive
2387 depending on whether A compares less than, equal to, or greater than B. */
2388
2389@@ -2744,7 +3305,7 @@
2390 initialize_exit_failure (SORT_FAILURE);
2391
2392 hard_LC_COLLATE = hard_locale (LC_COLLATE);
2393-#if HAVE_NL_LANGINFO
2394+#if HAVE_LANGINFO_CODESET
2395 hard_LC_TIME = hard_locale (LC_TIME);
2396 #endif
2397
2398@@ -2765,6 +3326,27 @@
2399 thousands_sep = -1;
2400 }
2401
2402+#if HAVE_MBRTOWC
2403+ if (MB_CUR_MAX > 1)
2404+ {
2405+ inittables = inittables_mb;
2406+ begfield = begfield_mb;
2407+ limfield = limfield_mb;
2408+ getmonth = getmonth_mb;
2409+ keycompare = keycompare_mb;
2410+ numcompare = numcompare_mb;
2411+ }
2412+ else
2413+#endif
2414+ {
2415+ inittables = inittables_uni;
2416+ begfield = begfield_uni;
2417+ limfield = limfield_uni;
2418+ getmonth = getmonth_uni;
2419+ keycompare = keycompare_uni;
2420+ numcompare = numcompare_uni;
2421+ }
2422+
2423 have_read_stdin = false;
2424 inittables ();
2425
2426@@ -3015,13 +3597,35 @@
2427
2428 case 't':
2429 {
2430- char newtab = optarg[0];
2431- if (! newtab)
2432+ char newtab[MB_LEN_MAX + 1];
2433+ size_t newtab_length = 1;
2434+ strncpy (newtab, optarg, MB_LEN_MAX);
2435+ if (! newtab[0])
2436 error (SORT_FAILURE, 0, _("empty tab"));
2437- if (optarg[1])
2438+#if HAVE_MBRTOWC
2439+ if (MB_CUR_MAX > 1)
2440+ {
2441+ wchar_t wc;
2442+ mbstate_t state;
2443+ size_t i;
2444+
2445+ memset (&state, '\0', sizeof (mbstate_t));
2446+ newtab_length = mbrtowc (&wc, newtab, strnlen (newtab,
2447+ MB_LEN_MAX),
2448+ &state);
2449+ switch (newtab_length)
2450+ {
2451+ case (size_t) -1:
2452+ case (size_t) -2:
2453+ case 0:
2454+ newtab_length = 1;
2455+ }
2456+ }
2457+#endif
2458+ if (newtab_length == 1 && optarg[1])
2459 {
2460 if (STREQ (optarg, "\\0"))
2461- newtab = '\0';
2462+ newtab[0] = '\0';
2463 else
2464 {
2465 /* Provoke with `sort -txx'. Complain about
2466@@ -3032,9 +3636,12 @@
2467 quote (optarg));
2468 }
2469 }
2470- if (tab != TAB_DEFAULT && tab != newtab)
2471+ if (tab_length
2472+ && (tab_length != newtab_length
2473+ || memcmp (tab, newtab, tab_length) != 0))
2474 error (SORT_FAILURE, 0, _("incompatible tabs"));
2475- tab = newtab;
2476+ memcpy (tab, newtab, newtab_length);
2477+ tab_length = newtab_length;
2478 }
2479 break;
2480
2481--- coreutils-6.8+/src/unexpand.c.i18n 2007-01-14 15:41:28.000000000 +0000
2482+++ coreutils-6.8+/src/unexpand.c 2007-03-01 15:08:24.000000000 +0000
2483@@ -39,11 +39,28 @@
2484 #include <stdio.h>
2485 #include <getopt.h>
2486 #include <sys/types.h>
2487+
2488+/* Get mbstate_t, mbrtowc(), wcwidth(). */
2489+#if HAVE_WCHAR_H
2490+# include <wchar.h>
2491+#endif
2492+
2493 #include "system.h"
2494 #include "error.h"
2495 #include "quote.h"
2496 #include "xstrndup.h"
2497
2498+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
2499+ installation; work around this configuration error. */
2500+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
2501+# define MB_LEN_MAX 16
2502+#endif
2503+
2504+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
2505+#if HAVE_MBRTOWC && defined mbstate_t
2506+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
2507+#endif
2508+
2509 /* The official name of this program (e.g., no `g' prefix). */
2510 #define PROGRAM_NAME "unexpand"
2511
2512@@ -110,6 +127,208 @@
2513 {NULL, 0, NULL, 0}
2514 };
2515
2516+static FILE *next_file (FILE *fp);
2517+
2518+#if HAVE_MBRTOWC
2519+static void
2520+unexpand_multibyte (void)
2521+{
2522+ FILE *fp; /* Input stream. */
2523+ mbstate_t i_state; /* Current shift state of the input stream. */
2524+ mbstate_t i_state_bak; /* Back up the I_STATE. */
2525+ mbstate_t o_state; /* Current shift state of the output stream. */
2526+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
2527+ char *bufpos; /* Next read position of BUF. */
2528+ size_t buflen = 0; /* The length of the byte sequence in buf. */
2529+ wint_t wc; /* A gotten wide character. */
2530+ size_t mblength; /* The byte size of a multibyte character
2531+ which shows as same character as WC. */
2532+
2533+ /* Index in `tab_list' of next tabstop: */
2534+ int tab_index = 0; /* For calculating width of pending tabs. */
2535+ int print_tab_index = 0; /* For printing as many tabs as possible. */
2536+ unsigned int column = 0; /* Column on screen of next char. */
2537+ int next_tab_column; /* Column the next tab stop is on. */
2538+ int convert = 1; /* If nonzero, perform translations. */
2539+ unsigned int pending = 0; /* Pending columns of blanks. */
2540+
2541+ fp = next_file ((FILE *) NULL);
2542+ if (fp == NULL)
2543+ return;
2544+
2545+ memset (&o_state, '\0', sizeof(mbstate_t));
2546+ memset (&i_state, '\0', sizeof(mbstate_t));
2547+
2548+ for (;;)
2549+ {
2550+ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp))
2551+ {
2552+ memmove (buf, bufpos, buflen);
2553+ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp);
2554+ bufpos = buf;
2555+ }
2556+
2557+ /* Get a wide character. */
2558+ if (buflen < 1)
2559+ {
2560+ mblength = 1;
2561+ wc = WEOF;
2562+ }
2563+ else
2564+ {
2565+ i_state_bak = i_state;
2566+ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &i_state);
2567+ }
2568+
2569+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
2570+ {
2571+ i_state = i_state_bak;
2572+ wc = L'\0';
2573+ }
2574+
2575+ if (wc == L' ' && convert && column < INT_MAX)
2576+ {
2577+ ++pending;
2578+ ++column;
2579+ }
2580+ else if (wc == L'\t' && convert)
2581+ {
2582+ if (tab_size == 0)
2583+ {
2584+ /* Do not let tab_index == first_free_tab;
2585+ stop when it is 1 less. */
2586+ while (tab_index < first_free_tab - 1
2587+ && column >= tab_list[tab_index])
2588+ tab_index++;
2589+ next_tab_column = tab_list[tab_index];
2590+ if (tab_index < first_free_tab - 1)
2591+ tab_index++;
2592+ if (column >= next_tab_column)
2593+ {
2594+ convert = 0; /* Ran out of tab stops. */
2595+ goto flush_pend_mb;
2596+ }
2597+ }
2598+ else
2599+ {
2600+ next_tab_column = column + tab_size - column % tab_size;
2601+ }
2602+ pending += next_tab_column - column;
2603+ column = next_tab_column;
2604+ }
2605+ else
2606+ {
2607+flush_pend_mb:
2608+ /* Flush pending spaces. Print as many tabs as possible,
2609+ then print the rest as spaces. */
2610+ if (pending == 1)
2611+ {
2612+ putchar (' ');
2613+ pending = 0;
2614+ }
2615+ column -= pending;
2616+ while (pending > 0)
2617+ {
2618+ if (tab_size == 0)
2619+ {
2620+ /* Do not let print_tab_index == first_free_tab;
2621+ stop when it is 1 less. */
2622+ while (print_tab_index < first_free_tab - 1
2623+ && column >= tab_list[print_tab_index])
2624+ print_tab_index++;
2625+ next_tab_column = tab_list[print_tab_index];
2626+ if (print_tab_index < first_free_tab - 1)
2627+ print_tab_index++;
2628+ }
2629+ else
2630+ {
2631+ next_tab_column =
2632+ column + tab_size - column % tab_size;
2633+ }
2634+ if (next_tab_column - column <= pending)
2635+ {
2636+ putchar ('\t');
2637+ pending -= next_tab_column - column;
2638+ column = next_tab_column;
2639+ }
2640+ else
2641+ {
2642+ --print_tab_index;
2643+ column += pending;
2644+ while (pending != 0)
2645+ {
2646+ putchar (' ');
2647+ pending--;
2648+ }
2649+ }
2650+ }
2651+
2652+ if (wc == WEOF)
2653+ {
2654+ fp = next_file (fp);
2655+ if (fp == NULL)
2656+ break; /* No more files. */
2657+ else
2658+ {
2659+ memset (&i_state, '\0', sizeof(mbstate_t));
2660+ continue;
2661+ }
2662+ }
2663+
2664+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
2665+ {
2666+ if (convert)
2667+ {
2668+ ++column;
2669+ if (convert_entire_line == 0)
2670+ convert = 0;
2671+ }
2672+ mblength = 1;
2673+ putchar (buf[0]);
2674+ }
2675+ else if (mblength == 0)
2676+ {
2677+ if (convert && convert_entire_line == 0)
2678+ convert = 0;
2679+ mblength = 1;
2680+ putchar ('\0');
2681+ }
2682+ else
2683+ {
2684+ if (convert)
2685+ {
2686+ if (wc == L'\b')
2687+ {
2688+ if (column > 0)
2689+ --column;
2690+ }
2691+ else
2692+ {
2693+ int width; /* The width of WC. */
2694+
2695+ width = wcwidth (wc);
2696+ column += (width > 0) ? width : 0;
2697+ if (convert_entire_line == 0)
2698+ convert = 0;
2699+ }
2700+ }
2701+
2702+ if (wc == L'\n')
2703+ {
2704+ tab_index = print_tab_index = 0;
2705+ column = pending = 0;
2706+ convert = 1;
2707+ }
2708+ fwrite (bufpos, sizeof(char), mblength, stdout);
2709+ }
2710+ }
2711+ buflen -= mblength;
2712+ bufpos += mblength;
2713+ }
2714+}
2715+#endif
2716+
2717+
2718 void
2719 usage (int status)
2720 {
2721@@ -531,7 +750,12 @@
2722
2723 file_list = (optind < argc ? &argv[optind] : stdin_argv);
2724
2725- unexpand ();
2726+#if HAVE_MBRTOWC
2727+ if (MB_CUR_MAX > 1)
2728+ unexpand_multibyte ();
2729+ else
2730+#endif
2731+ unexpand ();
2732
2733 if (have_read_stdin && fclose (stdin) != 0)
2734 error (EXIT_FAILURE, errno, "-");
2735--- coreutils-6.8+/src/pr.c.i18n 2007-01-14 15:41:28.000000000 +0000
2736+++ coreutils-6.8+/src/pr.c 2007-03-01 15:08:24.000000000 +0000
2737@@ -313,6 +313,32 @@
2738
2739 #include <getopt.h>
2740 #include <sys/types.h>
2741+
2742+/* Get MB_LEN_MAX. */
2743+#include <limits.h>
2744+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
2745+ installation; work around this configuration error. */
2746+#if !defined MB_LEN_MAX || MB_LEN_MAX == 1
2747+# define MB_LEN_MAX 16
2748+#endif
2749+
2750+/* Get MB_CUR_MAX. */
2751+#include <stdlib.h>
2752+
2753+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
2754+/* Get mbstate_t, mbrtowc(), wcwidth(). */
2755+#if HAVE_WCHAR_H
2756+# include <wchar.h>
2757+#endif
2758+
2759+/* Get iswprint(). -- for wcwidth(). */
2760+#if HAVE_WCTYPE_H
2761+# include <wctype.h>
2762+#endif
2763+#if !defined iswprint && !HAVE_ISWPRINT
2764+# define iswprint(wc) 1
2765+#endif
2766+
2767 #include "system.h"
2768 #include "error.h"
2769 #include "hard-locale.h"
2770@@ -324,6 +350,18 @@
2771 #include "strftime.h"
2772 #include "xstrtol.h"
2773
2774+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
2775+#if HAVE_MBRTOWC && defined mbstate_t
2776+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
2777+#endif
2778+
2779+#ifndef HAVE_DECL_WCWIDTH
2780+"this configure-time declaration test was not run"
2781+#endif
2782+#if !HAVE_DECL_WCWIDTH
2783+extern int wcwidth ();
2784+#endif
2785+
2786 /* The official name of this program (e.g., no `g' prefix). */
2787 #define PROGRAM_NAME "pr"
2788
2789@@ -416,7 +454,20 @@
2790
2791 #define NULLCOL (COLUMN *)0
2792
2793-static int char_to_clump (char c);
2794+/* Funtion pointers to switch functions for single byte locale or for
2795+ multibyte locale. If multibyte functions do not exist in your sysytem,
2796+ these pointers always point the function for single byte locale. */
2797+static void (*print_char) (char c);
2798+static int (*char_to_clump) (char c);
2799+
2800+/* Functions for single byte locale. */
2801+static void print_char_single (char c);
2802+static int char_to_clump_single (char c);
2803+
2804+/* Functions for multibyte locale. */
2805+static void print_char_multi (char c);
2806+static int char_to_clump_multi (char c);
2807+
2808 static bool read_line (COLUMN *p);
2809 static bool print_page (void);
2810 static bool print_stored (COLUMN *p);
2811@@ -426,6 +477,7 @@
2812 static void pad_across_to (int position);
2813 static void add_line_number (COLUMN *p);
2814 static void getoptarg (char *arg, char switch_char, char *character,
2815+ int *character_length, int *character_width,
2816 int *number);
2817 void usage (int status);
2818 static void print_files (int number_of_files, char **av);
2819@@ -440,7 +492,6 @@
2820 static void pad_down (int lines);
2821 static void read_rest_of_line (COLUMN *p);
2822 static void skip_read (COLUMN *p, int column_number);
2823-static void print_char (char c);
2824 static void cleanup (void);
2825 static void print_sep_string (void);
2826 static void separator_string (const char *optarg_S);
2827@@ -455,7 +506,7 @@
2828 we store the leftmost columns contiguously in buff.
2829 To print a line from buff, get the index of the first character
2830 from line_vector[i], and print up to line_vector[i + 1]. */
2831-static char *buff;
2832+static unsigned char *buff;
2833
2834 /* Index of the position in buff where the next character
2835 will be stored. */
2836@@ -559,7 +610,7 @@
2837 static bool untabify_input = false;
2838
2839 /* (-e) The input tab character. */
2840-static char input_tab_char = '\t';
2841+static char input_tab_char[MB_LEN_MAX] = "\t";
2842
2843 /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ...
2844 where the leftmost column is 1. */
2845@@ -569,7 +620,10 @@
2846 static bool tabify_output = false;
2847
2848 /* (-i) The output tab character. */
2849-static char output_tab_char = '\t';
2850+static char output_tab_char[MB_LEN_MAX] = "\t";
2851+
2852+/* (-i) The byte length of output tab character. */
2853+static int output_tab_char_length = 1;
2854
2855 /* (-i) The width of the output tab. */
2856 static int chars_per_output_tab = 8;
2857@@ -643,7 +697,13 @@
2858 static bool numbered_lines = false;
2859
2860 /* (-n) Character which follows each line number. */
2861-static char number_separator = '\t';
2862+static char number_separator[MB_LEN_MAX] = "\t";
2863+
2864+/* (-n) The byte length of the character which follows each line number. */
2865+static int number_separator_length = 1;
2866+
2867+/* (-n) The character width of the character which follows each line number. */
2868+static int number_separator_width = 0;
2869
2870 /* (-n) line counting starts with 1st line of input file (not with 1st
2871 line of 1st page printed). */
2872@@ -696,6 +756,7 @@
2873 -a|COLUMN|-m is a `space' and with the -J option a `tab'. */
2874 static char *col_sep_string = "";
2875 static int col_sep_length = 0;
2876+static int col_sep_width = 0;
2877 static char *column_separator = " ";
2878 static char *line_separator = "\t";
2879
2880@@ -852,6 +913,13 @@
2881 col_sep_length = (int) strlen (optarg_S);
2882 col_sep_string = xmalloc (col_sep_length + 1);
2883 strcpy (col_sep_string, optarg_S);
2884+
2885+#if HAVE_MBRTOWC
2886+ if (MB_CUR_MAX > 1)
2887+ col_sep_width = mbswidth (col_sep_string, 0);
2888+ else
2889+#endif
2890+ col_sep_width = col_sep_length;
2891 }
2892
2893 int
2894@@ -877,6 +945,21 @@
2895
2896 atexit (close_stdout);
2897
2898+/* Define which functions are used, the ones for single byte locale or the ones
2899+ for multibyte locale. */
2900+#if HAVE_MBRTOWC
2901+ if (MB_CUR_MAX > 1)
2902+ {
2903+ print_char = print_char_multi;
2904+ char_to_clump = char_to_clump_multi;
2905+ }
2906+ else
2907+#endif
2908+ {
2909+ print_char = print_char_single;
2910+ char_to_clump = char_to_clump_single;
2911+ }
2912+
2913 n_files = 0;
2914 file_names = (argc > 1
2915 ? xmalloc ((argc - 1) * sizeof (char *))
2916@@ -949,8 +1032,12 @@
2917 break;
2918 case 'e':
2919 if (optarg)
2920- getoptarg (optarg, 'e', &input_tab_char,
2921- &chars_per_input_tab);
2922+ {
2923+ int dummy_length, dummy_width;
2924+
2925+ getoptarg (optarg, 'e', input_tab_char, &dummy_length,
2926+ &dummy_width, &chars_per_input_tab);
2927+ }
2928 /* Could check tab width > 0. */
2929 untabify_input = true;
2930 break;
2931@@ -963,8 +1050,12 @@
2932 break;
2933 case 'i':
2934 if (optarg)
2935- getoptarg (optarg, 'i', &output_tab_char,
2936- &chars_per_output_tab);
2937+ {
2938+ int dummy_width;
2939+
2940+ getoptarg (optarg, 'i', output_tab_char, &output_tab_char_length,
2941+ &dummy_width, &chars_per_output_tab);
2942+ }
2943 /* Could check tab width > 0. */
2944 tabify_output = true;
2945 break;
2946@@ -991,8 +1082,8 @@
2947 case 'n':
2948 numbered_lines = true;
2949 if (optarg)
2950- getoptarg (optarg, 'n', &number_separator,
2951- &chars_per_number);
2952+ getoptarg (optarg, 'n', number_separator, &number_separator_length,
2953+ &number_separator_width, &chars_per_number);
2954 break;
2955 case 'N':
2956 skip_count = false;
2957@@ -1031,7 +1122,7 @@
2958 old_s = false;
2959 /* Reset an additional input of -s, -S dominates -s */
2960 col_sep_string = "";
2961- col_sep_length = 0;
2962+ col_sep_length = col_sep_width = 0;
2963 use_col_separator = true;
2964 if (optarg)
2965 separator_string (optarg);
2966@@ -1188,10 +1279,45 @@
2967 a number. */
2968
2969 static void
2970-getoptarg (char *arg, char switch_char, char *character, int *number)
2971+getoptarg (char *arg, char switch_char, char *character, int *character_length,
2972+ int *character_width, int *number)
2973 {
2974 if (!ISDIGIT (*arg))
2975- *character = *arg++;
2976+ {
2977+#ifdef HAVE_MBRTOWC
2978+ if (MB_CUR_MAX > 1) /* for multibyte locale. */
2979+ {
2980+ wchar_t wc;
2981+ size_t mblength;
2982+ int width;
2983+ mbstate_t state = {'\0'};
2984+
2985+ mblength = mbrtowc (&wc, arg, strnlen(arg, MB_LEN_MAX), &state);
2986+
2987+ if (mblength == (size_t)-1 || mblength == (size_t)-2)
2988+ {
2989+ *character_length = 1;
2990+ *character_width = 1;
2991+ }
2992+ else
2993+ {
2994+ *character_length = (mblength < 1) ? 1 : mblength;
2995+ width = wcwidth (wc);
2996+ *character_width = (width < 0) ? 0 : width;
2997+ }
2998+
2999+ strncpy (character, arg, *character_length);
3000+ arg += *character_length;
3001+ }
3002+ else /* for single byte locale. */
3003+#endif
3004+ {
3005+ *character = *arg++;
3006+ *character_length = 1;
3007+ *character_width = 1;
3008+ }
3009+ }
3010+
3011 if (*arg)
3012 {
3013 long int tmp_long;
3014@@ -1256,7 +1382,7 @@
3015 else
3016 col_sep_string = column_separator;
3017
3018- col_sep_length = 1;
3019+ col_sep_length = col_sep_width = 1;
3020 use_col_separator = true;
3021 }
3022 /* It's rather pointless to define a TAB separator with column
3023@@ -1288,11 +1414,11 @@
3024 TAB_WIDTH (chars_per_input_tab, chars_per_number); */
3025
3026 /* Estimate chars_per_text without any margin and keep it constant. */
3027- if (number_separator == '\t')
3028+ if (number_separator[0] == '\t')
3029 number_width = chars_per_number +
3030 TAB_WIDTH (chars_per_default_tab, chars_per_number);
3031 else
3032- number_width = chars_per_number + 1;
3033+ number_width = chars_per_number + number_separator_width;
3034
3035 /* The number is part of the column width unless we are
3036 printing files in parallel. */
3037@@ -1307,7 +1433,7 @@
3038 }
3039
3040 chars_per_column = (chars_per_line - chars_used_by_number -
3041- (columns - 1) * col_sep_length) / columns;
3042+ (columns - 1) * col_sep_width) / columns;
3043
3044 if (chars_per_column < 1)
3045 error (EXIT_FAILURE, 0, _("page width too narrow"));
3046@@ -1432,7 +1558,7 @@
3047
3048 /* Enlarge p->start_position of first column to use the same form of
3049 padding_not_printed with all columns. */
3050- h = h + col_sep_length;
3051+ h = h + col_sep_width;
3052
3053 /* This loop takes care of all but the rightmost column. */
3054
3055@@ -1466,7 +1592,7 @@
3056 }
3057 else
3058 {
3059- h = h_next + col_sep_length;
3060+ h = h_next + col_sep_width;
3061 h_next = h + chars_per_column;
3062 }
3063 }
3064@@ -1756,9 +1882,9 @@
3065 align_column (COLUMN *p)
3066 {
3067 padding_not_printed = p->start_position;
3068- if (padding_not_printed - col_sep_length > 0)
3069+ if (padding_not_printed - col_sep_width > 0)
3070 {
3071- pad_across_to (padding_not_printed - col_sep_length);
3072+ pad_across_to (padding_not_printed - col_sep_width);
3073 padding_not_printed = ANYWHERE;
3074 }
3075
3076@@ -2029,13 +2155,13 @@
3077 /* May be too generous. */
3078 buff = X2REALLOC (buff, &buff_allocated);
3079 }
3080- buff[buff_current++] = c;
3081+ buff[buff_current++] = (unsigned char) c;
3082 }
3083
3084 static void
3085 add_line_number (COLUMN *p)
3086 {
3087- int i;
3088+ int i, j;
3089 char *s;
3090 int left_cut;
3091
3092@@ -2058,22 +2184,24 @@
3093 /* Tabification is assumed for multiple columns, also for n-separators,
3094 but `default n-separator = TAB' hasn't been given priority over
3095 equal column_width also specified by POSIX. */
3096- if (number_separator == '\t')
3097+ if (number_separator[0] == '\t')
3098 {
3099 i = number_width - chars_per_number;
3100 while (i-- > 0)
3101 (p->char_func) (' ');
3102 }
3103 else
3104- (p->char_func) (number_separator);
3105+ for (j = 0; j < number_separator_length; j++)
3106+ (p->char_func) (number_separator[j]);
3107 }
3108 else
3109 /* To comply with POSIX, we avoid any expansion of default TAB
3110 separator with a single column output. No column_width requirement
3111 has to be considered. */
3112 {
3113- (p->char_func) (number_separator);
3114- if (number_separator == '\t')
3115+ for (j = 0; j < number_separator_length; j++)
3116+ (p->char_func) (number_separator[j]);
3117+ if (number_separator[0] == '\t')
3118 output_position = POS_AFTER_TAB (chars_per_output_tab,
3119 output_position);
3120 }
3121@@ -2234,7 +2362,7 @@
3122 while (goal - h_old > 1
3123 && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
3124 {
3125- putchar (output_tab_char);
3126+ fwrite (output_tab_char, sizeof(char), output_tab_char_length, stdout);
3127 h_old = h_new;
3128 }
3129 while (++h_old <= goal)
3130@@ -2254,6 +2382,7 @@
3131 {
3132 char *s;
3133 int l = col_sep_length;
3134+ int not_space_flag;
3135
3136 s = col_sep_string;
3137
3138@@ -2267,6 +2396,7 @@
3139 {
3140 for (; separators_not_printed > 0; --separators_not_printed)
3141 {
3142+ not_space_flag = 0;
3143 while (l-- > 0)
3144 {
3145 /* 3 types of sep_strings: spaces only, spaces and chars,
3146@@ -2280,12 +2410,15 @@
3147 }
3148 else
3149 {
3150+ not_space_flag = 1;
3151 if (spaces_not_printed > 0)
3152 print_white_space ();
3153 putchar (*s++);
3154- ++output_position;
3155 }
3156 }
3157+ if (not_space_flag)
3158+ output_position += col_sep_width;
3159+
3160 /* sep_string ends with some spaces */
3161 if (spaces_not_printed > 0)
3162 print_white_space ();
3163@@ -2313,7 +2446,7 @@
3164 required number of tabs and spaces. */
3165
3166 static void
3167-print_char (char c)
3168+print_char_single (char c)
3169 {
3170 if (tabify_output)
3171 {
3172@@ -2337,6 +2470,74 @@
3173 putchar (c);
3174 }
3175
3176+#ifdef HAVE_MBRTOWC
3177+static void
3178+print_char_multi (char c)
3179+{
3180+ static size_t mbc_pos = 0;
3181+ static char mbc[MB_LEN_MAX] = {'\0'};
3182+ static mbstate_t state = {'\0'};
3183+ mbstate_t state_bak;
3184+ wchar_t wc;
3185+ size_t mblength;
3186+ int width;
3187+
3188+ if (tabify_output)
3189+ {
3190+ state_bak = state;
3191+ mbc[mbc_pos++] = c;
3192+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
3193+
3194+ while (mbc_pos > 0)
3195+ {
3196+ switch (mblength)
3197+ {
3198+ case (size_t)-2:
3199+ state = state_bak;
3200+ return;
3201+
3202+ case (size_t)-1:
3203+ state = state_bak;
3204+ ++output_position;
3205+ putchar (mbc[0]);
3206+ memmove (mbc, mbc + 1, MB_CUR_MAX - 1);
3207+ --mbc_pos;
3208+ break;
3209+
3210+ case 0:
3211+ mblength = 1;
3212+
3213+ default:
3214+ if (wc == L' ')
3215+ {
3216+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
3217+ --mbc_pos;
3218+ ++spaces_not_printed;
3219+ return;
3220+ }
3221+ else if (spaces_not_printed > 0)
3222+ print_white_space ();
3223+
3224+ /* Nonprintables are assumed to have width 0, except L'\b'. */
3225+ if ((width = wcwidth (wc)) < 1)
3226+ {
3227+ if (wc == L'\b')
3228+ --output_position;
3229+ }
3230+ else
3231+ output_position += width;
3232+
3233+ fwrite (mbc, sizeof(char), mblength, stdout);
3234+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
3235+ mbc_pos -= mblength;
3236+ }
3237+ }
3238+ return;
3239+ }
3240+ putchar (c);
3241+}
3242+#endif
3243+
3244 /* Skip to page PAGE before printing.
3245 PAGE may be larger than total number of pages. */
3246
3247@@ -2517,9 +2718,9 @@
3248 align_empty_cols = false;
3249 }
3250
3251- if (padding_not_printed - col_sep_length > 0)
3252+ if (padding_not_printed - col_sep_width > 0)
3253 {
3254- pad_across_to (padding_not_printed - col_sep_length);
3255+ pad_across_to (padding_not_printed - col_sep_width);
3256 padding_not_printed = ANYWHERE;
3257 }
3258
3259@@ -2620,9 +2821,9 @@
3260 }
3261 }
3262
3263- if (padding_not_printed - col_sep_length > 0)
3264+ if (padding_not_printed - col_sep_width > 0)
3265 {
3266- pad_across_to (padding_not_printed - col_sep_length);
3267+ pad_across_to (padding_not_printed - col_sep_width);
3268 padding_not_printed = ANYWHERE;
3269 }
3270
3271@@ -2635,8 +2836,8 @@
3272 if (spaces_not_printed == 0)
3273 {
3274 output_position = p->start_position + end_vector[line];
3275- if (p->start_position - col_sep_length == chars_per_margin)
3276- output_position -= col_sep_length;
3277+ if (p->start_position - col_sep_width == chars_per_margin)
3278+ output_position -= col_sep_width;
3279 }
3280
3281 return true;
3282@@ -2655,7 +2856,7 @@
3283 number of characters is 1.) */
3284
3285 static int
3286-char_to_clump (char c)
3287+char_to_clump_single (char c)
3288 {
3289 unsigned char uc = c;
3290 char *s = clump_buff;
3291@@ -2665,10 +2866,10 @@
3292 int chars;
3293 int chars_per_c = 8;
3294
3295- if (c == input_tab_char)
3296+ if (c == input_tab_char[0])
3297 chars_per_c = chars_per_input_tab;
3298
3299- if (c == input_tab_char || c == '\t')
3300+ if (c == input_tab_char[0] || c == '\t')
3301 {
3302 width = TAB_WIDTH (chars_per_c, input_position);
3303
3304@@ -2739,6 +2940,154 @@
3305 return chars;
3306 }
3307
3308+#ifdef HAVE_MBRTOWC
3309+static int
3310+char_to_clump_multi (char c)
3311+{
3312+ static size_t mbc_pos = 0;
3313+ static char mbc[MB_LEN_MAX] = {'\0'};
3314+ static mbstate_t state = {'\0'};
3315+ mbstate_t state_bak;
3316+ wchar_t wc;
3317+ size_t mblength;
3318+ int wc_width;
3319+ register char *s = clump_buff;
3320+ register int i, j;
3321+ char esc_buff[4];
3322+ int width;
3323+ int chars;
3324+ int chars_per_c = 8;
3325+
3326+ state_bak = state;
3327+ mbc[mbc_pos++] = c;
3328+ mblength = mbrtowc (&wc, mbc, mbc_pos, &state);
3329+
3330+ width = 0;
3331+ chars = 0;
3332+ while (mbc_pos > 0)
3333+ {
3334+ switch (mblength)
3335+ {
3336+ case (size_t)-2:
3337+ state = state_bak;
3338+ return 0;
3339+
3340+ case (size_t)-1:
3341+ state = state_bak;
3342+ mblength = 1;
3343+
3344+ if (use_esc_sequence || use_cntrl_prefix)
3345+ {
3346+ width = +4;
3347+ chars = +4;
3348+ *s++ = '\\';
3349+ sprintf (esc_buff, "%03o", mbc[0]);
3350+ for (i = 0; i <= 2; ++i)
3351+ *s++ = (int) esc_buff[i];
3352+ }
3353+ else
3354+ {
3355+ width += 1;
3356+ chars += 1;
3357+ *s++ = mbc[0];
3358+ }
3359+ break;
3360+
3361+ case 0:
3362+ mblength = 1;
3363+ /* Fall through */
3364+
3365+ default:
3366+ if (memcmp (mbc, input_tab_char, mblength) == 0)
3367+ chars_per_c = chars_per_input_tab;
3368+
3369+ if (memcmp (mbc, input_tab_char, mblength) == 0 || c == '\t')
3370+ {
3371+ int width_inc;
3372+
3373+ width_inc = TAB_WIDTH (chars_per_c, input_position);
3374+ width += width_inc;
3375+
3376+ if (untabify_input)
3377+ {
3378+ for (i = width_inc; i; --i)
3379+ *s++ = ' ';
3380+ chars += width_inc;
3381+ }
3382+ else
3383+ {
3384+ for (i = 0; i < mblength; i++)
3385+ *s++ = mbc[i];
3386+ chars += mblength;
3387+ }
3388+ }
3389+ else if ((wc_width = wcwidth (wc)) < 1)
3390+ {
3391+ if (use_esc_sequence)
3392+ {
3393+ for (i = 0; i < mblength; i++)
3394+ {
3395+ width += 4;
3396+ chars += 4;
3397+ *s++ = '\\';
3398+ sprintf (esc_buff, "%03o", c);
3399+ for (j = 0; j <= 2; ++j)
3400+ *s++ = (int) esc_buff[j];
3401+ }
3402+ }
3403+ else if (use_cntrl_prefix)
3404+ {
3405+ if (wc < 0200)
3406+ {
3407+ width += 2;
3408+ chars += 2;
3409+ *s++ = '^';
3410+ *s++ = wc ^ 0100;
3411+ }
3412+ else
3413+ {
3414+ for (i = 0; i < mblength; i++)
3415+ {
3416+ width += 4;
3417+ chars += 4;
3418+ *s++ = '\\';
3419+ sprintf (esc_buff, "%03o", c);
3420+ for (j = 0; j <= 2; ++j)
3421+ *s++ = (int) esc_buff[j];
3422+ }
3423+ }
3424+ }
3425+ else if (wc == L'\b')
3426+ {
3427+ width += -1;
3428+ chars += 1;
3429+ *s++ = c;
3430+ }
3431+ else
3432+ {
3433+ width += 0;
3434+ chars += mblength;
3435+ for (i = 0; i < mblength; i++)
3436+ *s++ = mbc[i];
3437+ }
3438+ }
3439+ else
3440+ {
3441+ width += wc_width;
3442+ chars += mblength;
3443+ for (i = 0; i < mblength; i++)
3444+ *s++ = mbc[i];
3445+ }
3446+ }
3447+ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength);
3448+ mbc_pos -= mblength;
3449+ }
3450+
3451+ input_position += width;
3452+ return chars;
3453+}
3454+#endif
3455+
3456 /* We've just printed some files and need to clean up things before
3457 looking for more options and printing the next batch of files.
3458
3459--- coreutils-6.8+/src/cut.c.i18n 2007-01-14 15:41:28.000000000 +0000
3460+++ coreutils-6.8+/src/cut.c 2007-03-01 15:08:24.000000000 +0000
3461@@ -29,6 +29,11 @@
3462 #include <assert.h>
3463 #include <getopt.h>
3464 #include <sys/types.h>
3465+
3466+/* Get mbstate_t, mbrtowc(). */
3467+#if HAVE_WCHAR_H
3468+# include <wchar.h>
3469+#endif
3470 #include "system.h"
3471
3472 #include "error.h"
3473@@ -37,6 +42,18 @@
3474 #include "quote.h"
3475 #include "xstrndup.h"
3476
3477+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC
3478+ installation; work around this configuration error. */
3479+#if !defined MB_LEN_MAX || MB_LEN_MAX < 2
3480+# undef MB_LEN_MAX
3481+# define MB_LEN_MAX 16
3482+#endif
3483+
3484+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */
3485+#if HAVE_MBRTOWC && defined mbstate_t
3486+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0)
3487+#endif
3488+
3489 /* The official name of this program (e.g., no `g' prefix). */
3490 #define PROGRAM_NAME "cut"
3491
3492@@ -67,6 +84,52 @@
3493 } \
3494 while (0)
3495
3496+/* Refill the buffer BUF to get a multibyte character. */
3497+#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \
3498+ do \
3499+ { \
3500+ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \
3501+ { \
3502+ memmove (BUF, BUFPOS, BUFLEN); \
3503+ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \
3504+ BUFPOS = BUF; \
3505+ } \
3506+ } \
3507+ while (0)
3508+
3509+/* Get wide character on BUFPOS. BUFPOS is not included after that.
3510+ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */
3511+#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \
3512+ do \
3513+ { \
3514+ mbstate_t state_bak; \
3515+ \
3516+ if (BUFLEN < 1) \
3517+ { \
3518+ WC = WEOF; \
3519+ break; \
3520+ } \
3521+ \
3522+ /* Get a wide character. */ \
3523+ CONVFAIL = 0; \
3524+ state_bak = STATE; \
3525+ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \
3526+ \
3527+ switch (MBLENGTH) \
3528+ { \
3529+ case (size_t)-1: \
3530+ case (size_t)-2: \
3531+ CONVFAIL++; \
3532+ STATE = state_bak; \
3533+ /* Fall througn. */ \
3534+ \
3535+ case 0: \
3536+ MBLENGTH = 1; \
3537+ break; \
3538+ } \
3539+ } \
3540+ while (0)
3541+
3542 struct range_pair
3543 {
3544 size_t lo;
3545@@ -85,7 +148,7 @@
3546 /* The number of bytes allocated for FIELD_1_BUFFER. */
3547 static size_t field_1_bufsize;
3548
3549-/* The largest field or byte index used as an endpoint of a closed
3550+/* The largest byte, character or field index used as an endpoint of a closed
3551 or degenerate range specification; this doesn't include the starting
3552 index of right-open-ended ranges. For example, with either range spec
3553 `2-5,9-', `2-3,5,9-' this variable would be set to 5. */
3554@@ -97,10 +160,11 @@
3555
3556 /* This is a bit vector.
3557 In byte mode, which bytes to output.
3558+ In character mode, which characters to output.
3559 In field mode, which DELIM-separated fields to output.
3560- Both bytes and fields are numbered starting with 1,
3561+ Bytes, characters and fields are numbered starting with 1,
3562 so the zeroth bit of this array is unused.
3563- A field or byte K has been selected if
3564+ A byte, character or field K has been selected if
3565 (K <= MAX_RANGE_ENDPOINT and is_printable_field(K))
3566 || (EOL_RANGE_START > 0 && K >= EOL_RANGE_START). */
3567 static unsigned char *printable_field;
3568@@ -109,9 +173,12 @@
3569 {
3570 undefined_mode,
3571
3572- /* Output characters that are in the given bytes. */
3573+ /* Output bytes that are at the given positions. */
3574 byte_mode,
3575
3576+ /* Output characters that are at the given positions. */
3577+ character_mode,
3578+
3579 /* Output the given delimeter-separated fields. */
3580 field_mode
3581 };
3582@@ -121,6 +188,13 @@
3583
3584 static enum operating_mode operating_mode;
3585
3586+/* If nonzero, when in byte mode, don't split multibyte characters. */
3587+static int byte_mode_character_aware;
3588+
3589+/* If nonzero, the function for single byte locale is work
3590+ if this program runs on multibyte locale. */
3591+static int force_singlebyte_mode;
3592+
3593 /* If true do not output lines containing no delimeter characters.
3594 Otherwise, all such lines are printed. This option is valid only
3595 with field mode. */
3596@@ -132,6 +206,9 @@
3597
3598 /* The delimeter character for field mode. */
3599 static unsigned char delim;
3600+#if HAVE_WCHAR_H
3601+static wchar_t wcdelim;
3602+#endif
3603
3604 /* True if the --output-delimiter=STRING option was specified. */
3605 static bool output_delimiter_specified;
3606@@ -205,7 +282,7 @@
3607 -f, --fields=LIST select only these fields; also print any line\n\
3608 that contains no delimiter character, unless\n\
3609 the -s option is specified\n\
3610- -n (ignored)\n\
3611+ -n with -b: don't split multibyte characters\n\
3612 "), stdout);
3613 fputs (_("\
3614 --complement complement the set of selected bytes, characters\n\
3615@@ -362,7 +439,7 @@
3616 in_digits = false;
3617 /* Starting a range. */
3618 if (dash_found)
3619- FATAL_ERROR (_("invalid byte or field list"));
3620+ FATAL_ERROR (_("invalid byte, character or field list"));
3621 dash_found = true;
3622 fieldstr++;
3623
3624@@ -387,14 +464,16 @@
3625 if (value == 0)
3626 {
3627 /* `n-'. From `initial' to end of line. */
3628- eol_range_start = initial;
3629+ if (eol_range_start == 0 ||
3630+ (eol_range_start != 0 && eol_range_start > initial))
3631+ eol_range_start = initial;
3632 field_found = true;
3633 }
3634 else
3635 {
3636 /* `m-n' or `-n' (1-n). */
3637 if (value < initial)
3638- FATAL_ERROR (_("invalid byte or field list"));
3639+ FATAL_ERROR (_("invalid byte, character or field list"));
3640
3641 /* Is there already a range going to end of line? */
3642 if (eol_range_start != 0)
3643@@ -467,6 +546,9 @@
3644 if (operating_mode == byte_mode)
3645 error (0, 0,
3646 _("byte offset %s is too large"), quote (bad_num));
3647+ else if (operating_mode == character_mode)
3648+ error (0, 0,
3649+ _("character offset %s is too large"), quote (bad_num));
3650 else
3651 error (0, 0,
3652 _("field number %s is too large"), quote (bad_num));
3653@@ -477,7 +559,7 @@
3654 fieldstr++;
3655 }
3656 else
3657- FATAL_ERROR (_("invalid byte or field list"));
3658+ FATAL_ERROR (_("invalid byte, character or field list"));
3659 }
3660
3661 max_range_endpoint = 0;
3662@@ -570,6 +652,63 @@
3663 }
3664 }
3665
3666+#if HAVE_MBRTOWC
3667+/* This function is in use for the following case.
3668+
3669+ 1. Read from the stream STREAM, printing to standard output any selected
3670+ characters.
3671+
3672+ 2. Read from stream STREAM, printing to standard output any selected bytes,
3673+ without splitting multibyte characters. */
3674+
3675+static void
3676+cut_characters_or_cut_bytes_no_split (FILE *stream)
3677+{
3678+ int idx; /* number of bytes or characters in the line so far. */
3679+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
3680+ char *bufpos; /* Next read position of BUF. */
3681+ size_t buflen; /* The length of the byte sequence in buf. */
3682+ wint_t wc; /* A gotten wide character. */
3683+ size_t mblength; /* The byte size of a multibyte character which shows
3684+ as same character as WC. */
3685+ mbstate_t state; /* State of the stream. */
3686+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
3687+
3688+ idx = 0;
3689+ buflen = 0;
3690+ bufpos = buf;
3691+ memset (&state, '\0', sizeof(mbstate_t));
3692+
3693+ while (1)
3694+ {
3695+ REFILL_BUFFER (buf, bufpos, buflen, stream);
3696+
3697+ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail);
3698+
3699+ if (wc == WEOF)
3700+ {
3701+ if (idx > 0)
3702+ putchar ('\n');
3703+ break;
3704+ }
3705+ else if (wc == L'\n')
3706+ {
3707+ putchar ('\n');
3708+ idx = 0;
3709+ }
3710+ else
3711+ {
3712+ idx += (operating_mode == byte_mode) ? mblength : 1;
3713+ if (print_kth (idx, NULL))
3714+ fwrite (bufpos, mblength, sizeof(char), stdout);
3715+ }
3716+
3717+ buflen -= mblength;
3718+ bufpos += mblength;
3719+ }
3720+}
3721+#endif
3722+
3723 /* Read from stream STREAM, printing to standard output any selected fields. */
3724
3725 static void
3726@@ -692,13 +831,192 @@
3727 }
3728 }
3729
3730+#if HAVE_MBRTOWC
3731+static void
3732+cut_fields_mb (FILE *stream)
3733+{
3734+ int c;
3735+ unsigned int field_idx;
3736+ int found_any_selected_field;
3737+ int buffer_first_field;
3738+ int empty_input;
3739+ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */
3740+ char *bufpos; /* Next read position of BUF. */
3741+ size_t buflen; /* The length of the byte sequence in buf. */
3742+ wint_t wc = 0; /* A gotten wide character. */
3743+ size_t mblength; /* The byte size of a multibyte character which shows
3744+ as same character as WC. */
3745+ mbstate_t state; /* State of the stream. */
3746+ int convfail; /* 1, when conversion is failed. Otherwise 0. */
3747+
3748+ found_any_selected_field = 0;
3749+ field_idx = 1;
3750+ bufpos = buf;
3751+ buflen = 0;
3752+ memset (&state, '\0', sizeof(mbstate_t));
3753+
3754+ c = getc (stream);
3755+ empty_input = (c == EOF);
3756+ if (c != EOF)
3757+ ungetc (c, stream);
3758+ else
3759+ wc = WEOF;
3760+
3761+ /* To support the semantics of the -s flag, we may have to buffer
3762+ all of the first field to determine whether it is `delimited.'
3763+ But that is unnecessary if all non-delimited lines must be printed
3764+ and the first field has been selected, or if non-delimited lines
3765+ must be suppressed and the first field has *not* been selected.
3766+ That is because a non-delimited line has exactly one field. */
3767+ buffer_first_field = (suppress_non_delimited ^ !print_kth (1, NULL));
3768+
3769+ while (1)
3770+ {
3771+ if (field_idx == 1 && buffer_first_field)
3772+ {
3773+ int len = 0;
3774+
3775+ while (1)
3776+ {
3777+ REFILL_BUFFER (buf, bufpos, buflen, stream);
3778+
3779+ GET_NEXT_WC_FROM_BUFFER
3780+ (wc, bufpos, buflen, mblength, state, convfail);
3781+
3782+ if (wc == WEOF)
3783+ break;
3784+
3785+ field_1_buffer = xrealloc (field_1_buffer, len + mblength);
3786+ memcpy (field_1_buffer + len, bufpos, mblength);
3787+ len += mblength;
3788+ buflen -= mblength;
3789+ bufpos += mblength;
3790+
3791+ if (!convfail && (wc == L'\n' || wc == wcdelim))
3792+ break;
3793+ }
3794+
3795+ if (wc == WEOF)
3796+ break;
3797+
3798+ /* If the first field extends to the end of line (it is not
3799+ delimited) and we are printing all non-delimited lines,
3800+ print this one. */
3801+ if (convfail || (!convfail && wc != wcdelim))
3802+ {
3803+ if (suppress_non_delimited)
3804+ {
3805+ /* Empty. */
3806+ }
3807+ else
3808+ {
3809+ fwrite (field_1_buffer, sizeof (char), len, stdout);
3810+ /* Make sure the output line is newline terminated. */
3811+ if (convfail || (!convfail && wc != L'\n'))
3812+ putchar ('\n');
3813+ }
3814+ continue;
3815+ }
3816+
3817+ if (print_kth (1, NULL))
3818+ {
3819+ /* Print the field, but not the trailing delimiter. */
3820+ fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
3821+ found_any_selected_field = 1;
3822+ }
3823+ ++field_idx;
3824+ }
3825+
3826+ if (wc != WEOF)
3827+ {
3828+ if (print_kth (field_idx, NULL))
3829+ {
3830+ if (found_any_selected_field)
3831+ {
3832+ fwrite (output_delimiter_string, sizeof (char),
3833+ output_delimiter_length, stdout);
3834+ }
3835+ found_any_selected_field = 1;
3836+ }
3837+
3838+ while (1)
3839+ {
3840+ REFILL_BUFFER (buf, bufpos, buflen, stream);
3841+
3842+ GET_NEXT_WC_FROM_BUFFER
3843+ (wc, bufpos, buflen, mblength, state, convfail);
3844+
3845+ if (wc == WEOF)
3846+ break;
3847+ else if (!convfail && (wc == wcdelim || wc == L'\n'))
3848+ {
3849+ buflen -= mblength;
3850+ bufpos += mblength;
3851+ break;
3852+ }
3853+
3854+ if (print_kth (field_idx, NULL))
3855+ fwrite (bufpos, mblength, sizeof(char), stdout);
3856+
3857+ buflen -= mblength;
3858+ bufpos += mblength;
3859+ }
3860+ }
3861+
3862+ if ((!convfail || wc == L'\n') && buflen < 1)
3863+ wc = WEOF;
3864+
3865+ if (!convfail && wc == wcdelim)
3866+ ++field_idx;
3867+ else if (wc == WEOF || (!convfail && wc == L'\n'))
3868+ {
3869+ if (found_any_selected_field
3870+ || (!empty_input && !(suppress_non_delimited && field_idx == 1)))
3871+ putchar ('\n');
3872+ if (wc == WEOF)
3873+ break;
3874+ field_idx = 1;
3875+ found_any_selected_field = 0;
3876+ }
3877+ }
3878+}
3879+#endif
3880+
3881 static void
3882 cut_stream (FILE *stream)
3883 {
3884- if (operating_mode == byte_mode)
3885- cut_bytes (stream);
3886+#if HAVE_MBRTOWC
3887+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
3888+ {
3889+ switch (operating_mode)
3890+ {
3891+ case byte_mode:
3892+ if (byte_mode_character_aware)
3893+ cut_characters_or_cut_bytes_no_split (stream);
3894+ else
3895+ cut_bytes (stream);
3896+ break;
3897+
3898+ case character_mode:
3899+ cut_characters_or_cut_bytes_no_split (stream);
3900+ break;
3901+
3902+ case field_mode:
3903+ cut_fields_mb (stream);
3904+ break;
3905+
3906+ default:
3907+ abort ();
3908+ }
3909+ }
3910 else
3911- cut_fields (stream);
3912+#endif
3913+ {
3914+ if (operating_mode == field_mode)
3915+ cut_fields (stream);
3916+ else
3917+ cut_bytes (stream);
3918+ }
3919 }
3920
3921 /* Process file FILE to standard output.
3922@@ -748,6 +1066,8 @@
3923 bool ok;
3924 bool delim_specified = false;
3925 char *spec_list_string IF_LINT(= NULL);
3926+ char mbdelim[MB_LEN_MAX + 1];
3927+ size_t delimlen = 0;
3928
3929 initialize_main (&argc, &argv);
3930 program_name = argv[0];
3931@@ -770,7 +1090,6 @@
3932 switch (optc)
3933 {
3934 case 'b':
3935- case 'c':
3936 /* Build the byte list. */
3937 if (operating_mode != undefined_mode)
3938 FATAL_ERROR (_("only one type of list may be specified"));
3939@@ -778,6 +1097,14 @@
3940 spec_list_string = optarg;
3941 break;
3942
3943+ case 'c':
3944+ /* Build the character list. */
3945+ if (operating_mode != undefined_mode)
3946+ FATAL_ERROR (_("only one type of list may be specified"));
3947+ operating_mode = character_mode;
3948+ spec_list_string = optarg;
3949+ break;
3950+
3951 case 'f':
3952 /* Build the field list. */
3953 if (operating_mode != undefined_mode)
3954@@ -789,10 +1116,35 @@
3955 case 'd':
3956 /* New delimiter. */
3957 /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */
3958- if (optarg[0] != '\0' && optarg[1] != '\0')
3959- FATAL_ERROR (_("the delimiter must be a single character"));
3960- delim = optarg[0];
3961- delim_specified = true;
3962+#if HAVE_MBRTOWC
3963+ {
3964+ if(MB_CUR_MAX > 1)
3965+ {
3966+ mbstate_t state;
3967+
3968+ memset (&state, '\0', sizeof(mbstate_t));
3969+ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state);
3970+
3971+ if (delimlen == (size_t)-1 || delimlen == (size_t)-2)
3972+ ++force_singlebyte_mode;
3973+ else
3974+ {
3975+ delimlen = (delimlen < 1) ? 1 : delimlen;
3976+ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0')
3977+ FATAL_ERROR (_("the delimiter must be a single character"));
3978+ memcpy (mbdelim, optarg, delimlen);
3979+ }
3980+ }
3981+
3982+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
3983+#endif
3984+ {
3985+ if (optarg[0] != '\0' && optarg[1] != '\0')
3986+ FATAL_ERROR (_("the delimiter must be a single character"));
3987+ delim = (unsigned char) optarg[0];
3988+ }
3989+ delim_specified = true;
3990+ }
3991 break;
3992
3993 case OUTPUT_DELIMITER_OPTION:
3994@@ -805,6 +1157,7 @@
3995 break;
3996
3997 case 'n':
3998+ byte_mode_character_aware = 1;
3999 break;
4000
4001 case 's':
4002@@ -827,7 +1180,7 @@
4003 if (operating_mode == undefined_mode)
4004 FATAL_ERROR (_("you must specify a list of bytes, characters, or fields"));
4005
4006- if (delim != '\0' && operating_mode != field_mode)
4007+ if (delim_specified && operating_mode != field_mode)
4008 FATAL_ERROR (_("an input delimiter may be specified only\
4009 when operating on fields"));
4010
4011@@ -854,15 +1207,34 @@
4012 }
4013
4014 if (!delim_specified)
4015- delim = '\t';
4016+ {
4017+ delim = '\t';
4018+#ifdef HAVE_MBRTOWC
4019+ wcdelim = L'\t';
4020+ mbdelim[0] = '\t';
4021+ mbdelim[1] = '\0';
4022+ delimlen = 1;
4023+#endif
4024+ }
4025
4026 if (output_delimiter_string == NULL)
4027 {
4028- static char dummy[2];
4029- dummy[0] = delim;
4030- dummy[1] = '\0';
4031- output_delimiter_string = dummy;
4032- output_delimiter_length = 1;
4033+#ifdef HAVE_MBRTOWC
4034+ if (MB_CUR_MAX > 1 && !force_singlebyte_mode)
4035+ {
4036+ output_delimiter_string = xstrdup(mbdelim);
4037+ output_delimiter_length = delimlen;
4038+ }
4039+
4040+ if (MB_CUR_MAX <= 1 || force_singlebyte_mode)
4041+#endif
4042+ {
4043+ static char dummy[2];
4044+ dummy[0] = delim;
4045+ dummy[1] = '\0';
4046+ output_delimiter_string = dummy;
4047+ output_delimiter_length = 1;
4048+ }
4049 }
4050
4051 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
new file mode 100644
index 0000000000..aba8742f6a
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-ls-x.patch
@@ -0,0 +1,117 @@
1Upstream-Status: Inappropriate [legacy version]
2
3This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
4
5The package is stated as being Licensed as GPLv2+.
6
7Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
8
9--- coreutils-6.9/src/ls.c.ls-x 2007-06-13 14:27:36.000000000 +0100
10+++ coreutils-6.9/src/ls.c 2007-06-13 14:28:42.000000000 +0100
11@@ -4151,16 +4151,16 @@
12 size_t pos = 0;
13 size_t cols = calculate_columns (false);
14 struct column_info const *line_fmt = &column_info[cols - 1];
15- size_t name_length = length_of_file_name_and_frills (cwd_file);
16+ struct fileinfo const *f = sorted_file[0];
17+ size_t name_length = length_of_file_name_and_frills (f);
18 size_t max_name_length = line_fmt->col_arr[0];
19
20 /* Print first entry. */
21- print_file_name_and_frills (cwd_file);
22+ print_file_name_and_frills (f);
23
24 /* Now the rest. */
25 for (filesno = 1; filesno < cwd_n_used; ++filesno)
26 {
27- struct fileinfo const *f;
28 size_t col = filesno % cols;
29
30 if (col == 0)
31--- coreutils-6.9/tests/ls/Makefile.am.ls-x 2007-03-18 21:36:43.000000000 +0000
32+++ coreutils-6.9/tests/ls/Makefile.am 2007-06-13 14:28:42.000000000 +0100
33@@ -24,7 +24,7 @@
34 stat-dtype \
35 inode dangle file-type recursive dired infloop \
36 rt-1 time-1 symlink-slash follow-slink no-arg m-option \
37- stat-vs-dirent
38+ stat-vs-dirent x-option
39
40 EXTRA_DIST = $(TESTS)
41 TESTS_ENVIRONMENT = \
42--- /dev/null 2007-06-13 08:43:51.993263382 +0100
43+++ coreutils-6.9/tests/ls/x-option 2007-06-13 14:28:42.000000000 +0100
44@@ -0,0 +1,59 @@
45+#!/bin/sh
46+# Exercise the -x option.
47+
48+# Copyright (C) 2007 Free Software Foundation, Inc.
49+
50+# This program is free software; you can redistribute it and/or modify
51+# it under the terms of the GNU General Public License as published by
52+# the Free Software Foundation; either version 2 of the License, or
53+# (at your option) any later version.
54+
55+# This program is distributed in the hope that it will be useful,
56+# but WITHOUT ANY WARRANTY; without even the implied warranty of
57+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+# GNU General Public License for more details.
59+
60+# You should have received a copy of the GNU General Public License
61+# along with this program; if not, write to the Free Software
62+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
63+# 02110-1301, USA.
64+
65+if test "$VERBOSE" = yes; then
66+ set -x
67+ ls --version
68+fi
69+
70+. $srcdir/../envvar-check
71+. $srcdir/../lang-default
72+
73+pwd=`pwd`
74+t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
75+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
76+trap '(exit $?); exit $?' 1 2 13 15
77+
78+framework_failure=0
79+mkdir -p $tmp || framework_failure=1
80+cd $tmp || framework_failure=1
81+mkdir subdir || framework_failure=1
82+touch subdir/b || framework_failure=1
83+touch subdir/a || framework_failure=1
84+
85+if test $framework_failure = 1; then
86+ echo "$0: failure in testing framework" 1>&2
87+ (exit 1); exit 1
88+fi
89+
90+fail=0
91+
92+# Coreutils 6.8 and 6.9 would output this in the wrong order.
93+ls -x subdir > out || fail=1
94+ls -rx subdir >> out || fail=1
95+cat <<\EOF > exp || fail=1
96+a b
97+b a
98+EOF
99+
100+cmp out exp || fail=1
101+test $fail = 1 && diff out exp 2> /dev/null
102+
103+(exit $fail); exit $fail
104--- coreutils-6.9/NEWS.ls-x 2007-03-22 21:19:45.000000000 +0000
105+++ coreutils-6.9/NEWS 2007-06-13 14:28:42.000000000 +0100
106@@ -13,6 +13,11 @@
107 Using pr -m -s (i.e. merging files, with TAB as the output separator)
108 no longer inserts extraneous spaces between output columns.
109
110+** Bug fixes
111+
112+ ls -x DIR would sometimes output the wrong string in place of the
113+ first entry. [introduced in coreutils-6.8]
114+
115
116 * Noteworthy changes in release 6.8 (2007-02-24) [not-unstable]
117
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
new file mode 100644
index 0000000000..58074c09a5
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils-overflow.patch
@@ -0,0 +1,19 @@
1Upstream-Status: Inappropriate [legacy version]
2
3This patch was imported from the Fedora Core 8 coreutils-6.9-9 package.
4
5The package is stated as being Licensed as GPLv2+.
6
7Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
8
9--- coreutils-5.2.1/src/who.c.overflow 2005-05-25 09:59:06.000000000 +0100
10+++ coreutils-5.2.1/src/who.c 2005-05-25 10:00:31.000000000 +0100
11@@ -75,7 +75,7 @@
12 # define NEW_TIME 0
13 #endif
14
15-#define IDLESTR_LEN 6
16+#define IDLESTR_LEN 10
17
18 #if HAVE_STRUCT_XTMP_UT_PID
19 # 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
new file mode 100644
index 0000000000..02730dbbb4
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/coreutils_fix_for_automake-1.12.patch
@@ -0,0 +1,32 @@
1Upstream-Status: Pending
2
3automake 1.12 has depricated automatic de-ANSI-fication support
4
5this patch avoids these kinds of errors:
6
7| configure.ac:40: error: automatic de-ANSI-fication support has been removed
8| /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...
9| /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...
10| /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...
11| configure.ac:40: the top level
12| autom4te: m4 failed with exit status: 1
13
14Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
152012/05/04
16
17Index: coreutils-6.9/m4/jm-macros.m4
18===================================================================
19--- coreutils-6.9.orig/m4/jm-macros.m4
20+++ coreutils-6.9/m4/jm-macros.m4
21@@ -142,11 +142,6 @@ AC_DEFUN([gl_CHECK_ALL_TYPES],
22 dnl whether functions and headers are available, whether they work, etc.
23 AC_REQUIRE([AC_SYS_LARGEFILE])
24
25- dnl This test must precede tests of compiler characteristics like
26- dnl that for the inline keyword, since it may change the degree to
27- dnl which the compiler supports such features.
28- AC_REQUIRE([AM_C_PROTOTYPES])
29-
30 dnl Checks for typedefs, structures, and compiler characteristics.
31 AC_REQUIRE([AC_C_BIGENDIAN])
32 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
new file mode 100644
index 0000000000..e0d600a390
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/fix_for_manpage_building.patch
@@ -0,0 +1,85 @@
1Upstream-Status: Inappropriate [legacy version]
2
3Use native coreutils binaries to build manpages in cross environment.
4This avoids man page build issues like this:
5
6| Making all in man
7| make[1]: Entering directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
8| Updating man page cut.1
9| Updating man page dir.1
10| Updating man page expand.1
11| Updating man page fold.1
12| Updating man page install.1
13| Updating man page join.1
14| Updating man page pr.1
15| Updating man page ls.1
16| Updating man page sort.1
17| Updating man page unexpand.1
18| Updating man page uniq.1
19| Updating man page who.1
20| Updating man page vdir.1
21| help2man: can't get `--help' info from dir.td/dir
22| help2man: can't get `--help' info from cut.td/cut
23| make[1]: *** [dir.1] Error 126
24| make[1]: *** Waiting for unfinished jobs....
25| help2man: can't get `--help' info from fold.td/fold
26| help2man: can't get `--help' info from install.td/install
27| help2man: can't get `--help' info from expand.td/expand
28| help2man: can't get `--help' info from join.td/join
29| make[1]: *** [cut.1] Error 126
30| make[1]: *** [fold.1] Error 126
31| make[1]: *** [install.1] Error 126
32| help2man: can't get `--help' info from sort.td/sort
33| make[1]: *** [expand.1] Error 126
34| help2man: can't get `--help' info from pr.td/pr
35| make[1]: *** [join.1] Error 126
36| help2man: can't get `--help' info from ls.td/ls
37| help2man: can't get `--help' info from unexpand.td/unexpand
38| help2man: can't get `--help' info from uniq.td/uniq
39| help2man: can't get `--help' info from who.td/who
40| make[1]: *** [sort.1] Error 126
41| make[1]: *** [pr.1] Error 126
42| help2man: can't get `--help' info from vdir.td/vdir
43| make[1]: *** [ls.1] Error 126
44| make[1]: *** [uniq.1] Error 126
45| make[1]: *** [unexpand.1] Error 126
46| make[1]: *** [who.1] Error 126
47| make[1]: *** [vdir.1] Error 126
48| make[1]: Leaving directory `/build_disk/poky_build/build1/tmp/work/i586-poky-linux/coreutils-6.9-r0/coreutils-6.9/man'
49| make: *** [all-recursive] Error 1
50| FATAL: oe_runmake failed
51| 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)
52NOTE: package coreutils-6.9-r0: task do_compile: Failed
53ERROR: Task 8 (/home/nitin/prj/poky.git/meta/recipes-core/coreutils/coreutils_6.9.bb, do_compile) failed with exit code '1'
54
55
56This patch is made for gplv2 coreutils the recipe
57Nitin A Kamble <nitin.a.kamble@intel.com>
582011/03/17
59
60Index: man/Makefile.am
61===================================================================
62--- a/man.orig/Makefile.am
63+++ b/man/Makefile.am
64@@ -167,7 +167,7 @@ mapped_name = `echo $*|sed 's/install/gi
65 $(PERL) -- $(srcdir)/help2man \
66 --source='$(PACKAGE_STRING)' \
67 --include=$(srcdir)/$*.x \
68- --output=$t/$@ $t/$*; \
69+ --output=$t/$@ $*; \
70 } \
71 && sed 's|$*\.td/||g' $t/$@ > $@ \
72 && chmod a-w $@ \
73Index: man/Makefile.in
74===================================================================
75--- a/man.orig/Makefile.in
76+++ b/man/Makefile.in
77@@ -865,7 +865,7 @@ yes.1: $(common_dep) $(srcdir)/yes.x .
78 $(PERL) -- $(srcdir)/help2man \
79 --source='$(PACKAGE_STRING)' \
80 --include=$(srcdir)/$*.x \
81- --output=$t/$@ $t/$*; \
82+ --output=$t/$@ $*; \
83 } \
84 && sed 's|$*\.td/||g' $t/$@ > $@ \
85 && 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
new file mode 100644
index 0000000000..5ca590bcc6
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/futimens.patch
@@ -0,0 +1,63 @@
1Upstream-Status: Inappropriate [legacy version]
2
3# coreutils uses gnulib which conflicts with newer libc header on futimens
4# this patch simply renames coreutils futimes to avoid confliction
5#
6# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
7# (this patch is licensed under GPLv2)
8
9diff --git a/lib/utimens.c b/lib/utimens.c
10index 71bc510..ae870b8 100644
11--- a/lib/utimens.c
12+++ b/lib/utimens.c
13@@ -75,7 +75,7 @@ struct utimbuf
14 Return 0 on success, -1 (setting errno) on failure. */
15
16 int
17-futimens (int fd ATTRIBUTE_UNUSED,
18+futimens_coreutils (int fd ATTRIBUTE_UNUSED,
19 char const *file, struct timespec const timespec[2])
20 {
21 /* Some Linux-based NFS clients are buggy, and mishandle time stamps
22@@ -185,5 +185,5 @@ futimens (int fd ATTRIBUTE_UNUSED,
23 int
24 utimens (char const *file, struct timespec const timespec[2])
25 {
26- return futimens (-1, file, timespec);
27+ return futimens_coreutils (-1, file, timespec);
28 }
29diff --git a/lib/utimens.h b/lib/utimens.h
30index 0097aaa..13fc45a 100644
31--- a/lib/utimens.h
32+++ b/lib/utimens.h
33@@ -1,3 +1,3 @@
34 #include <time.h>
35-int futimens (int, char const *, struct timespec const [2]);
36+int futimens_coreutils (int, char const *, struct timespec const [2]);
37 int utimens (char const *, struct timespec const [2]);
38diff --git a/src/copy.c b/src/copy.c
39index 4bdb75c..04634f1 100644
40--- a/src/copy.c
41+++ b/src/copy.c
42@@ -518,7 +518,7 @@ copy_reg (char const *src_name, char const *dst_name,
43 timespec[0] = get_stat_atime (src_sb);
44 timespec[1] = get_stat_mtime (src_sb);
45
46- if (futimens (dest_desc, dst_name, timespec) != 0)
47+ if (futimens_coreutils (dest_desc, dst_name, timespec) != 0)
48 {
49 error (0, errno, _("preserving times for %s"), quote (dst_name));
50 if (x->require_preserve)
51diff --git a/src/touch.c b/src/touch.c
52index a79c26d..6ef317d 100644
53--- a/src/touch.c
54+++ b/src/touch.c
55@@ -182,7 +182,7 @@ touch (const char *file)
56 t = timespec;
57 }
58
59- ok = (futimens (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
60+ ok = (futimens_coreutils (fd, (fd == STDOUT_FILENO ? NULL : file), t) == 0);
61
62 if (fd == STDIN_FILENO)
63 {
diff --git a/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch b/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
new file mode 100644
index 0000000000..8f355520bd
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/gnulib_m4.patch
@@ -0,0 +1,21 @@
1Upstream-Status: Inappropriate [legacy version]
2
3# remove the line to cause recursive inclusion error from autoreconf, sicne
4# newer autoconf has included this definition. Simply rename it here.
5#
6# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
7# (this patch is licensed under GPLv2)
8
9diff --git a/extensions.m4 b/extensions.m4
10index 143a9e5..f6558f1 100644
11--- a/m4/extensions.m4
12+++ b/m4/extensions.m4
13@@ -16,7 +16,7 @@
14 # ------------------------
15 # Enable extensions on systems that normally disable them,
16 # typically due to standards-conformance issues.
17-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
18+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS_DUMMY],
19 [
20 AC_BEFORE([$0], [AC_COMPILE_IFELSE])
21 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
new file mode 100644
index 0000000000..c42cb9c059
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-6.9/man-touch.patch
@@ -0,0 +1,24 @@
1Upstream-Status: Inappropriate [legacy version]
2
3# man page for 'touch' is generated differently from others. All other utilities
4# are provided static man source files, while for 'touch' it requires help2man
5# to invoke "touch --help" and then convert the output into the manual. Since touch
6# is with target format which can't be invoked on build system, disable building
7# 'touch' man page here.
8#
9# Signed-off-by Kevin Tian <kevin.tian@intel.com>, 2010-08-18
10# (this patch is licensed under GPLv2)
11
12diff --git a/man/Makefile.am b/man/Makefile.am
13index 32df9d1..37b09e3 100644
14--- a/man/Makefile.am
15+++ b/man/Makefile.am
16@@ -27,7 +27,7 @@ dist_man_MANS = \
17 paste.1 pathchk.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
18 rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \
19 shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 \
20- su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
21+ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 tr.1 true.1 tsort.1 \
22 tty.1 unexpand.1 uniq.1 unlink.1 vdir.1 wc.1 \
23 whoami.1 yes.1 $(MAN)
24 optional_mans = \
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/date-tz-crash.patch b/meta/recipes-core/coreutils/coreutils-8.22/date-tz-crash.patch
new file mode 100644
index 0000000000..570e4fd49c
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.22/date-tz-crash.patch
@@ -0,0 +1,43 @@
1This was reported in http://bugs.gnu.org/16872
2from the coreutils command: date -d 'TZ="""'
3
4The infinite loop for this case was present since the
5initial TZ="" parsing support in commit de95bdc2 29-10-2004.
6This was changed to a crash or heap corruption depending
7on the platform with commit 2e3e4195 18-01-2010.
8
9* lib/parse-datetime.y (parse_datetime): Break out of the
10TZ="" parsing loop once the second significant " is found.
11Also skip over any subsequent whitespace to be consistent
12with the non TZ= case.
13
14Fixes: CVE-2014-9471
15
16Upstream-Status: backport
17
18Signed-off-by: Maxin B. John <maxin.john@enea.com>
19Signed-off-by: Pádraig Brady <P@draigBrady.com>
20---
21diff -Naur coreutils-8.22-origin/lib/parse-datetime.y coreutils-8.22/lib/parse-datetime.y
22--- coreutils-8.22-origin/lib/parse-datetime.y 2013-12-04 15:53:33.000000000 +0100
23+++ coreutils-8.22/lib/parse-datetime.y 2015-01-05 17:11:16.754358184 +0100
24@@ -1303,8 +1303,6 @@
25 char tz1buf[TZBUFSIZE];
26 bool large_tz = TZBUFSIZE < tzsize;
27 bool setenv_ok;
28- /* Free tz0, in case this is the 2nd or subsequent time through. */
29- free (tz0);
30 tz0 = get_tz (tz0buf);
31 z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
32 for (s = tzbase; *s != '"'; s++)
33@@ -1317,6 +1315,10 @@
34 goto fail;
35 tz_was_altered = true;
36 p = s + 1;
37+ while (c = *p, c_isspace (c))
38+ p++;
39+
40+ break;
41 }
42 }
43
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch b/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch
new file mode 100644
index 0000000000..4757f52aa0
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.22/dummy_help2man.patch
@@ -0,0 +1,22 @@
1Upstream-Status: Inappropriate [disable feature]
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4diff -Nurd coreutils-8.21/man/local.mk coreutils-8.21/man/local.mk
5--- coreutils-8.21/man/local.mk 2013-02-05 16:01:21.000000000 +0200
6+++ coreutils-8.21/man/local.mk 2013-03-23 09:12:53.360470192 +0200
7@@ -19,11 +19,11 @@
8 EXTRA_DIST += man/help2man man/dummy-man
9
10 ## Graceful degradation for systems lacking perl.
11-if HAVE_PERL
12-run_help2man = $(PERL) -- $(srcdir)/man/help2man
13-else
14+#if HAVE_PERL
15+#run_help2man = $(PERL) -- $(srcdir)/man/help2man
16+#else
17 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
18-endif
19+#endif
20
21 man1_MANS = @man1_MANS@
22 EXTRA_DIST += $(man1_MANS:.1=.x)
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch b/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch
new file mode 100644
index 0000000000..b7e82609bd
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.22/fix-for-dummy-man-usage.patch
@@ -0,0 +1,31 @@
1Upstream-Status: Pending
2
3coreutils: fix for dummy-man usage
4
5The options should be before the final argument, otherwise, the following error
6would appear when compiling.
7
8"dummy-man: too many non-option arguments"
9
10Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11---
12 man/local.mk | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/man/local.mk b/man/local.mk
16index 7cef5e3..dc0865f 100644
17--- a/man/local.mk
18+++ b/man/local.mk
19@@ -189,8 +189,8 @@ man/yes.1: src/yes
20 && $(run_help2man) \
21 --source='$(PACKAGE_STRING)' \
22 --include=$(srcdir)/man/$$name.x \
23- --output=$$t/$$name.1 $$t/$$name \
24 --info-page='coreutils \(aq'$$name' invocation\(aq' \
25+ --output=$$t/$$name.1 $$t/$$name \
26 && sed \
27 -e 's|$*\.td/||g' \
28 -e '/For complete documentation/d' \
29--
301.7.9.5
31
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/fix-selinux-flask.patch b/meta/recipes-core/coreutils/coreutils-8.22/fix-selinux-flask.patch
new file mode 100644
index 0000000000..9d1ae55d47
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.22/fix-selinux-flask.patch
@@ -0,0 +1,39 @@
1From a1d360509fa3a4aff57eedcd528cc0347a87531d Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Tue, 16 Sep 2014 01:59:08 -0700
4Subject: [PATCH] gnulib-comp.m4: selinux/flask.h should respect to
5 with_selinux
6
7Fixed when build with meta-selinux even when --without-selinux:
8runcon.c:49:28: fatal error: selinux/flask.h: No such file or directory
9 # include <selinux/flask.h>
10 ^
11compilation terminated.
12
13Upstream-Status: Pending
14
15Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
16---
17 m4/gnulib-comp.m4 | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
21index 472d3a0..5f09734 100644
22--- a/m4/gnulib-comp.m4
23+++ b/m4/gnulib-comp.m4
24@@ -1730,11 +1730,11 @@ AC_DEFUN([gl_INIT],
25 AC_LIBOBJ([select])
26 fi
27 gl_SYS_SELECT_MODULE_INDICATOR([select])
28- AC_CHECK_HEADERS([selinux/flask.h])
29 AC_LIBOBJ([selinux-at])
30 gl_HEADERS_SELINUX_SELINUX_H
31 gl_HEADERS_SELINUX_CONTEXT_H
32 if test "$with_selinux" != no && test "$ac_cv_header_selinux_selinux_h" = yes; then
33+ AC_CHECK_HEADERS([selinux/flask.h])
34 AC_LIBOBJ([getfilecon])
35 fi
36 gl_SERVENT
37--
381.7.9.5
39
diff --git a/meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch b/meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch
new file mode 100644
index 0000000000..2ef8a548ac
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils-8.22/remove-usr-local-lib-from-m4.patch
@@ -0,0 +1,31 @@
1We have problem using hardcoded directories like /usr/local here
2which will be checked for cross builds. This is a special case which
3is valid for AIX only. We do not have AIX as one of our supported
4build host or target. Therefore we get rid of the hardcoded paths
5and make life easier for cross compilation process.
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Upstream-Status: Inappropriate [Upstream does care for AIX while we may not]
10
11Index: coreutils-8.14/m4/getloadavg.m4
12===================================================================
13--- coreutils-8.14.orig/m4/getloadavg.m4 2011-09-19 08:09:24.000000000 -0700
14+++ coreutils-8.14/m4/getloadavg.m4 2011-10-19 21:42:00.385533357 -0700
15@@ -41,16 +41,6 @@
16 [LIBS="-lutil $LIBS" gl_func_getloadavg_done=yes])
17 fi
18
19- if test $gl_func_getloadavg_done = no; then
20- # There is a commonly available library for RS/6000 AIX.
21- # Since it is not a standard part of AIX, it might be installed locally.
22- gl_getloadavg_LIBS=$LIBS
23- LIBS="-L/usr/local/lib $LIBS"
24- AC_CHECK_LIB([getloadavg], [getloadavg],
25- [LIBS="-lgetloadavg $LIBS" gl_func_getloadavg_done=yes],
26- [LIBS=$gl_getloadavg_LIBS])
27- fi
28-
29 # Set up the replacement function if necessary.
30 if test $gl_func_getloadavg_done = no; then
31 HAVE_GETLOADAVG=0
diff --git a/meta/recipes-core/coreutils/coreutils_6.9.bb b/meta/recipes-core/coreutils/coreutils_6.9.bb
new file mode 100644
index 0000000000..debd2a123b
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils_6.9.bb
@@ -0,0 +1,106 @@
1SUMMARY = "The basic file, shell and text manipulation utilities"
2DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
3manipulation utilities. These are the core utilities which are expected to exist on \
4every system."
5
6HOMEPAGE = "http://www.gnu.org/software/coreutils/"
7BUGTRACKER = "http://debbugs.gnu.org/coreutils"
8LICENSE = "GPLv2+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
10 file://src/ls.c;beginline=4;endline=16;md5=15ed60f67b1db5fedd5dbc37cf8a9543"
11PR = "r5"
12DEPENDS_class-native = "gettext-native"
13
14inherit autotools gettext texinfo
15
16SRC_URI_BASE = "${GNU_MIRROR}/coreutils/${BP}.tar.bz2 \
17 file://gnulib_m4.patch \
18 file://futimens.patch \
19 file://coreutils-ls-x.patch \
20 file://coreutils-6.9-cp-i-u.patch \
21 file://coreutils-i18n.patch \
22 file://coreutils-overflow.patch \
23 file://coreutils-fix-install.patch \
24 file://man-touch.patch \
25 file://coreutils_fix_for_automake-1.12.patch \
26 file://coreutils-build-with-acl.patch \
27 file://coreutils-fix-texinfo.patch \
28 "
29
30SRC_URI = "${SRC_URI_BASE} file://fix_for_manpage_building.patch"
31SRC_URI_class-native = "${SRC_URI_BASE}"
32
33SRC_URI[md5sum] = "c9607d8495f16e98906e7ed2d9751a06"
34SRC_URI[sha256sum] = "89c2895ad157de50e53298b22d91db116ee4e1dd3fdf4019260254e2e31497b0"
35
36
37# acl is not a default feature
38#
39PACKAGECONFIG_class-target ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
40PACKAGECONFIG_class-native ??= ""
41
42# with, without, depends, rdepends
43#
44PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
45
46
47# [ gets a special treatment and is not included in this
48bindir_progs = "base64 basename cksum comm csplit cut dir dircolors dirname du \
49 env expand expr factor fmt fold groups head hostid id install \
50 join link logname md5sum mkfifo nice nl nohup od paste pathchk \
51 pinky pr printenv printf ptx readlink seq sha1sum sha224sum sha256sum \
52 sha384sum sha512sum shred shuf sort split sum tac tail tee test \
53 tr tsort tty unexpand uniq unlink users vdir wc who whoami yes uptime"
54
55# hostname gets a special treatment and is not included in this
56base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
57 mknod mv pwd rm rmdir sleep stty sync touch true uname hostname stat"
58
59sbindir_progs= "chroot"
60
61# Let aclocal use the relative path for the m4 file rather than the
62# absolute since coreutils has a lot of m4 files, otherwise there might
63# be an "Argument list too long" error when it is built in a long/deep
64# directory.
65acpaths = "-I ./m4"
66
67do_install() {
68 autotools_do_install
69
70 install -d ${D}${base_bindir}
71 [ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done
72
73 install -d ${D}${sbindir}
74 [ "${bindir}" != "${sbindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i; done
75
76 # [ requires special handling because [.coreutils will cause the sed stuff
77 # in update-alternatives to fail, therefore use lbracket - the name used
78 # for the actual source file.
79 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
80
81 # Newer versions of coreutils do not include su, to mimic this behavior
82 # we simply remove it.
83 rm -f ${D}${bindir}/su
84}
85
86inherit update-alternatives
87
88ALTERNATIVE_PRIORITY = "100"
89
90ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs}"
91
92ALTERNATIVE_PRIORITY[uptime] = "10"
93ALTERNATIVE_PRIORITY[hostname] = "10"
94
95ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
96ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
97
98python __anonymous() {
99 for prog in d.getVar('base_bindir_progs', True).split():
100 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
101
102 for prog in d.getVar('sbindir_progs', True).split():
103 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
104}
105
106BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/coreutils/coreutils_8.22.bb b/meta/recipes-core/coreutils/coreutils_8.22.bb
new file mode 100644
index 0000000000..4a1aee6260
--- /dev/null
+++ b/meta/recipes-core/coreutils/coreutils_8.22.bb
@@ -0,0 +1,108 @@
1SUMMARY = "The basic file, shell and text manipulation utilities"
2DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
3manipulation utilities. These are the core utilities which are expected to exist on \
4every system."
5HOMEPAGE = "http://www.gnu.org/software/coreutils/"
6BUGTRACKER = "http://debbugs.gnu.org/coreutils"
7LICENSE = "GPLv3+"
8LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\
9 file://src/ls.c;beginline=5;endline=16;md5=38b79785ca88537b75871782a2a3c6b8"
10DEPENDS = "gmp libcap"
11DEPENDS_class-native = ""
12
13inherit autotools gettext texinfo
14
15SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
16 file://remove-usr-local-lib-from-m4.patch \
17 file://dummy_help2man.patch \
18 file://fix-for-dummy-man-usage.patch \
19 file://fix-selinux-flask.patch \
20 file://date-tz-crash.patch \
21 "
22
23SRC_URI[md5sum] = "8fb0ae2267aa6e728958adc38f8163a2"
24SRC_URI[sha256sum] = "5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212"
25
26EXTRA_OECONF_class-native = "--without-gmp"
27EXTRA_OECONF_class-target = "--enable-install-program=arch --libexecdir=${libdir}"
28
29# acl is not a default feature
30#
31PACKAGECONFIG_class-target ??= "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
32PACKAGECONFIG_class-native ??= ""
33
34# with, without, depends, rdepends
35#
36PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
37
38# [ df mktemp base64 gets a special treatment and is not included in this
39bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
40 env expand expr factor fmt fold groups head hostid id install \
41 join link logname md5sum mkfifo nice nl nohup nproc od paste pathchk \
42 pinky pr printenv printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
43 sha384sum sha512sum shred shuf sort split stdbuf sum tac tail tee test timeout\
44 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
45
46# hostname gets a special treatment and is not included in this
47base_bindir_progs = "cat chgrp chmod chown cp date dd echo false kill ln ls mkdir \
48 mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
49
50sbindir_progs= "chroot"
51
52# Let aclocal use the relative path for the m4 file rather than the
53# absolute since coreutils has a lot of m4 files, otherwise there might
54# be an "Argument list too long" error when it is built in a long/deep
55# directory.
56acpaths = "-I ./m4"
57
58# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
59do_compile_prepend () {
60 mkdir -p ${B}/src
61}
62
63do_install_append() {
64 for i in df mktemp base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
65
66 install -d ${D}${base_bindir}
67 [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
68
69 install -d ${D}${sbindir}
70 [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
71
72 # [ requires special handling because [.coreutils will cause the sed stuff
73 # in update-alternatives to fail, therefore use lbracket - the name used
74 # for the actual source file.
75 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
76}
77
78do_install_append_class-native(){
79 # remove groups to fix conflict with shadow-native
80 rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
81}
82
83inherit update-alternatives
84
85ALTERNATIVE_PRIORITY = "100"
86ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base64 mktemp df"
87
88ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
89ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
90
91ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
92ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
93
94ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
95ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
96
97ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
98ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
99
100python __anonymous() {
101 for prog in d.getVar('base_bindir_progs', True).split():
102 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir', True), prog))
103
104 for prog in d.getVar('sbindir_progs', True).split():
105 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir', True), prog))
106}
107
108BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/dbus-wait/dbus-wait_git.bb b/meta/recipes-core/dbus-wait/dbus-wait_git.bb
new file mode 100644
index 0000000000..691dc86e92
--- /dev/null
+++ b/meta/recipes-core/dbus-wait/dbus-wait_git.bb
@@ -0,0 +1,17 @@
1SUMMARY = "A simple tool to wait for a specific signal over DBus"
2HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/dbus-wait"
3SECTION = "base"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
6
7DEPENDS = "dbus"
8
9SRCREV = "6cc6077a36fe2648a5f993fe7c16c9632f946517"
10PV = "0.1+git${SRCPV}"
11PR = "r2"
12
13SRC_URI = "git://git.yoctoproject.org/${BPN}"
14
15S = "${WORKDIR}/git"
16
17inherit autotools pkgconfig
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch b/meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch
new file mode 100644
index 0000000000..fbb4967828
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.100.2/no-examples.patch
@@ -0,0 +1,15 @@
1Disable compiling examples
2
3Upstream-Status: Inappropriate [disable feature]
4
5Signed-off-by: Kevin Tian <kevin.tian@intel.com>
6Signed-off-by: Scott Garman <scott.a.garman@intel.com>
7
8--- dbus-glib-0.70/dbus/Makefile.am.orig 2006-07-23 16:04:43.000000000 +0200
9+++ dbus-glib-0.70/dbus/Makefile.am 2006-07-23 16:04:52.000000000 +0200
10@@ -1,4 +1,4 @@
11-SUBDIRS = . examples
12+SUBDIRS = .
13
14 INCLUDES=-I$(top_srcdir) $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_TOOL_CFLAGS) -DDBUS_COMPILATION=1 -DDBUS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\"
15
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch b/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch
new file mode 100644
index 0000000000..40e3b12b5d
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.100.2/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Submitted [https://bugs.freedesktop.org/show_bug.cgi?id=59003]
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4diff -Nurd dbus-glib-0.100/configure.ac dbus-glib-0.100/configure.ac
5--- dbus-glib-0.100/configure.ac 2012-06-25 19:26:39.000000000 +0300
6+++ dbus-glib-0.100/configure.ac 2013-01-03 04:53:22.314976758 +0200
7@@ -8,7 +8,7 @@
8
9 AM_INIT_AUTOMAKE([1.9])
10
11-AM_CONFIG_HEADER(config.h)
12+AC_CONFIG_HEADERS(config.h)
13
14 # Honor aclocal flags
15 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
diff --git a/meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch b/meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch
new file mode 100644
index 0000000000..2e8e178bb7
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.100.2/test-install-makefile.patch
@@ -0,0 +1,48 @@
1Change Makefile.am to install regression tests for test package purpose.
2
3Upstream-Status: Inappropriate [test not install is for purpose from upstream]
4
5Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
6
7diff --git a/test/Makefile.am b/test/Makefile.am
8index 7ba11a8..249f0e7 100644
9--- a/test/Makefile.am
10+++ b/test/Makefile.am
11@@ -13,7 +13,8 @@ else
12 TEST_BINARIES=
13 endif
14
15-noinst_PROGRAMS= $(TEST_BINARIES)
16+testdir = $(datadir)/@PACKAGE@/tests
17+test_PROGRAMS= $(TEST_BINARIES)
18
19 test_service_SOURCES= \
20 test-service.c
21diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am
22index 3cb2c39..e6de67d 100644
23--- a/test/interfaces/Makefile.am
24+++ b/test/interfaces/Makefile.am
25@@ -39,7 +39,8 @@ if DBUS_BUILD_TESTS
26
27 ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
28 ## build even when not doing "make check"
29-noinst_PROGRAMS = test-service test-client
30+testdir = $(datadir)/@PACKAGE@/tests/interfaces
31+test_PROGRAMS = test-service test-client
32
33 test_service_SOURCES = \
34 test-interfaces.c \
35diff --git a/test/core/Makefile.am b/test/core/Makefile.am
36index ef6cb26..9786c3a 100644
37--- a/test/core/Makefile.am
38+++ b/test/core/Makefile.am
39@@ -46,7 +46,8 @@ endif
40
41 ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
42 ## build even when not doing "make check"
43-noinst_PROGRAMS = \
44+testdir = $(datadir)/@PACKAGE@/tests/core
45+test_PROGRAMS = \
46 test-dbus-glib \
47 test-service-glib \
48 $(THREAD_APPS) \
diff --git a/meta/recipes-core/dbus/dbus-glib-0.102/no-examples.patch b/meta/recipes-core/dbus/dbus-glib-0.102/no-examples.patch
new file mode 100644
index 0000000000..fbb4967828
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.102/no-examples.patch
@@ -0,0 +1,15 @@
1Disable compiling examples
2
3Upstream-Status: Inappropriate [disable feature]
4
5Signed-off-by: Kevin Tian <kevin.tian@intel.com>
6Signed-off-by: Scott Garman <scott.a.garman@intel.com>
7
8--- dbus-glib-0.70/dbus/Makefile.am.orig 2006-07-23 16:04:43.000000000 +0200
9+++ dbus-glib-0.70/dbus/Makefile.am 2006-07-23 16:04:52.000000000 +0200
10@@ -1,4 +1,4 @@
11-SUBDIRS = . examples
12+SUBDIRS = .
13
14 INCLUDES=-I$(top_srcdir) $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_TOOL_CFLAGS) -DDBUS_COMPILATION=1 -DDBUS_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\"
15
diff --git a/meta/recipes-core/dbus/dbus-glib-0.102/obsolete_automake_macros.patch b/meta/recipes-core/dbus/dbus-glib-0.102/obsolete_automake_macros.patch
new file mode 100644
index 0000000000..40e3b12b5d
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.102/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Submitted [https://bugs.freedesktop.org/show_bug.cgi?id=59003]
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4diff -Nurd dbus-glib-0.100/configure.ac dbus-glib-0.100/configure.ac
5--- dbus-glib-0.100/configure.ac 2012-06-25 19:26:39.000000000 +0300
6+++ dbus-glib-0.100/configure.ac 2013-01-03 04:53:22.314976758 +0200
7@@ -8,7 +8,7 @@
8
9 AM_INIT_AUTOMAKE([1.9])
10
11-AM_CONFIG_HEADER(config.h)
12+AC_CONFIG_HEADERS(config.h)
13
14 # Honor aclocal flags
15 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
diff --git a/meta/recipes-core/dbus/dbus-glib-0.102/test-install-makefile.patch b/meta/recipes-core/dbus/dbus-glib-0.102/test-install-makefile.patch
new file mode 100644
index 0000000000..2e8e178bb7
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib-0.102/test-install-makefile.patch
@@ -0,0 +1,48 @@
1Change Makefile.am to install regression tests for test package purpose.
2
3Upstream-Status: Inappropriate [test not install is for purpose from upstream]
4
5Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
6
7diff --git a/test/Makefile.am b/test/Makefile.am
8index 7ba11a8..249f0e7 100644
9--- a/test/Makefile.am
10+++ b/test/Makefile.am
11@@ -13,7 +13,8 @@ else
12 TEST_BINARIES=
13 endif
14
15-noinst_PROGRAMS= $(TEST_BINARIES)
16+testdir = $(datadir)/@PACKAGE@/tests
17+test_PROGRAMS= $(TEST_BINARIES)
18
19 test_service_SOURCES= \
20 test-service.c
21diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am
22index 3cb2c39..e6de67d 100644
23--- a/test/interfaces/Makefile.am
24+++ b/test/interfaces/Makefile.am
25@@ -39,7 +39,8 @@ if DBUS_BUILD_TESTS
26
27 ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
28 ## build even when not doing "make check"
29-noinst_PROGRAMS = test-service test-client
30+testdir = $(datadir)/@PACKAGE@/tests/interfaces
31+test_PROGRAMS = test-service test-client
32
33 test_service_SOURCES = \
34 test-interfaces.c \
35diff --git a/test/core/Makefile.am b/test/core/Makefile.am
36index ef6cb26..9786c3a 100644
37--- a/test/core/Makefile.am
38+++ b/test/core/Makefile.am
39@@ -46,7 +46,8 @@ endif
40
41 ## we use noinst_PROGRAMS not check_PROGRAMS for TESTS so that we
42 ## build even when not doing "make check"
43-noinst_PROGRAMS = \
44+testdir = $(datadir)/@PACKAGE@/tests/core
45+test_PROGRAMS = \
46 test-dbus-glib \
47 test-service-glib \
48 $(THREAD_APPS) \
diff --git a/meta/recipes-core/dbus/dbus-glib.inc b/meta/recipes-core/dbus/dbus-glib.inc
new file mode 100644
index 0000000000..6c60d9e408
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib.inc
@@ -0,0 +1,44 @@
1SUMMARY = "High level language (GLib) binding for D-Bus"
2DESCRIPTION = "GLib bindings for the D-Bus message bus that integrate \
3the D-Bus library with the GLib thread abstraction and main loop."
4HOMEPAGE = "http://www.freedesktop.org/Software/dbus"
5LICENSE = "AFL-2 | GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=cf5b3a2f7083750d504333114e738656 \
7 file://dbus/dbus-glib.h;beginline=7;endline=21;md5=7755c9d7abccd5dbd25a6a974538bb3c"
8SECTION = "base"
9
10DEPENDS = "expat glib-2.0 virtual/libintl dbus-glib-native dbus"
11DEPENDS_class-native = "glib-2.0-native dbus-native"
12
13SRC_URI = "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
14 file://no-examples.patch \
15 file://test-install-makefile.patch \
16 file://obsolete_automake_macros.patch \
17"
18
19inherit autotools pkgconfig gettext
20
21#default disable regression tests, some unit test code in non testing code
22#PACKAGECONFIG_pn-${PN} = "tests" enable regression tests local.conf
23PACKAGECONFIG ??= ""
24PACKAGECONFIG[tests] = "--enable-tests,,,"
25
26EXTRA_OECONF = "--with-introspect-xml=${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml \
27 --with-dbus-binding-tool=${STAGING_BINDIR_NATIVE}/dbus-binding-tool"
28EXTRA_OECONF_class-native = "--with-introspect-xml=${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml"
29
30PACKAGES += "${PN}-bash-completion ${PN}-tests-dbg ${PN}-tests"
31
32FILES_${PN} = "${libdir}/lib*${SOLIBS}"
33FILES_${PN}-bash-completion = "${sysconfdir}/bash_completion.d/dbus-bash-completion.sh \
34 ${libexecdir}/dbus-bash-completion-helper"
35FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
36FILES_${PN}-dev += "${bindir}/dbus-binding-tool"
37
38RDEPENDS_${PN}-tests += "dbus-x11"
39FILES_${PN}-tests = "${datadir}/${BPN}/tests"
40FILES_${PN}-tests-dbg = "${datadir}/${BPN}/tests/.debug/* \
41 ${datadir}/${BPN}/tests/core/.debug/* \
42 ${datadir}/${BPN}/tests/interfaces/.debug/*"
43
44BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/dbus/dbus-glib_0.100.2.bb b/meta/recipes-core/dbus/dbus-glib_0.100.2.bb
new file mode 100644
index 0000000000..c1bb06a1b4
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib_0.100.2.bb
@@ -0,0 +1,5 @@
1require dbus-glib.inc
2
3
4SRC_URI[md5sum] = "ad0920c7e3aad669163bb59171cf138e"
5SRC_URI[sha256sum] = "a5bb42da921f51c28161e0e54a5a8241d94a1c0499a14007150e9ce743da6ac5"
diff --git a/meta/recipes-core/dbus/dbus-glib_0.102.bb b/meta/recipes-core/dbus/dbus-glib_0.102.bb
new file mode 100644
index 0000000000..28e8a72e23
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-glib_0.102.bb
@@ -0,0 +1,8 @@
1require dbus-glib.inc
2
3SRC_URI = "http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-${PV}.tar.gz \
4 file://no-examples.patch \
5"
6
7SRC_URI[md5sum] = "f76b8558fd575d0106c3a556eaa49184"
8SRC_URI[sha256sum] = "6964ed585bb8149a14ab744b5ded5e77cf71ec5446e6dcc5fcf5eebcc52df29c"
diff --git a/meta/recipes-core/dbus/dbus-test_1.8.2.bb b/meta/recipes-core/dbus/dbus-test_1.8.2.bb
new file mode 100644
index 0000000000..e19d2e9d1e
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-test_1.8.2.bb
@@ -0,0 +1,60 @@
1SUMMARY = "D-Bus test package (for D-bus functionality testing only)"
2HOMEPAGE = "http://dbus.freedesktop.org"
3SECTION = "base"
4LICENSE = "AFL-2 | GPLv2+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
6 file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c"
7
8DEPENDS = "python-pygobject dbus dbus-glib"
9
10RDEPENDS_${PN} += "make"
11RDEPENDS_${PN}-dev = ""
12
13SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
14 file://tmpdir.patch \
15 file://dbus-1.init \
16 file://run-ptest \
17 file://python-config.patch \
18 file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
19 "
20
21SRC_URI[md5sum] = "d6f709bbec0a022a1847c7caec9d6068"
22SRC_URI[sha256sum] = "5689f7411165adc953f37974e276a3028db94447c76e8dd92efe910c6d3bae08"
23
24S="${WORKDIR}/dbus-${PV}"
25FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
26
27inherit autotools pkgconfig gettext ptest
28
29EXTRA_OECONF_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '--with-x', '--without-x', d)}"
30EXTRA_OECONF_X_class-native = "--without-x"
31
32EXTRA_OECONF = "--enable-tests \
33 --enable-modular-tests \
34 --enable-installed-tests \
35 --enable-checks \
36 --enable-asserts \
37 --enable-verbose-mode \
38 --disable-xml-docs \
39 --disable-doxygen-docs \
40 --disable-libaudit \
41 --disable-systemd \
42 --without-systemdsystemunitdir \
43 --with-dbus-test-dir=${PTEST_PATH} \
44 ${EXTRA_OECONF_X}"
45
46do_install() {
47}
48
49do_install_ptest() {
50 install -d ${D}${PTEST_PATH}/test
51 case1="shell printf refs syslog"
52 for i in ${case1}; do install ${B}/test/test-$i ${D}${PTEST_PATH}/test; done
53 case2="marshal syntax corrupt dbus-daemon dbus-daemon-eavesdrop loopback relay"
54 for i in ${case2}; do install ${B}/test/.libs/test-$i ${D}${PTEST_PATH}/test; done
55 case3="bus bus-system bus-launch-helper"
56 for i in ${case3}; do install ${B}/bus/test-$i ${D}${PTEST_PATH}/test; done
57 install ${B}/dbus/test-dbus ${D}${PTEST_PATH}/test
58 cp -r ${B}/test/data ${D}${PTEST_PATH}/test
59}
60RDEPENDS_${PN}-ptest += "bash"
diff --git a/meta/recipes-core/dbus/dbus-test_1.8.6.bb b/meta/recipes-core/dbus/dbus-test_1.8.6.bb
new file mode 100644
index 0000000000..53c5d9ae38
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus-test_1.8.6.bb
@@ -0,0 +1,59 @@
1SUMMARY = "D-Bus test package (for D-bus functionality testing only)"
2HOMEPAGE = "http://dbus.freedesktop.org"
3SECTION = "base"
4LICENSE = "AFL-2 | GPLv2+"
5LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
6 file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c"
7
8DEPENDS = "python-pygobject dbus dbus-glib"
9
10RDEPENDS_${PN} += "make"
11RDEPENDS_${PN}-dev = ""
12
13SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
14 file://tmpdir.patch \
15 file://dbus-1.init \
16 file://run-ptest \
17 file://python-config.patch \
18 file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
19 "
20
21SRC_URI[md5sum] = "6a08ba555d340e9dfe2d623b83c0eea8"
22
23S="${WORKDIR}/dbus-${PV}"
24FILESEXTRAPATHS =. "${FILE_DIRNAME}/dbus:"
25
26inherit autotools pkgconfig gettext ptest
27
28EXTRA_OECONF_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '--with-x', '--without-x', d)}"
29EXTRA_OECONF_X_class-native = "--without-x"
30
31EXTRA_OECONF = "--enable-tests \
32 --enable-modular-tests \
33 --enable-installed-tests \
34 --enable-checks \
35 --enable-asserts \
36 --enable-verbose-mode \
37 --disable-xml-docs \
38 --disable-doxygen-docs \
39 --disable-libaudit \
40 --disable-systemd \
41 --without-systemdsystemunitdir \
42 --with-dbus-test-dir=${PTEST_PATH} \
43 ${EXTRA_OECONF_X}"
44
45do_install() {
46}
47
48do_install_ptest() {
49 install -d ${D}${PTEST_PATH}/test
50 case1="shell printf refs syslog"
51 for i in ${case1}; do install ${B}/test/test-$i ${D}${PTEST_PATH}/test; done
52 case2="marshal syntax corrupt dbus-daemon dbus-daemon-eavesdrop loopback relay"
53 for i in ${case2}; do install ${B}/test/.libs/test-$i ${D}${PTEST_PATH}/test; done
54 case3="bus bus-system bus-launch-helper"
55 for i in ${case3}; do install ${B}/bus/test-$i ${D}${PTEST_PATH}/test; done
56 install ${B}/dbus/test-dbus ${D}${PTEST_PATH}/test
57 cp -r ${B}/test/data ${D}${PTEST_PATH}/test
58}
59RDEPENDS_${PN}-ptest += "bash"
diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc
new file mode 100644
index 0000000000..971eabf82c
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus.inc
@@ -0,0 +1,169 @@
1SUMMARY = "D-Bus message bus"
2DESCRIPTION = "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."
3HOMEPAGE = "http://dbus.freedesktop.org"
4SECTION = "base"
5LICENSE = "AFL-2 | GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=10dded3b58148f3f1fd804b26354af3e \
7 file://dbus/dbus.h;beginline=6;endline=20;md5=7755c9d7abccd5dbd25a6a974538bb3c"
8DEPENDS = "expat virtual/libintl"
9RDEPENDS_dbus_class-native = ""
10RDEPENDS_dbus_class-nativesdk = ""
11PACKAGES += "${@bb.utils.contains('PTEST_ENABLED', '1', 'dbus-ptest', '', d)}"
12ALLOW_EMPTY_dbus-ptest = "1"
13RDEPENDS_dbus-ptest_class-target = "dbus-test-ptest"
14
15SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
16 file://tmpdir.patch \
17 file://dbus-1.init \
18 file://os-test.patch \
19 file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
20 file://CVE-2015-0245-prevent-forged-ActivationFailure.patch \
21"
22
23inherit useradd autotools pkgconfig gettext update-rc.d
24
25INITSCRIPT_NAME = "dbus-1"
26INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
27
28python __anonymous() {
29 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
30 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
31}
32
33USERADD_PACKAGES = "${PN}"
34GROUPADD_PARAM_${PN} = "-r netdev"
35USERADD_PARAM_${PN} = "--system --home ${localstatedir}/lib/dbus \
36 --no-create-home --shell /bin/false \
37 --user-group messagebus"
38
39CONFFILES_${PN} = "${sysconfdir}/dbus-1/system.conf ${sysconfdir}/dbus-1/session.conf"
40
41DEBIANNAME_${PN} = "dbus-1"
42
43PACKAGES =+ "${PN}-lib"
44
45OLDPKGNAME = "dbus-x11"
46OLDPKGNAME_class-nativesdk = ""
47
48# for compatibility
49RPROVIDES_${PN} = "${OLDPKGNAME}"
50RREPLACES_${PN} += "${OLDPKGNAME}"
51
52FILES_${PN} = "${bindir}/dbus-daemon* \
53 ${bindir}/dbus-uuidgen \
54 ${bindir}/dbus-cleanup-sockets \
55 ${bindir}/dbus-send \
56 ${bindir}/dbus-monitor \
57 ${bindir}/dbus-launch \
58 ${bindir}/dbus-run-session \
59 ${libexecdir}/dbus* \
60 ${sysconfdir} \
61 ${localstatedir} \
62 ${datadir}/dbus-1/services \
63 ${datadir}/dbus-1/system-services \
64 ${systemd_unitdir}/system/"
65FILES_${PN}-lib = "${libdir}/lib*.so.*"
66RRECOMMENDS_${PN}-lib = "${PN}"
67FILES_${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-glib-tool"
68
69pkg_postinst_dbus() {
70 # If both systemd and sysvinit are enabled, mask the dbus-1 init script
71 if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
72 if [ -n "$D" ]; then
73 OPTS="--root=$D"
74 fi
75 systemctl $OPTS mask dbus-1.service
76 fi
77
78 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
79 /etc/init.d/populate-volatile.sh update
80 fi
81}
82
83EXTRA_OECONF = "--disable-tests \
84 --disable-xml-docs \
85 --disable-doxygen-docs \
86 --disable-libaudit \
87 --disable-systemd \
88 --without-dbus-glib"
89
90EXTRA_OECONF_append_class-native = " --disable-selinux"
91
92PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
93 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
94PACKAGECONFIG_class-native = ""
95PACKAGECONFIG_class-nativesdk = ""
96
97# Would like to --enable-systemd but that's a circular build-dependency between
98# systemd<->dbus
99PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir"
100PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
101
102do_install() {
103 autotools_do_install
104
105 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
106 install -d ${D}${sysconfdir}/init.d
107 sed 's:@bindir@:${bindir}:' < ${WORKDIR}/dbus-1.init >${WORKDIR}/dbus-1.init.sh
108 install -m 0755 ${WORKDIR}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
109 fi
110
111 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
112 for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
113 install -d ${D}${systemd_unitdir}/system/$i; done
114 install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_unitdir}/system/
115 cd ${D}${systemd_unitdir}/system/dbus.target.wants/
116 ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/dbus.target.wants/dbus.socket
117 ln -fs ../dbus.socket ${D}${systemd_unitdir}/system/sockets.target.wants/dbus.socket
118 ln -fs ../dbus.service ${D}${systemd_unitdir}/system/multi-user.target.wants/dbus.service
119 fi
120
121 install -d ${D}${sysconfdir}/default/volatiles
122 echo "d messagebus messagebus 0755 ${localstatedir}/run/dbus none" \
123 > ${D}${sysconfdir}/default/volatiles/99_dbus
124
125
126 mkdir -p ${D}${localstatedir}/lib/dbus
127
128 chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
129
130 chown root:messagebus ${D}${libexecdir}/dbus-daemon-launch-helper
131 chmod 4755 ${D}${libexecdir}/dbus-daemon-launch-helper
132
133 # Remove Red Hat initscript
134 rm -rf ${D}${sysconfdir}/rc.d
135
136 # Remove empty testexec directory as we don't build tests
137 rm -rf ${D}${libdir}/dbus-1.0/test
138
139 # Remove /var/run as it is created on startup
140 rm -rf ${D}${localstatedir}/run
141}
142
143do_install_class-native() {
144 autotools_do_install
145
146 # for dbus-glib-native introspection generation
147 install -d ${STAGING_DATADIR_NATIVE}/dbus/
148 # N.B. is below install actually required?
149 install -m 0644 bus/session.conf ${STAGING_DATADIR_NATIVE}/dbus/session.conf
150
151 # dbus-glib-native and dbus-glib need this xml file
152 ./bus/dbus-daemon --introspect > ${STAGING_DATADIR_NATIVE}/dbus/dbus-bus-introspect.xml
153
154 # dbus-launch has no X support so lets not install it in case the host
155 # has a more featured and useful version
156 rm -f ${D}${bindir}/dbus-launch
157}
158
159do_install_class-nativesdk() {
160 autotools_do_install
161
162 # dbus-launch has no X support so lets not install it in case the host
163 # has a more featured and useful version
164 rm -f ${D}${bindir}/dbus-launch
165
166 # Remove /var/run to avoid QA error
167 rm -rf ${D}${localstatedir}/run
168}
169BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/dbus/dbus/CVE-2015-0245-prevent-forged-ActivationFailure.patch b/meta/recipes-core/dbus/dbus/CVE-2015-0245-prevent-forged-ActivationFailure.patch
new file mode 100644
index 0000000000..59363b3e76
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/CVE-2015-0245-prevent-forged-ActivationFailure.patch
@@ -0,0 +1,48 @@
1CVE-2015-0245: prevent forged ActivationFailure from non-root processes
2
3Upstream has fixed this in code but suggests using this as a easily
4backportable fix: https://bugs.freedesktop.org/show_bug.cgi?id=88811
5
6Upstream-Status: Inappropriate
7Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
8
9
10
11From 91eb2ea3362630190e08c1c777c47bae065ac828 Mon Sep 17 00:00:00 2001
12From: Simon McVittie <simon.mcvittie@collabora.co.uk>
13Date: Mon, 26 Jan 2015 20:09:56 +0000
14Subject: [PATCH 1/3] CVE-2015-0245: prevent forged ActivationFailure from
15 non-root processes
16
17Without either this rule or better checking in dbus-daemon, non-systemd
18processes can make dbus-daemon think systemd failed to activate a system
19service, resulting in an error reply back to the requester.
20
21This is redundant with the fix in the C code (which I consider to be
22the real solution), but is likely to be easier to backport.
23---
24 bus/system.conf.in | 8 ++++++++
25 1 file changed, 8 insertions(+)
26
27diff --git a/bus/system.conf.in b/bus/system.conf.in
28index 92f4cc4..851b9e6 100644
29--- a/bus/system.conf.in
30+++ b/bus/system.conf.in
31@@ -68,6 +68,14 @@
32 <deny send_destination="org.freedesktop.DBus"
33 send_interface="org.freedesktop.DBus"
34 send_member="UpdateActivationEnvironment"/>
35+ <deny send_destination="org.freedesktop.DBus"
36+ send_interface="org.freedesktop.systemd1.Activator"/>
37+ </policy>
38+
39+ <!-- Only systemd, which runs as root, may report activation failures. -->
40+ <policy user="root">
41+ <allow send_destination="org.freedesktop.DBus"
42+ send_interface="org.freedesktop.systemd1.Activator"/>
43 </policy>
44
45 <!-- Config files are placed here that among other things, punch
46--
472.1.4
48
diff --git a/meta/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch b/meta/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch
new file mode 100644
index 0000000000..6bb6d9c82e
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/clear-guid_from_server-if-send_negotiate_unix_f.patch
@@ -0,0 +1,104 @@
1From b8f84bd39485d3977625c9a8b8e8cff5d23be56f Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Thu, 27 Feb 2014 09:05:02 +0800
4Subject: [PATCH] dbus: clear guid_from_server if send_negotiate_unix_fd
5 failed
6
7Upstream-Status: Submitted
8
9bus-test dispatch test failed with below information:
10 ./bus/bus-test: Running message dispatch test
11 Activating service name='org.freedesktop.DBus.TestSuiteEchoService'
12 Successfully activated service 'org.freedesktop.DBus.TestSuiteEchoService'
13 6363: assertion failed "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0" file "dbus-auth.c" line 1545 function process_ok
14 ./bus/bus-test(_dbus_print_backtrace+0x29) [0x80cb969]
15 ./bus/bus-test(_dbus_abort+0x14) [0x80cfb44]
16 ./bus/bus-test(_dbus_real_assert+0x53) [0x80b52c3]
17 ./bus/bus-test() [0x80e24da]
18 ./bus/bus-test(_dbus_auth_do_work+0x388) [0x80e3848]
19 ./bus/bus-test() [0x80aea49]
20 ./bus/bus-test() [0x80affde]
21 ./bus/bus-test(_dbus_transport_handle_watch+0xb1) [0x80ad841]
22 ./bus/bus-test(_dbus_connection_handle_watch+0x104) [0x8089174]
23 ./bus/bus-test(dbus_watch_handle+0xd8) [0x80b15e8]
24 ./bus/bus-test(_dbus_loop_iterate+0x4a9) [0x80d1509]
25 ./bus/bus-test(bus_test_run_clients_loop+0x5d) [0x808129d]
26 ./bus/bus-test() [0x806cab0]
27 ./bus/bus-test() [0x806e0ca]
28 ./bus/bus-test() [0x806da6f]
29 ./bus/bus-test(_dbus_test_oom_handling+0x18c) [0x80b5c8c]
30 ./bus/bus-test() [0x806f723]
31 ./bus/bus-test(bus_dispatch_test+0x3c) [0x8071aac]
32 ./bus/bus-test(main+0x1b7) [0x805acc7]
33 /lib/libc.so.6(__libc_start_main+0xf3) [0x45f919b3]
34 ./bus/bus-test() [0x805ae39]
35
36The stack is below:
37 #0 0xffffe425 in __kernel_vsyscall ()
38 #1 0x45fa62d6 in raise () from /lib/libc.so.6
39 #2 0x45fa9653 in abort () from /lib/libc.so.6
40 #3 0x080cfb65 in _dbus_abort () at dbus-sysdeps.c:94
41 #4 0x080b52c3 in _dbus_real_assert (condition=0,
42 condition_text=condition_text@entry=0x8117a38 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0",
43 file=file@entry=0x8117273 "dbus-auth.c", line=line@entry=1545,
44 func=func@entry=0x8117f8e <__FUNCTION__.3492> "process_ok")
45 data=0x8157290) at dbus-connection.c:1515
46 #0 0x00000033fee353e9 in raise () from /lib64/libc.so.6
47 #1 0x00000033fee38508 in abort () from /lib64/libc.so.6
48 #2 0x000000000047d585 in _dbus_abort () at dbus-sysdeps.c:94
49 #3 0x0000000000466486 in _dbus_real_assert (condition=<optimized out>,
50 condition_text=condition_text@entry=0x4c2988 "_dbus_string_get_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server) == 0",
51 file=file@entry=0x4c21a5 "dbus-auth.c", line=line@entry=1546,
52 func=func@entry=0x4c2fce <__FUNCTION__.3845> "process_ok")
53 at dbus-internals.c:931
54 #4 0x000000000048d424 in process_ok (args_from_ok=0x7fffffffe480,
55 auth=0x6ff340) at dbus-auth.c:1546
56 #5 handle_client_state_waiting_for_data (auth=0x6ff340,
57 command=<optimized out>, args=0x7fffffffe480) at dbus-auth.c:1996
58 #6 0x000000000048e789 in process_command (auth=0x6ff340) at dbus-auth.c:2208
59 #7 _dbus_auth_do_work (auth=0x6ff340) at dbus-auth.c:2458
60 #8 0x000000000046091d in do_authentication (
61 transport=transport@entry=0x6ffaa0, do_reading=do_reading@entry=1,
62 do_writing=do_writing@entry=0,
63 auth_completed=auth_completed@entry=0x7fffffffe55c)
64 at dbus-transport-socket.c:442
65 #9 0x0000000000461d08 in socket_handle_watch (transport=0x6ffaa0,
66 watch=0x6f4190, flags=1) at dbus-transport-socket.c:921
67 #10 0x000000000045fa3a in _dbus_transport_handle_watch (transport=0x6ffaa0,
68
69Once send_negotiate_unix_fd failed, this failure will happen, since
70auth->guid_from_server has been set to some value before
71send_negotiate_unix_fd. send_negotiate_unix_fd failure will lead to
72this auth be handled by process_ok again, but this auth->guid_from_server
73is not zero.
74
75So we should clear auth->guid_from_server if send_negotiate_unix_fd failed
76
77Signed-off-by: Roy Li <rongqing.li@windriver.com>
78---
79 dbus/dbus-auth.c | 9 +++++++--
80 1 file changed, 7 insertions(+), 2 deletions(-)
81
82diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
83index d2c37a7..37b45c6 100644
84--- a/dbus/dbus-auth.c
85+++ b/dbus/dbus-auth.c
86@@ -1571,8 +1571,13 @@ process_ok(DBusAuth *auth,
87 _dbus_verbose ("Got GUID '%s' from the server\n",
88 _dbus_string_get_const_data (& DBUS_AUTH_CLIENT (auth)->guid_from_server));
89
90- if (auth->unix_fd_possible)
91- return send_negotiate_unix_fd(auth);
92+ if (auth->unix_fd_possible) {
93+ if (!send_negotiate_unix_fd(auth)) {
94+ _dbus_string_set_length (& DBUS_AUTH_CLIENT (auth)->guid_from_server, 0);
95+ return FALSE;
96+ }
97+ return TRUE;
98+ }
99
100 _dbus_verbose("Not negotiating unix fd passing, since not possible\n");
101 return send_begin (auth);
102--
1031.7.10.4
104
diff --git a/meta/recipes-core/dbus/dbus/dbus-1.init b/meta/recipes-core/dbus/dbus/dbus-1.init
new file mode 100644
index 0000000000..42c86297c3
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/dbus-1.init
@@ -0,0 +1,123 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: dbus
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 1
8# Short-Description: D-Bus systemwide message bus
9# Description: D-Bus is a simple interprocess messaging system, used
10# for sending messages between applications.
11### END INIT INFO
12#
13# -*- coding: utf-8 -*-
14# Debian init.d script for D-BUS
15# Copyright © 2003 Colin Walters <walters@debian.org>
16
17# set -e
18
19# Source function library.
20. /etc/init.d/functions
21
22DAEMON=@bindir@/dbus-daemon
23NAME=dbus
24DAEMONUSER=messagebus # must match /etc/dbus-1/system.conf
25PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf
26UUIDDIR=/var/lib/dbus
27DESC="system message bus"
28EVENTDIR=/etc/dbus-1/event.d
29
30test -x $DAEMON || exit 0
31
32# Source defaults file; edit that file to configure this script.
33ENABLED=1
34PARAMS=""
35if [ -e /etc/default/dbus ]; then
36 . /etc/default/dbus
37fi
38
39test "$ENABLED" != "0" || exit 0
40
41start_it_up()
42{
43 mkdir -p "`dirname $PIDFILE`"
44 if [ -e $PIDFILE ]; then
45 PIDDIR=/proc/$(cat $PIDFILE)
46 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
47 echo "$DESC already started; not starting."
48 else
49 echo "Removing stale PID file $PIDFILE."
50 rm -f $PIDFILE
51 fi
52 fi
53
54 if [ ! -d $UUIDDIR ]; then
55 mkdir -p $UUIDDIR
56 chown $DAEMONUSER $UUIDDIR
57 chgrp $DAEMONUSER $UUIDDIR
58 fi
59
60 dbus-uuidgen --ensure
61
62 echo -n "Starting $DESC: "
63 start-stop-daemon -o --start --quiet --pidfile $PIDFILE \
64 --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
65 echo "$NAME."
66 if [ -d $EVENTDIR ]; then
67 run-parts --arg=start $EVENTDIR
68 fi
69}
70
71shut_it_down()
72{
73 if [ -d $EVENTDIR ]; then
74 # TODO: --reverse when busybox supports it
75 run-parts --arg=stop $EVENTDIR
76 fi
77 echo -n "Stopping $DESC: "
78 start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \
79 --user $DAEMONUSER
80 # We no longer include these arguments so that start-stop-daemon
81 # can do its job even given that we may have been upgraded.
82 # We rely on the pidfile being sanely managed
83 # --exec $DAEMON -- --system $PARAMS
84 echo "$NAME."
85 rm -f $PIDFILE
86}
87
88reload_it()
89{
90 echo -n "Reloading $DESC config: "
91 dbus-send --print-reply --system --type=method_call \
92 --dest=org.freedesktop.DBus \
93 / org.freedesktop.DBus.ReloadConfig > /dev/null
94 # hopefully this is enough time for dbus to reload it's config file.
95 echo "done."
96}
97
98case "$1" in
99 start)
100 start_it_up
101 ;;
102 stop)
103 shut_it_down
104 ;;
105 status)
106 status $DAEMON
107 exit $?
108 ;;
109 reload|force-reload)
110 reload_it
111 ;;
112 restart)
113 shut_it_down
114 sleep 1
115 start_it_up
116 ;;
117 *)
118 echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2
119 exit 1
120 ;;
121esac
122
123exit 0
diff --git a/meta/recipes-core/dbus/dbus/os-test.patch b/meta/recipes-core/dbus/dbus/os-test.patch
new file mode 100644
index 0000000000..79554b1ee1
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/os-test.patch
@@ -0,0 +1,35 @@
1dbus: remove build host test in configure script
2
3The dbus build tests the build host to detect what initscript
4environment it expects. Remove the test and set it to "redhat"
5unconditionally as the oe-core initscript has a redhat-style pid file
6path.
7
8Signed-off-by: Andy Ross <andy.ross@windriver.com>
9Upstream-Status: innappropriate [embedded]
10
11diff -u a/configure.ac b/configure.ac
12--- a/configure.ac 2012-08-28 11:23:43.040609874 -0700
13+++ b/configure.ac 2012-08-28 11:54:25.602913945 -0700
14@@ -1348,19 +1348,8 @@
15 AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
16 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
17
18-#### Check our operating system
19-operating_system=unknown
20-if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
21- operating_system=redhat
22-fi
23-
24-if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
25- operating_system=slackware
26-fi
27-
28-if test -f /usr/bin/cygwin1.dll || test -f $EXPANDED_BINDIR/cygwin1.dll ; then
29- operating_system=cygwin
30-fi
31+#### Build host test removed from upstream code, openembedded initscript is redhat-like:
32+operating_system=redhat
33
34 #### Sort out init scripts
35
diff --git a/meta/recipes-core/dbus/dbus/python-config.patch b/meta/recipes-core/dbus/dbus/python-config.patch
new file mode 100644
index 0000000000..294400247e
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/python-config.patch
@@ -0,0 +1,25 @@
1When building the dbus-ptest package, we have to enable python. However
2checking if the host-system python has the necessary library isn't useful.
3
4Disable the python module check for cross compiling.
5
6Upstream-Status: Inappropriate [oe specific]
7
8Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
9
10--- dbus-1.6.8/configure.ac.orig 2013-07-11 14:15:58.834554799 -0500
11+++ dbus-1.6.8/configure.ac 2013-07-11 14:14:40.969554848 -0500
12@@ -257,13 +257,6 @@
13 # full test coverage is required, Python is a hard dependency
14 AC_MSG_NOTICE([Full test coverage (--enable-tests=yes) requires Python, dbus-python, pygobject])
15 AM_PATH_PYTHON([2.6])
16- AC_MSG_CHECKING([for Python modules for full test coverage])
17- if "$PYTHON" -c "import dbus, gobject, dbus.mainloop.glib"; then
18- AC_MSG_RESULT([yes])
19- else
20- AC_MSG_RESULT([no])
21- AC_MSG_ERROR([cannot import dbus, gobject, dbus.mainloop.glib Python modules])
22- fi
23 else
24 # --enable-tests not given: do not abort if Python is missing
25 AM_PATH_PYTHON([2.6], [], [:])
diff --git a/meta/recipes-core/dbus/dbus/run-ptest b/meta/recipes-core/dbus/dbus/run-ptest
new file mode 100755
index 0000000000..c72d083a91
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/run-ptest
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3output() {
4 if [ $? -eq 0 ]
5 then echo "PASS: $i"
6 else echo "FAIL: $i"
7 fi
8}
9
10for i in `ls test/test-*`; do ./$i ./test/data DBUS_TEST_HOMEDIR=./test >/dev/null; output; done
diff --git a/meta/recipes-core/dbus/dbus/tmpdir.patch b/meta/recipes-core/dbus/dbus/tmpdir.patch
new file mode 100644
index 0000000000..bf086e1788
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus/tmpdir.patch
@@ -0,0 +1,44 @@
1From 5105fedd7fa13dadd2d0d864fb77873b83b79a4b Mon Sep 17 00:00:00 2001
2From: Koen Kooi <koen@dominion.thruhere.net>
3Date: Thu, 23 Jun 2011 13:52:09 +0200
4Subject: [PATCH] buildsys: hardcode socketdir to /tmp
5
6the TMPDIR env var isn't always pointing to the right target path
7
8Upstream-Status: Inappropriate [embedded]
9
10Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
11
12Original comment:
13
14 avoid to check tmp dir at build time. instead uses hard coded /tmp here
15 comment added by Kevin Tian <kevin.tian@intel.com>
16---
17 configure.ac | 11 +----------
18 1 files changed, 1 insertions(+), 10 deletions(-)
19
20diff --git a/configure.ac b/configure.ac
21index 408054b..6d26180 100644
22--- a/configure.ac
23+++ b/configure.ac
24@@ -1483,16 +1483,7 @@ AC_SUBST(TEST_LAUNCH_HELPER_BINARY)
25 AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY",
26 [Full path to the launch helper test program in the builddir])
27
28-#### Find socket directories
29-if ! test -z "$TMPDIR" ; then
30- DEFAULT_SOCKET_DIR=$TMPDIR
31-elif ! test -z "$TEMP" ; then
32- DEFAULT_SOCKET_DIR=$TEMP
33-elif ! test -z "$TMP" ; then
34- DEFAULT_SOCKET_DIR=$TMP
35-else
36- DEFAULT_SOCKET_DIR=/tmp
37-fi
38+DEFAULT_SOCKET_DIR=/tmp
39
40 DEFAULT_SOCKET_DIR=`echo $DEFAULT_SOCKET_DIR | sed 's/+/%2B/g'`
41
42--
431.6.6.1
44
diff --git a/meta/recipes-core/dbus/dbus_1.8.2.bb b/meta/recipes-core/dbus/dbus_1.8.2.bb
new file mode 100644
index 0000000000..37ebed2bd6
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus_1.8.2.bb
@@ -0,0 +1,4 @@
1include dbus.inc
2
3SRC_URI[md5sum] = "d6f709bbec0a022a1847c7caec9d6068"
4SRC_URI[sha256sum] = "5689f7411165adc953f37974e276a3028db94447c76e8dd92efe910c6d3bae08"
diff --git a/meta/recipes-core/dbus/dbus_1.8.6.bb b/meta/recipes-core/dbus/dbus_1.8.6.bb
new file mode 100644
index 0000000000..2fd630fa98
--- /dev/null
+++ b/meta/recipes-core/dbus/dbus_1.8.6.bb
@@ -0,0 +1,4 @@
1include dbus.inc
2
3SRC_URI[md5sum] = "6a08ba555d340e9dfe2d623b83c0eea8"
4SRC_URI[sha256sum] = "eded83ca007b719f32761e60fd8b9ffd0f5796a4caf455b01b5a5ef740ebd23f"
diff --git a/meta/recipes-core/dropbear/dropbear-2013.58/build_test.patch b/meta/recipes-core/dropbear/dropbear-2013.58/build_test.patch
new file mode 100644
index 0000000000..6f828cfc51
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear-2013.58/build_test.patch
@@ -0,0 +1,229 @@
1Fix various linkage errors for LibTomCrypt library in order to run tests
2using ANSI-C PRNG algorithm. Also check that XCLOCKS_PER_SEC is larger than 1000000
3so that there may be a valid PRNG (Pseudo Random Number Generator).
4Customize the tests output to be ptest-compliant <result: testname>.
5
6Upstream-Status: Pending
7Signed-off-by: Dorin Gheorghe<dorin.gheorghe@enea.com>
8
9diff -Naur dropbear-2012.55/libtomcrypt/Makefile.in dropbear-2012.55.modified/libtomcrypt/Makefile.in
10--- dropbear-2012.55/libtomcrypt/Makefile.in 2013-04-16 14:20:45.270448945 +0200
11+++ dropbear-2012.55.modified/libtomcrypt/Makefile.in 2013-04-16 11:00:06.517614900 +0200
12@@ -19,7 +19,7 @@
13
14 # Compilation flags. Note the += does not write over the user's CFLAGS!
15 # The rest of the flags come from the parent Dropbear makefile
16-CFLAGS += -c -I$(srcdir)/src/headers/ -I$(srcdir)/../
17+CFLAGS += -c -I$(srcdir)/src/headers/ -I$(srcdir)/../ -I./testprof
18
19 # additional warnings (newer GCC 3.4 and higher)
20 ifdef GCC_34
21@@ -175,6 +175,7 @@
22 MULTIS=demos/multi.o
23 TIMINGS=demos/timing.o
24 TESTS=demos/test.o
25+YARROW=src/prngs/yarrow.o src/prngs/rng_make_prng.o src/prngs/rng_get_bytes.o
26
27 #Files left over from making the crypt.pdf.
28 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out
29@@ -227,8 +228,8 @@
30 timing: library testprof/$(LIBTEST) $(TIMINGS)
31 $(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
32
33-test: library testprof/$(LIBTEST) $(TESTS)
34- $(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
35+test: library testprof/$(LIBTEST) $(TESTS) $(YARROW)
36+ $(CC) $(LDFLAGS) $(TESTS) $(YARROW) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
37
38 #This rule installs the library and the header files. This must be run
39 #as root in order to have a high enough permission to write to the correct
40diff -Naur dropbear-2012.55/libtomcrypt/demos/test.c dropbear-2012.55.modified/libtomcrypt/demos/test.c
41--- dropbear-2012.55/libtomcrypt/demos/test.c 2012-02-23 14:47:05.000000000 +0100
42+++ dropbear-2012.55.modified/libtomcrypt/demos/test.c 2013-04-18 14:30:44.519839797 +0200
43@@ -12,21 +12,21 @@
44 #elif defined(USE_GMP)
45 ltc_mp = gmp_desc;
46 #else
47- extern ltc_math_descriptor EXT_MATH_LIB;
48+ ltc_math_descriptor EXT_MATH_LIB;
49 ltc_mp = EXT_MATH_LIB;
50 #endif
51
52 printf("build == \n%s\n", crypt_build_settings);
53- printf("\nstore_test...."); fflush(stdout); x = store_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
54- printf("\ncipher_test..."); fflush(stdout); x = cipher_hash_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
55- printf("\nmodes_test...."); fflush(stdout); x = modes_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
56- printf("\nder_test......"); fflush(stdout); x = der_tests(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
57- printf("\nmac_test......"); fflush(stdout); x = mac_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
58- printf("\npkcs_1_test..."); fflush(stdout); x = pkcs_1_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
59- printf("\nrsa_test......"); fflush(stdout); x = rsa_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
60- printf("\necc_test......"); fflush(stdout); x = ecc_tests(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
61- printf("\ndsa_test......"); fflush(stdout); x = dsa_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
62- printf("\nkatja_test...."); fflush(stdout); x = katja_test(); printf(x ? "failed" : "passed");if (x) exit(EXIT_FAILURE);
63+ fflush(stdout); x = store_test(); printf(x ? "FAIL: " : "PASS: "); printf("store_test\n"); if (x) exit(EXIT_FAILURE);
64+ fflush(stdout); x = cipher_hash_test(); printf(x ? "FAIL: " : "PASS: "); printf("cipher_test\n"); if (x) exit(EXIT_FAILURE);
65+ fflush(stdout); x = modes_test(); printf(x ? "FAIL: " : "PASS: "); printf("modes_test\n"); if (x) exit(EXIT_FAILURE);
66+ fflush(stdout); x = der_tests(); printf(x ? "FAIL: " : "PASS: "); printf("der_test\n"); if (x) exit(EXIT_FAILURE);
67+ fflush(stdout); x = mac_test(); printf(x ? "FAIL: " : "PASS: "); printf("mac_test\n"); if (x) exit(EXIT_FAILURE);
68+ fflush(stdout); x = pkcs_1_test(); printf(x ? "FAIL: " : "PASS: "); printf("pkcs_1_test\n"); if (x) exit(EXIT_FAILURE);
69+ fflush(stdout); x = rsa_test(); printf(x ? "FAIL: " : "PASS: "); printf("rsa_test\n"); if (x) exit(EXIT_FAILURE);
70+ fflush(stdout); x = ecc_tests(); printf(x ? "FAIL: " : "PASS: "); printf("ecc_test\n"); if (x) exit(EXIT_FAILURE);
71+ fflush(stdout); x = dsa_test(); printf(x ? "FAIL: " : "PASS: "); printf("dsa_test\n"); if (x) exit(EXIT_FAILURE);
72+ fflush(stdout); x = katja_test(); printf(x ? "FAIL: " : "PASS: "); printf("katja_test\n"); if (x) exit(EXIT_FAILURE);
73 printf("\n");
74 return EXIT_SUCCESS;
75 }
76diff -Naur dropbear-2012.55/libtomcrypt/src/ciphers/des.c dropbear-2012.55.modified/libtomcrypt/src/ciphers/des.c
77--- dropbear-2012.55/libtomcrypt/src/ciphers/des.c 2012-02-23 14:47:05.000000000 +0100
78+++ dropbear-2012.55.modified/libtomcrypt/src/ciphers/des.c 2013-04-16 11:05:46.171309548 +0200
79@@ -20,7 +20,7 @@
80 #define EN0 0
81 #define DE1 1
82
83-#if 0
84+#if 1
85 const struct ltc_cipher_descriptor des_desc =
86 {
87 "des",
88@@ -1520,7 +1520,7 @@
89 }
90 #endif
91
92-#if 0
93+#if 1
94 /**
95 Initialize the DES block cipher
96 @param key The symmetric key you wish to pass
97@@ -1581,7 +1581,7 @@
98 return CRYPT_OK;
99 }
100
101-#if 0
102+#if 1
103 /**
104 Encrypts a block of text with DES
105 @param pt The input plaintext (8 bytes)
106@@ -1672,7 +1672,7 @@
107 return CRYPT_OK;
108 }
109
110-#if 0
111+#if 1
112 /**
113 Performs a self-test of the DES block cipher
114 @return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
115@@ -1857,7 +1857,7 @@
116 #endif
117 }
118
119-#if 0
120+#if 1
121 /** Terminate the context
122 @param skey The scheduled key
123 */
124@@ -1874,7 +1874,7 @@
125 }
126
127
128-#if 0
129+#if 1
130 /**
131 Gets suitable key size
132 @param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable.
133diff -Naur dropbear-2012.55/libtomcrypt/src/headers/tomcrypt_cipher.h dropbear-2012.55.modified/libtomcrypt/src/headers/tomcrypt_cipher.h
134--- dropbear-2012.55/libtomcrypt/src/headers/tomcrypt_cipher.h 2012-02-23 14:47:05.000000000 +0100
135+++ dropbear-2012.55.modified/libtomcrypt/src/headers/tomcrypt_cipher.h 2013-04-16 10:41:21.916943343 +0200
136@@ -187,6 +187,7 @@
137 void *data;
138 } symmetric_key;
139
140+#define LTC_ECB_MODE
141 #ifdef LTC_ECB_MODE
142 /** A block cipher ECB structure */
143 typedef struct {
144diff -Naur dropbear-2012.55/libtomcrypt/src/headers/tomcrypt_custom.h dropbear-2012.55.modified/libtomcrypt/src/headers/tomcrypt_custom.h
145--- dropbear-2012.55/libtomcrypt/src/headers/tomcrypt_custom.h 2012-02-23 14:47:05.000000000 +0100
146+++ dropbear-2012.55.modified/libtomcrypt/src/headers/tomcrypt_custom.h 2013-04-16 14:02:10.794122645 +0200
147@@ -72,13 +72,15 @@
148
149 /* Enable self-test test vector checking */
150 /* Not for dropbear */
151-/*#define LTC_TEST*/
152+#define LTC_TEST
153+
154+#define YARROW
155
156 /* clean the stack of functions which put private information on stack */
157 /* #define LTC_CLEAN_STACK */
158
159 /* disable all file related functions */
160-#define LTC_NO_FILE
161+//#define LTC_NO_FILE
162
163 /* disable all forms of ASM */
164 /* #define LTC_NO_ASM */
165diff -Naur dropbear-2012.55/libtomcrypt/src/misc/crypt/crypt.c dropbear-2012.55.modified/libtomcrypt/src/misc/crypt/crypt.c
166--- dropbear-2012.55/libtomcrypt/src/misc/crypt/crypt.c 2012-02-23 14:47:06.000000000 +0100
167+++ dropbear-2012.55.modified/libtomcrypt/src/misc/crypt/crypt.c 2013-04-16 10:46:33.359842595 +0200
168@@ -15,7 +15,6 @@
169 Build strings, Tom St Denis
170 */
171
172-/*
173 const char *crypt_build_settings =
174 "LibTomCrypt " SCRYPT " (Tom St Denis, tomstdenis@gmail.com)\n"
175 "LibTomCrypt is public domain software.\n"
176@@ -358,7 +357,7 @@
177 "\n"
178 "\n\n\n"
179 ;
180- */
181+
182
183
184 /* $Source: /cvs/libtom/libtomcrypt/src/misc/crypt/crypt.c,v $ */
185diff -Naur dropbear-2012.55/libtomcrypt/src/prngs/rng_get_bytes.c dropbear-2012.55.modified/libtomcrypt/src/prngs/rng_get_bytes.c
186--- dropbear-2012.55/libtomcrypt/src/prngs/rng_get_bytes.c 2012-02-23 14:47:06.000000000 +0100
187+++ dropbear-2012.55.modified/libtomcrypt/src/prngs/rng_get_bytes.c 2013-04-18 14:20:03.974930313 +0200
188@@ -60,7 +60,7 @@
189 clock_t t1;
190 int l, acc, bits, a, b;
191
192- if (XCLOCKS_PER_SEC < 100 || XCLOCKS_PER_SEC > 10000) {
193+ if (XCLOCKS_PER_SEC < 100 || XCLOCKS_PER_SEC > 1000000) {
194 return 0;
195 }
196
197diff -Naur dropbear-2012.55/libtomcrypt/testprof/cipher_hash_test.c dropbear-2012.55.modified/libtomcrypt/testprof/cipher_hash_test.c
198--- dropbear-2012.55/libtomcrypt/testprof/cipher_hash_test.c 2012-02-23 14:47:06.000000000 +0100
199+++ dropbear-2012.55.modified/libtomcrypt/testprof/cipher_hash_test.c 2013-04-16 14:08:22.042234657 +0200
200@@ -11,6 +11,8 @@
201
202 /* test ciphers */
203 for (x = 0; cipher_descriptor[x].name != NULL; x++) {
204+ /* md5 test is failing with segfault */
205+ if (!strcmp(cipher_descriptor[x].name, "md5")) break;
206 DO(cipher_descriptor[x].test());
207 }
208
209diff -Naur dropbear-2012.55/libtomcrypt/testprof/makefile dropbear-2012.55.modified/libtomcrypt/testprof/makefile
210--- dropbear-2012.55/libtomcrypt/testprof/makefile 2012-02-23 14:47:06.000000000 +0100
211+++ dropbear-2012.55.modified/libtomcrypt/testprof/makefile 2013-04-16 10:35:21.200110690 +0200
212@@ -1,4 +1,4 @@
213-CFLAGS += -I../src/headers -I./ -Wall -W
214+CFLAGS += -I../src/headers -I./ -I./../../ -Wall -W
215
216 # ranlib tools
217 ifndef RANLIB
218diff -Naur dropbear-2012.55/libtomcrypt/testprof/modes_test.c dropbear-2012.55.modified/libtomcrypt/testprof/modes_test.c
219--- dropbear-2012.55/libtomcrypt/testprof/modes_test.c 2012-02-23 14:47:06.000000000 +0100
220+++ dropbear-2012.55.modified/libtomcrypt/testprof/modes_test.c 2013-04-16 10:50:53.820882559 +0200
221@@ -1,6 +1,8 @@
222 /* test CFB/OFB/CBC modes */
223 #include <tomcrypt_test.h>
224
225+extern unsigned long yarrow_read(unsigned char *out, unsigned long outlen, prng_state *prng);
226+
227 int modes_test(void)
228 {
229 unsigned char pt[64], ct[64], tmp[64], key[16], iv[16], iv2[16];
diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
new file mode 100644
index 0000000000..947a491679
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -0,0 +1,106 @@
1SUMMARY = "A lightweight SSH and SCP implementation"
2HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
3SECTION = "console/network"
4
5# some files are from other projects and have others license terms:
6# public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY
7LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=4d290ce0ac102c828dfc9ce836784688"
9
10DEPENDS = "zlib"
11RPROVIDES_${PN} = "ssh sshd"
12
13DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
14
15SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
16 file://0001-urandom-xauth-changes-to-options.h.patch \
17 file://0003-configure.patch \
18 file://0004-fix-2kb-keys.patch \
19 file://0007-dropbear-fix-for-x32-abi.patch \
20 file://init \
21 file://dropbearkey.service \
22 file://dropbear@.service \
23 file://dropbear.socket \
24 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} "
25
26PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
27 file://0006-dropbear-configuration-file.patch \
28 file://dropbear"
29
30PAM_PLUGINS = "libpam-runtime \
31 pam-plugin-deny \
32 pam-plugin-permit \
33 pam-plugin-unix \
34 "
35RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
36
37inherit autotools update-rc.d systemd
38
39INITSCRIPT_NAME = "dropbear"
40INITSCRIPT_PARAMS = "defaults 10"
41
42SYSTEMD_SERVICE_${PN} = "dropbear.socket"
43
44CFLAGS_prepend = " -I. "
45LD = "${CC}"
46
47SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
48BINCOMMANDS = "dbclient ssh scp"
49EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
50EXTRA_OECONF += "\
51 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
52CFLAGS += "-DSFTPSERVER_PATH=\\"${libdir}/openssh/sftp-server\\""
53
54do_install() {
55 install -d ${D}${sysconfdir} \
56 ${D}${sysconfdir}/init.d \
57 ${D}${sysconfdir}/default \
58 ${D}${sysconfdir}/dropbear \
59 ${D}${bindir} \
60 ${D}${sbindir} \
61 ${D}${localstatedir}
62
63 install -m 0755 dropbearmulti ${D}${sbindir}/
64 ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
65
66 for i in ${SBINCOMMANDS}
67 do
68 ln -s ./dropbearmulti ${D}${sbindir}/$i
69 done
70 sed -e 's,/etc,${sysconfdir},g' \
71 -e 's,/usr/sbin,${sbindir},g' \
72 -e 's,/var,${localstatedir},g' \
73 -e 's,/usr/bin,${bindir},g' \
74 -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
75 chmod 755 ${D}${sysconfdir}/init.d/dropbear
76 if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
77 install -d ${D}${sysconfdir}/pam.d
78 install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
79 fi
80
81 # deal with systemd unit files
82 install -d ${D}${systemd_unitdir}/system
83 install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
84 install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
85 install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
86 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
87 -e 's,@BINDIR@,${bindir},g' \
88 -e 's,@SBINDIR@,${sbindir},g' \
89 ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
90}
91
92inherit update-alternatives
93
94ALTERNATIVE_PRIORITY = "20"
95ALTERNATIVE_${PN} = "scp ssh"
96
97ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
98
99pkg_postrm_append_${PN} () {
100 if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
101 rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
102 fi
103 if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
104 rm ${sysconfdir}/dropbear/dropbear_dss_host_key
105 fi
106}
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
new file mode 100644
index 0000000000..71a4666b5c
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0001-urandom-xauth-changes-to-options.h.patch
@@ -0,0 +1,23 @@
1Subject: [PATCH 1/6] urandom-xauth-changes-to-options.h
2
3Upstream-Status: Inappropriate [configuration]
4---
5 options.h | 2 +-
6 1 file changed, 1 insertion(+), 1 deletion(-)
7
8diff --git a/options.h b/options.h
9index 7d06322..71a21c2 100644
10--- a/options.h
11+++ b/options.h
12@@ -247,7 +247,7 @@ much traffic. */
13 /* The command to invoke for xauth when using X11 forwarding.
14 * "-q" for quiet */
15 #ifndef XAUTH_COMMAND
16-#define XAUTH_COMMAND "/usr/bin/X11/xauth -q"
17+#define XAUTH_COMMAND "xauth -q"
18 #endif
19
20 /* if you want to enable running an sftp server (such as the one included with
21--
221.7.11.7
23
diff --git a/meta/recipes-core/dropbear/dropbear/0003-configure.patch b/meta/recipes-core/dropbear/dropbear/0003-configure.patch
new file mode 100644
index 0000000000..c53ab01ddd
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0003-configure.patch
@@ -0,0 +1,42 @@
1From c5f5c5054c1b15539dccf866e2c3faba7ed68456 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
3Date: Thu, 25 Apr 2013 00:27:25 +0200
4Subject: [PATCH 3/6] configure: add a variable to allow openpty check to be cached
5
6Upstream-Status: Pending
7
8---
9 configure.ac | 11 ++++++++---
10 1 file changed, 8 insertions(+), 3 deletions(-)
11
12diff --git a/configure.ac b/configure.ac
13index 05461f3..9c16d90 100644
14--- a/configure.ac
15+++ b/configure.ac
16@@ -166,15 +166,20 @@ AC_ARG_ENABLE(openpty,
17 AC_MSG_NOTICE(Not using openpty)
18 else
19 AC_MSG_NOTICE(Using openpty if available)
20- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
21+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
22 fi
23 ],
24 [
25 AC_MSG_NOTICE(Using openpty if available)
26- AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
27+ AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
28 ]
29 )
30-
31+
32+if test "x$dropbear_cv_func_have_openpty" = "xyes"; then
33+ AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)
34+ no_ptc_check=yes
35+ no_ptmx_check=yes
36+fi
37
38 AC_ARG_ENABLE(syslog,
39 [ --disable-syslog Don't include syslog support],
40--
411.7.11.7
42
diff --git a/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch b/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
new file mode 100644
index 0000000000..7539d2034f
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0004-fix-2kb-keys.patch
@@ -0,0 +1,22 @@
1Subject: [PATCH 4/6] fix 2kb keys
2
3Upstream-Status: Inappropriate [configuration]
4---
5 kex.h | 2 +-
6 1 file changed, 1 insertion(+), 1 deletion(-)
7
8diff --git a/kex.h b/kex.h
9index 72430e9..375c677 100644
10--- a/kex.h
11+++ b/kex.h
12@@ -67,6 +67,6 @@ struct KEXState {
13 };
14
15
16-#define MAX_KEXHASHBUF 2000
17+#define MAX_KEXHASHBUF 3000
18
19 #endif /* _KEX_H_ */
20--
211.7.11.7
22
diff --git a/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
new file mode 100644
index 0000000000..c408c571e6
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0005-dropbear-enable-pam.patch
@@ -0,0 +1,28 @@
1Subject: [PATCH 5/6] dropbear enable pam
2
3dropbear: We need modify file option.h besides enabling pam in \
4configure if we want dropbear to support pam.
5
6Upstream-Status: Pending
7
8Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
9---
10 options.h | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13Index: dropbear-2013.62/options.h
14===================================================================
15--- dropbear-2013.62.orig/options.h 2014-01-14 21:53:02.803262009 +0000
16+++ dropbear-2013.62/options.h 2014-01-14 21:53:56.119263462 +0000
17@@ -192,9 +192,9 @@
18 * PAM challenge/response.
19 * You can't enable both PASSWORD and PAM. */
20
21-#define ENABLE_SVR_PASSWORD_AUTH
22+/*#define ENABLE_SVR_PASSWORD_AUTH*/
23 /* PAM requires ./configure --enable-pam */
24-/*#define ENABLE_SVR_PAM_AUTH */
25+#define ENABLE_SVR_PAM_AUTH
26 #define ENABLE_SVR_PUBKEY_AUTH
27
28 /* Whether to take public key options in
diff --git a/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
new file mode 100644
index 0000000000..fa4c8d0a67
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0006-dropbear-configuration-file.patch
@@ -0,0 +1,22 @@
1Subject: [PATCH 6/6] dropbear configuration file
2
3dropbear: Change the path ("/etc/pam.d/sshd" as default) to find a pam configuration file \
4to "/etc/pam.d/dropbear for dropbear when enabling pam supporting"
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-off-by: Maxin B. John <maxin.john@enea.com>
9Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
10---
11diff -Naur dropbear-2013.60-orig/svr-authpam.c dropbear-2013.60/svr-authpam.c
12--- dropbear-2013.60-orig/svr-authpam.c 2013-10-16 16:34:53.000000000 +0200
13+++ dropbear-2013.60/svr-authpam.c 2013-10-21 17:04:04.969416055 +0200
14@@ -211,7 +211,7 @@
15 userData.passwd = password;
16
17 /* Init pam */
18- if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
19+ if ((rc = pam_start("dropbear", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
20 dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s",
21 rc, pam_strerror(pamHandlep, rc));
22 goto cleanup;
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
new file mode 100644
index 0000000000..b4501211c3
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/0007-dropbear-fix-for-x32-abi.patch
@@ -0,0 +1,140 @@
1Upstream-Status: Pending
2
3The dropbearkey utility built in x32 abi format, when generating ssh
4keys, was getting lost in the infinite loop.
5
6This patch fixes the issue by fixing types of variables and
7parameters of functions used in the code, which were getting
8undesired size, when compiled with the x32 abi toolchain.
9
102013/05/23
11Received this fix from H J Lu.
12
13Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
14
15# HG changeset patch
16# User H.J. Lu <hjl.tools@gmail.com>
17# Date 1369344079 25200
18# Node ID a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
19# Parent e76614145aea67f66e4a4257685c771efba21aa1
20Typdef mp_digit to unsigned long long for MP_64BIT
21
22When GCC is used with MP_64BIT, we should typedef mp_digit to unsigned
23long long instead of unsigned long since for x32, unsigned long is
2432-bit and unsigned long long is 64-bit and it is safe to use unsigned
25long long for 64-bit integer with GCC.
26
27diff -r e76614145aea -r a10a1c46b857 libtommath/tommath.h
28--- a/libtommath/tommath.h Thu Apr 18 22:57:47 2013 +0800
29+++ b/libtommath/tommath.h Thu May 23 14:21:19 2013 -0700
30@@ -73,7 +73,7 @@
31 typedef signed long long long64;
32 #endif
33
34- typedef unsigned long mp_digit;
35+ typedef unsigned long long mp_digit;
36 typedef unsigned long mp_word __attribute__ ((mode(TI)));
37
38 #define DIGIT_BIT 60
39# HG changeset patch
40# User H.J. Lu <hjl.tools@gmail.com>
41# Date 1369344241 25200
42# Node ID c7555a4cb7ded3a88409ba85f4027baa7af5f536
43# Parent a10a1c46b857cc8a3923c3bb6d1504aa25b6052f
44Cast to mp_digit when updating *rho
45
46There is
47
48int
49mp_montgomery_setup (mp_int * n, mp_digit * rho)
50
51We should cast to mp_digit instead of unsigned long when updating
52*rho since mp_digit may be unsigned long long and unsigned long long
53may be different from unsigned long, like in x32.
54
55diff -r a10a1c46b857 -r c7555a4cb7de libtommath/bn_mp_montgomery_setup.c
56--- a/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:21:19 2013 -0700
57+++ b/libtommath/bn_mp_montgomery_setup.c Thu May 23 14:24:01 2013 -0700
58@@ -48,7 +48,7 @@
59 #endif
60
61 /* rho = -1/m mod b */
62- *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
63+ *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK;
64
65 return MP_OKAY;
66 }
67# HG changeset patch
68# User H.J. Lu <hjl.tools@gmail.com>
69# Date 1369344541 25200
70# Node ID 7c656e7071a6412688b2f30a529a9afac6c7bf5a
71# Parent c7555a4cb7ded3a88409ba85f4027baa7af5f536
72Define LTC_FAST_TYPE to unsigned long long for __x86_64__
73
74We should define LTC_FAST_TYPE to unsigned long long instead of unsigned
75long if __x86_64__ to support x32 where unsigned long long is 64-bit
76and unsigned long is 32-bit.
77
78diff -r c7555a4cb7de -r 7c656e7071a6 libtomcrypt/src/headers/tomcrypt_cfg.h
79--- a/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:24:01 2013 -0700
80+++ b/libtomcrypt/src/headers/tomcrypt_cfg.h Thu May 23 14:29:01 2013 -0700
81@@ -74,7 +74,7 @@
82 #define ENDIAN_LITTLE
83 #define ENDIAN_64BITWORD
84 #define LTC_FAST
85- #define LTC_FAST_TYPE unsigned long
86+ #define LTC_FAST_TYPE unsigned long long
87 #endif
88
89 /* detect PPC32 */
90# HG changeset patch
91# User H.J. Lu <hjl.tools@gmail.com>
92# Date 1369344730 25200
93# Node ID a7d4690158fae4ede2c4e5b56233e83730bf38ee
94# Parent 7c656e7071a6412688b2f30a529a9afac6c7bf5a
95Use unsigned long long aas unsigned 64-bit integer for x86-64 GCC
96
97We should use unsigned long long instead of unsigned long as unsigned
9864-bit integer for x86-64 GCC to support x32 where unsigned long is
9932-bit.
100
101diff -r 7c656e7071a6 -r a7d4690158fa libtomcrypt/src/headers/tomcrypt_macros.h
102--- a/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:29:01 2013 -0700
103+++ b/libtomcrypt/src/headers/tomcrypt_macros.h Thu May 23 14:32:10 2013 -0700
104@@ -343,7 +343,7 @@
105 /* 64-bit Rotates */
106 #if !defined(__STRICT_ANSI__) && defined(__GNUC__) && defined(__x86_64__) && !defined(LTC_NO_ASM)
107
108-static inline unsigned long ROL64(unsigned long word, int i)
109+static inline unsigned long long ROL64(unsigned long long word, int i)
110 {
111 asm("rolq %%cl,%0"
112 :"=r" (word)
113@@ -351,7 +351,7 @@
114 return word;
115 }
116
117-static inline unsigned long ROR64(unsigned long word, int i)
118+static inline unsigned long long ROR64(unsigned long long word, int i)
119 {
120 asm("rorq %%cl,%0"
121 :"=r" (word)
122@@ -361,7 +361,7 @@
123
124 #ifndef LTC_NO_ROLC
125
126-static inline unsigned long ROL64c(unsigned long word, const int i)
127+static inline unsigned long long ROL64c(unsigned long long word, const int i)
128 {
129 asm("rolq %2,%0"
130 :"=r" (word)
131@@ -369,7 +369,7 @@
132 return word;
133 }
134
135-static inline unsigned long ROR64c(unsigned long word, const int i)
136+static inline unsigned long long ROR64c(unsigned long long word, const int i)
137 {
138 asm("rorq %2,%0"
139 :"=r" (word)
140
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear b/meta/recipes-core/dropbear/dropbear/dropbear
new file mode 100644
index 0000000000..47e787fb10
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear
@@ -0,0 +1,4 @@
1#%PAM-1.0
2
3auth include common-auth
4account include common-account
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear.socket b/meta/recipes-core/dropbear/dropbear/dropbear.socket
new file mode 100644
index 0000000000..e5c61b755e
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear.socket
@@ -0,0 +1,10 @@
1[Unit]
2Conflicts=dropbear.service
3
4[Socket]
5ListenStream=22
6Accept=yes
7
8[Install]
9WantedBy=sockets.target
10Also=dropbearkey.service
diff --git a/meta/recipes-core/dropbear/dropbear/dropbear@.service b/meta/recipes-core/dropbear/dropbear/dropbear@.service
new file mode 100644
index 0000000000..6fe9942090
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbear@.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=SSH Per-Connection Server
3Wants=dropbearkey.service
4After=syslog.target dropbearkey.service
5
6[Service]
7EnvironmentFile=-/etc/default/dropbear
8ExecStart=-@SBINDIR@/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
9ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
10StandardInput=socket
11KillMode=process
diff --git a/meta/recipes-core/dropbear/dropbear/dropbearkey.service b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
new file mode 100644
index 0000000000..ccc21d5cca
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/dropbearkey.service
@@ -0,0 +1,8 @@
1[Unit]
2Description=SSH Key Generation
3ConditionPathExists=|!/etc/dropbear/dropbear_rsa_host_key
4
5[Service]
6Type=oneshot
7ExecStart=@SBINDIR@/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
8RemainAfterExit=yes
diff --git a/meta/recipes-core/dropbear/dropbear/init b/meta/recipes-core/dropbear/dropbear/init
new file mode 100755
index 0000000000..e8fed3f94d
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/init
@@ -0,0 +1,113 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: sshd
4# Required-Start: $remote_fs $syslog $networking
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 1
8# Short-Description: Dropbear Secure Shell server
9### END INIT INFO
10#
11# Do not configure this file. Edit /etc/default/dropbear instead!
12#
13
14PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15DAEMON=/usr/sbin/dropbear
16NAME=dropbear
17DESC="Dropbear SSH server"
18PIDFILE=/var/run/dropbear.pid
19
20DROPBEAR_PORT=22
21DROPBEAR_EXTRA_ARGS=
22NO_START=0
23
24set -e
25
26test ! -r /etc/default/dropbear || . /etc/default/dropbear
27test "$NO_START" = "0" || exit 0
28test -x "$DAEMON" || exit 0
29test ! -h /var/service/dropbear || exit 0
30
31readonly_rootfs=0
32for flag in `awk '{ if ($2 == "/") { split($4,FLAGS,",") } }; END { for (f in FLAGS) print FLAGS[f] }' </proc/mounts`; do
33 case $flag in
34 ro)
35 readonly_rootfs=1
36 ;;
37 esac
38done
39
40if [ $readonly_rootfs = "1" ]; then
41 mkdir -p /var/lib/dropbear
42 DROPBEAR_RSAKEY_DEFAULT="/var/lib/dropbear/dropbear_rsa_host_key"
43 DROPBEAR_DSSKEY_DEFAULT="/var/lib/dropbear/dropbear_dss_host_key"
44else
45 DROPBEAR_RSAKEY_DEFAULT="/etc/dropbear/dropbear_rsa_host_key"
46 DROPBEAR_DSSKEY_DEFAULT="/etc/dropbear/dropbear_dss_host_key"
47fi
48
49test -z "$DROPBEAR_BANNER" || \
50 DROPBEAR_EXTRA_ARGS="$DROPBEAR_EXTRA_ARGS -b $DROPBEAR_BANNER"
51test -n "$DROPBEAR_RSAKEY" || \
52 DROPBEAR_RSAKEY=$DROPBEAR_RSAKEY_DEFAULT
53test -n "$DROPBEAR_DSSKEY" || \
54 DROPBEAR_DSSKEY=$DROPBEAR_DSSKEY_DEFAULT
55test -n "$DROPBEAR_KEYTYPES" || \
56 DROPBEAR_KEYTYPES="rsa"
57
58gen_keys() {
59for t in $DROPBEAR_KEYTYPES; do
60 case $t in
61 rsa)
62 if [ -f "$DROPBEAR_RSAKEY" -a ! -s "$DROPBEAR_RSAKEY" ]; then
63 rm $DROPBEAR_RSAKEY || true
64 fi
65 test -f $DROPBEAR_RSAKEY || dropbearkey -t rsa -f $DROPBEAR_RSAKEY
66 ;;
67 dsa)
68 if [ -f "$DROPBEAR_DSSKEY" -a ! -s "$DROPBEAR_DSSKEY" ]; then
69 rm $DROPBEAR_DSSKEY || true
70 fi
71 test -f $DROPBEAR_DSSKEY || dropbearkey -t dss -f $DROPBEAR_DSSKEY
72 ;;
73 esac
74done
75}
76
77case "$1" in
78 start)
79 echo -n "Starting $DESC: "
80 gen_keys
81 KEY_ARGS=""
82 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
83 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
84 start-stop-daemon -S -p $PIDFILE \
85 -x "$DAEMON" -- $KEY_ARGS \
86 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
87 echo "$NAME."
88 ;;
89 stop)
90 echo -n "Stopping $DESC: "
91 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
92 echo "$NAME."
93 ;;
94 restart|force-reload)
95 echo -n "Restarting $DESC: "
96 start-stop-daemon -K -x "$DAEMON" -p $PIDFILE
97 sleep 1
98 KEY_ARGS=""
99 test -f $DROPBEAR_DSSKEY && KEY_ARGS="$KEY_ARGS -d $DROPBEAR_DSSKEY"
100 test -f $DROPBEAR_RSAKEY && KEY_ARGS="$KEY_ARGS -r $DROPBEAR_RSAKEY"
101 start-stop-daemon -S -p $PIDFILE \
102 -x "$DAEMON" -- $KEY_ARGS \
103 -p "$DROPBEAR_PORT" $DROPBEAR_EXTRA_ARGS
104 echo "$NAME."
105 ;;
106 *)
107 N=/etc/init.d/$NAME
108 echo "Usage: $N {start|stop|restart|force-reload}" >&2
109 exit 1
110 ;;
111esac
112
113exit 0
diff --git a/meta/recipes-core/dropbear/dropbear/run-ptest b/meta/recipes-core/dropbear/dropbear/run-ptest
new file mode 100644
index 0000000000..61f1e0c0dd
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/run-ptest
@@ -0,0 +1,2 @@
1#!/bin/sh
2cd libtomcrypt; ./test 2>&1 | sed 's/NOPPASS/SKIP/'
diff --git a/meta/recipes-core/dropbear/dropbear_2014.63.bb b/meta/recipes-core/dropbear/dropbear_2014.63.bb
new file mode 100644
index 0000000000..bb7e6178bc
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear_2014.63.bb
@@ -0,0 +1,4 @@
1require dropbear.inc
2
3SRC_URI[md5sum] = "7066bb9a2da708f3ed06314fdc9c47fd"
4SRC_URI[sha256sum] = "595992de432ba586a0e7e191bbb1ad587727678bb3e345b018c395b8c55b57ae"
diff --git a/meta/recipes-core/expat/expat-2.1.0/autotools.patch b/meta/recipes-core/expat/expat-2.1.0/autotools.patch
new file mode 100644
index 0000000000..0e599697a6
--- /dev/null
+++ b/meta/recipes-core/expat/expat-2.1.0/autotools.patch
@@ -0,0 +1,24 @@
1Avoid using expat's m4 files
2
3Upstream-Status: Inappropriate [Other]
4Workaround specific to our build system.
5
6Signed-off-by: Kevin Tian <kevin.tian@intel.com>
7Signed-off-by: Scott Garman <scott.a.garman@intel.com>
8
9Updated to apply over expat 2.1.0
10
11Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
12
13diff -Nurd expat-2.1.0/configure.in expat-2.1.0/configure.in
14--- expat-2.1.0/configure.in 2012-03-04 01:45:53.000000000 +0200
15+++ expat-2.1.0/configure.in 2012-05-10 21:04:44.000000000 +0300
16@@ -51,8 +51,6 @@
17
18 AC_CONFIG_HEADER(expat_config.h)
19
20-sinclude(conftools/ac_c_bigendian_cross.m4)
21-
22 AC_LIBTOOL_WIN32_DLL
23 AC_PROG_LIBTOOL
24
diff --git a/meta/recipes-core/expat/expat.inc b/meta/recipes-core/expat/expat.inc
new file mode 100644
index 0000000000..6dfafe94d2
--- /dev/null
+++ b/meta/recipes-core/expat/expat.inc
@@ -0,0 +1,20 @@
1SUMMARY = "A stream-oriented XML parser library"
2DESCRIPTION = "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)"
3HOMEPAGE = "http://expat.sourceforge.net/"
4SECTION = "libs"
5LICENSE = "MIT"
6
7SRC_URI = "${SOURCEFORGE_MIRROR}/expat/expat-${PV}.tar.gz \
8 file://autotools.patch"
9
10inherit autotools lib_package gzipnative
11
12# This package uses an archive format known to have issue with some
13# versions of gzip
14do_unpack[depends] += "gzip-native:do_populate_sysroot"
15
16do_configure_prepend () {
17 rm -f ${S}/conftools/libtool.m4
18}
19
20BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/expat/expat_2.1.0.bb b/meta/recipes-core/expat/expat_2.1.0.bb
new file mode 100644
index 0000000000..b958742edc
--- /dev/null
+++ b/meta/recipes-core/expat/expat_2.1.0.bb
@@ -0,0 +1,5 @@
1require expat.inc
2LIC_FILES_CHKSUM = "file://COPYING;md5=1b71f681713d1256e1c23b0890920874"
3
4SRC_URI[md5sum] = "dd7dab7a5fea97d2a6a43f511449b7cd"
5SRC_URI[sha256sum] = "823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86"
diff --git a/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb b/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb
new file mode 100644
index 0000000000..fb312f8151
--- /dev/null
+++ b/meta/recipes-core/feed-config/poky-feed-config-opkg_1.0.bb
@@ -0,0 +1,44 @@
1SUMMARY = "Poky example feed configuration"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4PR = "r2"
5PACKAGE_ARCH = "${MACHINE_ARCH}"
6INHIBIT_DEFAULT_DEPS = "1"
7
8#FEEDNAMEPREFIX ?= "INVALID"
9#FEEDURIPREFIX ?= "INVALID"
10
11do_compile() {
12 mkdir -p ${S}/${sysconfdir}/opkg/
13
14 archconf=${S}/${sysconfdir}/opkg/arch.conf
15
16 rm -f $archconf
17 ipkgarchs="${ALL_MULTILIB_PACKAGE_ARCHS}"
18 priority=1
19 for arch in $ipkgarchs; do
20 echo "arch $arch $priority" >> $archconf
21 priority=$(expr $priority + 5)
22 done
23
24 basefeedconf=${S}/${sysconfdir}/opkg/base-feeds.conf
25
26 rm -f $basefeedconf
27 touch $basefeedconf
28
29 #for arch in $ipkgarchs; do
30 # echo "src/gz ${FEEDNAMEPREFIX}-$arch http://pokylinux.org/${FEEDURIPREFIX}$arch" >> $basefeedconf
31 #done
32}
33
34
35do_install () {
36 install -d ${D}${sysconfdir}/opkg
37 install -m 0644 ${S}/${sysconfdir}/opkg/* ${D}${sysconfdir}/opkg/
38}
39
40FILES_${PN} = "${sysconfdir}/opkg/ "
41
42CONFFILES_${PN} += "${sysconfdir}/opkg/base-feeds.conf \
43 ${sysconfdir}/opkg/arch.conf"
44
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
new file mode 100644
index 0000000000..e4c5f1566b
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/disable_java.patch
@@ -0,0 +1,39 @@
1
2# Pulled from OpenEmbedded
3#
4# Commented by: Saul Wold <saul.wold@intel.com>
5
6Upstream-Status: Inappropriate [licensing]
7
8Index: gettext-0.16.1/gettext-tools/configure.ac
9===================================================================
10--- gettext-0.16.1.orig/gettext-tools/configure.ac 2006-11-27 09:02:01.000000000 -0800
11+++ gettext-0.16.1/gettext-tools/configure.ac 2011-03-16 16:55:36.111396557 -0700
12@@ -36,27 +36,15 @@
13 gt_JAVA_CHOICE
14
15 gt_GCJ
16-if test -n "$HAVE_GCJ" && test "$JAVA_CHOICE" = yes; then
17- BUILDJAVAEXE=yes
18-else
19 BUILDJAVAEXE=no
20-fi
21 AC_SUBST(BUILDJAVAEXE)
22
23 gt_JAVAEXEC
24 gt_JAVACOMP([1.3])
25 AC_CHECK_PROG(JAR, jar, jar)
26-if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then
27- BUILDJAVA=yes
28-else
29 BUILDJAVA=no
30-fi
31 AC_SUBST(BUILDJAVA)
32-if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
33- TESTJAVA=yes
34-else
35 TESTJAVA=no
36-fi
37 AC_SUBST(TESTJAVA)
38
39 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
new file mode 100644
index 0000000000..7293f5b08d
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/fix_aclocal_version.patch
@@ -0,0 +1,110 @@
1
2This patch updates the required version number from 2.61 to the
3current 2.65 version of aclocal, this will need to be updated
4when we update aclocal
5
6Upstream-Status: Inappropriate [configuration]
7
8Signed-off-by Saul Wold <sgw@linux.intel.com>
9
10Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
11===================================================================
12--- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:36.391519775 -0700
13+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 02:24:45.569526073 -0700
14@@ -148,7 +148,7 @@
15 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
16 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
17 dnl Autoconf >= 2.61 supports dots in --with options.
18- define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
19+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.65]),[-1],[translit([$1],[.],[_])],[$1])])
20 dnl By default, look in $includedir and $libdir.
21 use_additional=yes
22 AC_LIB_WITH_FINAL_PREFIX([
23Index: gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4
24===================================================================
25--- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
26+++ gettext-0.16.1/autoconf-lib-link/tests/rpathly/aclocal.m4 2011-03-17 02:24:45.570526904 -0700
27@@ -11,8 +11,8 @@
28 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 # PARTICULAR PURPOSE.
30
31-m4_if(m4_PACKAGE_VERSION, [2.61],,
32-[m4_fatal([this file was generated for autoconf 2.61.
33+m4_if(m4_PACKAGE_VERSION, [2.65],,
34+[m4_fatal([this file was generated for autoconf 2.65.
35 You have another version of autoconf. If you want to use that,
36 you should regenerate the build system entirely.], [63])])
37
38Index: gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4
39===================================================================
40--- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
41+++ gettext-0.16.1/autoconf-lib-link/tests/rpathx/aclocal.m4 2011-03-17 02:24:45.572525773 -0700
42@@ -11,8 +11,8 @@
43 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
44 # PARTICULAR PURPOSE.
45
46-m4_if(m4_PACKAGE_VERSION, [2.61],,
47-[m4_fatal([this file was generated for autoconf 2.61.
48+m4_if(m4_PACKAGE_VERSION, [2.65],,
49+[m4_fatal([this file was generated for autoconf 2.65.
50 You have another version of autoconf. If you want to use that,
51 you should regenerate the build system entirely.], [63])])
52
53Index: gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4
54===================================================================
55--- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
56+++ gettext-0.16.1/autoconf-lib-link/tests/rpathy/aclocal.m4 2011-03-17 02:24:45.578394916 -0700
57@@ -11,7 +11,7 @@
58 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
59 # PARTICULAR PURPOSE.
60
61-m4_if(m4_PACKAGE_VERSION, [2.61],,
62+m4_if(m4_PACKAGE_VERSION, [2.65],,
63 [m4_fatal([this file was generated for autoconf 2.61.
64 You have another version of autoconf. If you want to use that,
65 you should regenerate the build system entirely.], [63])])
66Index: gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4
67===================================================================
68--- gettext-0.16.1.orig/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:36.391519775 -0700
69+++ gettext-0.16.1/autoconf-lib-link/tests/rpathz/aclocal.m4 2011-03-17 02:24:45.586395416 -0700
70@@ -11,8 +11,8 @@
71 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
72 # PARTICULAR PURPOSE.
73
74-m4_if(m4_PACKAGE_VERSION, [2.61],,
75-[m4_fatal([this file was generated for autoconf 2.61.
76+m4_if(m4_PACKAGE_VERSION, [2.65],,
77+[m4_fatal([this file was generated for autoconf 2.65.
78 You have another version of autoconf. If you want to use that,
79 you should regenerate the build system entirely.], [63])])
80
81Index: gettext-0.16.1/gettext-tools/aclocal.m4
82===================================================================
83--- gettext-0.16.1.orig/gettext-tools/aclocal.m4 2006-11-27 09:34:32.000000000 -0800
84+++ gettext-0.16.1/gettext-tools/aclocal.m4 2011-03-17 02:27:01.135682807 -0700
85@@ -11,8 +11,8 @@
86 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
87 # PARTICULAR PURPOSE.
88
89-m4_if(m4_PACKAGE_VERSION, [2.61],,
90-[m4_fatal([this file was generated for autoconf 2.61.
91+m4_if(m4_PACKAGE_VERSION, [2.65],,
92+[m4_fatal([this file was generated for autoconf 2.65.
93 You have another version of autoconf. If you want to use that,
94 you should regenerate the build system entirely.], [63])])
95
96Index: gettext-0.16.1/gettext-tools/examples/aclocal.m4
97===================================================================
98--- gettext-0.16.1.orig/gettext-tools/examples/aclocal.m4 2006-11-27 09:16:23.000000000 -0800
99+++ gettext-0.16.1/gettext-tools/examples/aclocal.m4 2011-03-17 02:26:52.589396683 -0700
100@@ -11,8 +11,8 @@
101 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
102 # PARTICULAR PURPOSE.
103
104-m4_if(m4_PACKAGE_VERSION, [2.61],,
105-[m4_fatal([this file was generated for autoconf 2.61.
106+m4_if(m4_PACKAGE_VERSION, [2.65],,
107+[m4_fatal([this file was generated for autoconf 2.65.
108 You have another version of autoconf. If you want to use that,
109 you should regenerate the build system entirely.], [63])])
110
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
new file mode 100644
index 0000000000..06861492c0
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/fix_gnu_source_circular.patch
@@ -0,0 +1,348 @@
1
2This patch removes the circular dependency on AC_GNU_SOURCE in
3AC_USE_SYSTEM_EXTENSIONS.
4
5Thanks to Mark Hatle for the timely pointers and fixes.
6
7Upstream-Status: Inappropriate [licensing]
8
9Signed-off-by Saul Wold <sgw@linux.intel.com>
10
11diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 gettext.patched/gettext-runtime/gnulib-m4/extensions.m4
12--- gettext-0.16.1/gettext-runtime/gnulib-m4/extensions.m4 2006-11-27 09:14:38.000000000 -0800
13+++ gettext.patched/gettext-runtime/gnulib-m4/extensions.m4 2011-03-16 23:54:01.711923448 -0700
14@@ -16,43 +16,47 @@
15 # ------------------------
16 # Enable extensions on systems that normally disable them,
17 # typically due to standards-conformance issues.
18-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
19-[
20- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
21- AC_BEFORE([$0], [AC_RUN_IFELSE])
22-
23- AC_REQUIRE([AC_GNU_SOURCE])
24- AC_REQUIRE([AC_AIX])
25- AC_REQUIRE([AC_MINIX])
26-
27- AH_VERBATIM([__EXTENSIONS__],
28-[/* Enable extensions on Solaris. */
29-#ifndef __EXTENSIONS__
30-# undef __EXTENSIONS__
31-#endif
32-#ifndef _POSIX_PTHREAD_SEMANTICS
33-# undef _POSIX_PTHREAD_SEMANTICS
34-#endif
35-#ifndef _TANDEM_SOURCE
36-# undef _TANDEM_SOURCE
37-#endif])
38- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
39- [ac_cv_safe_to_define___extensions__],
40- [AC_COMPILE_IFELSE(
41- [AC_LANG_PROGRAM([
42-# define __EXTENSIONS__ 1
43- AC_INCLUDES_DEFAULT])],
44- [ac_cv_safe_to_define___extensions__=yes],
45- [ac_cv_safe_to_define___extensions__=no])])
46- test $ac_cv_safe_to_define___extensions__ = yes &&
47- AC_DEFINE([__EXTENSIONS__])
48- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
49- AC_DEFINE([_TANDEM_SOURCE])
50-])
51+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
52+#[
53+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
54+# AC_BEFORE([$0], [AC_RUN_IFELSE])
55+#
56+# AC_REQUIRE([AC_GNU_SOURCE])
57+# AC_REQUIRE([AC_AIX])
58+# AC_REQUIRE([AC_MINIX])
59+#
60+# AH_VERBATIM([__EXTENSIONS__],
61+#[/* Enable extensions on Solaris. */
62+##ifndef __EXTENSIONS__
63+## undef __EXTENSIONS__
64+##endif
65+##ifndef _POSIX_PTHREAD_SEMANTICS
66+## undef _POSIX_PTHREAD_SEMANTICS
67+##endif
68+##ifndef _TANDEM_SOURCE
69+## undef _TANDEM_SOURCE
70+##endif])
71+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
72+# [ac_cv_safe_to_define___extensions__],
73+# [AC_COMPILE_IFELSE(
74+# [AC_LANG_PROGRAM([
75+## define __EXTENSIONS__ 1
76+# AC_INCLUDES_DEFAULT])],
77+# [ac_cv_safe_to_define___extensions__=yes],
78+# [ac_cv_safe_to_define___extensions__=no])])
79+# test $ac_cv_safe_to_define___extensions__ = yes &&
80+# AC_DEFINE([__EXTENSIONS__])
81+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
82+# AC_DEFINE([_TANDEM_SOURCE])
83+#])
84
85 # gl_USE_SYSTEM_EXTENSIONS
86 # ------------------------
87 # Enable extensions on systems that normally disable them,
88 # typically due to standards-conformance issues.
89 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
90- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
91+[
92+ AC_REQUIRE([AC_GNU_SOURCE])
93+
94+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
95+])
96diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4
97--- gettext-0.16.1/gettext-runtime/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:19.000000000 -0800
98+++ gettext.patched/gettext-runtime/gnulib-m4/gnulib-comp.m4 2011-03-16 23:50:17.471531838 -0700
99@@ -25,7 +25,7 @@
100 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
101 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
102 AC_REQUIRE([AC_PROG_RANLIB])
103- AC_REQUIRE([AC_GNU_SOURCE])
104+ dnl AC_REQUIRE([AC_GNU_SOURCE])
105 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
106 ])
107
108diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4
109--- gettext-0.16.1/gettext-runtime/gnulib-m4/mbchar.m4 2006-11-27 09:14:38.000000000 -0800
110+++ gettext.patched/gettext-runtime/gnulib-m4/mbchar.m4 2011-03-16 23:50:10.814396529 -0700
111@@ -9,7 +9,7 @@
112
113 AC_DEFUN([gl_MBCHAR],
114 [
115- AC_REQUIRE([AC_GNU_SOURCE])
116+ dnl AC_REQUIRE([AC_GNU_SOURCE])
117 dnl The following line is that so the user can test HAVE_WCHAR_H
118 dnl before #include "mbchar.h".
119 AC_CHECK_HEADERS_ONCE([wchar.h])
120diff -ru gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4
121--- gettext-0.16.1/gettext-runtime/gnulib-m4/wcwidth.m4 2006-11-27 09:14:38.000000000 -0800
122+++ gettext.patched/gettext-runtime/gnulib-m4/wcwidth.m4 2011-03-16 23:50:08.357396247 -0700
123@@ -7,7 +7,7 @@
124 AC_DEFUN([gl_FUNC_WCWIDTH],
125 [
126 dnl Persuade glibc <wchar.h> to declare wcwidth().
127- AC_REQUIRE([AC_GNU_SOURCE])
128+ dnl AC_REQUIRE([AC_GNU_SOURCE])
129
130 AC_REQUIRE([AC_C_INLINE])
131 AC_REQUIRE([gt_TYPE_WCHAR_T])
132diff -ru gettext-0.16.1/gettext-runtime/m4/lock.m4 gettext.patched/gettext-runtime/m4/lock.m4
133--- gettext-0.16.1/gettext-runtime/m4/lock.m4 2006-10-24 13:59:59.000000000 -0700
134+++ gettext.patched/gettext-runtime/m4/lock.m4 2011-03-16 23:50:04.355891676 -0700
135@@ -35,7 +35,7 @@
136 AC_BEFORE([$0], [gl_ARGP])dnl
137
138 AC_REQUIRE([AC_CANONICAL_HOST])
139- AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
140+ dnl AC_REQUIRE([AC_GNU_SOURCE]) dnl needed for pthread_rwlock_t on glibc systems
141 dnl Check for multithreading.
142 AC_ARG_ENABLE(threads,
143 AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
144diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 gettext.patched/gettext-tools/gnulib-m4/extensions.m4
145--- gettext-0.16.1/gettext-tools/gnulib-m4/extensions.m4 2006-11-27 09:14:54.000000000 -0800
146+++ gettext.patched/gettext-tools/gnulib-m4/extensions.m4 2011-03-16 23:53:28.487671266 -0700
147@@ -16,43 +16,47 @@
148 # ------------------------
149 # Enable extensions on systems that normally disable them,
150 # typically due to standards-conformance issues.
151-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
152-[
153- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
154- AC_BEFORE([$0], [AC_RUN_IFELSE])
155-
156- AC_REQUIRE([AC_GNU_SOURCE])
157- AC_REQUIRE([AC_AIX])
158- AC_REQUIRE([AC_MINIX])
159-
160- AH_VERBATIM([__EXTENSIONS__],
161-[/* Enable extensions on Solaris. */
162-#ifndef __EXTENSIONS__
163-# undef __EXTENSIONS__
164-#endif
165-#ifndef _POSIX_PTHREAD_SEMANTICS
166-# undef _POSIX_PTHREAD_SEMANTICS
167-#endif
168-#ifndef _TANDEM_SOURCE
169-# undef _TANDEM_SOURCE
170-#endif])
171- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
172- [ac_cv_safe_to_define___extensions__],
173- [AC_COMPILE_IFELSE(
174- [AC_LANG_PROGRAM([
175-# define __EXTENSIONS__ 1
176- AC_INCLUDES_DEFAULT])],
177- [ac_cv_safe_to_define___extensions__=yes],
178- [ac_cv_safe_to_define___extensions__=no])])
179- test $ac_cv_safe_to_define___extensions__ = yes &&
180- AC_DEFINE([__EXTENSIONS__])
181- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
182- AC_DEFINE([_TANDEM_SOURCE])
183-])
184+#AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
185+#[
186+# AC_BEFORE([$0], [AC_COMPILE_IFELSE])
187+# AC_BEFORE([$0], [AC_RUN_IFELSE])
188+#
189+# AC_REQUIRE([AC_GNU_SOURCE])
190+# AC_REQUIRE([AC_AIX])
191+# AC_REQUIRE([AC_MINIX])
192+#
193+# AH_VERBATIM([__EXTENSIONS__],
194+#[/* Enable extensions on Solaris. */
195+##ifndef __EXTENSIONS__
196+## undef __EXTENSIONS__
197+##endif
198+##ifndef _POSIX_PTHREAD_SEMANTICS
199+## undef _POSIX_PTHREAD_SEMANTICS
200+##endif
201+##ifndef _TANDEM_SOURCE
202+## undef _TANDEM_SOURCE
203+##endif])
204+# AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
205+# [ac_cv_safe_to_define___extensions__],
206+# [AC_COMPILE_IFELSE(
207+# [AC_LANG_PROGRAM([
208+## define __EXTENSIONS__ 1
209+# AC_INCLUDES_DEFAULT])],
210+# [ac_cv_safe_to_define___extensions__=yes],
211+# [ac_cv_safe_to_define___extensions__=no])])
212+# test $ac_cv_safe_to_define___extensions__ = yes &&
213+# AC_DEFINE([__EXTENSIONS__])
214+# AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
215+# AC_DEFINE([_TANDEM_SOURCE])
216+#])
217
218 # gl_USE_SYSTEM_EXTENSIONS
219 # ------------------------
220 # Enable extensions on systems that normally disable them,
221 # typically due to standards-conformance issues.
222 AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
223- [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
224+[
225+ AC_REQUIRE([AC_GNU_SOURCE])
226+
227+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
228+])
229diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4
230--- gettext-0.16.1/gettext-tools/gnulib-m4/fnmatch.m4 2006-11-27 09:14:54.000000000 -0800
231+++ gettext.patched/gettext-tools/gnulib-m4/fnmatch.m4 2011-03-16 23:52:06.477463671 -0700
232@@ -91,7 +91,7 @@
233 AC_DEFUN([gl_FUNC_FNMATCH_GNU],
234 [
235 dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
236- AC_REQUIRE([AC_GNU_SOURCE])
237+ dnl AC_REQUIRE([AC_GNU_SOURCE])
238
239 FNMATCH_H=
240 _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
241diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 gettext.patched/gettext-tools/gnulib-m4/getdelim.m4
242--- gettext-0.16.1/gettext-tools/gnulib-m4/getdelim.m4 2006-11-27 09:14:54.000000000 -0800
243+++ gettext.patched/gettext-tools/gnulib-m4/getdelim.m4 2011-03-16 23:52:22.871674845 -0700
244@@ -12,7 +12,7 @@
245 [
246
247 dnl Persuade glibc <stdio.h> to declare getdelim().
248- AC_REQUIRE([AC_GNU_SOURCE])
249+ dnl AC_REQUIRE([AC_GNU_SOURCE])
250
251 AC_REPLACE_FUNCS(getdelim)
252 AC_CHECK_DECLS_ONCE(getdelim)
253diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 gettext.patched/gettext-tools/gnulib-m4/getline.m4
254--- gettext-0.16.1/gettext-tools/gnulib-m4/getline.m4 2006-11-27 09:14:54.000000000 -0800
255+++ gettext.patched/gettext-tools/gnulib-m4/getline.m4 2011-03-16 23:51:49.829971108 -0700
256@@ -16,7 +16,7 @@
257 AC_DEFUN([gl_FUNC_GETLINE],
258 [
259 dnl Persuade glibc <stdio.h> to declare getline().
260- AC_REQUIRE([AC_GNU_SOURCE])
261+ dnl AC_REQUIRE([AC_GNU_SOURCE])
262
263 AC_CHECK_DECLS([getline])
264
265diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4
266--- gettext-0.16.1/gettext-tools/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:36.000000000 -0800
267+++ gettext.patched/gettext-tools/gnulib-m4/gnulib-comp.m4 2011-03-16 23:52:18.970450488 -0700
268@@ -25,7 +25,7 @@
269 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
270 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
271 AC_REQUIRE([AC_PROG_RANLIB])
272- AC_REQUIRE([AC_GNU_SOURCE])
273+ dnl AC_REQUIRE([AC_GNU_SOURCE])
274 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
275 AC_REQUIRE([gl_LOCK_EARLY])
276 ])
277diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 gettext.patched/gettext-tools/gnulib-m4/mbchar.m4
278--- gettext-0.16.1/gettext-tools/gnulib-m4/mbchar.m4 2006-11-27 09:14:55.000000000 -0800
279+++ gettext.patched/gettext-tools/gnulib-m4/mbchar.m4 2011-03-16 23:51:40.844410216 -0700
280@@ -9,7 +9,7 @@
281
282 AC_DEFUN([gl_MBCHAR],
283 [
284- AC_REQUIRE([AC_GNU_SOURCE])
285+ dnl AC_REQUIRE([AC_GNU_SOURCE])
286 dnl The following line is that so the user can test HAVE_WCHAR_H
287 dnl before #include "mbchar.h".
288 AC_CHECK_HEADERS_ONCE([wchar.h])
289diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4
290--- gettext-0.16.1/gettext-tools/gnulib-m4/stpcpy.m4 2006-11-27 09:14:55.000000000 -0800
291+++ gettext.patched/gettext-tools/gnulib-m4/stpcpy.m4 2011-03-16 23:52:14.691396045 -0700
292@@ -7,7 +7,7 @@
293 AC_DEFUN([gl_FUNC_STPCPY],
294 [
295 dnl Persuade glibc <string.h> to declare stpcpy().
296- AC_REQUIRE([AC_GNU_SOURCE])
297+ dnl AC_REQUIRE([AC_GNU_SOURCE])
298
299 AC_REPLACE_FUNCS(stpcpy)
300 if test $ac_cv_func_stpcpy = no; then
301diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4
302--- gettext-0.16.1/gettext-tools/gnulib-m4/stpncpy.m4 2006-11-27 09:14:55.000000000 -0800
303+++ gettext.patched/gettext-tools/gnulib-m4/stpncpy.m4 2011-03-16 23:52:10.356641459 -0700
304@@ -7,7 +7,7 @@
305 AC_DEFUN([gl_FUNC_STPNCPY],
306 [
307 dnl Persuade glibc <string.h> to declare stpncpy().
308- AC_REQUIRE([AC_GNU_SOURCE])
309+ dnl AC_REQUIRE([AC_GNU_SOURCE])
310
311 dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
312 dnl declared in <string.h>. Its side effects are the same as those
313diff -ru gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4
314--- gettext-0.16.1/gettext-tools/gnulib-m4/wcwidth.m4 2006-11-27 09:14:55.000000000 -0800
315+++ gettext.patched/gettext-tools/gnulib-m4/wcwidth.m4 2011-03-16 23:51:08.260324221 -0700
316@@ -7,7 +7,7 @@
317 AC_DEFUN([gl_FUNC_WCWIDTH],
318 [
319 dnl Persuade glibc <wchar.h> to declare wcwidth().
320- AC_REQUIRE([AC_GNU_SOURCE])
321+ dnl AC_REQUIRE([AC_GNU_SOURCE])
322
323 AC_REQUIRE([AC_C_INLINE])
324 AC_REQUIRE([gt_TYPE_WCHAR_T])
325diff -ru gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4
326--- gettext-0.16.1/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2006-11-27 09:33:45.000000000 -0800
327+++ gettext.patched/gettext-tools/libgettextpo/gnulib-m4/gnulib-comp.m4 2011-03-16 23:51:02.036061317 -0700
328@@ -25,7 +25,7 @@
329 m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
330 m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
331 AC_REQUIRE([AC_PROG_RANLIB])
332- AC_REQUIRE([AC_GNU_SOURCE])
333+ dnl AC_REQUIRE([AC_GNU_SOURCE])
334 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
335 AC_REQUIRE([gl_LOCK_EARLY])
336 ])
337diff -ru gettext-0.16.1/gettext-tools/m4/regex.m4 gettext.patched/gettext-tools/m4/regex.m4
338--- gettext-0.16.1/gettext-tools/m4/regex.m4 2006-11-27 09:02:05.000000000 -0800
339+++ gettext.patched/gettext-tools/m4/regex.m4 2011-03-16 23:50:53.533477195 -0700
340@@ -116,7 +116,7 @@
341 dnl to get them.
342
343 dnl Persuade glibc <string.h> to declare mempcpy().
344- AC_REQUIRE([AC_GNU_SOURCE])
345+ dnl AC_REQUIRE([AC_GNU_SOURCE])
346
347 AC_REQUIRE([AC_C_RESTRICT])
348 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
new file mode 100644
index 0000000000..072fe5ff6c
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/gettext-autoconf-lib-link-no-L.patch
@@ -0,0 +1,19 @@
1
2# Pulled from OpenEmbedded
3#
4# Commented by: Saul Wold <saul.wold@intel.com>
5
6Upstream-Status: Inappropriate [licensing]
7
8--- gettext-0.17/autoconf-lib-link/m4/lib-link.m4~ 2009-04-17 15:12:30.000000000 -0700
9+++ gettext-0.17/autoconf-lib-link/m4/lib-link.m4 2009-04-17 15:37:39.000000000 -0700
10@@ -267,6 +267,9 @@
11 fi
12 fi
13 fi
14+ dnl Just let the compiler find the library, the compiler and user are smarter then this script
15+ dnl when cross compiling and working with a relocated install.
16+ found_dir=""
17 if test "X$found_dir" = "X"; then
18 for x in $LDFLAGS $LTLIB[]NAME; do
19 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
diff --git a/meta/recipes-core/gettext/gettext-0.16.1/gettext-error_print_progname.patch b/meta/recipes-core/gettext/gettext-0.16.1/gettext-error_print_progname.patch
new file mode 100644
index 0000000000..93d91942f0
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/gettext-error_print_progname.patch
@@ -0,0 +1,19 @@
1
2# Pulled from OpenEmbedded
3#
4# Commented by: Saul Wold <saul.wold@intel.com>
5
6Upstream-Status: Inappropriate [licensing]
7
8diff -ur gettext-0.14.6/gettext-tools/lib/error.h gettext-0.14.6-patched/gettext-tools/lib/error.h
9--- gettext-0.14.6/gettext-tools/lib/error.h 2005-05-20 16:03:42.000000000 -0500
10+++ gettext-0.14.6-patched/gettext-tools/lib/error.h 2007-01-13 20:57:24.422168053 -0600
11@@ -50,7 +50,7 @@
12 /* If NULL, error will flush stdout, then print on stderr the program
13 name, a colon and a space. Otherwise, error will call this
14 function without parameters instead. */
15-extern DLL_VARIABLE void (*error_print_progname) (void);
16+void (*error_print_progname) (void);
17
18 /* This variable is incremented each time `error' is called. */
19 extern DLL_VARIABLE unsigned int error_message_count;
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
new file mode 100644
index 0000000000..f09e450efe
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/gettext-vpath.patch
@@ -0,0 +1,20 @@
1
2# Pulled from OpenEmbedded
3#
4# Commented by: Saul Wold <saul.wold@intel.com>
5
6Upstream-Status: Inappropriate [licensing]
7
8Index: gettext-0.16.1/gettext-runtime/intl/Makefile.in
9===================================================================
10--- gettext-0.16.1.orig/gettext-runtime/intl/Makefile.in 2006-11-27 09:02:00.000000000 -0800
11+++ gettext-0.16.1/gettext-runtime/intl/Makefile.in 2011-03-16 16:04:49.175419930 -0700
12@@ -35,7 +35,7 @@
13 # 'make' does the wrong thing if GNU gettext was configured with
14 # "./configure --srcdir=`pwd`", namely it gets confused by the .lo and .la
15 # files it finds in srcdir = ../../gettext-runtime/intl.
16-VPATH = $(srcdir)
17+#VPATH = $(srcdir)
18
19 prefix = @prefix@
20 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
new file mode 100644
index 0000000000..4da8dd4536
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/hardcode_macro_version.patch
@@ -0,0 +1,51 @@
1
2This patch hardcodes in version 0.17 for the GETTEXT_MACRO_VERSION,
3the version check is only part of 0.17 and will not affect any 0.16.1
4operations
5
6Upstream-Status: Inappropriate [licensing]
7
8Signed-off-by: Saul Wold <sgw@linux.intel.com>
9
10Index: gettext-0.16.1/gettext-runtime/m4/po.m4
11===================================================================
12--- gettext-0.16.1.orig/gettext-runtime/m4/po.m4 2011-03-17 02:24:28.953520231 -0700
13+++ gettext-0.16.1/gettext-runtime/m4/po.m4 2011-03-17 02:28:25.455396862 -0700
14@@ -27,6 +27,9 @@
15 AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
16 AC_REQUIRE([AM_NLS])dnl
17
18+ dnl Hardcode the MACRO_VERSION to 0.17 for gnutls
19+ AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
20+
21 dnl Perform the following tests also if --disable-nls has been given,
22 dnl because they are needed for "make dist" to work.
23
24Index: gettext-0.16.1/gettext-runtime/po/Makefile.in.in
25===================================================================
26--- gettext-0.16.1.orig/gettext-runtime/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
27+++ gettext-0.16.1/gettext-runtime/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
28@@ -10,6 +10,9 @@
29 #
30 # Origin: gettext-0.16
31
32+# Hardcode this value for gnutls building against gplv2 code
33+GETTEXT_MACRO_VERSION = 0.17
34+
35 PACKAGE = @PACKAGE@
36 VERSION = @VERSION@
37 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
38Index: gettext-0.16.1/gettext-tools/po/Makefile.in.in
39===================================================================
40--- gettext-0.16.1.orig/gettext-tools/po/Makefile.in.in 2011-03-17 02:24:28.953520231 -0700
41+++ gettext-0.16.1/gettext-tools/po/Makefile.in.in 2011-03-17 02:28:07.574395144 -0700
42@@ -10,6 +10,9 @@
43 #
44 # Origin: gettext-0.16
45
46+# Hardcode this value for gnutls building against gplv2 code
47+GETTEXT_MACRO_VERSION = 0.17
48+
49 PACKAGE = @PACKAGE@
50 VERSION = @VERSION@
51 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
new file mode 100644
index 0000000000..d921069711
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.16.1/linklib_from_0.17.patch
@@ -0,0 +1,720 @@
1
2# Pulled from OpenEmbedded
3#
4# Commented by: Saul Wold <saul.wold@intel.com>
5
6Upstream-Status: Inappropriate [licensing]
7
8Index: gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4
9===================================================================
10--- gettext-0.16.1.orig/autoconf-lib-link/m4/lib-link.m4 2006-11-27 09:01:58.000000000 -0800
11+++ gettext-0.16.1/autoconf-lib-link/m4/lib-link.m4 2011-03-17 00:36:08.710836720 -0700
12@@ -6,12 +6,14 @@
13
14 dnl From Bruno Haible.
15
16-AC_PREREQ(2.50)
17+AC_PREREQ(2.54)
18
19 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
20 dnl the libraries corresponding to explicit and implicit dependencies.
21 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
22 dnl augments the CPPFLAGS variable.
23+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
24+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
25 AC_DEFUN([AC_LIB_LINKFLAGS],
26 [
27 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
28@@ -24,13 +26,16 @@
29 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
30 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
31 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
32+ ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
33 ])
34 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
35 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
36 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
37+ LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
38 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
39 AC_SUBST([LIB]NAME)
40 AC_SUBST([LTLIB]NAME)
41+ AC_SUBST([LIB]NAME[_PREFIX])
42 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
43 dnl results of this search when this library appears as a dependency.
44 HAVE_LIB[]NAME=yes
45@@ -46,6 +51,8 @@
46 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
47 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
48 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
49+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
50+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
51 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
52 [
53 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
54@@ -82,17 +89,24 @@
55 CPPFLAGS="$ac_save_CPPFLAGS"
56 LIB[]NAME=
57 LTLIB[]NAME=
58+ LIB[]NAME[]_PREFIX=
59+
60 fi
61 AC_SUBST([HAVE_LIB]NAME)
62 AC_SUBST([LIB]NAME)
63 AC_SUBST([LTLIB]NAME)
64+ AC_SUBST([LIB]NAME[_PREFIX])
65 undefine([Name])
66 undefine([NAME])
67 ])
68
69 dnl Determine the platform dependent parameters needed to use rpath:
70-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
71-dnl hardcode_direct, hardcode_minus_L.
72+dnl acl_libext,
73+dnl acl_shlibext,
74+dnl acl_hardcode_libdir_flag_spec,
75+dnl acl_hardcode_libdir_separator,
76+dnl acl_hardcode_direct,
77+dnl acl_hardcode_minus_L.
78 AC_DEFUN([AC_LIB_RPATH],
79 [
80 dnl Tell automake >= 1.10 to complain if config.rpath is missing.
81@@ -109,12 +123,14 @@
82 acl_cv_rpath=done
83 ])
84 wl="$acl_cv_wl"
85- libext="$acl_cv_libext"
86- shlibext="$acl_cv_shlibext"
87- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
88- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
89- hardcode_direct="$acl_cv_hardcode_direct"
90- hardcode_minus_L="$acl_cv_hardcode_minus_L"
91+ acl_libext="$acl_cv_libext"
92+ acl_shlibext="$acl_cv_shlibext"
93+ acl_libname_spec="$acl_cv_libname_spec"
94+ acl_library_names_spec="$acl_cv_library_names_spec"
95+ acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
96+ acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
97+ acl_hardcode_direct="$acl_cv_hardcode_direct"
98+ acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
99 dnl Determine whether the user wants rpath handling at all.
100 AC_ARG_ENABLE(rpath,
101 [ --disable-rpath do not hardcode runtime library paths],
102@@ -124,20 +140,24 @@
103 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
104 dnl the libraries corresponding to explicit and implicit dependencies.
105 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
106+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
107+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
108 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
109 [
110 AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
111 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
112 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
113+ dnl Autoconf >= 2.61 supports dots in --with options.
114+ define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
115 dnl By default, look in $includedir and $libdir.
116 use_additional=yes
117 AC_LIB_WITH_FINAL_PREFIX([
118 eval additional_includedir=\"$includedir\"
119 eval additional_libdir=\"$libdir\"
120 ])
121- AC_LIB_ARG_WITH([lib$1-prefix],
122-[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
123- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
124+ AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
125+[ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
126+ --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir],
127 [
128 if test "X$withval" = "Xno"; then
129 use_additional=no
130@@ -158,6 +178,7 @@
131 LIB[]NAME=
132 LTLIB[]NAME=
133 INC[]NAME=
134+ LIB[]NAME[]_PREFIX=
135 rpathdirs=
136 ltrpathdirs=
137 names_already_handled=
138@@ -197,27 +218,53 @@
139 found_la=
140 found_so=
141 found_a=
142+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
143+ if test -n "$acl_shlibext"; then
144+ shrext=".$acl_shlibext" # typically: shrext=.so
145+ else
146+ shrext=
147+ fi
148 if test $use_additional = yes; then
149- if test -n "$shlibext" \
150- && { test -f "$additional_libdir/lib$name.$shlibext" \
151- || { test "$shlibext" = dll \
152- && test -f "$additional_libdir/lib$name.dll.a"; }; }; then
153- found_dir="$additional_libdir"
154- if test -f "$additional_libdir/lib$name.$shlibext"; then
155- found_so="$additional_libdir/lib$name.$shlibext"
156+ dir="$additional_libdir"
157+ dnl The same code as in the loop below:
158+ dnl First look for a shared library.
159+ if test -n "$acl_shlibext"; then
160+ if test -f "$dir/$libname$shrext"; then
161+ found_dir="$dir"
162+ found_so="$dir/$libname$shrext"
163 else
164- found_so="$additional_libdir/lib$name.dll.a"
165+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
166+ ver=`(cd "$dir" && \
167+ for f in "$libname$shrext".*; do echo "$f"; done \
168+ | sed -e "s,^$libname$shrext\\\\.,," \
169+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
170+ | sed 1q ) 2>/dev/null`
171+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
172+ found_dir="$dir"
173+ found_so="$dir/$libname$shrext.$ver"
174+ fi
175+ else
176+ eval library_names=\"$acl_library_names_spec\"
177+ for f in $library_names; do
178+ if test -f "$dir/$f"; then
179+ found_dir="$dir"
180+ found_so="$dir/$f"
181+ break
182+ fi
183+ done
184+ fi
185 fi
186- if test -f "$additional_libdir/lib$name.la"; then
187- found_la="$additional_libdir/lib$name.la"
188+ fi
189+ dnl Then look for a static library.
190+ if test "X$found_dir" = "X"; then
191+ if test -f "$dir/$libname.$acl_libext"; then
192+ found_dir="$dir"
193+ found_a="$dir/$libname.$acl_libext"
194 fi
195- else
196- if test -f "$additional_libdir/lib$name.$libext"; then
197- found_dir="$additional_libdir"
198- found_a="$additional_libdir/lib$name.$libext"
199- if test -f "$additional_libdir/lib$name.la"; then
200- found_la="$additional_libdir/lib$name.la"
201- fi
202+ fi
203+ if test "X$found_dir" != "X"; then
204+ if test -f "$dir/$libname.la"; then
205+ found_la="$dir/$libname.la"
206 fi
207 fi
208 fi
209@@ -227,26 +274,44 @@
210 case "$x" in
211 -L*)
212 dir=`echo "X$x" | sed -e 's/^X-L//'`
213- if test -n "$shlibext" \
214- && { test -f "$dir/lib$name.$shlibext" \
215- || { test "$shlibext" = dll \
216- && test -f "$dir/lib$name.dll.a"; }; }; then
217- found_dir="$dir"
218- if test -f "$dir/lib$name.$shlibext"; then
219- found_so="$dir/lib$name.$shlibext"
220+ dnl First look for a shared library.
221+ if test -n "$acl_shlibext"; then
222+ if test -f "$dir/$libname$shrext"; then
223+ found_dir="$dir"
224+ found_so="$dir/$libname$shrext"
225 else
226- found_so="$dir/lib$name.dll.a"
227- fi
228- if test -f "$dir/lib$name.la"; then
229- found_la="$dir/lib$name.la"
230+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
231+ ver=`(cd "$dir" && \
232+ for f in "$libname$shrext".*; do echo "$f"; done \
233+ | sed -e "s,^$libname$shrext\\\\.,," \
234+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
235+ | sed 1q ) 2>/dev/null`
236+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
237+ found_dir="$dir"
238+ found_so="$dir/$libname$shrext.$ver"
239+ fi
240+ else
241+ eval library_names=\"$acl_library_names_spec\"
242+ for f in $library_names; do
243+ if test -f "$dir/$f"; then
244+ found_dir="$dir"
245+ found_so="$dir/$f"
246+ break
247+ fi
248+ done
249+ fi
250 fi
251- else
252- if test -f "$dir/lib$name.$libext"; then
253+ fi
254+ dnl Then look for a static library.
255+ if test "X$found_dir" = "X"; then
256+ if test -f "$dir/$libname.$acl_libext"; then
257 found_dir="$dir"
258- found_a="$dir/lib$name.$libext"
259- if test -f "$dir/lib$name.la"; then
260- found_la="$dir/lib$name.la"
261- fi
262+ found_a="$dir/$libname.$acl_libext"
263+ fi
264+ fi
265+ if test "X$found_dir" != "X"; then
266+ if test -f "$dir/$libname.la"; then
267+ found_la="$dir/$libname.la"
268 fi
269 fi
270 ;;
271@@ -282,12 +347,12 @@
272 ltrpathdirs="$ltrpathdirs $found_dir"
273 fi
274 dnl The hardcoding into $LIBNAME is system dependent.
275- if test "$hardcode_direct" = yes; then
276+ if test "$acl_hardcode_direct" = yes; then
277 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
278 dnl resulting binary.
279 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
280 else
281- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
282+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
283 dnl Use an explicit option to hardcode DIR into the resulting
284 dnl binary.
285 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
286@@ -318,13 +383,13 @@
287 if test -z "$haveit"; then
288 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
289 fi
290- if test "$hardcode_minus_L" != no; then
291+ if test "$acl_hardcode_minus_L" != no; then
292 dnl FIXME: Not sure whether we should use
293 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
294 dnl here.
295 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
296 else
297- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
298+ dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
299 dnl here, because this doesn't fit in flags passed to the
300 dnl compiler. So give up. No hardcoding. This affects only
301 dnl very old systems.
302@@ -512,18 +577,18 @@
303 done
304 done
305 if test "X$rpathdirs" != "X"; then
306- if test -n "$hardcode_libdir_separator"; then
307+ if test -n "$acl_hardcode_libdir_separator"; then
308 dnl Weird platform: only the last -rpath option counts, the user must
309 dnl pass all path elements in one option. We can arrange that for a
310 dnl single library, but not when more than one $LIBNAMEs are used.
311 alldirs=
312 for found_dir in $rpathdirs; do
313- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
314+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
315 done
316- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
317+ dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
318 acl_save_libdir="$libdir"
319 libdir="$alldirs"
320- eval flag=\"$hardcode_libdir_flag_spec\"
321+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
322 libdir="$acl_save_libdir"
323 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
324 else
325@@ -531,7 +596,7 @@
326 for found_dir in $rpathdirs; do
327 acl_save_libdir="$libdir"
328 libdir="$found_dir"
329- eval flag=\"$hardcode_libdir_flag_spec\"
330+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
331 libdir="$acl_save_libdir"
332 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
333 done
334@@ -642,3 +707,79 @@
335 fi
336 AC_SUBST([$1])
337 ])
338+
339+dnl For those cases where a variable contains several -L and -l options
340+dnl referring to unknown libraries and directories, this macro determines the
341+dnl necessary additional linker options for the runtime path.
342+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
343+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
344+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
345+dnl otherwise linking without libtool is assumed.
346+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
347+[
348+ AC_REQUIRE([AC_LIB_RPATH])
349+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
350+ $1=
351+ if test "$enable_rpath" != no; then
352+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
353+ dnl Use an explicit option to hardcode directories into the resulting
354+ dnl binary.
355+ rpathdirs=
356+ next=
357+ for opt in $2; do
358+ if test -n "$next"; then
359+ dir="$next"
360+ dnl No need to hardcode the standard /usr/lib.
361+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
362+ rpathdirs="$rpathdirs $dir"
363+ fi
364+ next=
365+ else
366+ case $opt in
367+ -L) next=yes ;;
368+ -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
369+ dnl No need to hardcode the standard /usr/lib.
370+ if test "X$dir" != "X/usr/$acl_libdirstem"; then
371+ rpathdirs="$rpathdirs $dir"
372+ fi
373+ next= ;;
374+ *) next= ;;
375+ esac
376+ fi
377+ done
378+ if test "X$rpathdirs" != "X"; then
379+ if test -n ""$3""; then
380+ dnl libtool is used for linking. Use -R options.
381+ for dir in $rpathdirs; do
382+ $1="${$1}${$1:+ }-R$dir"
383+ done
384+ else
385+ dnl The linker is used for linking directly.
386+ if test -n "$acl_hardcode_libdir_separator"; then
387+ dnl Weird platform: only the last -rpath option counts, the user
388+ dnl must pass all path elements in one option.
389+ alldirs=
390+ for dir in $rpathdirs; do
391+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
392+ done
393+ acl_save_libdir="$libdir"
394+ libdir="$alldirs"
395+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
396+ libdir="$acl_save_libdir"
397+ $1="$flag"
398+ else
399+ dnl The -rpath options are cumulative.
400+ for dir in $rpathdirs; do
401+ acl_save_libdir="$libdir"
402+ libdir="$dir"
403+ eval flag=\"$acl_hardcode_libdir_flag_spec\"
404+ libdir="$acl_save_libdir"
405+ $1="${$1}${$1:+ }$flag"
406+ done
407+ fi
408+ fi
409+ fi
410+ fi
411+ fi
412+ AC_SUBST([$1])
413+])
414Index: gettext-0.16.1/autoconf-lib-link/config.rpath
415===================================================================
416--- gettext-0.16.1.orig/autoconf-lib-link/config.rpath 2006-11-27 09:01:58.000000000 -0800
417+++ gettext-0.16.1/autoconf-lib-link/config.rpath 2011-03-17 00:33:23.336539490 -0700
418@@ -2,7 +2,7 @@
419 # Output a system dependent set of variables, describing how to set the
420 # run time search path of shared libraries in an executable.
421 #
422-# Copyright 1996-2006 Free Software Foundation, Inc.
423+# Copyright 1996-2007 Free Software Foundation, Inc.
424 # Taken from GNU libtool, 2001
425 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
426 #
427@@ -47,6 +47,18 @@
428 done
429 cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
430
431+# Code taken from libtool.m4's _LT_CC_BASENAME.
432+
433+for cc_temp in $CC""; do
434+ case $cc_temp in
435+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
436+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
437+ \-*) ;;
438+ *) break;;
439+ esac
440+done
441+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
442+
443 # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
444
445 wl=
446@@ -64,7 +76,14 @@
447 ;;
448 esac
449 ;;
450- mingw* | pw32* | os2*)
451+ darwin*)
452+ case $cc_basename in
453+ xlc*)
454+ wl='-Wl,'
455+ ;;
456+ esac
457+ ;;
458+ mingw* | cygwin* | pw32* | os2*)
459 ;;
460 hpux9* | hpux10* | hpux11*)
461 wl='-Wl,'
462@@ -74,7 +93,7 @@
463 ;;
464 newsos6)
465 ;;
466- linux*)
467+ linux* | k*bsd*-gnu)
468 case $cc_basename in
469 icc* | ecc*)
470 wl='-Wl,'
471@@ -100,7 +119,7 @@
472 osf3* | osf4* | osf5*)
473 wl='-Wl,'
474 ;;
475- sco3.2v5*)
476+ rdos*)
477 ;;
478 solaris*)
479 wl='-Wl,'
480@@ -108,11 +127,14 @@
481 sunos4*)
482 wl='-Qoption ld '
483 ;;
484- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
485+ sysv4 | sysv4.2uw2* | sysv4.3*)
486 wl='-Wl,'
487 ;;
488 sysv4*MP*)
489 ;;
490+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
491+ wl='-Wl,'
492+ ;;
493 unicos*)
494 wl='-Wl,'
495 ;;
496@@ -141,6 +163,10 @@
497 # we just hope/assume this is gcc and not c89 (= MSVC++)
498 with_gnu_ld=yes
499 ;;
500+ interix*)
501+ # we just hope/assume this is gcc and not c89 (= MSVC++)
502+ with_gnu_ld=yes
503+ ;;
504 openbsd*)
505 with_gnu_ld=no
506 ;;
507@@ -189,11 +215,11 @@
508 ld_shlibs=no
509 fi
510 ;;
511- interix3*)
512+ interix[3-9]*)
513 hardcode_direct=no
514 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
515 ;;
516- linux*)
517+ gnu* | linux* | k*bsd*-gnu)
518 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
519 :
520 else
521@@ -280,7 +306,7 @@
522 strings "$collect2name" | grep resolve_lib_name >/dev/null
523 then
524 # We have reworked collect2
525- hardcode_direct=yes
526+ :
527 else
528 # We have old collect2
529 hardcode_direct=unsupported
530@@ -359,7 +385,7 @@
531 hardcode_direct=yes
532 hardcode_minus_L=yes
533 ;;
534- freebsd* | kfreebsd*-gnu | dragonfly*)
535+ freebsd* | dragonfly*)
536 hardcode_libdir_flag_spec='-R$libdir'
537 hardcode_direct=yes
538 ;;
539@@ -412,18 +438,22 @@
540 hardcode_libdir_separator=:
541 ;;
542 openbsd*)
543- hardcode_direct=yes
544- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
545- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
546+ if test -f /usr/libexec/ld.so; then
547+ hardcode_direct=yes
548+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
549+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
550+ else
551+ case "$host_os" in
552+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
553+ hardcode_libdir_flag_spec='-R$libdir'
554+ ;;
555+ *)
556+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
557+ ;;
558+ esac
559+ fi
560 else
561- case "$host_os" in
562- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
563- hardcode_libdir_flag_spec='-R$libdir'
564- ;;
565- *)
566- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
567- ;;
568- esac
569+ ld_shlibs=no
570 fi
571 ;;
572 os2*)
573@@ -471,7 +501,7 @@
574 ld_shlibs=yes
575 fi
576 ;;
577- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
578+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* |sco3.2v5.0.[024]*)
579 ;;
580 sysv5* | sco3.2v5* | sco5v6*)
581 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
582@@ -488,33 +518,51 @@
583
584 # Check dynamic linker characteristics
585 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
586+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
587+# only about the one the linker finds when passed -lNAME. This is the last
588+# element of library_names_spec in libtool.m4, or possibly two of them if the
589+# linker has special search rules.
590+library_names_spec= # the last element of library_names_spec in libtool.m4
591 libname_spec='lib$name'
592 case "$host_os" in
593 aix3*)
594+ library_names_spec='$libname.a'
595 ;;
596 aix4* | aix5*)
597+ library_names_spec='$libname$shrext'
598 ;;
599 amigaos*)
600+ library_names_spec='$libname.a'
601 ;;
602 beos*)
603+ library_names_spec='$libname$shrext'
604 ;;
605 bsdi[45]*)
606+ library_names_spec='$libname$shrext'
607 ;;
608 cygwin* | mingw* | pw32*)
609 shrext=.dll
610+ library_names_spec='$libname.dll.a $libname.lib'
611 ;;
612 darwin* | rhapsody*)
613 shrext=.dylib
614+ library_names_spec='$libname$shrext'
615 ;;
616 dgux*)
617+ library_names_spec='$libname$shrext'
618 ;;
619 freebsd1*)
620 ;;
621- kfreebsd*-gnu)
622- ;;
623 freebsd* | dragonfly*)
624+ case "$host_os" in
625+ freebsd[123]*)
626+ library_names_spec='$libname$shrext$versuffix' ;;
627+ *)
628+ library_names_spec='$libname$shrext' ;;
629+ esac
630 ;;
631 gnu*)
632+ library_names_spec='$libname$shrext'
633 ;;
634 hpux9* | hpux10* | hpux11*)
635 case $host_cpu in
636@@ -528,10 +576,13 @@
637 shrext=.sl
638 ;;
639 esac
640+ library_names_spec='$libname$shrext'
641 ;;
642- interix3*)
643+ interix[3-9]*)
644+ library_names_spec='$libname$shrext'
645 ;;
646 irix5* | irix6* | nonstopux*)
647+ library_names_spec='$libname$shrext'
648 case "$host_os" in
649 irix5* | nonstopux*)
650 libsuff= shlibsuff=
651@@ -548,33 +599,46 @@
652 ;;
653 linux*oldld* | linux*aout* | linux*coff*)
654 ;;
655- linux*)
656+ linux* | k*bsd*-gnu)
657+ library_names_spec='$libname$shrext'
658 ;;
659 knetbsd*-gnu)
660+ library_names_spec='$libname$shrext'
661 ;;
662 netbsd*)
663+ library_names_spec='$libname$shrext'
664 ;;
665 newsos6)
666+ library_names_spec='$libname$shrext'
667 ;;
668 nto-qnx*)
669+ library_names_spec='$libname$shrext'
670 ;;
671 openbsd*)
672+ library_names_spec='$libname$shrext$versuffix'
673 ;;
674 os2*)
675 libname_spec='$name'
676 shrext=.dll
677+ library_names_spec='$libname.a'
678 ;;
679 osf3* | osf4* | osf5*)
680+ library_names_spec='$libname$shrext'
681 ;;
682 solaris*)
683+ library_names_spec='$libname$shrext'
684 ;;
685 sunos4*)
686+ library_names_spec='$libname$shrext$versuffix'
687 ;;
688 sysv4 | sysv4.3*)
689+ library_names_spec='$libname$shrext'
690 ;;
691 sysv4*MP*)
692+ library_names_spec='$libname$shrext'
693 ;;
694 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
695+ library_names_spec='$libname$shrext'
696 ;;
697 uts4*)
698 ;;
699@@ -583,6 +647,8 @@
700 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
701 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
702 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
703+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
704+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
705 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
706
707 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
708@@ -596,6 +662,12 @@
709 # Shared library suffix (normally "so").
710 shlibext="$shlibext"
711
712+# Format of library name prefix.
713+libname_spec="$escaped_libname_spec"
714+
715+# Library names that the linker finds when passed -lNAME.
716+library_names_spec="$escaped_library_names_spec"
717+
718 # Flag to hardcode \$libdir into a binary during linking.
719 # This must work even if \$libdir does not exist.
720 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
diff --git a/meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch b/meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch
new file mode 100644
index 0000000000..f2c567d188
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-0.18.3.2/parallel.patch
@@ -0,0 +1,36 @@
1instal libgettextlib.a before removing it
2
3In a multiple job build, Makefile can simultaneously
4be installing and removing libgettextlib.a. We serialize
5the operations.
6
7Upstream-Status: Pending
8
9Signed-off-by: Joe Slater <jslater@windriver.com>
10
11--- a/gettext-tools/gnulib-lib/Makefile.am
12+++ b/gettext-tools/gnulib-lib/Makefile.am
13@@ -57,6 +57,10 @@ endif
14 # Rules generated and collected by gnulib-tool.
15 include Makefile.gnulib
16
17+# defined in Makefile.gnulib but missing this dependency
18+#
19+install-exec-clean: install-libLTLIBRARIES
20+
21 # Which classes to export from the shared library.
22 MOOPPFLAGS += --dllexport=styled_ostream
23
24--- a/gettext-tools/src/Makefile.am
25+++ b/gettext-tools/src/Makefile.am
26@@ -229,8 +229,8 @@ libgettextsrc_la_LDFLAGS += -Wl,--export
27 endif
28
29 # No need to install libgettextsrc.a, except on AIX.
30-install-exec-local: install-libLTLIBRARIES install-exec-clean
31-install-exec-clean:
32+install-exec-local: install-exec-clean
33+install-exec-clean: install-libLTLIBRARIES
34 case "@host_os@" in \
35 aix*) ;; \
36 *) $(RM) $(DESTDIR)$(libdir)/libgettextsrc.a ;; \
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING
new file mode 100644
index 0000000000..3485c5a2cb
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/COPYING
@@ -0,0 +1,4 @@
1dnl Copyright (C) 1997-2010 Free Software Foundation, Inc.
2dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved.
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in
new file mode 100644
index 0000000000..fabdc76c9c
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makefile.in.in
@@ -0,0 +1,454 @@
1# Makefile for PO directory in any package using GNU gettext.
2# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3#
4# This file can be copied and used freely without restrictions. It can
5# be used in projects which are not available under the GNU General Public
6# License but which still want to provide support for the GNU gettext
7# functionality.
8# Please note that the actual code of GNU gettext is covered by the GNU
9# General Public License and is *not* in the public domain.
10#
11# Origin: gettext-0.18.3
12GETTEXT_MACRO_VERSION = 0.18
13
14PACKAGE = @PACKAGE@
15VERSION = @VERSION@
16PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
17
18SED = @SED@
19SHELL = /bin/sh
20@SET_MAKE@
21
22srcdir = @srcdir@
23top_srcdir = @top_srcdir@
24VPATH = @srcdir@
25
26prefix = @prefix@
27exec_prefix = @exec_prefix@
28datarootdir = @datarootdir@
29datadir = @datadir@
30localedir = @localedir@
31gettextsrcdir = $(datadir)/gettext/po
32
33INSTALL = @INSTALL@
34INSTALL_DATA = @INSTALL_DATA@
35
36# We use $(mkdir_p).
37# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
38# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
39# @install_sh@ does not start with $(SHELL), so we add it.
40# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
41# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
42# versions, $(mkinstalldirs) and $(install_sh) are unused.
43mkinstalldirs = $(SHELL) @install_sh@ -d
44install_sh = $(SHELL) @install_sh@
45MKDIR_P = @MKDIR_P@
46mkdir_p = @mkdir_p@
47
48GMSGFMT_ = @GMSGFMT@
49GMSGFMT_no = @GMSGFMT@
50GMSGFMT_yes = @GMSGFMT_015@
51GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
52MSGFMT_ = @MSGFMT@
53MSGFMT_no = @MSGFMT@
54MSGFMT_yes = @MSGFMT_015@
55MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
56XGETTEXT_ = @XGETTEXT@
57XGETTEXT_no = @XGETTEXT@
58XGETTEXT_yes = @XGETTEXT_015@
59XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
60MSGMERGE = msgmerge
61MSGMERGE_UPDATE = @MSGMERGE@ --update
62MSGINIT = msginit
63MSGCONV = msgconv
64MSGFILTER = msgfilter
65
66POFILES = @POFILES@
67GMOFILES = @GMOFILES@
68UPDATEPOFILES = @UPDATEPOFILES@
69DUMMYPOFILES = @DUMMYPOFILES@
70DISTFILES.common = Makefile.in.in remove-potcdate.sin \
71$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
72DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
73$(POFILES) $(GMOFILES) \
74$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
75
76POTFILES = \
77
78CATALOGS = @CATALOGS@
79
80# Makevars gets inserted here. (Don't remove this line!)
81
82.SUFFIXES:
83.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
84
85.po.mo:
86 @echo "$(MSGFMT) -c -o $@ $<"; \
87 $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
88
89.po.gmo:
90 @lang=`echo $* | sed -e 's,.*/,,'`; \
91 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
92 echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
93 cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
94
95.sin.sed:
96 sed -e '/^#/d' $< > t-$@
97 mv t-$@ $@
98
99
100all: all-@USE_NLS@
101
102all-yes: stamp-po
103all-no:
104
105# Ensure that the gettext macros and this Makefile.in.in are in sync.
106CHECK_MACRO_VERSION = \
107 test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
108 || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
109 exit 1; \
110 }
111
112# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
113# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
114# we don't want to bother translators with empty POT files). We assume that
115# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
116# In this case, stamp-po is a nop (i.e. a phony target).
117
118# stamp-po is a timestamp denoting the last time at which the CATALOGS have
119# been loosely updated. Its purpose is that when a developer or translator
120# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
121# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
122# invocations of "make" will do nothing. This timestamp would not be necessary
123# if updating the $(CATALOGS) would always touch them; however, the rule for
124# $(POFILES) has been designed to not touch files that don't need to be
125# changed.
126stamp-po: $(srcdir)/$(DOMAIN).pot
127 @$(CHECK_MACRO_VERSION)
128 test ! -f $(srcdir)/$(DOMAIN).pot || \
129 test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
130 @test ! -f $(srcdir)/$(DOMAIN).pot || { \
131 echo "touch stamp-po" && \
132 echo timestamp > stamp-poT && \
133 mv stamp-poT stamp-po; \
134 }
135
136# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
137# otherwise packages like GCC can not be built if only parts of the source
138# have been downloaded.
139
140# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
141# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
142# The determination of whether the package xyz is a GNU one is based on the
143# heuristic whether some file in the top level directory mentions "GNU xyz".
144# If GNU 'find' is available, we avoid grepping through monster files.
145$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
146 if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
147 LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
148 else \
149 LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
150 fi; \
151 } | grep -v 'libtool:' >/dev/null; then \
152 package_gnu='GNU '; \
153 else \
154 package_gnu=''; \
155 fi; \
156 if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
157 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
158 else \
159 msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
160 fi; \
161 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
162 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
163 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
164 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
165 --files-from=$(srcdir)/POTFILES.in \
166 --copyright-holder='$(COPYRIGHT_HOLDER)' \
167 --msgid-bugs-address="$$msgid_bugs_address" \
168 ;; \
169 *) \
170 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
171 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
172 --files-from=$(srcdir)/POTFILES.in \
173 --copyright-holder='$(COPYRIGHT_HOLDER)' \
174 --package-name="$${package_gnu}@PACKAGE@" \
175 --package-version='@VERSION@' \
176 --msgid-bugs-address="$$msgid_bugs_address" \
177 ;; \
178 esac
179 test ! -f $(DOMAIN).po || { \
180 if test -f $(srcdir)/$(DOMAIN).pot; then \
181 sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
182 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
183 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
184 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
185 else \
186 rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
187 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
188 fi; \
189 else \
190 mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
191 fi; \
192 }
193
194# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
195# every "make" invocation, only create it when it is missing.
196# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
197$(srcdir)/$(DOMAIN).pot:
198 $(MAKE) $(DOMAIN).pot-update
199
200# This target rebuilds a PO file if $(DOMAIN).pot has changed.
201# Note that a PO file is not touched if it doesn't need to be changed.
202$(POFILES): $(srcdir)/$(DOMAIN).pot
203 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
204 if test -f "$(srcdir)/$${lang}.po"; then \
205 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
206 echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
207 cd $(srcdir) \
208 && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
209 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
210 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
211 *) \
212 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
213 esac; \
214 }; \
215 else \
216 $(MAKE) $${lang}.po-create; \
217 fi
218
219
220install: install-exec install-data
221install-exec:
222install-data: install-data-@USE_NLS@
223 if test "$(PACKAGE)" = "gettext-tools"; then \
224 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
225 for file in $(DISTFILES.common) Makevars.template; do \
226 $(INSTALL_DATA) $(srcdir)/$$file \
227 $(DESTDIR)$(gettextsrcdir)/$$file; \
228 done; \
229 for file in Makevars; do \
230 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
231 done; \
232 else \
233 : ; \
234 fi
235install-data-no: all
236install-data-yes: all
237 @catalogs='$(CATALOGS)'; \
238 for cat in $$catalogs; do \
239 cat=`basename $$cat`; \
240 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
241 dir=$(localedir)/$$lang/LC_MESSAGES; \
242 $(mkdir_p) $(DESTDIR)$$dir; \
243 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
244 $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
245 echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
246 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
247 if test -n "$$lc"; then \
248 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
249 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
250 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
251 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
252 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
253 for file in *; do \
254 if test -f $$file; then \
255 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
256 fi; \
257 done); \
258 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
259 else \
260 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
261 :; \
262 else \
263 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
264 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
265 fi; \
266 fi; \
267 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
268 ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
269 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
270 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
271 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
272 fi; \
273 done; \
274 done
275
276install-strip: install
277
278installdirs: installdirs-exec installdirs-data
279installdirs-exec:
280installdirs-data: installdirs-data-@USE_NLS@
281 if test "$(PACKAGE)" = "gettext-tools"; then \
282 $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
283 else \
284 : ; \
285 fi
286installdirs-data-no:
287installdirs-data-yes:
288 @catalogs='$(CATALOGS)'; \
289 for cat in $$catalogs; do \
290 cat=`basename $$cat`; \
291 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
292 dir=$(localedir)/$$lang/LC_MESSAGES; \
293 $(mkdir_p) $(DESTDIR)$$dir; \
294 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
295 if test -n "$$lc"; then \
296 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
297 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
298 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
299 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
300 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
301 for file in *; do \
302 if test -f $$file; then \
303 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
304 fi; \
305 done); \
306 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
307 else \
308 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
309 :; \
310 else \
311 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
312 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
313 fi; \
314 fi; \
315 fi; \
316 done; \
317 done
318
319# Define this as empty until I found a useful application.
320installcheck:
321
322uninstall: uninstall-exec uninstall-data
323uninstall-exec:
324uninstall-data: uninstall-data-@USE_NLS@
325 if test "$(PACKAGE)" = "gettext-tools"; then \
326 for file in $(DISTFILES.common) Makevars.template; do \
327 rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
328 done; \
329 else \
330 : ; \
331 fi
332uninstall-data-no:
333uninstall-data-yes:
334 catalogs='$(CATALOGS)'; \
335 for cat in $$catalogs; do \
336 cat=`basename $$cat`; \
337 lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
338 for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
339 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
340 done; \
341 done
342
343check: all
344
345info dvi ps pdf html tags TAGS ctags CTAGS ID:
346
347mostlyclean:
348 rm -f remove-potcdate.sed
349 rm -f stamp-poT
350 rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
351 rm -fr *.o
352
353clean: mostlyclean
354
355distclean: clean
356 rm -f Makefile Makefile.in POTFILES *.mo
357
358maintainer-clean: distclean
359 @echo "This command is intended for maintainers to use;"
360 @echo "it deletes files that may require special tools to rebuild."
361 rm -f stamp-po $(GMOFILES)
362
363distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
364dist distdir:
365 $(MAKE) update-po
366 @$(MAKE) dist2
367# This is a separate target because 'update-po' must be executed before.
368dist2: stamp-po $(DISTFILES)
369 dists="$(DISTFILES)"; \
370 if test "$(PACKAGE)" = "gettext-tools"; then \
371 dists="$$dists Makevars.template"; \
372 fi; \
373 if test -f $(srcdir)/$(DOMAIN).pot; then \
374 dists="$$dists $(DOMAIN).pot stamp-po"; \
375 fi; \
376 if test -f $(srcdir)/ChangeLog; then \
377 dists="$$dists ChangeLog"; \
378 fi; \
379 for i in 0 1 2 3 4 5 6 7 8 9; do \
380 if test -f $(srcdir)/ChangeLog.$$i; then \
381 dists="$$dists ChangeLog.$$i"; \
382 fi; \
383 done; \
384 if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
385 for file in $$dists; do \
386 if test -f $$file; then \
387 cp -p $$file $(distdir) || exit 1; \
388 else \
389 cp -p $(srcdir)/$$file $(distdir) || exit 1; \
390 fi; \
391 done
392
393update-po: Makefile
394 $(MAKE) $(DOMAIN).pot-update
395 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
396 $(MAKE) update-gmo
397
398# General rule for creating PO files.
399
400.nop.po-create:
401 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
402 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
403 exit 1
404
405# General rule for updating PO files.
406
407.nop.po-update:
408 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
409 if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
410 tmpdir=`pwd`; \
411 echo "$$lang:"; \
412 test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
413 echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
414 cd $(srcdir); \
415 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
416 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
417 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
418 *) \
419 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
420 esac; \
421 }; then \
422 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
423 rm -f $$tmpdir/$$lang.new.po; \
424 else \
425 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
426 :; \
427 else \
428 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
429 exit 1; \
430 fi; \
431 fi; \
432 else \
433 echo "msgmerge for $$lang.po failed!" 1>&2; \
434 rm -f $$tmpdir/$$lang.new.po; \
435 fi
436
437$(DUMMYPOFILES):
438
439update-gmo: Makefile $(GMOFILES)
440 @:
441
442# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
443# because execution permission bits may not work on the current file system.
444# Use @SHELL@, which is the shell determined by autoconf for the use by its
445# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
446Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
447 cd $(top_builddir) \
448 && @SHELL@ ./config.status $(subdir)/$@.in po-directories
449
450force:
451
452# Tell versions [3.59,3.63) of GNU make not to export all variables.
453# Otherwise a system limit (for SysV at least) may be exceeded.
454.NOEXPORT:
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template
new file mode 100644
index 0000000000..4a9ff7d231
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/Makevars.template
@@ -0,0 +1,53 @@
1# Makefile variables for PO directory in any package using GNU gettext.
2
3# Usually the message domain is the same as the package name.
4DOMAIN = $(PACKAGE)
5
6# These two variables depend on the location of this directory.
7subdir = po
8top_builddir = ..
9
10# These options get passed to xgettext.
11XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
12
13# This is the copyright holder that gets inserted into the header of the
14# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
15# package. (Note that the msgstr strings, extracted from the package's
16# sources, belong to the copyright holder of the package.) Translators are
17# expected to transfer the copyright for their translations to this person
18# or entity, or to disclaim their copyright. The empty string stands for
19# the public domain; in this case the translators are expected to disclaim
20# their copyright.
21COPYRIGHT_HOLDER = Free Software Foundation, Inc.
22
23# This is the email address or URL to which the translators shall report
24# bugs in the untranslated strings:
25# - Strings which are not entire sentences, see the maintainer guidelines
26# in the GNU gettext documentation, section 'Preparing Strings'.
27# - Strings which use unclear terms or require additional context to be
28# understood.
29# - Strings which make invalid assumptions about notation of date, time or
30# money.
31# - Pluralisation problems.
32# - Incorrect English spelling.
33# - Incorrect formatting.
34# It can be your email address, or a mailing list address where translators
35# can write to without being subscribed, or the URL of a web page through
36# which the translators can contact you.
37MSGID_BUGS_ADDRESS =
38
39# This is the list of locale categories, beyond LC_MESSAGES, for which the
40# message catalogs shall be used. It is usually empty.
41EXTRA_LOCALE_CATEGORIES =
42
43# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
44# context. Possible values are "yes" and "no". Set this to yes if the
45# package uses functions taking also a message context, like pgettext(), or
46# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
47USE_MSGCTXT = no
48
49# These options get passed to msgmerge.
50# Useful options are in particular:
51# --previous to keep previous msgids of translated messages,
52# --quiet to reduce the verbosity.
53MSGMERGE_OPTIONS =
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz
new file mode 100644
index 0000000000..e0335a3d1c
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/aclocal.tgz
Binary files differ
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath
new file mode 100755
index 0000000000..c38b914d6b
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/config.rpath
@@ -0,0 +1,690 @@
1#! /bin/sh
2# Output a system dependent set of variables, describing how to set the
3# run time search path of shared libraries in an executable.
4#
5# Copyright 1996-2013 Free Software Foundation, Inc.
6# Taken from GNU libtool, 2001
7# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8#
9# This file is free software; the Free Software Foundation gives
10# unlimited permission to copy and/or distribute it, with or without
11# modifications, as long as this notice is preserved.
12#
13# The first argument passed to this file is the canonical host specification,
14# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
15# or
16# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
17# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
18# should be set by the caller.
19#
20# The set of defined variables is at the end of this script.
21
22# Known limitations:
23# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
24# than 256 bytes, otherwise the compiler driver will dump core. The only
25# known workaround is to choose shorter directory names for the build
26# directory and/or the installation directory.
27
28# All known linkers require a '.a' archive for static linking (except MSVC,
29# which needs '.lib').
30libext=a
31shrext=.so
32
33host="$1"
34host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
35host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
36host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
37
38# Code taken from libtool.m4's _LT_CC_BASENAME.
39
40for cc_temp in $CC""; do
41 case $cc_temp in
42 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
43 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
44 \-*) ;;
45 *) break;;
46 esac
47done
48cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
49
50# Code taken from libtool.m4's _LT_COMPILER_PIC.
51
52wl=
53if test "$GCC" = yes; then
54 wl='-Wl,'
55else
56 case "$host_os" in
57 aix*)
58 wl='-Wl,'
59 ;;
60 mingw* | cygwin* | pw32* | os2* | cegcc*)
61 ;;
62 hpux9* | hpux10* | hpux11*)
63 wl='-Wl,'
64 ;;
65 irix5* | irix6* | nonstopux*)
66 wl='-Wl,'
67 ;;
68 linux* | k*bsd*-gnu | kopensolaris*-gnu)
69 case $cc_basename in
70 ecc*)
71 wl='-Wl,'
72 ;;
73 icc* | ifort*)
74 wl='-Wl,'
75 ;;
76 lf95*)
77 wl='-Wl,'
78 ;;
79 nagfor*)
80 wl='-Wl,-Wl,,'
81 ;;
82 pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
83 wl='-Wl,'
84 ;;
85 ccc*)
86 wl='-Wl,'
87 ;;
88 xl* | bgxl* | bgf* | mpixl*)
89 wl='-Wl,'
90 ;;
91 como)
92 wl='-lopt='
93 ;;
94 *)
95 case `$CC -V 2>&1 | sed 5q` in
96 *Sun\ F* | *Sun*Fortran*)
97 wl=
98 ;;
99 *Sun\ C*)
100 wl='-Wl,'
101 ;;
102 esac
103 ;;
104 esac
105 ;;
106 newsos6)
107 ;;
108 *nto* | *qnx*)
109 ;;
110 osf3* | osf4* | osf5*)
111 wl='-Wl,'
112 ;;
113 rdos*)
114 ;;
115 solaris*)
116 case $cc_basename in
117 f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
118 wl='-Qoption ld '
119 ;;
120 *)
121 wl='-Wl,'
122 ;;
123 esac
124 ;;
125 sunos4*)
126 wl='-Qoption ld '
127 ;;
128 sysv4 | sysv4.2uw2* | sysv4.3*)
129 wl='-Wl,'
130 ;;
131 sysv4*MP*)
132 ;;
133 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
134 wl='-Wl,'
135 ;;
136 unicos*)
137 wl='-Wl,'
138 ;;
139 uts4*)
140 ;;
141 esac
142fi
143
144# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
145
146hardcode_libdir_flag_spec=
147hardcode_libdir_separator=
148hardcode_direct=no
149hardcode_minus_L=no
150
151case "$host_os" in
152 cygwin* | mingw* | pw32* | cegcc*)
153 # FIXME: the MSVC++ port hasn't been tested in a loooong time
154 # When not using gcc, we currently assume that we are using
155 # Microsoft Visual C++.
156 if test "$GCC" != yes; then
157 with_gnu_ld=no
158 fi
159 ;;
160 interix*)
161 # we just hope/assume this is gcc and not c89 (= MSVC++)
162 with_gnu_ld=yes
163 ;;
164 openbsd*)
165 with_gnu_ld=no
166 ;;
167esac
168
169ld_shlibs=yes
170if test "$with_gnu_ld" = yes; then
171 # Set some defaults for GNU ld with shared library support. These
172 # are reset later if shared libraries are not supported. Putting them
173 # here allows them to be overridden if necessary.
174 # Unlike libtool, we use -rpath here, not --rpath, since the documented
175 # option of GNU ld is called -rpath, not --rpath.
176 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
177 case "$host_os" in
178 aix[3-9]*)
179 # On AIX/PPC, the GNU linker is very broken
180 if test "$host_cpu" != ia64; then
181 ld_shlibs=no
182 fi
183 ;;
184 amigaos*)
185 case "$host_cpu" in
186 powerpc)
187 ;;
188 m68k)
189 hardcode_libdir_flag_spec='-L$libdir'
190 hardcode_minus_L=yes
191 ;;
192 esac
193 ;;
194 beos*)
195 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
196 :
197 else
198 ld_shlibs=no
199 fi
200 ;;
201 cygwin* | mingw* | pw32* | cegcc*)
202 # hardcode_libdir_flag_spec is actually meaningless, as there is
203 # no search path for DLLs.
204 hardcode_libdir_flag_spec='-L$libdir'
205 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
206 :
207 else
208 ld_shlibs=no
209 fi
210 ;;
211 haiku*)
212 ;;
213 interix[3-9]*)
214 hardcode_direct=no
215 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
216 ;;
217 gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
218 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
219 :
220 else
221 ld_shlibs=no
222 fi
223 ;;
224 netbsd*)
225 ;;
226 solaris*)
227 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
228 ld_shlibs=no
229 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
230 :
231 else
232 ld_shlibs=no
233 fi
234 ;;
235 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
236 case `$LD -v 2>&1` in
237 *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
238 ld_shlibs=no
239 ;;
240 *)
241 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
242 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
243 else
244 ld_shlibs=no
245 fi
246 ;;
247 esac
248 ;;
249 sunos4*)
250 hardcode_direct=yes
251 ;;
252 *)
253 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
254 :
255 else
256 ld_shlibs=no
257 fi
258 ;;
259 esac
260 if test "$ld_shlibs" = no; then
261 hardcode_libdir_flag_spec=
262 fi
263else
264 case "$host_os" in
265 aix3*)
266 # Note: this linker hardcodes the directories in LIBPATH if there
267 # are no directories specified by -L.
268 hardcode_minus_L=yes
269 if test "$GCC" = yes; then
270 # Neither direct hardcoding nor static linking is supported with a
271 # broken collect2.
272 hardcode_direct=unsupported
273 fi
274 ;;
275 aix[4-9]*)
276 if test "$host_cpu" = ia64; then
277 # On IA64, the linker does run time linking by default, so we don't
278 # have to do anything special.
279 aix_use_runtimelinking=no
280 else
281 aix_use_runtimelinking=no
282 # Test if we are trying to use run time linking or normal
283 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
284 # need to do runtime linking.
285 case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
286 for ld_flag in $LDFLAGS; do
287 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
288 aix_use_runtimelinking=yes
289 break
290 fi
291 done
292 ;;
293 esac
294 fi
295 hardcode_direct=yes
296 hardcode_libdir_separator=':'
297 if test "$GCC" = yes; then
298 case $host_os in aix4.[012]|aix4.[012].*)
299 collect2name=`${CC} -print-prog-name=collect2`
300 if test -f "$collect2name" && \
301 strings "$collect2name" | grep resolve_lib_name >/dev/null
302 then
303 # We have reworked collect2
304 :
305 else
306 # We have old collect2
307 hardcode_direct=unsupported
308 hardcode_minus_L=yes
309 hardcode_libdir_flag_spec='-L$libdir'
310 hardcode_libdir_separator=
311 fi
312 ;;
313 esac
314 fi
315 # Begin _LT_AC_SYS_LIBPATH_AIX.
316 echo 'int main () { return 0; }' > conftest.c
317 ${CC} ${LDFLAGS} conftest.c -o conftest
318 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
319}'`
320 if test -z "$aix_libpath"; then
321 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
322}'`
323 fi
324 if test -z "$aix_libpath"; then
325 aix_libpath="/usr/lib:/lib"
326 fi
327 rm -f conftest.c conftest
328 # End _LT_AC_SYS_LIBPATH_AIX.
329 if test "$aix_use_runtimelinking" = yes; then
330 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
331 else
332 if test "$host_cpu" = ia64; then
333 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
334 else
335 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
336 fi
337 fi
338 ;;
339 amigaos*)
340 case "$host_cpu" in
341 powerpc)
342 ;;
343 m68k)
344 hardcode_libdir_flag_spec='-L$libdir'
345 hardcode_minus_L=yes
346 ;;
347 esac
348 ;;
349 bsdi[45]*)
350 ;;
351 cygwin* | mingw* | pw32* | cegcc*)
352 # When not using gcc, we currently assume that we are using
353 # Microsoft Visual C++.
354 # hardcode_libdir_flag_spec is actually meaningless, as there is
355 # no search path for DLLs.
356 hardcode_libdir_flag_spec=' '
357 libext=lib
358 ;;
359 darwin* | rhapsody*)
360 hardcode_direct=no
361 if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
362 :
363 else
364 ld_shlibs=no
365 fi
366 ;;
367 dgux*)
368 hardcode_libdir_flag_spec='-L$libdir'
369 ;;
370 freebsd2.2*)
371 hardcode_libdir_flag_spec='-R$libdir'
372 hardcode_direct=yes
373 ;;
374 freebsd2*)
375 hardcode_direct=yes
376 hardcode_minus_L=yes
377 ;;
378 freebsd* | dragonfly*)
379 hardcode_libdir_flag_spec='-R$libdir'
380 hardcode_direct=yes
381 ;;
382 hpux9*)
383 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
384 hardcode_libdir_separator=:
385 hardcode_direct=yes
386 # hardcode_minus_L: Not really in the search PATH,
387 # but as the default location of the library.
388 hardcode_minus_L=yes
389 ;;
390 hpux10*)
391 if test "$with_gnu_ld" = no; then
392 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
393 hardcode_libdir_separator=:
394 hardcode_direct=yes
395 # hardcode_minus_L: Not really in the search PATH,
396 # but as the default location of the library.
397 hardcode_minus_L=yes
398 fi
399 ;;
400 hpux11*)
401 if test "$with_gnu_ld" = no; then
402 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
403 hardcode_libdir_separator=:
404 case $host_cpu in
405 hppa*64*|ia64*)
406 hardcode_direct=no
407 ;;
408 *)
409 hardcode_direct=yes
410 # hardcode_minus_L: Not really in the search PATH,
411 # but as the default location of the library.
412 hardcode_minus_L=yes
413 ;;
414 esac
415 fi
416 ;;
417 irix5* | irix6* | nonstopux*)
418 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
419 hardcode_libdir_separator=:
420 ;;
421 netbsd*)
422 hardcode_libdir_flag_spec='-R$libdir'
423 hardcode_direct=yes
424 ;;
425 newsos6)
426 hardcode_direct=yes
427 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
428 hardcode_libdir_separator=:
429 ;;
430 *nto* | *qnx*)
431 ;;
432 openbsd*)
433 if test -f /usr/libexec/ld.so; then
434 hardcode_direct=yes
435 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
436 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
437 else
438 case "$host_os" in
439 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
440 hardcode_libdir_flag_spec='-R$libdir'
441 ;;
442 *)
443 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
444 ;;
445 esac
446 fi
447 else
448 ld_shlibs=no
449 fi
450 ;;
451 os2*)
452 hardcode_libdir_flag_spec='-L$libdir'
453 hardcode_minus_L=yes
454 ;;
455 osf3*)
456 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
457 hardcode_libdir_separator=:
458 ;;
459 osf4* | osf5*)
460 if test "$GCC" = yes; then
461 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
462 else
463 # Both cc and cxx compiler support -rpath directly
464 hardcode_libdir_flag_spec='-rpath $libdir'
465 fi
466 hardcode_libdir_separator=:
467 ;;
468 solaris*)
469 hardcode_libdir_flag_spec='-R$libdir'
470 ;;
471 sunos4*)
472 hardcode_libdir_flag_spec='-L$libdir'
473 hardcode_direct=yes
474 hardcode_minus_L=yes
475 ;;
476 sysv4)
477 case $host_vendor in
478 sni)
479 hardcode_direct=yes # is this really true???
480 ;;
481 siemens)
482 hardcode_direct=no
483 ;;
484 motorola)
485 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
486 ;;
487 esac
488 ;;
489 sysv4.3*)
490 ;;
491 sysv4*MP*)
492 if test -d /usr/nec; then
493 ld_shlibs=yes
494 fi
495 ;;
496 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
497 ;;
498 sysv5* | sco3.2v5* | sco5v6*)
499 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
500 hardcode_libdir_separator=':'
501 ;;
502 uts4*)
503 hardcode_libdir_flag_spec='-L$libdir'
504 ;;
505 *)
506 ld_shlibs=no
507 ;;
508 esac
509fi
510
511# Check dynamic linker characteristics
512# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
513# Unlike libtool.m4, here we don't care about _all_ names of the library, but
514# only about the one the linker finds when passed -lNAME. This is the last
515# element of library_names_spec in libtool.m4, or possibly two of them if the
516# linker has special search rules.
517library_names_spec= # the last element of library_names_spec in libtool.m4
518libname_spec='lib$name'
519case "$host_os" in
520 aix3*)
521 library_names_spec='$libname.a'
522 ;;
523 aix[4-9]*)
524 library_names_spec='$libname$shrext'
525 ;;
526 amigaos*)
527 case "$host_cpu" in
528 powerpc*)
529 library_names_spec='$libname$shrext' ;;
530 m68k)
531 library_names_spec='$libname.a' ;;
532 esac
533 ;;
534 beos*)
535 library_names_spec='$libname$shrext'
536 ;;
537 bsdi[45]*)
538 library_names_spec='$libname$shrext'
539 ;;
540 cygwin* | mingw* | pw32* | cegcc*)
541 shrext=.dll
542 library_names_spec='$libname.dll.a $libname.lib'
543 ;;
544 darwin* | rhapsody*)
545 shrext=.dylib
546 library_names_spec='$libname$shrext'
547 ;;
548 dgux*)
549 library_names_spec='$libname$shrext'
550 ;;
551 freebsd* | dragonfly*)
552 case "$host_os" in
553 freebsd[123]*)
554 library_names_spec='$libname$shrext$versuffix' ;;
555 *)
556 library_names_spec='$libname$shrext' ;;
557 esac
558 ;;
559 gnu*)
560 library_names_spec='$libname$shrext'
561 ;;
562 haiku*)
563 library_names_spec='$libname$shrext'
564 ;;
565 hpux9* | hpux10* | hpux11*)
566 case $host_cpu in
567 ia64*)
568 shrext=.so
569 ;;
570 hppa*64*)
571 shrext=.sl
572 ;;
573 *)
574 shrext=.sl
575 ;;
576 esac
577 library_names_spec='$libname$shrext'
578 ;;
579 interix[3-9]*)
580 library_names_spec='$libname$shrext'
581 ;;
582 irix5* | irix6* | nonstopux*)
583 library_names_spec='$libname$shrext'
584 case "$host_os" in
585 irix5* | nonstopux*)
586 libsuff= shlibsuff=
587 ;;
588 *)
589 case $LD in
590 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
591 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
592 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
593 *) libsuff= shlibsuff= ;;
594 esac
595 ;;
596 esac
597 ;;
598 linux*oldld* | linux*aout* | linux*coff*)
599 ;;
600 linux* | k*bsd*-gnu | kopensolaris*-gnu)
601 library_names_spec='$libname$shrext'
602 ;;
603 knetbsd*-gnu)
604 library_names_spec='$libname$shrext'
605 ;;
606 netbsd*)
607 library_names_spec='$libname$shrext'
608 ;;
609 newsos6)
610 library_names_spec='$libname$shrext'
611 ;;
612 *nto* | *qnx*)
613 library_names_spec='$libname$shrext'
614 ;;
615 openbsd*)
616 library_names_spec='$libname$shrext$versuffix'
617 ;;
618 os2*)
619 libname_spec='$name'
620 shrext=.dll
621 library_names_spec='$libname.a'
622 ;;
623 osf3* | osf4* | osf5*)
624 library_names_spec='$libname$shrext'
625 ;;
626 rdos*)
627 ;;
628 solaris*)
629 library_names_spec='$libname$shrext'
630 ;;
631 sunos4*)
632 library_names_spec='$libname$shrext$versuffix'
633 ;;
634 sysv4 | sysv4.3*)
635 library_names_spec='$libname$shrext'
636 ;;
637 sysv4*MP*)
638 library_names_spec='$libname$shrext'
639 ;;
640 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
641 library_names_spec='$libname$shrext'
642 ;;
643 tpf*)
644 library_names_spec='$libname$shrext'
645 ;;
646 uts4*)
647 library_names_spec='$libname$shrext'
648 ;;
649esac
650
651sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
652escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
653shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
654escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
655escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
656escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
657
658LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
659
660# How to pass a linker flag through the compiler.
661wl="$escaped_wl"
662
663# Static library suffix (normally "a").
664libext="$libext"
665
666# Shared library suffix (normally "so").
667shlibext="$shlibext"
668
669# Format of library name prefix.
670libname_spec="$escaped_libname_spec"
671
672# Library names that the linker finds when passed -lNAME.
673library_names_spec="$escaped_library_names_spec"
674
675# Flag to hardcode \$libdir into a binary during linking.
676# This must work even if \$libdir does not exist.
677hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
678
679# Whether we need a single -rpath flag with a separated argument.
680hardcode_libdir_separator="$hardcode_libdir_separator"
681
682# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
683# resulting binary.
684hardcode_direct="$hardcode_direct"
685
686# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
687# resulting binary.
688hardcode_minus_L="$hardcode_minus_L"
689
690EOF
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch
new file mode 100644
index 0000000000..d453a74b51
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/iconv-m4-remove-the-test-to-convert-euc-jp.patch
@@ -0,0 +1,43 @@
1From 0bfade685783ccd193b2e1b94d0e4ef5ce449432 Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Wed, 20 Nov 2013 17:52:50 +0800
4Subject: [PATCH] remove the test to convert euc-jp
5
6Remove the test "Test against HP-UX 11.11 bug:
7No converter from EUC-JP to UTF-8 is provided"
8since we don't support HP-UX and it causes
9guile-native compile failure if the euc-jp is not
10installed on the host
11
12Upstream-Status: Inappropriate [OE specific]
13
14Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
15---
16 iconv.m4 | 11 -----------
17 1 file changed, 11 deletions(-)
18
19diff --git a/iconv.m4 b/iconv.m4
20index a503646..dbe7ca1 100644
21--- a/iconv.m4
22+++ b/iconv.m4
23@@ -159,17 +159,6 @@ int main ()
24 }
25 }
26 #endif
27- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
28- provided. */
29- if (/* Try standardized names. */
30- iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
31- /* Try IRIX, OSF/1 names. */
32- && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
33- /* Try AIX names. */
34- && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
35- /* Try HP-UX names. */
36- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
37- result |= 16;
38 return result;
39 }]])],
40 [am_cv_func_iconv_works=yes],
41--
421.8.3
43
diff --git a/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin
new file mode 100644
index 0000000000..2436c49e78
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-0.18.3.2/remove-potcdate.sin
@@ -0,0 +1,19 @@
1# Sed script that remove the POT-Creation-Date line in the header entry
2# from a POT file.
3#
4# The distinction between the first and the following occurrences of the
5# pattern is achieved by looking at the hold space.
6/^"POT-Creation-Date: .*"$/{
7x
8# Test if the hold space is empty.
9s/P/P/
10ta
11# Yes it was empty. First occurrence. Remove the line.
12g
13d
14bb
15:a
16# The hold space was nonempty. Following occurrences. Do nothing.
17x
18:b
19}
diff --git a/meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb b/meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb
new file mode 100644
index 0000000000..2b43b97022
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext-minimal-native_0.18.3.2.bb
@@ -0,0 +1,32 @@
1SUMMARY = "Minimal gettext for supporting native autoconf/automake"
2DESCRIPTION = "Contains the m4 macros sufficient to support building \
3autoconf/automake. This provides a significant build time speedup by \
4the removal of gettext-native from most dependency chains (now only \
5needed for gettext for the target)."
6SRC_URI = "file://aclocal.tgz \
7 file://config.rpath \
8 file://Makefile.in.in \
9 file://remove-potcdate.sin \
10 file://COPYING \
11 file://iconv-m4-remove-the-test-to-convert-euc-jp.patch \
12"
13
14INHIBIT_DEFAULT_DEPS = "1"
15INHIBIT_AUTOTOOLS_DEPS = "1"
16
17LICENSE = "FSF-Unlimited"
18LIC_FILES_CHKSUM = "file://COPYING;md5=0854da868a929923087141d9d7aba7d5"
19
20inherit native
21
22
23S = "${WORKDIR}"
24
25do_install () {
26 install -d ${D}${datadir}/aclocal/
27 cp ${WORKDIR}/*.m4 ${D}${datadir}/aclocal/
28 install -d ${D}${datadir}/gettext/po/
29 cp ${WORKDIR}/config.rpath ${D}${datadir}/gettext/
30 cp ${WORKDIR}/Makefile.in.in ${D}${datadir}/gettext/po/
31 cp ${WORKDIR}/remove-potcdate.sin ${D}${datadir}/gettext/po/
32}
diff --git a/meta/recipes-core/gettext/gettext_0.16.1.bb b/meta/recipes-core/gettext/gettext_0.16.1.bb
new file mode 100644
index 0000000000..892194c9ce
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext_0.16.1.bb
@@ -0,0 +1,109 @@
1SUMMARY = "Utilities and libraries for producing multi-lingual messages"
2DESCRIPTION = "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."
3HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
4SECTION = "libs"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=9ea3144f04c41cd2eada5d3f472e6ea5"
7
8PR = "r6"
9DEPENDS = "virtual/libiconv"
10DEPENDS_class-native = ""
11PROVIDES = "virtual/libintl virtual/gettext"
12PROVIDES_class-native = ""
13
14SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
15 file://gettext-vpath.patch \
16 file://linklib_from_0.17.patch \
17 file://gettext-autoconf-lib-link-no-L.patch \
18 file://disable_java.patch \
19 file://fix_aclocal_version.patch \
20 file://fix_gnu_source_circular.patch \
21 file://hardcode_macro_version.patch \
22 "
23
24
25SRC_URI_append_linux-uclibc = " file://gettext-error_print_progname.patch"
26SRC_URI_append_linux-uclibceabi = " file://gettext-error_print_progname.patch"
27
28SRC_URI[md5sum] = "3d9ad24301c6d6b17ec30704a13fe127"
29SRC_URI[sha256sum] = "0bf850d1a079fb5a61f0a47b1a9efd35eb44032255375e1cedb0253bc27b376d"
30
31PARALLEL_MAKE = ""
32
33inherit autotools texinfo
34
35EXTRA_OECONF += "--without-lisp --disable-csharp --disable-openmp --without-emacs"
36acpaths = '-I ${S}/autoconf-lib-link/m4/ \
37 -I ${S}/gettext-runtime/m4 \
38 -I ${S}/gettext-tools/m4'
39
40do_configure_prepend() {
41 rm -f ${S}/config/m4/libtool.m4
42}
43
44# these lack the .x behind the .so, but shouldn't be in the -dev package
45# Otherwise you get the following results:
46# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
47# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
48# because gettext depends on gettext-dev, which pulls in more -dev packages:
49# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
50# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
51# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
52# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
53
54PACKAGES =+ "libgettextlib libgettextsrc"
55FILES_libgettextlib = "${libdir}/libgettextlib-*.so*"
56FILES_libgettextsrc = "${libdir}/libgettextsrc-*.so*"
57
58PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-staticdev gettext-runtime-doc"
59
60FILES_${PN} += "${libdir}/${BPN}/*"
61
62FILES_gettext-runtime = "${bindir}/gettext \
63 ${bindir}/ngettext \
64 ${bindir}/envsubst \
65 ${bindir}/gettext.sh \
66 ${libdir}/libasprintf${SODEV} \
67 ${libdir}/GNU.Gettext.dll \
68 "
69FILES_gettext-runtime_append_libc-uclibc = " ${libdir}/libintl.so.* \
70 ${libdir}/charset.alias \
71 "
72FILES_gettext-runtime-staticdev += "${libdir}/libasprintf.a"
73FILES_gettext-runtime-dev += "${includedir}/autosprintf.h \
74 ${libdir}/libasprintf${SOLIBDEV}"
75FILES_gettext-runtime-dev_append_libc-uclibc = " ${libdir}/libintl.so \
76 ${includedir}/libintl.h \
77 "
78FILES_gettext-runtime-doc = "${mandir}/man1/gettext.* \
79 ${mandir}/man1/ngettext.* \
80 ${mandir}/man1/envsubst.* \
81 ${mandir}/man1/.* \
82 ${mandir}/man3/* \
83 ${docdir}/gettext/gettext.* \
84 ${docdir}/gettext/ngettext.* \
85 ${docdir}/gettext/envsubst.* \
86 ${docdir}/gettext/*.3.html \
87 ${datadir}/gettext/ABOUT-NLS \
88 ${docdir}/gettext/csharpdoc/* \
89 ${docdir}/libasprintf/autosprintf.html \
90 ${infodir}/autosprintf.info \
91 "
92
93
94do_install_append() {
95 rm -f ${D}${libdir}/preloadable_libintl.so
96}
97
98# Anyone inheriting gettext will have both gettext-native and gettext
99# available, and we don't want to use older macros from the target gettext in
100# a non-gplv3 build, so kill them and let dependent recipes rely on
101# gettext-native.
102
103SYSROOT_PREPROCESS_FUNCS += "remove_sysroot_m4_macros"
104
105remove_sysroot_m4_macros () {
106 rm -r "${SYSROOT_DESTDIR}${datadir}/aclocal"
107}
108
109BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/gettext/gettext_0.18.3.2.bb b/meta/recipes-core/gettext/gettext_0.18.3.2.bb
new file mode 100644
index 0000000000..65d4103a97
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext_0.18.3.2.bb
@@ -0,0 +1,106 @@
1SUMMARY = "Utilities and libraries for producing multi-lingual messages"
2DESCRIPTION = "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."
3HOMEPAGE = "http://www.gnu.org/software/gettext/gettext.html"
4SECTION = "libs"
5LICENSE = "GPLv3+ & LGPL-2.1+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
7
8DEPENDS = "gettext-native virtual/libiconv expat"
9DEPENDS_class-native = "gettext-minimal-native"
10PROVIDES = "virtual/libintl virtual/gettext"
11PROVIDES_class-native = "virtual/gettext-native"
12RCONFLICTS_${PN} = "proxy-libintl"
13SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \
14 file://parallel.patch \
15 "
16
17PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses,"
18
19LDFLAGS_prepend_libc-uclibc = " -lrt -lpthread "
20
21SRC_URI[md5sum] = "241aba309d07aa428252c74b40a818ef"
22SRC_URI[sha256sum] = "d1a4e452d60eb407ab0305976529a45c18124bd518d976971ac6dc7aa8b4c5d7"
23
24inherit autotools texinfo
25
26EXTRA_OECONF += "--without-lispdir \
27 --disable-csharp \
28 --disable-libasprintf \
29 --disable-java \
30 --disable-native-java \
31 --disable-openmp \
32 --disable-acl \
33 --with-included-glib \
34 --without-emacs \
35 --without-cvs \
36 --without-git \
37 --with-included-libxml \
38 --with-included-libcroco \
39 --with-included-libunistring \
40 "
41
42acpaths = '-I ${S}/gettext-runtime/m4 \
43 -I ${S}/gettext-tools/m4'
44
45
46# these lack the .x behind the .so, but shouldn't be in the -dev package
47# Otherwise you get the following results:
48# 7.4M glibc/images/ep93xx/Angstrom-console-image-glibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
49# 25M uclibc/images/ep93xx/Angstrom-console-image-uclibc-ipk-2008.1-test-20080104-ep93xx.rootfs.tar.gz
50# because gettext depends on gettext-dev, which pulls in more -dev packages:
51# 15228 KiB /ep93xx/libstdc++-dev_4.2.2-r2_ep93xx.ipk
52# 1300 KiB /ep93xx/uclibc-dev_0.9.29-r8_ep93xx.ipk
53# 140 KiB /armv4t/gettext-dev_0.14.1-r6_armv4t.ipk
54# 4 KiB /ep93xx/libgcc-s-dev_4.2.2-r2_ep93xx.ipk
55
56PACKAGES =+ "libgettextlib libgettextsrc"
57FILES_libgettextlib = "${libdir}/libgettextlib-*.so*"
58FILES_libgettextsrc = "${libdir}/libgettextsrc-*.so*"
59
60PACKAGES =+ "gettext-runtime gettext-runtime-dev gettext-runtime-doc"
61
62FILES_${PN} += "${libdir}/${BPN}/*"
63
64FILES_gettext-runtime = "${bindir}/gettext \
65 ${bindir}/ngettext \
66 ${bindir}/envsubst \
67 ${bindir}/gettext.sh \
68 ${libdir}/libasprintf.so* \
69 ${libdir}/GNU.Gettext.dll \
70 "
71FILES_gettext-runtime_append_libc-uclibc = " ${libdir}/libintl.so.* \
72 ${libdir}/charset.alias \
73 "
74FILES_gettext-runtime-dev += "${libdir}/libasprintf.a \
75 ${includedir}/autosprintf.h \
76 "
77FILES_gettext-runtime-dev_append_libc-uclibc = " ${libdir}/libintl.so \
78 ${includedir}/libintl.h \
79 "
80FILES_gettext-runtime-doc = "${mandir}/man1/gettext.* \
81 ${mandir}/man1/ngettext.* \
82 ${mandir}/man1/envsubst.* \
83 ${mandir}/man1/.* \
84 ${mandir}/man3/* \
85 ${docdir}/gettext/gettext.* \
86 ${docdir}/gettext/ngettext.* \
87 ${docdir}/gettext/envsubst.* \
88 ${docdir}/gettext/*.3.html \
89 ${datadir}/gettext/ABOUT-NLS \
90 ${docdir}/gettext/csharpdoc/* \
91 ${docdir}/libasprintf/autosprintf.html \
92 ${infodir}/autosprintf.info \
93 "
94
95do_install_append() {
96 rm -f ${D}${libdir}/preloadable_libintl.so
97}
98
99do_install_append_class-native () {
100 rm ${D}${datadir}/aclocal/*
101 rm ${D}${datadir}/gettext/config.rpath
102 rm ${D}${datadir}/gettext/po/Makefile.in.in
103 rm ${D}${datadir}/gettext/po/remove-potcdate.sin
104}
105
106BBCLASSEXTEND = "native nativesdk"
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
new file mode 100644
index 0000000000..0be36316b9
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch
@@ -0,0 +1,31 @@
1commit 9b38d507ec37b3d7d4df6095fa7ed16b47d399f7
2Author: Drew Moseley <drew_moseley@mentor.com>
3Date: Sat Mar 29 21:10:43 2014 -0400
4
5 configure.ac: Do not use readlink when cross compiling.
6
7 Do not use readlink to set ABS_GLIB_RUNTIME_LIBDIR when cross
8 compiling. Doing so causes host paths to potentially pollute
9 the target.
10
11 Note that in this case the path is not converted to absolute if
12 it contains any ".." references so it's not completely correct.
13
14 Upstream-Status: Submitted [https://bugzilla.gnome.org/show_bug.cgi?id=727575]
15 Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
16
17diff -rub glib-2.38.2.orig/configure.ac glib-2.38.2/configure.ac
18--- glib-2.38.2.orig/configure.ac 2014-04-03 20:17:13.035567143 -0400
19+++ glib-2.38.2/configure.ac 2014-04-03 20:19:07.071566057 -0400
20@@ -275,7 +275,11 @@
21 [],
22 [with_runtime_libdir=""])
23 GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
24+AS_IF([ test $cross_compiling = yes ], [
25+ABS_GLIB_RUNTIME_LIBDIR="$libdir/$with_runtime_libdir"
26+], [
27 ABS_GLIB_RUNTIME_LIBDIR="`readlink -m $libdir/$with_runtime_libdir`"
28+])
29 AC_SUBST(GLIB_RUNTIME_LIBDIR)
30 AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
31 AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
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
new file mode 100644
index 0000000000..3aac35a5d3
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/add-march-i486-into-CFLAGS-automatically.patch
@@ -0,0 +1,39 @@
1From 55253b55b9c65f3e0efbbe03cbab2a4c4014a16b Mon Sep 17 00:00:00 2001
2From: Song.Li <Song.Li@windriver.com>
3Date: Thu, 5 Jul 2012 15:09:41 +0800
4Subject: [PATCH] add -march=i486 into CFLAGS automatically
5
6Upstream-Status: Inappropriate [configuration]
7
8glib configure will check if current gcc need -march=i486,
9when gcc need -march=i486 but CFLAGS don't have,
10glib configure will abort and advise the user to add -march=i486 or later.
11This will break the build process,it's not good for automatic build system.
12so change this to adding -march=i485 automatically when it is needed.
13---
14 configure.ac | 6 ++++--
15 1 files changed, 4 insertions(+), 2 deletions(-)
16
17Index: glib-2.36.0/configure.ac
18===================================================================
19--- glib-2.36.0.orig/configure.ac
20+++ glib-2.36.0/configure.ac
21@@ -2378,7 +2378,7 @@ dnl
22 dnl Note that the atomic ops are only available with GCC on x86 when
23 dnl using -march=i486 or higher. If we detect that the atomic ops are
24 dnl not available but would be available given the right flags, we want
25-dnl to abort and advise the user to fix their CFLAGS. It's better to do
26+dnl to add -march=i486 automatically to fix their CFLAGS. It's better to do
27 dnl that then to silently fall back on emulated atomic ops just because
28 dnl the user had the wrong build environment.
29
30@@ -2401,7 +2401,8 @@ AC_CACHE_CHECK([for lock-free atomic int
31 AC_TRY_COMPILE([],
32 [volatile int atomic = 2;\
33 __sync_bool_compare_and_swap (&atomic, 2, 3);],
34- [AC_MSG_ERROR([GLib must be build with -march=i486 or later.])],
35+ [AC_MSG_WARN([GLib must be build with -march=i486 or later.])
36+ SAVE_CFLAGS="${SAVE_CFLAGS} -march=i486"],
37 [])
38 CFLAGS="${SAVE_CFLAGS}"
39 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
new file mode 100644
index 0000000000..3d0c008bbe
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/allow-run-media-sdX-drive-mount-if-username-root.patch
@@ -0,0 +1,39 @@
1From c53e94a520b573aa0dcf12903e9563fe8badc34c Mon Sep 17 00:00:00 2001
2From: Marius Avram <marius.avram@intel.com>
3Date: Wed, 27 Aug 2014 12:10:41 +0300
4Subject: [PATCH] Allow /run/media/sdX drive mount if username root
5
6In case that the username logged in the system is root
7the drives are directly mounted in /run/media/sdX and
8not /run/media/<username>/sdX as the function
9g_unix_mount_guess_should_display() expects.
10
11Without this change USB stick mounts are not accesible from
12graphical applications such as the File Manager (pcmanfm).
13
14Upstream-Status: Inappropriate
15
16Signed-off-by: Marius Avram <marius.avram@intel.com>
17---
18 gio/gunixmounts.c | 5 +++++
19 1 file changed, 5 insertions(+)
20
21diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
22index 4999354..f6c1472 100644
23--- a/gio/gunixmounts.c
24+++ b/gio/gunixmounts.c
25@@ -2136,6 +2136,11 @@ g_unix_mount_guess_should_display (GUnixMountEntry *mount_entry)
26 mount_path[sizeof ("/run/media/") - 1 + user_name_len] == '/')
27 is_in_runtime_dir = TRUE;
28
29+ /* Allow no username in path in /run/media if current user is root */
30+ if (strcmp(user_name, "root") == 0 &&
31+ strncmp (mount_path, "/run/media/", sizeof("run/media")) == 0)
32+ is_in_runtime_dir = TRUE;
33+
34 if (is_in_runtime_dir || g_str_has_prefix (mount_path, "/media/"))
35 {
36 char *path;
37--
381.7.9.5
39
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
new file mode 100644
index 0000000000..1d69a3f290
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/configure-libtool.patch
@@ -0,0 +1,60 @@
1From 1c5718648d49e795efee91c220a2bf9386c184f2 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Sat, 28 Apr 2012 18:24:50 +0200
4Subject: [PATCH] configure: use $host_alias-libtool instead of libtool
5 directly
6
7Poky renames libtool to $host_alias-libtool.
8./$host_alias-libtool isn't created until after configure runs with
9libtool >= 2.2.2
10so we can't call # it at this point. We can safely assume a version is
11available
12from PATH though
13
14Rebased to glib-2.27.3 by Dongxiao Xu <dongxiao.xu@intel.com>
15Rebased to glib-2.32.1 by Martin Jansa <Martin.Jansa@gmail.com>
16
17Upstream-Status: Inappropriate [configuration]
18
19Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
20---
21 configure.ac | 8 ++++----
22 1 files changed, 4 insertions(+), 4 deletions(-)
23
24diff --git a/configure.ac b/configure.ac
25index a6478c6..9a93d60 100644
26--- a/configure.ac
27+++ b/configure.ac
28@@ -1470,7 +1470,7 @@ if test x"$glib_native_win32" = xyes; then
29 G_MODULE_LDFLAGS=
30 else
31 export SED
32- G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
33+ G_MODULE_LDFLAGS=`(./$host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
34 fi
35 dnl G_MODULE_IMPL= don't reset, so cmd-line can override
36 G_MODULE_NEED_USCORE=0
37@@ -1535,9 +1535,9 @@ if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
38 LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
39 dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
40 echo "void glib_plugin_test(void) { }" > plugin.c
41- ${SHELL} ./libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
42+ ${SHELL} ./$host_alias-libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
43 ${CPPFLAGS} -c -o plugin.lo plugin.c >/dev/null 2>&1
44- ${SHELL} ./libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
45+ ${SHELL} ./$host_alias-libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
46 ${LDFLAGS} -module -o plugin.la -export-dynamic \
47 -shrext ".o" -avoid-version plugin.lo \
48 -rpath /dont/care >/dev/null 2>&1
49@@ -1614,7 +1614,7 @@ fi
50
51 AC_MSG_CHECKING(for the suffix of module shared libraries)
52 export SED
53-shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
54+shrext_cmds=`./$host_alias-libtool --config | grep '^shrext_cmds='`
55 eval $shrext_cmds
56 module=yes eval std_shrext=$shrext_cmds
57 # chop the initial dot
58--
591.7.8.6
60
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
new file mode 100644
index 0000000000..1571112b0e
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/fix-conflicting-rand.patch
@@ -0,0 +1,35 @@
1Rename 'rand' variable to avoid conflict.
2
3Upstream-Status: pending
4Signed-off-by: Björn Stenberg <bjst@enea.com>
5
6diff -u glib-2.34.3/tests/refcount/signals.c~ glib-2.34.3/tests/refcount/signals.c
7--- glib-2.34.3/tests/refcount/signals.c 2012-11-26 17:52:48.000000000 +0100
8+++ glib-2.34.3/tests/refcount/signals.c 2013-02-08 14:24:10.052477546 +0100
9@@ -9,7 +9,7 @@
10 #define MY_IS_TEST_CLASS(tclass) (G_TYPE_CHECK_CLASS_TYPE ((tclass), G_TYPE_TEST))
11 #define MY_TEST_GET_CLASS(test) (G_TYPE_INSTANCE_GET_CLASS ((test), G_TYPE_TEST, GTestClass))
12
13-static GRand *rand;
14+static GRand *grand;
15
16 typedef struct _GTest GTest;
17 typedef struct _GTestClass GTestClass;
18@@ -84,7 +84,7 @@
19 NULL
20 };
21
22- rand = g_rand_new();
23+ grand = g_rand_new();
24
25 test_type = g_type_register_static (G_TYPE_OBJECT, "GTest",
26 &test_info, 0);
27@@ -218,7 +218,7 @@
28 static void
29 my_test_do_prop (GTest * test)
30 {
31- test->value = g_rand_int (rand);
32+ test->value = g_rand_int (grand);
33 g_object_notify (G_OBJECT (test), "test-prop");
34 }
35
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
new file mode 100644
index 0000000000..9759d11e3c
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/glib-2.0-configure-readlink.patch
@@ -0,0 +1,29 @@
1configure.ac: change readlink -f to -m
2
3Change "readlink -f" to "readlink -m" since $libdir/$with_runtime_libdir
4may not exist.
5
6This patch should go to the upstream, I will send it sooner.
7
8Upstream-Status: Pending
9
10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
11---
12 configure.ac | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/configure.ac b/configure.ac
16--- a/configure.ac
17+++ b/configure.ac
18@@ -271,7 +271,7 @@ AC_ARG_WITH(runtime-libdir,
19 [],
20 [with_runtime_libdir=""])
21 GLIB_RUNTIME_LIBDIR="$with_runtime_libdir"
22-ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`"
23+ABS_GLIB_RUNTIME_LIBDIR="`readlink -m $libdir/$with_runtime_libdir`"
24 AC_SUBST(GLIB_RUNTIME_LIBDIR)
25 AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR)
26 AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"])
27--
281.8.1.2
29
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
new file mode 100644
index 0000000000..ee435111fc
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/glib-gettextize-dir.patch
@@ -0,0 +1,24 @@
1# an very old patch cherry-picked in every glib-2.0 patch directory. The earliest container
2# for it is 2.6.5 in OE. The earliest commit for it is c8e5702127e507e82e6f68a4b8c546803accea9d
3# in OE side which ports from previous bitkeeper SCM. In OE side it's only used til 2.12.4.
4#
5# keep it since it's always cleaner to not hardcode destination path. Use @datadir@ is more
6# portable here. mark for upstream
7#
8# by Kevin Tian <kevin.tian@intel.com>, 06/25/2010
9# Rebased by Dongxiao Xu <dongxiao.xu@intel.com>, 11/16/2010
10
11Upstream-Status: Inappropriate [configuration]
12
13diff -ruN glib-2.27.3-orig/glib-gettextize.in glib-2.27.3/glib-gettextize.in
14--- glib-2.27.3-orig/glib-gettextize.in 2009-04-01 07:04:20.000000000 +0800
15+++ glib-2.27.3/glib-gettextize.in 2010-11-16 12:55:06.874605916 +0800
16@@ -52,7 +52,7 @@
17 datadir=@datadir@
18 datarootdir=@datarootdir@
19
20-gettext_dir=$prefix/share/glib-2.0/gettext
21+gettext_dir=@datadir@/glib-2.0/gettext
22
23 while test $# -gt 0; do
24 case "$1" in
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
new file mode 100644
index 0000000000..f3be02770c
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/ptest-paths.patch
@@ -0,0 +1,30 @@
1Instead of writing the temporary mapping files in the mappedfile test to the
2user runtime directory, write them to $TMP. The runtime directory may not
3currently exist if the test is executed on a non-desktop system and the test
4doesn't attempt to create the directory structure.
5
6Upstream-Status: Pending
7Signed-off-by: Ross Burton <ross.burton@intel.com>
8
9diff --git a/glib/tests/mappedfile.c b/glib/tests/mappedfile.c
10index 40e0e60..27a24be 100644
11--- a/glib/tests/mappedfile.c
12+++ b/glib/tests/mappedfile.c
13@@ -81,7 +81,7 @@ test_writable (void)
14 const gchar *new = "abcdefghijklmnopqrstuvxyz";
15 gchar *tmp_copy_path;
16
17- tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
18+ tmp_copy_path = g_build_filename (g_get_tmp_dir (), "glib-test-4096-random-bytes", NULL);
19
20 g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
21 g_assert_no_error (error);
22@@ -125,7 +125,7 @@ test_writable_fd (void)
23 int fd;
24 gchar *tmp_copy_path;
25
26- tmp_copy_path = g_build_filename (g_get_user_runtime_dir (), "glib-test-4096-random-bytes", NULL);
27+ tmp_copy_path = g_build_filename (g_get_tmp_dir (), "glib-test-4096-random-bytes", NULL);
28
29 g_file_get_contents (g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL), &contents, &len, &error);
30 g_assert_no_error (error);
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
new file mode 100644
index 0000000000..130ae09b6c
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/run-ptest
@@ -0,0 +1,3 @@
1#! /bin/sh
2
3gnome-desktop-testing-runner glib
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
new file mode 100644
index 0000000000..2a154fdd4a
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/uclibc.patch
@@ -0,0 +1,20 @@
1Fix DATADIRNAME on uclibc/Linux
2
3translation files are always installed under PREFIX/share/locale in uclibc
4based systems therefore lets set DATADIRNAME to "share".
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8Index: glib-2.38.2/m4macros/glib-gettext.m4
9===================================================================
10--- glib-2.38.2.orig/m4macros/glib-gettext.m4 2013-11-07 07:29:13.000000000 -0800
11+++ glib-2.38.2/m4macros/glib-gettext.m4 2014-03-15 14:51:54.712135644 -0700
12@@ -239,7 +239,7 @@
13 [CATOBJEXT=.mo
14 DATADIRNAME=lib])
15 ;;
16- *-*-openbsd*)
17+ *-*-openbsd* | *-*-linux-uclibc*)
18 CATOBJEXT=.mo
19 DATADIRNAME=share
20 ;;
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb
new file mode 100644
index 0000000000..4b1bcf85c5
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.40.0.bb
@@ -0,0 +1,22 @@
1require glib.inc
2
3PE = "1"
4
5SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
6
7SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
8 file://configure-libtool.patch \
9 file://fix-conflicting-rand.patch \
10 file://add-march-i486-into-CFLAGS-automatically.patch \
11 file://glib-2.0-configure-readlink.patch \
12 file://run-ptest \
13 file://ptest-paths.patch \
14 file://uclibc.patch \
15 file://0001-configure.ac-Do-not-use-readlink-when-cross-compilin.patch \
16 file://allow-run-media-sdX-drive-mount-if-username-root.patch \
17 "
18
19SRC_URI_append_class-native = " file://glib-gettextize-dir.patch"
20
21SRC_URI[md5sum] = "05fb7cb17eacbc718e90366a1eae60d9"
22SRC_URI[sha256sum] = "0d27f195966ecb1995dcce0754129fd66ebe820c7cd29200d264b02af1aa28b5"
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
new file mode 100644
index 0000000000..2d81afc8f2
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -0,0 +1,102 @@
1SUMMARY = "A general-purpose utility library"
2DESCRIPTION = "GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on."
3# pcre is under BSD;
4# docs/reference/COPYING is with a 'public domai'-like license!
5LICENSE = "LGPLv2+ & BSD & PD"
6LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
7 file://glib/glib.h;beginline=4;endline=17;md5=b4f0f4a399c19e5ebb20c31b79d6bc32 \
8 file://gmodule/COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
9 file://gmodule/gmodule.h;beginline=4;endline=17;md5=b4f0f4a399c19e5ebb20c31b79d6bc32 \
10 file://glib/pcre/COPYING;md5=266ebc3ff74ee9ce6fad65577667c0f4 \
11 file://glib/pcre/pcre.h;beginline=11;endline=35;md5=de27f2bf633d20a2b7af0b1983423283 \
12 file://docs/reference/COPYING;md5=f51a5100c17af6bae00735cd791e1fcc"
13BUGTRACKER = "http://bugzilla.gnome.org"
14SECTION = "libs"
15
16BBCLASSEXTEND = "native nativesdk"
17
18DEPENDS = "glib-2.0-native virtual/libiconv libffi zlib"
19DEPENDS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', ' dbus', '', d)}"
20DEPENDS_class-native = "pkgconfig-native gettext-native libffi-native zlib-native"
21DEPENDS_class-nativesdk = "nativesdk-libtool nativesdk-gettext nativesdk-libffi nativesdk-zlib ${BPN}-native"
22
23PACKAGES =+ "${PN}-utils ${PN}-bash-completion ${PN}-codegen"
24
25LEAD_SONAME = "libglib-2.0.*"
26FILES_${PN}-utils = "${bindir}/* ${datadir}/glib-2.0/gettext"
27
28inherit autotools gettext gtk-doc pkgconfig ptest-gnome
29
30S = "${WORKDIR}/glib-${PV}"
31
32CORECONF = "--disable-dtrace --disable-fam --disable-libelf --disable-systemtap --disable-man"
33
34PRINTF = "--enable-included-printf=no"
35PRINTF_darwin = "--enable-included-printf=yes"
36PRINTF_mingw32 = "--enable-included-printf=yes"
37EXTRA_OECONF = "${PRINTF} ${CORECONF}"
38EXTRA_OECONF_class-native = "${CORECONF} --disable-selinux"
39EXTRA_OECONF_append_libc-uclibc = " --with-libiconv=gnu"
40
41do_configure_prepend() {
42 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
43}
44
45FILES_${PN} = "${libdir}/lib*${SOLIBS} ${libdir}/gio ${datadir}/glib-2.0/schemas \
46 ${datadir}/glib-2.0/gettext/mkinstalldirs ${datadir}/glib-2.0/gettext/po/Makefile.in.in"
47FILES_${PN}-dev += "${libdir}/glib-2.0/include \
48 ${libdir}/gio/modules/lib*${SOLIBSDEV} \
49 ${libdir}/gio/modules/*.la"
50FILES_${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb \
51 ${libdir}/gio/modules/.debug \
52 ${libdir}/glib-2.0/installed-tests/glib/.debug"
53FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py"
54FILES_${PN}-bash-completion = "${sysconfdir}/bash_completion.d \
55 ${datadir}/bash-completion"
56
57ARM_INSTRUCTION_SET = "arm"
58USE_NLS = "yes"
59
60do_install_append () {
61 if [ -f ${D}${bindir}/gtester-report ]; then
62 sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python|'
63 fi
64
65 # Remove some unpackaged files
66 rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
67 rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo
68
69 # Some distros have both /bin/perl and /usr/bin/perl, but we set perl location
70 # for target as /usr/bin/perl, so fix it to /usr/bin/perl.
71 if [ -f ${D}${bindir}/glib-mkenums ]; then
72 sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' ${D}${bindir}/glib-mkenums
73 fi
74}
75
76RDEPENDS_${PN}-ptest += "\
77 gnome-desktop-testing \
78 tzdata \
79 tzdata-americas \
80 tzdata-asia \
81 tzdata-europe \
82 tzdata-posix \
83 python-pygobject \
84 python-dbus \
85 shared-mime-info \
86 "
87
88RDEPENDS_${PN}-ptest_append_libc-glibc = "\
89 glibc-gconv-utf-16 \
90 glibc-charmap-utf-8 \
91 glibc-gconv-cp1255 \
92 glibc-charmap-cp1255 \
93 glibc-gconv-utf-32 \
94 glibc-gconv-utf-7 \
95 glibc-gconv-euc-jp \
96 glibc-gconv-iso8859-1 \
97 glibc-gconv-iso8859-15 \
98 glibc-charmap-invariant \
99 glibc-localedata-translit-cjk-variants \
100 "
101
102INSANE_SKIP_${PN}-ptest += "libdir"
diff --git a/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb b/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb
new file mode 100644
index 0000000000..b9ba2d6217
--- /dev/null
+++ b/meta/recipes-core/glib-networking/glib-networking_2.38.0.bb
@@ -0,0 +1,32 @@
1SUMMARY = "GLib networking extensions"
2DESCRIPTION = "glib-networking contains the implementations of certain GLib networking features that cannot be implemented directly in GLib itself because of their dependencies."
3HOMEPAGE = "http://git.gnome.org/browse/glib-networking/"
4BUGTRACKER = "http://bugzilla.gnome.org"
5
6LICENSE = "LGPLv2"
7LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
8
9SECTION = "libs"
10DEPENDS = "glib-2.0 intltool-native"
11
12GNOME_COMPRESS_TYPE = "xz"
13
14SRC_URI[archive.md5sum] = "a22907deed3d956860d83aa3233e86ff"
15SRC_URI[archive.sha256sum] = "a43eacbf721b475cf6ba0cd2eab02a332014f71a4c41d0b44bd7bbf8ed1f840d"
16
17PACKAGECONFIG ??= "ca-certificates gnutls"
18
19# No explicit dependency as it works without ca-certificates installed
20PACKAGECONFIG[ca-certificates] = "--with-ca-certificates=${sysconfdir}/ssl/certs/ca-certificates.crt,--without-ca-certificates"
21PACKAGECONFIG[gnutls] = "--with-gnutls,--without-gnutls,gnutls"
22PACKAGECONFIG[libproxy] = "--with-libproxy,--without-libproxy,libproxy"
23PACKAGECONFIG[pkcs11] = "--with-pkcs11,--without-pkcs11,p11-kit"
24
25EXTRA_OECONF = "--without-gnome-proxy"
26
27inherit gnomebase gettext
28
29FILES_${PN} += "${libdir}/gio/modules/libgio*.so ${datadir}/dbus-1/services/"
30FILES_${PN}-dbg += "${libdir}/gio/modules/.debug/"
31FILES_${PN}-dev += "${libdir}/gio/modules/libgio*.la"
32FILES_${PN}-staticdev += "${libdir}/gio/modules/libgio*.a"
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
new file mode 100644
index 0000000000..186a480458
--- /dev/null
+++ b/meta/recipes-core/glibc/cross-localedef-native/fix_for_centos_5.8.patch
@@ -0,0 +1,18 @@
1Upstream-Status: Inappropriate [other]
2
3This is a hack to fix building the locale bits on an older
4CentOs 5.X machine
5
6Index: git/locale/programs/config.h
7===================================================================
8--- git/locale/programs/config.h
9+++ git.orig/locale/programs/config.h
10@@ -19,6 +19,8 @@
11 #ifndef _LD_CONFIG_H
12 #define _LD_CONFIG_H 1
13
14+#define DUMMY_LOCALE_T
15+
16 /* Use the internal textdomain used for libc messages. */
17 #define PACKAGE _libc_intl_domainname
18 #ifndef VERSION
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.20.bb b/meta/recipes-core/glibc/cross-localedef-native_2.20.bb
new file mode 100644
index 0000000000..ccf56a9415
--- /dev/null
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.20.bb
@@ -0,0 +1,52 @@
1SUMMARY = "Cross locale generation tool for glibc"
2HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
3SECTION = "libs"
4LICENSE = "LGPL-2.1"
5
6LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
7 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
8 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
9 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
10
11
12inherit native
13inherit autotools
14
15FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
16
17PV = "2.20"
18
19SRC_URI = "git://sourceware.org/git/glibc.git;branch=release/${PV}/master;name=glibc \
20 git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
21 file://fix_for_centos_5.8.patch \
22 ${EGLIBCPATCHES} \
23 "
24EGLIBCPATCHES = "\
25 file://timezone-re-written-tzselect-as-posix-sh.patch \
26 file://eglibc.patch \
27 file://option-groups.patch \
28 file://GLRO_dl_debug_mask.patch \
29 file://eglibc-header-bootstrap.patch \
30 file://eglibc-resolv-dynamic.patch \
31 file://eglibc-ppc8xx-cache-line-workaround.patch \
32 file://eglibc-sh4-fpscr_values.patch \
33 file://eglibc-use-option-groups.patch \
34 "
35
36SRCREV_glibc = "b8079dd0d360648e4e8de48656c5c38972621072"
37SRCREV_localedef = "c833367348d39dad7ba018990bfdaffaec8e9ed3"
38
39S = "${WORKDIR}/git"
40
41EXTRA_OECONF = "--with-glibc=${S}"
42CFLAGS += "-DNOT_IN_libc=1"
43
44do_configure () {
45 ${S}/localedef/configure ${EXTRA_OECONF}
46}
47
48
49do_install() {
50 install -d ${D}${bindir}
51 install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
52}
diff --git a/meta/recipes-core/glibc/glibc-collateral.inc b/meta/recipes-core/glibc/glibc-collateral.inc
new file mode 100644
index 0000000000..85e06da816
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-collateral.inc
@@ -0,0 +1,12 @@
1INHIBIT_DEFAULT_DEPS = "1"
2LICENSE = "GPLv2 & LGPLv2.1"
3HOMEPAGE = "http://www.gnu.org/software/libc/index.html"
4
5do_fetch[noexec] = "1"
6do_unpack[noexec] = "1"
7do_patch[noexec] = "1"
8do_configure[noexec] = "1"
9do_compile[noexec] = "1"
10
11do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot"
12
diff --git a/meta/recipes-core/glibc/glibc-common.inc b/meta/recipes-core/glibc/glibc-common.inc
new file mode 100644
index 0000000000..bba1568baf
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-common.inc
@@ -0,0 +1,9 @@
1SUMMARY = "GLIBC (GNU C Library)"
2DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel."
3HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
4SECTION = "libs"
5LICENSE = "GPLv2 & LGPLv2.1"
6LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
7 file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
8 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
9 file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff "
diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
new file mode 100644
index 0000000000..7db3deac1b
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-initial.inc
@@ -0,0 +1,78 @@
1DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial libgcc-initial"
2PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
3
4PACKAGES = ""
5PACKAGES_DYNAMIC = ""
6
7STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
8STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
9TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
10
11do_configure () {
12 sed -ie 's,{ (exit 1); exit 1; }; },{ (exit 0); }; },g' ${S}/configure
13 chmod +x ${S}/configure
14 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
15 find ${S} -name "configure" | xargs touch
16 ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \
17 --prefix=/usr \
18 --without-cvs --disable-sanity-checks \
19 --with-headers=${STAGING_DIR_TARGET}${includedir} \
20 --with-kconfig=${STAGING_BINDIR_NATIVE} \
21 --enable-hacker-mode --enable-addons
22}
23
24do_compile () {
25 :
26}
27
28do_install () {
29 oe_runmake cross-compiling=yes install_root=${D} \
30 includedir='${includedir}' prefix='${prefix}' \
31 install-bootstrap-headers=yes install-headers
32
33 oe_runmake csu/subdir_lib
34 mkdir -p ${D}${libdir}/
35 install -m 644 csu/crt[1in].o ${D}${libdir}
36
37 # Two headers -- stubs.h and features.h -- aren't installed by install-headers,
38 # so do them by hand. We can tolerate an empty stubs.h for the moment.
39 # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
40 mkdir -p ${D}${includedir}/gnu/
41 touch ${D}${includedir}/gnu/stubs.h
42 cp ${S}/include/features.h ${D}${includedir}/features.h
43
44 if [ -e ${B}/bits/stdio_lim.h ]; then
45 cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/
46 fi
47 # add links to linux-libc-headers: final glibc build need this.
48 for t in linux asm asm-generic; do
49 ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
50 done
51}
52
53do_install_locale() {
54 :
55}
56
57do_siteconfig () {
58 :
59}
60
61SSTATEPOSTINSTFUNCS += "glibcinitial_sstate_postinst"
62glibcinitial_sstate_postinst() {
63 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
64 then
65 # Recreate the symlinks to ensure they point to the correct location
66 for t in linux asm asm-generic; do
67 rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
68 ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
69 done
70 fi
71}
72
73do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
74
75# We don't install any scripts so there is nothing to evacuate
76do_evacuate_scripts () {
77 :
78}
diff --git a/meta/recipes-core/glibc/glibc-initial_2.20.bb b/meta/recipes-core/glibc/glibc-initial_2.20.bb
new file mode 100644
index 0000000000..8ab01dc79d
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-initial_2.20.bb
@@ -0,0 +1,11 @@
1require glibc_${PV}.bb
2require glibc-initial.inc
3
4DEPENDS += "kconfig-frontends-native"
5
6# main glibc recipes muck with TARGET_CPPFLAGS to point into
7# final target sysroot but we
8# are not there when building glibc-initial
9# so reset it here
10
11TARGET_CPPFLAGS = ""
diff --git a/meta/recipes-core/glibc/glibc-ld.inc b/meta/recipes-core/glibc/glibc-ld.inc
new file mode 100644
index 0000000000..962d666885
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-ld.inc
@@ -0,0 +1,56 @@
1def ld_append_if_tune_exists(d, infos, dict):
2 tune = d.getVar("DEFAULTTUNE", True) or ""
3 libdir = d.getVar("base_libdir", True) or ""
4 if tune in dict:
5 infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }')
6 infos['lddrewrite'].add(libdir+'/'+dict[tune][0])
7
8def glibc_dl_info(d):
9 ld_info_all = {
10 "mips": ["ld.so.1", "FLAG_ELF_LIBC6"],
11 "mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
12 "mips64": ["ld.so.1", "FLAG_ELF_LIBC6"],
13 "mipsel": ["ld.so.1", "FLAG_ELF_LIBC6"],
14 "mips64el-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
15 "mips64el": ["ld.so.1", "FLAG_ELF_LIBC6"],
16 "mips-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
17 "mips64-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
18 "mips64-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
19 "mips64el-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"],
20 "mips64el-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
21 "powerpc": ["ld.so.1", "FLAG_ELF_LIBC6"],
22 "powerpc-nf": ["ld.so.1", "FLAG_ELF_LIBC6"],
23 "powerpc64": ["ld64.so.1", "FLAG_ELF_LIBC6"],
24 "powerpc64-nf": ["ld64.so.1", "FLAG_ELF_LIBC6"],
25 "core2-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
26 "core2-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
27 "x86": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
28 "x86-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
29 "i586": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
30 "corei7-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"],
31 "corei7-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"],
32 }
33
34 infos = {'ldconfig':set(), 'lddrewrite':set()}
35 ld_append_if_tune_exists(d, infos, ld_info_all)
36
37 #DEFAULTTUNE_MULTILIB_ORIGINAL
38 original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL",True)
39 if original_tune:
40 localdata = bb.data.createCopy(d)
41 localdata.setVar("DEFAULTTUNE", original_tune)
42 ld_append_if_tune_exists(localdata, infos, ld_info_all)
43
44 variants = d.getVar("MULTILIB_VARIANTS", True) or ""
45 for item in variants.split():
46 localdata = bb.data.createCopy(d)
47 overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
48 localdata.setVar("OVERRIDES", overrides)
49 bb.data.update_data(localdata)
50 ld_append_if_tune_exists(localdata, infos, ld_info_all)
51 infos['ldconfig'] = ','.join(infos['ldconfig'])
52 infos['lddrewrite'] = ' '.join(infos['lddrewrite'])
53 return infos
54
55EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}"
56RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}"
diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
new file mode 100644
index 0000000000..d472605842
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-locale.inc
@@ -0,0 +1,96 @@
1include glibc-collateral.inc
2
3SUMMARY = "Locale data from glibc"
4
5BPN = "glibc"
6LOCALEBASEPN = "${MLPREFIX}glibc"
7
8# glibc-collateral.inc inhibits all default deps, but do_package needs objcopy
9# 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')
10# ERROR: Function failed: split_and_strip_files
11BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot"
12BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
13do_package[depends] += "${BINUTILSDEP}"
14
15# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
16# is set. The idea is to avoid running localedef on the target (at first boot)
17# to decrease initial boot time and avoid localedef being killed by the OOM
18# killer which used to effectively break i18n on machines with < 128MB RAM.
19
20# default to disabled
21ENABLE_BINARY_LOCALE_GENERATION ?= "0"
22ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "0"
23
24#enable locale generation on these arches
25# BINARY_LOCALE_ARCHES is a space separated list of regular expressions
26BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips mips64"
27
28# set "1" to use cross-localedef for locale generation
29# set "0" for qemu emulation of native localedef for locale generation
30LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1"
31
32PROVIDES = "virtual/libc-locale"
33
34PACKAGES = "localedef ${PN}-dbg"
35
36PACKAGES_DYNAMIC = "^locale-base-.* \
37 ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
38 ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
39 ^${MLPREFIX}glibc-gconv$"
40
41# Create a glibc-binaries package
42ALLOW_EMPTY_${BPN}-binaries = "1"
43PACKAGES += "${BPN}-binaries"
44RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-binary") != -1])}"
45
46# Create a glibc-charmaps package
47ALLOW_EMPTY_${BPN}-charmaps = "1"
48PACKAGES += "${BPN}-charmaps"
49RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-charmap") != -1])}"
50
51# Create a glibc-gconvs package
52ALLOW_EMPTY_${BPN}-gconvs = "1"
53PACKAGES += "${BPN}-gconvs"
54RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-gconv") != -1])}"
55
56# Create a glibc-localedatas package
57ALLOW_EMPTY_${BPN}-localedatas = "1"
58PACKAGES += "${BPN}-localedatas"
59RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("glibc-localedata") != -1])}"
60
61DESCRIPTION_localedef = "glibc: compile locale definition files"
62
63# glibc-gconv is dynamically added into PACKAGES, thus
64# FILES_glibc-gconv will not be automatically extended in multilib.
65# Explicitly add ${MLPREFIX} for FILES_glibc-gconv.
66FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
67FILES_${PN}-dbg += "${libdir}/gconv/.debug/*"
68FILES_localedef = "${bindir}/localedef"
69
70LOCALETREESRC = "${STAGING_INCDIR}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}"
71
72do_install () {
73 mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir}
74 if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
75 cp -fpPR ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
76 fi
77 if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
78 mkdir -p ${D}${localedir}
79 cp -fpPR ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
80 fi
81 if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
82 cp -fpPR ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
83 fi
84 if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
85 cp -fpPR ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
86 fi
87 if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
88 cp -fpPR ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
89 fi
90 chown root.root -R ${D}
91 cp -fpPR ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
92}
93
94inherit libc-package
95
96BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-core/glibc/glibc-locale_2.20.bb b/meta/recipes-core/glibc/glibc-locale_2.20.bb
new file mode 100644
index 0000000000..f7702e0358
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-locale_2.20.bb
@@ -0,0 +1 @@
require glibc-locale.inc
diff --git a/meta/recipes-core/glibc/glibc-mtrace.inc b/meta/recipes-core/glibc/glibc-mtrace.inc
new file mode 100644
index 0000000000..e12b079e06
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-mtrace.inc
@@ -0,0 +1,13 @@
1include glibc-collateral.inc
2
3SUMMARY = "mtrace utility provided by glibc"
4DESCRIPTION = "mtrace utility provided by glibc"
5RDEPENDS_${PN} = "perl"
6RPROVIDES_${PN} = "libc-mtrace"
7
8SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
9
10do_install() {
11 install -d -m 0755 ${D}${bindir}
12 install -m 0755 ${SRC}/mtrace ${D}${bindir}/
13}
diff --git a/meta/recipes-core/glibc/glibc-mtrace_2.20.bb b/meta/recipes-core/glibc/glibc-mtrace_2.20.bb
new file mode 100644
index 0000000000..0b69bad46a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-mtrace_2.20.bb
@@ -0,0 +1 @@
require glibc-mtrace.inc
diff --git a/meta/recipes-core/glibc/glibc-options.inc b/meta/recipes-core/glibc/glibc-options.inc
new file mode 100644
index 0000000000..9fd27f32f9
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-options.inc
@@ -0,0 +1,162 @@
1def glibc_cfg(feature, tokens, cnf):
2 if type(tokens) == type(""):
3 tokens = [tokens]
4 if feature:
5 cnf.extend([token + '=y' for token in tokens])
6 else:
7 for token in tokens:
8 cnf.extend([token + '=n'])
9 if token == 'OPTION_EGLIBC_NSSWITCH':
10 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""])
11 cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""])
12
13# Map distro features to glibc options settings
14def features_to_glibc_settings(d):
15 cnf = ([])
16
17 ipv4 = bb.utils.contains('DISTRO_FEATURES', 'ipv4', True, False, d)
18 ipv6 = bb.utils.contains('DISTRO_FEATURES', 'ipv6', True, False, d)
19 libc_backtrace = bb.utils.contains('DISTRO_FEATURES', 'libc-backtrace', True, False, d)
20 libc_big_macros = bb.utils.contains('DISTRO_FEATURES', 'libc-big-macros', True, False, d)
21 libc_bsd = bb.utils.contains('DISTRO_FEATURES', 'libc-bsd', True, False, d)
22 libc_cxx_tests = bb.utils.contains('DISTRO_FEATURES', 'libc-cxx-tests', True, False, d)
23 libc_catgets = bb.utils.contains('DISTRO_FEATURES', 'libc-catgets', True, False, d)
24 libc_charsets = bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d)
25 libc_crypt = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt', True, False, d)
26 libc_crypt_ufc = bb.utils.contains('DISTRO_FEATURES', 'libc-crypt-ufc', True, False, d)
27 libc_db_aliases = bb.utils.contains('DISTRO_FEATURES', 'libc-db-aliases', True, False, d)
28 libc_envz = bb.utils.contains('DISTRO_FEATURES', 'libc-envz', True, False, d)
29 libc_fcvt = bb.utils.contains('DISTRO_FEATURES', 'libc-fcvt', True, False, d)
30 libc_fmtmsg = bb.utils.contains('DISTRO_FEATURES', 'libc-fmtmsg', True, False, d)
31 libc_fstab = bb.utils.contains('DISTRO_FEATURES', 'libc-fstab', True, False, d)
32 libc_ftraverse = bb.utils.contains('DISTRO_FEATURES', 'libc-ftraverse', True, False, d)
33 libc_getlogin = bb.utils.contains('DISTRO_FEATURES', 'libc-getlogin', True, False, d)
34 libc_idn = bb.utils.contains('DISTRO_FEATURES', 'libc-idn', True, False, d)
35 libc_inet_anl = bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', True, False, d)
36 libc_libm = bb.utils.contains('DISTRO_FEATURES', 'libc-libm', True, False, d)
37 libc_locales = bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d)
38 libc_locale_code = bb.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d)
39 libc_memusage = bb.utils.contains('DISTRO_FEATURES', 'libc-memusage', True, False, d)
40 libc_nis = bb.utils.contains('DISTRO_FEATURES', 'libc-nis', True, False, d)
41 libc_nsswitch = bb.utils.contains('DISTRO_FEATURES', 'libc-nsswitch', True, False, d)
42 libc_rcmd = bb.utils.contains('DISTRO_FEATURES', 'libc-rcmd', True, False, d)
43 libc_rtld_debug = bb.utils.contains('DISTRO_FEATURES', 'libc-rtld-debug', True, False, d)
44 libc_spawn = bb.utils.contains('DISTRO_FEATURES', 'libc-spawn', True, False, d)
45 libc_streams = bb.utils.contains('DISTRO_FEATURES', 'libc-streams', True, False, d)
46 libc_sunrpc = bb.utils.contains('DISTRO_FEATURES', 'libc-sunrpc', True, False, d)
47 libc_utmp = bb.utils.contains('DISTRO_FEATURES', 'libc-utmp', True, False, d)
48 libc_utmpx = bb.utils.contains('DISTRO_FEATURES', 'libc-utmpx', True, False, d)
49 libc_wordexp = bb.utils.contains('DISTRO_FEATURES', 'libc-wordexp', True, False, d)
50 libc_posix_clang_wchar = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', True, False, d)
51 libc_posix_regexp = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp', True, False, d)
52 libc_posix_regexp_glibc = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d)
53 libc_posix_wchar_io = bb.utils.contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d)
54
55 # arrange the dependencies among glibc configuable options according to file option-groups.def from glibc source code
56 new_dep = True
57 while new_dep:
58 new_dep = False
59
60 if ipv6 and not ipv4:
61 new_dep = True
62 ipv4 = True
63
64 if ipv4 and not libc_nsswitch:
65 new_dep = True
66 libc_nsswitch = True
67
68 if libc_cxx_tests:
69 if not libc_posix_wchar_io:
70 new_dep = True
71 libc_posix_wchar_io = True
72 if not libc_libm:
73 new_dep = True
74 libc_libm = True
75
76 if libc_catgets and not libc_locale_code:
77 new_dep = True
78 libc_locale_code = True
79
80 if libc_crypt_ufc and not libc_crypt:
81 new_dep = True
82 libc_crypt = True
83
84 if libc_getlogin and not libc_utmp:
85 new_dep = True
86 libc_utmp = True
87
88 if libc_inet_anl and not ipv4:
89 new_dep = True
90 ipv4 = True
91
92 if libc_locale_code and not libc_posix_clang_wchar:
93 new_dep = True
94 libc_posix_clang_wchar = True
95
96 if libc_nis:
97 if not ipv4:
98 new_dep = True
99 ipv4 = True
100 if not libc_sunrpc:
101 new_dep = True
102 libc_sunrpc = True
103
104 if libc_rcmd and not ipv4:
105 new_dep = True
106 ipv4 = True
107
108 if libc_sunrpc and not ipv4:
109 new_dep = True
110 ipv4 = True
111
112 if libc_utmpx and not libc_utmp:
113 new_dep = True
114 libc_utmp = True
115
116 if libc_posix_regexp_glibc and not libc_posix_regexp:
117 new_dep = True
118 libc_posix_regexp = True
119
120 if libc_posix_wchar_io and not libc_posix_clang_wchar:
121 new_dep = True
122 libc_posix_clang_wchar = True
123
124 glibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf)
125 glibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf)
126 glibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf)
127 glibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf)
128 glibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf)
129 glibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf)
130 glibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf)
131 glibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf)
132 glibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf)
133 glibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf)
134 glibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf)
135 glibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf)
136 glibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf)
137 glibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf)
138 glibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf)
139 glibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf)
140 glibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf)
141 glibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf)
142 glibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf)
143 glibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf)
144 glibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf)
145 glibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf)
146 glibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf)
147 glibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf)
148 glibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf)
149 glibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf)
150 glibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf)
151 glibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf)
152 glibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf)
153 glibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf)
154 glibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf)
155 glibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf)
156 glibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf)
157 glibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf)
158 glibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf)
159 glibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf)
160 glibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf)
161
162 return "\n".join(cnf)
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
new file mode 100644
index 0000000000..6212e5b38e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -0,0 +1,158 @@
1#
2# For now, we will skip building of a gcc package if it is a uclibc one
3# and our build is not a uclibc one, and we skip a glibc one if our build
4# is a uclibc build.
5#
6# See the note in gcc/gcc_3.4.0.oe
7#
8
9python __anonymous () {
10 import bb, re
11 uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS', True)) != None)
12 if uc_os:
13 raise bb.parse.SkipPackage("incompatible with target %s" %
14 d.getVar('TARGET_OS', True))
15}
16
17# Set this to zero if you don't want ldconfig in the output package
18USE_LDCONFIG ?= "1"
19
20PACKAGES = "${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"
21
22# The ld.so in this glibc supports the GNU_HASH
23RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
24RPROVIDES_${PN}-utils = "eglibc-utils"
25RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace"
26RPROVIDES_${PN}-pic = "eglibc-pic"
27RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
28RPROVIDES_${PN}-staticdev = "eglibc-staticdev"
29RPROVIDES_${PN}-doc = "eglibc-doc"
30RPROVIDES_glibc-extra-nss = "eglibc-extra-nss"
31RPROVIDES_glibc-thread-db = "eglibc-thread-db"
32RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile"
33RPROVIDES_${PN}-dbg = "eglibc-dbg"
34libc_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}/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"
35
36FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}"
37FILES_ldd = "${bindir}/ldd"
38FILES_libsegfault = "${base_libdir}/libSegFault*"
39FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
40FILES_libmemusage = "${base_libdir}/libmemusage.so"
41FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
42FILES_sln = "${base_sbindir}/sln"
43FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
44FILES_libsotruss = "${libdir}/audit/sotruss-lib.so"
45FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
46FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
47FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
48FILES_nscd = "${sbindir}/nscd*"
49FILES_${PN}-mtrace = "${bindir}/mtrace"
50FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump"
51FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
52FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/audit/.debug"
53FILES_catchsegv = "${bindir}/catchsegv"
54RDEPENDS_catchsegv = "libsegfault"
55FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
56FILES_glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
57RPROVIDES_${PN}-dev += "libc-dev"
58RPROVIDES_${PN}-staticdev += "libc-staticdev"
59
60SUMMARY_sln = "The static ln"
61DESCRIPTION_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."
62SUMMARY_nscd = "Name service cache daemon"
63DESCRIPTION_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."
64SUMMARY_glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
65DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
66SUMMARY_ldd = "print shared library dependencies"
67DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
68SUMMARY_${PN}-utils = "Miscellaneous utilities provided by glibc"
69DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, rpcgen, ..."
70DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs"
71DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect"
72
73inherit libc-common multilib_header
74
75do_install_append () {
76 rm -f ${D}${sysconfdir}/localtime
77 rm -rf ${D}${localstatedir}
78
79 # remove empty glibc dir
80 if [ -d ${D}${libdir}/glibc -a ! -e ${D}${libdir}/glibc/pt_chown ]; then
81 rmdir ${D}${libdir}/glibc
82 fi
83 oe_multilib_header bits/syscall.h
84
85 if [ -f ${D}${bindir}/mtrace ]; then
86 sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace
87 fi
88 rm -rf ${D}${includedir}/rpcsvc/rquota*
89 # Info dir listing isn't interesting at this point so remove it if it exists.
90 if [ -e "${D}${infodir}/dir" ]; then
91 rm -f ${D}${infodir}/dir
92 fi
93
94 if [ "${USE_LDCONFIG}" != "1" ]; then
95 # We won't ship these files (see FILES above) so let's not install them
96 rm -f ${D}${sysconfdir}/ld.so.conf
97 rm -f ${D}${base_sbindir}/ldconfig
98 # This directory will be empty now so remove it too.
99 # But check whether it exists first, since it won't for glibc-initial.
100 if [ -d ${D}${sysconfdir} ]; then
101 rmdir ${D}${sysconfdir}
102 fi
103 fi
104}
105
106do_install_locale () {
107 dest=${D}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
108 install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir}
109 if [ "${base_libdir}" != "${libdir}" ]; then
110 cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir}
111 fi
112 if [ -e ${D}${bindir}/localedef ]; then
113 mv -f ${D}${bindir}/localedef ${dest}${bindir}
114 fi
115 if [ -e ${D}${libdir}/gconv ]; then
116 mv -f ${D}${libdir}/gconv ${dest}${libdir}
117 fi
118 if [ -e ${D}${exec_prefix}/lib ]; then
119 cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix}
120 fi
121 if [ -e ${D}${datadir}/i18n ]; then
122 mv ${D}${datadir}/i18n ${dest}${datadir}
123 fi
124 cp -fpPR ${D}${datadir}/* ${dest}${datadir}
125 rm -rf ${D}${datadir}/locale/
126 cp -fpPR ${WORKDIR}/SUPPORTED ${dest}
127}
128
129addtask do_install_locale after do_install before do_populate_sysroot do_package
130
131bashscripts = "mtrace sotruss xtrace"
132
133do_evacuate_scripts () {
134 target=${D}${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
135 mkdir -p $target
136 for i in ${bashscripts}; do
137 if [ -f ${D}${bindir}/$i ]; then
138 cp ${D}${bindir}/$i $target/
139 fi
140 done
141}
142
143addtask evacuate_scripts after do_install before do_populate_sysroot do_package
144
145PACKAGE_PREPROCESS_FUNCS += "glibc_package_preprocess"
146
147glibc_package_preprocess () {
148 rm -rf ${PKGD}/${includedir}/glibc-locale-internal-${MULTIMACH_TARGET_SYS}
149 rm -rf ${PKGD}/${includedir}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}
150 for i in ${bashscripts}; do
151 rm -f ${PKGD}${bindir}/$i
152 done
153 rm -rf ${PKGD}/${localedir}
154 if [ "${libdir}" != "${exec_prefix}/lib" ]; then
155 # This dir only exists to hold locales
156 rm -rf ${PKGD}${exec_prefix}/lib
157 fi
158}
diff --git a/meta/recipes-core/glibc/glibc-scripts.inc b/meta/recipes-core/glibc/glibc-scripts.inc
new file mode 100644
index 0000000000..3a06773d66
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-scripts.inc
@@ -0,0 +1,16 @@
1include glibc-collateral.inc
2
3SUMMARY = "utility scripts provided by glibc"
4DESCRIPTION = "utility scripts provided by glibc"
5RDEPENDS_${PN} = "bash glibc-mtrace"
6
7SRC = "${STAGING_INCDIR}/glibc-scripts-internal-${MULTIMACH_TARGET_SYS}"
8
9bashscripts = "sotruss xtrace"
10
11do_install() {
12 install -d -m 0755 ${D}${bindir}
13 for i in ${bashscripts}; do
14 install -m 0755 ${SRC}/$i ${D}${bindir}/
15 done
16}
diff --git a/meta/recipes-core/glibc/glibc-scripts_2.20.bb b/meta/recipes-core/glibc/glibc-scripts_2.20.bb
new file mode 100644
index 0000000000..5a89bd8022
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-scripts_2.20.bb
@@ -0,0 +1 @@
require glibc-scripts.inc
diff --git a/meta/recipes-core/glibc/glibc-testing.inc b/meta/recipes-core/glibc/glibc-testing.inc
new file mode 100644
index 0000000000..ec16fe1fde
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc-testing.inc
@@ -0,0 +1,79 @@
1do_compile_append () {
2 # now generate script to drive testing
3 echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testglibc
4 set >> ${B}/${HOST_PREFIX}testglibc
5 # prune out the unneeded vars
6 sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testglibc
7 sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testglibc
8 sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testglibc
9 sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testglibc
10 sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testglibc
11 sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testglibc
12 sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testglibc
13 sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testglibc
14 sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testglibc
15 sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testglibc
16 sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testglibc
17 sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testglibc
18 sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testglibc
19 sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testglibc
20 sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testglibc
21 sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testglibc
22 sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testglibc
23 sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testglibc
24 sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testglibc
25 sed -i -e "/^PATCH_GET/d" ${B}/${HOST_PREFIX}testglibc
26 sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testglibc
27 sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testglibc
28 sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testglibc
29 sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testglibc
30 sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testglibc
31 sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testglibc
32 sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testglibc
33 sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testglibc
34 sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testglibc
35
36 # point to real sysroot not the toolchain bootstrap sysroot
37 sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testglibc
38
39 # use the final cross-gcc to test since some tests need libstdc++
40 sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testglibc
41
42 # append execution part script
43cat >> ${B}/${HOST_PREFIX}testglibc << STOP
44target="\$1"
45if [ "x\$target" = "x" ]
46then
47 echo "Please specify the target machine and remote user in form of user@target"
48 exit 1;
49fi
50ssh \$target ls \$PWD\ 2>&1 > /dev/null
51if [ "x\$?" != "x0" ]
52then
53 echo "Failed connecting to \$target it could be because of:"
54 echo "1. You dont have passwordless ssh setup to access \$target"
55 echo "2. NFS share on \$target is not mounted or if mounted then not matching the build tree layout."
56 echo " The tree should be accessible at same location on build host and target"
57 echo " You can add nfs-server to IMAGE_FEATURES to get the nfs client on target"
58 echo "3. nfs server on build host is not running."
59 echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want"
60 echo " to test as root user on target (usually its recommended to create a non"
61 echo " root user."
62 echo " As a sanity check make sure that target can read/write to the glibc build tree"
63 echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup"
64 exit 1
65fi
66 echo "# we test using cross compiler from real sysroot therefore override the" > ${B}/configparms
67 echo "# definitions that come from ${B}/config.make" >> ${B}/configparms
68
69 fgrep tcbootstrap ${B}/config.make > ${B}/configparms
70 sed -i -e "s/\-tcbootstrap//g" ${B}/configparms
71wrapper="${S}/scripts/cross-test-ssh.sh \$target"
72localedef="${STAGING_BINDIR_NATIVE}/cross-localedef --little-endian --uint32-align=4"
73make tests-clean
74make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check
75rm -rf ${B}/configparms
76STOP
77
78 chmod +x ${B}/${HOST_PREFIX}testglibc
79}
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
new file mode 100644
index 0000000000..8aa78dfb34
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -0,0 +1,92 @@
1require glibc-common.inc
2require glibc-ld.inc
3require glibc-testing.inc
4
5STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
8
9TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
10
11# glibc can't be built without optimization, if someone tries to compile an
12# entire image as -O0, we override it with -O2 here and give a note about it.
13def get_optimization(d):
14 selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
15 if bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
16 bb.note("glibc can't be built with -O0, -O2 will be used instead.")
17 return selected_optimization.replace("-O0", "-O2")
18 return selected_optimization
19
20SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
21
22# siteconfig.bbclass runs configure which needs a working compiler
23# For the compiler to work we need a working libc yet libc isn't
24# in the sysroots directory at this point. This means the libc.so
25# linker script won't work as the --sysroot setting isn't correct.
26# Here we create a hacked up libc linker script and pass in the right
27# flags to let configure work. Ugly.
28EXTRASITECONFIG = "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}'"
29siteconfig_do_siteconfig_gencache_prepend = " \
30 mkdir -p ${WORKDIR}/site_config_libc; \
31 cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
32 sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
33"
34
35# nptl needs unwind support in gcc, which can't be built without glibc.
36DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial"
37# nptl needs libgcc but dlopens it, so our shlibs code doesn't detect this
38#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}"
39PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
40PROVIDES += "virtual/libintl virtual/libiconv"
41inherit autotools texinfo distro_features_check
42require glibc-options.inc
43
44# The main purpose of setting this variable is to prevent users from accidently
45# overriding DISTRO_FEATRUES, causing obscure build failures because of lack
46# of libc functions.
47REQUIRED_DISTRO_FEATURES = "${DISTRO_FEATURES_LIBC}"
48
49LEAD_SONAME = "libc.so"
50
51CACHED_CONFIGUREVARS += " \
52 ac_cv_path_KSH=${base_bindir}/bash \
53 ac_cv_path_BASH_SHELL=${base_bindir}/bash \
54 libc_cv_slibdir=${base_libdir} \
55 libc_cv_rootsbindir=${base_sbindir} \
56 libc_cv_localedir=${localedir} \
57 libc_cv_ssp=no \
58"
59
60GLIBC_EXTRA_OECONF ?= ""
61GLIBC_EXTRA_OECONF_class-nativesdk = ""
62INHIBIT_DEFAULT_DEPS = "1"
63
64ARM_INSTRUCTION_SET = "arm"
65
66# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
67# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
68EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
69EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
70EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
71PARALLEL_MAKE = ""
72
73# glibc make-syscalls.sh has a number of issues with /bin/dash and
74# it's output which make calls via the SHELL also has issues, so
75# ensure make uses /bin/bash
76EXTRA_OEMAKE += "SHELL=/bin/bash"
77
78OE_FEATURES = "${@features_to_glibc_settings(d)}"
79do_configure_prepend() {
80 sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
81 echo '${OE_FEATURES}' > ${B}/option-groups.config
82}
83
84do_configure_append() {
85 oe_runmake config
86
87 # Remove quotation marks from OPTION_EGLIBC_NSSWITCH_FIXED_*. This will
88 # avoid install error.
89 sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config
90}
91
92GLIBC_ADDONS ?= "nptl,libidn"
diff --git a/meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch b/meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch
new file mode 100644
index 0000000000..3922cb818f
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-R_ARM_TLS_DTPOFF32.patch
@@ -0,0 +1,56 @@
1
2Quote from bug 1443 which explains what the patch does :
3
4 We build some random program and link it with -lust. When we run it,
5 it dies with a SIGSEGV before reaching main().
6
7 Libust.so depends on liburcu-bp.so from the usermode-rcu package.
8 Although libust.so is not prelinked, liburcu-bp.so IS prelinked; this
9 is critical.
10
11 Libust.so uses a TLS / __thread variable that is defined in liburcu-
12 bp.so. There are special ARM-specific relocation types that allow two
13 shared libraries to share thread-specific data. This is critical too.
14
15 One more critical issue: although liburcu-bp.so is prelinked, we can't
16 load it at its prelinked address, because we also link against
17 librt.so, and librt.so uses that address.
18
19 The dynamic linker is forced to relink liburcu-bp.so at a different
20 address. In the course of relinking, it processes the special ARM
21 relocation record mentioned above. The prelinker has already filled
22 in the information, which is a short offset into a table of thread-
23 specific data that is allocated per-thread for each library that uses
24 TLS. Because the normal behavior of a relocation is to add the symbol
25 value to an addend stored at the address being relocated, we end up
26 adding the short offset to itself, doubling it.
27
28 Now we have an awkward situation. The libust.so library doesn't know
29 about the addend, so its TLS data for this element is correct. The
30 liburcu-bp.so library has a different offset for the element. When we
31 go to initialize the element for the first time in liburcu-bp.so, we
32 write the address of the result at the doubled (broken) offset.
33 Later, when we refer to the address from libust.so, we check the value
34 at the correct offset, but it's NULL, so we eat hot SIGSEGV.
35
36Upstream-Status: Pending
37
38Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
39---
40 .../libc/ports/sysdeps/arm/dl-machine.h | 2 +-
41 1 file changed, 1 insertion(+), 1 deletion(-)
42
43ndex 8d905e8..dcfa71e 100644
44Index: git/sysdeps/arm/dl-machine.h
45===================================================================
46--- git.orig/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.748070587 +0000
47+++ git/sysdeps/arm/dl-machine.h 2014-08-27 05:30:47.740070587 +0000
48@@ -495,7 +495,7 @@
49
50 case R_ARM_TLS_DTPOFF32:
51 if (sym != NULL)
52- *reloc_addr += sym->st_value;
53+ *reloc_addr = sym->st_value;
54 break;
55
56 case R_ARM_TLS_TPOFF32:
diff --git a/meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
new file mode 100644
index 0000000000..f341282ffb
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch
@@ -0,0 +1,33 @@
1From 713d822908d1b2ae8403af7f9375c7054ed3dd49 Mon Sep 17 00:00:00 2001
2From: Ting Liu <b28495@freescale.com>
3Date: Wed, 19 Dec 2012 04:39:57 -0600
4Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S}
5
6libm-err-tab.pl will parse all the files named "libm-test-ulps"
7in the given dir recursively. To avoid parsing the one in
8${S}/.pc/ (it does exist after eglibc adds aarch64 support,
9${S}/.pc/aarch64-0001-glibc-fsf-v1-eaf6f205.patch/ports/sysdeps/
10aarch64/libm-test-ulps), run libm-err-tab.pl with specific dirs
11in ${S}.
12
13Upstream-Status: inappropriate [OE specific]
14
15Signed-off-by: Ting Liu <b28495@freescale.com>
16---
17 manual/Makefile | 3 ++-
18 1 file changed, 2 insertions(+), 1 deletion(-)
19
20Index: git/manual/Makefile
21===================================================================
22--- git.orig/manual/Makefile 2014-08-29 10:35:18.728070587 -0700
23+++ git/manual/Makefile 2014-08-29 10:35:18.720070587 -0700
24@@ -105,7 +105,8 @@
25 $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\
26 $(dir)/libm-test-ulps))
27 pwd=`pwd`; \
28- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp
29+ $(PERL) $< $$pwd/../ports > $(objpfx)libm-err-tmp
30+ $(PERL) $< $$pwd/../sysdeps >> $(objpfx)libm-err-tmp
31 $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi
32 touch $@
33
diff --git a/meta/recipes-core/glibc/glibc/CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch b/meta/recipes-core/glibc/glibc/CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch
new file mode 100644
index 0000000000..92b85014b3
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch
@@ -0,0 +1,339 @@
1From a5357b7ce2a2982c5778435704bcdb55ce3667a0 Mon Sep 17 00:00:00 2001
2From: Jeff Law <law@redhat.com>
3Date: Mon, 15 Dec 2014 10:09:32 +0100
4Subject: [PATCH] CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
5
6A larger number of format specifiers coudld cause a stack overflow,
7potentially allowing to bypass _FORTIFY_SOURCE format string
8protection.
9---
10 ChangeLog | 9 +++++++
11 NEWS | 13 +++++----
12 stdio-common/Makefile | 2 +-
13 stdio-common/bug23-2.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
14 stdio-common/bug23-3.c | 50 +++++++++++++++++++++++++++++++++++
15 stdio-common/bug23-4.c | 31 ++++++++++++++++++++++
16 stdio-common/vfprintf.c | 40 ++++++++++++++++++++++++++--
17 7 files changed, 207 insertions(+), 8 deletions(-)
18 create mode 100644 stdio-common/bug23-2.c
19 create mode 100644 stdio-common/bug23-3.c
20 create mode 100644 stdio-common/bug23-4.c
21
22Index: git/ChangeLog
23===================================================================
24--- git.orig/ChangeLog
25+++ git/ChangeLog
26@@ -1,3 +1,12 @@
27+2014-12-15 Jeff Law <law@redhat.com>
28+
29+ [BZ #16617]
30+ * stdio-common/vfprintf.c (vfprintf): Allocate large specs array
31+ on the heap. (CVE-2012-3406)
32+ * stdio-common/bug23-2.c, stdio-common/bug23-3.c: New file.
33+ * stdio-common/bug23-4.c: New file. Test case by Joseph Myers.
34+ * stdio-common/Makefile (tests): Add bug23-2, bug23-3, bug23-4.
35+
36 2014-11-19 Carlos O'Donell <carlos@redhat.com>
37 Florian Weimer <fweimer@redhat.com>
38 Joseph Myers <joseph@codesourcery.com>
39Index: git/NEWS
40===================================================================
41--- git.orig/NEWS
42+++ git/NEWS
43@@ -13,24 +13,28 @@ Version 2.20
44 15698, 15804, 15894, 15946, 16002, 16064, 16095, 16194, 16198, 16275,
45 16284, 16287, 16315, 16348, 16349, 16354, 16357, 16362, 16447, 16516,
46 16532, 16539, 16545, 16561, 16562, 16564, 16574, 16599, 16600, 16609,
47- 16610, 16611, 16613, 16619, 16623, 16629, 16632, 16634, 16639, 16642,
48- 16648, 16649, 16670, 16674, 16677, 16680, 16681, 16683, 16689, 16695,
49- 16701, 16706, 16707, 16712, 16713, 16714, 16724, 16731, 16739, 16740,
50- 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789, 16791, 16796,
51- 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16839, 16849, 16854,
52- 16876, 16877, 16878, 16882, 16885, 16888, 16890, 16892, 16912, 16915,
53- 16916, 16917, 16918, 16922, 16927, 16928, 16932, 16943, 16958, 16965,
54- 16966, 16967, 16977, 16978, 16984, 16990, 16996, 17009, 17022, 17031,
55- 17042, 17048, 17050, 17058, 17061, 17062, 17069, 17075, 17078, 17079,
56- 17084, 17086, 17088, 17092, 17097, 17125, 17135, 17137, 17150, 17153,
57- 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354, 17625.
58-
59+ 16610, 16611, 16613, 16617, 16619, 16623, 16629, 16632, 16634, 16639,
60+ 16642, 16648, 16649, 16670, 16674, 16677, 16680, 16681, 16683, 16689,
61+ 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16724, 16731, 16739,
62+ 16740, 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789, 16791,
63+ 16796, 16799, 16800, 16815, 16823, 16824, 16831, 16838, 16839, 16849,
64+ 16854, 16876, 16877, 16878, 16882, 16885, 16888, 16890, 16892, 16912,
65+ 16915, 16916, 16917, 16918, 16922, 16927, 16928, 16932, 16943, 16958,
66+ 16965, 16966, 16967, 16977, 16978, 16984, 16990, 16996, 17009, 17022,
67+ 17031, 17042, 17048, 17050, 17058, 17061, 17062, 17069, 17075, 17078,
68+ 17079, 17084, 17086, 17088, 17092, 17097, 17125, 17135, 17137, 17150,
69+ 17153, 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354,
70+ 17625.
71+
72 * CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
73 under certain input conditions resulting in the execution of a shell for
74 command substitution when the applicaiton did not request it. The
75 implementation now checks WRDE_NOCMD immediately before executing the
76 shell and returns the error WRDE_CMDSUB as expected.
77
78+* CVE-2012-3406 printf-style functions could run into a stack overflow when
79+ processing format strings with a large number of format specifiers.
80+
81 * Reverted change of ABI data structures for s390 and s390x:
82 On s390 and s390x the size of struct ucontext and jmp_buf was increased in
83 2.19. This change is reverted in 2.20. The introduced 2.19 symbol versions
84Index: git/stdio-common/bug23-2.c
85===================================================================
86--- /dev/null
87+++ git/stdio-common/bug23-2.c
88@@ -0,0 +1,70 @@
89+#include <stdio.h>
90+#include <string.h>
91+#include <stdlib.h>
92+
93+static const char expected[] = "\
94+\n\
95+a\n\
96+abbcd55\
97+\n\
98+a\n\
99+abbcd55\
100+\n\
101+a\n\
102+abbcd55\
103+\n\
104+a\n\
105+abbcd55\
106+\n\
107+a\n\
108+abbcd55\
109+\n\
110+a\n\
111+abbcd55\
112+\n\
113+a\n\
114+abbcd55\
115+\n\
116+a\n\
117+abbcd55\
118+\n\
119+a\n\
120+abbcd55\
121+\n\
122+a\n\
123+abbcd55\
124+\n\
125+a\n\
126+abbcd55\
127+\n\
128+a\n\
129+abbcd55\
130+\n\
131+a\n\
132+abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
133+
134+static int
135+do_test (void)
136+{
137+ char *buf = malloc (strlen (expected) + 1);
138+ snprintf (buf, strlen (expected) + 1,
139+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
140+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
141+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
142+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
143+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
144+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
145+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
146+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
147+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
148+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
149+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
150+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
151+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
152+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
153+ "a", "b", "c", "d", 5);
154+ return strcmp (buf, expected) != 0;
155+}
156+
157+#define TEST_FUNCTION do_test ()
158+#include "../test-skeleton.c"
159Index: git/stdio-common/bug23-3.c
160===================================================================
161--- /dev/null
162+++ git/stdio-common/bug23-3.c
163@@ -0,0 +1,50 @@
164+#include <stdio.h>
165+#include <string.h>
166+#include <stdlib.h>
167+
168+int
169+do_test (void)
170+{
171+ size_t instances = 16384;
172+#define X0 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
173+ const char *item = "\na\nabbcd55";
174+#define X3 X0 X0 X0 X0 X0 X0 X0 X0
175+#define X6 X3 X3 X3 X3 X3 X3 X3 X3
176+#define X9 X6 X6 X6 X6 X6 X6 X6 X6
177+#define X12 X9 X9 X9 X9 X9 X9 X9 X9
178+#define X14 X12 X12 X12 X12
179+#define TRAILER "%%%%%%%%%%%%%%%%%%%%%%%%%%"
180+#define TRAILER2 TRAILER TRAILER
181+ size_t length = instances * strlen (item) + strlen (TRAILER) + 1;
182+
183+ char *buf = malloc (length + 1);
184+ snprintf (buf, length + 1,
185+ X14 TRAILER2 "\n",
186+ "a", "b", "c", "d", 5);
187+
188+ const char *p = buf;
189+ size_t i;
190+ for (i = 0; i < instances; ++i)
191+ {
192+ const char *expected;
193+ for (expected = item; *expected; ++expected)
194+ {
195+ if (*p != *expected)
196+ {
197+ printf ("mismatch at offset %zu (%zu): expected %d, got %d\n",
198+ (size_t) (p - buf), i, *expected & 0xFF, *p & 0xFF);
199+ return 1;
200+ }
201+ ++p;
202+ }
203+ }
204+ if (strcmp (p, TRAILER "\n") != 0)
205+ {
206+ printf ("mismatch at trailer: [%s]\n", p);
207+ return 1;
208+ }
209+ free (buf);
210+ return 0;
211+}
212+#define TEST_FUNCTION do_test ()
213+#include "../test-skeleton.c"
214Index: git/stdio-common/bug23-4.c
215===================================================================
216--- /dev/null
217+++ git/stdio-common/bug23-4.c
218@@ -0,0 +1,31 @@
219+#include <stdio.h>
220+#include <stdlib.h>
221+#include <string.h>
222+#include <sys/resource.h>
223+
224+#define LIMIT 1000000
225+
226+int
227+main (void)
228+{
229+ struct rlimit lim;
230+ getrlimit (RLIMIT_STACK, &lim);
231+ lim.rlim_cur = 1048576;
232+ setrlimit (RLIMIT_STACK, &lim);
233+ char *fmtstr = malloc (4 * LIMIT + 1);
234+ if (fmtstr == NULL)
235+ abort ();
236+ char *output = malloc (LIMIT + 1);
237+ if (output == NULL)
238+ abort ();
239+ for (size_t i = 0; i < LIMIT; i++)
240+ memcpy (fmtstr + 4 * i, "%1$d", 4);
241+ fmtstr[4 * LIMIT] = '\0';
242+ int ret = snprintf (output, LIMIT + 1, fmtstr, 0);
243+ if (ret != LIMIT)
244+ abort ();
245+ for (size_t i = 0; i < LIMIT; i++)
246+ if (output[i] != '0')
247+ abort ();
248+ return 0;
249+}
250Index: git/stdio-common/vfprintf.c
251===================================================================
252--- git.orig/stdio-common/vfprintf.c
253+++ git/stdio-common/vfprintf.c
254@@ -276,6 +276,12 @@ vfprintf (FILE *s, const CHAR_T *format,
255 /* For the argument descriptions, which may be allocated on the heap. */
256 void *args_malloced = NULL;
257
258+ /* For positional argument handling. */
259+ struct printf_spec *specs;
260+
261+ /* Track if we malloced the SPECS array and thus must free it. */
262+ bool specs_malloced = false;
263+
264 /* This table maps a character into a number representing a
265 class. In each step there is a destination label for each
266 class. */
267@@ -1699,8 +1705,8 @@ do_positional:
268 size_t nspecs = 0;
269 /* A more or less arbitrary start value. */
270 size_t nspecs_size = 32 * sizeof (struct printf_spec);
271- struct printf_spec *specs = alloca (nspecs_size);
272
273+ specs = alloca (nspecs_size);
274 /* The number of arguments the format string requests. This will
275 determine the size of the array needed to store the argument
276 attributes. */
277@@ -1743,11 +1749,39 @@ do_positional:
278 if (nspecs * sizeof (*specs) >= nspecs_size)
279 {
280 /* Extend the array of format specifiers. */
281+ if (nspecs_size * 2 < nspecs_size)
282+ {
283+ __set_errno (ENOMEM);
284+ done = -1;
285+ goto all_done;
286+ }
287 struct printf_spec *old = specs;
288- specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
289+ if (__libc_use_alloca (2 * nspecs_size))
290+ specs = extend_alloca (specs, nspecs_size, 2 * nspecs_size);
291+ else
292+ {
293+ nspecs_size *= 2;
294+ specs = malloc (nspecs_size);
295+ if (specs == NULL)
296+ {
297+ __set_errno (ENOMEM);
298+ specs = old;
299+ done = -1;
300+ goto all_done;
301+ }
302+ }
303
304 /* Copy the old array's elements to the new space. */
305 memmove (specs, old, nspecs * sizeof (*specs));
306+
307+ /* If we had previously malloc'd space for SPECS, then
308+ release it after the copy is complete. */
309+ if (specs_malloced)
310+ free (old);
311+
312+ /* Now set SPECS_MALLOCED if needed. */
313+ if (!__libc_use_alloca (nspecs_size))
314+ specs_malloced = true;
315 }
316
317 /* Parse the format specifier. */
318@@ -2068,6 +2102,8 @@ do_positional:
319 }
320
321 all_done:
322+ if (specs_malloced)
323+ free (specs);
324 if (__glibc_unlikely (args_malloced != NULL))
325 free (args_malloced);
326 if (__glibc_unlikely (workstart != NULL))
327Index: git/stdio-common/Makefile
328===================================================================
329--- git.orig/stdio-common/Makefile
330+++ git/stdio-common/Makefile
331@@ -66,7 +66,7 @@ tests := tstscanf test_rdwr test-popen t
332 tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
333 bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
334 tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tst-sprintf3 bug25 \
335- tst-printf-round bug26
336+ tst-printf-round bug23-2 bug23-3 bug23-4
337
338 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
339 += tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
diff --git a/meta/recipes-core/glibc/glibc/CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch b/meta/recipes-core/glibc/glibc/CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch
new file mode 100644
index 0000000000..9bfea10623
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch
@@ -0,0 +1,215 @@
1From a39208bd7fb76c1b01c127b4c61f9bfd915bfe7c Mon Sep 17 00:00:00 2001
2From: Carlos O'Donell <carlos@redhat.com>
3Date: Wed, 19 Nov 2014 11:44:12 -0500
4Subject: [PATCH] CVE-2014-7817: wordexp fails to honour WRDE_NOCMD.
5
6The function wordexp() fails to properly handle the WRDE_NOCMD
7flag when processing arithmetic inputs in the form of "$((... ``))"
8where "..." can be anything valid. The backticks in the arithmetic
9epxression are evaluated by in a shell even if WRDE_NOCMD forbade
10command substitution. This allows an attacker to attempt to pass
11dangerous commands via constructs of the above form, and bypass
12the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD
13in exec_comm(), the only place that can execute a shell. All other
14checks for WRDE_NOCMD are superfluous and removed.
15
16We expand the testsuite and add 3 new regression tests of roughly
17the same form but with a couple of nested levels.
18
19On top of the 3 new tests we add fork validation to the WRDE_NOCMD
20testing. If any forks are detected during the execution of a wordexp()
21call with WRDE_NOCMD, the test is marked as failed. This is slightly
22heuristic since vfork might be used in the future, but it provides a
23higher level of assurance that no shells were executed as part of
24command substitution with WRDE_NOCMD in effect. In addition it doesn't
25require libpthread or libdl, instead we use the public implementation
26namespace function __register_atfork (already part of the public ABI
27for libpthread).
28
29Tested on x86_64 with no regressions.
30---
31 ChangeLog | 22 ++++++++++++++++++++++
32 NEWS | 8 +++++++-
33 posix/wordexp-test.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
34 posix/wordexp.c | 16 ++++------------
35 4 files changed, 77 insertions(+), 13 deletions(-)
36
37Index: git/ChangeLog
38===================================================================
39--- git.orig/ChangeLog
40+++ git/ChangeLog
41@@ -1,3 +1,24 @@
42+2014-11-19 Carlos O'Donell <carlos@redhat.com>
43+ Florian Weimer <fweimer@redhat.com>
44+ Joseph Myers <joseph@codesourcery.com>
45+ Adam Conrad <adconrad@0c3.net>
46+ Andreas Schwab <schwab@suse.de>
47+ Brooks <bmoses@google.com>
48+
49+ [BZ #17625]
50+ * wordexp-test.c (__dso_handle): Add prototype.
51+ (__register_atfork): Likewise.
52+ (__app_register_atfork): New function.
53+ (registered_forks): New global.
54+ (register_fork): New function.
55+ (test_case): Add 3 new tests for WRDE_CMDSUB.
56+ (main): Call __app_register_atfork.
57+ (testit): If WRDE_NOCMD set registered_forks to zero, run test, and if
58+ fork count is non-zero fail the test.
59+ * posix/wordexp.c (exec_comm): Return WRDE_CMDSUB if WRDE_NOCMD flag
60+ is set.
61+ (parse_dollars): Remove check for WRDE_NOCMD.
62+
63 2014-09-07 Allan McRae <allan@archlinux.org
64
65 * version.h (RELEASE): Set to "stable".
66Index: git/NEWS
67===================================================================
68--- git.orig/NEWS
69+++ git/NEWS
70@@ -23,7 +23,13 @@ Version 2.20
71 16966, 16967, 16977, 16978, 16984, 16990, 16996, 17009, 17022, 17031,
72 17042, 17048, 17050, 17058, 17061, 17062, 17069, 17075, 17078, 17079,
73 17084, 17086, 17088, 17092, 17097, 17125, 17135, 17137, 17150, 17153,
74- 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354.
75+ 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354, 17625.
76+
77+* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
78+ under certain input conditions resulting in the execution of a shell for
79+ command substitution when the applicaiton did not request it. The
80+ implementation now checks WRDE_NOCMD immediately before executing the
81+ shell and returns the error WRDE_CMDSUB as expected.
82
83 * Reverted change of ABI data structures for s390 and s390x:
84 On s390 and s390x the size of struct ucontext and jmp_buf was increased in
85Index: git/posix/wordexp-test.c
86===================================================================
87--- git.orig/posix/wordexp-test.c
88+++ git/posix/wordexp-test.c
89@@ -27,6 +27,25 @@
90
91 #define IFS " \n\t"
92
93+extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
94+extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
95+
96+static int __app_register_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
97+{
98+ return __register_atfork (prepare, parent, child,
99+ &__dso_handle == NULL ? NULL : __dso_handle);
100+}
101+
102+/* Number of forks seen. */
103+static int registered_forks;
104+
105+/* For each fork increment the fork count. */
106+static void
107+register_fork (void)
108+{
109+ registered_forks++;
110+}
111+
112 struct test_case_struct
113 {
114 int retval;
115@@ -206,6 +225,12 @@ struct test_case_struct
116 { WRDE_SYNTAX, NULL, "$((2+))", 0, 0, { NULL, }, IFS },
117 { WRDE_SYNTAX, NULL, "`", 0, 0, { NULL, }, IFS },
118 { WRDE_SYNTAX, NULL, "$((010+4+))", 0, 0, { NULL }, IFS },
119+ /* Test for CVE-2014-7817. We test 3 combinations of command
120+ substitution inside an arithmetic expression to make sure that
121+ no commands are executed and error is returned. */
122+ { WRDE_CMDSUB, NULL, "$((`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
123+ { WRDE_CMDSUB, NULL, "$((1+`echo 1`))", WRDE_NOCMD, 0, { NULL, }, IFS },
124+ { WRDE_CMDSUB, NULL, "$((1+$((`echo 1`))))", WRDE_NOCMD, 0, { NULL, }, IFS },
125
126 { -1, NULL, NULL, 0, 0, { NULL, }, IFS },
127 };
128@@ -258,6 +283,15 @@ main (int argc, char *argv[])
129 return -1;
130 }
131
132+ /* If we are not allowed to do command substitution, we install
133+ fork handlers to verify that no forks happened. No forks should
134+ happen at all if command substitution is disabled. */
135+ if (__app_register_atfork (register_fork, NULL, NULL) != 0)
136+ {
137+ printf ("Failed to register fork handler.\n");
138+ return -1;
139+ }
140+
141 for (test = 0; test_case[test].retval != -1; test++)
142 if (testit (&test_case[test]))
143 ++fail;
144@@ -367,6 +401,9 @@ testit (struct test_case_struct *tc)
145
146 printf ("Test %d (%s): ", ++tests, tc->words);
147
148+ if (tc->flags & WRDE_NOCMD)
149+ registered_forks = 0;
150+
151 if (tc->flags & WRDE_APPEND)
152 {
153 /* initial wordexp() call, to be appended to */
154@@ -378,6 +415,13 @@ testit (struct test_case_struct *tc)
155 }
156 retval = wordexp (tc->words, &we, tc->flags);
157
158+ if ((tc->flags & WRDE_NOCMD)
159+ && (registered_forks > 0))
160+ {
161+ printf ("FAILED fork called for WRDE_NOCMD\n");
162+ return 1;
163+ }
164+
165 if (tc->flags & WRDE_DOOFFS)
166 start_offs = sav_we.we_offs;
167
168Index: git/posix/wordexp.c
169===================================================================
170--- git.orig/posix/wordexp.c
171+++ git/posix/wordexp.c
172@@ -893,6 +893,10 @@ exec_comm (char *comm, char **word, size
173 pid_t pid;
174 int noexec = 0;
175
176+ /* Do nothing if command substitution should not succeed. */
177+ if (flags & WRDE_NOCMD)
178+ return WRDE_CMDSUB;
179+
180 /* Don't fork() unless necessary */
181 if (!comm || !*comm)
182 return 0;
183@@ -2082,9 +2086,6 @@ parse_dollars (char **word, size_t *word
184 }
185 }
186
187- if (flags & WRDE_NOCMD)
188- return WRDE_CMDSUB;
189-
190 (*offset) += 2;
191 return parse_comm (word, word_length, max_length, words, offset, flags,
192 quoted? NULL : pwordexp, ifs, ifs_white);
193@@ -2196,9 +2197,6 @@ parse_dquote (char **word, size_t *word_
194 break;
195
196 case '`':
197- if (flags & WRDE_NOCMD)
198- return WRDE_CMDSUB;
199-
200 ++(*offset);
201 error = parse_backtick (word, word_length, max_length, words,
202 offset, flags, NULL, NULL, NULL);
203@@ -2357,12 +2355,6 @@ wordexp (const char *words, wordexp_t *p
204 break;
205
206 case '`':
207- if (flags & WRDE_NOCMD)
208- {
209- error = WRDE_CMDSUB;
210- goto do_error;
211- }
212-
213 ++words_offset;
214 error = parse_backtick (&word, &word_length, &max_length, words,
215 &words_offset, flags, pwordexp, ifs,
diff --git a/meta/recipes-core/glibc/glibc/CVE-2014-9402_endless-loop-in-getaddr_r.patch b/meta/recipes-core/glibc/glibc/CVE-2014-9402_endless-loop-in-getaddr_r.patch
new file mode 100644
index 0000000000..ba1da67b76
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2014-9402_endless-loop-in-getaddr_r.patch
@@ -0,0 +1,65 @@
1CVE-2014-9402 endless loop in getaddr_r
2
3
4https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=11e3417af6e354f1942c68a271ae51e892b2814d
5
6Upstream-Status: Backport
7
8Signed-off-by: Armin Kuster <akuster@mvista.com>
9
10From 11e3417af6e354f1942c68a271ae51e892b2814d Mon Sep 17 00:00:00 2001
11From: Florian Weimer <fweimer@redhat.com>
12Date: Mon, 15 Dec 2014 17:41:13 +0100
13Subject: [PATCH] Avoid infinite loop in nss_dns getnetbyname [BZ #17630]
14
15---
16 ChangeLog | 6 ++++++
17 NEWS | 7 +++++--
18 resolv/nss_dns/dns-network.c | 4 ++--
19 3 files changed, 13 insertions(+), 4 deletions(-)
20
21Index: git/NEWS
22===================================================================
23--- git.orig/NEWS
24+++ git/NEWS
25@@ -24,7 +24,10 @@ Version 2.20
26 17031, 17042, 17048, 17050, 17058, 17061, 17062, 17069, 17075, 17078,
27 17079, 17084, 17086, 17088, 17092, 17097, 17125, 17135, 17137, 17150,
28 17153, 17187, 17213, 17259, 17261, 17262, 17263, 17319, 17325, 17354,
29- 17625.
30+ 17625, 17630.
31+
32+* The nss_dns implementation of getnetbyname could run into an infinite loop
33+ if the DNS response contained a PTR record of an unexpected format.
34
35 * CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
36 under certain input conditions resulting in the execution of a shell for
37Index: git/resolv/nss_dns/dns-network.c
38===================================================================
39--- git.orig/resolv/nss_dns/dns-network.c
40+++ git/resolv/nss_dns/dns-network.c
41@@ -398,8 +398,8 @@ getanswer_r (const querybuf *answer, int
42
43 case BYNAME:
44 {
45- char **ap = result->n_aliases++;
46- while (*ap != NULL)
47+ char **ap;
48+ for (ap = result->n_aliases; *ap != NULL; ++ap)
49 {
50 /* Check each alias name for being of the forms:
51 4.3.2.1.in-addr.arpa = net 1.2.3.4
52Index: git/ChangeLog
53===================================================================
54--- git.orig/ChangeLog
55+++ git/ChangeLog
56@@ -1,3 +1,9 @@
57+2014-12-16 Florian Weimer <fweimer@redhat.com>
58+
59+ [BZ #17630]
60+ * resolv/nss_dns/dns-network.c (getanswer_r): Iterate over alias
61+ names.
62+
63 2014-12-15 Jeff Law <law@redhat.com>
64
65 [BZ #16617]
diff --git a/meta/recipes-core/glibc/glibc/CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch b/meta/recipes-core/glibc/glibc/CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch
new file mode 100644
index 0000000000..c02fa127cd
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch
@@ -0,0 +1,43 @@
1From 2959eda9272a033863c271aff62095abd01bd4e3 Mon Sep 17 00:00:00 2001
2From: Arjun Shankar <arjun.is@lostca.se>
3Date: Tue, 21 Apr 2015 14:06:31 +0200
4Subject: [PATCH] CVE-2015-1781: resolv/nss_dns/dns-host.c buffer overflow
5 [BZ#18287]
6
7Upstream-Status: Backport
8https://sourceware.org/bugzilla/show_bug.cgi?id=18287
9---
10 resolv/nss_dns/dns-host.c | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
14index b16b0ddf110907a0086b86612e544d3dc75182b8..d8c55791591750567f00e616e5d7b378dec934a0 100644
15--- a/resolv/nss_dns/dns-host.c
16+++ b/resolv/nss_dns/dns-host.c
17@@ -608,21 +608,22 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
18 int n, ancount, qdcount;
19 int haveanswer, had_error;
20 char *bp, **ap, **hap;
21 char tbuf[MAXDNAME];
22 const char *tname;
23 int (*name_ok) (const char *);
24 u_char packtmp[NS_MAXCDNAME];
25 int have_to_map = 0;
26 uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct host_data);
27 buffer += pad;
28- if (__glibc_unlikely (buflen < sizeof (struct host_data) + pad))
29+ buflen = buflen > pad ? buflen - pad : 0;
30+ if (__glibc_unlikely (buflen < sizeof (struct host_data)))
31 {
32 /* The buffer is too small. */
33 too_small:
34 *errnop = ERANGE;
35 *h_errnop = NETDB_INTERNAL;
36 return NSS_STATUS_TRYAGAIN;
37 }
38 host_data = (struct host_data *) buffer;
39 linebuflen = buflen - sizeof (struct host_data);
40 if (buflen - sizeof (struct host_data) != linebuflen)
41--
422.2.2
43
diff --git a/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch b/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch
new file mode 100644
index 0000000000..e858bfaeda
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/GLRO_dl_debug_mask.patch
@@ -0,0 +1,529 @@
1Its controlled by __OPTION_EGLIBC_RTLD_DEBUG
2so we should use GLRO_dl_debug_mask
3
4Singed-off-by: Khem Raj <raj.khem@gmail.com>
5
6Upstream-Status: Pending
7Index: git/elf/dl-open.c
8===================================================================
9--- git.orig/elf/dl-open.c 2014-08-27 05:03:59.732070587 +0000
10+++ git/elf/dl-open.c 2014-08-27 05:05:25.656070587 +0000
11@@ -147,7 +147,7 @@
12 ns->_ns_main_searchlist->r_list[new_nlist++] = map;
13
14 /* We modify the global scope. Report this. */
15- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
16+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
17 _dl_debug_printf ("\nadd %s [%lu] to global scope\n",
18 map->l_name, map->l_ns);
19 }
20@@ -243,7 +243,7 @@
21 if (__glibc_unlikely (new->l_searchlist.r_list != NULL))
22 {
23 /* Let the user know about the opencount. */
24- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
25+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
26 _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
27 new->l_name, new->l_ns, new->l_direct_opencount);
28
29@@ -294,7 +294,7 @@
30 LIBC_PROBE (map_complete, 3, args->nsid, r, new);
31
32 /* Print scope information. */
33- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
34+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
35 _dl_show_scope (new, 0);
36
37 /* Only do lazy relocation if `LD_BIND_NOW' is not set. */
38@@ -511,7 +511,7 @@
39 }
40
41 /* Print scope information. */
42- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
43+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
44 _dl_show_scope (imap, from_scope);
45 }
46
47@@ -584,7 +584,7 @@
48 #endif
49
50 /* Let the user know about the opencount. */
51- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
52+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
53 _dl_debug_printf ("opening file=%s [%lu]; direct_opencount=%u\n\n",
54 new->l_name, new->l_ns, new->l_direct_opencount);
55 }
56Index: git/elf/rtld.c
57===================================================================
58--- git.orig/elf/rtld.c 2014-08-27 05:03:59.732070587 +0000
59+++ git/elf/rtld.c 2014-08-27 05:12:33.812070587 +0000
60@@ -321,7 +321,7 @@
61 }
62 #endif
63
64- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
65+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
66 {
67 #ifndef HP_TIMING_NONAVAIL
68 print_statistics (&rtld_total_time);
69@@ -1699,7 +1699,7 @@
70 after relocation. */
71 struct link_map *l;
72
73- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
74+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
75 {
76 struct r_scope_elem *scope = &main_map->l_searchlist;
77
78@@ -1729,7 +1729,7 @@
79 _dl_printf ("\n");
80 }
81 }
82- else if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
83+ else if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
84 {
85 /* Look through the dependencies of the main executable
86 and determine which of them is not actually
87@@ -1837,7 +1837,7 @@
88 }
89 }
90
91- if ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
92+ if ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
93 && rtld_multiple_ref)
94 {
95 /* Mark the link map as not yet relocated again. */
96@@ -1970,7 +1970,7 @@
97 if (r_list == r_listend && liblist == liblistend)
98 prelinked = true;
99
100- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
101+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
102 _dl_debug_printf ("\nprelink checking: %s\n",
103 prelinked ? "ok" : "failed");
104 }
105@@ -1988,7 +1988,7 @@
106 GLRO(dl_init_all_dirs) = GL(dl_all_dirs);
107
108 /* Print scope information. */
109- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES))
110+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SCOPES))
111 {
112 _dl_debug_printf ("\nInitial object scopes\n");
113
114@@ -2262,7 +2262,7 @@
115 if (debopts[cnt].len == len
116 && memcmp (dl_debug, debopts[cnt].name, len) == 0)
117 {
118- GLRO(dl_debug_mask) |= debopts[cnt].mask;
119+ GLRO_dl_debug_mask |= debopts[cnt].mask;
120 any_debug = 1;
121 break;
122 }
123@@ -2283,7 +2283,7 @@
124 ++dl_debug;
125 }
126
127- if (GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)
128+ if (GLRO_dl_debug_mask & DL_DEBUG_UNUSED)
129 {
130 /* In order to get an accurate picture of whether a particular
131 DT_NEEDED entry is actually used we have to process both
132@@ -2291,7 +2291,7 @@
133 GLRO(dl_lazy) = 0;
134 }
135
136- if (GLRO(dl_debug_mask) & DL_DEBUG_HELP)
137+ if (GLRO_dl_debug_mask & DL_DEBUG_HELP)
138 {
139 size_t cnt;
140
141@@ -2490,7 +2490,7 @@
142 {
143 mode = trace;
144 GLRO(dl_verbose) = 1;
145- GLRO(dl_debug_mask) |= DL_DEBUG_PRELINK;
146+ GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
147 GLRO(dl_trace_prelink) = &envline[17];
148 }
149 break;
150@@ -2537,7 +2537,7 @@
151 if (__access ("/etc/suid-debug", F_OK) != 0)
152 {
153 unsetenv ("MALLOC_CHECK_");
154- GLRO(dl_debug_mask) = 0;
155+ GLRO_dl_debug_mask = 0;
156 }
157
158 if (mode != normal)
159Index: git/elf/dl-lookup.c
160===================================================================
161--- git.orig/elf/dl-lookup.c 2014-08-27 05:03:59.732070587 +0000
162+++ git/elf/dl-lookup.c 2014-08-27 05:13:07.644070587 +0000
163@@ -300,7 +300,7 @@
164 hash table. */
165 if (__glibc_unlikely (tab->size))
166 {
167- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
168+ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK);
169 goto success;
170 }
171 #endif
172@@ -375,7 +375,7 @@
173 continue;
174
175 /* Print some debugging info if wanted. */
176- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS))
177+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS))
178 _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n",
179 undef_name, DSO_FILENAME (map->l_name),
180 map->l_ns);
181@@ -698,7 +698,7 @@
182 }
183
184 /* Display information if we are debugging. */
185- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
186+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
187 _dl_debug_printf ("\
188 \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n",
189 DSO_FILENAME (map->l_name),
190@@ -802,7 +802,7 @@
191 {
192 if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
193 && skip_map == NULL
194- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
195+ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED))
196 {
197 /* We could find no value for a strong reference. */
198 const char *reference_name = undef_map ? undef_map->l_name : "";
199@@ -873,7 +873,7 @@
200 if (__glibc_unlikely (current_value.m->l_used == 0))
201 current_value.m->l_used = 1;
202
203- if (__glibc_unlikely (GLRO(dl_debug_mask)
204+ if (__glibc_unlikely (GLRO_dl_debug_mask
205 & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK)))
206 _dl_debug_bindings (undef_name, undef_map, ref,
207 &current_value, version, type_class, protected);
208@@ -938,7 +938,7 @@
209 {
210 const char *reference_name = undef_map->l_name;
211
212- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS)
213+ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS)
214 {
215 _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'",
216 DSO_FILENAME (reference_name),
217@@ -952,7 +952,7 @@
218 _dl_debug_printf_c ("\n");
219 }
220 #ifdef SHARED
221- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)
222+ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK)
223 {
224 int conflict = 0;
225 struct sym_val val = { NULL, NULL };
226Index: git/elf/get-dynamic-info.h
227===================================================================
228--- git.orig/elf/get-dynamic-info.h 2014-08-27 05:03:59.732070587 +0000
229+++ git/elf/get-dynamic-info.h 2014-08-27 05:03:59.728070587 +0000
230@@ -157,7 +157,7 @@
231 them. Therefore to avoid breaking existing applications the
232 best we can do is add a warning during debugging with the
233 intent of notifying the user of the problem. */
234- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)
235+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)
236 && l->l_flags_1 & ~DT_1_SUPPORTED_MASK)
237 _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n",
238 l->l_flags_1 & ~DT_1_SUPPORTED_MASK);
239Index: git/csu/libc-start.c
240===================================================================
241--- git.orig/csu/libc-start.c 2014-08-27 04:59:01.412070587 +0000
242+++ git/csu/libc-start.c 2014-08-27 05:09:28.936070587 +0000
243@@ -238,7 +238,7 @@
244
245 /* Call the initializer of the program, if any. */
246 #ifdef SHARED
247- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
248+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
249 GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
250 #endif
251 if (init)
252@@ -261,7 +261,7 @@
253 #endif
254
255 #ifdef SHARED
256- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
257+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
258 GLRO(dl_debug_printf) ("\ntransferring control: %s\n\n", argv[0]);
259 #endif
260
261Index: git/elf/dl-cache.c
262===================================================================
263--- git.orig/elf/dl-cache.c 2014-08-27 04:59:01.568070587 +0000
264+++ git/elf/dl-cache.c 2014-08-27 05:10:14.384070587 +0000
265@@ -187,7 +187,7 @@
266 const char *best;
267
268 /* Print a message if the loading of libs is traced. */
269- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
270+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
271 _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
272
273 if (cache == NULL)
274@@ -285,7 +285,7 @@
275 }
276
277 /* Print our result if wanted. */
278- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0)
279+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
280 && best != NULL)
281 _dl_debug_printf (" trying file=%s\n", best);
282
283Index: git/elf/dl-close.c
284===================================================================
285--- git.orig/elf/dl-close.c 2014-08-27 04:59:01.568070587 +0000
286+++ git/elf/dl-close.c 2014-08-27 05:10:26.456070587 +0000
287@@ -125,7 +125,7 @@
288 dl_close_state = rerun;
289
290 /* There are still references to this object. Do nothing more. */
291- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
292+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
293 _dl_debug_printf ("\nclosing file=%s; direct_opencount=%u\n",
294 map->l_name, map->l_direct_opencount);
295
296@@ -257,7 +257,7 @@
297 if (imap->l_init_called)
298 {
299 /* When debugging print a message first. */
300- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS,
301+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS,
302 0))
303 _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
304 imap->l_name, nsid);
305@@ -664,7 +664,7 @@
306 free (imap->l_reldeps);
307
308 /* Print debugging message. */
309- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
310+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
311 _dl_debug_printf ("\nfile=%s [%lu]; destroying link map\n",
312 imap->l_name, imap->l_ns);
313
314Index: git/elf/dl-conflict.c
315===================================================================
316--- git.orig/elf/dl-conflict.c 2014-08-27 04:59:01.568070587 +0000
317+++ git/elf/dl-conflict.c 2014-08-27 05:10:37.652070587 +0000
318@@ -32,7 +32,7 @@
319 ElfW(Rela) *conflictend)
320 {
321 #if ! ELF_MACHINE_NO_RELA
322- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
323+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
324 _dl_debug_printf ("\nconflict processing: %s\n", DSO_FILENAME (l->l_name));
325
326 {
327Index: git/elf/dl-deps.c
328===================================================================
329--- git.orig/elf/dl-deps.c 2014-08-27 04:59:01.568070587 +0000
330+++ git/elf/dl-deps.c 2014-08-27 05:10:48.260070587 +0000
331@@ -127,7 +127,7 @@
332 else \
333 { \
334 /* This is for DT_AUXILIARY. */ \
335- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) \
336+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)) \
337 _dl_debug_printf (N_("\
338 cannot load auxiliary `%s' because of empty dynamic string token " \
339 "substitution\n"), __str); \
340@@ -303,7 +303,7 @@
341 args.name = name;
342
343 /* Say that we are about to load an auxiliary library. */
344- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS,
345+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS,
346 0))
347 _dl_debug_printf ("load auxiliary object=%s"
348 " requested by file=%s\n",
349@@ -520,7 +520,7 @@
350 runp->map->l_reserved = 0;
351 }
352
353- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0
354+ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_PRELINK, 0) != 0
355 && map == GL(dl_ns)[LM_ID_BASE]._ns_loaded)
356 {
357 /* If we are to compute conflicts, we have to build local scope
358Index: git/elf/dl-error.c
359===================================================================
360--- git.orig/elf/dl-error.c 2014-08-27 04:59:01.568070587 +0000
361+++ git/elf/dl-error.c 2014-08-27 05:11:06.752070587 +0000
362@@ -139,7 +139,7 @@
363 _dl_signal_cerror (int errcode, const char *objname, const char *occation,
364 const char *errstring)
365 {
366- if (__builtin_expect (GLRO(dl_debug_mask)
367+ if (__builtin_expect (GLRO_dl_debug_mask
368 & ~(DL_DEBUG_STATISTICS|DL_DEBUG_PRELINK), 0))
369 _dl_debug_printf ("%s: error: %s: %s (%s)\n", objname, occation,
370 errstring, receiver ? "continued" : "fatal");
371Index: git/elf/dl-fini.c
372===================================================================
373--- git.orig/elf/dl-fini.c 2014-08-27 04:59:01.568070587 +0000
374+++ git/elf/dl-fini.c 2014-08-27 05:11:17.544070587 +0000
375@@ -234,7 +234,7 @@
376 || l->l_info[DT_FINI] != NULL)
377 {
378 /* When debugging print a message first. */
379- if (__builtin_expect (GLRO(dl_debug_mask)
380+ if (__builtin_expect (GLRO_dl_debug_mask
381 & DL_DEBUG_IMPCALLS, 0))
382 _dl_debug_printf ("\ncalling fini: %s [%lu]\n\n",
383 DSO_FILENAME (l->l_name),
384@@ -286,7 +286,7 @@
385 goto again;
386 }
387
388- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
389+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_STATISTICS))
390 _dl_debug_printf ("\nruntime linker statistics:\n"
391 " final number of relocations: %lu\n"
392 "final number of relocations from cache: %lu\n",
393Index: git/elf/dl-init.c
394===================================================================
395--- git.orig/elf/dl-init.c 2014-08-27 04:59:01.568070587 +0000
396+++ git/elf/dl-init.c 2014-08-27 05:11:28.372070587 +0000
397@@ -52,7 +52,7 @@
398 return;
399
400 /* Print a debug message if wanted. */
401- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
402+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
403 _dl_debug_printf ("\ncalling init: %s\n\n",
404 DSO_FILENAME (l->l_name));
405
406@@ -102,7 +102,7 @@
407 ElfW(Addr) *addrs;
408 unsigned int cnt;
409
410- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS))
411+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_IMPCALLS))
412 _dl_debug_printf ("\ncalling preinit: %s\n\n",
413 DSO_FILENAME (main_map->l_name));
414
415Index: git/elf/dl-load.c
416===================================================================
417--- git.orig/elf/dl-load.c 2014-08-27 04:59:01.572070587 +0000
418+++ git/elf/dl-load.c 2014-08-27 05:11:41.156070587 +0000
419@@ -957,7 +957,7 @@
420 }
421
422 /* Print debugging message. */
423- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
424+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
425 _dl_debug_printf ("file=%s [%lu]; generating link map\n", name, nsid);
426
427 /* This is the ELF header. We read it in `open_verify'. */
428@@ -1361,7 +1361,7 @@
429
430 l->l_entry += l->l_addr;
431
432- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))
433+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES))
434 _dl_debug_printf ("\
435 dynamic: 0x%0*lx base: 0x%0*lx size: 0x%0*Zx\n\
436 entry: 0x%0*lx phdr: 0x%0*lx phnum: %*u\n\n",
437@@ -1787,7 +1787,7 @@
438
439 /* If we are debugging the search for libraries print the path
440 now if it hasn't happened now. */
441- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)
442+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS)
443 && current_what != this_dir->what)
444 {
445 current_what = this_dir->what;
446@@ -1808,7 +1808,7 @@
447 - buf);
448
449 /* Print name we try if this is wanted. */
450- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
451+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
452 _dl_debug_printf (" trying file=%s\n", buf);
453
454 fd = open_verify (buf, fbp, loader, whatcode, mode,
455@@ -1953,7 +1953,7 @@
456 }
457
458 /* Display information if we are debugging. */
459- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES)
460+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_FILES)
461 && loader != NULL)
462 _dl_debug_printf ((mode & __RTLD_CALLMAP) == 0
463 ? "\nfile=%s [%lu]; needed by %s [%lu]\n"
464@@ -1995,7 +1995,7 @@
465
466 size_t namelen = strlen (name) + 1;
467
468- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
469+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
470 _dl_debug_printf ("find library=%s [%lu]; searching\n", name, nsid);
471
472 fd = -1;
473@@ -2122,7 +2122,7 @@
474 &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
475
476 /* Add another newline when we are tracing the library loading. */
477- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
478+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
479 _dl_debug_printf ("\n");
480 }
481 else
482@@ -2155,7 +2155,7 @@
483 if (__glibc_unlikely (fd == -1))
484 {
485 if (trace_mode
486- && __glibc_likely ((GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) == 0))
487+ && __glibc_likely ((GLRO_dl_debug_mask & DL_DEBUG_PRELINK) == 0))
488 {
489 /* We haven't found an appropriate library. But since we
490 are only interested in the list of libraries this isn't
491Index: git/elf/dl-object.c
492===================================================================
493--- git.orig/elf/dl-object.c 2014-08-27 04:59:01.572070587 +0000
494+++ git/elf/dl-object.c 2014-08-27 05:11:51.756070587 +0000
495@@ -98,7 +98,7 @@
496 new->l_type = type;
497 /* If we set the bit now since we know it is never used we avoid
498 dirtying the cache line later. */
499- if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
500+ if ((GLRO_dl_debug_mask & DL_DEBUG_UNUSED) == 0)
501 new->l_used = 1;
502 new->l_loader = loader;
503 #if NO_TLS_OFFSET != 0
504Index: git/elf/dl-reloc.c
505===================================================================
506--- git.orig/elf/dl-reloc.c 2014-08-27 04:59:01.572070587 +0000
507+++ git/elf/dl-reloc.c 2014-08-27 05:12:07.056070587 +0000
508@@ -183,7 +183,7 @@
509 && __builtin_expect (l->l_info[DT_BIND_NOW] != NULL, 0))
510 lazy = 0;
511
512- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_RELOC))
513+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_RELOC))
514 _dl_debug_printf ("\nrelocation processing: %s%s\n",
515 DSO_FILENAME (l->l_name), lazy ? " (lazy)" : "");
516
517Index: git/elf/dl-version.c
518===================================================================
519--- git.orig/elf/dl-version.c 2014-08-27 04:59:01.608070587 +0000
520+++ git/elf/dl-version.c 2014-08-27 05:12:19.568070587 +0000
521@@ -82,7 +82,7 @@
522 int result = 0;
523
524 /* Display information about what we are doing while debugging. */
525- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_VERSIONS))
526+ if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_VERSIONS))
527 _dl_debug_printf ("\
528 checking for version `%s' in file %s [%lu] required by file %s [%lu]\n",
529 string, DSO_FILENAME (map->l_name),
diff --git a/meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch b/meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch
new file mode 100644
index 0000000000..ffbaba14a2
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/IO-acquire-lock-fix.patch
@@ -0,0 +1,17 @@
1import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html
2
3Upstream-Status: Pending
4
5Index: git/bits/stdio-lock.h
6===================================================================
7--- git.orig/bits/stdio-lock.h 2014-08-29 10:33:57.960070587 -0700
8+++ git/bits/stdio-lock.h 2014-08-29 10:33:57.952070587 -0700
9@@ -49,6 +49,8 @@
10 _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \
11 _IO_flockfile (_fp)
12
13+# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp)
14+
15 # define _IO_release_lock(_fp) \
16 _IO_funlockfile (_fp); \
17 _IO_cleanup_region_end (0)
diff --git a/meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch b/meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch
new file mode 100644
index 0000000000..4559de7bc1
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/add_resource_h_to_wait_h.patch
@@ -0,0 +1,20 @@
1The older versions of perf still require sys/resource.h to be
2present in this header, the newer version of perf in 3.2 and
3beyond directly include sys/resource.h
4
5Upstream-Status: Inapproriate [older kernel/perf specific]
6
7Signed-off-by: Saul Wold <sgw@linux.intel.com>
8
9Index: git/posix/sys/wait.h
10===================================================================
11--- git.orig/posix/sys/wait.h 2014-08-29 10:35:10.432070587 -0700
12+++ git/posix/sys/wait.h 2014-08-29 10:35:10.424070587 -0700
13@@ -27,6 +27,7 @@
14 __BEGIN_DECLS
15
16 #include <signal.h>
17+#include <sys/resource.h>
18
19 /* These macros could also be defined in <stdlib.h>. */
20 #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
diff --git a/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch b/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch
new file mode 100644
index 0000000000..e1aa13926a
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-header-bootstrap.patch
@@ -0,0 +1,85 @@
1Taken from EGLIBC, r1484 + r1525
2
3 2007-02-20 Jim Blandy <jimb@codesourcery.com>
4
5 * Makefile (install-headers): Preserve old behavior: depend on
6 $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers
7 is set; otherwise, place gnu/stubs.h on the 'install-others' list.
8
9 2007-02-16 Jim Blandy <jimb@codesourcery.com>
10
11 * Makefile: Amend make install-headers to install everything
12 necessary for building a cross-compiler. Install gnu/stubs.h as
13 part of 'install-headers', not 'install-others'.
14 If install-bootstrap-headers is 'yes', install a dummy copy of
15 gnu/stubs.h, instead of computing the real thing.
16 * include/stubs-bootstrap.h: New file.
17
18Upstream-Status: Pending
19
20Index: git/Makefile
21===================================================================
22--- git.orig/Makefile 2014-08-27 18:35:18.908070587 +0000
23+++ git/Makefile 2014-08-27 18:35:19.340070587 +0000
24@@ -69,9 +69,18 @@
25 vpath %.h $(subdir-dirs)
26
27 # What to install.
28-install-others = $(inst_includedir)/gnu/stubs.h
29 install-bin-script =
30
31+# If we're bootstrapping, install a dummy gnu/stubs.h along with the
32+# other headers, so 'make install-headers' produces a useable include
33+# tree. Otherwise, install gnu/stubs.h later, after the rest of the
34+# build is done.
35+ifeq ($(install-bootstrap-headers),yes)
36+install-headers: $(inst_includedir)/gnu/stubs.h
37+else
38+install-others = $(inst_includedir)/gnu/stubs.h
39+endif
40+
41 ifeq (yes,$(build-shared))
42 headers += gnu/lib-names.h
43 endif
44@@ -151,6 +160,16 @@
45
46 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
47
48+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
49+# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty
50+# gnu/stubs.h is good enough.
51+ifeq ($(install-bootstrap-headers),yes)
52+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force)
53+ $(make-target-directory)
54+ $(INSTALL_DATA) $< $@
55+
56+installed-stubs =
57+else
58 ifndef abi-variants
59 installed-stubs = $(inst_includedir)/gnu/stubs.h
60 else
61@@ -177,6 +196,7 @@
62
63 install-others-nosubdir: $(installed-stubs)
64 endif
65+endif
66
67
68 # Since stubs.h is never needed when building the library, we simplify the
69Index: git/include/stubs-bootstrap.h
70===================================================================
71--- /dev/null 1970-01-01 00:00:00.000000000 +0000
72+++ git/include/stubs-bootstrap.h 2014-08-27 18:35:19.340070587 +0000
73@@ -0,0 +1,12 @@
74+/* Placeholder stubs.h file for bootstrapping.
75+
76+ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC
77+ headers be installed, but we can't fully build EGLIBC without that
78+ GCC. So we run the command:
79+
80+ make install-headers install-bootstrap-headers=yes
81+
82+ to install the headers GCC needs, but avoid building certain
83+ difficult headers. The <gnu/stubs.h> header depends, via the
84+ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
85+ an empty stubs.h like this will do fine for GCC. */
diff --git a/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch b/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch
new file mode 100644
index 0000000000..9a31255b09
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-install-pic-archives.patch
@@ -0,0 +1,109 @@
12008-02-07 Joseph Myers <joseph@codesourcery.com>
2
3 * Makerules (install-extras, install-map): New variables.
4 (installed-libcs): Add libc_pic.a.
5 (install-lib): Include _pic.a files for versioned shared
6 libraries.
7 (install-map-nosubdir, install-extras-nosubdir): Add rules for
8 installing extra files.
9 (install-no-libc.a-nosubdir): Depend on install-map-nosubdir and
10 install-extras-nosubdir.
11
12
132008-04-01 Maxim Kuvyrkov <maxim@codesourcery.com>
14
15 * Makerules (install-lib): Don't install libpthread_pic.a.
16 (install-map): Don't install libpthread_pic.map.
17
18Upstream-Status: Pending
19
20Index: git/Makerules
21===================================================================
22--- git.orig/Makerules 2014-08-27 18:49:22.552070587 +0000
23+++ git/Makerules 2014-08-27 18:49:27.308070587 +0000
24@@ -612,6 +631,9 @@
25 $(common-objpfx)libc.so: $(common-objpfx)libc.map
26 endif
27 common-generated += libc.so libc_pic.os
28+ifndef subdir
29+install-extras := soinit.o sofini.o
30+endif
31 ifdef libc.so-version
32 $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
33 $(make-link)
34@@ -834,6 +856,7 @@
35 installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
36 $(inst_libdir)/$(patsubst %,$(libtype$o),\
37 $(libprefix)$(libc-name)))
38+installed-libcs := $(installed-libcs) $(inst_libdir)/libc_pic.a
39 install: $(installed-libcs)
40 $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
41 $(make-target-directory)
42@@ -862,6 +885,22 @@
43 install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
44 install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
45
46+# Install the _pic.a files for versioned libraries, and corresponding
47+# .map files.
48+# libpthread_pic.a breaks mklibs, so don't install it and its map.
49+install-lib := $(install-lib) $(install-lib.so-versioned:%.so=%_pic.a)
50+install-lib := $(filter-out libpthread_pic.a,$(install-lib))
51+# Despite having a soname libhurduser and libmachuser do not use symbol
52+# versioning, so don't install the corresponding .map files.
53+ifeq ($(build-shared),yes)
54+install-map := $(patsubst %.so,%.map,\
55+ $(foreach L,$(install-lib.so-versioned),$(notdir $L)))
56+install-map := $(filter-out libhurduser.map libmachuser.map libpthread.map,$(install-map))
57+ifndef subdir
58+install-map := $(install-map) libc.map
59+endif
60+endif
61+
62 # For versioned libraries, we install three files:
63 # $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
64 # $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
65@@ -1103,9 +1142,22 @@
66 endif # headers-nonh
67 endif # headers
68
69+ifdef install-map
70+$(addprefix $(inst_libdir)/,$(patsubst lib%.map,lib%_pic.map,$(install-map))): \
71+ $(inst_libdir)/lib%_pic.map: $(common-objpfx)lib%.map $(+force)
72+ $(do-install)
73+endif
74+
75+ifdef install-extras
76+$(addprefix $(inst_libdir)/libc_pic/,$(install-extras)): \
77+ $(inst_libdir)/libc_pic/%.o: $(elfobjdir)/%.os $(+force)
78+ $(do-install)
79+endif
80+
81 .PHONY: install-bin-nosubdir install-bin-script-nosubdir \
82 install-rootsbin-nosubdir install-sbin-nosubdir install-lib-nosubdir \
83- install-data-nosubdir install-headers-nosubdir
84+ install-data-nosubdir install-headers-nosubdir install-map-nosubdir \
85+ install-extras-nosubdir
86 install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
87 install-bin-script-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin-script))
88 install-rootsbin-nosubdir: \
89@@ -1118,6 +1170,10 @@
90 install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
91 install-others-nosubdir: $(install-others)
92 install-others-programs-nosubdir: $(install-others-programs)
93+install-map-nosubdir: $(addprefix $(inst_libdir)/,\
94+ $(patsubst lib%.map,lib%_pic.map,$(install-map)))
95+install-extras-nosubdir: $(addprefix $(inst_libdir)/libc_pic/,\
96+ $(install-extras))
97
98 # We need all the `-nosubdir' targets so that `install' in the parent
99 # doesn't depend on several things which each iterate over the subdirs.
100@@ -1127,7 +1183,8 @@
101
102 .PHONY: install install-no-libc.a-nosubdir
103 install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir \
104- install-lib-nosubdir install-others-nosubdir
105+ install-lib-nosubdir install-others-nosubdir \
106+ install-map-nosubdir install-extras-nosubdir
107 ifeq ($(build-programs),yes)
108 install-no-libc.a-nosubdir: install-bin-nosubdir install-bin-script-nosubdir \
109 install-rootsbin-nosubdir install-sbin-nosubdir \
diff --git a/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch b/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch
new file mode 100644
index 0000000000..bb83d6d36e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-ppc8xx-cache-line-workaround.patch
@@ -0,0 +1,68 @@
12007-06-13 Nathan Sidwell <nathan@codesourcery.com>
2 Mark Shinwell <shinwell@codesourcery.com>
3
4 * sysdeps/unix/sysv/linux/powerpc/libc-start.c
5 (__libc_start_main): Detect 8xx parts and clear
6 __cache_line_size if detected.
7 * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
8 (DL_PLATFORM_AUXV): Likewise.
9
10Upstream-Status: Pending
11
12Index: git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c
13===================================================================
14--- git.orig/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:23.996070587 +0000
15+++ git/sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c 2014-08-27 18:49:27.332070587 +0000
16@@ -24,9 +24,21 @@
17 /* Scan the Aux Vector for the "Data Cache Block Size" entry. If found
18 verify that the static extern __cache_line_size is defined by checking
19 for not NULL. If it is defined then assign the cache block size
20- value to __cache_line_size. */
21+ value to __cache_line_size. This is used by memset to
22+ optimize setting to zero. We have to detect 8xx processors, which
23+ have buggy dcbz implementations that cannot report page faults
24+ correctly. That requires reading SPR, which is a privileged
25+ operation. Fortunately 2.2.18 and later emulates PowerPC mfspr
26+ reads from the PVR register. */
27 #define DL_PLATFORM_AUXV \
28 case AT_DCACHEBSIZE: \
29+ if (__LINUX_KERNEL_VERSION >= 0x020218) \
30+ { \
31+ unsigned pvr = 0; \
32+ asm ("mfspr %0, 287" : "=r" (pvr)); \
33+ if ((pvr & 0xffff0000) == 0x00500000) \
34+ break; \
35+ } \
36 __cache_line_size = av->a_un.a_val; \
37 break;
38
39Index: git/sysdeps/unix/sysv/linux/powerpc/libc-start.c
40===================================================================
41--- git.orig/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:23.996070587 +0000
42+++ git/sysdeps/unix/sysv/linux/powerpc/libc-start.c 2014-08-27 18:49:27.332070587 +0000
43@@ -68,11 +68,24 @@
44 rtld_fini = NULL;
45 }
46
47- /* Initialize the __cache_line_size variable from the aux vector. */
48+ /* Initialize the __cache_line_size variable from the aux vector.
49+ This is used by memset to optimize setting to zero. We have to
50+ detect 8xx processors, which have buggy dcbz implementations that
51+ cannot report page faults correctly. That requires reading SPR,
52+ which is a privileged operation. Fortunately 2.2.18 and later
53+ emulates PowerPC mfspr reads from the PVR register. */
54 for (ElfW (auxv_t) * av = auxvec; av->a_type != AT_NULL; ++av)
55 switch (av->a_type)
56 {
57 case AT_DCACHEBSIZE:
58+ if (__LINUX_KERNEL_VERSION >= 0x020218)
59+ {
60+ unsigned pvr = 0;
61+
62+ asm ("mfspr %0, 287" : "=r" (pvr) :);
63+ if ((pvr & 0xffff0000) == 0x00500000)
64+ break;
65+ }
66 __cache_line_size = av->a_un.a_val;
67 break;
68 }
diff --git a/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch b/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch
new file mode 100644
index 0000000000..a73bcebe34
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-resolv-dynamic.patch
@@ -0,0 +1,54 @@
1cherry-picked from http://www.eglibc.org/archives/patches/msg00772.html
2
3It hasnt yet been merged into glibc
4
5Signed-off-by: Khem Raj
6
7Upstream-Status: Pending
8
9Index: git/resolv/res_libc.c
10===================================================================
11--- git.orig/resolv/res_libc.c 2014-08-27 18:35:15.492070587 +0000
12+++ git/resolv/res_libc.c 2014-08-27 18:35:19.204070587 +0000
13@@ -22,12 +22,13 @@
14 #include <arpa/nameser.h>
15 #include <resolv.h>
16 #include <bits/libc-lock.h>
17-
18+#include <sys/stat.h>
19
20 /* The following bit is copied from res_data.c (where it is #ifdef'ed
21 out) since res_init() should go into libc.so but the rest of that
22 file should not. */
23
24+__libc_lock_define_initialized (static, lock);
25 extern unsigned long long int __res_initstamp attribute_hidden;
26 /* We have atomic increment operations on 64-bit platforms. */
27 #if __WORDSIZE == 64
28@@ -35,7 +36,6 @@
29 # define atomicincunlock(lock) (void) 0
30 # define atomicinc(var) catomic_increment (&(var))
31 #else
32-__libc_lock_define_initialized (static, lock);
33 # define atomicinclock(lock) __libc_lock_lock (lock)
34 # define atomicincunlock(lock) __libc_lock_unlock (lock)
35 # define atomicinc(var) ++var
36@@ -94,7 +94,18 @@
37 int
38 __res_maybe_init (res_state resp, int preinit)
39 {
40+ static time_t last_mtime;
41+ struct stat statbuf;
42+ int ret;
43+
44 if (resp->options & RES_INIT) {
45+ ret = stat (_PATH_RESCONF, &statbuf);
46+ __libc_lock_lock (lock);
47+ if ((ret == 0) && (last_mtime != statbuf.st_mtime)) {
48+ last_mtime = statbuf.st_mtime;
49+ atomicinc (__res_initstamp);
50+ }
51+ __libc_lock_unlock (lock);
52 if (__res_initstamp != resp->_u._ext.initstamp) {
53 if (resp->nscount > 0)
54 __res_iclose (resp, true);
diff --git a/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch b/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch
new file mode 100644
index 0000000000..bfb813eb7c
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-sh4-fpscr_values.patch
@@ -0,0 +1,42 @@
12010-09-29 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2 Andrew Stubbs <ams@codesourcery.com>
3
4 Resolve SH's __fpscr_values to symbol in libc.so.
5
6 * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype.
7 * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values.
8 * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant.
9
10Upstream-Status: Pending
11
12Index: git/sysdeps/unix/sysv/linux/sh/sysdep.S
13===================================================================
14--- git.orig/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:24.036070587 +0000
15+++ git/sysdeps/unix/sysv/linux/sh/sysdep.S 2014-08-27 18:49:27.332070587 +0000
16@@ -30,3 +30,14 @@
17
18 #define __syscall_error __syscall_error_1
19 #include <sysdeps/unix/sh/sysdep.S>
20+
21+ .data
22+ .align 3
23+ .globl ___fpscr_values
24+ .type ___fpscr_values, @object
25+ .size ___fpscr_values, 8
26+___fpscr_values:
27+ .long 0
28+ .long 0x80000
29+weak_alias (___fpscr_values, __fpscr_values)
30+
31Index: git/sysdeps/unix/sysv/linux/sh/Versions
32===================================================================
33--- git.orig/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:24.028070587 +0000
34+++ git/sysdeps/unix/sysv/linux/sh/Versions 2014-08-27 18:49:27.332070587 +0000
35@@ -2,6 +2,7 @@
36 GLIBC_2.2 {
37 # functions used in other libraries
38 __xstat64; __fxstat64; __lxstat64;
39+ __fpscr_values;
40
41 # a*
42 alphasort64;
diff --git a/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch b/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch
new file mode 100644
index 0000000000..332b8f73a6
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc-use-option-groups.patch
@@ -0,0 +1,16578 @@
1Forward port eglibc options groups support
2
3Upstream-Status: Pending
4
5Index: git/argp/argp-fmtstream.c
6===================================================================
7--- git.orig/argp/argp-fmtstream.c 2014-08-29 20:00:42.976070587 -0700
8+++ git/argp/argp-fmtstream.c 2014-08-29 20:01:15.188070587 -0700
9@@ -42,6 +42,7 @@
10 #ifdef _LIBC
11 # include <wchar.h>
12 # include <libio/libioP.h>
13+# include <gnu/option-groups.h>
14 # define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
15 #endif
16
17@@ -100,7 +101,11 @@
18 __argp_fmtstream_update (fs);
19 if (fs->p > fs->buf)
20 {
21+#ifdef _LIBC
22 __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
23+#else
24+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
25+#endif
26 }
27 free (fs->buf);
28 free (fs);
29@@ -145,9 +150,17 @@
30 size_t i;
31 for (i = 0; i < pad; i++)
32 {
33+#ifdef _LIBC
34 if (_IO_fwide (fs->stream, 0) > 0)
35- putwc_unlocked (L' ', fs->stream);
36+ {
37+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
38+ putwc_unlocked (L' ', fs->stream);
39+#else
40+ abort ();
41+#endif
42+ }
43 else
44+#endif
45 putc_unlocked (' ', fs->stream);
46 }
47 }
48@@ -308,9 +321,17 @@
49 *nl++ = ' ';
50 else
51 for (i = 0; i < fs->wmargin; ++i)
52+#ifdef _LIBC
53 if (_IO_fwide (fs->stream, 0) > 0)
54- putwc_unlocked (L' ', fs->stream);
55+ {
56+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
57+ putwc_unlocked (L' ', fs->stream);
58+#else
59+ abort ();
60+#endif
61+ }
62 else
63+#endif
64 putc_unlocked (' ', fs->stream);
65
66 /* Copy the tail of the original buffer into the current buffer
67Index: git/argp/argp-help.c
68===================================================================
69--- git.orig/argp/argp-help.c 2014-08-29 20:00:42.976070587 -0700
70+++ git/argp/argp-help.c 2014-08-29 20:01:15.188070587 -0700
71@@ -51,6 +51,7 @@
72 #ifdef _LIBC
73 # include <../libio/libioP.h>
74 # include <wchar.h>
75+# include <gnu/option-groups.h>
76 #endif
77
78 #ifndef _
79@@ -1702,7 +1703,7 @@
80 }
81
82 char *
83-__argp_short_program_name (void)
84+(__argp_short_program_name) (void)
85 {
86 # if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
87 return program_invocation_short_name;
88@@ -1873,9 +1874,17 @@
89 #endif
90 }
91
92+#ifdef _LIBC
93 if (_IO_fwide (stream, 0) > 0)
94- putwc_unlocked (L'\n', stream);
95+ {
96+#if ! _LIBC || __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
97+ putwc_unlocked (L'\n', stream);
98+#else
99+ abort ();
100+#endif
101+ }
102 else
103+#endif
104 putc_unlocked ('\n', stream);
105
106 #if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
107Index: git/argp/argp-namefrob.h
108===================================================================
109--- git.orig/argp/argp-namefrob.h 2014-08-29 20:00:42.976070587 -0700
110+++ git/argp/argp-namefrob.h 2014-08-29 20:01:15.192070587 -0700
111@@ -76,10 +76,12 @@
112 #undef __argp_fmtstream_wmargin
113 #define __argp_fmtstream_wmargin argp_fmtstream_wmargin
114
115+#if 0
116 #include "mempcpy.h"
117 #include "strcase.h"
118 #include "strchrnul.h"
119 #include "strndup.h"
120+#endif
121
122 /* normal libc functions we call */
123 #undef __flockfile
124Index: git/argp/Makefile
125===================================================================
126--- git.orig/argp/Makefile 2014-08-29 20:00:42.976070587 -0700
127+++ git/argp/Makefile 2014-08-29 20:01:15.192070587 -0700
128@@ -18,6 +18,8 @@
129 #
130 # Makefile for argp.
131 #
132+include ../option-groups.mak
133+
134 subdir := argp
135
136 include ../Makeconfig
137Index: git/catgets/Makefile
138===================================================================
139--- git.orig/catgets/Makefile 2014-08-29 20:00:43.008070587 -0700
140+++ git/catgets/Makefile 2014-08-29 20:01:15.192070587 -0700
141@@ -22,20 +22,23 @@
142
143 include ../Makeconfig
144
145+include ../option-groups.mak
146+
147 headers = nl_types.h
148-routines = catgets open_catalog
149-others = gencat
150-install-bin = gencat
151-extra-objs = $(gencat-modules:=.o)
152+routines-$(OPTION_EGLIBC_CATGETS) := catgets open_catalog
153+others-$(OPTION_EGLIBC_CATGETS) := gencat
154+install-bin-$(OPTION_EGLIBC_CATGETS) := gencat
155+extra-objs-$(OPTION_EGLIBC_CATGETS) := $(gencat-modules:=.o)
156
157-tests = tst-catgets
158-test-srcs = test-gencat
159+tests-$(OPTION_EGLIBC_CATGETS) := tst-catgets
160+test-srcs-$(OPTION_EGLIBC_CATGETS) := test-gencat
161
162+ifeq (y,$(OPTION_EGLIBC_CATGETS))
163 ifeq ($(run-built-tests),yes)
164 tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
165 $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
166 endif
167-
168+endif
169 gencat-modules = xmalloc
170
171 # To find xmalloc.c
172Index: git/crypt/crypt-entry.c
173===================================================================
174--- git.orig/crypt/crypt-entry.c 2014-08-29 20:00:43.028070587 -0700
175+++ git/crypt/crypt-entry.c 2014-08-29 20:01:15.192070587 -0700
176@@ -27,6 +27,7 @@
177 #include <stdio.h>
178 #endif
179 #include <string.h>
180+#include <gnu/option-groups.h>
181 #include <errno.h>
182 #include <fips-private.h>
183
184@@ -76,9 +77,11 @@
185 const char *salt;
186 struct crypt_data * __restrict data;
187 {
188+#if __OPTION_EGLIBC_CRYPT_UFC
189 ufc_long res[4];
190 char ktab[9];
191 ufc_long xx = 25; /* to cope with GCC long long compiler bugs */
192+#endif /*__OPTION_EGLIBC_CRYPT_UFC*/
193
194 #ifdef _LIBC
195 /* Try to find out whether we have to use MD5 encryption replacement. */
196@@ -105,6 +108,7 @@
197 sizeof (struct crypt_data));
198 #endif
199
200+#if __OPTION_EGLIBC_CRYPT_UFC
201 /*
202 * Hack DES tables according to salt
203 */
204@@ -144,6 +148,10 @@
205 */
206 _ufc_output_conversion_r (res[0], res[1], salt, data);
207 return data->crypt_3_buf;
208+#else /* __OPTION_EGLIBC_CRYPT_UFC */
209+ __set_errno (ENOSYS);
210+ return NULL;
211+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
212 }
213 weak_alias (__crypt_r, crypt_r)
214
215@@ -168,7 +176,12 @@
216 return __sha512_crypt (key, salt);
217 #endif
218
219+#if __OPTION_EGLIBC_CRYPT_UFC
220 return __crypt_r (key, salt, &_ufc_foobar);
221+#else /* __OPTION_EGLIBC_CRYPT_UFC */
222+ __set_errno (ENOSYS);
223+ return NULL;
224+#endif /* __OPTION_EGLIBC_CRYPT_UFC */
225 }
226
227
228Index: git/crypt/Makefile
229===================================================================
230--- git.orig/crypt/Makefile 2014-08-29 20:00:43.024070587 -0700
231+++ git/crypt/Makefile 2014-08-29 20:01:15.192070587 -0700
232@@ -18,21 +18,25 @@
233 #
234 # Sub-makefile for crypt() portion of the library.
235 #
236+include ../option-groups.mak
237+
238 subdir := crypt
239
240 include ../Makeconfig
241
242 headers := crypt.h
243
244-extra-libs := libcrypt
245-extra-libs-others := $(extra-libs)
246+extra-libs-$(OPTION_EGLIBC_CRYPT) := libcrypt
247+extra-libs-others-y := $(extra-libs-y)
248
249-libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
250- crypt_util
251+libcrypt-routines :=crypt-entry md5-crypt sha256-crypt sha512-crypt crypt_common
252+libcrypt-routines-$(OPTION_EGLIBC_CRYPT_UFC) := crypt crypt_util
253+libcrypt-routines += $(libcrypt-routines-y)
254
255-tests := cert md5c-test sha256c-test sha512c-test badsalttest
256+tests-$(OPTION_EGLIBC_CRYPT) := md5c-test sha256c-test sha512c-test badsalttest
257+tests-$(OPTION_EGLIBC_CRYPT_UFC) += cert
258
259-ifeq ($(crypt-in-libc),yes)
260+ifeq ($(crypt-in-libc)$(OPTION_EGLIBC_CRYPT),yesy)
261 routines += $(libcrypt-routines)
262 endif
263
264@@ -44,7 +48,7 @@
265 else
266 libcrypt-routines += md5 sha256 sha512
267
268-tests += md5test sha256test sha512test
269+tests-$(OPTION_EGLIBC_CRYPT) += md5test sha256test sha512test
270
271 # The test md5test-giant uses up to 400 MB of RSS and runs on a fast
272 # machine over a minute.
273@@ -64,8 +68,10 @@
274 $(objpfx)sha512test: $(patsubst %, $(objpfx)%.o,$(sha512-routines))
275 endif
276
277+ifeq ($(OPTION_EGLIBC_CRYPT),y)
278 ifeq (yes,$(build-shared))
279 $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.so
280 else
281 $(addprefix $(objpfx),$(tests)): $(objpfx)libcrypt.a
282 endif
283+endif # eglibc: OPTION_EGLIBC_CRYPT
284Index: git/csu/Makefile
285===================================================================
286--- git.orig/csu/Makefile 2014-08-29 20:00:43.032070587 -0700
287+++ git/csu/Makefile 2014-08-29 20:01:15.192070587 -0700
288@@ -22,6 +22,8 @@
289 # crtn.o, special "initializer" and "finalizer" files used in the link
290 # to make the .init and .fini sections work right.
291
292+include ../option-groups.mak
293+
294 subdir := csu
295
296 include ../Makeconfig
297Index: git/debug/Makefile
298===================================================================
299--- git.orig/debug/Makefile 2014-08-29 20:00:43.036070587 -0700
300+++ git/debug/Makefile 2014-08-29 20:01:15.192070587 -0700
301@@ -18,6 +18,8 @@
302 #
303 # Sub-makefile for debug portion of the library.
304 #
305+include ../option-groups.mak
306+
307 subdir := debug
308
309 include ../Makeconfig
310@@ -27,7 +29,7 @@
311 # Note that ptsname_r_chk and getlogin_r are not here, but in
312 # login/Makefile instead. If that subdir is omitted from the
313 # build, its _FORTIFY_SOURCE support will be too.
314-routines = backtrace backtracesyms backtracesymsfd noophooks \
315+routines = noophooks \
316 memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
317 strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
318 sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
319@@ -36,20 +38,27 @@
320 read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
321 readlink_chk readlinkat_chk getwd_chk getcwd_chk \
322 realpath_chk fread_chk fread_u_chk \
323- wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
324- wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
325- wcpncpy_chk \
326- swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
327- vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
328 confstr_chk getgroups_chk ttyname_r_chk \
329- gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
330- wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
331- wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
332+ gethostname_chk getdomainname_chk \
333+ asprintf_chk vasprintf_chk dprintf_chk \
334 vdprintf_chk obprintf_chk \
335 longjmp_chk ____longjmp_chk \
336 fdelt_chk poll_chk ppoll_chk \
337 stack_chk_fail fortify_fail \
338 $(static-only-routines)
339+routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd
340+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
341+ += wprintf_chk fwprintf_chk \
342+ vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk
343+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
344+ += wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
345+ wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
346+ wcpncpy_chk \
347+ swprintf_chk vswprintf_chk \
348+ wcrtomb_chk mbsnrtowcs_chk \
349+ wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
350+ wcstombs_chk
351+
352 static-only-routines := warning-nop stack_chk_fail_local
353
354 CFLAGS-backtrace.c = -fno-omit-frame-pointer
355@@ -129,11 +138,15 @@
356 LDFLAGS-tst-backtrace5 = -rdynamic
357 LDFLAGS-tst-backtrace6 = -rdynamic
358
359-tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
360- tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
361- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
362- tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
363- tst-backtrace5 tst-backtrace6
364+tests = tst-longjmp_chk test-strcpy_chk test-stpcpy_chk tst-longjmp_chk2
365+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
366+ += tst-chk1 tst-chk2 tst-chk3 tst-lfschk1 tst-lfschk2 tst-lfschk3
367+tests-$(OPTION_EGLIBC_BACKTRACE) \
368+ += backtrace-tst tst-backtrace2 tst-backtrace3 tst-backtrace4 \
369+ tst-backtrace5 tst-backtrace6
370+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_EGLIBC_CXX_TESTS))
371+tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
372+endif
373
374 tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
375 tests += $(tests-ifunc)
376Index: git/debug/segfault.c
377===================================================================
378--- git.orig/debug/segfault.c 2014-08-29 20:00:46.280070587 -0700
379+++ git/debug/segfault.c 2014-08-29 20:01:15.192070587 -0700
380@@ -30,6 +30,7 @@
381 #include <unistd.h>
382 #include <_itoa.h>
383 #include <ldsodefs.h>
384+#include <gnu/option-groups.h>
385
386 /* This file defines macros to access the content of the sigcontext element
387 passed up by the signal handler. */
388@@ -91,6 +92,7 @@
389 REGISTER_DUMP;
390 #endif
391
392+#if __OPTION_EGLIBC_BACKTRACE
393 WRITE_STRING ("\nBacktrace:\n");
394
395 /* Get the backtrace. */
396@@ -113,6 +115,7 @@
397
398 /* Now generate nicely formatted output. */
399 __backtrace_symbols_fd (arr + i, cnt - i, fd);
400+#endif
401
402 #ifdef HAVE_PROC_SELF
403 /* Now the link map. */
404Index: git/debug/tst-chk1.c
405===================================================================
406--- git.orig/debug/tst-chk1.c 2014-08-29 20:00:46.288070587 -0700
407+++ git/debug/tst-chk1.c 2014-08-29 20:01:15.192070587 -0700
408@@ -31,6 +31,7 @@
409 #include <sys/select.h>
410 #include <sys/socket.h>
411 #include <sys/un.h>
412+#include <gnu/option-groups.h>
413
414
415 #define obstack_chunk_alloc malloc
416@@ -307,6 +308,7 @@
417 snprintf (buf + 8, l0 + 3, "%d", num2);
418 CHK_FAIL_END
419
420+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
421 CHK_FAIL_START
422 swprintf (wbuf + 8, 3, L"%d", num1);
423 CHK_FAIL_END
424@@ -314,6 +316,7 @@
425 CHK_FAIL_START
426 swprintf (wbuf + 8, l0 + 3, L"%d", num1);
427 CHK_FAIL_END
428+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
429 # endif
430
431 memcpy (buf, str1 + 2, l0 + 9);
432@@ -381,6 +384,7 @@
433 CHK_FAIL_END
434 #endif
435
436+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
437
438 /* These ops can be done without runtime checking of object size. */
439 wmemcpy (wbuf, L"abcdefghij", 10);
440@@ -605,6 +609,7 @@
441 CHK_FAIL_END
442 #endif
443
444+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
445
446 /* Now checks for %n protection. */
447
448@@ -1192,6 +1197,7 @@
449 # endif
450 #endif
451
452+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
453 if (setlocale (LC_ALL, "de_DE.UTF-8") != NULL)
454 {
455 assert (MB_CUR_MAX <= 10);
456@@ -1348,6 +1354,7 @@
457 puts ("cannot set locale");
458 ret = 1;
459 }
460+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
461
462 int fd = posix_openpt (O_RDWR);
463 if (fd != -1)
464Index: git/dlfcn/Makefile
465===================================================================
466--- git.orig/dlfcn/Makefile 2014-08-29 20:00:46.312070587 -0700
467+++ git/dlfcn/Makefile 2014-08-29 20:01:15.192070587 -0700
468@@ -15,6 +15,8 @@
469 # License along with the GNU C Library; if not, see
470 # <http://www.gnu.org/licenses/>.
471
472+include ../option-groups.mak
473+
474 subdir := dlfcn
475
476 include ../Makeconfig
477@@ -36,7 +38,9 @@
478 ifeq (yes,$(build-shared))
479 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
480 bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
481- bug-atexit3 tstatexit bug-dl-leaf
482+ tstatexit bug-dl-leaf
483+
484+tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3
485 endif
486 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
487 defaultmod2 errmsg1mod modatexit modcxaatexit \
488Index: git/elf/dl-support.c
489===================================================================
490--- git.orig/elf/dl-support.c 2014-08-29 20:00:46.384070587 -0700
491+++ git/elf/dl-support.c 2014-08-29 20:01:15.192070587 -0700
492@@ -19,6 +19,7 @@
493 /* This file defines some things that for the dynamic linker are defined in
494 rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */
495
496+#include <gnu/option-groups.h>
497 #include <errno.h>
498 #include <libintl.h>
499 #include <stdlib.h>
500@@ -42,7 +43,9 @@
501 const char *_dl_platform;
502 size_t _dl_platformlen;
503
504+#if __OPTION_EGLIBC_RTLD_DEBUG
505 int _dl_debug_mask;
506+#endif
507 int _dl_lazy;
508 ElfW(Addr) _dl_use_load_bias = -2;
509 int _dl_dynamic_weak;
510Index: git/elf/rtld.c
511===================================================================
512--- git.orig/elf/rtld.c 2014-08-29 20:01:14.708070587 -0700
513+++ git/elf/rtld.c 2014-08-29 20:01:15.196070587 -0700
514@@ -16,6 +16,7 @@
515 License along with the GNU C Library; if not, see
516 <http://www.gnu.org/licenses/>. */
517
518+#include <gnu/option-groups.h>
519 #include <errno.h>
520 #include <dlfcn.h>
521 #include <fcntl.h>
522@@ -2200,6 +2201,7 @@
523 objname, errstring);
524 }
525
526+#if __OPTION_EGLIBC_RTLD_DEBUG
527 /* Nonzero if any of the debugging options is enabled. */
528 static int any_debug attribute_relro;
529
530@@ -2309,6 +2311,7 @@
531 _exit (0);
532 }
533 }
534+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
535
536 static void
537 process_dl_audit (char *str)
538@@ -2376,12 +2379,14 @@
539 break;
540
541 case 5:
542+#if __OPTION_EGLIBC_RTLD_DEBUG
543 /* Debugging of the dynamic linker? */
544 if (memcmp (envline, "DEBUG", 5) == 0)
545 {
546 process_dl_debug (&envline[6]);
547 break;
548 }
549+#endif
550 if (memcmp (envline, "AUDIT", 5) == 0)
551 process_dl_audit (&envline[6]);
552 break;
553@@ -2490,7 +2495,9 @@
554 {
555 mode = trace;
556 GLRO(dl_verbose) = 1;
557+#if __OPTION_EGLIBC_RTLD_DEBUG
558 GLRO_dl_debug_mask |= DL_DEBUG_PRELINK;
559+#endif
560 GLRO(dl_trace_prelink) = &envline[17];
561 }
562 break;
563@@ -2537,12 +2544,15 @@
564 if (__access ("/etc/suid-debug", F_OK) != 0)
565 {
566 unsetenv ("MALLOC_CHECK_");
567+#if __OPTION_EGLIBC_RTLD_DEBUG
568 GLRO_dl_debug_mask = 0;
569+#endif
570 }
571
572 if (mode != normal)
573 _exit (5);
574 }
575+#if __OPTION_EGLIBC_RTLD_DEBUG
576 /* If we have to run the dynamic linker in debugging mode and the
577 LD_DEBUG_OUTPUT environment variable is given, we write the debug
578 messages to this file. */
579@@ -2567,6 +2577,7 @@
580 /* We use standard output if opening the file failed. */
581 GLRO(dl_debug_fd) = STDOUT_FILENO;
582 }
583+#endif /* __OPTION_EGLIBC_RTLD_DEBUG */
584 }
585
586
587Index: git/extra-lib.mk
588===================================================================
589--- git.orig/extra-lib.mk 2014-08-29 20:00:46.544070587 -0700
590+++ git/extra-lib.mk 2014-08-29 20:01:15.196070587 -0700
591@@ -25,7 +25,9 @@
592 extra-objs := $(extra-objs)
593
594 # The modules that go in $(lib).
595-all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
596+all-$(lib)-routines := $($(lib)-routines) \
597+ $($(lib)-routines-y) \
598+ $($(lib)-sysdep_routines)
599
600 # Add each flavor of library to the lists of things to build and install.
601 install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
602@@ -101,7 +103,7 @@
603 endif
604
605 # This will define `libof-ROUTINE := LIB' for each of the routines.
606-cpp-srcs-left := $($(lib)-routines) $($(lib)-sysdep_routines)
607+cpp-srcs-left := $(all-$(lib)-routines)
608 ifneq (,$(cpp-srcs-left))
609 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
610 endif
611Index: git/grp/Makefile
612===================================================================
613--- git.orig/grp/Makefile 2014-08-29 20:00:46.556070587 -0700
614+++ git/grp/Makefile 2014-08-29 20:01:15.196070587 -0700
615@@ -18,6 +18,8 @@
616 #
617 # Sub-makefile for grp portion of the library.
618 #
619+include ../option-groups.mak
620+
621 subdir := grp
622
623 include ../Makeconfig
624@@ -29,6 +31,9 @@
625 getgrent_r getgrgid_r getgrnam_r fgetgrent_r
626
627 tests := testgrp
628+ifneq (y,$(OPTION_EGLIBC_NSSWITCH))
629+LDLIBS-testgrp += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
630+endif
631
632 ifeq (yes,$(build-shared))
633 test-srcs := tst_fgetgrent
634Index: git/hesiod/Makefile
635===================================================================
636--- git.orig/hesiod/Makefile 2014-08-29 20:00:46.580070587 -0700
637+++ git/hesiod/Makefile 2014-08-29 20:01:15.196070587 -0700
638@@ -18,12 +18,14 @@
639 #
640 # Sub-makefile for hesiod portion of the library.
641 #
642+include ../option-groups.mak
643+
644 subdir := hesiod
645
646 include ../Makeconfig
647
648-extra-libs := libnss_hesiod
649-extra-libs-others = $(extra-libs)
650+extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod
651+extra-libs-others-y += $(extra-libs-y)
652
653 subdir-dirs = nss_hesiod
654 vpath %.c nss_hesiod
655Index: git/iconv/gconv_db.c
656===================================================================
657--- git.orig/iconv/gconv_db.c 2014-08-29 20:00:46.604070587 -0700
658+++ git/iconv/gconv_db.c 2014-08-29 20:01:15.196070587 -0700
659@@ -25,6 +25,7 @@
660 #include <sys/param.h>
661 #include <bits/libc-lock.h>
662 #include <locale/localeinfo.h>
663+#include <gnu/option-groups.h>
664
665 #include <dlfcn.h>
666 #include <gconv_int.h>
667@@ -828,9 +829,11 @@
668 /* Free all resources if necessary. */
669 libc_freeres_fn (free_mem)
670 {
671+#if __OPTION_EGLIBC_LOCALE_CODE
672 /* First free locale memory. This needs to be done before freeing derivations,
673 as ctype cleanup functions dereference steps arrays which we free below. */
674 _nl_locale_subfreeres ();
675+#endif
676
677 /* finddomain.c has similar problem. */
678 extern void _nl_finddomain_subfreeres (void) attribute_hidden;
679Index: git/iconv/gconv_trans.c
680===================================================================
681--- git.orig/iconv/gconv_trans.c 2014-08-29 20:00:46.612070587 -0700
682+++ git/iconv/gconv_trans.c 2014-08-29 20:01:15.196070587 -0700
683@@ -23,6 +23,7 @@
684 #include <stdint.h>
685 #include <string.h>
686 #include <stdlib.h>
687+#include <gnu/option-groups.h>
688
689 #include <bits/libc-lock.h>
690 #include "gconv_int.h"
691@@ -59,6 +60,7 @@
692 PTR_DEMANGLE (fct);
693 #endif
694
695+#if __OPTION_EGLIBC_LOCALE_CODE
696 /* If there is no transliteration information in the locale don't do
697 anything and return the error. */
698 size = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_TAB_SIZE);
699@@ -194,6 +196,7 @@
700 sorted. */
701 break;
702 }
703+#endif
704
705 /* One last chance: use the default replacement. */
706 if (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN) != 0)
707Index: git/iconv/iconv_prog.c
708===================================================================
709--- git.orig/iconv/iconv_prog.c 2014-08-29 20:00:46.612070587 -0700
710+++ git/iconv/iconv_prog.c 2014-08-29 20:01:15.196070587 -0700
711@@ -35,6 +35,7 @@
712 #ifdef _POSIX_MAPPED_FILES
713 # include <sys/mman.h>
714 #endif
715+#include <gnu/option-groups.h>
716 #include <charmap.h>
717 #include <gconv_int.h>
718 #include "iconv_prog.h"
719@@ -221,10 +222,17 @@
720 bool to_wrong =
721 (iconv_open (to_code, "UTF-8") == (iconv_t) -1
722 && errno == EINVAL);
723+#if __OPTION_EGLIBC_LOCALE_CODE
724 const char *from_pretty =
725 (from_code[0] ? from_code : nl_langinfo (CODESET));
726 const char *to_pretty =
727 (orig_to_code[0] ? orig_to_code : nl_langinfo (CODESET));
728+#else
729+ const char *from_pretty =
730+ (from_code[0] ? from_code : "ANSI_X3.4-1968");
731+ const char *to_pretty =
732+ (orig_to_code[0] ? orig_to_code : "ANSI_X3.4-1968");
733+#endif
734
735 if (from_wrong)
736 {
737Index: git/iconv/Makefile
738===================================================================
739--- git.orig/iconv/Makefile 2014-08-29 20:00:46.600070587 -0700
740+++ git/iconv/Makefile 2014-08-29 20:01:15.196070587 -0700
741@@ -18,6 +18,8 @@
742 #
743 # Makefile for iconv.
744 #
745+include ../option-groups.mak
746+
747 subdir := iconv
748
749 include ../Makeconfig
750@@ -57,6 +59,9 @@
751 CPPFLAGS-strtab = -DNOT_IN_libc
752 CPPFLAGS-charmap = -DNOT_IN_libc
753 CPPFLAGS-charmap-dir = -DNOT_IN_libc
754+ifneq (y,$(OPTION_EGLIBC_SPAWN))
755+CPPFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
756+endif
757
758 ifeq ($(run-built-tests),yes)
759 xtests-special += $(objpfx)test-iconvconfig.out
760Index: git/iconvdata/Makefile
761===================================================================
762--- git.orig/iconvdata/Makefile 2014-08-29 20:00:46.628070587 -0700
763+++ git/iconvdata/Makefile 2014-08-29 20:01:15.196070587 -0700
764@@ -18,12 +18,15 @@
765 #
766 # Makefile for iconv data and code.
767 #
768+include ../option-groups.mak
769+
770 subdir := iconvdata
771
772 include ../Makeconfig
773
774 # Names of all the shared objects which implement the transformations.
775-modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
776+modules-$(OPTION_EGLIBC_CHARSETS) \
777+ := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
778 ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 \
779 ISO8859-11 ISO8859-13 ISO8859-14 ISO8859-15 ISO8859-16 \
780 T.61 ISO_6937 SJIS KOI-8 HP-ROMAN8 HP-ROMAN9 EBCDIC-AT-DE \
781@@ -63,11 +66,13 @@
782 MAC-CENTRALEUROPE KOI8-RU ISO8859-9E \
783 CP770 CP771 CP772 CP773 CP774
784
785-modules.so := $(addsuffix .so, $(modules))
786+modules.so := $(addsuffix .so, $(modules-y))
787
788 ifeq (yes,$(build-shared))
789 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
790- tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
791+ tst-iconv6 bug-iconv5 bug-iconv8 bug-iconv9
792+tests-$(OPTION_EGLIBC_LOCALE_CODE) += bug-iconv6 tst-iconv7
793+
794 ifeq ($(have-thread-library),yes)
795 tests += bug-iconv3
796 endif
797@@ -130,13 +135,13 @@
798 # Rule to generate the shared objects.
799 charmaps = ../localedata/charmaps
800 -include $(objpfx)iconv-rules
801-extra-modules-left := $(modules)
802+extra-modules-left := $(modules-y)
803 include extra-module.mk
804
805
806 extra-objs += $(modules.so)
807-install-others = $(addprefix $(inst_gconvdir)/, $(modules.so)) \
808- $(inst_gconvdir)/gconv-modules
809+install-others-y += $(addprefix $(inst_gconvdir)/, $(modules.so))
810+install-others-$(OPTION_EGLIBC_CHARSETS) += $(inst_gconvdir)/gconv-modules
811
812 # We can build the conversion tables for numerous charsets automatically.
813
814@@ -204,7 +209,7 @@
815 ifndef avoid-generated
816 $(objpfx)iconv-rules: Makefile
817 $(make-target-directory)
818- { echo $(filter-out lib%, $(modules)); \
819+ { echo $(filter-out lib%, $(modules-y)); \
820 echo 8bit $(gen-8bit-modules); \
821 echo 8bit-gap $(gen-8bit-gap-modules); } | \
822 LC_ALL=C \
823@@ -247,7 +252,7 @@
824 $(do-install-program)
825 $(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
826 $(do-install)
827-ifeq (no,$(cross-compiling))
828+# eglibc: ifeq (no,$(cross-compiling))
829 # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
830 # if this libc has more gconv modules than the previously installed one.
831 if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
832@@ -256,9 +261,9 @@
833 $(common-objpfx)iconv/iconvconfig \
834 $(addprefix --prefix=,$(install_root)); \
835 fi
836-else
837- @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
838-endif
839+# eglibc: else
840+# eglibc: @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
841+# eglibc: endif
842
843 endif # build-shared = yes
844
845Index: git/include/netdb.h
846===================================================================
847--- git.orig/include/netdb.h 2014-08-29 20:00:47.152070587 -0700
848+++ git/include/netdb.h 2014-08-29 20:01:15.196070587 -0700
849@@ -232,6 +232,10 @@
850 (const char *name, int af, struct hostent *host, \
851 char *buffer, size_t buflen, int *errnop, \
852 int *h_errnop); \
853+extern enum nss_status _nss_ ## service ## _gethostbyname3_r \
854+ (const char *name, int af, struct hostent *result, \
855+ char *buffer, size_t buflen, int *errnop, \
856+ int *h_errnop, int32_t *ttlp, char **canonp); \
857 extern enum nss_status _nss_ ## service ## _gethostbyname_r \
858 (const char *name, struct hostent *host, char *buffer, \
859 size_t buflen, int *errnop, int *h_errnop); \
860Index: git/inet/Makefile
861===================================================================
862--- git.orig/inet/Makefile 2014-08-29 20:00:47.176070587 -0700
863+++ git/inet/Makefile 2014-08-29 20:01:15.200070587 -0700
864@@ -18,6 +18,8 @@
865 #
866 # Sub-makefile for inet portion of the library.
867 #
868+include ../option-groups.mak
869+
870 subdir := inet
871
872 include ../Makeconfig
873@@ -27,7 +29,8 @@
874 netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
875 aliases.h ifaddrs.h netinet/ip6.h netinet/icmp6.h bits/in.h
876
877-routines := htonl htons \
878+routines-$(OPTION_EGLIBC_INET) \
879+ += htonl htons \
880 inet_lnaof inet_mkadr \
881 inet_netof inet_ntoa inet_net herrno herrno-loc \
882 gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
883@@ -41,18 +44,23 @@
884 getrpcent_r getrpcbyname_r getrpcbynumber_r \
885 ether_aton ether_aton_r ether_hton ether_line \
886 ether_ntoa ether_ntoa_r ether_ntoh \
887- rcmd rexec ruserpass \
888 getnetgrent_r getnetgrent \
889- getaliasent_r getaliasent getaliasname getaliasname_r \
890- in6_addr getnameinfo if_index ifaddrs inet6_option \
891+ in6_addr getnameinfo if_index ifaddrs \
892 getipv4sourcefilter setipv4sourcefilter \
893- getsourcefilter setsourcefilter inet6_opt inet6_rth
894+ getsourcefilter setsourcefilter
895+routines-$(OPTION_EGLIBC_RCMD) \
896+ += rcmd rexec ruserpass
897+routines-$(OPTION_EGLIBC_DB_ALIASES) \
898+ += getaliasent_r getaliasent getaliasname getaliasname_r
899+routines-$(OPTION_EGLIBC_ADVANCED_INET6) \
900+ += inet6_option inet6_opt inet6_rth
901
902-aux := check_pf check_native ifreq
903+aux-$(OPTION_EGLIBC_INET) += check_pf check_native ifreq
904
905 tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
906- tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
907+ tst-gethnm test-ifaddrs bug-if1 tst-ether_line \
908 tst-getni1 tst-getni2 tst-inet6_rth tst-checks
909+tests-$(OPTION_EGLIBC_ADVANCED_INET6) += test-inet6_opt
910
911 include ../Rules
912
913Index: git/intl/dcigettext.c
914===================================================================
915--- git.orig/intl/dcigettext.c 2014-08-29 20:00:47.224070587 -0700
916+++ git/intl/dcigettext.c 2014-08-29 20:01:15.200070587 -0700
917@@ -77,6 +77,10 @@
918 #endif
919 #include "hash-string.h"
920
921+#ifdef _LIBC
922+# include <gnu/option-groups.h>
923+#endif
924+
925 /* Thread safetyness. */
926 #ifdef _LIBC
927 # include <bits/libc-lock.h>
928@@ -449,9 +453,11 @@
929 #endif
930
931 #ifdef _LIBC
932+#if __OPTION_EGLIBC_LOCALE_CODE
933 __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
934 __libc_rwlock_rdlock (__libc_setlocale_lock);
935 #endif
936+#endif
937
938 __libc_rwlock_rdlock (_nl_state_lock);
939
940@@ -470,7 +476,11 @@
941 search.category = category;
942 # ifdef HAVE_PER_THREAD_LOCALE
943 # ifdef _LIBC
944+# if __OPTION_EGLIBC_LOCALE_CODE
945 localename = strdupa (__current_locale_name (category));
946+# else
947+ localename = "C";
948+# endif
949 # endif
950 search.localename = localename;
951 # endif
952@@ -494,7 +504,9 @@
953 retval = (char *) (*foundp)->translation;
954
955 # ifdef _LIBC
956+#if __OPTION_EGLIBC_LOCALE_CODE
957 __libc_rwlock_unlock (__libc_setlocale_lock);
958+#endif
959 # endif
960 __libc_rwlock_unlock (_nl_state_lock);
961 return retval;
962@@ -611,7 +623,9 @@
963 {
964 no_translation:
965 FREE_BLOCKS (block_list);
966+#if __OPTION_EGLIBC_LOCALE_CODE
967 __libc_rwlock_unlock (__libc_setlocale_lock);
968+#endif
969 __libc_rwlock_unlock (_nl_state_lock);
970 __set_errno (saved_errno);
971 return (plural == 0
972@@ -730,7 +744,9 @@
973 if (plural)
974 retval = plural_lookup (domain, n, retval, retlen);
975
976+#if __OPTION_EGLIBC_LOCALE_CODE
977 __libc_rwlock_unlock (__libc_setlocale_lock);
978+#endif
979 __libc_rwlock_unlock (_nl_state_lock);
980 return retval;
981 }
982@@ -1361,7 +1377,11 @@
983 `LC_xxx', and `LANG'. On some systems this can be done by the
984 `setlocale' function itself. */
985 #ifdef _LIBC
986+# if __OPTION_EGLIBC_LOCALE_CODE
987 retval = __current_locale_name (category);
988+# else
989+ retval = "C";
990+# endif
991 #else
992 retval = _nl_locale_name (category, categoryname);
993 #endif
994Index: git/intl/Makefile
995===================================================================
996--- git.orig/intl/Makefile 2014-08-29 20:00:47.220070587 -0700
997+++ git/intl/Makefile 2014-08-29 20:01:15.200070587 -0700
998@@ -16,6 +16,7 @@
999 # <http://www.gnu.org/licenses/>.
1000
1001 # Makefile for intl subdirectory: message handling code from GNU gettext.
1002+include ../option-groups.mak
1003
1004 subdir = intl
1005
1006@@ -48,7 +49,7 @@
1007 $(objpfx)plural.o: plural.c
1008
1009 ifeq ($(run-built-tests),yes)
1010-ifeq (yes,$(build-shared))
1011+ifeq (yyyes,$(OPTION_EGLIBC_LOCALES)$(OPTION_EGLIBC_LOCALE_CODE)$(build-shared))
1012 ifneq ($(strip $(MSGFMT)),:)
1013 tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
1014 $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
1015Index: git/io/Makefile
1016===================================================================
1017--- git.orig/io/Makefile 2014-08-29 20:00:47.244070587 -0700
1018+++ git/io/Makefile 2014-08-29 20:01:15.200070587 -0700
1019@@ -18,6 +18,8 @@
1020 #
1021 # Sub-makefile for I/O portion of the library.
1022 #
1023+include ../option-groups.mak
1024+
1025 subdir := io
1026
1027 include ../Makeconfig
1028@@ -36,7 +38,7 @@
1029 fxstatat fxstatat64 \
1030 statfs fstatfs statfs64 fstatfs64 \
1031 statvfs fstatvfs statvfs64 fstatvfs64 \
1032- umask chmod fchmod lchmod fchmodat \
1033+ umask chmod fchmod fchmodat \
1034 mkdir mkdirat \
1035 open open_2 open64 open64_2 openat openat_2 openat64 openat64_2 \
1036 read write lseek lseek64 access euidaccess faccessat \
1037@@ -49,11 +51,13 @@
1038 ttyname ttyname_r isatty \
1039 link linkat symlink symlinkat readlink readlinkat \
1040 unlink unlinkat rmdir \
1041- ftw ftw64 fts poll ppoll \
1042+ poll ppoll \
1043 posix_fadvise posix_fadvise64 \
1044 posix_fallocate posix_fallocate64 \
1045 sendfile sendfile64 \
1046 utimensat futimens
1047+routines-$(OPTION_EGLIBC_BSD) += lchmod
1048+routines-$(OPTION_EGLIBC_FTRAVERSE) += ftw ftw64 fts
1049
1050 aux := have_o_cloexec
1051
1052@@ -64,18 +68,22 @@
1053 fstatat fstatat64 mknod mknodat
1054
1055 others := pwd
1056-test-srcs := ftwtest
1057+test-srcs-$(OPTION_EGLIBC_FTRAVERSE) := ftwtest
1058 tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
1059- tst-fcntl bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 tst-statvfs \
1060+ tst-fcntl tst-statvfs \
1061 tst-openat tst-unlinkat tst-fstatat tst-futimesat \
1062 tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
1063 tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
1064- tst-mknodat tst-mkfifoat tst-ttyname_r bug-ftw5 \
1065+ tst-mknodat tst-mkfifoat tst-ttyname_r \
1066 tst-posix_fallocate
1067+tests-$(OPTION_EGLIBC_FTRAVERSE) += bug-ftw1 bug-ftw2 bug-ftw3 bug-ftw4 \
1068+ bug-ftw5
1069
1070 ifeq ($(run-built-tests),yes)
1071+ifeq (y,$(OPTION_EGLIBC_FTRAVERSE))
1072 tests-special += $(objpfx)ftwtest.out
1073 endif
1074+endif
1075
1076 include ../Rules
1077
1078Index: git/libidn/Makefile
1079===================================================================
1080--- git.orig/libidn/Makefile 2014-08-29 20:00:47.316070587 -0700
1081+++ git/libidn/Makefile 2014-08-29 20:01:15.200070587 -0700
1082@@ -16,6 +16,7 @@
1083 # <http://www.gnu.org/licenses/>.
1084
1085 # Makefile for libidn subdirectory of GNU C Library.
1086+include ../option-groups.mak
1087
1088 subdir := libidn
1089
1090@@ -23,8 +24,8 @@
1091
1092 routines = idn-stub
1093
1094-extra-libs = libcidn
1095-extra-libs-others = $(extra-libs)
1096+extra-libs-$(OPTION_EGLIBC_IDN) = libcidn
1097+extra-libs-others-y = $(extra-libs-y)
1098
1099 libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
1100 iconvme
1101Index: git/libidn/toutf8.c
1102===================================================================
1103--- git.orig/libidn/toutf8.c 2014-08-29 20:00:47.332070587 -0700
1104+++ git/libidn/toutf8.c 2014-08-29 20:01:15.200070587 -0700
1105@@ -33,6 +33,11 @@
1106 /* Get strlen. */
1107 #include <string.h>
1108
1109+/* Get __OPTION_EGLIBC_LOCALE_CODE. */
1110+#ifdef _LIBC
1111+# include <gnu/option-groups.h>
1112+#endif
1113+
1114 /* Get iconv_string. */
1115 #include "iconvme.h"
1116
1117@@ -47,7 +52,11 @@
1118 #endif
1119
1120 #ifdef _LIBC
1121-# define stringprep_locale_charset() nl_langinfo (CODESET)
1122+# if __OPTION_EGLIBC_LOCALE_CODE
1123+# define stringprep_locale_charset() nl_langinfo (CODESET)
1124+# else
1125+# define stringprep_locale_charset() "ANSI_X3.4-1968"
1126+# endif
1127 #else
1128 /**
1129 * stringprep_locale_charset - return charset used in current locale
1130Index: git/libio/fileops.c
1131===================================================================
1132--- git.orig/libio/fileops.c 2014-08-29 20:00:47.352070587 -0700
1133+++ git/libio/fileops.c 2014-08-29 20:01:15.200070587 -0700
1134@@ -38,6 +38,7 @@
1135 #include <string.h>
1136 #include <errno.h>
1137 #include <unistd.h>
1138+#include <gnu/option-groups.h>
1139 #include <stdlib.h>
1140 #if _LIBC
1141 # include "../wcsmbs/wcsmbsload.h"
1142@@ -174,7 +175,7 @@
1143
1144 /* Free buffer. */
1145 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
1146- if (fp->_mode > 0)
1147+ if (_IO_is_wide (fp))
1148 {
1149 if (_IO_have_wbackup (fp))
1150 _IO_free_wbackup_area (fp);
1151@@ -359,6 +360,7 @@
1152 cs = strstr (last_recognized + 1, ",ccs=");
1153 if (cs != NULL)
1154 {
1155+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
1156 /* Yep. Load the appropriate conversions and set the orientation
1157 to wide. */
1158 struct gconv_fcts fcts;
1159@@ -423,6 +425,12 @@
1160
1161 /* Set the mode now. */
1162 result->_mode = 1;
1163+#else
1164+ /* Treat this as if we couldn't find the given character set. */
1165+ (void) _IO_file_close_it (fp);
1166+ __set_errno (EINVAL);
1167+ return NULL;
1168+#endif
1169 }
1170 }
1171
1172Index: git/libio/__fpurge.c
1173===================================================================
1174--- git.orig/libio/__fpurge.c 2014-08-29 20:00:47.336070587 -0700
1175+++ git/libio/__fpurge.c 2014-08-29 20:01:15.200070587 -0700
1176@@ -21,7 +21,7 @@
1177 void
1178 __fpurge (FILE *fp)
1179 {
1180- if (fp->_mode > 0)
1181+ if (_IO_is_wide (fp))
1182 {
1183 /* Wide-char stream. */
1184 if (_IO_in_backup (fp))
1185Index: git/libio/iofwide.c
1186===================================================================
1187--- git.orig/libio/iofwide.c 2014-08-29 20:00:47.360070587 -0700
1188+++ git/libio/iofwide.c 2014-08-29 20:01:15.200070587 -0700
1189@@ -26,6 +26,7 @@
1190
1191 #include <libioP.h>
1192 #ifdef _LIBC
1193+# include <gnu/option-groups.h>
1194 # include <dlfcn.h>
1195 # include <wchar.h>
1196 #endif
1197@@ -43,6 +44,8 @@
1198 #endif
1199
1200
1201+#if ! defined _LIBC || __OPTION_POSIX_C_LANG_WIDE_CHAR
1202+
1203 /* Prototypes of libio's codecvt functions. */
1204 static enum __codecvt_result do_out (struct _IO_codecvt *codecvt,
1205 __mbstate_t *statep,
1206@@ -513,3 +516,26 @@
1207 return MB_CUR_MAX;
1208 #endif
1209 }
1210+
1211+#else
1212+/* OPTION_POSIX_C_LANG_WIDE_CHAR is disabled. */
1213+
1214+#undef _IO_fwide
1215+int
1216+_IO_fwide (fp, mode)
1217+ _IO_FILE *fp;
1218+ int mode;
1219+{
1220+ /* Die helpfully if the user tries to create a wide stream; I
1221+ disbelieve that most users check the return value from
1222+ 'fwide (fp, 1)'. */
1223+ assert (mode <= 0);
1224+
1225+ /* We can only make streams byte-oriented, which is trivial. */
1226+ if (mode < 0)
1227+ fp->_mode = -1;
1228+
1229+ return fp->_mode;
1230+}
1231+
1232+#endif
1233Index: git/libio/ioseekoff.c
1234===================================================================
1235--- git.orig/libio/ioseekoff.c 2014-08-29 20:00:47.364070587 -0700
1236+++ git/libio/ioseekoff.c 2014-08-29 20:01:15.200070587 -0700
1237@@ -60,7 +60,7 @@
1238 else
1239 abort ();
1240 }
1241- if (_IO_fwide (fp, 0) < 0)
1242+ if (! _IO_is_wide (fp))
1243 _IO_free_backup_area (fp);
1244 else
1245 _IO_free_wbackup_area (fp);
1246Index: git/libio/ioseekpos.c
1247===================================================================
1248--- git.orig/libio/ioseekpos.c 2014-08-29 20:00:47.364070587 -0700
1249+++ git/libio/ioseekpos.c 2014-08-29 20:01:15.200070587 -0700
1250@@ -35,7 +35,7 @@
1251 /* If we have a backup buffer, get rid of it, since the __seekoff
1252 callback may not know to do the right thing about it.
1253 This may be over-kill, but it'll do for now. TODO */
1254- if (_IO_fwide (fp, 0) <= 0)
1255+ if (! _IO_is_wide (fp))
1256 {
1257 if (_IO_have_backup (fp))
1258 _IO_free_backup_area (fp);
1259Index: git/libio/iosetbuffer.c
1260===================================================================
1261--- git.orig/libio/iosetbuffer.c 2014-08-29 20:00:47.364070587 -0700
1262+++ git/libio/iosetbuffer.c 2014-08-29 20:01:15.204070587 -0700
1263@@ -24,6 +24,8 @@
1264 This exception applies to code released by its copyright holders
1265 in files containing the exception. */
1266
1267+#include <gnu/option-groups.h>
1268+
1269 #include "libioP.h"
1270
1271 void
1272@@ -38,9 +40,11 @@
1273 if (!buf)
1274 size = 0;
1275 (void) _IO_SETBUF (fp, buf, size);
1276+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
1277 if (_IO_vtable_offset (fp) == 0 && fp->_mode == 0 && _IO_CHECK_WIDE (fp))
1278 /* We also have to set the buffer using the wide char function. */
1279 (void) _IO_WSETBUF (fp, buf, size);
1280+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
1281 _IO_release_lock (fp);
1282 }
1283 libc_hidden_def (_IO_setbuffer)
1284Index: git/libio/libioP.h
1285===================================================================
1286--- git.orig/libio/libioP.h 2014-08-29 20:00:47.372070587 -0700
1287+++ git/libio/libioP.h 2014-08-29 20:01:15.204070587 -0700
1288@@ -42,6 +42,10 @@
1289 /*# include <comthread.h>*/
1290 #endif
1291
1292+#if defined _LIBC
1293+# include <gnu/option-groups.h>
1294+#endif
1295+
1296 #include <math_ldbl_opt.h>
1297
1298 #include "iolibio.h"
1299@@ -508,8 +512,20 @@
1300
1301
1302 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
1303+
1304+/* _IO_is_wide (fp) is roughly equivalent to '_IO_fwide (fp, 0) > 0',
1305+ except that when OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, it
1306+ expands to a constant, allowing the compiler to realize that it can
1307+ eliminate code that references wide stream handling functions.
1308+ This, in turn, allows us to omit them. */
1309+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
1310+# define _IO_is_wide(_f) ((_f)->_mode > 0)
1311+#else
1312+# define _IO_is_wide(_f) (0)
1313+#endif
1314+
1315 # define _IO_do_flush(_f) \
1316- ((_f)->_mode <= 0 \
1317+ (! _IO_is_wide (_f) \
1318 ? _IO_do_write(_f, (_f)->_IO_write_base, \
1319 (_f)->_IO_write_ptr-(_f)->_IO_write_base) \
1320 : _IO_wdo_write(_f, (_f)->_wide_data->_IO_write_base, \
1321Index: git/libio/Makefile
1322===================================================================
1323--- git.orig/libio/Makefile 2014-08-29 20:00:47.332070587 -0700
1324+++ git/libio/Makefile 2014-08-29 20:01:15.204070587 -0700
1325@@ -18,6 +18,8 @@
1326 #
1327 # Specific makefile for libio.
1328 #
1329+include ../option-groups.mak
1330+
1331 subdir := libio
1332
1333 include ../Makeconfig
1334@@ -27,16 +29,13 @@
1335
1336 routines := \
1337 filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
1338- iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
1339+ iofopncook iofputs iofread iofsetpos ioftell \
1340 iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
1341 ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
1342 iovsprintf iovsscanf \
1343 iofgetpos64 iofopen64 iofsetpos64 \
1344- fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
1345- iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
1346- putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
1347- wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
1348- wstrops wfileops iofwide fwide wmemstream \
1349+ putchar putchar_u \
1350+ iofwide \
1351 \
1352 clearerr feof ferror fileno fputc freopen fseek getc getchar \
1353 memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
1354@@ -47,25 +46,48 @@
1355 __fpurge __fpending __fsetlocking \
1356 \
1357 libc_fatal fmemopen
1358-
1359-tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
1360- tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
1361- tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
1362- tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
1363- tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
1364- tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
1365- tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
1366- bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
1367- tst-memstream1 tst-memstream2 \
1368- tst-wmemstream1 tst-wmemstream2 \
1369- bug-memstream1 bug-wmemstream1 \
1370- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
1371- tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
1372- tst-ftell-append
1373+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
1374+ wfiledoalloc \
1375+ iowpadn \
1376+ swprintf \
1377+ vswprintf iovswscanf swscanf wgenops \
1378+ wstrops wfileops wmemstream
1379+routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += \
1380+ wdummyfileops
1381+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += \
1382+ fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
1383+ iofputws iofputws_u iogetwline ioungetwc putwc putwc_u \
1384+ putwchar putwchar_u fwprintf vwprintf \
1385+ wprintf wscanf fwscanf vwscanf \
1386+ fwide
1387+
1388+tests = test-fmemopen tst-ext tst-ext2 \
1389+ tst-mmap-setvbuf tst-atime tst-eof \
1390+ tst-freopen bug-ungetc bug-fseek \
1391+ tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
1392+ tst-mmap2-eofsync tst-mmap-offend bug-fopena+ \
1393+ bug-ungetc2 bug-ungetc3 bug-ungetc4 \
1394+ tst-memstream1 tst-memstream2 \
1395+ bug-memstream1 tst-popen1 tst-fwrite-error \
1396+ tst-ftell-active-handler tst-ftell-append
1397+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
1398+ += tst-swscanf tst-fgetws tst-setvbuf1 \
1399+ tst-ungetwc1 tst-ungetwc2 bug-ftell bug-ungetwc2 \
1400+ tst-widetext
1401+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
1402+ += bug-rewind bug-rewind2 bug-ungetwc1 \
1403+ bug-wfflush bug-wmemstream1 tst-fopenloc2 \
1404+ tst_getwc \
1405+ tst_putwc tst_wprintf tst_wprintf2 tst_wscanf \
1406+ tst-fgetwc bug-wsetpos tst-fseek tst-ftell-partial-wide
1407+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
1408+ += tst_swprintf tst_swscanf \
1409+ tst-sscanf \
1410+ tst-wmemstream1 tst-wmemstream2
1411 ifeq (yes,$(build-shared))
1412 # Add test-fopenloc only if shared library is enabled since it depends on
1413 # shared localedata objects.
1414-tests += tst-fopenloc
1415+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-fopenloc
1416 endif
1417 test-srcs = test-freopen
1418
1419@@ -164,13 +186,17 @@
1420 oldiofsetpos64
1421
1422 ifeq ($(run-built-tests),yes)
1423+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
1424 tests-special += $(objpfx)test-freopen.out
1425+endif
1426+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
1427 ifeq (yes,$(build-shared))
1428 # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
1429 # library is enabled since they depend on tst-fopenloc.out.
1430 tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
1431 endif
1432 endif
1433+endif
1434
1435 include ../Rules
1436
1437Index: git/libio/wdummyfileops.c
1438===================================================================
1439--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1440+++ git/libio/wdummyfileops.c 2014-08-29 20:01:15.204070587 -0700
1441@@ -0,0 +1,161 @@
1442+/* Copyright (C) 2007 Free Software Foundation, Inc.
1443+ This file is part of the GNU C Library.
1444+
1445+ The GNU C Library is free software; you can redistribute it and/or
1446+ modify it under the terms of the GNU Lesser General Public
1447+ License as published by the Free Software Foundation; either
1448+ version 2.1 of the License, or (at your option) any later version.
1449+
1450+ The GNU C Library is distributed in the hope that it will be useful,
1451+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1452+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1453+ Lesser General Public License for more details.
1454+
1455+ You should have received a copy of the GNU Lesser General Public
1456+ License along with the GNU C Library; if not, write to the Free
1457+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1458+ 02111-1307 USA.
1459+
1460+ As a special exception, if you link the code in this file with
1461+ files compiled with a GNU compiler to produce an executable,
1462+ that does not cause the resulting executable to be covered by
1463+ the GNU Lesser General Public License. This exception does not
1464+ however invalidate any other reasons why the executable file
1465+ might be covered by the GNU Lesser General Public License.
1466+ This exception applies to code released by its copyright holders
1467+ in files containing the exception. */
1468+
1469+#include <assert.h>
1470+#include <stdio.h>
1471+#include <stdlib.h>
1472+#include <libioP.h>
1473+
1474+static void __THROW __attribute__ ((__noreturn__))
1475+_IO_wfile_wide_char_support_disabled (void)
1476+{
1477+ static const char errstr[]
1478+ = ("The application tried to use wide character I/O, but libc.so"
1479+ " was compiled\n"
1480+ "with the OPTION_POSIX_C_LANG_WIDE_CHAR option group disabled.\n");
1481+ __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
1482+ abort ();
1483+}
1484+
1485+static void
1486+_IO_wfile_disabled_void_int (_IO_FILE *fp, int x)
1487+{
1488+ _IO_wfile_wide_char_support_disabled ();
1489+}
1490+
1491+static int
1492+_IO_wfile_disabled_int_int (_IO_FILE *fp, int x)
1493+{
1494+ _IO_wfile_wide_char_support_disabled ();
1495+}
1496+
1497+static int
1498+_IO_wfile_disabled_int_none (_IO_FILE *fp)
1499+{
1500+ _IO_wfile_wide_char_support_disabled ();
1501+}
1502+
1503+static _IO_size_t
1504+_IO_wfile_disabled_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n)
1505+{
1506+ _IO_wfile_wide_char_support_disabled ();
1507+}
1508+
1509+static _IO_size_t
1510+_IO_wfile_disabled_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
1511+{
1512+ _IO_wfile_wide_char_support_disabled ();
1513+}
1514+
1515+static _IO_off64_t
1516+_IO_wfile_disabled_seekoff (_IO_FILE *fp, _IO_off64_t off, int dir, int mode)
1517+{
1518+ _IO_wfile_wide_char_support_disabled ();
1519+}
1520+
1521+static _IO_off64_t
1522+_IO_wfile_disabled_seekpos (_IO_FILE *fp, _IO_off64_t pos, int flags)
1523+{
1524+ _IO_wfile_wide_char_support_disabled ();
1525+}
1526+
1527+static _IO_FILE *
1528+_IO_wfile_disabled_setbuf (_IO_FILE *fp, char *buffer, _IO_ssize_t length)
1529+{
1530+ _IO_wfile_wide_char_support_disabled ();
1531+}
1532+
1533+static _IO_ssize_t
1534+_IO_wfile_disabled_read (_IO_FILE *fp, void *buffer, _IO_ssize_t length)
1535+{
1536+ _IO_wfile_wide_char_support_disabled ();
1537+}
1538+
1539+static _IO_ssize_t
1540+_IO_wfile_disabled_write (_IO_FILE *fp, const void *buffer, _IO_ssize_t length)
1541+{
1542+ _IO_wfile_wide_char_support_disabled ();
1543+}
1544+
1545+static _IO_off64_t
1546+_IO_wfile_disabled_seek (_IO_FILE *fp, _IO_off64_t offset, int mode)
1547+{
1548+ _IO_wfile_wide_char_support_disabled ();
1549+}
1550+
1551+static int
1552+_IO_wfile_disabled_close (_IO_FILE *fp)
1553+{
1554+ _IO_wfile_wide_char_support_disabled ();
1555+}
1556+
1557+static int
1558+_IO_wfile_disabled_stat (_IO_FILE *fp, void *buf)
1559+{
1560+ _IO_wfile_wide_char_support_disabled ();
1561+}
1562+
1563+static int
1564+_IO_wfile_disabled_showmanyc (_IO_FILE *fp)
1565+{
1566+ _IO_wfile_wide_char_support_disabled ();
1567+}
1568+
1569+static void
1570+_IO_wfile_disabled_imbue (_IO_FILE *fp, void *locale)
1571+{
1572+ _IO_wfile_wide_char_support_disabled ();
1573+}
1574+
1575+static const struct _IO_jump_t _IO_wfile_jumps_disabled =
1576+{
1577+ JUMP_INIT_DUMMY,
1578+ JUMP_INIT(finish, _IO_wfile_disabled_void_int),
1579+ JUMP_INIT(overflow, _IO_wfile_disabled_int_int),
1580+ JUMP_INIT(underflow, _IO_wfile_disabled_int_none),
1581+ JUMP_INIT(uflow, _IO_wfile_disabled_int_none),
1582+ JUMP_INIT(pbackfail, _IO_wfile_disabled_int_int),
1583+ JUMP_INIT(xsputn, _IO_wfile_disabled_xsputn),
1584+ JUMP_INIT(xsgetn, _IO_wfile_disabled_xsgetn),
1585+ JUMP_INIT(seekoff, _IO_wfile_disabled_seekoff),
1586+ JUMP_INIT(seekpos, _IO_wfile_disabled_seekpos),
1587+ JUMP_INIT(setbuf, _IO_wfile_disabled_setbuf),
1588+ JUMP_INIT(sync, _IO_wfile_disabled_int_none),
1589+ JUMP_INIT(doallocate, _IO_wfile_disabled_int_none),
1590+ JUMP_INIT(read, _IO_wfile_disabled_read),
1591+ JUMP_INIT(write, _IO_wfile_disabled_write),
1592+ JUMP_INIT(seek, _IO_wfile_disabled_seek),
1593+ JUMP_INIT(close, _IO_wfile_disabled_close),
1594+ JUMP_INIT(stat, _IO_wfile_disabled_stat),
1595+ JUMP_INIT(showmanyc, _IO_wfile_disabled_showmanyc),
1596+ JUMP_INIT(imbue, _IO_wfile_disabled_imbue)
1597+};
1598+
1599+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps)
1600+libc_hidden_data_def (_IO_wfile_jumps)
1601+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_mmap)
1602+strong_alias (_IO_wfile_jumps_disabled, _IO_wfile_jumps_maybe_mmap)
1603Index: git/locale/catnames.c
1604===================================================================
1605--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1606+++ git/locale/catnames.c 2014-08-29 20:01:15.204070587 -0700
1607@@ -0,0 +1,48 @@
1608+/* Copyright (C) 2006 Free Software Foundation, Inc.
1609+ This file is part of the GNU C Library.
1610+
1611+ The GNU C Library is free software; you can redistribute it and/or
1612+ modify it under the terms of the GNU Lesser General Public
1613+ License as published by the Free Software Foundation; either
1614+ version 2.1 of the License, or (at your option) any later version.
1615+
1616+ The GNU C Library is distributed in the hope that it will be useful,
1617+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1618+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1619+ Lesser General Public License for more details.
1620+
1621+ You should have received a copy of the GNU Lesser General Public
1622+ License along with the GNU C Library; if not, write to the Free
1623+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1624+ 02111-1307 USA. */
1625+
1626+#include "localeinfo.h"
1627+
1628+/* Define an array of category names (also the environment variable names). */
1629+const union catnamestr_t _nl_category_names attribute_hidden =
1630+ {
1631+ {
1632+#define DEFINE_CATEGORY(category, category_name, items, a) \
1633+ category_name,
1634+#include "categories.def"
1635+#undef DEFINE_CATEGORY
1636+ }
1637+ };
1638+
1639+const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
1640+ {
1641+#define DEFINE_CATEGORY(category, category_name, items, a) \
1642+ [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
1643+#include "categories.def"
1644+#undef DEFINE_CATEGORY
1645+ };
1646+
1647+/* An array of their lengths, for convenience. */
1648+const uint8_t _nl_category_name_sizes[] attribute_hidden =
1649+ {
1650+#define DEFINE_CATEGORY(category, category_name, items, a) \
1651+ [category] = sizeof (category_name) - 1,
1652+#include "categories.def"
1653+#undef DEFINE_CATEGORY
1654+ [LC_ALL] = sizeof ("LC_ALL") - 1
1655+ };
1656Index: git/locale/C-ctype.c
1657===================================================================
1658--- git.orig/locale/C-ctype.c 2014-08-29 20:00:47.396070587 -0700
1659+++ git/locale/C-ctype.c 2014-08-29 20:01:15.204070587 -0700
1660@@ -19,8 +19,11 @@
1661 #include "localeinfo.h"
1662 #include <endian.h>
1663 #include <stdint.h>
1664+#include <gnu/option-groups.h>
1665
1666+#if __OPTION_EGLIBC_LOCALE_CODE
1667 #include "C-translit.h"
1668+#endif
1669
1670 /* This table's entries are taken from POSIX.2 Table 2-6
1671 ``LC_CTYPE Category Definition in the POSIX Locale''.
1672@@ -647,6 +650,7 @@
1673 { .word = L'7' },
1674 { .word = L'8' },
1675 { .word = L'9' },
1676+#if __OPTION_EGLIBC_LOCALE_CODE
1677 /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
1678 { .word = NTRANSLIT },
1679 /* _NL_CTYPE_TRANSLIT_FROM_IDX */
1680@@ -657,6 +661,22 @@
1681 { .wstr = translit_to_idx },
1682 /* _NL_CTYPE_TRANSLIT_TO_TBL */
1683 { .wstr = (uint32_t *) translit_to_tbl },
1684+#else
1685+ /* If the locale code isn't enabled, we don't have the
1686+ transliteration code in iconv/gconv_trans.c anyway, so there's
1687+ no need for the transliteration tables here. We'll fall back
1688+ on the default missing replacement, '?'. */
1689+ /* _NL_CTYPE_TRANSLIT_TAB_SIZE */
1690+ { .word = 0 },
1691+ /* _NL_CTYPE_TRANSLIT_FROM_IDX */
1692+ { .wstr = NULL },
1693+ /* _NL_CTYPE_TRANSLIT_FROM_TBL */
1694+ { .wstr = NULL },
1695+ /* _NL_CTYPE_TRANSLIT_TO_IDX */
1696+ { .wstr = NULL },
1697+ /* _NL_CTYPE_TRANSLIT_TO_TBL */
1698+ { .wstr = NULL },
1699+#endif
1700 /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN */
1701 { .word = 1 },
1702 /* _NL_CTYPE_TRANSLIT_DEFAULT_MISSING */
1703Index: git/locale/dummy-setlocale.c
1704===================================================================
1705--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1706+++ git/locale/dummy-setlocale.c 2014-08-29 20:01:15.204070587 -0700
1707@@ -0,0 +1,33 @@
1708+/* Copyright (C) 2006 Free Software Foundation, Inc.
1709+ This file is part of the GNU C Library.
1710+
1711+ The GNU C Library is free software; you can redistribute it and/or
1712+ modify it under the terms of the GNU Lesser General Public
1713+ License as published by the Free Software Foundation; either
1714+ version 2.1 of the License, or (at your option) any later version.
1715+
1716+ The GNU C Library is distributed in the hope that it will be useful,
1717+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1718+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1719+ Lesser General Public License for more details.
1720+
1721+ You should have received a copy of the GNU Lesser General Public
1722+ License along with the GNU C Library; if not, write to the Free
1723+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1724+ 02111-1307 USA. */
1725+
1726+#include <string.h>
1727+#include <locale.h>
1728+
1729+char *
1730+setlocale (int category, const char *locale)
1731+{
1732+ if (! locale
1733+ || locale[0] == '\0'
1734+ || strcmp (locale, "C") == 0
1735+ || strcmp (locale, "POSIX") == 0)
1736+ return (char *) "C";
1737+ else
1738+ return NULL;
1739+}
1740+libc_hidden_def (setlocale)
1741Index: git/locale/localeinfo.h
1742===================================================================
1743--- git.orig/locale/localeinfo.h 2014-08-29 20:00:47.404070587 -0700
1744+++ git/locale/localeinfo.h 2014-08-29 20:01:15.204070587 -0700
1745@@ -224,7 +224,7 @@
1746 unused. We can manage this playing some tricks with weak references.
1747 But with thread-local locale settings, it becomes quite ungainly unless
1748 we can use __thread variables. So only in that case do we attempt this. */
1749-#ifndef SHARED
1750+#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF
1751 # include <tls.h>
1752 # define NL_CURRENT_INDIRECT 1
1753 #endif
1754Index: git/locale/Makefile
1755===================================================================
1756--- git.orig/locale/Makefile 2014-08-29 20:00:47.400070587 -0700
1757+++ git/locale/Makefile 2014-08-29 20:01:15.204070587 -0700
1758@@ -18,27 +18,43 @@
1759 #
1760 # Makefile for locales.
1761 #
1762+include ../option-groups.mak
1763+
1764 subdir := locale
1765
1766 include ../Makeconfig
1767
1768 headers = locale.h bits/locale.h langinfo.h xlocale.h
1769-routines = setlocale findlocale loadlocale loadarchive \
1770- localeconv nl_langinfo nl_langinfo_l mb_cur_max \
1771- newlocale duplocale freelocale uselocale
1772-tests = tst-C-locale tst-locname tst-duplocale
1773+# catnames is needed by OPTION_EGLIBC_LOCALE_CODE and by the 'intl' code.
1774+# If we put the latter in an option group, too, we can omit catnames
1775+# when both option groups are disabled. libstdc++-v3 needs mb_cur_max.
1776+routines-y := catnames mb_cur_max
1777+routines-$(OPTION_EGLIBC_LOCALE_CODE) \
1778+ += setlocale findlocale loadlocale loadarchive \
1779+ localeconv nl_langinfo nl_langinfo_l \
1780+ newlocale duplocale freelocale uselocale
1781+ifneq (y,$(OPTION_EGLIBC_LOCALE_CODE))
1782+routines-y += dummy-setlocale
1783+endif
1784+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-C-locale tst-locname tst-duplocale
1785 categories = ctype messages monetary numeric time paper name \
1786 address telephone measurement identification collate
1787-aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
1788- xlocale localename global-locale coll-lookup
1789-others = localedef locale
1790+# C-messages belongs in an intl option group.
1791+aux-y := C-ctype C-time \
1792+ SYS_libc C_name xlocale global-locale coll-lookup
1793+aux-$(OPTION_EGLIBC_LOCALE_CODE) \
1794+ += $(filter-out $(aux-y), \
1795+ $(categories:%=lc-%) $(categories:%=C-%)) \
1796+ localename
1797+others-$(OPTION_EGLIBC_LOCALE_CODE) = localedef locale
1798 #others-static = localedef locale
1799-install-bin = localedef locale
1800-extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
1801+install-bin = $(others-y)
1802+extra-objs-$(OPTION_EGLIBC_LOCALE_CODE) \
1803+ = $(localedef-modules:=.o) $(localedef-aux:=.o) \
1804 $(locale-modules:=.o) $(lib-modules:=.o)
1805
1806-extra-libs = libBrokenLocale
1807-extra-libs-others = $(extra-libs)
1808+extra-libs-$(OPTION_EGLIBC_LOCALE_CODE) = libBrokenLocale
1809+extra-libs-others = $(extra-libs-y)
1810
1811 libBrokenLocale-routines = broken_cur_max
1812
1813@@ -94,6 +110,9 @@
1814 CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
1815 CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
1816 CFLAGS-charmap-dir.c = -Wno-write-strings
1817+ifneq (y,$(OPTION_EGLIBC_SPAWN))
1818+CFLAGS-charmap-dir.c += -DNO_UNCOMPRESS
1819+endif
1820
1821 # This makes sure -DNOT_IN_libc et al are passed for all these modules.
1822 cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
1823Index: git/locale/programs/charmap-dir.c
1824===================================================================
1825--- git.orig/locale/programs/charmap-dir.c 2014-08-29 20:00:47.408070587 -0700
1826+++ git/locale/programs/charmap-dir.c 2014-08-29 20:01:15.204070587 -0700
1827@@ -19,7 +19,9 @@
1828 #include <error.h>
1829 #include <fcntl.h>
1830 #include <libintl.h>
1831+#ifndef NO_UNCOMPRESS
1832 #include <spawn.h>
1833+#endif
1834 #include <stdio.h>
1835 #include <stdlib.h>
1836 #include <string.h>
1837@@ -156,6 +158,7 @@
1838 return closedir (dir);
1839 }
1840
1841+#ifndef NO_UNCOMPRESS
1842 /* Creates a subprocess decompressing the given pathname, and returns
1843 a stream reading its output (the decompressed data). */
1844 static
1845@@ -204,6 +207,7 @@
1846 }
1847 return NULL;
1848 }
1849+#endif
1850
1851 /* Opens a charmap for reading, given its name (not an alias name). */
1852 FILE *
1853@@ -226,6 +230,7 @@
1854 if (stream != NULL)
1855 return stream;
1856
1857+#ifndef NO_UNCOMPRESS
1858 memcpy (p, ".gz", 4);
1859 stream = fopen_uncompressed (pathname, "gzip");
1860 if (stream != NULL)
1861@@ -235,6 +240,7 @@
1862 stream = fopen_uncompressed (pathname, "bzip2");
1863 if (stream != NULL)
1864 return stream;
1865+#endif
1866
1867 return NULL;
1868 }
1869@@ -263,8 +269,8 @@
1870 char *alias = NULL;
1871 char junk[BUFSIZ];
1872
1873- if (fscanf (stream, " <code_set_name> %ms", &alias) == 1
1874- || fscanf (stream, "%% alias %ms", &alias) == 1)
1875+ if (fscanf (stream, " <code_set_name> %as", &alias) == 1
1876+ || fscanf (stream, "%% alias %as", &alias) == 1)
1877 {
1878 aliases = (char **) xrealloc (aliases,
1879 (naliases + 2) * sizeof (char *));
1880Index: git/locale/programs/ld-collate.c
1881===================================================================
1882--- git.orig/locale/programs/ld-collate.c 2014-08-29 20:00:47.408070587 -0700
1883+++ git/locale/programs/ld-collate.c 2014-08-29 20:01:15.208070587 -0700
1884@@ -350,7 +350,7 @@
1885 }
1886 if (wcs != NULL)
1887 {
1888- size_t nwcs = wcslen ((wchar_t *) wcs);
1889+ size_t nwcs = wcslen_uint32 (wcs);
1890 uint32_t zero = 0;
1891 /* Handle <U0000> as a single character. */
1892 if (nwcs == 0)
1893@@ -1776,8 +1776,7 @@
1894
1895 if ((*eptr)->nwcs == runp->nwcs)
1896 {
1897- int c = wmemcmp ((wchar_t *) (*eptr)->wcs,
1898- (wchar_t *) runp->wcs, runp->nwcs);
1899+ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs);
1900
1901 if (c == 0)
1902 {
1903@@ -2010,9 +2009,9 @@
1904 one consecutive entry. */
1905 if (runp->wcnext != NULL
1906 && runp->nwcs == runp->wcnext->nwcs
1907- && wmemcmp ((wchar_t *) runp->wcs,
1908- (wchar_t *)runp->wcnext->wcs,
1909- runp->nwcs - 1) == 0
1910+ && wmemcmp_uint32 (runp->wcs,
1911+ runp->wcnext->wcs,
1912+ runp->nwcs - 1) == 0
1913 && (runp->wcs[runp->nwcs - 1]
1914 == runp->wcnext->wcs[runp->nwcs - 1] + 1))
1915 {
1916@@ -2036,9 +2035,9 @@
1917 runp = runp->wcnext;
1918 while (runp->wcnext != NULL
1919 && runp->nwcs == runp->wcnext->nwcs
1920- && wmemcmp ((wchar_t *) runp->wcs,
1921- (wchar_t *)runp->wcnext->wcs,
1922- runp->nwcs - 1) == 0
1923+ && wmemcmp_uint32 (runp->wcs,
1924+ runp->wcnext->wcs,
1925+ runp->nwcs - 1) == 0
1926 && (runp->wcs[runp->nwcs - 1]
1927 == runp->wcnext->wcs[runp->nwcs - 1] + 1));
1928
1929Index: git/locale/programs/ld-ctype.c
1930===================================================================
1931--- git.orig/locale/programs/ld-ctype.c 2014-08-29 20:00:47.408070587 -0700
1932+++ git/locale/programs/ld-ctype.c 2014-08-29 20:01:15.208070587 -0700
1933@@ -957,7 +957,7 @@
1934 allocate_arrays (ctype, charmap, ctype->repertoire);
1935
1936 default_missing_len = (ctype->default_missing
1937- ? wcslen ((wchar_t *) ctype->default_missing)
1938+ ? wcslen_uint32 (ctype->default_missing)
1939 : 0);
1940
1941 init_locale_data (&file, nelems);
1942@@ -1968,7 +1968,7 @@
1943 ignore = 1;
1944 else
1945 /* This value is usable. */
1946- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4);
1947+ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4);
1948
1949 first = 0;
1950 }
1951@@ -2516,8 +2516,8 @@
1952 }
1953
1954 handle_tok_digit:
1955- class_bit = _ISwdigit;
1956- class256_bit = _ISdigit;
1957+ class_bit = BITw (tok_digit);
1958+ class256_bit = BIT (tok_digit);
1959 handle_digits = 1;
1960 goto read_charclass;
1961
1962@@ -4001,8 +4001,7 @@
1963
1964 while (idx < number)
1965 {
1966- int res = wcscmp ((const wchar_t *) sorted[idx]->from,
1967- (const wchar_t *) runp->from);
1968+ int res = wcscmp_uint32 (sorted[idx]->from, runp->from);
1969 if (res == 0)
1970 {
1971 replace = 1;
1972@@ -4039,11 +4038,11 @@
1973 for (cnt = 0; cnt < number; ++cnt)
1974 {
1975 struct translit_to_t *srunp;
1976- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
1977+ from_len += wcslen_uint32 (sorted[cnt]->from) + 1;
1978 srunp = sorted[cnt]->to;
1979 while (srunp != NULL)
1980 {
1981- to_len += wcslen ((const wchar_t *) srunp->str) + 1;
1982+ to_len += wcslen_uint32 (srunp->str) + 1;
1983 srunp = srunp->next;
1984 }
1985 /* Plus one for the extra NUL character marking the end of
1986@@ -4067,18 +4066,18 @@
1987 ctype->translit_from_idx[cnt] = from_len;
1988 ctype->translit_to_idx[cnt] = to_len;
1989
1990- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1;
1991- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len],
1992- (const wchar_t *) sorted[cnt]->from, len);
1993+ len = wcslen_uint32 (sorted[cnt]->from) + 1;
1994+ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len],
1995+ sorted[cnt]->from, len);
1996 from_len += len;
1997
1998 ctype->translit_to_idx[cnt] = to_len;
1999 srunp = sorted[cnt]->to;
2000 while (srunp != NULL)
2001 {
2002- len = wcslen ((const wchar_t *) srunp->str) + 1;
2003- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len],
2004- (const wchar_t *) srunp->str, len);
2005+ len = wcslen_uint32 (srunp->str) + 1;
2006+ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len],
2007+ srunp->str, len);
2008 to_len += len;
2009 srunp = srunp->next;
2010 }
2011Index: git/locale/programs/ld-messages.c
2012===================================================================
2013--- git.orig/locale/programs/ld-messages.c 2014-08-29 20:00:47.412070587 -0700
2014+++ git/locale/programs/ld-messages.c 2014-08-29 20:01:15.208070587 -0700
2015@@ -25,6 +25,7 @@
2016 #include <string.h>
2017 #include <stdint.h>
2018 #include <sys/uio.h>
2019+#include <gnu/option-groups.h>
2020
2021 #include <assert.h>
2022
2023@@ -124,6 +125,7 @@
2024 }
2025 else
2026 {
2027+#if __OPTION_POSIX_REGEXP
2028 int result;
2029 regex_t re;
2030
2031@@ -140,6 +142,7 @@
2032 }
2033 else if (result != 0)
2034 regfree (&re);
2035+#endif
2036 }
2037
2038 if (messages->noexpr == NULL)
2039@@ -158,6 +161,7 @@
2040 }
2041 else
2042 {
2043+#if __OPTION_POSIX_REGEXP
2044 int result;
2045 regex_t re;
2046
2047@@ -174,6 +178,7 @@
2048 }
2049 else if (result != 0)
2050 regfree (&re);
2051+#endif
2052 }
2053 }
2054
2055Index: git/locale/programs/ld-time.c
2056===================================================================
2057--- git.orig/locale/programs/ld-time.c 2014-08-29 20:00:47.412070587 -0700
2058+++ git/locale/programs/ld-time.c 2014-08-29 20:01:15.208070587 -0700
2059@@ -215,8 +215,10 @@
2060 }
2061 else
2062 {
2063+ static const uint32_t wt_fmt_ampm[]
2064+ = { '%','I',':','%','M',':','%','S',' ','%','p',0 };
2065 time->t_fmt_ampm = "%I:%M:%S %p";
2066- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p";
2067+ time->wt_fmt_ampm = wt_fmt_ampm;
2068 }
2069 }
2070
2071@@ -226,7 +228,7 @@
2072 const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
2073 31, 31, 30, 31 ,30, 31 };
2074 size_t idx;
2075- wchar_t *wstr;
2076+ uint32_t *wstr;
2077
2078 time->era_entries =
2079 (struct era_data *) xmalloc (time->num_era
2080@@ -464,18 +466,18 @@
2081 }
2082
2083 /* Now generate the wide character name and format. */
2084- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */
2085- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */
2086- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */
2087- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */
2088+ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */
2089+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */
2090+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */
2091+ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */
2092 if (wstr != NULL)
2093 {
2094- time->era_entries[idx].wname = (uint32_t *) wstr + 1;
2095- wstr = wcschr (wstr + 1, L':'); /* end name */
2096+ time->era_entries[idx].wname = wstr + 1;
2097+ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */
2098 if (wstr != NULL)
2099 {
2100 *wstr = L'\0';
2101- time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
2102+ time->era_entries[idx].wformat = wstr + 1;
2103 }
2104 else
2105 time->era_entries[idx].wname =
2106@@ -530,7 +532,16 @@
2107 if (time->date_fmt == NULL)
2108 time->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
2109 if (time->wdate_fmt == NULL)
2110- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y";
2111+ {
2112+ static const uint32_t wdate_fmt[] =
2113+ { '%','a',' ',
2114+ '%','b',' ',
2115+ '%','e',' ',
2116+ '%','H',':','%','M',':','%','S',' ',
2117+ '%','Z',' ',
2118+ '%','Y',0 };
2119+ time->wdate_fmt = wdate_fmt;
2120+ }
2121 }
2122
2123
2124Index: git/locale/programs/linereader.c
2125===================================================================
2126--- git.orig/locale/programs/linereader.c 2014-08-29 20:00:47.412070587 -0700
2127+++ git/locale/programs/linereader.c 2014-08-29 20:01:15.208070587 -0700
2128@@ -595,7 +595,7 @@
2129 {
2130 int return_widestr = lr->return_widestr;
2131 char *buf;
2132- wchar_t *buf2 = NULL;
2133+ uint32_t *buf2 = NULL;
2134 size_t bufact;
2135 size_t bufmax = 56;
2136
2137Index: git/locale/programs/localedef.c
2138===================================================================
2139--- git.orig/locale/programs/localedef.c 2014-08-29 20:00:47.416070587 -0700
2140+++ git/locale/programs/localedef.c 2014-08-29 20:01:15.208070587 -0700
2141@@ -114,6 +114,7 @@
2142 #define OPT_LIST_ARCHIVE 309
2143 #define OPT_LITTLE_ENDIAN 400
2144 #define OPT_BIG_ENDIAN 401
2145+#define OPT_UINT32_ALIGN 402
2146
2147 /* Definitions of arguments for argp functions. */
2148 static const struct argp_option options[] =
2149@@ -150,6 +151,8 @@
2150 N_("Generate little-endian output") },
2151 { "big-endian", OPT_BIG_ENDIAN, NULL, 0,
2152 N_("Generate big-endian output") },
2153+ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0,
2154+ N_("Set the target's uint32_t alignment in bytes (default 4)") },
2155 { NULL, 0, NULL, 0, NULL }
2156 };
2157
2158@@ -239,12 +242,14 @@
2159 ctype locale. (P1003.2 4.35.5.2) */
2160 setlocale (LC_CTYPE, "POSIX");
2161
2162+#ifndef NO_SYSCONF
2163 /* Look whether the system really allows locale definitions. POSIX
2164 defines error code 3 for this situation so I think it must be
2165 a fatal error (see P1003.2 4.35.8). */
2166 if (sysconf (_SC_2_LOCALEDEF) < 0)
2167 WITH_CUR_LOCALE (error (3, 0, _("\
2168 FATAL: system does not define `_POSIX2_LOCALEDEF'")));
2169+#endif
2170
2171 /* Process charmap file. */
2172 charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1);
2173@@ -338,6 +343,9 @@
2174 case OPT_BIG_ENDIAN:
2175 set_big_endian (true);
2176 break;
2177+ case OPT_UINT32_ALIGN:
2178+ uint32_align_mask = strtol (arg, NULL, 0) - 1;
2179+ break;
2180 case 'c':
2181 force_output = 1;
2182 break;
2183Index: git/locale/programs/locfile.c
2184===================================================================
2185--- git.orig/locale/programs/locfile.c 2014-08-29 20:00:47.432070587 -0700
2186+++ git/locale/programs/locfile.c 2014-08-29 20:01:15.208070587 -0700
2187@@ -544,6 +544,9 @@
2188 machine running localedef. */
2189 bool swap_endianness_p;
2190
2191+/* The target's value of __align__(uint32_t) - 1. */
2192+unsigned int uint32_align_mask = 3;
2193+
2194 /* When called outside a start_locale_structure/end_locale_structure
2195 or start_locale_prelude/end_locale_prelude block, record that the
2196 next byte in FILE's obstack will be the first byte of a new element.
2197@@ -621,7 +624,7 @@
2198 void
2199 add_locale_wstring (struct locale_file *file, const uint32_t *string)
2200 {
2201- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1);
2202+ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1);
2203 }
2204
2205 /* Record that FILE's next element is the 32-bit integer VALUE. */
2206Index: git/locale/programs/locfile.h
2207===================================================================
2208--- git.orig/locale/programs/locfile.h 2014-08-29 20:00:47.432070587 -0700
2209+++ git/locale/programs/locfile.h 2014-08-29 20:01:15.208070587 -0700
2210@@ -71,6 +71,8 @@
2211
2212 extern bool swap_endianness_p;
2213
2214+extern unsigned int uint32_align_mask;
2215+
2216 /* Change the output to be big-endian if BIG_ENDIAN is true and
2217 little-endian otherwise. */
2218 static inline void
2219@@ -275,4 +277,49 @@
2220 const struct charmap_t *charmap,
2221 const char *output_path);
2222
2223+static inline size_t
2224+wcslen_uint32 (const uint32_t *str)
2225+{
2226+ size_t len = 0;
2227+ while (str[len] != 0)
2228+ len++;
2229+ return len;
2230+}
2231+
2232+static inline int
2233+wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n)
2234+{
2235+ while (n-- != 0)
2236+ {
2237+ int diff = *s1++ - *s2++;
2238+ if (diff != 0)
2239+ return diff;
2240+ }
2241+ return 0;
2242+}
2243+
2244+static inline int
2245+wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2)
2246+{
2247+ while (*s1 != 0 && *s1 == *s2)
2248+ s1++, s2++;
2249+ return *s1 - *s2;
2250+}
2251+
2252+static inline uint32_t *
2253+wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n)
2254+{
2255+ return memcpy (s1, s2, n * sizeof (uint32_t));
2256+}
2257+
2258+static inline uint32_t *
2259+wcschr_uint32 (const uint32_t *s, uint32_t ch)
2260+{
2261+ do
2262+ if (*s == ch)
2263+ return (uint32_t *) s;
2264+ while (*s++ != 0);
2265+ return 0;
2266+}
2267+
2268 #endif /* locfile.h */
2269Index: git/locale/setlocale.c
2270===================================================================
2271--- git.orig/locale/setlocale.c 2014-08-29 20:00:47.432070587 -0700
2272+++ git/locale/setlocale.c 2014-08-29 20:01:15.208070587 -0700
2273@@ -64,36 +64,6 @@
2274 #endif
2275
2276
2277-/* Define an array of category names (also the environment variable names). */
2278-const union catnamestr_t _nl_category_names attribute_hidden =
2279- {
2280- {
2281-#define DEFINE_CATEGORY(category, category_name, items, a) \
2282- category_name,
2283-#include "categories.def"
2284-#undef DEFINE_CATEGORY
2285- }
2286- };
2287-
2288-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden =
2289- {
2290-#define DEFINE_CATEGORY(category, category_name, items, a) \
2291- [category] = offsetof (union catnamestr_t, CATNAMEMF (__LINE__)),
2292-#include "categories.def"
2293-#undef DEFINE_CATEGORY
2294- };
2295-
2296-/* An array of their lengths, for convenience. */
2297-const uint8_t _nl_category_name_sizes[] attribute_hidden =
2298- {
2299-#define DEFINE_CATEGORY(category, category_name, items, a) \
2300- [category] = sizeof (category_name) - 1,
2301-#include "categories.def"
2302-#undef DEFINE_CATEGORY
2303- [LC_ALL] = sizeof ("LC_ALL") - 1
2304- };
2305-
2306-
2307 #ifdef NL_CURRENT_INDIRECT
2308 # define WEAK_POSTLOAD(postload) weak_extern (postload)
2309 #else
2310Index: git/locale/xlocale.c
2311===================================================================
2312--- git.orig/locale/xlocale.c 2014-08-29 20:00:47.436070587 -0700
2313+++ git/locale/xlocale.c 2014-08-29 20:01:15.208070587 -0700
2314@@ -18,6 +18,7 @@
2315 <http://www.gnu.org/licenses/>. */
2316
2317 #include <locale.h>
2318+#include <gnu/option-groups.h>
2319 #include "localeinfo.h"
2320
2321 #define DEFINE_CATEGORY(category, category_name, items, a) \
2322@@ -25,6 +26,19 @@
2323 #include "categories.def"
2324 #undef DEFINE_CATEGORY
2325
2326+/* If the locale support code isn't enabled, don't generate strong
2327+ reference to the C locale_data structures here; let the Makefile
2328+ decide which ones to include. (In the static linking case, the
2329+ strong reference to the 'class', 'toupper', and 'tolower' tables
2330+ will cause C-ctype.o to be brought in, as it should be, even when
2331+ the reference to _nl_C_LC_CTYPE will be weak.) */
2332+#if ! __OPTION_EGLIBC_LOCALE_CODE
2333+# define DEFINE_CATEGORY(category, category_name, items, a) \
2334+ weak_extern (_nl_C_##category)
2335+# include "categories.def"
2336+# undef DEFINE_CATEGORY
2337+#endif
2338+
2339 /* Defined in locale/C-ctype.c. */
2340 extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
2341 extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
2342@@ -52,3 +66,26 @@
2343 .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
2344 .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
2345 };
2346+
2347+
2348+#if ! __OPTION_EGLIBC_LOCALE_CODE
2349+/* When locale code is enabled, these are each defined in the
2350+ appropriate lc-CATEGORY.c file, so that static links (when __thread
2351+ is supported) bring in only those lc-CATEGORY.o files for
2352+ categories the program actually uses; look for NL_CURRENT_INDIRECT
2353+ in localeinfo.h.
2354+
2355+ When locale code is disabled, the _nl_C_CATEGORY objects are the
2356+ only possible referents. At the moment, there isn't a way to get
2357+ __OPTION_EGLIBC_LOCALE_CODE defined in every compilation unit that
2358+ #includes localeinfo.h, so we can't just turn off
2359+ NL_CURRENT_INDIRECT. So we'll define the _nl_current_CATEGORY
2360+ pointers here. */
2361+#if defined (NL_CURRENT_INDIRECT)
2362+#define DEFINE_CATEGORY(category, category_name, items, a) \
2363+ __thread struct __locale_data * const *_nl_current_##category \
2364+ attribute_hidden = &_nl_C_locobj.__locales[category];
2365+#include "categories.def"
2366+#undef DEFINE_CATEGORY
2367+#endif
2368+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
2369Index: git/localedata/Makefile
2370===================================================================
2371--- git.orig/localedata/Makefile 2014-08-29 20:00:47.444070587 -0700
2372+++ git/localedata/Makefile 2014-08-29 20:01:15.212070587 -0700
2373@@ -21,12 +21,22 @@
2374
2375 include ../Makeconfig
2376
2377-# List with all available character set descriptions.
2378-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
2379+include ../option-groups.mak
2380
2381 # List with all available character set descriptions.
2382-locales := $(wildcard locales/*)
2383+all-charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
2384+
2385+all-locales := $(wildcard locales/*)
2386
2387+# If the EGLIBC_LOCALES option group is not enabled, trim the
2388+# list of charmap and locale source files.
2389+ifeq ($(OPTION_EGLIBC_LOCALES),y)
2390+charmaps := $(all-charmaps)
2391+locales := $(all-locales)
2392+else
2393+charmaps :=
2394+locales := locales/POSIX
2395+endif
2396
2397 subdir-dirs = tests-mbwc
2398 vpath %.c tests-mbwc
2399@@ -71,14 +81,20 @@
2400 tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
2401 tst_wctype tst_wcwidth
2402
2403-tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
2404+# Since these tests build their own locale files, they're not
2405+# dependent on the OPTION_EGLIBC_LOCALES option group. But they do
2406+# need the locale functions to be present.
2407+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
2408+ += $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
2409 tst-leaks tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
2410 tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
2411 tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3 \
2412 tst-wctype
2413+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
2414 tests-static = bug-setlocale1-static
2415 tests += $(tests-static)
2416-ifeq (yes,$(build-shared))
2417+endif
2418+ifeq (yesy,$(build-shared)$(OPTION_EGLIBC_LOCALE_CODE))
2419 ifneq (no,$(PERL))
2420 tests-special += $(objpfx)mtrace-tst-leaks.out
2421 endif
2422@@ -92,12 +108,14 @@
2423
2424 tests: $(objdir)/iconvdata/gconv-modules
2425
2426+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
2427 tests-special += $(objpfx)sort-test.out $(objpfx)tst-fmon.out \
2428 $(objpfx)tst-locale.out $(objpfx)tst-rpmatch.out \
2429 $(objpfx)tst-trans.out $(objpfx)tst-ctype.out \
2430 $(objpfx)tst-langinfo.out $(objpfx)tst-langinfo-static.out \
2431 $(objpfx)tst-numeric.out
2432 tests-static += tst-langinfo-static
2433+endif
2434
2435 ifeq ($(run-built-tests),yes)
2436 # We have to generate locales
2437@@ -143,9 +161,13 @@
2438 $(addprefix $(objpfx),$(CTYPE_FILES)): %: \
2439 gen-locale.sh $(common-objpfx)locale/localedef Makefile \
2440 $(addprefix charmaps/,$(CHARMAPS)) $(addprefix locales/,$(LOCALE_SRCS))
2441- @$(SHELL) gen-locale.sh $(common-objpfx) \
2442- '$(built-program-cmd-before-env)' '$(run-program-env)' \
2443- '$(built-program-cmd-after-env)' $@; \
2444+ @$(SHELL) gen-locale.sh $(common-objpfx) \
2445+ '$(if $(cross-localedef), \
2446+ $(cross-localedef), \
2447+ $(built-program-cmd-before-env) \
2448+ $(run-program-env) \
2449+ $(built-program-cmd-after-env))' \
2450+ $@; \
2451 $(evaluate-test)
2452
2453 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
2454@@ -213,6 +235,11 @@
2455
2456 include SUPPORTED
2457
2458+# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
2459+ifneq ($(OPTION_EGLIBC_LOCALES),y)
2460+SUPPORTED-LOCALES :=
2461+endif
2462+
2463 INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
2464
2465 # Sometimes the whole collection of locale files should be installed.
2466Index: git/login/Makefile
2467===================================================================
2468--- git.orig/login/Makefile 2014-08-29 20:00:47.736070587 -0700
2469+++ git/login/Makefile 2014-08-29 20:01:15.212070587 -0700
2470@@ -18,6 +18,7 @@
2471 #
2472 # Sub-makefile for login portion of the library.
2473 #
2474+include ../option-groups.mak
2475
2476 subdir := login
2477
2478@@ -25,14 +26,16 @@
2479
2480 headers := utmp.h bits/utmp.h lastlog.h pty.h
2481
2482-routines := getlogin getlogin_r setlogin getlogin_r_chk \
2483- getutent getutent_r getutid getutline getutid_r getutline_r \
2484- utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname \
2485- ptsname_r_chk
2486+routines := getpt grantpt unlockpt ptsname ptsname_r_chk
2487+routines-$(OPTION_EGLIBC_UTMP) \
2488+ += getutent getutent_r getutid getutline getutid_r getutline_r \
2489+ utmp_file utmpname updwtmp
2490+routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin getlogin_r getlogin_r_chk
2491+routines-$(OPTION_EGLIBC_BSD) += setlogin
2492
2493 CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
2494
2495-others = utmpdump
2496+others-$(OPTION_EGLIBC_UTMP) += utmpdump
2497
2498 ifeq (yes,$(build-pt-chown))
2499 others += pt_chown
2500@@ -46,8 +49,8 @@
2501 tests := tst-utmp tst-utmpx tst-grantpt tst-ptsname
2502
2503 # Build the -lutil library with these extra functions.
2504-extra-libs := libutil
2505-extra-libs-others := $(extra-libs)
2506+extra-libs-$(OPTION_EGLIBC_UTMP) := libutil
2507+extra-libs-others := $(extra-libs-y)
2508
2509 libutil-routines:= login login_tty logout logwtmp openpty forkpty
2510
2511Index: git/Makeconfig
2512===================================================================
2513--- git.orig/Makeconfig 2014-08-29 20:00:42.956070587 -0700
2514+++ git/Makeconfig 2014-08-29 20:01:15.212070587 -0700
2515@@ -582,7 +582,7 @@
2516 # and run on the build system, causes that program with those
2517 # arguments to be run on the host for which the library is built.
2518 ifndef test-wrapper
2519-test-wrapper =
2520+test-wrapper = $(cross-test-wrapper)
2521 endif
2522 # Likewise, but the name of the program is preceded by
2523 # <variable>=<value> assignments for environment variables.
2524@@ -1057,6 +1057,24 @@
2525 libm = $(common-objpfx)math/libm.a
2526 endif
2527
2528+# Generate a header file that #defines preprocessor symbols indicating
2529+# which option groups are enabled. Note that the option-groups.config file
2530+# may not exist at all.
2531+before-compile += $(common-objpfx)gnu/option-groups.h
2532+common-generated += gnu/option-groups.h gnu/option-groups.stmp
2533+headers += gnu/option-groups.h
2534+$(common-objpfx)gnu/option-groups.h: $(common-objpfx)gnu/option-groups.stmp; @:
2535+$(common-objpfx)gnu/option-groups.stmp: \
2536+ $(..)scripts/option-groups.awk \
2537+ $(..)option-groups.defaults \
2538+ $(wildcard $(common-objpfx)option-groups.config)
2539+ $(make-target-directory)
2540+ @rm -f ${@:stmp=T} $@
2541+ LC_ALL=C $(AWK) -f $^ > ${@:stmp=T}
2542+ $(move-if-change) ${@:stmp=T} ${@:stmp=h}
2543+ touch $@
2544+
2545+
2546 # These are the subdirectories containing the library source. The order
2547 # is more or less arbitrary. The sorting step will take care of the
2548 # dependencies.
2549Index: git/Makerules
2550===================================================================
2551--- git.orig/Makerules 2014-08-29 20:00:42.960070587 -0700
2552+++ git/Makerules 2014-08-29 20:01:15.212070587 -0700
2553@@ -379,6 +379,25 @@
2554 endef
2555 endif
2556
2557+# Include targets in the selected option groups.
2558+aux += $(aux-y)
2559+extra-libs += $(extra-libs-y)
2560+extra-libs-others += $(extra-libs-others-y)
2561+extra-objs += $(extra-objs-y)
2562+install-bin += $(install-bin-y)
2563+install-others += $(install-others-y)
2564+install-sbin += $(install-sbin-y)
2565+modules += $(modules-y)
2566+others += $(others-y)
2567+others-pie += $(others-pie-y)
2568+routines += $(routines-y)
2569+static-only-routines += $(static-only-routines-y)
2570+sysdep_routines += $(sysdep_routines-y)
2571+test-srcs += $(test-srcs-y)
2572+tests += $(tests-y)
2573+xtests += $(xtests-y)
2574+
2575+
2576 # Modify the list of routines we build for different targets
2577
2578 ifeq (yes,$(build-shared))
2579Index: git/malloc/Makefile
2580===================================================================
2581--- git.orig/malloc/Makefile 2014-08-29 20:00:47.760070587 -0700
2582+++ git/malloc/Makefile 2014-08-29 20:01:15.212070587 -0700
2583@@ -18,6 +18,8 @@
2584 #
2585 # Makefile for malloc routines
2586 #
2587+include ../option-groups.mak
2588+
2589 subdir := malloc
2590
2591 include ../Makeconfig
2592@@ -36,9 +38,15 @@
2593 non-lib.a := libmcheck.a
2594
2595 # Additional library.
2596+ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
2597 extra-libs = libmemusage
2598 extra-libs-others = $(extra-libs)
2599
2600+ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2601+CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
2602+endif
2603+endif
2604+
2605 libmemusage-routines = memusage
2606 libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes))
2607
2608@@ -67,7 +75,7 @@
2609 # Unless we get a test for the availability of libgd which also works
2610 # for cross-compiling we disable the memusagestat generation in this
2611 # situation.
2612-ifneq ($(cross-compiling),yes)
2613+ifeq ($(cross-compiling)$(OPTION_EGLIBC_MEMUSAGE),noy)
2614 # If the gd library is available we build the `memusagestat' program.
2615 ifneq ($(LIBGD),no)
2616 others: $(objpfx)memusage
2617Index: git/malloc/memusage.c
2618===================================================================
2619--- git.orig/malloc/memusage.c 2014-08-29 20:00:47.768070587 -0700
2620+++ git/malloc/memusage.c 2014-08-29 20:01:15.212070587 -0700
2621@@ -33,6 +33,7 @@
2622 #include <stdint.h>
2623 #include <sys/mman.h>
2624 #include <sys/time.h>
2625+#include <gnu/option-groups.h>
2626
2627 #include <memusage.h>
2628
2629@@ -93,7 +94,11 @@
2630 #define peak_stack peak_use[1]
2631 #define peak_total peak_use[2]
2632
2633-#define DEFAULT_BUFFER_SIZE 32768
2634+#ifndef __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2635+# define DEFAULT_BUFFER_SIZE 32768
2636+#else
2637+# define DEFAULT_BUFFER_SIZE __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
2638+#endif
2639 static size_t buffer_size;
2640
2641 static int fd = -1;
2642Index: git/malloc/memusage.sh
2643===================================================================
2644--- git.orig/malloc/memusage.sh 2014-08-29 20:00:47.768070587 -0700
2645+++ git/malloc/memusage.sh 2014-08-29 20:01:15.212070587 -0700
2646@@ -35,7 +35,7 @@
2647
2648 # Print help message
2649 do_help() {
2650- echo $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
2651+ printf $"Usage: memusage [OPTION]... PROGRAM [PROGRAMOPTION]...
2652 Profile memory usage of PROGRAM.
2653
2654 -n,--progname=NAME Name of the program file to profile
2655Index: git/math/Makefile
2656===================================================================
2657--- git.orig/math/Makefile 2014-08-29 20:00:47.836070587 -0700
2658+++ git/math/Makefile 2014-08-29 20:01:15.212070587 -0700
2659@@ -21,6 +21,8 @@
2660
2661 include ../Makeconfig
2662
2663+include ../option-groups.mak
2664+
2665 # Installed header files.
2666 headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
2667 bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
2668@@ -33,8 +35,8 @@
2669
2670 # Build the -lm library.
2671
2672-extra-libs := libm
2673-extra-libs-others = $(extra-libs)
2674+extra-libs-$(OPTION_EGLIBC_LIBM) := libm
2675+extra-libs-others-$(OPTION_EGLIBC_LIBM) = $(extra-libs-$(OPTION_EGLIBC_LIBM))
2676
2677 libm-support = k_standard s_lib_version s_matherr s_signgam \
2678 fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
2679Index: git/misc/err.c
2680===================================================================
2681--- git.orig/misc/err.c 2014-08-29 20:00:48.232070587 -0700
2682+++ git/misc/err.c 2014-08-29 20:01:15.212070587 -0700
2683@@ -22,6 +22,7 @@
2684 #include <errno.h>
2685 #include <string.h>
2686 #include <stdio.h>
2687+#include <gnu/option-groups.h>
2688
2689 #include <wchar.h>
2690 #define flockfile(s) _IO_flockfile (s)
2691@@ -37,6 +38,7 @@
2692 va_end (ap); \
2693 }
2694
2695+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2696 static void
2697 convert_and_print (const char *format, __gnuc_va_list ap)
2698 {
2699@@ -81,6 +83,7 @@
2700
2701 __vfwprintf (stderr, wformat, ap);
2702 }
2703+#endif
2704
2705 void
2706 vwarnx (const char *format, __gnuc_va_list ap)
2707@@ -88,9 +91,13 @@
2708 flockfile (stderr);
2709 if (_IO_fwide (stderr, 0) > 0)
2710 {
2711+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2712 __fwprintf (stderr, L"%s: ", __progname);
2713 convert_and_print (format, ap);
2714 putwc_unlocked (L'\n', stderr);
2715+#else
2716+ abort ();
2717+#endif
2718 }
2719 else
2720 {
2721@@ -111,6 +118,7 @@
2722 flockfile (stderr);
2723 if (_IO_fwide (stderr, 0) > 0)
2724 {
2725+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2726 __fwprintf (stderr, L"%s: ", __progname);
2727 if (format)
2728 {
2729@@ -119,6 +127,9 @@
2730 }
2731 __set_errno (error);
2732 __fwprintf (stderr, L"%m\n");
2733+#else
2734+ abort ();
2735+#endif
2736 }
2737 else
2738 {
2739Index: git/misc/error.c
2740===================================================================
2741--- git.orig/misc/error.c 2014-08-29 20:00:48.232070587 -0700
2742+++ git/misc/error.c 2014-08-29 20:01:15.212070587 -0700
2743@@ -35,6 +35,7 @@
2744 #endif
2745
2746 #ifdef _LIBC
2747+# include <gnu/option-groups.h>
2748 # include <libintl.h>
2749 # include <stdbool.h>
2750 # include <stdint.h>
2751@@ -205,6 +206,7 @@
2752 #if _LIBC
2753 if (_IO_fwide (stderr, 0) > 0)
2754 {
2755+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
2756 size_t len = strlen (message) + 1;
2757 wchar_t *wmessage = NULL;
2758 mbstate_t st;
2759@@ -265,6 +267,9 @@
2760
2761 if (use_malloc)
2762 free (wmessage);
2763+#else
2764+ abort ();
2765+#endif
2766 }
2767 else
2768 #endif
2769Index: git/misc/Makefile
2770===================================================================
2771--- git.orig/misc/Makefile 2014-08-29 20:00:48.232070587 -0700
2772+++ git/misc/Makefile 2014-08-29 20:01:15.212070587 -0700
2773@@ -19,6 +19,10 @@
2774 # Sub-makefile for misc portion of the library.
2775 #
2776
2777+# Some system-dependent implementations of these functions use option
2778+# groups (see sysdeps/unix/sysv/linux/Makefile, for example).
2779+include ../option-groups.mak
2780+
2781 subdir := misc
2782
2783 include ../Makeconfig
2784@@ -46,40 +50,47 @@
2785 select pselect \
2786 acct chroot fsync sync fdatasync syncfs reboot \
2787 gethostid sethostid \
2788- revoke vhangup \
2789+ vhangup \
2790 swapon swapoff mktemp mkstemp mkstemp64 mkdtemp \
2791 mkostemp mkostemp64 mkstemps mkstemps64 mkostemps mkostemps64 \
2792 ualarm usleep \
2793 gtty stty \
2794 ptrace \
2795- fstab mntent mntent_r \
2796+ mntent mntent_r \
2797 utimes lutimes futimes futimesat \
2798 truncate ftruncate truncate64 ftruncate64 \
2799- chflags fchflags \
2800 insremque getttyent getusershell getpass ttyslot \
2801 syslog syscall daemon \
2802 mmap mmap64 munmap mprotect msync madvise mincore remap_file_pages\
2803 mlock munlock mlockall munlockall \
2804- efgcvt efgcvt_r qefgcvt qefgcvt_r \
2805 hsearch hsearch_r tsearch lsearch \
2806 err error ustat \
2807- getsysstats dirname regexp \
2808+ getsysstats dirname \
2809 getloadavg getclktck \
2810 fgetxattr flistxattr fremovexattr fsetxattr getxattr \
2811 listxattr lgetxattr llistxattr lremovexattr lsetxattr \
2812 removexattr setxattr getauxval ifunc-impl-list
2813
2814+routines-$(OPTION_POSIX_REGEXP) += regexp
2815+routines-$(OPTION_EGLIBC_FSTAB) += fstab
2816+routines-$(OPTION_EGLIBC_BSD) += chflags fchflags revoke
2817+routines-$(OPTION_EGLIBC_FCVT) += efgcvt efgcvt_r qefgcvt qefgcvt_r
2818+
2819 generated += tst-error1.mtrace tst-error1-mem.out
2820
2821 aux := init-misc
2822 install-lib := libg.a
2823 gpl2lgpl := error.c error.h
2824
2825-tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
2826- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
2827+tests := tst-dirname tst-tsearch tst-fdset tst-mntent tst-hsearch \
2828+ tst-pselect tst-insremque tst-mntent2 bug-hsearch1
2829+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
2830+tests-$(OPTION_EGLIBC_FCVT) += tst-efgcvt
2831 ifeq ($(run-built-tests),yes)
2832+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
2833 tests-special += $(objpfx)tst-error1-mem.out
2834 endif
2835+endif
2836
2837 CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
2838 CFLAGS-tsearch.c = $(uses-callbacks)
2839Index: git/misc/sys/xattr.h
2840===================================================================
2841--- git.orig/misc/sys/xattr.h 2014-08-29 20:00:52.644070587 -0700
2842+++ git/misc/sys/xattr.h 2014-08-29 20:01:15.216070587 -0700
2843@@ -26,7 +26,6 @@
2844
2845 /* The following constants should be used for the fifth parameter of
2846 `*setxattr'. */
2847-#ifndef __USE_KERNEL_XATTR_DEFS
2848 enum
2849 {
2850 XATTR_CREATE = 1, /* set value, fail if attr already exists. */
2851@@ -34,7 +33,6 @@
2852 XATTR_REPLACE = 2 /* set value, fail if attr does not exist. */
2853 #define XATTR_REPLACE XATTR_REPLACE
2854 };
2855-#endif
2856
2857 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
2858 is SIZE bytes long). Return 0 on success, -1 for errors. */
2859Index: git/misc/tst-efgcvt.c
2860===================================================================
2861--- git.orig/misc/tst-efgcvt.c 2014-08-29 20:00:52.652070587 -0700
2862+++ git/misc/tst-efgcvt.c 2014-08-29 20:01:15.216070587 -0700
2863@@ -59,7 +59,7 @@
2864 { 123.01, -4, 3, "" },
2865 { 126.71, -4, 3, "" },
2866 { 0.0, 4, 1, "0000" },
2867-#if DBL_MANT_DIG == 53
2868+#if DBL_MANT_DIG == 53 && !(defined __powerpc__ && defined __NO_FPRS__ && !defined _SOFT_FLOAT && !defined _SOFT_DOUBLE)
2869 { 0x1p-1074, 3, -323, "494" },
2870 { -0x1p-1074, 3, -323, "494" },
2871 #endif
2872Index: git/nis/Makefile
2873===================================================================
2874--- git.orig/nis/Makefile 2014-08-29 20:00:52.660070587 -0700
2875+++ git/nis/Makefile 2014-08-29 20:01:15.216070587 -0700
2876@@ -18,6 +18,8 @@
2877 #
2878 # Makefile for NIS/NIS+ part.
2879 #
2880+include ../option-groups.mak
2881+
2882 subdir := nis
2883
2884 include ../Makeconfig
2885@@ -30,19 +32,26 @@
2886
2887 # These are the databases available for the nis (and perhaps later nisplus)
2888 # service. This must be a superset of the services in nss.
2889-databases = proto service hosts network grp pwd rpc ethers \
2890- spwd netgrp alias publickey
2891+databases-y := proto service hosts network grp pwd rpc ethers \
2892+ spwd netgrp publickey
2893+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
2894
2895 # Specify rules for the nss_* modules.
2896-services := nis nisplus compat
2897+# The 'compat' module includes nis support, and the 'nss' directory
2898+# includes a bare-bones "files" library, so we'll include 'compat' in
2899+# OPTION_EGLIBC_NIS.
2900+services-y :=
2901+services-$(OPTION_EGLIBC_NIS) += nis nisplus compat
2902+
2903+extra-libs-$(OPTION_EGLIBC_NIS) += libnsl
2904+extra-libs-y += $(services-y:%=libnss_%)
2905
2906-extra-libs = libnsl $(services:%=libnss_%)
2907 # These libraries will be built in the `others' pass rather than
2908 # the `lib' pass, because they depend on libc.so being built already.
2909-extra-libs-others = $(extra-libs)
2910+extra-libs-others-y += $(extra-libs-y)
2911
2912 # The sources are found in the appropriate subdir.
2913-subdir-dirs = $(services:%=nss_%)
2914+subdir-dirs = $(services-y:%=nss_%)
2915 vpath %.c $(subdir-dirs)
2916
2917 libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
2918@@ -60,11 +69,11 @@
2919 libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups)
2920 libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
2921
2922-libnss_nis-routines := $(addprefix nis-,$(databases)) nis-initgroups \
2923+libnss_nis-routines := $(addprefix nis-,$(databases-y)) nis-initgroups \
2924 nss-nis
2925 libnss_nis-inhibit-o = $(filter-out .os,$(object-suffixes))
2926
2927-libnss_nisplus-routines := $(addprefix nisplus-,$(databases)) nisplus-parser \
2928+libnss_nisplus-routines := $(addprefix nisplus-,$(databases-y)) nisplus-parser \
2929 nss-nisplus nisplus-initgroups
2930 libnss_nisplus-inhibit-o = $(filter-out .os,$(object-suffixes))
2931
2932@@ -80,12 +89,12 @@
2933 # Target-specific variable setting to link objects using deprecated
2934 # RPC interfaces with the version of libc.so that makes them available
2935 # for new links:
2936-$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
2937+$(services-y:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
2938 libc-for-link = $(libnsl-libc)
2939
2940
2941 ifeq ($(build-shared),yes)
2942-$(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
2943+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
2944 else
2945-$(others:%=$(objpfx)%): $(objpfx)libnsl.a
2946+$(others-y:%=$(objpfx)%): $(objpfx)libnsl.a
2947 endif
2948Index: git/nptl/Makefile
2949===================================================================
2950--- git.orig/nptl/Makefile 2014-08-29 20:00:52.704070587 -0700
2951+++ git/nptl/Makefile 2014-08-29 20:01:15.216070587 -0700
2952@@ -18,6 +18,8 @@
2953 #
2954 # Sub-makefile for NPTL portion of the library.
2955 #
2956+include ../option-groups.mak
2957+
2958 subdir := nptl
2959
2960 include ../Makeconfig
2961@@ -116,7 +118,7 @@
2962 pt-raise pt-system \
2963 flockfile ftrylockfile funlockfile \
2964 sigaction \
2965- herrno res pt-allocrtsig \
2966+ pt-allocrtsig \
2967 pthread_kill_other_threads \
2968 pthread_getaffinity pthread_setaffinity \
2969 pthread_attr_getaffinity pthread_attr_setaffinity \
2970@@ -136,6 +138,8 @@
2971 # pthread_setgid pthread_setegid pthread_setregid \
2972 # pthread_setresgid
2973
2974+libpthread-routines-$(OPTION_EGLIBC_INET) := herrno res
2975+
2976 libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
2977 libpthread-static-only-routines = pthread_atfork
2978
2979@@ -210,7 +214,7 @@
2980 tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
2981 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a tst-mutexpi8 \
2982 tst-mutexpi9 \
2983- tst-spin1 tst-spin2 tst-spin3 tst-spin4 \
2984+ tst-spin1 tst-spin2 tst-spin3 \
2985 tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \
2986 tst-cond8 tst-cond9 tst-cond10 tst-cond11 tst-cond12 tst-cond13 \
2987 tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
2988@@ -244,14 +248,14 @@
2989 tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
2990 tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
2991 tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
2992- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
2993+ tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
2994 tst-cancel-self tst-cancel-self-cancelstate \
2995 tst-cancel-self-canceltype tst-cancel-self-testcancel \
2996 tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
2997 tst-flock1 tst-flock2 \
2998 tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
2999 tst-signal6 tst-signal7 \
3000- tst-exec1 tst-exec2 tst-exec3 tst-exec4 \
3001+ tst-exec2 tst-exec3 tst-exec4 \
3002 tst-exit1 tst-exit2 tst-exit3 \
3003 tst-stdio1 tst-stdio2 \
3004 tst-stack1 tst-stack2 tst-stack3 tst-pthread-getattr \
3005@@ -259,13 +263,12 @@
3006 tst-unload \
3007 tst-dlsym1 \
3008 tst-sysconf \
3009- tst-locale1 tst-locale2 \
3010+ tst-locale2 \
3011 tst-umask1 \
3012 tst-popen1 \
3013 tst-clock1 \
3014 tst-context1 \
3015 tst-sched1 \
3016- tst-backtrace1 \
3017 tst-abstime \
3018 tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
3019 tst-getpid1 tst-getpid2 tst-getpid3 \
3020@@ -275,6 +278,17 @@
3021 tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
3022 test-srcs = tst-oddstacklimit
3023
3024+# This test uses the posix_spawn functions.
3025+tests-$(OPTION_EGLIBC_SPAWN) += tst-exec1
3026+
3027+# This test uses the 'backtrace' functions.
3028+tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
3029+
3030+# This test is written in C++.
3031+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
3032+
3033+tests-$(OPTION_EGLIBC_LOCALE_CODE) += tst-locale1
3034+
3035 # Files which must not be linked with libpthread.
3036 tests-nolibpthread = tst-unload
3037
3038Index: git/nptl/pthread_create.c
3039===================================================================
3040--- git.orig/nptl/pthread_create.c 2014-08-29 20:00:52.764070587 -0700
3041+++ git/nptl/pthread_create.c 2014-08-29 20:01:15.216070587 -0700
3042@@ -31,6 +31,7 @@
3043 #include <kernel-features.h>
3044 #include <exit-thread.h>
3045
3046+#include <gnu/option-groups.h>
3047 #include <shlib-compat.h>
3048
3049 #include <stap-probe.h>
3050@@ -240,8 +241,10 @@
3051 THREAD_SETMEM (pd, cpuclock_offset, now);
3052 #endif
3053
3054+#if __OPTION_EGLIBC_INET
3055 /* Initialize resolver state pointer. */
3056 __resp = &pd->res;
3057+#endif
3058
3059 /* Initialize pointers to locale data. */
3060 __ctype_init ();
3061@@ -322,8 +325,10 @@
3062 /* Run the destructor for the thread-local data. */
3063 __nptl_deallocate_tsd ();
3064
3065+#if __OPTION_EGLIBC_INET
3066 /* Clean up any state libc stored in thread-local variables. */
3067 __libc_thread_freeres ();
3068+#endif
3069
3070 /* If this is the last thread we terminate the process now. We
3071 do not notify the debugger, it might just irritate it if there
3072Index: git/nscd/Makefile
3073===================================================================
3074--- git.orig/nscd/Makefile 2014-08-29 20:00:52.948070587 -0700
3075+++ git/nscd/Makefile 2014-08-29 20:01:15.216070587 -0700
3076@@ -18,14 +18,17 @@
3077 #
3078 # Sub-makefile for nscd portion of the library.
3079 #
3080+include ../option-groups.mak
3081+
3082 subdir := nscd
3083
3084 include ../Makeconfig
3085
3086 ifneq ($(use-nscd),no)
3087-routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
3088+routines-$(OPTION_EGLIBC_INET) += \
3089+ nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
3090 nscd_initgroups nscd_getserv_r nscd_netgroup
3091-aux := nscd_helper
3092+aux-$(OPTION_EGLIBC_INET) += nscd_helper
3093 endif
3094
3095 # To find xmalloc.c
3096@@ -37,14 +40,18 @@
3097 dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
3098 xmalloc xstrdup aicache initgrcache gai res_hconf \
3099 netgroupcache
3100-
3101+ifneq (y,$(OPTION_EGLIBC_NIS))
3102+# If we haven't build libnsl.so, then we'll need to include our
3103+# own copy of nis_hash.
3104+nscd-modules += nis_hash
3105+endif
3106 ifeq ($(build-nscd)$(have-thread-library),yesyes)
3107
3108-others += nscd
3109-others-pie += nscd
3110-install-sbin := nscd
3111+others-$(OPTION_EGLIBC_INET) += nscd
3112+others-pie-$(OPTION_EGLIBC_INET) += nscd
3113+install-sbin-$(OPTION_EGLIBC_INET) += nscd
3114
3115-extra-objs = $(nscd-modules:=.o)
3116+extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
3117
3118 endif
3119
3120@@ -101,7 +108,15 @@
3121 $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
3122
3123 ifeq ($(build-shared),yes)
3124-$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
3125+$(objpfx)nscd: $(shared-thread-library)
3126+else
3127+$(objpfx)nscd: $(static-thread-library)
3128+endif
3129+
3130+ifeq (y,$(OPTION_EGLIBC_NIS))
3131+ifeq ($(build-shared),yes)
3132+$(objpfx)nscd: $(common-objpfx)nis/libnsl.so
3133 else
3134-$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
3135+$(objpfx)nscd: $(common-objpfx)nis/libnsl.a
3136+endif
3137 endif
3138Index: git/nscd/nis_hash.c
3139===================================================================
3140--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3141+++ git/nscd/nis_hash.c 2014-08-29 20:01:15.216070587 -0700
3142@@ -0,0 +1,3 @@
3143+/* If OPTION_EGLIBC_NIS is disabled, nscd can't get this from libnsl.so;
3144+ we need our own copy. */
3145+#include "../nis/nis_hash.c"
3146Index: git/nss/fixed-nsswitch.conf
3147===================================================================
3148--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3149+++ git/nss/fixed-nsswitch.conf 2014-08-29 20:01:15.216070587 -0700
3150@@ -0,0 +1,22 @@
3151+# /etc/nsswitch.conf
3152+#
3153+# Example configuration for fixed name service.
3154+# See the description of OPTION_EGLIBC_NSSWITCH in option-groups.def
3155+# for details.
3156+#
3157+
3158+aliases: files
3159+
3160+passwd: files
3161+group: files
3162+shadow: files
3163+
3164+hosts: files dns
3165+networks: files dns
3166+
3167+protocols: files
3168+services: files
3169+ethers: files
3170+rpc: files
3171+
3172+netgroup: files
3173Index: git/nss/fixed-nsswitch.functions
3174===================================================================
3175--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3176+++ git/nss/fixed-nsswitch.functions 2014-08-29 20:01:15.216070587 -0700
3177@@ -0,0 +1,121 @@
3178+/* List of functions defined for fixed NSS in GNU C Library.
3179+ Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
3180+ This file is part of the GNU C Library.
3181+
3182+ The GNU C Library is free software; you can redistribute it and/or
3183+ modify it under the terms of the GNU Lesser General Public
3184+ License as published by the Free Software Foundation; either
3185+ version 2.1 of the License, or (at your option) any later version.
3186+
3187+ The GNU C Library is distributed in the hope that it will be useful,
3188+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3189+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3190+ Lesser General Public License for more details.
3191+
3192+ You should have received a copy of the GNU Lesser General Public
3193+ License along with the GNU C Library; if not, write to the Free
3194+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3195+ 02111-1307 USA. */
3196+
3197+/* When OPTION_EGLIBC_NSSWITCH is disabled (see option-groups.def),
3198+ EGLIBC does not use the 'dlopen' and 'dlsym' functions to look for
3199+ database query functions in the individual name service libraries.
3200+ Instead, it uses a set of functions chosen at compile time, as
3201+ directed by the OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS file. This
3202+ file is a sample of what you might use there.
3203+
3204+ This file is C source code; it should only contain invocations of
3205+ the following macros:
3206+
3207+ - DEFINE_ENT (DATABASE, SERVICE, X)
3208+
3209+ Declare the 'setXent', 'getXent_r', and 'endXent' functions that
3210+ query DATABASE using the service library 'libnss_SERVICE.so.2'.
3211+ DATABASE should be the full name of the database as it appears in
3212+ 'nsswitch.conf', like 'passwd' or 'aliases'.
3213+
3214+ (The non-reentrant 'getXent' functions are implemented in terms
3215+ of the reentrant 'getXent_r' functions, so there is no need to
3216+ refer to them explicitly here.)
3217+
3218+ - DEFINE_GETBY (DATABASE, SERVICE, X, KEY)
3219+
3220+ Declare the 'getXbyKEY_r' functions that query DATABASE using
3221+ SERVICE. DATABASE and SERVICE are as described above.
3222+
3223+ (The non-reentrant 'getXbyKEY' functions are implemented in terms
3224+ of the reentrant 'getXbyKEY_r' functions, so there is no need to
3225+ refer to them explicitly here.)
3226+
3227+ Use the special key 'name3' for the service library function that
3228+ implements the 'getaddrinfo' function.
3229+
3230+ - DEFINE_GET (DATABASE, SERVICE, QUERY)
3231+
3232+ Declare the 'getQUERY_r' functions that query DATABASE using
3233+ SERVICE. This is used for functions like 'getpwnam'.
3234+
3235+ (The non-reentrant 'getQUERY' functions are implemented in terms
3236+ of the reentrant 'getQUERY_r' functions, so there is no need to
3237+ refer to them explicitly here.)
3238+
3239+ This sample file only includes functions that consult the files in
3240+ '/etc', and the Domain Name System (DNS). */
3241+
3242+/* aliases */
3243+DEFINE_ENT (aliases, files, alias)
3244+DEFINE_GETBY (aliases, files, alias, name)
3245+
3246+/* ethers */
3247+DEFINE_ENT (ethers, files, ether)
3248+
3249+/* group */
3250+DEFINE_ENT (group, files, gr)
3251+DEFINE_GET (group, files, grgid)
3252+DEFINE_GET (group, files, grnam)
3253+
3254+/* hosts */
3255+DEFINE_ENT (hosts, files, host)
3256+DEFINE_GETBY (hosts, files, host, addr)
3257+DEFINE_GETBY (hosts, files, host, name)
3258+DEFINE_GETBY (hosts, files, host, name2)
3259+DEFINE_GET (hosts, files, hostton)
3260+DEFINE_GET (hosts, files, ntohost)
3261+DEFINE_GETBY (hosts, dns, host, addr)
3262+DEFINE_GETBY (hosts, dns, host, name)
3263+DEFINE_GETBY (hosts, dns, host, name2)
3264+DEFINE_GETBY (hosts, dns, host, name3)
3265+
3266+/* netgroup */
3267+DEFINE_ENT (netgroup, files, netgr)
3268+
3269+/* networks */
3270+DEFINE_ENT (networks, files, net)
3271+DEFINE_GETBY (networks, files, net, name)
3272+DEFINE_GETBY (networks, files, net, addr)
3273+DEFINE_GETBY (networks, dns, net, name)
3274+DEFINE_GETBY (networks, dns, net, addr)
3275+
3276+/* protocols */
3277+DEFINE_ENT (protocols, files, proto)
3278+DEFINE_GETBY (protocols, files, proto, name)
3279+DEFINE_GETBY (protocols, files, proto, number)
3280+
3281+/* passwd */
3282+DEFINE_ENT (passwd, files, pw)
3283+DEFINE_GET (passwd, files, pwnam)
3284+DEFINE_GET (passwd, files, pwuid)
3285+
3286+/* rpc */
3287+DEFINE_ENT (rpc, files, rpc)
3288+DEFINE_GETBY (rpc, files, rpc, name)
3289+DEFINE_GETBY (rpc, files, rpc, number)
3290+
3291+/* services */
3292+DEFINE_ENT (services, files, serv)
3293+DEFINE_GETBY (services, files, serv, name)
3294+DEFINE_GETBY (services, files, serv, port)
3295+
3296+/* shadow */
3297+DEFINE_ENT (shadow, files, sp)
3298+DEFINE_GET (shadow, files, spnam)
3299Index: git/nss/gen-fixed-nsswitch.c
3300===================================================================
3301--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3302+++ git/nss/gen-fixed-nsswitch.c 2014-08-29 20:01:15.216070587 -0700
3303@@ -0,0 +1,803 @@
3304+/* gen-fixed-nsswitch.c --- generate fixed name service data structures
3305+ Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
3306+ This file is part of the GNU C Library.
3307+
3308+ The GNU C Library is free software; you can redistribute it and/or
3309+ modify it under the terms of the GNU Lesser General Public
3310+ License as published by the Free Software Foundation; either
3311+ version 2.1 of the License, or (at your option) any later version.
3312+
3313+ The GNU C Library is distributed in the hope that it will be useful,
3314+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3315+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3316+ Lesser General Public License for more details.
3317+
3318+ You should have received a copy of the GNU Lesser General Public
3319+ License along with the GNU C Library; if not, write to the Free
3320+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3321+ 02111-1307 USA. */
3322+
3323+#define _GNU_SOURCE
3324+
3325+#include <stdlib.h>
3326+#include <stdio.h>
3327+#include <errno.h>
3328+#include <string.h>
3329+#include <stdarg.h>
3330+#include <assert.h>
3331+#include <ctype.h>
3332+
3333+#include "gnu/lib-names.h"
3334+#include "nss.h"
3335+
3336+/* Provide a fallback definition to allow this file to be compiled outside
3337+ libc. */
3338+#ifndef internal_function
3339+# define internal_function
3340+#endif
3341+
3342+
3343+/* Simple utilities. */
3344+
3345+void __attribute__ ((noreturn))
3346+error (const char *message)
3347+{
3348+ fprintf (stderr, "%s\n", message);
3349+ exit (1);
3350+}
3351+
3352+
3353+void *
3354+check_alloc (void *p)
3355+{
3356+ if (p)
3357+ return p;
3358+ else
3359+ error ("out of memory");
3360+}
3361+
3362+void *
3363+xmalloc (size_t size)
3364+{
3365+ return check_alloc (malloc (size));
3366+}
3367+
3368+
3369+/* Format ARGS according to FORMAT, and return the result as a
3370+ malloc'ed string. */
3371+char *
3372+saprintf (const char *format, ...)
3373+{
3374+ va_list args;
3375+ size_t len;
3376+ char *buf;
3377+
3378+ va_start (args, format);
3379+ len = vsnprintf (NULL, 0, format, args);
3380+ va_end (args);
3381+
3382+ buf = xmalloc (len + 1);
3383+ va_start (args, format);
3384+ assert (len == vsnprintf (buf, len + 1, format, args));
3385+ va_end (args);
3386+
3387+ return buf;
3388+}
3389+
3390+
3391+
3392+/* Data structures representing the configuration file in memory. */
3393+
3394+/* These are copied from nsswitch.h.
3395+
3396+ We could simply #include that file, but this program runs on the
3397+ build machine and links against the build machine's libraries,
3398+ whereas that header is meant for use by target code; it uses
3399+ 'libc_hidden_proto', 'internal_function', and related hair. Since
3400+ we've copied the parsing code, we might as well copy the data
3401+ structure definitions as well. */
3402+
3403+/* Actions performed after lookup finished. */
3404+typedef enum
3405+{
3406+ NSS_ACTION_CONTINUE,
3407+ NSS_ACTION_RETURN
3408+} lookup_actions;
3409+
3410+
3411+typedef struct service_library
3412+{
3413+ /* Name of service (`files', `dns', `nis', ...). */
3414+ const char *name;
3415+ /* Pointer to the loaded shared library. */
3416+ void *lib_handle;
3417+ /* And the link to the next entry. */
3418+ struct service_library *next;
3419+} service_library;
3420+
3421+
3422+/* For mapping a function name to a function pointer. It is known in
3423+ nsswitch.c:nss_lookup_function that a string pointer for the lookup key
3424+ is the first member. */
3425+typedef struct
3426+{
3427+ const char *fct_name;
3428+ void *fct_ptr;
3429+} known_function;
3430+
3431+
3432+typedef struct service_user
3433+{
3434+ /* And the link to the next entry. */
3435+ struct service_user *next;
3436+ /* Action according to result. */
3437+ lookup_actions actions[5];
3438+ /* Link to the underlying library object. */
3439+ service_library *library;
3440+ /* Collection of known functions.
3441+
3442+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
3443+ 'tsearch'-style tree.
3444+
3445+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
3446+ pointers to known_function structures, NULL-terminated. */
3447+ union
3448+ {
3449+ void *tree;
3450+ const known_function **array;
3451+ } known;
3452+ /* Name of the service (`files', `dns', `nis', ...). */
3453+ const char *name;
3454+} service_user;
3455+
3456+/* To access the action based on the status value use this macro. */
3457+#define nss_next_action(ni, status) ((ni)->actions[2 + status])
3458+
3459+
3460+typedef struct name_database_entry
3461+{
3462+ /* And the link to the next entry. */
3463+ struct name_database_entry *next;
3464+ /* List of service to be used. */
3465+ service_user *service;
3466+ /* Name of the database. */
3467+ const char *name;
3468+} name_database_entry;
3469+
3470+
3471+typedef struct name_database
3472+{
3473+ /* List of all known databases. */
3474+ name_database_entry *entry;
3475+ /* List of libraries with service implementation. */
3476+ service_library *library;
3477+} name_database;
3478+
3479+
3480+
3481+/* Gathering the contents of the FIXED_FUNCTIONS file. */
3482+
3483+/* It should be possible to generate this list automatically by
3484+ looking at the services and databases used in the nsswitch.conf
3485+ file, and having a hard-coded set of queries supported on each
3486+ database. */
3487+
3488+/* We #include the FIXED_FUNCTIONS file several times to build an
3489+ array of function structures holding its data. */
3490+enum function_kind {
3491+ fk_end = 0, /* Last entry. */
3492+ fk_setent, /* Like setpwent. */
3493+ fk_getent, /* Like getpwent. */
3494+ fk_endent, /* Like endpwent. */
3495+ fk_getby, /* Like gethostbyname. */
3496+ fk_get /* Like getpwnam. */
3497+};
3498+
3499+
3500+struct function {
3501+ /* What kind of function this is. */
3502+ enum function_kind kind;
3503+
3504+ /* The database and service of the function being hardwired in. */
3505+ char *database, *service;
3506+
3507+ /* The kind of entry being queried, for 'fk_setent', 'fk_getent',
3508+ 'fk_endent', and 'fk_getby' functions. */
3509+ char *entry;
3510+
3511+ /* The key, for 'fk_getby' entries. */
3512+ char *key;
3513+
3514+ /* The value and key, for 'fk_get' entries. */
3515+ char *value_and_key;
3516+};
3517+
3518+
3519+const struct function functions[] =
3520+ {
3521+
3522+#define DEFINE_ENT(database, service, entry) \
3523+ { fk_setent, #database, #service, #entry }, \
3524+ { fk_getent, #database, #service, #entry }, \
3525+ { fk_endent, #database, #service, #entry },
3526+#define DEFINE_GETBY(database, service, entry, key) \
3527+ { fk_getby, #database, #service, #entry, #key },
3528+#define DEFINE_GET(database, service, value_and_key) \
3529+ { fk_get, #database, #service, NULL, NULL, #value_and_key },
3530+
3531+#include FIXED_FUNCTIONS
3532+
3533+#undef DEFINE_ENT
3534+#undef DEFINE_GETBY
3535+#undef DEFINE_GET
3536+
3537+ { fk_end }
3538+ };
3539+
3540+
3541+/* Parsing the config file. Functions copied from nsswitch.c. */
3542+
3543+#define __strchrnul strchrnul
3544+#define __getline getline
3545+#define __strncasecmp strncasecmp
3546+
3547+/* Prototypes for the local functions. */
3548+static name_database *nss_parse_file (const char *fname) internal_function;
3549+static name_database_entry *nss_getline (char *line) internal_function;
3550+static service_user *nss_parse_service_list (const char *line)
3551+ internal_function;
3552+
3553+static name_database *
3554+internal_function
3555+nss_parse_file (const char *fname)
3556+{
3557+ FILE *fp;
3558+ name_database *result;
3559+ name_database_entry *last;
3560+ char *line;
3561+ size_t len;
3562+
3563+ /* Open the configuration file. */
3564+ fp = fopen (fname, "rc");
3565+ if (fp == NULL)
3566+ return NULL;
3567+
3568+ // /* No threads use this stream. */
3569+ // __fsetlocking (fp, FSETLOCKING_BYCALLER);
3570+
3571+ result = (name_database *) xmalloc (sizeof (name_database));
3572+
3573+ result->entry = NULL;
3574+ result->library = NULL;
3575+ last = NULL;
3576+ line = NULL;
3577+ len = 0;
3578+ do
3579+ {
3580+ name_database_entry *this;
3581+ ssize_t n;
3582+
3583+ n = __getline (&line, &len, fp);
3584+ if (n < 0)
3585+ break;
3586+ if (line[n - 1] == '\n')
3587+ line[n - 1] = '\0';
3588+
3589+ /* Because the file format does not know any form of quoting we
3590+ can search forward for the next '#' character and if found
3591+ make it terminating the line. */
3592+ *__strchrnul (line, '#') = '\0';
3593+
3594+ /* If the line is blank it is ignored. */
3595+ if (line[0] == '\0')
3596+ continue;
3597+
3598+ /* Each line completely specifies the actions for a database. */
3599+ this = nss_getline (line);
3600+ if (this != NULL)
3601+ {
3602+ if (last != NULL)
3603+ last->next = this;
3604+ else
3605+ result->entry = this;
3606+
3607+ last = this;
3608+ }
3609+ }
3610+ while (!feof_unlocked (fp));
3611+
3612+ /* Free the buffer. */
3613+ free (line);
3614+ /* Close configuration file. */
3615+ fclose (fp);
3616+
3617+ return result;
3618+}
3619+
3620+
3621+/* Read the source names:
3622+ `( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
3623+ */
3624+static service_user *
3625+internal_function
3626+nss_parse_service_list (const char *line)
3627+{
3628+ service_user *result = NULL, **nextp = &result;
3629+
3630+ while (1)
3631+ {
3632+ service_user *new_service;
3633+ const char *name;
3634+
3635+ while (isspace (line[0]))
3636+ ++line;
3637+ if (line[0] == '\0')
3638+ /* No source specified. */
3639+ return result;
3640+
3641+ /* Read <source> identifier. */
3642+ name = line;
3643+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[')
3644+ ++line;
3645+ if (name == line)
3646+ return result;
3647+
3648+
3649+ new_service = (service_user *) xmalloc (sizeof (*new_service));
3650+ new_service->name = (char *) xmalloc (line - name + 1);
3651+
3652+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
3653+ = '\0';
3654+
3655+ /* Set default actions. */
3656+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
3657+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE;
3658+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE;
3659+ new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
3660+ new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
3661+ new_service->library = NULL;
3662+ new_service->known.tree = NULL;
3663+ new_service->next = NULL;
3664+
3665+ while (isspace (line[0]))
3666+ ++line;
3667+
3668+ if (line[0] == '[')
3669+ {
3670+ /* Read criterions. */
3671+ do
3672+ ++line;
3673+ while (line[0] != '\0' && isspace (line[0]));
3674+
3675+ do
3676+ {
3677+ int not;
3678+ enum nss_status status;
3679+ lookup_actions action;
3680+
3681+ /* Grok ! before name to mean all statii but that one. */
3682+ not = line[0] == '!';
3683+ if (not)
3684+ ++line;
3685+
3686+ /* Read status name. */
3687+ name = line;
3688+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
3689+ && line[0] != ']')
3690+ ++line;
3691+
3692+ /* Compare with known statii. */
3693+ if (line - name == 7)
3694+ {
3695+ if (__strncasecmp (name, "SUCCESS", 7) == 0)
3696+ status = NSS_STATUS_SUCCESS;
3697+ else if (__strncasecmp (name, "UNAVAIL", 7) == 0)
3698+ status = NSS_STATUS_UNAVAIL;
3699+ else
3700+ return result;
3701+ }
3702+ else if (line - name == 8)
3703+ {
3704+ if (__strncasecmp (name, "NOTFOUND", 8) == 0)
3705+ status = NSS_STATUS_NOTFOUND;
3706+ else if (__strncasecmp (name, "TRYAGAIN", 8) == 0)
3707+ status = NSS_STATUS_TRYAGAIN;
3708+ else
3709+ return result;
3710+ }
3711+ else
3712+ return result;
3713+
3714+ while (isspace (line[0]))
3715+ ++line;
3716+ if (line[0] != '=')
3717+ return result;
3718+ do
3719+ ++line;
3720+ while (isspace (line[0]));
3721+
3722+ name = line;
3723+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
3724+ && line[0] != ']')
3725+ ++line;
3726+
3727+ if (line - name == 6 && __strncasecmp (name, "RETURN", 6) == 0)
3728+ action = NSS_ACTION_RETURN;
3729+ else if (line - name == 8
3730+ && __strncasecmp (name, "CONTINUE", 8) == 0)
3731+ action = NSS_ACTION_CONTINUE;
3732+ else
3733+ return result;
3734+
3735+ if (not)
3736+ {
3737+ /* Save the current action setting for this status,
3738+ set them all to the given action, and reset this one. */
3739+ const lookup_actions save = new_service->actions[2 + status];
3740+ new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
3741+ new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
3742+ new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
3743+ new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
3744+ new_service->actions[2 + status] = save;
3745+ }
3746+ else
3747+ new_service->actions[2 + status] = action;
3748+
3749+ /* Skip white spaces. */
3750+ while (isspace (line[0]))
3751+ ++line;
3752+ }
3753+ while (line[0] != ']');
3754+
3755+ /* Skip the ']'. */
3756+ ++line;
3757+ }
3758+
3759+ *nextp = new_service;
3760+ nextp = &new_service->next;
3761+ }
3762+}
3763+
3764+static name_database_entry *
3765+internal_function
3766+nss_getline (char *line)
3767+{
3768+ const char *name;
3769+ name_database_entry *result;
3770+ size_t len;
3771+
3772+ /* Ignore leading white spaces. ATTENTION: this is different from
3773+ what is implemented in Solaris. The Solaris man page says a line
3774+ beginning with a white space character is ignored. We regard
3775+ this as just another misfeature in Solaris. */
3776+ while (isspace (line[0]))
3777+ ++line;
3778+
3779+ /* Recognize `<database> ":"'. */
3780+ name = line;
3781+ while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
3782+ ++line;
3783+ if (line[0] == '\0' || name == line)
3784+ /* Syntax error. */
3785+ return NULL;
3786+ *line++ = '\0';
3787+
3788+ len = strlen (name) + 1;
3789+
3790+ result = (name_database_entry *) xmalloc (sizeof (*result));
3791+ result->name = (char *) xmalloc (len);
3792+
3793+ /* Save the database name. */
3794+ memcpy ((char *) result->name, name, len);
3795+
3796+ /* Parse the list of services. */
3797+ result->service = nss_parse_service_list (line);
3798+
3799+ result->next = NULL;
3800+ return result;
3801+}
3802+
3803+
3804+
3805+/* Generating code for statically initialized nsswitch structures. */
3806+
3807+
3808+/* Return the service-neutral suffix of the name of the service
3809+ library function referred to by the function F. The result is
3810+ allocated with malloc. */
3811+char *
3812+known_function_suffix (const struct function *f)
3813+{
3814+ switch (f->kind)
3815+ {
3816+ case fk_setent:
3817+ return saprintf ("set%sent", f->entry);
3818+
3819+ case fk_getent:
3820+ return saprintf ("get%sent_r", f->entry);
3821+
3822+ case fk_endent:
3823+ return saprintf ("end%sent", f->entry);
3824+
3825+ case fk_getby:
3826+ return saprintf ("get%sby%s_r", f->entry, f->key);
3827+
3828+ case fk_get:
3829+ return saprintf ("get%s_r", f->value_and_key);
3830+
3831+ default:
3832+ abort ();
3833+ }
3834+}
3835+
3836+
3837+/* Return the name of the service library function referred to by the
3838+ function F. The result is allocated with malloc. */
3839+char *
3840+known_function_name (const struct function *f)
3841+{
3842+ return saprintf ("_nss_%s_%s", f->service, known_function_suffix (f));
3843+}
3844+
3845+
3846+/* Write initialized known_function structures to OUT for
3847+ all the functions we'll use. */
3848+void
3849+generate_known_functions (FILE *out)
3850+{
3851+ int i;
3852+
3853+ /* First, generate weak references to the functions. The service
3854+ libraries depend on libc, and if these references weren't weak,
3855+ we'd be making libc depend circularly on the service
3856+ libraries. */
3857+ for (i = 0; functions[i].kind; i++)
3858+ {
3859+ char *name = known_function_name (&functions[i]);
3860+ fprintf (out, "typeof (%s) %s __attribute__ ((weak));\n",
3861+ name, name);
3862+ }
3863+ fputs ("\n", out);
3864+
3865+ /* Then, a table mapping names to functions. */
3866+ fputs ("static const known_function fixed_known_functions[] = {\n",
3867+ out);
3868+ for (i = 0; functions[i].kind; i++)
3869+ {
3870+ const struct function *f = &functions[i];
3871+ char *suffix = known_function_suffix (f);
3872+
3873+ fprintf (out, " /* %2d */ { \"%s\", _nss_%s_%s },\n",
3874+ i, suffix, f->service, suffix);
3875+ }
3876+ fputs ("};\n", out);
3877+ fputs ("\n", out);
3878+}
3879+
3880+
3881+/* Print code to OUT for an initialized array of pointers to the
3882+ 'known_function' structures needed for USER, which is for
3883+ DATABASE. Return its name, allocated with malloc. */
3884+char *
3885+generate_known_function_list (FILE *out,
3886+ const name_database_entry *database,
3887+ const service_user *user)
3888+{
3889+ char *list_name = saprintf ("fixed_%s_%s_known_funcs",
3890+ database->name, user->name);
3891+ fprintf (out, "static const known_function *%s[] = {\n",
3892+ list_name);
3893+ int i;
3894+ for (i = 0; functions[i].kind; i++)
3895+ if (strcmp (functions[i].database, database->name) == 0
3896+ && strcmp (functions[i].service, user->name) == 0)
3897+ fprintf (out, " &fixed_known_functions[%d], /* %s */\n",
3898+ i, known_function_name (&functions[i]));
3899+ fputs (" NULL\n", out);
3900+ fputs ("};\n", out);
3901+ fputs ("\n", out);
3902+
3903+ return list_name;
3904+}
3905+
3906+
3907+/* Return the name of the status value STATUS, as a statically
3908+ allocated string. */
3909+const char *
3910+lookup_status_name (enum nss_status status)
3911+{
3912+ switch (status)
3913+ {
3914+ case NSS_STATUS_TRYAGAIN: return "NSS_STATUS_TRYAGAIN";
3915+ case NSS_STATUS_UNAVAIL: return "NSS_STATUS_UNAVAIL";
3916+ case NSS_STATUS_NOTFOUND: return "NSS_STATUS_NOTFOUND";
3917+ case NSS_STATUS_SUCCESS: return "NSS_STATUS_SUCCESS";
3918+ case NSS_STATUS_RETURN: return "NSS_STATUS_RETURN";
3919+ default: abort ();
3920+ };
3921+}
3922+
3923+
3924+/* Return the name of ACTION as a statically allocated string. */
3925+const char *
3926+lookup_action_name (lookup_actions action)
3927+{
3928+ switch (action)
3929+ {
3930+ case NSS_ACTION_CONTINUE: return "NSS_ACTION_CONTINUE";
3931+ case NSS_ACTION_RETURN: return "NSS_ACTION_RETURN";
3932+ default: abort ();
3933+ }
3934+}
3935+
3936+
3937+/* Print code to OUT for the list of service_user structures starting
3938+ with USER, which are all for DATABASE. Return the name of the
3939+ first structure in that list, or zero if USER is NULL. */
3940+char *
3941+generate_service_user_list (FILE *out,
3942+ name_database_entry *database,
3943+ service_user *user)
3944+{
3945+ if (user)
3946+ {
3947+ /* Generate the tail of the list. */
3948+ char *next_name = generate_service_user_list (out, database, user->next);
3949+ /* Generate our known function list. */
3950+ char *known_function_list_name =
3951+ generate_known_function_list (out, database, user);
3952+
3953+ char *name = saprintf ("fixed_%s_%s_user", database->name, user->name);
3954+
3955+ fprintf (out, "static const service_user %s = {\n", name);
3956+ if (next_name)
3957+ fprintf (out, " (service_user *) &%s,\n", next_name);
3958+ else
3959+ fprintf (out, " NULL, /* no next entry */\n");
3960+ fputs (" {\n", out);
3961+ int i;
3962+ for (i = 0; i < sizeof (user->actions) / sizeof (user->actions[0]); i++)
3963+ fprintf (out, " %s, /* %s */\n",
3964+ lookup_action_name (user->actions[i]),
3965+ lookup_status_name (i - 2));
3966+ fputs (" },\n", out);
3967+ fprintf (out, " NULL, /* we never need the service library */\n");
3968+ fprintf (out, " { .array = %s },\n", known_function_list_name);
3969+ fprintf (out, " \"%s\"\n", user->name);
3970+ fputs ("};\n", out);
3971+ fputs ("\n", out);
3972+
3973+ return name;
3974+ }
3975+ else
3976+ return NULL;
3977+}
3978+
3979+
3980+/* Print code to OUT for the list of name_database_entry structures
3981+ starting with DATABASE. Return the name of the first structure
3982+ in that list, or zero if DATABASE is NULL. */
3983+char *
3984+generate_name_database_entries (FILE *out, name_database_entry *database)
3985+{
3986+ if (database)
3987+ {
3988+ char *next_name = generate_name_database_entries (out, database->next);
3989+ char *service_user_name
3990+ = generate_service_user_list (out, database, database->service);
3991+ char *name = saprintf ("fixed_%s_name_database", database->name);
3992+
3993+ fprintf (out, "static const name_database_entry %s = {\n", name);
3994+
3995+ if (next_name)
3996+ fprintf (out, " (name_database_entry *) &%s,\n", next_name);
3997+ else
3998+ fprintf (out, " NULL,\n");
3999+
4000+ if (service_user_name)
4001+ fprintf (out, " (service_user *) &%s,\n", service_user_name);
4002+ else
4003+ fprintf (out, " NULL,\n");
4004+
4005+ fprintf (out, " \"%s\"\n", database->name);
4006+ fprintf (out, "};\n");
4007+ fputs ("\n", out);
4008+
4009+ return name;
4010+ }
4011+ else
4012+ return NULL;
4013+}
4014+
4015+
4016+void
4017+generate_name_database (FILE *out, name_database *service_table)
4018+{
4019+ /* Produce a linked list of the known name_database_entry
4020+ structures. */
4021+ char *entries = generate_name_database_entries (out, service_table->entry);
4022+
4023+ /* Now produce the main structure that points to them all. */
4024+ fprintf (out, "static const name_database fixed_name_database = {\n");
4025+ if (entries)
4026+ fprintf (out, " (name_database_entry *) &%s,\n", entries);
4027+ else
4028+ fprintf (out, " NULL,\n");
4029+ fputs (" NULL /* we don't need the libraries */\n"
4030+ "};\n",
4031+ out);
4032+}
4033+
4034+
4035+
4036+/* Generating the list of service libraries we generate references to. */
4037+
4038+/* String with revision number of the shared object files. */
4039+static const char *const nss_shlib_revision = LIBNSS_FILES_SO + 15;
4040+
4041+void
4042+generate_service_lib_list (FILE *out, name_database *service_table)
4043+{
4044+ int i, j;
4045+ int printed_any = 0;
4046+
4047+ for (i = 0; functions[i].kind; i++)
4048+ {
4049+ /* Mention each service library only once. */
4050+ for (j = 0; j < i; j++)
4051+ if (strcmp (functions[i].service, functions[j].service) == 0)
4052+ break;
4053+
4054+ if (j >= i)
4055+ {
4056+ if (printed_any)
4057+ putc (' ', out);
4058+ fprintf (out, "-lnss_%s",
4059+ functions[i].service,
4060+ nss_shlib_revision);
4061+ printed_any = 1;
4062+ }
4063+ }
4064+}
4065+
4066+
4067+/* Main. */
4068+
4069+int
4070+main (int argc, char **argv)
4071+{
4072+ if (argc != 4)
4073+ {
4074+ fprintf (stderr, "usage: gen-fixed-nsswitch HEADER SERVLIBS CONFIG\n");
4075+ exit (1);
4076+ }
4077+
4078+ name_database *service_table = nss_parse_file (argv[3]);
4079+
4080+ FILE *header = fopen (argv[1], "w");
4081+ if (! header)
4082+ {
4083+ fprintf (stderr,
4084+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
4085+ argv[1], strerror (errno));
4086+ exit (1);
4087+ }
4088+ fputs ("/* Generated by nss/gen-fixed-nsswitch.c. */\n", header);
4089+ fputs ("\n", header);
4090+ generate_known_functions (header);
4091+ generate_name_database (header, service_table);
4092+ fclose (header);
4093+
4094+ FILE *service_lib_list = fopen (argv[2], "w");
4095+ if (! service_lib_list)
4096+ {
4097+ fprintf (stderr,
4098+ "gen-fixed-nsswitch: couldn't open output file %s: %s\n",
4099+ argv[2], strerror (errno));
4100+ exit (1);
4101+ }
4102+ generate_service_lib_list (service_lib_list, service_table);
4103+ fclose (service_lib_list);
4104+
4105+ return 0;
4106+}
4107Index: git/nss/getent.c
4108===================================================================
4109--- git.orig/nss/getent.c 2014-08-29 20:00:52.976070587 -0700
4110+++ git/nss/getent.c 2014-08-29 20:01:15.216070587 -0700
4111@@ -39,6 +39,7 @@
4112 #include <netinet/ether.h>
4113 #include <netinet/in.h>
4114 #include <sys/socket.h>
4115+#include <gnu/option-groups.h>
4116
4117 /* Get libc version number. */
4118 #include <version.h>
4119@@ -91,6 +92,7 @@
4120 fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
4121 }
4122
4123+#if __OPTION_EGLIBC_DB_ALIASES
4124 /* This is for aliases */
4125 static void
4126 print_aliases (struct aliasent *alias)
4127@@ -135,7 +137,9 @@
4128
4129 return result;
4130 }
4131+#endif /* __OPTION_EGLIBC_DB_ALIASES */
4132
4133+#if __OPTION_EGLIBC_INET
4134 /* This is for ethers */
4135 static int
4136 ethers_keys (int number, char *key[])
4137@@ -179,6 +183,7 @@
4138
4139 return result;
4140 }
4141+#endif /* __OPTION_EGLIBC_INET */
4142
4143 /* This is for group */
4144 static void
4145@@ -301,6 +306,7 @@
4146 return result;
4147 }
4148
4149+#if __OPTION_EGLIBC_INET
4150 /* This is for hosts */
4151 static void
4152 print_hosts (struct hostent *host)
4153@@ -598,6 +604,7 @@
4154
4155 return result;
4156 }
4157+#endif /* __OPTION_EGLIBC_INET */
4158
4159 /* Now is all for passwd */
4160 static void
4161@@ -650,6 +657,7 @@
4162 return result;
4163 }
4164
4165+#if __OPTION_EGLIBC_INET
4166 /* This is for protocols */
4167 static void
4168 print_protocols (struct protoent *proto)
4169@@ -805,6 +813,7 @@
4170
4171 return result;
4172 }
4173+#endif /* __OPTION_EGLIBC_INET */
4174
4175 /* This is for shadow */
4176 static void
4177@@ -871,21 +880,34 @@
4178 } databases[] =
4179 {
4180 #define D(name) { #name, name ## _keys },
4181-D(ahosts)
4182-D(ahostsv4)
4183-D(ahostsv6)
4184-D(aliases)
4185-D(ethers)
4186+
4187+#if __OPTION_EGLIBC_INET
4188+#define DN(name) D(name)
4189+#else
4190+#define DN(name)
4191+#endif
4192+
4193+#if __OPTION_EGLIBC_DB_ALIASES
4194+#define DA(name) D(name)
4195+#else
4196+#define DA(name)
4197+#endif
4198+
4199+DN(ahosts)
4200+DN(ahostsv4)
4201+DN(ahostsv6)
4202+DA(aliases)
4203+DN(ethers)
4204 D(group)
4205 D(gshadow)
4206-D(hosts)
4207+DN(hosts)
4208-D(initgroups)
4209+DN(initgroups)
4210-D(netgroup)
4211-D(networks)
4212+DN(netgroup)
4213+DN(networks)
4214 D(passwd)
4215-D(protocols)
4216-D(rpc)
4217-D(services)
4218+DN(protocols)
4219+DN(rpc)
4220+DN(services)
4221 D(shadow)
4222 #undef D
4223 { NULL, NULL }
4224Index: git/nss/getnssent_r.c
4225===================================================================
4226--- git.orig/nss/getnssent_r.c 2014-08-29 20:00:52.976070587 -0700
4227+++ git/nss/getnssent_r.c 2014-08-29 20:01:15.220070587 -0700
4228@@ -16,6 +16,7 @@
4229 <http://www.gnu.org/licenses/>. */
4230
4231 #include <errno.h>
4232+#include <gnu/option-groups.h>
4233 #include <netdb.h>
4234 #include "nsswitch.h"
4235
4236@@ -59,11 +60,13 @@
4237 } fct;
4238 int no_more;
4239
4240+#if __OPTION_EGLIBC_INET
4241 if (res && __res_maybe_init (&_res, 0) == -1)
4242 {
4243 __set_h_errno (NETDB_INTERNAL);
4244 return;
4245 }
4246+#endif /* __OPTION_EGLIBC_INET */
4247
4248 /* Cycle through the services and run their `setXXent' functions until
4249 we find an available service. */
4250@@ -101,11 +104,13 @@
4251 } fct;
4252 int no_more;
4253
4254+#if __OPTION_EGLIBC_INET
4255 if (res && __res_maybe_init (&_res, 0) == -1)
4256 {
4257 __set_h_errno (NETDB_INTERNAL);
4258 return;
4259 }
4260+#endif /* __OPTION_EGLIBC_INET */
4261
4262 /* Cycle through all the services and run their endXXent functions. */
4263 no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
4264@@ -141,12 +146,14 @@
4265 int no_more;
4266 enum nss_status status;
4267
4268+#if __OPTION_EGLIBC_INET
4269 if (res && __res_maybe_init (&_res, 0) == -1)
4270 {
4271 *h_errnop = NETDB_INTERNAL;
4272 *result = NULL;
4273 return errno;
4274 }
4275+#endif /* __OPTION_EGLIBC_INET */
4276
4277 /* Initialize status to return if no more functions are found. */
4278 status = NSS_STATUS_NOTFOUND;
4279@@ -161,7 +168,7 @@
4280 int is_last_nip = *nip == *last_nip;
4281
4282 status = DL_CALL_FCT (fct.f,
4283- (resbuf, buffer, buflen, &errno, &h_errno));
4284+ (resbuf, buffer, buflen, &errno, h_errnop));
4285
4286 /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
4287 provided buffer is too small. In this case we should give
4288Index: git/nss/Makefile
4289===================================================================
4290--- git.orig/nss/Makefile 2014-08-29 20:00:52.972070587 -0700
4291+++ git/nss/Makefile 2014-08-29 20:01:15.220070587 -0700
4292@@ -18,29 +18,36 @@
4293 #
4294 # Makefile for name service switch.
4295 #
4296+include ../option-groups.mak
4297+
4298 subdir := nss
4299
4300 include ../Makeconfig
4301
4302 headers := nss.h
4303
4304-# This is the trivial part which goes into libc itself.
4305-routines = nsswitch getnssent getnssent_r digits_dots \
4306- $(addsuffix -lookup,$(databases))
4307-
4308 # These are the databases that go through nss dispatch.
4309 # Caution: if you add a database here, you must add its real name
4310 # in databases.def, too.
4311-databases = proto service hosts network grp pwd rpc ethers \
4312- spwd netgrp key alias sgrp
4313+databases-y = grp pwd spwd sgrp
4314+databases-$(OPTION_EGLIBC_INET) \
4315+ += proto service hosts network rpc ethers \
4316+ netgrp key
4317+databases-$(OPTION_EGLIBC_DB_ALIASES) += alias
4318+
4319+# This is the trivial part which goes into libc itself.
4320+routines-y += nsswitch getnssent getnssent_r \
4321+ $(addsuffix -lookup,$(databases-y))
4322+routines-$(OPTION_EGLIBC_INET) += digits_dots
4323
4324 others := getent makedb
4325 install-bin := getent makedb
4326 makedb-modules = xmalloc hash-string
4327 extra-objs += $(makedb-modules:=.o)
4328
4329-tests = test-netdb tst-nss-test1 test-digits-dots
4330-xtests = bug-erange
4331+tests = tst-nss-test1
4332+tests-$(OPTION_EGLIBC_INET) += test-netdb test-digits-dots
4333+xtests-$(OPTION_EGLIBC_INET) += bug-erange
4334
4335 # Specify rules for the nss_* modules. We have some services.
4336 services := files db
4337@@ -55,7 +62,7 @@
4338 vpath %.c $(subdir-dirs) ../locale/programs ../intl
4339
4340
4341-libnss_files-routines := $(addprefix files-,$(databases)) \
4342+libnss_files-routines := $(addprefix files-,$(databases-y)) \
4343 files-initgroups files-have_o_cloexec files-init
4344
4345 libnss_db-dbs := $(addprefix db-,\
4346@@ -78,6 +85,45 @@
4347 tests += $(tests-static)
4348 endif
4349
4350+ifneq ($(OPTION_EGLIBC_NSSWITCH),y)
4351+
4352+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG
4353+$(error OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG variable left unset)
4354+endif
4355+
4356+ifndef OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS
4357+$(error OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS variable left unset)
4358+endif
4359+
4360+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)))
4361+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed config file)
4362+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG))
4363+endif
4364+
4365+ifeq (,$(wildcard $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)))
4366+$(warning OPTION_EGLIBC_NSSWITCH is disabled, but fixed functions file)
4367+$(error does not exist: $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS))
4368+endif
4369+
4370+before-compile := $(objpfx)fixed-nsswitch.h
4371+generated := fixed-nsswitch.h
4372+$(objpfx)fixed-nsswitch.h $(objfpx)fixed-nsswitch-libs: \
4373+ $(objpfx)gen-fixed-nsswitch \
4374+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
4375+ $< $(objpfx)fixed-nsswitch.h \
4376+ $(objpfx)fixed-nsswitch-libs \
4377+ $(OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG)
4378+
4379+$(objpfx)gen-fixed-nsswitch: gen-fixed-nsswitch.c \
4380+ $(common-objpfx)option-groups.config \
4381+ $(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)
4382+ $(native-compile)
4383+gen-fixed-nsswitch-CFLAGS = \
4384+ -g3 -O -Wall \
4385+ -I $(objpfx) \
4386+ -DFIXED_FUNCTIONS='"$(OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS)"'
4387+endif
4388+
4389 include ../Rules
4390
4391 ifeq (yes,$(have-selinux))
4392Index: git/nss/nsswitch.c
4393===================================================================
4394--- git.orig/nss/nsswitch.c 2014-08-29 20:00:53.004070587 -0700
4395+++ git/nss/nsswitch.c 2014-08-29 20:01:15.220070587 -0700
4396@@ -26,6 +26,7 @@
4397 #include <stdio_ext.h>
4398 #include <stdlib.h>
4399 #include <string.h>
4400+#include <gnu/option-groups.h>
4401
4402 #include <aliases.h>
4403 #include <grp.h>
4404@@ -41,6 +42,15 @@
4405 #include "../nscd/nscd_proto.h"
4406 #include <sysdep.h>
4407
4408+/* When OPTION_EGLIBC_NSSWITCH is disabled, we use fixed tables of
4409+ databases and services, generated at library build time. Thus:
4410+ - We can't reconfigure individual databases, so we don't need a
4411+ name-to-database map.
4412+ - We never add databases or service libraries, or look up functions
4413+ at runtime, so there's no need for a lock to protect our tables.
4414+ See ../option-groups.def for the details. */
4415+#if __OPTION_EGLIBC_NSSWITCH
4416+
4417 /* Prototypes for the local functions. */
4418 static name_database *nss_parse_file (const char *fname) internal_function;
4419 static name_database_entry *nss_getline (char *line) internal_function;
4420@@ -79,6 +89,9 @@
4421
4422 __libc_lock_define_initialized (static, lock)
4423
4424+#define lock_nsswitch __libc_lock_lock (lock)
4425+#define unlock_nsswitch __libc_lock_unlock (lock)
4426+
4427 #if !defined DO_STATIC_NSS || defined SHARED
4428 /* String with revision number of the shared object files. */
4429 static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
4430@@ -93,6 +106,20 @@
4431 __libc_freeres. */
4432 static name_database_entry *defconfig_entries;
4433
4434+#else /* __OPTION_EGLIBC_NSSWITCH */
4435+
4436+/* Bring in the statically initialized service table we generated at
4437+ build time. */
4438+#include "fixed-nsswitch.h"
4439+
4440+const static name_database *service_table = &fixed_name_database;
4441+
4442+/* Nothing ever changes, so there's no need to lock anything. */
4443+#define lock_nsswitch (0)
4444+#define unlock_nsswitch (0)
4445+
4446+#endif /* __OPTION_EGLIBC_NSSWITCH */
4447+
4448
4449 #ifdef USE_NSCD
4450 /* Nonzero if this is the nscd process. */
4451@@ -109,20 +136,22 @@
4452 const char *defconfig, service_user **ni)
4453 {
4454 /* Prevent multiple threads to change the service table. */
4455- __libc_lock_lock (lock);
4456+ lock_nsswitch;
4457
4458 /* Reconsider database variable in case some other thread called
4459 `__nss_configure_lookup' while we waited for the lock. */
4460 if (*ni != NULL)
4461 {
4462- __libc_lock_unlock (lock);
4463+ unlock_nsswitch;
4464 return 0;
4465 }
4466
4467+#if __OPTION_EGLIBC_NSSWITCH
4468 /* Are we initialized yet? */
4469 if (service_table == NULL)
4470 /* Read config file. */
4471 service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
4472+#endif
4473
4474 /* Test whether configuration data is available. */
4475 if (service_table != NULL)
4476@@ -144,6 +173,7 @@
4477 *ni = entry->service;
4478 }
4479
4480+#if __OPTION_EGLIBC_NSSWITCH
4481 /* No configuration data is available, either because nsswitch.conf
4482 doesn't exist or because it doesn't have a line for this database.
4483
4484@@ -166,13 +196,23 @@
4485 {
4486 entry->next = defconfig_entries;
4487 entry->service = *ni;
4488- entry->name[0] = '\0';
4489+ entry->name = "";
4490 defconfig_entries = entry;
4491 }
4492 }
4493 }
4494+#else
4495+ /* Without the dynamic behavior, we can't process defconfig. The
4496+ databases the user specified at library build time are all you
4497+ get. */
4498+ if (*ni == NULL)
4499+ {
4500+ unlock_nsswitch;
4501+ return -1;
4502+ }
4503+#endif
4504
4505- __libc_lock_unlock (lock);
4506+ unlock_nsswitch;
4507
4508 return *ni != NULL ? 0 : -1;
4509 }
4510@@ -252,6 +292,7 @@
4511 libc_hidden_def (__nss_next2)
4512
4513
4514+#if __OPTION_EGLIBC_NSSWITCH
4515 int
4516 attribute_compat_text_section
4517 __nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
4518@@ -300,13 +341,13 @@
4519 }
4520
4521 /* Prevent multiple threads to change the service table. */
4522- __libc_lock_lock (lock);
4523+ lock_nsswitch;
4524
4525 /* Install new rules. */
4526 *databases[cnt].dbp = new_db;
4527 __nss_database_custom[cnt] = true;
4528
4529- __libc_lock_unlock (lock);
4530+ unlock_nsswitch;
4531
4532 return 0;
4533 }
4534@@ -402,7 +443,7 @@
4535 void **found, *result;
4536
4537 /* We now modify global data. Protect it. */
4538- __libc_lock_lock (lock);
4539+ lock_nsswitch;
4540
4541 /* Search the tree of functions previously requested. Data in the
4542 tree are `known_function' structures, whose first member is a
4543@@ -413,7 +454,7 @@
4544 enough to a pointer to our structure to use as a lookup key that
4545 will be passed to `known_compare' (above). */
4546
4547- found = __tsearch (&fct_name, &ni->known, &known_compare);
4548+ found = __tsearch (&fct_name, &ni->known.tree, &known_compare);
4549 if (found == NULL)
4550 /* This means out-of-memory. */
4551 result = NULL;
4552@@ -440,7 +481,7 @@
4553 #endif
4554 /* Oops. We can't instantiate this node properly.
4555 Remove it from the tree. */
4556- __tdelete (&fct_name, &ni->known, &known_compare);
4557+ __tdelete (&fct_name, &ni->known.tree, &known_compare);
4558 free (known);
4559 result = NULL;
4560 }
4561@@ -520,13 +561,43 @@
4562 }
4563
4564 /* Remove the lock. */
4565- __libc_lock_unlock (lock);
4566+ unlock_nsswitch;
4567
4568 return result;
4569 }
4570 libc_hidden_def (__nss_lookup_function)
4571
4572
4573+#else /* below if ! __OPTION_EGLIBC_NSSWITCH */
4574+
4575+
4576+int
4577+__nss_configure_lookup (const char *dbname, const char *service_line)
4578+{
4579+ /* We can't dynamically configure lookup without
4580+ OPTION_EGLIBC_NSSWITCH. */
4581+ __set_errno (EINVAL);
4582+ return -1;
4583+}
4584+
4585+
4586+void *
4587+__nss_lookup_function (service_user *ni, const char *fct_name)
4588+{
4589+ int i;
4590+ const known_function **known = ni->known.array;
4591+
4592+ for (i = 0; known[i]; i++)
4593+ if (strcmp (fct_name, known[i]->fct_name) == 0)
4594+ return known[i]->fct_ptr;
4595+
4596+ return NULL;
4597+}
4598+libc_hidden_def (__nss_lookup_function)
4599+#endif
4600+
4601+
4602+#if __OPTION_EGLIBC_NSSWITCH
4603 static name_database *
4604 internal_function
4605 nss_parse_file (const char *fname)
4606@@ -632,8 +703,10 @@
4607 + (line - name + 1));
4608 if (new_service == NULL)
4609 return result;
4610+ new_service->name = (char *) (new_service + 1);
4611
4612- *((char *) __mempcpy (new_service->name, name, line - name)) = '\0';
4613+ *((char *) __mempcpy ((char *) new_service->name, name, line - name))
4614+ = '\0';
4615
4616 /* Set default actions. */
4617 new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
4618@@ -642,7 +715,7 @@
4619 new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
4620 new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
4621 new_service->library = NULL;
4622- new_service->known = NULL;
4623+ new_service->known.tree = NULL;
4624 new_service->next = NULL;
4625
4626 while (isspace (line[0]))
4627@@ -778,9 +851,10 @@
4628 result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
4629 if (result == NULL)
4630 return NULL;
4631+ result->name = (char *) (result + 1);
4632
4633 /* Save the database name. */
4634- memcpy (result->name, name, len);
4635+ memcpy ((char *) result->name, name, len);
4636
4637 /* Parse the list of services. */
4638 result->service = nss_parse_service_list (line);
4639@@ -816,6 +890,7 @@
4640 return *currentp;
4641 }
4642 #endif
4643+#endif /* __OPTION_EGLIBC_NSSWITCH */
4644
4645
4646 #if defined SHARED && defined USE_NSCD
4647@@ -834,6 +909,7 @@
4648 }
4649
4650
4651+#if __OPTION_EGLIBC_INET
4652 /* Called by nscd and nscd alone. */
4653 void
4654 __nss_disable_nscd (void (*cb) (size_t, struct traced_file *))
4655@@ -857,8 +933,10 @@
4656 __nss_not_use_nscd_services = -1;
4657 __nss_not_use_nscd_netgroup = -1;
4658 }
4659+#endif /* __OPTION_EGLIBC_INET */
4660 #endif
4661
4662+#if __OPTION_EGLIBC_NSSWITCH
4663 static void
4664 free_database_entries (name_database_entry *entry)
4665 {
4666@@ -871,8 +949,8 @@
4667 {
4668 service_user *olds = service;
4669
4670- if (service->known != NULL)
4671- __tdestroy (service->known, free);
4672+ if (service->known.tree != NULL)
4673+ __tdestroy (service->known.tree, free);
4674
4675 service = service->next;
4676 free (olds);
4677@@ -926,3 +1004,4 @@
4678
4679 free (top);
4680 }
4681+#endif /* __OPTION_EGLIBC_NSSWITCH */
4682Index: git/nss/nsswitch.h
4683===================================================================
4684--- git.orig/nss/nsswitch.h 2014-08-29 20:00:53.012070587 -0700
4685+++ git/nss/nsswitch.h 2014-08-29 20:01:15.220070587 -0700
4686@@ -65,10 +65,20 @@
4687 lookup_actions actions[5];
4688 /* Link to the underlying library object. */
4689 service_library *library;
4690- /* Collection of known functions. */
4691- void *known;
4692+ /* Collection of known functions.
4693+
4694+ With OPTION_EGLIBC_NSSWITCH enabled, this is the root of a
4695+ 'tsearch'-style tree.
4696+
4697+ With OPTION_EGLIBC_NSSWITCH disabled, this is an array of
4698+ pointers to known_function structures, NULL-terminated. */
4699+ union
4700+ {
4701+ void *tree;
4702+ const known_function **array;
4703+ } known;
4704 /* Name of the service (`files', `dns', `nis', ...). */
4705- char name[0];
4706+ const char *name;
4707 } service_user;
4708
4709 /* To access the action based on the status value use this macro. */
4710@@ -82,7 +92,7 @@
4711 /* List of service to be used. */
4712 service_user *service;
4713 /* Name of the database. */
4714- char name[0];
4715+ const char *name;
4716 } name_database_entry;
4717
4718
4719Index: git/posix/bug-regex1.c
4720===================================================================
4721--- git.orig/posix/bug-regex1.c 2014-08-29 20:00:53.184070587 -0700
4722+++ git/posix/bug-regex1.c 2014-08-29 20:01:15.220070587 -0700
4723@@ -4,6 +4,7 @@
4724 #include <string.h>
4725 #include <regex.h>
4726 #include <wchar.h>
4727+#include <gnu/option-groups.h>
4728
4729 int
4730 main (void)
4731@@ -17,7 +18,9 @@
4732 memset (&regex, '\0', sizeof (regex));
4733
4734 setlocale (LC_ALL, "de_DE.ISO-8859-1");
4735+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
4736 fwide (stdout, -1);
4737+#endif
4738
4739 re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
4740
4741Index: git/posix/bug-regex6.c
4742===================================================================
4743--- git.orig/posix/bug-regex6.c 2014-08-29 20:00:53.204070587 -0700
4744+++ git/posix/bug-regex6.c 2014-08-29 20:01:15.220070587 -0700
4745@@ -22,6 +22,7 @@
4746 #include <string.h>
4747 #include <sys/types.h>
4748 #include <regex.h>
4749+#include <gnu/option-groups.h>
4750
4751
4752 int
4753@@ -30,7 +31,12 @@
4754 regex_t re;
4755 regmatch_t mat[10];
4756 int i, j, ret = 0;
4757- const char *locales[] = { "C", "de_DE.UTF-8" };
4758+ const char *locales[] = {
4759+ "C",
4760+#if __OPTION_EGLIBC_LOCALE_CODE
4761+ "de_DE.UTF-8"
4762+#endif
4763+ };
4764 const char *string = "http://www.regex.com/pattern/matching.html#intro";
4765 regmatch_t expect[10] = {
4766 { 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
4767Index: git/posix/fnmatch.c
4768===================================================================
4769--- git.orig/posix/fnmatch.c 2014-08-29 20:00:53.208070587 -0700
4770+++ git/posix/fnmatch.c 2014-08-29 20:01:15.220070587 -0700
4771@@ -30,6 +30,10 @@
4772 #include <ctype.h>
4773 #include <string.h>
4774
4775+#if defined _LIBC
4776+# include <gnu/option-groups.h>
4777+#endif
4778+
4779 #if defined STDC_HEADERS || defined _LIBC
4780 # include <stdlib.h>
4781 #endif
4782@@ -131,7 +135,7 @@
4783 # define ISWCTYPE(WC, WT) iswctype (WC, WT)
4784 # endif
4785
4786-# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
4787+# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || (_LIBC && __OPTION_EGLIBC_LOCALE_CODE)
4788 /* In this case we are implementing the multibyte character handling. */
4789 # define HANDLE_MULTIBYTE 1
4790 # endif
4791Index: git/posix/fnmatch_loop.c
4792===================================================================
4793--- git.orig/posix/fnmatch_loop.c 2014-08-29 20:00:53.220070587 -0700
4794+++ git/posix/fnmatch_loop.c 2014-08-29 20:01:15.220070587 -0700
4795@@ -15,6 +15,8 @@
4796 License along with the GNU C Library; if not, see
4797 <http://www.gnu.org/licenses/>. */
4798
4799+#include <gnu/option-groups.h>
4800+
4801 #include <stdint.h>
4802
4803 struct STRUCT
4804@@ -54,10 +56,15 @@
4805 const char *collseq = (const char *)
4806 _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
4807 # else
4808+# if __OPTION_EGLIBC_LOCALE_CODE
4809 const UCHAR *collseq = (const UCHAR *)
4810 _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
4811-# endif
4812-#endif
4813+# define COLLSEQ_BYTE_LOOKUP(ix) (collseq[(ix)])
4814+# else
4815+# define COLLSEQ_BYTE_LOOKUP(ix) (ix)
4816+# endif /* __OPTION_EGLIBC_LOCALE_CODE */
4817+# endif /* WIDE_CHAR_VERSION */
4818+#endif /* _LIBC */
4819
4820 while ((c = *p++) != L('\0'))
4821 {
4822@@ -277,7 +284,7 @@
4823 /* Leave room for the null. */
4824 CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
4825 size_t c1 = 0;
4826-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4827+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4828 wctype_t wt;
4829 #endif
4830 const CHAR *startp = p;
4831@@ -307,7 +314,7 @@
4832 }
4833 str[c1] = L('\0');
4834
4835-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4836+#if defined _LIBC ? __OPTION_POSIX_C_LANG_WIDE_CHAR : (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
4837 wt = IS_CHAR_CLASS (str);
4838 if (wt == 0)
4839 /* Invalid character class name. */
4840@@ -681,8 +688,10 @@
4841 else
4842 lcollseq = __collseq_table_lookup (collseq, cold);
4843 # else
4844- fcollseq = collseq[fn];
4845- lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
4846+ fcollseq = COLLSEQ_BYTE_LOOKUP (fn);
4847+ lcollseq = (is_seqval
4848+ ? cold
4849+ : COLLSEQ_BYTE_LOOKUP ((UCHAR) cold));
4850 # endif
4851
4852 is_seqval = 0;
4853@@ -858,7 +867,7 @@
4854 goto matched;
4855 }
4856 # else
4857- hcollseq = collseq[cend];
4858+ hcollseq = COLLSEQ_BYTE_LOOKUP (cend);
4859 # endif
4860 }
4861
4862Index: git/posix/glob.c
4863===================================================================
4864--- git.orig/posix/glob.c 2014-08-29 20:00:53.232070587 -0700
4865+++ git/posix/glob.c 2014-08-29 20:01:15.220070587 -0700
4866@@ -25,6 +25,9 @@
4867 #include <sys/types.h>
4868 #include <sys/stat.h>
4869 #include <stddef.h>
4870+#ifdef _LIBC
4871+# include <gnu/option-groups.h>
4872+#endif
4873
4874 /* Outcomment the following line for production quality code. */
4875 /* #define NDEBUG 1 */
4876@@ -607,6 +610,7 @@
4877 if (home_dir == NULL || home_dir[0] == '\0')
4878 home_dir = "c:/users/default"; /* poor default */
4879 # else
4880+# if ! _LIBC || __OPTION_EGLIBC_GETLOGIN
4881 if (home_dir == NULL || home_dir[0] == '\0')
4882 {
4883 int success;
4884@@ -623,19 +627,19 @@
4885 if (success)
4886 {
4887 struct passwd *p;
4888-# if defined HAVE_GETPWNAM_R || defined _LIBC
4889+# if defined HAVE_GETPWNAM_R || defined _LIBC
4890 long int pwbuflen = GETPW_R_SIZE_MAX ();
4891 char *pwtmpbuf;
4892 struct passwd pwbuf;
4893 int malloc_pwtmpbuf = 0;
4894 int save = errno;
4895
4896-# ifndef _LIBC
4897+# ifndef _LIBC
4898 if (pwbuflen == -1)
4899 /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
4900 Try a moderate value. */
4901 pwbuflen = 1024;
4902-# endif
4903+# endif
4904 if (__libc_use_alloca (alloca_used + pwbuflen))
4905 pwtmpbuf = alloca_account (pwbuflen, alloca_used);
4906 else
4907@@ -682,9 +686,9 @@
4908 }
4909 __set_errno (save);
4910 }
4911-# else
4912+# else
4913 p = getpwnam (name);
4914-# endif
4915+# endif
4916 if (p != NULL)
4917 {
4918 if (!malloc_pwtmpbuf)
4919@@ -713,6 +717,7 @@
4920 }
4921 }
4922 }
4923+# endif /* ! _LIBC || __OPTION_EGLIBC_GETLOGIN */
4924 if (home_dir == NULL || home_dir[0] == '\0')
4925 {
4926 if (flags & GLOB_TILDE_CHECK)
4927Index: git/posix/Makefile
4928===================================================================
4929--- git.orig/posix/Makefile 2014-08-29 20:00:53.160070587 -0700
4930+++ git/posix/Makefile 2014-08-29 20:01:15.220070587 -0700
4931@@ -18,6 +18,8 @@
4932 #
4933 # Sub-makefile for POSIX portion of the library.
4934 #
4935+include ../option-groups.mak
4936+
4937 subdir := posix
4938
4939 include ../Makeconfig
4940@@ -43,13 +45,24 @@
4941 getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
4942 getresuid getresgid setresuid setresgid \
4943 pathconf sysconf fpathconf \
4944- glob glob64 fnmatch regex \
4945+ glob glob64 fnmatch \
4946 confstr \
4947 getopt getopt1 getopt_init \
4948 sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
4949 sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
4950- getaddrinfo gai_strerror wordexp \
4951 pread pwrite pread64 pwrite64 \
4952+ posix_madvise \
4953+ get_child_max sched_cpucount sched_cpualloc sched_cpufree
4954+
4955+routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
4956+
4957+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
4958+routines-$(OPTION_POSIX_REGEXP) += regex
4959+else
4960+routines-$(OPTION_POSIX_REGEXP) += xregex
4961+endif
4962+
4963+routines-$(OPTION_EGLIBC_SPAWN) += \
4964 spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
4965 spawn_faction_addopen spawn_faction_adddup2 \
4966 spawnattr_init spawnattr_destroy \
4967@@ -57,41 +70,53 @@
4968 spawnattr_getflags spawnattr_setflags \
4969 spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni \
4970 spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
4971- spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
4972- posix_madvise \
4973- get_child_max sched_cpucount sched_cpualloc sched_cpufree
4974+ spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam
4975+routines-$(OPTION_EGLIBC_WORDEXP) += wordexp
4976
4977 aux := init-posix environ
4978-tests := tstgetopt testfnm runtests runptests \
4979+tests := tstgetopt testfnm runtests \
4980 tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
4981- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
4982- tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
4983- tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
4984- tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
4985- bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
4986- bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
4987- bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
4988- bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
4989- bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
4990- bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
4991- bug-regex33 tst-nice tst-nanosleep tst-regex2 \
4992- transbug tst-rxspencer tst-pcre tst-boost \
4993- bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
4994- tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
4995+ tst-getlogin tst-mmap tst-truncate \
4996+ tst-truncate64 tst-fork tst-dir \
4997+ tst-chmod bug-regex2 bug-regex3 bug-regex4 \
4998+ tst-gnuglob bug-regex6 bug-regex7 \
4999+ bug-regex8 bug-regex9 bug-regex10 bug-regex12 \
5000+ bug-regex14 bug-regex15 \
5001+ bug-regex21 bug-regex24 \
5002+ bug-regex27 bug-regex28 bug-regex29 bug-regex30 \
5003+ bug-regex31 \
5004+ tst-nice tst-nanosleep \
5005+ transbug \
5006+ tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
5007+ bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
5008 tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
5009 tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
5010 tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
5011- tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
5012- tst-rfc3484-3 \
5013- tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
5014+ tst-execvp3 tst-execvp4 \
5015+ tst-fnmatch2 tst-cpucount tst-cpuset \
5016 bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
5017 bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
5018 tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \
5019 tst-fnmatch3 bug-regex36
5020-xtests := bug-ga2
5021+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
5022+ += tst-fnmatch tst-regexloc bug-regex1 bug-regex5 \
5023+ bug-regex23 bug-regex25 bug-regex32 bug-regex33
5024+tests-$(OPTION_EGLIBC_INET) \
5025+ += tst-getaddrinfo bug-ga1 tst-getaddrinfo2 \
5026+ tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 tst-getaddrinfo3
5027+tests-$(OPTION_POSIX_REGEXP_GLIBC) \
5028+ += runptests bug-regex11 bug-regex13 bug-regex16 \
5029+ tst-regex2 tst-rxspencer tst-pcre tst-boost
5030+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP_GLIBC))
5031+tests += tst-regex bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
5032+ bug-regex22 bug-regex26
5033+endif
5034+xtests-$(OPTION_EGLIBC_INET) += bug-ga2
5035 ifeq (yes,$(build-shared))
5036 test-srcs := globtest
5037-tests += wordexp-test tst-exec tst-spawn
5038+tests += tst-exec
5039+tests-$(OPTION_EGLIBC_SPAWN) += tst-spawn
5040+tests-$(OPTION_EGLIBC_WORDEXP) += wordexp-test
5041 endif
5042 tests-static = tst-exec-static tst-spawn-static
5043 tests += $(tests-static)
5044@@ -117,7 +142,10 @@
5045
5046 ifeq ($(run-built-tests),yes)
5047 ifeq (yes,$(build-shared))
5048-tests-special += $(objpfx)globtest.out $(objpfx)wordexp-tst.out
5049+tests-special += $(objpfx)globtest.out
5050+ifeq (y,$(OPTION_EGLIBC_WORDEXP))
5051+tests-special += $(objpfx)wordexp-tst.out
5052+endif
5053 endif
5054 endif
5055
5056@@ -125,12 +153,16 @@
5057 # XXX Please note that for now we ignore the result of this test.
5058 tests-special += $(objpfx)annexc.out
5059 ifeq ($(run-built-tests),yes)
5060-tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
5061+tests-special += $(objpfx)bug-regex2-mem.out \
5062 $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
5063- $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
5064- $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
5065+ $(objpfx)tst-getconf.out \
5066 $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
5067 $(objpfx)tst-fnmatch-mem.out $(objpfx)bug-regex36-mem.out
5068+ifeq (y,$(OPTION_POSIX_REGEXP_GLIBC))
5069+tests-special += $(objpfx)bug-regex14-mem $(objpfx)tst-rxspencer-no-utf8-mem \
5070+ $(objpfx)tst-pcre-mem $(objpfx)tst-boost-mem
5071+endif
5072+
5073 xtests-special += $(objpfx)bug-ga2-mem.out
5074 endif
5075
5076@@ -143,6 +175,8 @@
5077 $(SHELL) $< $(common-objpfx) '$(test-via-rtld-prefix)' \
5078 '$(test-program-prefix)' '$(test-wrapper-env)'; \
5079 $(evaluate-test)
5080+LDLIBS-globtest += $(shell cat $(common-objpfx)nss/fixed-nsswitch-libs)
5081+
5082 $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test
5083 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
5084 '$(run-program-env)' '$(test-program-prefix-after-env)'; \
5085@@ -205,7 +239,10 @@
5086 tst-chmod-ARGS = $(objdir)
5087 tst-vfork3-ARGS = --test-dir=$(objpfx)
5088
5089-tst-rxspencer-ARGS = --utf8 rxspencer/tests
5090+tst-rxspencer-ARGS = rxspencer/tests
5091+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
5092+tst-rxspencer-ARGS += --utf8
5093+endif
5094 tst-rxspencer-no-utf8-ARGS = rxspencer/tests
5095 tst-pcre-ARGS = PCRE.tests
5096 tst-boost-ARGS = BOOST.tests
5097Index: git/posix/regcomp.c
5098===================================================================
5099--- git.orig/posix/regcomp.c 2014-08-29 20:00:53.264070587 -0700
5100+++ git/posix/regcomp.c 2014-08-29 20:01:15.224070587 -0700
5101@@ -18,6 +18,7 @@
5102 <http://www.gnu.org/licenses/>. */
5103
5104 #include <stdint.h>
5105+#include <gnu/option-groups.h>
5106
5107 static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
5108 size_t length, reg_syntax_t syntax);
5109@@ -305,7 +306,7 @@
5110 {
5111 re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
5112 int node_cnt;
5113- int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
5114+ int icase = (dfa_mb_cur_max (dfa) == 1 && (bufp->syntax & RE_ICASE));
5115 for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
5116 {
5117 int node = init_state->nodes.elems[node_cnt];
5118@@ -315,9 +316,9 @@
5119 {
5120 re_set_fastmap (fastmap, icase, dfa->nodes[node].opr.c);
5121 #ifdef RE_ENABLE_I18N
5122- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
5123+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
5124 {
5125- unsigned char *buf = alloca (dfa->mb_cur_max), *p;
5126+ unsigned char *buf = alloca (dfa_mb_cur_max (dfa)), *p;
5127 wchar_t wc;
5128 mbstate_t state;
5129
5130@@ -348,7 +349,11 @@
5131 re_set_fastmap (fastmap, icase, ch);
5132 }
5133 }
5134-#ifdef RE_ENABLE_I18N
5135+
5136+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, the current
5137+ locale is always C, which has no rules and no multi-byte
5138+ characters. */
5139+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5140 else if (type == COMPLEX_BRACKET)
5141 {
5142 re_charset_t *cset = dfa->nodes[node].opr.mbcset;
5143@@ -376,7 +381,7 @@
5144 i.e. where we would not find an invalid sequence. This only
5145 applies to multibyte character sets; for single byte character
5146 sets, the SIMPLE_BRACKET again suffices. */
5147- if (dfa->mb_cur_max > 1
5148+ if (dfa_mb_cur_max (dfa) > 1
5149 && (cset->nchar_classes || cset->non_match || cset->nranges
5150 # ifdef _LIBC
5151 || cset->nequiv_classes
5152@@ -404,7 +409,7 @@
5153 memset (&state, '\0', sizeof (state));
5154 if (__wcrtomb (buf, cset->mbchars[i], &state) != (size_t) -1)
5155 re_set_fastmap (fastmap, icase, *(unsigned char *) buf);
5156- if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
5157+ if ((bufp->syntax & RE_ICASE) && dfa_mb_cur_max (dfa) > 1)
5158 {
5159 if (__wcrtomb (buf, towlower (cset->mbchars[i]), &state)
5160 != (size_t) -1)
5161@@ -413,7 +418,7 @@
5162 }
5163 }
5164 }
5165-#endif /* RE_ENABLE_I18N */
5166+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5167 else if (type == OP_PERIOD
5168 #ifdef RE_ENABLE_I18N
5169 || type == OP_UTF8_PERIOD
5170@@ -856,11 +861,15 @@
5171
5172 dfa->mb_cur_max = MB_CUR_MAX;
5173 #ifdef _LIBC
5174- if (dfa->mb_cur_max == 6
5175+ if (dfa_mb_cur_max (dfa) == 6
5176 && strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
5177 dfa->is_utf8 = 1;
5178+# if __OPTION_EGLIBC_LOCALE_CODE
5179 dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
5180 != 0);
5181+# else
5182+ dfa->map_notascii = 0;
5183+# endif
5184 #else
5185 # ifdef HAVE_LANGINFO_CODESET
5186 codeset_name = nl_langinfo (CODESET);
5187@@ -886,7 +895,7 @@
5188 #endif
5189
5190 #ifdef RE_ENABLE_I18N
5191- if (dfa->mb_cur_max > 1)
5192+ if (dfa_mb_cur_max (dfa) > 1)
5193 {
5194 if (dfa->is_utf8)
5195 dfa->sb_char = (re_bitset_ptr_t) utf8_sb_map;
5196@@ -1784,7 +1793,7 @@
5197 token->word_char = 0;
5198 #ifdef RE_ENABLE_I18N
5199 token->mb_partial = 0;
5200- if (input->mb_cur_max > 1 &&
5201+ if (string_mb_cur_max (input) > 1 &&
5202 !re_string_first_byte (input, re_string_cur_idx (input)))
5203 {
5204 token->type = CHARACTER;
5205@@ -1805,7 +1814,7 @@
5206 token->opr.c = c2;
5207 token->type = CHARACTER;
5208 #ifdef RE_ENABLE_I18N
5209- if (input->mb_cur_max > 1)
5210+ if (string_mb_cur_max (input) > 1)
5211 {
5212 wint_t wc = re_string_wchar_at (input,
5213 re_string_cur_idx (input) + 1);
5214@@ -1919,7 +1928,7 @@
5215
5216 token->type = CHARACTER;
5217 #ifdef RE_ENABLE_I18N
5218- if (input->mb_cur_max > 1)
5219+ if (string_mb_cur_max (input) > 1)
5220 {
5221 wint_t wc = re_string_wchar_at (input, re_string_cur_idx (input));
5222 token->word_char = IS_WIDE_WORD_CHAR (wc) != 0;
5223@@ -2019,7 +2028,7 @@
5224 token->opr.c = c;
5225
5226 #ifdef RE_ENABLE_I18N
5227- if (input->mb_cur_max > 1 &&
5228+ if (string_mb_cur_max (input) > 1 &&
5229 !re_string_first_byte (input, re_string_cur_idx (input)))
5230 {
5231 token->type = CHARACTER;
5232@@ -2242,7 +2251,7 @@
5233 return NULL;
5234 }
5235 #ifdef RE_ENABLE_I18N
5236- if (dfa->mb_cur_max > 1)
5237+ if (dfa_mb_cur_max (dfa) > 1)
5238 {
5239 while (!re_string_eoi (regexp)
5240 && !re_string_first_byte (regexp, re_string_cur_idx (regexp)))
5241@@ -2380,7 +2389,7 @@
5242 *err = REG_ESPACE;
5243 return NULL;
5244 }
5245- if (dfa->mb_cur_max > 1)
5246+ if (dfa_mb_cur_max (dfa) > 1)
5247 dfa->has_mb_node = 1;
5248 break;
5249 case OP_WORD:
5250@@ -2686,7 +2695,7 @@
5251 However, for !_LIBC we have no collation elements: if the
5252 character set is single byte, the single byte character set
5253 that we build below suffices. parse_bracket_exp passes
5254- no MBCSET if dfa->mb_cur_max == 1. */
5255+ no MBCSET if dfa_mb_cur_max (dfa) == 1. */
5256 if (mbcset)
5257 {
5258 /* Check the space of the arrays. */
5259@@ -2782,7 +2791,13 @@
5260 reg_syntax_t syntax, reg_errcode_t *err)
5261 {
5262 #ifdef _LIBC
5263+#if __OPTION_EGLIBC_LOCALE_CODE
5264 const unsigned char *collseqmb;
5265+# define COLLSEQMB_LOOKUP(ix) (collseqmb[(ix)])
5266+#else
5267+# define COLLSEQMB_LOOKUP(ix) (ix)
5268+#endif
5269+
5270 const char *collseqwc;
5271 uint32_t nrules;
5272 int32_t table_size;
5273@@ -2830,18 +2845,20 @@
5274 if (MB_CUR_MAX == 1)
5275 */
5276 if (nrules == 0)
5277- return collseqmb[br_elem->opr.ch];
5278+ return COLLSEQMB_LOOKUP (br_elem->opr.ch);
5279 else
5280 {
5281 wint_t wc = __btowc (br_elem->opr.ch);
5282 return __collseq_table_lookup (collseqwc, wc);
5283 }
5284 }
5285+#if __OPTION_EGLIBC_LOCALE_CODE
5286 else if (br_elem->type == MB_CHAR)
5287 {
5288 if (nrules != 0)
5289 return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
5290 }
5291+#endif
5292 else if (br_elem->type == COLL_SYM)
5293 {
5294 size_t sym_name_len = strlen ((char *) br_elem->opr.name);
5295@@ -2872,11 +2889,11 @@
5296 {
5297 /* No valid character. Match it as a single byte
5298 character. */
5299- return collseqmb[br_elem->opr.name[0]];
5300+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
5301 }
5302 }
5303 else if (sym_name_len == 1)
5304- return collseqmb[br_elem->opr.name[0]];
5305+ return COLLSEQMB_LOOKUP (br_elem->opr.name[0]);
5306 }
5307 return UINT_MAX;
5308 }
5309@@ -2916,7 +2933,7 @@
5310 However, if we have no collation elements, and the character set
5311 is single byte, the single byte character set that we
5312 build below suffices. */
5313- if (nrules > 0 || dfa->mb_cur_max > 1)
5314+ if (nrules > 0 || dfa_mb_cur_max (dfa) > 1)
5315 {
5316 /* Check the space of the arrays. */
5317 if (BE (*range_alloc == mbcset->nranges, 0))
5318@@ -2953,7 +2970,7 @@
5319 if (MB_CUR_MAX == 1)
5320 */
5321 if (nrules == 0)
5322- ch_collseq = collseqmb[ch];
5323+ ch_collseq = COLLSEQMB_LOOKUP (ch);
5324 else
5325 ch_collseq = __collseq_table_lookup (collseqwc, __btowc (ch));
5326 if (start_collseq <= ch_collseq && ch_collseq <= end_collseq)
5327@@ -3031,7 +3048,10 @@
5328 re_bitset_ptr_t sbcset;
5329 #ifdef RE_ENABLE_I18N
5330 re_charset_t *mbcset;
5331- int coll_sym_alloc = 0, range_alloc = 0, mbchar_alloc = 0;
5332+ int coll_sym_alloc = 0, range_alloc = 0;
5333+#if __OPTION_EGLIBC_LOCALE_CODE
5334+ int mbchar_alloc = 0;
5335+#endif
5336 int equiv_class_alloc = 0, char_class_alloc = 0;
5337 #endif /* not RE_ENABLE_I18N */
5338 int non_match = 0;
5339@@ -3039,9 +3059,15 @@
5340 int token_len;
5341 int first_round = 1;
5342 #ifdef _LIBC
5343+#if __OPTION_EGLIBC_LOCALE_CODE
5344 collseqmb = (const unsigned char *)
5345 _NL_CURRENT (LC_COLLATE, _NL_COLLATE_COLLSEQMB);
5346 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5347+#else
5348+ /* This is true when OPTION_EGLIBC_LOCALE_CODE is disabled, but the
5349+ compiler can't figure that out. */
5350+ nrules = 0;
5351+#endif
5352 if (nrules)
5353 {
5354 /*
5355@@ -3169,7 +3195,7 @@
5356 #else
5357 # ifdef RE_ENABLE_I18N
5358 *err = build_range_exp (sbcset,
5359- dfa->mb_cur_max > 1 ? mbcset : NULL,
5360+ dfa_mb_cur_max (dfa) > 1 ? mbcset : NULL,
5361 &range_alloc, &start_elem, &end_elem);
5362 # else
5363 *err = build_range_exp (sbcset, &start_elem, &end_elem);
5364@@ -3185,7 +3211,7 @@
5365 case SB_CHAR:
5366 bitset_set (sbcset, start_elem.opr.ch);
5367 break;
5368-#ifdef RE_ENABLE_I18N
5369+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5370 case MB_CHAR:
5371 /* Check whether the array has enough space. */
5372 if (BE (mbchar_alloc == mbcset->nmbchars, 0))
5373@@ -3203,7 +3229,7 @@
5374 }
5375 mbcset->mbchars[mbcset->nmbchars++] = start_elem.opr.wch;
5376 break;
5377-#endif /* RE_ENABLE_I18N */
5378+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5379 case EQUIV_CLASS:
5380 *err = build_equiv_class (sbcset,
5381 #ifdef RE_ENABLE_I18N
5382@@ -3253,11 +3279,11 @@
5383
5384 #ifdef RE_ENABLE_I18N
5385 /* Ensure only single byte characters are set. */
5386- if (dfa->mb_cur_max > 1)
5387+ if (dfa_mb_cur_max (dfa) > 1)
5388 bitset_mask (sbcset, dfa->sb_char);
5389
5390 if (mbcset->nmbchars || mbcset->ncoll_syms || mbcset->nequiv_classes
5391- || mbcset->nranges || (dfa->mb_cur_max > 1 && (mbcset->nchar_classes
5392+ || mbcset->nranges || (dfa_mb_cur_max (dfa) > 1 && (mbcset->nchar_classes
5393 || mbcset->non_match)))
5394 {
5395 bin_tree_t *mbc_tree;
5396@@ -3326,7 +3352,7 @@
5397 re_token_t *token, int token_len, re_dfa_t *dfa,
5398 reg_syntax_t syntax, int accept_hyphen)
5399 {
5400-#ifdef RE_ENABLE_I18N
5401+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5402 int cur_char_size;
5403 cur_char_size = re_string_char_size_at (regexp, re_string_cur_idx (regexp));
5404 if (cur_char_size > 1)
5405@@ -3336,7 +3362,7 @@
5406 re_string_skip_bytes (regexp, cur_char_size);
5407 return REG_NOERROR;
5408 }
5409-#endif /* RE_ENABLE_I18N */
5410+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5411 re_string_skip_bytes (regexp, token_len); /* Skip a token. */
5412 if (token->type == OP_OPEN_COLL_ELEM || token->type == OP_OPEN_CHAR_CLASS
5413 || token->type == OP_OPEN_EQUIV_CLASS)
5414@@ -3416,7 +3442,9 @@
5415 build_equiv_class (bitset_t sbcset, const unsigned char *name)
5416 #endif /* not RE_ENABLE_I18N */
5417 {
5418-#ifdef _LIBC
5419+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C locale
5420+ is supported; it has no collation rules. */
5421+#if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5422 uint32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5423 if (nrules != 0)
5424 {
5425@@ -3488,7 +3516,7 @@
5426 mbcset->equiv_classes[mbcset->nequiv_classes++] = idx1;
5427 }
5428 else
5429-#endif /* _LIBC */
5430+#endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5431 {
5432 if (BE (strlen ((const char *) name) != 1, 0))
5433 return REG_ECOLLATE;
5434@@ -3522,7 +3550,7 @@
5435 && (strcmp (name, "upper") == 0 || strcmp (name, "lower") == 0))
5436 name = "alpha";
5437
5438-#ifdef RE_ENABLE_I18N
5439+#if defined RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE
5440 /* Check the space of the arrays. */
5441 if (BE (*char_class_alloc == mbcset->nchar_classes, 0))
5442 {
5443@@ -3538,7 +3566,7 @@
5444 *char_class_alloc = new_char_class_alloc;
5445 }
5446 mbcset->char_classes[mbcset->nchar_classes++] = __wctype (name);
5447-#endif /* RE_ENABLE_I18N */
5448+#endif /* RE_ENABLE_I18N && __OPTION_EGLIBC_LOCALE_CODE */
5449
5450 #define BUILD_CHARCLASS_LOOP(ctype_func) \
5451 do { \
5452@@ -3649,7 +3677,7 @@
5453
5454 #ifdef RE_ENABLE_I18N
5455 /* Ensure only single byte characters are set. */
5456- if (dfa->mb_cur_max > 1)
5457+ if (dfa_mb_cur_max (dfa) > 1)
5458 bitset_mask (sbcset, dfa->sb_char);
5459 #endif
5460
5461@@ -3661,7 +3689,7 @@
5462 goto build_word_op_espace;
5463
5464 #ifdef RE_ENABLE_I18N
5465- if (dfa->mb_cur_max > 1)
5466+ if (dfa_mb_cur_max (dfa) > 1)
5467 {
5468 bin_tree_t *mbc_tree;
5469 /* Build a tree for complex bracket. */
5470Index: git/posix/regexec.c
5471===================================================================
5472--- git.orig/posix/regexec.c 2014-08-29 20:00:53.268070587 -0700
5473+++ git/posix/regexec.c 2014-08-29 20:01:15.224070587 -0700
5474@@ -18,6 +18,7 @@
5475 <http://www.gnu.org/licenses/>. */
5476
5477 #include <stdint.h>
5478+#include <gnu/option-groups.h>
5479
5480 static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
5481 int n) internal_function;
5482@@ -186,11 +187,11 @@
5483 static int check_node_accept_bytes (const re_dfa_t *dfa, int node_idx,
5484 const re_string_t *input, int idx)
5485 internal_function;
5486-# ifdef _LIBC
5487+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5488 static unsigned int find_collation_sequence_value (const unsigned char *mbs,
5489 size_t name_len)
5490 internal_function;
5491-# endif /* _LIBC */
5492+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5493 #endif /* RE_ENABLE_I18N */
5494 static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
5495 const re_dfastate_t *state,
5496@@ -255,25 +256,9 @@
5497 return err != REG_NOERROR;
5498 }
5499
5500-#ifdef _LIBC
5501-# include <shlib-compat.h>
5502-versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
5503-
5504-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
5505-__typeof__ (__regexec) __compat_regexec;
5506-
5507-int
5508-attribute_compat_text_section
5509-__compat_regexec (const regex_t *__restrict preg,
5510- const char *__restrict string, size_t nmatch,
5511- regmatch_t pmatch[], int eflags)
5512-{
5513- return regexec (preg, string, nmatch, pmatch,
5514- eflags & (REG_NOTBOL | REG_NOTEOL));
5515-}
5516-compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
5517-# endif
5518-#endif
5519+/* EGLIBC: The code that used to be here was move to a separate file
5520+ so that it can be shared with xregex.c. */
5521+#include "regexec-compat.c"
5522
5523 /* Entry points for GNU code. */
5524
5525@@ -728,7 +713,7 @@
5526 incr = (range < 0) ? -1 : 1;
5527 left_lim = (range < 0) ? start + range : start;
5528 right_lim = (range < 0) ? start : start + range;
5529- sb = dfa->mb_cur_max == 1;
5530+ sb = dfa_mb_cur_max (dfa) == 1;
5531 match_kind =
5532 (fastmap
5533 ? ((sb || !(preg->syntax & RE_ICASE || t) ? 4 : 0)
5534@@ -3448,7 +3433,7 @@
5535 if (BE (dest_states_word[i] == NULL && err != REG_NOERROR, 0))
5536 goto out_free;
5537
5538- if (dest_states[i] != dest_states_word[i] && dfa->mb_cur_max > 1)
5539+ if (dest_states[i] != dest_states_word[i] && dfa_mb_cur_max (dfa) > 1)
5540 need_word_trtable = 1;
5541
5542 dest_states_nl[i] = re_acquire_state_context (&err, dfa, &follows,
5543@@ -3590,7 +3575,7 @@
5544 else if (type == OP_PERIOD)
5545 {
5546 #ifdef RE_ENABLE_I18N
5547- if (dfa->mb_cur_max > 1)
5548+ if (dfa_mb_cur_max (dfa) > 1)
5549 bitset_merge (accepts, dfa->sb_char);
5550 else
5551 #endif
5552@@ -3641,7 +3626,7 @@
5553 continue;
5554 }
5555 #ifdef RE_ENABLE_I18N
5556- if (dfa->mb_cur_max > 1)
5557+ if (dfa_mb_cur_max (dfa) > 1)
5558 for (j = 0; j < BITSET_WORDS; ++j)
5559 any_set |= (accepts[j] &= (dfa->word_char[j] | ~dfa->sb_char[j]));
5560 else
5561@@ -3660,7 +3645,7 @@
5562 continue;
5563 }
5564 #ifdef RE_ENABLE_I18N
5565- if (dfa->mb_cur_max > 1)
5566+ if (dfa_mb_cur_max (dfa) > 1)
5567 for (j = 0; j < BITSET_WORDS; ++j)
5568 any_set |= (accepts[j] &= ~(dfa->word_char[j] & dfa->sb_char[j]));
5569 else
5570@@ -3832,12 +3817,6 @@
5571 if (node->type == COMPLEX_BRACKET)
5572 {
5573 const re_charset_t *cset = node->opr.mbcset;
5574-# ifdef _LIBC
5575- const unsigned char *pin
5576- = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
5577- int j;
5578- uint32_t nrules;
5579-# endif /* _LIBC */
5580 int match_len = 0;
5581 wchar_t wc = ((cset->nranges || cset->nchar_classes || cset->nmbchars)
5582 ? re_string_wchar_at (input, str_idx) : 0);
5583@@ -3849,6 +3828,7 @@
5584 match_len = char_len;
5585 goto check_node_accept_bytes_match;
5586 }
5587+#if __OPTION_EGLIBC_LOCALE_CODE
5588 /* match with character_class? */
5589 for (i = 0; i < cset->nchar_classes; ++i)
5590 {
5591@@ -3859,8 +3839,16 @@
5592 goto check_node_accept_bytes_match;
5593 }
5594 }
5595+#endif
5596+
5597+ /* When __OPTION_EGLIBC_LOCALE_CODE is disabled, only the C
5598+ locale is supported; it has no collation rules. */
5599+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5600+ const unsigned char *pin
5601+ = ((const unsigned char *) re_string_get_buffer (input) + str_idx);
5602+ int j;
5603+ uint32_t nrules;
5604
5605-# ifdef _LIBC
5606 nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
5607 if (nrules != 0)
5608 {
5609@@ -3953,8 +3941,12 @@
5610 }
5611 }
5612 else
5613-# endif /* _LIBC */
5614+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5615 {
5616+ /* In the _LIBC version, if OPTION_EGLIBC_LOCALE_CODE is
5617+ disabled, there can be no multibyte range endpoints, and
5618+ cset->nranges is always zero. */
5619+#if __OPTION_EGLIBC_LOCALE_CODE
5620 /* match with range expression? */
5621 #if __GNUC__ >= 2
5622 wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'};
5623@@ -3973,6 +3965,7 @@
5624 goto check_node_accept_bytes_match;
5625 }
5626 }
5627+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
5628 }
5629 check_node_accept_bytes_match:
5630 if (!cset->non_match)
5631@@ -3988,7 +3981,7 @@
5632 return 0;
5633 }
5634
5635-# ifdef _LIBC
5636+# if defined _LIBC && __OPTION_EGLIBC_LOCALE_CODE
5637 static unsigned int
5638 internal_function
5639 find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
5640@@ -4046,7 +4039,7 @@
5641 return UINT_MAX;
5642 }
5643 }
5644-# endif /* _LIBC */
5645+# endif /* _LIBC && __OPTION_EGLIBC_LOCALE_CODE */
5646 #endif /* RE_ENABLE_I18N */
5647
5648 /* Check whether the node accepts the byte which is IDX-th
5649@@ -4137,7 +4130,7 @@
5650 if (pstr->icase)
5651 {
5652 #ifdef RE_ENABLE_I18N
5653- if (pstr->mb_cur_max > 1)
5654+ if (string_mb_cur_max (pstr) > 1)
5655 {
5656 ret = build_wcs_upper_buffer (pstr);
5657 if (BE (ret != REG_NOERROR, 0))
5658@@ -4150,7 +4143,7 @@
5659 else
5660 {
5661 #ifdef RE_ENABLE_I18N
5662- if (pstr->mb_cur_max > 1)
5663+ if (string_mb_cur_max (pstr) > 1)
5664 build_wcs_buffer (pstr);
5665 else
5666 #endif /* RE_ENABLE_I18N */
5667Index: git/posix/regexec-compat.c
5668===================================================================
5669--- /dev/null 1970-01-01 00:00:00.000000000 +0000
5670+++ git/posix/regexec-compat.c 2014-08-29 20:01:15.224070587 -0700
5671@@ -0,0 +1,39 @@
5672+/* Extended regular expression matching and search library.
5673+ Copyright (C) 2008 Free Software Foundation, Inc.
5674+ This file is part of the GNU C Library.
5675+ Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5676+
5677+ The GNU C Library is free software; you can redistribute it and/or
5678+ modify it under the terms of the GNU Lesser General Public
5679+ License as published by the Free Software Foundation; either
5680+ version 2.1 of the License, or (at your option) any later version.
5681+
5682+ The GNU C Library is distributed in the hope that it will be useful,
5683+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5684+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5685+ Lesser General Public License for more details.
5686+
5687+ You should have received a copy of the GNU Lesser General Public
5688+ License along with the GNU C Library; if not, write to the Free
5689+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5690+ 02111-1307 USA. */
5691+
5692+#ifdef _LIBC
5693+# include <shlib-compat.h>
5694+versioned_symbol (libc, __regexec, regexec, GLIBC_2_3_4);
5695+
5696+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
5697+__typeof__ (__regexec) __compat_regexec;
5698+
5699+int
5700+attribute_compat_text_section
5701+__compat_regexec (const regex_t *__restrict preg,
5702+ const char *__restrict string, size_t nmatch,
5703+ regmatch_t pmatch[], int eflags)
5704+{
5705+ return regexec (preg, string, nmatch, pmatch,
5706+ eflags & (REG_NOTBOL | REG_NOTEOL));
5707+}
5708+compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0);
5709+# endif
5710+#endif
5711Index: git/posix/regex.h
5712===================================================================
5713--- git.orig/posix/regex.h 2014-08-29 20:00:53.264070587 -0700
5714+++ git/posix/regex.h 2014-08-29 20:01:15.224070587 -0700
5715@@ -21,6 +21,7 @@
5716 #define _REGEX_H 1
5717
5718 #include <sys/types.h>
5719+#include <gnu/option-groups.h>
5720
5721 /* Allow the use in C++ code. */
5722 #ifdef __cplusplus
5723@@ -156,6 +157,8 @@
5724 treated as 'a\{1'. */
5725 # define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
5726
5727+/* EGLIBC: Old regex implementation does not support these. */
5728+# if __OPTION_POSIX_REGEXP_GLIBC
5729 /* If this bit is set, then ignore case when matching.
5730 If not set, then case is significant. */
5731 # define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
5732@@ -172,6 +175,7 @@
5733 /* If this bit is set, then no_sub will be set to 1 during
5734 re_compile_pattern. */
5735 # define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
5736+# endif /* __OPTION_POSIX_REGEXP_GLIBC */
5737 #endif
5738
5739 /* This global variable defines the particular regexp syntax to use (for
5740@@ -231,8 +235,13 @@
5741 (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
5742 | RE_INTERVALS | RE_NO_EMPTY_RANGES)
5743
5744+#if __OPTION_POSIX_REGEXP_GLIBC
5745 #define RE_SYNTAX_POSIX_BASIC \
5746 (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
5747+#else
5748+#define RE_SYNTAX_POSIX_BASIC \
5749+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
5750+#endif
5751
5752 /* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
5753 RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
5754@@ -298,9 +307,11 @@
5755 /* Like REG_NOTBOL, except for the end-of-line. */
5756 #define REG_NOTEOL (1 << 1)
5757
5758+#if __OPTION_POSIX_REGEXP_GLIBC
5759 /* Use PMATCH[0] to delimit the start and end of the search in the
5760 buffer. */
5761 #define REG_STARTEND (1 << 2)
5762+#endif
5763
5764
5765 /* If any error codes are removed, changed, or added, update the
5766Index: git/posix/regex_internal.c
5767===================================================================
5768--- git.orig/posix/regex_internal.c 2014-08-29 20:00:53.264070587 -0700
5769+++ git/posix/regex_internal.c 2014-08-29 20:01:15.224070587 -0700
5770@@ -43,8 +43,8 @@
5771 int init_buf_len;
5772
5773 /* Ensure at least one character fits into the buffers. */
5774- if (init_len < dfa->mb_cur_max)
5775- init_len = dfa->mb_cur_max;
5776+ if (init_len < dfa_mb_cur_max (dfa))
5777+ init_len = dfa_mb_cur_max (dfa);
5778 init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
5779 re_string_construct_common (str, len, pstr, trans, icase, dfa);
5780
5781@@ -55,7 +55,7 @@
5782 pstr->word_char = dfa->word_char;
5783 pstr->word_ops_used = dfa->word_ops_used;
5784 pstr->mbs = pstr->mbs_allocated ? pstr->mbs : (unsigned char *) str;
5785- pstr->valid_len = (pstr->mbs_allocated || dfa->mb_cur_max > 1) ? 0 : len;
5786+ pstr->valid_len = (pstr->mbs_allocated || dfa_mb_cur_max (dfa) > 1) ? 0 : len;
5787 pstr->valid_raw_len = pstr->valid_len;
5788 return REG_NOERROR;
5789 }
5790@@ -82,7 +82,7 @@
5791 if (icase)
5792 {
5793 #ifdef RE_ENABLE_I18N
5794- if (dfa->mb_cur_max > 1)
5795+ if (dfa_mb_cur_max (dfa) > 1)
5796 {
5797 while (1)
5798 {
5799@@ -91,7 +91,7 @@
5800 return ret;
5801 if (pstr->valid_raw_len >= len)
5802 break;
5803- if (pstr->bufs_len > pstr->valid_len + dfa->mb_cur_max)
5804+ if (pstr->bufs_len > pstr->valid_len + dfa_mb_cur_max (dfa))
5805 break;
5806 ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
5807 if (BE (ret != REG_NOERROR, 0))
5808@@ -105,7 +105,7 @@
5809 else
5810 {
5811 #ifdef RE_ENABLE_I18N
5812- if (dfa->mb_cur_max > 1)
5813+ if (dfa_mb_cur_max (dfa) > 1)
5814 build_wcs_buffer (pstr);
5815 else
5816 #endif /* RE_ENABLE_I18N */
5817@@ -130,7 +130,7 @@
5818 re_string_realloc_buffers (re_string_t *pstr, int new_buf_len)
5819 {
5820 #ifdef RE_ENABLE_I18N
5821- if (pstr->mb_cur_max > 1)
5822+ if (string_mb_cur_max (pstr) > 1)
5823 {
5824 wint_t *new_wcs;
5825
5826@@ -177,7 +177,7 @@
5827 pstr->trans = trans;
5828 pstr->icase = icase ? 1 : 0;
5829 pstr->mbs_allocated = (trans != NULL || icase);
5830- pstr->mb_cur_max = dfa->mb_cur_max;
5831+ pstr->mb_cur_max = dfa_mb_cur_max (dfa);
5832 pstr->is_utf8 = dfa->is_utf8;
5833 pstr->map_notascii = dfa->map_notascii;
5834 pstr->stop = pstr->len;
5835@@ -203,7 +203,7 @@
5836 {
5837 #ifdef _LIBC
5838 unsigned char buf[MB_LEN_MAX];
5839- assert (MB_LEN_MAX >= pstr->mb_cur_max);
5840+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
5841 #else
5842 unsigned char buf[64];
5843 #endif
5844@@ -226,7 +226,7 @@
5845 {
5846 int i, ch;
5847
5848- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
5849+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
5850 {
5851 ch = pstr->raw_mbs [pstr->raw_mbs_idx + byte_idx + i];
5852 buf[i] = pstr->mbs[byte_idx + i] = pstr->trans[ch];
5853@@ -275,7 +275,7 @@
5854 size_t mbclen;
5855 #ifdef _LIBC
5856 char buf[MB_LEN_MAX];
5857- assert (MB_LEN_MAX >= pstr->mb_cur_max);
5858+ assert (MB_LEN_MAX >= string_mb_cur_max (pstr));
5859 #else
5860 char buf[64];
5861 #endif
5862@@ -369,7 +369,7 @@
5863 {
5864 int i, ch;
5865
5866- for (i = 0; i < pstr->mb_cur_max && i < remain_len; ++i)
5867+ for (i = 0; i < string_mb_cur_max (pstr) && i < remain_len; ++i)
5868 {
5869 ch = pstr->raw_mbs [pstr->raw_mbs_idx + src_idx + i];
5870 buf[i] = pstr->trans[ch];
5871@@ -567,8 +567,9 @@
5872 }
5873
5874 /* This function re-construct the buffers.
5875- Concretely, convert to wide character in case of pstr->mb_cur_max > 1,
5876- convert to upper case in case of REG_ICASE, apply translation. */
5877+ Concretely, convert to wide character in case of
5878+ string_mb_cur_max (pstr) > 1, convert to upper case in case of
5879+ REG_ICASE, apply translation. */
5880
5881 static reg_errcode_t
5882 internal_function __attribute_warn_unused_result__
5883@@ -579,7 +580,7 @@
5884 {
5885 /* Reset buffer. */
5886 #ifdef RE_ENABLE_I18N
5887- if (pstr->mb_cur_max > 1)
5888+ if (string_mb_cur_max (pstr) > 1)
5889 memset (&pstr->cur_state, '\0', sizeof (mbstate_t));
5890 #endif /* RE_ENABLE_I18N */
5891 pstr->len = pstr->raw_len;
5892@@ -670,7 +671,7 @@
5893 pstr->tip_context = re_string_context_at (pstr, offset - 1,
5894 eflags);
5895 #ifdef RE_ENABLE_I18N
5896- if (pstr->mb_cur_max > 1)
5897+ if (string_mb_cur_max (pstr) > 1)
5898 memmove (pstr->wcs, pstr->wcs + offset,
5899 (pstr->valid_len - offset) * sizeof (wint_t));
5900 #endif /* RE_ENABLE_I18N */
5901@@ -699,7 +700,7 @@
5902 #endif
5903 pstr->valid_len = 0;
5904 #ifdef RE_ENABLE_I18N
5905- if (pstr->mb_cur_max > 1)
5906+ if (string_mb_cur_max (pstr) > 1)
5907 {
5908 int wcs_idx;
5909 wint_t wc = WEOF;
5910@@ -711,7 +712,7 @@
5911 /* Special case UTF-8. Multi-byte chars start with any
5912 byte other than 0x80 - 0xbf. */
5913 raw = pstr->raw_mbs + pstr->raw_mbs_idx;
5914- end = raw + (offset - pstr->mb_cur_max);
5915+ end = raw + (offset - string_mb_cur_max (pstr));
5916 if (end < pstr->raw_mbs)
5917 end = pstr->raw_mbs;
5918 p = raw + offset - 1;
5919@@ -803,7 +804,7 @@
5920
5921 /* Then build the buffers. */
5922 #ifdef RE_ENABLE_I18N
5923- if (pstr->mb_cur_max > 1)
5924+ if (string_mb_cur_max (pstr) > 1)
5925 {
5926 if (pstr->icase)
5927 {
5928@@ -841,7 +842,7 @@
5929 return re_string_peek_byte (pstr, idx);
5930
5931 #ifdef RE_ENABLE_I18N
5932- if (pstr->mb_cur_max > 1
5933+ if (string_mb_cur_max (pstr) > 1
5934 && ! re_string_is_single_byte_char (pstr, pstr->cur_idx + idx))
5935 return re_string_peek_byte (pstr, idx);
5936 #endif
5937@@ -930,7 +931,7 @@
5938 return ((eflags & REG_NOTEOL) ? CONTEXT_ENDBUF
5939 : CONTEXT_NEWLINE | CONTEXT_ENDBUF);
5940 #ifdef RE_ENABLE_I18N
5941- if (input->mb_cur_max > 1)
5942+ if (string_mb_cur_max (input) > 1)
5943 {
5944 wint_t wc;
5945 int wc_idx = idx;
5946@@ -1444,7 +1445,7 @@
5947 dfa->nodes[dfa->nodes_len].constraint = 0;
5948 #ifdef RE_ENABLE_I18N
5949 dfa->nodes[dfa->nodes_len].accept_mb =
5950- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET;
5951+ (type == OP_PERIOD && dfa_mb_cur_max (dfa) > 1) || type == COMPLEX_BRACKET;
5952 #endif
5953 dfa->nexts[dfa->nodes_len] = -1;
5954 re_node_set_init_empty (dfa->edests + dfa->nodes_len);
5955Index: git/posix/regex_internal.h
5956===================================================================
5957--- git.orig/posix/regex_internal.h 2014-08-29 20:00:53.264070587 -0700
5958+++ git/posix/regex_internal.h 2014-08-29 20:01:15.224070587 -0700
5959@@ -26,6 +26,10 @@
5960 #include <stdlib.h>
5961 #include <string.h>
5962
5963+#if defined _LIBC
5964+# include <gnu/option-groups.h>
5965+#endif
5966+
5967 #if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
5968 # include <langinfo.h>
5969 #endif
5970@@ -370,6 +374,13 @@
5971 };
5972 typedef struct re_string_t re_string_t;
5973
5974+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
5975+ help the compiler make use of that fact. */
5976+#if __OPTION_EGLIBC_LOCALE_CODE
5977+# define string_mb_cur_max(str) ((str)->mb_cur_max + 0)
5978+#else
5979+# define string_mb_cur_max(str) (1)
5980+#endif
5981
5982 struct re_dfa_t;
5983 typedef struct re_dfa_t re_dfa_t;
5984@@ -655,6 +666,14 @@
5985 __libc_lock_define (, lock)
5986 };
5987
5988+/* When OPTION_EGLIBC_LOCALE_CODE is disabled, this is always 1;
5989+ help the compiler make use of that fact. */
5990+#if __OPTION_EGLIBC_LOCALE_CODE
5991+# define dfa_mb_cur_max(dfa) ((dfa)->mb_cur_max + 0)
5992+#else
5993+# define dfa_mb_cur_max(dfa) (1)
5994+#endif
5995+
5996 #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
5997 #define re_node_set_remove(set,id) \
5998 (re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
5999@@ -715,7 +734,7 @@
6000 re_string_char_size_at (const re_string_t *pstr, int idx)
6001 {
6002 int byte_idx;
6003- if (pstr->mb_cur_max == 1)
6004+ if (string_mb_cur_max (pstr) == 1)
6005 return 1;
6006 for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
6007 if (pstr->wcs[idx + byte_idx] != WEOF)
6008@@ -727,7 +746,7 @@
6009 internal_function __attribute__ ((pure, unused))
6010 re_string_wchar_at (const re_string_t *pstr, int idx)
6011 {
6012- if (pstr->mb_cur_max == 1)
6013+ if (string_mb_cur_max (pstr) == 1)
6014 return (wint_t) pstr->mbs[idx];
6015 return (wint_t) pstr->wcs[idx];
6016 }
6017Index: git/posix/xregex.c
6018===================================================================
6019--- /dev/null 1970-01-01 00:00:00.000000000 +0000
6020+++ git/posix/xregex.c 2014-08-29 20:01:15.228070587 -0700
6021@@ -0,0 +1,8212 @@
6022+/* Extended regular expression matching and search library,
6023+ version 0.12.
6024+ (Implements POSIX draft P1003.2/D11.2, except for some of the
6025+ internationalization features.)
6026+
6027+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
6028+ 2002, 2005 Free Software Foundation, Inc.
6029+ This file is part of the GNU C Library.
6030+
6031+ The GNU C Library is free software; you can redistribute it and/or
6032+ modify it under the terms of the GNU Lesser General Public
6033+ License as published by the Free Software Foundation; either
6034+ version 2.1 of the License, or (at your option) any later version.
6035+
6036+ The GNU C Library is distributed in the hope that it will be useful,
6037+ but WITHOUT ANY WARRANTY; without even the implied warranty of
6038+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6039+ Lesser General Public License for more details.
6040+
6041+ You should have received a copy of the GNU Lesser General Public
6042+ License along with the GNU C Library; if not, write to the Free
6043+ Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
6044+ 02110-1301 USA. */
6045+
6046+/* AIX requires this to be the first thing in the file. */
6047+#if defined _AIX && !defined __GNUC__ && !defined REGEX_MALLOC
6048+ #pragma alloca
6049+#endif
6050+
6051+#undef _GNU_SOURCE
6052+#define _GNU_SOURCE
6053+
6054+#ifndef INSIDE_RECURSION
6055+# ifdef HAVE_CONFIG_H
6056+# include <config.h>
6057+# endif
6058+#endif
6059+
6060+/*#include <ansidecl.h>*/
6061+
6062+#ifndef INSIDE_RECURSION
6063+
6064+# if defined STDC_HEADERS && !defined emacs
6065+# include <stddef.h>
6066+# else
6067+/* We need this for `regex.h', and perhaps for the Emacs include files. */
6068+# include <sys/types.h>
6069+# endif
6070+
6071+# define WIDE_CHAR_SUPPORT (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
6072+
6073+/* For platform which support the ISO C amendement 1 functionality we
6074+ support user defined character classes. */
6075+# if WIDE_CHAR_SUPPORT
6076+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>. */
6077+# include <wchar.h>
6078+# include <wctype.h>
6079+# endif
6080+
6081+# ifdef _LIBC
6082+/* We have to keep the namespace clean. */
6083+# define regfree(preg) __regfree (preg)
6084+# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
6085+# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
6086+# define regerror(errcode, preg, errbuf, errbuf_size) \
6087+ __regerror(errcode, preg, errbuf, errbuf_size)
6088+# define re_set_registers(bu, re, nu, st, en) \
6089+ __re_set_registers (bu, re, nu, st, en)
6090+# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
6091+ __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
6092+# define re_match(bufp, string, size, pos, regs) \
6093+ __re_match (bufp, string, size, pos, regs)
6094+# define re_search(bufp, string, size, startpos, range, regs) \
6095+ __re_search (bufp, string, size, startpos, range, regs)
6096+# define re_compile_pattern(pattern, length, bufp) \
6097+ __re_compile_pattern (pattern, length, bufp)
6098+# define re_set_syntax(syntax) __re_set_syntax (syntax)
6099+# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
6100+ __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
6101+# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
6102+
6103+# define btowc __btowc
6104+
6105+/* We are also using some library internals. */
6106+# include <locale/localeinfo.h>
6107+# include <locale/elem-hash.h>
6108+# include <langinfo.h>
6109+# include <locale/coll-lookup.h>
6110+# endif
6111+
6112+/* This is for other GNU distributions with internationalized messages. */
6113+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
6114+# include <libintl.h>
6115+# ifdef _LIBC
6116+# undef gettext
6117+# define gettext(msgid) __dcgettext ("libc", msgid, LC_MESSAGES)
6118+# endif
6119+# else
6120+# define gettext(msgid) (msgid)
6121+# endif
6122+
6123+# ifndef gettext_noop
6124+/* This define is so xgettext can find the internationalizable
6125+ strings. */
6126+# define gettext_noop(String) String
6127+# endif
6128+
6129+/* The `emacs' switch turns on certain matching commands
6130+ that make sense only in Emacs. */
6131+# ifdef emacs
6132+
6133+# include "lisp.h"
6134+# include "buffer.h"
6135+# include "syntax.h"
6136+
6137+# else /* not emacs */
6138+
6139+/* If we are not linking with Emacs proper,
6140+ we can't use the relocating allocator
6141+ even if config.h says that we can. */
6142+# undef REL_ALLOC
6143+
6144+# if defined STDC_HEADERS || defined _LIBC
6145+# include <stdlib.h>
6146+# else
6147+char *malloc ();
6148+char *realloc ();
6149+# endif
6150+
6151+/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
6152+ If nothing else has been done, use the method below. */
6153+# ifdef INHIBIT_STRING_HEADER
6154+# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
6155+# if !defined bzero && !defined bcopy
6156+# undef INHIBIT_STRING_HEADER
6157+# endif
6158+# endif
6159+# endif
6160+
6161+/* This is the normal way of making sure we have a bcopy and a bzero.
6162+ This is used in most programs--a few other programs avoid this
6163+ by defining INHIBIT_STRING_HEADER. */
6164+# ifndef INHIBIT_STRING_HEADER
6165+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
6166+# include <string.h>
6167+# ifndef bzero
6168+# ifndef _LIBC
6169+# define bzero(s, n) (memset (s, '\0', n), (s))
6170+# else
6171+# define bzero(s, n) __bzero (s, n)
6172+# endif
6173+# endif
6174+# else
6175+# include <strings.h>
6176+# ifndef memcmp
6177+# define memcmp(s1, s2, n) bcmp (s1, s2, n)
6178+# endif
6179+# ifndef memcpy
6180+# define memcpy(d, s, n) (bcopy (s, d, n), (d))
6181+# endif
6182+# endif
6183+# endif
6184+
6185+/* Define the syntax stuff for \<, \>, etc. */
6186+
6187+/* This must be nonzero for the wordchar and notwordchar pattern
6188+ commands in re_match_2. */
6189+# ifndef Sword
6190+# define Sword 1
6191+# endif
6192+
6193+# ifdef SWITCH_ENUM_BUG
6194+# define SWITCH_ENUM_CAST(x) ((int)(x))
6195+# else
6196+# define SWITCH_ENUM_CAST(x) (x)
6197+# endif
6198+
6199+# endif /* not emacs */
6200+
6201+# if defined _LIBC || HAVE_LIMITS_H
6202+# include <limits.h>
6203+# endif
6204+
6205+# ifndef MB_LEN_MAX
6206+# define MB_LEN_MAX 1
6207+# endif
6208+
6209+/* Get the interface, including the syntax bits. */
6210+# include "regex.h"
6211+
6212+/* isalpha etc. are used for the character classes. */
6213+# include <ctype.h>
6214+
6215+/* Jim Meyering writes:
6216+
6217+ "... Some ctype macros are valid only for character codes that
6218+ isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
6219+ using /bin/cc or gcc but without giving an ansi option). So, all
6220+ ctype uses should be through macros like ISPRINT... If
6221+ STDC_HEADERS is defined, then autoconf has verified that the ctype
6222+ macros don't need to be guarded with references to isascii. ...
6223+ Defining isascii to 1 should let any compiler worth its salt
6224+ eliminate the && through constant folding."
6225+ Solaris defines some of these symbols so we must undefine them first. */
6226+
6227+# undef ISASCII
6228+# if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII)
6229+# define ISASCII(c) 1
6230+# else
6231+# define ISASCII(c) isascii(c)
6232+# endif
6233+
6234+# ifdef isblank
6235+# define ISBLANK(c) (ISASCII (c) && isblank (c))
6236+# else
6237+# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
6238+# endif
6239+# ifdef isgraph
6240+# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
6241+# else
6242+# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
6243+# endif
6244+
6245+# undef ISPRINT
6246+# define ISPRINT(c) (ISASCII (c) && isprint (c))
6247+# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
6248+# define ISALNUM(c) (ISASCII (c) && isalnum (c))
6249+# define ISALPHA(c) (ISASCII (c) && isalpha (c))
6250+# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
6251+# define ISLOWER(c) (ISASCII (c) && islower (c))
6252+# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
6253+# define ISSPACE(c) (ISASCII (c) && isspace (c))
6254+# define ISUPPER(c) (ISASCII (c) && isupper (c))
6255+# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
6256+
6257+# ifdef _tolower
6258+# define TOLOWER(c) _tolower(c)
6259+# else
6260+# define TOLOWER(c) tolower(c)
6261+# endif
6262+
6263+# ifndef NULL
6264+# define NULL (void *)0
6265+# endif
6266+
6267+/* We remove any previous definition of `SIGN_EXTEND_CHAR',
6268+ since ours (we hope) works properly with all combinations of
6269+ machines, compilers, `char' and `unsigned char' argument types.
6270+ (Per Bothner suggested the basic approach.) */
6271+# undef SIGN_EXTEND_CHAR
6272+# if __STDC__
6273+# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
6274+# else /* not __STDC__ */
6275+/* As in Harbison and Steele. */
6276+# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
6277+# endif
6278+
6279+# ifndef emacs
6280+/* How many characters in the character set. */
6281+# define CHAR_SET_SIZE 256
6282+
6283+# ifdef SYNTAX_TABLE
6284+
6285+extern char *re_syntax_table;
6286+
6287+# else /* not SYNTAX_TABLE */
6288+
6289+static char re_syntax_table[CHAR_SET_SIZE];
6290+
6291+static void init_syntax_once (void);
6292+
6293+static void
6294+init_syntax_once (void)
6295+{
6296+ register int c;
6297+ static int done = 0;
6298+
6299+ if (done)
6300+ return;
6301+ bzero (re_syntax_table, sizeof re_syntax_table);
6302+
6303+ for (c = 0; c < CHAR_SET_SIZE; ++c)
6304+ if (ISALNUM (c))
6305+ re_syntax_table[c] = Sword;
6306+
6307+ re_syntax_table['_'] = Sword;
6308+
6309+ done = 1;
6310+}
6311+
6312+# endif /* not SYNTAX_TABLE */
6313+
6314+# define SYNTAX(c) re_syntax_table[(unsigned char) (c)]
6315+
6316+# endif /* emacs */
6317+
6318+/* Integer type for pointers. */
6319+# if !defined _LIBC && !defined HAVE_UINTPTR_T
6320+typedef unsigned long int uintptr_t;
6321+# endif
6322+
6323+/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we
6324+ use `alloca' instead of `malloc'. This is because using malloc in
6325+ re_search* or re_match* could cause memory leaks when C-g is used in
6326+ Emacs; also, malloc is slower and causes storage fragmentation. On
6327+ the other hand, malloc is more portable, and easier to debug.
6328+
6329+ Because we sometimes use alloca, some routines have to be macros,
6330+ not functions -- `alloca'-allocated space disappears at the end of the
6331+ function it is called in. */
6332+
6333+# ifdef REGEX_MALLOC
6334+
6335+# define REGEX_ALLOCATE malloc
6336+# define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize)
6337+# define REGEX_FREE free
6338+
6339+# else /* not REGEX_MALLOC */
6340+
6341+/* Emacs already defines alloca, sometimes. */
6342+# ifndef alloca
6343+
6344+/* Make alloca work the best possible way. */
6345+# ifdef __GNUC__
6346+# define alloca __builtin_alloca
6347+# else /* not __GNUC__ */
6348+# if HAVE_ALLOCA_H
6349+# include <alloca.h>
6350+# endif /* HAVE_ALLOCA_H */
6351+# endif /* not __GNUC__ */
6352+
6353+# endif /* not alloca */
6354+
6355+# define REGEX_ALLOCATE alloca
6356+
6357+/* Assumes a `char *destination' variable. */
6358+# define REGEX_REALLOCATE(source, osize, nsize) \
6359+ (destination = (char *) alloca (nsize), \
6360+ memcpy (destination, source, osize))
6361+
6362+/* No need to do anything to free, after alloca. */
6363+# define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */
6364+
6365+# endif /* not REGEX_MALLOC */
6366+
6367+/* Define how to allocate the failure stack. */
6368+
6369+# if defined REL_ALLOC && defined REGEX_MALLOC
6370+
6371+# define REGEX_ALLOCATE_STACK(size) \
6372+ r_alloc (&failure_stack_ptr, (size))
6373+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
6374+ r_re_alloc (&failure_stack_ptr, (nsize))
6375+# define REGEX_FREE_STACK(ptr) \
6376+ r_alloc_free (&failure_stack_ptr)
6377+
6378+# else /* not using relocating allocator */
6379+
6380+# ifdef REGEX_MALLOC
6381+
6382+# define REGEX_ALLOCATE_STACK malloc
6383+# define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize)
6384+# define REGEX_FREE_STACK free
6385+
6386+# else /* not REGEX_MALLOC */
6387+
6388+# define REGEX_ALLOCATE_STACK alloca
6389+
6390+# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
6391+ REGEX_REALLOCATE (source, osize, nsize)
6392+/* No need to explicitly free anything. */
6393+# define REGEX_FREE_STACK(arg)
6394+
6395+# endif /* not REGEX_MALLOC */
6396+# endif /* not using relocating allocator */
6397+
6398+
6399+/* True if `size1' is non-NULL and PTR is pointing anywhere inside
6400+ `string1' or just past its end. This works if PTR is NULL, which is
6401+ a good thing. */
6402+# define FIRST_STRING_P(ptr) \
6403+ (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
6404+
6405+/* (Re)Allocate N items of type T using malloc, or fail. */
6406+# define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
6407+# define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
6408+# define RETALLOC_IF(addr, n, t) \
6409+ if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
6410+# define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
6411+
6412+# define BYTEWIDTH 8 /* In bits. */
6413+
6414+# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
6415+
6416+# undef MAX
6417+# undef MIN
6418+# define MAX(a, b) ((a) > (b) ? (a) : (b))
6419+# define MIN(a, b) ((a) < (b) ? (a) : (b))
6420+
6421+typedef char boolean;
6422+# define false 0
6423+# define true 1
6424+
6425+static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
6426+ reg_syntax_t syntax,
6427+ struct re_pattern_buffer *bufp);
6428+
6429+static int byte_re_match_2_internal (struct re_pattern_buffer *bufp,
6430+ const char *string1, int size1,
6431+ const char *string2, int size2,
6432+ int pos,
6433+ struct re_registers *regs,
6434+ int stop);
6435+static int byte_re_search_2 (struct re_pattern_buffer *bufp,
6436+ const char *string1, int size1,
6437+ const char *string2, int size2,
6438+ int startpos, int range,
6439+ struct re_registers *regs, int stop);
6440+static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp);
6441+
6442+#ifdef MBS_SUPPORT
6443+static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
6444+ reg_syntax_t syntax,
6445+ struct re_pattern_buffer *bufp);
6446+
6447+
6448+static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
6449+ const char *cstring1, int csize1,
6450+ const char *cstring2, int csize2,
6451+ int pos,
6452+ struct re_registers *regs,
6453+ int stop,
6454+ wchar_t *string1, int size1,
6455+ wchar_t *string2, int size2,
6456+ int *mbs_offset1, int *mbs_offset2);
6457+static int wcs_re_search_2 (struct re_pattern_buffer *bufp,
6458+ const char *string1, int size1,
6459+ const char *string2, int size2,
6460+ int startpos, int range,
6461+ struct re_registers *regs, int stop);
6462+static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp);
6463+#endif
6464+
6465+/* These are the command codes that appear in compiled regular
6466+ expressions. Some opcodes are followed by argument bytes. A
6467+ command code can specify any interpretation whatsoever for its
6468+ arguments. Zero bytes may appear in the compiled regular expression. */
6469+
6470+typedef enum
6471+{
6472+ no_op = 0,
6473+
6474+ /* Succeed right away--no more backtracking. */
6475+ succeed,
6476+
6477+ /* Followed by one byte giving n, then by n literal bytes. */
6478+ exactn,
6479+
6480+# ifdef MBS_SUPPORT
6481+ /* Same as exactn, but contains binary data. */
6482+ exactn_bin,
6483+# endif
6484+
6485+ /* Matches any (more or less) character. */
6486+ anychar,
6487+
6488+ /* Matches any one char belonging to specified set. First
6489+ following byte is number of bitmap bytes. Then come bytes
6490+ for a bitmap saying which chars are in. Bits in each byte
6491+ are ordered low-bit-first. A character is in the set if its
6492+ bit is 1. A character too large to have a bit in the map is
6493+ automatically not in the set. */
6494+ /* ifdef MBS_SUPPORT, following element is length of character
6495+ classes, length of collating symbols, length of equivalence
6496+ classes, length of character ranges, and length of characters.
6497+ Next, character class element, collating symbols elements,
6498+ equivalence class elements, range elements, and character
6499+ elements follow.
6500+ See regex_compile function. */
6501+ charset,
6502+
6503+ /* Same parameters as charset, but match any character that is
6504+ not one of those specified. */
6505+ charset_not,
6506+
6507+ /* Start remembering the text that is matched, for storing in a
6508+ register. Followed by one byte with the register number, in
6509+ the range 0 to one less than the pattern buffer's re_nsub
6510+ field. Then followed by one byte with the number of groups
6511+ inner to this one. (This last has to be part of the
6512+ start_memory only because we need it in the on_failure_jump
6513+ of re_match_2.) */
6514+ start_memory,
6515+
6516+ /* Stop remembering the text that is matched and store it in a
6517+ memory register. Followed by one byte with the register
6518+ number, in the range 0 to one less than `re_nsub' in the
6519+ pattern buffer, and one byte with the number of inner groups,
6520+ just like `start_memory'. (We need the number of inner
6521+ groups here because we don't have any easy way of finding the
6522+ corresponding start_memory when we're at a stop_memory.) */
6523+ stop_memory,
6524+
6525+ /* Match a duplicate of something remembered. Followed by one
6526+ byte containing the register number. */
6527+ duplicate,
6528+
6529+ /* Fail unless at beginning of line. */
6530+ begline,
6531+
6532+ /* Fail unless at end of line. */
6533+ endline,
6534+
6535+ /* Succeeds if at beginning of buffer (if emacs) or at beginning
6536+ of string to be matched (if not). */
6537+ begbuf,
6538+
6539+ /* Analogously, for end of buffer/string. */
6540+ endbuf,
6541+
6542+ /* Followed by two byte relative address to which to jump. */
6543+ jump,
6544+
6545+ /* Same as jump, but marks the end of an alternative. */
6546+ jump_past_alt,
6547+
6548+ /* Followed by two-byte relative address of place to resume at
6549+ in case of failure. */
6550+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6551+ on_failure_jump,
6552+
6553+ /* Like on_failure_jump, but pushes a placeholder instead of the
6554+ current string position when executed. */
6555+ on_failure_keep_string_jump,
6556+
6557+ /* Throw away latest failure point and then jump to following
6558+ two-byte relative address. */
6559+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6560+ pop_failure_jump,
6561+
6562+ /* Change to pop_failure_jump if know won't have to backtrack to
6563+ match; otherwise change to jump. This is used to jump
6564+ back to the beginning of a repeat. If what follows this jump
6565+ clearly won't match what the repeat does, such that we can be
6566+ sure that there is no use backtracking out of repetitions
6567+ already matched, then we change it to a pop_failure_jump.
6568+ Followed by two-byte address. */
6569+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6570+ maybe_pop_jump,
6571+
6572+ /* Jump to following two-byte address, and push a dummy failure
6573+ point. This failure point will be thrown away if an attempt
6574+ is made to use it for a failure. A `+' construct makes this
6575+ before the first repeat. Also used as an intermediary kind
6576+ of jump when compiling an alternative. */
6577+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6578+ dummy_failure_jump,
6579+
6580+ /* Push a dummy failure point and continue. Used at the end of
6581+ alternatives. */
6582+ push_dummy_failure,
6583+
6584+ /* Followed by two-byte relative address and two-byte number n.
6585+ After matching N times, jump to the address upon failure. */
6586+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6587+ succeed_n,
6588+
6589+ /* Followed by two-byte relative address, and two-byte number n.
6590+ Jump to the address N times, then fail. */
6591+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6592+ jump_n,
6593+
6594+ /* Set the following two-byte relative address to the
6595+ subsequent two-byte number. The address *includes* the two
6596+ bytes of number. */
6597+ /* ifdef MBS_SUPPORT, the size of address is 1. */
6598+ set_number_at,
6599+
6600+ wordchar, /* Matches any word-constituent character. */
6601+ notwordchar, /* Matches any char that is not a word-constituent. */
6602+
6603+ wordbeg, /* Succeeds if at word beginning. */
6604+ wordend, /* Succeeds if at word end. */
6605+
6606+ wordbound, /* Succeeds if at a word boundary. */
6607+ notwordbound /* Succeeds if not at a word boundary. */
6608+
6609+# ifdef emacs
6610+ ,before_dot, /* Succeeds if before point. */
6611+ at_dot, /* Succeeds if at point. */
6612+ after_dot, /* Succeeds if after point. */
6613+
6614+ /* Matches any character whose syntax is specified. Followed by
6615+ a byte which contains a syntax code, e.g., Sword. */
6616+ syntaxspec,
6617+
6618+ /* Matches any character whose syntax is not that specified. */
6619+ notsyntaxspec
6620+# endif /* emacs */
6621+} re_opcode_t;
6622+#endif /* not INSIDE_RECURSION */
6623+
6624+
6625+#ifdef BYTE
6626+# define CHAR_T char
6627+# define UCHAR_T unsigned char
6628+# define COMPILED_BUFFER_VAR bufp->buffer
6629+# define OFFSET_ADDRESS_SIZE 2
6630+# define PREFIX(name) byte_##name
6631+# define ARG_PREFIX(name) name
6632+# define PUT_CHAR(c) putchar (c)
6633+#else
6634+# ifdef WCHAR
6635+# define CHAR_T wchar_t
6636+# define UCHAR_T wchar_t
6637+# define COMPILED_BUFFER_VAR wc_buffer
6638+# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
6639+# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
6640+# define PREFIX(name) wcs_##name
6641+# define ARG_PREFIX(name) c##name
6642+/* Should we use wide stream?? */
6643+# define PUT_CHAR(c) printf ("%C", c);
6644+# define TRUE 1
6645+# define FALSE 0
6646+# else
6647+# ifdef MBS_SUPPORT
6648+# define WCHAR
6649+# define INSIDE_RECURSION
6650+# include "xregex.c"
6651+# undef INSIDE_RECURSION
6652+# endif
6653+# define BYTE
6654+# define INSIDE_RECURSION
6655+# include "xregex.c"
6656+# undef INSIDE_RECURSION
6657+# endif
6658+#endif
6659+
6660+#ifdef INSIDE_RECURSION
6661+/* Common operations on the compiled pattern. */
6662+
6663+/* Store NUMBER in two contiguous bytes starting at DESTINATION. */
6664+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6665+
6666+# ifdef WCHAR
6667+# define STORE_NUMBER(destination, number) \
6668+ do { \
6669+ *(destination) = (UCHAR_T)(number); \
6670+ } while (0)
6671+# else /* BYTE */
6672+# define STORE_NUMBER(destination, number) \
6673+ do { \
6674+ (destination)[0] = (number) & 0377; \
6675+ (destination)[1] = (number) >> 8; \
6676+ } while (0)
6677+# endif /* WCHAR */
6678+
6679+/* Same as STORE_NUMBER, except increment DESTINATION to
6680+ the byte after where the number is stored. Therefore, DESTINATION
6681+ must be an lvalue. */
6682+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6683+
6684+# define STORE_NUMBER_AND_INCR(destination, number) \
6685+ do { \
6686+ STORE_NUMBER (destination, number); \
6687+ (destination) += OFFSET_ADDRESS_SIZE; \
6688+ } while (0)
6689+
6690+/* Put into DESTINATION a number stored in two contiguous bytes starting
6691+ at SOURCE. */
6692+/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
6693+
6694+# ifdef WCHAR
6695+# define EXTRACT_NUMBER(destination, source) \
6696+ do { \
6697+ (destination) = *(source); \
6698+ } while (0)
6699+# else /* BYTE */
6700+# define EXTRACT_NUMBER(destination, source) \
6701+ do { \
6702+ (destination) = *(source) & 0377; \
6703+ (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \
6704+ } while (0)
6705+# endif
6706+
6707+# ifdef DEBUG
6708+static void PREFIX(extract_number) (int *dest, UCHAR_T *source);
6709+static void
6710+PREFIX(extract_number) (int *dest, UCHAR_T *source)
6711+{
6712+# ifdef WCHAR
6713+ *dest = *source;
6714+# else /* BYTE */
6715+ int temp = SIGN_EXTEND_CHAR (*(source + 1));
6716+ *dest = *source & 0377;
6717+ *dest += temp << 8;
6718+# endif
6719+}
6720+
6721+# ifndef EXTRACT_MACROS /* To debug the macros. */
6722+# undef EXTRACT_NUMBER
6723+# define EXTRACT_NUMBER(dest, src) PREFIX(extract_number) (&dest, src)
6724+# endif /* not EXTRACT_MACROS */
6725+
6726+# endif /* DEBUG */
6727+
6728+/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
6729+ SOURCE must be an lvalue. */
6730+
6731+# define EXTRACT_NUMBER_AND_INCR(destination, source) \
6732+ do { \
6733+ EXTRACT_NUMBER (destination, source); \
6734+ (source) += OFFSET_ADDRESS_SIZE; \
6735+ } while (0)
6736+
6737+# ifdef DEBUG
6738+static void PREFIX(extract_number_and_incr) (int *destination,
6739+ UCHAR_T **source);
6740+static void
6741+PREFIX(extract_number_and_incr) (int *destination, UCHAR_T **source)
6742+{
6743+ PREFIX(extract_number) (destination, *source);
6744+ *source += OFFSET_ADDRESS_SIZE;
6745+}
6746+
6747+# ifndef EXTRACT_MACROS
6748+# undef EXTRACT_NUMBER_AND_INCR
6749+# define EXTRACT_NUMBER_AND_INCR(dest, src) \
6750+ PREFIX(extract_number_and_incr) (&dest, &src)
6751+# endif /* not EXTRACT_MACROS */
6752+
6753+# endif /* DEBUG */
6754+
6755+
6756+
6757+/* If DEBUG is defined, Regex prints many voluminous messages about what
6758+ it is doing (if the variable `debug' is nonzero). If linked with the
6759+ main program in `iregex.c', you can enter patterns and strings
6760+ interactively. And if linked with the main program in `main.c' and
6761+ the other test files, you can run the already-written tests. */
6762+
6763+# ifdef DEBUG
6764+
6765+# ifndef DEFINED_ONCE
6766+
6767+/* We use standard I/O for debugging. */
6768+# include <stdio.h>
6769+
6770+/* It is useful to test things that ``must'' be true when debugging. */
6771+# include <assert.h>
6772+
6773+static int debug;
6774+
6775+# define DEBUG_STATEMENT(e) e
6776+# define DEBUG_PRINT1(x) if (debug) printf (x)
6777+# define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2)
6778+# define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3)
6779+# define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4)
6780+# endif /* not DEFINED_ONCE */
6781+
6782+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \
6783+ if (debug) PREFIX(print_partial_compiled_pattern) (s, e)
6784+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \
6785+ if (debug) PREFIX(print_double_string) (w, s1, sz1, s2, sz2)
6786+
6787+
6788+/* Print the fastmap in human-readable form. */
6789+
6790+# ifndef DEFINED_ONCE
6791+void
6792+print_fastmap (char *fastmap)
6793+{
6794+ unsigned was_a_range = 0;
6795+ unsigned i = 0;
6796+
6797+ while (i < (1 << BYTEWIDTH))
6798+ {
6799+ if (fastmap[i++])
6800+ {
6801+ was_a_range = 0;
6802+ putchar (i - 1);
6803+ while (i < (1 << BYTEWIDTH) && fastmap[i])
6804+ {
6805+ was_a_range = 1;
6806+ i++;
6807+ }
6808+ if (was_a_range)
6809+ {
6810+ printf ("-");
6811+ putchar (i - 1);
6812+ }
6813+ }
6814+ }
6815+ putchar ('\n');
6816+}
6817+# endif /* not DEFINED_ONCE */
6818+
6819+
6820+/* Print a compiled pattern string in human-readable form, starting at
6821+ the START pointer into it and ending just before the pointer END. */
6822+
6823+void
6824+PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end)
6825+{
6826+ int mcnt, mcnt2;
6827+ UCHAR_T *p1;
6828+ UCHAR_T *p = start;
6829+ UCHAR_T *pend = end;
6830+
6831+ if (start == NULL)
6832+ {
6833+ printf ("(null)\n");
6834+ return;
6835+ }
6836+
6837+ /* Loop over pattern commands. */
6838+ while (p < pend)
6839+ {
6840+# ifdef _LIBC
6841+ printf ("%td:\t", p - start);
6842+# else
6843+ printf ("%ld:\t", (long int) (p - start));
6844+# endif
6845+
6846+ switch ((re_opcode_t) *p++)
6847+ {
6848+ case no_op:
6849+ printf ("/no_op");
6850+ break;
6851+
6852+ case exactn:
6853+ mcnt = *p++;
6854+ printf ("/exactn/%d", mcnt);
6855+ do
6856+ {
6857+ putchar ('/');
6858+ PUT_CHAR (*p++);
6859+ }
6860+ while (--mcnt);
6861+ break;
6862+
6863+# ifdef MBS_SUPPORT
6864+ case exactn_bin:
6865+ mcnt = *p++;
6866+ printf ("/exactn_bin/%d", mcnt);
6867+ do
6868+ {
6869+ printf("/%lx", (long int) *p++);
6870+ }
6871+ while (--mcnt);
6872+ break;
6873+# endif /* MBS_SUPPORT */
6874+
6875+ case start_memory:
6876+ mcnt = *p++;
6877+ printf ("/start_memory/%d/%ld", mcnt, (long int) *p++);
6878+ break;
6879+
6880+ case stop_memory:
6881+ mcnt = *p++;
6882+ printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++);
6883+ break;
6884+
6885+ case duplicate:
6886+ printf ("/duplicate/%ld", (long int) *p++);
6887+ break;
6888+
6889+ case anychar:
6890+ printf ("/anychar");
6891+ break;
6892+
6893+ case charset:
6894+ case charset_not:
6895+ {
6896+# ifdef WCHAR
6897+ int i, length;
6898+ wchar_t *workp = p;
6899+ printf ("/charset [%s",
6900+ (re_opcode_t) *(workp - 1) == charset_not ? "^" : "");
6901+ p += 5;
6902+ length = *workp++; /* the length of char_classes */
6903+ for (i=0 ; i<length ; i++)
6904+ printf("[:%lx:]", (long int) *p++);
6905+ length = *workp++; /* the length of collating_symbol */
6906+ for (i=0 ; i<length ;)
6907+ {
6908+ printf("[.");
6909+ while(*p != 0)
6910+ PUT_CHAR((i++,*p++));
6911+ i++,p++;
6912+ printf(".]");
6913+ }
6914+ length = *workp++; /* the length of equivalence_class */
6915+ for (i=0 ; i<length ;)
6916+ {
6917+ printf("[=");
6918+ while(*p != 0)
6919+ PUT_CHAR((i++,*p++));
6920+ i++,p++;
6921+ printf("=]");
6922+ }
6923+ length = *workp++; /* the length of char_range */
6924+ for (i=0 ; i<length ; i++)
6925+ {
6926+ wchar_t range_start = *p++;
6927+ wchar_t range_end = *p++;
6928+ printf("%C-%C", range_start, range_end);
6929+ }
6930+ length = *workp++; /* the length of char */
6931+ for (i=0 ; i<length ; i++)
6932+ printf("%C", *p++);
6933+ putchar (']');
6934+# else
6935+ register int c, last = -100;
6936+ register int in_range = 0;
6937+
6938+ printf ("/charset [%s",
6939+ (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
6940+
6941+ assert (p + *p < pend);
6942+
6943+ for (c = 0; c < 256; c++)
6944+ if (c / 8 < *p
6945+ && (p[1 + (c/8)] & (1 << (c % 8))))
6946+ {
6947+ /* Are we starting a range? */
6948+ if (last + 1 == c && ! in_range)
6949+ {
6950+ putchar ('-');
6951+ in_range = 1;
6952+ }
6953+ /* Have we broken a range? */
6954+ else if (last + 1 != c && in_range)
6955+ {
6956+ putchar (last);
6957+ in_range = 0;
6958+ }
6959+
6960+ if (! in_range)
6961+ putchar (c);
6962+
6963+ last = c;
6964+ }
6965+
6966+ if (in_range)
6967+ putchar (last);
6968+
6969+ putchar (']');
6970+
6971+ p += 1 + *p;
6972+# endif /* WCHAR */
6973+ }
6974+ break;
6975+
6976+ case begline:
6977+ printf ("/begline");
6978+ break;
6979+
6980+ case endline:
6981+ printf ("/endline");
6982+ break;
6983+
6984+ case on_failure_jump:
6985+ PREFIX(extract_number_and_incr) (&mcnt, &p);
6986+# ifdef _LIBC
6987+ printf ("/on_failure_jump to %td", p + mcnt - start);
6988+# else
6989+ printf ("/on_failure_jump to %ld", (long int) (p + mcnt - start));
6990+# endif
6991+ break;
6992+
6993+ case on_failure_keep_string_jump:
6994+ PREFIX(extract_number_and_incr) (&mcnt, &p);
6995+# ifdef _LIBC
6996+ printf ("/on_failure_keep_string_jump to %td", p + mcnt - start);
6997+# else
6998+ printf ("/on_failure_keep_string_jump to %ld",
6999+ (long int) (p + mcnt - start));
7000+# endif
7001+ break;
7002+
7003+ case dummy_failure_jump:
7004+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7005+# ifdef _LIBC
7006+ printf ("/dummy_failure_jump to %td", p + mcnt - start);
7007+# else
7008+ printf ("/dummy_failure_jump to %ld", (long int) (p + mcnt - start));
7009+# endif
7010+ break;
7011+
7012+ case push_dummy_failure:
7013+ printf ("/push_dummy_failure");
7014+ break;
7015+
7016+ case maybe_pop_jump:
7017+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7018+# ifdef _LIBC
7019+ printf ("/maybe_pop_jump to %td", p + mcnt - start);
7020+# else
7021+ printf ("/maybe_pop_jump to %ld", (long int) (p + mcnt - start));
7022+# endif
7023+ break;
7024+
7025+ case pop_failure_jump:
7026+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7027+# ifdef _LIBC
7028+ printf ("/pop_failure_jump to %td", p + mcnt - start);
7029+# else
7030+ printf ("/pop_failure_jump to %ld", (long int) (p + mcnt - start));
7031+# endif
7032+ break;
7033+
7034+ case jump_past_alt:
7035+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7036+# ifdef _LIBC
7037+ printf ("/jump_past_alt to %td", p + mcnt - start);
7038+# else
7039+ printf ("/jump_past_alt to %ld", (long int) (p + mcnt - start));
7040+# endif
7041+ break;
7042+
7043+ case jump:
7044+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7045+# ifdef _LIBC
7046+ printf ("/jump to %td", p + mcnt - start);
7047+# else
7048+ printf ("/jump to %ld", (long int) (p + mcnt - start));
7049+# endif
7050+ break;
7051+
7052+ case succeed_n:
7053+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7054+ p1 = p + mcnt;
7055+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7056+# ifdef _LIBC
7057+ printf ("/succeed_n to %td, %d times", p1 - start, mcnt2);
7058+# else
7059+ printf ("/succeed_n to %ld, %d times",
7060+ (long int) (p1 - start), mcnt2);
7061+# endif
7062+ break;
7063+
7064+ case jump_n:
7065+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7066+ p1 = p + mcnt;
7067+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7068+ printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
7069+ break;
7070+
7071+ case set_number_at:
7072+ PREFIX(extract_number_and_incr) (&mcnt, &p);
7073+ p1 = p + mcnt;
7074+ PREFIX(extract_number_and_incr) (&mcnt2, &p);
7075+# ifdef _LIBC
7076+ printf ("/set_number_at location %td to %d", p1 - start, mcnt2);
7077+# else
7078+ printf ("/set_number_at location %ld to %d",
7079+ (long int) (p1 - start), mcnt2);
7080+# endif
7081+ break;
7082+
7083+ case wordbound:
7084+ printf ("/wordbound");
7085+ break;
7086+
7087+ case notwordbound:
7088+ printf ("/notwordbound");
7089+ break;
7090+
7091+ case wordbeg:
7092+ printf ("/wordbeg");
7093+ break;
7094+
7095+ case wordend:
7096+ printf ("/wordend");
7097+ break;
7098+
7099+# ifdef emacs
7100+ case before_dot:
7101+ printf ("/before_dot");
7102+ break;
7103+
7104+ case at_dot:
7105+ printf ("/at_dot");
7106+ break;
7107+
7108+ case after_dot:
7109+ printf ("/after_dot");
7110+ break;
7111+
7112+ case syntaxspec:
7113+ printf ("/syntaxspec");
7114+ mcnt = *p++;
7115+ printf ("/%d", mcnt);
7116+ break;
7117+
7118+ case notsyntaxspec:
7119+ printf ("/notsyntaxspec");
7120+ mcnt = *p++;
7121+ printf ("/%d", mcnt);
7122+ break;
7123+# endif /* emacs */
7124+
7125+ case wordchar:
7126+ printf ("/wordchar");
7127+ break;
7128+
7129+ case notwordchar:
7130+ printf ("/notwordchar");
7131+ break;
7132+
7133+ case begbuf:
7134+ printf ("/begbuf");
7135+ break;
7136+
7137+ case endbuf:
7138+ printf ("/endbuf");
7139+ break;
7140+
7141+ default:
7142+ printf ("?%ld", (long int) *(p-1));
7143+ }
7144+
7145+ putchar ('\n');
7146+ }
7147+
7148+# ifdef _LIBC
7149+ printf ("%td:\tend of pattern.\n", p - start);
7150+# else
7151+ printf ("%ld:\tend of pattern.\n", (long int) (p - start));
7152+# endif
7153+}
7154+
7155+
7156+void
7157+PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp)
7158+{
7159+ UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
7160+
7161+ PREFIX(print_partial_compiled_pattern) (buffer, buffer
7162+ + bufp->used / sizeof(UCHAR_T));
7163+ printf ("%ld bytes used/%ld bytes allocated.\n",
7164+ bufp->used, bufp->allocated);
7165+
7166+ if (bufp->fastmap_accurate && bufp->fastmap)
7167+ {
7168+ printf ("fastmap: ");
7169+ print_fastmap (bufp->fastmap);
7170+ }
7171+
7172+# ifdef _LIBC
7173+ printf ("re_nsub: %Zd\t", bufp->re_nsub);
7174+# else
7175+ printf ("re_nsub: %ld\t", (long int) bufp->re_nsub);
7176+# endif
7177+ printf ("regs_alloc: %d\t", bufp->regs_allocated);
7178+ printf ("can_be_null: %d\t", bufp->can_be_null);
7179+ printf ("newline_anchor: %d\n", bufp->newline_anchor);
7180+ printf ("no_sub: %d\t", bufp->no_sub);
7181+ printf ("not_bol: %d\t", bufp->not_bol);
7182+ printf ("not_eol: %d\t", bufp->not_eol);
7183+ printf ("syntax: %lx\n", bufp->syntax);
7184+ /* Perhaps we should print the translate table? */
7185+}
7186+
7187+
7188+void
7189+PREFIX(print_double_string) (const CHAR_T *where, const CHAR_T *string1,
7190+ int size1, const CHAR_T *string2, int size2)
7191+{
7192+ int this_char;
7193+
7194+ if (where == NULL)
7195+ printf ("(null)");
7196+ else
7197+ {
7198+ int cnt;
7199+
7200+ if (FIRST_STRING_P (where))
7201+ {
7202+ for (this_char = where - string1; this_char < size1; this_char++)
7203+ PUT_CHAR (string1[this_char]);
7204+
7205+ where = string2;
7206+ }
7207+
7208+ cnt = 0;
7209+ for (this_char = where - string2; this_char < size2; this_char++)
7210+ {
7211+ PUT_CHAR (string2[this_char]);
7212+ if (++cnt > 100)
7213+ {
7214+ fputs ("...", stdout);
7215+ break;
7216+ }
7217+ }
7218+ }
7219+}
7220+
7221+# ifndef DEFINED_ONCE
7222+void
7223+printchar (int c)
7224+{
7225+ putc (c, stderr);
7226+}
7227+# endif
7228+
7229+# else /* not DEBUG */
7230+
7231+# ifndef DEFINED_ONCE
7232+# undef assert
7233+# define assert(e)
7234+
7235+# define DEBUG_STATEMENT(e)
7236+# define DEBUG_PRINT1(x)
7237+# define DEBUG_PRINT2(x1, x2)
7238+# define DEBUG_PRINT3(x1, x2, x3)
7239+# define DEBUG_PRINT4(x1, x2, x3, x4)
7240+# endif /* not DEFINED_ONCE */
7241+# define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
7242+# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
7243+
7244+# endif /* not DEBUG */
7245+
7246+
7247+
7248+# ifdef WCHAR
7249+/* This convert a multibyte string to a wide character string.
7250+ And write their correspondances to offset_buffer(see below)
7251+ and write whether each wchar_t is binary data to is_binary.
7252+ This assume invalid multibyte sequences as binary data.
7253+ We assume offset_buffer and is_binary is already allocated
7254+ enough space. */
7255+
7256+static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
7257+ size_t len, int *offset_buffer,
7258+ char *is_binary);
7259+static size_t
7260+convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
7261+ int *offset_buffer, char *is_binary)
7262+ /* It hold correspondances between src(char string) and
7263+ dest(wchar_t string) for optimization.
7264+ e.g. src = "xxxyzz"
7265+ dest = {'X', 'Y', 'Z'}
7266+ (each "xxx", "y" and "zz" represent one multibyte character
7267+ corresponding to 'X', 'Y' and 'Z'.)
7268+ offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
7269+ = {0, 3, 4, 6}
7270+ */
7271+{
7272+ wchar_t *pdest = dest;
7273+ const unsigned char *psrc = src;
7274+ size_t wc_count = 0;
7275+
7276+ mbstate_t mbs;
7277+ int i, consumed;
7278+ size_t mb_remain = len;
7279+ size_t mb_count = 0;
7280+
7281+ /* Initialize the conversion state. */
7282+ memset (&mbs, 0, sizeof (mbstate_t));
7283+
7284+ offset_buffer[0] = 0;
7285+ for( ; mb_remain > 0 ; ++wc_count, ++pdest, mb_remain -= consumed,
7286+ psrc += consumed)
7287+ {
7288+#ifdef _LIBC
7289+ consumed = __mbrtowc (pdest, psrc, mb_remain, &mbs);
7290+#else
7291+ consumed = mbrtowc (pdest, psrc, mb_remain, &mbs);
7292+#endif
7293+
7294+ if (consumed <= 0)
7295+ /* failed to convert. maybe src contains binary data.
7296+ So we consume 1 byte manualy. */
7297+ {
7298+ *pdest = *psrc;
7299+ consumed = 1;
7300+ is_binary[wc_count] = TRUE;
7301+ }
7302+ else
7303+ is_binary[wc_count] = FALSE;
7304+ /* In sjis encoding, we use yen sign as escape character in
7305+ place of reverse solidus. So we convert 0x5c(yen sign in
7306+ sjis) to not 0xa5(yen sign in UCS2) but 0x5c(reverse
7307+ solidus in UCS2). */
7308+ if (consumed == 1 && (int) *psrc == 0x5c && (int) *pdest == 0xa5)
7309+ *pdest = (wchar_t) *psrc;
7310+
7311+ offset_buffer[wc_count + 1] = mb_count += consumed;
7312+ }
7313+
7314+ /* Fill remain of the buffer with sentinel. */
7315+ for (i = wc_count + 1 ; i <= len ; i++)
7316+ offset_buffer[i] = mb_count + 1;
7317+
7318+ return wc_count;
7319+}
7320+
7321+# endif /* WCHAR */
7322+
7323+#else /* not INSIDE_RECURSION */
7324+
7325+/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
7326+ also be assigned to arbitrarily: each pattern buffer stores its own
7327+ syntax, so it can be changed between regex compilations. */
7328+/* This has no initializer because initialized variables in Emacs
7329+ become read-only after dumping. */
7330+reg_syntax_t re_syntax_options;
7331+
7332+
7333+/* Specify the precise syntax of regexps for compilation. This provides
7334+ for compatibility for various utilities which historically have
7335+ different, incompatible syntaxes.
7336+
7337+ The argument SYNTAX is a bit mask comprised of the various bits
7338+ defined in regex.h. We return the old syntax. */
7339+
7340+reg_syntax_t
7341+re_set_syntax (reg_syntax_t syntax)
7342+{
7343+ reg_syntax_t ret = re_syntax_options;
7344+
7345+ re_syntax_options = syntax;
7346+# ifdef DEBUG
7347+ if (syntax & RE_DEBUG)
7348+ debug = 1;
7349+ else if (debug) /* was on but now is not */
7350+ debug = 0;
7351+# endif /* DEBUG */
7352+ return ret;
7353+}
7354+# ifdef _LIBC
7355+weak_alias (__re_set_syntax, re_set_syntax)
7356+# endif
7357+
7358+/* This table gives an error message for each of the error codes listed
7359+ in regex.h. Obviously the order here has to be same as there.
7360+ POSIX doesn't require that we do anything for REG_NOERROR,
7361+ but why not be nice? */
7362+
7363+static const char *re_error_msgid[] =
7364+ {
7365+ gettext_noop ("Success"), /* REG_NOERROR */
7366+ gettext_noop ("No match"), /* REG_NOMATCH */
7367+ gettext_noop ("Invalid regular expression"), /* REG_BADPAT */
7368+ gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */
7369+ gettext_noop ("Invalid character class name"), /* REG_ECTYPE */
7370+ gettext_noop ("Trailing backslash"), /* REG_EESCAPE */
7371+ gettext_noop ("Invalid back reference"), /* REG_ESUBREG */
7372+ gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */
7373+ gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */
7374+ gettext_noop ("Unmatched \\{"), /* REG_EBRACE */
7375+ gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */
7376+ gettext_noop ("Invalid range end"), /* REG_ERANGE */
7377+ gettext_noop ("Memory exhausted"), /* REG_ESPACE */
7378+ gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */
7379+ gettext_noop ("Premature end of regular expression"), /* REG_EEND */
7380+ gettext_noop ("Regular expression too big"), /* REG_ESIZE */
7381+ gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
7382+ };
7383+
7384+#endif /* INSIDE_RECURSION */
7385+
7386+#ifndef DEFINED_ONCE
7387+/* Avoiding alloca during matching, to placate r_alloc. */
7388+
7389+/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the
7390+ searching and matching functions should not call alloca. On some
7391+ systems, alloca is implemented in terms of malloc, and if we're
7392+ using the relocating allocator routines, then malloc could cause a
7393+ relocation, which might (if the strings being searched are in the
7394+ ralloc heap) shift the data out from underneath the regexp
7395+ routines.
7396+
7397+ Here's another reason to avoid allocation: Emacs
7398+ processes input from X in a signal handler; processing X input may
7399+ call malloc; if input arrives while a matching routine is calling
7400+ malloc, then we're scrod. But Emacs can't just block input while
7401+ calling matching routines; then we don't notice interrupts when
7402+ they come in. So, Emacs blocks input around all regexp calls
7403+ except the matching calls, which it leaves unprotected, in the
7404+ faith that they will not malloc. */
7405+
7406+/* Normally, this is fine. */
7407+# define MATCH_MAY_ALLOCATE
7408+
7409+/* When using GNU C, we are not REALLY using the C alloca, no matter
7410+ what config.h may say. So don't take precautions for it. */
7411+# ifdef __GNUC__
7412+# undef C_ALLOCA
7413+# endif
7414+
7415+/* The match routines may not allocate if (1) they would do it with malloc
7416+ and (2) it's not safe for them to use malloc.
7417+ Note that if REL_ALLOC is defined, matching would not use malloc for the
7418+ failure stack, but we would still use it for the register vectors;
7419+ so REL_ALLOC should not affect this. */
7420+# if (defined C_ALLOCA || defined REGEX_MALLOC) && defined emacs
7421+# undef MATCH_MAY_ALLOCATE
7422+# endif
7423+#endif /* not DEFINED_ONCE */
7424+
7425+#ifdef INSIDE_RECURSION
7426+/* Failure stack declarations and macros; both re_compile_fastmap and
7427+ re_match_2 use a failure stack. These have to be macros because of
7428+ REGEX_ALLOCATE_STACK. */
7429+
7430+
7431+/* Number of failure points for which to initially allocate space
7432+ when matching. If this number is exceeded, we allocate more
7433+ space, so it is not a hard limit. */
7434+# ifndef INIT_FAILURE_ALLOC
7435+# define INIT_FAILURE_ALLOC 5
7436+# endif
7437+
7438+/* Roughly the maximum number of failure points on the stack. Would be
7439+ exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
7440+ This is a variable only so users of regex can assign to it; we never
7441+ change it ourselves. */
7442+
7443+
7444+# ifndef DEFINED_ONCE
7445+
7446+# ifdef INT_IS_16BIT
7447+# define RE_M_F_TYPE long int
7448+# else
7449+# define RE_M_F_TYPE int
7450+# endif /* INT_IS_16BIT */
7451+
7452+# ifdef MATCH_MAY_ALLOCATE
7453+/* 4400 was enough to cause a crash on Alpha OSF/1,
7454+ whose default stack limit is 2mb. */
7455+# define RE_M_F_DEFAULT 4000
7456+# else
7457+# define RE_M_F_DEFAULT 2000
7458+# endif /* MATCH_MAY_ALLOCATE */
7459+
7460+# include <shlib-compat.h>
7461+
7462+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
7463+link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
7464+RE_M_F_TYPE re_max_failures = RE_M_F_DEFAULT;
7465+# else
7466+RE_M_F_TYPE re_max_failures attribute_hidden = RE_M_F_DEFAULT;
7467+# endif /* SHLIB_COMPAT */
7468+
7469+# undef RE_M_F_TYPE
7470+# undef RE_M_F_DEFAULT
7471+
7472+# endif /* DEFINED_ONCE */
7473+
7474+# ifdef INT_IS_16BIT
7475+
7476+union PREFIX(fail_stack_elt)
7477+{
7478+ UCHAR_T *pointer;
7479+ long int integer;
7480+};
7481+
7482+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
7483+
7484+typedef struct
7485+{
7486+ PREFIX(fail_stack_elt_t) *stack;
7487+ unsigned long int size;
7488+ unsigned long int avail; /* Offset of next open position. */
7489+} PREFIX(fail_stack_type);
7490+
7491+# else /* not INT_IS_16BIT */
7492+
7493+union PREFIX(fail_stack_elt)
7494+{
7495+ UCHAR_T *pointer;
7496+ int integer;
7497+};
7498+
7499+typedef union PREFIX(fail_stack_elt) PREFIX(fail_stack_elt_t);
7500+
7501+typedef struct
7502+{
7503+ PREFIX(fail_stack_elt_t) *stack;
7504+ unsigned size;
7505+ unsigned avail; /* Offset of next open position. */
7506+} PREFIX(fail_stack_type);
7507+
7508+# endif /* INT_IS_16BIT */
7509+
7510+# ifndef DEFINED_ONCE
7511+# define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
7512+# define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
7513+# define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
7514+# endif
7515+
7516+
7517+/* Define macros to initialize and free the failure stack.
7518+ Do `return -2' if the alloc fails. */
7519+
7520+# ifdef MATCH_MAY_ALLOCATE
7521+# define INIT_FAIL_STACK() \
7522+ do { \
7523+ fail_stack.stack = (PREFIX(fail_stack_elt_t) *) \
7524+ REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (PREFIX(fail_stack_elt_t))); \
7525+ \
7526+ if (fail_stack.stack == NULL) \
7527+ return -2; \
7528+ \
7529+ fail_stack.size = INIT_FAILURE_ALLOC; \
7530+ fail_stack.avail = 0; \
7531+ } while (0)
7532+
7533+# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
7534+# else
7535+# define INIT_FAIL_STACK() \
7536+ do { \
7537+ fail_stack.avail = 0; \
7538+ } while (0)
7539+
7540+# define RESET_FAIL_STACK()
7541+# endif
7542+
7543+
7544+/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items.
7545+
7546+ Return 1 if succeeds, and 0 if either ran out of memory
7547+ allocating space for it or it was already too large.
7548+
7549+ REGEX_REALLOCATE_STACK requires `destination' be declared. */
7550+
7551+# define DOUBLE_FAIL_STACK(fail_stack) \
7552+ ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \
7553+ ? 0 \
7554+ : ((fail_stack).stack = (PREFIX(fail_stack_elt_t) *) \
7555+ REGEX_REALLOCATE_STACK ((fail_stack).stack, \
7556+ (fail_stack).size * sizeof (PREFIX(fail_stack_elt_t)), \
7557+ ((fail_stack).size << 1) * sizeof (PREFIX(fail_stack_elt_t))),\
7558+ \
7559+ (fail_stack).stack == NULL \
7560+ ? 0 \
7561+ : ((fail_stack).size <<= 1, \
7562+ 1)))
7563+
7564+
7565+/* Push pointer POINTER on FAIL_STACK.
7566+ Return 1 if was able to do so and 0 if ran out of memory allocating
7567+ space to do so. */
7568+# define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \
7569+ ((FAIL_STACK_FULL () \
7570+ && !DOUBLE_FAIL_STACK (FAIL_STACK)) \
7571+ ? 0 \
7572+ : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \
7573+ 1))
7574+
7575+/* Push a pointer value onto the failure stack.
7576+ Assumes the variable `fail_stack'. Probably should only
7577+ be called from within `PUSH_FAILURE_POINT'. */
7578+# define PUSH_FAILURE_POINTER(item) \
7579+ fail_stack.stack[fail_stack.avail++].pointer = (UCHAR_T *) (item)
7580+
7581+/* This pushes an integer-valued item onto the failure stack.
7582+ Assumes the variable `fail_stack'. Probably should only
7583+ be called from within `PUSH_FAILURE_POINT'. */
7584+# define PUSH_FAILURE_INT(item) \
7585+ fail_stack.stack[fail_stack.avail++].integer = (item)
7586+
7587+/* Push a fail_stack_elt_t value onto the failure stack.
7588+ Assumes the variable `fail_stack'. Probably should only
7589+ be called from within `PUSH_FAILURE_POINT'. */
7590+# define PUSH_FAILURE_ELT(item) \
7591+ fail_stack.stack[fail_stack.avail++] = (item)
7592+
7593+/* These three POP... operations complement the three PUSH... operations.
7594+ All assume that `fail_stack' is nonempty. */
7595+# define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
7596+# define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
7597+# define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
7598+
7599+/* Used to omit pushing failure point id's when we're not debugging. */
7600+# ifdef DEBUG
7601+# define DEBUG_PUSH PUSH_FAILURE_INT
7602+# define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
7603+# else
7604+# define DEBUG_PUSH(item)
7605+# define DEBUG_POP(item_addr)
7606+# endif
7607+
7608+
7609+/* Push the information about the state we will need
7610+ if we ever fail back to it.
7611+
7612+ Requires variables fail_stack, regstart, regend, reg_info, and
7613+ num_regs_pushed be declared. DOUBLE_FAIL_STACK requires `destination'
7614+ be declared.
7615+
7616+ Does `return FAILURE_CODE' if runs out of memory. */
7617+
7618+# define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \
7619+ do { \
7620+ char *destination; \
7621+ /* Must be int, so when we don't save any registers, the arithmetic \
7622+ of 0 + -1 isn't done as unsigned. */ \
7623+ /* Can't be int, since there is not a shred of a guarantee that int \
7624+ is wide enough to hold a value of something to which pointer can \
7625+ be assigned */ \
7626+ active_reg_t this_reg; \
7627+ \
7628+ DEBUG_STATEMENT (failure_id++); \
7629+ DEBUG_STATEMENT (nfailure_points_pushed++); \
7630+ DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
7631+ DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\
7632+ DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\
7633+ \
7634+ DEBUG_PRINT2 (" slots needed: %ld\n", NUM_FAILURE_ITEMS); \
7635+ DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
7636+ \
7637+ /* Ensure we have enough space allocated for what we will push. */ \
7638+ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
7639+ { \
7640+ if (!DOUBLE_FAIL_STACK (fail_stack)) \
7641+ return failure_code; \
7642+ \
7643+ DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \
7644+ (fail_stack).size); \
7645+ DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\
7646+ } \
7647+ \
7648+ /* Push the info, starting with the registers. */ \
7649+ DEBUG_PRINT1 ("\n"); \
7650+ \
7651+ if (1) \
7652+ for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
7653+ this_reg++) \
7654+ { \
7655+ DEBUG_PRINT2 (" Pushing reg: %lu\n", this_reg); \
7656+ DEBUG_STATEMENT (num_regs_pushed++); \
7657+ \
7658+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
7659+ PUSH_FAILURE_POINTER (regstart[this_reg]); \
7660+ \
7661+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
7662+ PUSH_FAILURE_POINTER (regend[this_reg]); \
7663+ \
7664+ DEBUG_PRINT2 (" info: %p\n ", \
7665+ reg_info[this_reg].word.pointer); \
7666+ DEBUG_PRINT2 (" match_null=%d", \
7667+ REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \
7668+ DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \
7669+ DEBUG_PRINT2 (" matched_something=%d", \
7670+ MATCHED_SOMETHING (reg_info[this_reg])); \
7671+ DEBUG_PRINT2 (" ever_matched=%d", \
7672+ EVER_MATCHED_SOMETHING (reg_info[this_reg])); \
7673+ DEBUG_PRINT1 ("\n"); \
7674+ PUSH_FAILURE_ELT (reg_info[this_reg].word); \
7675+ } \
7676+ \
7677+ DEBUG_PRINT2 (" Pushing low active reg: %ld\n", lowest_active_reg);\
7678+ PUSH_FAILURE_INT (lowest_active_reg); \
7679+ \
7680+ DEBUG_PRINT2 (" Pushing high active reg: %ld\n", highest_active_reg);\
7681+ PUSH_FAILURE_INT (highest_active_reg); \
7682+ \
7683+ DEBUG_PRINT2 (" Pushing pattern %p:\n", pattern_place); \
7684+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
7685+ PUSH_FAILURE_POINTER (pattern_place); \
7686+ \
7687+ DEBUG_PRINT2 (" Pushing string %p: `", string_place); \
7688+ DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
7689+ size2); \
7690+ DEBUG_PRINT1 ("'\n"); \
7691+ PUSH_FAILURE_POINTER (string_place); \
7692+ \
7693+ DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
7694+ DEBUG_PUSH (failure_id); \
7695+ } while (0)
7696+
7697+# ifndef DEFINED_ONCE
7698+/* This is the number of items that are pushed and popped on the stack
7699+ for each register. */
7700+# define NUM_REG_ITEMS 3
7701+
7702+/* Individual items aside from the registers. */
7703+# ifdef DEBUG
7704+# define NUM_NONREG_ITEMS 5 /* Includes failure point id. */
7705+# else
7706+# define NUM_NONREG_ITEMS 4
7707+# endif
7708+
7709+/* We push at most this many items on the stack. */
7710+/* We used to use (num_regs - 1), which is the number of registers
7711+ this regexp will save; but that was changed to 5
7712+ to avoid stack overflow for a regexp with lots of parens. */
7713+# define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
7714+
7715+/* We actually push this many items. */
7716+# define NUM_FAILURE_ITEMS \
7717+ (((0 \
7718+ ? 0 : highest_active_reg - lowest_active_reg + 1) \
7719+ * NUM_REG_ITEMS) \
7720+ + NUM_NONREG_ITEMS)
7721+
7722+/* How many items can still be added to the stack without overflowing it. */
7723+# define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail)
7724+# endif /* not DEFINED_ONCE */
7725+
7726+
7727+/* Pops what PUSH_FAIL_STACK pushes.
7728+
7729+ We restore into the parameters, all of which should be lvalues:
7730+ STR -- the saved data position.
7731+ PAT -- the saved pattern position.
7732+ LOW_REG, HIGH_REG -- the highest and lowest active registers.
7733+ REGSTART, REGEND -- arrays of string positions.
7734+ REG_INFO -- array of information about each subexpression.
7735+
7736+ Also assumes the variables `fail_stack' and (if debugging), `bufp',
7737+ `pend', `string1', `size1', `string2', and `size2'. */
7738+# define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
7739+{ \
7740+ DEBUG_STATEMENT (unsigned failure_id;) \
7741+ active_reg_t this_reg; \
7742+ const UCHAR_T *string_temp; \
7743+ \
7744+ assert (!FAIL_STACK_EMPTY ()); \
7745+ \
7746+ /* Remove failure points and point to how many regs pushed. */ \
7747+ DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \
7748+ DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
7749+ DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
7750+ \
7751+ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
7752+ \
7753+ DEBUG_POP (&failure_id); \
7754+ DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
7755+ \
7756+ /* If the saved string location is NULL, it came from an \
7757+ on_failure_keep_string_jump opcode, and we want to throw away the \
7758+ saved NULL, thus retaining our current position in the string. */ \
7759+ string_temp = POP_FAILURE_POINTER (); \
7760+ if (string_temp != NULL) \
7761+ str = (const CHAR_T *) string_temp; \
7762+ \
7763+ DEBUG_PRINT2 (" Popping string %p: `", str); \
7764+ DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \
7765+ DEBUG_PRINT1 ("'\n"); \
7766+ \
7767+ pat = (UCHAR_T *) POP_FAILURE_POINTER (); \
7768+ DEBUG_PRINT2 (" Popping pattern %p:\n", pat); \
7769+ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
7770+ \
7771+ /* Restore register info. */ \
7772+ high_reg = (active_reg_t) POP_FAILURE_INT (); \
7773+ DEBUG_PRINT2 (" Popping high active reg: %ld\n", high_reg); \
7774+ \
7775+ low_reg = (active_reg_t) POP_FAILURE_INT (); \
7776+ DEBUG_PRINT2 (" Popping low active reg: %ld\n", low_reg); \
7777+ \
7778+ if (1) \
7779+ for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
7780+ { \
7781+ DEBUG_PRINT2 (" Popping reg: %ld\n", this_reg); \
7782+ \
7783+ reg_info[this_reg].word = POP_FAILURE_ELT (); \
7784+ DEBUG_PRINT2 (" info: %p\n", \
7785+ reg_info[this_reg].word.pointer); \
7786+ \
7787+ regend[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
7788+ DEBUG_PRINT2 (" end: %p\n", regend[this_reg]); \
7789+ \
7790+ regstart[this_reg] = (const CHAR_T *) POP_FAILURE_POINTER (); \
7791+ DEBUG_PRINT2 (" start: %p\n", regstart[this_reg]); \
7792+ } \
7793+ else \
7794+ { \
7795+ for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
7796+ { \
7797+ reg_info[this_reg].word.integer = 0; \
7798+ regend[this_reg] = 0; \
7799+ regstart[this_reg] = 0; \
7800+ } \
7801+ highest_active_reg = high_reg; \
7802+ } \
7803+ \
7804+ set_regs_matched_done = 0; \
7805+ DEBUG_STATEMENT (nfailure_points_popped++); \
7806+} /* POP_FAILURE_POINT */
7807+
7808+/* Structure for per-register (a.k.a. per-group) information.
7809+ Other register information, such as the
7810+ starting and ending positions (which are addresses), and the list of
7811+ inner groups (which is a bits list) are maintained in separate
7812+ variables.
7813+
7814+ We are making a (strictly speaking) nonportable assumption here: that
7815+ the compiler will pack our bit fields into something that fits into
7816+ the type of `word', i.e., is something that fits into one item on the
7817+ failure stack. */
7818+
7819+
7820+/* Declarations and macros for re_match_2. */
7821+
7822+typedef union
7823+{
7824+ PREFIX(fail_stack_elt_t) word;
7825+ struct
7826+ {
7827+ /* This field is one if this group can match the empty string,
7828+ zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */
7829+# define MATCH_NULL_UNSET_VALUE 3
7830+ unsigned match_null_string_p : 2;
7831+ unsigned is_active : 1;
7832+ unsigned matched_something : 1;
7833+ unsigned ever_matched_something : 1;
7834+ } bits;
7835+} PREFIX(register_info_type);
7836+
7837+# ifndef DEFINED_ONCE
7838+# define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p)
7839+# define IS_ACTIVE(R) ((R).bits.is_active)
7840+# define MATCHED_SOMETHING(R) ((R).bits.matched_something)
7841+# define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something)
7842+
7843+
7844+/* Call this when have matched a real character; it sets `matched' flags
7845+ for the subexpressions which we are currently inside. Also records
7846+ that those subexprs have matched. */
7847+# define SET_REGS_MATCHED() \
7848+ do \
7849+ { \
7850+ if (!set_regs_matched_done) \
7851+ { \
7852+ active_reg_t r; \
7853+ set_regs_matched_done = 1; \
7854+ for (r = lowest_active_reg; r <= highest_active_reg; r++) \
7855+ { \
7856+ MATCHED_SOMETHING (reg_info[r]) \
7857+ = EVER_MATCHED_SOMETHING (reg_info[r]) \
7858+ = 1; \
7859+ } \
7860+ } \
7861+ } \
7862+ while (0)
7863+# endif /* not DEFINED_ONCE */
7864+
7865+/* Registers are set to a sentinel when they haven't yet matched. */
7866+static CHAR_T PREFIX(reg_unset_dummy);
7867+# define REG_UNSET_VALUE (&PREFIX(reg_unset_dummy))
7868+# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
7869+
7870+/* Subroutine declarations and macros for regex_compile. */
7871+static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg);
7872+static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc,
7873+ int arg1, int arg2);
7874+static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc,
7875+ int arg, UCHAR_T *end);
7876+static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc,
7877+ int arg1, int arg2, UCHAR_T *end);
7878+static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
7879+ const CHAR_T *p,
7880+ reg_syntax_t syntax);
7881+static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p,
7882+ const CHAR_T *pend,
7883+ reg_syntax_t syntax);
7884+# ifdef WCHAR
7885+static reg_errcode_t wcs_compile_range (CHAR_T range_start,
7886+ const CHAR_T **p_ptr,
7887+ const CHAR_T *pend,
7888+ char *translate,
7889+ reg_syntax_t syntax,
7890+ UCHAR_T *b,
7891+ CHAR_T *char_set);
7892+static void insert_space (int num, CHAR_T *loc, CHAR_T *end);
7893+# else /* BYTE */
7894+static reg_errcode_t byte_compile_range (unsigned int range_start,
7895+ const char **p_ptr,
7896+ const char *pend,
7897+ RE_TRANSLATE_TYPE translate,
7898+ reg_syntax_t syntax,
7899+ unsigned char *b);
7900+# endif /* WCHAR */
7901+
7902+/* Fetch the next character in the uncompiled pattern---translating it
7903+ if necessary. Also cast from a signed character in the constant
7904+ string passed to us by the user to an unsigned char that we can use
7905+ as an array index (in, e.g., `translate'). */
7906+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
7907+ because it is impossible to allocate 4GB array for some encodings
7908+ which have 4 byte character_set like UCS4. */
7909+# ifndef PATFETCH
7910+# ifdef WCHAR
7911+# define PATFETCH(c) \
7912+ do {if (p == pend) return REG_EEND; \
7913+ c = (UCHAR_T) *p++; \
7914+ if (translate && (c <= 0xff)) c = (UCHAR_T) translate[c]; \
7915+ } while (0)
7916+# else /* BYTE */
7917+# define PATFETCH(c) \
7918+ do {if (p == pend) return REG_EEND; \
7919+ c = (unsigned char) *p++; \
7920+ if (translate) c = (unsigned char) translate[c]; \
7921+ } while (0)
7922+# endif /* WCHAR */
7923+# endif
7924+
7925+/* Fetch the next character in the uncompiled pattern, with no
7926+ translation. */
7927+# define PATFETCH_RAW(c) \
7928+ do {if (p == pend) return REG_EEND; \
7929+ c = (UCHAR_T) *p++; \
7930+ } while (0)
7931+
7932+/* Go backwards one character in the pattern. */
7933+# define PATUNFETCH p--
7934+
7935+
7936+/* If `translate' is non-null, return translate[D], else just D. We
7937+ cast the subscript to translate because some data is declared as
7938+ `char *', to avoid warnings when a string constant is passed. But
7939+ when we use a character as a subscript we must make it unsigned. */
7940+/* ifdef MBS_SUPPORT, we translate only if character <= 0xff,
7941+ because it is impossible to allocate 4GB array for some encodings
7942+ which have 4 byte character_set like UCS4. */
7943+
7944+# ifndef TRANSLATE
7945+# ifdef WCHAR
7946+# define TRANSLATE(d) \
7947+ ((translate && ((UCHAR_T) (d)) <= 0xff) \
7948+ ? (char) translate[(unsigned char) (d)] : (d))
7949+# else /* BYTE */
7950+# define TRANSLATE(d) \
7951+ (translate ? (char) translate[(unsigned char) (d)] : (char) (d))
7952+# endif /* WCHAR */
7953+# endif
7954+
7955+
7956+/* Macros for outputting the compiled pattern into `buffer'. */
7957+
7958+/* If the buffer isn't allocated when it comes in, use this. */
7959+# define INIT_BUF_SIZE (32 * sizeof(UCHAR_T))
7960+
7961+/* Make sure we have at least N more bytes of space in buffer. */
7962+# ifdef WCHAR
7963+# define GET_BUFFER_SPACE(n) \
7964+ while (((unsigned long)b - (unsigned long)COMPILED_BUFFER_VAR \
7965+ + (n)*sizeof(CHAR_T)) > bufp->allocated) \
7966+ EXTEND_BUFFER ()
7967+# else /* BYTE */
7968+# define GET_BUFFER_SPACE(n) \
7969+ while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \
7970+ EXTEND_BUFFER ()
7971+# endif /* WCHAR */
7972+
7973+/* Make sure we have one more byte of buffer space and then add C to it. */
7974+# define BUF_PUSH(c) \
7975+ do { \
7976+ GET_BUFFER_SPACE (1); \
7977+ *b++ = (UCHAR_T) (c); \
7978+ } while (0)
7979+
7980+
7981+/* Ensure we have two more bytes of buffer space and then append C1 and C2. */
7982+# define BUF_PUSH_2(c1, c2) \
7983+ do { \
7984+ GET_BUFFER_SPACE (2); \
7985+ *b++ = (UCHAR_T) (c1); \
7986+ *b++ = (UCHAR_T) (c2); \
7987+ } while (0)
7988+
7989+
7990+/* As with BUF_PUSH_2, except for three bytes. */
7991+# define BUF_PUSH_3(c1, c2, c3) \
7992+ do { \
7993+ GET_BUFFER_SPACE (3); \
7994+ *b++ = (UCHAR_T) (c1); \
7995+ *b++ = (UCHAR_T) (c2); \
7996+ *b++ = (UCHAR_T) (c3); \
7997+ } while (0)
7998+
7999+/* Store a jump with opcode OP at LOC to location TO. We store a
8000+ relative address offset by the three bytes the jump itself occupies. */
8001+# define STORE_JUMP(op, loc, to) \
8002+ PREFIX(store_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)))
8003+
8004+/* Likewise, for a two-argument jump. */
8005+# define STORE_JUMP2(op, loc, to, arg) \
8006+ PREFIX(store_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), arg)
8007+
8008+/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
8009+# define INSERT_JUMP(op, loc, to) \
8010+ PREFIX(insert_op1) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)), b)
8011+
8012+/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
8013+# define INSERT_JUMP2(op, loc, to, arg) \
8014+ PREFIX(insert_op2) (op, loc, (int) ((to) - (loc) - (1 + OFFSET_ADDRESS_SIZE)),\
8015+ arg, b)
8016+
8017+/* This is not an arbitrary limit: the arguments which represent offsets
8018+ into the pattern are two bytes long. So if 2^16 bytes turns out to
8019+ be too small, many things would have to change. */
8020+/* Any other compiler which, like MSC, has allocation limit below 2^16
8021+ bytes will have to use approach similar to what was done below for
8022+ MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
8023+ reallocating to 0 bytes. Such thing is not going to work too well.
8024+ You have been warned!! */
8025+# ifndef DEFINED_ONCE
8026+# if defined _MSC_VER && !defined WIN32
8027+/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
8028+ The REALLOC define eliminates a flurry of conversion warnings,
8029+ but is not required. */
8030+# define MAX_BUF_SIZE 65500L
8031+# define REALLOC(p,s) realloc ((p), (size_t) (s))
8032+# else
8033+# define MAX_BUF_SIZE (1L << 16)
8034+# define REALLOC(p,s) realloc ((p), (s))
8035+# endif
8036+
8037+/* Extend the buffer by twice its current size via realloc and
8038+ reset the pointers that pointed into the old block to point to the
8039+ correct places in the new one. If extending the buffer results in it
8040+ being larger than MAX_BUF_SIZE, then flag memory exhausted. */
8041+# if __BOUNDED_POINTERS__
8042+# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
8043+# define MOVE_BUFFER_POINTER(P) \
8044+ (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
8045+# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
8046+ else \
8047+ { \
8048+ SET_HIGH_BOUND (b); \
8049+ SET_HIGH_BOUND (begalt); \
8050+ if (fixup_alt_jump) \
8051+ SET_HIGH_BOUND (fixup_alt_jump); \
8052+ if (laststart) \
8053+ SET_HIGH_BOUND (laststart); \
8054+ if (pending_exact) \
8055+ SET_HIGH_BOUND (pending_exact); \
8056+ }
8057+# else
8058+# define MOVE_BUFFER_POINTER(P) (P) += incr
8059+# define ELSE_EXTEND_BUFFER_HIGH_BOUND
8060+# endif
8061+# endif /* not DEFINED_ONCE */
8062+
8063+# ifdef WCHAR
8064+# define EXTEND_BUFFER() \
8065+ do { \
8066+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
8067+ int wchar_count; \
8068+ if (bufp->allocated + sizeof(UCHAR_T) > MAX_BUF_SIZE) \
8069+ return REG_ESIZE; \
8070+ bufp->allocated <<= 1; \
8071+ if (bufp->allocated > MAX_BUF_SIZE) \
8072+ bufp->allocated = MAX_BUF_SIZE; \
8073+ /* How many characters the new buffer can have? */ \
8074+ wchar_count = bufp->allocated / sizeof(UCHAR_T); \
8075+ if (wchar_count == 0) wchar_count = 1; \
8076+ /* Truncate the buffer to CHAR_T align. */ \
8077+ bufp->allocated = wchar_count * sizeof(UCHAR_T); \
8078+ RETALLOC (COMPILED_BUFFER_VAR, wchar_count, UCHAR_T); \
8079+ bufp->buffer = (char*)COMPILED_BUFFER_VAR; \
8080+ if (COMPILED_BUFFER_VAR == NULL) \
8081+ return REG_ESPACE; \
8082+ /* If the buffer moved, move all the pointers into it. */ \
8083+ if (old_buffer != COMPILED_BUFFER_VAR) \
8084+ { \
8085+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
8086+ MOVE_BUFFER_POINTER (b); \
8087+ MOVE_BUFFER_POINTER (begalt); \
8088+ if (fixup_alt_jump) \
8089+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
8090+ if (laststart) \
8091+ MOVE_BUFFER_POINTER (laststart); \
8092+ if (pending_exact) \
8093+ MOVE_BUFFER_POINTER (pending_exact); \
8094+ } \
8095+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
8096+ } while (0)
8097+# else /* BYTE */
8098+# define EXTEND_BUFFER() \
8099+ do { \
8100+ UCHAR_T *old_buffer = COMPILED_BUFFER_VAR; \
8101+ if (bufp->allocated == MAX_BUF_SIZE) \
8102+ return REG_ESIZE; \
8103+ bufp->allocated <<= 1; \
8104+ if (bufp->allocated > MAX_BUF_SIZE) \
8105+ bufp->allocated = MAX_BUF_SIZE; \
8106+ bufp->buffer = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, \
8107+ bufp->allocated); \
8108+ if (COMPILED_BUFFER_VAR == NULL) \
8109+ return REG_ESPACE; \
8110+ /* If the buffer moved, move all the pointers into it. */ \
8111+ if (old_buffer != COMPILED_BUFFER_VAR) \
8112+ { \
8113+ int incr = COMPILED_BUFFER_VAR - old_buffer; \
8114+ MOVE_BUFFER_POINTER (b); \
8115+ MOVE_BUFFER_POINTER (begalt); \
8116+ if (fixup_alt_jump) \
8117+ MOVE_BUFFER_POINTER (fixup_alt_jump); \
8118+ if (laststart) \
8119+ MOVE_BUFFER_POINTER (laststart); \
8120+ if (pending_exact) \
8121+ MOVE_BUFFER_POINTER (pending_exact); \
8122+ } \
8123+ ELSE_EXTEND_BUFFER_HIGH_BOUND \
8124+ } while (0)
8125+# endif /* WCHAR */
8126+
8127+# ifndef DEFINED_ONCE
8128+/* Since we have one byte reserved for the register number argument to
8129+ {start,stop}_memory, the maximum number of groups we can report
8130+ things about is what fits in that byte. */
8131+# define MAX_REGNUM 255
8132+
8133+/* But patterns can have more than `MAX_REGNUM' registers. We just
8134+ ignore the excess. */
8135+typedef unsigned regnum_t;
8136+
8137+
8138+/* Macros for the compile stack. */
8139+
8140+/* Since offsets can go either forwards or backwards, this type needs to
8141+ be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
8142+/* int may be not enough when sizeof(int) == 2. */
8143+typedef long pattern_offset_t;
8144+
8145+typedef struct
8146+{
8147+ pattern_offset_t begalt_offset;
8148+ pattern_offset_t fixup_alt_jump;
8149+ pattern_offset_t inner_group_offset;
8150+ pattern_offset_t laststart_offset;
8151+ regnum_t regnum;
8152+} compile_stack_elt_t;
8153+
8154+
8155+typedef struct
8156+{
8157+ compile_stack_elt_t *stack;
8158+ unsigned size;
8159+ unsigned avail; /* Offset of next open position. */
8160+} compile_stack_type;
8161+
8162+
8163+# define INIT_COMPILE_STACK_SIZE 32
8164+
8165+# define COMPILE_STACK_EMPTY (compile_stack.avail == 0)
8166+# define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size)
8167+
8168+/* The next available element. */
8169+# define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail])
8170+
8171+# endif /* not DEFINED_ONCE */
8172+
8173+/* Set the bit for character C in a list. */
8174+# ifndef DEFINED_ONCE
8175+# define SET_LIST_BIT(c) \
8176+ (b[((unsigned char) (c)) / BYTEWIDTH] \
8177+ |= 1 << (((unsigned char) c) % BYTEWIDTH))
8178+# endif /* DEFINED_ONCE */
8179+
8180+/* Get the next unsigned number in the uncompiled pattern. */
8181+# define GET_UNSIGNED_NUMBER(num) \
8182+ { \
8183+ while (p != pend) \
8184+ { \
8185+ PATFETCH (c); \
8186+ if (c < '0' || c > '9') \
8187+ break; \
8188+ if (num <= RE_DUP_MAX) \
8189+ { \
8190+ if (num < 0) \
8191+ num = 0; \
8192+ num = num * 10 + c - '0'; \
8193+ } \
8194+ } \
8195+ }
8196+
8197+# ifndef DEFINED_ONCE
8198+# if WIDE_CHAR_SUPPORT
8199+/* The GNU C library provides support for user-defined character classes
8200+ and the functions from ISO C amendement 1. */
8201+# ifdef CHARCLASS_NAME_MAX
8202+# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
8203+# else
8204+/* This shouldn't happen but some implementation might still have this
8205+ problem. Use a reasonable default value. */
8206+# define CHAR_CLASS_MAX_LENGTH 256
8207+# endif
8208+
8209+# ifdef _LIBC
8210+# define IS_CHAR_CLASS(string) __wctype (string)
8211+# else
8212+# define IS_CHAR_CLASS(string) wctype (string)
8213+# endif
8214+# else
8215+# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
8216+
8217+# define IS_CHAR_CLASS(string) \
8218+ (STREQ (string, "alpha") || STREQ (string, "upper") \
8219+ || STREQ (string, "lower") || STREQ (string, "digit") \
8220+ || STREQ (string, "alnum") || STREQ (string, "xdigit") \
8221+ || STREQ (string, "space") || STREQ (string, "print") \
8222+ || STREQ (string, "punct") || STREQ (string, "graph") \
8223+ || STREQ (string, "cntrl") || STREQ (string, "blank"))
8224+# endif
8225+# endif /* DEFINED_ONCE */
8226+
8227+# ifndef MATCH_MAY_ALLOCATE
8228+
8229+/* If we cannot allocate large objects within re_match_2_internal,
8230+ we make the fail stack and register vectors global.
8231+ The fail stack, we grow to the maximum size when a regexp
8232+ is compiled.
8233+ The register vectors, we adjust in size each time we
8234+ compile a regexp, according to the number of registers it needs. */
8235+
8236+static PREFIX(fail_stack_type) fail_stack;
8237+
8238+/* Size with which the following vectors are currently allocated.
8239+ That is so we can make them bigger as needed,
8240+ but never make them smaller. */
8241+# ifdef DEFINED_ONCE
8242+static int regs_allocated_size;
8243+
8244+static const char ** regstart, ** regend;
8245+static const char ** old_regstart, ** old_regend;
8246+static const char **best_regstart, **best_regend;
8247+static const char **reg_dummy;
8248+# endif /* DEFINED_ONCE */
8249+
8250+static PREFIX(register_info_type) *PREFIX(reg_info);
8251+static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
8252+
8253+/* Make the register vectors big enough for NUM_REGS registers,
8254+ but don't make them smaller. */
8255+
8256+static void
8257+PREFIX(regex_grow_registers) (int num_regs)
8258+{
8259+ if (num_regs > regs_allocated_size)
8260+ {
8261+ RETALLOC_IF (regstart, num_regs, const char *);
8262+ RETALLOC_IF (regend, num_regs, const char *);
8263+ RETALLOC_IF (old_regstart, num_regs, const char *);
8264+ RETALLOC_IF (old_regend, num_regs, const char *);
8265+ RETALLOC_IF (best_regstart, num_regs, const char *);
8266+ RETALLOC_IF (best_regend, num_regs, const char *);
8267+ RETALLOC_IF (PREFIX(reg_info), num_regs, PREFIX(register_info_type));
8268+ RETALLOC_IF (reg_dummy, num_regs, const char *);
8269+ RETALLOC_IF (PREFIX(reg_info_dummy), num_regs, PREFIX(register_info_type));
8270+
8271+ regs_allocated_size = num_regs;
8272+ }
8273+}
8274+
8275+# endif /* not MATCH_MAY_ALLOCATE */
8276+
8277+# ifndef DEFINED_ONCE
8278+static boolean group_in_compile_stack (compile_stack_type compile_stack,
8279+ regnum_t regnum);
8280+# endif /* not DEFINED_ONCE */
8281+
8282+/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
8283+ Returns one of error codes defined in `regex.h', or zero for success.
8284+
8285+ Assumes the `allocated' (and perhaps `buffer') and `translate'
8286+ fields are set in BUFP on entry.
8287+
8288+ If it succeeds, results are put in BUFP (if it returns an error, the
8289+ contents of BUFP are undefined):
8290+ `buffer' is the compiled pattern;
8291+ `syntax' is set to SYNTAX;
8292+ `used' is set to the length of the compiled pattern;
8293+ `fastmap_accurate' is zero;
8294+ `re_nsub' is the number of subexpressions in PATTERN;
8295+ `not_bol' and `not_eol' are zero;
8296+
8297+ The `fastmap' and `newline_anchor' fields are neither
8298+ examined nor set. */
8299+
8300+/* Return, freeing storage we allocated. */
8301+# ifdef WCHAR
8302+# define FREE_STACK_RETURN(value) \
8303+ return (free(pattern), free(mbs_offset), free(is_binary), free (compile_stack.stack), value)
8304+# else
8305+# define FREE_STACK_RETURN(value) \
8306+ return (free (compile_stack.stack), value)
8307+# endif /* WCHAR */
8308+
8309+static reg_errcode_t
8310+PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
8311+ size_t ARG_PREFIX(size), reg_syntax_t syntax,
8312+ struct re_pattern_buffer *bufp)
8313+{
8314+ /* We fetch characters from PATTERN here. Even though PATTERN is
8315+ `char *' (i.e., signed), we declare these variables as unsigned, so
8316+ they can be reliably used as array indices. */
8317+ register UCHAR_T c, c1;
8318+
8319+#ifdef WCHAR
8320+ /* A temporary space to keep wchar_t pattern and compiled pattern. */
8321+ CHAR_T *pattern, *COMPILED_BUFFER_VAR;
8322+ size_t size;
8323+ /* offset buffer for optimization. See convert_mbs_to_wc. */
8324+ int *mbs_offset = NULL;
8325+ /* It hold whether each wchar_t is binary data or not. */
8326+ char *is_binary = NULL;
8327+ /* A flag whether exactn is handling binary data or not. */
8328+ char is_exactn_bin = FALSE;
8329+#endif /* WCHAR */
8330+
8331+ /* A random temporary spot in PATTERN. */
8332+ const CHAR_T *p1;
8333+
8334+ /* Points to the end of the buffer, where we should append. */
8335+ register UCHAR_T *b;
8336+
8337+ /* Keeps track of unclosed groups. */
8338+ compile_stack_type compile_stack;
8339+
8340+ /* Points to the current (ending) position in the pattern. */
8341+#ifdef WCHAR
8342+ const CHAR_T *p;
8343+ const CHAR_T *pend;
8344+#else /* BYTE */
8345+ const CHAR_T *p = pattern;
8346+ const CHAR_T *pend = pattern + size;
8347+#endif /* WCHAR */
8348+
8349+ /* How to translate the characters in the pattern. */
8350+ RE_TRANSLATE_TYPE translate = bufp->translate;
8351+
8352+ /* Address of the count-byte of the most recently inserted `exactn'
8353+ command. This makes it possible to tell if a new exact-match
8354+ character can be added to that command or if the character requires
8355+ a new `exactn' command. */
8356+ UCHAR_T *pending_exact = 0;
8357+
8358+ /* Address of start of the most recently finished expression.
8359+ This tells, e.g., postfix * where to find the start of its
8360+ operand. Reset at the beginning of groups and alternatives. */
8361+ UCHAR_T *laststart = 0;
8362+
8363+ /* Address of beginning of regexp, or inside of last group. */
8364+ UCHAR_T *begalt;
8365+
8366+ /* Address of the place where a forward jump should go to the end of
8367+ the containing expression. Each alternative of an `or' -- except the
8368+ last -- ends with a forward jump of this sort. */
8369+ UCHAR_T *fixup_alt_jump = 0;
8370+
8371+ /* Counts open-groups as they are encountered. Remembered for the
8372+ matching close-group on the compile stack, so the same register
8373+ number is put in the stop_memory as the start_memory. */
8374+ regnum_t regnum = 0;
8375+
8376+#ifdef WCHAR
8377+ /* Initialize the wchar_t PATTERN and offset_buffer. */
8378+ p = pend = pattern = TALLOC(csize + 1, CHAR_T);
8379+ mbs_offset = TALLOC(csize + 1, int);
8380+ is_binary = TALLOC(csize + 1, char);
8381+ if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
8382+ {
8383+ free(pattern);
8384+ free(mbs_offset);
8385+ free(is_binary);
8386+ return REG_ESPACE;
8387+ }
8388+ pattern[csize] = L'\0'; /* sentinel */
8389+ size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
8390+ pend = p + size;
8391+ if (size < 0)
8392+ {
8393+ free(pattern);
8394+ free(mbs_offset);
8395+ free(is_binary);
8396+ return REG_BADPAT;
8397+ }
8398+#endif
8399+
8400+#ifdef DEBUG
8401+ DEBUG_PRINT1 ("\nCompiling pattern: ");
8402+ if (debug)
8403+ {
8404+ unsigned debug_count;
8405+
8406+ for (debug_count = 0; debug_count < size; debug_count++)
8407+ PUT_CHAR (pattern[debug_count]);
8408+ putchar ('\n');
8409+ }
8410+#endif /* DEBUG */
8411+
8412+ /* Initialize the compile stack. */
8413+ compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
8414+ if (compile_stack.stack == NULL)
8415+ {
8416+#ifdef WCHAR
8417+ free(pattern);
8418+ free(mbs_offset);
8419+ free(is_binary);
8420+#endif
8421+ return REG_ESPACE;
8422+ }
8423+
8424+ compile_stack.size = INIT_COMPILE_STACK_SIZE;
8425+ compile_stack.avail = 0;
8426+
8427+ /* Initialize the pattern buffer. */
8428+ bufp->syntax = syntax;
8429+ bufp->fastmap_accurate = 0;
8430+ bufp->not_bol = bufp->not_eol = 0;
8431+
8432+ /* Set `used' to zero, so that if we return an error, the pattern
8433+ printer (for debugging) will think there's no pattern. We reset it
8434+ at the end. */
8435+ bufp->used = 0;
8436+
8437+ /* Always count groups, whether or not bufp->no_sub is set. */
8438+ bufp->re_nsub = 0;
8439+
8440+#if !defined emacs && !defined SYNTAX_TABLE
8441+ /* Initialize the syntax table. */
8442+ init_syntax_once ();
8443+#endif
8444+
8445+ if (bufp->allocated == 0)
8446+ {
8447+ if (bufp->buffer)
8448+ { /* If zero allocated, but buffer is non-null, try to realloc
8449+ enough space. This loses if buffer's address is bogus, but
8450+ that is the user's responsibility. */
8451+#ifdef WCHAR
8452+ /* Free bufp->buffer and allocate an array for wchar_t pattern
8453+ buffer. */
8454+ free(bufp->buffer);
8455+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE/sizeof(UCHAR_T),
8456+ UCHAR_T);
8457+#else
8458+ RETALLOC (COMPILED_BUFFER_VAR, INIT_BUF_SIZE, UCHAR_T);
8459+#endif /* WCHAR */
8460+ }
8461+ else
8462+ { /* Caller did not allocate a buffer. Do it for them. */
8463+ COMPILED_BUFFER_VAR = TALLOC (INIT_BUF_SIZE / sizeof(UCHAR_T),
8464+ UCHAR_T);
8465+ }
8466+
8467+ if (!COMPILED_BUFFER_VAR) FREE_STACK_RETURN (REG_ESPACE);
8468+#ifdef WCHAR
8469+ bufp->buffer = (char*)COMPILED_BUFFER_VAR;
8470+#endif /* WCHAR */
8471+ bufp->allocated = INIT_BUF_SIZE;
8472+ }
8473+#ifdef WCHAR
8474+ else
8475+ COMPILED_BUFFER_VAR = (UCHAR_T*) bufp->buffer;
8476+#endif
8477+
8478+ begalt = b = COMPILED_BUFFER_VAR;
8479+
8480+ /* Loop through the uncompiled pattern until we're at the end. */
8481+ while (p != pend)
8482+ {
8483+ PATFETCH (c);
8484+
8485+ switch (c)
8486+ {
8487+ case '^':
8488+ {
8489+ if ( /* If at start of pattern, it's an operator. */
8490+ p == pattern + 1
8491+ /* If context independent, it's an operator. */
8492+ || syntax & RE_CONTEXT_INDEP_ANCHORS
8493+ /* Otherwise, depends on what's come before. */
8494+ || PREFIX(at_begline_loc_p) (pattern, p, syntax))
8495+ BUF_PUSH (begline);
8496+ else
8497+ goto normal_char;
8498+ }
8499+ break;
8500+
8501+
8502+ case '$':
8503+ {
8504+ if ( /* If at end of pattern, it's an operator. */
8505+ p == pend
8506+ /* If context independent, it's an operator. */
8507+ || syntax & RE_CONTEXT_INDEP_ANCHORS
8508+ /* Otherwise, depends on what's next. */
8509+ || PREFIX(at_endline_loc_p) (p, pend, syntax))
8510+ BUF_PUSH (endline);
8511+ else
8512+ goto normal_char;
8513+ }
8514+ break;
8515+
8516+
8517+ case '+':
8518+ case '?':
8519+ if ((syntax & RE_BK_PLUS_QM)
8520+ || (syntax & RE_LIMITED_OPS))
8521+ goto normal_char;
8522+ handle_plus:
8523+ case '*':
8524+ /* If there is no previous pattern... */
8525+ if (!laststart)
8526+ {
8527+ if (syntax & RE_CONTEXT_INVALID_OPS)
8528+ FREE_STACK_RETURN (REG_BADRPT);
8529+ else if (!(syntax & RE_CONTEXT_INDEP_OPS))
8530+ goto normal_char;
8531+ }
8532+
8533+ {
8534+ /* Are we optimizing this jump? */
8535+ boolean keep_string_p = false;
8536+
8537+ /* 1 means zero (many) matches is allowed. */
8538+ char zero_times_ok = 0, many_times_ok = 0;
8539+
8540+ /* If there is a sequence of repetition chars, collapse it
8541+ down to just one (the right one). We can't combine
8542+ interval operators with these because of, e.g., `a{2}*',
8543+ which should only match an even number of `a's. */
8544+
8545+ for (;;)
8546+ {
8547+ zero_times_ok |= c != '+';
8548+ many_times_ok |= c != '?';
8549+
8550+ if (p == pend)
8551+ break;
8552+
8553+ PATFETCH (c);
8554+
8555+ if (c == '*'
8556+ || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')))
8557+ ;
8558+
8559+ else if (syntax & RE_BK_PLUS_QM && c == '\\')
8560+ {
8561+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
8562+
8563+ PATFETCH (c1);
8564+ if (!(c1 == '+' || c1 == '?'))
8565+ {
8566+ PATUNFETCH;
8567+ PATUNFETCH;
8568+ break;
8569+ }
8570+
8571+ c = c1;
8572+ }
8573+ else
8574+ {
8575+ PATUNFETCH;
8576+ break;
8577+ }
8578+
8579+ /* If we get here, we found another repeat character. */
8580+ }
8581+
8582+ /* Star, etc. applied to an empty pattern is equivalent
8583+ to an empty pattern. */
8584+ if (!laststart)
8585+ break;
8586+
8587+ /* Now we know whether or not zero matches is allowed
8588+ and also whether or not two or more matches is allowed. */
8589+ if (many_times_ok)
8590+ { /* More than one repetition is allowed, so put in at the
8591+ end a backward relative jump from `b' to before the next
8592+ jump we're going to put in below (which jumps from
8593+ laststart to after this jump).
8594+
8595+ But if we are at the `*' in the exact sequence `.*\n',
8596+ insert an unconditional jump backwards to the .,
8597+ instead of the beginning of the loop. This way we only
8598+ push a failure point once, instead of every time
8599+ through the loop. */
8600+ assert (p - 1 > pattern);
8601+
8602+ /* Allocate the space for the jump. */
8603+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8604+
8605+ /* We know we are not at the first character of the pattern,
8606+ because laststart was nonzero. And we've already
8607+ incremented `p', by the way, to be the character after
8608+ the `*'. Do we have to do something analogous here
8609+ for null bytes, because of RE_DOT_NOT_NULL? */
8610+ if (TRANSLATE (*(p - 2)) == TRANSLATE ('.')
8611+ && zero_times_ok
8612+ && p < pend && TRANSLATE (*p) == TRANSLATE ('\n')
8613+ && !(syntax & RE_DOT_NEWLINE))
8614+ { /* We have .*\n. */
8615+ STORE_JUMP (jump, b, laststart);
8616+ keep_string_p = true;
8617+ }
8618+ else
8619+ /* Anything else. */
8620+ STORE_JUMP (maybe_pop_jump, b, laststart -
8621+ (1 + OFFSET_ADDRESS_SIZE));
8622+
8623+ /* We've added more stuff to the buffer. */
8624+ b += 1 + OFFSET_ADDRESS_SIZE;
8625+ }
8626+
8627+ /* On failure, jump from laststart to b + 3, which will be the
8628+ end of the buffer after this jump is inserted. */
8629+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE' instead of
8630+ 'b + 3'. */
8631+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8632+ INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump
8633+ : on_failure_jump,
8634+ laststart, b + 1 + OFFSET_ADDRESS_SIZE);
8635+ pending_exact = 0;
8636+ b += 1 + OFFSET_ADDRESS_SIZE;
8637+
8638+ if (!zero_times_ok)
8639+ {
8640+ /* At least one repetition is required, so insert a
8641+ `dummy_failure_jump' before the initial
8642+ `on_failure_jump' instruction of the loop. This
8643+ effects a skip over that instruction the first time
8644+ we hit that loop. */
8645+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
8646+ INSERT_JUMP (dummy_failure_jump, laststart, laststart +
8647+ 2 + 2 * OFFSET_ADDRESS_SIZE);
8648+ b += 1 + OFFSET_ADDRESS_SIZE;
8649+ }
8650+ }
8651+ break;
8652+
8653+
8654+ case '.':
8655+ laststart = b;
8656+ BUF_PUSH (anychar);
8657+ break;
8658+
8659+
8660+ case '[':
8661+ {
8662+ boolean had_char_class = false;
8663+#ifdef WCHAR
8664+ CHAR_T range_start = 0xffffffff;
8665+#else
8666+ unsigned int range_start = 0xffffffff;
8667+#endif
8668+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8669+
8670+#ifdef WCHAR
8671+ /* We assume a charset(_not) structure as a wchar_t array.
8672+ charset[0] = (re_opcode_t) charset(_not)
8673+ charset[1] = l (= length of char_classes)
8674+ charset[2] = m (= length of collating_symbols)
8675+ charset[3] = n (= length of equivalence_classes)
8676+ charset[4] = o (= length of char_ranges)
8677+ charset[5] = p (= length of chars)
8678+
8679+ charset[6] = char_class (wctype_t)
8680+ charset[6+CHAR_CLASS_SIZE] = char_class (wctype_t)
8681+ ...
8682+ charset[l+5] = char_class (wctype_t)
8683+
8684+ charset[l+6] = collating_symbol (wchar_t)
8685+ ...
8686+ charset[l+m+5] = collating_symbol (wchar_t)
8687+ ifdef _LIBC we use the index if
8688+ _NL_COLLATE_SYMB_EXTRAMB instead of
8689+ wchar_t string.
8690+
8691+ charset[l+m+6] = equivalence_classes (wchar_t)
8692+ ...
8693+ charset[l+m+n+5] = equivalence_classes (wchar_t)
8694+ ifdef _LIBC we use the index in
8695+ _NL_COLLATE_WEIGHT instead of
8696+ wchar_t string.
8697+
8698+ charset[l+m+n+6] = range_start
8699+ charset[l+m+n+7] = range_end
8700+ ...
8701+ charset[l+m+n+2o+4] = range_start
8702+ charset[l+m+n+2o+5] = range_end
8703+ ifdef _LIBC we use the value looked up
8704+ in _NL_COLLATE_COLLSEQ instead of
8705+ wchar_t character.
8706+
8707+ charset[l+m+n+2o+6] = char
8708+ ...
8709+ charset[l+m+n+2o+p+5] = char
8710+
8711+ */
8712+
8713+ /* We need at least 6 spaces: the opcode, the length of
8714+ char_classes, the length of collating_symbols, the length of
8715+ equivalence_classes, the length of char_ranges, the length of
8716+ chars. */
8717+ GET_BUFFER_SPACE (6);
8718+
8719+ /* Save b as laststart. And We use laststart as the pointer
8720+ to the first element of the charset here.
8721+ In other words, laststart[i] indicates charset[i]. */
8722+ laststart = b;
8723+
8724+ /* We test `*p == '^' twice, instead of using an if
8725+ statement, so we only need one BUF_PUSH. */
8726+ BUF_PUSH (*p == '^' ? charset_not : charset);
8727+ if (*p == '^')
8728+ p++;
8729+
8730+ /* Push the length of char_classes, the length of
8731+ collating_symbols, the length of equivalence_classes, the
8732+ length of char_ranges and the length of chars. */
8733+ BUF_PUSH_3 (0, 0, 0);
8734+ BUF_PUSH_2 (0, 0);
8735+
8736+ /* Remember the first position in the bracket expression. */
8737+ p1 = p;
8738+
8739+ /* charset_not matches newline according to a syntax bit. */
8740+ if ((re_opcode_t) b[-6] == charset_not
8741+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
8742+ {
8743+ BUF_PUSH('\n');
8744+ laststart[5]++; /* Update the length of characters */
8745+ }
8746+
8747+ /* Read in characters and ranges, setting map bits. */
8748+ for (;;)
8749+ {
8750+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8751+
8752+ PATFETCH (c);
8753+
8754+ /* \ might escape characters inside [...] and [^...]. */
8755+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
8756+ {
8757+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
8758+
8759+ PATFETCH (c1);
8760+ BUF_PUSH(c1);
8761+ laststart[5]++; /* Update the length of chars */
8762+ range_start = c1;
8763+ continue;
8764+ }
8765+
8766+ /* Could be the end of the bracket expression. If it's
8767+ not (i.e., when the bracket expression is `[]' so
8768+ far), the ']' character bit gets set way below. */
8769+ if (c == ']' && p != p1 + 1)
8770+ break;
8771+
8772+ /* Look ahead to see if it's a range when the last thing
8773+ was a character class. */
8774+ if (had_char_class && c == '-' && *p != ']')
8775+ FREE_STACK_RETURN (REG_ERANGE);
8776+
8777+ /* Look ahead to see if it's a range when the last thing
8778+ was a character: if this is a hyphen not at the
8779+ beginning or the end of a list, then it's the range
8780+ operator. */
8781+ if (c == '-'
8782+ && !(p - 2 >= pattern && p[-2] == '[')
8783+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
8784+ && *p != ']')
8785+ {
8786+ reg_errcode_t ret;
8787+ /* Allocate the space for range_start and range_end. */
8788+ GET_BUFFER_SPACE (2);
8789+ /* Update the pointer to indicate end of buffer. */
8790+ b += 2;
8791+ ret = wcs_compile_range (range_start, &p, pend, translate,
8792+ syntax, b, laststart);
8793+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
8794+ range_start = 0xffffffff;
8795+ }
8796+ else if (p[0] == '-' && p[1] != ']')
8797+ { /* This handles ranges made up of characters only. */
8798+ reg_errcode_t ret;
8799+
8800+ /* Move past the `-'. */
8801+ PATFETCH (c1);
8802+ /* Allocate the space for range_start and range_end. */
8803+ GET_BUFFER_SPACE (2);
8804+ /* Update the pointer to indicate end of buffer. */
8805+ b += 2;
8806+ ret = wcs_compile_range (c, &p, pend, translate, syntax, b,
8807+ laststart);
8808+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
8809+ range_start = 0xffffffff;
8810+ }
8811+
8812+ /* See if we're at the beginning of a possible character
8813+ class. */
8814+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
8815+ { /* Leave room for the null. */
8816+ char str[CHAR_CLASS_MAX_LENGTH + 1];
8817+
8818+ PATFETCH (c);
8819+ c1 = 0;
8820+
8821+ /* If pattern is `[[:'. */
8822+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8823+
8824+ for (;;)
8825+ {
8826+ PATFETCH (c);
8827+ if ((c == ':' && *p == ']') || p == pend)
8828+ break;
8829+ if (c1 < CHAR_CLASS_MAX_LENGTH)
8830+ str[c1++] = c;
8831+ else
8832+ /* This is in any case an invalid class name. */
8833+ str[0] = '\0';
8834+ }
8835+ str[c1] = '\0';
8836+
8837+ /* If isn't a word bracketed by `[:' and `:]':
8838+ undo the ending character, the letters, and leave
8839+ the leading `:' and `[' (but store them as character). */
8840+ if (c == ':' && *p == ']')
8841+ {
8842+ wctype_t wt;
8843+ uintptr_t alignedp;
8844+
8845+ /* Query the character class as wctype_t. */
8846+ wt = IS_CHAR_CLASS (str);
8847+ if (wt == 0)
8848+ FREE_STACK_RETURN (REG_ECTYPE);
8849+
8850+ /* Throw away the ] at the end of the character
8851+ class. */
8852+ PATFETCH (c);
8853+
8854+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8855+
8856+ /* Allocate the space for character class. */
8857+ GET_BUFFER_SPACE(CHAR_CLASS_SIZE);
8858+ /* Update the pointer to indicate end of buffer. */
8859+ b += CHAR_CLASS_SIZE;
8860+ /* Move data which follow character classes
8861+ not to violate the data. */
8862+ insert_space(CHAR_CLASS_SIZE,
8863+ laststart + 6 + laststart[1],
8864+ b - 1);
8865+ alignedp = ((uintptr_t)(laststart + 6 + laststart[1])
8866+ + __alignof__(wctype_t) - 1)
8867+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
8868+ /* Store the character class. */
8869+ *((wctype_t*)alignedp) = wt;
8870+ /* Update length of char_classes */
8871+ laststart[1] += CHAR_CLASS_SIZE;
8872+
8873+ had_char_class = true;
8874+ }
8875+ else
8876+ {
8877+ c1++;
8878+ while (c1--)
8879+ PATUNFETCH;
8880+ BUF_PUSH ('[');
8881+ BUF_PUSH (':');
8882+ laststart[5] += 2; /* Update the length of characters */
8883+ range_start = ':';
8884+ had_char_class = false;
8885+ }
8886+ }
8887+ else if (syntax & RE_CHAR_CLASSES && c == '[' && (*p == '='
8888+ || *p == '.'))
8889+ {
8890+ CHAR_T str[128]; /* Should be large enough. */
8891+ CHAR_T delim = *p; /* '=' or '.' */
8892+# ifdef _LIBC
8893+ uint32_t nrules =
8894+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
8895+# endif
8896+ PATFETCH (c);
8897+ c1 = 0;
8898+
8899+ /* If pattern is `[[=' or '[[.'. */
8900+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
8901+
8902+ for (;;)
8903+ {
8904+ PATFETCH (c);
8905+ if ((c == delim && *p == ']') || p == pend)
8906+ break;
8907+ if (c1 < sizeof (str) - 1)
8908+ str[c1++] = c;
8909+ else
8910+ /* This is in any case an invalid class name. */
8911+ str[0] = '\0';
8912+ }
8913+ str[c1] = '\0';
8914+
8915+ if (c == delim && *p == ']' && str[0] != '\0')
8916+ {
8917+ unsigned int i, offset;
8918+ /* If we have no collation data we use the default
8919+ collation in which each character is in a class
8920+ by itself. It also means that ASCII is the
8921+ character set and therefore we cannot have character
8922+ with more than one byte in the multibyte
8923+ representation. */
8924+
8925+ /* If not defined _LIBC, we push the name and
8926+ `\0' for the sake of matching performance. */
8927+ int datasize = c1 + 1;
8928+
8929+# ifdef _LIBC
8930+ int32_t idx = 0;
8931+ if (nrules == 0)
8932+# endif
8933+ {
8934+ if (c1 != 1)
8935+ FREE_STACK_RETURN (REG_ECOLLATE);
8936+ }
8937+# ifdef _LIBC
8938+ else
8939+ {
8940+ const int32_t *table;
8941+ const int32_t *weights;
8942+ const int32_t *extra;
8943+ const int32_t *indirect;
8944+ wint_t *cp;
8945+
8946+ /* This #include defines a local function! */
8947+# include <locale/weightwc.h>
8948+
8949+ if(delim == '=')
8950+ {
8951+ /* We push the index for equivalence class. */
8952+ cp = (wint_t*)str;
8953+
8954+ table = (const int32_t *)
8955+ _NL_CURRENT (LC_COLLATE,
8956+ _NL_COLLATE_TABLEWC);
8957+ weights = (const int32_t *)
8958+ _NL_CURRENT (LC_COLLATE,
8959+ _NL_COLLATE_WEIGHTWC);
8960+ extra = (const int32_t *)
8961+ _NL_CURRENT (LC_COLLATE,
8962+ _NL_COLLATE_EXTRAWC);
8963+ indirect = (const int32_t *)
8964+ _NL_CURRENT (LC_COLLATE,
8965+ _NL_COLLATE_INDIRECTWC);
8966+
8967+ idx = findidx ((const wint_t**)&cp, c1);
8968+ if (idx == 0 || cp < (wint_t*) str + c1)
8969+ /* This is no valid character. */
8970+ FREE_STACK_RETURN (REG_ECOLLATE);
8971+
8972+ str[0] = (wchar_t)idx;
8973+ }
8974+ else /* delim == '.' */
8975+ {
8976+ /* We push collation sequence value
8977+ for collating symbol. */
8978+ int32_t table_size;
8979+ const int32_t *symb_table;
8980+ const unsigned char *extra;
8981+ int32_t idx;
8982+ int32_t elem;
8983+ int32_t second;
8984+ int32_t hash;
8985+ char char_str[c1];
8986+
8987+ /* We have to convert the name to a single-byte
8988+ string. This is possible since the names
8989+ consist of ASCII characters and the internal
8990+ representation is UCS4. */
8991+ for (i = 0; i < c1; ++i)
8992+ char_str[i] = str[i];
8993+
8994+ table_size =
8995+ _NL_CURRENT_WORD (LC_COLLATE,
8996+ _NL_COLLATE_SYMB_HASH_SIZEMB);
8997+ symb_table = (const int32_t *)
8998+ _NL_CURRENT (LC_COLLATE,
8999+ _NL_COLLATE_SYMB_TABLEMB);
9000+ extra = (const unsigned char *)
9001+ _NL_CURRENT (LC_COLLATE,
9002+ _NL_COLLATE_SYMB_EXTRAMB);
9003+
9004+ /* Locate the character in the hashing table. */
9005+ hash = elem_hash (char_str, c1);
9006+
9007+ idx = 0;
9008+ elem = hash % table_size;
9009+ second = hash % (table_size - 2);
9010+ while (symb_table[2 * elem] != 0)
9011+ {
9012+ /* First compare the hashing value. */
9013+ if (symb_table[2 * elem] == hash
9014+ && c1 == extra[symb_table[2 * elem + 1]]
9015+ && memcmp (char_str,
9016+ &extra[symb_table[2 * elem + 1]
9017+ + 1], c1) == 0)
9018+ {
9019+ /* Yep, this is the entry. */
9020+ idx = symb_table[2 * elem + 1];
9021+ idx += 1 + extra[idx];
9022+ break;
9023+ }
9024+
9025+ /* Next entry. */
9026+ elem += second;
9027+ }
9028+
9029+ if (symb_table[2 * elem] != 0)
9030+ {
9031+ /* Compute the index of the byte sequence
9032+ in the table. */
9033+ idx += 1 + extra[idx];
9034+ /* Adjust for the alignment. */
9035+ idx = (idx + 3) & ~3;
9036+
9037+ str[0] = (wchar_t) idx + 4;
9038+ }
9039+ else if (symb_table[2 * elem] == 0 && c1 == 1)
9040+ {
9041+ /* No valid character. Match it as a
9042+ single byte character. */
9043+ had_char_class = false;
9044+ BUF_PUSH(str[0]);
9045+ /* Update the length of characters */
9046+ laststart[5]++;
9047+ range_start = str[0];
9048+
9049+ /* Throw away the ] at the end of the
9050+ collating symbol. */
9051+ PATFETCH (c);
9052+ /* exit from the switch block. */
9053+ continue;
9054+ }
9055+ else
9056+ FREE_STACK_RETURN (REG_ECOLLATE);
9057+ }
9058+ datasize = 1;
9059+ }
9060+# endif
9061+ /* Throw away the ] at the end of the equivalence
9062+ class (or collating symbol). */
9063+ PATFETCH (c);
9064+
9065+ /* Allocate the space for the equivalence class
9066+ (or collating symbol) (and '\0' if needed). */
9067+ GET_BUFFER_SPACE(datasize);
9068+ /* Update the pointer to indicate end of buffer. */
9069+ b += datasize;
9070+
9071+ if (delim == '=')
9072+ { /* equivalence class */
9073+ /* Calculate the offset of char_ranges,
9074+ which is next to equivalence_classes. */
9075+ offset = laststart[1] + laststart[2]
9076+ + laststart[3] +6;
9077+ /* Insert space. */
9078+ insert_space(datasize, laststart + offset, b - 1);
9079+
9080+ /* Write the equivalence_class and \0. */
9081+ for (i = 0 ; i < datasize ; i++)
9082+ laststart[offset + i] = str[i];
9083+
9084+ /* Update the length of equivalence_classes. */
9085+ laststart[3] += datasize;
9086+ had_char_class = true;
9087+ }
9088+ else /* delim == '.' */
9089+ { /* collating symbol */
9090+ /* Calculate the offset of the equivalence_classes,
9091+ which is next to collating_symbols. */
9092+ offset = laststart[1] + laststart[2] + 6;
9093+ /* Insert space and write the collationg_symbol
9094+ and \0. */
9095+ insert_space(datasize, laststart + offset, b-1);
9096+ for (i = 0 ; i < datasize ; i++)
9097+ laststart[offset + i] = str[i];
9098+
9099+ /* In re_match_2_internal if range_start < -1, we
9100+ assume -range_start is the offset of the
9101+ collating symbol which is specified as
9102+ the character of the range start. So we assign
9103+ -(laststart[1] + laststart[2] + 6) to
9104+ range_start. */
9105+ range_start = -(laststart[1] + laststart[2] + 6);
9106+ /* Update the length of collating_symbol. */
9107+ laststart[2] += datasize;
9108+ had_char_class = false;
9109+ }
9110+ }
9111+ else
9112+ {
9113+ c1++;
9114+ while (c1--)
9115+ PATUNFETCH;
9116+ BUF_PUSH ('[');
9117+ BUF_PUSH (delim);
9118+ laststart[5] += 2; /* Update the length of characters */
9119+ range_start = delim;
9120+ had_char_class = false;
9121+ }
9122+ }
9123+ else
9124+ {
9125+ had_char_class = false;
9126+ BUF_PUSH(c);
9127+ laststart[5]++; /* Update the length of characters */
9128+ range_start = c;
9129+ }
9130+ }
9131+
9132+#else /* BYTE */
9133+ /* Ensure that we have enough space to push a charset: the
9134+ opcode, the length count, and the bitset; 34 bytes in all. */
9135+ GET_BUFFER_SPACE (34);
9136+
9137+ laststart = b;
9138+
9139+ /* We test `*p == '^' twice, instead of using an if
9140+ statement, so we only need one BUF_PUSH. */
9141+ BUF_PUSH (*p == '^' ? charset_not : charset);
9142+ if (*p == '^')
9143+ p++;
9144+
9145+ /* Remember the first position in the bracket expression. */
9146+ p1 = p;
9147+
9148+ /* Push the number of bytes in the bitmap. */
9149+ BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
9150+
9151+ /* Clear the whole map. */
9152+ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
9153+
9154+ /* charset_not matches newline according to a syntax bit. */
9155+ if ((re_opcode_t) b[-2] == charset_not
9156+ && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
9157+ SET_LIST_BIT ('\n');
9158+
9159+ /* Read in characters and ranges, setting map bits. */
9160+ for (;;)
9161+ {
9162+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9163+
9164+ PATFETCH (c);
9165+
9166+ /* \ might escape characters inside [...] and [^...]. */
9167+ if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\')
9168+ {
9169+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
9170+
9171+ PATFETCH (c1);
9172+ SET_LIST_BIT (c1);
9173+ range_start = c1;
9174+ continue;
9175+ }
9176+
9177+ /* Could be the end of the bracket expression. If it's
9178+ not (i.e., when the bracket expression is `[]' so
9179+ far), the ']' character bit gets set way below. */
9180+ if (c == ']' && p != p1 + 1)
9181+ break;
9182+
9183+ /* Look ahead to see if it's a range when the last thing
9184+ was a character class. */
9185+ if (had_char_class && c == '-' && *p != ']')
9186+ FREE_STACK_RETURN (REG_ERANGE);
9187+
9188+ /* Look ahead to see if it's a range when the last thing
9189+ was a character: if this is a hyphen not at the
9190+ beginning or the end of a list, then it's the range
9191+ operator. */
9192+ if (c == '-'
9193+ && !(p - 2 >= pattern && p[-2] == '[')
9194+ && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^')
9195+ && *p != ']')
9196+ {
9197+ reg_errcode_t ret
9198+ = byte_compile_range (range_start, &p, pend, translate,
9199+ syntax, b);
9200+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
9201+ range_start = 0xffffffff;
9202+ }
9203+
9204+ else if (p[0] == '-' && p[1] != ']')
9205+ { /* This handles ranges made up of characters only. */
9206+ reg_errcode_t ret;
9207+
9208+ /* Move past the `-'. */
9209+ PATFETCH (c1);
9210+
9211+ ret = byte_compile_range (c, &p, pend, translate, syntax, b);
9212+ if (ret != REG_NOERROR) FREE_STACK_RETURN (ret);
9213+ range_start = 0xffffffff;
9214+ }
9215+
9216+ /* See if we're at the beginning of a possible character
9217+ class. */
9218+
9219+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
9220+ { /* Leave room for the null. */
9221+ char str[CHAR_CLASS_MAX_LENGTH + 1];
9222+
9223+ PATFETCH (c);
9224+ c1 = 0;
9225+
9226+ /* If pattern is `[[:'. */
9227+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9228+
9229+ for (;;)
9230+ {
9231+ PATFETCH (c);
9232+ if ((c == ':' && *p == ']') || p == pend)
9233+ break;
9234+ if (((int) c1) < CHAR_CLASS_MAX_LENGTH)
9235+ str[c1++] = c;
9236+ else
9237+ /* This is in any case an invalid class name. */
9238+ str[0] = '\0';
9239+ }
9240+ str[c1] = '\0';
9241+
9242+ /* If isn't a word bracketed by `[:' and `:]':
9243+ undo the ending character, the letters, and leave
9244+ the leading `:' and `[' (but set bits for them). */
9245+ if (c == ':' && *p == ']')
9246+ {
9247+# if WIDE_CHAR_SUPPORT
9248+ boolean is_lower = STREQ (str, "lower");
9249+ boolean is_upper = STREQ (str, "upper");
9250+ wctype_t wt;
9251+ int ch;
9252+
9253+ wt = IS_CHAR_CLASS (str);
9254+ if (wt == 0)
9255+ FREE_STACK_RETURN (REG_ECTYPE);
9256+
9257+ /* Throw away the ] at the end of the character
9258+ class. */
9259+ PATFETCH (c);
9260+
9261+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9262+
9263+ for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
9264+ {
9265+# ifdef _LIBC
9266+ if (__iswctype (__btowc (ch), wt))
9267+ SET_LIST_BIT (ch);
9268+# else
9269+ if (iswctype (btowc (ch), wt))
9270+ SET_LIST_BIT (ch);
9271+# endif
9272+
9273+ if (translate && (is_upper || is_lower)
9274+ && (ISUPPER (ch) || ISLOWER (ch)))
9275+ SET_LIST_BIT (ch);
9276+ }
9277+
9278+ had_char_class = true;
9279+# else
9280+ int ch;
9281+ boolean is_alnum = STREQ (str, "alnum");
9282+ boolean is_alpha = STREQ (str, "alpha");
9283+ boolean is_blank = STREQ (str, "blank");
9284+ boolean is_cntrl = STREQ (str, "cntrl");
9285+ boolean is_digit = STREQ (str, "digit");
9286+ boolean is_graph = STREQ (str, "graph");
9287+ boolean is_lower = STREQ (str, "lower");
9288+ boolean is_print = STREQ (str, "print");
9289+ boolean is_punct = STREQ (str, "punct");
9290+ boolean is_space = STREQ (str, "space");
9291+ boolean is_upper = STREQ (str, "upper");
9292+ boolean is_xdigit = STREQ (str, "xdigit");
9293+
9294+ if (!IS_CHAR_CLASS (str))
9295+ FREE_STACK_RETURN (REG_ECTYPE);
9296+
9297+ /* Throw away the ] at the end of the character
9298+ class. */
9299+ PATFETCH (c);
9300+
9301+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9302+
9303+ for (ch = 0; ch < 1 << BYTEWIDTH; ch++)
9304+ {
9305+ /* This was split into 3 if's to
9306+ avoid an arbitrary limit in some compiler. */
9307+ if ( (is_alnum && ISALNUM (ch))
9308+ || (is_alpha && ISALPHA (ch))
9309+ || (is_blank && ISBLANK (ch))
9310+ || (is_cntrl && ISCNTRL (ch)))
9311+ SET_LIST_BIT (ch);
9312+ if ( (is_digit && ISDIGIT (ch))
9313+ || (is_graph && ISGRAPH (ch))
9314+ || (is_lower && ISLOWER (ch))
9315+ || (is_print && ISPRINT (ch)))
9316+ SET_LIST_BIT (ch);
9317+ if ( (is_punct && ISPUNCT (ch))
9318+ || (is_space && ISSPACE (ch))
9319+ || (is_upper && ISUPPER (ch))
9320+ || (is_xdigit && ISXDIGIT (ch)))
9321+ SET_LIST_BIT (ch);
9322+ if ( translate && (is_upper || is_lower)
9323+ && (ISUPPER (ch) || ISLOWER (ch)))
9324+ SET_LIST_BIT (ch);
9325+ }
9326+ had_char_class = true;
9327+# endif /* libc || wctype.h */
9328+ }
9329+ else
9330+ {
9331+ c1++;
9332+ while (c1--)
9333+ PATUNFETCH;
9334+ SET_LIST_BIT ('[');
9335+ SET_LIST_BIT (':');
9336+ range_start = ':';
9337+ had_char_class = false;
9338+ }
9339+ }
9340+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '=')
9341+ {
9342+ unsigned char str[MB_LEN_MAX + 1];
9343+# ifdef _LIBC
9344+ uint32_t nrules =
9345+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
9346+# endif
9347+
9348+ PATFETCH (c);
9349+ c1 = 0;
9350+
9351+ /* If pattern is `[[='. */
9352+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9353+
9354+ for (;;)
9355+ {
9356+ PATFETCH (c);
9357+ if ((c == '=' && *p == ']') || p == pend)
9358+ break;
9359+ if (c1 < MB_LEN_MAX)
9360+ str[c1++] = c;
9361+ else
9362+ /* This is in any case an invalid class name. */
9363+ str[0] = '\0';
9364+ }
9365+ str[c1] = '\0';
9366+
9367+ if (c == '=' && *p == ']' && str[0] != '\0')
9368+ {
9369+ /* If we have no collation data we use the default
9370+ collation in which each character is in a class
9371+ by itself. It also means that ASCII is the
9372+ character set and therefore we cannot have character
9373+ with more than one byte in the multibyte
9374+ representation. */
9375+# ifdef _LIBC
9376+ if (nrules == 0)
9377+# endif
9378+ {
9379+ if (c1 != 1)
9380+ FREE_STACK_RETURN (REG_ECOLLATE);
9381+
9382+ /* Throw away the ] at the end of the equivalence
9383+ class. */
9384+ PATFETCH (c);
9385+
9386+ /* Set the bit for the character. */
9387+ SET_LIST_BIT (str[0]);
9388+ }
9389+# ifdef _LIBC
9390+ else
9391+ {
9392+ /* Try to match the byte sequence in `str' against
9393+ those known to the collate implementation.
9394+ First find out whether the bytes in `str' are
9395+ actually from exactly one character. */
9396+ const int32_t *table;
9397+ const unsigned char *weights;
9398+ const unsigned char *extra;
9399+ const int32_t *indirect;
9400+ int32_t idx;
9401+ const unsigned char *cp = str;
9402+ int ch;
9403+
9404+ /* This #include defines a local function! */
9405+# include <locale/weight.h>
9406+
9407+ table = (const int32_t *)
9408+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
9409+ weights = (const unsigned char *)
9410+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
9411+ extra = (const unsigned char *)
9412+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
9413+ indirect = (const int32_t *)
9414+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
9415+
9416+ idx = findidx (&cp, c1);
9417+ if (idx == 0 || cp < str + c1)
9418+ /* This is no valid character. */
9419+ FREE_STACK_RETURN (REG_ECOLLATE);
9420+
9421+ /* Throw away the ] at the end of the equivalence
9422+ class. */
9423+ PATFETCH (c);
9424+
9425+ /* Now we have to go throught the whole table
9426+ and find all characters which have the same
9427+ first level weight.
9428+
9429+ XXX Note that this is not entirely correct.
9430+ we would have to match multibyte sequences
9431+ but this is not possible with the current
9432+ implementation. */
9433+ for (ch = 1; ch < 256; ++ch)
9434+ /* XXX This test would have to be changed if we
9435+ would allow matching multibyte sequences. */
9436+ if (table[ch] > 0)
9437+ {
9438+ int32_t idx2 = table[ch];
9439+ size_t len = weights[idx2];
9440+
9441+ /* Test whether the lenghts match. */
9442+ if (weights[idx] == len)
9443+ {
9444+ /* They do. New compare the bytes of
9445+ the weight. */
9446+ size_t cnt = 0;
9447+
9448+ while (cnt < len
9449+ && (weights[idx + 1 + cnt]
9450+ == weights[idx2 + 1 + cnt]))
9451+ ++cnt;
9452+
9453+ if (cnt == len)
9454+ /* They match. Mark the character as
9455+ acceptable. */
9456+ SET_LIST_BIT (ch);
9457+ }
9458+ }
9459+ }
9460+# endif
9461+ had_char_class = true;
9462+ }
9463+ else
9464+ {
9465+ c1++;
9466+ while (c1--)
9467+ PATUNFETCH;
9468+ SET_LIST_BIT ('[');
9469+ SET_LIST_BIT ('=');
9470+ range_start = '=';
9471+ had_char_class = false;
9472+ }
9473+ }
9474+ else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == '.')
9475+ {
9476+ unsigned char str[128]; /* Should be large enough. */
9477+# ifdef _LIBC
9478+ uint32_t nrules =
9479+ _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
9480+# endif
9481+
9482+ PATFETCH (c);
9483+ c1 = 0;
9484+
9485+ /* If pattern is `[[.'. */
9486+ if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
9487+
9488+ for (;;)
9489+ {
9490+ PATFETCH (c);
9491+ if ((c == '.' && *p == ']') || p == pend)
9492+ break;
9493+ if (c1 < sizeof (str))
9494+ str[c1++] = c;
9495+ else
9496+ /* This is in any case an invalid class name. */
9497+ str[0] = '\0';
9498+ }
9499+ str[c1] = '\0';
9500+
9501+ if (c == '.' && *p == ']' && str[0] != '\0')
9502+ {
9503+ /* If we have no collation data we use the default
9504+ collation in which each character is the name
9505+ for its own class which contains only the one
9506+ character. It also means that ASCII is the
9507+ character set and therefore we cannot have character
9508+ with more than one byte in the multibyte
9509+ representation. */
9510+# ifdef _LIBC
9511+ if (nrules == 0)
9512+# endif
9513+ {
9514+ if (c1 != 1)
9515+ FREE_STACK_RETURN (REG_ECOLLATE);
9516+
9517+ /* Throw away the ] at the end of the equivalence
9518+ class. */
9519+ PATFETCH (c);
9520+
9521+ /* Set the bit for the character. */
9522+ SET_LIST_BIT (str[0]);
9523+ range_start = ((const unsigned char *) str)[0];
9524+ }
9525+# ifdef _LIBC
9526+ else
9527+ {
9528+ /* Try to match the byte sequence in `str' against
9529+ those known to the collate implementation.
9530+ First find out whether the bytes in `str' are
9531+ actually from exactly one character. */
9532+ int32_t table_size;
9533+ const int32_t *symb_table;
9534+ const unsigned char *extra;
9535+ int32_t idx;
9536+ int32_t elem;
9537+ int32_t second;
9538+ int32_t hash;
9539+
9540+ table_size =
9541+ _NL_CURRENT_WORD (LC_COLLATE,
9542+ _NL_COLLATE_SYMB_HASH_SIZEMB);
9543+ symb_table = (const int32_t *)
9544+ _NL_CURRENT (LC_COLLATE,
9545+ _NL_COLLATE_SYMB_TABLEMB);
9546+ extra = (const unsigned char *)
9547+ _NL_CURRENT (LC_COLLATE,
9548+ _NL_COLLATE_SYMB_EXTRAMB);
9549+
9550+ /* Locate the character in the hashing table. */
9551+ hash = elem_hash ((const char *) str, c1);
9552+
9553+ idx = 0;
9554+ elem = hash % table_size;
9555+ second = hash % (table_size - 2);
9556+ while (symb_table[2 * elem] != 0)
9557+ {
9558+ /* First compare the hashing value. */
9559+ if (symb_table[2 * elem] == hash
9560+ && c1 == extra[symb_table[2 * elem + 1]]
9561+ && memcmp (str,
9562+ &extra[symb_table[2 * elem + 1]
9563+ + 1],
9564+ c1) == 0)
9565+ {
9566+ /* Yep, this is the entry. */
9567+ idx = symb_table[2 * elem + 1];
9568+ idx += 1 + extra[idx];
9569+ break;
9570+ }
9571+
9572+ /* Next entry. */
9573+ elem += second;
9574+ }
9575+
9576+ if (symb_table[2 * elem] == 0)
9577+ /* This is no valid character. */
9578+ FREE_STACK_RETURN (REG_ECOLLATE);
9579+
9580+ /* Throw away the ] at the end of the equivalence
9581+ class. */
9582+ PATFETCH (c);
9583+
9584+ /* Now add the multibyte character(s) we found
9585+ to the accept list.
9586+
9587+ XXX Note that this is not entirely correct.
9588+ we would have to match multibyte sequences
9589+ but this is not possible with the current
9590+ implementation. Also, we have to match
9591+ collating symbols, which expand to more than
9592+ one file, as a whole and not allow the
9593+ individual bytes. */
9594+ c1 = extra[idx++];
9595+ if (c1 == 1)
9596+ range_start = extra[idx];
9597+ while (c1-- > 0)
9598+ {
9599+ SET_LIST_BIT (extra[idx]);
9600+ ++idx;
9601+ }
9602+ }
9603+# endif
9604+ had_char_class = false;
9605+ }
9606+ else
9607+ {
9608+ c1++;
9609+ while (c1--)
9610+ PATUNFETCH;
9611+ SET_LIST_BIT ('[');
9612+ SET_LIST_BIT ('.');
9613+ range_start = '.';
9614+ had_char_class = false;
9615+ }
9616+ }
9617+ else
9618+ {
9619+ had_char_class = false;
9620+ SET_LIST_BIT (c);
9621+ range_start = c;
9622+ }
9623+ }
9624+
9625+ /* Discard any (non)matching list bytes that are all 0 at the
9626+ end of the map. Decrease the map-length byte too. */
9627+ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
9628+ b[-1]--;
9629+ b += b[-1];
9630+#endif /* WCHAR */
9631+ }
9632+ break;
9633+
9634+
9635+ case '(':
9636+ if (syntax & RE_NO_BK_PARENS)
9637+ goto handle_open;
9638+ else
9639+ goto normal_char;
9640+
9641+
9642+ case ')':
9643+ if (syntax & RE_NO_BK_PARENS)
9644+ goto handle_close;
9645+ else
9646+ goto normal_char;
9647+
9648+
9649+ case '\n':
9650+ if (syntax & RE_NEWLINE_ALT)
9651+ goto handle_alt;
9652+ else
9653+ goto normal_char;
9654+
9655+
9656+ case '|':
9657+ if (syntax & RE_NO_BK_VBAR)
9658+ goto handle_alt;
9659+ else
9660+ goto normal_char;
9661+
9662+
9663+ case '{':
9664+ if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES)
9665+ goto handle_interval;
9666+ else
9667+ goto normal_char;
9668+
9669+
9670+ case '\\':
9671+ if (p == pend) FREE_STACK_RETURN (REG_EESCAPE);
9672+
9673+ /* Do not translate the character after the \, so that we can
9674+ distinguish, e.g., \B from \b, even if we normally would
9675+ translate, e.g., B to b. */
9676+ PATFETCH_RAW (c);
9677+
9678+ switch (c)
9679+ {
9680+ case '(':
9681+ if (syntax & RE_NO_BK_PARENS)
9682+ goto normal_backslash;
9683+
9684+ handle_open:
9685+ bufp->re_nsub++;
9686+ regnum++;
9687+
9688+ if (COMPILE_STACK_FULL)
9689+ {
9690+ RETALLOC (compile_stack.stack, compile_stack.size << 1,
9691+ compile_stack_elt_t);
9692+ if (compile_stack.stack == NULL) return REG_ESPACE;
9693+
9694+ compile_stack.size <<= 1;
9695+ }
9696+
9697+ /* These are the values to restore when we hit end of this
9698+ group. They are all relative offsets, so that if the
9699+ whole pattern moves because of realloc, they will still
9700+ be valid. */
9701+ COMPILE_STACK_TOP.begalt_offset = begalt - COMPILED_BUFFER_VAR;
9702+ COMPILE_STACK_TOP.fixup_alt_jump
9703+ = fixup_alt_jump ? fixup_alt_jump - COMPILED_BUFFER_VAR + 1 : 0;
9704+ COMPILE_STACK_TOP.laststart_offset = b - COMPILED_BUFFER_VAR;
9705+ COMPILE_STACK_TOP.regnum = regnum;
9706+
9707+ /* We will eventually replace the 0 with the number of
9708+ groups inner to this one. But do not push a
9709+ start_memory for groups beyond the last one we can
9710+ represent in the compiled pattern. */
9711+ if (regnum <= MAX_REGNUM)
9712+ {
9713+ COMPILE_STACK_TOP.inner_group_offset = b
9714+ - COMPILED_BUFFER_VAR + 2;
9715+ BUF_PUSH_3 (start_memory, regnum, 0);
9716+ }
9717+
9718+ compile_stack.avail++;
9719+
9720+ fixup_alt_jump = 0;
9721+ laststart = 0;
9722+ begalt = b;
9723+ /* If we've reached MAX_REGNUM groups, then this open
9724+ won't actually generate any code, so we'll have to
9725+ clear pending_exact explicitly. */
9726+ pending_exact = 0;
9727+ break;
9728+
9729+
9730+ case ')':
9731+ if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
9732+
9733+ if (COMPILE_STACK_EMPTY)
9734+ {
9735+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
9736+ goto normal_backslash;
9737+ else
9738+ FREE_STACK_RETURN (REG_ERPAREN);
9739+ }
9740+
9741+ handle_close:
9742+ if (fixup_alt_jump)
9743+ { /* Push a dummy failure point at the end of the
9744+ alternative for a possible future
9745+ `pop_failure_jump' to pop. See comments at
9746+ `push_dummy_failure' in `re_match_2'. */
9747+ BUF_PUSH (push_dummy_failure);
9748+
9749+ /* We allocated space for this jump when we assigned
9750+ to `fixup_alt_jump', in the `handle_alt' case below. */
9751+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1);
9752+ }
9753+
9754+ /* See similar code for backslashed left paren above. */
9755+ if (COMPILE_STACK_EMPTY)
9756+ {
9757+ if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
9758+ goto normal_char;
9759+ else
9760+ FREE_STACK_RETURN (REG_ERPAREN);
9761+ }
9762+
9763+ /* Since we just checked for an empty stack above, this
9764+ ``can't happen''. */
9765+ assert (compile_stack.avail != 0);
9766+ {
9767+ /* We don't just want to restore into `regnum', because
9768+ later groups should continue to be numbered higher,
9769+ as in `(ab)c(de)' -- the second group is #2. */
9770+ regnum_t this_group_regnum;
9771+
9772+ compile_stack.avail--;
9773+ begalt = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.begalt_offset;
9774+ fixup_alt_jump
9775+ = COMPILE_STACK_TOP.fixup_alt_jump
9776+ ? COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.fixup_alt_jump - 1
9777+ : 0;
9778+ laststart = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.laststart_offset;
9779+ this_group_regnum = COMPILE_STACK_TOP.regnum;
9780+ /* If we've reached MAX_REGNUM groups, then this open
9781+ won't actually generate any code, so we'll have to
9782+ clear pending_exact explicitly. */
9783+ pending_exact = 0;
9784+
9785+ /* We're at the end of the group, so now we know how many
9786+ groups were inside this one. */
9787+ if (this_group_regnum <= MAX_REGNUM)
9788+ {
9789+ UCHAR_T *inner_group_loc
9790+ = COMPILED_BUFFER_VAR + COMPILE_STACK_TOP.inner_group_offset;
9791+
9792+ *inner_group_loc = regnum - this_group_regnum;
9793+ BUF_PUSH_3 (stop_memory, this_group_regnum,
9794+ regnum - this_group_regnum);
9795+ }
9796+ }
9797+ break;
9798+
9799+
9800+ case '|': /* `\|'. */
9801+ if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR)
9802+ goto normal_backslash;
9803+ handle_alt:
9804+ if (syntax & RE_LIMITED_OPS)
9805+ goto normal_char;
9806+
9807+ /* Insert before the previous alternative a jump which
9808+ jumps to this alternative if the former fails. */
9809+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9810+ INSERT_JUMP (on_failure_jump, begalt,
9811+ b + 2 + 2 * OFFSET_ADDRESS_SIZE);
9812+ pending_exact = 0;
9813+ b += 1 + OFFSET_ADDRESS_SIZE;
9814+
9815+ /* The alternative before this one has a jump after it
9816+ which gets executed if it gets matched. Adjust that
9817+ jump so it will jump to this alternative's analogous
9818+ jump (put in below, which in turn will jump to the next
9819+ (if any) alternative's such jump, etc.). The last such
9820+ jump jumps to the correct final destination. A picture:
9821+ _____ _____
9822+ | | | |
9823+ | v | v
9824+ a | b | c
9825+
9826+ If we are at `b', then fixup_alt_jump right now points to a
9827+ three-byte space after `a'. We'll put in the jump, set
9828+ fixup_alt_jump to right after `b', and leave behind three
9829+ bytes which we'll fill in when we get to after `c'. */
9830+
9831+ if (fixup_alt_jump)
9832+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
9833+
9834+ /* Mark and leave space for a jump after this alternative,
9835+ to be filled in later either by next alternative or
9836+ when know we're at the end of a series of alternatives. */
9837+ fixup_alt_jump = b;
9838+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9839+ b += 1 + OFFSET_ADDRESS_SIZE;
9840+
9841+ laststart = 0;
9842+ begalt = b;
9843+ break;
9844+
9845+
9846+ case '{':
9847+ /* If \{ is a literal. */
9848+ if (!(syntax & RE_INTERVALS)
9849+ /* If we're at `\{' and it's not the open-interval
9850+ operator. */
9851+ || (syntax & RE_NO_BK_BRACES))
9852+ goto normal_backslash;
9853+
9854+ handle_interval:
9855+ {
9856+ /* If got here, then the syntax allows intervals. */
9857+
9858+ /* At least (most) this many matches must be made. */
9859+ int lower_bound = -1, upper_bound = -1;
9860+
9861+ /* Place in the uncompiled pattern (i.e., just after
9862+ the '{') to go back to if the interval is invalid. */
9863+ const CHAR_T *beg_interval = p;
9864+
9865+ if (p == pend)
9866+ goto invalid_interval;
9867+
9868+ GET_UNSIGNED_NUMBER (lower_bound);
9869+
9870+ if (c == ',')
9871+ {
9872+ GET_UNSIGNED_NUMBER (upper_bound);
9873+ if (upper_bound < 0)
9874+ upper_bound = RE_DUP_MAX;
9875+ }
9876+ else
9877+ /* Interval such as `{1}' => match exactly once. */
9878+ upper_bound = lower_bound;
9879+
9880+ if (! (0 <= lower_bound && lower_bound <= upper_bound))
9881+ goto invalid_interval;
9882+
9883+ if (!(syntax & RE_NO_BK_BRACES))
9884+ {
9885+ if (c != '\\' || p == pend)
9886+ goto invalid_interval;
9887+ PATFETCH (c);
9888+ }
9889+
9890+ if (c != '}')
9891+ goto invalid_interval;
9892+
9893+ /* If it's invalid to have no preceding re. */
9894+ if (!laststart)
9895+ {
9896+ if (syntax & RE_CONTEXT_INVALID_OPS
9897+ && !(syntax & RE_INVALID_INTERVAL_ORD))
9898+ FREE_STACK_RETURN (REG_BADRPT);
9899+ else if (syntax & RE_CONTEXT_INDEP_OPS)
9900+ laststart = b;
9901+ else
9902+ goto unfetch_interval;
9903+ }
9904+
9905+ /* We just parsed a valid interval. */
9906+
9907+ if (RE_DUP_MAX < upper_bound)
9908+ FREE_STACK_RETURN (REG_BADBR);
9909+
9910+ /* If the upper bound is zero, don't want to succeed at
9911+ all; jump from `laststart' to `b + 3', which will be
9912+ the end of the buffer after we insert the jump. */
9913+ /* ifdef WCHAR, 'b + 1 + OFFSET_ADDRESS_SIZE'
9914+ instead of 'b + 3'. */
9915+ if (upper_bound == 0)
9916+ {
9917+ GET_BUFFER_SPACE (1 + OFFSET_ADDRESS_SIZE);
9918+ INSERT_JUMP (jump, laststart, b + 1
9919+ + OFFSET_ADDRESS_SIZE);
9920+ b += 1 + OFFSET_ADDRESS_SIZE;
9921+ }
9922+
9923+ /* Otherwise, we have a nontrivial interval. When
9924+ we're all done, the pattern will look like:
9925+ set_number_at <jump count> <upper bound>
9926+ set_number_at <succeed_n count> <lower bound>
9927+ succeed_n <after jump addr> <succeed_n count>
9928+ <body of loop>
9929+ jump_n <succeed_n addr> <jump count>
9930+ (The upper bound and `jump_n' are omitted if
9931+ `upper_bound' is 1, though.) */
9932+ else
9933+ { /* If the upper bound is > 1, we need to insert
9934+ more at the end of the loop. */
9935+ unsigned nbytes = 2 + 4 * OFFSET_ADDRESS_SIZE +
9936+ (upper_bound > 1) * (2 + 4 * OFFSET_ADDRESS_SIZE);
9937+
9938+ GET_BUFFER_SPACE (nbytes);
9939+
9940+ /* Initialize lower bound of the `succeed_n', even
9941+ though it will be set during matching by its
9942+ attendant `set_number_at' (inserted next),
9943+ because `re_compile_fastmap' needs to know.
9944+ Jump to the `jump_n' we might insert below. */
9945+ INSERT_JUMP2 (succeed_n, laststart,
9946+ b + 1 + 2 * OFFSET_ADDRESS_SIZE
9947+ + (upper_bound > 1) * (1 + 2 * OFFSET_ADDRESS_SIZE)
9948+ , lower_bound);
9949+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9950+
9951+ /* Code to initialize the lower bound. Insert
9952+ before the `succeed_n'. The `5' is the last two
9953+ bytes of this `set_number_at', plus 3 bytes of
9954+ the following `succeed_n'. */
9955+ /* ifdef WCHAR, The '1+2*OFFSET_ADDRESS_SIZE'
9956+ is the 'set_number_at', plus '1+OFFSET_ADDRESS_SIZE'
9957+ of the following `succeed_n'. */
9958+ PREFIX(insert_op2) (set_number_at, laststart, 1
9959+ + 2 * OFFSET_ADDRESS_SIZE, lower_bound, b);
9960+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9961+
9962+ if (upper_bound > 1)
9963+ { /* More than one repetition is allowed, so
9964+ append a backward jump to the `succeed_n'
9965+ that starts this interval.
9966+
9967+ When we've reached this during matching,
9968+ we'll have matched the interval once, so
9969+ jump back only `upper_bound - 1' times. */
9970+ STORE_JUMP2 (jump_n, b, laststart
9971+ + 2 * OFFSET_ADDRESS_SIZE + 1,
9972+ upper_bound - 1);
9973+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9974+
9975+ /* The location we want to set is the second
9976+ parameter of the `jump_n'; that is `b-2' as
9977+ an absolute address. `laststart' will be
9978+ the `set_number_at' we're about to insert;
9979+ `laststart+3' the number to set, the source
9980+ for the relative address. But we are
9981+ inserting into the middle of the pattern --
9982+ so everything is getting moved up by 5.
9983+ Conclusion: (b - 2) - (laststart + 3) + 5,
9984+ i.e., b - laststart.
9985+
9986+ We insert this at the beginning of the loop
9987+ so that if we fail during matching, we'll
9988+ reinitialize the bounds. */
9989+ PREFIX(insert_op2) (set_number_at, laststart,
9990+ b - laststart,
9991+ upper_bound - 1, b);
9992+ b += 1 + 2 * OFFSET_ADDRESS_SIZE;
9993+ }
9994+ }
9995+ pending_exact = 0;
9996+ break;
9997+
9998+ invalid_interval:
9999+ if (!(syntax & RE_INVALID_INTERVAL_ORD))
10000+ FREE_STACK_RETURN (p == pend ? REG_EBRACE : REG_BADBR);
10001+ unfetch_interval:
10002+ /* Match the characters as literals. */
10003+ p = beg_interval;
10004+ c = '{';
10005+ if (syntax & RE_NO_BK_BRACES)
10006+ goto normal_char;
10007+ else
10008+ goto normal_backslash;
10009+ }
10010+
10011+#ifdef emacs
10012+ /* There is no way to specify the before_dot and after_dot
10013+ operators. rms says this is ok. --karl */
10014+ case '=':
10015+ BUF_PUSH (at_dot);
10016+ break;
10017+
10018+ case 's':
10019+ laststart = b;
10020+ PATFETCH (c);
10021+ BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]);
10022+ break;
10023+
10024+ case 'S':
10025+ laststart = b;
10026+ PATFETCH (c);
10027+ BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]);
10028+ break;
10029+#endif /* emacs */
10030+
10031+
10032+ case 'w':
10033+ if (syntax & RE_NO_GNU_OPS)
10034+ goto normal_char;
10035+ laststart = b;
10036+ BUF_PUSH (wordchar);
10037+ break;
10038+
10039+
10040+ case 'W':
10041+ if (syntax & RE_NO_GNU_OPS)
10042+ goto normal_char;
10043+ laststart = b;
10044+ BUF_PUSH (notwordchar);
10045+ break;
10046+
10047+
10048+ case '<':
10049+ if (syntax & RE_NO_GNU_OPS)
10050+ goto normal_char;
10051+ BUF_PUSH (wordbeg);
10052+ break;
10053+
10054+ case '>':
10055+ if (syntax & RE_NO_GNU_OPS)
10056+ goto normal_char;
10057+ BUF_PUSH (wordend);
10058+ break;
10059+
10060+ case 'b':
10061+ if (syntax & RE_NO_GNU_OPS)
10062+ goto normal_char;
10063+ BUF_PUSH (wordbound);
10064+ break;
10065+
10066+ case 'B':
10067+ if (syntax & RE_NO_GNU_OPS)
10068+ goto normal_char;
10069+ BUF_PUSH (notwordbound);
10070+ break;
10071+
10072+ case '`':
10073+ if (syntax & RE_NO_GNU_OPS)
10074+ goto normal_char;
10075+ BUF_PUSH (begbuf);
10076+ break;
10077+
10078+ case '\'':
10079+ if (syntax & RE_NO_GNU_OPS)
10080+ goto normal_char;
10081+ BUF_PUSH (endbuf);
10082+ break;
10083+
10084+ case '1': case '2': case '3': case '4': case '5':
10085+ case '6': case '7': case '8': case '9':
10086+ if (syntax & RE_NO_BK_REFS)
10087+ goto normal_char;
10088+
10089+ c1 = c - '0';
10090+
10091+ if (c1 > regnum)
10092+ FREE_STACK_RETURN (REG_ESUBREG);
10093+
10094+ /* Can't back reference to a subexpression if inside of it. */
10095+ if (group_in_compile_stack (compile_stack, (regnum_t) c1))
10096+ goto normal_char;
10097+
10098+ laststart = b;
10099+ BUF_PUSH_2 (duplicate, c1);
10100+ break;
10101+
10102+
10103+ case '+':
10104+ case '?':
10105+ if (syntax & RE_BK_PLUS_QM)
10106+ goto handle_plus;
10107+ else
10108+ goto normal_backslash;
10109+
10110+ default:
10111+ normal_backslash:
10112+ /* You might think it would be useful for \ to mean
10113+ not to translate; but if we don't translate it
10114+ it will never match anything. */
10115+ c = TRANSLATE (c);
10116+ goto normal_char;
10117+ }
10118+ break;
10119+
10120+
10121+ default:
10122+ /* Expects the character in `c'. */
10123+ normal_char:
10124+ /* If no exactn currently being built. */
10125+ if (!pending_exact
10126+#ifdef WCHAR
10127+ /* If last exactn handle binary(or character) and
10128+ new exactn handle character(or binary). */
10129+ || is_exactn_bin != is_binary[p - 1 - pattern]
10130+#endif /* WCHAR */
10131+
10132+ /* If last exactn not at current position. */
10133+ || pending_exact + *pending_exact + 1 != b
10134+
10135+ /* We have only one byte following the exactn for the count. */
10136+ || *pending_exact == (1 << BYTEWIDTH) - 1
10137+
10138+ /* If followed by a repetition operator. */
10139+ || *p == '*' || *p == '^'
10140+ || ((syntax & RE_BK_PLUS_QM)
10141+ ? *p == '\\' && (p[1] == '+' || p[1] == '?')
10142+ : (*p == '+' || *p == '?'))
10143+ || ((syntax & RE_INTERVALS)
10144+ && ((syntax & RE_NO_BK_BRACES)
10145+ ? *p == '{'
10146+ : (p[0] == '\\' && p[1] == '{'))))
10147+ {
10148+ /* Start building a new exactn. */
10149+
10150+ laststart = b;
10151+
10152+#ifdef WCHAR
10153+ /* Is this exactn binary data or character? */
10154+ is_exactn_bin = is_binary[p - 1 - pattern];
10155+ if (is_exactn_bin)
10156+ BUF_PUSH_2 (exactn_bin, 0);
10157+ else
10158+ BUF_PUSH_2 (exactn, 0);
10159+#else
10160+ BUF_PUSH_2 (exactn, 0);
10161+#endif /* WCHAR */
10162+ pending_exact = b - 1;
10163+ }
10164+
10165+ BUF_PUSH (c);
10166+ (*pending_exact)++;
10167+ break;
10168+ } /* switch (c) */
10169+ } /* while p != pend */
10170+
10171+
10172+ /* Through the pattern now. */
10173+
10174+ if (fixup_alt_jump)
10175+ STORE_JUMP (jump_past_alt, fixup_alt_jump, b);
10176+
10177+ if (!COMPILE_STACK_EMPTY)
10178+ FREE_STACK_RETURN (REG_EPAREN);
10179+
10180+ /* If we don't want backtracking, force success
10181+ the first time we reach the end of the compiled pattern. */
10182+ if (syntax & RE_NO_POSIX_BACKTRACKING)
10183+ BUF_PUSH (succeed);
10184+
10185+#ifdef WCHAR
10186+ free (pattern);
10187+ free (mbs_offset);
10188+ free (is_binary);
10189+#endif
10190+ free (compile_stack.stack);
10191+
10192+ /* We have succeeded; set the length of the buffer. */
10193+#ifdef WCHAR
10194+ bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR;
10195+#else
10196+ bufp->used = b - bufp->buffer;
10197+#endif
10198+
10199+#ifdef DEBUG
10200+ if (debug)
10201+ {
10202+ DEBUG_PRINT1 ("\nCompiled pattern: \n");
10203+ PREFIX(print_compiled_pattern) (bufp);
10204+ }
10205+#endif /* DEBUG */
10206+
10207+#ifndef MATCH_MAY_ALLOCATE
10208+ /* Initialize the failure stack to the largest possible stack. This
10209+ isn't necessary unless we're trying to avoid calling alloca in
10210+ the search and match routines. */
10211+ {
10212+ int num_regs = bufp->re_nsub + 1;
10213+
10214+ /* Since DOUBLE_FAIL_STACK refuses to double only if the current size
10215+ is strictly greater than re_max_failures, the largest possible stack
10216+ is 2 * re_max_failures failure points. */
10217+ if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS))
10218+ {
10219+ fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS);
10220+
10221+# ifdef emacs
10222+ if (! fail_stack.stack)
10223+ fail_stack.stack
10224+ = (PREFIX(fail_stack_elt_t) *) xmalloc (fail_stack.size
10225+ * sizeof (PREFIX(fail_stack_elt_t)));
10226+ else
10227+ fail_stack.stack
10228+ = (PREFIX(fail_stack_elt_t) *) xrealloc (fail_stack.stack,
10229+ (fail_stack.size
10230+ * sizeof (PREFIX(fail_stack_elt_t))));
10231+# else /* not emacs */
10232+ if (! fail_stack.stack)
10233+ fail_stack.stack
10234+ = (PREFIX(fail_stack_elt_t) *) malloc (fail_stack.size
10235+ * sizeof (PREFIX(fail_stack_elt_t)));
10236+ else
10237+ fail_stack.stack
10238+ = (PREFIX(fail_stack_elt_t) *) realloc (fail_stack.stack,
10239+ (fail_stack.size
10240+ * sizeof (PREFIX(fail_stack_elt_t))));
10241+# endif /* not emacs */
10242+ }
10243+
10244+ PREFIX(regex_grow_registers) (num_regs);
10245+ }
10246+#endif /* not MATCH_MAY_ALLOCATE */
10247+
10248+ return REG_NOERROR;
10249+} /* regex_compile */
10250+
10251+/* Subroutines for `regex_compile'. */
10252+
10253+/* Store OP at LOC followed by two-byte integer parameter ARG. */
10254+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10255+
10256+static void
10257+PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg)
10258+{
10259+ *loc = (UCHAR_T) op;
10260+ STORE_NUMBER (loc + 1, arg);
10261+}
10262+
10263+
10264+/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */
10265+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10266+
10267+static void
10268+PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, int arg1, int arg2)
10269+{
10270+ *loc = (UCHAR_T) op;
10271+ STORE_NUMBER (loc + 1, arg1);
10272+ STORE_NUMBER (loc + 1 + OFFSET_ADDRESS_SIZE, arg2);
10273+}
10274+
10275+
10276+/* Copy the bytes from LOC to END to open up three bytes of space at LOC
10277+ for OP followed by two-byte integer parameter ARG. */
10278+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10279+
10280+static void
10281+PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, int arg, UCHAR_T *end)
10282+{
10283+ register UCHAR_T *pfrom = end;
10284+ register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
10285+
10286+ while (pfrom != loc)
10287+ *--pto = *--pfrom;
10288+
10289+ PREFIX(store_op1) (op, loc, arg);
10290+}
10291+
10292+
10293+/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */
10294+/* ifdef WCHAR, integer parameter is 1 wchar_t. */
10295+
10296+static void
10297+PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, int arg1,
10298+ int arg2, UCHAR_T *end)
10299+{
10300+ register UCHAR_T *pfrom = end;
10301+ register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
10302+
10303+ while (pfrom != loc)
10304+ *--pto = *--pfrom;
10305+
10306+ PREFIX(store_op2) (op, loc, arg1, arg2);
10307+}
10308+
10309+
10310+/* P points to just after a ^ in PATTERN. Return true if that ^ comes
10311+ after an alternative or a begin-subexpression. We assume there is at
10312+ least one character before the ^. */
10313+
10314+static boolean
10315+PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
10316+ reg_syntax_t syntax)
10317+{
10318+ const CHAR_T *prev = p - 2;
10319+ boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
10320+
10321+ return
10322+ /* After a subexpression? */
10323+ (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
10324+ /* After an alternative? */
10325+ || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash));
10326+}
10327+
10328+
10329+/* The dual of at_begline_loc_p. This one is for $. We assume there is
10330+ at least one character after the $, i.e., `P < PEND'. */
10331+
10332+static boolean
10333+PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend,
10334+ reg_syntax_t syntax)
10335+{
10336+ const CHAR_T *next = p;
10337+ boolean next_backslash = *next == '\\';
10338+ const CHAR_T *next_next = p + 1 < pend ? p + 1 : 0;
10339+
10340+ return
10341+ /* Before a subexpression? */
10342+ (syntax & RE_NO_BK_PARENS ? *next == ')'
10343+ : next_backslash && next_next && *next_next == ')')
10344+ /* Before an alternative? */
10345+ || (syntax & RE_NO_BK_VBAR ? *next == '|'
10346+ : next_backslash && next_next && *next_next == '|');
10347+}
10348+
10349+#else /* not INSIDE_RECURSION */
10350+
10351+/* Returns true if REGNUM is in one of COMPILE_STACK's elements and
10352+ false if it's not. */
10353+
10354+static boolean
10355+group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
10356+{
10357+ int this_element;
10358+
10359+ for (this_element = compile_stack.avail - 1;
10360+ this_element >= 0;
10361+ this_element--)
10362+ if (compile_stack.stack[this_element].regnum == regnum)
10363+ return true;
10364+
10365+ return false;
10366+}
10367+#endif /* not INSIDE_RECURSION */
10368+
10369+#ifdef INSIDE_RECURSION
10370+
10371+#ifdef WCHAR
10372+/* This insert space, which size is "num", into the pattern at "loc".
10373+ "end" must point the end of the allocated buffer. */
10374+static void
10375+insert_space (int num, CHAR_T *loc, CHAR_T *end)
10376+{
10377+ register CHAR_T *pto = end;
10378+ register CHAR_T *pfrom = end - num;
10379+
10380+ while (pfrom >= loc)
10381+ *pto-- = *pfrom--;
10382+}
10383+#endif /* WCHAR */
10384+
10385+#ifdef WCHAR
10386+static reg_errcode_t
10387+wcs_compile_range (CHAR_T range_start_char, const CHAR_T **p_ptr,
10388+ const CHAR_T *pend, RE_TRANSLATE_TYPE translate,
10389+ reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
10390+{
10391+ const CHAR_T *p = *p_ptr;
10392+ CHAR_T range_start, range_end;
10393+ reg_errcode_t ret;
10394+# ifdef _LIBC
10395+ uint32_t nrules;
10396+ uint32_t start_val, end_val;
10397+# endif
10398+ if (p == pend)
10399+ return REG_ERANGE;
10400+
10401+# ifdef _LIBC
10402+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
10403+ if (nrules != 0)
10404+ {
10405+ const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
10406+ _NL_COLLATE_COLLSEQWC);
10407+ const unsigned char *extra = (const unsigned char *)
10408+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
10409+
10410+ if (range_start_char < -1)
10411+ {
10412+ /* range_start is a collating symbol. */
10413+ int32_t *wextra;
10414+ /* Retreive the index and get collation sequence value. */
10415+ wextra = (int32_t*)(extra + char_set[-range_start_char]);
10416+ start_val = wextra[1 + *wextra];
10417+ }
10418+ else
10419+ start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
10420+
10421+ end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
10422+
10423+ /* Report an error if the range is empty and the syntax prohibits
10424+ this. */
10425+ ret = ((syntax & RE_NO_EMPTY_RANGES)
10426+ && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
10427+
10428+ /* Insert space to the end of the char_ranges. */
10429+ insert_space(2, b - char_set[5] - 2, b - 1);
10430+ *(b - char_set[5] - 2) = (wchar_t)start_val;
10431+ *(b - char_set[5] - 1) = (wchar_t)end_val;
10432+ char_set[4]++; /* ranges_index */
10433+ }
10434+ else
10435+# endif
10436+ {
10437+ range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
10438+ range_start_char;
10439+ range_end = TRANSLATE (p[0]);
10440+ /* Report an error if the range is empty and the syntax prohibits
10441+ this. */
10442+ ret = ((syntax & RE_NO_EMPTY_RANGES)
10443+ && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
10444+
10445+ /* Insert space to the end of the char_ranges. */
10446+ insert_space(2, b - char_set[5] - 2, b - 1);
10447+ *(b - char_set[5] - 2) = range_start;
10448+ *(b - char_set[5] - 1) = range_end;
10449+ char_set[4]++; /* ranges_index */
10450+ }
10451+ /* Have to increment the pointer into the pattern string, so the
10452+ caller isn't still at the ending character. */
10453+ (*p_ptr)++;
10454+
10455+ return ret;
10456+}
10457+#else /* BYTE */
10458+/* Read the ending character of a range (in a bracket expression) from the
10459+ uncompiled pattern *P_PTR (which ends at PEND). We assume the
10460+ starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
10461+ Then we set the translation of all bits between the starting and
10462+ ending characters (inclusive) in the compiled pattern B.
10463+
10464+ Return an error code.
10465+
10466+ We use these short variable names so we can use the same macros as
10467+ `regex_compile' itself. */
10468+
10469+static reg_errcode_t
10470+byte_compile_range (unsigned int range_start_char, const char **p_ptr,
10471+ const char *pend, RE_TRANSLATE_TYPE translate,
10472+ reg_syntax_t syntax, unsigned char *b)
10473+{
10474+ unsigned this_char;
10475+ const char *p = *p_ptr;
10476+ reg_errcode_t ret;
10477+# if _LIBC
10478+ const unsigned char *collseq;
10479+ unsigned int start_colseq;
10480+ unsigned int end_colseq;
10481+# else
10482+ unsigned end_char;
10483+# endif
10484+
10485+ if (p == pend)
10486+ return REG_ERANGE;
10487+
10488+ /* Have to increment the pointer into the pattern string, so the
10489+ caller isn't still at the ending character. */
10490+ (*p_ptr)++;
10491+
10492+ /* Report an error if the range is empty and the syntax prohibits this. */
10493+ ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
10494+
10495+# if _LIBC
10496+ collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
10497+ _NL_COLLATE_COLLSEQMB);
10498+
10499+ start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
10500+ end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
10501+ for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
10502+ {
10503+ unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
10504+
10505+ if (start_colseq <= this_colseq && this_colseq <= end_colseq)
10506+ {
10507+ SET_LIST_BIT (TRANSLATE (this_char));
10508+ ret = REG_NOERROR;
10509+ }
10510+ }
10511+# else
10512+ /* Here we see why `this_char' has to be larger than an `unsigned
10513+ char' -- we would otherwise go into an infinite loop, since all
10514+ characters <= 0xff. */
10515+ range_start_char = TRANSLATE (range_start_char);
10516+ /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
10517+ and some compilers cast it to int implicitly, so following for_loop
10518+ may fall to (almost) infinite loop.
10519+ e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
10520+ To avoid this, we cast p[0] to unsigned int and truncate it. */
10521+ end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
10522+
10523+ for (this_char = range_start_char; this_char <= end_char; ++this_char)
10524+ {
10525+ SET_LIST_BIT (TRANSLATE (this_char));
10526+ ret = REG_NOERROR;
10527+ }
10528+# endif
10529+
10530+ return ret;
10531+}
10532+#endif /* WCHAR */
10533+
10534+/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
10535+ BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
10536+ characters can start a string that matches the pattern. This fastmap
10537+ is used by re_search to skip quickly over impossible starting points.
10538+
10539+ The caller must supply the address of a (1 << BYTEWIDTH)-byte data
10540+ area as BUFP->fastmap.
10541+
10542+ We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
10543+ the pattern buffer.
10544+
10545+ Returns 0 if we succeed, -2 if an internal error. */
10546+
10547+#ifdef WCHAR
10548+/* local function for re_compile_fastmap.
10549+ truncate wchar_t character to char. */
10550+static unsigned char truncate_wchar (CHAR_T c);
10551+
10552+static unsigned char
10553+truncate_wchar (CHAR_T c)
10554+{
10555+ unsigned char buf[MB_CUR_MAX];
10556+ mbstate_t state;
10557+ int retval;
10558+ memset (&state, '\0', sizeof (state));
10559+# ifdef _LIBC
10560+ retval = __wcrtomb (buf, c, &state);
10561+# else
10562+ retval = wcrtomb (buf, c, &state);
10563+# endif
10564+ return retval > 0 ? buf[0] : (unsigned char) c;
10565+}
10566+#endif /* WCHAR */
10567+
10568+static int
10569+PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp)
10570+{
10571+ int j, k;
10572+#ifdef MATCH_MAY_ALLOCATE
10573+ PREFIX(fail_stack_type) fail_stack;
10574+#endif
10575+#ifndef REGEX_MALLOC
10576+ char *destination;
10577+#endif
10578+
10579+ register char *fastmap = bufp->fastmap;
10580+
10581+#ifdef WCHAR
10582+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
10583+ pattern to (char*) in regex_compile. */
10584+ UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
10585+ register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
10586+#else /* BYTE */
10587+ UCHAR_T *pattern = bufp->buffer;
10588+ register UCHAR_T *pend = pattern + bufp->used;
10589+#endif /* WCHAR */
10590+ UCHAR_T *p = pattern;
10591+
10592+#ifdef REL_ALLOC
10593+ /* This holds the pointer to the failure stack, when
10594+ it is allocated relocatably. */
10595+ fail_stack_elt_t *failure_stack_ptr;
10596+#endif
10597+
10598+ /* Assume that each path through the pattern can be null until
10599+ proven otherwise. We set this false at the bottom of switch
10600+ statement, to which we get only if a particular path doesn't
10601+ match the empty string. */
10602+ boolean path_can_be_null = true;
10603+
10604+ /* We aren't doing a `succeed_n' to begin with. */
10605+ boolean succeed_n_p = false;
10606+
10607+ assert (fastmap != NULL && p != NULL);
10608+
10609+ INIT_FAIL_STACK ();
10610+ bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
10611+ bufp->fastmap_accurate = 1; /* It will be when we're done. */
10612+ bufp->can_be_null = 0;
10613+
10614+ while (1)
10615+ {
10616+ if (p == pend || *p == (UCHAR_T) succeed)
10617+ {
10618+ /* We have reached the (effective) end of pattern. */
10619+ if (!FAIL_STACK_EMPTY ())
10620+ {
10621+ bufp->can_be_null |= path_can_be_null;
10622+
10623+ /* Reset for next path. */
10624+ path_can_be_null = true;
10625+
10626+ p = fail_stack.stack[--fail_stack.avail].pointer;
10627+
10628+ continue;
10629+ }
10630+ else
10631+ break;
10632+ }
10633+
10634+ /* We should never be about to go beyond the end of the pattern. */
10635+ assert (p < pend);
10636+
10637+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
10638+ {
10639+
10640+ /* I guess the idea here is to simply not bother with a fastmap
10641+ if a backreference is used, since it's too hard to figure out
10642+ the fastmap for the corresponding group. Setting
10643+ `can_be_null' stops `re_search_2' from using the fastmap, so
10644+ that is all we do. */
10645+ case duplicate:
10646+ bufp->can_be_null = 1;
10647+ goto done;
10648+
10649+
10650+ /* Following are the cases which match a character. These end
10651+ with `break'. */
10652+
10653+#ifdef WCHAR
10654+ case exactn:
10655+ fastmap[truncate_wchar(p[1])] = 1;
10656+ break;
10657+#else /* BYTE */
10658+ case exactn:
10659+ fastmap[p[1]] = 1;
10660+ break;
10661+#endif /* WCHAR */
10662+#ifdef MBS_SUPPORT
10663+ case exactn_bin:
10664+ fastmap[p[1]] = 1;
10665+ break;
10666+#endif
10667+
10668+#ifdef WCHAR
10669+ /* It is hard to distinguish fastmap from (multi byte) characters
10670+ which depends on current locale. */
10671+ case charset:
10672+ case charset_not:
10673+ case wordchar:
10674+ case notwordchar:
10675+ bufp->can_be_null = 1;
10676+ goto done;
10677+#else /* BYTE */
10678+ case charset:
10679+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
10680+ if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
10681+ fastmap[j] = 1;
10682+ break;
10683+
10684+
10685+ case charset_not:
10686+ /* Chars beyond end of map must be allowed. */
10687+ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
10688+ fastmap[j] = 1;
10689+
10690+ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
10691+ if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
10692+ fastmap[j] = 1;
10693+ break;
10694+
10695+
10696+ case wordchar:
10697+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10698+ if (SYNTAX (j) == Sword)
10699+ fastmap[j] = 1;
10700+ break;
10701+
10702+
10703+ case notwordchar:
10704+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10705+ if (SYNTAX (j) != Sword)
10706+ fastmap[j] = 1;
10707+ break;
10708+#endif /* WCHAR */
10709+
10710+ case anychar:
10711+ {
10712+ int fastmap_newline = fastmap['\n'];
10713+
10714+ /* `.' matches anything ... */
10715+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10716+ fastmap[j] = 1;
10717+
10718+ /* ... except perhaps newline. */
10719+ if (!(bufp->syntax & RE_DOT_NEWLINE))
10720+ fastmap['\n'] = fastmap_newline;
10721+
10722+ /* Return if we have already set `can_be_null'; if we have,
10723+ then the fastmap is irrelevant. Something's wrong here. */
10724+ else if (bufp->can_be_null)
10725+ goto done;
10726+
10727+ /* Otherwise, have to check alternative paths. */
10728+ break;
10729+ }
10730+
10731+#ifdef emacs
10732+ case syntaxspec:
10733+ k = *p++;
10734+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10735+ if (SYNTAX (j) == (enum syntaxcode) k)
10736+ fastmap[j] = 1;
10737+ break;
10738+
10739+
10740+ case notsyntaxspec:
10741+ k = *p++;
10742+ for (j = 0; j < (1 << BYTEWIDTH); j++)
10743+ if (SYNTAX (j) != (enum syntaxcode) k)
10744+ fastmap[j] = 1;
10745+ break;
10746+
10747+
10748+ /* All cases after this match the empty string. These end with
10749+ `continue'. */
10750+
10751+
10752+ case before_dot:
10753+ case at_dot:
10754+ case after_dot:
10755+ continue;
10756+#endif /* emacs */
10757+
10758+
10759+ case no_op:
10760+ case begline:
10761+ case endline:
10762+ case begbuf:
10763+ case endbuf:
10764+ case wordbound:
10765+ case notwordbound:
10766+ case wordbeg:
10767+ case wordend:
10768+ case push_dummy_failure:
10769+ continue;
10770+
10771+
10772+ case jump_n:
10773+ case pop_failure_jump:
10774+ case maybe_pop_jump:
10775+ case jump:
10776+ case jump_past_alt:
10777+ case dummy_failure_jump:
10778+ EXTRACT_NUMBER_AND_INCR (j, p);
10779+ p += j;
10780+ if (j > 0)
10781+ continue;
10782+
10783+ /* Jump backward implies we just went through the body of a
10784+ loop and matched nothing. Opcode jumped to should be
10785+ `on_failure_jump' or `succeed_n'. Just treat it like an
10786+ ordinary jump. For a * loop, it has pushed its failure
10787+ point already; if so, discard that as redundant. */
10788+ if ((re_opcode_t) *p != on_failure_jump
10789+ && (re_opcode_t) *p != succeed_n)
10790+ continue;
10791+
10792+ p++;
10793+ EXTRACT_NUMBER_AND_INCR (j, p);
10794+ p += j;
10795+
10796+ /* If what's on the stack is where we are now, pop it. */
10797+ if (!FAIL_STACK_EMPTY ()
10798+ && fail_stack.stack[fail_stack.avail - 1].pointer == p)
10799+ fail_stack.avail--;
10800+
10801+ continue;
10802+
10803+
10804+ case on_failure_jump:
10805+ case on_failure_keep_string_jump:
10806+ handle_on_failure_jump:
10807+ EXTRACT_NUMBER_AND_INCR (j, p);
10808+
10809+ /* For some patterns, e.g., `(a?)?', `p+j' here points to the
10810+ end of the pattern. We don't want to push such a point,
10811+ since when we restore it above, entering the switch will
10812+ increment `p' past the end of the pattern. We don't need
10813+ to push such a point since we obviously won't find any more
10814+ fastmap entries beyond `pend'. Such a pattern can match
10815+ the null string, though. */
10816+ if (p + j < pend)
10817+ {
10818+ if (!PUSH_PATTERN_OP (p + j, fail_stack))
10819+ {
10820+ RESET_FAIL_STACK ();
10821+ return -2;
10822+ }
10823+ }
10824+ else
10825+ bufp->can_be_null = 1;
10826+
10827+ if (succeed_n_p)
10828+ {
10829+ EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
10830+ succeed_n_p = false;
10831+ }
10832+
10833+ continue;
10834+
10835+
10836+ case succeed_n:
10837+ /* Get to the number of times to succeed. */
10838+ p += OFFSET_ADDRESS_SIZE;
10839+
10840+ /* Increment p past the n for when k != 0. */
10841+ EXTRACT_NUMBER_AND_INCR (k, p);
10842+ if (k == 0)
10843+ {
10844+ p -= 2 * OFFSET_ADDRESS_SIZE;
10845+ succeed_n_p = true; /* Spaghetti code alert. */
10846+ goto handle_on_failure_jump;
10847+ }
10848+ continue;
10849+
10850+
10851+ case set_number_at:
10852+ p += 2 * OFFSET_ADDRESS_SIZE;
10853+ continue;
10854+
10855+
10856+ case start_memory:
10857+ case stop_memory:
10858+ p += 2;
10859+ continue;
10860+
10861+
10862+ default:
10863+ abort (); /* We have listed all the cases. */
10864+ } /* switch *p++ */
10865+
10866+ /* Getting here means we have found the possible starting
10867+ characters for one path of the pattern -- and that the empty
10868+ string does not match. We need not follow this path further.
10869+ Instead, look at the next alternative (remembered on the
10870+ stack), or quit if no more. The test at the top of the loop
10871+ does these things. */
10872+ path_can_be_null = false;
10873+ p = pend;
10874+ } /* while p */
10875+
10876+ /* Set `can_be_null' for the last path (also the first path, if the
10877+ pattern is empty). */
10878+ bufp->can_be_null |= path_can_be_null;
10879+
10880+ done:
10881+ RESET_FAIL_STACK ();
10882+ return 0;
10883+}
10884+
10885+#else /* not INSIDE_RECURSION */
10886+
10887+int
10888+re_compile_fastmap (struct re_pattern_buffer *bufp)
10889+{
10890+# ifdef MBS_SUPPORT
10891+ if (MB_CUR_MAX != 1)
10892+ return wcs_re_compile_fastmap(bufp);
10893+ else
10894+# endif
10895+ return byte_re_compile_fastmap(bufp);
10896+} /* re_compile_fastmap */
10897+#ifdef _LIBC
10898+weak_alias (__re_compile_fastmap, re_compile_fastmap)
10899+#endif
10900+
10901+
10902+/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
10903+ ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use
10904+ this memory for recording register information. STARTS and ENDS
10905+ must be allocated using the malloc library routine, and must each
10906+ be at least NUM_REGS * sizeof (regoff_t) bytes long.
10907+
10908+ If NUM_REGS == 0, then subsequent matches should allocate their own
10909+ register data.
10910+
10911+ Unless this function is called, the first search or match using
10912+ PATTERN_BUFFER will allocate its own register data, without
10913+ freeing the old data. */
10914+
10915+void
10916+re_set_registers (struct re_pattern_buffer *bufp,
10917+ struct re_registers *regs, unsigned num_regs,
10918+ regoff_t *starts, regoff_t *ends)
10919+{
10920+ if (num_regs)
10921+ {
10922+ bufp->regs_allocated = REGS_REALLOCATE;
10923+ regs->num_regs = num_regs;
10924+ regs->start = starts;
10925+ regs->end = ends;
10926+ }
10927+ else
10928+ {
10929+ bufp->regs_allocated = REGS_UNALLOCATED;
10930+ regs->num_regs = 0;
10931+ regs->start = regs->end = (regoff_t *) 0;
10932+ }
10933+}
10934+#ifdef _LIBC
10935+weak_alias (__re_set_registers, re_set_registers)
10936+#endif
10937+
10938+/* Searching routines. */
10939+
10940+/* Like re_search_2, below, but only one string is specified, and
10941+ doesn't let you say where to stop matching. */
10942+
10943+int
10944+re_search (struct re_pattern_buffer *bufp, const char *string, int size,
10945+ int startpos, int range, struct re_registers *regs)
10946+{
10947+ return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
10948+ regs, size);
10949+}
10950+#ifdef _LIBC
10951+weak_alias (__re_search, re_search)
10952+#endif
10953+
10954+
10955+/* Using the compiled pattern in BUFP->buffer, first tries to match the
10956+ virtual concatenation of STRING1 and STRING2, starting first at index
10957+ STARTPOS, then at STARTPOS + 1, and so on.
10958+
10959+ STRING1 and STRING2 have length SIZE1 and SIZE2, respectively.
10960+
10961+ RANGE is how far to scan while trying to match. RANGE = 0 means try
10962+ only at STARTPOS; in general, the last start tried is STARTPOS +
10963+ RANGE.
10964+
10965+ In REGS, return the indices of the virtual concatenation of STRING1
10966+ and STRING2 that matched the entire BUFP->buffer and its contained
10967+ subexpressions.
10968+
10969+ Do not consider matching one past the index STOP in the virtual
10970+ concatenation of STRING1 and STRING2.
10971+
10972+ We return either the position in the strings at which the match was
10973+ found, -1 if no match, or -2 if error (such as failure
10974+ stack overflow). */
10975+
10976+int
10977+re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
10978+ const char *string2, int size2, int startpos, int range,
10979+ struct re_registers *regs, int stop)
10980+{
10981+# ifdef MBS_SUPPORT
10982+ if (MB_CUR_MAX != 1)
10983+ return wcs_re_search_2 (bufp, string1, size1, string2, size2, startpos,
10984+ range, regs, stop);
10985+ else
10986+# endif
10987+ return byte_re_search_2 (bufp, string1, size1, string2, size2, startpos,
10988+ range, regs, stop);
10989+} /* re_search_2 */
10990+#ifdef _LIBC
10991+weak_alias (__re_search_2, re_search_2)
10992+#endif
10993+
10994+#endif /* not INSIDE_RECURSION */
10995+
10996+#ifdef INSIDE_RECURSION
10997+
10998+#ifdef MATCH_MAY_ALLOCATE
10999+# define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL
11000+#else
11001+# define FREE_VAR(var) if (var) free (var); var = NULL
11002+#endif
11003+
11004+#ifdef WCHAR
11005+# define MAX_ALLOCA_SIZE 2000
11006+
11007+# define FREE_WCS_BUFFERS() \
11008+ do { \
11009+ if (size1 > MAX_ALLOCA_SIZE) \
11010+ { \
11011+ free (wcs_string1); \
11012+ free (mbs_offset1); \
11013+ } \
11014+ else \
11015+ { \
11016+ FREE_VAR (wcs_string1); \
11017+ FREE_VAR (mbs_offset1); \
11018+ } \
11019+ if (size2 > MAX_ALLOCA_SIZE) \
11020+ { \
11021+ free (wcs_string2); \
11022+ free (mbs_offset2); \
11023+ } \
11024+ else \
11025+ { \
11026+ FREE_VAR (wcs_string2); \
11027+ FREE_VAR (mbs_offset2); \
11028+ } \
11029+ } while (0)
11030+
11031+#endif
11032+
11033+
11034+static int
11035+PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
11036+ int size1, const char *string2, int size2,
11037+ int startpos, int range,
11038+ struct re_registers *regs, int stop)
11039+{
11040+ int val;
11041+ register char *fastmap = bufp->fastmap;
11042+ register RE_TRANSLATE_TYPE translate = bufp->translate;
11043+ int total_size = size1 + size2;
11044+ int endpos = startpos + range;
11045+#ifdef WCHAR
11046+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
11047+ wchar_t *wcs_string1 = NULL, *wcs_string2 = NULL;
11048+ /* We need the size of wchar_t buffers correspond to csize1, csize2. */
11049+ int wcs_size1 = 0, wcs_size2 = 0;
11050+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
11051+ int *mbs_offset1 = NULL, *mbs_offset2 = NULL;
11052+ /* They hold whether each wchar_t is binary data or not. */
11053+ char *is_binary = NULL;
11054+#endif /* WCHAR */
11055+
11056+ /* Check for out-of-range STARTPOS. */
11057+ if (startpos < 0 || startpos > total_size)
11058+ return -1;
11059+
11060+ /* Fix up RANGE if it might eventually take us outside
11061+ the virtual concatenation of STRING1 and STRING2.
11062+ Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */
11063+ if (endpos < 0)
11064+ range = 0 - startpos;
11065+ else if (endpos > total_size)
11066+ range = total_size - startpos;
11067+
11068+ /* If the search isn't to be a backwards one, don't waste time in a
11069+ search for a pattern that must be anchored. */
11070+ if (bufp->used > 0 && range > 0
11071+ && ((re_opcode_t) bufp->buffer[0] == begbuf
11072+ /* `begline' is like `begbuf' if it cannot match at newlines. */
11073+ || ((re_opcode_t) bufp->buffer[0] == begline
11074+ && !bufp->newline_anchor)))
11075+ {
11076+ if (startpos > 0)
11077+ return -1;
11078+ else
11079+ range = 1;
11080+ }
11081+
11082+#ifdef emacs
11083+ /* In a forward search for something that starts with \=.
11084+ don't keep searching past point. */
11085+ if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0)
11086+ {
11087+ range = PT - startpos;
11088+ if (range <= 0)
11089+ return -1;
11090+ }
11091+#endif /* emacs */
11092+
11093+ /* Update the fastmap now if not correct already. */
11094+ if (fastmap && !bufp->fastmap_accurate)
11095+ if (re_compile_fastmap (bufp) == -2)
11096+ return -2;
11097+
11098+#ifdef WCHAR
11099+ /* Allocate wchar_t array for wcs_string1 and wcs_string2 and
11100+ fill them with converted string. */
11101+ if (size1 != 0)
11102+ {
11103+ if (size1 > MAX_ALLOCA_SIZE)
11104+ {
11105+ wcs_string1 = TALLOC (size1 + 1, CHAR_T);
11106+ mbs_offset1 = TALLOC (size1 + 1, int);
11107+ is_binary = TALLOC (size1 + 1, char);
11108+ }
11109+ else
11110+ {
11111+ wcs_string1 = REGEX_TALLOC (size1 + 1, CHAR_T);
11112+ mbs_offset1 = REGEX_TALLOC (size1 + 1, int);
11113+ is_binary = REGEX_TALLOC (size1 + 1, char);
11114+ }
11115+ if (!wcs_string1 || !mbs_offset1 || !is_binary)
11116+ {
11117+ if (size1 > MAX_ALLOCA_SIZE)
11118+ {
11119+ free (wcs_string1);
11120+ free (mbs_offset1);
11121+ free (is_binary);
11122+ }
11123+ else
11124+ {
11125+ FREE_VAR (wcs_string1);
11126+ FREE_VAR (mbs_offset1);
11127+ FREE_VAR (is_binary);
11128+ }
11129+ return -2;
11130+ }
11131+ wcs_size1 = convert_mbs_to_wcs(wcs_string1, string1, size1,
11132+ mbs_offset1, is_binary);
11133+ wcs_string1[wcs_size1] = L'\0'; /* for a sentinel */
11134+ if (size1 > MAX_ALLOCA_SIZE)
11135+ free (is_binary);
11136+ else
11137+ FREE_VAR (is_binary);
11138+ }
11139+ if (size2 != 0)
11140+ {
11141+ if (size2 > MAX_ALLOCA_SIZE)
11142+ {
11143+ wcs_string2 = TALLOC (size2 + 1, CHAR_T);
11144+ mbs_offset2 = TALLOC (size2 + 1, int);
11145+ is_binary = TALLOC (size2 + 1, char);
11146+ }
11147+ else
11148+ {
11149+ wcs_string2 = REGEX_TALLOC (size2 + 1, CHAR_T);
11150+ mbs_offset2 = REGEX_TALLOC (size2 + 1, int);
11151+ is_binary = REGEX_TALLOC (size2 + 1, char);
11152+ }
11153+ if (!wcs_string2 || !mbs_offset2 || !is_binary)
11154+ {
11155+ FREE_WCS_BUFFERS ();
11156+ if (size2 > MAX_ALLOCA_SIZE)
11157+ free (is_binary);
11158+ else
11159+ FREE_VAR (is_binary);
11160+ return -2;
11161+ }
11162+ wcs_size2 = convert_mbs_to_wcs(wcs_string2, string2, size2,
11163+ mbs_offset2, is_binary);
11164+ wcs_string2[wcs_size2] = L'\0'; /* for a sentinel */
11165+ if (size2 > MAX_ALLOCA_SIZE)
11166+ free (is_binary);
11167+ else
11168+ FREE_VAR (is_binary);
11169+ }
11170+#endif /* WCHAR */
11171+
11172+
11173+ /* Loop through the string, looking for a place to start matching. */
11174+ for (;;)
11175+ {
11176+ /* If a fastmap is supplied, skip quickly over characters that
11177+ cannot be the start of a match. If the pattern can match the
11178+ null string, however, we don't need to skip characters; we want
11179+ the first null string. */
11180+ if (fastmap && startpos < total_size && !bufp->can_be_null)
11181+ {
11182+ if (range > 0) /* Searching forwards. */
11183+ {
11184+ register const char *d;
11185+ register int lim = 0;
11186+ int irange = range;
11187+
11188+ if (startpos < size1 && startpos + range >= size1)
11189+ lim = range - (size1 - startpos);
11190+
11191+ d = (startpos >= size1 ? string2 - size1 : string1) + startpos;
11192+
11193+ /* Written out as an if-else to avoid testing `translate'
11194+ inside the loop. */
11195+ if (translate)
11196+ while (range > lim
11197+ && !fastmap[(unsigned char)
11198+ translate[(unsigned char) *d++]])
11199+ range--;
11200+ else
11201+ while (range > lim && !fastmap[(unsigned char) *d++])
11202+ range--;
11203+
11204+ startpos += irange - range;
11205+ }
11206+ else /* Searching backwards. */
11207+ {
11208+ register CHAR_T c = (size1 == 0 || startpos >= size1
11209+ ? string2[startpos - size1]
11210+ : string1[startpos]);
11211+
11212+ if (!fastmap[(unsigned char) TRANSLATE (c)])
11213+ goto advance;
11214+ }
11215+ }
11216+
11217+ /* If can't match the null string, and that's all we have left, fail. */
11218+ if (range >= 0 && startpos == total_size && fastmap
11219+ && !bufp->can_be_null)
11220+ {
11221+#ifdef WCHAR
11222+ FREE_WCS_BUFFERS ();
11223+#endif
11224+ return -1;
11225+ }
11226+
11227+#ifdef WCHAR
11228+ val = wcs_re_match_2_internal (bufp, string1, size1, string2,
11229+ size2, startpos, regs, stop,
11230+ wcs_string1, wcs_size1,
11231+ wcs_string2, wcs_size2,
11232+ mbs_offset1, mbs_offset2);
11233+#else /* BYTE */
11234+ val = byte_re_match_2_internal (bufp, string1, size1, string2,
11235+ size2, startpos, regs, stop);
11236+#endif /* BYTE */
11237+
11238+#ifndef REGEX_MALLOC
11239+# ifdef C_ALLOCA
11240+ alloca (0);
11241+# endif
11242+#endif
11243+
11244+ if (val >= 0)
11245+ {
11246+#ifdef WCHAR
11247+ FREE_WCS_BUFFERS ();
11248+#endif
11249+ return startpos;
11250+ }
11251+
11252+ if (val == -2)
11253+ {
11254+#ifdef WCHAR
11255+ FREE_WCS_BUFFERS ();
11256+#endif
11257+ return -2;
11258+ }
11259+
11260+ advance:
11261+ if (!range)
11262+ break;
11263+ else if (range > 0)
11264+ {
11265+ range--;
11266+ startpos++;
11267+ }
11268+ else
11269+ {
11270+ range++;
11271+ startpos--;
11272+ }
11273+ }
11274+#ifdef WCHAR
11275+ FREE_WCS_BUFFERS ();
11276+#endif
11277+ return -1;
11278+}
11279+
11280+#ifdef WCHAR
11281+/* This converts PTR, a pointer into one of the search wchar_t strings
11282+ `string1' and `string2' into an multibyte string offset from the
11283+ beginning of that string. We use mbs_offset to optimize.
11284+ See convert_mbs_to_wcs. */
11285+# define POINTER_TO_OFFSET(ptr) \
11286+ (FIRST_STRING_P (ptr) \
11287+ ? ((regoff_t)(mbs_offset1 != NULL? mbs_offset1[(ptr)-string1] : 0)) \
11288+ : ((regoff_t)((mbs_offset2 != NULL? mbs_offset2[(ptr)-string2] : 0) \
11289+ + csize1)))
11290+#else /* BYTE */
11291+/* This converts PTR, a pointer into one of the search strings `string1'
11292+ and `string2' into an offset from the beginning of that string. */
11293+# define POINTER_TO_OFFSET(ptr) \
11294+ (FIRST_STRING_P (ptr) \
11295+ ? ((regoff_t) ((ptr) - string1)) \
11296+ : ((regoff_t) ((ptr) - string2 + size1)))
11297+#endif /* WCHAR */
11298+
11299+/* Macros for dealing with the split strings in re_match_2. */
11300+
11301+#define MATCHING_IN_FIRST_STRING (dend == end_match_1)
11302+
11303+/* Call before fetching a character with *d. This switches over to
11304+ string2 if necessary. */
11305+#define PREFETCH() \
11306+ while (d == dend) \
11307+ { \
11308+ /* End of string2 => fail. */ \
11309+ if (dend == end_match_2) \
11310+ goto fail; \
11311+ /* End of string1 => advance to string2. */ \
11312+ d = string2; \
11313+ dend = end_match_2; \
11314+ }
11315+
11316+/* Test if at very beginning or at very end of the virtual concatenation
11317+ of `string1' and `string2'. If only one string, it's `string2'. */
11318+#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
11319+#define AT_STRINGS_END(d) ((d) == end2)
11320+
11321+
11322+/* Test if D points to a character which is word-constituent. We have
11323+ two special cases to check for: if past the end of string1, look at
11324+ the first character in string2; and if before the beginning of
11325+ string2, look at the last character in string1. */
11326+#ifdef WCHAR
11327+/* Use internationalized API instead of SYNTAX. */
11328+# define WORDCHAR_P(d) \
11329+ (iswalnum ((wint_t)((d) == end1 ? *string2 \
11330+ : (d) == string2 - 1 ? *(end1 - 1) : *(d))) != 0 \
11331+ || ((d) == end1 ? *string2 \
11332+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) == L'_')
11333+#else /* BYTE */
11334+# define WORDCHAR_P(d) \
11335+ (SYNTAX ((d) == end1 ? *string2 \
11336+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
11337+ == Sword)
11338+#endif /* WCHAR */
11339+
11340+/* Disabled due to a compiler bug -- see comment at case wordbound */
11341+#if 0
11342+/* Test if the character before D and the one at D differ with respect
11343+ to being word-constituent. */
11344+#define AT_WORD_BOUNDARY(d) \
11345+ (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
11346+ || WORDCHAR_P (d - 1) != WORDCHAR_P (d))
11347+#endif
11348+
11349+/* Free everything we malloc. */
11350+#ifdef MATCH_MAY_ALLOCATE
11351+# ifdef WCHAR
11352+# define FREE_VARIABLES() \
11353+ do { \
11354+ REGEX_FREE_STACK (fail_stack.stack); \
11355+ FREE_VAR (regstart); \
11356+ FREE_VAR (regend); \
11357+ FREE_VAR (old_regstart); \
11358+ FREE_VAR (old_regend); \
11359+ FREE_VAR (best_regstart); \
11360+ FREE_VAR (best_regend); \
11361+ FREE_VAR (reg_info); \
11362+ FREE_VAR (reg_dummy); \
11363+ FREE_VAR (reg_info_dummy); \
11364+ if (!cant_free_wcs_buf) \
11365+ { \
11366+ FREE_VAR (string1); \
11367+ FREE_VAR (string2); \
11368+ FREE_VAR (mbs_offset1); \
11369+ FREE_VAR (mbs_offset2); \
11370+ } \
11371+ } while (0)
11372+# else /* BYTE */
11373+# define FREE_VARIABLES() \
11374+ do { \
11375+ REGEX_FREE_STACK (fail_stack.stack); \
11376+ FREE_VAR (regstart); \
11377+ FREE_VAR (regend); \
11378+ FREE_VAR (old_regstart); \
11379+ FREE_VAR (old_regend); \
11380+ FREE_VAR (best_regstart); \
11381+ FREE_VAR (best_regend); \
11382+ FREE_VAR (reg_info); \
11383+ FREE_VAR (reg_dummy); \
11384+ FREE_VAR (reg_info_dummy); \
11385+ } while (0)
11386+# endif /* WCHAR */
11387+#else
11388+# ifdef WCHAR
11389+# define FREE_VARIABLES() \
11390+ do { \
11391+ if (!cant_free_wcs_buf) \
11392+ { \
11393+ FREE_VAR (string1); \
11394+ FREE_VAR (string2); \
11395+ FREE_VAR (mbs_offset1); \
11396+ FREE_VAR (mbs_offset2); \
11397+ } \
11398+ } while (0)
11399+# else /* BYTE */
11400+# define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */
11401+# endif /* WCHAR */
11402+#endif /* not MATCH_MAY_ALLOCATE */
11403+
11404+/* These values must meet several constraints. They must not be valid
11405+ register values; since we have a limit of 255 registers (because
11406+ we use only one byte in the pattern for the register number), we can
11407+ use numbers larger than 255. They must differ by 1, because of
11408+ NUM_FAILURE_ITEMS above. And the value for the lowest register must
11409+ be larger than the value for the highest register, so we do not try
11410+ to actually save any registers when none are active. */
11411+#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH)
11412+#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1)
11413+
11414+#else /* not INSIDE_RECURSION */
11415+/* Matching routines. */
11416+
11417+#ifndef emacs /* Emacs never uses this. */
11418+/* re_match is like re_match_2 except it takes only a single string. */
11419+
11420+int
11421+re_match (struct re_pattern_buffer *bufp, const char *string,
11422+ int size, int pos, struct re_registers *regs)
11423+{
11424+ int result;
11425+# ifdef MBS_SUPPORT
11426+ if (MB_CUR_MAX != 1)
11427+ result = wcs_re_match_2_internal (bufp, NULL, 0, string, size,
11428+ pos, regs, size,
11429+ NULL, 0, NULL, 0, NULL, NULL);
11430+ else
11431+# endif
11432+ result = byte_re_match_2_internal (bufp, NULL, 0, string, size,
11433+ pos, regs, size);
11434+# ifndef REGEX_MALLOC
11435+# ifdef C_ALLOCA
11436+ alloca (0);
11437+# endif
11438+# endif
11439+ return result;
11440+}
11441+# ifdef _LIBC
11442+weak_alias (__re_match, re_match)
11443+# endif
11444+#endif /* not emacs */
11445+
11446+#endif /* not INSIDE_RECURSION */
11447+
11448+#ifdef INSIDE_RECURSION
11449+static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p,
11450+ UCHAR_T *end,
11451+ PREFIX(register_info_type) *reg_info);
11452+static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p,
11453+ UCHAR_T *end,
11454+ PREFIX(register_info_type) *reg_info);
11455+static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p,
11456+ UCHAR_T *end,
11457+ PREFIX(register_info_type) *reg_info);
11458+static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2,
11459+ register int len,
11460+ RE_TRANSLATE_TYPE translate);
11461+#else /* not INSIDE_RECURSION */
11462+
11463+/* re_match_2 matches the compiled pattern in BUFP against the
11464+ the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
11465+ and SIZE2, respectively). We start matching at POS, and stop
11466+ matching at STOP.
11467+
11468+ If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
11469+ store offsets for the substring each group matched in REGS. See the
11470+ documentation for exactly how many groups we fill.
11471+
11472+ We return -1 if no match, -2 if an internal error (such as the
11473+ failure stack overflowing). Otherwise, we return the length of the
11474+ matched substring. */
11475+
11476+int
11477+re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
11478+ const char *string2, int size2, int pos,
11479+ struct re_registers *regs, int stop)
11480+{
11481+ int result;
11482+# ifdef MBS_SUPPORT
11483+ if (MB_CUR_MAX != 1)
11484+ result = wcs_re_match_2_internal (bufp, string1, size1, string2, size2,
11485+ pos, regs, stop,
11486+ NULL, 0, NULL, 0, NULL, NULL);
11487+ else
11488+# endif
11489+ result = byte_re_match_2_internal (bufp, string1, size1, string2, size2,
11490+ pos, regs, stop);
11491+
11492+#ifndef REGEX_MALLOC
11493+# ifdef C_ALLOCA
11494+ alloca (0);
11495+# endif
11496+#endif
11497+ return result;
11498+}
11499+#ifdef _LIBC
11500+weak_alias (__re_match_2, re_match_2)
11501+#endif
11502+
11503+#endif /* not INSIDE_RECURSION */
11504+
11505+#ifdef INSIDE_RECURSION
11506+
11507+#ifdef WCHAR
11508+static int count_mbs_length (int *, int);
11509+
11510+/* This check the substring (from 0, to length) of the multibyte string,
11511+ to which offset_buffer correspond. And count how many wchar_t_characters
11512+ the substring occupy. We use offset_buffer to optimization.
11513+ See convert_mbs_to_wcs. */
11514+
11515+static int
11516+count_mbs_length(int *offset_buffer, int length)
11517+{
11518+ int upper, lower;
11519+
11520+ /* Check whether the size is valid. */
11521+ if (length < 0)
11522+ return -1;
11523+
11524+ if (offset_buffer == NULL)
11525+ return 0;
11526+
11527+ /* If there are no multibyte character, offset_buffer[i] == i.
11528+ Optmize for this case. */
11529+ if (offset_buffer[length] == length)
11530+ return length;
11531+
11532+ /* Set up upper with length. (because for all i, offset_buffer[i] >= i) */
11533+ upper = length;
11534+ lower = 0;
11535+
11536+ while (true)
11537+ {
11538+ int middle = (lower + upper) / 2;
11539+ if (middle == lower || middle == upper)
11540+ break;
11541+ if (offset_buffer[middle] > length)
11542+ upper = middle;
11543+ else if (offset_buffer[middle] < length)
11544+ lower = middle;
11545+ else
11546+ return middle;
11547+ }
11548+
11549+ return -1;
11550+}
11551+#endif /* WCHAR */
11552+
11553+/* This is a separate function so that we can force an alloca cleanup
11554+ afterwards. */
11555+#ifdef WCHAR
11556+static int
11557+wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
11558+ const char *cstring1, int csize1,
11559+ const char *cstring2, int csize2,
11560+ int pos,
11561+ struct re_registers *regs,
11562+ int stop,
11563+ /* string1 == string2 == NULL means string1/2, size1/2 and
11564+ mbs_offset1/2 need seting up in this function. */
11565+ /* We need wchar_t* buffers correspond to cstring1, cstring2. */
11566+ wchar_t *string1, int size1,
11567+ wchar_t *string2, int size2,
11568+ /* offset buffer for optimizatoin. See convert_mbs_to_wc. */
11569+ int *mbs_offset1, int *mbs_offset2)
11570+#else /* BYTE */
11571+static int
11572+byte_re_match_2_internal (struct re_pattern_buffer *bufp,
11573+ const char *string1, int size1,
11574+ const char *string2, int size2,
11575+ int pos,
11576+ struct re_registers *regs, int stop)
11577+#endif /* BYTE */
11578+{
11579+ /* General temporaries. */
11580+ int mcnt;
11581+ UCHAR_T *p1;
11582+#ifdef WCHAR
11583+ /* They hold whether each wchar_t is binary data or not. */
11584+ char *is_binary = NULL;
11585+ /* If true, we can't free string1/2, mbs_offset1/2. */
11586+ int cant_free_wcs_buf = 1;
11587+#endif /* WCHAR */
11588+
11589+ /* Just past the end of the corresponding string. */
11590+ const CHAR_T *end1, *end2;
11591+
11592+ /* Pointers into string1 and string2, just past the last characters in
11593+ each to consider matching. */
11594+ const CHAR_T *end_match_1, *end_match_2;
11595+
11596+ /* Where we are in the data, and the end of the current string. */
11597+ const CHAR_T *d, *dend;
11598+
11599+ /* Where we are in the pattern, and the end of the pattern. */
11600+#ifdef WCHAR
11601+ UCHAR_T *pattern, *p;
11602+ register UCHAR_T *pend;
11603+#else /* BYTE */
11604+ UCHAR_T *p = bufp->buffer;
11605+ register UCHAR_T *pend = p + bufp->used;
11606+#endif /* WCHAR */
11607+
11608+ /* Mark the opcode just after a start_memory, so we can test for an
11609+ empty subpattern when we get to the stop_memory. */
11610+ UCHAR_T *just_past_start_mem = 0;
11611+
11612+ /* We use this to map every character in the string. */
11613+ RE_TRANSLATE_TYPE translate = bufp->translate;
11614+
11615+ /* Failure point stack. Each place that can handle a failure further
11616+ down the line pushes a failure point on this stack. It consists of
11617+ restart, regend, and reg_info for all registers corresponding to
11618+ the subexpressions we're currently inside, plus the number of such
11619+ registers, and, finally, two char *'s. The first char * is where
11620+ to resume scanning the pattern; the second one is where to resume
11621+ scanning the strings. If the latter is zero, the failure point is
11622+ a ``dummy''; if a failure happens and the failure point is a dummy,
11623+ it gets discarded and the next next one is tried. */
11624+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
11625+ PREFIX(fail_stack_type) fail_stack;
11626+#endif
11627+#ifdef DEBUG
11628+ static unsigned failure_id;
11629+ unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
11630+#endif
11631+
11632+#ifdef REL_ALLOC
11633+ /* This holds the pointer to the failure stack, when
11634+ it is allocated relocatably. */
11635+ fail_stack_elt_t *failure_stack_ptr;
11636+#endif
11637+
11638+ /* We fill all the registers internally, independent of what we
11639+ return, for use in backreferences. The number here includes
11640+ an element for register zero. */
11641+ size_t num_regs = bufp->re_nsub + 1;
11642+
11643+ /* The currently active registers. */
11644+ active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
11645+ active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
11646+
11647+ /* Information on the contents of registers. These are pointers into
11648+ the input strings; they record just what was matched (on this
11649+ attempt) by a subexpression part of the pattern, that is, the
11650+ regnum-th regstart pointer points to where in the pattern we began
11651+ matching and the regnum-th regend points to right after where we
11652+ stopped matching the regnum-th subexpression. (The zeroth register
11653+ keeps track of what the whole pattern matches.) */
11654+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11655+ const CHAR_T **regstart, **regend;
11656+#endif
11657+
11658+ /* If a group that's operated upon by a repetition operator fails to
11659+ match anything, then the register for its start will need to be
11660+ restored because it will have been set to wherever in the string we
11661+ are when we last see its open-group operator. Similarly for a
11662+ register's end. */
11663+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11664+ const CHAR_T **old_regstart, **old_regend;
11665+#endif
11666+
11667+ /* The is_active field of reg_info helps us keep track of which (possibly
11668+ nested) subexpressions we are currently in. The matched_something
11669+ field of reg_info[reg_num] helps us tell whether or not we have
11670+ matched any of the pattern so far this time through the reg_num-th
11671+ subexpression. These two fields get reset each time through any
11672+ loop their register is in. */
11673+#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
11674+ PREFIX(register_info_type) *reg_info;
11675+#endif
11676+
11677+ /* The following record the register info as found in the above
11678+ variables when we find a match better than any we've seen before.
11679+ This happens as we backtrack through the failure points, which in
11680+ turn happens only if we have not yet matched the entire string. */
11681+ unsigned best_regs_set = false;
11682+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11683+ const CHAR_T **best_regstart, **best_regend;
11684+#endif
11685+
11686+ /* Logically, this is `best_regend[0]'. But we don't want to have to
11687+ allocate space for that if we're not allocating space for anything
11688+ else (see below). Also, we never need info about register 0 for
11689+ any of the other register vectors, and it seems rather a kludge to
11690+ treat `best_regend' differently than the rest. So we keep track of
11691+ the end of the best match so far in a separate variable. We
11692+ initialize this to NULL so that when we backtrack the first time
11693+ and need to test it, it's not garbage. */
11694+ const CHAR_T *match_end = NULL;
11695+
11696+ /* This helps SET_REGS_MATCHED avoid doing redundant work. */
11697+ int set_regs_matched_done = 0;
11698+
11699+ /* Used when we pop values we don't care about. */
11700+#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */
11701+ const CHAR_T **reg_dummy;
11702+ PREFIX(register_info_type) *reg_info_dummy;
11703+#endif
11704+
11705+#ifdef DEBUG
11706+ /* Counts the total number of registers pushed. */
11707+ unsigned num_regs_pushed = 0;
11708+#endif
11709+
11710+ DEBUG_PRINT1 ("\n\nEntering re_match_2.\n");
11711+
11712+ INIT_FAIL_STACK ();
11713+
11714+#ifdef MATCH_MAY_ALLOCATE
11715+ /* Do not bother to initialize all the register variables if there are
11716+ no groups in the pattern, as it takes a fair amount of time. If
11717+ there are groups, we include space for register 0 (the whole
11718+ pattern), even though we never use it, since it simplifies the
11719+ array indexing. We should fix this. */
11720+ if (bufp->re_nsub)
11721+ {
11722+ regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11723+ regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11724+ old_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11725+ old_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11726+ best_regstart = REGEX_TALLOC (num_regs, const CHAR_T *);
11727+ best_regend = REGEX_TALLOC (num_regs, const CHAR_T *);
11728+ reg_info = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
11729+ reg_dummy = REGEX_TALLOC (num_regs, const CHAR_T *);
11730+ reg_info_dummy = REGEX_TALLOC (num_regs, PREFIX(register_info_type));
11731+
11732+ if (!(regstart && regend && old_regstart && old_regend && reg_info
11733+ && best_regstart && best_regend && reg_dummy && reg_info_dummy))
11734+ {
11735+ FREE_VARIABLES ();
11736+ return -2;
11737+ }
11738+ }
11739+ else
11740+ {
11741+ /* We must initialize all our variables to NULL, so that
11742+ `FREE_VARIABLES' doesn't try to free them. */
11743+ regstart = regend = old_regstart = old_regend = best_regstart
11744+ = best_regend = reg_dummy = NULL;
11745+ reg_info = reg_info_dummy = (PREFIX(register_info_type) *) NULL;
11746+ }
11747+#endif /* MATCH_MAY_ALLOCATE */
11748+
11749+ /* The starting position is bogus. */
11750+#ifdef WCHAR
11751+ if (pos < 0 || pos > csize1 + csize2)
11752+#else /* BYTE */
11753+ if (pos < 0 || pos > size1 + size2)
11754+#endif
11755+ {
11756+ FREE_VARIABLES ();
11757+ return -1;
11758+ }
11759+
11760+#ifdef WCHAR
11761+ /* Allocate wchar_t array for string1 and string2 and
11762+ fill them with converted string. */
11763+ if (string1 == NULL && string2 == NULL)
11764+ {
11765+ /* We need seting up buffers here. */
11766+
11767+ /* We must free wcs buffers in this function. */
11768+ cant_free_wcs_buf = 0;
11769+
11770+ if (csize1 != 0)
11771+ {
11772+ string1 = REGEX_TALLOC (csize1 + 1, CHAR_T);
11773+ mbs_offset1 = REGEX_TALLOC (csize1 + 1, int);
11774+ is_binary = REGEX_TALLOC (csize1 + 1, char);
11775+ if (!string1 || !mbs_offset1 || !is_binary)
11776+ {
11777+ FREE_VAR (string1);
11778+ FREE_VAR (mbs_offset1);
11779+ FREE_VAR (is_binary);
11780+ return -2;
11781+ }
11782+ }
11783+ if (csize2 != 0)
11784+ {
11785+ string2 = REGEX_TALLOC (csize2 + 1, CHAR_T);
11786+ mbs_offset2 = REGEX_TALLOC (csize2 + 1, int);
11787+ is_binary = REGEX_TALLOC (csize2 + 1, char);
11788+ if (!string2 || !mbs_offset2 || !is_binary)
11789+ {
11790+ FREE_VAR (string1);
11791+ FREE_VAR (mbs_offset1);
11792+ FREE_VAR (string2);
11793+ FREE_VAR (mbs_offset2);
11794+ FREE_VAR (is_binary);
11795+ return -2;
11796+ }
11797+ size2 = convert_mbs_to_wcs(string2, cstring2, csize2,
11798+ mbs_offset2, is_binary);
11799+ string2[size2] = L'\0'; /* for a sentinel */
11800+ FREE_VAR (is_binary);
11801+ }
11802+ }
11803+
11804+ /* We need to cast pattern to (wchar_t*), because we casted this compiled
11805+ pattern to (char*) in regex_compile. */
11806+ p = pattern = (CHAR_T*)bufp->buffer;
11807+ pend = (CHAR_T*)(bufp->buffer + bufp->used);
11808+
11809+#endif /* WCHAR */
11810+
11811+ /* Initialize subexpression text positions to -1 to mark ones that no
11812+ start_memory/stop_memory has been seen for. Also initialize the
11813+ register information struct. */
11814+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11815+ {
11816+ regstart[mcnt] = regend[mcnt]
11817+ = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
11818+
11819+ REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE;
11820+ IS_ACTIVE (reg_info[mcnt]) = 0;
11821+ MATCHED_SOMETHING (reg_info[mcnt]) = 0;
11822+ EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0;
11823+ }
11824+
11825+ /* We move `string1' into `string2' if the latter's empty -- but not if
11826+ `string1' is null. */
11827+ if (size2 == 0 && string1 != NULL)
11828+ {
11829+ string2 = string1;
11830+ size2 = size1;
11831+ string1 = 0;
11832+ size1 = 0;
11833+#ifdef WCHAR
11834+ mbs_offset2 = mbs_offset1;
11835+ csize2 = csize1;
11836+ mbs_offset1 = NULL;
11837+ csize1 = 0;
11838+#endif
11839+ }
11840+ end1 = string1 + size1;
11841+ end2 = string2 + size2;
11842+
11843+ /* Compute where to stop matching, within the two strings. */
11844+#ifdef WCHAR
11845+ if (stop <= csize1)
11846+ {
11847+ mcnt = count_mbs_length(mbs_offset1, stop);
11848+ end_match_1 = string1 + mcnt;
11849+ end_match_2 = string2;
11850+ }
11851+ else
11852+ {
11853+ if (stop > csize1 + csize2)
11854+ stop = csize1 + csize2;
11855+ end_match_1 = end1;
11856+ mcnt = count_mbs_length(mbs_offset2, stop-csize1);
11857+ end_match_2 = string2 + mcnt;
11858+ }
11859+ if (mcnt < 0)
11860+ { /* count_mbs_length return error. */
11861+ FREE_VARIABLES ();
11862+ return -1;
11863+ }
11864+#else
11865+ if (stop <= size1)
11866+ {
11867+ end_match_1 = string1 + stop;
11868+ end_match_2 = string2;
11869+ }
11870+ else
11871+ {
11872+ end_match_1 = end1;
11873+ end_match_2 = string2 + stop - size1;
11874+ }
11875+#endif /* WCHAR */
11876+
11877+ /* `p' scans through the pattern as `d' scans through the data.
11878+ `dend' is the end of the input string that `d' points within. `d'
11879+ is advanced into the following input string whenever necessary, but
11880+ this happens before fetching; therefore, at the beginning of the
11881+ loop, `d' can be pointing at the end of a string, but it cannot
11882+ equal `string2'. */
11883+#ifdef WCHAR
11884+ if (size1 > 0 && pos <= csize1)
11885+ {
11886+ mcnt = count_mbs_length(mbs_offset1, pos);
11887+ d = string1 + mcnt;
11888+ dend = end_match_1;
11889+ }
11890+ else
11891+ {
11892+ mcnt = count_mbs_length(mbs_offset2, pos-csize1);
11893+ d = string2 + mcnt;
11894+ dend = end_match_2;
11895+ }
11896+
11897+ if (mcnt < 0)
11898+ { /* count_mbs_length return error. */
11899+ FREE_VARIABLES ();
11900+ return -1;
11901+ }
11902+#else
11903+ if (size1 > 0 && pos <= size1)
11904+ {
11905+ d = string1 + pos;
11906+ dend = end_match_1;
11907+ }
11908+ else
11909+ {
11910+ d = string2 + pos - size1;
11911+ dend = end_match_2;
11912+ }
11913+#endif /* WCHAR */
11914+
11915+ DEBUG_PRINT1 ("The compiled pattern is:\n");
11916+ DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
11917+ DEBUG_PRINT1 ("The string to match is: `");
11918+ DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
11919+ DEBUG_PRINT1 ("'\n");
11920+
11921+ /* This loops over pattern commands. It exits by returning from the
11922+ function if the match is complete, or it drops through if the match
11923+ fails at this starting point in the input data. */
11924+ for (;;)
11925+ {
11926+#ifdef _LIBC
11927+ DEBUG_PRINT2 ("\n%p: ", p);
11928+#else
11929+ DEBUG_PRINT2 ("\n0x%x: ", p);
11930+#endif
11931+
11932+ if (p == pend)
11933+ { /* End of pattern means we might have succeeded. */
11934+ DEBUG_PRINT1 ("end of pattern ... ");
11935+
11936+ /* If we haven't matched the entire string, and we want the
11937+ longest match, try backtracking. */
11938+ if (d != end_match_2)
11939+ {
11940+ /* 1 if this match ends in the same string (string1 or string2)
11941+ as the best previous match. */
11942+ boolean same_str_p = (FIRST_STRING_P (match_end)
11943+ == MATCHING_IN_FIRST_STRING);
11944+ /* 1 if this match is the best seen so far. */
11945+ boolean best_match_p;
11946+
11947+ /* AIX compiler got confused when this was combined
11948+ with the previous declaration. */
11949+ if (same_str_p)
11950+ best_match_p = d > match_end;
11951+ else
11952+ best_match_p = !MATCHING_IN_FIRST_STRING;
11953+
11954+ DEBUG_PRINT1 ("backtracking.\n");
11955+
11956+ if (!FAIL_STACK_EMPTY ())
11957+ { /* More failure points to try. */
11958+
11959+ /* If exceeds best match so far, save it. */
11960+ if (!best_regs_set || best_match_p)
11961+ {
11962+ best_regs_set = true;
11963+ match_end = d;
11964+
11965+ DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
11966+
11967+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11968+ {
11969+ best_regstart[mcnt] = regstart[mcnt];
11970+ best_regend[mcnt] = regend[mcnt];
11971+ }
11972+ }
11973+ goto fail;
11974+ }
11975+
11976+ /* If no failure points, don't restore garbage. And if
11977+ last match is real best match, don't restore second
11978+ best one. */
11979+ else if (best_regs_set && !best_match_p)
11980+ {
11981+ restore_best_regs:
11982+ /* Restore best match. It may happen that `dend ==
11983+ end_match_1' while the restored d is in string2.
11984+ For example, the pattern `x.*y.*z' against the
11985+ strings `x-' and `y-z-', if the two strings are
11986+ not consecutive in memory. */
11987+ DEBUG_PRINT1 ("Restoring best registers.\n");
11988+
11989+ d = match_end;
11990+ dend = ((d >= string1 && d <= end1)
11991+ ? end_match_1 : end_match_2);
11992+
11993+ for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++)
11994+ {
11995+ regstart[mcnt] = best_regstart[mcnt];
11996+ regend[mcnt] = best_regend[mcnt];
11997+ }
11998+ }
11999+ } /* d != end_match_2 */
12000+
12001+ succeed_label:
12002+ DEBUG_PRINT1 ("Accepting match.\n");
12003+ /* If caller wants register contents data back, do it. */
12004+ if (regs && !bufp->no_sub)
12005+ {
12006+ /* Have the register data arrays been allocated? */
12007+ if (bufp->regs_allocated == REGS_UNALLOCATED)
12008+ { /* No. So allocate them with malloc. We need one
12009+ extra element beyond `num_regs' for the `-1' marker
12010+ GNU code uses. */
12011+ regs->num_regs = MAX (RE_NREGS, num_regs + 1);
12012+ regs->start = TALLOC (regs->num_regs, regoff_t);
12013+ regs->end = TALLOC (regs->num_regs, regoff_t);
12014+ if (regs->start == NULL || regs->end == NULL)
12015+ {
12016+ FREE_VARIABLES ();
12017+ return -2;
12018+ }
12019+ bufp->regs_allocated = REGS_REALLOCATE;
12020+ }
12021+ else if (bufp->regs_allocated == REGS_REALLOCATE)
12022+ { /* Yes. If we need more elements than were already
12023+ allocated, reallocate them. If we need fewer, just
12024+ leave it alone. */
12025+ if (regs->num_regs < num_regs + 1)
12026+ {
12027+ regs->num_regs = num_regs + 1;
12028+ RETALLOC (regs->start, regs->num_regs, regoff_t);
12029+ RETALLOC (regs->end, regs->num_regs, regoff_t);
12030+ if (regs->start == NULL || regs->end == NULL)
12031+ {
12032+ FREE_VARIABLES ();
12033+ return -2;
12034+ }
12035+ }
12036+ }
12037+ else
12038+ {
12039+ /* These braces fend off a "empty body in an else-statement"
12040+ warning under GCC when assert expands to nothing. */
12041+ assert (bufp->regs_allocated == REGS_FIXED);
12042+ }
12043+
12044+ /* Convert the pointer data in `regstart' and `regend' to
12045+ indices. Register zero has to be set differently,
12046+ since we haven't kept track of any info for it. */
12047+ if (regs->num_regs > 0)
12048+ {
12049+ regs->start[0] = pos;
12050+#ifdef WCHAR
12051+ if (MATCHING_IN_FIRST_STRING)
12052+ regs->end[0] = mbs_offset1 != NULL ?
12053+ mbs_offset1[d-string1] : 0;
12054+ else
12055+ regs->end[0] = csize1 + (mbs_offset2 != NULL ?
12056+ mbs_offset2[d-string2] : 0);
12057+#else
12058+ regs->end[0] = (MATCHING_IN_FIRST_STRING
12059+ ? ((regoff_t) (d - string1))
12060+ : ((regoff_t) (d - string2 + size1)));
12061+#endif /* WCHAR */
12062+ }
12063+
12064+ /* Go through the first `min (num_regs, regs->num_regs)'
12065+ registers, since that is all we initialized. */
12066+ for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs);
12067+ mcnt++)
12068+ {
12069+ if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
12070+ regs->start[mcnt] = regs->end[mcnt] = -1;
12071+ else
12072+ {
12073+ regs->start[mcnt]
12074+ = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]);
12075+ regs->end[mcnt]
12076+ = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]);
12077+ }
12078+ }
12079+
12080+ /* If the regs structure we return has more elements than
12081+ were in the pattern, set the extra elements to -1. If
12082+ we (re)allocated the registers, this is the case,
12083+ because we always allocate enough to have at least one
12084+ -1 at the end. */
12085+ for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++)
12086+ regs->start[mcnt] = regs->end[mcnt] = -1;
12087+ } /* regs && !bufp->no_sub */
12088+
12089+ DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n",
12090+ nfailure_points_pushed, nfailure_points_popped,
12091+ nfailure_points_pushed - nfailure_points_popped);
12092+ DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed);
12093+
12094+#ifdef WCHAR
12095+ if (MATCHING_IN_FIRST_STRING)
12096+ mcnt = mbs_offset1 != NULL ? mbs_offset1[d-string1] : 0;
12097+ else
12098+ mcnt = (mbs_offset2 != NULL ? mbs_offset2[d-string2] : 0) +
12099+ csize1;
12100+ mcnt -= pos;
12101+#else
12102+ mcnt = d - pos - (MATCHING_IN_FIRST_STRING
12103+ ? string1
12104+ : string2 - size1);
12105+#endif /* WCHAR */
12106+
12107+ DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt);
12108+
12109+ FREE_VARIABLES ();
12110+ return mcnt;
12111+ }
12112+
12113+ /* Otherwise match next pattern command. */
12114+ switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
12115+ {
12116+ /* Ignore these. Used to ignore the n of succeed_n's which
12117+ currently have n == 0. */
12118+ case no_op:
12119+ DEBUG_PRINT1 ("EXECUTING no_op.\n");
12120+ break;
12121+
12122+ case succeed:
12123+ DEBUG_PRINT1 ("EXECUTING succeed.\n");
12124+ goto succeed_label;
12125+
12126+ /* Match the next n pattern characters exactly. The following
12127+ byte in the pattern defines n, and the n bytes after that
12128+ are the characters to match. */
12129+ case exactn:
12130+#ifdef MBS_SUPPORT
12131+ case exactn_bin:
12132+#endif
12133+ mcnt = *p++;
12134+ DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
12135+
12136+ /* This is written out as an if-else so we don't waste time
12137+ testing `translate' inside the loop. */
12138+ if (translate)
12139+ {
12140+ do
12141+ {
12142+ PREFETCH ();
12143+#ifdef WCHAR
12144+ if (*d <= 0xff)
12145+ {
12146+ if ((UCHAR_T) translate[(unsigned char) *d++]
12147+ != (UCHAR_T) *p++)
12148+ goto fail;
12149+ }
12150+ else
12151+ {
12152+ if (*d++ != (CHAR_T) *p++)
12153+ goto fail;
12154+ }
12155+#else
12156+ if ((UCHAR_T) translate[(unsigned char) *d++]
12157+ != (UCHAR_T) *p++)
12158+ goto fail;
12159+#endif /* WCHAR */
12160+ }
12161+ while (--mcnt);
12162+ }
12163+ else
12164+ {
12165+ do
12166+ {
12167+ PREFETCH ();
12168+ if (*d++ != (CHAR_T) *p++) goto fail;
12169+ }
12170+ while (--mcnt);
12171+ }
12172+ SET_REGS_MATCHED ();
12173+ break;
12174+
12175+
12176+ /* Match any character except possibly a newline or a null. */
12177+ case anychar:
12178+ DEBUG_PRINT1 ("EXECUTING anychar.\n");
12179+
12180+ PREFETCH ();
12181+
12182+ if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n')
12183+ || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000'))
12184+ goto fail;
12185+
12186+ SET_REGS_MATCHED ();
12187+ DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d);
12188+ d++;
12189+ break;
12190+
12191+
12192+ case charset:
12193+ case charset_not:
12194+ {
12195+ register UCHAR_T c;
12196+#ifdef WCHAR
12197+ unsigned int i, char_class_length, coll_symbol_length,
12198+ equiv_class_length, ranges_length, chars_length, length;
12199+ CHAR_T *workp, *workp2, *charset_top;
12200+#define WORK_BUFFER_SIZE 128
12201+ CHAR_T str_buf[WORK_BUFFER_SIZE];
12202+# ifdef _LIBC
12203+ uint32_t nrules;
12204+# endif /* _LIBC */
12205+#endif /* WCHAR */
12206+ boolean negate = (re_opcode_t) *(p - 1) == charset_not;
12207+
12208+ DEBUG_PRINT2 ("EXECUTING charset%s.\n", negate ? "_not" : "");
12209+ PREFETCH ();
12210+ c = TRANSLATE (*d); /* The character to match. */
12211+#ifdef WCHAR
12212+# ifdef _LIBC
12213+ nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
12214+# endif /* _LIBC */
12215+ charset_top = p - 1;
12216+ char_class_length = *p++;
12217+ coll_symbol_length = *p++;
12218+ equiv_class_length = *p++;
12219+ ranges_length = *p++;
12220+ chars_length = *p++;
12221+ /* p points charset[6], so the address of the next instruction
12222+ (charset[l+m+n+2o+k+p']) equals p[l+m+n+2*o+p'],
12223+ where l=length of char_classes, m=length of collating_symbol,
12224+ n=equivalence_class, o=length of char_range,
12225+ p'=length of character. */
12226+ workp = p;
12227+ /* Update p to indicate the next instruction. */
12228+ p += char_class_length + coll_symbol_length+ equiv_class_length +
12229+ 2*ranges_length + chars_length;
12230+
12231+ /* match with char_class? */
12232+ for (i = 0; i < char_class_length ; i += CHAR_CLASS_SIZE)
12233+ {
12234+ wctype_t wctype;
12235+ uintptr_t alignedp = ((uintptr_t)workp
12236+ + __alignof__(wctype_t) - 1)
12237+ & ~(uintptr_t)(__alignof__(wctype_t) - 1);
12238+ wctype = *((wctype_t*)alignedp);
12239+ workp += CHAR_CLASS_SIZE;
12240+# ifdef _LIBC
12241+ if (__iswctype((wint_t)c, wctype))
12242+ goto char_set_matched;
12243+# else
12244+ if (iswctype((wint_t)c, wctype))
12245+ goto char_set_matched;
12246+# endif
12247+ }
12248+
12249+ /* match with collating_symbol? */
12250+# ifdef _LIBC
12251+ if (nrules != 0)
12252+ {
12253+ const unsigned char *extra = (const unsigned char *)
12254+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
12255+
12256+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;
12257+ workp++)
12258+ {
12259+ int32_t *wextra;
12260+ wextra = (int32_t*)(extra + *workp++);
12261+ for (i = 0; i < *wextra; ++i)
12262+ if (TRANSLATE(d[i]) != wextra[1 + i])
12263+ break;
12264+
12265+ if (i == *wextra)
12266+ {
12267+ /* Update d, however d will be incremented at
12268+ char_set_matched:, we decrement d here. */
12269+ d += i - 1;
12270+ goto char_set_matched;
12271+ }
12272+ }
12273+ }
12274+ else /* (nrules == 0) */
12275+# endif
12276+ /* If we can't look up collation data, we use wcscoll
12277+ instead. */
12278+ {
12279+ for (workp2 = workp + coll_symbol_length ; workp < workp2 ;)
12280+ {
12281+ const CHAR_T *backup_d = d, *backup_dend = dend;
12282+# ifdef _LIBC
12283+ length = __wcslen (workp);
12284+# else
12285+ length = wcslen (workp);
12286+# endif
12287+
12288+ /* If wcscoll(the collating symbol, whole string) > 0,
12289+ any substring of the string never match with the
12290+ collating symbol. */
12291+# ifdef _LIBC
12292+ if (__wcscoll (workp, d) > 0)
12293+# else
12294+ if (wcscoll (workp, d) > 0)
12295+# endif
12296+ {
12297+ workp += length + 1;
12298+ continue;
12299+ }
12300+
12301+ /* First, we compare the collating symbol with
12302+ the first character of the string.
12303+ If it don't match, we add the next character to
12304+ the compare buffer in turn. */
12305+ for (i = 0 ; i < WORK_BUFFER_SIZE-1 ; i++, d++)
12306+ {
12307+ int match;
12308+ if (d == dend)
12309+ {
12310+ if (dend == end_match_2)
12311+ break;
12312+ d = string2;
12313+ dend = end_match_2;
12314+ }
12315+
12316+ /* add next character to the compare buffer. */
12317+ str_buf[i] = TRANSLATE(*d);
12318+ str_buf[i+1] = '\0';
12319+
12320+# ifdef _LIBC
12321+ match = __wcscoll (workp, str_buf);
12322+# else
12323+ match = wcscoll (workp, str_buf);
12324+# endif
12325+ if (match == 0)
12326+ goto char_set_matched;
12327+
12328+ if (match < 0)
12329+ /* (str_buf > workp) indicate (str_buf + X > workp),
12330+ because for all X (str_buf + X > str_buf).
12331+ So we don't need continue this loop. */
12332+ break;
12333+
12334+ /* Otherwise(str_buf < workp),
12335+ (str_buf+next_character) may equals (workp).
12336+ So we continue this loop. */
12337+ }
12338+ /* not matched */
12339+ d = backup_d;
12340+ dend = backup_dend;
12341+ workp += length + 1;
12342+ }
12343+ }
12344+ /* match with equivalence_class? */
12345+# ifdef _LIBC
12346+ if (nrules != 0)
12347+ {
12348+ const CHAR_T *backup_d = d, *backup_dend = dend;
12349+ /* Try to match the equivalence class against
12350+ those known to the collate implementation. */
12351+ const int32_t *table;
12352+ const int32_t *weights;
12353+ const int32_t *extra;
12354+ const int32_t *indirect;
12355+ int32_t idx, idx2;
12356+ wint_t *cp;
12357+ size_t len;
12358+
12359+ /* This #include defines a local function! */
12360+# include <locale/weightwc.h>
12361+
12362+ table = (const int32_t *)
12363+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
12364+ weights = (const wint_t *)
12365+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
12366+ extra = (const wint_t *)
12367+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
12368+ indirect = (const int32_t *)
12369+ _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
12370+
12371+ /* Write 1 collating element to str_buf, and
12372+ get its index. */
12373+ idx2 = 0;
12374+
12375+ for (i = 0 ; idx2 == 0 && i < WORK_BUFFER_SIZE - 1; i++)
12376+ {
12377+ cp = (wint_t*)str_buf;
12378+ if (d == dend)
12379+ {
12380+ if (dend == end_match_2)
12381+ break;
12382+ d = string2;
12383+ dend = end_match_2;
12384+ }
12385+ str_buf[i] = TRANSLATE(*(d+i));
12386+ str_buf[i+1] = '\0'; /* sentinel */
12387+ idx2 = findidx ((const wint_t**)&cp, i);
12388+ }
12389+
12390+ /* Update d, however d will be incremented at
12391+ char_set_matched:, we decrement d here. */
12392+ d = backup_d + ((wchar_t*)cp - (wchar_t*)str_buf - 1);
12393+ if (d >= dend)
12394+ {
12395+ if (dend == end_match_2)
12396+ d = dend;
12397+ else
12398+ {
12399+ d = string2;
12400+ dend = end_match_2;
12401+ }
12402+ }
12403+
12404+ len = weights[idx2];
12405+
12406+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;
12407+ workp++)
12408+ {
12409+ idx = (int32_t)*workp;
12410+ /* We already checked idx != 0 in regex_compile. */
12411+
12412+ if (idx2 != 0 && len == weights[idx])
12413+ {
12414+ int cnt = 0;
12415+ while (cnt < len && (weights[idx + 1 + cnt]
12416+ == weights[idx2 + 1 + cnt]))
12417+ ++cnt;
12418+
12419+ if (cnt == len)
12420+ goto char_set_matched;
12421+ }
12422+ }
12423+ /* not matched */
12424+ d = backup_d;
12425+ dend = backup_dend;
12426+ }
12427+ else /* (nrules == 0) */
12428+# endif
12429+ /* If we can't look up collation data, we use wcscoll
12430+ instead. */
12431+ {
12432+ for (workp2 = workp + equiv_class_length ; workp < workp2 ;)
12433+ {
12434+ const CHAR_T *backup_d = d, *backup_dend = dend;
12435+# ifdef _LIBC
12436+ length = __wcslen (workp);
12437+# else
12438+ length = wcslen (workp);
12439+# endif
12440+
12441+ /* If wcscoll(the collating symbol, whole string) > 0,
12442+ any substring of the string never match with the
12443+ collating symbol. */
12444+# ifdef _LIBC
12445+ if (__wcscoll (workp, d) > 0)
12446+# else
12447+ if (wcscoll (workp, d) > 0)
12448+# endif
12449+ {
12450+ workp += length + 1;
12451+ break;
12452+ }
12453+
12454+ /* First, we compare the equivalence class with
12455+ the first character of the string.
12456+ If it don't match, we add the next character to
12457+ the compare buffer in turn. */
12458+ for (i = 0 ; i < WORK_BUFFER_SIZE - 1 ; i++, d++)
12459+ {
12460+ int match;
12461+ if (d == dend)
12462+ {
12463+ if (dend == end_match_2)
12464+ break;
12465+ d = string2;
12466+ dend = end_match_2;
12467+ }
12468+
12469+ /* add next character to the compare buffer. */
12470+ str_buf[i] = TRANSLATE(*d);
12471+ str_buf[i+1] = '\0';
12472+
12473+# ifdef _LIBC
12474+ match = __wcscoll (workp, str_buf);
12475+# else
12476+ match = wcscoll (workp, str_buf);
12477+# endif
12478+
12479+ if (match == 0)
12480+ goto char_set_matched;
12481+
12482+ if (match < 0)
12483+ /* (str_buf > workp) indicate (str_buf + X > workp),
12484+ because for all X (str_buf + X > str_buf).
12485+ So we don't need continue this loop. */
12486+ break;
12487+
12488+ /* Otherwise(str_buf < workp),
12489+ (str_buf+next_character) may equals (workp).
12490+ So we continue this loop. */
12491+ }
12492+ /* not matched */
12493+ d = backup_d;
12494+ dend = backup_dend;
12495+ workp += length + 1;
12496+ }
12497+ }
12498+
12499+ /* match with char_range? */
12500+# ifdef _LIBC
12501+ if (nrules != 0)
12502+ {
12503+ uint32_t collseqval;
12504+ const char *collseq = (const char *)
12505+ _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
12506+
12507+ collseqval = collseq_table_lookup (collseq, c);
12508+
12509+ for (; workp < p - chars_length ;)
12510+ {
12511+ uint32_t start_val, end_val;
12512+
12513+ /* We already compute the collation sequence value
12514+ of the characters (or collating symbols). */
12515+ start_val = (uint32_t) *workp++; /* range_start */
12516+ end_val = (uint32_t) *workp++; /* range_end */
12517+
12518+ if (start_val <= collseqval && collseqval <= end_val)
12519+ goto char_set_matched;
12520+ }
12521+ }
12522+ else
12523+# endif
12524+ {
12525+ /* We set range_start_char at str_buf[0], range_end_char
12526+ at str_buf[4], and compared char at str_buf[2]. */
12527+ str_buf[1] = 0;
12528+ str_buf[2] = c;
12529+ str_buf[3] = 0;
12530+ str_buf[5] = 0;
12531+ for (; workp < p - chars_length ;)
12532+ {
12533+ wchar_t *range_start_char, *range_end_char;
12534+
12535+ /* match if (range_start_char <= c <= range_end_char). */
12536+
12537+ /* If range_start(or end) < 0, we assume -range_start(end)
12538+ is the offset of the collating symbol which is specified
12539+ as the character of the range start(end). */
12540+
12541+ /* range_start */
12542+ if (*workp < 0)
12543+ range_start_char = charset_top - (*workp++);
12544+ else
12545+ {
12546+ str_buf[0] = *workp++;
12547+ range_start_char = str_buf;
12548+ }
12549+
12550+ /* range_end */
12551+ if (*workp < 0)
12552+ range_end_char = charset_top - (*workp++);
12553+ else
12554+ {
12555+ str_buf[4] = *workp++;
12556+ range_end_char = str_buf + 4;
12557+ }
12558+
12559+# ifdef _LIBC
12560+ if (__wcscoll (range_start_char, str_buf+2) <= 0
12561+ && __wcscoll (str_buf+2, range_end_char) <= 0)
12562+# else
12563+ if (wcscoll (range_start_char, str_buf+2) <= 0
12564+ && wcscoll (str_buf+2, range_end_char) <= 0)
12565+# endif
12566+ goto char_set_matched;
12567+ }
12568+ }
12569+
12570+ /* match with char? */
12571+ for (; workp < p ; workp++)
12572+ if (c == *workp)
12573+ goto char_set_matched;
12574+
12575+ negate = !negate;
12576+
12577+ char_set_matched:
12578+ if (negate) goto fail;
12579+#else
12580+ /* Cast to `unsigned' instead of `unsigned char' in case the
12581+ bit list is a full 32 bytes long. */
12582+ if (c < (unsigned) (*p * BYTEWIDTH)
12583+ && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
12584+ negate = !negate;
12585+
12586+ p += 1 + *p;
12587+
12588+ if (!negate) goto fail;
12589+#undef WORK_BUFFER_SIZE
12590+#endif /* WCHAR */
12591+ SET_REGS_MATCHED ();
12592+ d++;
12593+ break;
12594+ }
12595+
12596+
12597+ /* The beginning of a group is represented by start_memory.
12598+ The arguments are the register number in the next byte, and the
12599+ number of groups inner to this one in the next. The text
12600+ matched within the group is recorded (in the internal
12601+ registers data structure) under the register number. */
12602+ case start_memory:
12603+ DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n",
12604+ (long int) *p, (long int) p[1]);
12605+
12606+ /* Find out if this group can match the empty string. */
12607+ p1 = p; /* To send to group_match_null_string_p. */
12608+
12609+ if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE)
12610+ REG_MATCH_NULL_STRING_P (reg_info[*p])
12611+ = PREFIX(group_match_null_string_p) (&p1, pend, reg_info);
12612+
12613+ /* Save the position in the string where we were the last time
12614+ we were at this open-group operator in case the group is
12615+ operated upon by a repetition operator, e.g., with `(a*)*b'
12616+ against `ab'; then we want to ignore where we are now in
12617+ the string in case this attempt to match fails. */
12618+ old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
12619+ ? REG_UNSET (regstart[*p]) ? d : regstart[*p]
12620+ : regstart[*p];
12621+ DEBUG_PRINT2 (" old_regstart: %d\n",
12622+ POINTER_TO_OFFSET (old_regstart[*p]));
12623+
12624+ regstart[*p] = d;
12625+ DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p]));
12626+
12627+ IS_ACTIVE (reg_info[*p]) = 1;
12628+ MATCHED_SOMETHING (reg_info[*p]) = 0;
12629+
12630+ /* Clear this whenever we change the register activity status. */
12631+ set_regs_matched_done = 0;
12632+
12633+ /* This is the new highest active register. */
12634+ highest_active_reg = *p;
12635+
12636+ /* If nothing was active before, this is the new lowest active
12637+ register. */
12638+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
12639+ lowest_active_reg = *p;
12640+
12641+ /* Move past the register number and inner group count. */
12642+ p += 2;
12643+ just_past_start_mem = p;
12644+
12645+ break;
12646+
12647+
12648+ /* The stop_memory opcode represents the end of a group. Its
12649+ arguments are the same as start_memory's: the register
12650+ number, and the number of inner groups. */
12651+ case stop_memory:
12652+ DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n",
12653+ (long int) *p, (long int) p[1]);
12654+
12655+ /* We need to save the string position the last time we were at
12656+ this close-group operator in case the group is operated
12657+ upon by a repetition operator, e.g., with `((a*)*(b*)*)*'
12658+ against `aba'; then we want to ignore where we are now in
12659+ the string in case this attempt to match fails. */
12660+ old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p])
12661+ ? REG_UNSET (regend[*p]) ? d : regend[*p]
12662+ : regend[*p];
12663+ DEBUG_PRINT2 (" old_regend: %d\n",
12664+ POINTER_TO_OFFSET (old_regend[*p]));
12665+
12666+ regend[*p] = d;
12667+ DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p]));
12668+
12669+ /* This register isn't active anymore. */
12670+ IS_ACTIVE (reg_info[*p]) = 0;
12671+
12672+ /* Clear this whenever we change the register activity status. */
12673+ set_regs_matched_done = 0;
12674+
12675+ /* If this was the only register active, nothing is active
12676+ anymore. */
12677+ if (lowest_active_reg == highest_active_reg)
12678+ {
12679+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
12680+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
12681+ }
12682+ else
12683+ { /* We must scan for the new highest active register, since
12684+ it isn't necessarily one less than now: consider
12685+ (a(b)c(d(e)f)g). When group 3 ends, after the f), the
12686+ new highest active register is 1. */
12687+ UCHAR_T r = *p - 1;
12688+ while (r > 0 && !IS_ACTIVE (reg_info[r]))
12689+ r--;
12690+
12691+ /* If we end up at register zero, that means that we saved
12692+ the registers as the result of an `on_failure_jump', not
12693+ a `start_memory', and we jumped to past the innermost
12694+ `stop_memory'. For example, in ((.)*) we save
12695+ registers 1 and 2 as a result of the *, but when we pop
12696+ back to the second ), we are at the stop_memory 1.
12697+ Thus, nothing is active. */
12698+ if (r == 0)
12699+ {
12700+ lowest_active_reg = NO_LOWEST_ACTIVE_REG;
12701+ highest_active_reg = NO_HIGHEST_ACTIVE_REG;
12702+ }
12703+ else
12704+ highest_active_reg = r;
12705+ }
12706+
12707+ /* If just failed to match something this time around with a
12708+ group that's operated on by a repetition operator, try to
12709+ force exit from the ``loop'', and restore the register
12710+ information for this group that we had before trying this
12711+ last match. */
12712+ if ((!MATCHED_SOMETHING (reg_info[*p])
12713+ || just_past_start_mem == p - 1)
12714+ && (p + 2) < pend)
12715+ {
12716+ boolean is_a_jump_n = false;
12717+
12718+ p1 = p + 2;
12719+ mcnt = 0;
12720+ switch ((re_opcode_t) *p1++)
12721+ {
12722+ case jump_n:
12723+ is_a_jump_n = true;
12724+ case pop_failure_jump:
12725+ case maybe_pop_jump:
12726+ case jump:
12727+ case dummy_failure_jump:
12728+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
12729+ if (is_a_jump_n)
12730+ p1 += OFFSET_ADDRESS_SIZE;
12731+ break;
12732+
12733+ default:
12734+ /* do nothing */ ;
12735+ }
12736+ p1 += mcnt;
12737+
12738+ /* If the next operation is a jump backwards in the pattern
12739+ to an on_failure_jump right before the start_memory
12740+ corresponding to this stop_memory, exit from the loop
12741+ by forcing a failure after pushing on the stack the
12742+ on_failure_jump's jump in the pattern, and d. */
12743+ if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump
12744+ && (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == start_memory
12745+ && p1[2+OFFSET_ADDRESS_SIZE] == *p)
12746+ {
12747+ /* If this group ever matched anything, then restore
12748+ what its registers were before trying this last
12749+ failed match, e.g., with `(a*)*b' against `ab' for
12750+ regstart[1], and, e.g., with `((a*)*(b*)*)*'
12751+ against `aba' for regend[3].
12752+
12753+ Also restore the registers for inner groups for,
12754+ e.g., `((a*)(b*))*' against `aba' (register 3 would
12755+ otherwise get trashed). */
12756+
12757+ if (EVER_MATCHED_SOMETHING (reg_info[*p]))
12758+ {
12759+ unsigned r;
12760+
12761+ EVER_MATCHED_SOMETHING (reg_info[*p]) = 0;
12762+
12763+ /* Restore this and inner groups' (if any) registers. */
12764+ for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1);
12765+ r++)
12766+ {
12767+ regstart[r] = old_regstart[r];
12768+
12769+ /* xx why this test? */
12770+ if (old_regend[r] >= regstart[r])
12771+ regend[r] = old_regend[r];
12772+ }
12773+ }
12774+ p1++;
12775+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
12776+ PUSH_FAILURE_POINT (p1 + mcnt, d, -2);
12777+
12778+ goto fail;
12779+ }
12780+ }
12781+
12782+ /* Move past the register number and the inner group count. */
12783+ p += 2;
12784+ break;
12785+
12786+
12787+ /* \<digit> has been turned into a `duplicate' command which is
12788+ followed by the numeric value of <digit> as the register number. */
12789+ case duplicate:
12790+ {
12791+ register const CHAR_T *d2, *dend2;
12792+ int regno = *p++; /* Get which register to match against. */
12793+ DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
12794+
12795+ /* Can't back reference a group which we've never matched. */
12796+ if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
12797+ goto fail;
12798+
12799+ /* Where in input to try to start matching. */
12800+ d2 = regstart[regno];
12801+
12802+ /* Where to stop matching; if both the place to start and
12803+ the place to stop matching are in the same string, then
12804+ set to the place to stop, otherwise, for now have to use
12805+ the end of the first string. */
12806+
12807+ dend2 = ((FIRST_STRING_P (regstart[regno])
12808+ == FIRST_STRING_P (regend[regno]))
12809+ ? regend[regno] : end_match_1);
12810+ for (;;)
12811+ {
12812+ /* If necessary, advance to next segment in register
12813+ contents. */
12814+ while (d2 == dend2)
12815+ {
12816+ if (dend2 == end_match_2) break;
12817+ if (dend2 == regend[regno]) break;
12818+
12819+ /* End of string1 => advance to string2. */
12820+ d2 = string2;
12821+ dend2 = regend[regno];
12822+ }
12823+ /* At end of register contents => success */
12824+ if (d2 == dend2) break;
12825+
12826+ /* If necessary, advance to next segment in data. */
12827+ PREFETCH ();
12828+
12829+ /* How many characters left in this segment to match. */
12830+ mcnt = dend - d;
12831+
12832+ /* Want how many consecutive characters we can match in
12833+ one shot, so, if necessary, adjust the count. */
12834+ if (mcnt > dend2 - d2)
12835+ mcnt = dend2 - d2;
12836+
12837+ /* Compare that many; failure if mismatch, else move
12838+ past them. */
12839+ if (translate
12840+ ? PREFIX(bcmp_translate) (d, d2, mcnt, translate)
12841+ : memcmp (d, d2, mcnt*sizeof(UCHAR_T)))
12842+ goto fail;
12843+ d += mcnt, d2 += mcnt;
12844+
12845+ /* Do this because we've match some characters. */
12846+ SET_REGS_MATCHED ();
12847+ }
12848+ }
12849+ break;
12850+
12851+
12852+ /* begline matches the empty string at the beginning of the string
12853+ (unless `not_bol' is set in `bufp'), and, if
12854+ `newline_anchor' is set, after newlines. */
12855+ case begline:
12856+ DEBUG_PRINT1 ("EXECUTING begline.\n");
12857+
12858+ if (AT_STRINGS_BEG (d))
12859+ {
12860+ if (!bufp->not_bol) break;
12861+ }
12862+ else if (d[-1] == '\n' && bufp->newline_anchor)
12863+ {
12864+ break;
12865+ }
12866+ /* In all other cases, we fail. */
12867+ goto fail;
12868+
12869+
12870+ /* endline is the dual of begline. */
12871+ case endline:
12872+ DEBUG_PRINT1 ("EXECUTING endline.\n");
12873+
12874+ if (AT_STRINGS_END (d))
12875+ {
12876+ if (!bufp->not_eol) break;
12877+ }
12878+
12879+ /* We have to ``prefetch'' the next character. */
12880+ else if ((d == end1 ? *string2 : *d) == '\n'
12881+ && bufp->newline_anchor)
12882+ {
12883+ break;
12884+ }
12885+ goto fail;
12886+
12887+
12888+ /* Match at the very beginning of the data. */
12889+ case begbuf:
12890+ DEBUG_PRINT1 ("EXECUTING begbuf.\n");
12891+ if (AT_STRINGS_BEG (d))
12892+ break;
12893+ goto fail;
12894+
12895+
12896+ /* Match at the very end of the data. */
12897+ case endbuf:
12898+ DEBUG_PRINT1 ("EXECUTING endbuf.\n");
12899+ if (AT_STRINGS_END (d))
12900+ break;
12901+ goto fail;
12902+
12903+
12904+ /* on_failure_keep_string_jump is used to optimize `.*\n'. It
12905+ pushes NULL as the value for the string on the stack. Then
12906+ `pop_failure_point' will keep the current value for the
12907+ string, instead of restoring it. To see why, consider
12908+ matching `foo\nbar' against `.*\n'. The .* matches the foo;
12909+ then the . fails against the \n. But the next thing we want
12910+ to do is match the \n against the \n; if we restored the
12911+ string value, we would be back at the foo.
12912+
12913+ Because this is used only in specific cases, we don't need to
12914+ check all the things that `on_failure_jump' does, to make
12915+ sure the right things get saved on the stack. Hence we don't
12916+ share its code. The only reason to push anything on the
12917+ stack at all is that otherwise we would have to change
12918+ `anychar's code to do something besides goto fail in this
12919+ case; that seems worse than this. */
12920+ case on_failure_keep_string_jump:
12921+ DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
12922+
12923+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12924+#ifdef _LIBC
12925+ DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
12926+#else
12927+ DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
12928+#endif
12929+
12930+ PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
12931+ break;
12932+
12933+
12934+ /* Uses of on_failure_jump:
12935+
12936+ Each alternative starts with an on_failure_jump that points
12937+ to the beginning of the next alternative. Each alternative
12938+ except the last ends with a jump that in effect jumps past
12939+ the rest of the alternatives. (They really jump to the
12940+ ending jump of the following alternative, because tensioning
12941+ these jumps is a hassle.)
12942+
12943+ Repeats start with an on_failure_jump that points past both
12944+ the repetition text and either the following jump or
12945+ pop_failure_jump back to this on_failure_jump. */
12946+ case on_failure_jump:
12947+ on_failure:
12948+ DEBUG_PRINT1 ("EXECUTING on_failure_jump");
12949+
12950+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12951+#ifdef _LIBC
12952+ DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
12953+#else
12954+ DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
12955+#endif
12956+
12957+ /* If this on_failure_jump comes right before a group (i.e.,
12958+ the original * applied to a group), save the information
12959+ for that group and all inner ones, so that if we fail back
12960+ to this point, the group's information will be correct.
12961+ For example, in \(a*\)*\1, we need the preceding group,
12962+ and in \(zz\(a*\)b*\)\2, we need the inner group. */
12963+
12964+ /* We can't use `p' to check ahead because we push
12965+ a failure point to `p + mcnt' after we do this. */
12966+ p1 = p;
12967+
12968+ /* We need to skip no_op's before we look for the
12969+ start_memory in case this on_failure_jump is happening as
12970+ the result of a completed succeed_n, as in \(a\)\{1,3\}b\1
12971+ against aba. */
12972+ while (p1 < pend && (re_opcode_t) *p1 == no_op)
12973+ p1++;
12974+
12975+ if (p1 < pend && (re_opcode_t) *p1 == start_memory)
12976+ {
12977+ /* We have a new highest active register now. This will
12978+ get reset at the start_memory we are about to get to,
12979+ but we will have saved all the registers relevant to
12980+ this repetition op, as described above. */
12981+ highest_active_reg = *(p1 + 1) + *(p1 + 2);
12982+ if (lowest_active_reg == NO_LOWEST_ACTIVE_REG)
12983+ lowest_active_reg = *(p1 + 1);
12984+ }
12985+
12986+ DEBUG_PRINT1 (":\n");
12987+ PUSH_FAILURE_POINT (p + mcnt, d, -2);
12988+ break;
12989+
12990+
12991+ /* A smart repeat ends with `maybe_pop_jump'.
12992+ We change it to either `pop_failure_jump' or `jump'. */
12993+ case maybe_pop_jump:
12994+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
12995+ DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt);
12996+ {
12997+ register UCHAR_T *p2 = p;
12998+
12999+ /* Compare the beginning of the repeat with what in the
13000+ pattern follows its end. If we can establish that there
13001+ is nothing that they would both match, i.e., that we
13002+ would have to backtrack because of (as in, e.g., `a*a')
13003+ then we can change to pop_failure_jump, because we'll
13004+ never have to backtrack.
13005+
13006+ This is not true in the case of alternatives: in
13007+ `(a|ab)*' we do need to backtrack to the `ab' alternative
13008+ (e.g., if the string was `ab'). But instead of trying to
13009+ detect that here, the alternative has put on a dummy
13010+ failure point which is what we will end up popping. */
13011+
13012+ /* Skip over open/close-group commands.
13013+ If what follows this loop is a ...+ construct,
13014+ look at what begins its body, since we will have to
13015+ match at least one of that. */
13016+ while (1)
13017+ {
13018+ if (p2 + 2 < pend
13019+ && ((re_opcode_t) *p2 == stop_memory
13020+ || (re_opcode_t) *p2 == start_memory))
13021+ p2 += 3;
13022+ else if (p2 + 2 + 2 * OFFSET_ADDRESS_SIZE < pend
13023+ && (re_opcode_t) *p2 == dummy_failure_jump)
13024+ p2 += 2 + 2 * OFFSET_ADDRESS_SIZE;
13025+ else
13026+ break;
13027+ }
13028+
13029+ p1 = p + mcnt;
13030+ /* p1[0] ... p1[2] are the `on_failure_jump' corresponding
13031+ to the `maybe_finalize_jump' of this case. Examine what
13032+ follows. */
13033+
13034+ /* If we're at the end of the pattern, we can change. */
13035+ if (p2 == pend)
13036+ {
13037+ /* Consider what happens when matching ":\(.*\)"
13038+ against ":/". I don't really understand this code
13039+ yet. */
13040+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
13041+ pop_failure_jump;
13042+ DEBUG_PRINT1
13043+ (" End of pattern: change to `pop_failure_jump'.\n");
13044+ }
13045+
13046+ else if ((re_opcode_t) *p2 == exactn
13047+#ifdef MBS_SUPPORT
13048+ || (re_opcode_t) *p2 == exactn_bin
13049+#endif
13050+ || (bufp->newline_anchor && (re_opcode_t) *p2 == endline))
13051+ {
13052+ register UCHAR_T c
13053+ = *p2 == (UCHAR_T) endline ? '\n' : p2[2];
13054+
13055+ if (((re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn
13056+#ifdef MBS_SUPPORT
13057+ || (re_opcode_t) p1[1+OFFSET_ADDRESS_SIZE] == exactn_bin
13058+#endif
13059+ ) && p1[3+OFFSET_ADDRESS_SIZE] != c)
13060+ {
13061+ p[-(1+OFFSET_ADDRESS_SIZE)] = (UCHAR_T)
13062+ pop_failure_jump;
13063+#ifdef WCHAR
13064+ DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n",
13065+ (wint_t) c,
13066+ (wint_t) p1[3+OFFSET_ADDRESS_SIZE]);
13067+#else
13068+ DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
13069+ (char) c,
13070+ (char) p1[3+OFFSET_ADDRESS_SIZE]);
13071+#endif
13072+ }
13073+
13074+#ifndef WCHAR
13075+ else if ((re_opcode_t) p1[3] == charset
13076+ || (re_opcode_t) p1[3] == charset_not)
13077+ {
13078+ int negate = (re_opcode_t) p1[3] == charset_not;
13079+
13080+ if (c < (unsigned) (p1[4] * BYTEWIDTH)
13081+ && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH)))
13082+ negate = !negate;
13083+
13084+ /* `negate' is equal to 1 if c would match, which means
13085+ that we can't change to pop_failure_jump. */
13086+ if (!negate)
13087+ {
13088+ p[-3] = (unsigned char) pop_failure_jump;
13089+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13090+ }
13091+ }
13092+#endif /* not WCHAR */
13093+ }
13094+#ifndef WCHAR
13095+ else if ((re_opcode_t) *p2 == charset)
13096+ {
13097+ /* We win if the first character of the loop is not part
13098+ of the charset. */
13099+ if ((re_opcode_t) p1[3] == exactn
13100+ && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
13101+ && (p2[2 + p1[5] / BYTEWIDTH]
13102+ & (1 << (p1[5] % BYTEWIDTH)))))
13103+ {
13104+ p[-3] = (unsigned char) pop_failure_jump;
13105+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13106+ }
13107+
13108+ else if ((re_opcode_t) p1[3] == charset_not)
13109+ {
13110+ int idx;
13111+ /* We win if the charset_not inside the loop
13112+ lists every character listed in the charset after. */
13113+ for (idx = 0; idx < (int) p2[1]; idx++)
13114+ if (! (p2[2 + idx] == 0
13115+ || (idx < (int) p1[4]
13116+ && ((p2[2 + idx] & ~ p1[5 + idx]) == 0))))
13117+ break;
13118+
13119+ if (idx == p2[1])
13120+ {
13121+ p[-3] = (unsigned char) pop_failure_jump;
13122+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13123+ }
13124+ }
13125+ else if ((re_opcode_t) p1[3] == charset)
13126+ {
13127+ int idx;
13128+ /* We win if the charset inside the loop
13129+ has no overlap with the one after the loop. */
13130+ for (idx = 0;
13131+ idx < (int) p2[1] && idx < (int) p1[4];
13132+ idx++)
13133+ if ((p2[2 + idx] & p1[5 + idx]) != 0)
13134+ break;
13135+
13136+ if (idx == p2[1] || idx == p1[4])
13137+ {
13138+ p[-3] = (unsigned char) pop_failure_jump;
13139+ DEBUG_PRINT1 (" No match => pop_failure_jump.\n");
13140+ }
13141+ }
13142+ }
13143+#endif /* not WCHAR */
13144+ }
13145+ p -= OFFSET_ADDRESS_SIZE; /* Point at relative address again. */
13146+ if ((re_opcode_t) p[-1] != pop_failure_jump)
13147+ {
13148+ p[-1] = (UCHAR_T) jump;
13149+ DEBUG_PRINT1 (" Match => jump.\n");
13150+ goto unconditional_jump;
13151+ }
13152+ /* Note fall through. */
13153+
13154+
13155+ /* The end of a simple repeat has a pop_failure_jump back to
13156+ its matching on_failure_jump, where the latter will push a
13157+ failure point. The pop_failure_jump takes off failure
13158+ points put on by this pop_failure_jump's matching
13159+ on_failure_jump; we got through the pattern to here from the
13160+ matching on_failure_jump, so didn't fail. */
13161+ case pop_failure_jump:
13162+ {
13163+ /* We need to pass separate storage for the lowest and
13164+ highest registers, even though we don't care about the
13165+ actual values. Otherwise, we will restore only one
13166+ register from the stack, since lowest will == highest in
13167+ `pop_failure_point'. */
13168+ active_reg_t dummy_low_reg, dummy_high_reg;
13169+ UCHAR_T *pdummy = NULL;
13170+ const CHAR_T *sdummy = NULL;
13171+
13172+ DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n");
13173+ POP_FAILURE_POINT (sdummy, pdummy,
13174+ dummy_low_reg, dummy_high_reg,
13175+ reg_dummy, reg_dummy, reg_info_dummy);
13176+ }
13177+ /* Note fall through. */
13178+
13179+ unconditional_jump:
13180+#ifdef _LIBC
13181+ DEBUG_PRINT2 ("\n%p: ", p);
13182+#else
13183+ DEBUG_PRINT2 ("\n0x%x: ", p);
13184+#endif
13185+ /* Note fall through. */
13186+
13187+ /* Unconditionally jump (without popping any failure points). */
13188+ case jump:
13189+ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
13190+ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
13191+ p += mcnt; /* Do the jump. */
13192+#ifdef _LIBC
13193+ DEBUG_PRINT2 ("(to %p).\n", p);
13194+#else
13195+ DEBUG_PRINT2 ("(to 0x%x).\n", p);
13196+#endif
13197+ break;
13198+
13199+
13200+ /* We need this opcode so we can detect where alternatives end
13201+ in `group_match_null_string_p' et al. */
13202+ case jump_past_alt:
13203+ DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n");
13204+ goto unconditional_jump;
13205+
13206+
13207+ /* Normally, the on_failure_jump pushes a failure point, which
13208+ then gets popped at pop_failure_jump. We will end up at
13209+ pop_failure_jump, also, and with a pattern of, say, `a+', we
13210+ are skipping over the on_failure_jump, so we have to push
13211+ something meaningless for pop_failure_jump to pop. */
13212+ case dummy_failure_jump:
13213+ DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n");
13214+ /* It doesn't matter what we push for the string here. What
13215+ the code at `fail' tests is the value for the pattern. */
13216+ PUSH_FAILURE_POINT (NULL, NULL, -2);
13217+ goto unconditional_jump;
13218+
13219+
13220+ /* At the end of an alternative, we need to push a dummy failure
13221+ point in case we are followed by a `pop_failure_jump', because
13222+ we don't want the failure point for the alternative to be
13223+ popped. For example, matching `(a|ab)*' against `aab'
13224+ requires that we match the `ab' alternative. */
13225+ case push_dummy_failure:
13226+ DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n");
13227+ /* See comments just above at `dummy_failure_jump' about the
13228+ two zeroes. */
13229+ PUSH_FAILURE_POINT (NULL, NULL, -2);
13230+ break;
13231+
13232+ /* Have to succeed matching what follows at least n times.
13233+ After that, handle like `on_failure_jump'. */
13234+ case succeed_n:
13235+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
13236+ DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt);
13237+
13238+ assert (mcnt >= 0);
13239+ /* Originally, this is how many times we HAVE to succeed. */
13240+ if (mcnt > 0)
13241+ {
13242+ mcnt--;
13243+ p += OFFSET_ADDRESS_SIZE;
13244+ STORE_NUMBER_AND_INCR (p, mcnt);
13245+#ifdef _LIBC
13246+ DEBUG_PRINT3 (" Setting %p to %d.\n", p - OFFSET_ADDRESS_SIZE
13247+ , mcnt);
13248+#else
13249+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - OFFSET_ADDRESS_SIZE
13250+ , mcnt);
13251+#endif
13252+ }
13253+ else if (mcnt == 0)
13254+ {
13255+#ifdef _LIBC
13256+ DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n",
13257+ p + OFFSET_ADDRESS_SIZE);
13258+#else
13259+ DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n",
13260+ p + OFFSET_ADDRESS_SIZE);
13261+#endif /* _LIBC */
13262+
13263+#ifdef WCHAR
13264+ p[1] = (UCHAR_T) no_op;
13265+#else
13266+ p[2] = (UCHAR_T) no_op;
13267+ p[3] = (UCHAR_T) no_op;
13268+#endif /* WCHAR */
13269+ goto on_failure;
13270+ }
13271+ break;
13272+
13273+ case jump_n:
13274+ EXTRACT_NUMBER (mcnt, p + OFFSET_ADDRESS_SIZE);
13275+ DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt);
13276+
13277+ /* Originally, this is how many times we CAN jump. */
13278+ if (mcnt)
13279+ {
13280+ mcnt--;
13281+ STORE_NUMBER (p + OFFSET_ADDRESS_SIZE, mcnt);
13282+
13283+#ifdef _LIBC
13284+ DEBUG_PRINT3 (" Setting %p to %d.\n", p + OFFSET_ADDRESS_SIZE,
13285+ mcnt);
13286+#else
13287+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + OFFSET_ADDRESS_SIZE,
13288+ mcnt);
13289+#endif /* _LIBC */
13290+ goto unconditional_jump;
13291+ }
13292+ /* If don't have to jump any more, skip over the rest of command. */
13293+ else
13294+ p += 2 * OFFSET_ADDRESS_SIZE;
13295+ break;
13296+
13297+ case set_number_at:
13298+ {
13299+ DEBUG_PRINT1 ("EXECUTING set_number_at.\n");
13300+
13301+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
13302+ p1 = p + mcnt;
13303+ EXTRACT_NUMBER_AND_INCR (mcnt, p);
13304+#ifdef _LIBC
13305+ DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
13306+#else
13307+ DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
13308+#endif
13309+ STORE_NUMBER (p1, mcnt);
13310+ break;
13311+ }
13312+
13313+#if 0
13314+ /* The DEC Alpha C compiler 3.x generates incorrect code for the
13315+ test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
13316+ AT_WORD_BOUNDARY, so this code is disabled. Expanding the
13317+ macro and introducing temporary variables works around the bug. */
13318+
13319+ case wordbound:
13320+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
13321+ if (AT_WORD_BOUNDARY (d))
13322+ break;
13323+ goto fail;
13324+
13325+ case notwordbound:
13326+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
13327+ if (AT_WORD_BOUNDARY (d))
13328+ goto fail;
13329+ break;
13330+#else
13331+ case wordbound:
13332+ {
13333+ boolean prevchar, thischar;
13334+
13335+ DEBUG_PRINT1 ("EXECUTING wordbound.\n");
13336+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
13337+ break;
13338+
13339+ prevchar = WORDCHAR_P (d - 1);
13340+ thischar = WORDCHAR_P (d);
13341+ if (prevchar != thischar)
13342+ break;
13343+ goto fail;
13344+ }
13345+
13346+ case notwordbound:
13347+ {
13348+ boolean prevchar, thischar;
13349+
13350+ DEBUG_PRINT1 ("EXECUTING notwordbound.\n");
13351+ if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
13352+ goto fail;
13353+
13354+ prevchar = WORDCHAR_P (d - 1);
13355+ thischar = WORDCHAR_P (d);
13356+ if (prevchar != thischar)
13357+ goto fail;
13358+ break;
13359+ }
13360+#endif
13361+
13362+ case wordbeg:
13363+ DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
13364+ if (!AT_STRINGS_END (d) && WORDCHAR_P (d)
13365+ && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1)))
13366+ break;
13367+ goto fail;
13368+
13369+ case wordend:
13370+ DEBUG_PRINT1 ("EXECUTING wordend.\n");
13371+ if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1)
13372+ && (AT_STRINGS_END (d) || !WORDCHAR_P (d)))
13373+ break;
13374+ goto fail;
13375+
13376+#ifdef emacs
13377+ case before_dot:
13378+ DEBUG_PRINT1 ("EXECUTING before_dot.\n");
13379+ if (PTR_CHAR_POS ((unsigned char *) d) >= point)
13380+ goto fail;
13381+ break;
13382+
13383+ case at_dot:
13384+ DEBUG_PRINT1 ("EXECUTING at_dot.\n");
13385+ if (PTR_CHAR_POS ((unsigned char *) d) != point)
13386+ goto fail;
13387+ break;
13388+
13389+ case after_dot:
13390+ DEBUG_PRINT1 ("EXECUTING after_dot.\n");
13391+ if (PTR_CHAR_POS ((unsigned char *) d) <= point)
13392+ goto fail;
13393+ break;
13394+
13395+ case syntaxspec:
13396+ DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);
13397+ mcnt = *p++;
13398+ goto matchsyntax;
13399+
13400+ case wordchar:
13401+ DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n");
13402+ mcnt = (int) Sword;
13403+ matchsyntax:
13404+ PREFETCH ();
13405+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
13406+ d++;
13407+ if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt)
13408+ goto fail;
13409+ SET_REGS_MATCHED ();
13410+ break;
13411+
13412+ case notsyntaxspec:
13413+ DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt);
13414+ mcnt = *p++;
13415+ goto matchnotsyntax;
13416+
13417+ case notwordchar:
13418+ DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n");
13419+ mcnt = (int) Sword;
13420+ matchnotsyntax:
13421+ PREFETCH ();
13422+ /* Can't use *d++ here; SYNTAX may be an unsafe macro. */
13423+ d++;
13424+ if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt)
13425+ goto fail;
13426+ SET_REGS_MATCHED ();
13427+ break;
13428+
13429+#else /* not emacs */
13430+ case wordchar:
13431+ DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n");
13432+ PREFETCH ();
13433+ if (!WORDCHAR_P (d))
13434+ goto fail;
13435+ SET_REGS_MATCHED ();
13436+ d++;
13437+ break;
13438+
13439+ case notwordchar:
13440+ DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n");
13441+ PREFETCH ();
13442+ if (WORDCHAR_P (d))
13443+ goto fail;
13444+ SET_REGS_MATCHED ();
13445+ d++;
13446+ break;
13447+#endif /* not emacs */
13448+
13449+ default:
13450+ abort ();
13451+ }
13452+ continue; /* Successfully executed one pattern command; keep going. */
13453+
13454+
13455+ /* We goto here if a matching operation fails. */
13456+ fail:
13457+ if (!FAIL_STACK_EMPTY ())
13458+ { /* A restart point is known. Restore to that state. */
13459+ DEBUG_PRINT1 ("\nFAIL:\n");
13460+ POP_FAILURE_POINT (d, p,
13461+ lowest_active_reg, highest_active_reg,
13462+ regstart, regend, reg_info);
13463+
13464+ /* If this failure point is a dummy, try the next one. */
13465+ if (!p)
13466+ goto fail;
13467+
13468+ /* If we failed to the end of the pattern, don't examine *p. */
13469+ assert (p <= pend);
13470+ if (p < pend)
13471+ {
13472+ boolean is_a_jump_n = false;
13473+
13474+ /* If failed to a backwards jump that's part of a repetition
13475+ loop, need to pop this failure point and use the next one. */
13476+ switch ((re_opcode_t) *p)
13477+ {
13478+ case jump_n:
13479+ is_a_jump_n = true;
13480+ case maybe_pop_jump:
13481+ case pop_failure_jump:
13482+ case jump:
13483+ p1 = p + 1;
13484+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13485+ p1 += mcnt;
13486+
13487+ if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n)
13488+ || (!is_a_jump_n
13489+ && (re_opcode_t) *p1 == on_failure_jump))
13490+ goto fail;
13491+ break;
13492+ default:
13493+ /* do nothing */ ;
13494+ }
13495+ }
13496+
13497+ if (d >= string1 && d <= end1)
13498+ dend = end_match_1;
13499+ }
13500+ else
13501+ break; /* Matching at this starting point really fails. */
13502+ } /* for (;;) */
13503+
13504+ if (best_regs_set)
13505+ goto restore_best_regs;
13506+
13507+ FREE_VARIABLES ();
13508+
13509+ return -1; /* Failure to match. */
13510+} /* re_match_2 */
13511+
13512+/* Subroutine definitions for re_match_2. */
13513+
13514+
13515+/* We are passed P pointing to a register number after a start_memory.
13516+
13517+ Return true if the pattern up to the corresponding stop_memory can
13518+ match the empty string, and false otherwise.
13519+
13520+ If we find the matching stop_memory, sets P to point to one past its number.
13521+ Otherwise, sets P to an undefined byte less than or equal to END.
13522+
13523+ We don't handle duplicates properly (yet). */
13524+
13525+static boolean
13526+PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
13527+ PREFIX(register_info_type) *reg_info)
13528+{
13529+ int mcnt;
13530+ /* Point to after the args to the start_memory. */
13531+ UCHAR_T *p1 = *p + 2;
13532+
13533+ while (p1 < end)
13534+ {
13535+ /* Skip over opcodes that can match nothing, and return true or
13536+ false, as appropriate, when we get to one that can't, or to the
13537+ matching stop_memory. */
13538+
13539+ switch ((re_opcode_t) *p1)
13540+ {
13541+ /* Could be either a loop or a series of alternatives. */
13542+ case on_failure_jump:
13543+ p1++;
13544+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13545+
13546+ /* If the next operation is not a jump backwards in the
13547+ pattern. */
13548+
13549+ if (mcnt >= 0)
13550+ {
13551+ /* Go through the on_failure_jumps of the alternatives,
13552+ seeing if any of the alternatives cannot match nothing.
13553+ The last alternative starts with only a jump,
13554+ whereas the rest start with on_failure_jump and end
13555+ with a jump, e.g., here is the pattern for `a|b|c':
13556+
13557+ /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6
13558+ /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3
13559+ /exactn/1/c
13560+
13561+ So, we have to first go through the first (n-1)
13562+ alternatives and then deal with the last one separately. */
13563+
13564+
13565+ /* Deal with the first (n-1) alternatives, which start
13566+ with an on_failure_jump (see above) that jumps to right
13567+ past a jump_past_alt. */
13568+
13569+ while ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] ==
13570+ jump_past_alt)
13571+ {
13572+ /* `mcnt' holds how many bytes long the alternative
13573+ is, including the ending `jump_past_alt' and
13574+ its number. */
13575+
13576+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt -
13577+ (1 + OFFSET_ADDRESS_SIZE),
13578+ reg_info))
13579+ return false;
13580+
13581+ /* Move to right after this alternative, including the
13582+ jump_past_alt. */
13583+ p1 += mcnt;
13584+
13585+ /* Break if it's the beginning of an n-th alternative
13586+ that doesn't begin with an on_failure_jump. */
13587+ if ((re_opcode_t) *p1 != on_failure_jump)
13588+ break;
13589+
13590+ /* Still have to check that it's not an n-th
13591+ alternative that starts with an on_failure_jump. */
13592+ p1++;
13593+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13594+ if ((re_opcode_t) p1[mcnt-(1+OFFSET_ADDRESS_SIZE)] !=
13595+ jump_past_alt)
13596+ {
13597+ /* Get to the beginning of the n-th alternative. */
13598+ p1 -= 1 + OFFSET_ADDRESS_SIZE;
13599+ break;
13600+ }
13601+ }
13602+
13603+ /* Deal with the last alternative: go back and get number
13604+ of the `jump_past_alt' just before it. `mcnt' contains
13605+ the length of the alternative. */
13606+ EXTRACT_NUMBER (mcnt, p1 - OFFSET_ADDRESS_SIZE);
13607+
13608+ if (!PREFIX(alt_match_null_string_p) (p1, p1 + mcnt, reg_info))
13609+ return false;
13610+
13611+ p1 += mcnt; /* Get past the n-th alternative. */
13612+ } /* if mcnt > 0 */
13613+ break;
13614+
13615+
13616+ case stop_memory:
13617+ assert (p1[1] == **p);
13618+ *p = p1 + 2;
13619+ return true;
13620+
13621+
13622+ default:
13623+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
13624+ return false;
13625+ }
13626+ } /* while p1 < end */
13627+
13628+ return false;
13629+} /* group_match_null_string_p */
13630+
13631+
13632+/* Similar to group_match_null_string_p, but doesn't deal with alternatives:
13633+ It expects P to be the first byte of a single alternative and END one
13634+ byte past the last. The alternative can contain groups. */
13635+
13636+static boolean
13637+PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end,
13638+ PREFIX(register_info_type) *reg_info)
13639+{
13640+ int mcnt;
13641+ UCHAR_T *p1 = p;
13642+
13643+ while (p1 < end)
13644+ {
13645+ /* Skip over opcodes that can match nothing, and break when we get
13646+ to one that can't. */
13647+
13648+ switch ((re_opcode_t) *p1)
13649+ {
13650+ /* It's a loop. */
13651+ case on_failure_jump:
13652+ p1++;
13653+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13654+ p1 += mcnt;
13655+ break;
13656+
13657+ default:
13658+ if (!PREFIX(common_op_match_null_string_p) (&p1, end, reg_info))
13659+ return false;
13660+ }
13661+ } /* while p1 < end */
13662+
13663+ return true;
13664+} /* alt_match_null_string_p */
13665+
13666+
13667+/* Deals with the ops common to group_match_null_string_p and
13668+ alt_match_null_string_p.
13669+
13670+ Sets P to one after the op and its arguments, if any. */
13671+
13672+static boolean
13673+PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
13674+ PREFIX(register_info_type) *reg_info)
13675+{
13676+ int mcnt;
13677+ boolean ret;
13678+ int reg_no;
13679+ UCHAR_T *p1 = *p;
13680+
13681+ switch ((re_opcode_t) *p1++)
13682+ {
13683+ case no_op:
13684+ case begline:
13685+ case endline:
13686+ case begbuf:
13687+ case endbuf:
13688+ case wordbeg:
13689+ case wordend:
13690+ case wordbound:
13691+ case notwordbound:
13692+#ifdef emacs
13693+ case before_dot:
13694+ case at_dot:
13695+ case after_dot:
13696+#endif
13697+ break;
13698+
13699+ case start_memory:
13700+ reg_no = *p1;
13701+ assert (reg_no > 0 && reg_no <= MAX_REGNUM);
13702+ ret = PREFIX(group_match_null_string_p) (&p1, end, reg_info);
13703+
13704+ /* Have to set this here in case we're checking a group which
13705+ contains a group and a back reference to it. */
13706+
13707+ if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE)
13708+ REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret;
13709+
13710+ if (!ret)
13711+ return false;
13712+ break;
13713+
13714+ /* If this is an optimized succeed_n for zero times, make the jump. */
13715+ case jump:
13716+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13717+ if (mcnt >= 0)
13718+ p1 += mcnt;
13719+ else
13720+ return false;
13721+ break;
13722+
13723+ case succeed_n:
13724+ /* Get to the number of times to succeed. */
13725+ p1 += OFFSET_ADDRESS_SIZE;
13726+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13727+
13728+ if (mcnt == 0)
13729+ {
13730+ p1 -= 2 * OFFSET_ADDRESS_SIZE;
13731+ EXTRACT_NUMBER_AND_INCR (mcnt, p1);
13732+ p1 += mcnt;
13733+ }
13734+ else
13735+ return false;
13736+ break;
13737+
13738+ case duplicate:
13739+ if (!REG_MATCH_NULL_STRING_P (reg_info[*p1]))
13740+ return false;
13741+ break;
13742+
13743+ case set_number_at:
13744+ p1 += 2 * OFFSET_ADDRESS_SIZE;
13745+
13746+ default:
13747+ /* All other opcodes mean we cannot match the empty string. */
13748+ return false;
13749+ }
13750+
13751+ *p = p1;
13752+ return true;
13753+} /* common_op_match_null_string_p */
13754+
13755+
13756+/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
13757+ bytes; nonzero otherwise. */
13758+
13759+static int
13760+PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, register int len,
13761+ RE_TRANSLATE_TYPE translate)
13762+{
13763+ register const UCHAR_T *p1 = (const UCHAR_T *) s1;
13764+ register const UCHAR_T *p2 = (const UCHAR_T *) s2;
13765+ while (len)
13766+ {
13767+#ifdef WCHAR
13768+ if (((*p1<=0xff)?translate[*p1++]:*p1++)
13769+ != ((*p2<=0xff)?translate[*p2++]:*p2++))
13770+ return 1;
13771+#else /* BYTE */
13772+ if (translate[*p1++] != translate[*p2++]) return 1;
13773+#endif /* WCHAR */
13774+ len--;
13775+ }
13776+ return 0;
13777+}
13778+
13779+
13780+#else /* not INSIDE_RECURSION */
13781+
13782+/* Entry points for GNU code. */
13783+
13784+/* re_compile_pattern is the GNU regular expression compiler: it
13785+ compiles PATTERN (of length SIZE) and puts the result in BUFP.
13786+ Returns 0 if the pattern was valid, otherwise an error string.
13787+
13788+ Assumes the `allocated' (and perhaps `buffer') and `translate' fields
13789+ are set in BUFP on entry.
13790+
13791+ We call regex_compile to do the actual compilation. */
13792+
13793+const char *
13794+re_compile_pattern (const char *pattern, size_t length,
13795+ struct re_pattern_buffer *bufp)
13796+{
13797+ reg_errcode_t ret;
13798+
13799+ /* GNU code is written to assume at least RE_NREGS registers will be set
13800+ (and at least one extra will be -1). */
13801+ bufp->regs_allocated = REGS_UNALLOCATED;
13802+
13803+ /* And GNU code determines whether or not to get register information
13804+ by passing null for the REGS argument to re_match, etc., not by
13805+ setting no_sub. */
13806+ bufp->no_sub = 0;
13807+
13808+ /* Match anchors at newline. */
13809+ bufp->newline_anchor = 1;
13810+
13811+# ifdef MBS_SUPPORT
13812+ if (MB_CUR_MAX != 1)
13813+ ret = wcs_regex_compile (pattern, length, re_syntax_options, bufp);
13814+ else
13815+# endif
13816+ ret = byte_regex_compile (pattern, length, re_syntax_options, bufp);
13817+
13818+ if (!ret)
13819+ return NULL;
13820+ return gettext (re_error_msgid[(int) ret]);
13821+}
13822+#ifdef _LIBC
13823+weak_alias (__re_compile_pattern, re_compile_pattern)
13824+#endif
13825+
13826+/* Entry points compatible with 4.2 BSD regex library. We don't define
13827+ them unless specifically requested. */
13828+
13829+#if defined _REGEX_RE_COMP || defined _LIBC
13830+
13831+/* BSD has one and only one pattern buffer. */
13832+static struct re_pattern_buffer re_comp_buf;
13833+
13834+char *
13835+#ifdef _LIBC
13836+/* Make these definitions weak in libc, so POSIX programs can redefine
13837+ these names if they don't use our functions, and still use
13838+ regcomp/regexec below without link errors. */
13839+weak_function
13840+#endif
13841+re_comp (const char *s)
13842+{
13843+ reg_errcode_t ret;
13844+
13845+ if (!s)
13846+ {
13847+ if (!re_comp_buf.buffer)
13848+ return (char *) gettext ("No previous regular expression");
13849+ return 0;
13850+ }
13851+
13852+ if (!re_comp_buf.buffer)
13853+ {
13854+ re_comp_buf.buffer = (unsigned char *) malloc (200);
13855+ if (re_comp_buf.buffer == NULL)
13856+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
13857+ re_comp_buf.allocated = 200;
13858+
13859+ re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
13860+ if (re_comp_buf.fastmap == NULL)
13861+ return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
13862+ }
13863+
13864+ /* Since `re_exec' always passes NULL for the `regs' argument, we
13865+ don't need to initialize the pattern buffer fields which affect it. */
13866+
13867+ /* Match anchors at newlines. */
13868+ re_comp_buf.newline_anchor = 1;
13869+
13870+# ifdef MBS_SUPPORT
13871+ if (MB_CUR_MAX != 1)
13872+ ret = wcs_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
13873+ else
13874+# endif
13875+ ret = byte_regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf);
13876+
13877+ if (!ret)
13878+ return NULL;
13879+
13880+ /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
13881+ return (char *) gettext (re_error_msgid[(int) ret]);
13882+}
13883+
13884+
13885+int
13886+#ifdef _LIBC
13887+weak_function
13888+#endif
13889+re_exec (const char *s)
13890+{
13891+ const int len = strlen (s);
13892+ return
13893+ 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0);
13894+}
13895+
13896+#endif /* _REGEX_RE_COMP */
13897+
13898+/* POSIX.2 functions. Don't define these for Emacs. */
13899+
13900+#ifndef emacs
13901+
13902+/* regcomp takes a regular expression as a string and compiles it.
13903+
13904+ PREG is a regex_t *. We do not expect any fields to be initialized,
13905+ since POSIX says we shouldn't. Thus, we set
13906+
13907+ `buffer' to the compiled pattern;
13908+ `used' to the length of the compiled pattern;
13909+ `syntax' to RE_SYNTAX_POSIX_EXTENDED if the
13910+ REG_EXTENDED bit in CFLAGS is set; otherwise, to
13911+ RE_SYNTAX_POSIX_BASIC;
13912+ `newline_anchor' to REG_NEWLINE being set in CFLAGS;
13913+ `fastmap' to an allocated space for the fastmap;
13914+ `fastmap_accurate' to zero;
13915+ `re_nsub' to the number of subexpressions in PATTERN.
13916+
13917+ PATTERN is the address of the pattern string.
13918+
13919+ CFLAGS is a series of bits which affect compilation.
13920+
13921+ If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we
13922+ use POSIX basic syntax.
13923+
13924+ If REG_NEWLINE is set, then . and [^...] don't match newline.
13925+ Also, regexec will try a match beginning after every newline.
13926+
13927+ If REG_ICASE is set, then we considers upper- and lowercase
13928+ versions of letters to be equivalent when matching.
13929+
13930+ If REG_NOSUB is set, then when PREG is passed to regexec, that
13931+ routine will report only success or failure, and nothing about the
13932+ registers.
13933+
13934+ It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
13935+ the return codes and their meanings.) */
13936+
13937+int
13938+regcomp (regex_t *preg, const char *pattern, int cflags)
13939+{
13940+ reg_errcode_t ret;
13941+ reg_syntax_t syntax
13942+ = (cflags & REG_EXTENDED) ?
13943+ RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
13944+
13945+ /* regex_compile will allocate the space for the compiled pattern. */
13946+ preg->buffer = 0;
13947+ preg->allocated = 0;
13948+ preg->used = 0;
13949+
13950+ /* Try to allocate space for the fastmap. */
13951+ preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
13952+
13953+ if (cflags & REG_ICASE)
13954+ {
13955+ int i;
13956+
13957+ preg->translate
13958+ = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
13959+ * sizeof (*(RE_TRANSLATE_TYPE)0));
13960+ if (preg->translate == NULL)
13961+ return (int) REG_ESPACE;
13962+
13963+ /* Map uppercase characters to corresponding lowercase ones. */
13964+ for (i = 0; i < CHAR_SET_SIZE; i++)
13965+ preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
13966+ }
13967+ else
13968+ preg->translate = NULL;
13969+
13970+ /* If REG_NEWLINE is set, newlines are treated differently. */
13971+ if (cflags & REG_NEWLINE)
13972+ { /* REG_NEWLINE implies neither . nor [^...] match newline. */
13973+ syntax &= ~RE_DOT_NEWLINE;
13974+ syntax |= RE_HAT_LISTS_NOT_NEWLINE;
13975+ /* It also changes the matching behavior. */
13976+ preg->newline_anchor = 1;
13977+ }
13978+ else
13979+ preg->newline_anchor = 0;
13980+
13981+ preg->no_sub = !!(cflags & REG_NOSUB);
13982+
13983+ /* POSIX says a null character in the pattern terminates it, so we
13984+ can use strlen here in compiling the pattern. */
13985+# ifdef MBS_SUPPORT
13986+ if (MB_CUR_MAX != 1)
13987+ ret = wcs_regex_compile (pattern, strlen (pattern), syntax, preg);
13988+ else
13989+# endif
13990+ ret = byte_regex_compile (pattern, strlen (pattern), syntax, preg);
13991+
13992+ /* POSIX doesn't distinguish between an unmatched open-group and an
13993+ unmatched close-group: both are REG_EPAREN. */
13994+ if (ret == REG_ERPAREN) ret = REG_EPAREN;
13995+
13996+ if (ret == REG_NOERROR && preg->fastmap)
13997+ {
13998+ /* Compute the fastmap now, since regexec cannot modify the pattern
13999+ buffer. */
14000+ if (re_compile_fastmap (preg) == -2)
14001+ {
14002+ /* Some error occurred while computing the fastmap, just forget
14003+ about it. */
14004+ free (preg->fastmap);
14005+ preg->fastmap = NULL;
14006+ }
14007+ }
14008+
14009+ return (int) ret;
14010+}
14011+#ifdef _LIBC
14012+weak_alias (__regcomp, regcomp)
14013+#endif
14014+
14015+
14016+/* regexec searches for a given pattern, specified by PREG, in the
14017+ string STRING.
14018+
14019+ If NMATCH is zero or REG_NOSUB was set in the cflags argument to
14020+ `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at
14021+ least NMATCH elements, and we set them to the offsets of the
14022+ corresponding matched substrings.
14023+
14024+ EFLAGS specifies `execution flags' which affect matching: if
14025+ REG_NOTBOL is set, then ^ does not match at the beginning of the
14026+ string; if REG_NOTEOL is set, then $ does not match at the end.
14027+
14028+ We return 0 if we find a match and REG_NOMATCH if not. */
14029+
14030+int
14031+regexec (const regex_t *preg, const char *string, size_t nmatch,
14032+ regmatch_t pmatch[], int eflags)
14033+{
14034+ int ret;
14035+ struct re_registers regs;
14036+ regex_t private_preg;
14037+ int len = strlen (string);
14038+ boolean want_reg_info = !preg->no_sub && nmatch > 0;
14039+
14040+ private_preg = *preg;
14041+
14042+ private_preg.not_bol = !!(eflags & REG_NOTBOL);
14043+ private_preg.not_eol = !!(eflags & REG_NOTEOL);
14044+
14045+ /* The user has told us exactly how many registers to return
14046+ information about, via `nmatch'. We have to pass that on to the
14047+ matching routines. */
14048+ private_preg.regs_allocated = REGS_FIXED;
14049+
14050+ if (want_reg_info)
14051+ {
14052+ regs.num_regs = nmatch;
14053+ regs.start = TALLOC (nmatch * 2, regoff_t);
14054+ if (regs.start == NULL)
14055+ return (int) REG_NOMATCH;
14056+ regs.end = regs.start + nmatch;
14057+ }
14058+
14059+ /* Perform the searching operation. */
14060+ ret = re_search (&private_preg, string, len,
14061+ /* start: */ 0, /* range: */ len,
14062+ want_reg_info ? &regs : (struct re_registers *) 0);
14063+
14064+ /* Copy the register information to the POSIX structure. */
14065+ if (want_reg_info)
14066+ {
14067+ if (ret >= 0)
14068+ {
14069+ unsigned r;
14070+
14071+ for (r = 0; r < nmatch; r++)
14072+ {
14073+ pmatch[r].rm_so = regs.start[r];
14074+ pmatch[r].rm_eo = regs.end[r];
14075+ }
14076+ }
14077+
14078+ /* If we needed the temporary register info, free the space now. */
14079+ free (regs.start);
14080+ }
14081+
14082+ /* We want zero return to mean success, unlike `re_search'. */
14083+ return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
14084+}
14085+#ifdef _LIBC
14086+/* EGLIBC: This is handled in regexec-compat.c. */
14087+/*weak_alias (__regexec, regexec)*/
14088+#include "regexec-compat.c"
14089+#endif
14090+
14091+
14092+/* Returns a message corresponding to an error code, ERRCODE, returned
14093+ from either regcomp or regexec. We don't use PREG here. */
14094+
14095+size_t
14096+regerror (int errcode, const regex_t *preg __attribute__ ((unused)),
14097+ char *errbuf, size_t errbuf_size)
14098+{
14099+ const char *msg;
14100+ size_t msg_size;
14101+
14102+ if (errcode < 0
14103+ || errcode >= (int) (sizeof (re_error_msgid)
14104+ / sizeof (re_error_msgid[0])))
14105+ /* Only error codes returned by the rest of the code should be passed
14106+ to this routine. If we are given anything else, or if other regex
14107+ code generates an invalid error code, then the program has a bug.
14108+ Dump core so we can fix it. */
14109+ abort ();
14110+
14111+ msg = gettext (re_error_msgid[errcode]);
14112+
14113+ msg_size = strlen (msg) + 1; /* Includes the null. */
14114+
14115+ if (errbuf_size != 0)
14116+ {
14117+ if (msg_size > errbuf_size)
14118+ {
14119+#if defined HAVE_MEMPCPY || defined _LIBC
14120+ *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
14121+#else
14122+ memcpy (errbuf, msg, errbuf_size - 1);
14123+ errbuf[errbuf_size - 1] = 0;
14124+#endif
14125+ }
14126+ else
14127+ memcpy (errbuf, msg, msg_size);
14128+ }
14129+
14130+ return msg_size;
14131+}
14132+#ifdef _LIBC
14133+weak_alias (__regerror, regerror)
14134+#endif
14135+
14136+
14137+/* Free dynamically allocated space used by PREG. */
14138+
14139+void
14140+regfree (regex_t *preg)
14141+{
14142+ if (preg->buffer != NULL)
14143+ free (preg->buffer);
14144+ preg->buffer = NULL;
14145+
14146+ preg->allocated = 0;
14147+ preg->used = 0;
14148+
14149+ if (preg->fastmap != NULL)
14150+ free (preg->fastmap);
14151+ preg->fastmap = NULL;
14152+ preg->fastmap_accurate = 0;
14153+
14154+ if (preg->translate != NULL)
14155+ free (preg->translate);
14156+ preg->translate = NULL;
14157+}
14158+#ifdef _LIBC
14159+weak_alias (__regfree, regfree)
14160+#endif
14161+
14162+#endif /* not emacs */
14163+
14164+#endif /* not INSIDE_RECURSION */
14165+
14166+
14167+#undef STORE_NUMBER
14168+#undef STORE_NUMBER_AND_INCR
14169+#undef EXTRACT_NUMBER
14170+#undef EXTRACT_NUMBER_AND_INCR
14171+
14172+#undef DEBUG_PRINT_COMPILED_PATTERN
14173+#undef DEBUG_PRINT_DOUBLE_STRING
14174+
14175+#undef INIT_FAIL_STACK
14176+#undef RESET_FAIL_STACK
14177+#undef DOUBLE_FAIL_STACK
14178+#undef PUSH_PATTERN_OP
14179+#undef PUSH_FAILURE_POINTER
14180+#undef PUSH_FAILURE_INT
14181+#undef PUSH_FAILURE_ELT
14182+#undef POP_FAILURE_POINTER
14183+#undef POP_FAILURE_INT
14184+#undef POP_FAILURE_ELT
14185+#undef DEBUG_PUSH
14186+#undef DEBUG_POP
14187+#undef PUSH_FAILURE_POINT
14188+#undef POP_FAILURE_POINT
14189+
14190+#undef REG_UNSET_VALUE
14191+#undef REG_UNSET
14192+
14193+#undef PATFETCH
14194+#undef PATFETCH_RAW
14195+#undef PATUNFETCH
14196+#undef TRANSLATE
14197+
14198+#undef INIT_BUF_SIZE
14199+#undef GET_BUFFER_SPACE
14200+#undef BUF_PUSH
14201+#undef BUF_PUSH_2
14202+#undef BUF_PUSH_3
14203+#undef STORE_JUMP
14204+#undef STORE_JUMP2
14205+#undef INSERT_JUMP
14206+#undef INSERT_JUMP2
14207+#undef EXTEND_BUFFER
14208+#undef GET_UNSIGNED_NUMBER
14209+#undef FREE_STACK_RETURN
14210+
14211+# undef POINTER_TO_OFFSET
14212+# undef MATCHING_IN_FRST_STRING
14213+# undef PREFETCH
14214+# undef AT_STRINGS_BEG
14215+# undef AT_STRINGS_END
14216+# undef WORDCHAR_P
14217+# undef FREE_VAR
14218+# undef FREE_VARIABLES
14219+# undef NO_HIGHEST_ACTIVE_REG
14220+# undef NO_LOWEST_ACTIVE_REG
14221+
14222+# undef CHAR_T
14223+# undef UCHAR_T
14224+# undef COMPILED_BUFFER_VAR
14225+# undef OFFSET_ADDRESS_SIZE
14226+# undef CHAR_CLASS_SIZE
14227+# undef PREFIX
14228+# undef ARG_PREFIX
14229+# undef PUT_CHAR
14230+# undef BYTE
14231+# undef WCHAR
14232+
14233+# define DEFINED_ONCE
14234Index: git/pwd/Makefile
14235===================================================================
14236--- git.orig/pwd/Makefile 2014-08-29 20:00:53.316070587 -0700
14237+++ git/pwd/Makefile 2014-08-29 20:01:15.232070587 -0700
14238@@ -18,6 +18,8 @@
14239 #
14240 # Sub-makefile for pwd portion of the library.
14241 #
14242+include ../option-groups.mak
14243+
14244 subdir := pwd
14245
14246 include ../Makeconfig
14247Index: git/resolv/Makefile
14248===================================================================
14249--- git.orig/resolv/Makefile 2014-08-29 20:00:53.320070587 -0700
14250+++ git/resolv/Makefile 2014-08-29 20:01:15.232070587 -0700
14251@@ -18,6 +18,8 @@
14252 #
14253 # Sub-makefile for resolv portion of the library.
14254 #
14255+include ../option-groups.mak
14256+
14257 subdir := resolv
14258
14259 include ../Makeconfig
14260@@ -27,20 +29,21 @@
14261 arpa/nameser.h arpa/nameser_compat.h \
14262 sys/bitypes.h
14263
14264-routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
14265- res_hconf res_libc res-state
14266+routines-$(OPTION_EGLIBC_INET) \
14267+ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \
14268+ res_hconf res_libc res-state
14269
14270-tests = tst-aton tst-leaks tst-inet_ntop
14271-xtests = tst-leaks2
14272+tests-$(OPTION_EGLIBC_INET) += tst-aton tst-leaks tst-inet_ntop
14273+xtests-$(OPTION_EGLIBC_INET) += tst-leaks2
14274
14275 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
14276
14277-extra-libs := libresolv libnss_dns
14278+extra-libs-$(OPTION_EGLIBC_INET) += libresolv libnss_dns
14279 ifeq ($(have-thread-library),yes)
14280-extra-libs += libanl
14281-routines += gai_sigqueue
14282+extra-libs-$(OPTION_EGLIBC_INET_ANL) += libanl
14283+routines-$(OPTION_EGLIBC_INET) += gai_sigqueue
14284 endif
14285-extra-libs-others = $(extra-libs)
14286+extra-libs-others-y += $(extra-libs-y)
14287 libresolv-routines := gethnamaddr res_comp res_debug \
14288 res_data res_mkquery res_query res_send \
14289 inet_net_ntop inet_net_pton inet_neta base64 \
14290@@ -60,7 +63,7 @@
14291 static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
14292 endif
14293
14294-ifeq (yesyes,$(build-shared)$(have-thread-library))
14295+ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET_ANL))
14296 tests: $(objpfx)ga_test
14297 endif
14298
14299Index: git/stdio-common/fxprintf.c
14300===================================================================
14301--- git.orig/stdio-common/fxprintf.c 2014-08-29 20:00:53.544070587 -0700
14302+++ git/stdio-common/fxprintf.c 2014-08-29 20:01:15.232070587 -0700
14303@@ -23,6 +23,7 @@
14304 #include <wchar.h>
14305 #include <string.h>
14306 #include <libioP.h>
14307+#include <gnu/option-groups.h>
14308
14309
14310 int
14311@@ -37,6 +38,7 @@
14312 int res;
14313 if (_IO_fwide (fp, 0) > 0)
14314 {
14315+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
14316 size_t len = strlen (fmt) + 1;
14317 wchar_t wfmt[len];
14318 for (size_t i = 0; i < len; ++i)
14319@@ -45,6 +47,9 @@
14320 wfmt[i] = fmt[i];
14321 }
14322 res = __vfwprintf (fp, wfmt, ap);
14323+#else
14324+ abort();
14325+#endif
14326 }
14327 else
14328 res = _IO_vfprintf (fp, fmt, ap);
14329Index: git/stdio-common/_i18n_number.h
14330===================================================================
14331--- git.orig/stdio-common/_i18n_number.h 2014-08-29 20:00:53.500070587 -0700
14332+++ git/stdio-common/_i18n_number.h 2014-08-29 20:01:15.232070587 -0700
14333@@ -19,10 +19,13 @@
14334 #include <stdbool.h>
14335 #include <wchar.h>
14336 #include <wctype.h>
14337+#include <gnu/option-groups.h>
14338
14339 #include "../locale/outdigits.h"
14340 #include "../locale/outdigitswc.h"
14341
14342+#if __OPTION_EGLIBC_LOCALE_CODE
14343+
14344 static CHAR_T *
14345 _i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
14346 {
14347@@ -115,3 +118,13 @@
14348
14349 return w;
14350 }
14351+
14352+#else
14353+
14354+static CHAR_T *
14355+_i18n_number_rewrite (CHAR_T *w, CHAR_T *rear_ptr, CHAR_T *end)
14356+{
14357+ return w;
14358+}
14359+
14360+#endif
14361Index: git/stdio-common/Makefile
14362===================================================================
14363--- git.orig/stdio-common/Makefile 2014-08-29 20:00:53.500070587 -0700
14364+++ git/stdio-common/Makefile 2014-08-29 20:01:15.232070587 -0700
14365@@ -18,6 +18,8 @@
14366 #
14367 # Specific makefile for stdio-common.
14368 #
14369+include ../option-groups.mak
14370+
14371 subdir := stdio-common
14372
14373 include ../Makeconfig
14374@@ -30,7 +32,7 @@
14375 vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
14376 reg-modifier reg-type \
14377 printf_size fprintf printf snprintf sprintf asprintf dprintf \
14378- vfwprintf vfscanf vfwscanf \
14379+ vfscanf \
14380 fscanf scanf sscanf \
14381 perror psignal \
14382 tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
14383@@ -41,23 +43,37 @@
14384 isoc99_vsscanf \
14385 psiginfo
14386
14387-aux := errlist siglist printf-parsemb printf-parsewc fxprintf
14388+# Ideally, _itowa and itowa-digits would be in this option group as
14389+# well, but it is used unconditionally by printf_fp and printf_fphex,
14390+# and it didn't seem straightforward to disentangle it.
14391+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
14392+ vfwprintf vfwscanf
14393+
14394+aux := errlist siglist printf-parsemb fxprintf
14395+aux-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += printf-parsewc
14396
14397 tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
14398 temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
14399 xbug errnobug \
14400 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
14401- tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
14402+ tfformat tiformat tllformat tstdiomisc tst-printfsz \
14403 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
14404- scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
14405- tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
14406- tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
14407+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
14408+ scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
14409+ tst-fseek tst-fmemopen tst-gets \
14410+ tst-sprintf tst-rndseek tst-fdopen tst-fphex \
14411 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
14412- tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
14413- bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
14414- scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
14415- bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
14416- bug25 tst-printf-round bug26
14417+ tst-fwrite bug16 bug17 tst-sprintf2 bug18 \
14418+ bug19 tst-popen2 scanf14 scanf15 bug21 bug22 scanf16 scanf17 \
14419+ tst-setvbuf1 bug23 bug24 bug-vfprintf-nargs tst-sprintf3 bug25 \
14420+ tst-printf-round bug26
14421+
14422+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
14423+ += tst-sscanf tst-swprintf test-vfprintf bug14 scanf13 tst-grouping
14424+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
14425+ += tst-perror bug19a bug20 tst-long-dbl-fphex tst-fphex-wide
14426+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
14427+ += bug18a tst-swscanf tst-wc-printf
14428
14429 test-srcs = tst-unbputc tst-printf
14430
14431Index: git/stdio-common/printf_fp.c
14432===================================================================
14433--- git.orig/stdio-common/printf_fp.c 2014-08-29 20:00:53.548070587 -0700
14434+++ git/stdio-common/printf_fp.c 2014-08-29 20:01:15.232070587 -0700
14435@@ -39,6 +39,7 @@
14436 #include <unistd.h>
14437 #include <stdlib.h>
14438 #include <wchar.h>
14439+#include <gnu/option-groups.h>
14440 #include <stdbool.h>
14441 #include <rounding-mode.h>
14442
14443@@ -148,6 +149,10 @@
14444 wchar_t thousands_sep, int ngroups)
14445 internal_function;
14446
14447+/* Ideally, when OPTION_EGLIBC_LOCALE_CODE is disabled, this should do
14448+ all its work in ordinary characters, rather than doing it in wide
14449+ characters and then converting at the end. But that is a challenge
14450+ for another day. */
14451
14452 int
14453 ___printf_fp (FILE *fp,
14454@@ -206,7 +211,14 @@
14455 mp_limb_t cy;
14456
14457 /* Nonzero if this is output on a wide character stream. */
14458+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14459 int wide = info->wide;
14460+#else
14461+ /* This should never be called on a wide-oriented stream when
14462+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14463+ be trusted to figure that out. */
14464+ const int wide = 0;
14465+#endif
14466
14467 /* Buffer in which we produce the output. */
14468 wchar_t *wbuffer = NULL;
14469@@ -258,6 +270,7 @@
14470
14471
14472 /* Figure out the decimal point character. */
14473+#if __OPTION_EGLIBC_LOCALE_CODE
14474 if (info->extra == 0)
14475 {
14476 decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
14477@@ -277,7 +290,13 @@
14478 /* The decimal point character must not be zero. */
14479 assert (*decimal != '\0');
14480 assert (decimalwc != L'\0');
14481+#else
14482+ /* Hard-code values from 'C' locale. */
14483+ decimal = ".";
14484+ decimalwc = L'.';
14485+#endif
14486
14487+#if __OPTION_EGLIBC_LOCALE_CODE
14488 if (info->group)
14489 {
14490 if (info->extra == 0)
14491@@ -321,6 +340,9 @@
14492 }
14493 else
14494 grouping = NULL;
14495+#else
14496+ grouping = NULL;
14497+#endif
14498
14499 /* Fetch the argument value. */
14500 #ifndef __NO_LONG_DOUBLE_MATH
14501Index: git/stdio-common/printf_fphex.c
14502===================================================================
14503--- git.orig/stdio-common/printf_fphex.c 2014-08-29 20:00:53.548070587 -0700
14504+++ git/stdio-common/printf_fphex.c 2014-08-29 20:01:15.232070587 -0700
14505@@ -28,6 +28,7 @@
14506 #include <_itoa.h>
14507 #include <_itowa.h>
14508 #include <locale/localeinfo.h>
14509+#include <gnu/option-groups.h>
14510 #include <stdbool.h>
14511 #include <rounding-mode.h>
14512
14513@@ -139,10 +140,18 @@
14514 int done = 0;
14515
14516 /* Nonzero if this is output on a wide character stream. */
14517+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14518 int wide = info->wide;
14519+#else
14520+ /* This should never be called on a wide-oriented stream when
14521+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14522+ be trusted to figure that out. */
14523+ const int wide = 0;
14524+#endif
14525
14526
14527 /* Figure out the decimal point character. */
14528+#if __OPTION_EGLIBC_LOCALE_CODE
14529 if (info->extra == 0)
14530 {
14531 decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
14532@@ -156,6 +165,10 @@
14533 }
14534 /* The decimal point character must never be zero. */
14535 assert (*decimal != '\0' && decimalwc != L'\0');
14536+#else
14537+ decimal = ".";
14538+ decimalwc = L'.';
14539+#endif
14540
14541
14542 /* Fetch the argument value. */
14543Index: git/stdio-common/printf_size.c
14544===================================================================
14545--- git.orig/stdio-common/printf_size.c 2014-08-29 20:00:53.548070587 -0700
14546+++ git/stdio-common/printf_size.c 2014-08-29 20:01:15.232070587 -0700
14547@@ -23,6 +23,7 @@
14548 #include <math.h>
14549 #include <printf.h>
14550 #include <libioP.h>
14551+#include <gnu/option-groups.h>
14552
14553
14554 /* This defines make it possible to use the same code for GNU C library and
14555@@ -116,7 +117,14 @@
14556
14557 struct printf_info fp_info;
14558 int done = 0;
14559+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14560 int wide = info->wide;
14561+#else
14562+ /* This should never be called on a wide-oriented stream when
14563+ OPTION_POSIX_C_LANG_WIDE_CHAR is disabled, but the compiler can't
14564+ be trusted to figure that out. */
14565+ const int wide = 0;
14566+#endif
14567 int res;
14568
14569 /* Fetch the argument value. */
14570Index: git/stdio-common/scanf14.c
14571===================================================================
14572--- git.orig/stdio-common/scanf14.c 2014-08-29 20:00:53.548070587 -0700
14573+++ git/stdio-common/scanf14.c 2014-08-29 20:01:15.232070587 -0700
14574@@ -2,6 +2,7 @@
14575 #include <stdlib.h>
14576 #include <string.h>
14577 #include <wchar.h>
14578+#include <gnu/option-groups.h>
14579
14580 #define FAIL() \
14581 do { \
14582@@ -36,6 +37,7 @@
14583 FAIL ();
14584 else if (d != 2.25 || memcmp (c, " x", 2) != 0)
14585 FAIL ();
14586+#if __OPTION_EGLIBC_LOCALE_CODE
14587 if (sscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2)
14588 FAIL ();
14589 else
14590@@ -45,6 +47,7 @@
14591 memset (lsp, 'x', sizeof L"3.25");
14592 free (lsp);
14593 }
14594+#endif
14595 if (sscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2)
14596 FAIL ();
14597 else
14598Index: git/stdio-common/tstdiomisc.c
14599===================================================================
14600--- git.orig/stdio-common/tstdiomisc.c 2014-08-29 20:00:53.584070587 -0700
14601+++ git/stdio-common/tstdiomisc.c 2014-08-29 20:01:15.232070587 -0700
14602@@ -3,6 +3,7 @@
14603 #include <stdio.h>
14604 #include <string.h>
14605 #include <wchar.h>
14606+#include <gnu/option-groups.h>
14607
14608 static int
14609 t1 (void)
14610@@ -125,6 +126,7 @@
14611 printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
14612 buf);
14613
14614+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14615 swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%a %A %e %E %f %F %g %G",
14616 qnanval, qnanval, qnanval, qnanval,
14617 qnanval, qnanval, qnanval, qnanval);
14618@@ -162,6 +164,7 @@
14619 result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
14620 printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
14621 wbuf);
14622+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14623
14624 lqnanval = NAN;
14625
14626@@ -206,6 +209,7 @@
14627 printf ("expected \"-inf -INF -inf -INF -inf -INF -inf -INF\", got \"%s\"\n",
14628 buf);
14629
14630+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14631 swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]),
14632 L"%La %LA %Le %LE %Lf %LF %Lg %LG",
14633 lqnanval, lqnanval, lqnanval, lqnanval,
14634@@ -250,6 +254,7 @@
14635 result |= wcscmp (wbuf, L"-inf -INF -inf -INF -inf -INF -inf -INF") != 0;
14636 printf ("expected L\"-inf -INF -inf -INF -inf -INF -inf -INF\", got L\"%S\"\n",
14637 wbuf);
14638+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14639
14640 return result;
14641 }
14642Index: git/stdio-common/tst-popen.c
14643===================================================================
14644--- git.orig/stdio-common/tst-popen.c 2014-08-29 20:00:53.576070587 -0700
14645+++ git/stdio-common/tst-popen.c 2014-08-29 20:01:15.232070587 -0700
14646@@ -19,6 +19,7 @@
14647 #include <stdio.h>
14648 #include <string.h>
14649 #include <wchar.h>
14650+#include <gnu/option-groups.h>
14651
14652 static int
14653 do_test (void)
14654@@ -34,12 +35,14 @@
14655 return 1;
14656 }
14657
14658+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
14659 /* POSIX says that pipe streams are byte-oriented. */
14660 if (fwide (f, 0) >= 0)
14661 {
14662 puts ("popen did not return byte-oriented stream");
14663 result = 1;
14664 }
14665+#endif
14666
14667 if (getline (&line, &len, f) != 5)
14668 {
14669Index: git/stdio-common/tst-sprintf.c
14670===================================================================
14671--- git.orig/stdio-common/tst-sprintf.c 2014-08-29 20:00:53.580070587 -0700
14672+++ git/stdio-common/tst-sprintf.c 2014-08-29 20:01:15.236070587 -0700
14673@@ -2,6 +2,7 @@
14674 #include <stdlib.h>
14675 #include <locale.h>
14676 #include <string.h>
14677+#include <gnu/option-groups.h>
14678
14679
14680 int
14681@@ -10,12 +11,14 @@
14682 char buf[100];
14683 int result = 0;
14684
14685+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14686 if (sprintf (buf, "%.0ls", L"foo") != 0
14687 || strlen (buf) != 0)
14688 {
14689 puts ("sprintf (buf, \"%.0ls\", L\"foo\") produced some output");
14690 result = 1;
14691 }
14692+#endif /* __OPTION_POSIX_C_LANG_WIDE_CHAR */
14693
14694 #define SIZE (1024*70000)
14695 #define STR(x) #x
14696Index: git/stdio-common/vfprintf.c
14697===================================================================
14698--- git.orig/stdio-common/vfprintf.c 2014-08-29 20:00:53.588070587 -0700
14699+++ git/stdio-common/vfprintf.c 2014-08-29 20:01:15.236070587 -0700
14700@@ -29,6 +29,7 @@
14701 #include <_itoa.h>
14702 #include <locale/localeinfo.h>
14703 #include <stdio.h>
14704+#include <gnu/option-groups.h>
14705
14706 /* This code is shared between the standard stdio implementation found
14707 in GNU C library and the libio implementation originally found in
14708@@ -138,6 +139,18 @@
14709 # define EOF WEOF
14710 #endif
14711
14712+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14713+# define MULTIBYTE_SUPPORT (1)
14714+#else
14715+# define MULTIBYTE_SUPPORT (0)
14716+#endif
14717+
14718+#if __OPTION_EGLIBC_LOCALE_CODE
14719+# define LOCALE_SUPPORT (1)
14720+#else
14721+# define LOCALE_SUPPORT (0)
14722+#endif
14723+
14724 #include "_i18n_number.h"
14725
14726 /* Include the shared code for parsing the format string. */
14727@@ -1123,8 +1136,11 @@
14728 # define process_string_arg(fspec) \
14729 LABEL (form_character): \
14730 /* Character. */ \
14731- if (is_long) \
14732- goto LABEL (form_wcharacter); \
14733+ if (is_long) \
14734+ { \
14735+ assert (MULTIBYTE_SUPPORT); \
14736+ goto LABEL (form_wcharacter); \
14737+ } \
14738 --width; /* Account for the character itself. */ \
14739 if (!left) \
14740 PAD (' '); \
14741@@ -1137,6 +1153,7 @@
14742 break; \
14743 \
14744 LABEL (form_wcharacter): \
14745+ assert (MULTIBYTE_SUPPORT); \
14746 { \
14747 /* Wide character. */ \
14748 char buf[MB_CUR_MAX]; \
14749@@ -1203,6 +1220,7 @@
14750 } \
14751 else \
14752 { \
14753+ assert (MULTIBYTE_SUPPORT); \
14754 const wchar_t *s2 = (const wchar_t *) string; \
14755 mbstate_t mbstate; \
14756 \
14757@@ -1403,7 +1421,9 @@
14758 LABEL (flag_quote):
14759 group = 1;
14760
14761- if (grouping == (const char *) -1)
14762+ if (! LOCALE_SUPPORT)
14763+ grouping = NULL;
14764+ else if (grouping == (const char *) -1)
14765 {
14766 #ifdef COMPILE_WPRINTF
14767 thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
14768@@ -1702,7 +1722,9 @@
14769 free (workstart);
14770 workstart = NULL;
14771
14772- if (grouping == (const char *) -1)
14773+ if (! LOCALE_SUPPORT)
14774+ grouping = NULL;
14775+ else if (grouping == (const char *) -1)
14776 {
14777 #ifdef COMPILE_WPRINTF
14778 thousands_sep = _NL_CURRENT_WORD (LC_NUMERIC,
14779Index: git/stdio-common/vfscanf.c
14780===================================================================
14781--- git.orig/stdio-common/vfscanf.c 2014-08-29 20:00:53.588070587 -0700
14782+++ git/stdio-common/vfscanf.c 2014-08-29 20:01:15.236070587 -0700
14783@@ -29,6 +29,7 @@
14784 #include <wctype.h>
14785 #include <bits/libc-lock.h>
14786 #include <locale/localeinfo.h>
14787+#include <gnu/option-groups.h>
14788
14789 #ifdef __GNUC__
14790 # define HAVE_LONGLONG
14791@@ -133,6 +134,12 @@
14792 # define WINT_T int
14793 #endif
14794
14795+#if __OPTION_POSIX_C_LANG_WIDE_CHAR
14796+# define MULTIBYTE_SUPPORT (1)
14797+#else
14798+# define MULTIBYTE_SUPPORT (0)
14799+#endif
14800+
14801 #define encode_error() do { \
14802 errval = 4; \
14803 __set_errno (EILSEQ); \
14804@@ -316,24 +323,35 @@
14805 ARGCHECK (s, format);
14806
14807 {
14808-#ifndef COMPILE_WSCANF
14809+#if __OPTION_EGLIBC_LOCALE_CODE && !defined (COMPILE_WSCANF)
14810 struct __locale_data *const curnumeric = loc->__locales[LC_NUMERIC];
14811 #endif
14812
14813+#if __OPTION_EGLIBC_LOCALE_CODE
14814 /* Figure out the decimal point character. */
14815-#ifdef COMPILE_WSCANF
14816+# ifdef COMPILE_WSCANF
14817 decimal = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_DECIMAL_POINT_WC);
14818-#else
14819+# else
14820 decimal = curnumeric->values[_NL_ITEM_INDEX (DECIMAL_POINT)].string;
14821-#endif
14822+# endif
14823 /* Figure out the thousands separator character. */
14824-#ifdef COMPILE_WSCANF
14825+# ifdef COMPILE_WSCANF
14826 thousands = _NL_CURRENT_WORD (LC_NUMERIC, _NL_NUMERIC_THOUSANDS_SEP_WC);
14827-#else
14828+# else
14829 thousands = curnumeric->values[_NL_ITEM_INDEX (THOUSANDS_SEP)].string;
14830 if (*thousands == '\0')
14831 thousands = NULL;
14832-#endif
14833+# endif
14834+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
14835+ /* Hard-code values from the C locale. */
14836+# ifdef COMPILE_WSCANF
14837+ decimal = L'.';
14838+ thousands = L'\0';
14839+# else
14840+ decimal = ".";
14841+ thousands = NULL;
14842+# endif
14843+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
14844 }
14845
14846 /* Lock the stream. */
14847@@ -385,6 +403,8 @@
14848 #ifndef COMPILE_WSCANF
14849 if (!isascii ((unsigned char) *f))
14850 {
14851+ assert (MULTIBYTE_SUPPORT);
14852+
14853 /* Non-ASCII, may be a multibyte. */
14854 int len = __mbrlen (f, strlen (f), &state);
14855 if (len > 0)
14856@@ -830,6 +850,8 @@
14857 }
14858 /* FALLTHROUGH */
14859 case L_('C'):
14860+ assert (MULTIBYTE_SUPPORT);
14861+
14862 if (width == -1)
14863 width = 1;
14864
14865@@ -1172,6 +1194,8 @@
14866 /* FALLTHROUGH */
14867
14868 case L_('S'):
14869+ assert (MULTIBYTE_SUPPORT);
14870+
14871 {
14872 #ifndef COMPILE_WSCANF
14873 mbstate_t cstate;
14874@@ -1419,10 +1443,17 @@
14875 const char *mbdigits[10];
14876 const char *mbdigits_extended[10];
14877 #endif
14878+#if __OPTION_EGLIBC_LOCALE_CODE
14879 /* "to_inpunct" is a map from ASCII digits to their
14880 equivalent in locale. This is defined for locales
14881 which use an extra digits set. */
14882 wctrans_t map = __wctrans ("to_inpunct");
14883+#else
14884+ /* This will always be the case when
14885+ OPTION_EGLIBC_LOCALE_CODE is disabled, but the
14886+ compiler can't figure that out. */
14887+ wctrans_t map = NULL;
14888+#endif
14889 int n;
14890
14891 from_level = 0;
14892@@ -2088,6 +2119,7 @@
14893 --width;
14894 }
14895
14896+#if __OPTION_EGLIBC_LOCALE_CODE
14897 wctrans_t map;
14898 if (__builtin_expect ((flags & I18N) != 0, 0)
14899 /* Hexadecimal floats make no sense, fixing localized
14900@@ -2304,6 +2336,7 @@
14901 ;
14902 #endif
14903 }
14904+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
14905
14906 /* Have we read any character? If we try to read a number
14907 in hexadecimal notation and we have read only the `0x'
14908@@ -2343,7 +2376,10 @@
14909
14910 case L_('['): /* Character class. */
14911 if (flags & LONG)
14912- STRING_ARG (wstr, wchar_t, 100);
14913+ {
14914+ assert (MULTIBYTE_SUPPORT);
14915+ STRING_ARG (wstr, wchar_t, 100);
14916+ }
14917 else
14918 STRING_ARG (str, char, 100);
14919
14920@@ -2417,6 +2453,7 @@
14921 if (flags & LONG)
14922 {
14923 size_t now = read_in;
14924+ assert (MULTIBYTE_SUPPORT);
14925 #ifdef COMPILE_WSCANF
14926 if (__glibc_unlikely (inchar () == WEOF))
14927 input_error ();
14928Index: git/stdlib/Makefile
14929===================================================================
14930--- git.orig/stdlib/Makefile 2014-08-29 20:00:53.588070587 -0700
14931+++ git/stdlib/Makefile 2014-08-29 20:01:15.236070587 -0700
14932@@ -18,6 +18,8 @@
14933 #
14934 # Makefile for stdlib routines
14935 #
14936+include ../option-groups.mak
14937+
14938 subdir := stdlib
14939
14940 include ../Makeconfig
14941@@ -30,7 +32,7 @@
14942 alloca.h fmtmsg.h \
14943 bits/stdlib-bsearch.h
14944
14945-routines := \
14946+routines-y := \
14947 atof atoi atol atoll \
14948 abort \
14949 bsearch qsort msort \
14950@@ -39,7 +41,6 @@
14951 quick_exit at_quick_exit cxa_at_quick_exit cxa_thread_atexit_impl \
14952 abs labs llabs \
14953 div ldiv lldiv \
14954- mblen mbstowcs mbtowc wcstombs wctomb \
14955 random random_r rand rand_r \
14956 drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
14957 srand48 seed48 lcong48 \
14958@@ -52,9 +53,18 @@
14959 strtof_l strtod_l strtold_l \
14960 system canonicalize \
14961 a64l l64a \
14962- rpmatch strfmon strfmon_l getsubopt xpg_basename fmtmsg \
14963- strtoimax strtoumax wcstoimax wcstoumax \
14964+ getsubopt xpg_basename \
14965+ strtoimax strtoumax \
14966 getcontext setcontext makecontext swapcontext
14967+routines-$(OPTION_EGLIBC_LOCALE_CODE) += \
14968+ strfmon strfmon_l
14969+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) += \
14970+ mblen mbstowcs mbtowc wcstombs wctomb \
14971+ wcstoimax wcstoumax
14972+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP))
14973+routines-y += rpmatch
14974+endif
14975+routines-$(OPTION_EGLIBC_FMTMSG) += fmtmsg
14976 aux = grouping groupingwc tens_in_limb
14977
14978 # These routines will be omitted from the libc shared object.
14979@@ -62,20 +72,22 @@
14980 # linked against when the shared library will be used.
14981 static-only-routines = atexit at_quick_exit
14982
14983-test-srcs := tst-fmtmsg
14984-tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
14985+test-srcs-$(OPTION_EGLIBC_FMTMSG) := tst-fmtmsg
14986+tests := tst-strtol tst-strtod testrand testsort testdiv \
14987 test-canon test-canon2 tst-strtoll tst-environ \
14988 tst-xpg-basename tst-random tst-random2 tst-bsearch \
14989 tst-limits tst-rand48 bug-strtod tst-setcontext \
14990- test-a64l tst-qsort tst-system testmb2 bug-strtod2 \
14991- tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
14992- tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2 \
14993- tst-makecontext2 tst-strtod6 tst-unsetenv1 \
14994- tst-makecontext3 bug-getcontext bug-fmtmsg1 \
14995+ test-a64l tst-qsort tst-system bug-strtod2 \
14996+ tst-atof1 tst-atof2 tst-strtod2 tst-rand48-2 \
14997+ tst-makecontext tst-qsort2 tst-makecontext2 tst-strtod6 \
14998+ tst-unsetenv1 tst-makecontext3 bug-getcontext bug-fmtmsg1 \
14999 tst-secure-getenv tst-strtod-overflow tst-strtod-round \
15000 tst-tininess tst-strtod-underflow tst-tls-atexit
15001 tests-static := tst-secure-getenv
15002-
15003+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15004+ += tst-strtod3 tst-strtod4 tst-strtod5 testmb2
15005+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
15006+ += testmb
15007 modules-names = tst-tls-atexit-lib
15008
15009 ifeq ($(build-shared),yes)
15010@@ -115,8 +127,10 @@
15011 tests-special += $(objpfx)isomac.out
15012
15013 ifeq ($(run-built-tests),yes)
15014+ifeq (y,$(OPTION_EGLIBC_FMTMSG))
15015 tests-special += $(objpfx)tst-fmtmsg.out
15016 endif
15017+endif
15018
15019 include ../Rules
15020
15021Index: git/stdlib/strtod_l.c
15022===================================================================
15023--- git.orig/stdlib/strtod_l.c 2014-08-29 20:00:53.648070587 -0700
15024+++ git/stdlib/strtod_l.c 2014-08-29 20:01:15.236070587 -0700
15025@@ -17,6 +17,7 @@
15026 License along with the GNU C Library; if not, see
15027 <http://www.gnu.org/licenses/>. */
15028
15029+#include <gnu/option-groups.h>
15030 #include <xlocale.h>
15031
15032 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
15033@@ -548,6 +549,7 @@
15034 /* Used in several places. */
15035 int cnt;
15036
15037+#if __OPTION_EGLIBC_LOCALE_CODE
15038 struct __locale_data *current = loc->__locales[LC_NUMERIC];
15039
15040 if (__glibc_unlikely (group))
15041@@ -586,6 +588,17 @@
15042 decimal_len = strlen (decimal);
15043 assert (decimal_len > 0);
15044 #endif
15045+#else /* if ! __OPTION_EGLIBC_LOCALE_CODE */
15046+ /* Hard-code values from the 'C' locale. */
15047+ grouping = NULL;
15048+#ifdef USE_WIDE_CHAR
15049+ decimal = L'.';
15050+# define decimal_len 1
15051+#else
15052+ decimal = ".";
15053+ decimal_len = 1;
15054+#endif
15055+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
15056
15057 /* Prepare number representation. */
15058 exponent = 0;
15059Index: git/stdlib/tst-strtod.c
15060===================================================================
15061--- git.orig/stdlib/tst-strtod.c 2014-08-29 20:00:53.700070587 -0700
15062+++ git/stdlib/tst-strtod.c 2014-08-29 20:01:15.236070587 -0700
15063@@ -23,6 +23,7 @@
15064 #include <errno.h>
15065 #include <string.h>
15066 #include <math.h>
15067+#include <gnu/option-groups.h>
15068
15069 struct ltest
15070 {
15071@@ -176,7 +177,9 @@
15072
15073 status |= long_dbl ();
15074
15075+#if __OPTION_EGLIBC_LOCALE_CODE
15076 status |= locale_test ();
15077+#endif
15078
15079 return status ? EXIT_FAILURE : EXIT_SUCCESS;
15080 }
15081@@ -219,6 +222,7 @@
15082 return 0;
15083 }
15084
15085+#if __OPTION_EGLIBC_LOCALE_CODE
15086 /* Perform a few tests in a locale with thousands separators. */
15087 static int
15088 locale_test (void)
15089@@ -276,3 +280,4 @@
15090
15091 return result;
15092 }
15093+#endif /* __OPTION_EGLIBC_LOCALE_CODE */
15094Index: git/streams/Makefile
15095===================================================================
15096--- git.orig/streams/Makefile 2014-08-29 20:00:53.712070587 -0700
15097+++ git/streams/Makefile 2014-08-29 20:01:15.236070587 -0700
15098@@ -18,11 +18,14 @@
15099 #
15100 # Makefile for streams.
15101 #
15102+include ../option-groups.mak
15103+
15104 subdir := streams
15105
15106 include ../Makeconfig
15107
15108 headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
15109-routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
15110+routines-$(OPTION_EGLIBC_STREAMS) \
15111+ += isastream getmsg getpmsg putmsg putpmsg fattach fdetach
15112
15113 include ../Rules
15114Index: git/string/Makefile
15115===================================================================
15116--- git.orig/string/Makefile 2014-08-29 20:00:53.716070587 -0700
15117+++ git/string/Makefile 2014-08-29 20:01:15.236070587 -0700
15118@@ -18,6 +18,8 @@
15119 #
15120 # Sub-makefile for string portion of library.
15121 #
15122+include ../option-groups.mak
15123+
15124 subdir := string
15125
15126 include ../Makeconfig
15127@@ -39,10 +41,12 @@
15128 $(addprefix argz-,append count create ctsep next \
15129 delete extract insert stringify \
15130 addsep replace) \
15131- envz basename \
15132+ basename \
15133 strcoll_l strxfrm_l string-inlines memrchr \
15134 xpg-strerror strerror_l
15135
15136+routines-$(OPTION_EGLIBC_ENVZ) += envz
15137+
15138 strop-tests := memchr memcmp memcpy memmove mempcpy memset memccpy \
15139 stpcpy stpncpy strcat strchr strcmp strcpy strcspn \
15140 strlen strncmp strncpy strpbrk strrchr strspn memmem \
15141@@ -51,10 +55,12 @@
15142 tests := tester inl-tester noinl-tester testcopy test-ffs \
15143 tst-strlen stratcliff tst-svc tst-inlcall \
15144 bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap \
15145- tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
15146+ tst-strtok tst-strfry \
15147 bug-strtok1 $(addprefix test-,$(strop-tests)) \
15148- bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
15149- tst-strtok_r
15150+ tst-strxfrm2 tst-endian tst-svc2 tst-strtok_r
15151+tests-$(OPTION_EGLIBC_ENVZ) += bug-envz1
15152+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15153+ += tst-strxfrm bug-strcoll1
15154
15155 xtests = tst-strcoll-overflow
15156
15157Index: git/string/strcoll_l.c
15158===================================================================
15159--- git.orig/string/strcoll_l.c 2014-08-29 20:00:53.744070587 -0700
15160+++ git/string/strcoll_l.c 2014-08-29 20:01:15.240070587 -0700
15161@@ -25,6 +25,7 @@
15162 #include <stdlib.h>
15163 #include <string.h>
15164 #include <sys/param.h>
15165+#include <gnu/option-groups.h>
15166
15167 #ifndef STRING_TYPE
15168 # define STRING_TYPE char
15169@@ -472,7 +473,11 @@
15170 STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
15171 {
15172 struct __locale_data *current = l->__locales[LC_COLLATE];
15173+#if __OPTION_EGLIBC_LOCALE_CODE
15174 uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
15175+#else
15176+ const uint_fast32_t nrules = 0;
15177+#endif
15178 /* We don't assign the following values right away since it might be
15179 unnecessary in case there are no rules. */
15180 const unsigned char *rulesets;
15181Index: git/string/strerror_l.c
15182===================================================================
15183--- git.orig/string/strerror_l.c 2014-08-29 20:00:53.744070587 -0700
15184+++ git/string/strerror_l.c 2014-08-29 20:01:15.240070587 -0700
15185@@ -21,6 +21,7 @@
15186 #include <stdlib.h>
15187 #include <string.h>
15188 #include <sys/param.h>
15189+#include <gnu/option-groups.h>
15190
15191
15192 static __thread char *last_value;
15193@@ -29,10 +30,14 @@
15194 static const char *
15195 translate (const char *str, locale_t loc)
15196 {
15197+#if __OPTION_EGLIBC_LOCALE_CODE
15198 locale_t oldloc = __uselocale (loc);
15199 const char *res = _(str);
15200 __uselocale (oldloc);
15201 return res;
15202+#else
15203+ return str;
15204+#endif
15205 }
15206
15207
15208Index: git/string/strxfrm_l.c
15209===================================================================
15210--- git.orig/string/strxfrm_l.c 2014-08-29 20:00:53.748070587 -0700
15211+++ git/string/strxfrm_l.c 2014-08-29 20:01:15.240070587 -0700
15212@@ -24,6 +24,7 @@
15213 #include <stdlib.h>
15214 #include <string.h>
15215 #include <sys/param.h>
15216+#include <gnu/option-groups.h>
15217
15218 #ifndef STRING_TYPE
15219 # define STRING_TYPE char
15220@@ -85,7 +86,11 @@
15221 STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n, __locale_t l)
15222 {
15223 struct __locale_data *current = l->__locales[LC_COLLATE];
15224+#if __OPTION_EGLIBC_LOCALE_CODE
15225 uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
15226+#else
15227+ const uint_fast32_t nrules = 0;
15228+#endif
15229 /* We don't assign the following values right away since it might be
15230 unnecessary in case there are no rules. */
15231 const unsigned char *rulesets;
15232Index: git/string/test-strcmp.c
15233===================================================================
15234--- git.orig/string/test-strcmp.c 2014-08-29 20:00:53.752070587 -0700
15235+++ git/string/test-strcmp.c 2014-08-29 20:01:15.240070587 -0700
15236@@ -329,34 +329,6 @@
15237 FOR_EACH_IMPL (impl, 0)
15238 check_result (impl, s1 + i1, s2 + i2, exp_result);
15239 }
15240-
15241- /* Test cases where there are multiple zero bytes after the first. */
15242-
15243- for (size_t i = 0; i < 16 + 1; i++)
15244- {
15245- s1[i] = 0x00;
15246- s2[i] = 0x00;
15247- }
15248-
15249- for (size_t i = 0; i < 16; i++)
15250- {
15251- int exp_result;
15252-
15253- for (int val = 0x01; val < 0x100; val++)
15254- {
15255- for (size_t j = 0; j < i; j++)
15256- {
15257- s1[j] = val;
15258- s2[j] = val;
15259- }
15260-
15261- s2[i] = val;
15262-
15263- exp_result = SIMPLE_STRCMP (s1, s2);
15264- FOR_EACH_IMPL (impl, 0)
15265- check_result (impl, s1, s2, exp_result);
15266- }
15267- }
15268 }
15269
15270
15271Index: git/string/tst-strxfrm2.c
15272===================================================================
15273--- git.orig/string/tst-strxfrm2.c 2014-08-29 20:00:53.756070587 -0700
15274+++ git/string/tst-strxfrm2.c 2014-08-29 20:01:15.240070587 -0700
15275@@ -1,6 +1,7 @@
15276 #include <locale.h>
15277 #include <stdio.h>
15278 #include <string.h>
15279+#include <gnu/option-groups.h>
15280
15281 static int
15282 do_test (void)
15283@@ -38,6 +39,7 @@
15284 res = 1;
15285 }
15286
15287+#if __OPTION_EGLIBC_LOCALE_CODE
15288 if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
15289 {
15290 puts ("setlocale failed");
15291@@ -75,6 +77,7 @@
15292 res = 1;
15293 }
15294 }
15295+#endif
15296
15297 return res;
15298 }
15299Index: git/string/tst-strxfrm.c
15300===================================================================
15301--- git.orig/string/tst-strxfrm.c 2014-08-29 20:00:53.756070587 -0700
15302+++ git/string/tst-strxfrm.c 2014-08-29 20:01:15.240070587 -0700
15303@@ -3,6 +3,7 @@
15304 #include <stdio.h>
15305 #include <stdlib.h>
15306 #include <string.h>
15307+#include <gnu/option-groups.h>
15308
15309
15310 char const string[] = "";
15311@@ -64,8 +65,10 @@
15312 int result = 0;
15313
15314 result |= test ("C");
15315+#if __OPTION_EGLIBC_LOCALE_CODE
15316 result |= test ("en_US.ISO-8859-1");
15317 result |= test ("de_DE.UTF-8");
15318+#endif
15319
15320 return result;
15321 }
15322Index: git/sunrpc/Makefile
15323===================================================================
15324--- git.orig/sunrpc/Makefile 2014-08-29 20:00:53.760070587 -0700
15325+++ git/sunrpc/Makefile 2014-08-29 20:01:15.240070587 -0700
15326@@ -18,6 +18,8 @@
15327 #
15328 # Sub-makefile for sunrpc portion of the library.
15329 #
15330+include ../option-groups.mak
15331+
15332 subdir := sunrpc
15333
15334 include ../Makeconfig
15335@@ -55,7 +57,6 @@
15336 headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
15337 $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
15338 headers = rpc/netdb.h
15339-install-others = $(inst_sysconfdir)/rpc
15340 generated += $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
15341 $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
15342 generated-dirs += rpcsvc
15343@@ -65,18 +66,28 @@
15344 endif
15345
15346 ifeq ($(build-shared),yes)
15347-need-export-routines := auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
15348+need-export-routines-$(OPTION_EGLIBC_SUNRPC) += \
15349+ auth_des auth_unix clnt_gen clnt_perr clnt_tcp \
15350 clnt_udp get_myaddr key_call netname pm_getport \
15351- rpc_thread svc svc_tcp svc_udp xcrypt xdr_array xdr \
15352+ rpc_thread svc svc_tcp svc_udp xdr_array xdr \
15353 xdr_intXX_t xdr_mem xdr_ref xdr_sizeof xdr_stdio \
15354 svc_run
15355
15356-routines := auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
15357+need-export-routines-y += xcrypt
15358+
15359+need-export-routines := $(need-export-routines-y)
15360+
15361+routines-$(OPTION_EGLIBC_SUNRPC) \
15362+ += auth_none authuxprot bindrsvprt clnt_raw clnt_simp \
15363 rpc_dtable getrpcport pmap_clnt pm_getmaps pmap_prot pmap_prot2 \
15364 pmap_rmt rpc_prot rpc_common rpc_cmsg svc_auth svc_authux svc_raw \
15365 svc_simple xdr_float xdr_rec publickey authdes_prot \
15366- des_crypt des_impl des_soft key_prot openchild rtime svcauth_des \
15367- clnt_unix svc_unix create_xid $(need-export-routines)
15368+ key_prot openchild rtime svcauth_des \
15369+ clnt_unix svc_unix create_xid
15370+
15371+# xdecrypt is also used by nss/nss_files/files-key.c.
15372+routines-y += des_crypt des_impl des_soft $(need-export-routines)
15373+
15374 ifneq ($(link-obsolete-rpc),yes)
15375 # We only add the RPC for compatibility to libc.so.
15376 shared-only-routines = $(routines)
15377@@ -85,25 +96,28 @@
15378
15379 # We do not build rpcinfo anymore. It is not needed for a bootstrap
15380 # and not wanted on complete systems.
15381-# others := rpcinfo
15382-# install-sbin := rpcinfo
15383-install-bin := rpcgen
15384+# others-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
15385+# install-sbin-$(OPTION_EGLIBC_SUNRPC) += rpcinfo
15386+install-bin-$(OPTION_EGLIBC_SUNRPC) += rpcgen
15387 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
15388 rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
15389 rpc_tblout.o rpc_sample.o
15390-extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
15391-others += rpcgen
15392+extra-objs-$(OPTION_EGLIBC_SUNRPC) = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
15393+others-$(OPTION_EGLIBC_SUNRPC) += rpcgen
15394+
15395+install-others-$(OPTION_EGLIBC_SUNRPC) += $(inst_sysconfdir)/rpc
15396
15397-tests = tst-xdrmem tst-xdrmem2
15398-xtests := tst-getmyaddr
15399+tests-$(OPTION_EGLIBC_SUNRPC) = tst-xdrmem tst-xdrmem2
15400+xtests-$(OPTION_EGLIBC_SUNRPC) := tst-getmyaddr
15401
15402 ifeq ($(have-thread-library),yes)
15403-xtests += thrsvc
15404+xtests-$(OPTION_EGLIBC_SUNRPC) += thrsvc
15405 endif
15406
15407 headers += $(rpcsvc:%.x=rpcsvc/%.h)
15408-extra-libs := librpcsvc
15409-extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
15410+extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc
15411+# Make it in `others' pass, not `lib' pass.
15412+extra-libs-others-y += $(extra-libs-y)
15413 librpcsvc-routines = $(rpcsvc:%.x=x%)
15414 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
15415 omit-deps = $(librpcsvc-routines)
15416Index: git/sysdeps/generic/ldsodefs.h
15417===================================================================
15418--- git.orig/sysdeps/generic/ldsodefs.h 2014-08-29 20:00:53.904070587 -0700
15419+++ git/sysdeps/generic/ldsodefs.h 2014-08-29 20:01:15.240070587 -0700
15420@@ -425,6 +425,12 @@
15421 # undef __rtld_global_attribute__
15422 #endif
15423
15424+#if __OPTION_EGLIBC_RTLD_DEBUG
15425+# define GLRO_dl_debug_mask GLRO(dl_debug_mask)
15426+#else
15427+# define GLRO_dl_debug_mask 0
15428+#endif
15429+
15430 #ifndef SHARED
15431 # define GLRO(name) _##name
15432 #else
15433@@ -437,8 +443,10 @@
15434 {
15435 #endif
15436
15437+#if __OPTION_EGLIBC_RTLD_DEBUG
15438 /* If nonzero the appropriate debug information is printed. */
15439 EXTERN int _dl_debug_mask;
15440+#endif
15441 #define DL_DEBUG_LIBS (1 << 0)
15442 #define DL_DEBUG_IMPCALLS (1 << 1)
15443 #define DL_DEBUG_BINDINGS (1 << 2)
15444Index: git/sysdeps/gnu/Makefile
15445===================================================================
15446--- git.orig/sysdeps/gnu/Makefile 2014-08-29 20:00:53.924070587 -0700
15447+++ git/sysdeps/gnu/Makefile 2014-08-29 20:01:15.240070587 -0700
15448@@ -57,7 +57,8 @@
15449 endif
15450
15451 ifeq ($(subdir),login)
15452-sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
15453+sysdep_routines-$(OPTION_EGLIBC_UTMPX) \
15454+ += setutxent getutxent endutxent getutxid getutxline \
15455 pututxline utmpxname updwtmpx getutmpx getutmp
15456
15457 sysdep_headers += utmpx.h bits/utmpx.h
15458Index: git/sysdeps/ieee754/ldbl-opt/Makefile
15459===================================================================
15460--- git.orig/sysdeps/ieee754/ldbl-opt/Makefile 2014-08-29 20:00:54.452070587 -0700
15461+++ git/sysdeps/ieee754/ldbl-opt/Makefile 2014-08-29 20:01:15.244070587 -0700
15462@@ -11,19 +11,18 @@
15463 routines += math_ldbl_opt nldbl-compat
15464
15465 extra-libs += libnldbl
15466-libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
15467+libnldbl-calls = asprintf dprintf fprintf fscanf iovfscanf \
15468 obstack_printf obstack_vprintf printf scanf snprintf \
15469- sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
15470- vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
15471- vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
15472- wprintf wscanf printf_fp printf_size \
15473- fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
15474- swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
15475- vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
15476- wprintf_chk asprintf_chk vasprintf_chk dprintf_chk \
15477+ sprintf sscanf vasprintf vdprintf vfprintf \
15478+ vfscanf vprintf vscanf vsnprintf \
15479+ vsprintf vsscanf \
15480+ printf_fp printf_size \
15481+ fprintf_chk printf_chk snprintf_chk sprintf_chk \
15482+ vfprintf_chk vprintf_chk \
15483+ vsnprintf_chk vsprintf_chk \
15484+ asprintf_chk vasprintf_chk dprintf_chk \
15485 vdprintf_chk obstack_printf_chk obstack_vprintf_chk \
15486 syslog syslog_chk vsyslog vsyslog_chk \
15487- strfmon strfmon_l \
15488 strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
15489 qecvt qfcvt qgcvt qecvt_r qfcvt_r \
15490 isinf isnan finite signbit scalb log2 lgamma_r ceil \
15491@@ -38,9 +37,15 @@
15492 casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
15493 cabs carg cimag creal clog10 \
15494 isoc99_scanf isoc99_fscanf isoc99_sscanf \
15495- isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
15496+ isoc99_vscanf isoc99_vfscanf isoc99_vsscanf
15497+libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
15498+libnldbl-calls-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += fwprintf fwscanf \
15499+ swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
15500+ vwprintf vwscanf wprintf wscanf fwprintf_chk swprintf_chk \
15501+ vfwprintf_chk vswprintf_chk vwprintf_chk wprintf_chk \
15502 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
15503 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
15504+libnldbl-calls += $(libnldbl-calls-y)
15505 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
15506 libnldbl-inhibit-o = $(object-suffixes)
15507 libnldbl-static-only-routines = $(libnldbl-routines)
15508Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
15509===================================================================
15510--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.c 2014-08-29 20:00:54.468070587 -0700
15511+++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.c 2014-08-29 20:01:15.244070587 -0700
15512@@ -26,6 +26,7 @@
15513 #include <locale/localeinfo.h>
15514 #include <sys/syslog.h>
15515 #include <bits/libc-lock.h>
15516+#include <gnu/option-groups.h>
15517
15518 #include "nldbl-compat.h"
15519
15520@@ -33,20 +34,14 @@
15521 libc_hidden_proto (__nldbl_vsscanf)
15522 libc_hidden_proto (__nldbl_vsprintf)
15523 libc_hidden_proto (__nldbl_vfscanf)
15524-libc_hidden_proto (__nldbl_vfwscanf)
15525 libc_hidden_proto (__nldbl_vdprintf)
15526-libc_hidden_proto (__nldbl_vswscanf)
15527-libc_hidden_proto (__nldbl_vfwprintf)
15528-libc_hidden_proto (__nldbl_vswprintf)
15529 libc_hidden_proto (__nldbl_vsnprintf)
15530 libc_hidden_proto (__nldbl_vasprintf)
15531 libc_hidden_proto (__nldbl_obstack_vprintf)
15532-libc_hidden_proto (__nldbl___vfwprintf_chk)
15533 libc_hidden_proto (__nldbl___vsnprintf_chk)
15534 libc_hidden_proto (__nldbl___vfprintf_chk)
15535 libc_hidden_proto (__nldbl___vsyslog_chk)
15536 libc_hidden_proto (__nldbl___vsprintf_chk)
15537-libc_hidden_proto (__nldbl___vswprintf_chk)
15538 libc_hidden_proto (__nldbl___vasprintf_chk)
15539 libc_hidden_proto (__nldbl___vdprintf_chk)
15540 libc_hidden_proto (__nldbl___obstack_vprintf_chk)
15541@@ -54,8 +49,17 @@
15542 libc_hidden_proto (__nldbl___vstrfmon_l)
15543 libc_hidden_proto (__nldbl___isoc99_vsscanf)
15544 libc_hidden_proto (__nldbl___isoc99_vfscanf)
15545+
15546+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15547+libc_hidden_proto (__nldbl_vfwscanf)
15548+libc_hidden_proto (__nldbl_vswscanf)
15549+libc_hidden_proto (__nldbl_vfwprintf)
15550+libc_hidden_proto (__nldbl_vswprintf)
15551+libc_hidden_proto (__nldbl___vfwprintf_chk)
15552+libc_hidden_proto (__nldbl___vswprintf_chk)
15553 libc_hidden_proto (__nldbl___isoc99_vswscanf)
15554 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
15555+#endif
15556
15557 static void
15558 __nldbl_cleanup (void *arg)
15559@@ -117,6 +121,7 @@
15560 }
15561 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
15562
15563+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15564 int
15565 attribute_compat_text_section weak_function
15566 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
15567@@ -130,6 +135,7 @@
15568
15569 return done;
15570 }
15571+#endif
15572
15573 int
15574 attribute_compat_text_section
15575@@ -226,6 +232,7 @@
15576 return done;
15577 }
15578
15579+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15580 int
15581 attribute_compat_text_section
15582 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
15583@@ -239,6 +246,7 @@
15584
15585 return done;
15586 }
15587+#endif
15588
15589 int
15590 attribute_compat_text_section weak_function
15591@@ -264,6 +272,7 @@
15592 }
15593 libc_hidden_def (__nldbl_vdprintf)
15594
15595+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15596 int
15597 attribute_compat_text_section weak_function
15598 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
15599@@ -275,6 +284,7 @@
15600 return res;
15601 }
15602 libc_hidden_def (__nldbl_vfwprintf)
15603+#endif
15604
15605 int
15606 attribute_compat_text_section
15607@@ -297,6 +307,7 @@
15608 libc_hidden_def (__nldbl_vsnprintf)
15609 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
15610
15611+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15612 int
15613 attribute_compat_text_section weak_function
15614 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
15615@@ -330,6 +341,7 @@
15616
15617 return done;
15618 }
15619+#endif
15620
15621 int
15622 attribute_compat_text_section
15623@@ -419,6 +431,7 @@
15624 return done;
15625 }
15626
15627+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15628 int
15629 attribute_compat_text_section
15630 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
15631@@ -491,6 +504,7 @@
15632
15633 return done;
15634 }
15635+#endif
15636
15637 int
15638 attribute_compat_text_section
15639@@ -506,6 +520,7 @@
15640 return done;
15641 }
15642
15643+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15644 int
15645 attribute_compat_text_section
15646 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
15647@@ -519,6 +534,7 @@
15648
15649 return done;
15650 }
15651+#endif
15652
15653 int
15654 attribute_compat_text_section
15655@@ -563,6 +579,7 @@
15656 return done;
15657 }
15658
15659+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15660 int
15661 attribute_compat_text_section
15662 __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
15663@@ -577,6 +594,7 @@
15664
15665 return done;
15666 }
15667+#endif
15668
15669 int
15670 attribute_compat_text_section
15671@@ -590,6 +608,7 @@
15672 }
15673 libc_hidden_def (__nldbl___vfprintf_chk)
15674
15675+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15676 int
15677 attribute_compat_text_section
15678 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
15679@@ -601,6 +620,7 @@
15680 return res;
15681 }
15682 libc_hidden_def (__nldbl___vfwprintf_chk)
15683+#endif
15684
15685 int
15686 attribute_compat_text_section
15687@@ -635,6 +655,7 @@
15688 }
15689 libc_hidden_def (__nldbl___vsprintf_chk)
15690
15691+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15692 int
15693 attribute_compat_text_section
15694 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
15695@@ -668,6 +689,7 @@
15696
15697 return done;
15698 }
15699+#endif
15700
15701 int
15702 attribute_compat_text_section
15703@@ -775,6 +797,7 @@
15704 return ___printf_fp (fp, &info_no_ldbl, args);
15705 }
15706
15707+#if __OPTION_EGLIBC_LOCALE_CODE
15708 ssize_t
15709 attribute_compat_text_section
15710 __nldbl_strfmon (char *s, size_t maxsize, const char *format, ...)
15711@@ -829,6 +852,7 @@
15712 return res;
15713 }
15714 libc_hidden_def (__nldbl___vstrfmon_l)
15715+#endif
15716
15717 void
15718 attribute_compat_text_section
15719@@ -941,6 +965,7 @@
15720 return done;
15721 }
15722
15723+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15724 int
15725 attribute_compat_text_section
15726 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
15727@@ -1014,6 +1039,7 @@
15728
15729 return done;
15730 }
15731+#endif
15732
15733 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
15734 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
15735@@ -1057,6 +1083,7 @@
15736 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
15737 #endif
15738 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
15739+# if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15740 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
15741 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
15742 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
15743@@ -1069,6 +1096,7 @@
15744 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
15745 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
15746 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
15747+# endif
15748 #endif
15749 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
15750 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
15751Index: git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h
15752===================================================================
15753--- git.orig/sysdeps/ieee754/ldbl-opt/nldbl-compat.h 2014-08-29 20:00:54.468070587 -0700
15754+++ git/sysdeps/ieee754/ldbl-opt/nldbl-compat.h 2014-08-29 20:01:15.244070587 -0700
15755@@ -30,6 +30,7 @@
15756 #include <math.h>
15757 #include <monetary.h>
15758 #include <sys/syslog.h>
15759+#include <gnu/option-groups.h>
15760
15761
15762 /* Declare the __nldbl_NAME function the wrappers call that's in libc.so. */
15763@@ -37,19 +38,15 @@
15764
15765 NLDBL_DECL (_IO_vfscanf);
15766 NLDBL_DECL (vfscanf);
15767-NLDBL_DECL (vfwscanf);
15768 NLDBL_DECL (obstack_vprintf);
15769 NLDBL_DECL (vasprintf);
15770 NLDBL_DECL (dprintf);
15771 NLDBL_DECL (vdprintf);
15772 NLDBL_DECL (fprintf);
15773 NLDBL_DECL (vfprintf);
15774-NLDBL_DECL (vfwprintf);
15775 NLDBL_DECL (vsnprintf);
15776 NLDBL_DECL (vsprintf);
15777 NLDBL_DECL (vsscanf);
15778-NLDBL_DECL (vswprintf);
15779-NLDBL_DECL (vswscanf);
15780 NLDBL_DECL (__asprintf);
15781 NLDBL_DECL (asprintf);
15782 NLDBL_DECL (__printf_fp);
15783@@ -66,12 +63,18 @@
15784 NLDBL_DECL (__isoc99_vscanf);
15785 NLDBL_DECL (__isoc99_vfscanf);
15786 NLDBL_DECL (__isoc99_vsscanf);
15787+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15788+NLDBL_DECL (vfwscanf);
15789+NLDBL_DECL (vfwprintf);
15790+NLDBL_DECL (vswprintf);
15791+NLDBL_DECL (vswscanf);
15792 NLDBL_DECL (__isoc99_wscanf);
15793 NLDBL_DECL (__isoc99_fwscanf);
15794 NLDBL_DECL (__isoc99_swscanf);
15795 NLDBL_DECL (__isoc99_vwscanf);
15796 NLDBL_DECL (__isoc99_vfwscanf);
15797 NLDBL_DECL (__isoc99_vswscanf);
15798+#endif
15799
15800 /* This one does not exist in the normal interface, only
15801 __nldbl___vstrfmon really exists. */
15802@@ -82,22 +85,23 @@
15803 since we don't compile with _FORTIFY_SOURCE. */
15804 extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
15805 const char *__restrict, _G_va_list);
15806-extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
15807- const wchar_t *__restrict, __gnuc_va_list);
15808 extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
15809 const char *__restrict, _G_va_list) __THROW;
15810 extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
15811 const char *__restrict, _G_va_list)
15812 __THROW;
15813-extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
15814- const wchar_t *__restrict, __gnuc_va_list)
15815- __THROW;
15816 extern int __nldbl___vasprintf_chk (char **, int, const char *, _G_va_list)
15817 __THROW;
15818 extern int __nldbl___vdprintf_chk (int, int, const char *, _G_va_list);
15819 extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
15820 _G_va_list) __THROW;
15821 extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
15822-
15823+#if __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
15824+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
15825+ const wchar_t *__restrict, __gnuc_va_list);
15826+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
15827+ const wchar_t *__restrict, __gnuc_va_list)
15828+ __THROW;
15829+#endif
15830
15831 #endif /* __NLDBL_COMPAT_H */
15832Index: git/sysdeps/unix/sysv/linux/gethostid.c
15833===================================================================
15834--- git.orig/sysdeps/unix/sysv/linux/gethostid.c 2014-08-29 20:00:58.840070587 -0700
15835+++ git/sysdeps/unix/sysv/linux/gethostid.c 2014-08-29 20:01:15.244070587 -0700
15836@@ -21,6 +21,7 @@
15837 #include <unistd.h>
15838 #include <netdb.h>
15839 #include <not-cancel.h>
15840+#include <gnu/option-groups.h>
15841
15842 #define HOSTIDFILE "/etc/hostid"
15843
15844@@ -89,6 +90,7 @@
15845 return id;
15846 }
15847
15848+#if __OPTION_EGLIBC_INET
15849 /* Getting from the file was not successful. An intelligent guess for
15850 a unique number of a host is its IP address. Return this. */
15851 if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
15852@@ -115,5 +117,9 @@
15853 /* For the return value to be not exactly the IP address we do some
15854 bit fiddling. */
15855 return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
15856+#else
15857+ /* Return an arbitrary value. */
15858+ return 0;
15859+#endif
15860 }
15861 #endif
15862Index: git/sysdeps/unix/sysv/linux/libc_fatal.c
15863===================================================================
15864--- git.orig/sysdeps/unix/sysv/linux/libc_fatal.c 2014-08-29 20:00:58.980070587 -0700
15865+++ git/sysdeps/unix/sysv/linux/libc_fatal.c 2014-08-29 20:01:15.244070587 -0700
15866@@ -23,6 +23,7 @@
15867 #include <string.h>
15868 #include <sys/mman.h>
15869 #include <sys/uio.h>
15870+#include <gnu/option-groups.h>
15871
15872 static bool
15873 writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total)
15874@@ -40,6 +41,7 @@
15875 static void
15876 backtrace_and_maps (int do_abort, bool written, int fd)
15877 {
15878+#if __OPTION_EGLIBC_BACKTRACE
15879 if (do_abort > 1 && written)
15880 {
15881 void *addrs[64];
15882@@ -62,6 +64,7 @@
15883 close_not_cancel_no_status (fd2);
15884 }
15885 }
15886+#endif /* __OPTION_EGLIBC_BACKTRACE */
15887 }
15888 #define BEFORE_ABORT backtrace_and_maps
15889
15890Index: git/time/Makefile
15891===================================================================
15892--- git.orig/time/Makefile 2014-08-29 20:00:59.504070587 -0700
15893+++ git/time/Makefile 2014-08-29 20:01:15.244070587 -0700
15894@@ -18,6 +18,8 @@
15895 #
15896 # Makefile for time routines
15897 #
15898+include ../option-groups.mak
15899+
15900 subdir := time
15901
15902 include ../Makeconfig
15903@@ -30,14 +32,20 @@
15904 tzfile getitimer setitimer \
15905 stime dysize timegm ftime \
15906 getdate strptime strptime_l \
15907- strftime wcsftime strftime_l wcsftime_l \
15908+ strftime strftime_l \
15909 timespec_get
15910-aux := era alt_digit lc-time-cleanup
15911+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
15912+ := wcsftime wcsftime_l
15913+aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup
15914
15915-tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \
15916- tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
15917+tests := test_time clocktest tst-posixtz \
15918+ tst-getdate tst-mktime tst-mktime2 tst-strftime \
15919 tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
15920 tst-strptime3 bug-getdate1 tst-strptime-whitespace
15921+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
15922+ += tst-strptime tst-ftime_l
15923+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
15924+ += tst_wcsftime
15925
15926 include ../Rules
15927
15928Index: git/time/strftime_l.c
15929===================================================================
15930--- git.orig/time/strftime_l.c 2014-08-29 20:00:59.528070587 -0700
15931+++ git/time/strftime_l.c 2014-08-29 20:01:15.244070587 -0700
15932@@ -35,6 +35,10 @@
15933 # include "../locale/localeinfo.h"
15934 #endif
15935
15936+#ifdef _LIBC
15937+# include <gnu/option-groups.h>
15938+#endif
15939+
15940 #if defined emacs && !defined HAVE_BCOPY
15941 # define HAVE_MEMCPY 1
15942 #endif
15943@@ -882,7 +886,7 @@
15944 case L_('C'):
15945 if (modifier == L_('E'))
15946 {
15947-#if HAVE_STRUCT_ERA_ENTRY
15948+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15949 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15950 if (era)
15951 {
15952@@ -955,7 +959,7 @@
15953
15954 if (modifier == L_('O') && 0 <= number_value)
15955 {
15956-#ifdef _NL_CURRENT
15957+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
15958 /* Get the locale specific alternate representation of
15959 the number NUMBER_VALUE. If none exist NULL is returned. */
15960 const CHAR_T *cp = nl_get_alt_digit (number_value
15961@@ -1260,7 +1264,7 @@
15962 case L_('Y'):
15963 if (modifier == 'E')
15964 {
15965-#if HAVE_STRUCT_ERA_ENTRY
15966+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15967 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15968 if (era)
15969 {
15970@@ -1285,7 +1289,7 @@
15971 case L_('y'):
15972 if (modifier == L_('E'))
15973 {
15974-#if HAVE_STRUCT_ERA_ENTRY
15975+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && HAVE_STRUCT_ERA_ENTRY
15976 struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
15977 if (era)
15978 {
15979Index: git/time/strptime_l.c
15980===================================================================
15981--- git.orig/time/strptime_l.c 2014-08-29 20:00:59.528070587 -0700
15982+++ git/time/strptime_l.c 2014-08-29 20:01:15.244070587 -0700
15983@@ -29,6 +29,7 @@
15984
15985 #ifdef _LIBC
15986 # define HAVE_LOCALTIME_R 0
15987+# include <gnu/option-groups.h>
15988 # include "../locale/localeinfo.h"
15989 #endif
15990
15991@@ -84,7 +85,7 @@
15992 if (val < from || val > to) \
15993 return NULL; \
15994 } while (0)
15995-#ifdef _NL_CURRENT
15996+#if (! _LIBC || __OPTION_EGLIBC_LOCALE_CODE) && defined (_NL_CURRENT)
15997 # define get_alt_number(from, to, n) \
15998 ({ \
15999 __label__ do_normal; \
16000@@ -820,6 +821,7 @@
16001 s.want_xday = 1;
16002 break;
16003 case 'C':
16004+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16005 if (s.decided != raw)
16006 {
16007 if (s.era_cnt >= 0)
16008@@ -856,10 +858,12 @@
16009
16010 s.decided = raw;
16011 }
16012+#endif
16013 /* The C locale has no era information, so use the
16014 normal representation. */
16015 goto match_century;
16016 case 'y':
16017+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16018 if (s.decided != raw)
16019 {
16020 get_number(0, 9999, 4);
16021@@ -918,9 +922,10 @@
16022
16023 s.decided = raw;
16024 }
16025-
16026+#endif
16027 goto match_year_in_century;
16028 case 'Y':
16029+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16030 if (s.decided != raw)
16031 {
16032 num_eras = _NL_CURRENT_WORD (LC_TIME,
16033@@ -948,6 +953,7 @@
16034
16035 s.decided = raw;
16036 }
16037+#endif
16038 get_number (0, 9999, 4);
16039 tm->tm_year = val - 1900;
16040 s.want_century = 0;
16041@@ -1118,6 +1124,7 @@
16042 tm->tm_year = (s.century - 19) * 100;
16043 }
16044
16045+#if ! _LIBC || __OPTION_EGLIBC_LOCALE_CODE
16046 if (s.era_cnt != -1)
16047 {
16048 era = _nl_select_era_entry (s.era_cnt HELPER_LOCALE_ARG);
16049@@ -1132,6 +1139,7 @@
16050 tm->tm_year = era->start_date[0];
16051 }
16052 else
16053+#endif
16054 if (s.want_era)
16055 {
16056 /* No era found but we have seen an E modifier. Rectify some
16057Index: git/timezone/Makefile
16058===================================================================
16059--- git.orig/timezone/Makefile 2014-08-29 20:01:14.044070587 -0700
16060+++ git/timezone/Makefile 2014-08-29 20:01:15.244070587 -0700
16061@@ -115,7 +115,7 @@
16062
16063 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
16064 sed -e 's|/bin/bash|/bin/sh|' \
16065- -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
16066+ -e '/TZDIR=/s|\$$(pwd)|$(zonedir)|' \
16067 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
16068 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
16069 -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \
16070Index: git/wcsmbs/Makefile
16071===================================================================
16072--- git.orig/wcsmbs/Makefile 2014-08-29 20:00:59.548070587 -0700
16073+++ git/wcsmbs/Makefile 2014-08-29 20:01:15.244070587 -0700
16074@@ -18,15 +18,21 @@
16075 #
16076 # Sub-makefile for wcsmbs portion of the library.
16077 #
16078+include ../option-groups.mak
16079+
16080 subdir := wcsmbs
16081
16082 include ../Makeconfig
16083
16084 headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h
16085
16086-routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
16087+# These functions are used by printf_fp.c, even in the plain case; see
16088+# comments there for OPTION_EGLIBC_LOCALE_CODE.
16089+routines := wmemcpy wmemset
16090+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16091+ := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
16092 wcsncmp wcsncpy wcspbrk wcsrchr wcsspn wcstok wcsstr wmemchr \
16093- wmemcmp wmemcpy wmemmove wmemset wcpcpy wcpncpy wmempcpy \
16094+ wmemcmp wmemmove wcpcpy wcpncpy wmempcpy \
16095 btowc wctob mbsinit \
16096 mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \
16097 mbsnrtowcs wcsnrtombs wcsnlen wcschrnul \
16098@@ -38,14 +44,19 @@
16099 wcscoll_l wcsxfrm_l \
16100 wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
16101 wcsmbsload mbsrtowcs_l \
16102- isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
16103 isoc99_swscanf isoc99_vswscanf \
16104 mbrtoc16 c16rtomb
16105+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
16106+ += isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
16107
16108 strop-tests := wcscmp wmemcmp wcslen wcschr wcsrchr wcscpy
16109-tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
16110- tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
16111- tst-c16c32-1 wcsatcliff $(addprefix test-,$(strop-tests))
16112+tests := tst-wchar-h
16113+tests-$(OPTION_EGLIBC_LOCALE_CODE) \
16114+ += tst-btowc tst-mbrtowc tst-mbrtowc2 tst-wcrtomb tst-c16c32-1
16115+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16116+ += tst-wcstof wcsmbs-tst1 tst-wcsnlen \
16117+ tst-wcpncpy tst-mbsrtowcs \
16118+ wcsatcliff $(addprefix test-,$(strop-tests))
16119 tests-ifunc := $(strop-tests:%=test-%-ifunc)
16120 tests += $(tests-ifunc)
16121
16122Index: git/wcsmbs/wcsmbsload.c
16123===================================================================
16124--- git.orig/wcsmbs/wcsmbsload.c 2014-08-29 20:00:59.580070587 -0700
16125+++ git/wcsmbs/wcsmbsload.c 2014-08-29 20:01:15.248070587 -0700
16126@@ -21,6 +21,7 @@
16127 #include <limits.h>
16128 #include <stdlib.h>
16129 #include <string.h>
16130+#include <gnu/option-groups.h>
16131
16132 #include <locale/localeinfo.h>
16133 #include <wcsmbsload.h>
16134@@ -143,6 +144,7 @@
16135 })
16136
16137
16138+#if __OPTION_EGLIBC_LOCALE_CODE
16139 /* Some of the functions here must not be used while setlocale is called. */
16140 __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
16141
16142@@ -211,6 +213,17 @@
16143
16144 __libc_rwlock_unlock (__libc_setlocale_lock);
16145 }
16146+#else
16147+void
16148+internal_function
16149+__wcsmbs_load_conv (struct __locale_data *new_category)
16150+{
16151+ /* When OPTION_EGLIBC_LOCALE_CODE is disabled, we should never reach
16152+ this point: there is no way to change locales, so every locale
16153+ passed to get_gconv_fcts should be _nl_C_LC_CTYPE. */
16154+ abort ();
16155+}
16156+#endif
16157
16158
16159 /* Clone the current conversion function set. */
16160Index: git/wctype/Makefile
16161===================================================================
16162--- git.orig/wctype/Makefile 2014-08-29 20:00:59.584070587 -0700
16163+++ git/wctype/Makefile 2014-08-29 20:01:15.248070587 -0700
16164@@ -18,14 +18,20 @@
16165 #
16166 # Sub-makefile for wctype portion of the library.
16167 #
16168+include ../option-groups.mak
16169+
16170 subdir := wctype
16171
16172 include ../Makeconfig
16173
16174 headers := wctype.h
16175-routines := wcfuncs wctype iswctype wctrans towctrans \
16176- wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l
16177+routines := wctrans towctrans towctrans_l
16178+routines-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16179+ := wcfuncs wctype iswctype \
16180+ wcfuncs_l wctype_l iswctype_l wctrans_l
16181
16182-tests := test_wctype test_wcfuncs bug-wctypeh
16183+tests :=
16184+tests-$(OPTION_POSIX_C_LANG_WIDE_CHAR) \
16185+ += test_wctype test_wcfuncs bug-wctypeh
16186
16187 include ../Rules
16188Index: git/sysdeps/nptl/Makefile
16189===================================================================
16190--- git.orig/sysdeps/nptl/Makefile 2014-08-29 20:00:58.036070587 -0700
16191+++ git/sysdeps/nptl/Makefile 2014-08-29 20:01:15.248070587 -0700
16192@@ -18,6 +18,9 @@
16193
16194 ifeq ($(subdir),nptl)
16195 libpthread-sysdep_routines += errno-loc
16196+ifeq ($(OPTION_EGLIBC_BIG_MACROS),n)
16197+sysdep_routines += small-macros-fns
16198+endif
16199 endif
16200
16201 ifeq ($(subdir),rt)
16202Index: git/sysdeps/nptl/bits/libc-lock.h
16203===================================================================
16204--- git.orig/sysdeps/nptl/bits/libc-lock.h 2014-08-29 20:00:58.036070587 -0700
16205+++ git/sysdeps/nptl/bits/libc-lock.h 2014-08-29 20:01:15.248070587 -0700
16206@@ -24,6 +24,14 @@
16207 #include <stddef.h>
16208
16209
16210+#ifdef _LIBC
16211+# include <lowlevellock.h>
16212+# include <tls.h>
16213+# include <pthread-functions.h>
16214+# include <errno.h> /* For EBUSY. */
16215+# include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
16216+#endif
16217+
16218 /* Mutex type. */
16219 #if defined _LIBC || defined _IO_MTSAFE_IO
16220 # if (defined NOT_IN_libc && !defined IS_IN_libpthread) || !defined _LIBC
16221@@ -87,6 +95,14 @@
16222
16223 /* Lock the recursive named lock variable. */
16224 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16225+# if __OPTION_EGLIBC_BIG_MACROS != 1
16226+/* EGLIBC: Declare wrapper function for a big macro if either
16227+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16228+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16229+extern void __libc_lock_lock_recursive_fn (__libc_lock_recursive_t *);
16230+libc_hidden_proto (__libc_lock_lock_recursive_fn);
16231+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16232+# if __OPTION_EGLIBC_BIG_MACROS
16233 # define __libc_lock_lock_recursive(NAME) \
16234 do { \
16235 void *self = THREAD_SELF; \
16236@@ -97,6 +113,10 @@
16237 } \
16238 ++(NAME).cnt; \
16239 } while (0)
16240+# else
16241+# define __libc_lock_lock_recursive(NAME) \
16242+ __libc_lock_lock_recursive_fn (&(NAME))
16243+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16244 #else
16245 # define __libc_lock_lock_recursive(NAME) \
16246 __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
16247@@ -104,6 +124,14 @@
16248
16249 /* Try to lock the recursive named lock variable. */
16250 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16251+# if __OPTION_EGLIBC_BIG_MACROS != 1
16252+/* EGLIBC: Declare wrapper function for a big macro if either
16253+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16254+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16255+extern int __libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *);
16256+libc_hidden_proto (__libc_lock_trylock_recursive_fn);
16257+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16258+# if __OPTION_EGLIBC_BIG_MACROS
16259 # define __libc_lock_trylock_recursive(NAME) \
16260 ({ \
16261 int result = 0; \
16262@@ -122,6 +150,10 @@
16263 ++(NAME).cnt; \
16264 result; \
16265 })
16266+# else
16267+# define __libc_lock_trylock_recursive(NAME) \
16268+ __libc_lock_trylock_recursive_fn (&(NAME))
16269+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16270 #else
16271 # define __libc_lock_trylock_recursive(NAME) \
16272 __libc_maybe_call (__pthread_mutex_trylock, (&(NAME).mutex), 0)
16273@@ -129,6 +161,14 @@
16274
16275 /* Unlock the recursive named lock variable. */
16276 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16277+# if __OPTION_EGLIBC_BIG_MACROS != 1
16278+/* EGLIBC: Declare wrapper function for a big macro if either
16279+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
16280+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16281+extern void __libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *);
16282+libc_hidden_proto (__libc_lock_unlock_recursive_fn);
16283+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16284+# if __OPTION_EGLIBC_BIG_MACROS
16285 /* We do no error checking here. */
16286 # define __libc_lock_unlock_recursive(NAME) \
16287 do { \
16288@@ -138,6 +178,10 @@
16289 lll_unlock ((NAME).lock, LLL_PRIVATE); \
16290 } \
16291 } while (0)
16292+# else
16293+# define __libc_lock_unlock_recursive(NAME) \
16294+ __libc_lock_unlock_recursive_fn (&(NAME))
16295+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16296 #else
16297 # define __libc_lock_unlock_recursive(NAME) \
16298 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
16299Index: git/sysdeps/nptl/bits/libc-lockP.h
16300===================================================================
16301--- git.orig/sysdeps/nptl/bits/libc-lockP.h 2014-08-29 20:00:58.044070587 -0700
16302+++ git/sysdeps/nptl/bits/libc-lockP.h 2014-08-29 20:01:15.248070587 -0700
16303@@ -33,6 +33,8 @@
16304 #include <lowlevellock.h>
16305 #include <tls.h>
16306 #include <pthread-functions.h>
16307+#include <errno.h> /* For EBUSY. */
16308+#include <gnu/option-groups.h> /* For __OPTION_EGLIBC_BIG_MACROS. */
16309
16310 /* Mutex type. */
16311 #if defined NOT_IN_libc && !defined IS_IN_libpthread
16312@@ -159,10 +161,22 @@
16313
16314 /* Lock the named lock variable. */
16315 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16316-# ifndef __libc_lock_lock
16317-# define __libc_lock_lock(NAME) \
16318+# if __OPTION_EGLIBC_BIG_MACROS != 1
16319+/* EGLIBC: Declare wrapper function for a big macro if either
16320+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16321+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16322+extern void __libc_lock_lock_fn (__libc_lock_t *);
16323+libc_hidden_proto (__libc_lock_lock_fn);
16324+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16325+# if __OPTION_EGLIBC_BIG_MACROS
16326+# ifndef __libc_lock_lock
16327+# define __libc_lock_lock(NAME) \
16328 ({ lll_lock (NAME, LLL_PRIVATE); 0; })
16329-# endif
16330+# endif
16331+# else
16332+# define __libc_lock_lock(NAME) \
16333+ __libc_lock_lock_fn (&(NAME))
16334+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16335 #else
16336 # undef __libc_lock_lock
16337 # define __libc_lock_lock(NAME) \
16338@@ -175,10 +189,22 @@
16339
16340 /* Try to lock the named lock variable. */
16341 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16342-# ifndef __libc_lock_trylock
16343-# define __libc_lock_trylock(NAME) \
16344+# if __OPTION_EGLIBC_BIG_MACROS != 1
16345+/* EGLIBC: Declare wrapper function for a big macro if either
16346+ !__OPTION_EGLIBC_BIG_MACROS or we are using a back door from
16347+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16348+extern int __libc_lock_trylock_fn (__libc_lock_t *);
16349+libc_hidden_proto (__libc_lock_trylock_fn);
16350+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16351+# if __OPTION_EGLIBC_BIG_MACROS
16352+# ifndef __libc_lock_trylock
16353+# define __libc_lock_trylock(NAME) \
16354 lll_trylock (NAME)
16355-# endif
16356+# endif
16357+# else
16358+# define __libc_lock_trylock(NAME) \
16359+ __libc_lock_trylock_fn (&(NAME))
16360+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16361 #else
16362 # undef __libc_lock_trylock
16363 # define __libc_lock_trylock(NAME) \
16364@@ -194,8 +220,20 @@
16365
16366 /* Unlock the named lock variable. */
16367 #if !defined NOT_IN_libc || defined IS_IN_libpthread
16368+# if __OPTION_EGLIBC_BIG_MACROS != 1
16369+/* EGLIBC: Declare wrapper function for a big macro if either
16370+ !__OPTION_EGLIBC_BIG_MACROS, or we are using a back door from
16371+ small-macros-fns.c (__OPTION_EGLIBC_BIG_MACROS == 2). */
16372+extern void __libc_lock_unlock_fn (__libc_lock_t *);
16373+libc_hidden_proto (__libc_lock_unlock_fn);
16374+# endif /* __OPTION_EGLIBC_BIG_MACROS != 1 */
16375+# if __OPTION_EGLIBC_BIG_MACROS
16376 # define __libc_lock_unlock(NAME) \
16377 lll_unlock (NAME, LLL_PRIVATE)
16378+# else
16379+# define __libc_lock_unlock(NAME) \
16380+ __libc_lock_unlock_fn (&(NAME))
16381+# endif /* __OPTION_EGLIBC_BIG_MACROS */
16382 #else
16383 # define __libc_lock_unlock(NAME) \
16384 __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
16385Index: git/sysdeps/nptl/small-macros-fns.c
16386===================================================================
16387--- /dev/null 1970-01-01 00:00:00.000000000 +0000
16388+++ git/sysdeps/nptl/small-macros-fns.c 2014-08-29 20:01:15.248070587 -0700
16389@@ -0,0 +1,72 @@
16390+/* EGLIBC: function wrappers for big macros.
16391+ Copyright (C) 2009 Free Software Foundation, Inc.
16392+ This file is part of the GNU C Library.
16393+
16394+ The GNU C Library is free software; you can redistribute it and/or
16395+ modify it under the terms of the GNU Lesser General Public License as
16396+ published by the Free Software Foundation; either version 2.1 of the
16397+ License, or (at your option) any later version.
16398+
16399+ The GNU C Library is distributed in the hope that it will be useful,
16400+ but WITHOUT ANY WARRANTY; without even the implied warranty of
16401+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16402+ Lesser General Public License for more details.
16403+
16404+ You should have received a copy of the GNU Lesser General Public
16405+ License along with the GNU C Library; see the file COPYING.LIB. If not,
16406+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16407+ Boston, MA 02111-1307, USA. */
16408+
16409+#include <gnu/option-groups.h>
16410+
16411+/* Handle macros from ./bits/libc-lock.h. */
16412+#if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
16413+
16414+/* Get the macros for function bodies through a back door. */
16415+# undef __OPTION_EGLIBC_BIG_MACROS
16416+# define __OPTION_EGLIBC_BIG_MACROS 2
16417+# include <bits/libc-lock.h>
16418+
16419+void
16420+__libc_lock_lock_fn (__libc_lock_t *name)
16421+{
16422+ __libc_lock_lock (*name);
16423+}
16424+libc_hidden_def (__libc_lock_lock_fn);
16425+
16426+void
16427+__libc_lock_lock_recursive_fn (__libc_lock_recursive_t *name)
16428+{
16429+ __libc_lock_lock_recursive (*name);
16430+}
16431+libc_hidden_def (__libc_lock_lock_recursive_fn);
16432+
16433+int
16434+__libc_lock_trylock_fn (__libc_lock_t *name)
16435+{
16436+ return __libc_lock_trylock (*name);
16437+}
16438+libc_hidden_def (__libc_lock_trylock_fn);
16439+
16440+int
16441+__libc_lock_trylock_recursive_fn (__libc_lock_recursive_t *name)
16442+{
16443+ return __libc_lock_trylock_recursive (*name);
16444+}
16445+libc_hidden_def (__libc_lock_trylock_recursive_fn);
16446+
16447+void
16448+__libc_lock_unlock_fn (__libc_lock_t *name)
16449+{
16450+ __libc_lock_unlock (*name);
16451+}
16452+libc_hidden_def (__libc_lock_unlock_fn);
16453+
16454+void
16455+__libc_lock_unlock_recursive_fn (__libc_lock_recursive_t *name)
16456+{
16457+ __libc_lock_unlock_recursive (*name);
16458+}
16459+libc_hidden_def (__libc_lock_unlock_recursive_fn);
16460+
16461+#endif /*defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)*/
16462Index: git/include/libc-symbols.h
16463===================================================================
16464--- git.orig/include/libc-symbols.h 2014-08-29 20:00:47.144070587 -0700
16465+++ git/include/libc-symbols.h 2014-08-29 20:01:15.248070587 -0700
16466@@ -60,8 +60,11 @@
16467 /* Define these macros for the benefit of portable GNU code that wants to check
16468 them. Of course, STDC_HEADERS is never false when building libc! */
16469 #define STDC_HEADERS 1
16470-#define HAVE_MBSTATE_T 1
16471-#define HAVE_MBSRTOWCS 1
16472+
16473+#if __OPTION_EGLIBC_LOCALE_CODE
16474+# define HAVE_MBSTATE_T 1
16475+# define HAVE_MBSRTOWCS 1
16476+#endif
16477 #define HAVE_LIBINTL_H 1
16478 #define HAVE_WCTYPE_H 1
16479 #define HAVE_ISWCTYPE 1
16480Index: git/crypt/crypt_common.c
16481===================================================================
16482--- /dev/null 1970-01-01 00:00:00.000000000 +0000
16483+++ git/crypt/crypt_common.c 2014-08-29 20:01:15.248070587 -0700
16484@@ -0,0 +1,42 @@
16485+/*
16486+ * crypt: crypt(3) implementation
16487+ *
16488+ * Copyright (C) 1991-2014 Free Software Foundation, Inc.
16489+ *
16490+ * This library is free software; you can redistribute it and/or
16491+ * modify it under the terms of the GNU Lesser General Public
16492+ * License as published by the Free Software Foundation; either
16493+ * version 2.1 of the License, or (at your option) any later version.
16494+ *
16495+ * This library is distributed in the hope that it will be useful,
16496+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16497+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16498+ * Lesser General Public License for more details.
16499+ *
16500+ * You should have received a copy of the GNU Lesser General Public
16501+ * License along with this library; see the file COPYING.LIB. If not,
16502+ * see <http://www.gnu.org/licenses/>.
16503+ *
16504+ * General Support routines
16505+ *
16506+ */
16507+
16508+#include "crypt-private.h"
16509+
16510+/* Table with characters for base64 transformation. */
16511+static const char b64t[64] =
16512+"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
16513+
16514+void
16515+__b64_from_24bit (char **cp, int *buflen,
16516+ unsigned int b2, unsigned int b1, unsigned int b0,
16517+ int n)
16518+{
16519+ unsigned int w = (b2 << 16) | (b1 << 8) | b0;
16520+ while (n-- > 0 && (*buflen) > 0)
16521+ {
16522+ *(*cp)++ = b64t[w & 0x3f];
16523+ --(*buflen);
16524+ w >>= 6;
16525+ }
16526+}
16527Index: git/crypt/crypt_util.c
16528===================================================================
16529--- git.orig/crypt/crypt_util.c 2014-08-29 20:00:43.028070587 -0700
16530+++ git/crypt/crypt_util.c 2014-08-29 20:01:15.248070587 -0700
16531@@ -242,10 +242,6 @@
16532 */
16533 static ufc_long efp[16][64][2];
16534
16535-/* Table with characters for base64 transformation. */
16536-static const char b64t[64] =
16537-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
16538-
16539 /*
16540 * For use by the old, non-reentrant routines
16541 * (crypt/encrypt/setkey)
16542@@ -949,17 +945,3 @@
16543 {
16544 __setkey_r(__key, &_ufc_foobar);
16545 }
16546-
16547-void
16548-__b64_from_24bit (char **cp, int *buflen,
16549- unsigned int b2, unsigned int b1, unsigned int b0,
16550- int n)
16551-{
16552- unsigned int w = (b2 << 16) | (b1 << 8) | b0;
16553- while (n-- > 0 && (*buflen) > 0)
16554- {
16555- *(*cp)++ = b64t[w & 0x3f];
16556- --(*buflen);
16557- w >>= 6;
16558- }
16559-}
16560Index: git/sysdeps/arm/Makefile
16561===================================================================
16562--- git.orig/sysdeps/arm/Makefile 2014-08-29 20:29:37.000000000 -0700
16563+++ git/sysdeps/arm/Makefile 2014-08-29 20:31:09.904070587 -0700
16564@@ -37,10 +37,13 @@
16565 # get offset to rtld_global._dl_hwcap
16566 gen-as-const-headers += rtld-global-offsets.sym tlsdesc.sym
16567 aeabi_constants = aeabi_lcsts aeabi_sighandlers aeabi_math
16568-aeabi_routines = aeabi_assert aeabi_localeconv aeabi_errno_addr \
16569+aeabi_routines = aeabi_assert aeabi_errno_addr \
16570 aeabi_mb_cur_max aeabi_atexit aeabi_memclr aeabi_memcpy \
16571 aeabi_memmove aeabi_memset \
16572 aeabi_read_tp libc-aeabi_read_tp
16573+ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
16574+aeabi_routines += aeabi_localeconv
16575+endif
16576
16577 sysdep_routines += $(aeabi_constants) $(aeabi_routines)
16578 static-only-routines += $(aeabi_constants) aeabi_read_tp
diff --git a/meta/recipes-core/glibc/glibc/eglibc.patch b/meta/recipes-core/glibc/glibc/eglibc.patch
new file mode 100644
index 0000000000..fdfabc3a06
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/eglibc.patch
@@ -0,0 +1,602 @@
1Instruction documents from eglibc
2
3Upstream-Status: Pending
4
5Index: git/EGLIBC.cross-building
6===================================================================
7--- /dev/null 1970-01-01 00:00:00.000000000 +0000
8+++ git/EGLIBC.cross-building 2014-08-27 07:27:25.580070587 +0000
9@@ -0,0 +1,383 @@
10+ -*- mode: text -*-
11+
12+ Cross-Compiling EGLIBC
13+ Jim Blandy <jimb@codesourcery.com>
14+
15+
16+Introduction
17+
18+Most GNU tools have a simple build procedure: you run their
19+'configure' script, and then you run 'make'. Unfortunately, the
20+process of cross-compiling the GNU C library is quite a bit more
21+involved:
22+
23+1) Build a cross-compiler, with certain facilities disabled.
24+
25+2) Configure the C library using the compiler you built in step 1).
26+ Build a few of the C run-time object files, but not the rest of the
27+ library. Install the library's header files and the run-time
28+ object files, and create a dummy libc.so.
29+
30+3) Build a second cross-compiler, using the header files and object
31+ files you installed in step 2.
32+
33+4) Configure, build, and install a fresh C library, using the compiler
34+ built in step 3.
35+
36+5) Build a third cross-compiler, based on the C library built in step 4.
37+
38+The reason for this complexity is that, although GCC and the GNU C
39+library are distributed separately, they are not actually independent
40+of each other: GCC requires the C library's headers and some object
41+files to compile its own libraries, while the C library depends on
42+GCC's libraries. EGLIBC includes features and bug fixes to the stock
43+GNU C library that simplify this process, but the fundamental
44+interdependency stands.
45+
46+In this document, we explain how to cross-compile an EGLIBC/GCC pair
47+from source. Our intended audience is developers who are already
48+familiar with the GNU toolchain and comfortable working with
49+cross-development tools. While we do present a worked example to
50+accompany the explanation, for clarity's sake we do not cover many of
51+the options available to cross-toolchain users.
52+
53+
54+Preparation
55+
56+EGLIBC requires recent versions of the GNU binutils, GCC, and the
57+Linux kernel. The web page <http://www.eglibc.org/prerequisites>
58+documents the current requirements, and lists patches needed for
59+certain target architectures. As of this writing, these build
60+instructions have been tested with binutils 2.22.51, GCC 4.6.2,
61+and Linux 3.1.
62+
63+First, let's set some variables, to simplify later commands. We'll
64+build EGLIBC and GCC for an ARM target, known to the Linux kernel
65+as 'arm', and we'll do the build on an Intel x86_64 Linux box:
66+
67+ $ build=x86_64-pc-linux-gnu
68+ $ host=$build
69+ $ target=arm-none-linux-gnueabi
70+ $ linux_arch=arm
71+
72+We're using the aforementioned versions of Binutils, GCC, and Linux:
73+
74+ $ binutilsv=binutils-2.22.51
75+ $ gccv=gcc-4.6.2
76+ $ linuxv=linux-3.1
77+
78+We're carrying out the entire process under '~/cross-build', which
79+contains unpacked source trees for binutils, gcc, and linux kernel,
80+along with EGLIBC svn trunk (which can be checked-out with
81+'svn co http://www.eglibc.org/svn/trunk eglibc'):
82+
83+ $ top=$HOME/cross-build/$target
84+ $ src=$HOME/cross-build/src
85+ $ ls $src
86+ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1
87+
88+We're going to place our build directories in a subdirectory 'obj',
89+we'll install the cross-development toolchain in 'tools', and we'll
90+place our sysroot (containing files to be installed on the target
91+system) in 'sysroot':
92+
93+ $ obj=$top/obj
94+ $ tools=$top/tools
95+ $ sysroot=$top/sysroot
96+
97+
98+Binutils
99+
100+Configuring and building binutils for the target is straightforward:
101+
102+ $ mkdir -p $obj/binutils
103+ $ cd $obj/binutils
104+ $ $src/$binutilsv/configure \
105+ > --target=$target \
106+ > --prefix=$tools \
107+ > --with-sysroot=$sysroot
108+ $ make
109+ $ make install
110+
111+
112+The First GCC
113+
114+For our work, we need a cross-compiler targeting an ARM Linux
115+system. However, that configuration includes the shared library
116+'libgcc_s.so', which is compiled against the EGLIBC headers (which we
117+haven't installed yet) and linked against 'libc.so' (which we haven't
118+built yet).
119+
120+Fortunately, there are configuration options for GCC which tell it not
121+to build 'libgcc_s.so'. The '--without-headers' option is supposed to
122+take care of this, but its implementation is incomplete, so you must
123+also configure with the '--with-newlib' option. While '--with-newlib'
124+appears to mean "Use the Newlib C library", its effect is to tell the
125+GCC build machinery, "Don't assume there is a C library available."
126+
127+We also need to disable some of the libraries that would normally be
128+built along with GCC, and specify that only the compiler for the C
129+language is needed.
130+
131+So, we create a build directory, configure, make, and install.
132+
133+ $ mkdir -p $obj/gcc1
134+ $ cd $obj/gcc1
135+ $ $src/$gccv/configure \
136+ > --target=$target \
137+ > --prefix=$tools \
138+ > --without-headers --with-newlib \
139+ > --disable-shared --disable-threads --disable-libssp \
140+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \
141+ > --disable-decimal-float --disable-libffi \
142+ > --enable-languages=c
143+ $ PATH=$tools/bin:$PATH make
144+ $ PATH=$tools/bin:$PATH make install
145+
146+
147+Linux Kernel Headers
148+
149+To configure EGLIBC, we also need Linux kernel headers in place.
150+Fortunately, the Linux makefiles have a target that installs them for
151+us. Since the process does modify the source tree a bit, we make a
152+copy first:
153+
154+ $ cp -r $src/$linuxv $obj/linux
155+ $ cd $obj/linux
156+
157+Now we're ready to install the headers into the sysroot:
158+
159+ $ PATH=$tools/bin:$PATH \
160+ > make headers_install \
161+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
162+ > INSTALL_HDR_PATH=$sysroot/usr
163+
164+
165+EGLIBC Headers and Preliminary Objects
166+
167+Using the cross-compiler we've just built, we can now configure EGLIBC
168+well enough to install the headers and build the object files that the
169+full cross-compiler will need:
170+
171+ $ mkdir -p $obj/eglibc-headers
172+ $ cd $obj/eglibc-headers
173+ $ BUILD_CC=gcc \
174+ > CC=$tools/bin/$target-gcc \
175+ > CXX=$tools/bin/$target-g++ \
176+ > AR=$tools/bin/$target-ar \
177+ > RANLIB=$tools/bin/$target-ranlib \
178+ > $src/eglibc/libc/configure \
179+ > --prefix=/usr \
180+ > --with-headers=$sysroot/usr/include \
181+ > --build=$build \
182+ > --host=$target \
183+ > --disable-profile --without-gd --without-cvs \
184+ > --enable-add-ons=nptl,libidn,../ports
185+
186+The option '--prefix=/usr' may look strange, but you should never
187+configure EGLIBC with a prefix other than '/usr': in various places,
188+EGLIBC's build system checks whether the prefix is '/usr', and does
189+special handling only if that is the case. Unless you use this
190+prefix, you will get a sysroot that does not use the standard Linux
191+directory layouts and cannot be used as a basis for the root
192+filesystem on your target system compatibly with normal GLIBC
193+installations.
194+
195+The '--with-headers' option tells EGLIBC where the Linux headers have
196+been installed.
197+
198+The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look
199+for the listed glibc add-ons. Most notably the ports add-on (located
200+just above the libc sources in the EGLIBC svn tree) is required to
201+support ARM targets.
202+
203+We can now use the 'install-headers' makefile target to install the
204+headers:
205+
206+ $ make install-headers install_root=$sysroot \
207+ > install-bootstrap-headers=yes
208+
209+The 'install_root' variable indicates where the files should actually
210+be installed; its value is treated as the parent of the '--prefix'
211+directory we passed to the configure script, so the headers will go in
212+'$sysroot/usr/include'. The 'install-bootstrap-headers' variable
213+requests special handling for certain tricky header files.
214+
215+Next, there are a few object files needed to link shared libraries,
216+which we build and install by hand:
217+
218+ $ mkdir -p $sysroot/usr/lib
219+ $ make csu/subdir_lib
220+ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib
221+
222+Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However,
223+since we will never actually execute its code, it doesn't matter what
224+it contains. So, treating '/dev/null' as a C source file, we produce
225+a dummy 'libc.so' in one step:
226+
227+ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \
228+ > -o $sysroot/usr/lib/libc.so
229+
230+
231+The Second GCC
232+
233+With the EGLIBC headers and selected object files installed, we can
234+now build a GCC that is capable of compiling EGLIBC. We configure,
235+build, and install the second GCC, again building only the C compiler,
236+and avoiding libraries we won't use:
237+
238+ $ mkdir -p $obj/gcc2
239+ $ cd $obj/gcc2
240+ $ $src/$gccv/configure \
241+ > --target=$target \
242+ > --prefix=$tools \
243+ > --with-sysroot=$sysroot \
244+ > --disable-libssp --disable-libgomp --disable-libmudflap \
245+ > --disable-libffi --disable-libquadmath \
246+ > --enable-languages=c
247+ $ PATH=$tools/bin:$PATH make
248+ $ PATH=$tools/bin:$PATH make install
249+
250+
251+EGLIBC, Complete
252+
253+With the second compiler built and installed, we're now ready for the
254+full EGLIBC build:
255+
256+ $ mkdir -p $obj/eglibc
257+ $ cd $obj/eglibc
258+ $ BUILD_CC=gcc \
259+ > CC=$tools/bin/$target-gcc \
260+ > CXX=$tools/bin/$target-g++ \
261+ > AR=$tools/bin/$target-ar \
262+ > RANLIB=$tools/bin/$target-ranlib \
263+ > $src/eglibc/libc/configure \
264+ > --prefix=/usr \
265+ > --with-headers=$sysroot/usr/include \
266+ > --with-kconfig=$obj/linux/scripts/kconfig \
267+ > --build=$build \
268+ > --host=$target \
269+ > --disable-profile --without-gd --without-cvs \
270+ > --enable-add-ons=nptl,libidn,../ports
271+
272+Note the additional '--with-kconfig' option. This tells EGLIBC where to
273+find the host config tools used by the kernel 'make config' and 'make
274+menuconfig'. These tools can be re-used by EGLIBC for its own 'make
275+*config' support, which will create 'option-groups.config' for you.
276+But first make sure those tools have been built by running some
277+dummy 'make *config' calls in the kernel directory:
278+
279+ $ cd $obj/linux
280+ $ PATH=$tools/bin:$PATH make config \
281+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
282+ $ PATH=$tools/bin:$PATH make menuconfig \
283+ > ARCH=$linux_arch CROSS_COMPILE=$target- \
284+
285+Now we can configure and build the full EGLIBC:
286+
287+ $ cd $obj/eglibc
288+ $ PATH=$tools/bin:$PATH make defconfig
289+ $ PATH=$tools/bin:$PATH make menuconfig
290+ $ PATH=$tools/bin:$PATH make
291+ $ PATH=$tools/bin:$PATH make install install_root=$sysroot
292+
293+At this point, we have a complete EGLIBC installation in '$sysroot',
294+with header files, library files, and most of the C runtime startup
295+files in place.
296+
297+
298+The Third GCC
299+
300+Finally, we recompile GCC against this full installation, enabling
301+whatever languages and libraries we would like to use:
302+
303+ $ mkdir -p $obj/gcc3
304+ $ cd $obj/gcc3
305+ $ $src/$gccv/configure \
306+ > --target=$target \
307+ > --prefix=$tools \
308+ > --with-sysroot=$sysroot \
309+ > --enable-__cxa_atexit \
310+ > --disable-libssp --disable-libgomp --disable-libmudflap \
311+ > --enable-languages=c,c++
312+ $ PATH=$tools/bin:$PATH make
313+ $ PATH=$tools/bin:$PATH make install
314+
315+The '--enable-__cxa_atexit' option tells GCC what sort of C++
316+destructor support to expect from the C library; it's required with
317+EGLIBC.
318+
319+And since GCC's installation process isn't designed to help construct
320+sysroot trees, we must manually copy certain libraries into place in
321+the sysroot.
322+
323+ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib
324+ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib
325+
326+
327+Trying Things Out
328+
329+At this point, '$tools' contains a cross toolchain ready to use
330+the EGLIBC installation in '$sysroot':
331+
332+ $ cat > hello.c <<EOF
333+ > #include <stdio.h>
334+ > int
335+ > main (int argc, char **argv)
336+ > {
337+ > puts ("Hello, world!");
338+ > return 0;
339+ > }
340+ > EOF
341+ $ $tools/bin/$target-gcc -Wall hello.c -o hello
342+ $ cat > c++-hello.cc <<EOF
343+ > #include <iostream>
344+ > int
345+ > main (int argc, char **argv)
346+ > {
347+ > std::cout << "Hello, C++ world!" << std::endl;
348+ > return 0;
349+ > }
350+ > EOF
351+ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello
352+
353+
354+We can use 'readelf' to verify that these are indeed executables for
355+our target, using our dynamic linker:
356+
357+ $ $tools/bin/$target-readelf -hl hello
358+ ELF Header:
359+ ...
360+ Type: EXEC (Executable file)
361+ Machine: ARM
362+
363+ ...
364+ Program Headers:
365+ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
366+ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
367+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
368+ [Requesting program interpreter: /lib/ld-linux.so.3]
369+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000
370+ ...
371+
372+Looking at the dynamic section of the installed 'libgcc_s.so', we see
373+that the 'NEEDED' entry for the C library does include the '.6'
374+suffix, indicating that was linked against our fully build EGLIBC, and
375+not our dummy 'libc.so':
376+
377+ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1
378+ Dynamic section at offset 0x1083c contains 24 entries:
379+ Tag Type Name/Value
380+ 0x00000001 (NEEDED) Shared library: [libc.so.6]
381+ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1]
382+ ...
383+
384+
385+And on the target machine, we can run our programs:
386+
387+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
388+ > ./hello
389+ Hello, world!
390+ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \
391+ > ./c++-hello
392+ Hello, C++ world!
393Index: git/EGLIBC.cross-testing
394===================================================================
395--- /dev/null 1970-01-01 00:00:00.000000000 +0000
396+++ git/EGLIBC.cross-testing 2014-08-27 07:24:41.532070587 +0000
397@@ -0,0 +1,205 @@
398+ -*- mode: text -*-
399+
400+ Cross-Testing With EGLIBC
401+ Jim Blandy <jimb@codesourcery.com>
402+
403+
404+Introduction
405+
406+Developers writing software for embedded systems often use a desktop
407+or other similarly capable computer for development, but need to run
408+tests on the embedded system, or perhaps on a simulator. When
409+configured for cross-compilation, the stock GNU C library simply
410+disables running tests altogether: the command 'make tests' builds
411+test programs, but does not run them. EGLIBC, however, provides
412+facilities for compiling tests and generating data files on the build
413+system, but running the test programs themselves on a remote system or
414+simulator.
415+
416+
417+Test environment requirements
418+
419+The test environment must meet certain conditions for EGLIBC's
420+cross-testing facilities to work:
421+
422+- Shared filesystems. The 'build' system, on which you configure and
423+ compile EGLIBC, and the 'host' system, on which you intend to run
424+ EGLIBC, must share a filesystem containing the EGLIBC build and
425+ source trees. Files must appear at the same paths on both systems.
426+
427+- Remote-shell like invocation. There must be a way to run a program
428+ on the host system from the build system, passing it properly quoted
429+ command-line arguments, setting environment variables, and
430+ inheriting the caller's standard input and output.
431+
432+
433+Usage
434+
435+To use EGLIBC's cross-testing support, provide values for the
436+following Make variables when you invoke 'make':
437+
438+- cross-test-wrapper
439+
440+ This should be the name of the cross-testing wrapper command, along
441+ with any arguments.
442+
443+- cross-localedef
444+
445+ This should be the name of a cross-capable localedef program, like
446+ that included in the EGLIBC 'localedef' module, along with any
447+ arguments needed.
448+
449+These are each explained in detail below.
450+
451+
452+The Cross-Testing Wrapper
453+
454+To run test programs reliably, the stock GNU C library takes care to
455+ensure that test programs use the newly compiled dynamic linker and
456+shared libraries, and never the host system's installed libraries. To
457+accomplish this, it runs the tests by explicitly invoking the dynamic
458+linker from the build tree, passing it a list of build tree
459+directories to search for shared libraries, followed by the name of
460+the executable to run and its arguments.
461+
462+For example, where one might normally run a test program like this:
463+
464+ $ ./tst-foo arg1 arg2
465+
466+the GNU C library might run that program like this:
467+
468+ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \
469+ ./tst-foo arg1 arg2
470+
471+(where $objdir is the path to the top of the build tree, and the
472+trailing backslash indicates a continuation of the command). In other
473+words, each test program invocation is 'wrapped up' inside an explicit
474+invocation of the dynamic linker, which must itself execute the test
475+program, having loaded shared libraries from the appropriate
476+directories.
477+
478+To support cross-testing, EGLIBC allows the developer to optionally
479+set the 'cross-test-wrapper' Make variable to another wrapper command,
480+to which it passes the entire dynamic linker invocation shown above as
481+arguments. For example, if the developer supplies a wrapper of
482+'my-wrapper hostname', then EGLIBC would run the test above as
483+follows:
484+
485+ $ my-wrapper hostname \
486+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
487+ ./tst-foo arg1 arg2
488+
489+The 'my-wrapper' command is responsible for executing the command
490+given on the host system.
491+
492+Since tests are run in varying directories, the wrapper should either
493+be in your command search path, or 'cross-test-wrapper' should give an
494+absolute path for the wrapper.
495+
496+The wrapper must meet several requirements:
497+
498+- It must preserve the current directory. As explained above, the
499+ build directory tree must be visible on both the build and host
500+ systems, at the same path. The test wrapper must ensure that the
501+ current directory it inherits is also inherited by the dynamic
502+ linker (and thus the test program itself).
503+
504+- It must preserve environment variables' values. Many EGLIBC tests
505+ set environment variables for test runs; in native testing, it
506+ invokes programs like this:
507+
508+ $ GCONV_PATH=$objdir/iconvdata \
509+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
510+ ./tst-foo arg1 arg2
511+
512+ With the cross-testing wrapper, that invocation becomes:
513+
514+ $ GCONV_PATH=$objdir/iconvdata \
515+ my-wrapper hostname \
516+ $objdir/elf/ld-linux.so.3 --library-path $objdir \
517+ ./tst-foo arg1 arg2
518+
519+ Here, 'my-wrapper' must ensure that the value it sees for
520+ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo'
521+ itself. (The wrapper supplied with GLIBC simply preserves the
522+ values of *all* enviroment variables, with a fixed set of
523+ exceptions.)
524+
525+ If your wrapper is a shell script, take care to correctly propagate
526+ environment variables whose values contain spaces and shell
527+ metacharacters.
528+
529+- It must pass the command's arguments, unmodified. The arguments
530+ seen by the test program should be exactly those seen by the wrapper
531+ (after whatever arguments are given to the wrapper itself). The
532+ EGLIBC test framework performs all needed shell word splitting and
533+ expansion (wildcard expansion, parameter substitution, and so on)
534+ before invoking the wrapper; further expansion may break the tests.
535+
536+
537+The 'cross-test-ssh.sh' script
538+
539+If you want to use 'ssh' (or something sufficiently similar) to run
540+test programs on your host system, EGLIBC includes a shell script,
541+'scripts/cross-test-ssh.sh', which you can use as your wrapper
542+command. This script takes care of setting the test command's current
543+directory, propagating environment variable values, and carrying
544+command-line arguments, all across an 'ssh' connection. You may even
545+supply an alternative to 'ssh' on the command line, if needed.
546+
547+For more details, pass 'cross-test-ssh.sh' the '--help' option.
548+
549+
550+The Cross-Compiling Locale Definition Command
551+
552+Some EGLIBC tests rely on locales generated especially for the test
553+process. In a native configuration, these tests simply run the
554+'localedef' command built by the normal EGLIBC build process,
555+'locale/localedef', to process and install their locales. However, in
556+a cross-compiling configuration, this 'localedef' is built for the
557+host system, not the build system, and since it requires quite a bit
558+of memory to run (we have seen it fail on systems with 64MiB of
559+memory), it may not be practical to run it on the host system.
560+
561+If set, EGLIBC uses the 'cross-localedef' Make variable as the command
562+to run on the build system to process and install locales. The
563+localedef program built from the EGLIBC 'localedef' module is
564+suitable.
565+
566+The value of 'cross-localedef' may also include command-line arguments
567+to be passed to the program; if you are using EGLIBC's 'localedef',
568+you may include endianness and 'uint32_t' alignment arguments here.
569+
570+
571+Example
572+
573+In developing EGLIBC's cross-testing facility, we invoked 'make' with
574+the following script:
575+
576+ #!/bin/sh
577+
578+ srcdir=...
579+ test_hostname=...
580+ localedefdir=...
581+ cross_gxx=...-g++
582+
583+ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname"
584+ localedef="$localedefdir/localedef --little-endian --uint32-align=4"
585+
586+ make cross-test-wrapper="$wrapper" \
587+ cross-localedef="$localedef" \
588+ CXX="$cross_gxx" \
589+ "$@"
590+
591+
592+Other Cross-Testing Concerns
593+
594+Here are notes on some other issues which you may encounter in running
595+the EGLIBC tests in a cross-compiling environment:
596+
597+- Some tests require a C++ cross-compiler; you should set the 'CXX'
598+ Make variable to the name of an appropriate cross-compiler.
599+
600+- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we
601+ simply place copies of these libraries in the top EGLIBC build
602+ directory.
diff --git a/meta/recipes-core/glibc/glibc/etc/ld.so.conf b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/etc/ld.so.conf
diff --git a/meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch b/meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch
new file mode 100644
index 0000000000..9ab9fdcf12
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/fix-tibetian-locales.patch
@@ -0,0 +1,38 @@
1cross localedef fails to compile these locales because name_fmt field is empty
2It is not acceptable for cross localedef and it errors out
3
4LC_NAME: field `name_fmt' not defined
5
6We therefore give a dummy string to the format, the real fix needs some native
7tibetian person to define proper name_fmt
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13Index: git/localedata/locales/bo_CN
14===================================================================
15--- git.orig/localedata/locales/bo_CN 2014-08-29 10:35:22.464070587 -0700
16+++ git/localedata/locales/bo_CN 2014-08-29 10:35:22.456070587 -0700
17@@ -146,7 +146,7 @@
18 LC_NAME
19 % FIXME
20
21-name_fmt ""
22+name_fmt "FIXME"
23 % name_gen "FIXME"
24 % name_miss "FIXME"
25 % name_mr "FIXME"
26Index: git/localedata/locales/bo_IN
27===================================================================
28--- git.orig/localedata/locales/bo_IN 2014-08-29 10:35:22.464070587 -0700
29+++ git/localedata/locales/bo_IN 2014-08-29 10:35:22.456070587 -0700
30@@ -71,7 +71,7 @@
31
32 LC_NAME
33 % FIXME
34-name_fmt ""
35+name_fmt "FIXME"
36 % name_gen "FIXME"
37 % name_miss "FIXME"
38 % name_mr "FIXME"
diff --git a/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch b/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch
new file mode 100644
index 0000000000..668e8bf678
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/fix_am_rootsbindir.patch
@@ -0,0 +1,29 @@
1sysdeps/gnu/configure.ac: handle correctly $libc_cv_rootsbindir
2
3Upstream-Status:Pending
4Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
5
6Index: git/sysdeps/gnu/configure
7===================================================================
8--- git.orig/sysdeps/gnu/configure 2014-08-27 07:24:38.572070587 +0000
9+++ git/sysdeps/gnu/configure 2014-08-27 07:24:41.308070587 +0000
10@@ -32,6 +32,6 @@
11 else
12 libc_cv_localstatedir=$localstatedir
13 fi
14- libc_cv_rootsbindir=/sbin
15+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
16 ;;
17 esac
18Index: git/sysdeps/gnu/configure.ac
19===================================================================
20--- git.orig/sysdeps/gnu/configure.ac 2014-08-27 07:24:38.572070587 +0000
21+++ git/sysdeps/gnu/configure.ac 2014-08-27 07:24:41.308070587 +0000
22@@ -21,6 +21,6 @@
23 else
24 libc_cv_localstatedir=$localstatedir
25 fi
26- libc_cv_rootsbindir=/sbin
27+ test -n "$libc_cv_rootsbindir" || libc_cv_rootsbindir=/sbin
28 ;;
29 esac
diff --git a/meta/recipes-core/glibc/glibc/fsl-ppc-no-fsqrt.patch b/meta/recipes-core/glibc/glibc/fsl-ppc-no-fsqrt.patch
new file mode 100644
index 0000000000..f88eaf444e
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/fsl-ppc-no-fsqrt.patch
@@ -0,0 +1,100 @@
1Create e5500 specific math_private.h and let it include when compiling for e5500/64bit core
2We prefefine __CPU_HAS_FSQRT to 0 and then in general ppc64 math_private.h we check if its
3already defined before redefining it. This way we can ensure that on e5500 builds it wont
4emit fsqrt intructions
5
6-Khem
7
8Upstream-Status: Pending
9
10Index: git/sysdeps/powerpc/fpu/math_private.h
11===================================================================
12--- git.orig/sysdeps/powerpc/fpu/math_private.h 2014-08-29 10:31:30.224070587 -0700
13+++ git/sysdeps/powerpc/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
14@@ -25,10 +25,12 @@
15 #include <fenv_private.h>
16 #include_next <math_private.h>
17
18-# if __WORDSIZE == 64 || defined _ARCH_PWR4
19-# define __CPU_HAS_FSQRT 1
20-# else
21-# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
22+# ifndef __CPU_HAS_FSQRT
23+# if __WORDSIZE == 64 || defined _ARCH_PWR4
24+# define __CPU_HAS_FSQRT 1
25+# else
26+# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
27+# endif
28 # endif
29
30 extern double __slow_ieee754_sqrt (double);
31Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h
32===================================================================
33--- /dev/null 1970-01-01 00:00:00.000000000 +0000
34+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
35@@ -0,0 +1,9 @@
36+#ifndef _E5500_MATH_PRIVATE_H_
37+#define _E5500_MATH_PRIVATE_H_ 1
38+/* E5500 core FPU does not implement
39+ fsqrt */
40+
41+#define __CPU_HAS_FSQRT 0
42+#include_next <math_private.h>
43+
44+#endif /* _E5500_MATH_PRIVATE_H_ */
45Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h
46===================================================================
47--- /dev/null 1970-01-01 00:00:00.000000000 +0000
48+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
49@@ -0,0 +1,9 @@
50+#ifndef _E6500_MATH_PRIVATE_H_
51+#define _E6500_MATH_PRIVATE_H_ 1
52+/* E6500 core FPU does not implement
53+ fsqrt */
54+
55+#define __CPU_HAS_FSQRT 0
56+#include_next <math_private.h>
57+
58+#endif /* _E6500_MATH_PRIVATE_H_ */
59Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h
60===================================================================
61--- /dev/null 1970-01-01 00:00:00.000000000 +0000
62+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h 2014-08-29 10:31:30.212070587 -0700
63@@ -0,0 +1,9 @@
64+#ifndef _E500MC_MATH_PRIVATE_H_
65+#define _E500MC_MATH_PRIVATE_H_ 1
66+/* E500MC core FPU does not implement
67+ fsqrt */
68+
69+#define __CPU_HAS_FSQRT 0
70+#include_next <math_private.h>
71+
72+#endif /* _E500MC_MATH_PRIVATE_H_ */
73Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h
74===================================================================
75--- /dev/null 1970-01-01 00:00:00.000000000 +0000
76+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h 2014-08-29 10:31:30.216070587 -0700
77@@ -0,0 +1,9 @@
78+#ifndef _E5500_MATH_PRIVATE_H_
79+#define _E5500_MATH_PRIVATE_H_ 1
80+/* E5500 core FPU does not implement
81+ fsqrt */
82+
83+#define __CPU_HAS_FSQRT 0
84+#include_next <math_private.h>
85+
86+#endif /* _E5500_MATH_PRIVATE_H_ */
87Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h
88===================================================================
89--- /dev/null 1970-01-01 00:00:00.000000000 +0000
90+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h 2014-08-29 10:31:30.216070587 -0700
91@@ -0,0 +1,9 @@
92+#ifndef _E6500_MATH_PRIVATE_H_
93+#define _E6500_MATH_PRIVATE_H_ 1
94+/* E6500 core FPU does not implement
95+ fsqrt */
96+
97+#define __CPU_HAS_FSQRT 0
98+#include_next <math_private.h>
99+
100+#endif /* _E6500_MATH_PRIVATE_H_ */
diff --git a/meta/recipes-core/glibc/glibc/generate-supported.mk b/meta/recipes-core/glibc/glibc/generate-supported.mk
new file mode 100644
index 0000000000..d2a28c2dc6
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/generate-supported.mk
@@ -0,0 +1,11 @@
1#!/usr/bin/make
2
3include $(IN)
4
5all:
6 rm -f $(OUT)
7 touch $(OUT)
8 for locale in $(SUPPORTED-LOCALES); do \
9 [ $$locale = true ] && continue; \
10 echo $$locale | sed 's,/, ,' >> $(OUT); \
11 done
diff --git a/meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch b/meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch
new file mode 100644
index 0000000000..f5ed1bfeef
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/glibc.fix_sqrt2.patch
@@ -0,0 +1,1516 @@
1Signed-of-by: Edmar Wienskoski <edmar@freescale.com>
2Upstream-Status: Pending
3
4Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
5===================================================================
6--- /dev/null 1970-01-01 00:00:00.000000000 +0000
7+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
8@@ -0,0 +1,134 @@
9+/* Double-precision floating point square root.
10+ Copyright (C) 2010 Free Software Foundation, Inc.
11+ This file is part of the GNU C Library.
12+
13+ The GNU C Library is free software; you can redistribute it and/or
14+ modify it under the terms of the GNU Lesser General Public
15+ License as published by the Free Software Foundation; either
16+ version 2.1 of the License, or (at your option) any later version.
17+
18+ The GNU C Library is distributed in the hope that it will be useful,
19+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21+ Lesser General Public License for more details.
22+
23+ You should have received a copy of the GNU Lesser General Public
24+ License along with the GNU C Library; if not, write to the Free
25+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26+ 02111-1307 USA. */
27+
28+#include <math.h>
29+#include <math_private.h>
30+#include <fenv_libc.h>
31+#include <inttypes.h>
32+
33+#include <sysdep.h>
34+#include <ldsodefs.h>
35+
36+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
37+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
38+static const float two108 = 3.245185536584267269e+32;
39+static const float twom54 = 5.551115123125782702e-17;
40+static const float half = 0.5;
41+
42+/* The method is based on the descriptions in:
43+
44+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
45+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
46+
47+ We find the actual square root and half of its reciprocal
48+ simultaneously. */
49+
50+#ifdef __STDC__
51+double
52+__ieee754_sqrt (double b)
53+#else
54+double
55+__ieee754_sqrt (b)
56+ double b;
57+#endif
58+{
59+ if (__builtin_expect (b > 0, 1))
60+ {
61+ double y, g, h, d, r;
62+ ieee_double_shape_type u;
63+
64+ if (__builtin_expect (b != a_inf.value, 1))
65+ {
66+ fenv_t fe;
67+
68+ fe = fegetenv_register ();
69+
70+ u.value = b;
71+
72+ relax_fenv_state ();
73+
74+ __asm__ ("frsqrte %[estimate], %[x]\n"
75+ : [estimate] "=f" (y) : [x] "f" (b));
76+
77+ /* Following Muller et al, page 168, equation 5.20.
78+
79+ h goes to 1/(2*sqrt(b))
80+ g goes to sqrt(b).
81+
82+ We need three iterations to get within 1ulp. */
83+
84+ /* Indicate that these can be performed prior to the branch. GCC
85+ insists on sinking them below the branch, however; it seems like
86+ they'd be better before the branch so that we can cover any latency
87+ from storing the argument and loading its high word. Oh well. */
88+
89+ g = b * y;
90+ h = 0.5 * y;
91+
92+ /* Handle small numbers by scaling. */
93+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
94+ return __ieee754_sqrt (b * two108) * twom54;
95+
96+#define FMADD(a_, c_, b_) \
97+ ({ double __r; \
98+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
99+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
100+ __r;})
101+#define FNMSUB(a_, c_, b_) \
102+ ({ double __r; \
103+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
104+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
105+ __r;})
106+
107+ r = FNMSUB (g, h, half);
108+ g = FMADD (g, r, g);
109+ h = FMADD (h, r, h);
110+
111+ r = FNMSUB (g, h, half);
112+ g = FMADD (g, r, g);
113+ h = FMADD (h, r, h);
114+
115+ r = FNMSUB (g, h, half);
116+ g = FMADD (g, r, g);
117+ h = FMADD (h, r, h);
118+
119+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
120+
121+ /* Final refinement. */
122+ d = FNMSUB (g, g, b);
123+
124+ fesetenv_register (fe);
125+ return FMADD (d, h, g);
126+ }
127+ }
128+ else if (b < 0)
129+ {
130+ /* For some reason, some PowerPC32 processors don't implement
131+ FE_INVALID_SQRT. */
132+#ifdef FE_INVALID_SQRT
133+ feraiseexcept (FE_INVALID_SQRT);
134+
135+ fenv_union_t u = { .fenv = fegetenv_register () };
136+ if ((u.l & FE_INVALID) == 0)
137+#endif
138+ feraiseexcept (FE_INVALID);
139+ b = a_nan.value;
140+ }
141+ return f_wash (b);
142+}
143Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
144===================================================================
145--- /dev/null 1970-01-01 00:00:00.000000000 +0000
146+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:34:07.768070587 -0700
147@@ -0,0 +1,101 @@
148+/* Single-precision floating point square root.
149+ Copyright (C) 2010 Free Software Foundation, Inc.
150+ This file is part of the GNU C Library.
151+
152+ The GNU C Library is free software; you can redistribute it and/or
153+ modify it under the terms of the GNU Lesser General Public
154+ License as published by the Free Software Foundation; either
155+ version 2.1 of the License, or (at your option) any later version.
156+
157+ The GNU C Library is distributed in the hope that it will be useful,
158+ but WITHOUT ANY WARRANTY; without even the implied warranty of
159+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
160+ Lesser General Public License for more details.
161+
162+ You should have received a copy of the GNU Lesser General Public
163+ License along with the GNU C Library; if not, write to the Free
164+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
165+ 02111-1307 USA. */
166+
167+#include <math.h>
168+#include <math_private.h>
169+#include <fenv_libc.h>
170+#include <inttypes.h>
171+
172+#include <sysdep.h>
173+#include <ldsodefs.h>
174+
175+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
176+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
177+static const float threehalf = 1.5;
178+
179+/* The method is based on the descriptions in:
180+
181+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
182+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
183+
184+ We find the reciprocal square root and use that to compute the actual
185+ square root. */
186+
187+#ifdef __STDC__
188+float
189+__ieee754_sqrtf (float b)
190+#else
191+float
192+__ieee754_sqrtf (b)
193+ float b;
194+#endif
195+{
196+ if (__builtin_expect (b > 0, 1))
197+ {
198+#define FMSUB(a_, c_, b_) \
199+ ({ double __r; \
200+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
201+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
202+ __r;})
203+#define FNMSUB(a_, c_, b_) \
204+ ({ double __r; \
205+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
206+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
207+ __r;})
208+
209+ if (__builtin_expect (b != a_inf.value, 1))
210+ {
211+ double y, x;
212+ fenv_t fe;
213+
214+ fe = fegetenv_register ();
215+
216+ relax_fenv_state ();
217+
218+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
219+ y = FMSUB (threehalf, b, b);
220+
221+ /* Initial estimate. */
222+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
223+
224+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
225+ x = x * FNMSUB (y, x * x, threehalf);
226+ x = x * FNMSUB (y, x * x, threehalf);
227+ x = x * FNMSUB (y, x * x, threehalf);
228+
229+ /* All done. */
230+ fesetenv_register (fe);
231+ return x * b;
232+ }
233+ }
234+ else if (b < 0)
235+ {
236+ /* For some reason, some PowerPC32 processors don't implement
237+ FE_INVALID_SQRT. */
238+#ifdef FE_INVALID_SQRT
239+ feraiseexcept (FE_INVALID_SQRT);
240+
241+ fenv_union_t u = { .fenv = fegetenv_register () };
242+ if ((u.l & FE_INVALID) == 0)
243+#endif
244+ feraiseexcept (FE_INVALID);
245+ b = a_nan.value;
246+ }
247+ return f_washf (b);
248+}
249Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
250===================================================================
251--- /dev/null 1970-01-01 00:00:00.000000000 +0000
252+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:34:07.768070587 -0700
253@@ -0,0 +1,134 @@
254+/* Double-precision floating point square root.
255+ Copyright (C) 2010 Free Software Foundation, Inc.
256+ This file is part of the GNU C Library.
257+
258+ The GNU C Library is free software; you can redistribute it and/or
259+ modify it under the terms of the GNU Lesser General Public
260+ License as published by the Free Software Foundation; either
261+ version 2.1 of the License, or (at your option) any later version.
262+
263+ The GNU C Library is distributed in the hope that it will be useful,
264+ but WITHOUT ANY WARRANTY; without even the implied warranty of
265+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
266+ Lesser General Public License for more details.
267+
268+ You should have received a copy of the GNU Lesser General Public
269+ License along with the GNU C Library; if not, write to the Free
270+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
271+ 02111-1307 USA. */
272+
273+#include <math.h>
274+#include <math_private.h>
275+#include <fenv_libc.h>
276+#include <inttypes.h>
277+
278+#include <sysdep.h>
279+#include <ldsodefs.h>
280+
281+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
282+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
283+static const float two108 = 3.245185536584267269e+32;
284+static const float twom54 = 5.551115123125782702e-17;
285+static const float half = 0.5;
286+
287+/* The method is based on the descriptions in:
288+
289+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
290+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
291+
292+ We find the actual square root and half of its reciprocal
293+ simultaneously. */
294+
295+#ifdef __STDC__
296+double
297+__ieee754_sqrt (double b)
298+#else
299+double
300+__ieee754_sqrt (b)
301+ double b;
302+#endif
303+{
304+ if (__builtin_expect (b > 0, 1))
305+ {
306+ double y, g, h, d, r;
307+ ieee_double_shape_type u;
308+
309+ if (__builtin_expect (b != a_inf.value, 1))
310+ {
311+ fenv_t fe;
312+
313+ fe = fegetenv_register ();
314+
315+ u.value = b;
316+
317+ relax_fenv_state ();
318+
319+ __asm__ ("frsqrte %[estimate], %[x]\n"
320+ : [estimate] "=f" (y) : [x] "f" (b));
321+
322+ /* Following Muller et al, page 168, equation 5.20.
323+
324+ h goes to 1/(2*sqrt(b))
325+ g goes to sqrt(b).
326+
327+ We need three iterations to get within 1ulp. */
328+
329+ /* Indicate that these can be performed prior to the branch. GCC
330+ insists on sinking them below the branch, however; it seems like
331+ they'd be better before the branch so that we can cover any latency
332+ from storing the argument and loading its high word. Oh well. */
333+
334+ g = b * y;
335+ h = 0.5 * y;
336+
337+ /* Handle small numbers by scaling. */
338+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
339+ return __ieee754_sqrt (b * two108) * twom54;
340+
341+#define FMADD(a_, c_, b_) \
342+ ({ double __r; \
343+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
344+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
345+ __r;})
346+#define FNMSUB(a_, c_, b_) \
347+ ({ double __r; \
348+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
349+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
350+ __r;})
351+
352+ r = FNMSUB (g, h, half);
353+ g = FMADD (g, r, g);
354+ h = FMADD (h, r, h);
355+
356+ r = FNMSUB (g, h, half);
357+ g = FMADD (g, r, g);
358+ h = FMADD (h, r, h);
359+
360+ r = FNMSUB (g, h, half);
361+ g = FMADD (g, r, g);
362+ h = FMADD (h, r, h);
363+
364+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
365+
366+ /* Final refinement. */
367+ d = FNMSUB (g, g, b);
368+
369+ fesetenv_register (fe);
370+ return FMADD (d, h, g);
371+ }
372+ }
373+ else if (b < 0)
374+ {
375+ /* For some reason, some PowerPC32 processors don't implement
376+ FE_INVALID_SQRT. */
377+#ifdef FE_INVALID_SQRT
378+ feraiseexcept (FE_INVALID_SQRT);
379+
380+ fenv_union_t u = { .fenv = fegetenv_register () };
381+ if ((u.l & FE_INVALID) == 0)
382+#endif
383+ feraiseexcept (FE_INVALID);
384+ b = a_nan.value;
385+ }
386+ return f_wash (b);
387+}
388Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
389===================================================================
390--- /dev/null 1970-01-01 00:00:00.000000000 +0000
391+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
392@@ -0,0 +1,101 @@
393+/* Single-precision floating point square root.
394+ Copyright (C) 2010 Free Software Foundation, Inc.
395+ This file is part of the GNU C Library.
396+
397+ The GNU C Library is free software; you can redistribute it and/or
398+ modify it under the terms of the GNU Lesser General Public
399+ License as published by the Free Software Foundation; either
400+ version 2.1 of the License, or (at your option) any later version.
401+
402+ The GNU C Library is distributed in the hope that it will be useful,
403+ but WITHOUT ANY WARRANTY; without even the implied warranty of
404+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
405+ Lesser General Public License for more details.
406+
407+ You should have received a copy of the GNU Lesser General Public
408+ License along with the GNU C Library; if not, write to the Free
409+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
410+ 02111-1307 USA. */
411+
412+#include <math.h>
413+#include <math_private.h>
414+#include <fenv_libc.h>
415+#include <inttypes.h>
416+
417+#include <sysdep.h>
418+#include <ldsodefs.h>
419+
420+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
421+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
422+static const float threehalf = 1.5;
423+
424+/* The method is based on the descriptions in:
425+
426+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
427+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
428+
429+ We find the reciprocal square root and use that to compute the actual
430+ square root. */
431+
432+#ifdef __STDC__
433+float
434+__ieee754_sqrtf (float b)
435+#else
436+float
437+__ieee754_sqrtf (b)
438+ float b;
439+#endif
440+{
441+ if (__builtin_expect (b > 0, 1))
442+ {
443+#define FMSUB(a_, c_, b_) \
444+ ({ double __r; \
445+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
446+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
447+ __r;})
448+#define FNMSUB(a_, c_, b_) \
449+ ({ double __r; \
450+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
451+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
452+ __r;})
453+
454+ if (__builtin_expect (b != a_inf.value, 1))
455+ {
456+ double y, x;
457+ fenv_t fe;
458+
459+ fe = fegetenv_register ();
460+
461+ relax_fenv_state ();
462+
463+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
464+ y = FMSUB (threehalf, b, b);
465+
466+ /* Initial estimate. */
467+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
468+
469+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
470+ x = x * FNMSUB (y, x * x, threehalf);
471+ x = x * FNMSUB (y, x * x, threehalf);
472+ x = x * FNMSUB (y, x * x, threehalf);
473+
474+ /* All done. */
475+ fesetenv_register (fe);
476+ return x * b;
477+ }
478+ }
479+ else if (b < 0)
480+ {
481+ /* For some reason, some PowerPC32 processors don't implement
482+ FE_INVALID_SQRT. */
483+#ifdef FE_INVALID_SQRT
484+ feraiseexcept (FE_INVALID_SQRT);
485+
486+ fenv_union_t u = { .fenv = fegetenv_register () };
487+ if ((u.l & FE_INVALID) == 0)
488+#endif
489+ feraiseexcept (FE_INVALID);
490+ b = a_nan.value;
491+ }
492+ return f_washf (b);
493+}
494Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
495===================================================================
496--- /dev/null 1970-01-01 00:00:00.000000000 +0000
497+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
498@@ -0,0 +1,134 @@
499+/* Double-precision floating point square root.
500+ Copyright (C) 2010 Free Software Foundation, Inc.
501+ This file is part of the GNU C Library.
502+
503+ The GNU C Library is free software; you can redistribute it and/or
504+ modify it under the terms of the GNU Lesser General Public
505+ License as published by the Free Software Foundation; either
506+ version 2.1 of the License, or (at your option) any later version.
507+
508+ The GNU C Library is distributed in the hope that it will be useful,
509+ but WITHOUT ANY WARRANTY; without even the implied warranty of
510+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
511+ Lesser General Public License for more details.
512+
513+ You should have received a copy of the GNU Lesser General Public
514+ License along with the GNU C Library; if not, write to the Free
515+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
516+ 02111-1307 USA. */
517+
518+#include <math.h>
519+#include <math_private.h>
520+#include <fenv_libc.h>
521+#include <inttypes.h>
522+
523+#include <sysdep.h>
524+#include <ldsodefs.h>
525+
526+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
527+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
528+static const float two108 = 3.245185536584267269e+32;
529+static const float twom54 = 5.551115123125782702e-17;
530+static const float half = 0.5;
531+
532+/* The method is based on the descriptions in:
533+
534+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
535+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
536+
537+ We find the actual square root and half of its reciprocal
538+ simultaneously. */
539+
540+#ifdef __STDC__
541+double
542+__ieee754_sqrt (double b)
543+#else
544+double
545+__ieee754_sqrt (b)
546+ double b;
547+#endif
548+{
549+ if (__builtin_expect (b > 0, 1))
550+ {
551+ double y, g, h, d, r;
552+ ieee_double_shape_type u;
553+
554+ if (__builtin_expect (b != a_inf.value, 1))
555+ {
556+ fenv_t fe;
557+
558+ fe = fegetenv_register ();
559+
560+ u.value = b;
561+
562+ relax_fenv_state ();
563+
564+ __asm__ ("frsqrte %[estimate], %[x]\n"
565+ : [estimate] "=f" (y) : [x] "f" (b));
566+
567+ /* Following Muller et al, page 168, equation 5.20.
568+
569+ h goes to 1/(2*sqrt(b))
570+ g goes to sqrt(b).
571+
572+ We need three iterations to get within 1ulp. */
573+
574+ /* Indicate that these can be performed prior to the branch. GCC
575+ insists on sinking them below the branch, however; it seems like
576+ they'd be better before the branch so that we can cover any latency
577+ from storing the argument and loading its high word. Oh well. */
578+
579+ g = b * y;
580+ h = 0.5 * y;
581+
582+ /* Handle small numbers by scaling. */
583+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
584+ return __ieee754_sqrt (b * two108) * twom54;
585+
586+#define FMADD(a_, c_, b_) \
587+ ({ double __r; \
588+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
589+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
590+ __r;})
591+#define FNMSUB(a_, c_, b_) \
592+ ({ double __r; \
593+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
594+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
595+ __r;})
596+
597+ r = FNMSUB (g, h, half);
598+ g = FMADD (g, r, g);
599+ h = FMADD (h, r, h);
600+
601+ r = FNMSUB (g, h, half);
602+ g = FMADD (g, r, g);
603+ h = FMADD (h, r, h);
604+
605+ r = FNMSUB (g, h, half);
606+ g = FMADD (g, r, g);
607+ h = FMADD (h, r, h);
608+
609+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
610+
611+ /* Final refinement. */
612+ d = FNMSUB (g, g, b);
613+
614+ fesetenv_register (fe);
615+ return FMADD (d, h, g);
616+ }
617+ }
618+ else if (b < 0)
619+ {
620+ /* For some reason, some PowerPC32 processors don't implement
621+ FE_INVALID_SQRT. */
622+#ifdef FE_INVALID_SQRT
623+ feraiseexcept (FE_INVALID_SQRT);
624+
625+ fenv_union_t u = { .fenv = fegetenv_register () };
626+ if ((u.l & FE_INVALID) == 0)
627+#endif
628+ feraiseexcept (FE_INVALID);
629+ b = a_nan.value;
630+ }
631+ return f_wash (b);
632+}
633Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
634===================================================================
635--- /dev/null 1970-01-01 00:00:00.000000000 +0000
636+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
637@@ -0,0 +1,101 @@
638+/* Single-precision floating point square root.
639+ Copyright (C) 2010 Free Software Foundation, Inc.
640+ This file is part of the GNU C Library.
641+
642+ The GNU C Library is free software; you can redistribute it and/or
643+ modify it under the terms of the GNU Lesser General Public
644+ License as published by the Free Software Foundation; either
645+ version 2.1 of the License, or (at your option) any later version.
646+
647+ The GNU C Library is distributed in the hope that it will be useful,
648+ but WITHOUT ANY WARRANTY; without even the implied warranty of
649+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
650+ Lesser General Public License for more details.
651+
652+ You should have received a copy of the GNU Lesser General Public
653+ License along with the GNU C Library; if not, write to the Free
654+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
655+ 02111-1307 USA. */
656+
657+#include <math.h>
658+#include <math_private.h>
659+#include <fenv_libc.h>
660+#include <inttypes.h>
661+
662+#include <sysdep.h>
663+#include <ldsodefs.h>
664+
665+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
666+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
667+static const float threehalf = 1.5;
668+
669+/* The method is based on the descriptions in:
670+
671+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
672+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
673+
674+ We find the reciprocal square root and use that to compute the actual
675+ square root. */
676+
677+#ifdef __STDC__
678+float
679+__ieee754_sqrtf (float b)
680+#else
681+float
682+__ieee754_sqrtf (b)
683+ float b;
684+#endif
685+{
686+ if (__builtin_expect (b > 0, 1))
687+ {
688+#define FMSUB(a_, c_, b_) \
689+ ({ double __r; \
690+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
691+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
692+ __r;})
693+#define FNMSUB(a_, c_, b_) \
694+ ({ double __r; \
695+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
696+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
697+ __r;})
698+
699+ if (__builtin_expect (b != a_inf.value, 1))
700+ {
701+ double y, x;
702+ fenv_t fe;
703+
704+ fe = fegetenv_register ();
705+
706+ relax_fenv_state ();
707+
708+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
709+ y = FMSUB (threehalf, b, b);
710+
711+ /* Initial estimate. */
712+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
713+
714+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
715+ x = x * FNMSUB (y, x * x, threehalf);
716+ x = x * FNMSUB (y, x * x, threehalf);
717+ x = x * FNMSUB (y, x * x, threehalf);
718+
719+ /* All done. */
720+ fesetenv_register (fe);
721+ return x * b;
722+ }
723+ }
724+ else if (b < 0)
725+ {
726+ /* For some reason, some PowerPC32 processors don't implement
727+ FE_INVALID_SQRT. */
728+#ifdef FE_INVALID_SQRT
729+ feraiseexcept (FE_INVALID_SQRT);
730+
731+ fenv_union_t u = { .fenv = fegetenv_register () };
732+ if ((u.l & FE_INVALID) == 0)
733+#endif
734+ feraiseexcept (FE_INVALID);
735+ b = a_nan.value;
736+ }
737+ return f_washf (b);
738+}
739Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
740===================================================================
741--- /dev/null 1970-01-01 00:00:00.000000000 +0000
742+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
743@@ -0,0 +1,134 @@
744+/* Double-precision floating point square root.
745+ Copyright (C) 2010 Free Software Foundation, Inc.
746+ This file is part of the GNU C Library.
747+
748+ The GNU C Library is free software; you can redistribute it and/or
749+ modify it under the terms of the GNU Lesser General Public
750+ License as published by the Free Software Foundation; either
751+ version 2.1 of the License, or (at your option) any later version.
752+
753+ The GNU C Library is distributed in the hope that it will be useful,
754+ but WITHOUT ANY WARRANTY; without even the implied warranty of
755+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
756+ Lesser General Public License for more details.
757+
758+ You should have received a copy of the GNU Lesser General Public
759+ License along with the GNU C Library; if not, write to the Free
760+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
761+ 02111-1307 USA. */
762+
763+#include <math.h>
764+#include <math_private.h>
765+#include <fenv_libc.h>
766+#include <inttypes.h>
767+
768+#include <sysdep.h>
769+#include <ldsodefs.h>
770+
771+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
772+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
773+static const float two108 = 3.245185536584267269e+32;
774+static const float twom54 = 5.551115123125782702e-17;
775+static const float half = 0.5;
776+
777+/* The method is based on the descriptions in:
778+
779+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
780+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
781+
782+ We find the actual square root and half of its reciprocal
783+ simultaneously. */
784+
785+#ifdef __STDC__
786+double
787+__ieee754_sqrt (double b)
788+#else
789+double
790+__ieee754_sqrt (b)
791+ double b;
792+#endif
793+{
794+ if (__builtin_expect (b > 0, 1))
795+ {
796+ double y, g, h, d, r;
797+ ieee_double_shape_type u;
798+
799+ if (__builtin_expect (b != a_inf.value, 1))
800+ {
801+ fenv_t fe;
802+
803+ fe = fegetenv_register ();
804+
805+ u.value = b;
806+
807+ relax_fenv_state ();
808+
809+ __asm__ ("frsqrte %[estimate], %[x]\n"
810+ : [estimate] "=f" (y) : [x] "f" (b));
811+
812+ /* Following Muller et al, page 168, equation 5.20.
813+
814+ h goes to 1/(2*sqrt(b))
815+ g goes to sqrt(b).
816+
817+ We need three iterations to get within 1ulp. */
818+
819+ /* Indicate that these can be performed prior to the branch. GCC
820+ insists on sinking them below the branch, however; it seems like
821+ they'd be better before the branch so that we can cover any latency
822+ from storing the argument and loading its high word. Oh well. */
823+
824+ g = b * y;
825+ h = 0.5 * y;
826+
827+ /* Handle small numbers by scaling. */
828+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
829+ return __ieee754_sqrt (b * two108) * twom54;
830+
831+#define FMADD(a_, c_, b_) \
832+ ({ double __r; \
833+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
834+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
835+ __r;})
836+#define FNMSUB(a_, c_, b_) \
837+ ({ double __r; \
838+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
839+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
840+ __r;})
841+
842+ r = FNMSUB (g, h, half);
843+ g = FMADD (g, r, g);
844+ h = FMADD (h, r, h);
845+
846+ r = FNMSUB (g, h, half);
847+ g = FMADD (g, r, g);
848+ h = FMADD (h, r, h);
849+
850+ r = FNMSUB (g, h, half);
851+ g = FMADD (g, r, g);
852+ h = FMADD (h, r, h);
853+
854+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
855+
856+ /* Final refinement. */
857+ d = FNMSUB (g, g, b);
858+
859+ fesetenv_register (fe);
860+ return FMADD (d, h, g);
861+ }
862+ }
863+ else if (b < 0)
864+ {
865+ /* For some reason, some PowerPC32 processors don't implement
866+ FE_INVALID_SQRT. */
867+#ifdef FE_INVALID_SQRT
868+ feraiseexcept (FE_INVALID_SQRT);
869+
870+ fenv_union_t u = { .fenv = fegetenv_register () };
871+ if ((u.l & FE_INVALID) == 0)
872+#endif
873+ feraiseexcept (FE_INVALID);
874+ b = a_nan.value;
875+ }
876+ return f_wash (b);
877+}
878Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
879===================================================================
880--- /dev/null 1970-01-01 00:00:00.000000000 +0000
881+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
882@@ -0,0 +1,101 @@
883+/* Single-precision floating point square root.
884+ Copyright (C) 2010 Free Software Foundation, Inc.
885+ This file is part of the GNU C Library.
886+
887+ The GNU C Library is free software; you can redistribute it and/or
888+ modify it under the terms of the GNU Lesser General Public
889+ License as published by the Free Software Foundation; either
890+ version 2.1 of the License, or (at your option) any later version.
891+
892+ The GNU C Library is distributed in the hope that it will be useful,
893+ but WITHOUT ANY WARRANTY; without even the implied warranty of
894+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
895+ Lesser General Public License for more details.
896+
897+ You should have received a copy of the GNU Lesser General Public
898+ License along with the GNU C Library; if not, write to the Free
899+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
900+ 02111-1307 USA. */
901+
902+#include <math.h>
903+#include <math_private.h>
904+#include <fenv_libc.h>
905+#include <inttypes.h>
906+
907+#include <sysdep.h>
908+#include <ldsodefs.h>
909+
910+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
911+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
912+static const float threehalf = 1.5;
913+
914+/* The method is based on the descriptions in:
915+
916+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
917+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
918+
919+ We find the reciprocal square root and use that to compute the actual
920+ square root. */
921+
922+#ifdef __STDC__
923+float
924+__ieee754_sqrtf (float b)
925+#else
926+float
927+__ieee754_sqrtf (b)
928+ float b;
929+#endif
930+{
931+ if (__builtin_expect (b > 0, 1))
932+ {
933+#define FMSUB(a_, c_, b_) \
934+ ({ double __r; \
935+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
936+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
937+ __r;})
938+#define FNMSUB(a_, c_, b_) \
939+ ({ double __r; \
940+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
941+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
942+ __r;})
943+
944+ if (__builtin_expect (b != a_inf.value, 1))
945+ {
946+ double y, x;
947+ fenv_t fe;
948+
949+ fe = fegetenv_register ();
950+
951+ relax_fenv_state ();
952+
953+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
954+ y = FMSUB (threehalf, b, b);
955+
956+ /* Initial estimate. */
957+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
958+
959+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
960+ x = x * FNMSUB (y, x * x, threehalf);
961+ x = x * FNMSUB (y, x * x, threehalf);
962+ x = x * FNMSUB (y, x * x, threehalf);
963+
964+ /* All done. */
965+ fesetenv_register (fe);
966+ return x * b;
967+ }
968+ }
969+ else if (b < 0)
970+ {
971+ /* For some reason, some PowerPC32 processors don't implement
972+ FE_INVALID_SQRT. */
973+#ifdef FE_INVALID_SQRT
974+ feraiseexcept (FE_INVALID_SQRT);
975+
976+ fenv_union_t u = { .fenv = fegetenv_register () };
977+ if ((u.l & FE_INVALID) == 0)
978+#endif
979+ feraiseexcept (FE_INVALID);
980+ b = a_nan.value;
981+ }
982+ return f_washf (b);
983+}
984Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
985===================================================================
986--- /dev/null 1970-01-01 00:00:00.000000000 +0000
987+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
988@@ -0,0 +1,134 @@
989+/* Double-precision floating point square root.
990+ Copyright (C) 2010 Free Software Foundation, Inc.
991+ This file is part of the GNU C Library.
992+
993+ The GNU C Library is free software; you can redistribute it and/or
994+ modify it under the terms of the GNU Lesser General Public
995+ License as published by the Free Software Foundation; either
996+ version 2.1 of the License, or (at your option) any later version.
997+
998+ The GNU C Library is distributed in the hope that it will be useful,
999+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1000+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1001+ Lesser General Public License for more details.
1002+
1003+ You should have received a copy of the GNU Lesser General Public
1004+ License along with the GNU C Library; if not, write to the Free
1005+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1006+ 02111-1307 USA. */
1007+
1008+#include <math.h>
1009+#include <math_private.h>
1010+#include <fenv_libc.h>
1011+#include <inttypes.h>
1012+
1013+#include <sysdep.h>
1014+#include <ldsodefs.h>
1015+
1016+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1017+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1018+static const float two108 = 3.245185536584267269e+32;
1019+static const float twom54 = 5.551115123125782702e-17;
1020+static const float half = 0.5;
1021+
1022+/* The method is based on the descriptions in:
1023+
1024+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1025+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1026+
1027+ We find the actual square root and half of its reciprocal
1028+ simultaneously. */
1029+
1030+#ifdef __STDC__
1031+double
1032+__ieee754_sqrt (double b)
1033+#else
1034+double
1035+__ieee754_sqrt (b)
1036+ double b;
1037+#endif
1038+{
1039+ if (__builtin_expect (b > 0, 1))
1040+ {
1041+ double y, g, h, d, r;
1042+ ieee_double_shape_type u;
1043+
1044+ if (__builtin_expect (b != a_inf.value, 1))
1045+ {
1046+ fenv_t fe;
1047+
1048+ fe = fegetenv_register ();
1049+
1050+ u.value = b;
1051+
1052+ relax_fenv_state ();
1053+
1054+ __asm__ ("frsqrte %[estimate], %[x]\n"
1055+ : [estimate] "=f" (y) : [x] "f" (b));
1056+
1057+ /* Following Muller et al, page 168, equation 5.20.
1058+
1059+ h goes to 1/(2*sqrt(b))
1060+ g goes to sqrt(b).
1061+
1062+ We need three iterations to get within 1ulp. */
1063+
1064+ /* Indicate that these can be performed prior to the branch. GCC
1065+ insists on sinking them below the branch, however; it seems like
1066+ they'd be better before the branch so that we can cover any latency
1067+ from storing the argument and loading its high word. Oh well. */
1068+
1069+ g = b * y;
1070+ h = 0.5 * y;
1071+
1072+ /* Handle small numbers by scaling. */
1073+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
1074+ return __ieee754_sqrt (b * two108) * twom54;
1075+
1076+#define FMADD(a_, c_, b_) \
1077+ ({ double __r; \
1078+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
1079+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1080+ __r;})
1081+#define FNMSUB(a_, c_, b_) \
1082+ ({ double __r; \
1083+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1084+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1085+ __r;})
1086+
1087+ r = FNMSUB (g, h, half);
1088+ g = FMADD (g, r, g);
1089+ h = FMADD (h, r, h);
1090+
1091+ r = FNMSUB (g, h, half);
1092+ g = FMADD (g, r, g);
1093+ h = FMADD (h, r, h);
1094+
1095+ r = FNMSUB (g, h, half);
1096+ g = FMADD (g, r, g);
1097+ h = FMADD (h, r, h);
1098+
1099+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
1100+
1101+ /* Final refinement. */
1102+ d = FNMSUB (g, g, b);
1103+
1104+ fesetenv_register (fe);
1105+ return FMADD (d, h, g);
1106+ }
1107+ }
1108+ else if (b < 0)
1109+ {
1110+ /* For some reason, some PowerPC32 processors don't implement
1111+ FE_INVALID_SQRT. */
1112+#ifdef FE_INVALID_SQRT
1113+ feraiseexcept (FE_INVALID_SQRT);
1114+
1115+ fenv_union_t u = { .fenv = fegetenv_register () };
1116+ if ((u.l & FE_INVALID) == 0)
1117+#endif
1118+ feraiseexcept (FE_INVALID);
1119+ b = a_nan.value;
1120+ }
1121+ return f_wash (b);
1122+}
1123Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
1124===================================================================
1125--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1126+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:34:07.772070587 -0700
1127@@ -0,0 +1,101 @@
1128+/* Single-precision floating point square root.
1129+ Copyright (C) 2010 Free Software Foundation, Inc.
1130+ This file is part of the GNU C Library.
1131+
1132+ The GNU C Library is free software; you can redistribute it and/or
1133+ modify it under the terms of the GNU Lesser General Public
1134+ License as published by the Free Software Foundation; either
1135+ version 2.1 of the License, or (at your option) any later version.
1136+
1137+ The GNU C Library is distributed in the hope that it will be useful,
1138+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1139+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1140+ Lesser General Public License for more details.
1141+
1142+ You should have received a copy of the GNU Lesser General Public
1143+ License along with the GNU C Library; if not, write to the Free
1144+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1145+ 02111-1307 USA. */
1146+
1147+#include <math.h>
1148+#include <math_private.h>
1149+#include <fenv_libc.h>
1150+#include <inttypes.h>
1151+
1152+#include <sysdep.h>
1153+#include <ldsodefs.h>
1154+
1155+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1156+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1157+static const float threehalf = 1.5;
1158+
1159+/* The method is based on the descriptions in:
1160+
1161+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1162+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1163+
1164+ We find the reciprocal square root and use that to compute the actual
1165+ square root. */
1166+
1167+#ifdef __STDC__
1168+float
1169+__ieee754_sqrtf (float b)
1170+#else
1171+float
1172+__ieee754_sqrtf (b)
1173+ float b;
1174+#endif
1175+{
1176+ if (__builtin_expect (b > 0, 1))
1177+ {
1178+#define FMSUB(a_, c_, b_) \
1179+ ({ double __r; \
1180+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
1181+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1182+ __r;})
1183+#define FNMSUB(a_, c_, b_) \
1184+ ({ double __r; \
1185+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1186+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1187+ __r;})
1188+
1189+ if (__builtin_expect (b != a_inf.value, 1))
1190+ {
1191+ double y, x;
1192+ fenv_t fe;
1193+
1194+ fe = fegetenv_register ();
1195+
1196+ relax_fenv_state ();
1197+
1198+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
1199+ y = FMSUB (threehalf, b, b);
1200+
1201+ /* Initial estimate. */
1202+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
1203+
1204+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
1205+ x = x * FNMSUB (y, x * x, threehalf);
1206+ x = x * FNMSUB (y, x * x, threehalf);
1207+ x = x * FNMSUB (y, x * x, threehalf);
1208+
1209+ /* All done. */
1210+ fesetenv_register (fe);
1211+ return x * b;
1212+ }
1213+ }
1214+ else if (b < 0)
1215+ {
1216+ /* For some reason, some PowerPC32 processors don't implement
1217+ FE_INVALID_SQRT. */
1218+#ifdef FE_INVALID_SQRT
1219+ feraiseexcept (FE_INVALID_SQRT);
1220+
1221+ fenv_union_t u = { .fenv = fegetenv_register () };
1222+ if ((u.l & FE_INVALID) == 0)
1223+#endif
1224+ feraiseexcept (FE_INVALID);
1225+ b = a_nan.value;
1226+ }
1227+ return f_washf (b);
1228+}
1229Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
1230===================================================================
1231--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1232+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:34:07.772070587 -0700
1233@@ -0,0 +1,134 @@
1234+/* Double-precision floating point square root.
1235+ Copyright (C) 2010 Free Software Foundation, Inc.
1236+ This file is part of the GNU C Library.
1237+
1238+ The GNU C Library is free software; you can redistribute it and/or
1239+ modify it under the terms of the GNU Lesser General Public
1240+ License as published by the Free Software Foundation; either
1241+ version 2.1 of the License, or (at your option) any later version.
1242+
1243+ The GNU C Library is distributed in the hope that it will be useful,
1244+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1245+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1246+ Lesser General Public License for more details.
1247+
1248+ You should have received a copy of the GNU Lesser General Public
1249+ License along with the GNU C Library; if not, write to the Free
1250+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1251+ 02111-1307 USA. */
1252+
1253+#include <math.h>
1254+#include <math_private.h>
1255+#include <fenv_libc.h>
1256+#include <inttypes.h>
1257+
1258+#include <sysdep.h>
1259+#include <ldsodefs.h>
1260+
1261+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1262+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1263+static const float two108 = 3.245185536584267269e+32;
1264+static const float twom54 = 5.551115123125782702e-17;
1265+static const float half = 0.5;
1266+
1267+/* The method is based on the descriptions in:
1268+
1269+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1270+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1271+
1272+ We find the actual square root and half of its reciprocal
1273+ simultaneously. */
1274+
1275+#ifdef __STDC__
1276+double
1277+__ieee754_sqrt (double b)
1278+#else
1279+double
1280+__ieee754_sqrt (b)
1281+ double b;
1282+#endif
1283+{
1284+ if (__builtin_expect (b > 0, 1))
1285+ {
1286+ double y, g, h, d, r;
1287+ ieee_double_shape_type u;
1288+
1289+ if (__builtin_expect (b != a_inf.value, 1))
1290+ {
1291+ fenv_t fe;
1292+
1293+ fe = fegetenv_register ();
1294+
1295+ u.value = b;
1296+
1297+ relax_fenv_state ();
1298+
1299+ __asm__ ("frsqrte %[estimate], %[x]\n"
1300+ : [estimate] "=f" (y) : [x] "f" (b));
1301+
1302+ /* Following Muller et al, page 168, equation 5.20.
1303+
1304+ h goes to 1/(2*sqrt(b))
1305+ g goes to sqrt(b).
1306+
1307+ We need three iterations to get within 1ulp. */
1308+
1309+ /* Indicate that these can be performed prior to the branch. GCC
1310+ insists on sinking them below the branch, however; it seems like
1311+ they'd be better before the branch so that we can cover any latency
1312+ from storing the argument and loading its high word. Oh well. */
1313+
1314+ g = b * y;
1315+ h = 0.5 * y;
1316+
1317+ /* Handle small numbers by scaling. */
1318+ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
1319+ return __ieee754_sqrt (b * two108) * twom54;
1320+
1321+#define FMADD(a_, c_, b_) \
1322+ ({ double __r; \
1323+ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \
1324+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1325+ __r;})
1326+#define FNMSUB(a_, c_, b_) \
1327+ ({ double __r; \
1328+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1329+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1330+ __r;})
1331+
1332+ r = FNMSUB (g, h, half);
1333+ g = FMADD (g, r, g);
1334+ h = FMADD (h, r, h);
1335+
1336+ r = FNMSUB (g, h, half);
1337+ g = FMADD (g, r, g);
1338+ h = FMADD (h, r, h);
1339+
1340+ r = FNMSUB (g, h, half);
1341+ g = FMADD (g, r, g);
1342+ h = FMADD (h, r, h);
1343+
1344+ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */
1345+
1346+ /* Final refinement. */
1347+ d = FNMSUB (g, g, b);
1348+
1349+ fesetenv_register (fe);
1350+ return FMADD (d, h, g);
1351+ }
1352+ }
1353+ else if (b < 0)
1354+ {
1355+ /* For some reason, some PowerPC32 processors don't implement
1356+ FE_INVALID_SQRT. */
1357+#ifdef FE_INVALID_SQRT
1358+ feraiseexcept (FE_INVALID_SQRT);
1359+
1360+ fenv_union_t u = { .fenv = fegetenv_register () };
1361+ if ((u.l & FE_INVALID) == 0)
1362+#endif
1363+ feraiseexcept (FE_INVALID);
1364+ b = a_nan.value;
1365+ }
1366+ return f_wash (b);
1367+}
1368Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
1369===================================================================
1370--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1371+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:34:07.776070587 -0700
1372@@ -0,0 +1,101 @@
1373+/* Single-precision floating point square root.
1374+ Copyright (C) 2010 Free Software Foundation, Inc.
1375+ This file is part of the GNU C Library.
1376+
1377+ The GNU C Library is free software; you can redistribute it and/or
1378+ modify it under the terms of the GNU Lesser General Public
1379+ License as published by the Free Software Foundation; either
1380+ version 2.1 of the License, or (at your option) any later version.
1381+
1382+ The GNU C Library is distributed in the hope that it will be useful,
1383+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1384+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1385+ Lesser General Public License for more details.
1386+
1387+ You should have received a copy of the GNU Lesser General Public
1388+ License along with the GNU C Library; if not, write to the Free
1389+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1390+ 02111-1307 USA. */
1391+
1392+#include <math.h>
1393+#include <math_private.h>
1394+#include <fenv_libc.h>
1395+#include <inttypes.h>
1396+
1397+#include <sysdep.h>
1398+#include <ldsodefs.h>
1399+
1400+static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 };
1401+static const ieee_float_shape_type a_inf = {.word = 0x7f800000 };
1402+static const float threehalf = 1.5;
1403+
1404+/* The method is based on the descriptions in:
1405+
1406+ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5;
1407+ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9
1408+
1409+ We find the reciprocal square root and use that to compute the actual
1410+ square root. */
1411+
1412+#ifdef __STDC__
1413+float
1414+__ieee754_sqrtf (float b)
1415+#else
1416+float
1417+__ieee754_sqrtf (b)
1418+ float b;
1419+#endif
1420+{
1421+ if (__builtin_expect (b > 0, 1))
1422+ {
1423+#define FMSUB(a_, c_, b_) \
1424+ ({ double __r; \
1425+ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \
1426+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1427+ __r;})
1428+#define FNMSUB(a_, c_, b_) \
1429+ ({ double __r; \
1430+ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \
1431+ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \
1432+ __r;})
1433+
1434+ if (__builtin_expect (b != a_inf.value, 1))
1435+ {
1436+ double y, x;
1437+ fenv_t fe;
1438+
1439+ fe = fegetenv_register ();
1440+
1441+ relax_fenv_state ();
1442+
1443+ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */
1444+ y = FMSUB (threehalf, b, b);
1445+
1446+ /* Initial estimate. */
1447+ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b));
1448+
1449+ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */
1450+ x = x * FNMSUB (y, x * x, threehalf);
1451+ x = x * FNMSUB (y, x * x, threehalf);
1452+ x = x * FNMSUB (y, x * x, threehalf);
1453+
1454+ /* All done. */
1455+ fesetenv_register (fe);
1456+ return x * b;
1457+ }
1458+ }
1459+ else if (b < 0)
1460+ {
1461+ /* For some reason, some PowerPC32 processors don't implement
1462+ FE_INVALID_SQRT. */
1463+#ifdef FE_INVALID_SQRT
1464+ feraiseexcept (FE_INVALID_SQRT);
1465+
1466+ fenv_union_t u = { .fenv = fegetenv_register () };
1467+ if ((u.l & FE_INVALID) == 0)
1468+#endif
1469+ feraiseexcept (FE_INVALID);
1470+ b = a_nan.value;
1471+ }
1472+ return f_washf (b);
1473+}
1474Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies
1475===================================================================
1476--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1477+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1478@@ -0,0 +1 @@
1479+powerpc/powerpc32/603e/fpu
1480Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies
1481===================================================================
1482--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1483+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1484@@ -0,0 +1,2 @@
1485+# e300c3 is a variant of 603e so use the same optimizations for sqrt
1486+powerpc/powerpc32/603e/fpu
1487Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies
1488===================================================================
1489--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1490+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1491@@ -0,0 +1 @@
1492+powerpc/powerpc32/e500mc/fpu
1493Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies
1494===================================================================
1495--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1496+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1497@@ -0,0 +1 @@
1498+powerpc/powerpc32/e5500/fpu
1499Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies
1500===================================================================
1501--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1502+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies 2014-08-29 10:34:07.776070587 -0700
1503@@ -0,0 +1 @@
1504+powerpc/powerpc32/e6500/fpu
1505Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies
1506===================================================================
1507--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1508+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
1509@@ -0,0 +1 @@
1510+powerpc/powerpc64/e5500/fpu
1511Index: git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies
1512===================================================================
1513--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1514+++ git/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies 2014-08-29 10:34:07.780070587 -0700
1515@@ -0,0 +1 @@
1516+powerpc/powerpc64/e6500/fpu
diff --git a/meta/recipes-core/glibc/glibc/grok_gold.patch b/meta/recipes-core/glibc/glibc/grok_gold.patch
new file mode 100644
index 0000000000..26875c79d4
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/grok_gold.patch
@@ -0,0 +1,34 @@
1Make ld --version output matching grok gold's output
2
3adapted from from upstream branch roland/gold-vs-libc
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Upstream-Status: Backport
7
8
9Index: git/configure
10===================================================================
11--- git.orig/configure 2014-08-29 10:32:34.464070587 -0700
12+++ git/configure 2014-08-29 10:32:34.456070587 -0700
13@@ -4592,7 +4592,7 @@
14 # Found it, now check the version.
15 { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5
16 $as_echo_n "checking version of $LD... " >&6; }
17- ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
18+ ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
19 case $ac_prog_version in
20 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
21 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)
22Index: git/configure.ac
23===================================================================
24--- git.orig/configure.ac 2014-08-29 10:32:34.464070587 -0700
25+++ git/configure.ac 2014-08-29 10:32:34.460070587 -0700
26@@ -930,7 +930,7 @@
27 [GNU assembler.* \([0-9]*\.[0-9.]*\)],
28 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
29 AC_CHECK_PROG_VER(LD, $LD, --version,
30- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
31+ [GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\)],
32 [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
33
34 # These programs are version sensitive.
diff --git a/meta/recipes-core/glibc/glibc/initgroups_keys.patch b/meta/recipes-core/glibc/glibc/initgroups_keys.patch
new file mode 100644
index 0000000000..32aa15a533
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/initgroups_keys.patch
@@ -0,0 +1,20 @@
1This is needed since initgroups belongs to NET group
2so when NET is disabled in eglibc build then it reports
3as undefined symbol
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Upstream-Status: Pending
7
8Index: git/nss/getent.c
9===================================================================
10--- git.orig/nss/getent.c 2014-08-27 05:15:25.996070587 +0000
11+++ git/nss/getent.c 2014-08-27 05:16:00.048070587 +0000
12@@ -879,7 +879,7 @@
13 D(group)
14 D(gshadow)
15 D(hosts)
16-D(initgroups)
17+DN(initgroups)
18 D(netgroup)
19 D(networks)
20 D(passwd)
diff --git a/meta/recipes-core/glibc/glibc/ld-search-order.patch b/meta/recipes-core/glibc/glibc/ld-search-order.patch
new file mode 100644
index 0000000000..f518bc7642
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/ld-search-order.patch
@@ -0,0 +1,56 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3The default lib search path order is:
4
5 1) LD_LIBRARY_PATH
6 2) RPATH from the binary
7 3) ld.so.cache
8 4) default search paths embedded in the linker
9
10For nativesdk binaries which are being used alongside binaries on a host system, we
11need the search paths to firstly search the shipped nativesdk libs but then also
12cover the host system. For example we want the host system's libGL and this may be
13in a non-standard location like /usr/lib/mesa. The only place the location is know
14about is in the ld.so.cache of the host system.
15
16Since nativesdk has a simple structure and doesn't need to use a cache itself, we
17repurpose the cache for use as a last resort in finding host system binaries. This
18means we need to switch the order of 3 and 4 above to make this work effectively.
19
20RP 14/10/2010
21
22Index: git/elf/dl-load.c
23===================================================================
24--- git.orig/elf/dl-load.c 2014-08-28 17:32:46.292070587 -0700
25+++ git/elf/dl-load.c 2014-08-28 17:33:56.048070587 -0700
26@@ -2050,7 +2050,14 @@
27 fd = open_path (name, namelen, mode,
28 &loader->l_runpath_dirs, &realname, &fb, loader,
29 LA_SER_RUNPATH, &found_other_class);
30-
31+ /* try the default path. */
32+ if (fd == -1
33+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
34+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
35+ && rtld_search_dirs.dirs != (void *) -1)
36+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
37+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
38+ /* Finally try ld.so.cache */
39 #ifdef USE_LDCONFIG
40 if (fd == -1
41 && (__glibc_likely ((mode & __RTLD_SECURE) == 0)
42@@ -2113,14 +2120,6 @@
43 }
44 #endif
45
46- /* Finally, try the default path. */
47- if (fd == -1
48- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
49- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
50- && rtld_search_dirs.dirs != (void *) -1)
51- fd = open_path (name, namelen, mode, &rtld_search_dirs,
52- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
53-
54 /* Add another newline when we are tracing the library loading. */
55 if (__glibc_unlikely (GLRO_dl_debug_mask & DL_DEBUG_LIBS))
56 _dl_debug_printf ("\n");
diff --git a/meta/recipes-core/glibc/glibc/mips-rld-map-check.patch b/meta/recipes-core/glibc/glibc/mips-rld-map-check.patch
new file mode 100644
index 0000000000..9f593d6359
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/mips-rld-map-check.patch
@@ -0,0 +1,27 @@
1
2On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic
3section if a --version-script sets _RLD_MAP to local. This is apparently
4a binutils bug, but libc shouldn't segfault in this case.
5
6see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615
7
8Upstream-Status: Pending
9
109/19/2010 - added by Qing He <qing.he@intel.com>
11
12
13---
14Index: git/sysdeps/mips/dl-machine.h
15===================================================================
16--- git.orig/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.840070587 +0000
17+++ git/sysdeps/mips/dl-machine.h 2014-08-27 04:58:11.832070587 +0000
18@@ -70,7 +70,8 @@
19 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
20 with the run-time address of the r_debug structure */
21 #define ELF_MACHINE_DEBUG_SETUP(l,r) \
22-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
23+do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \
24+ (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \
25 *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
26 (ElfW(Addr)) (r); \
27 } while (0)
diff --git a/meta/recipes-core/glibc/glibc/multilib_readlib.patch b/meta/recipes-core/glibc/glibc/multilib_readlib.patch
new file mode 100644
index 0000000000..13ffc46f91
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/multilib_readlib.patch
@@ -0,0 +1,19 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Replace the OECORE_KNOWN_INTERPRETER_NAMES with the value of
4variable EGLIBC_KNOWN_INTERPRETER_NAMES.
5
6Lianhao Lu, 08/01/2011
7
8Index: git/elf/readlib.c
9===================================================================
10--- git.orig/elf/readlib.c 2014-08-29 10:34:16.824070587 -0700
11+++ git/elf/readlib.c 2014-08-29 10:34:16.816070587 -0700
12@@ -51,6 +51,7 @@
13 #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
14 SYSDEP_KNOWN_INTERPRETER_NAMES
15 #endif
16+ OECORE_KNOWN_INTERPRETER_NAMES
17 };
18
19 static struct known_names known_libs[] =
diff --git a/meta/recipes-core/glibc/glibc/option-groups.patch b/meta/recipes-core/glibc/glibc/option-groups.patch
new file mode 100644
index 0000000000..198be73524
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/option-groups.patch
@@ -0,0 +1,1397 @@
1Eglibc option group infrastructure
2
3Upstream-Status: Pending
4
5Index: git/option-groups.def
6===================================================================
7--- /dev/null 1970-01-01 00:00:00.000000000 +0000
8+++ git/option-groups.def 2014-08-27 07:26:51.652070587 +0000
9@@ -0,0 +1,868 @@
10+# This file documents the option groups EGLIBC currently supports, in
11+# a format akin to the Linux Kconfig system's. The syntax may change
12+# over time.
13+#
14+# An entry of the form:
15+#
16+# config GROUP_NAME
17+# bool "one-line explanation of what this option group controls"
18+# help
19+# Multi-line help explaining the option group's meaning in
20+# some detail, terminated by indentation level.
21+#
22+# defines an option group whose variable is GROUP_NAME, with
23+# meaningful values 'y' (enabled) and 'n' (disabled). The
24+# documentation is formatted to be consumed by some sort of
25+# interactive configuration interface, but EGLIBC doesn't have such an
26+# interface yet.
27+#
28+# An option may have a 'depends on' line, indicating which other options
29+# must also be enabled if this option is. At present, EGLIBC doesn't
30+# check that these dependencies are satisfied.
31+#
32+# Option group variables get their default values from the file
33+# 'option-groups.defaults', in the top directory of the EGLIBC source
34+# tree. By default, all EGLIBC option groups are enabled --- their
35+# variables are set to 'y'.
36+#
37+# After including 'option-groups.defaults', the EGLIBC make machinery
38+# includes the file 'option-groups.config' from the top of the build
39+# tree, if it is present. Developers can place assignments to option
40+# group variables in that file to override the defaults. For example,
41+# to disable an option group, place a line of the form:
42+#
43+# OPTION_GROUP_NAME = n
44+#
45+# in 'option-groups.config' at the top of your build tree. To
46+# explicitly enable an option group, you may also write:
47+#
48+# OPTION_GROUP_NAME = y
49+#
50+# although this simply reestablishes the value already set by
51+# 'option-groups.defaults'.
52+
53+config EGLIBC_ADVANCED_INET6
54+ bool "IPv6 Advanced Sockets API support (RFC3542)"
55+ depends on EGLIBC_INET
56+ help
57+ This option group includes the functions specified by RFC 3542,
58+ "Advanced Sockets Application Program Interface (API) for
59+ IPv6".
60+
61+ This option group includes the following functions:
62+
63+ inet6_opt_append
64+ inet6_opt_find
65+ inet6_opt_finish
66+ inet6_opt_get_val
67+ inet6_opt_init
68+ inet6_option_alloc
69+ inet6_option_append
70+ inet6_option_find
71+ inet6_option_init
72+ inet6_option_next
73+ inet6_option_space
74+ inet6_opt_next
75+ inet6_opt_set_val
76+ inet6_rth_add
77+ inet6_rth_getaddr
78+ inet6_rth_init
79+ inet6_rth_reverse
80+ inet6_rth_segments
81+ inet6_rth_space
82+
83+config EGLIBC_BACKTRACE
84+ bool "Functions for producing backtraces"
85+ help
86+ This option group includes functions for producing a list of
87+ the function calls that are currently active in a thread, from
88+ within the thread itself. These functions are often used
89+ within signal handlers, to produce diagnostic output.
90+
91+ This option group includes the following functions:
92+
93+ backtrace
94+ backtrace_symbols
95+ backtrace_symbols_fd
96+
97+config EGLIBC_BIG_MACROS
98+ bool "Use extensive inline code"
99+ help
100+ This option group specifies whether certain pieces of code
101+ should be inlined to achieve maximum speed. If this option
102+ group is not selected, function calls will be used instead,
103+ hence reducing the library footprint.
104+
105+config EGLIBC_BSD
106+ bool "BSD-specific functions, and their compatibility stubs"
107+ help
108+ This option group includes functions specific to BSD kernels.
109+ A number of these functions have stub versions that are also
110+ included in libraries built for non-BSD systems for
111+ compatibility.
112+
113+ This option group includes the following functions:
114+
115+ chflags
116+ fchflags
117+ lchmod
118+ revoke
119+ setlogin
120+
121+config EGLIBC_CXX_TESTS
122+ bool "Tests that link against the standard C++ library."
123+ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM
124+ help
125+ This option group does not include any C library functions;
126+ instead, it controls which EGLIBC tests an ordinary 'make
127+ tests' runs. With this group disabled, tests that would
128+ normally link against the standard C++ library are not
129+ run.
130+
131+ The standard C++ library depends on the math library 'libm' and
132+ the wide character I/O functions included in EGLIBC. So those
133+ option groups must be enabled if this test is enabled.
134+
135+config EGLIBC_CATGETS
136+ bool "Functions for accessing message catalogs"
137+ depends on EGLIBC_LOCALE_CODE
138+ help
139+ This option group includes functions for accessing message
140+ catalogs: catopen, catclose, and catgets.
141+
142+ This option group depends on the EGLIBC_LOCALE_CODE
143+ option group.
144+
145+config EGLIBC_CHARSETS
146+ bool "iconv/gconv character set conversion libraries"
147+ help
148+ This option group includes support for character sets other
149+ than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their
150+ various encodings. This affects both the character sets
151+ supported by the wide and multibyte character functions, and
152+ those supported by the 'iconv' functions.
153+
154+ With this option group disabled, EGLIBC supports only the
155+ following character sets:
156+
157+ ANSI_X3.4 - ASCII
158+ ANSI_X3.4-1968
159+ ANSI_X3.4-1986
160+ ASCII
161+ CP367
162+ CSASCII
163+ IBM367
164+ ISO-IR-6
165+ ISO646-US
166+ ISO_646.IRV:1991
167+ OSF00010020
168+ US
169+ US-ASCII
170+
171+ 10646-1:1993 - ISO 10646, in big-endian UCS4 form
172+ 10646-1:1993/UCS4
173+ CSUCS4
174+ ISO-10646
175+ ISO-10646/UCS4
176+ OSF00010104
177+ OSF00010105
178+ OSF00010106
179+ UCS-4
180+ UCS-4BE
181+ UCS4
182+
183+ UCS-4LE - ISO 10646, in little-endian UCS4 form
184+
185+ ISO-10646/UTF-8 - ISO 10646, in UTF-8 form
186+ ISO-10646/UTF8
187+ ISO-IR-193
188+ OSF05010001
189+ UTF-8
190+ UTF8
191+
192+ ISO-10646/UCS2 - ISO 10646, in target-endian UCS2 form
193+ OSF00010100
194+ OSF00010101
195+ OSF00010102
196+ UCS-2
197+ UCS2
198+
199+ UCS-2BE - ISO 10646, in big-endian UCS2 form
200+ UNICODEBIG
201+
202+ UCS-2LE - ISO 10646, in little-endian UCS2 form
203+ UNICODELITTLE
204+
205+ WCHAR_T - EGLIBC's internal form (target-endian,
206+ 32-bit ISO 10646)
207+
208+config EGLIBC_CRYPT
209+ bool "Encryption library"
210+ help
211+ This option group includes the `libcrypt' library which
212+ provides functions for one-way encryption. Supported
213+ encryption algorithms include MD5, SHA-256, SHA-512 and DES.
214+
215+config EGLIBC_CRYPT_UFC
216+ bool "Ultra fast `crypt' implementation"
217+ depends on EGLIBC_CRYPT
218+ help
219+ This option group provides ultra fast DES-based implementation of
220+ the `crypt' function. When this option group is disabled,
221+ (a) the library will not provide the setkey[_r] and encrypt[_r]
222+ functions and (b) the crypt[_r] function will return NULL and set the
223+ errno to ENOSYS if /salt/ passed does not correspond to either MD5,
224+ SHA-256 or SHA-512 algorithm.
225+
226+config EGLIBC_DB_ALIASES
227+ bool "Functions for accessing the mail aliases database"
228+ help
229+ This option group includues functions for looking up mail
230+ aliases in '/etc/aliases' or using nsswitch. It includes the
231+ following functions:
232+
233+ endaliasent
234+ getaliasbyname
235+ getaliasbyname_r
236+ getaliasent
237+ getaliasent_r
238+ setaliasent
239+
240+ When this option group is disabled, the NSS service libraries
241+ also lack support for querying their mail alias tables.
242+
243+config EGLIBC_ENVZ
244+ bool "Functions for handling envz-style environment vectors."
245+ help
246+ This option group contains functions for creating and operating
247+ on envz vectors. An "envz vector" is a vector of strings in a
248+ contiguous block of memory, where each element is a name-value
249+ pair, and elements are separated from their neighbors by null
250+ characters.
251+
252+ This option group includes the following functions:
253+
254+ envz_add envz_merge
255+ envz_entry envz_remove
256+ envz_get envz_strip
257+
258+config EGLIBC_FCVT
259+ bool "Functions for converting floating-point numbers to strings"
260+ help
261+ This option group includes functions for converting
262+ floating-point numbers to strings.
263+
264+ This option group includes the following functions:
265+
266+ ecvt qecvt
267+ ecvt_r qecvt_r
268+ fcvt qfcvt
269+ fcvt_r qfcvt_r
270+ gcvt qgcvt
271+
272+config EGLIBC_FMTMSG
273+ bool "Functions for formatting messages"
274+ help
275+ This option group includes the following functions:
276+
277+ addseverity fmtmsg
278+
279+config EGLIBC_FSTAB
280+ bool "Access functions for 'fstab'"
281+ help
282+ This option group includes functions for reading the mount
283+ point specification table, '/etc/fstab'. These functions are
284+ not included in the POSIX standard, which provides the
285+ 'getmntent' family of functions instead.
286+
287+ This option group includes the following functions:
288+
289+ endfsent getfsspec
290+ getfsent setfsent
291+ getfsfile
292+
293+config EGLIBC_FTRAVERSE
294+ bool "Functions for traversing file hierarchies"
295+ help
296+ This option group includes functions for traversing file
297+ UNIX file hierachies.
298+
299+ This option group includes the following functions:
300+
301+ fts_open ftw
302+ fts_read nftw
303+ fts_children ftw64
304+ fts_set nftw64
305+ fts_close
306+
307+config EGLIBC_GETLOGIN
308+ bool "The getlogin function"
309+ depends on EGLIBC_UTMP
310+ help
311+ This function group includes the 'getlogin' and 'getlogin_r'
312+ functions, which return the user name associated by the login
313+ activity with the current process's controlling terminal.
314+
315+ With this option group disabled, the 'glob' function will not
316+ fall back on 'getlogin' to find the user's login name for tilde
317+ expansion when the 'HOME' environment variable is not set.
318+
319+config EGLIBC_IDN
320+ bool "International domain names support"
321+ help
322+ This option group includes the `libcidn' library which
323+ provides support for international domain names.
324+
325+config EGLIBC_INET
326+ bool "Networking support"
327+ help
328+ This option group includes networking-specific functions and
329+ data. With EGLIBC_INET disabled, the EGLIBC
330+ installation and API changes as follows:
331+
332+ - The following libraries are not installed:
333+
334+ libnsl
335+ libnss_compat
336+ libnss_dns
337+ libnss_hesiod
338+ libnss_nis
339+ libnss_nisplus
340+ libresolv
341+
342+ - The following functions and variables are omitted from libc:
343+
344+ authdes_create hstrerror svc_fdset
345+ authdes_getucred htonl svc_getreq
346+ authdes_pk_create htons svc_getreq_common
347+ authnone_create if_freenameindex svc_getreq_poll
348+ authunix_create if_indextoname svc_getreqset
349+ authunix_create_default if_nameindex svc_max_pollfd
350+ bindresvport if_nametoindex svc_pollfd
351+ callrpc in6addr_any svcraw_create
352+ cbc_crypt in6addr_loopback svc_register
353+ clnt_broadcast inet6_opt_append svc_run
354+ clnt_create inet6_opt_find svc_sendreply
355+ clnt_pcreateerror inet6_opt_finish svctcp_create
356+ clnt_perrno inet6_opt_get_val svcudp_bufcreate
357+ clnt_perror inet6_opt_init svcudp_create
358+ clntraw_create inet6_option_alloc svcudp_enablecache
359+ clnt_spcreateerror inet6_option_append svcunix_create
360+ clnt_sperrno inet6_option_find svcunixfd_create
361+ clnt_sperror inet6_option_init svc_unregister
362+ clnttcp_create inet6_option_next user2netname
363+ clntudp_bufcreate inet6_option_space xdecrypt
364+ clntudp_create inet6_opt_next xdr_accepted_reply
365+ clntunix_create inet6_opt_set_val xdr_array
366+ des_setparity inet6_rth_add xdr_authdes_cred
367+ ecb_crypt inet6_rth_getaddr xdr_authdes_verf
368+ endaliasent inet6_rth_init xdr_authunix_parms
369+ endhostent inet6_rth_reverse xdr_bool
370+ endnetent inet6_rth_segments xdr_bytes
371+ endnetgrent inet6_rth_space xdr_callhdr
372+ endprotoent inet_addr xdr_callmsg
373+ endrpcent inet_aton xdr_char
374+ endservent inet_lnaof xdr_cryptkeyarg
375+ ether_aton inet_makeaddr xdr_cryptkeyarg2
376+ ether_aton_r inet_netof xdr_cryptkeyres
377+ ether_hostton inet_network xdr_des_block
378+ ether_line inet_nsap_addr xdr_double
379+ ether_ntoa inet_nsap_ntoa xdr_enum
380+ ether_ntoa_r inet_ntoa xdr_float
381+ ether_ntohost inet_ntop xdr_free
382+ freeaddrinfo inet_pton xdr_getcredres
383+ freeifaddrs innetgr xdr_hyper
384+ gai_strerror iruserok xdr_int
385+ getaddrinfo iruserok_af xdr_int16_t
386+ getaliasbyname key_decryptsession xdr_int32_t
387+ getaliasbyname_r key_decryptsession_pk xdr_int64_t
388+ getaliasent key_encryptsession xdr_int8_t
389+ getaliasent_r key_encryptsession_pk xdr_keybuf
390+ gethostbyaddr key_gendes xdr_key_netstarg
391+ gethostbyaddr_r key_get_conv xdr_key_netstres
392+ gethostbyname key_secretkey_is_set xdr_keystatus
393+ gethostbyname2 key_setnet xdr_long
394+ gethostbyname2_r key_setsecret xdr_longlong_t
395+ gethostbyname_r netname2host xdrmem_create
396+ gethostent netname2user xdr_netnamestr
397+ gethostent_r ntohl xdr_netobj
398+ getifaddrs ntohs xdr_opaque
399+ getipv4sourcefilter passwd2des xdr_opaque_auth
400+ get_myaddress pmap_getmaps xdr_pmap
401+ getnameinfo pmap_getport xdr_pmaplist
402+ getnetbyaddr pmap_rmtcall xdr_pointer
403+ getnetbyaddr_r pmap_set xdr_quad_t
404+ getnetbyname pmap_unset xdrrec_create
405+ getnetbyname_r rcmd xdrrec_endofrecord
406+ getnetent rcmd_af xdrrec_eof
407+ getnetent_r registerrpc xdrrec_skiprecord
408+ getnetgrent res_init xdr_reference
409+ getnetgrent_r rexec xdr_rejected_reply
410+ getnetname rexec_af xdr_replymsg
411+ getprotobyname rexecoptions xdr_rmtcall_args
412+ getprotobyname_r rpc_createerr xdr_rmtcallres
413+ getprotobynumber rresvport xdr_short
414+ getprotobynumber_r rresvport_af xdr_sizeof
415+ getprotoent rtime xdrstdio_create
416+ getprotoent_r ruserok xdr_string
417+ getpublickey ruserok_af xdr_u_char
418+ getrpcbyname ruserpass xdr_u_hyper
419+ getrpcbyname_r setaliasent xdr_u_int
420+ getrpcbynumber sethostent xdr_uint16_t
421+ getrpcbynumber_r setipv4sourcefilter xdr_uint32_t
422+ getrpcent setnetent xdr_uint64_t
423+ getrpcent_r setnetgrent xdr_uint8_t
424+ getrpcport setprotoent xdr_u_long
425+ getsecretkey setrpcent xdr_u_longlong_t
426+ getservbyname setservent xdr_union
427+ getservbyname_r setsourcefilter xdr_unixcred
428+ getservbyport svcauthdes_stats xdr_u_quad_t
429+ getservbyport_r svcerr_auth xdr_u_short
430+ getservent svcerr_decode xdr_vector
431+ getservent_r svcerr_noproc xdr_void
432+ getsourcefilter svcerr_noprog xdr_wrapstring
433+ h_errlist svcerr_progvers xencrypt
434+ h_errno svcerr_systemerr xprt_register
435+ herror svcerr_weakauth xprt_unregister
436+ h_nerr svc_exit
437+ host2netname svcfd_create
438+
439+ - The rpcgen, nscd, and rpcinfo commands are not installed.
440+
441+ - The 'rpc' file (a text file listing RPC services) is not installed.
442+
443+ Socket-related system calls do not fall in this option group,
444+ because many are also used for other inter-process
445+ communication mechanisms. For example, the 'syslog' routines
446+ use Unix-domain sockets to communicate with the syslog daemon;
447+ syslog is valuable in non-networked contexts.
448+
449+config EGLIBC_INET_ANL
450+ bool "Asynchronous name lookup"
451+ depends on EGLIBC_INET
452+ help
453+ This option group includes the `libanl' library which
454+ provides support for asynchronous name lookup.
455+
456+config EGLIBC_LIBM
457+ bool "libm (math library)"
458+ help
459+ This option group includes the 'libm' library, containing
460+ mathematical functions. If this option group is omitted, then
461+ an EGLIBC installation does not include shared or unshared versions
462+ of the math library.
463+
464+ Note that this does not remove all floating-point related
465+ functionality from EGLIBC; for example, 'printf' and 'scanf'
466+ can still print and read floating-point values with this option
467+ group disabled.
468+
469+ Note that the ISO Standard C++ library 'libstdc++' depends on
470+ EGLIBC's math library 'libm'. If you disable this option
471+ group, you will not be able to build 'libstdc++' against the
472+ resulting EGLIBC installation.
473+
474+config EGLIBC_LOCALES
475+ bool "Locale definitions"
476+ help
477+ This option group includes all locale definitions other than
478+ that for the "C" locale. If this option group is omitted, then
479+ only the "C" locale is supported.
480+
481+
482+config EGLIBC_LOCALE_CODE
483+ bool "Locale functions"
484+ depends on POSIX_C_LANG_WIDE_CHAR
485+ help
486+ This option group includes locale support functions, programs,
487+ and libraries. With EGLIBC_LOCALE_CODE disabled,
488+ EGLIBC supports only the 'C' locale (also known as 'POSIX'),
489+ and ignores the settings of the 'LANG' and 'LC_*' environment
490+ variables.
491+
492+ With EGLIBC_LOCALE_CODE disabled, the following
493+ functions are omitted from libc:
494+
495+ duplocale localeconv nl_langinfo rpmatch strfmon_l
496+ freelocale newlocale nl_langinfo_l strfmon uselocale
497+
498+ Furthermore, only the LC_CTYPE and LC_TIME categories of the
499+ standard "C" locale are available.
500+
501+ The EGLIBC_CATGETS option group depends on this option group.
502+
503+
504+config EGLIBC_MEMUSAGE
505+ bool "Memory profiling library"
506+ help
507+ This option group includes the `libmemusage' library and
508+ the `memusage' and `memusagestat' utilities.
509+ These components provide memory profiling functions.
510+
511+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
512+ int "Memory profiling library buffer size"
513+ depends on EGLIBC_MEMUSAGE
514+ default "32768"
515+ help
516+ Libmemusage library buffers the profiling data in memory
517+ before writing it out to disk. By default, the library
518+ allocates 1.5M buffer, which can be substantial for some
519+ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option
520+ allows to change the default buffer size. It specifies
521+ the number of entries the buffer should have.
522+ On most architectures one buffer entry amounts to 48 bytes,
523+ so setting this option to the value of 512 will reduce the size of
524+ the memory buffer to 24K.
525+
526+config EGLIBC_NIS
527+ bool "Support for NIS, NIS+, and the special 'compat' services."
528+ depends on EGLIBC_INET && EGLIBC_SUNRPC
529+ help
530+ This option group includes the NIS, NIS+, and 'compat' Name
531+ Service Switch service libraries. When it is disabled, those
532+ services libraries are not installed; you should remove any
533+ references to them from your 'nsswitch.conf' file.
534+
535+ This option group depends on the EGLIBC_INET option
536+ group; you must enable that to enable this option group.
537+
538+config EGLIBC_NSSWITCH
539+ bool "Name service switch (nsswitch) support"
540+ help
541+ This option group includes support for the 'nsswitch' facility.
542+ With this option group enabled, all EGLIBC functions for
543+ accessing various system databases (passwords and groups;
544+ networking; aliases; public keys; and so on) consult the
545+ '/etc/nsswitch.conf' configuration file to decide how to handle
546+ queries.
547+
548+ With this option group disabled, EGLIBC uses a fixed list of
549+ services to satisfy queries on each database, as requested by
550+ configuration files specified when EGLIBC is built. Your
551+ 'option-groups.config' file must set the following two
552+ variables:
553+
554+config EGLIBC_NSSWITCH_FIXED_CONFIG
555+ string "Nsswitch fixed config filename"
556+ depends on !EGLIBC_NSSWITCH
557+ default ""
558+ help
559+ Set this to the name of a file whose contents observe the
560+ same syntax as an ordinary '/etc/nsswitch.conf' file. The
561+ EGLIBC build process parses this file just as EGLIBC would
562+ at run time if EGLIBC_NSSWITCH were enabled, and
563+ produces a C library that uses the nsswitch service
564+ libraries to search for database entries as this file
565+ specifies, instead of consulting '/etc/nsswitch.conf' at run
566+ time.
567+
568+ This should be an absolute filename. The EGLIBC build
569+ process may use it from several different working
570+ directories. It may include references to Makefile
571+ variables like 'common-objpfx' (the top of the build tree,
572+ with a trailing slash), or '..' (the top of the source tree,
573+ with a trailing slash).
574+
575+ The EGLIBC source tree includes a sample configuration file
576+ named 'nss/fixed-nsswitch.conf'; for simple configurations,
577+ you will probably want to delete references to databases not
578+ needed on your system.
579+
580+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
581+ string "Nsswitch fixed functions filename"
582+ depends on !EGLIBC_NSSWITCH
583+ default ""
584+ help
585+ The EGLIBC build process uses this file to decide which
586+ functions to make available from which service libraries.
587+ The file 'nss/fixed-nsswitch.functions' serves as a sample
588+ configuration file for this setting, and explains its syntax
589+ and meaning in more detail.
590+
591+ This should be an absolute file name. The EGLIBC build
592+ process may use it from several different working
593+ directories. It may include references to Makefile
594+ variables like 'common-objpfx' (the top of the build tree,
595+ with a trailing slash), or '..' (the top of the source tree,
596+ with a trailing slash).
597+
598+ Be sure to mention each function in each service you wish to
599+ use. If you do not mention a service's function here, the
600+ EGLIBC database access functions will not find it, even if
601+ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG
602+ file.
603+
604+ In this arrangement, EGLIBC will not use the 'dlopen' and
605+ 'dlsym' functions to find database access functions. Instead,
606+ libc hard-codes references to the service libraries' database
607+ access functions. You must explicitly link your program
608+ against the name service libraries (those whose names start
609+ with 'libnss_', in the sysroot's '/lib' directory) whose
610+ functions you intend to use. This arrangement helps
611+ system-wide static analysis tools decide which functions a
612+ system actually uses.
613+
614+ Note that some nsswitch service libraries require other option
615+ groups to be enabled; for example, the EGLIBC_INET
616+ option group must be enabled to use the 'libnss_dns.so.2'
617+ service library, which uses the Domain Name System network
618+ protocol to answer queries.
619+
620+config EGLIBC_RCMD
621+ bool "Support for 'rcmd' and related library functions"
622+ depends on EGLIBC_INET
623+ help
624+ This option group includes functions for running commands on
625+ remote machines via the 'rsh' protocol, and doing authentication
626+ related to those functions. This also includes functions that
627+ use the 'rexec' protocol.
628+
629+ This option group includes the following functions:
630+
631+ rcmd ruserok
632+ rcmd_af ruserok_af
633+ rexec iruserok
634+ rexec_af iruserok_af
635+ rresvport ruserpass
636+ rresvport_af
637+
638+config EGLIBC_RTLD_DEBUG
639+ bool "Runtime linker debug print outs"
640+ help
641+ This option group enables debug output of the runtime linker
642+ which is activated via LD_DEBUG and LD_TRACE_PRELINKING
643+ environment variables. Disabling this option group yields
644+ a smaller runtime linker binary.
645+ BEWARE: Disabling this option group is likely to break
646+ the `ldd' utility which may also be used by the prelinker.
647+ In particular, the `--unused' ldd option will not work correctly.
648+
649+config EGLIBC_SPAWN
650+ bool "Support for POSIX posix_spawn functions"
651+ help
652+ This option group includes the POSIX functions for executing
653+ programs in child processes without using 'fork' or 'vfork'.
654+
655+ This option group includes the following functions:
656+
657+ posix_spawn
658+ posix_spawnattr_destroy
659+ posix_spawnattr_getflags
660+ posix_spawnattr_getpgroup
661+ posix_spawnattr_getschedparam
662+ posix_spawnattr_getschedpolicy
663+ posix_spawnattr_getsigdefault
664+ posix_spawnattr_getsigmask
665+ posix_spawnattr_init
666+ posix_spawnattr_setflags
667+ posix_spawnattr_setpgroup
668+ posix_spawnattr_setschedparam
669+ posix_spawnattr_setschedpolicy
670+ posix_spawnattr_setsigdefault
671+ posix_spawnattr_setsigmask
672+ posix_spawn_file_actions_addclose
673+ posix_spawn_file_actions_adddup2
674+ posix_spawn_file_actions_addopen
675+ posix_spawn_file_actions_destroy
676+ posix_spawn_file_actions_init
677+ posix_spawnp
678+
679+ This option group also provides the ability for the iconv,
680+ localedef, and locale programs to operate transparently on
681+ compressed charset definitions. When this option group is
682+ disabled, those programs will only operate on uncompressed
683+ charmap files.
684+
685+config EGLIBC_STREAMS
686+ bool "Support for accessing STREAMS."
687+ help
688+ This option group includes functions for reading and writing
689+ messages to and from STREAMS. The STREAMS interface provides a
690+ uniform mechanism for implementing networking services and other
691+ character-based I/O. (STREAMS are not to be confused with
692+ <stdio.h> FILE objects, also called 'streams'.)
693+
694+ This option group includes the following functions:
695+
696+ getmsg putpmsg
697+ getpmsg fattach
698+ isastream fdetach
699+ putmsg
700+
701+config EGLIBC_SUNRPC
702+ bool "Support for the Sun 'RPC' protocol."
703+ depends on EGLIBC_INET
704+ help
705+ This option group includes support for the Sun RPC protocols,
706+ including the 'rpcgen' and 'rpcinfo' programs.
707+
708+config EGLIBC_UTMP
709+ bool "Older access functions for 'utmp' login records"
710+ help
711+ This option group includes the older 'utent' family of
712+ functions for accessing user login records in the 'utmp' file.
713+ POSIX omits these functions in favor of the 'utxent' family,
714+ and they are obsolete on systems other than Linux.
715+
716+ This option group includes the following functions:
717+
718+ endutent
719+ getutent
720+ getutent_r
721+ getutid
722+ getutid_r
723+ getutline
724+ getutline_r
725+ logwtmp
726+ pututline
727+ setutent
728+ updwtmp
729+ utmpname
730+
731+ This option group includes the following libraries:
732+
733+ libutil.so (and libutil.a)
734+
735+config EGLIBC_UTMPX
736+ bool "POSIX access functions for 'utmp' login records"
737+ depends on EGLIBC_UTMP
738+ help
739+ This option group includes the POSIX functions for reading and
740+ writing user login records in the 'utmp' file (usually
741+ '/var/run/utmp'). The POSIX functions operate on 'struct
742+ utmpx' structures, as opposed to the family of older 'utent'
743+ functions, which operate on 'struct utmp' structures.
744+
745+ This option group includes the following functions:
746+
747+ endutxent
748+ getutmp
749+ getutmpx
750+ getutxent
751+ getutxid
752+ getutxline
753+ pututxline
754+ setutxent
755+ updwtmpx
756+ utmpxname
757+
758+config EGLIBC_WORDEXP
759+ bool "Shell-style word expansion"
760+ help
761+ This option group includes the 'wordexp' function for
762+ performing word expansion in the manner of the shell, and the
763+ accompanying 'wordfree' function.
764+
765+config POSIX_C_LANG_WIDE_CHAR
766+ bool "ISO C library wide character functions, excluding I/O"
767+ help
768+ This option group includes the functions defined by the ISO C
769+ standard for working with wide and multibyte characters in
770+ memory. Functions for reading and writing wide and multibyte
771+ characters from and to files call in the
772+ POSIX_WIDE_CHAR_DEVICE_IO option group.
773+
774+ This option group includes the following functions:
775+
776+ btowc mbsinit wcscspn wcstoll
777+ iswalnum mbsrtowcs wcsftime wcstombs
778+ iswalpha mbstowcs wcslen wcstoul
779+ iswblank mbtowc wcsncat wcstoull
780+ iswcntrl swprintf wcsncmp wcstoumax
781+ iswctype swscanf wcsncpy wcsxfrm
782+ iswdigit towctrans wcspbrk wctob
783+ iswgraph towlower wcsrchr wctomb
784+ iswlower towupper wcsrtombs wctrans
785+ iswprint vswprintf wcsspn wctype
786+ iswpunct vswscanf wcsstr wmemchr
787+ iswspace wcrtomb wcstod wmemcmp
788+ iswupper wcscat wcstof wmemcpy
789+ iswxdigit wcschr wcstoimax wmemmove
790+ mblen wcscmp wcstok wmemset
791+ mbrlen wcscoll wcstol
792+ mbrtowc wcscpy wcstold
793+
794+config POSIX_REGEXP
795+ bool "Regular expressions"
796+ help
797+ This option group includes the POSIX regular expression
798+ functions, and the associated non-POSIX extensions and
799+ compatibility functions.
800+
801+ With POSIX_REGEXP disabled, the following functions are
802+ omitted from libc:
803+
804+ re_comp re_max_failures regcomp
805+ re_compile_fastmap re_search regerror
806+ re_compile_pattern re_search_2 regexec
807+ re_exec re_set_registers regfree
808+ re_match re_set_syntax rpmatch
809+ re_match_2 re_syntax_options
810+
811+ Furthermore, the compatibility regexp interface defined in the
812+ <regexp.h> header file, 'compile', 'step', and 'advance', is
813+ omitted.
814+
815+config POSIX_REGEXP_GLIBC
816+ bool "Regular expressions from GLIBC"
817+ depends on POSIX_REGEXP
818+ help
819+ This option group specifies which regular expression
820+ library to use. The choice is between regex
821+ implementation from GLIBC and regex implementation from
822+ libiberty. The GLIBC variant is fully POSIX conformant and
823+ optimized for speed; regex from libiberty is more than twice
824+ as small while still is enough for most practical purposes.
825+
826+config POSIX_WIDE_CHAR_DEVICE_IO
827+ bool "Input and output functions for wide characters"
828+ depends on POSIX_C_LANG_WIDE_CHAR
829+ help
830+ This option group includes functions for reading and writing
831+ wide characters to and from <stdio.h> streams.
832+
833+ This option group includes the following functions:
834+
835+ fgetwc fwprintf putwchar vwscanf
836+ fgetws fwscanf ungetwc wprintf
837+ fputwc getwc vfwprintf wscanf
838+ fputws getwchar vfwscanf
839+ fwide putwc vwprintf
840+
841+ This option group further includes the following unlocked
842+ variants of the above functions:
843+
844+ fgetwc_unlocked getwc_unlocked
845+ fgetws_unlocked getwchar_unlocked
846+ fputwc_unlocked putwc_unlocked
847+ fputws_unlocked putwchar_unlocked
848+
849+ Note that the GNU standard C++ library, 'libstdc++.so', uses
850+ some of these functions; you will not be able to link or run
851+ C++ programs if you disable this option group.
852+
853+ This option group also affects the behavior of the following
854+ functions:
855+
856+ fdopen
857+ fopen
858+ fopen64
859+ freopen
860+ freopen64
861+
862+ These functions all take an OPENTYPE parameter which may
863+ contain a string of the form ",ccs=CHARSET", indicating that
864+ the underlying file uses the character set named CHARSET.
865+ This produces a wide-oriented stream, which is only useful
866+ when the functions included in this option group are present.
867+ If the user attempts to open a file specifying a character set
868+ in the OPENTYPE parameter, and EGLIBC was built with this
869+ option group disabled, the function returns NULL, and sets
870+ errno to EINVAL.
871+
872+
873+# This helps Emacs users browse this file using the page motion commands
874+# and commands like 'pages-directory'.
875+# Local Variables:
876+# page-delimiter: "^config\\s-"
877+# End:
878Index: git/option-groups.mak
879===================================================================
880--- /dev/null 1970-01-01 00:00:00.000000000 +0000
881+++ git/option-groups.mak 2014-08-27 07:26:51.652070587 +0000
882@@ -0,0 +1,41 @@
883+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
884+
885+# EGLIBC shouldn't need to override this. However, the
886+# cross-build-friendly localedef includes this makefile to get option
887+# group variable definitions; it uses a single build tree for all the
888+# multilibs, and needs to be able to specify a different option group
889+# configuration file for each multilib.
890+option_group_config_file ?= $(objdir)/option-groups.config
891+
892+# Read the default settings for all options.
893+# We're included before ../Rules, so we can't assume $(..) is set.
894+include $(firstword $(..) ../)option-groups.defaults
895+
896+# Read the developer's option group selections, overriding the
897+# defaults from option-groups.defaults.
898+-include $(option_group_config_file)
899+
900+# $(call option-disabled, VAR) is 'y' if VAR is not 'y', or 'n' otherwise.
901+# VAR should be a variable name, not a variable reference; this is
902+# less general, but more terse for the intended use.
903+# You can use it to add a file to a list if an option group is
904+# disabled, like this:
905+# routines-$(call option-disabled, OPTION_POSIX_C_LANG_WIDE_CHAR) += ...
906+define option-disabled
907+$(firstword $(subst y,n,$(filter y,$($(strip $(1))))) y)
908+endef
909+
910+# Establish 'routines-y', etc. as simply-expanded variables.
911+aux-y :=
912+extra-libs-others-y :=
913+extra-libs-y :=
914+extra-objs-y :=
915+install-bin-y :=
916+install-others-y :=
917+install-sbin-y :=
918+others-y :=
919+others-pie-y :=
920+routines-y :=
921+test-srcs-y :=
922+tests-y :=
923+xtests-y :=
924Index: git/option-groups.defaults
925===================================================================
926--- /dev/null 1970-01-01 00:00:00.000000000 +0000
927+++ git/option-groups.defaults 2014-08-27 07:24:41.652070587 +0000
928@@ -0,0 +1,47 @@
929+# This file sets default values for all option group variables
930+# mentioned in option-groups.def; see that file for a description of
931+# each option group.
932+#
933+# Subdirectory makefiles include this file before including the user's
934+# settings from option-groups.config at the top of the build tree;
935+# that file need only refer to those options whose default settings
936+# are to be changed.
937+#
938+# By default, all option groups are enabled.
939+OPTION_EGLIBC_ADVANCED_INET6 = y
940+OPTION_EGLIBC_BACKTRACE = y
941+OPTION_EGLIBC_BIG_MACROS = y
942+OPTION_EGLIBC_BSD = y
943+OPTION_EGLIBC_CXX_TESTS = y
944+OPTION_EGLIBC_CATGETS = y
945+OPTION_EGLIBC_CHARSETS = y
946+OPTION_EGLIBC_CRYPT = y
947+OPTION_EGLIBC_CRYPT_UFC = y
948+OPTION_EGLIBC_DB_ALIASES = y
949+OPTION_EGLIBC_ENVZ = y
950+OPTION_EGLIBC_FCVT = y
951+OPTION_EGLIBC_FMTMSG = y
952+OPTION_EGLIBC_FSTAB = y
953+OPTION_EGLIBC_FTRAVERSE = y
954+OPTION_EGLIBC_GETLOGIN = y
955+OPTION_EGLIBC_IDN = y
956+OPTION_EGLIBC_INET = y
957+OPTION_EGLIBC_INET_ANL = y
958+OPTION_EGLIBC_LIBM = y
959+OPTION_EGLIBC_LOCALES = y
960+OPTION_EGLIBC_LOCALE_CODE = y
961+OPTION_EGLIBC_MEMUSAGE = y
962+OPTION_EGLIBC_NIS = y
963+OPTION_EGLIBC_NSSWITCH = y
964+OPTION_EGLIBC_RCMD = y
965+OPTION_EGLIBC_RTLD_DEBUG = y
966+OPTION_EGLIBC_SPAWN = y
967+OPTION_EGLIBC_STREAMS = y
968+OPTION_EGLIBC_SUNRPC = y
969+OPTION_EGLIBC_UTMP = y
970+OPTION_EGLIBC_UTMPX = y
971+OPTION_EGLIBC_WORDEXP = y
972+OPTION_POSIX_C_LANG_WIDE_CHAR = y
973+OPTION_POSIX_REGEXP = y
974+OPTION_POSIX_REGEXP_GLIBC = y
975+OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
976Index: git/Makefile
977===================================================================
978--- git.orig/Makefile 2014-08-27 07:24:37.540070587 +0000
979+++ git/Makefile 2014-08-27 07:24:41.656070587 +0000
980@@ -24,6 +24,7 @@
981
982 include Makeconfig
983
984+include options-config/Makefile
985
986 # This is the default target; it makes everything except the tests.
987 .PHONY: all
988Index: git/EGLIBC.option-groups
989===================================================================
990--- /dev/null 1970-01-01 00:00:00.000000000 +0000
991+++ git/EGLIBC.option-groups 2014-08-27 07:24:41.656070587 +0000
992@@ -0,0 +1,122 @@
993+ -*- mode: text -*-
994+
995+ The EGLIBC Component Configuration System
996+ Jim Blandy <jimb@codesourcery.com>
997+
998+Introduction
999+
1000+The GNU C library (GLIBC) provides a broad range of functionality,
1001+ranging from internationalization support to transcendental
1002+mathematical functions. Its website boasts that "nearly all known and
1003+useful functions from any other C library are available." This
1004+exhaustive approach has been one of GLIBC's strengths on desktop and
1005+server systems, but it has also given GLIBC a large footprint, both in
1006+memory and on disk, making it a challenge to use in embedded systems
1007+with limited resources.
1008+
1009+The Embedded GNU C library (EGLIBC) is a variant of the GNU C library
1010+designed to work well on embedded systems. In particular, EGLIBC's
1011+component configuration system allows embedded developers to build
1012+customized versions of the library that include only the features
1013+their application uses, reducing its space requirements.
1014+
1015+EGLIBC's component configuration system categorizes the library's
1016+functions into "option groups", and allows you to include or exclude
1017+option groups individually. Some option groups depend on others;
1018+EGLIBC tracks these relationships, and ensures that the selected
1019+configuration yields a functioning library.
1020+
1021+
1022+Consistent and Predictable Behavior
1023+
1024+A flexible configuration system is a mixed blessing: if the options
1025+offered are poorly designed, it can be hard to see which choices will
1026+have the desired effects, and choices with obscure consequences can
1027+make debugging difficult. EGLIBC's configuration follows some general
1028+principles to reduce these risks:
1029+
1030+- EGLIBC has a single default configuration for each target
1031+ architecture.
1032+
1033+- In the default configuration, all option groups are enabled, and
1034+ EGLIBC is upwardly API- and ABI-compatible with GLIBC.
1035+
1036+- As much as possible, configurations only affect what functions are
1037+ present, not how they behave. If the system works with an option
1038+ group disabled, it will still work with it enabled.
1039+
1040+- As much as possible, configurations only select option groups ---
1041+ they do not describe characteristics of the target architecture.
1042+
1043+These rules mean that you have a simple debugging strategy available
1044+if you suspect that your EGLIBC configuration might be the source of a
1045+problem: fall back to the default configuration, re-test, and then
1046+disable option groups one by one, until the problem reappears.
1047+
1048+
1049+The Option Groups
1050+
1051+To see the current full list of implemented option groups, refer to the
1052+file 'option-groups.def' at the top of the source tree, or run
1053+'make menuconfig' from the top-level build directory.
1054+
1055+The POSIX.1-2001 specification includes a suggested partition of all
1056+the functions in the POSIX C API into option groups: math functions
1057+like 'sin' and 'cos'; networking functions like 'socket' and
1058+'connect'; and so on. EGLIBC could use this partitioning as the basis
1059+for future option groups.
1060+
1061+
1062+Implementation
1063+
1064+The EGLIBC component configuration system resembles the approach used
1065+by the Linux kernel to select device drivers, network protocols, and
1066+other features. A file named 'option-groups.config' in the top-level
1067+build directory contains assignments to Make variables, each of which
1068+enables or disables a particular option group. If the variable's
1069+value is set to 'y', then the option group is enabled; if it set to
1070+anything else, the option group is omitted. The file
1071+'option-groups.defaults', at the top of the source tree, establishes
1072+default values for all variables; all option groups are enabled by
1073+default.
1074+
1075+For example, the following 'option-groups.config' would omit locale
1076+data, but include mathematical functions, and everything else:
1077+
1078+ OPTION_EGLIBC_LOCALES = n
1079+ OPTION_EGLIBC_LIBM = y
1080+
1081+Like the Linux kernel, EGLIBC supports a similar set of '*config' make
1082+targets to make it easier to create 'option-groups.config', with all
1083+dependencies between option groups automatically satisfied. Run
1084+'make help' to see the list of supported make config targets. For
1085+example, 'make menuconfig' will update the current config utilising a
1086+menu based program.
1087+
1088+The option group names and their type (boolean, int, hex, string), help
1089+description, and dependencies with other option groups, are described by
1090+'option-groups.def' at the top of the source tree, analogous to the
1091+'Kconfig' files in the Linux kernel.
1092+
1093+In general, each option group variable controls whether a given set of
1094+object files in EGLIBC is compiled and included in the final
1095+libraries, or omitted from the build.
1096+
1097+Each subdirectory's Makefile categorizes its routines, libraries, and
1098+executables by option group. For example, EGLIBC's 'math/Makefile'
1099+places the 'libm' library in the OPTION_EGLIBC_LIBM group as follows:
1100+
1101+ extra-libs-$(OPTION_EGLIBC_LIBM) := libm
1102+
1103+Finally, common code in 'Makerules' cites the value of the variable
1104+'extra-libs-y', selecting only those libraries that belong to enabled
1105+option groups to be built.
1106+
1107+
1108+Current Status and Future Directions
1109+
1110+The EGLIBC component configuration system described here is still
1111+under development.
1112+
1113+We have used the system to subset some portions of EGLIBC's
1114+Index: libc/configure.ac
1115Index: git/configure.ac
1116===================================================================
1117--- git.orig/configure.ac 2014-08-27 07:24:41.196070587 +0000
1118+++ git/configure.ac 2014-08-27 07:24:41.656070587 +0000
1119@@ -127,6 +127,16 @@
1120 [sysheaders=''])
1121 AC_SUBST(sysheaders)
1122
1123+AC_ARG_WITH([kconfig],
1124+ AC_HELP_STRING([--with-kconfig=PATH],
1125+ [location of kconfig tools to use (from Linux
1126+ kernel builds) to re-use for configuring EGLIBC
1127+ option groups]),
1128+ [KCONFIG_TOOLS=$withval],
1129+ [KCONFIG_TOOLS=''])
1130+AC_SUBST(KCONFIG_TOOLS)
1131+
1132+
1133 AC_SUBST(use_default_link)
1134 AC_ARG_WITH([default-link],
1135 AC_HELP_STRING([--with-default-link],
1136Index: git/config.make.in
1137===================================================================
1138--- git.orig/config.make.in 2014-08-27 07:24:37.560070587 +0000
1139+++ git/config.make.in 2014-08-27 07:24:41.656070587 +0000
1140@@ -46,6 +46,8 @@
1141 c++-sysincludes = @CXX_SYSINCLUDES@
1142 all-warnings = @all_warnings@
1143
1144+kconfig_tools = @KCONFIG_TOOLS@
1145+
1146 have-z-combreloc = @libc_cv_z_combreloc@
1147 have-z-execstack = @libc_cv_z_execstack@
1148 have-Bgroup = @libc_cv_Bgroup@
1149Index: git/configure
1150===================================================================
1151--- git.orig/configure 2014-08-27 07:24:41.192070587 +0000
1152+++ git/configure 2014-08-27 07:24:41.660070587 +0000
1153@@ -619,6 +619,7 @@
1154 PERL
1155 BASH_SHELL
1156 libc_cv_gcc_static_libgcc
1157+KCONFIG_TOOLS
1158 CXX_SYSINCLUDES
1159 SYSINCLUDES
1160 AUTOCONF
1161@@ -733,6 +734,7 @@
1162 with_binutils
1163 with_selinux
1164 with_headers
1165+with_kconfig
1166 with_default_link
1167 enable_sanity_checks
1168 enable_shared
1169@@ -1437,6 +1439,9 @@
1170 --with-selinux if building with SELinux support
1171 --with-headers=PATH location of system headers to use (for example
1172 /usr/src/linux/include) [default=compiler default]
1173+ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel
1174+ builds) to re-use for configuring EGLIBC option
1175+ groups
1176 --with-default-link do not use explicit linker scripts
1177 --with-cpu=CPU select code for CPU variant
1178
1179@@ -3400,6 +3405,14 @@
1180
1181
1182
1183+# Check whether --with-kconfig was given.
1184+if test "${with_kconfig+set}" = set; then
1185+ withval=$with_kconfig; KCONFIG_TOOLS=$withval
1186+else
1187+ KCONFIG_TOOLS=''
1188+fi
1189+
1190+
1191
1192 # Check whether --with-default-link was given.
1193 if test "${with_default_link+set}" = set; then :
1194Index: git/options-config/Makefile
1195===================================================================
1196--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1197+++ git/options-config/Makefile 2014-08-27 07:24:41.652070587 +0000
1198@@ -0,0 +1,55 @@
1199+# ===========================================================================
1200+# EGLIBC option-groups configuration targets
1201+# These targets are included from top-level makefile
1202+
1203+ifneq ($(kconfig_tools),)
1204+ifneq (no,$(PERL))
1205+
1206+ocdir := options-config
1207+
1208+OconfigDefaults := option-groups.defaults
1209+OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig
1210+OconfigDef := option-groups.def
1211+Oconfig := $(common-objpfx)option-groups.config
1212+Oconfig_tmp := $(common-objpfx).tmp.config
1213+
1214+conf := $(kconfig_tools)/conf
1215+mconf := $(kconfig_tools)/mconf
1216+
1217+preproc := $(PERL) $(ocdir)/config-preproc.pl
1218+postproc := $(PERL) $(ocdir)/config-postproc.pl
1219+
1220+PHONY += defconfig config menuconfig
1221+
1222+defconfig: $(conf) $(OconfigDefaults) $(OconfigDef)
1223+ rm -f $(OconfigDefaults_tmp)
1224+ rm -f $(Oconfig_tmp)
1225+ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp)
1226+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \
1227+ $(OconfigDef)
1228+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1229+ rm $(Oconfig_tmp)
1230+ rm $(OconfigDefaults_tmp)
1231+
1232+config: $(conf) $(OconfigDefaults) $(OconfigDef)
1233+ rm -f $(Oconfig_tmp)
1234+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1235+ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef)
1236+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1237+ rm $(Oconfig_tmp)
1238+
1239+menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef)
1240+ rm -f $(Oconfig_tmp)
1241+ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp)
1242+ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef)
1243+ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig)
1244+ rm $(Oconfig_tmp)
1245+
1246+# Help text used by make help
1247+help:
1248+ @echo ' defconfig - New config with default from default config'
1249+ @echo ' config - Update current config utilising a line-oriented program'
1250+ @echo ' menuconfig - Update current config utilising a menu based program'
1251+
1252+endif
1253+endif
1254Index: git/options-config/config-postproc.pl
1255===================================================================
1256--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1257+++ git/options-config/config-postproc.pl 2014-08-27 07:24:41.652070587 +0000
1258@@ -0,0 +1,58 @@
1259+#!/usr/bin/perl
1260+
1261+$usage = "usage: $0 <default config file> <config file>\n";
1262+
1263+die "$usage" unless @ARGV;
1264+$defaults = shift @ARGV;
1265+die "$usage" unless @ARGV;
1266+die "Could not open $ARGV[0]" unless -T $ARGV[0];
1267+
1268+sub yank {
1269+ @option = grep(!($_ =~ /$_[0]\s*=/), @option);
1270+}
1271+
1272+open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
1273+
1274+# get the full list of available options using the default config file
1275+$i = 0;
1276+while (<DEFAULTS>) {
1277+ if (/^\s*OPTION_(\w+\s*=.*$)/) {
1278+ $option[$i++] = $1;
1279+ }
1280+}
1281+
1282+# now go through the config file, making the necessary changes
1283+while (<>) {
1284+ if (/Linux Kernel Configuration/) {
1285+ # change title
1286+ s/Linux Kernel/Option Groups/;
1287+ print;
1288+ } elsif (/^\s*CONFIG_(\w+)\s*=/) {
1289+ # this is an explicit option set line, change CONFIG_ to OPTION_
1290+ # before printing and remove this option from option list
1291+ $opt = $1;
1292+ yank($opt);
1293+ s/CONFIG_/OPTION_/g;
1294+ print;
1295+ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
1296+ # this is a comment line for an unset boolean option, change CONFIG_
1297+ # to OPTION_, remove this option from option list, and convert to
1298+ # explicit OPTION_FOO=n
1299+ $opt = $1;
1300+ yank($opt);
1301+ s/CONFIG_/OPTION_/g;
1302+ print "OPTION_$opt=n\n";
1303+ } else {
1304+ print;
1305+ }
1306+}
1307+
1308+# any boolean options left in @options, are options that were not mentioned in
1309+# the config file, and implicitly that means the option must be set =n,
1310+# so do that here.
1311+foreach $opt (@option) {
1312+ if ($opt =~ /=\s*[yn]/) {
1313+ $opt =~ s/=\s*[yn]/=n/;
1314+ print "OPTION_$opt\n";
1315+ }
1316+}
1317Index: git/options-config/config-preproc.pl
1318===================================================================
1319--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1320+++ git/options-config/config-preproc.pl 2014-08-27 07:24:41.652070587 +0000
1321@@ -0,0 +1,8 @@
1322+#!/usr/bin/perl
1323+
1324+if (@ARGV) {
1325+ while (<>) {
1326+ s/OPTION_/CONFIG_/g;
1327+ print;
1328+ }
1329+}
1330Index: git/scripts/option-groups.awk
1331===================================================================
1332--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1333+++ git/scripts/option-groups.awk 2014-08-27 07:26:51.652070587 +0000
1334@@ -0,0 +1,63 @@
1335+# option-groups.awk --- generate option group header file
1336+# Given input files containing makefile-style assignments to variables,
1337+# print out a header file that #defines an appropriate preprocessor
1338+# symbol for each variable left set to 'y'.
1339+
1340+BEGIN { FS="=" }
1341+
1342+# Trim spaces.
1343+{ gsub (/[[:blank:]]/, "") }
1344+
1345+# Skip comments.
1346+/^#/ { next }
1347+
1348+# Process assignments.
1349+NF == 2 {
1350+ vars[$1] = $2
1351+}
1352+
1353+# Print final values.
1354+END {
1355+ print "/* This file is automatically generated by scripts/option-groups.awk"
1356+ print " in the EGLIBC source tree."
1357+ print ""
1358+ print " It defines macros that indicate which EGLIBC option groups were"
1359+ print " configured in 'option-groups.config' when this C library was"
1360+ print " built. For each option group named OPTION_foo, it #defines"
1361+ print " __OPTION_foo to be 1 if the group is enabled, or #defines that"
1362+ print " symbol to be 0 if the group is disabled. */"
1363+ print ""
1364+ print "#ifndef __GNU_OPTION_GROUPS_H"
1365+ print "#define __GNU_OPTION_GROUPS_H"
1366+ print ""
1367+
1368+ # Produce a sorted list of variable names.
1369+ i=0
1370+ for (var in vars)
1371+ names[i++] = var
1372+ n = asort (names)
1373+
1374+ for (i = 1; i <= n; i++)
1375+ {
1376+ var = names[i]
1377+ if (var ~ /^OPTION_/)
1378+ {
1379+ if (vars[var] == "y")
1380+ print "#define __" var " 1"
1381+ else if (vars[var] == "n")
1382+ print "#define __" var " 0"
1383+ else if (vars[var] ~ /^[0-9]+/ ||
1384+ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
1385+ vars[var] ~ /^\"/)
1386+ print "#define __" var " " vars[var]
1387+ else
1388+ print "/* #undef __" var " */"
1389+ # Ignore variables that don't have boolean, int, hex, or
1390+ # string values. Ideally, this would be driven by the types
1391+ # given in option-groups.def.
1392+ }
1393+ }
1394+
1395+ print ""
1396+ print "#endif /* __GNU_OPTION_GROUPS_H */"
1397+}
diff --git a/meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch b/meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch
new file mode 100644
index 0000000000..6ea666b1d6
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/ppc-sqrt_finite.patch
@@ -0,0 +1,184 @@
1on ppc fixes the errors like below
2| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite'
3| collect2: ld returned 1 exit status
4
5Upstream-Status: Pending
6
7ChangeLog
8
92012-01-06 Khem Raj <raj.khem@gmail.com>
10
11 * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c: Add __*_finite alias.
12 Remove cruft.
13 * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c: Ditto.
14 * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c: Ditto.
15 * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c: Ditto.
16
17Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
18===================================================================
19--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
20+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
21@@ -39,14 +39,8 @@ static const float half = 0.5;
22 We find the actual square root and half of its reciprocal
23 simultaneously. */
24
25-#ifdef __STDC__
26 double
27 __ieee754_sqrt (double b)
28-#else
29-double
30-__ieee754_sqrt (b)
31- double b;
32-#endif
33 {
34 if (__builtin_expect (b > 0, 1))
35 {
36@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
37 }
38 return f_wash (b);
39 }
40+strong_alias (__ieee754_sqrt, __sqrt_finite)
41Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
42===================================================================
43--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
44+++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
45@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
46 We find the reciprocal square root and use that to compute the actual
47 square root. */
48
49-#ifdef __STDC__
50 float
51 __ieee754_sqrtf (float b)
52-#else
53-float
54-__ieee754_sqrtf (b)
55- float b;
56-#endif
57 {
58 if (__builtin_expect (b > 0, 1))
59 {
60@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
61 }
62 return f_washf (b);
63 }
64+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
65Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
66===================================================================
67--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
68+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
69@@ -39,14 +39,8 @@ static const float half = 0.5;
70 We find the actual square root and half of its reciprocal
71 simultaneously. */
72
73-#ifdef __STDC__
74 double
75 __ieee754_sqrt (double b)
76-#else
77-double
78-__ieee754_sqrt (b)
79- double b;
80-#endif
81 {
82 if (__builtin_expect (b > 0, 1))
83 {
84@@ -132,3 +126,4 @@ __ieee754_sqrt (b)
85 }
86 return f_wash (b);
87 }
88+strong_alias (__ieee754_sqrt, __sqrt_finite)
89Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
90===================================================================
91--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
92+++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
93@@ -37,14 +37,8 @@ static const float threehalf = 1.5;
94 We find the reciprocal square root and use that to compute the actual
95 square root. */
96
97-#ifdef __STDC__
98 float
99 __ieee754_sqrtf (float b)
100-#else
101-float
102-__ieee754_sqrtf (b)
103- float b;
104-#endif
105 {
106 if (__builtin_expect (b > 0, 1))
107 {
108@@ -99,3 +93,4 @@ __ieee754_sqrtf (b)
109 }
110 return f_washf (b);
111 }
112+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
113Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
114===================================================================
115--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
116+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
117@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
118 }
119 return f_wash (b);
120 }
121+strong_alias (__ieee754_sqrt, __sqrt_finite)
122Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
123===================================================================
124--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
125+++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
126@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
127 }
128 return f_washf (b);
129 }
130+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
131Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
132===================================================================
133--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
134+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
135@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
136 }
137 return f_wash (b);
138 }
139+strong_alias (__ieee754_sqrt, __sqrt_finite)
140Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
141===================================================================
142--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
143+++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
144@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
145 }
146 return f_washf (b);
147 }
148+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
149Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
150===================================================================
151--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
152+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
153@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
154 }
155 return f_wash (b);
156 }
157+strong_alias (__ieee754_sqrt, __sqrt_finite)
158Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
159===================================================================
160--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
161+++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
162@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
163 }
164 return f_washf (b);
165 }
166+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
167Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
168===================================================================
169--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
170+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
171@@ -132,3 +132,4 @@ __ieee754_sqrt (b)
172 }
173 return f_wash (b);
174 }
175+strong_alias (__ieee754_sqrt, __sqrt_finite)
176Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
177===================================================================
178--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
179+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
180@@ -99,3 +99,4 @@ __ieee754_sqrtf (b)
181 }
182 return f_washf (b);
183 }
184+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch b/meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch
new file mode 100644
index 0000000000..5b819bc458
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/ppc_slow_ieee754_sqrt.patch
@@ -0,0 +1,365 @@
1 __ieee754_sqrt{,f} are now inline functions and call out __slow versions
2
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending
6Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c
7===================================================================
8--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
9+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
10@@ -40,7 +40,7 @@
11 simultaneously. */
12
13 double
14-__ieee754_sqrt (double b)
15+__slow_ieee754_sqrt (double b)
16 {
17 if (__builtin_expect (b > 0, 1))
18 {
19@@ -77,7 +77,7 @@
20
21 /* Handle small numbers by scaling. */
22 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
23- return __ieee754_sqrt (b * two108) * twom54;
24+ return __slow_ieee754_sqrt (b * two108) * twom54;
25
26 #define FMADD(a_, c_, b_) \
27 ({ double __r; \
28@@ -126,4 +126,12 @@
29 }
30 return f_wash (b);
31 }
32+
33+#undef __ieee754_sqrt
34+double
35+__ieee754_sqrt (double x)
36+{
37+ return __slow_ieee754_sqrt (x);
38+}
39+
40 strong_alias (__ieee754_sqrt, __sqrt_finite)
41Index: git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c
42===================================================================
43--- git.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
44+++ git/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
45@@ -38,7 +38,7 @@
46 square root. */
47
48 float
49-__ieee754_sqrtf (float b)
50+__slow_ieee754_sqrtf (float b)
51 {
52 if (__builtin_expect (b > 0, 1))
53 {
54@@ -93,4 +93,10 @@
55 }
56 return f_washf (b);
57 }
58+#undef __ieee754_sqrtf
59+float
60+__ieee754_sqrtf (float x)
61+{
62+ return __slow_ieee754_sqrtf (x);
63+}
64 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
65Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c
66===================================================================
67--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
68+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
69@@ -40,7 +40,7 @@
70 simultaneously. */
71
72 double
73-__ieee754_sqrt (double b)
74+__slow_ieee754_sqrt (double b)
75 {
76 if (__builtin_expect (b > 0, 1))
77 {
78@@ -77,7 +77,7 @@
79
80 /* Handle small numbers by scaling. */
81 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
82- return __ieee754_sqrt (b * two108) * twom54;
83+ return __slow_ieee754_sqrt (b * two108) * twom54;
84
85 #define FMADD(a_, c_, b_) \
86 ({ double __r; \
87@@ -126,4 +126,12 @@
88 }
89 return f_wash (b);
90 }
91+
92+#undef __ieee754_sqrt
93+double
94+__ieee754_sqrt (double x)
95+{
96+ return __slow_ieee754_sqrt (x);
97+}
98+
99 strong_alias (__ieee754_sqrt, __sqrt_finite)
100Index: git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c
101===================================================================
102--- git.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
103+++ git/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
104@@ -38,7 +38,7 @@
105 square root. */
106
107 float
108-__ieee754_sqrtf (float b)
109+__slow_ieee754_sqrtf (float b)
110 {
111 if (__builtin_expect (b > 0, 1))
112 {
113@@ -93,4 +93,11 @@
114 }
115 return f_washf (b);
116 }
117+#undef __ieee754_sqrtf
118+float
119+__ieee754_sqrtf (float x)
120+{
121+ return __slow_ieee754_sqrtf (x);
122+}
123+
124 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
125Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c
126===================================================================
127--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
128+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.604070587 -0700
129@@ -41,10 +41,10 @@
130
131 #ifdef __STDC__
132 double
133-__ieee754_sqrt (double b)
134+__slow_ieee754_sqrt (double b)
135 #else
136 double
137-__ieee754_sqrt (b)
138+__slow_ieee754_sqrt (b)
139 double b;
140 #endif
141 {
142@@ -83,7 +83,7 @@
143
144 /* Handle small numbers by scaling. */
145 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
146- return __ieee754_sqrt (b * two108) * twom54;
147+ return __slow_ieee754_sqrt (b * two108) * twom54;
148
149 #define FMADD(a_, c_, b_) \
150 ({ double __r; \
151@@ -132,4 +132,12 @@
152 }
153 return f_wash (b);
154 }
155+
156+#undef __ieee754_sqrt
157+double
158+__ieee754_sqrt (double x)
159+{
160+ return __slow_ieee754_sqrt (x);
161+}
162+
163 strong_alias (__ieee754_sqrt, __sqrt_finite)
164Index: git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c
165===================================================================
166--- git.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
167+++ git/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.604070587 -0700
168@@ -39,10 +39,10 @@
169
170 #ifdef __STDC__
171 float
172-__ieee754_sqrtf (float b)
173+__slow_ieee754_sqrtf (float b)
174 #else
175 float
176-__ieee754_sqrtf (b)
177+__slow_ieee754_sqrtf (b)
178 float b;
179 #endif
180 {
181@@ -99,4 +99,12 @@
182 }
183 return f_washf (b);
184 }
185+
186+#undef __ieee754_sqrtf
187+float
188+__ieee754_sqrtf (float x)
189+{
190+ return __slow_ieee754_sqrtf (x);
191+}
192+
193 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
194Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c
195===================================================================
196--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
197+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
198@@ -41,10 +41,10 @@
199
200 #ifdef __STDC__
201 double
202-__ieee754_sqrt (double b)
203+__slow_ieee754_sqrt (double b)
204 #else
205 double
206-__ieee754_sqrt (b)
207+__slow_ieee754_sqrt (b)
208 double b;
209 #endif
210 {
211@@ -83,7 +83,7 @@
212
213 /* Handle small numbers by scaling. */
214 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
215- return __ieee754_sqrt (b * two108) * twom54;
216+ return __slow_ieee754_sqrt (b * two108) * twom54;
217
218 #define FMADD(a_, c_, b_) \
219 ({ double __r; \
220@@ -132,4 +132,12 @@
221 }
222 return f_wash (b);
223 }
224+
225+#undef __ieee754_sqrt
226+double
227+__ieee754_sqrt (double x)
228+{
229+ return __slow_ieee754_sqrt (x);
230+}
231+
232 strong_alias (__ieee754_sqrt, __sqrt_finite)
233Index: git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c
234===================================================================
235--- git.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
236+++ git/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
237@@ -39,10 +39,10 @@
238
239 #ifdef __STDC__
240 float
241-__ieee754_sqrtf (float b)
242+__slow_ieee754_sqrtf (float b)
243 #else
244 float
245-__ieee754_sqrtf (b)
246+__slow_ieee754_sqrtf (b)
247 float b;
248 #endif
249 {
250@@ -99,4 +99,12 @@
251 }
252 return f_washf (b);
253 }
254+
255+#undef __ieee754_sqrtf
256+float
257+__ieee754_sqrtf (float x)
258+{
259+ return __slow_ieee754_sqrtf (x);
260+}
261+
262 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
263Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c
264===================================================================
265--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
266+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
267@@ -41,10 +41,10 @@
268
269 #ifdef __STDC__
270 double
271-__ieee754_sqrt (double b)
272+__slow_ieee754_sqrt (double b)
273 #else
274 double
275-__ieee754_sqrt (b)
276+__slow_ieee754_sqrt (b)
277 double b;
278 #endif
279 {
280@@ -83,7 +83,7 @@
281
282 /* Handle small numbers by scaling. */
283 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
284- return __ieee754_sqrt (b * two108) * twom54;
285+ return __slow_ieee754_sqrt (b * two108) * twom54;
286
287 #define FMADD(a_, c_, b_) \
288 ({ double __r; \
289@@ -132,4 +132,12 @@
290 }
291 return f_wash (b);
292 }
293+
294+#undef __ieee754_sqrt
295+double
296+__ieee754_sqrt (double x)
297+{
298+ return __slow_ieee754_sqrt (x);
299+}
300+
301 strong_alias (__ieee754_sqrt, __sqrt_finite)
302Index: git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c
303===================================================================
304--- git.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
305+++ git/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
306@@ -39,10 +39,10 @@
307
308 #ifdef __STDC__
309 float
310-__ieee754_sqrtf (float b)
311+__slow_ieee754_sqrtf (float b)
312 #else
313 float
314-__ieee754_sqrtf (b)
315+__slow_ieee754_sqrtf (b)
316 float b;
317 #endif
318 {
319@@ -99,4 +99,12 @@
320 }
321 return f_washf (b);
322 }
323+
324+#undef __ieee754_sqrtf
325+float
326+__ieee754_sqrtf (float x)
327+{
328+ return __slow_ieee754_sqrtf (x);
329+}
330+
331 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
332Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
333===================================================================
334--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.616070587 -0700
335+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-08-29 10:35:02.608070587 -0700
336@@ -132,4 +132,12 @@
337 }
338 return f_wash (b);
339 }
340+
341+#undef __ieee754_sqrt
342+double
343+__ieee754_sqrt (double x)
344+{
345+ return __slow_ieee754_sqrt (x);
346+}
347+
348 strong_alias (__ieee754_sqrt, __sqrt_finite)
349Index: git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
350===================================================================
351--- git.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.616070587 -0700
352+++ git/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-08-29 10:35:02.608070587 -0700
353@@ -99,4 +99,12 @@
354 }
355 return f_washf (b);
356 }
357+
358+#undef __ieee754_sqrtf
359+float
360+__ieee754_sqrtf (float x)
361+{
362+ return __slow_ieee754_sqrtf (x);
363+}
364+
365 strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch b/meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch
new file mode 100644
index 0000000000..4c6c1070c3
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/ppce6500-32b_slow_ieee754_sqrt.patch
@@ -0,0 +1,47 @@
1 __ieee754_sqrt{,f} are now inline functions and call out __slow versions
2
3
4Signed-off-by: chunrong guo <B40290@freescale.com>
5Upstream-Status: Pending
6
7diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c
8--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:39:58.487229887 -0500
9+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:40:52.643069198 -0500
10@@ -41,10 +41,10 @@
11
12 #ifdef __STDC__
13 double
14-__ieee754_sqrt (double b)
15+__slow_ieee754_sqrt (double b)
16 #else
17 double
18-__ieee754_sqrt (b)
19+__slow_ieee754_sqrt (b)
20 double b;
21 #endif
22 {
23@@ -83,7 +83,7 @@
24
25 /* Handle small numbers by scaling. */
26 if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0))
27- return __ieee754_sqrt (b * two108) * twom54;
28+ return __slow_ieee754_sqrt (b * two108) * twom54;
29
30 #define FMADD(a_, c_, b_) \
31 ({ double __r; \
32diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c
33--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:39:58.487229887 -0500
34+++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:41:26.017067682 -0500
35@@ -39,10 +39,10 @@
36
37 #ifdef __STDC__
38 float
39-__ieee754_sqrtf (float b)
40+__slow_ieee754_sqrtf (float b)
41 #else
42 float
43-__ieee754_sqrtf (b)
44+__slow_ieee754_sqrtf (b)
45 float b;
46 #endif
47 {
diff --git a/meta/recipes-core/glibc/glibc/relocatable_sdk.patch b/meta/recipes-core/glibc/glibc/relocatable_sdk.patch
new file mode 100644
index 0000000000..ca5f17ba58
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/relocatable_sdk.patch
@@ -0,0 +1,108 @@
1Upstream-Status: Inappropriate [SDK specific]
2
3This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
4and lengths as well as ld.so.cache path in the dynamic loader to specific
5sections in memory. The sections that contain paths have been allocated a 4096
6byte section, which is the maximum path length in linux. This will allow the
7relocating script to parse the ELF binary, detect the section and easily replace
8the strings in a certain path.
9
10Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
11
12Index: libc/elf/interp.c
13===================================================================
14--- libc.orig/elf/interp.c
15+++ libc/elf/interp.c
16@@ -16,5 +16,5 @@
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
21+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
22 = RUNTIME_LINKER;
23Index: libc/elf/dl-load.c
24===================================================================
25--- libc.orig/elf/dl-load.c
26+++ libc/elf/dl-load.c
27@@ -144,8 +144,8 @@ static size_t max_capstrlen attribute_re
28 /* Get the generated information about the trusted directories. */
29 #include "trusted-dirs.h"
30
31-static const char system_dirs[] = SYSTEM_DIRS;
32-static const size_t system_dirs_len[] =
33+static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS;
34+volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) =
35 {
36 SYSTEM_DIRS_LEN
37 };
38Index: libc/elf/dl-cache.c
39===================================================================
40--- libc.orig/elf/dl-cache.c
41+++ libc/elf/dl-cache.c
42@@ -133,6 +133,10 @@ do \
43 while (0)
44
45
46+const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) =
47+ SYSCONFDIR "/ld.so.cache";
48+
49+
50 int
51 internal_function
52 _dl_cache_libcmp (const char *p1, const char *p2)
53Index: libc/elf/ldconfig.c
54===================================================================
55--- libc.orig/elf/ldconfig.c
56+++ libc/elf/ldconfig.c
57@@ -166,6 +166,9 @@ static struct argp argp =
58 options, parse_opt, NULL, doc, NULL, more_help, NULL
59 };
60
61+
62+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
63+
64 /* Check if string corresponds to an important hardware capability or
65 a platform. */
66 static int
67Index: libc/sysdeps/generic/dl-cache.h
68===================================================================
69--- libc.orig/sysdeps/generic/dl-cache.h
70+++ libc/sysdeps/generic/dl-cache.h
71@@ -27,10 +27,6 @@
72 ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
73 #endif
74
75-#ifndef LD_SO_CACHE
76-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
77-#endif
78-
79 #ifndef add_system_dir
80 # define add_system_dir(dir) add_dir (dir)
81 #endif
82Index: libc/elf/rtld.c
83===================================================================
84--- libc.orig/elf/rtld.c
85+++ libc/elf/rtld.c
86@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local
87 strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
88 #endif
89
90+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
91
92 /* List of auditing DSOs. */
93 static struct audit_list
94@@ -1031,12 +1032,12 @@ of this helper program; chances are you
95 --list list all dependencies and how they are resolved\n\
96 --verify verify that given object really is a dynamically linked\n\
97 object we can handle\n\
98- --inhibit-cache Do not use " LD_SO_CACHE "\n\
99+ --inhibit-cache Do not use %s\n\
100 --library-path PATH use given PATH instead of content of the environment\n\
101 variable LD_LIBRARY_PATH\n\
102 --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
103 in LIST\n\
104- --audit LIST use objects named in LIST as auditors\n");
105+ --audit LIST use objects named in LIST as auditors\n", LD_SO_CACHE);
106
107 ++_dl_skip_args;
108 --_dl_argc;
diff --git a/meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch b/meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch
new file mode 100644
index 0000000000..f164f8f9ae
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/relocatable_sdk_fix_openpath.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Inappropriate [SDK specific]
2
3eglibc-nativesdk: Fix buffer overrun with a relocated SDK
4
5When ld-linux-*.so.2 is relocated to a path that is longer than the
6original fixed location, the dynamic loader will crash in open_path
7because it implicitly assumes that max_dirnamelen is a fixed size that
8never changes.
9
10The allocated buffer will not be large enough to contain the directory
11path string which is larger than the fixed location provided at build
12time.
13
14Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
15
16---
17 elf/dl-load.c | 12 ++++++++++++
18 1 file changed, 12 insertions(+)
19
20--- a/elf/dl-load.c
21+++ b/elf/dl-load.c
22@@ -1919,7 +1919,19 @@ open_path (const char *name, size_t name
23 given on the command line when rtld is run directly. */
24 return -1;
25
26+ do
27+ {
28+ struct r_search_path_elem *this_dir = *dirs;
29+ if (this_dir->dirnamelen > max_dirnamelen)
30+ {
31+ max_dirnamelen = this_dir->dirnamelen;
32+ }
33+ }
34+ while (*++dirs != NULL);
35+
36 buf = alloca (max_dirnamelen + max_capstrlen + namelen);
37+
38+ dirs = sps->dirs;
39 do
40 {
41 struct r_search_path_elem *this_dir = *dirs;
diff --git a/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch
new file mode 100644
index 0000000000..55547deae7
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/timezone-re-written-tzselect-as-posix-sh.patch
@@ -0,0 +1,38 @@
1timezone: re-written tzselect as posix sh
2
3To avoid the bash dependency.
4
5Upstream-Status: Pending
6
7Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
8---
9 timezone/Makefile | 2 +-
10 timezone/tzselect.ksh | 2 +-
11 2 files changed, 2 insertions(+), 2 deletions(-)
12
13Index: git/timezone/Makefile
14===================================================================
15--- git.orig/timezone/Makefile 2014-08-27 05:35:58.008070587 +0000
16+++ git/timezone/Makefile 2014-08-27 05:36:37.908070587 +0000
17@@ -114,7 +114,7 @@
18
19
20 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
21- sed -e 's|/bin/bash|$(BASH)|' \
22+ sed -e 's|/bin/bash|/bin/sh|' \
23 -e 's|TZDIR=[^}]*|TZDIR=$(zonedir)|' \
24 -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \
25 -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \
26Index: git/timezone/tzselect.ksh
27===================================================================
28--- git.orig/timezone/tzselect.ksh 2014-08-27 05:35:58.008070587 +0000
29+++ git/timezone/tzselect.ksh 2014-08-27 05:35:58.000070587 +0000
30@@ -35,7 +35,7 @@
31
32 # Specify default values for environment variables if they are unset.
33 : ${AWK=awk}
34-: ${TZDIR=`pwd`}
35+: ${TZDIR=$(pwd)}
36
37 # Check for awk Posix compliance.
38 ($AWK -v x=y 'BEGIN { exit 123 }') </dev/null >/dev/null 2>&1
diff --git a/meta/recipes-core/glibc/glibc_2.20.bb b/meta/recipes-core/glibc/glibc_2.20.bb
new file mode 100644
index 0000000000..a0736cdeec
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc_2.20.bb
@@ -0,0 +1,165 @@
1require glibc.inc
2
3DEPENDS += "gperf-native kconfig-frontends-native"
4
5PV = "2.20"
6
7SRCREV = "b8079dd0d360648e4e8de48656c5c38972621072"
8
9SRC_URI = "git://sourceware.org/git/glibc.git;branch=release/${PV}/master \
10 file://IO-acquire-lock-fix.patch \
11 file://mips-rld-map-check.patch \
12 file://etc/ld.so.conf \
13 file://generate-supported.mk \
14 file://glibc.fix_sqrt2.patch \
15 file://multilib_readlib.patch \
16 file://ppc-sqrt_finite.patch \
17 file://ppc_slow_ieee754_sqrt.patch \
18 file://add_resource_h_to_wait_h.patch \
19 file://fsl-ppc-no-fsqrt.patch \
20 file://0001-R_ARM_TLS_DTPOFF32.patch \
21 file://0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
22 file://fix-tibetian-locales.patch \
23 file://ppce6500-32b_slow_ieee754_sqrt.patch \
24 file://grok_gold.patch \
25 file://fix_am_rootsbindir.patch \
26 ${EGLIBCPATCHES} \
27 ${CVEPATCHES} \
28 "
29EGLIBCPATCHES = "\
30 file://timezone-re-written-tzselect-as-posix-sh.patch \
31 file://eglibc.patch \
32 file://option-groups.patch \
33 file://GLRO_dl_debug_mask.patch \
34 file://eglibc-header-bootstrap.patch \
35 file://eglibc-resolv-dynamic.patch \
36 file://eglibc-ppc8xx-cache-line-workaround.patch \
37 file://eglibc-sh4-fpscr_values.patch \
38 file://eglibc-use-option-groups.patch \
39 "
40# file://eglibc-install-pic-archives.patch \
41# file://initgroups_keys.patch \
42#
43CVEPATCHES = "\
44 file://CVE-2015-1781-resolv-nss_dns-dns-host.c-buffer-overf.patch \
45"
46
47CVEPATCHES = "\
48 file://CVE-2014-7817-wordexp-fails-to-honour-WRDE_NOCMD.patch \
49 file://CVE-2012-3406-Stack-overflow-in-vfprintf-BZ-16617.patch \
50 file://CVE-2014-9402_endless-loop-in-getaddr_r.patch \
51 "
52LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \
53 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
54 file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
55 file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
56
57SRC_URI_append_class-nativesdk = " file://ld-search-order.patch \
58 file://relocatable_sdk.patch \
59 file://relocatable_sdk_fix_openpath.patch \
60 "
61S = "${WORKDIR}/git"
62B = "${WORKDIR}/build-${TARGET_SYS}"
63
64PACKAGES_DYNAMIC = ""
65
66# the -isystem in bitbake.conf screws up glibc do_stage
67BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
68TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
69
70GLIBC_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"
71
72#
73# For now, we will skip building of a gcc package if it is a uclibc one
74# and our build is not a uclibc one, and we skip a glibc one if our build
75# is a uclibc build.
76#
77# See the note in gcc/gcc_3.4.0.oe
78#
79
80python __anonymous () {
81 import re
82 uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None)
83 if uc_os:
84 raise bb.parse.SkipPackage("incompatible with target %s" %
85 d.getVar('TARGET_OS', True))
86}
87
88EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
89 --without-cvs --disable-profile \
90 --disable-debug --without-gd \
91 --enable-clocale=gnu \
92 --enable-add-ons \
93 --with-headers=${STAGING_INCDIR} \
94 --without-selinux \
95 --enable-obsolete-rpc \
96 --with-kconfig=${STAGING_BINDIR_NATIVE} \
97 --disable-nscd \
98 ${GLIBC_EXTRA_OECONF}"
99
100EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
101EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'libc-inet-anl', '--enable-nscd', '--disable-nscd', d)}"
102
103
104do_patch_append() {
105 bb.build.exec_func('do_fix_readlib_c', d)
106}
107
108# for mips glibc now builds syscall tables for all abi's
109# so we make sure that we choose right march option which is
110# compatible with o32,n32 and n64 abi's
111# e.g. -march=mips32 is not compatible with n32 and n64 therefore
112# we filter it out in such case -march=from-abi which will be
113# mips1 when using o32 and mips3 when using n32/n64
114
115TUNE_CCARGS_mips := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}"
116TUNE_CCARGS_mipsel := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}"
117
118do_fix_readlib_c () {
119 sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
120}
121
122do_configure () {
123# override this function to avoid the autoconf/automake/aclocal/autoheader
124# calls for now
125# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
126# version check and doesn't really help with anything
127 if [ -z "`which rpcgen`" ]; then
128 echo "rpcgen not found. Install glibc-devel."
129 exit 1
130 fi
131 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
132 find ${S} -name "configure" | xargs touch
133 CPPFLAGS="" oe_runconf
134}
135
136rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
137 yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \
138 rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
139
140do_compile () {
141 # -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
142 unset LDFLAGS
143 base_do_compile
144 (
145 cd ${S}/sunrpc/rpcsvc
146 for r in ${rpcsvc}; do
147 h=`echo $r|sed -e's,\.x$,.h,'`
148 rpcgen -h $r -o $h || bbwarn "unable to generate header for $r"
149 done
150 )
151 echo "Adjust ldd script"
152 if [ -n "${RTLDLIST}" ]
153 then
154 prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
155 if [ "${prevrtld}" != "${RTLDLIST}" ]
156 then
157 sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#"
158 fi
159 fi
160
161}
162
163require glibc-package.inc
164
165BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
new file mode 100644
index 0000000000..cdfeaeadd8
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/32and64bit.patch
@@ -0,0 +1,331 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3We run the ldconfig in the cross fashion. make the code bitsize aware so that
4we can cross build ldconfig cache for various architectures.
5
6Richard Purdie <richard.purdie@linuxfoundation.org> 2009/05/19
7Nitin A Kamble <nitin.a.kamble@intel.com> 2009/03/29
8
9Index: ldconfig-native-2.12.1/readelflib.c
10===================================================================
11--- ldconfig-native-2.12.1.orig/readelflib.c
12+++ ldconfig-native-2.12.1/readelflib.c
13@@ -40,39 +40,212 @@ do \
14
15 /* Returns 0 if everything is ok, != 0 in case of error. */
16 int
17-process_elf_file (const char *file_name, const char *lib, int *flag,
18+process_elf_file32 (const char *file_name, const char *lib, int *flag,
19 unsigned int *osversion, char **soname, void *file_contents,
20 size_t file_length)
21 {
22 int i;
23 unsigned int j;
24- ElfW(Addr) loadaddr;
25+ Elf32_Addr loadaddr;
26 unsigned int dynamic_addr;
27 size_t dynamic_size;
28 char *program_interpreter;
29
30- ElfW(Ehdr) *elf_header;
31- ElfW(Phdr) *elf_pheader, *segment;
32- ElfW(Dyn) *dynamic_segment, *dyn_entry;
33+ Elf32_Ehdr *elf_header;
34+ Elf32_Phdr *elf_pheader, *segment;
35+ Elf32_Dyn *dynamic_segment, *dyn_entry;
36 char *dynamic_strings;
37
38- elf_header = (ElfW(Ehdr) *) file_contents;
39+ elf_header = (Elf32_Ehdr *) file_contents;
40 *osversion = 0;
41
42- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS))
43+ if (elf_header->e_type != ET_DYN)
44 {
45- if (opt_verbose)
46+ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
47+ elf_header->e_type);
48+ return 1;
49+ }
50+
51+ /* Get information from elf program header. */
52+ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents);
53+ check_ptr (elf_pheader);
54+
55+ /* The library is an elf library, now search for soname and
56+ libc5/libc6. */
57+ *flag = FLAG_ELF;
58+
59+ loadaddr = -1;
60+ dynamic_addr = 0;
61+ dynamic_size = 0;
62+ program_interpreter = NULL;
63+ for (i = 0, segment = elf_pheader;
64+ i < elf_header->e_phnum; i++, segment++)
65+ {
66+ check_ptr (segment);
67+
68+ switch (segment->p_type)
69 {
70- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
71- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name);
72- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
73- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name);
74- else
75- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
76+ case PT_LOAD:
77+ if (loadaddr == (Elf32_Addr) -1)
78+ loadaddr = segment->p_vaddr - segment->p_offset;
79+ break;
80+
81+ case PT_DYNAMIC:
82+ if (dynamic_addr)
83+ error (0, 0, _("more than one dynamic segment\n"));
84+
85+ dynamic_addr = segment->p_offset;
86+ dynamic_size = segment->p_filesz;
87+ break;
88+
89+ case PT_INTERP:
90+ program_interpreter = (char *) (file_contents + segment->p_offset);
91+ check_ptr (program_interpreter);
92+
93+ /* Check if this is enough to classify the binary. */
94+ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
95+ ++j)
96+ if (strcmp (program_interpreter, interpreters[j].soname) == 0)
97+ {
98+ *flag = interpreters[j].flag;
99+ break;
100+ }
101+ break;
102+
103+ case PT_NOTE:
104+ if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
105+ {
106+ Elf32_Word *abi_note = (Elf32_Word *) (file_contents
107+ + segment->p_offset);
108+ Elf32_Addr size = segment->p_filesz;
109+
110+ while (abi_note [0] != 4 || abi_note [1] != 16
111+ || abi_note [2] != 1
112+ || memcmp (abi_note + 3, "GNU", 4) != 0)
113+ {
114+#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word)))
115+ Elf32_Addr) note_size = 3 * sizeof (Elf32_Word))
116+ + ROUND (abi_note[0])
117+ + ROUND (abi_note[1]);
118+
119+ if (size - 32 < note_size || note_size == 0)
120+ {
121+ size = 0;
122+ break;
123+ }
124+ size -= note_size;
125+ abi_note = (void *) abi_note + note_size;
126+ }
127+
128+ if (size == 0)
129+ break;
130+
131+ *osversion = (abi_note [4] << 24) |
132+ ((abi_note [5] & 0xff) << 16) |
133+ ((abi_note [6] & 0xff) << 8) |
134+ (abi_note [7] & 0xff);
135+ }
136+ break;
137+
138+ default:
139+ break;
140+ }
141+
142+ }
143+ if (loadaddr == (Elf32_Addr) -1)
144+ {
145+ /* Very strange. */
146+ loadaddr = 0;
147+ }
148+
149+ /* Now we can read the dynamic sections. */
150+ if (dynamic_size == 0)
151+ return 1;
152+
153+ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr);
154+ check_ptr (dynamic_segment);
155+
156+ /* Find the string table. */
157+ dynamic_strings = NULL;
158+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
159+ ++dyn_entry)
160+ {
161+ check_ptr (dyn_entry);
162+ if (dyn_entry->d_tag == DT_STRTAB)
163+ {
164+ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
165+ check_ptr (dynamic_strings);
166+ break;
167 }
168- return 1;
169 }
170
171+ if (dynamic_strings == NULL)
172+ return 1;
173+
174+ /* Now read the DT_NEEDED and DT_SONAME entries. */
175+ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
176+ ++dyn_entry)
177+ {
178+ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
179+ {
180+ char *name = dynamic_strings + dyn_entry->d_un.d_val;
181+ check_ptr (name);
182+
183+ if (dyn_entry->d_tag == DT_NEEDED)
184+ {
185+
186+ if (*flag == FLAG_ELF)
187+ {
188+ /* Check if this is enough to classify the binary. */
189+ for (j = 0;
190+ j < sizeof (known_libs) / sizeof (known_libs [0]);
191+ ++j)
192+ if (strcmp (name, known_libs [j].soname) == 0)
193+ {
194+ *flag = known_libs [j].flag;
195+ break;
196+ }
197+ }
198+ }
199+
200+ else if (dyn_entry->d_tag == DT_SONAME)
201+ *soname = xstrdup (name);
202+
203+ /* Do we have everything we need? */
204+ if (*soname && *flag != FLAG_ELF)
205+ return 0;
206+ }
207+ }
208+
209+ /* We reach this point only if the file doesn't contain a DT_SONAME
210+ or if we can't classify the library. If it doesn't have a
211+ soname, return the name of the library. */
212+ if (*soname == NULL)
213+ *soname = xstrdup (lib);
214+
215+ return 0;
216+}
217+
218+int
219+process_elf_file64 (const char *file_name, const char *lib, int *flag,
220+ unsigned int *osversion, char **soname, void *file_contents,
221+ size_t file_length)
222+{
223+ int i;
224+ unsigned int j;
225+ Elf64_Addr loadaddr;
226+ unsigned int dynamic_addr;
227+ size_t dynamic_size;
228+ char *program_interpreter;
229+
230+ Elf64_Ehdr *elf_header;
231+ Elf64_Phdr *elf_pheader, *segment;
232+ Elf64_Dyn *dynamic_segment, *dyn_entry;
233+ char *dynamic_strings;
234+
235+ elf_header = (Elf64_Ehdr *) file_contents;
236+ *osversion = 0;
237+
238 if (elf_header->e_type != ET_DYN)
239 {
240 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
241@@ -81,7 +254,7 @@ process_elf_file (const char *file_name,
242 }
243
244 /* Get information from elf program header. */
245- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
246+ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents);
247 check_ptr (elf_pheader);
248
249 /* The library is an elf library, now search for soname and
250@@ -100,7 +273,7 @@ process_elf_file (const char *file_name,
251 switch (segment->p_type)
252 {
253 case PT_LOAD:
254- if (loadaddr == (ElfW(Addr)) -1)
255+ if (loadaddr == (Elf64_Addr) -1)
256 loadaddr = segment->p_vaddr - segment->p_offset;
257 break;
258
259@@ -129,16 +302,16 @@ process_elf_file (const char *file_name,
260 case PT_NOTE:
261 if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
262 {
263- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents
264+ Elf64_Word *abi_note = (Elf64_Word *) (file_contents
265 + segment->p_offset);
266- ElfW(Addr) size = segment->p_filesz;
267+ Elf64_Addr size = segment->p_filesz;
268
269 while (abi_note [0] != 4 || abi_note [1] != 16
270 || abi_note [2] != 1
271 || memcmp (abi_note + 3, "GNU", 4) != 0)
272 {
273-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
274- ElfW(Addr) note_size = 3 * sizeof (ElfW(Word))
275+#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word))
276+ Elf64_Addr note_size = 3 * sizeof (Elf64_Word)
277 + ROUND (abi_note[0])
278 + ROUND (abi_note[1]);
279
280@@ -166,7 +339,7 @@ process_elf_file (const char *file_name,
281 }
282
283 }
284- if (loadaddr == (ElfW(Addr)) -1)
285+ if (loadaddr == (Elf64_Addr) -1)
286 {
287 /* Very strange. */
288 loadaddr = 0;
289@@ -176,7 +349,7 @@ process_elf_file (const char *file_name,
290 if (dynamic_size == 0)
291 return 1;
292
293- dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr);
294+ dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr);
295 check_ptr (dynamic_segment);
296
297 /* Find the string table. */
298@@ -233,3 +406,33 @@ process_elf_file (const char *file_name,
299
300 return 0;
301 }
302+/* Returns 0 if everything is ok, != 0 in case of error. */
303+int
304+process_elf_file (const char *file_name, const char *lib, int *flag,
305+ unsigned int *osversion, char **soname, void *file_contents,
306+ size_t file_length)
307+{
308+ int i;
309+ unsigned int j;
310+ ElfW(Addr) loadaddr;
311+ unsigned int dynamic_addr;
312+ size_t dynamic_size;
313+ char *program_interpreter;
314+
315+ ElfW(Ehdr) *elf_header;
316+ ElfW(Phdr) *elf_pheader, *segment;
317+ ElfW(Dyn) *dynamic_segment, *dyn_entry;
318+ char *dynamic_strings;
319+
320+ elf_header = (ElfW(Ehdr) *) file_contents;
321+ *osversion = 0;
322+
323+ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32)
324+ return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length);
325+ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64)
326+ return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length);
327+ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name);
328+ return 1;
329+}
330+
331+
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/README b/meta/recipes-core/glibc/ldconfig-native-2.12.1/README
new file mode 100644
index 0000000000..43fb983729
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/README
@@ -0,0 +1,8 @@
1The files are pulled verbatim from glibc 2.5 and then patched to allow
2standalone compilation of ldconfig.
3
4Richard Purdie
5OpenedHand Ltd.
6
7Upgraded the ldconfig recipe to eglibc 2.12.1
8Nitin A Kamble <nitin.a.kamble@intel.com> 2011/03/29
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
new file mode 100644
index 0000000000..7f8e4db78a
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling.patch
@@ -0,0 +1,454 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Do data input/output handling according to endien-ness of the library file. That
4enables use of ldconfig in the cross fashion for any architecture.
5
62011/04/04
7Richard Purdie <richard.purdie@linuxfoundation.org>
8Nitin Kamble <nitin.a.kamble@intel.com>
9
10Index: ldconfig-native-2.12.1/readelflib.c
11===================================================================
12--- ldconfig-native-2.12.1.orig/readelflib.c
13+++ ldconfig-native-2.12.1/readelflib.c
14@@ -38,6 +38,28 @@ do \
15 } \
16 while (0);
17
18+int be;
19+static uint16_t read16(uint16_t x, int be)
20+{
21+ if (be)
22+ return be16toh(x);
23+ return le16toh(x);
24+}
25+
26+static uint32_t read32(uint32_t x, int be)
27+{
28+ if (be)
29+ return be32toh(x);
30+ return le32toh(x);
31+}
32+
33+static uint64_t read64(uint64_t x, int be)
34+{
35+ if (be)
36+ return be64toh(x);
37+ return le64toh(x);
38+}
39+
40 /* Returns 0 if everything is ok, != 0 in case of error. */
41 int
42 process_elf_file32 (const char *file_name, const char *lib, int *flag,
43@@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam
44 elf_header = (Elf32_Ehdr *) file_contents;
45 *osversion = 0;
46
47- if (elf_header->e_type != ET_DYN)
48+ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB);
49+
50+ if (read16(elf_header->e_type, be) != ET_DYN)
51 {
52 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
53- elf_header->e_type);
54+ read16(elf_header->e_type, be));
55 return 1;
56 }
57
58 /* Get information from elf program header. */
59- elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents);
60+ elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents);
61 check_ptr (elf_pheader);
62
63 /* The library is an elf library, now search for soname and
64@@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam
65 dynamic_size = 0;
66 program_interpreter = NULL;
67 for (i = 0, segment = elf_pheader;
68- i < elf_header->e_phnum; i++, segment++)
69+ i < read16(elf_header->e_phnum, be); i++, segment++)
70 {
71 check_ptr (segment);
72
73- switch (segment->p_type)
74+ switch (read32(segment->p_type, be))
75 {
76 case PT_LOAD:
77 if (loadaddr == (Elf32_Addr) -1)
78- loadaddr = segment->p_vaddr - segment->p_offset;
79+ loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be);
80 break;
81
82 case PT_DYNAMIC:
83 if (dynamic_addr)
84 error (0, 0, _("more than one dynamic segment\n"));
85
86- dynamic_addr = segment->p_offset;
87- dynamic_size = segment->p_filesz;
88+ dynamic_addr = read32(segment->p_offset, be);
89+ dynamic_size = read32(segment->p_filesz, be);
90 break;
91
92 case PT_INTERP:
93- program_interpreter = (char *) (file_contents + segment->p_offset);
94+ program_interpreter = (char *) (file_contents + read32(segment->p_offset, be));
95 check_ptr (program_interpreter);
96
97 /* Check if this is enough to classify the binary. */
98@@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam
99 break;
100
101 case PT_NOTE:
102- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
103+ if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4)
104 {
105 Elf32_Word *abi_note = (Elf32_Word *) (file_contents
106- + segment->p_offset);
107- Elf32_Addr size = segment->p_filesz;
108+ + read32(segment->p_offset, be));
109+ Elf32_Addr size = read32(segment->p_filesz, be);
110
111- while (abi_note [0] != 4 || abi_note [1] != 16
112- || abi_note [2] != 1
113+ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
114+ || read32(abi_note [2], be) != 1
115 || memcmp (abi_note + 3, "GNU", 4) != 0)
116 {
117-#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word)))
118- Elf32_Addr) note_size = 3 * sizeof (Elf32_Word))
119- + ROUND (abi_note[0])
120- + ROUND (abi_note[1]);
121+#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word))
122+ Elf32_Addr note_size = 3 * sizeof (Elf32_Word)
123+ + ROUND (read32(abi_note[0], be))
124+ + ROUND (read32(abi_note[1], be));
125
126 if (size - 32 < note_size || note_size == 0)
127 {
128@@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam
129 if (size == 0)
130 break;
131
132- *osversion = (abi_note [4] << 24) |
133- ((abi_note [5] & 0xff) << 16) |
134- ((abi_note [6] & 0xff) << 8) |
135- (abi_note [7] & 0xff);
136+ *osversion = (read32(abi_note [4], be) << 24) |
137+ ((read32(abi_note [5], be) & 0xff) << 16) |
138+ ((read32(abi_note [6], be) & 0xff) << 8) |
139+ (read32(abi_note [7], be) & 0xff);
140 }
141 break;
142
143@@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam
144
145 /* Find the string table. */
146 dynamic_strings = NULL;
147- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
148+ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL;
149 ++dyn_entry)
150 {
151 check_ptr (dyn_entry);
152- if (dyn_entry->d_tag == DT_STRTAB)
153+ if (read32(dyn_entry->d_tag, be) == DT_STRTAB)
154 {
155- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
156+ dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr);
157 check_ptr (dynamic_strings);
158 break;
159 }
160@@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam
161 return 1;
162
163 /* Now read the DT_NEEDED and DT_SONAME entries. */
164- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
165+ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL;
166 ++dyn_entry)
167 {
168- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
169+ if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME)
170 {
171- char *name = dynamic_strings + dyn_entry->d_un.d_val;
172+ char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be);
173 check_ptr (name);
174
175- if (dyn_entry->d_tag == DT_NEEDED)
176+ if (read32(dyn_entry->d_tag, be) == DT_NEEDED)
177 {
178
179 if (*flag == FLAG_ELF)
180@@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam
181 }
182 }
183
184- else if (dyn_entry->d_tag == DT_SONAME)
185+ else if (read32(dyn_entry->d_tag, be) == DT_SONAME)
186 *soname = xstrdup (name);
187
188 /* Do we have everything we need? */
189@@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam
190 elf_header = (Elf64_Ehdr *) file_contents;
191 *osversion = 0;
192
193- if (elf_header->e_type != ET_DYN)
194+ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB);
195+
196+ if (read16(elf_header->e_type, be) != ET_DYN)
197 {
198 error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name,
199- elf_header->e_type);
200+ read16(elf_header->e_type, be));
201 return 1;
202 }
203
204 /* Get information from elf program header. */
205- elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents);
206+ elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents);
207 check_ptr (elf_pheader);
208
209 /* The library is an elf library, now search for soname and
210@@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam
211 dynamic_size = 0;
212 program_interpreter = NULL;
213 for (i = 0, segment = elf_pheader;
214- i < elf_header->e_phnum; i++, segment++)
215+ i < read16(elf_header->e_phnum, be); i++, segment++)
216 {
217 check_ptr (segment);
218
219- switch (segment->p_type)
220+ switch (read32(segment->p_type, be))
221 {
222 case PT_LOAD:
223 if (loadaddr == (Elf64_Addr) -1)
224- loadaddr = segment->p_vaddr - segment->p_offset;
225+ loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be);
226 break;
227
228 case PT_DYNAMIC:
229 if (dynamic_addr)
230 error (0, 0, _("more than one dynamic segment\n"));
231
232- dynamic_addr = segment->p_offset;
233- dynamic_size = segment->p_filesz;
234+ dynamic_addr = read64(segment->p_offset, be);
235+ dynamic_size = read32(segment->p_filesz, be);
236 break;
237
238 case PT_INTERP:
239- program_interpreter = (char *) (file_contents + segment->p_offset);
240+ program_interpreter = (char *) (file_contents + read64(segment->p_offset, be));
241 check_ptr (program_interpreter);
242
243 /* Check if this is enough to classify the binary. */
244@@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam
245 break;
246
247 case PT_NOTE:
248- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4)
249+ if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
250 {
251 Elf64_Word *abi_note = (Elf64_Word *) (file_contents
252- + segment->p_offset);
253- Elf64_Addr size = segment->p_filesz;
254+ + read64(segment->p_offset, be));
255+ Elf64_Addr size = read32(segment->p_filesz, be);
256
257- while (abi_note [0] != 4 || abi_note [1] != 16
258- || abi_note [2] != 1
259+ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
260+ || read32(abi_note [2], be) != 1
261 || memcmp (abi_note + 3, "GNU", 4) != 0)
262 {
263+#undef ROUND
264 #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word))
265 Elf64_Addr note_size = 3 * sizeof (Elf64_Word)
266- + ROUND (abi_note[0])
267- + ROUND (abi_note[1]);
268+ + ROUND (read32(abi_note[0], be))
269+ + ROUND (read32(abi_note[1], be));
270
271 if (size - 32 < note_size || note_size == 0)
272 {
273@@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam
274 if (size == 0)
275 break;
276
277- *osversion = (abi_note [4] << 24) |
278- ((abi_note [5] & 0xff) << 16) |
279- ((abi_note [6] & 0xff) << 8) |
280- (abi_note [7] & 0xff);
281+ *osversion = (read32(abi_note [4], be) << 24) |
282+ ((read32(abi_note [5], be) & 0xff) << 16) |
283+ ((read32(abi_note [6], be) & 0xff) << 8) |
284+ (read32(abi_note [7], be) & 0xff);
285 }
286 break;
287
288@@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam
289
290 /* Find the string table. */
291 dynamic_strings = NULL;
292- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
293+ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL;
294 ++dyn_entry)
295 {
296 check_ptr (dyn_entry);
297- if (dyn_entry->d_tag == DT_STRTAB)
298+ if (read64(dyn_entry->d_tag, be) == DT_STRTAB)
299 {
300- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr);
301+ dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr);
302 check_ptr (dynamic_strings);
303 break;
304 }
305@@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam
306 return 1;
307
308 /* Now read the DT_NEEDED and DT_SONAME entries. */
309- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
310+ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL;
311 ++dyn_entry)
312 {
313- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
314+ if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME)
315 {
316- char *name = dynamic_strings + dyn_entry->d_un.d_val;
317+ char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be);
318 check_ptr (name);
319
320- if (dyn_entry->d_tag == DT_NEEDED)
321+ if (read64(dyn_entry->d_tag, be) == DT_NEEDED)
322 {
323
324 if (*flag == FLAG_ELF)
325@@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam
326 }
327 }
328
329- else if (dyn_entry->d_tag == DT_SONAME)
330+ else if (read64(dyn_entry->d_tag, be) == DT_SONAME)
331 *soname = xstrdup (name);
332
333 /* Do we have everything we need? */
334Index: ldconfig-native-2.12.1/readlib.c
335===================================================================
336--- ldconfig-native-2.12.1.orig/readlib.c
337+++ ldconfig-native-2.12.1/readlib.c
338@@ -169,7 +169,8 @@ process_file (const char *real_file_name
339 ret = 1;
340 }
341 /* Libraries have to be shared object files. */
342- else if (elf_header->e_type != ET_DYN)
343+ else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) ||
344+ (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN))
345 ret = 1;
346 else if (process_elf_file (file_name, lib, flag, osversion, soname,
347 file_contents, statbuf.st_size))
348Index: ldconfig-native-2.12.1/cache.c
349===================================================================
350--- ldconfig-native-2.12.1.orig/cache.c
351+++ ldconfig-native-2.12.1/cache.c
352@@ -39,6 +39,29 @@
353 # define N_(msgid) msgid
354 #define _(msg) msg
355
356+extern int be;
357+
358+static uint16_t write16(uint16_t x, int be)
359+{
360+ if (be)
361+ return htobe16(x);
362+ return htole16(x);
363+}
364+
365+static uint32_t write32(uint32_t x, int be)
366+{
367+ if (be)
368+ return htobe32(x);
369+ return htole32(x);
370+}
371+
372+static uint64_t write64(uint64_t x, int be)
373+{
374+ if (be)
375+ return htobe64(x);
376+ return htole64(x);
377+}
378+
379 struct cache_entry
380 {
381 char *lib; /* Library name. */
382@@ -279,7 +302,12 @@ save_cache (const char *cache_name)
383 /* Number of normal cache entries. */
384 int cache_entry_old_count = 0;
385
386- for (entry = entries; entry != NULL; entry = entry->next)
387+ if (be)
388+ printf("saving cache in big endian encoding\n");
389+ else
390+ printf("saving cache in little endian encoding\n");
391+
392+ for (entry = entries; entry != NULL; entry = entry->next)
393 {
394 /* Account the final NULs. */
395 total_strlen += strlen (entry->lib) + strlen (entry->path) + 2;
396@@ -310,7 +338,7 @@ save_cache (const char *cache_name)
397 memset (file_entries, '\0', sizeof (struct cache_file));
398 memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1);
399
400- file_entries->nlibs = cache_entry_old_count;
401+ file_entries->nlibs = write32(cache_entry_old_count, be);
402 }
403
404 struct cache_file_new *file_entries_new = NULL;
405@@ -330,8 +358,8 @@ save_cache (const char *cache_name)
406 memcpy (file_entries_new->version, CACHE_VERSION,
407 sizeof CACHE_VERSION - 1);
408
409- file_entries_new->nlibs = cache_entry_count;
410- file_entries_new->len_strings = total_strlen;
411+ file_entries_new->nlibs = write32(cache_entry_count, be);
412+ file_entries_new->len_strings = write32(total_strlen, be);
413 }
414
415 /* Pad for alignment of cache_file_new. */
416@@ -358,9 +386,9 @@ save_cache (const char *cache_name)
417 /* First the library. */
418 if (opt_format != 2 && entry->hwcap == 0)
419 {
420- file_entries->libs[idx_old].flags = entry->flags;
421+ file_entries->libs[idx_old].flags = write32(entry->flags, be);
422 /* XXX: Actually we can optimize here and remove duplicates. */
423- file_entries->libs[idx_old].key = str_offset + pad;
424+ file_entries->libs[idx_old].key = write32(str_offset + pad, be);
425 }
426 if (opt_format != 0)
427 {
428@@ -368,10 +396,10 @@ save_cache (const char *cache_name)
429 not doing so makes the code easier, the string table
430 always begins at the beginning of the the new cache
431 struct. */
432- file_entries_new->libs[idx_new].flags = entry->flags;
433- file_entries_new->libs[idx_new].osversion = entry->osversion;
434- file_entries_new->libs[idx_new].hwcap = entry->hwcap;
435- file_entries_new->libs[idx_new].key = str_offset;
436+ file_entries_new->libs[idx_new].flags = write32(entry->flags, be);
437+ file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be);
438+ file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be);
439+ file_entries_new->libs[idx_new].key = write32(str_offset, be);
440 }
441
442 size_t len = strlen (entry->lib) + 1;
443@@ -379,9 +407,9 @@ save_cache (const char *cache_name)
444 str_offset += len;
445 /* Then the path. */
446 if (opt_format != 2 && entry->hwcap == 0)
447- file_entries->libs[idx_old].value = str_offset + pad;
448+ file_entries->libs[idx_old].value = write32(str_offset + pad, be);
449 if (opt_format != 0)
450- file_entries_new->libs[idx_new].value = str_offset;
451+ file_entries_new->libs[idx_new].value = write32(str_offset, be);
452 len = strlen (entry->path) + 1;
453 str = mempcpy (str, entry->path, len);
454 str_offset += len;
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
new file mode 100644
index 0000000000..931a151e20
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endian-ness_handling_fix.patch
@@ -0,0 +1,47 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Fix problem during parsing of ELF headers for 64bit on big-endian.
4Some header fields were read with wrong size.
5
62014/10/24
7Par Olsson <Par.Olsson@windriver.com>
8Shan Hai <shan.hai@windriver.com>
9
10diff --git a/readelflib.c b/readelflib.c
11index 3f5b25b..0bf0de3 100644
12--- a/readelflib.c
13+++ b/readelflib.c
14@@ -261,8 +261,8 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
15 int i;
16 unsigned int j;
17 Elf64_Addr loadaddr;
18- unsigned int dynamic_addr;
19- size_t dynamic_size;
20+ Elf64_Addr dynamic_addr;
21+ Elf64_Xword dynamic_size;
22 char *program_interpreter;
23
24 Elf64_Ehdr *elf_header;
25@@ -311,7 +311,7 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
26 error (0, 0, _("more than one dynamic segment\n"));
27
28 dynamic_addr = read64(segment->p_offset, be);
29- dynamic_size = read32(segment->p_filesz, be);
30+ dynamic_size = read64(segment->p_filesz, be);
31 break;
32
33 case PT_INTERP:
34@@ -329,11 +329,11 @@ process_elf_file64 (const char *file_name, const char *lib, int *flag,
35 break;
36
37 case PT_NOTE:
38- if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4)
39+ if (!*osversion && read64(segment->p_filesz, be) >= 32 && read64(segment->p_align, be) >= 4)
40 {
41 Elf64_Word *abi_note = (Elf64_Word *) (file_contents
42 + read64(segment->p_offset, be));
43- Elf64_Addr size = read32(segment->p_filesz, be);
44+ Elf64_Xword size = read64(segment->p_filesz, be);
45
46 while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16
47 || read32(abi_note [2], be) != 1
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
new file mode 100644
index 0000000000..a18b2c20de
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/endianess-header.patch
@@ -0,0 +1,113 @@
1Upstream-Status: Inappropriate [fix poky patch]
2
3This patch fixes build issues with a previous endian-ness_handling.patch on
4distros that don't have macros referenced
5
67/20/2011
7Matthew McClintock <msm@freescale.com>
8
9diff -purN ldconfig-native-2.12.1.orig/endian_extra.h ldconfig-native-2.12.1/endian_extra.h
10--- ldconfig-native-2.12.1.orig/endian_extra.h 1969-12-31 18:00:00.000000000 -0600
11+++ ldconfig-native-2.12.1/endian_extra.h 2011-07-19 18:09:14.323048417 -0500
12@@ -0,0 +1,64 @@
13+/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc.
14+ This file is part of the GNU C Library.
15+
16+ The GNU C Library is free software; you can redistribute it and/or
17+ modify it under the terms of the GNU Lesser General Public
18+ License as published by the Free Software Foundation; either
19+ version 2.1 of the License, or (at your option) any later version.
20+
21+ The GNU C Library is distributed in the hope that it will be useful,
22+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24+ Lesser General Public License for more details.
25+
26+ You should have received a copy of the GNU Lesser General Public
27+ License along with the GNU C Library; if not, write to the Free
28+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29+ 02111-1307 USA. */
30+
31+#include <endian.h>
32+
33+#ifndef _ENDIAN_EXTRA_H
34+#define _ENDIAN_EXTRA_H 1
35+
36+/* Don't redefine these macros if they already exist */
37+#ifndef htobe16
38+#ifdef __USE_BSD
39+/* Conversion interfaces. */
40+# include <byteswap.h>
41+
42+# if __BYTE_ORDER == __LITTLE_ENDIAN
43+# define htobe16(x) __bswap_16 (x)
44+# define htole16(x) (x)
45+# define be16toh(x) __bswap_16 (x)
46+# define le16toh(x) (x)
47+
48+# define htobe32(x) __bswap_32 (x)
49+# define htole32(x) (x)
50+# define be32toh(x) __bswap_32 (x)
51+# define le32toh(x) (x)
52+
53+# define htobe64(x) __bswap_64 (x)
54+# define htole64(x) (x)
55+# define be64toh(x) __bswap_64 (x)
56+# define le64toh(x) (x)
57+# else
58+# define htobe16(x) (x)
59+# define htole16(x) __bswap_16 (x)
60+# define be16toh(x) (x)
61+# define le16toh(x) __bswap_16 (x)
62+
63+# define htobe32(x) (x)
64+# define htole32(x) __bswap_32 (x)
65+# define be32toh(x) (x)
66+# define le32toh(x) __bswap_32 (x)
67+
68+# define htobe64(x) (x)
69+# define htole64(x) __bswap_64 (x)
70+# define be64toh(x) (x)
71+# define le64toh(x) __bswap_64 (x)
72+# endif
73+#endif
74+#endif
75+
76+#endif /* endian_extra.h */
77diff -purN ldconfig-native-2.12.1.orig/cache.c ldconfig-native-2.12.1/cache.c
78--- ldconfig-native-2.12.1.orig/cache.c 2011-07-19 18:21:28.347041301 -0500
79+++ ldconfig-native-2.12.1/cache.c 2011-07-19 18:22:54.118048064 -0500
80@@ -39,6 +39,8 @@
81 # define N_(msgid) msgid
82 #define _(msg) msg
83
84+#include "endian_extra.h"
85+
86 extern int be;
87
88 static uint16_t write16(uint16_t x, int be)
89diff -purN ldconfig-native-2.12.1.orig/readelflib.c ldconfig-native-2.12.1/readelflib.c
90--- ldconfig-native-2.12.1.orig/readelflib.c 2011-07-19 18:21:28.346041593 -0500
91+++ ldconfig-native-2.12.1/readelflib.c 2011-07-19 18:23:05.324059875 -0500
92@@ -25,6 +25,9 @@
93
94 /* check_ptr checks that a pointer is in the mmaped file and doesn't
95 point outside it. */
96+
97+#include "endian_extra.h"
98+
99 #undef check_ptr
100 #define check_ptr(ptr) \
101 do \
102diff -purN ldconfig-native-2.12.1.orig/readlib.c ldconfig-native-2.12.1/readlib.c
103--- ldconfig-native-2.12.1.orig/readlib.c 2011-07-19 18:21:28.346041593 -0500
104+++ ldconfig-native-2.12.1/readlib.c 2011-07-19 18:23:23.877046210 -0500
105@@ -40,6 +40,8 @@
106
107 #include "ldconfig.h"
108
109+#include "endian_extra.h"
110+
111 #define _(msg) msg
112
113 #define Elf32_CLASS ELFCLASS32
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
new file mode 100644
index 0000000000..4e9aab9416
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/flag_fix.patch
@@ -0,0 +1,24 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3The native version of ldconfig was using native definition of LD_SO (i.e.
4ld-linux-x86-64.so.2 ) which is not correct for doing the cross ldconfig.
5This was causing libc.so on the target marked as ELF lib rather than
6FLAG_ELF_LIBC6 in the ld.so.cache.
7
8Nitin A Kamble <nitin.a.kamble@intel.com> 2011/04/4
9
10Index: ldconfig-native-2.12.1/readlib.c
11===================================================================
12--- ldconfig-native-2.12.1.orig/readlib.c
13+++ ldconfig-native-2.12.1/readlib.c
14@@ -51,6 +51,10 @@ struct known_names
15 int flag;
16 };
17
18+/* don't use host's definition of LD_SO */
19+#undef LD_SO
20+#define LD_SO "ld.so.1"
21+
22 static struct known_names interpreters[] =
23 {
24 { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
new file mode 100644
index 0000000000..5ed4f6ff69
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch
@@ -0,0 +1,37 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3make ldconfig default to both /lib+/usr/lib, /lib32+/usr/lib32 and
4/lib64+/usr/lib64 on bi-ABI architectures.
5
6---
7 ldconfig.c | 10 ++++++++++
8 1 file changed, 10 insertions(+)
9
10diff -urpN a/ldconfig.c b/ldconfig.c
11--- a/ldconfig.c
12+++ b/ldconfig.c
13@@ -52,7 +52,11 @@
14
15 #define SYSCONFDIR "/etc"
16 #define LIBDIR "/usr/lib"
17+#define LIBDIR32 "/usr/lib32"
18+#define LIBDIR64 "/usr/lib64"
19 #define SLIBDIR "/lib"
20+#define SLIBDIR32 "/lib32"
21+#define SLIBDIR64 "/lib64"
22 # define N_(msgid) msgid
23 #define _(msg) msg
24
25@@ -1373,6 +1377,12 @@ main (int argc, char **argv)
26 add_system_dir (SLIBDIR);
27 if (strcmp (SLIBDIR, LIBDIR))
28 add_system_dir (LIBDIR);
29+ add_system_dir (SLIBDIR32);
30+ if (strcmp (SLIBDIR32, LIBDIR32))
31+ add_system_dir (LIBDIR32);
32+ add_system_dir (SLIBDIR64);
33+ if (strcmp (SLIBDIR64, LIBDIR64))
34+ add_system_dir (LIBDIR64);
35 }
36
37 const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
new file mode 100644
index 0000000000..dc1e79888e
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2
Binary files differ
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
new file mode 100644
index 0000000000..52986e61c7
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig.patch
@@ -0,0 +1,471 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3enable standalone building of ldconfig
4
5---
6 cache.c | 11 +-
7 chroot_canon.c | 7 +
8 dl-cache.c | 235 ---------------------------------------------------------
9 dl-cache.h | 3
10 ldconfig.c | 27 ++++--
11 readlib.c | 7 +
12 xstrdup.c | 11 --
13 7 files changed, 45 insertions(+), 256 deletions(-)
14
15Index: ldconfig-native-2.12.1/cache.c
16===================================================================
17--- ldconfig-native-2.12.1.orig/cache.c
18+++ ldconfig-native-2.12.1/cache.c
19@@ -16,6 +16,9 @@
20 along with this program; if not, write to the Free Software Foundation,
21 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22
23+#define _LARGEFILE64_SOURCE
24+#define _GNU_SOURCE
25+
26 #include <errno.h>
27 #include <error.h>
28 #include <dirent.h>
29@@ -31,8 +34,10 @@
30 #include <sys/stat.h>
31 #include <sys/types.h>
32
33-#include <ldconfig.h>
34-#include <dl-cache.h>
35+#include "ldconfig.h"
36+#include "dl-cache.h"
37+# define N_(msgid) msgid
38+#define _(msg) msg
39
40 struct cache_entry
41 {
42Index: ldconfig-native-2.12.1/chroot_canon.c
43===================================================================
44--- ldconfig-native-2.12.1.orig/chroot_canon.c
45+++ ldconfig-native-2.12.1/chroot_canon.c
46@@ -17,6 +17,9 @@
47 along with this program; if not, write to the Free Software Foundation,
48 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
49
50+#define _LARGEFILE64_SOURCE
51+#define _GNU_SOURCE
52+
53 #include <stdlib.h>
54 #include <string.h>
55 #include <unistd.h>
56@@ -27,7 +30,9 @@
57 #include <stddef.h>
58 #include <stdint.h>
59
60-#include <ldconfig.h>
61+#include "ldconfig.h"
62+
63+#define __set_errno(Val) errno = (Val)
64
65 #ifndef PATH_MAX
66 #define PATH_MAX 1024
67Index: ldconfig-native-2.12.1/dl-cache.c
68===================================================================
69--- ldconfig-native-2.12.1.orig/dl-cache.c
70+++ ldconfig-native-2.12.1/dl-cache.c
71@@ -20,12 +20,12 @@
72
73 #include <assert.h>
74 #include <unistd.h>
75-#include <ldsodefs.h>
76+//#include "ldsodefs.h"
77 #include <sys/mman.h>
78 #include <dl-cache.h>
79 #include <dl-procinfo.h>
80
81-#include <stdio-common/_itoa.h>
82+//#include "_itoa.h"
83
84 #ifndef _DL_PLATFORMS_COUNT
85 # define _DL_PLATFORMS_COUNT 0
86@@ -39,103 +39,7 @@ static size_t cachesize;
87 /* 1 if cache_data + PTR points into the cache. */
88 #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size)
89
90-#define SEARCH_CACHE(cache) \
91-/* We use binary search since the table is sorted in the cache file. \
92- The first matching entry in the table is returned. \
93- It is important to use the same algorithm as used while generating \
94- the cache file. */ \
95-do \
96- { \
97- left = 0; \
98- right = cache->nlibs - 1; \
99- \
100- while (left <= right) \
101- { \
102- __typeof__ (cache->libs[0].key) key; \
103- \
104- middle = (left + right) / 2; \
105- \
106- key = cache->libs[middle].key; \
107- \
108- /* Make sure string table indices are not bogus before using \
109- them. */ \
110- if (! _dl_cache_verify_ptr (key)) \
111- { \
112- cmpres = 1; \
113- break; \
114- } \
115- \
116- /* Actually compare the entry with the key. */ \
117- cmpres = _dl_cache_libcmp (name, cache_data + key); \
118- if (__builtin_expect (cmpres == 0, 0)) \
119- { \
120- /* Found it. LEFT now marks the last entry for which we \
121- know the name is correct. */ \
122- left = middle; \
123- \
124- /* There might be entries with this name before the one we \
125- found. So we have to find the beginning. */ \
126- while (middle > 0) \
127- { \
128- __typeof__ (cache->libs[0].key) key; \
129- \
130- key = cache->libs[middle - 1].key; \
131- /* Make sure string table indices are not bogus before \
132- using them. */ \
133- if (! _dl_cache_verify_ptr (key) \
134- /* Actually compare the entry. */ \
135- || _dl_cache_libcmp (name, cache_data + key) != 0) \
136- break; \
137- --middle; \
138- } \
139- \
140- do \
141- { \
142- int flags; \
143- __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \
144- \
145- /* Only perform the name test if necessary. */ \
146- if (middle > left \
147- /* We haven't seen this string so far. Test whether the \
148- index is ok and whether the name matches. Otherwise \
149- we are done. */ \
150- && (! _dl_cache_verify_ptr (lib->key) \
151- || (_dl_cache_libcmp (name, cache_data + lib->key) \
152- != 0))) \
153- break; \
154- \
155- flags = lib->flags; \
156- if (_dl_cache_check_flags (flags) \
157- && _dl_cache_verify_ptr (lib->value)) \
158- { \
159- if (best == NULL || flags == GLRO(dl_correct_cache_id)) \
160- { \
161- HWCAP_CHECK; \
162- best = cache_data + lib->value; \
163- \
164- if (flags == GLRO(dl_correct_cache_id)) \
165- /* We've found an exact match for the shared \
166- object and no general `ELF' release. Stop \
167- searching. */ \
168- break; \
169- } \
170- } \
171- } \
172- while (++middle <= right); \
173- break; \
174- } \
175- \
176- if (cmpres < 0) \
177- left = middle + 1; \
178- else \
179- right = middle - 1; \
180- } \
181- } \
182-while (0)
183-
184-
185 int
186-internal_function
187 _dl_cache_libcmp (const char *p1, const char *p2)
188 {
189 while (*p1 != '\0')
190@@ -172,139 +76,3 @@ _dl_cache_libcmp (const char *p1, const
191 }
192 return *p1 - *p2;
193 }
194-
195-
196-/* Look up NAME in ld.so.cache and return the file name stored there,
197- or null if none is found. */
198-
199-const char *
200-internal_function
201-_dl_load_cache_lookup (const char *name)
202-{
203- int left, right, middle;
204- int cmpres;
205- const char *cache_data;
206- uint32_t cache_data_size;
207- const char *best;
208-
209- /* Print a message if the loading of libs is traced. */
210- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0))
211- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE);
212-
213- if (cache == NULL)
214- {
215- /* Read the contents of the file. */
216- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize,
217- PROT_READ);
218-
219- /* We can handle three different cache file formats here:
220- - the old libc5/glibc2.0/2.1 format
221- - the old format with the new format in it
222- - only the new format
223- The following checks if the cache contains any of these formats. */
224- if (file != MAP_FAILED && cachesize > sizeof *cache
225- && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0)
226- {
227- size_t offset;
228- /* Looks ok. */
229- cache = file;
230-
231- /* Check for new version. */
232- offset = ALIGN_CACHE (sizeof (struct cache_file)
233- + cache->nlibs * sizeof (struct file_entry));
234-
235- cache_new = (struct cache_file_new *) ((void *) cache + offset);
236- if (cachesize < (offset + sizeof (struct cache_file_new))
237- || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW,
238- sizeof CACHEMAGIC_VERSION_NEW - 1) != 0)
239- cache_new = (void *) -1;
240- }
241- else if (file != MAP_FAILED && cachesize > sizeof *cache_new
242- && memcmp (file, CACHEMAGIC_VERSION_NEW,
243- sizeof CACHEMAGIC_VERSION_NEW - 1) == 0)
244- {
245- cache_new = file;
246- cache = file;
247- }
248- else
249- {
250- if (file != MAP_FAILED)
251- __munmap (file, cachesize);
252- cache = (void *) -1;
253- }
254-
255- assert (cache != NULL);
256- }
257-
258- if (cache == (void *) -1)
259- /* Previously looked for the cache file and didn't find it. */
260- return NULL;
261-
262- best = NULL;
263-
264- if (cache_new != (void *) -1)
265- {
266- uint64_t platform;
267-
268- /* This is where the strings start. */
269- cache_data = (const char *) cache_new;
270-
271- /* Now we can compute how large the string table is. */
272- cache_data_size = (const char *) cache + cachesize - cache_data;
273-
274- platform = _dl_string_platform (GLRO(dl_platform));
275- if (platform != (uint64_t) -1)
276- platform = 1ULL << platform;
277-
278-#define _DL_HWCAP_TLS_MASK (1LL << 63)
279- uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask))
280- | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK);
281-
282- /* Only accept hwcap if it's for the right platform. */
283-#define HWCAP_CHECK \
284- if (lib->hwcap & hwcap_exclude) \
285- continue; \
286- if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \
287- continue; \
288- if (_DL_PLATFORMS_COUNT \
289- && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \
290- && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \
291- continue
292- SEARCH_CACHE (cache_new);
293- }
294- else
295- {
296- /* This is where the strings start. */
297- cache_data = (const char *) &cache->libs[cache->nlibs];
298-
299- /* Now we can compute how large the string table is. */
300- cache_data_size = (const char *) cache + cachesize - cache_data;
301-
302-#undef HWCAP_CHECK
303-#define HWCAP_CHECK do {} while (0)
304- SEARCH_CACHE (cache);
305- }
306-
307- /* Print our result if wanted. */
308- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)
309- && best != NULL)
310- _dl_debug_printf (" trying file=%s\n", best);
311-
312- return best;
313-}
314-
315-#ifndef MAP_COPY
316-/* If the system does not support MAP_COPY we cannot leave the file open
317- all the time since this would create problems when the file is replaced.
318- Therefore we provide this function to close the file and open it again
319- once needed. */
320-void
321-_dl_unload_cache (void)
322-{
323- if (cache != NULL && cache != (struct cache_file *) -1)
324- {
325- __munmap (cache, cachesize);
326- cache = NULL;
327- }
328-}
329-#endif
330Index: ldconfig-native-2.12.1/dl-cache.h
331===================================================================
332--- ldconfig-native-2.12.1.orig/dl-cache.h
333+++ ldconfig-native-2.12.1/dl-cache.h
334@@ -101,5 +101,4 @@ struct cache_file_new
335 (((addr) + __alignof__ (struct cache_file_new) -1) \
336 & (~(__alignof__ (struct cache_file_new) - 1)))
337
338-extern int _dl_cache_libcmp (const char *p1, const char *p2)
339- internal_function;
340+extern int _dl_cache_libcmp (const char *p1, const char *p2);
341Index: ldconfig-native-2.12.1/ldconfig.c
342===================================================================
343--- ldconfig-native-2.12.1.orig/ldconfig.c
344+++ ldconfig-native-2.12.1/ldconfig.c
345@@ -16,6 +16,9 @@
346 along with this program; if not, write to the Free Software Foundation,
347 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
348
349+#define _LARGEFILE64_SOURCE
350+#define _GNU_SOURCE
351+
352 #define PROCINFO_CLASS static
353 #include <alloca.h>
354 #include <argp.h>
355@@ -39,10 +42,20 @@
356 #include <glob.h>
357 #include <libgen.h>
358
359-#include <ldconfig.h>
360-#include <dl-cache.h>
361+#include "ldconfig.h"
362+#include "dl-cache.h"
363+
364+#include "dl-procinfo.h"
365+
366+#include "argp.h"
367+
368+
369+#define SYSCONFDIR "/etc"
370+#define LIBDIR "/usr/lib"
371+#define SLIBDIR "/lib"
372+# define N_(msgid) msgid
373+#define _(msg) msg
374
375-#include <dl-procinfo.h>
376
377 #ifdef _DL_FIRST_PLATFORM
378 # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)
379@@ -55,7 +68,7 @@
380 #endif
381
382 /* Get libc version number. */
383-#include <version.h>
384+#include "version.h"
385
386 #define PACKAGE _libc_intl_domainname
387
388@@ -152,8 +165,8 @@ static const struct argp_option options[
389 { NULL, 0, NULL, 0, NULL, 0 }
390 };
391
392-#define PROCINFO_CLASS static
393-#include <dl-procinfo.c>
394+//#define PROCINFO_CLASS static
395+//#include <dl-procinfo.c>
396
397 /* Short description of program. */
398 static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings.");
399@@ -291,6 +304,7 @@ parse_opt (int key, char *arg, struct ar
400 return 0;
401 }
402
403+#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org"
404 /* Print bug-reporting information in the help message. */
405 static char *
406 more_help (int key, const char *text, void *input)
407@@ -315,7 +329,7 @@ For bug reporting instructions, please s
408 static void
409 print_version (FILE *stream, struct argp_state *state)
410 {
411- fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION);
412+ fprintf (stream, "ldconfig (Hacked Poky Version)\n");
413 fprintf (stream, gettext ("\
414 Copyright (C) %s Free Software Foundation, Inc.\n\
415 This is free software; see the source for copying conditions. There is NO\n\
416@@ -1233,6 +1247,7 @@ set_hwcap (void)
417 hwcap_mask = strtoul (mask, NULL, 0);
418 }
419
420+const char _libc_intl_domainname[] = "libc";
421
422 int
423 main (int argc, char **argv)
424Index: ldconfig-native-2.12.1/readlib.c
425===================================================================
426--- ldconfig-native-2.12.1.orig/readlib.c
427+++ ldconfig-native-2.12.1/readlib.c
428@@ -22,6 +22,9 @@
429 development version. Besides the simplification, it has also been
430 modified to read some other file formats. */
431
432+#define _LARGEFILE64_SOURCE
433+#define _GNU_SOURCE
434+
435 #include <a.out.h>
436 #include <elf.h>
437 #include <error.h>
438@@ -35,7 +38,9 @@
439 #include <sys/stat.h>
440 #include <gnu/lib-names.h>
441
442-#include <ldconfig.h>
443+#include "ldconfig.h"
444+
445+#define _(msg) msg
446
447 #define Elf32_CLASS ELFCLASS32
448 #define Elf64_CLASS ELFCLASS64
449Index: ldconfig-native-2.12.1/xstrdup.c
450===================================================================
451--- ldconfig-native-2.12.1.orig/xstrdup.c
452+++ ldconfig-native-2.12.1/xstrdup.c
453@@ -16,15 +16,10 @@
454 along with this program; if not, write to the Free Software Foundation,
455 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
456
457-#ifdef HAVE_CONFIG_H
458-# include <config.h>
459-#endif
460+#define _GNU_SOURCE
461+
462+#include <string.h>
463
464-#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC
465-# include <string.h>
466-#else
467-# include <strings.h>
468-#endif
469 void *xmalloc (size_t n) __THROW;
470 char *xstrdup (char *string) __THROW;
471
diff --git a/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
new file mode 100644
index 0000000000..27bc411078
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch
@@ -0,0 +1,36 @@
1Upstream-Status: Pending
2
3Coming from this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11149
4
5Nitin A Kamble <nitin.a.kamble@intel.com>2011/03/29
6
7--- ldconfig-native-2.12.1.orig/ldconfig.c
8+++ ldconfig-native-2.12.1/ldconfig.c
9@@ -1359,14 +1359,9 @@ main (int argc, char **argv)
10
11 const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;
12 if (opt_chroot)
13- {
14- aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
15- if (aux_cache_file == NULL)
16- error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"),
17- _PATH_LDCONFIG_AUX_CACHE);
18- }
19+ aux_cache_file = chroot_canon (opt_chroot, aux_cache_file);
20
21- if (! opt_ignore_aux_cache)
22+ if (! opt_ignore_aux_cache && aux_cache_file)
23 load_aux_cache (aux_cache_file);
24 else
25 init_aux_cache ();
26@@ -1376,7 +1371,8 @@ main (int argc, char **argv)
27 if (opt_build_cache)
28 {
29 save_cache (cache_file);
30- save_aux_cache (aux_cache_file);
31+ if (aux_cache_file)
32+ save_aux_cache (aux_cache_file);
33 }
34
35 return 0;
36
diff --git a/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
new file mode 100644
index 0000000000..1debf8ee2f
--- /dev/null
+++ b/meta/recipes-core/glibc/ldconfig-native_2.12.1.bb
@@ -0,0 +1,33 @@
1SUMMARY = "A standalone native ldconfig build"
2
3LICENSE = "GPLv2+"
4
5LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399"
6
7SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \
8 file://ldconfig.patch \
9 file://ldconfig_aux-cache_path_fix.patch \
10 file://32and64bit.patch \
11 file://endian-ness_handling.patch \
12 file://flag_fix.patch \
13 file://endianess-header.patch \
14 file://ldconfig-default-to-all-multilib-dirs.patch \
15 file://endian-ness_handling_fix.patch \
16"
17
18PR = "r2"
19
20FILESEXTRAPATHS =. "${FILE_DIRNAME}/${P}:"
21
22inherit native
23
24S = "${WORKDIR}/${PN}-${PV}"
25
26do_compile () {
27 $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig
28}
29
30do_install () {
31 install -d ${D}/${bindir}/
32 install ldconfig ${D}/${bindir}/
33}
diff --git a/meta/recipes-core/glibc/site_config/funcs b/meta/recipes-core/glibc/site_config/funcs
new file mode 100644
index 0000000000..ccc85392d7
--- /dev/null
+++ b/meta/recipes-core/glibc/site_config/funcs
@@ -0,0 +1,474 @@
1a64l
2abs
3access
4__adjtimex
5alarm
6alphasort
7argz_append
8__argz_count
9argz_create_sep
10argz_insert
11__argz_next
12argz_next
13__argz_stringify
14argz_stringify
15asprintf
16atexit
17atof
18atoi
19bcmp
20bcopy
21bindresvport
22bind_textdomain_codeset
23btowc
24bzero
25calloc
26canonicalize_file_name
27catgets
28cfgetospeed
29cfsetispeed
30cfsetspeed
31chmod
32chown
33chroot
34clock
35close
36closedir
37closelog
38confstr
39connect
40daemon
41dcgettext
42difftime
43dirfd
44dirname
45dngettext
46dup2
47ecvt
48endgrent
49endmntent
50endpwent
51endutent
52endutxent
53epoll_ctl
54err
55ether_hostton
56ether_ntohost
57euidaccess
58execv
59fchdir
60fchmod
61fchmodat
62fchown
63fchownat
64fcntl
65fcvt
66fdatasync
67fdopendir
68feof_unlocked
69fgets_unlocked
70fgetxattr
71finite
72flistxattr
73flock
74flockfile
75fnmatch
76fork
77fpathconf
78__fpending
79fprintf
80free
81freeaddrinfo
82freeifaddrs
83fseeko
84__fsetlocking
85fsetxattr
86fstat64
87fstat
88fstatfs
89fsync
90ftello
91ftime
92ftruncate
93funlockfile
94futimes
95futimesat
96gai_strerror
97gcvt
98getaddrinfo
99getc_unlocked
100getcwd
101getdelim
102getdomainname
103getdtablesize
104getegid
105getenv
106geteuid
107getgid
108getgrent
109getgrent_r
110getgrgid_r
111getgrnam
112getgrnam_r
113getgrouplist
114getgroups
115gethostbyaddr_r
116gethostbyname2
117gethostbyname
118gethostbyname_r
119gethostent
120gethostid
121gethostname
122getifaddrs
123getline
124getloadavg
125getmntent
126getmsg
127getnameinfo
128getnetbyaddr_r
129getnetgrent_r
130getopt
131getopt_long
132getopt_long_only
133getpagesize
134getpass
135getpeername
136getpgrp
137getpid
138getppid
139getprotoent_r
140getpwent
141getpwent_r
142getpwnam
143getpwnam_r
144getpwuid
145getpwuid_r
146getresuid
147getrlimit
148getrusage
149getservbyname
150getservbyname_r
151getservbyport_r
152getservent
153getservent_r
154getspnam
155getspnam_r
156gettimeofday
157getttyent
158getttynam
159getuid
160getusershell
161getutent
162getutid
163getutline
164getutmp
165getutmpx
166getutxent
167getutxid
168getutxline
169getwd
170getxattr
171glob
172gmtime
173gmtime_r
174grantpt
175group_member
176herror
177hstrerror
178iconv
179iconv_open
180if_freenameindex
181if_indextoname
182if_nameindex
183if_nametoindex
184index
185inet_addr
186inet_aton
187inet_ntoa
188inet_ntop
189inet_pton
190initgroups
191innetgr
192iruserok
193isascii
194isatty
195isblank
196isgraph
197isinf
198isnan
199isprint
200isspace
201iswalnum
202iswcntrl
203iswctype
204iswprint
205iswspace
206iswupper
207isxdigit
208kill
209killpg
210lchown
211lckpwdf
212lgetxattr
213link
214listxattr
215llistxattr
216localtime
217localtime_r
218lockf
219lrand48
220lsearch
221lseek64
222lsetxattr
223lstat
224mallinfo
225malloc
226mblen
227mbrlen
228mbrtowc
229mbsinit
230mbsrtowcs
231mbtowc
232memalign
233memchr
234memcmp
235memcpy
236memmove
237mempcpy
238memrchr
239memset
240mkdir
241mkdirat
242mkdtemp
243mkfifo
244mknod
245mkstemp64
246mkstemp
247mktime
248mlock
249mmap
250mtrace
251munlock
252munmap
253nanosleep
254nice
255nl_langinfo
256ntp_adjtime
257ntp_gettime
258_obstack_free
259on_exit
260open64
261open
262openat
263opendir
264openlog
265pathconf
266pipe
267poll
268popen
269posix_memalign
270prctl
271pread
272printf
273__progname
274pselect
275pthread_mutex_lock
276ptsname
277putenv
278putgrent
279putpwent
280putspent
281pututline
282pututxline
283putwc
284pwrite
285qsort
286raise
287rand
288random
289rand_r
290read
291readdir
292readdir_r
293readlink
294realloc
295realpath
296re_comp
297recvmsg
298re_exec
299regcomp
300regexec
301remove
302rename
303re_search
304rmdir
305rpmatch
306rresvport_af
307ruserok
308ruserok_af
309sbrk
310scandir
311sched_setscheduler
312sched_yield
313__secure_getenv
314select
315semctl
316semget
317sendmsg
318setbuf
319setbuffer
320setegid
321setenv
322seteuid
323setgid
324setgroups
325sethostname
326setitimer
327_setjmp
328setjmp
329setlinebuf
330setlocale
331setmntent
332setpgid
333setpgrp
334setpriority
335setregid
336setresgid
337setresuid
338setreuid
339setrlimit
340setsid
341setsockopt
342settimeofday
343setuid
344setutent
345setutxent
346setvbuf
347setxattr
348sgetspent
349shmat
350shmctl
351shmdt
352shmget
353shutdown
354sigaction
355sigaddset
356sigaltstack
357sigblock
358sigemptyset
359sighold
360siginterrupt
361signal
362sigprocmask
363sigset
364sigsetmask
365sigstack
366sigsuspend
367sigvec
368snprintf
369socket
370socketpair
371sprintf
372srand48
373srand
374srandom
375sscanf
376stat
377statfs
378statvfs
379stime
380stpcpy
381strcasecmp
382strcasestr
383strchr
384strchrnul
385strcmp
386strcspn
387strdup
388strerror
389strerror_r
390strftime
391strlen
392strncasecmp
393strncmp
394strndup
395strnlen
396strpbrk
397strptime
398strrchr
399strsep
400strsignal
401strspn
402strstr
403strtod
404strtoimax
405strtok_r
406strtol
407strtoll
408strtoul
409strtoull
410strtoumax
411strverscmp
412strxfrm
413symlink
414sync
415sysconf
416sysctl
417sysinfo
418syslog
419_sys_siglist
420sys_siglist
421system
422tcgetattr
423tcgetpgrp
424tcsetattr
425tcsetpgrp
426time
427timegm
428times
429timezone
430tmpnam
431towlower
432towupper
433truncate
434tsearch
435ttyname
436tzset
437ulimit
438umask
439uname
440unlink
441unsetenv
442unshare
443updwtmp
444updwtmpx
445usleep
446ustat
447utime
448utimes
449utmpname
450utmpxname
451valloc
452vasprintf
453verrx
454vfork
455vfprintf
456vfscanf
457vhangup
458vprintf
459vsnprintf
460vsprintf
461wait3
462wait4
463waitpid
464wcrtomb
465wcscoll
466wcsdup
467wcslen
468wctob
469wctomb
470wctype
471wcwidth
472wmemchr
473wmemcpy
474wmempcpy
diff --git a/meta/recipes-core/glibc/site_config/headers b/meta/recipes-core/glibc/site_config/headers
new file mode 100644
index 0000000000..609ab53797
--- /dev/null
+++ b/meta/recipes-core/glibc/site_config/headers
@@ -0,0 +1,156 @@
1aio.h
2alloca.h
3argz.h
4arpa/inet.h
5arpa/nameser.h
6asm/byteorder.h
7asm/ioctls.h
8asm/page.h
9asm/types.h
10assert.h
11byteswap.h
12crypt.h
13ctype.h
14dirent.h
15dlfcn.h
16elf.h
17endian.h
18err.h
19errno.h
20execinfo.h
21fcntl.h
22features.h
23float.h
24fstab.h
25ftw.h
26getopt.h
27glob.h
28grp.h
29iconv.h
30ifaddrs.h
31inttypes.h
32langinfo.h
33lastlog.h
34libgen.h
35libintl.h
36limits.h
37linux/capability.h
38linux/fd.h
39linux/fs.h
40linux/hayesesp.h
41linux/hdreg.h
42linux/icmp.h
43linux/in6.h
44linux/joystick.h
45linux/ptrace.h
46linux/serial.h
47linux/sonypi.h
48linux/unistd.h
49linux/utsname.h
50linux/version.h
51locale.h
52malloc.h
53math.h
54mcheck.h
55memory.h
56mntent.h
57mqueue.h
58netdb.h
59net/if.h
60netinet/ether.h
61netinet/in.h
62netinet/ip6.h
63netinet/ip.h
64netinet/tcp.h
65netinet/udp.h
66netipx/ipx.h
67net/route.h
68paths.h
69poll.h
70pthread.h
71pty.h
72pwd.h
73regex.h
74resolv.h
75rpc/rpc.h
76rpc/types.h
77sched.h
78scsi/scsi.h
79search.h
80semaphore.h
81setjmp.h
82sgtty.h
83shadow.h
84signal.h
85stdarg.h
86stdbool.h
87stdc
88stddef.h
89stdint.h
90stdio.h
91stdlib.h
92string.h
93strings.h
94stropts.h
95sys/bitypes.h
96sys/cdefs.h
97sys/dir.h
98sys/epoll.h
99sysexits.h
100sys/fcntl.h
101sys/file.h
102sys/fsuid.h
103sys/ioctl.h
104sys/ipc.h
105syslog.h
106sys/mman.h
107sys/mount.h
108sys/mtio.h
109sys/param.h
110sys/poll.h
111sys/prctl.h
112sys/ptrace.h
113sys/queue.h
114sys/reg.h
115sys/resource.h
116sys/select.h
117sys/sem.h
118sys/shm.h
119sys/signal.h
120sys/socket.h
121sys/socketvar.h
122sys/soundcard.h
123sys/statfs.h
124sys/stat.h
125sys/statvfs.h
126sys/stropts.h
127sys/swap.h
128sys/sysctl.h
129sys/sysinfo.h
130sys/sysmacros.h
131sys/termios.h
132sys/timeb.h
133sys/time.h
134sys/times.h
135sys/timex.h
136sys/types.h
137sys/uio.h
138sys/un.h
139sys/unistd.h
140sys/user.h
141sys/utsname.h
142sys/vfs.h
143sys/wait.h
144termio.h
145termios.h
146time.h
147ttyent.h
148ulimit.h
149unistd.h
150ustat.h
151utime.h
152utmp.h
153utmpx.h
154values.h
155wchar.h
156wctype.h
diff --git a/meta/recipes-core/glibc/site_config/types b/meta/recipes-core/glibc/site_config/types
new file mode 100644
index 0000000000..178bd85a00
--- /dev/null
+++ b/meta/recipes-core/glibc/site_config/types
@@ -0,0 +1,21 @@
1char
2char *
3double
4float
5int
6long
7long double
8long int
9long long
10long long int
11short
12short int
13signed char
14unsigned char
15unsigned int
16unsigned long
17unsigned long int
18unsigned long long int
19unsigned short
20unsigned short int
21void *
diff --git a/meta/recipes-core/images/build-appliance-image_8.0.bb b/meta/recipes-core/images/build-appliance-image_8.0.bb
new file mode 100644
index 0000000000..fe2b7b18a7
--- /dev/null
+++ b/meta/recipes-core/images/build-appliance-image_8.0.bb
@@ -0,0 +1,93 @@
1SUMMARY = "An image containing the build system itself"
2DESCRIPTION = "An image containing the build system that you can boot and run using either VMware Player or VMware Workstation."
3HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
4
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
7 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
8
9IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted"
10
11IMAGE_FEATURES += "x11-base package-management splash"
12
13# Ensure there's enough space to do a core-image-sato build, with rm_work enabled
14IMAGE_ROOTFS_EXTRA_SPACE = "41943040"
15
16# Do a quiet boot with limited console messages
17APPEND += "quiet"
18
19DEPENDS = "zip-native"
20IMAGE_FSTYPES = "vmdk"
21
22inherit core-image
23
24SRCREV ?= "c4ebd5d28b75e844a1bd146dbfac205f64cc8915"
25SRC_URI = "git://git.yoctoproject.org/poky;branch=dizzy \
26 file://Yocto_Build_Appliance.vmx \
27 file://Yocto_Build_Appliance.vmxf \
28 "
29
30IMAGE_CMD_ext3_append () {
31 # We don't need to reserve much space for root, 0.5% is more than enough
32 tune2fs -m 0.5 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3
33}
34
35fakeroot do_populate_poky_src () {
36 # Because fetch2's git's unpack uses -s cloneflag, the unpacked git repo
37 # will become invalid in the target.
38 rm -rf ${WORKDIR}/git/.git
39 rm -f ${WORKDIR}/git/.gitignore
40
41 cp -Rp ${WORKDIR}/git ${IMAGE_ROOTFS}/home/builder/poky
42
43 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/conf
44 mkdir -p ${IMAGE_ROOTFS}/home/builder/poky/build/downloads
45 cp -RpL ${DL_DIR}/* ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/
46
47 # Remove the git2_* tarballs -- this is ok since we still have the git2/.
48 rm -rf ${IMAGE_ROOTFS}/home/builder/poky/build/downloads/git2_*
49
50 echo "/usr/bin" > ${IMAGE_ROOTFS}/home/builder/poky/build/pseudodone
51 echo "INHERIT += \"rm_work\"" >> ${IMAGE_ROOTFS}/home/builder/poky/build/conf/auto.conf
52 mkdir -p ${IMAGE_ROOTFS}/home/builder/pseudo
53 echo "export PSEUDO_PREFIX=/usr" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
54 echo "export PSEUDO_LOCALSTATEDIR=/home/builder/pseudo" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
55 echo "export PSEUDO_LIBDIR=/usr/lib/pseudo/lib64" >> ${IMAGE_ROOTFS}/home/builder/.bashrc
56
57 chown builder.builder ${IMAGE_ROOTFS}/home/builder/pseudo
58
59 chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/poky
60
61 # Allow builder to use sudo to setup tap/tun
62 echo "builder ALL=(ALL) NOPASSWD: ALL" >> ${IMAGE_ROOTFS}/etc/sudoers
63
64 # Use Clearlooks GTK+ theme
65 mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
66 echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
67}
68
69IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
70
71addtask rootfs after do_unpack
72
73python () {
74 # Ensure we run these usually noexec tasks
75 d.delVarFlag("do_fetch", "noexec")
76 d.delVarFlag("do_unpack", "noexec")
77}
78
79create_bundle_files () {
80 cd ${WORKDIR}
81 mkdir -p Yocto_Build_Appliance
82 cp *.vmx* Yocto_Build_Appliance
83 ln -sf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.vmdk Yocto_Build_Appliance/Yocto_Build_Appliance.vmdk
84 zip -r ${DEPLOY_DIR_IMAGE}/Yocto_Build_Appliance-${DATETIME}.zip Yocto_Build_Appliance
85 ln -sf Yocto_Build_Appliance-${DATETIME}.zip ${DEPLOY_DIR_IMAGE}/Yocto_Build_Appliance.zip
86}
87
88python do_bundle_files() {
89 bb.build.exec_func('create_bundle_files', d)
90}
91
92addtask bundle_files after do_vmdkimg before do_build
93do_bundle_files[nostamp] = "1"
diff --git a/meta/recipes-core/images/core-image-base.bb b/meta/recipes-core/images/core-image-base.bb
new file mode 100644
index 0000000000..75a08cfc92
--- /dev/null
+++ b/meta/recipes-core/images/core-image-base.bb
@@ -0,0 +1,8 @@
1SUMMARY = "A console-only image that fully supports the target device \
2hardware."
3
4IMAGE_FEATURES += "splash"
5
6LICENSE = "MIT"
7
8inherit core-image
diff --git a/meta/recipes-core/images/core-image-minimal-dev.bb b/meta/recipes-core/images/core-image-minimal-dev.bb
new file mode 100644
index 0000000000..93ead20553
--- /dev/null
+++ b/meta/recipes-core/images/core-image-minimal-dev.bb
@@ -0,0 +1,7 @@
1require core-image-minimal.bb
2
3DESCRIPTION = "A small image just capable of allowing a device to boot and \
4is suitable for development work."
5
6IMAGE_FEATURES += "dev-pkgs"
7
diff --git a/meta/recipes-core/images/core-image-minimal-initramfs.bb b/meta/recipes-core/images/core-image-minimal-initramfs.bb
new file mode 100644
index 0000000000..1f0fa9580b
--- /dev/null
+++ b/meta/recipes-core/images/core-image-minimal-initramfs.bb
@@ -0,0 +1,21 @@
1# Simple initramfs image. Mostly used for live images.
2DESCRIPTION = "Small image capable of booting a device. The kernel includes \
3the Minimal RAM-based Initial Root Filesystem (initramfs), which finds the \
4first 'init' program more efficiently."
5
6PACKAGE_INSTALL = "initramfs-live-boot initramfs-live-install initramfs-live-install-efi busybox udev base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}"
7
8# Do not pollute the initrd image with rootfs features
9IMAGE_FEATURES = ""
10
11export IMAGE_BASENAME = "core-image-minimal-initramfs"
12IMAGE_LINGUAS = ""
13
14LICENSE = "MIT"
15
16IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
17inherit core-image
18
19IMAGE_ROOTFS_SIZE = "8192"
20
21BAD_RECOMMENDATIONS += "busybox-syslog"
diff --git a/meta/recipes-core/images/core-image-minimal-mtdutils.bb b/meta/recipes-core/images/core-image-minimal-mtdutils.bb
new file mode 100644
index 0000000000..c92234c082
--- /dev/null
+++ b/meta/recipes-core/images/core-image-minimal-mtdutils.bb
@@ -0,0 +1,7 @@
1require core-image-minimal.bb
2
3DESCRIPTION = "Small image capable of booting a device with support for the \
4Minimal MTD Utilities, which let the user interact with the MTD subsystem in \
5the kernel to perform operations on flash devices."
6
7IMAGE_INSTALL += "mtd-utils"
diff --git a/meta/recipes-core/images/core-image-minimal.bb b/meta/recipes-core/images/core-image-minimal.bb
new file mode 100644
index 0000000000..9716274c34
--- /dev/null
+++ b/meta/recipes-core/images/core-image-minimal.bb
@@ -0,0 +1,12 @@
1SUMMARY = "A small image just capable of allowing a device to boot."
2
3IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
4
5IMAGE_LINGUAS = " "
6
7LICENSE = "MIT"
8
9inherit core-image
10
11IMAGE_ROOTFS_SIZE ?= "8192"
12
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright
new file mode 100644
index 0000000000..2a8e0d1264
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/copyright
@@ -0,0 +1,11 @@
1This package was created by Peter Tobias tobias@et-inf.fho-emden.de on
2Wed, 24 Aug 1994 21:33:28 +0200 and maintained by Anthony Towns
3<ajt@debian.org> until 2001.
4It is currently maintained by Marco d'Itri <md@linux.it>.
5
6Copyright 1994-2010 Peter Tobias, Anthony Towns and Marco d'Itri
7
8The programs in this package are distributed under the terms of the GNU
9General Public License, version 2 as distributed by the Free Software
10Foundation. On Debian systems, a copy of this license may be found in
11/usr/share/common-licenses/GPL-2.
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
new file mode 100644
index 0000000000..fb31c635be
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
@@ -0,0 +1,90 @@
1#!/bin/sh -e
2### BEGIN INIT INFO
3# Provides: networking
4# Required-Start: mountvirtfs $local_fs
5# Required-Stop: $local_fs
6# Should-Start: ifupdown
7# Should-Stop: ifupdown
8# Default-Start: S
9# Default-Stop: 0 6
10# Short-Description: Raise network interfaces.
11### END INIT INFO
12
13PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
14
15[ -x /sbin/ifup ] || exit 0
16
17check_network_file_systems() {
18 [ -e /proc/mounts ] || return 0
19
20 if [ -e /etc/iscsi/iscsi.initramfs ]; then
21 echo "not deconfiguring network interfaces: iSCSI root is mounted."
22 exit 0
23 fi
24
25 exec 9<&0 < /proc/mounts
26 while read DEV MTPT FSTYPE REST; do
27 case $DEV in
28 /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
29 echo "not deconfiguring network interfaces: network devices still mounted."
30 exit 0
31 ;;
32 esac
33 case $FSTYPE in
34 nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
35 echo "not deconfiguring network interfaces: network file systems still mounted."
36 exit 0
37 ;;
38 esac
39 done
40 exec 0<&9 9<&-
41}
42
43check_network_swap() {
44 [ -e /proc/swaps ] || return 0
45
46 exec 9<&0 < /proc/swaps
47 while read DEV MTPT FSTYPE REST; do
48 case $DEV in
49 /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
50 echo "not deconfiguring network interfaces: network swap still mounted."
51 exit 0
52 ;;
53 esac
54 done
55 exec 0<&9 9<&-
56}
57
58case "$1" in
59start)
60 echo -n "Configuring network interfaces... "
61 sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
62 ifup -a
63 echo "done."
64 ;;
65
66stop)
67 check_network_file_systems
68 check_network_swap
69
70 echo -n "Deconfiguring network interfaces... "
71 ifdown -a
72 echo "done."
73 ;;
74
75force-reload|restart)
76 echo "Running $0 $1 is deprecated because it may not enable again some interfaces"
77 echo "Reconfiguring network interfaces... "
78 ifdown -a || true
79 ifup -a
80 echo "done."
81 ;;
82
83*)
84 echo "Usage: /etc/init.d/networking {start|stop}"
85 exit 1
86 ;;
87esac
88
89exit 0
90
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces
new file mode 100644
index 0000000000..0acf4cf441
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/interfaces
@@ -0,0 +1,31 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7# Wireless interfaces
8iface wlan0 inet dhcp
9 wireless_mode managed
10 wireless_essid any
11 wpa-driver wext
12 wpa-conf /etc/wpa_supplicant.conf
13
14iface atml0 inet dhcp
15
16# Wired or wireless interfaces
17auto eth0
18iface eth0 inet dhcp
19iface eth1 inet dhcp
20
21# Ethernet/RNDIS gadget (g_ether)
22# ... or on host side, usbnet and random hwaddr
23iface usb0 inet static
24 address 192.168.7.2
25 netmask 255.255.255.0
26 network 192.168.7.0
27 gateway 192.168.7.1
28
29# Bluetooth networking
30iface bnep0 inet dhcp
31
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
new file mode 100644
index 0000000000..750c0a98f9
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/nfsroot
@@ -0,0 +1,39 @@
1#! /bin/sh
2
3# In case the interface is used as nfsroot, avoid ifup, otherwise
4# nfsroot may lose response
5
6nfsroot=0
7
8if test "x$IFACE" = xlo ; then
9 exit 0
10fi
11
12exec 9<&0 < /proc/mounts
13while read dev mtpt fstype rest; do
14 if test $mtpt = "/" ; then
15 case $fstype in
16 nfs | nfs4)
17 nfsroot=1
18 nfs_addr=`echo $rest | sed -e 's/^.*addr=\([0-9.]*\).*$/\1/'`
19 break
20 ;;
21 *)
22 ;;
23 esac
24 fi
25done
26exec 0<&9 9<&-
27
28test $nfsroot -eq 0 && exit 0
29
30if [ -x /bin/ip -o -x /sbin/ip ] ; then
31 nfs_iface=`ip route get $nfs_addr | grep dev | sed -e 's/^.*dev \([-a-z0-9.]*\).*$/\1/'`
32fi
33
34if test "x$IFACE" = "x$nfs_iface" ; then
35 echo "ifup skipped for nfsroot interface $nfs_iface"
36 exit 1
37fi
38
39exit 0
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces
new file mode 100644
index 0000000000..16967763e5
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarm/interfaces
@@ -0,0 +1,5 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface 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
new file mode 100644
index 0000000000..16967763e5
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv6/interfaces
@@ -0,0 +1,5 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface 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
new file mode 100644
index 0000000000..16967763e5
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuarmv7/interfaces
@@ -0,0 +1,5 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface 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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemumips64/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemuppc/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemush4/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86-64/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
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
new file mode 100644
index 0000000000..f62b9a897d
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/qemux86/interfaces
@@ -0,0 +1,8 @@
1# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
2
3# The loopback interface
4auto lo
5iface lo inet loopback
6
7
8
diff --git a/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
new file mode 100644
index 0000000000..3d88506c05
--- /dev/null
+++ b/meta/recipes-core/init-ifupdown/init-ifupdown_1.0.bb
@@ -0,0 +1,39 @@
1SUMMARY = "Basic TCP/IP networking init scripts and configuration files"
2DESCRIPTION = "This package provides high level tools to configure network interfaces"
3HOMEPAGE = "http://packages.debian.org/ifupdown"
4SECTION = "base"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://${WORKDIR}/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
7PR = "r7"
8
9inherit update-rc.d
10
11INITSCRIPT_NAME = "networking"
12INITSCRIPT_PARAMS = "start 01 2 3 4 5 . stop 80 0 6 1 ."
13
14SRC_URI = "file://copyright \
15 file://init \
16 file://interfaces \
17 file://nfsroot"
18
19do_install () {
20 install -d ${D}${sysconfdir}/init.d \
21 ${D}${sysconfdir}/network/if-pre-up.d \
22 ${D}${sysconfdir}/network/if-up.d \
23 ${D}${sysconfdir}/network/if-down.d \
24 ${D}${sysconfdir}/network/if-post-down.d
25 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/networking
26 install -m 0644 ${WORKDIR}/interfaces ${D}${sysconfdir}/network/interfaces
27 install -m 0755 ${WORKDIR}/nfsroot ${D}${sysconfdir}/network/if-pre-up.d
28}
29
30do_install_append_qemuall () {
31 # Disable network manager on machines that commonly do NFS booting
32 touch ${D}${sysconfdir}/network/nm-disabled-eth0
33}
34
35PACKAGE_ARCH_qemuall = "${MACHINE_ARCH}"
36RDEPENDS_${PN} = "netbase"
37RCONFLICTS_${PN} = "netbase (< 1:5.0)"
38
39CONFFILES_${PN} = "${sysconfdir}/network/interfaces"
diff --git a/meta/recipes-core/initrdscripts/files/init-boot.sh b/meta/recipes-core/initrdscripts/files/init-boot.sh
new file mode 100644
index 0000000000..e82eba025d
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-boot.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3PATH=/sbin:/bin:/usr/sbin:/usr/bin
4
5mkdir /proc
6mkdir /sys
7mount -t proc proc /proc
8mount -t sysfs sysfs /sys
9
10exec sh
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
new file mode 100644
index 0000000000..7a0b4d4406
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi-testfs.sh
@@ -0,0 +1,199 @@
1#!/bin/sh -e
2#
3# Copyright (c) 2012, Intel Corporation.
4# All rights reserved.
5#
6# install.sh [device_name] [rootfs_name]
7#
8
9PATH=/sbin:/bin:/usr/sbin:/usr/bin
10
11# We need 200 Mb for the boot partition
12boot_size=200
13
14# 50% for the second rootfs
15testfs_ratio=50
16
17found="no"
18
19echo "Searching for a hard drive..."
20for device in 'hda' 'hdb' 'sda' 'sdb' 'mmcblk0' 'mmcblk1'
21do
22 if [ -e /sys/block/${device}/removable ]; then
23 if [ "$(cat /sys/block/${device}/removable)" = "0" ]; then
24 found="yes"
25
26 while true; do
27 # Try sleeping here to avoid getting kernel messages
28 # obscuring/confusing user
29 sleep 5
30 echo "Found drive at /dev/${device}. Do you want to install this image there ? [y/n]"
31 read answer
32 if [ "$answer" = "y" ] ; then
33 break
34 fi
35
36 if [ "$answer" = "n" ] ; then
37 found=no
38 break
39 fi
40
41 echo "Please answer y or n"
42 done
43 fi
44 fi
45
46 if [ "$found" = "yes" ]; then
47 break;
48 fi
49
50done
51
52if [ "$found" = "no" ]; then
53 exit 1
54fi
55
56echo "Installing image on /dev/${device}"
57
58#
59# The udev automounter can cause pain here, kill it
60#
61rm -f /etc/udev/rules.d/automount.rules
62rm -f /etc/udev/scripts/mount*
63
64#
65# Unmount anything the automounter had mounted
66#
67umount /dev/${device}* 2> /dev/null || /bin/true
68
69mkdir -p /tmp
70cat /proc/mounts > /etc/mtab
71
72disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
73
74testfs_size=$((disk_size*testfs_ratio/100))
75rootfs_size=$((disk_size-boot_size-testfs_size))
76
77rootfs_start=$((boot_size))
78rootfs_end=$((rootfs_start+rootfs_size))
79testfs_start=$((rootfs_end))
80
81# MMC devices are special in a couple of ways
82# 1) they use a partition prefix character 'p'
83# 2) they are detected asynchronously (need rootwait)
84rootwait=""
85part_prefix=""
86if [ ! "${device#mmcblk}" = "${device}" ]; then
87 part_prefix="p"
88 rootwait="rootwait"
89fi
90bootfs=/dev/${device}${part_prefix}1
91rootfs=/dev/${device}${part_prefix}2
92testfs=/dev/${device}${part_prefix}3
93
94echo "*****************"
95echo "Boot partition size: $boot_size MB ($bootfs)"
96echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
97echo "Testfs partition size: $testfs_size MB ($testfs)"
98echo "*****************"
99echo "Deleting partition table on /dev/${device} ..."
100dd if=/dev/zero of=/dev/${device} bs=512 count=2
101
102echo "Creating new partition table on /dev/${device} ..."
103parted /dev/${device} mklabel gpt
104
105echo "Creating boot partition on $bootfs"
106parted /dev/${device} mkpart primary 0% $boot_size
107parted /dev/${device} set 1 boot on
108
109echo "Creating rootfs partition on $rootfs"
110parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
111
112echo "Creating testfs partition on $testfs"
113parted /dev/${device} mkpart primary $testfs_start 100%
114
115parted /dev/${device} print
116
117echo "Formatting $bootfs to vfat..."
118mkfs.vfat -n "boot" $bootfs
119
120echo "Formatting $rootfs to ext3..."
121mkfs.ext3 -L "platform" $rootfs
122
123echo "Formatting $testfs to ext3..."
124mkfs.ext3 -L "testrootfs" $testfs
125
126mkdir /ssd
127mkdir /rootmnt
128mkdir /bootmnt
129
130mount $rootfs /ssd
131mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /rootmnt
132
133echo "Copying rootfs files..."
134cp -a /rootmnt/* /ssd
135
136touch /ssd/etc/masterimage
137
138if [ -d /ssd/etc/ ] ; then
139 # We dont want udev to mount our root device while we're booting...
140 if [ -d /ssd/etc/udev/ ] ; then
141 echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist
142 fi
143fi
144
145umount /ssd
146umount /rootmnt
147
148echo "Preparing boot partition..."
149mount $bootfs /ssd
150
151EFIDIR="/ssd/EFI/BOOT"
152mkdir -p $EFIDIR
153cp /run/media/$1/vmlinuz /ssd
154# Copy the efi loader
155cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
156
157if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
158 GRUBCFG="$EFIDIR/grub.cfg"
159 cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
160 # Update grub config for the installed image
161 # Delete the install entry
162 sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
163 # Delete the initrd lines
164 sed -i "/initrd /d" $GRUBCFG
165 # Delete any LABEL= strings
166 sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
167 # Delete any root= strings
168 sed -i "s/ root=[^ ]*/ /" $GRUBCFG
169 # Add the root= and other standard boot options
170 sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
171fi
172
173if [ -d /run/media/$1/loader ]; then
174 GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
175 # copy config files for gummiboot
176 cp -dr /run/media/$1/loader /ssd
177 # delete the install entry
178 rm -f /ssd/loader/entries/install.conf
179 # delete the initrd lines
180 sed -i "/initrd /d" $GUMMIBOOT_CFGS
181 # delete any LABEL= strings
182 sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
183 # delete any root= strings
184 sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
185 # add the root= and other standard boot options
186 sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
187 # Add the test label
188 echo -ne "title test\nlinux /test-kernel\noptions root=$testfs rw $rootwait quiet\n" > /ssd/loader/entries/test.conf
189fi
190
191umount /ssd
192sync
193
194echo "Remove your installation media, and press ENTER"
195
196read enter
197
198echo "Rebooting..."
199reboot -f
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
new file mode 100644
index 0000000000..329586d74d
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -0,0 +1,230 @@
1#!/bin/sh -e
2#
3# Copyright (c) 2012, Intel Corporation.
4# All rights reserved.
5#
6# install.sh [device_name] [rootfs_name]
7#
8
9PATH=/sbin:/bin:/usr/sbin:/usr/bin
10
11# We need 20 Mb for the boot partition
12boot_size=20
13
14# 5% for swap
15swap_ratio=5
16
17# Get a list of hard drives
18hdnamelist=""
19live_dev_name=${1%%/*}
20live_dev_name=${live_dev_name%%[0-9]*}
21
22echo "Searching for hard drives ..."
23
24for device in `ls /sys/block/`; do
25 case $device in
26 loop*)
27 # skip loop device
28 ;;
29 sr*)
30 # skip CDROM device
31 ;;
32 ram*)
33 # skip ram device
34 ;;
35 *)
36 # skip the device LiveOS is on
37 # Add valid hard drive name to the list
38 if [ $device != $live_dev_name -a -e /dev/$device ]; then
39 hdnamelist="$hdnamelist $device"
40 fi
41 ;;
42 esac
43done
44
45TARGET_DEVICE_NAME=""
46for hdname in $hdnamelist; do
47 # Display found hard drives and their basic info
48 echo "-------------------------------"
49 echo /dev/$hdname
50 if [ -r /sys/block/$hdname/device/vendor ]; then
51 echo -n "VENDOR="
52 cat /sys/block/$hdname/device/vendor
53 fi
54 if [ -r /sys/block/$hdname/device/model ]; then
55 echo -n "MODEL="
56 cat /sys/block/$hdname/device/model
57 fi
58 if [ -r /sys/block/$hdname/device/uevent ]; then
59 echo -n "UEVENT="
60 cat /sys/block/$hdname/device/uevent
61 fi
62 echo
63 # Get user choice
64 while true; do
65 echo -n "Do you want to install this image there? [y/n] "
66 read answer
67 if [ "$answer" = "y" -o "$answer" = "n" ]; then
68 break
69 fi
70 echo "Please answer y or n"
71 done
72 if [ "$answer" = "y" ]; then
73 TARGET_DEVICE_NAME=$hdname
74 break
75 fi
76
77done
78
79if [ -n "$TARGET_DEVICE_NAME" ]; then
80 echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
81else
82 echo "No hard drive selected. Installation aborted."
83 exit 1
84fi
85
86device=$TARGET_DEVICE_NAME
87
88#
89# The udev automounter can cause pain here, kill it
90#
91rm -f /etc/udev/rules.d/automount.rules
92rm -f /etc/udev/scripts/mount*
93
94#
95# Unmount anything the automounter had mounted
96#
97umount /dev/${device}* 2> /dev/null || /bin/true
98
99mkdir -p /tmp
100cat /proc/mounts > /etc/mtab
101
102disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
103
104swap_size=$((disk_size*swap_ratio/100))
105rootfs_size=$((disk_size-boot_size-swap_size))
106
107rootfs_start=$((boot_size))
108rootfs_end=$((rootfs_start+rootfs_size))
109swap_start=$((rootfs_end))
110
111# MMC devices are special in a couple of ways
112# 1) they use a partition prefix character 'p'
113# 2) they are detected asynchronously (need rootwait)
114rootwait=""
115part_prefix=""
116if [ ! "${device#mmcblk}" = "${device}" ]; then
117 part_prefix="p"
118 rootwait="rootwait"
119fi
120bootfs=/dev/${device}${part_prefix}1
121rootfs=/dev/${device}${part_prefix}2
122swap=/dev/${device}${part_prefix}3
123
124echo "*****************"
125echo "Boot partition size: $boot_size MB ($bootfs)"
126echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
127echo "Swap partition size: $swap_size MB ($swap)"
128echo "*****************"
129echo "Deleting partition table on /dev/${device} ..."
130dd if=/dev/zero of=/dev/${device} bs=512 count=2
131
132echo "Creating new partition table on /dev/${device} ..."
133parted /dev/${device} mklabel gpt
134
135echo "Creating boot partition on $bootfs"
136parted /dev/${device} mkpart primary 0% $boot_size
137parted /dev/${device} set 1 boot on
138
139echo "Creating rootfs partition on $rootfs"
140parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
141
142echo "Creating swap partition on $swap"
143parted /dev/${device} mkpart primary $swap_start 100%
144
145parted /dev/${device} print
146
147echo "Formatting $bootfs to vfat..."
148mkfs.vfat $bootfs
149
150echo "Formatting $rootfs to ext3..."
151mkfs.ext3 $rootfs
152
153echo "Formatting swap partition...($swap)"
154mkswap $swap
155
156mkdir /tgt_root
157mkdir /src_root
158mkdir -p /boot
159
160# Handling of the target root partition
161mount $rootfs /tgt_root
162mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
163echo "Copying rootfs files..."
164cp -a /src_root/* /tgt_root
165if [ -d /tgt_root/etc/ ] ; then
166 echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab
167 echo "$bootfs /boot vfat defaults 1 2" >> /tgt_root/etc/fstab
168 # We dont want udev to mount our root device while we're booting...
169 if [ -d /tgt_root/etc/udev/ ] ; then
170 echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
171 fi
172fi
173
174umount /src_root
175
176# Handling of the target boot partition
177mount $bootfs /boot
178echo "Preparing boot partition..."
179
180EFIDIR="/boot/EFI/BOOT"
181mkdir -p $EFIDIR
182# Copy the efi loader
183cp /run/media/$1/EFI/BOOT/*.efi $EFIDIR
184
185if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
186 GRUBCFG="$EFIDIR/grub.cfg"
187 cp /run/media/$1/EFI/BOOT/grub.cfg $GRUBCFG
188 # Update grub config for the installed image
189 # Delete the install entry
190 sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
191 # Delete the initrd lines
192 sed -i "/initrd /d" $GRUBCFG
193 # Delete any LABEL= strings
194 sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
195 # Delete any root= strings
196 sed -i "s/ root=[^ ]*/ /" $GRUBCFG
197 # Add the root= and other standard boot options
198 sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
199fi
200
201if [ -d /run/media/$1/loader ]; then
202 GUMMIBOOT_CFGS="/boot/loader/entries/*.conf"
203 # copy config files for gummiboot
204 cp -dr /run/media/$1/loader /boot
205 # delete the install entry
206 rm -f /boot/loader/entries/install.conf
207 # delete the initrd lines
208 sed -i "/initrd /d" $GUMMIBOOT_CFGS
209 # delete any LABEL= strings
210 sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
211 # delete any root= strings
212 sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
213 # add the root= and other standard boot options
214 sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
215fi
216
217umount /tgt_root
218
219cp /run/media/$1/vmlinuz /boot
220
221umount /boot
222
223sync
224
225echo "Remove your installation media, and press ENTER"
226
227read enter
228
229echo "Rebooting..."
230reboot -f
diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
new file mode 100644
index 0000000000..ac62160528
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -0,0 +1,220 @@
1#!/bin/sh -e
2#
3# Copyright (C) 2008-2011 Intel
4#
5# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
6#
7
8PATH=/sbin:/bin:/usr/sbin:/usr/bin
9
10# We need 20 Mb for the boot partition
11boot_size=200
12
13# 50% for the the test partition
14testfs_ratio=50
15
16# Get a list of hard drives
17hdnamelist=""
18live_dev_name=${1%%/*}
19
20echo "Searching for hard drives ..."
21
22for device in `ls /sys/block/`; do
23 case $device in
24 loop*)
25 # skip loop device
26 ;;
27 ram*)
28 # skip ram device
29 ;;
30 *)
31 # skip the device LiveOS is on
32 # Add valid hard drive name to the list
33 if [ $device != $live_dev_name -a -e /dev/$device ]; then
34 hdnamelist="$hdnamelist $device"
35 fi
36 ;;
37 esac
38done
39
40TARGET_DEVICE_NAME=""
41for hdname in $hdnamelist; do
42 # Display found hard drives and their basic info
43 echo "-------------------------------"
44 echo /dev/$hdname
45 if [ -r /sys/block/$hdname/device/vendor ]; then
46 echo -n "VENDOR="
47 cat /sys/block/$hdname/device/vendor
48 fi
49 echo -n "MODEL="
50 cat /sys/block/$hdname/device/model
51 cat /sys/block/$hdname/device/uevent
52 echo
53 # Get user choice
54 while true; do
55 echo -n "Do you want to install this image there? [y/n] "
56 read answer
57 if [ "$answer" = "y" -o "$answer" = "n" ]; then
58 break
59 fi
60 echo "Please answer y or n"
61 done
62 if [ "$answer" = "y" ]; then
63 TARGET_DEVICE_NAME=$hdname
64 break
65 fi
66done
67
68if [ -n "$TARGET_DEVICE_NAME" ]; then
69 echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
70else
71 echo "No hard drive selected. Installation aborted."
72 exit 1
73fi
74
75device=$TARGET_DEVICE_NAME
76
77#
78# The udev automounter can cause pain here, kill it
79#
80rm -f /etc/udev/rules.d/automount.rules
81rm -f /etc/udev/scripts/mount*
82
83#
84# Unmount anything the automounter had mounted
85#
86umount /dev/${device}* 2> /dev/null || /bin/true
87
88if [ ! -b /dev/loop0 ] ; then
89 mknod /dev/loop0 b 7 0
90fi
91
92mkdir -p /tmp
93if [ ! -L /etc/mtab ]; then
94 cat /proc/mounts > /etc/mtab
95fi
96
97disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
98
99testfs_size=$((disk_size*testfs_ratio/100))
100rootfs_size=$((disk_size-boot_size-testfs_size))
101
102rootfs_start=$((boot_size))
103rootfs_end=$((rootfs_start+rootfs_size))
104testfs_start=$((rootfs_end))
105
106# MMC devices are special in a couple of ways
107# 1) they use a partition prefix character 'p'
108# 2) they are detected asynchronously (need rootwait)
109rootwait=""
110part_prefix=""
111if [ ! "${device#mmcblk}" = "${device}" ]; then
112 part_prefix="p"
113 rootwait="rootwait"
114fi
115bootfs=/dev/${device}${part_prefix}1
116rootfs=/dev/${device}${part_prefix}2
117testfs=/dev/${device}${part_prefix}3
118
119echo "*****************"
120echo "Boot partition size: $boot_size MB ($bootfs)"
121echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
122echo "Testfs partition size: $testfs_size MB ($testfs)"
123echo "*****************"
124echo "Deleting partition table on /dev/${device} ..."
125dd if=/dev/zero of=/dev/${device} bs=512 count=2
126
127echo "Creating new partition table on /dev/${device} ..."
128parted /dev/${device} mklabel msdos
129
130echo "Creating boot partition on $bootfs"
131parted /dev/${device} mkpart primary 0% $boot_size
132
133echo "Creating rootfs partition on $rootfs"
134parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
135
136echo "Creating testfs partition on $testfs"
137parted /dev/${device} mkpart primary $testfs_start 100%
138
139parted /dev/${device} print
140
141echo "Formatting $bootfs to ext3..."
142mkfs.ext3 -L "boot" $bootfs
143
144echo "Formatting $rootfs to ext3..."
145mkfs.ext3 -L "rootfs" $rootfs
146
147echo "Formatting $testfs to ext3..."
148mkfs.ext3 -L "testrootfs" $testfs
149
150mkdir /tgt_root
151mkdir /src_root
152mkdir -p /boot
153
154# Handling of the target root partition
155mount $rootfs /tgt_root
156mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
157
158echo "Copying rootfs files..."
159cp -a /src_root/* /tgt_root
160
161touch /tgt_root/etc/masterimage
162
163if [ -d /tgt_root/etc/ ] ; then
164 echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab
165 # We dont want udev to mount our root device while we're booting...
166 if [ -d /tgt_root/etc/udev/ ] ; then
167 echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
168 fi
169fi
170umount /tgt_root
171umount /src_root
172
173# Handling of the target boot partition
174mount $bootfs /boot
175echo "Preparing boot partition..."
176if [ -f /etc/grub.d/00_header ] ; then
177 echo "Preparing custom grub2 menu..."
178 GRUBCFG="/boot/grub/grub.cfg"
179 mkdir -p $(dirname $GRUBCFG)
180 cat >$GRUBCFG <<_EOF
181serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1
182terminal_input --append serial
183terminal_output --append serial
184set timeout_style=hidden
185set timeout=5
186menuentry "Linux" {
187 set root=(hd0,1)
188 linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
189}
190_EOF
191 # Add the test label
192 echo -ne "\nmenuentry 'test' --hotkey x {\nlinux /test-kernel root=$testfs rw $rootwait quiet\n}\n" >> $GRUBCFG
193
194 chmod 0444 $GRUBCFG
195fi
196grub-install /dev/${device}
197echo "(hd0) /dev/${device}" > /boot/grub/device.map
198
199# If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst
200if [ ! -f /boot/grub/grub.cfg ] ; then
201 echo "Preparing custom grub menu..."
202 echo "default 0" > /boot/grub/menu.lst
203 echo "timeout 30" >> /boot/grub/menu.lst
204 echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
205 echo "root (hd0,0)" >> /boot/grub/menu.lst
206 echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
207fi
208
209cp /run/media/$1/vmlinuz /boot/
210
211umount /boot
212
213sync
214
215echo "Remove your installation media, and press ENTER"
216
217read enter
218
219echo "Rebooting..."
220reboot -f
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
new file mode 100644
index 0000000000..fb537ee310
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -0,0 +1,218 @@
1#!/bin/sh -e
2#
3# Copyright (C) 2008-2011 Intel
4#
5# install.sh [device_name] [rootfs_name] [video_mode] [vga_mode]
6#
7
8PATH=/sbin:/bin:/usr/sbin:/usr/bin
9
10# We need 20 Mb for the boot partition
11boot_size=20
12
13# 5% for the swap
14swap_ratio=5
15
16# Get a list of hard drives
17hdnamelist=""
18live_dev_name=${1%%/*}
19live_dev_name=${live_dev_name%%[0-9]*}
20
21echo "Searching for hard drives ..."
22
23for device in `ls /sys/block/`; do
24 case $device in
25 loop*)
26 # skip loop device
27 ;;
28 sr*)
29 # skip CDROM device
30 ;;
31 ram*)
32 # skip ram device
33 ;;
34 *)
35 # skip the device LiveOS is on
36 # Add valid hard drive name to the list
37 if [ $device != $live_dev_name -a -e /dev/$device ]; then
38 hdnamelist="$hdnamelist $device"
39 fi
40 ;;
41 esac
42done
43
44TARGET_DEVICE_NAME=""
45for hdname in $hdnamelist; do
46 # Display found hard drives and their basic info
47 echo "-------------------------------"
48 echo /dev/$hdname
49 if [ -r /sys/block/$hdname/device/vendor ]; then
50 echo -n "VENDOR="
51 cat /sys/block/$hdname/device/vendor
52 fi
53 if [ -r /sys/block/$hdname/device/model ]; then
54 echo -n "MODEL="
55 cat /sys/block/$hdname/device/model
56 fi
57 if [ -r /sys/block/$hdname/device/uevent ]; then
58 echo -n "UEVENT="
59 cat /sys/block/$hdname/device/uevent
60 fi
61 echo
62 # Get user choice
63 while true; do
64 echo -n "Do you want to install this image there? [y/n] "
65 read answer
66 if [ "$answer" = "y" -o "$answer" = "n" ]; then
67 break
68 fi
69 echo "Please answer y or n"
70 done
71 if [ "$answer" = "y" ]; then
72 TARGET_DEVICE_NAME=$hdname
73 break
74 fi
75done
76
77if [ -n "$TARGET_DEVICE_NAME" ]; then
78 echo "Installing image on /dev/$TARGET_DEVICE_NAME ..."
79else
80 echo "No hard drive selected. Installation aborted."
81 exit 1
82fi
83
84device=$TARGET_DEVICE_NAME
85
86#
87# The udev automounter can cause pain here, kill it
88#
89rm -f /etc/udev/rules.d/automount.rules
90rm -f /etc/udev/scripts/mount*
91
92#
93# Unmount anything the automounter had mounted
94#
95umount /dev/${device}* 2> /dev/null || /bin/true
96
97if [ ! -b /dev/loop0 ] ; then
98 mknod /dev/loop0 b 7 0
99fi
100
101mkdir -p /tmp
102if [ ! -L /etc/mtab ]; then
103 cat /proc/mounts > /etc/mtab
104fi
105
106disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")
107
108swap_size=$((disk_size*swap_ratio/100))
109rootfs_size=$((disk_size-boot_size-swap_size))
110
111rootfs_start=$((boot_size))
112rootfs_end=$((rootfs_start+rootfs_size))
113swap_start=$((rootfs_end))
114
115# MMC devices are special in a couple of ways
116# 1) they use a partition prefix character 'p'
117# 2) they are detected asynchronously (need rootwait)
118rootwait=""
119part_prefix=""
120if [ ! "${device#mmcblk}" = "${device}" ]; then
121 part_prefix="p"
122 rootwait="rootwait"
123fi
124bootfs=/dev/${device}${part_prefix}1
125rootfs=/dev/${device}${part_prefix}2
126swap=/dev/${device}${part_prefix}3
127
128echo "*****************"
129echo "Boot partition size: $boot_size MB ($bootfs)"
130echo "Rootfs partition size: $rootfs_size MB ($rootfs)"
131echo "Swap partition size: $swap_size MB ($swap)"
132echo "*****************"
133echo "Deleting partition table on /dev/${device} ..."
134dd if=/dev/zero of=/dev/${device} bs=512 count=2
135
136echo "Creating new partition table on /dev/${device} ..."
137parted /dev/${device} mklabel msdos
138
139echo "Creating boot partition on $bootfs"
140parted /dev/${device} mkpart primary 0% $boot_size
141
142echo "Creating rootfs partition on $rootfs"
143parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
144
145echo "Creating swap partition on $swap"
146parted /dev/${device} mkpart primary $swap_start 100%
147
148parted /dev/${device} print
149
150echo "Formatting $bootfs to ext3..."
151mkfs.ext3 $bootfs
152
153echo "Formatting $rootfs to ext3..."
154mkfs.ext3 $rootfs
155
156echo "Formatting swap partition...($swap)"
157mkswap $swap
158
159mkdir /tgt_root
160mkdir /src_root
161mkdir -p /boot
162
163# Handling of the target root partition
164mount $rootfs /tgt_root
165mount -o rw,loop,noatime,nodiratime /run/media/$1/$2 /src_root
166echo "Copying rootfs files..."
167cp -a /src_root/* /tgt_root
168if [ -d /tgt_root/etc/ ] ; then
169 echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab
170 echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab
171 # We dont want udev to mount our root device while we're booting...
172 if [ -d /tgt_root/etc/udev/ ] ; then
173 echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist
174 fi
175fi
176umount /tgt_root
177umount /src_root
178
179# Handling of the target boot partition
180mount $bootfs /boot
181echo "Preparing boot partition..."
182if [ -f /etc/grub.d/00_header ] ; then
183 echo "Preparing custom grub2 menu..."
184 GRUBCFG="/boot/grub/grub.cfg"
185 mkdir -p $(dirname $GRUBCFG)
186 cat >$GRUBCFG <<_EOF
187menuentry "Linux" {
188 set root=(hd0,1)
189 linux /vmlinuz root=$rootfs $rootwait rw $5 $3 $4 quiet
190}
191_EOF
192 chmod 0444 $GRUBCFG
193fi
194grub-install /dev/${device}
195echo "(hd0) /dev/${device}" > /boot/grub/device.map
196
197# If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst
198if [ ! -f /boot/grub/grub.cfg ] ; then
199 echo "Preparing custom grub menu..."
200 echo "default 0" > /boot/grub/menu.lst
201 echo "timeout 30" >> /boot/grub/menu.lst
202 echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst
203 echo "root (hd0,0)" >> /boot/grub/menu.lst
204 echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst
205fi
206
207cp /run/media/$1/vmlinuz /boot/
208
209umount /boot
210
211sync
212
213echo "Remove your installation media, and press ENTER"
214
215read enter
216
217echo "Rebooting..."
218reboot -f
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
new file mode 100644
index 0000000000..d852c5737f
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -0,0 +1,235 @@
1#!/bin/sh
2
3PATH=/sbin:/bin:/usr/sbin:/usr/bin
4
5ROOT_MOUNT="/rootfs/"
6ROOT_IMAGE="rootfs.img"
7MOUNT="/bin/mount"
8UMOUNT="/bin/umount"
9ISOLINUX=""
10
11ROOT_DISK=""
12
13# Copied from initramfs-framework. The core of this script probably should be
14# turned into initramfs-framework modules to reduce duplication.
15udev_daemon() {
16 OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"
17
18 for o in $OPTIONS; do
19 if [ -x "$o" ]; then
20 echo $o
21 return 0
22 fi
23 done
24
25 return 1
26}
27
28_UDEV_DAEMON=`udev_daemon`
29
30early_setup() {
31 mkdir -p /proc
32 mkdir -p /sys
33 mount -t proc proc /proc
34 mount -t sysfs sysfs /sys
35 mount -t devtmpfs none /dev
36
37 # support modular kernel
38 modprobe isofs 2> /dev/null
39
40 mkdir -p /run
41 mkdir -p /var/run
42
43 $_UDEV_DAEMON --daemon
44 udevadm trigger --action=add
45}
46
47read_args() {
48 [ -z "$CMDLINE" ] && CMDLINE=`cat /proc/cmdline`
49 for arg in $CMDLINE; do
50 optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
51 case $arg in
52 root=*)
53 ROOT_DEVICE=$optarg ;;
54 rootimage=*)
55 ROOT_IMAGE=$optarg ;;
56 rootfstype=*)
57 modprobe $optarg 2> /dev/null ;;
58 LABEL=*)
59 label=$optarg ;;
60 video=*)
61 video_mode=$arg ;;
62 vga=*)
63 vga_mode=$arg ;;
64 console=*)
65 if [ -z "${console_params}" ]; then
66 console_params=$arg
67 else
68 console_params="$console_params $arg"
69 fi ;;
70 debugshell*)
71 if [ -z "$optarg" ]; then
72 shelltimeout=30
73 else
74 shelltimeout=$optarg
75 fi
76 esac
77 done
78}
79
80boot_live_root() {
81 # Watches the udev event queue, and exits if all current events are handled
82 udevadm settle --timeout=3 --quiet
83 killall "${_UDEV_DAEMON##*/}" 2>/dev/null
84
85 # Allow for identification of the real root even after boot
86 mkdir -p ${ROOT_MOUNT}/media/realroot
87 mount -n --move "/run/media/${ROOT_DISK}" ${ROOT_MOUNT}/media/realroot
88
89 # Move the mount points of some filesystems over to
90 # the corresponding directories under the real root filesystem.
91 for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
92 mkdir -p ${ROOT_MOUNT}/media/${dir##*/}
93 mount -n --move $dir ${ROOT_MOUNT}/media/${dir##*/}
94 done
95 mount -n --move /proc ${ROOT_MOUNT}/proc
96 mount -n --move /sys ${ROOT_MOUNT}/sys
97 mount -n --move /dev ${ROOT_MOUNT}/dev
98
99 cd $ROOT_MOUNT
100
101 # busybox switch_root supports -c option
102 exec switch_root -c /dev/console $ROOT_MOUNT /sbin/init $CMDLINE ||
103 fatal "Couldn't switch_root, dropping to shell"
104}
105
106fatal() {
107 echo $1 >$CONSOLE
108 echo >$CONSOLE
109 exec sh
110}
111
112early_setup
113
114[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
115
116read_args
117
118echo "Waiting for removable media..."
119C=0
120while true
121do
122 for i in `ls /run/media 2>/dev/null`; do
123 if [ -f /run/media/$i/$ROOT_IMAGE ] ; then
124 found="yes"
125 ROOT_DISK="$i"
126 break
127 elif [ -f /run/media/$i/isolinux/$ROOT_IMAGE ]; then
128 found="yes"
129 ISOLINUX="isolinux"
130 ROOT_DISK="$i"
131 break
132 fi
133 done
134 if [ "$found" = "yes" ]; then
135 break;
136 fi
137 # don't wait for more than $shelltimeout seconds, if it's set
138 if [ -n "$shelltimeout" ]; then
139 echo -n " " $(( $shelltimeout - $C ))
140 if [ $C -ge $shelltimeout ]; then
141 echo "..."
142 echo "Mounted filesystems"
143 mount | grep media
144 echo "Available block devices"
145 cat /proc/partitions
146 fatal "Cannot find $ROOT_IMAGE file in /run/media/* , dropping to a shell "
147 fi
148 C=$(( C + 1 ))
149 fi
150 sleep 1
151done
152
153# Try to mount the root image read-write and then boot it up.
154# This function distinguishes between a read-only image and a read-write image.
155# In the former case (typically an iso), it tries to make a union mount if possible.
156# In the latter case, the root image could be mounted and then directly booted up.
157mount_and_boot() {
158 mkdir $ROOT_MOUNT
159 mknod /dev/loop0 b 7 0 2>/dev/null
160
161 if ! mount -o rw,loop,noatime,nodiratime /run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then
162 fatal "Could not mount rootfs image"
163 fi
164
165 if touch $ROOT_MOUNT/bin 2>/dev/null; then
166 # The root image is read-write, directly boot it up.
167 boot_live_root
168 fi
169
170 # determine which unification filesystem to use
171 union_fs_type=""
172 if grep -q -w "overlayfs" /proc/filesystems; then
173 union_fs_type="overlayfs"
174 elif grep -q -w "aufs" /proc/filesystems; then
175 union_fs_type="aufs"
176 else
177 union_fs_type=""
178 fi
179
180 # make a union mount if possible
181 case $union_fs_type in
182 "overlayfs")
183 mkdir -p /rootfs.ro /rootfs.rw
184 if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then
185 rm -rf /rootfs.ro /rootfs.rw
186 fatal "Could not move rootfs mount point"
187 else
188 mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
189 mount -t overlayfs -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw" overlayfs $ROOT_MOUNT
190 mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
191 mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
192 mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
193 fi
194 ;;
195 "aufs")
196 mkdir -p /rootfs.ro /rootfs.rw
197 if ! mount -n --move $ROOT_MOUNT /rootfs.ro; then
198 rm -rf /rootfs.ro /rootfs.rw
199 fatal "Could not move rootfs mount point"
200 else
201 mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw
202 mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT
203 mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw
204 mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
205 mount --move /rootfs.rw $ROOT_MOUNT/rootfs.rw
206 fi
207 ;;
208 "")
209 mount -t tmpfs -o rw,noatime,mode=755 tmpfs $ROOT_MOUNT/media
210 ;;
211 esac
212
213 # boot the image
214 boot_live_root
215}
216
217case $label in
218 boot)
219 mount_and_boot
220 ;;
221 install|install-efi)
222 if [ -f /run/media/$i/$ISOLINUX/$ROOT_IMAGE ] ; then
223 ./$label.sh $i/$ISOLINUX $ROOT_IMAGE $video_mode $vga_mode $console_params
224 else
225 fatal "Could not find $label script"
226 fi
227
228 # If we're getting here, we failed...
229 fatal "Installation image failed"
230 ;;
231 *)
232 # Not sure what boot label is provided. Try to boot to avoid locking up.
233 mount_and_boot
234 ;;
235esac
diff --git a/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
new file mode 100644
index 0000000000..0ede20b15d
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-boot_1.0.bb
@@ -0,0 +1,14 @@
1SUMMARY = "Extremely basic live image init script"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-boot.sh"
5
6PR = "r2"
7
8do_install() {
9 install -m 0755 ${WORKDIR}/init-boot.sh ${D}/init
10}
11
12inherit allarch
13
14FILES_${PN} += " /init "
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/debug b/meta/recipes-core/initrdscripts/initramfs-framework/debug
new file mode 100644
index 0000000000..00bfd7d3f5
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/debug
@@ -0,0 +1,82 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5# Adds support to dynamic debugging of initramfs using bootparam in
6# following format:
7# shell : starts a shell before and after each module
8# shell=before:<module> : starts a shell before <module> is loaded and run
9# shell=after:<module> : starts a shell after <module> is loaded and run
10#
11# shell-debug : run set -x as soon as possible
12# shell-debug=before:<module> : run set -x before <module> is loaded and run
13# shell-debug=after:<module> : run set -x after <module> is loaded and run
14
15DEBUG_SHELL="false"
16
17debug_hook_handler() {
18 status=$1
19 module=$2
20
21 if [ -n "$bootparam_shell" ] && [ "$bootparam_shell" != "true" ]; then
22 shell_wanted_status=`expr $bootparam_shell : '\(.*\):.*'`
23 shell_wanted_module=`expr $bootparam_shell : '.*:\(.*\)'`
24
25 if [ "$shell_wanted_status" = "before" ]; then
26 shell_wanted_status=pre
27 else
28 shell_wanted_status=post
29 fi
30 fi
31
32 if [ "$bootparam_shell" = "true" ] ||
33 ( [ "$status" = "$shell_wanted_status" ] &&
34 [ "$module" = "$shell_wanted_module" ] ); then
35 if [ "$status" = "pre" ]; then
36 status_msg="before"
37 else
38 status_msg="after"
39 fi
40
41 msg "Starting shell $status_msg $module..."
42 sh
43 fi
44
45 if [ -n "$bootparam_shell_debug" ] && [ "$bootparam_shell_debug" != "true" ]; then
46 shell_debug_wanted_status=`expr $bootparam_shell_debug : '\(.*\):.*'`
47 shell_debug_wanted_module=`expr $bootparam_shell_debug : '.*:\(.*\)'`
48
49 if [ "$shell_debug_wanted_status" = "before" ]; then
50 shell_debug_wanted_status=pre
51 else
52 shell_debug_wanted_status=post
53 fi
54 fi
55
56 if [ "$bootparam_shell_debug" = "true" ] ||
57 ( [ "$status" = "$shell_debug_wanted_status" ] &&
58 [ "$module" = "$shell_debug_wanted_module" ] ); then
59 if [ "$DEBUG_SHELL" = "true" ]; then
60 return 0
61 fi
62
63 if [ "$status" = "pre" ]; then
64 status_msg="before"
65 else
66 status_msg="after"
67 fi
68
69 msg "Starting shell debugging $status_msg $module..."
70 DEBUG_SHELL="true"
71 set -x
72 fi
73}
74
75debug_enabled() {
76 return 0
77}
78
79debug_run() {
80 add_module_pre_hook "debug_hook_handler"
81 add_module_post_hook "debug_hook_handler"
82}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/e2fs b/meta/recipes-core/initrdscripts/initramfs-framework/e2fs
new file mode 100755
index 0000000000..29f801a7bd
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/e2fs
@@ -0,0 +1,28 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5e2fs_enabled() {
6 return 0
7}
8
9e2fs_run() {
10 filesystems="ext4 ext3 ext2"
11
12 # load modules
13 for fs in $filesystems; do
14 load_kernel_module $fs
15 done
16
17 for fs in $filesystems; do
18 eval "fs_options=\$bootparam_${fs}"
19 if [ -n "$fs_options" ]; then
20 dev=`expr "$fs_options" : '\([^:]*\).*'`
21 path=`expr "$fs_options" : '[^:]*:\([^:]*\).*'`
22
23 info "Mounting $dev as $fs on $path as $fs..."
24 mkdir -p $path
25 mount -t $fs $dev $path
26 fi
27 done
28}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/finish b/meta/recipes-core/initrdscripts/initramfs-framework/finish
new file mode 100755
index 0000000000..325f47be40
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/finish
@@ -0,0 +1,47 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5finish_enabled() {
6 return 0
7}
8
9finish_run() {
10 if [ -n "$ROOTFS_DIR" ]; then
11 if [ -n "$bootparam_rootdelay" ]; then
12 debug "Sleeping for $rootdelay second(s) to wait root to settle..."
13 sleep $bootparam_rootdelay
14 fi
15
16 if [ -n "$bootparam_root" ]; then
17 debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
18
19 if [ "`echo ${bootparam_root} | cut -c1-5`" = "UUID=" ]; then
20 root_uuid=`echo $bootparam_root | cut -c6-`
21 bootparam_root="/dev/disk/by-uuid/$root_uuid"
22 fi
23
24 if [ -e "$bootparam_root" ]; then
25 mount $bootparam_root $ROOTFS_DIR
26 else
27 debug "root '$bootparam_root' doesn't exist."
28 fi
29 fi
30
31 if [ ! -d $ROOTFS_DIR/dev ]; then
32 fatal "ERROR: There's no '/dev' on rootfs."
33 fi
34
35 info "Switching root to '$ROOTFS_DIR'..."
36
37 debug "Moving /dev, /proc and /sys onto rootfs..."
38 mount --move /dev $ROOTFS_DIR/dev
39 mount --move /proc $ROOTFS_DIR/proc
40 mount --move /sys $ROOTFS_DIR/sys
41
42 cd $ROOTFS_DIR
43 exec switch_root -c /dev/console $ROOTFS_DIR /sbin/init
44 else
45 debug "No rootfs has been set"
46 fi
47}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init
new file mode 100755
index 0000000000..95fa9fb1a0
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/init
@@ -0,0 +1,140 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4#
5# Provides the API to be used by the initramfs modules
6#
7# Modules need to provide the following functions:
8#
9# <module>_enabled : check if the module ought to run (return 1 to skip)
10# <module>_run : do what is need
11#
12# Boot parameters are available on environment in the as:
13#
14# 'foo=value' as 'bootparam_foo=value'
15# 'foo' as 'bootparam_foo=true'
16
17# Register a function to be called before running a module
18# The hook is called as:
19# <function> pre <module>
20add_module_pre_hook() {
21 MODULE_PRE_HOOKS="$MODULE_PRE_HOOKS $1"
22}
23
24# Register a function to be called after running a module
25# The hook is called as:
26# <function> post <module>
27add_module_post_hook() {
28 MODULE_POST_HOOKS="$MODULE_POST_HOOKS $1"
29}
30
31# Load kernel module
32load_kernel_module() {
33 if modprobe $1 >/dev/null 2>&1; then
34 info "Loaded module $1"
35 else
36 debug "Failed to load module $1"
37 fi
38}
39
40# Prints information
41msg() {
42 echo "$@" >/dev/console
43}
44
45# Prints information if verbose bootparam is used
46info() {
47 [ -n "$bootparam_verbose" ] && echo "$@" >/dev/console
48}
49
50# Prints information if debug bootparam is used
51debug() {
52 [ -n "$bootparam_debug" ] && echo "DEBUG: $@" >/dev/console
53}
54
55# Prints a message and start a endless loop
56fatal() {
57 echo $1 >/dev/console
58 echo >/dev/console
59
60 while [ "true" ]; do
61 sleep 3600
62 done
63}
64
65# Variables shared amoung modules
66ROOTFS_DIR="/rootfs" # where to do the switch root
67MODULE_PRE_HOOKS="" # functions to call before running each module
68MODULE_POST_HOOKS="" # functions to call after running each module
69MODULES_DIR=/init.d # place to look for modules
70
71# make mount stop complaining about missing /etc/fstab
72touch /etc/fstab
73
74# initialize /proc, /sys and /var/lock
75mkdir -p /proc /sys /var/lock
76mount -t proc proc /proc
77mount -t sysfs sysfs /sys
78
79# populate bootparam environment
80for p in `cat /proc/cmdline`; do
81 opt=`echo $p | cut -d'=' -f1`
82 opt=`echo $opt | sed -e 's/-/_/'`
83 if [ "`echo $p | cut -d'=' -f1`" = "$p" ]; then
84 eval "bootparam_${opt}=true"
85 else
86 value="`echo $p | cut -d'=' -f2-`"
87 eval "bootparam_${opt}=\"${value}\""
88 fi
89done
90
91# use /dev with devtmpfs
92if grep -q devtmpfs /proc/filesystems; then
93 mkdir -p /dev
94 mount -t devtmpfs devtmpfs /dev
95else
96 if [ ! -d /dev ]; then
97 fatal "ERROR: /dev doesn't exist and kernel doesn't has devtmpfs enabled."
98 fi
99fi
100
101mkdir $ROOTFS_DIR
102
103# Load and run modules
104for m in $MODULES_DIR/*; do
105 # Skip backup files
106 if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then
107 continue
108 fi
109
110 module=`basename $m | cut -d'-' -f 2`
111 debug "Loading module $module"
112
113 # pre hooks
114 for h in $MODULE_PRE_HOOKS; do
115 debug "Calling module hook (pre): $h"
116 eval "$h pre $module"
117 debug "Finished module hook (pre): $h"
118 done
119
120 # process module
121 . $m
122
123 if ! eval "${module}_enabled"; then
124 debug "Skipping module $module"
125 continue
126 fi
127
128 debug "Running ${module}_run"
129 eval "${module}_run"
130
131 # post hooks
132 for h in $MODULE_POST_HOOKS; do
133 debug "Calling module hook (post): $h"
134 eval "$h post $module"
135 debug "Finished module hook (post): $h"
136 done
137done
138
139# Catch all
140fatal "ERROR: Initramfs failed to initialize the system."
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/mdev b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
new file mode 100644
index 0000000000..a5df1d717a
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/mdev
@@ -0,0 +1,30 @@
1#!/bin/sh
2# Copyright (C) 2011 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5mdev_enabled() {
6 if [ ! -e /sbin/mdev ]; then
7 debug "/sbin/mdev doesn't exist"
8 return 1
9 fi
10
11 return 0
12}
13
14mdev_run() {
15 # setup the environment
16 mount -t tmpfs tmpfs /dev
17
18 mkdir -m 1777 /dev/shm
19
20 mkdir -m 0755 /dev/pts
21 mount -t devpts devpts /dev/pts
22
23 echo /sbin/mdev > /proc/sys/kernel/hotplug
24 mdev -s
25
26 # load modules for devices
27 find /sys -name modalias | while read m; do
28 load_kernel_module $(cat $m)
29 done
30}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/udev b/meta/recipes-core/initrdscripts/initramfs-framework/udev
new file mode 100644
index 0000000000..bb462dc448
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework/udev
@@ -0,0 +1,45 @@
1#!/bin/sh
2# Copyright (C) 2011, 2012 O.S. Systems Software LTDA.
3# Licensed on MIT
4
5udev_shutdown_hook_handler() {
6 status=$1
7 module=$2
8 if [ "$status" = "pre" ] && [ "$module" = "finish" ]; then
9 killall `basename $_UDEV_DAEMON` 2>/dev/null
10 fi
11}
12
13udev_daemon() {
14 OPTIONS="/sbin/udev/udevd /sbin/udevd /lib/udev/udevd /lib/systemd/systemd-udevd"
15
16 for o in $OPTIONS; do
17 if [ -x "$o" ]; then
18 echo $o
19 return 0
20 fi
21 done
22
23 return 1
24}
25
26_UDEV_DAEMON=`udev_daemon`
27
28udev_enabled() {
29 if [ -z "$_UDEV_DAEMON" ]; then
30 msg "WARNING: Cannot find the udev daemon; daemon will not be started in initramfs."
31 return 1
32 fi
33
34 return 0
35}
36
37udev_run() {
38 add_module_pre_hook "udev_shutdown_hook_handler"
39
40 mkdir -p /run
41
42 $_UDEV_DAEMON --daemon
43 udevadm trigger --action=add
44 udevadm settle
45}
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
new file mode 100644
index 0000000000..403127be09
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb
@@ -0,0 +1,59 @@
1SUMMARY = "Modular initramfs system"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4RDEPENDS_${PN} += "busybox"
5
6PR = "r2"
7
8inherit allarch
9
10SRC_URI = "file://init \
11 file://finish \
12 file://mdev \
13 file://udev \
14 file://e2fs \
15 file://debug"
16
17do_install() {
18 install -d ${D}/init.d
19
20 # base
21 install -m 0755 ${WORKDIR}/init ${D}/init
22 install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish
23
24 # mdev
25 install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev
26
27 # udev
28 install -m 0755 ${WORKDIR}/udev ${D}/init.d/01-udev
29
30 # e2fs
31 install -m 0755 ${WORKDIR}/e2fs ${D}/init.d/10-e2fs
32
33 # debug
34 install -m 0755 ${WORKDIR}/debug ${D}/init.d/00-debug
35}
36
37PACKAGES = "${PN}-base \
38 initramfs-module-mdev \
39 initramfs-module-udev \
40 initramfs-module-e2fs \
41 initramfs-module-debug"
42
43FILES_${PN}-base = "/init /init.d/99-finish"
44
45SUMMARY_initramfs-module-mdev = "initramfs support for mdev"
46RDEPENDS_initramfs-module-mdev = "${PN}-base"
47FILES_initramfs-module-mdev = "/init.d/01-mdev"
48
49SUMMARY_initramfs-module-udev = "initramfs support for udev"
50RDEPENDS_initramfs-module-udev = "${PN}-base udev"
51FILES_initramfs-module-udev = "/init.d/01-udev"
52
53SUMMARY_initramfs-module-e2fs = "initramfs support for ext4/ext3/ext2 filesystems"
54RDEPENDS_initramfs-module-e2fs = "${PN}-base"
55FILES_initramfs-module-e2fs = "/init.d/10-e2fs"
56
57SUMMARY_initramfs-module-debug = "initramfs dynamic debug support"
58RDEPENDS_initramfs-module-debug = "${PN}-base"
59FILES_initramfs-module-debug = "/init.d/00-debug"
diff --git a/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
new file mode 100644
index 0000000000..ac54902415
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-boot_1.0.bb
@@ -0,0 +1,17 @@
1SUMMARY = "Live image init script"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4DEPENDS = "virtual/kernel"
5RDEPENDS_${PN} = "udev udev-extraconf"
6SRC_URI = "file://init-live.sh"
7
8PR = "r12"
9
10do_install() {
11 install -m 0755 ${WORKDIR}/init-live.sh ${D}/init
12}
13
14FILES_${PN} += " /init "
15
16# Due to kernel dependency
17PACKAGE_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
new file mode 100644
index 0000000000..a54960c596
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi-testfs_1.0.bb
@@ -0,0 +1,14 @@
1SUMMARY = "Live image install script for with a second rootfs/kernel option"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-install-efi-testfs.sh"
5
6RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools"
7
8do_install() {
9 install -m 0755 ${WORKDIR}/init-install-efi-testfs.sh ${D}/install-efi.sh
10}
11
12INHIBIT_DEFAULT_DEPS = "1"
13FILES_${PN} = " /install-efi.sh "
14COMPATIBLE_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
new file mode 100644
index 0000000000..7195dc2718
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-efi_1.0.bb
@@ -0,0 +1,22 @@
1SUMMARY = "Live image install script for grub-efi"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-install-efi.sh"
5
6PR = "r1"
7
8RDEPENDS_${PN} = "parted e2fsprogs-mke2fs dosfstools"
9
10do_install() {
11 install -m 0755 ${WORKDIR}/init-install-efi.sh ${D}/install-efi.sh
12}
13
14# While this package maybe an allarch due to it being a
15# simple script, reality is that it is Host specific based
16# on the COMPATIBLE_HOST below, which needs to take precedence
17#inherit allarch
18INHIBIT_DEFAULT_DEPS = "1"
19
20FILES_${PN} = " /install-efi.sh "
21
22COMPATIBLE_HOST = "(i.86|x86_64).*-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
new file mode 100644
index 0000000000..db4cf544e8
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install-testfs_1.0.bb
@@ -0,0 +1,14 @@
1SUMMARY = "Live image install script with a second rootfs/kernel"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-install-testfs.sh"
5
6RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
7
8do_install() {
9 install -m 0755 ${WORKDIR}/init-install-testfs.sh ${D}/install.sh
10}
11
12INHIBIT_DEFAULT_DEPS = "1"
13FILES_${PN} = " /install.sh "
14COMPATIBLE_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
new file mode 100644
index 0000000000..7bf31c9cf8
--- /dev/null
+++ b/meta/recipes-core/initrdscripts/initramfs-live-install_1.0.bb
@@ -0,0 +1,22 @@
1SUMMARY = "Live image install script for grub"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4SRC_URI = "file://init-install.sh"
5
6PR = "r9"
7
8RDEPENDS_${PN} = "grub parted e2fsprogs-mke2fs"
9
10do_install() {
11 install -m 0755 ${WORKDIR}/init-install.sh ${D}/install.sh
12}
13
14# While this package maybe an allarch due to it being a
15# simple script, reality is that it is Host specific based
16# on the COMPATIBLE_HOST below, which needs to take precedence
17#inherit allarch
18INHIBIT_DEFAULT_DEPS = "1"
19
20FILES_${PN} = " /install.sh "
21
22COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch b/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch
new file mode 100644
index 0000000000..1ee8181f12
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/GPLv2.patch
@@ -0,0 +1,347 @@
1Upstream-Status: Inappropriate [licensing]
2
3diff --git a/COPYING b/COPYING
4new file mode 100644
5index 0000000..d511905
6--- /dev/null
7+++ b/COPYING
8@@ -0,0 +1,339 @@
9+ GNU GENERAL PUBLIC LICENSE
10+ Version 2, June 1991
11+
12+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
13+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14+ Everyone is permitted to copy and distribute verbatim copies
15+ of this license document, but changing it is not allowed.
16+
17+ Preamble
18+
19+ The licenses for most software are designed to take away your
20+freedom to share and change it. By contrast, the GNU General Public
21+License is intended to guarantee your freedom to share and change free
22+software--to make sure the software is free for all its users. This
23+General Public License applies to most of the Free Software
24+Foundation's software and to any other program whose authors commit to
25+using it. (Some other Free Software Foundation software is covered by
26+the GNU Lesser General Public License instead.) You can apply it to
27+your programs, too.
28+
29+ When we speak of free software, we are referring to freedom, not
30+price. Our General Public Licenses are designed to make sure that you
31+have the freedom to distribute copies of free software (and charge for
32+this service if you wish), that you receive source code or can get it
33+if you want it, that you can change the software or use pieces of it
34+in new free programs; and that you know you can do these things.
35+
36+ To protect your rights, we need to make restrictions that forbid
37+anyone to deny you these rights or to ask you to surrender the rights.
38+These restrictions translate to certain responsibilities for you if you
39+distribute copies of the software, or if you modify it.
40+
41+ For example, if you distribute copies of such a program, whether
42+gratis or for a fee, you must give the recipients all the rights that
43+you have. You must make sure that they, too, receive or can get the
44+source code. And you must show them these terms so they know their
45+rights.
46+
47+ We protect your rights with two steps: (1) copyright the software, and
48+(2) offer you this license which gives you legal permission to copy,
49+distribute and/or modify the software.
50+
51+ Also, for each author's protection and ours, we want to make certain
52+that everyone understands that there is no warranty for this free
53+software. If the software is modified by someone else and passed on, we
54+want its recipients to know that what they have is not the original, so
55+that any problems introduced by others will not reflect on the original
56+authors' reputations.
57+
58+ Finally, any free program is threatened constantly by software
59+patents. We wish to avoid the danger that redistributors of a free
60+program will individually obtain patent licenses, in effect making the
61+program proprietary. To prevent this, we have made it clear that any
62+patent must be licensed for everyone's free use or not licensed at all.
63+
64+ The precise terms and conditions for copying, distribution and
65+modification follow.
66+
67+ GNU GENERAL PUBLIC LICENSE
68+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
69+
70+ 0. This License applies to any program or other work which contains
71+a notice placed by the copyright holder saying it may be distributed
72+under the terms of this General Public License. The "Program", below,
73+refers to any such program or work, and a "work based on the Program"
74+means either the Program or any derivative work under copyright law:
75+that is to say, a work containing the Program or a portion of it,
76+either verbatim or with modifications and/or translated into another
77+language. (Hereinafter, translation is included without limitation in
78+the term "modification".) Each licensee is addressed as "you".
79+
80+Activities other than copying, distribution and modification are not
81+covered by this License; they are outside its scope. The act of
82+running the Program is not restricted, and the output from the Program
83+is covered only if its contents constitute a work based on the
84+Program (independent of having been made by running the Program).
85+Whether that is true depends on what the Program does.
86+
87+ 1. You may copy and distribute verbatim copies of the Program's
88+source code as you receive it, in any medium, provided that you
89+conspicuously and appropriately publish on each copy an appropriate
90+copyright notice and disclaimer of warranty; keep intact all the
91+notices that refer to this License and to the absence of any warranty;
92+and give any other recipients of the Program a copy of this License
93+along with the Program.
94+
95+You may charge a fee for the physical act of transferring a copy, and
96+you may at your option offer warranty protection in exchange for a fee.
97+
98+ 2. You may modify your copy or copies of the Program or any portion
99+of it, thus forming a work based on the Program, and copy and
100+distribute such modifications or work under the terms of Section 1
101+above, provided that you also meet all of these conditions:
102+
103+ a) You must cause the modified files to carry prominent notices
104+ stating that you changed the files and the date of any change.
105+
106+ b) You must cause any work that you distribute or publish, that in
107+ whole or in part contains or is derived from the Program or any
108+ part thereof, to be licensed as a whole at no charge to all third
109+ parties under the terms of this License.
110+
111+ c) If the modified program normally reads commands interactively
112+ when run, you must cause it, when started running for such
113+ interactive use in the most ordinary way, to print or display an
114+ announcement including an appropriate copyright notice and a
115+ notice that there is no warranty (or else, saying that you provide
116+ a warranty) and that users may redistribute the program under
117+ these conditions, and telling the user how to view a copy of this
118+ License. (Exception: if the Program itself is interactive but
119+ does not normally print such an announcement, your work based on
120+ the Program is not required to print an announcement.)
121+
122+These requirements apply to the modified work as a whole. If
123+identifiable sections of that work are not derived from the Program,
124+and can be reasonably considered independent and separate works in
125+themselves, then this License, and its terms, do not apply to those
126+sections when you distribute them as separate works. But when you
127+distribute the same sections as part of a whole which is a work based
128+on the Program, the distribution of the whole must be on the terms of
129+this License, whose permissions for other licensees extend to the
130+entire whole, and thus to each and every part regardless of who wrote it.
131+
132+Thus, it is not the intent of this section to claim rights or contest
133+your rights to work written entirely by you; rather, the intent is to
134+exercise the right to control the distribution of derivative or
135+collective works based on the Program.
136+
137+In addition, mere aggregation of another work not based on the Program
138+with the Program (or with a work based on the Program) on a volume of
139+a storage or distribution medium does not bring the other work under
140+the scope of this License.
141+
142+ 3. You may copy and distribute the Program (or a work based on it,
143+under Section 2) in object code or executable form under the terms of
144+Sections 1 and 2 above provided that you also do one of the following:
145+
146+ a) Accompany it with the complete corresponding machine-readable
147+ source code, which must be distributed under the terms of Sections
148+ 1 and 2 above on a medium customarily used for software interchange; or,
149+
150+ b) Accompany it with a written offer, valid for at least three
151+ years, to give any third party, for a charge no more than your
152+ cost of physically performing source distribution, a complete
153+ machine-readable copy of the corresponding source code, to be
154+ distributed under the terms of Sections 1 and 2 above on a medium
155+ customarily used for software interchange; or,
156+
157+ c) Accompany it with the information you received as to the offer
158+ to distribute corresponding source code. (This alternative is
159+ allowed only for noncommercial distribution and only if you
160+ received the program in object code or executable form with such
161+ an offer, in accord with Subsection b above.)
162+
163+The source code for a work means the preferred form of the work for
164+making modifications to it. For an executable work, complete source
165+code means all the source code for all modules it contains, plus any
166+associated interface definition files, plus the scripts used to
167+control compilation and installation of the executable. However, as a
168+special exception, the source code distributed need not include
169+anything that is normally distributed (in either source or binary
170+form) with the major components (compiler, kernel, and so on) of the
171+operating system on which the executable runs, unless that component
172+itself accompanies the executable.
173+
174+If distribution of executable or object code is made by offering
175+access to copy from a designated place, then offering equivalent
176+access to copy the source code from the same place counts as
177+distribution of the source code, even though third parties are not
178+compelled to copy the source along with the object code.
179+
180+ 4. You may not copy, modify, sublicense, or distribute the Program
181+except as expressly provided under this License. Any attempt
182+otherwise to copy, modify, sublicense or distribute the Program is
183+void, and will automatically terminate your rights under this License.
184+However, parties who have received copies, or rights, from you under
185+this License will not have their licenses terminated so long as such
186+parties remain in full compliance.
187+
188+ 5. You are not required to accept this License, since you have not
189+signed it. However, nothing else grants you permission to modify or
190+distribute the Program or its derivative works. These actions are
191+prohibited by law if you do not accept this License. Therefore, by
192+modifying or distributing the Program (or any work based on the
193+Program), you indicate your acceptance of this License to do so, and
194+all its terms and conditions for copying, distributing or modifying
195+the Program or works based on it.
196+
197+ 6. Each time you redistribute the Program (or any work based on the
198+Program), the recipient automatically receives a license from the
199+original licensor to copy, distribute or modify the Program subject to
200+these terms and conditions. You may not impose any further
201+restrictions on the recipients' exercise of the rights granted herein.
202+You are not responsible for enforcing compliance by third parties to
203+this License.
204+
205+ 7. If, as a consequence of a court judgment or allegation of patent
206+infringement or for any other reason (not limited to patent issues),
207+conditions are imposed on you (whether by court order, agreement or
208+otherwise) that contradict the conditions of this License, they do not
209+excuse you from the conditions of this License. If you cannot
210+distribute so as to satisfy simultaneously your obligations under this
211+License and any other pertinent obligations, then as a consequence you
212+may not distribute the Program at all. For example, if a patent
213+license would not permit royalty-free redistribution of the Program by
214+all those who receive copies directly or indirectly through you, then
215+the only way you could satisfy both it and this License would be to
216+refrain entirely from distribution of the Program.
217+
218+If any portion of this section is held invalid or unenforceable under
219+any particular circumstance, the balance of the section is intended to
220+apply and the section as a whole is intended to apply in other
221+circumstances.
222+
223+It is not the purpose of this section to induce you to infringe any
224+patents or other property right claims or to contest validity of any
225+such claims; this section has the sole purpose of protecting the
226+integrity of the free software distribution system, which is
227+implemented by public license practices. Many people have made
228+generous contributions to the wide range of software distributed
229+through that system in reliance on consistent application of that
230+system; it is up to the author/donor to decide if he or she is willing
231+to distribute software through any other system and a licensee cannot
232+impose that choice.
233+
234+This section is intended to make thoroughly clear what is believed to
235+be a consequence of the rest of this License.
236+
237+ 8. If the distribution and/or use of the Program is restricted in
238+certain countries either by patents or by copyrighted interfaces, the
239+original copyright holder who places the Program under this License
240+may add an explicit geographical distribution limitation excluding
241+those countries, so that distribution is permitted only in or among
242+countries not thus excluded. In such case, this License incorporates
243+the limitation as if written in the body of this License.
244+
245+ 9. The Free Software Foundation may publish revised and/or new versions
246+of the General Public License from time to time. Such new versions will
247+be similar in spirit to the present version, but may differ in detail to
248+address new problems or concerns.
249+
250+Each version is given a distinguishing version number. If the Program
251+specifies a version number of this License which applies to it and "any
252+later version", you have the option of following the terms and conditions
253+either of that version or of any later version published by the Free
254+Software Foundation. If the Program does not specify a version number of
255+this License, you may choose any version ever published by the Free Software
256+Foundation.
257+
258+ 10. If you wish to incorporate parts of the Program into other free
259+programs whose distribution conditions are different, write to the author
260+to ask for permission. For software which is copyrighted by the Free
261+Software Foundation, write to the Free Software Foundation; we sometimes
262+make exceptions for this. Our decision will be guided by the two goals
263+of preserving the free status of all derivatives of our free software and
264+of promoting the sharing and reuse of software generally.
265+
266+ NO WARRANTY
267+
268+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
269+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
270+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
271+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
272+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
273+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
274+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
275+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
276+REPAIR OR CORRECTION.
277+
278+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
279+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
280+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
281+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
282+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
283+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
284+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
285+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
286+POSSIBILITY OF SUCH DAMAGES.
287+
288+ END OF TERMS AND CONDITIONS
289+
290+ How to Apply These Terms to Your New Programs
291+
292+ If you develop a new program, and you want it to be of the greatest
293+possible use to the public, the best way to achieve this is to make it
294+free software which everyone can redistribute and change under these terms.
295+
296+ To do so, attach the following notices to the program. It is safest
297+to attach them to the start of each source file to most effectively
298+convey the exclusion of warranty; and each file should have at least
299+the "copyright" line and a pointer to where the full notice is found.
300+
301+ <one line to give the program's name and a brief idea of what it does.>
302+ Copyright (C) <year> <name of author>
303+
304+ This program is free software; you can redistribute it and/or modify
305+ it under the terms of the GNU General Public License as published by
306+ the Free Software Foundation; either version 2 of the License, or
307+ (at your option) any later version.
308+
309+ This program is distributed in the hope that it will be useful,
310+ but WITHOUT ANY WARRANTY; without even the implied warranty of
311+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
312+ GNU General Public License for more details.
313+
314+ You should have received a copy of the GNU General Public License along
315+ with this program; if not, write to the Free Software Foundation, Inc.,
316+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
317+
318+Also add information on how to contact you by electronic and paper mail.
319+
320+If the program is interactive, make it output a short notice like this
321+when it starts in an interactive mode:
322+
323+ Gnomovision version 69, Copyright (C) year name of author
324+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
325+ This is free software, and you are welcome to redistribute it
326+ under certain conditions; type `show c' for details.
327+
328+The hypothetical commands `show w' and `show c' should show the appropriate
329+parts of the General Public License. Of course, the commands you use may
330+be called something other than `show w' and `show c'; they could even be
331+mouse-clicks or menu items--whatever suits your program.
332+
333+You should also get your employer (if you work as a programmer) or your
334+school, if any, to sign a "copyright disclaimer" for the program, if
335+necessary. Here is a sample; alter the names:
336+
337+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
338+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
339+
340+ <signature of Ty Coon>, 1 April 1989
341+ Ty Coon, President of Vice
342+
343+This General Public License does not permit incorporating your program into
344+proprietary programs. If your program is a subroutine library, you may
345+consider it more useful to permit linking proprietary applications with the
346+library. If this is what you want to do, use the GNU Lesser General
347+Public License instead of this License.
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh
new file mode 100644
index 0000000000..b577b9a03a
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/arm/alignment.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: alignment
4# Required-Start: mountkernfs
5# Required-Stop: mountkernfs
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ -e /proc/cpu/alignment ]; then
11 echo "3" > /proc/cpu/alignment
12fi
13
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/banner.sh b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh
new file mode 100644
index 0000000000..9e2b091252
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/banner.sh
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: banner
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ ! -e /dev/tty ]; then
11 /bin/mknod -m 0666 /dev/tty c 5 0
12fi
13
14if ( > /dev/tty0 ) 2>/dev/null; then
15 vtmaster=/dev/tty0
16elif ( > /dev/vc/0 ) 2>/dev/null; then
17 vtmaster=/dev/vc/0
18elif ( > /dev/console ) 2>/dev/null; then
19 vtmaster=/dev/console
20else
21 vtmaster=/dev/null
22fi
23echo > $vtmaster
24echo "Please wait: booting..." > $vtmaster
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
new file mode 100755
index 0000000000..df553bc079
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -0,0 +1,81 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: bootmisc
4# Required-Start: $local_fs mountvirtfs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Misc and other.
9### END INIT INFO
10
11. /etc/default/rcS
12#
13# Put a nologin file in /etc to prevent people from logging in before
14# system startup is complete.
15#
16if test "$DELAYLOGIN" = yes
17then
18 echo "System bootup in progress - please wait" > /etc/nologin
19 cp /etc/nologin /etc/nologin.boot
20fi
21
22#
23# Set pseudo-terminal access permissions.
24#
25if test -c /dev/ttyp0
26then
27 chmod 666 /dev/tty[p-za-e][0-9a-f]
28 chown root:tty /dev/tty[p-za-e][0-9a-f]
29fi
30
31#
32# Apply /proc settings if defined
33#
34SYSCTL_CONF="/etc/sysctl.conf"
35if [ -f "${SYSCTL_CONF}" ]
36then
37 if [ -x "/sbin/sysctl" ]
38 then
39 # busybox sysctl does not support -q
40 VERBOSE_REDIR="1>/dev/null"
41 if [ "${VERBOSE}" != "no" ]; then
42 VERBOSE_REDIR="1>&1"
43 fi
44 eval /sbin/sysctl -p "${SYSCTL_CONF}" $VERBOSE_REDIR
45 else
46 echo "To have ${SYSCTL_CONF} applied during boot, install package <procps>."
47 fi
48fi
49
50#
51# Update /etc/motd.
52#
53if test "$EDITMOTD" != no
54then
55 uname -a > /etc/motd.tmp
56 sed 1d /etc/motd >> /etc/motd.tmp
57 mv /etc/motd.tmp /etc/motd
58fi
59
60#
61# This is as good a place as any for a sanity check
62#
63# Set the system clock from hardware clock
64# If the timestamp is more recent than the current time,
65# use the timestamp instead.
66test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh start
67if test -e /etc/timestamp
68then
69 SYSTEMDATE=`date -u +%4Y%2m%2d%2H%2M%2S`
70 read TIMESTAMP < /etc/timestamp
71 if [ ${TIMESTAMP} -gt $SYSTEMDATE ]; then
72 # format the timestamp as date expects it (2m2d2H2M4Y.2S)
73 TS_YR=${TIMESTAMP%??????????}
74 TS_SEC=${TIMESTAMP#????????????}
75 TS_FIRST12=${TIMESTAMP%??}
76 TS_MIDDLE8=${TS_FIRST12#????}
77 date -u ${TS_MIDDLE8}${TS_YR}.${TS_SEC}
78 test -x /etc/init.d/hwclock.sh && /etc/init.d/hwclock.sh stop
79 fi
80fi
81: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh
new file mode 100755
index 0000000000..62869451b7
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkfs.sh
@@ -0,0 +1,50 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: checkfs
4# Required-Start: checkroot
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Check all other file systems
9### END INIT INFO
10
11. /etc/default/rcS
12
13#
14# Check the rest of the filesystems.
15#
16if test ! -f /fastboot
17then
18 if test -f /forcefsck
19 then
20 force="-f"
21 else
22 force=""
23 fi
24 if test "$FSCKFIX" = yes
25 then
26 fix="-y"
27 else
28 fix="-a"
29 fi
30 spinner="-C"
31 case "$TERM" in
32 dumb|network|unknown|"") spinner="" ;;
33 esac
34 test "`uname -m`" = "s390" && spinner="" # This should go away
35 test "$VERBOSE" != no && echo "Checking all filesystems..."
36 fsck $spinner -R -A $fix $force
37 if test "$?" -gt 1
38 then
39 echo
40 echo "fsck failed. Please repair manually."
41 echo
42 echo "CONTROL-D will exit from this shell and continue system startup."
43 echo
44 # Start a single user shell on the console
45 /sbin/sulogin $CONSOLE
46 fi
47fi
48rm -f /fastboot /forcefsck
49
50: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
new file mode 100755
index 0000000000..dfee2afaad
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
@@ -0,0 +1,148 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: checkroot
4# Required-Start: udev
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Check to root file system.
9### END INIT INFO
10
11. /etc/default/rcS
12
13#
14# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to be spawned
15# from this script *before anything else* with a timeout, like SCO does.
16#
17test "$SULOGIN" = yes && sulogin -t 30 $CONSOLE
18
19#
20# Read /etc/fstab.
21#
22exec 9< /etc/fstab
23rootmode=rw
24rootopts=rw
25rootcheck=$ENABLE_ROOTFS_FSCK
26swap_on_md=no
27devfs=
28while read fs mnt type opts dump pass junk <&9
29do
30 case "$fs" in
31 ""|\#*)
32 continue;
33 ;;
34 /dev/md*)
35 # Swap on md device.
36 test "$type" = swap && swap_on_md=yes
37 ;;
38 /dev/*)
39 ;;
40 *)
41 # Might be a swapfile.
42 test "$type" = swap && swap_on_md=yes
43 ;;
44 esac
45 test "$type" = devfs && devfs="$fs"
46 test "$mnt" != / && continue
47 rootopts="$opts"
48 test "$pass" = 0 -o "$pass" = "" && rootcheck=no
49 case "$opts" in
50 ro|ro,*|*,ro|*,ro,*)
51 rootmode=ro
52 ;;
53 esac
54done
55exec 0>&9 9>&-
56
57# Check for conflicting configurations
58if [ "$rootmode" = "ro" -a "$ROOTFS_READ_ONLY" = "no" ] || \
59 [ "$rootmode" = "rw" -a "$ROOTFS_READ_ONLY" = "yes" ]; then
60 echo ""
61 echo "WARN: conflicting configurations in /etc/fstab and /etc/default/rcS"
62 echo " regarding the writability of rootfs. Please fix one of them."
63 echo ""
64fi
65
66
67#
68# Activate the swap device(s) in /etc/fstab. This needs to be done
69# before fsck, since fsck can be quite memory-hungry.
70#
71test "$VERBOSE" != no && echo "Activating swap"
72swapon -a 2> /dev/null
73
74#
75# Check the root filesystem.
76#
77if test -f /fastboot || test $rootcheck = no
78then
79 test $rootcheck = yes && echo "Fast boot, no filesystem check"
80else
81 #
82 # Ensure that root is quiescent and read-only before fsck'ing.
83 #
84 mount -n -o remount,ro /
85 if test $? = 0
86 then
87 if test -f /forcefsck
88 then
89 force="-f"
90 else
91 force=""
92 fi
93 if test "$FSCKFIX" = yes
94 then
95 fix="-y"
96 else
97 fix="-a"
98 fi
99 spinner="-C"
100 case "$TERM" in
101 dumb|network|unknown|"") spinner="" ;;
102 esac
103 test `uname -m` = s390 && spinner="" # This should go away
104 test "$VERBOSE" != no && echo "Checking root filesystem..."
105 fsck $spinner $force $fix /
106 #
107 # If there was a failure, drop into single-user mode.
108 #
109 # NOTE: "failure" is defined as exiting with a return code of
110 # 2 or larger. A return code of 1 indicates that filesystem
111 # errors were corrected but that the boot may proceed.
112 #
113 if test "$?" -gt 1
114 then
115 # Surprise! Re-directing from a HERE document (as in
116 # "cat << EOF") won't work, because the root is read-only.
117 echo
118 echo "fsck failed. Please repair manually and reboot. Please note"
119 echo "that the root filesystem is currently mounted read-only. To"
120 echo "remount it read-write:"
121 echo
122 echo " # mount -n -o remount,rw /"
123 echo
124 echo "CONTROL-D will exit from this shell and REBOOT the system."
125 echo
126 # Start a single user shell on the console
127 /sbin/sulogin $CONSOLE
128 reboot -f
129 fi
130 else
131 echo "*** ERROR! Cannot fsck root fs because it is not mounted read-only!"
132 echo
133 fi
134fi
135
136#
137# If the root filesystem was not marked as read-only in /etc/fstab,
138# remount the rootfs rw but do not try to change mtab because it
139# is on a ro fs until the remount succeeded. Then clean up old mtabs
140# and finally write the new mtab.
141#
142mount -n -o remount,$rootmode /
143if test "$rootmode" = rw
144then
145 ln -sf /proc/mounts /dev/mtab
146fi
147
148: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/devpts b/meta/recipes-core/initscripts/initscripts-1.0/devpts
new file mode 100644
index 0000000000..4a0978b404
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/devpts
@@ -0,0 +1,5 @@
1# GID of the `tty' group
2TTYGRP=5
3
4# Set to 600 to have `mesg n' be the default
5TTYMODE=620
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
new file mode 100755
index 0000000000..c6043fb1e6
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/devpts.sh
@@ -0,0 +1,28 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: devpts
4# Required-Start: udev
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount /dev/pts file systems.
9### END INIT INFO
10
11. /etc/default/devpts
12
13if grep -q devpts /proc/filesystems
14then
15 #
16 # Create multiplexor device.
17 #
18 test -c /dev/ptmx || mknod -m 666 /dev/ptmx c 5 2
19
20 #
21 # Mount /dev/pts if needed.
22 #
23 if ! grep -q devpts /proc/mounts
24 then
25 mkdir -p /dev/pts
26 mount -t devpts devpts /dev/pts -ogid=${TTYGRP},mode=${TTYMODE}
27 fi
28fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
new file mode 100644
index 0000000000..a97b0681e1
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/dmesg.sh
@@ -0,0 +1,17 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: dmesg
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10if [ -f /var/log/dmesg ]; then
11 if [ -f /usr/sbin/logrotate ]; then
12 logrotate -f /etc/logrotate-dmesg.conf
13 else
14 mv -f /var/log/dmesg /var/log/dmesg.old
15 fi
16fi
17dmesg -s 131072 > /var/log/dmesg
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions
new file mode 100755
index 0000000000..01ad1edd3e
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
@@ -0,0 +1,91 @@
1# -*-Shell-script-*-
2#
3# functions This file contains functions to be used by most or all
4# shell scripts in the /etc/init.d directory.
5#
6
7NORMAL="\\033[0;39m" # Standard console grey
8SUCCESS="\\033[1;32m" # Success is green
9WARNING="\\033[1;33m" # Warnings are yellow
10FAILURE="\\033[1;31m" # Failures are red
11INFO="\\033[1;36m" # Information is light cyan
12BRACKET="\\033[1;34m" # Brackets are blue
13
14# NOTE: The pidofproc () doesn't support the process which is a script unless
15# the pidof supports "-x" option. If you want to use it for such a
16# process:
17# 1) If there is no "pidof -x", replace the "pidof $1" with another
18# command like(for core-image-minimal):
19# ps | awk '/'"$1"'/ {print $1}'
20# Or
21# 2) If there is "pidof -x", replace "pidof" with "pidof -x".
22#
23# pidofproc - print the pid of a process
24# $1: the name of the process
25pidofproc () {
26
27 # pidof output null when no program is running, so no "2>/dev/null".
28 pid=`pidof $1`
29 status=$?
30 case $status in
31 0)
32 echo $pid
33 return 0
34 ;;
35 127)
36 echo "ERROR: command pidof not found" >&2
37 exit 127
38 ;;
39 *)
40 return $status
41 ;;
42 esac
43}
44
45machine_id() { # return the machine ID
46 awk 'BEGIN { FS=": " } /Hardware/ \
47 { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
48}
49
50killproc() { # kill the named process(es)
51 pid=`pidofproc $1` && kill $pid
52}
53
54status() {
55 local pid
56 if [ "$#" = 0 ]; then
57 echo "Usage: status {program}"
58 return 1
59 fi
60 pid=`pidofproc $1`
61 if [ -n "$pid" ]; then
62 echo "$1 (pid $pid) is running..."
63 return 0
64 else
65 echo "$1 is stopped"
66 fi
67 return 3
68}
69
70success() {
71 echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
72 return 0
73}
74
75failure() {
76 local rc=$*
77 echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
78 return $rc
79}
80
81warning() {
82 local rc=$*
83 echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
84 return $rc
85}
86
87passed() {
88 local rc=$*
89 echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}"
90 return $rc
91}
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/halt b/meta/recipes-core/initscripts/initscripts-1.0/halt
new file mode 100755
index 0000000000..a56f73421b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/halt
@@ -0,0 +1,29 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: halt
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 0
8# Short-Description: Execute the halt command.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# See if we need to cut the power.
15if test -x /etc/init.d/ups-monitor
16then
17 /etc/init.d/ups-monitor poweroff
18fi
19
20# Don't shut down drives if we're using RAID.
21hddown="-h"
22if grep -qs '^md.*active' /proc/mdstat
23then
24 hddown=""
25fi
26
27halt SED_HALTARGS -p $hddown
28
29: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
new file mode 100755
index 0000000000..95287cc139
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/hostname.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: hostname
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Set hostname based on /etc/hostname
9### END INIT INFO
10HOSTNAME=$(/bin/hostname)
11
12hostname -b -F /etc/hostname 2> /dev/null
13if [ $? -eq 0 ]; then
14 exit
15fi
16
17# Busybox hostname doesn't support -b so we need implement it on our own
18if [ -f /etc/hostname ];then
19 hostname `cat /etc/hostname`
20elif [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" -o ! -z "`echo $HOSTNAME | sed -n '/^[0-9]*\.[0-9].*/p'`" ] ; then
21 hostname localhost
22fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf b/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf
new file mode 100644
index 0000000000..6f46e4216f
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/logrotate-dmesg.conf
@@ -0,0 +1,9 @@
1# see "man logrotate" for details
2# rotate dmesg, and keep 5 versions.
3
4/var/log/dmesg {
5 create
6 rotate 5
7 nodateext
8}
9
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
new file mode 100755
index 0000000000..94bae420c0
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -0,0 +1,39 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountall
4# Required-Start: mountvirtfs
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount all filesystems.
9# Description:
10### END INIT INFO
11
12. /etc/default/rcS
13
14#
15# Mount local filesystems in /etc/fstab. For some reason, people
16# might want to mount "proc" several times, and mount -v complains
17# about this. So we mount "proc" filesystems without -v.
18#
19test "$VERBOSE" != no && echo "Mounting local filesystems..."
20mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
21
22#
23# We might have mounted something over /dev, see if /dev/initctl is there.
24#
25if test ! -p /dev/initctl
26then
27 rm -f /dev/initctl
28 mknod -m 600 /dev/initctl p
29fi
30kill -USR1 1
31
32#
33# Execute swapon command again, in case we want to swap to
34# a file on a now mounted filesystem.
35#
36swapon -a 2> /dev/null
37
38: exit 0
39
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
new file mode 100755
index 0000000000..fe6c19605f
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountnfs.sh
@@ -0,0 +1,88 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountnfs
4# Required-Start: $local_fs $network $rpcbind
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10#
11# Run in a subshell because of I/O redirection.
12#
13test -f /etc/fstab && (
14
15#
16# Read through fstab line by line. If it is NFS, set the flag
17# for mounting NFS filesystems. If any NFS partition is found and it
18# not mounted with the nolock option, we start the rpcbind.
19#
20rpcbind=no
21mount_nfs=no
22mount_smb=no
23mount_ncp=no
24mount_cifs=no
25while read device mountpt fstype options
26do
27 case "$device" in
28 ""|\#*)
29 continue
30 ;;
31 esac
32
33 case "$options" in
34 *noauto*)
35 continue
36 ;;
37 esac
38
39 if test "$fstype" = nfs
40 then
41 mount_nfs=yes
42 case "$options" in
43 *nolock*)
44 ;;
45 *)
46 rpcbind=yes
47 ;;
48 esac
49 fi
50 if test "$fstype" = smbfs
51 then
52 mount_smb=yes
53 fi
54 if test "$fstype" = ncpfs
55 then
56 mount_ncp=yes
57 fi
58 if test "$fstype" = cifs
59 then
60 mount_cifs=yes
61 fi
62done
63
64exec 0>&1
65
66if test "$rpcbind" = yes
67then
68 if test -x /usr/sbin/rpcbind
69 then
70 echo -n "Starting rpcbind... "
71 start-stop-daemon --start --quiet --exec /usr/sbin/rpcbind
72 sleep 2
73 fi
74fi
75
76if test "$mount_nfs" = yes || test "$mount_smb" = yes || test "$mount_ncp" = yes || test "$mount_cifs" = yes
77then
78 echo "Mounting remote filesystems..."
79 test "$mount_nfs" = yes && mount -a -t nfs
80 test "$mount_smb" = yes && mount -a -t smbfs
81 test "$mount_ncp" = yes && mount -a -t ncpfs
82 test "$mount_cifs" = yes && mount -a -t cifs
83fi
84
85) < /etc/fstab
86
87: exit 0
88
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
new file mode 100755
index 0000000000..904037eeaa
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh
@@ -0,0 +1,222 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: volatile
4# Required-Start: $local_fs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Populate the volatile filesystem
9### END INIT INFO
10
11# Get ROOT_DIR
12DIRNAME=`dirname $0`
13ROOT_DIR=`echo $DIRNAME | sed -ne 's:/etc/.*::p'`
14
15[ -e ${ROOT_DIR}/etc/default/rcS ] && . ${ROOT_DIR}/etc/default/rcS
16# When running populate-volatile.sh at rootfs time, disable cache.
17[ -n "$ROOT_DIR" ] && VOLATILE_ENABLE_CACHE=no
18# If rootfs is read-only, disable cache.
19[ "$ROOTFS_READ_ONLY" = "yes" ] && VOLATILE_ENABLE_CACHE=no
20
21CFGDIR="${ROOT_DIR}/etc/default/volatiles"
22TMPROOT="${ROOT_DIR}/var/volatile/tmp"
23COREDEF="00_core"
24
25[ "${VERBOSE}" != "no" ] && echo "Populating volatile Filesystems."
26
27create_file() {
28 EXEC="
29 touch \"$1\";
30 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
31 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
32
33 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
34
35 [ -e "$1" ] && {
36 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
37 } || {
38 if [ -z "$ROOT_DIR" ]; then
39 eval $EXEC &
40 else
41 # Creating some files at rootfs time may fail and should fail,
42 # but these failures should not be logged to make sure the do_rootfs
43 # process doesn't fail. This does no harm, as this script will
44 # run on target to set up the correct files and directories.
45 eval $EXEC > /dev/null 2>&1
46 fi
47 }
48}
49
50mk_dir() {
51 EXEC="
52 mkdir -p \"$1\";
53 chown ${TUSER}.${TGROUP} $1 || echo \"Failed to set owner -${TUSER}- for -$1-.\" >/dev/tty0 2>&1;
54 chmod ${TMODE} $1 || echo \"Failed to set mode -${TMODE}- for -$1-.\" >/dev/tty0 2>&1 "
55
56 test "$VOLATILE_ENABLE_CACHE" = yes && echo "$EXEC" >> /etc/volatile.cache.build
57 [ -e "$1" ] && {
58 [ "${VERBOSE}" != "no" ] && echo "Target already exists. Skipping."
59 } || {
60 if [ -z "$ROOT_DIR" ]; then
61 eval $EXEC
62 else
63 # For the same reason with create_file(), failures should
64 # not be logged.
65 eval $EXEC > /dev/null 2>&1
66 fi
67 }
68}
69
70link_file() {
71 EXEC="
72 if [ -L \"$2\" ]; then
73 [ \"\$(readlink -f \"$2\")\" != \"\$(readlink -f \"$1\")\" ] && { rm -f \"$2\"; ln -sf \"$1\" \"$2\"; };
74 elif [ -d \"$2\" ]; then
75 if awk '\$2 == \"$2\" {exit 1}' /proc/mounts; then
76 cp -a $2/* $1 2>/dev/null;
77 cp -a $2/.[!.]* $1 2>/dev/null;
78 rm -rf \"$2\";
79 ln -sf \"$1\" \"$2\";
80 fi
81 else
82 ln -sf \"$1\" \"$2\";
83 fi
84 "
85
86 test "$VOLATILE_ENABLE_CACHE" = yes && echo " $EXEC" >> /etc/volatile.cache.build
87
88 if [ -z "$ROOT_DIR" ]; then
89 eval $EXEC &
90 else
91 # For the same reason with create_file(), failures should
92 # not be logged.
93 eval $EXEC > /dev/null 2>&1
94 fi
95}
96
97check_requirements() {
98 cleanup() {
99 rm "${TMP_INTERMED}"
100 rm "${TMP_DEFINED}"
101 rm "${TMP_COMBINED}"
102 }
103
104 CFGFILE="$1"
105 [ `basename "${CFGFILE}"` = "${COREDEF}" ] && return 0
106
107 TMP_INTERMED="${TMPROOT}/tmp.$$"
108 TMP_DEFINED="${TMPROOT}/tmpdefined.$$"
109 TMP_COMBINED="${TMPROOT}/tmpcombined.$$"
110
111 sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/passwd | sort | uniq > "${TMP_DEFINED}"
112 cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 2 > "${TMP_INTERMED}"
113 cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
114 NR_DEFINED_USERS="`cat "${TMP_DEFINED}" | wc -l`"
115 NR_COMBINED_USERS="`cat "${TMP_COMBINED}" | wc -l`"
116
117 [ "${NR_DEFINED_USERS}" -ne "${NR_COMBINED_USERS}" ] && {
118 echo "Undefined users:"
119 diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
120 cleanup
121 return 1
122 }
123
124
125 sed 's@\(^:\)*:.*@\1@' ${ROOT_DIR}/etc/group | sort | uniq > "${TMP_DEFINED}"
126 cat ${CFGFILE} | grep -v "^#" | cut -s -d " " -f 3 > "${TMP_INTERMED}"
127 cat "${TMP_DEFINED}" "${TMP_INTERMED}" | sort | uniq > "${TMP_COMBINED}"
128
129 NR_DEFINED_GROUPS="`cat "${TMP_DEFINED}" | wc -l`"
130 NR_COMBINED_GROUPS="`cat "${TMP_COMBINED}" | wc -l`"
131
132 [ "${NR_DEFINED_GROUPS}" -ne "${NR_COMBINED_GROUPS}" ] && {
133 echo "Undefined groups:"
134 diff "${TMP_DEFINED}" "${TMP_COMBINED}" | grep "^>"
135 cleanup
136 return 1
137 }
138
139 # Add checks for required directories here
140
141 cleanup
142 return 0
143}
144
145apply_cfgfile() {
146 CFGFILE="$1"
147
148 check_requirements "${CFGFILE}" || {
149 echo "Skipping ${CFGFILE}"
150 return 1
151 }
152
153 cat ${CFGFILE} | grep -v "^#" | \
154 while read LINE; do
155 eval `echo "$LINE" | sed -n "s/\(.*\)\ \(.*\) \(.*\)\ \(.*\)\ \(.*\)\ \(.*\)/TTYPE=\1 ; TUSER=\2; TGROUP=\3; TMODE=\4; TNAME=\5 TLTARGET=\6/p"`
156 TNAME=${ROOT_DIR}${TNAME}
157 [ "${VERBOSE}" != "no" ] && echo "Checking for -${TNAME}-."
158
159 [ "${TTYPE}" = "l" ] && {
160 TSOURCE="$TLTARGET"
161 [ "${VERBOSE}" != "no" ] && echo "Creating link -${TNAME}- pointing to -${TSOURCE}-."
162 link_file "${TSOURCE}" "${TNAME}"
163 continue
164 }
165
166 [ -L "${TNAME}" ] && {
167 [ "${VERBOSE}" != "no" ] && echo "Found link."
168 NEWNAME=`ls -l "${TNAME}" | sed -e 's/^.*-> \(.*\)$/\1/'`
169 echo ${NEWNAME} | grep -v "^/" >/dev/null && {
170 TNAME="`echo ${TNAME} | sed -e 's@\(.*\)/.*@\1@'`/${NEWNAME}"
171 [ "${VERBOSE}" != "no" ] && echo "Converted relative linktarget to absolute path -${TNAME}-."
172 } || {
173 TNAME="${NEWNAME}"
174 [ "${VERBOSE}" != "no" ] && echo "Using absolute link target -${TNAME}-."
175 }
176 }
177
178 case "${TTYPE}" in
179 "f") [ "${VERBOSE}" != "no" ] && echo "Creating file -${TNAME}-."
180 create_file "${TNAME}" &
181 ;;
182 "d") [ "${VERBOSE}" != "no" ] && echo "Creating directory -${TNAME}-."
183 mk_dir "${TNAME}"
184 # Add check to see if there's an entry in fstab to mount.
185 ;;
186 *) [ "${VERBOSE}" != "no" ] && echo "Invalid type -${TTYPE}-."
187 continue
188 ;;
189 esac
190 done
191 return 0
192}
193
194clearcache=0
195exec 9</proc/cmdline
196while read line <&9
197do
198 case "$line" in
199 *clearcache*) clearcache=1
200 ;;
201 *) continue
202 ;;
203 esac
204done
205exec 9>&-
206
207if test -e ${ROOT_DIR}/etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
208then
209 sh ${ROOT_DIR}/etc/volatile.cache
210else
211 rm -f ${ROOT_DIR}/etc/volatile.cache ${ROOT_DIR}/etc/volatile.cache.build
212 for file in `ls -1 "${CFGDIR}" | sort`; do
213 apply_cfgfile "${CFGDIR}/${file}"
214 done
215
216 [ -e ${ROOT_DIR}/etc/volatile.cache.build ] && sync && mv ${ROOT_DIR}/etc/volatile.cache.build ${ROOT_DIR}/etc/volatile.cache
217fi
218
219if [ -z "${ROOT_DIR}" ] && [ -f /etc/ld.so.cache ] && [ ! -f /var/run/ld.so.cache ]
220then
221 ln -s /etc/ld.so.cache /var/run/ld.so.cache
222fi
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
new file mode 100644
index 0000000000..1a0328d63e
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/read-only-rootfs-hook.sh
@@ -0,0 +1,38 @@
1#!/bin/sh
2
3. /etc/default/rcS
4
5[ "$ROOTFS_READ_ONLY" = "no" ] && exit 0
6
7is_on_read_only_partition () {
8 DIRECTORY=$1
9 dir=`readlink -f $DIRECTORY`
10 while true; do
11 if [ ! -d "$dir" ]; then
12 echo "ERROR: $dir is not a directory"
13 exit 1
14 else
15 for flag in `awk -v dir=$dir '{ if ($2 == dir) { print "FOUND"; split($4,FLAGS,",") } }; \
16 END { for (f in FLAGS) print FLAGS[f] }' < /proc/mounts`; do
17 [ "$flag" = "FOUND" ] && partition="read-write"
18 [ "$flag" = "ro" ] && { partition="read-only"; break; }
19 done
20 if [ "$dir" = "/" -o -n "$partition" ]; then
21 break
22 else
23 dir=`dirname $dir`
24 fi
25 fi
26 done
27 [ "$partition" = "read-only" ] && echo "yes" || echo "no"
28}
29
30if [ "$1" = "start" ] ; then
31 if [ `is_on_read_only_partition /var/lib` = "yes" ]; then
32 grep -q "tmpfs /var/volatile" /proc/mounts || mount /var/volatile
33 mkdir -p /var/volatile/lib
34 cp -a /var/lib/* /var/volatile/lib
35 mount --bind /var/volatile/lib /var/lib
36 fi
37fi
38
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/reboot b/meta/recipes-core/initscripts/initscripts-1.0/reboot
new file mode 100755
index 0000000000..087d8d5da4
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/reboot
@@ -0,0 +1,15 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: reboot
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 6
8# Short-Description: Execute the reboot command.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14echo -n "Rebooting... "
15reboot SED_HALTARGS
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh
new file mode 100755
index 0000000000..76de3418ac
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/rmnologin.sh
@@ -0,0 +1,20 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: rmnologin
4# Required-Start: $remote_fs $all
5# Required-Stop:
6# Default-Start: 2 3 4 5
7# Default-Stop:
8# Short-Description: Remove /etc/nologin at boot
9# Description: This script removes the /etc/nologin file as the
10# last step in the boot process, if DELAYLOGIN=yes.
11# If DELAYLOGIN=no, /etc/nologin was not created by
12# bootmisc earlier in the boot process.
13### END INIT INFO
14
15if test -f /etc/nologin.boot
16then
17 rm -f /etc/nologin /etc/nologin.boot
18fi
19
20: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
new file mode 100644
index 0000000000..b038fc59d4
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
@@ -0,0 +1,13 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: save-rtc
4# Required-Start:
5# Required-Stop: $local_fs hwclock
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Store system clock into file
9# Description:
10### END INIT INFO
11
12# Update the timestamp
13date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sendsigs b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs
new file mode 100755
index 0000000000..34e1b7714b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/sendsigs
@@ -0,0 +1,21 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: sendsigs
4# Required-Start:
5# Required-Stop: umountnfs
6# Default-Start:
7# Default-Stop: 0 6
8# Short-Description: Kill all remaining processes.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# Kill all processes.
15echo "Sending all processes the TERM signal..."
16killall5 -15
17sleep 5
18echo "Sending all processes the KILL signal..."
19killall5 -9
20
21: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/single b/meta/recipes-core/initscripts/initscripts-1.0/single
new file mode 100755
index 0000000000..da82d178a1
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/single
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: single
4# Required-Start: $local_fs $all killprocs
5# Required-Stop:
6# Default-Start: 1
7# Default-Stop:
8# Short-Description: executed by init(8) upon entering runlevel 1 (single).
9### END INIT INFO
10
11PATH="/sbin:/bin:/usr/sbin:/usr/bin"
12
13# Kill all processes.
14echo "Sending all processes the TERM signal..."
15killall5 -15
16sleep 5
17echo "Sending all processes the KILL signal..."
18killall5 -9
19
20# We start update here, since we just killed it.
21test -x /sbin/update && update
22
23echo "Entering single-user mode..."
24exec init -t1 S
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
new file mode 100644
index 0000000000..0cfe76e230
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/sysfs.sh
@@ -0,0 +1,23 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: mountvirtfs
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Mount kernel virtual file systems.
9# Description: Mount initial set of virtual filesystems the kernel
10# provides and that are required by everything.
11### END INIT INFO
12
13if [ -e /proc ] && ! [ -e /proc/mounts ]; then
14 mount -t proc proc /proc
15fi
16
17if [ -e /sys ] && grep -q sysfs /proc/filesystems && ! [ -e /sys/class ]; then
18 mount -t sysfs sysfs /sys
19fi
20
21if [ -e /sys/kernel/debug ] && grep -q debugfs /proc/filesystems; then
22 mount -t debugfs debugfs /sys/kernel/debug
23fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountfs b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
new file mode 100755
index 0000000000..61324c630b
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/umountfs
@@ -0,0 +1,24 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: umountfs
4# Required-Start:
5# Required-Stop:
6# Default-Start:
7# Default-Stop: 0 6
8# Short-Description: Turn off swap and unmount all local file systems.
9# Description:
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14echo "Deactivating swap..."
15swapoff -a
16
17# We leave /proc mounted.
18echo "Unmounting local filesystems..."
19grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram
20mount -o remount,ro /
21
22umount -f -a -r > /dev/null 2>&1
23
24: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
new file mode 100755
index 0000000000..af075407fd
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh
@@ -0,0 +1,33 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: umountnfs
4# Required-Start:
5# Required-Stop: umountfs
6# Should-Stop: $network $portmap
7# Default-Start:
8# Default-Stop: 0 6
9# Short-Description: Unmount all network filesystems
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13
14# Write a reboot record to /var/log/wtmp before unmounting
15halt -w
16
17echo "Unmounting remote filesystems..."
18
19test -f /etc/fstab && (
20
21#
22# Read through fstab line by line and unount network file systems
23#
24while read device mountpt fstype options
25do
26 if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs
27 then
28 umount -f $mountpt
29 fi
30done
31) < /etc/fstab
32
33: exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/urandom b/meta/recipes-core/initscripts/initscripts-1.0/urandom
new file mode 100755
index 0000000000..af1625b5fd
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/urandom
@@ -0,0 +1,49 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: urandom
4# Required-Start: $local_fs mountvirtfs
5# Required-Stop: $local_fs
6# Default-Start: S
7# Default-Stop: 0 6
8# Short-Description: Save and restore the random seed
9# Description: Save the random seed on shutdown and restore it on boot,
10# to ensure that the seed isn't predicable on startup
11# (because the boot process is predictable)
12### END INIT INFO
13
14test -c /dev/urandom || exit 0
15
16RANDOM_SEED_FILE=/var/lib/urandom/random-seed
17
18. /etc/default/rcS
19[ -f /etc/default/urandom ] && . /etc/default/urandom
20
21case "$1" in
22 start|"")
23 test "$VERBOSE" != no && echo "Initializing random number generator..."
24 # Load and then save 512 bytes, which is the size of the entropy
25 # pool. Also load the current date, in case the seed file is
26 # empty.
27 ( date +%s.%N; [ -f "$RANDOM_SEED_FILE" ] && cat "$RANDOM_SEED_FILE" ) \
28 >/dev/urandom
29 rm -f "$RANDOM_SEED_FILE"
30 umask 077
31 dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
32 >/dev/null 2>&1 || echo "urandom start: failed."
33 umask 022
34 ;;
35 stop)
36 # Carry a random seed from shut-down to start-up;
37 # see documentation in linux/drivers/char/random.c
38 test "$VERBOSE" != no && echo "Saving random seed..."
39 umask 077
40 dd if=/dev/urandom of=$RANDOM_SEED_FILE count=1 \
41 >/dev/null 2>&1 || echo "urandom stop: failed."
42 ;;
43 *)
44 echo "Usage: urandom {start|stop}" >&2
45 exit 1
46 ;;
47esac
48
49exit 0
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/volatiles b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
new file mode 100644
index 0000000000..297245d0e4
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts-1.0/volatiles
@@ -0,0 +1,36 @@
1# This configuration file lists filesystem objects that should get verified
2# during startup and be created if missing.
3#
4# Every line must either be a comment starting with #
5# or a definition of format:
6# <type> <owner> <group> <mode> <path> <linksource>
7# where the items are separated by whitespace !
8#
9# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
10#
11# A linking example:
12# l root root 0777 /var/test /tmp/testfile
13# f root root 0644 /var/test none
14#
15# Understanding links:
16# When populate-volatile is to verify/create a directory or file, it will first
17# check it's existence. If a link is found to exist in the place of the target,
18# the path of the target is replaced with the target the link points to.
19# Thus, if a link is in the place to be verified, the object will be created
20# in the place the link points to instead.
21# This explains the order of "link before object" as in the example above, where
22# a link will be created at /var/test pointing to /tmp/testfile and due to this
23# link the file defined as /var/test will actually be created as /tmp/testfile.
24d root root 1777 /run/lock none
25d root root 0755 /var/volatile/log none
26d root root 1777 /var/volatile/tmp none
27l root root 1777 /var/lock /run/lock
28l root root 0755 /var/log /var/volatile/log
29l root root 0755 /var/run /run
30l root root 1777 /var/tmp /var/volatile/tmp
31l root root 1777 /tmp /var/tmp
32d root root 0755 /var/lock/subsys none
33f root root 0664 /var/log/wtmp none
34f root root 0664 /var/run/utmp none
35l root root 0644 /etc/resolv.conf /var/run/resolv.conf
36f root root 0644 /var/run/resolv.conf none
diff --git a/meta/recipes-core/initscripts/initscripts_1.0.bb b/meta/recipes-core/initscripts/initscripts_1.0.bb
new file mode 100644
index 0000000000..775816a37f
--- /dev/null
+++ b/meta/recipes-core/initscripts/initscripts_1.0.bb
@@ -0,0 +1,169 @@
1SUMMARY = "SysV init scripts"
2DESCRIPTION = "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."
3SECTION = "base"
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
6PR = "r155"
7
8INHIBIT_DEFAULT_DEPS = "1"
9
10SRC_URI = "file://functions \
11 file://halt \
12 file://umountfs \
13 file://devpts.sh \
14 file://devpts \
15 file://hostname.sh \
16 file://mountall.sh \
17 file://banner.sh \
18 file://bootmisc.sh \
19 file://mountnfs.sh \
20 file://reboot \
21 file://checkfs.sh \
22 file://single \
23 file://sendsigs \
24 file://urandom \
25 file://rmnologin.sh \
26 file://checkroot.sh \
27 file://umountnfs.sh \
28 file://sysfs.sh \
29 file://populate-volatile.sh \
30 file://read-only-rootfs-hook.sh \
31 file://volatiles \
32 file://save-rtc.sh \
33 file://GPLv2.patch \
34 file://dmesg.sh \
35 file://logrotate-dmesg.conf \
36"
37
38SRC_URI_append_arm = " file://alignment.sh"
39
40KERNEL_VERSION = ""
41
42inherit update-alternatives
43DEPENDS_append = " update-rc.d-native"
44DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
45
46PACKAGES =+ "${PN}-functions"
47RDEPENDS_${PN} = "${PN}-functions"
48FILES_${PN}-functions = "${sysconfdir}/init.d/functions*"
49
50ALTERNATIVE_PRIORITY_${PN}-functions = "90"
51ALTERNATIVE_${PN}-functions = "functions"
52ALTERNATIVE_LINK_NAME[functions] = "${sysconfdir}/init.d/functions"
53
54HALTARGS ?= "-d -f"
55
56do_configure() {
57 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/halt
58 sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
59}
60
61do_install () {
62#
63# Create directories and install device independent scripts
64#
65 install -d ${D}${sysconfdir}/init.d
66 install -d ${D}${sysconfdir}/rcS.d
67 install -d ${D}${sysconfdir}/rc0.d
68 install -d ${D}${sysconfdir}/rc1.d
69 install -d ${D}${sysconfdir}/rc2.d
70 install -d ${D}${sysconfdir}/rc3.d
71 install -d ${D}${sysconfdir}/rc4.d
72 install -d ${D}${sysconfdir}/rc5.d
73 install -d ${D}${sysconfdir}/rc6.d
74 install -d ${D}${sysconfdir}/default
75 install -d ${D}${sysconfdir}/default/volatiles
76 # Holds state information pertaining to urandom
77 install -d ${D}/var/lib/urandom
78
79 install -m 0644 ${WORKDIR}/functions ${D}${sysconfdir}/init.d
80 install -m 0755 ${WORKDIR}/bootmisc.sh ${D}${sysconfdir}/init.d
81 install -m 0755 ${WORKDIR}/checkroot.sh ${D}${sysconfdir}/init.d
82 install -m 0755 ${WORKDIR}/halt ${D}${sysconfdir}/init.d
83 install -m 0755 ${WORKDIR}/hostname.sh ${D}${sysconfdir}/init.d
84 install -m 0755 ${WORKDIR}/mountall.sh ${D}${sysconfdir}/init.d
85 install -m 0755 ${WORKDIR}/mountnfs.sh ${D}${sysconfdir}/init.d
86 install -m 0755 ${WORKDIR}/reboot ${D}${sysconfdir}/init.d
87 install -m 0755 ${WORKDIR}/rmnologin.sh ${D}${sysconfdir}/init.d
88 install -m 0755 ${WORKDIR}/sendsigs ${D}${sysconfdir}/init.d
89 install -m 0755 ${WORKDIR}/single ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/umountnfs.sh ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/urandom ${D}${sysconfdir}/init.d
92 install -m 0755 ${WORKDIR}/devpts.sh ${D}${sysconfdir}/init.d
93 install -m 0755 ${WORKDIR}/devpts ${D}${sysconfdir}/default
94 install -m 0755 ${WORKDIR}/sysfs.sh ${D}${sysconfdir}/init.d
95 install -m 0755 ${WORKDIR}/populate-volatile.sh ${D}${sysconfdir}/init.d
96 install -m 0755 ${WORKDIR}/read-only-rootfs-hook.sh ${D}${sysconfdir}/init.d
97 install -m 0755 ${WORKDIR}/save-rtc.sh ${D}${sysconfdir}/init.d
98 install -m 0644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/00_core
99 install -m 0755 ${WORKDIR}/dmesg.sh ${D}${sysconfdir}/init.d
100 install -m 0644 ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
101
102 if [ "${TARGET_ARCH}" = "arm" ]; then
103 install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
104 fi
105#
106# Install device dependent scripts
107#
108 install -m 0755 ${WORKDIR}/banner.sh ${D}${sysconfdir}/init.d/banner.sh
109 install -m 0755 ${WORKDIR}/umountfs ${D}${sysconfdir}/init.d/umountfs
110#
111# Create runlevel links
112#
113 update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
114 update-rc.d -r ${D} sendsigs start 20 0 6 .
115 update-rc.d -r ${D} urandom start 30 S 0 6 .
116 update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
117 update-rc.d -r ${D} umountfs start 40 0 6 .
118 update-rc.d -r ${D} reboot start 90 6 .
119 update-rc.d -r ${D} halt start 90 0 .
120 update-rc.d -r ${D} save-rtc.sh start 25 0 6 .
121 update-rc.d -r ${D} banner.sh start 02 S .
122 update-rc.d -r ${D} checkroot.sh start 06 S .
123 update-rc.d -r ${D} mountall.sh start 03 S .
124 update-rc.d -r ${D} hostname.sh start 39 S .
125 update-rc.d -r ${D} mountnfs.sh start 15 2 3 4 5 .
126 update-rc.d -r ${D} bootmisc.sh start 55 S .
127 update-rc.d -r ${D} sysfs.sh start 02 S .
128 update-rc.d -r ${D} populate-volatile.sh start 37 S .
129 update-rc.d -r ${D} read-only-rootfs-hook.sh start 29 S .
130 update-rc.d -r ${D} devpts.sh start 38 S .
131 if [ "${TARGET_ARCH}" = "arm" ]; then
132 update-rc.d -r ${D} alignment.sh start 06 S .
133 fi
134 # We wish to have /var/log ready at this stage so execute this after
135 # populate-volatile.sh
136 update-rc.d -r ${D} dmesg.sh start 38 S .
137}
138
139MASKED_SCRIPTS = " \
140 banner \
141 bootmisc \
142 checkfs \
143 checkroot \
144 devpts \
145 dmesg \
146 hostname \
147 mountall \
148 mountnfs \
149 populate-volatile \
150 read-only-rootfs-hook \
151 rmnologin \
152 sysfs \
153 urandom"
154
155pkg_postinst_${PN} () {
156 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
157 if [ -n "$D" ]; then
158 OPTS="--root=$D"
159 fi
160 for SERVICE in ${MASKED_SCRIPTS}; do
161 systemctl $OPTS mask $SERVICE.service
162 done
163 fi
164
165 # Delete any old volatile cache script, as directories may have moved
166 if [ -z "$D" ]; then
167 rm -f "/etc/volatile.cache"
168 fi
169}
diff --git a/meta/recipes-core/jpeg/jpeg-8d/debian-libjpeg7_7-1.diff b/meta/recipes-core/jpeg/jpeg-8d/debian-libjpeg7_7-1.diff
new file mode 100644
index 0000000000..3b8fa6980a
--- /dev/null
+++ b/meta/recipes-core/jpeg/jpeg-8d/debian-libjpeg7_7-1.diff
@@ -0,0 +1,1070 @@
1This is a well-known debian patch used by many Linux distribution, but not
2accepted by upstream yet.
3Upstream-Status: Pending
4
5--- libjpeg7-7.orig/config.sub
6+++ libjpeg7-7/config.sub
7@@ -1,4 +1,10 @@
8 #! /bin/sh
9+# autotools-dev hack (<ballombe@debian.org>, Wed, 14 Nov 2001 10:13:10 +0100)
10+if [ -x /usr/share/misc/config.sub ]; then
11+ /usr/share/misc/config.sub $*
12+ exit $?
13+fi
14+
15 # Configuration validation subroutine script.
16 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
17 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
18--- libjpeg7-7.orig/config.guess
19+++ libjpeg7-7/config.guess
20@@ -1,4 +1,10 @@
21 #! /bin/sh
22+# autotools-dev hack (<ballombe@debian.org>, Wed, 14 Nov 2001 10:13:10 +0100)
23+if [ -x /usr/share/misc/config.guess ]; then
24+ /usr/share/misc/config.guess $*
25+ exit $?
26+fi
27+
28 # Attempt to guess a canonical system name.
29 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
30 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
31--- libjpeg7-7.orig/debian/libjpeg7-dev.files
32+++ libjpeg7-7/debian/libjpeg7-dev.files
33@@ -0,0 +1,4 @@
34+usr/include
35+usr/lib/libjpeg.a
36+usr/lib/libjpeg.la
37+usr/lib/libjpeg.so
38--- libjpeg7-7.orig/debian/libjpeg-progs.README.Debian
39+++ libjpeg7-7/debian/libjpeg-progs.README.Debian
40@@ -0,0 +1,13 @@
41+libjpeg-progs for Debian
42+========================
43+
44+This package contains programs for manipulating JPEG files:
45+ cjpeg/djpeg: convert to/from the JPEG file format
46+ rdjpgcom/wrjpgcom: read/write comments in JPEG files
47+ jpegtran: lossless transformations of JPEG files
48+ jpegexiforient/exifautotran: manipulate EXIF orientation tag
49+
50+Thanks for using Debian!
51+
52+--
53+Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:18:59 +0200
54--- libjpeg7-7.orig/debian/shlibs.local
55+++ libjpeg7-7/debian/shlibs.local
56@@ -0,0 +1 @@
57+libjpeg 7 libjpeg7
58--- libjpeg7-7.orig/debian/rules
59+++ libjpeg7-7/debian/rules
60@@ -0,0 +1,71 @@
61+#!/usr/bin/make -f
62+# Made with the aid of debmake, by Christoph Lameter,
63+# based on the sample debian/rules file for GNU hello by Ian Jackson.
64+
65+package=libjpeg
66+
67+export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
68+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
69+
70+export CFLAGS=-D_REENTRANT -g -Wall
71+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
72+CFLAGS += -O0
73+else
74+CFLAGS += -O2
75+endif
76+
77+#export DH_VERBOSE=1
78+
79+build: build-stamp
80+build-stamp:
81+ dh_testdir
82+ ./configure --prefix=/usr --mandir=/usr/share/man \
83+ --enable-static --enable-shared \
84+ --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
85+ $(MAKE)
86+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
87+ $(MAKE) check
88+endif
89+ $(MAKE) -C debian/extra
90+
91+ touch build-stamp
92+
93+clean:
94+ dh_testdir
95+ dh_testroot
96+ -rm -f build-stamp
97+ if [ -f Makefile ]; then $(MAKE) distclean; fi
98+ $(MAKE) clean -C debian/extra
99+ dh_clean
100+
101+binary-indep:
102+
103+binary-arch: build
104+ dh_testdir
105+ dh_testroot
106+ dh_clean -k
107+ dh_installdirs
108+ $(MAKE) install DESTDIR=`pwd`/debian/tmp
109+ $(MAKE) install -C debian/extra prefix=/usr DESTDIR=`pwd`/debian/tmp
110+ # fix jconfig.h
111+ rm debian/tmp/usr/include/jconfig.h
112+ sed -e "s/#\(undef\|define\) HAVE_\(LOCALE\|\(STD\(DEF\|LIB\)\)\)_H 1//g" \
113+ jconfig.h > debian/tmp/usr/include/jconfig.h
114+ # separate out lib package
115+ dh_movefiles
116+ # Finish it off with debhelper
117+ dh_installdocs README
118+ dh_installexamples
119+ dh_installchangelogs change.log
120+ dh_strip --dbg-package=libjpeg7-dbg
121+ dh_compress
122+ dh_fixperms
123+ dh_installdeb
124+ dh_shlibdeps -l`pwd`/debian/libjpeg7/usr/lib
125+ dh_gencontrol
126+ dh_md5sums
127+ dh_builddeb
128+
129+binary: binary-indep binary-arch
130+
131+.PHONY: clean binary-indep binary-arch binary build
132--- libjpeg7-7.orig/debian/libjpeg7-dev.README.Debian
133+++ libjpeg7-7/debian/libjpeg7-dev.README.Debian
134@@ -0,0 +1,18 @@
135+IJG JPEG for Debian
136+===================
137+
138+The following patch has been applied to the headers files:
139+
140+--- jconfig.h: Remove unused symbol HAVE_STDDEF_H, HAVE_STDLIB_H and
141+HAVE_LOCALE_H since they are not used by the installed headers files and cause
142+problem with autoconf.
143+
144+This can theoretically cause problems if your software relies on theses symbols
145+being defined by this header. If it ever happens, please define them manually.
146+
147+Note: this is not Debian-specific, others distributions apply similar patches.
148+
149+Thanks for using Debian!
150+
151+---
152+Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:17:56 +0200
153--- libjpeg7-7.orig/debian/shlibs
154+++ libjpeg7-7/debian/shlibs
155@@ -0,0 +1 @@
156+libjpeg 7 libjpeg7
157--- libjpeg7-7.orig/debian/control
158+++ libjpeg7-7/debian/control
159@@ -0,0 +1,52 @@
160+Source: libjpeg7
161+Maintainer: Bill Allombert <ballombe@debian.org>
162+Section: graphics
163+Priority: optional
164+Build-Depends: debhelper (>= 5), autotools-dev
165+Standards-Version: 3.8.2
166+
167+Package: libjpeg7
168+Architecture: any
169+Section: libs
170+Description: The Independent JPEG Group's JPEG runtime library
171+ The Independent JPEG Group's JPEG library is a library for handling
172+ JPEG files.
173+ .
174+ This package contains the shared library.
175+Depends: ${shlibs:Depends}
176+
177+Package: libjpeg7-dev
178+Architecture: any
179+Section: libdevel
180+Description: Development files for the IJG JPEG library
181+ The Independent JPEG Group's JPEG library is a library for handling
182+ JPEG files.
183+ .
184+ This package contains the static library, headers and documentation.
185+Depends: libjpeg7 (=${binary:Version}), libc-dev
186+Conflicts: libjpeg62-dev
187+Replaces: libjpeg62-dev
188+
189+Package: libjpeg7-dbg
190+Architecture: any
191+Section: debug
192+Priority: extra
193+Description: Development files for the IJG JPEG library
194+ The Independent JPEG Group's JPEG library is a library for handling
195+ JPEG files.
196+ .
197+ This package contains the debugging symbols for libjpeg.
198+Provides: libjpeg-dbg
199+Depends: libjpeg7 (=${binary:Version})
200+Conflicts: libjpeg62-dbg
201+Replaces: libjpeg62-dbg
202+
203+Package: libjpeg-progs
204+Architecture: any
205+Description: Programs for manipulating JPEG files
206+ This package contains programs for manipulating JPEG files:
207+ cjpeg/djpeg: convert to/from the JPEG file format
208+ rdjpgcom/wrjpgcom: read/write comments in JPEG files
209+ jpegtran: lossless transformations of JPEG files
210+ jpegexiforient/exifautotran: manipulate EXIF orientation tag
211+Depends: ${shlibs:Depends}
212--- libjpeg7-7.orig/debian/libjpeg7.files
213+++ libjpeg7-7/debian/libjpeg7.files
214@@ -0,0 +1,2 @@
215+/usr/lib/libjpeg.so.7.0.0
216+/usr/lib/libjpeg.so.7
217--- libjpeg7-7.orig/debian/postinst
218+++ libjpeg7-7/debian/postinst
219@@ -0,0 +1,8 @@
220+#!/bin/sh -e
221+
222+#DEBHELPER#
223+
224+if [ "$1" = "configure" ]; then
225+ ldconfig
226+fi
227+
228--- libjpeg7-7.orig/debian/compat
229+++ libjpeg7-7/debian/compat
230@@ -0,0 +1 @@
231+5
232--- libjpeg7-7.orig/debian/libjpeg7-dev.examples
233+++ libjpeg7-7/debian/libjpeg7-dev.examples
234@@ -0,0 +1 @@
235+example.c
236--- libjpeg7-7.orig/debian/changelog
237+++ libjpeg7-7/debian/changelog
238@@ -0,0 +1,245 @@
239+libjpeg7 (7-1) unstable; urgency=low
240+
241+ * The "Yoan" release.
242+ * New upstream release. closes: #535350
243+ - This release includes configure.ac and Makefile.am. closes: #346126
244+ - All patches merged upstream.
245+ - Remove dpatch support.
246+ * debian/control:
247+ - Remove Build-Dependency on libtool and sharutils.
248+ - Move libjpeg7-dbg to debug section.
249+ - Bump standard version to 3.8.2.
250+ * Skip test-suite if nocheck is set. closes: #451222
251+
252+ -- Bill Allombert <ballombe@debian.org> Sun, 05 Jul 2009 15:29:27 +0200
253+
254+libjpeg6b (6b-14) unstable; urgency=low
255+
256+ * The "Lino" release.
257+ * exifautotran:
258+ - fix typo in manpage. closes: #376371, thanks Reuben Thomas.
259+ - preserve file mode. closes: #383379, thanks Vincent Arkesteijn.
260+ * debian/control, debian/rules, debian/compat:
261+ + switch to debhelper v5
262+ + add libjpeg-dbg debugging package.
263+ * debian/rules: remove - before "make clean" rules.
264+ * Add patch 204_jpegtran_man to improve readability of manpage.
265+ closes: #437453. Thanks Jorgen Grahn.
266+ * jpegexiforient.1: Apply patch from Jorgen Grahn to improve formatting.
267+ closes: #437446.
268+
269+ -- Bill Allombert <ballombe@debian.org> Thu, 16 Aug 2007 22:59:21 +0200
270+
271+libjpeg6b (6b-13) unstable; urgency=low
272+
273+ * The "If at first you don't succeed..." release.
274+ * Change --enable-maxmem to 1024, following Guido advice.
275+ This should fix the slowdowns with large files (for large < 1Gb):
276+ closes: #356556, #365025, Thanks Nicolas.
277+ If you hit performance problems, please set the JPEGMEM variable to
278+ about half your available RAM, see jpegtran(1).
279+ * Update libjpeg-progs README.Debian to reflect the new patch set and
280+ the JPEGMEM feature.
281+ * Bump standard version to 3.7.2.
282+
283+ -- Bill Allombert <ballombe@debian.org> Fri, 5 May 2006 19:14:25 +0200
284+
285+libjpeg6b (6b-12) unstable; urgency=low
286+
287+ * The "vote for me" release
288+ * Bump standard version to 3.6.2.
289+ * Run 'make test' instead of home-made test-suite.
290+ * Switch to debhelper v4.
291+ * libjpeg is now configured with --enable-maxmem=32. This limits the memory
292+ usage to 32Mb and it can be overrided by JPEGMEM. Without this flag
293+ JPEGMEM is ignored and there were no limits.
294+ closes: #346023. Thanks C. Scott Ananian.
295+
296+ -- Bill Allombert <ballombe@debian.org> Thu, 2 Mar 2006 18:52:44 +0100
297+
298+libjpeg6b (6b-11) unstable; urgency=high
299+
300+ * The "Silencio" release
301+ * exifautotran: Apply patch by Uwe Zeisberger to fix bad temporary file
302+ handling. closes: #340079
303+
304+ -- Bill Allombert <ballombe@debian.org> Sun, 20 Nov 2005 20:57:07 +0100
305+
306+libjpeg6b (6b-10) unstable; urgency=low
307+
308+ * The "timeout" release.
309+ * Rebuild with current toolchain.
310+ * Depends on libc-dev instead of libc6-dev. closes: #294696
311+ Thanks Joel Aelwyn for discussing thoroughly the matter.
312+ * Instead of copying /usr/bin/libtool, we replace it by a script that
313+ call libtool (using standard path search). Remarked by Jesus Climent.
314+ * debian/control: remove pre-hamm cruft.
315+ * Add jpegexiforient and jpegautotran by Guido Vollbeding
316+ <http://sylvana.net/jpegcrop/exif_orientation.html> as proposed by Philip
317+ Armstrong. closes: #257061.
318+ * Run the test-suite at build time instead of shipping it in the package:
319+ - /usr/share/doc/libjpeg-progs/tests: removed.
320+ - debian/control: Add Build-Depends on sharutils for uuencode.
321+ - debian/libjpeg-progs.dirs: removed.
322+ - debian/libjpeg-progs.test: removed.
323+
324+ -- Bill Allombert <ballombe@debian.org> Tue, 1 Mar 2005 19:43:26 +0100
325+
326+libjpeg6b (6b-9) unstable; urgency=low
327+
328+ * The "I'm all for aggressive goals" release.
329+ * Rebuild with new libtool. closes: #201943.
330+ * patch 100_crop: Updated from Guido Vollbeding <guido@jpegclub.org>
331+ to include patches 203_jpegtran_errmsg,204_perfect.
332+ * patch 200_crop_man: Include 205_perfect_man.
333+ * patches 203_jpegtran_errmsg, 204_perfect, 205_perfect_man: removed
334+ * Add patch 203_rdppm: fix cjpeg issue with 16-bit PPM files. closes: #208937
335+ * Bump standard version to 3.6.1.
336+ * Update debian/edit-patch.
337+
338+ -- Bill Allombert <ballombe@debian.org> Mon, 8 Sep 2003 16:22:08 +0200
339+
340+libjpeg6b (6b-8) unstable; urgency=low
341+
342+ * The "I *hate* when that happens" release.
343+ * Move libjpeg62-dev to libdevel section.
344+ * See debian/README.sources for detail about the (d)patch system.
345+ * debian/rules: avoid to run configure twice.
346+ * Add patches 204_perfect and 205_perfect_man. They implement the
347+ -perfect jpegtran option as proposed by Mark W. Eichin. closes: #189027
348+ * Bump standard version to 3.5.10.
349+ * Use /usr/bin/libtool instead of ldconfig-generated libtool, and remove
350+ various libtool related kludges, including patch 301_configure.
351+ closes: #195281. Thanks Robert Millan for the suggestion.
352+ * Remove patch 302_makefile. Fix debian/rules instead.
353+
354+ -- Bill Allombert <ballombe@debian.org> Sat, 31 May 2003 16:16:59 +0200
355+
356+libjpeg6b (6b-7) unstable; urgency=low
357+
358+ * Rebuild with new gcc/new glibc/new debhelper.
359+ * Add -g to build options according to new policy.
360+ * Add support for DEB_BUILD_OPTIONS noopt. nostrip is handled by dh_strip.
361+ * Bump standard version to 3.5.9.
362+ * Extend description a bit (If you have a better one please email me!).
363+ * Use dpatch to handle the patches.
364+
365+ -- Bill Allombert <ballombe@debian.org> Sun, 16 Mar 2003 12:19:36 +0100
366+
367+libjpeg6b (6b-6) unstable; urgency=low
368+
369+ * The "Try to break sarge before it even got a name" release
370+ * jpegtran: better error messages when opening files.
371+ closes: #147516 Thanks Mark W. Eichin.
372+ * Add debian/patch dir with my patches.
373+ * Add extern "C" if we are under C++.
374+ closes: #113167 Thanks, Fredrik Jagenheim.
375+ * Remove HAVE_STD{LIB,DEF}_H from jconfig.h since they are not used and
376+ conflict with autoconf. closes: #109516 Thanks <Benedikt.Roth@gmx.net>
377+ * Add README.Debian in /usr/share/libjpeg62-dev
378+
379+ -- Bill Allombert <ballombe@debian.org> Mon, 3 Jun 2002 19:34:08 +0200
380+
381+libjpeg6b (6b-5) unstable; urgency=low
382+
383+ * jpeg-->JPEG in libjpeg-progs description.
384+ * Add lib path to dh_shlibdeps to avoid warning.
385+ * Apply patch from <http://sylvana.net/jpegcrop/croppatch.tar.gz> by
386+ <guido@jpegclub.org> closes: #129412 Thanks, Colin Marquardt.
387+
388+ -- Bill Allombert <ballombe@debian.org> Mon, 20 May 2002 11:55:22 +0200
389+
390+libjpeg6b (6b-4) unstable; urgency=low
391+
392+ * Avoid bashism in debian/rules.
393+ * Update libtool to 1.3.5. (1.4 will break).
394+ closes: #52095 Thanks, <Marcus.Brinkmann@ruhr-uni-bochum.de>
395+ * Patch config.guess to use version in the autotools-dev package.
396+ * Correct Section: field of libjpeg62 and libjpeg62-dev.
397+
398+ -- Bill Allombert <ballombe@debian.org> Tue, 20 Nov 2001 10:23:47 +0100
399+
400+libjpeg6b (6b-3) unstable; urgency=low
401+
402+ * The "Where is ltconfig ?" release.
403+ * Remove jconfig.h in debian/rules clean and do some clean up.
404+ * Install libjpeg.la per Policy 11.2.
405+ * Remove duplicate wizard.doc file in libjpeg62-dev.
406+ * Use dpkg-architecture instead of config.guess.
407+ * Patch config.sub to use version in the autotools-dev package.
408+ closes: #85558, #120039
409+ * Patch rdjpgcom.c to use locales for isprint check on comment chars.
410+ closes: #116589 Thanks, Neal H Walfield <neal@cs.uml.edu>
411+ * Apply patch from <http://sylvana.net/jpegcrop/transupp.c> by
412+ <guido@jpegclub.org> closes: #114415 Thanks, <Jean-Marc.Notin@loria.fr>
413+
414+ -- Bill Allombert <ballombe@debian.org> Tue, 13 Nov 2001 21:41:49 +0000
415+
416+libjpeg6b (6b-2) unstable; urgency=low
417+
418+ * New Maintainer. Mark, If you want back the package, just ask!
419+ * Acknowledge previous NMU:
420+ Jordi: closes: #74087, #24330, #24291
421+ Colin: closes: #80752
422+ Joel: closes: #25324, #27033, #28341
423+ * Write source location as a valid URL in debian/copyright.
424+ closes: #118628 Thanks, Doug Porter <dsp@debian.org>.
425+ * Fix formating of description of libjpeg-progs.
426+ closes: #114378 Thanks, Colin Watson <cjwatson@flatline.org.uk>.
427+ * Install jpegint.h header needed by some apps. closes: #100171
428+ * Remove unused/empty debian/postrm.
429+ closes: #24849 Thanks, Adrian Bridgett <adrian.bridgett@zetnet.co.uk>.
430+ * Install wizard.doc file. closes: #64807 Thanks <amc@arwen.cs.berkeley.edu>.
431+ * Fix libjpeg-progs test.sh.
432+ * Fix lintian bugs: typo in copyright, emacs user info in changelog.
433+ * Fix false lintian bug: unsafe ldconfig in postinst, by reformatting.
434+ * Remove "-g" from CFLAGS per Policy 11.1, hoping m68k is fixed now.
435+ * Remove libtool and Makefile in debian/rules clean.
436+ * Fix the test system. As a side effect,
437+ closes: #109195 Thanks Daniel Schepler <schepler@math.berkeley.edu>
438+ * Standards-Version is now 3.5.6.
439+
440+ -- Bill Allombert <ballombe@debian.org> Fri, 9 Nov 2001 22:40:16 +0100
441+
442+libjpeg6b (6b-1.3) frozen unstable; urgency=low
443+
444+ * Non-Maintainer Upload.
445+ * Added Build-Depends.
446+ * Gil Bahat <coutal@netvision.net.il> did the rest of the changes.
447+ * Close bug regarding non-standard jpegs not being processed
448+ (closes: #74087).
449+ * The output gifs are uncompressed, so have no UNISYS patent issues.
450+ (closes: #24330, #24291).
451+ * Standards-Version is now 3.0.0.
452+
453+ -- Jordi Mallach <jordi@debian.org> Sat, 24 Feb 2001 22:17:38 +0100
454+
455+libjpeg6b (6b-1.2) frozen unstable; urgency=low (HIGH for m68k)
456+
457+ * Non-maintainer release.
458+ * Recompile for m68k since existing djpeg binary claims all jpegs I have
459+ are invalid (yet hamm djpeg has no problem with them).
460+ Specifically, added "-O2 -g -Wall" to CFLAGS -- possible gcc bug?
461+
462+ -- Chris Lawrence <lawrencc@debian.org> Tue, 10 Nov 1998 20:57:38 -0600
463+
464+libjpeg6b (6b-1.1) frozen unstable; urgency=high
465+
466+ * Non-maintainer release.
467+ * Use upstream library soname (62).
468+ * Removed libjpeg-gif package, as the source notes
469+ that the GIF reading has been removed, and the GIFs written
470+ do not infringe on the LZW patent.
471+
472+ -- Joel Klecker <espy@debian.org> Thu, 22 Oct 1998 05:49:48 -0700
473+
474+libjpeg6b (6b-1) unstable; urgency=low
475+
476+ * New binary packages for 6b
477+ * New upstream release
478+
479+ -- Mark Mickan <mmickan@debian.org> Tue, 7 Jul 1998 22:27:10 +0930
480+
481+Local variables:
482+mode: debian-changelog
483+End:
484--- libjpeg7-7.orig/debian/libjpeg-progs.files
485+++ libjpeg7-7/debian/libjpeg-progs.files
486@@ -0,0 +1,2 @@
487+usr/bin
488+usr/share/man/man1
489--- libjpeg7-7.orig/debian/libjpeg7-dev.docs
490+++ libjpeg7-7/debian/libjpeg7-dev.docs
491@@ -0,0 +1,3 @@
492+libjpeg.txt
493+structure.txt
494+coderules.txt
495--- libjpeg7-7.orig/debian/libjpeg-progs.docs
496+++ libjpeg7-7/debian/libjpeg-progs.docs
497@@ -0,0 +1,2 @@
498+usage.txt
499+wizard.txt
500--- libjpeg7-7.orig/debian/copyright
501+++ libjpeg7-7/debian/copyright
502@@ -0,0 +1,96 @@
503+This is Debian's prepackaged version of the `jpeg library' by the Independent
504+JPEG Group.
505+
506+This package was created by Mark Mickan <mmickan@debian.org> from sources
507+which can be found at ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
508+
509+It is partly based on the libjpeg6a package originally put together by
510+Andy Guy <awpguy@acs.ucalgary.ca> and later maintained by Mark Mickan.
511+
512+Current Debian maintainer is Bill Allombert <ballombe@debian.org>.
513+
514+LEGAL ISSUES [ from README supplied with source - MM ]
515+============
516+
517+In plain English:
518+
519+1. We don't promise that this software works. (But if you find any bugs,
520+ please let us know!)
521+2. You can use this software for whatever you want. You don't have to pay us.
522+3. You may not pretend that you wrote this software. If you use it in a
523+ program, you must acknowledge somewhere in your documentation that
524+ you've used the IJG code.
525+
526+In legalese:
527+
528+The authors make NO WARRANTY or representation, either express or implied,
529+with respect to this software, its quality, accuracy, merchantability, or
530+fitness for a particular purpose. This software is provided "AS IS", and you,
531+its user, assume the entire risk as to its quality and accuracy.
532+
533+This software is copyright (C) 1991-2009, Thomas G. Lane, Guido Vollbeding.
534+All Rights Reserved except as specified below.
535+
536+Permission is hereby granted to use, copy, modify, and distribute this
537+software (or portions thereof) for any purpose, without fee, subject to these
538+conditions:
539+(1) If any part of the source code for this software is distributed, then this
540+README file must be included, with this copyright and no-warranty notice
541+unaltered; and any additions, deletions, or changes to the original files
542+must be clearly indicated in accompanying documentation.
543+(2) If only executable code is distributed, then the accompanying
544+documentation must state that "this software is based in part on the work of
545+the Independent JPEG Group".
546+(3) Permission for use of this software is granted only if the user accepts
547+full responsibility for any undesirable consequences; the authors accept
548+NO LIABILITY for damages of any kind.
549+
550+These conditions apply to any software derived from or based on the IJG code,
551+not just to the unmodified library. If you use our work, you ought to
552+acknowledge us.
553+
554+Permission is NOT granted for the use of any IJG author's name or company name
555+in advertising or publicity relating to this software or products derived from
556+it. This software may be referred to only as "the Independent JPEG Group's
557+software".
558+
559+We specifically permit and encourage the use of this software as the basis of
560+commercial products, provided that all warranty or liability claims are
561+assumed by the product vendor.
562+
563+
564+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
565+sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
566+ansi2knr.c is NOT covered by the above copyright and conditions, but instead
567+by the usual distribution terms of the Free Software Foundation; principally,
568+that you must include source code if you redistribute it. (See the file
569+ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
570+of any program generated from the IJG code, this does not limit you more than
571+the foregoing paragraphs do.
572+
573+The Unix configuration script "configure" was produced with GNU Autoconf.
574+It is copyright by the Free Software Foundation but is freely distributable.
575+The same holds for its supporting scripts (config.guess, config.sub,
576+ltconfig, ltmain.sh). Another support script, install-sh, is copyright
577+by M.I.T. but is also freely distributable.
578+
579+It appears that the arithmetic coding option of the JPEG spec is covered by
580+patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot
581+legally be used without obtaining one or more licenses. For this reason,
582+support for arithmetic coding has been removed from the free JPEG software.
583+(Since arithmetic coding provides only a marginal gain over the unpatented
584+Huffman mode, it is unlikely that very many implementations will support it.)
585+So far as we are aware, there are no patent restrictions on the remaining
586+code.
587+
588+The IJG distribution formerly included code to read and write GIF files.
589+To avoid entanglement with the Unisys LZW patent, GIF reading support has
590+been removed altogether, and the GIF writer has been simplified to produce
591+"uncompressed GIFs". This technique does not use the LZW algorithm; the
592+resulting GIF files are larger than usual, but are readable by all standard
593+GIF decoders.
594+
595+We are required to state that
596+ "The Graphics Interchange Format(c) is the Copyright property of
597+ CompuServe Incorporated. GIF(sm) is a Service Mark property of
598+ CompuServe Incorporated."
599--- libjpeg7-7.orig/debian/extra/jpegexiforient.c
600+++ libjpeg7-7/debian/extra/jpegexiforient.c
601@@ -0,0 +1,299 @@
602+/*
603+ * jpegexiforient.c
604+ *
605+ * This is a utility program to get and set the Exif Orientation Tag.
606+ * It can be used together with jpegtran in scripts for automatic
607+ * orientation correction of digital camera pictures.
608+ *
609+ * The Exif orientation value gives the orientation of the camera
610+ * relative to the scene when the image was captured. The relation
611+ * of the '0th row' and '0th column' to visual position is shown as
612+ * below.
613+ *
614+ * Value | 0th Row | 0th Column
615+ * ------+-------------+-----------
616+ * 1 | top | left side
617+ * 2 | top | rigth side
618+ * 3 | bottom | rigth side
619+ * 4 | bottom | left side
620+ * 5 | left side | top
621+ * 6 | right side | top
622+ * 7 | right side | bottom
623+ * 8 | left side | bottom
624+ *
625+ * For convenience, here is what the letter F would look like if it were
626+ * tagged correctly and displayed by a program that ignores the orientation
627+ * tag:
628+ *
629+ * 1 2 3 4 5 6 7 8
630+ *
631+ * 888888 888888 88 88 8888888888 88 88 8888888888
632+ * 88 88 88 88 88 88 88 88 88 88 88 88
633+ * 8888 8888 8888 8888 88 8888888888 8888888888 88
634+ * 88 88 88 88
635+ * 88 88 888888 888888
636+ *
637+ */
638+
639+#include <stdio.h>
640+#include <stdlib.h>
641+
642+static FILE * myfile; /* My JPEG file */
643+
644+static unsigned char exif_data[65536L];
645+
646+/* Return next input byte, or EOF if no more */
647+#define NEXTBYTE() getc(myfile)
648+
649+/* Error exit handler */
650+#define ERREXIT(msg) (exit(0))
651+
652+/* Read one byte, testing for EOF */
653+static int
654+read_1_byte (void)
655+{
656+ int c;
657+
658+ c = NEXTBYTE();
659+ if (c == EOF)
660+ ERREXIT("Premature EOF in JPEG file");
661+ return c;
662+}
663+
664+/* Read 2 bytes, convert to unsigned int */
665+/* All 2-byte quantities in JPEG markers are MSB first */
666+static unsigned int
667+read_2_bytes (void)
668+{
669+ int c1, c2;
670+
671+ c1 = NEXTBYTE();
672+ if (c1 == EOF)
673+ ERREXIT("Premature EOF in JPEG file");
674+ c2 = NEXTBYTE();
675+ if (c2 == EOF)
676+ ERREXIT("Premature EOF in JPEG file");
677+ return (((unsigned int) c1) << 8) + ((unsigned int) c2);
678+}
679+
680+static const char * progname; /* program name for error messages */
681+
682+static void
683+usage (FILE *out)
684+/* complain about bad command line */
685+{
686+ fprintf(out, "jpegexiforient reads or writes the Exif Orientation Tag ");
687+ fprintf(out, "in a JPEG Exif file.\n");
688+
689+ fprintf(out, "Usage: %s [switches] jpegfile\n", progname);
690+
691+ fprintf(out, "Switches:\n");
692+ fprintf(out, " --help display this help and exit\n");
693+ fprintf(out, " --version output version information and exit\n");
694+ fprintf(out, " -n Do not output the trailing newline\n");
695+ fprintf(out, " -1 .. -8 Set orientation value 1 .. 8\n");
696+}
697+
698+/*
699+ * The main program.
700+ */
701+
702+int
703+main (int argc, char **argv)
704+{
705+ int n_flag, set_flag;
706+ unsigned int length, i;
707+ int is_motorola; /* Flag for byte order */
708+ unsigned int offset, number_of_tags, tagnum;
709+
710+ progname = argv[0];
711+ if (progname == NULL || progname[0] == 0)
712+ progname = "jpegexiforient"; /* in case C library doesn't provide it */
713+
714+ if (argc < 2) { usage(stderr); return 1; }
715+
716+ n_flag = 0; set_flag = 0;
717+
718+ i = 1;
719+ while (argv[i][0] == '-') {
720+ switch (argv[i][1]) {
721+ case '-':
722+ switch (argv[i][2]) {
723+ case 'h': usage(stdout); return 0;
724+ case 'v': fprintf(stdout,"jpegexiforient\n"); return 0;
725+ }
726+ case 'n':
727+ n_flag = 1;
728+ break;
729+ case '1':
730+ case '2':
731+ case '3':
732+ case '4':
733+ case '5':
734+ case '6':
735+ case '7':
736+ case '8':
737+ set_flag = argv[i][1] - '0';
738+ break;
739+ default:
740+ usage(stderr); return 1;
741+ }
742+ if (++i >= argc) { usage(stderr); return 1; }
743+ }
744+
745+ if (set_flag) {
746+ if ((myfile = fopen(argv[i], "rb+")) == NULL) {
747+ fprintf(stderr, "%s: can't open %s\n", progname, argv[i]);
748+ return 0;
749+ }
750+ } else {
751+ if ((myfile = fopen(argv[i], "rb")) == NULL) {
752+ fprintf(stderr, "%s: can't open %s\n", progname, argv[i]);
753+ return 0;
754+ }
755+ }
756+
757+ /* Read File head, check for JPEG SOI + Exif APP1 */
758+ for (i = 0; i < 4; i++)
759+ exif_data[i] = (unsigned char) read_1_byte();
760+ if (exif_data[0] != 0xFF ||
761+ exif_data[1] != 0xD8 ||
762+ exif_data[2] != 0xFF ||
763+ exif_data[3] != 0xE1)
764+ return 0;
765+
766+ /* Get the marker parameter length count */
767+ length = read_2_bytes();
768+ /* Length includes itself, so must be at least 2 */
769+ /* Following Exif data length must be at least 6 */
770+ if (length < 8)
771+ return 0;
772+ length -= 8;
773+ /* Read Exif head, check for "Exif" */
774+ for (i = 0; i < 6; i++)
775+ exif_data[i] = (unsigned char) read_1_byte();
776+ if (exif_data[0] != 0x45 ||
777+ exif_data[1] != 0x78 ||
778+ exif_data[2] != 0x69 ||
779+ exif_data[3] != 0x66 ||
780+ exif_data[4] != 0 ||
781+ exif_data[5] != 0)
782+ return 0;
783+ /* Read Exif body */
784+ for (i = 0; i < length; i++)
785+ exif_data[i] = (unsigned char) read_1_byte();
786+
787+ if (length < 12) return 0; /* Length of an IFD entry */
788+
789+ /* Discover byte order */
790+ if (exif_data[0] == 0x49 && exif_data[1] == 0x49)
791+ is_motorola = 0;
792+ else if (exif_data[0] == 0x4D && exif_data[1] == 0x4D)
793+ is_motorola = 1;
794+ else
795+ return 0;
796+
797+ /* Check Tag Mark */
798+ if (is_motorola) {
799+ if (exif_data[2] != 0) return 0;
800+ if (exif_data[3] != 0x2A) return 0;
801+ } else {
802+ if (exif_data[3] != 0) return 0;
803+ if (exif_data[2] != 0x2A) return 0;
804+ }
805+
806+ /* Get first IFD offset (offset to IFD0) */
807+ if (is_motorola) {
808+ if (exif_data[4] != 0) return 0;
809+ if (exif_data[5] != 0) return 0;
810+ offset = exif_data[6];
811+ offset <<= 8;
812+ offset += exif_data[7];
813+ } else {
814+ if (exif_data[7] != 0) return 0;
815+ if (exif_data[6] != 0) return 0;
816+ offset = exif_data[5];
817+ offset <<= 8;
818+ offset += exif_data[4];
819+ }
820+ if (offset > length - 2) return 0; /* check end of data segment */
821+
822+ /* Get the number of directory entries contained in this IFD */
823+ if (is_motorola) {
824+ number_of_tags = exif_data[offset];
825+ number_of_tags <<= 8;
826+ number_of_tags += exif_data[offset+1];
827+ } else {
828+ number_of_tags = exif_data[offset+1];
829+ number_of_tags <<= 8;
830+ number_of_tags += exif_data[offset];
831+ }
832+ if (number_of_tags == 0) return 0;
833+ offset += 2;
834+
835+ /* Search for Orientation Tag in IFD0 */
836+ for (;;) {
837+ if (offset > length - 12) return 0; /* check end of data segment */
838+ /* Get Tag number */
839+ if (is_motorola) {
840+ tagnum = exif_data[offset];
841+ tagnum <<= 8;
842+ tagnum += exif_data[offset+1];
843+ } else {
844+ tagnum = exif_data[offset+1];
845+ tagnum <<= 8;
846+ tagnum += exif_data[offset];
847+ }
848+ if (tagnum == 0x0112) break; /* found Orientation Tag */
849+ if (--number_of_tags == 0) return 0;
850+ offset += 12;
851+ }
852+
853+ if (set_flag) {
854+ /* Set the Orientation value */
855+ if (is_motorola) {
856+ exif_data[offset+2] = 0; /* Format = unsigned short (2 octets) */
857+ exif_data[offset+3] = 3;
858+ exif_data[offset+4] = 0; /* Number Of Components = 1 */
859+ exif_data[offset+5] = 0;
860+ exif_data[offset+6] = 0;
861+ exif_data[offset+7] = 1;
862+ exif_data[offset+8] = 0;
863+ exif_data[offset+9] = (unsigned char)set_flag;
864+ exif_data[offset+10] = 0;
865+ exif_data[offset+11] = 0;
866+ } else {
867+ exif_data[offset+2] = 3; /* Format = unsigned short (2 octets) */
868+ exif_data[offset+3] = 0;
869+ exif_data[offset+4] = 1; /* Number Of Components = 1 */
870+ exif_data[offset+5] = 0;
871+ exif_data[offset+6] = 0;
872+ exif_data[offset+7] = 0;
873+ exif_data[offset+8] = (unsigned char)set_flag;
874+ exif_data[offset+9] = 0;
875+ exif_data[offset+10] = 0;
876+ exif_data[offset+11] = 0;
877+ }
878+ fseek(myfile, (4 + 2 + 6 + 2) + offset, SEEK_SET);
879+ fwrite(exif_data + 2 + offset, 1, 10, myfile);
880+ } else {
881+ /* Get the Orientation value */
882+ if (is_motorola) {
883+ if (exif_data[offset+8] != 0) return 0;
884+ set_flag = exif_data[offset+9];
885+ } else {
886+ if (exif_data[offset+9] != 0) return 0;
887+ set_flag = exif_data[offset+8];
888+ }
889+ if (set_flag > 8) return 0;
890+ }
891+
892+ /* Write out Orientation value */
893+ if (n_flag)
894+ printf("%c", '0' + set_flag);
895+ else
896+ printf("%c\n", '0' + set_flag);
897+
898+ /* All done. */
899+ return 0;
900+}
901--- libjpeg7-7.orig/debian/extra/exifautotran.1
902+++ libjpeg7-7/debian/extra/exifautotran.1
903@@ -0,0 +1,13 @@
904+.TH EXIFAUTOTRAN "1" "February 2005" "exifautotran" "User Commands"
905+.SH NAME
906+exifautotran \- Transforms Exif files so that Orientation becomes 1
907+.SH DESCRIPTION
908+exifautotran [list of files]
909+.PP
910+Take a list of files as input and transform them in place so that the
911+Orientation becomes 1.
912+.SH "AUTHOR"
913+ Guido Vollbeding <guido@jpegclub.org>
914+.SH "SEE ALSO"
915+.BR jpegtran(1)
916+.BR jpegexiforient(1)
917--- libjpeg7-7.orig/debian/extra/jpegexiforient.1
918+++ libjpeg7-7/debian/extra/jpegexiforient.1
919@@ -0,0 +1,73 @@
920+.TH JPEGEXIFORIENT "1" "February 2005" "jpegexiforient" "User Commands"
921+.SH NAME
922+jpegexiforient \- reads or writes the Exif Orientation Tag
923+.SH SYNOPSIS
924+.B jpegexiforient
925+[\fIswitches\fR] \fIjpegfile\fR
926+.SH DESCRIPTION
927+.
928+This is a utility program to get and set the Exif Orientation Tag.
929+It can be used together with jpegtran in scripts for automatic
930+orientation correction of digital camera pictures.
931+.PP
932+The Exif orientation value gives the orientation of the camera
933+relative to the scene when the image was captured. The relation
934+of the '0th row' and '0th column' to visual position is shown as
935+below.
936+.IP
937+.nf
938+.ft CR
939+Value | 0th Row | 0th Column
940+------+-------------+-----------
941+ 1 | top | left side
942+ 2 | top | rigth side
943+ 3 | bottom | rigth side
944+ 4 | bottom | left side
945+ 5 | left side | top
946+ 6 | right side | top
947+ 7 | right side | bottom
948+ 8 | left side | bottom
949+.fi
950+.PP
951+For convenience, here is what the letter F would look like if it were
952+tagged correctly and displayed by a program that ignores the orientation
953+tag:
954+.IP
955+.nf
956+.ft CB
957+ 1 2 3 4
958+
959+888888 888888 88 88
960+88 88 88 88
961+8888 8888 8888 8888
962+88 88 88 88
963+88 88 888888 888888
964+
965+ 5 6 7 8
966+
967+8888888888 88 88 8888888888
968+88 88 88 88 88 88 88 88
969+88 8888888888 8888888888 88
970+.fi
971+.PP
972+jpegexiforient output the Exif Orientation Tag in a JPEG Exif file.
973+With the options -1 .. -8, it can also be used to set the tag.
974+.
975+.SS "OPTIONS"
976+.TP
977+\fB\-\-help\fR
978+display this help and exit
979+.TP
980+\fB\-\-version\fR
981+output version information and exit
982+.TP
983+\fB\-n\fR
984+Do not output the trailing newline
985+.TP
986+\fB\-1\fR .. \fB\-8\fR
987+Set orientation value 1 .. 8
988+.SH "AUTHOR"
989+ Guido Vollbeding <guido@jpegclub.org>
990+.SH "SEE ALSO"
991+.BR jpegtran(1)
992+.BR exifautotran(1)
993--- libjpeg7-7.orig/debian/extra/exifautotran
994+++ libjpeg7-7/debian/extra/exifautotran
995@@ -0,0 +1,50 @@
996+#!/bin/sh
997+# exifautotran [list of files]
998+#
999+# Transforms Exif files so that Orientation becomes 1
1000+#
1001+
1002+trap "if test -n \"\$tempfile\"; then rm -f \"\$tempfile\"; fi" INT QUIT TERM
1003+
1004+for i
1005+do
1006+ case $i in
1007+ -v|--version) echo "exifautotran"; exit 0;;
1008+ -h|--help)
1009+ cat <<EOF
1010+exifautotran [list of files]
1011+
1012+Transforms Exif files so that Orientation becomes 1
1013+EOF
1014+ exit 0;;
1015+ esac
1016+
1017+ case `jpegexiforient -n "$i"` in
1018+ 1) transform="";;
1019+ 2) transform="-flip horizontal";;
1020+ 3) transform="-rotate 180";;
1021+ 4) transform="-flip vertical";;
1022+ 5) transform="-transpose";;
1023+ 6) transform="-rotate 90";;
1024+ 7) transform="-transverse";;
1025+ 8) transform="-rotate 270";;
1026+ *) transform="";;
1027+ esac
1028+ if test -n "$transform"; then
1029+ tempfile=`mktemp`;
1030+ if test "$?" -ne "0"; then
1031+ echo "Failed to create temporary file" >&2
1032+ exit 1;
1033+ fi
1034+ echo Executing: jpegtran -copy all $transform $i >&2
1035+ jpegtran -copy all $transform "$i" > $tempfile
1036+ if test $? -ne 0; then
1037+ echo Error while transforming $i - skipped. >&2
1038+ rm "$tempfile"
1039+ else
1040+ cp "$tempfile" "$i"
1041+ rm "$tempfile"
1042+ jpegexiforient -1 "$i" > /dev/null
1043+ fi
1044+ fi
1045+done
1046--- libjpeg7-7.orig/debian/extra/Makefile
1047+++ libjpeg7-7/debian/extra/Makefile
1048@@ -0,0 +1,22 @@
1049+CFLAGS = -O2 -Wall -g
1050+CC = cc
1051+INSTALL = install -m755 -o root -g root
1052+INSTALLDIR = install -m755 -o root -g root -d
1053+DESTDIR =
1054+prefix = /usr/local
1055+bindir = $(prefix)/bin
1056+mandir = $(prefix)/share/man/man1
1057+
1058+all: jpegexiforient
1059+
1060+jpegexiforient: jpegexiforient.c
1061+ $(CC) $(CFLAGS) -o jpegexiforient jpegexiforient.c
1062+clean:
1063+ -rm -f jpegexiforient
1064+install:
1065+ $(INSTALLDIR) $(DESTDIR)$(bindir)
1066+ $(INSTALLDIR) $(DESTDIR)$(mandir)
1067+ $(INSTALL) jpegexiforient $(DESTDIR)$(bindir)
1068+ $(INSTALL) jpegexiforient.1 $(DESTDIR)$(mandir)
1069+ $(INSTALL) exifautotran $(DESTDIR)$(bindir)
1070+ $(INSTALL) exifautotran.1 $(DESTDIR)$(mandir)
diff --git a/meta/recipes-core/jpeg/jpeg-8d/fix_for_automake_1.12.1.patch b/meta/recipes-core/jpeg/jpeg-8d/fix_for_automake_1.12.1.patch
new file mode 100644
index 0000000000..3a970ea477
--- /dev/null
+++ b/meta/recipes-core/jpeg/jpeg-8d/fix_for_automake_1.12.1.patch
@@ -0,0 +1,44 @@
1Upstream-Status: Pending
2
3The support for automatic de-ANSI-fication has been deprecated in
4automake 1.11.2, and will be removed altogether in automake 1.12
5
6This avoids this error:
7| configure.ac:24: automatic de-ANSI-fication support is deprecated
8| autoreconf: automake failed with exit status: 1
9| ERROR: autoreconf execution failed.
10NOTE: package jpeg-native-8c-r2: task do_configure: Failed
11
12Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com>
132011/12/28
14
15
16Index: jpeg-8d/configure.ac
17===================================================================
18--- jpeg-8d.orig/configure.ac
19+++ jpeg-8d/configure.ac
20@@ -21,7 +21,7 @@ AC_CANONICAL_TARGET
21
22 # Initialize Automake
23 # Don't require all the GNU mandated files
24-AM_INIT_AUTOMAKE([-Wall -Werror -Wno-obsolete ansi2knr no-dist foreign])
25+AM_INIT_AUTOMAKE([-Wall -Werror -Wno-obsolete no-dist foreign])
26
27 # Make --enable-silent-rules the default.
28 # To get verbose build output you may configure
29@@ -29,7 +29,14 @@ AM_INIT_AUTOMAKE([-Wall -Werror -Wno-obs
30 AM_SILENT_RULES([yes])
31
32 # This is required when using the de-ANSI-fication feature.
33-AM_C_PROTOTYPES
34+#AM_C_PROTOTYPES
35+# add following to avoid this error:
36+#| automake: warnings are treated as errors
37+#| /srv/home/nitin/builds2/build0/tmp/sysroots/x86_64-linux/usr/share/automake-1.12/am/ltlibrary.am: warning: 'libjpeg.la': linking libtool libraries using a non-POSIX
38+#| /srv/home/nitin/builds2/build0/tmp/sysroots/x86_64-linux/usr/share/automake-1.12/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
39+#| Makefile.am:65: while processing Libtool library 'libjpeg.la'
40+#| autoreconf: automake failed with exit status: 1
41+AM_PROG_AR
42
43 # Add configure option --enable-maintainer-mode which enables
44 # dependency checking and generation useful to package maintainers.
diff --git a/meta/recipes-core/jpeg/jpeg_8d.bb b/meta/recipes-core/jpeg/jpeg_8d.bb
new file mode 100644
index 0000000000..da23302149
--- /dev/null
+++ b/meta/recipes-core/jpeg/jpeg_8d.bb
@@ -0,0 +1,51 @@
1SUMMARY = "libjpeg is a library for handling the JPEG (JFIF) image format"
2DESCRIPTION = "libjpeg contains a library for handling the JPEG (JFIF) image format, as well as related programs for accessing the libjpeg functions."
3HOMEPAGE = "http://www.ijg.org/"
4
5LICENSE ="BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://README;md5=4f46756b064c225fae088903300e5c98"
7
8SECTION = "libs"
9
10DEPENDS = "libtool-cross"
11DEPENDS_class-native = "libtool-native"
12
13PR = "r1"
14
15SRC_URI = "http://www.ijg.org/files/jpegsrc.v${PV}.tar.gz \
16 file://debian-libjpeg7_7-1.diff \
17 file://fix_for_automake_1.12.1.patch"
18
19SRC_URI[md5sum] = "52654eb3b2e60c35731ea8fc87f1bd29"
20SRC_URI[sha256sum] = "00029b1473f0f0ea72fbca3230e8cb25797fbb27e58ae2e46bb8bf5a806fe0b3"
21
22inherit autotools
23
24EXTRA_OECONF="--enable-static --enable-shared"
25EXTRA_OEMAKE='"LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool"'
26
27CFLAGS_append = " -D_REENTRANT"
28
29do_configure_prepend () {
30 rm -f ${S}/ltconfig
31 rm -f ${S}/ltmain.sh
32}
33
34do_install() {
35 install -d ${D}${bindir} ${D}${includedir} \
36 ${D}${mandir}/man1 ${D}${libdir}
37 oe_runmake 'DESTDIR=${D}' install
38}
39
40PACKAGES =+ "jpeg-tools "
41DESCRIPTION_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."
42FILES_jpeg-tools = "${bindir}/*"
43
44BBCLASSEXTEND = "native"
45
46pkg_postinst_${PN}_linuxstdbase () {
47 if [ ! -e $D${libdir}/libjpeg.so.62 ]; then
48 JPEG=`find $D${libdir} -type f -name libjpeg.so.\*.\*.\*`
49 ln -sf `basename $JPEG` $D${libdir}/libjpeg.so.62
50 fi
51}
diff --git a/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch b/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch
new file mode 100644
index 0000000000..be7f324acc
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd/uclibc-stdarg.patch
@@ -0,0 +1,36 @@
1In file included from keymap.h:5:0,
2 from ksyms.c:6:
3./keymap/common.h:65:38: error: unknown type name 'va_list'
4 const char *format, va_list args),
5 ^
6./keymap/common.h:66:3: error: expected ';', ',' or ')' before 'const'
7 const void *data);
8 ^
9
10Upstream-Status: Pending
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Index: kbd-2.0.0/src/libkeymap/contextP.h
13===================================================================
14--- kbd-2.0.0.orig/src/libkeymap/contextP.h 2013-08-13 06:46:23.000000000 -0700
15+++ kbd-2.0.0/src/libkeymap/contextP.h 2013-11-05 22:33:49.200528226 -0800
16@@ -2,7 +2,7 @@
17 #define LK_CONTEXTP_H
18
19 #include "keymap.h"
20-
21+#include <stdarg.h>
22 /**
23 * @brief Copy of struct kbdiacruc.
24 */
25Index: kbd-2.0.0/src/libkeymap/keymap/common.h
26===================================================================
27--- kbd-2.0.0.orig/src/libkeymap/keymap/common.h 2013-08-13 06:46:23.000000000 -0700
28+++ kbd-2.0.0/src/libkeymap/keymap/common.h 2013-11-05 22:33:59.964528438 -0800
29@@ -6,6 +6,7 @@
30 */
31
32 #include <keymap/context.h>
33+#include <stdarg.h>
34
35 /** Initializes the structures necessary to read and/or parse keymap.
36 *
diff --git a/meta/recipes-core/kbd/kbd_2.0.2.bb b/meta/recipes-core/kbd/kbd_2.0.2.bb
new file mode 100644
index 0000000000..0aa976a46b
--- /dev/null
+++ b/meta/recipes-core/kbd/kbd_2.0.2.bb
@@ -0,0 +1,35 @@
1SUMMARY = "Keytable files and keyboard utilities"
2# everything minus console-fonts is GPLv2+
3LICENSE = "GPLv2+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=a5fcc36121d93e1f69d96a313078c8b5"
5DEPENDS = "libcheck"
6
7inherit autotools gettext ptest pkgconfig
8
9RREPLACES_${PN} = "console-tools"
10RPROVIDES_${PN} = "console-tools"
11RCONFLICTS_${PN} = "console-tools"
12
13SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/${BP}.tar.xz \
14 file://uclibc-stdarg.patch \
15 "
16
17SRC_URI[md5sum] = "87475eb78b1d6e6ab06686dd323ad4ba"
18SRC_URI[sha256sum] = "9dfddabf96012e329c4bebb96a21aeef7c3872f624e96e8156ba542b82aeb912"
19
20PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
21PACKAGECONFIG[pam] = "--enable-vlock, --disable-vlock, libpam,"
22
23PACKAGES += "${PN}-consolefonts ${PN}-keymaps ${PN}-unimaps ${PN}-consoletrans"
24
25FILES_${PN}-consolefonts = "${datadir}/consolefonts"
26FILES_${PN}-consoletrans = "${datadir}/consoletrans"
27FILES_${PN}-keymaps = "${datadir}/keymaps"
28FILES_${PN}-unimaps = "${datadir}/unimaps"
29
30inherit update-alternatives
31
32ALTERNATIVE_${PN} = "chvt deallocvt fgconsole openvt"
33ALTERNATIVE_PRIORITY = "100"
34
35BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/libcgroup/libcgroup_0.41.bb b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
new file mode 100644
index 0000000000..69f85666aa
--- /dev/null
+++ b/meta/recipes-core/libcgroup/libcgroup_0.41.bb
@@ -0,0 +1,41 @@
1SUMMARY = "Linux control group abstraction library"
2DESCRIPTION = "libcgroup is a library that abstracts the control group file system \
3in Linux. Control groups allow you to limit, account and isolate resource usage \
4(CPU, memory, disk I/O, etc.) of groups of processes."
5SECTION = "libs"
6LICENSE = "LGPLv2.1"
7LIC_FILES_CHKSUM = "file://COPYING;md5=2d5025d4aa3495befef8f17206a5b0a1"
8
9inherit autotools pkgconfig
10
11DEPENDS = "bison-native flex-native ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
12
13SRC_URI = "${SOURCEFORGE_MIRROR}/project/libcg/${BPN}/v0.41/${BPN}-${PV}.tar.bz2"
14
15SRC_URI[md5sum] = "3dea9d50b8a5b73ff0bf1cdcb210f63f"
16SRC_URI[sha256sum] = "e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51"
17
18EXTRA_OECONF = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam-module-dir=${base_libdir}/security --enable-pam=yes', '--enable-pam=no', d)}"
19
20# http://www.mail-archive.com/openembedded-devel@lists.openembedded.org/msg21444.html
21PARALLEL_MAKE = ""
22
23PACKAGES =+ "cgroups-pam-plugin"
24FILES_cgroups-pam-plugin = "${base_libdir}/security/pam_cgroup.so*"
25FILES_${PN}-dbg += "${base_libdir}/security/.debug"
26FILES_${PN}-dev += "${base_libdir}/security/*.la"
27
28do_install_append() {
29 # Moving libcgroup to base_libdir
30 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
31 mkdir -p ${D}/${base_libdir}/
32 mv -f ${D}${libdir}/libcgroup.so.* ${D}${base_libdir}/
33 rel_lib_prefix=`echo ${libdir} | sed 's,\(^/\|\)[^/][^/]*,..,g'`
34 ln -sf ${rel_lib_prefix}${base_libdir}/libcgroup.so.1 ${D}${libdir}/libcgroup.so
35 fi
36 # pam modules in ${base_libdir}/security/ should be binary .so files, not symlinks.
37 if [ -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ]; then
38 mv -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ${D}${base_libdir}/security/pam_cgroup.so
39 rm -f ${D}${base_libdir}/security/pam_cgroup.so.*
40 fi
41}
diff --git a/meta/recipes-core/libxml/libxml2.inc b/meta/recipes-core/libxml/libxml2.inc
new file mode 100644
index 0000000000..840a8eb006
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2.inc
@@ -0,0 +1,78 @@
1SUMMARY = "XML C Parser Library and Toolkit"
2DESCRIPTION = "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."
3HOMEPAGE = "http://www.xmlsoft.org/"
4BUGTRACKER = "http://bugzilla.gnome.org/buglist.cgi?product=libxml2"
5SECTION = "libs"
6LICENSE = "MIT"
7LIC_FILES_CHKSUM = "file://Copyright;md5=2044417e2e5006b65a8b9067b683fcf1 \
8 file://hash.c;beginline=6;endline=15;md5=96f7296605eae807670fb08947829969 \
9 file://list.c;beginline=4;endline=13;md5=cdbfa3dee51c099edb04e39f762ee907 \
10 file://trio.c;beginline=5;endline=14;md5=6c025753c86d958722ec76e94cae932e"
11
12DEPENDS_class-nativesdk = "nativesdk-python"
13DEPENDS_class-native = "python-native"
14DEPENDS =+ "zlib"
15
16SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
17 file://libxml-64bit.patch \
18 file://ansidecl.patch \
19 file://runtest.patch \
20 file://run-ptest \
21 file://libxml2-CVE-2014-0191-fix.patch \
22 file://python-sitepackages-dir.patch \
23 file://libxml-m4-use-pkgconfig.patch \
24 file://libxml2-CVE-2014-3660.patch \
25 file://0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch \
26 "
27
28BINCONFIG = "${bindir}/xml2-config"
29
30inherit autotools pkgconfig binconfig-disabled pythonnative ptest
31
32RDEPENDS_${PN}-ptest += "python-core"
33
34RDEPENDS_${PN}-ptest_append_libc-glibc += "glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
35
36# We don't DEPEND on binutils for ansidecl.h so ensure we don't use the header
37do_configure_prepend () {
38 sed -i -e '/.*ansidecl.h.*/d' ${S}/configure.in
39}
40
41do_configure_prepend_class-nativesdk () {
42 # Ensure we get the correct site-packages path
43 export PYTHON_SITE_PACKAGES="${PYTHON_SITEPACKAGES_DIR}"
44}
45
46# WARNING: zlib is require for RPM use
47EXTRA_OECONF = "--without-python --without-debug --without-legacy --with-catalog --without-docbook --with-c14n --without-lzma --with-fexceptions"
48EXTRA_OECONF_class-native = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
49EXTRA_OECONF_class-nativesdk = "--with-python=${STAGING_BINDIR}/python --without-legacy --without-docbook --with-c14n --without-lzma --with-zlib"
50EXTRA_OECONF_linuxstdbase = "--without-python --with-debug --with-legacy --with-docbook --with-c14n --without-lzma --with-zlib"
51
52# required for pythong binding
53export HOST_SYS
54export BUILD_SYS
55export STAGING_LIBDIR
56export STAGING_INCDIR
57
58export LDFLAGS += "-ldl"
59
60python populate_packages_prepend () {
61 # autonamer would call this libxml2-2, but we don't want that
62 if d.getVar('DEBIAN_NAMES', True):
63 d.setVar('PKG_libxml2', '${MLPREFIX}libxml2')
64}
65
66PACKAGES += "${PN}-utils ${PN}-python"
67
68FILES_${PN}-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug"
69FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
70FILES_${PN}-dev += "${libdir}/xml2Conf.sh"
71FILES_${PN}-utils += "${bindir}/*"
72FILES_${PN}-python += "${PYTHON_SITEPACKAGES_DIR}"
73
74do_install_ptest () {
75 cp -r ${WORKDIR}/xmlconf ${D}${PTEST_PATH}
76}
77
78BBCLASSEXTEND = "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
new file mode 100644
index 0000000000..96d58f9dd6
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/0001-CVE-2015-1819-Enforce-the-reader-to-run-in-constant-.patch
@@ -0,0 +1,181 @@
1From 213f1fe0d76d30eaed6e5853057defc43e6df2c9 Mon Sep 17 00:00:00 2001
2From: Daniel Veillard <veillard@redhat.com>
3Date: Tue, 14 Apr 2015 17:41:48 +0800
4Subject: [PATCH] CVE-2015-1819 Enforce the reader to run in constant memory
5
6One of the operation on the reader could resolve entities
7leading to the classic expansion issue. Make sure the
8buffer used for xmlreader operation is bounded.
9Introduce a new allocation type for the buffers for this effect.
10
11Upstream-Status: Backport
12
13Signed-off-by: Yue Tao <Yue.Tao@windriver.com>
14Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
15---
16 buf.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
17 include/libxml/tree.h | 3 ++-
18 xmlreader.c | 20 +++++++++++++++++++-
19 3 files changed, 63 insertions(+), 3 deletions(-)
20
21diff --git a/buf.c b/buf.c
22index 6efc7b6..07922ff 100644
23--- a/buf.c
24+++ b/buf.c
25@@ -27,6 +27,7 @@
26 #include <libxml/tree.h>
27 #include <libxml/globals.h>
28 #include <libxml/tree.h>
29+#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
30 #include "buf.h"
31
32 #define WITH_BUFFER_COMPAT
33@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
34 if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
35 (scheme == XML_BUFFER_ALLOC_EXACT) ||
36 (scheme == XML_BUFFER_ALLOC_HYBRID) ||
37- (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
38+ (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
39+ (scheme == XML_BUFFER_ALLOC_BOUNDED)) {
40 buf->alloc = scheme;
41 if (buf->buffer)
42 buf->buffer->alloc = scheme;
43@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
44 size = buf->use + len + 100;
45 #endif
46
47+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
48+ /*
49+ * Used to provide parsing limits
50+ */
51+ if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
52+ (buf->size >= XML_MAX_TEXT_LENGTH)) {
53+ xmlBufMemoryError(buf, "buffer error: text too long\n");
54+ return(0);
55+ }
56+ if (size >= XML_MAX_TEXT_LENGTH)
57+ size = XML_MAX_TEXT_LENGTH;
58+ }
59 if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
60 size_t start_buf = buf->content - buf->contentIO;
61
62@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
63 CHECK_COMPAT(buf)
64
65 if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
66+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
67+ /*
68+ * Used to provide parsing limits
69+ */
70+ if (size >= XML_MAX_TEXT_LENGTH) {
71+ xmlBufMemoryError(buf, "buffer error: text too long\n");
72+ return(0);
73+ }
74+ }
75
76 /* Don't resize if we don't have to */
77 if (size < buf->size)
78@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
79
80 needSize = buf->use + len + 2;
81 if (needSize > buf->size){
82+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
83+ /*
84+ * Used to provide parsing limits
85+ */
86+ if (needSize >= XML_MAX_TEXT_LENGTH) {
87+ xmlBufMemoryError(buf, "buffer error: text too long\n");
88+ return(-1);
89+ }
90+ }
91 if (!xmlBufResize(buf, needSize)){
92 xmlBufMemoryError(buf, "growing buffer");
93 return XML_ERR_NO_MEMORY;
94@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
95 }
96 needSize = buf->use + len + 2;
97 if (needSize > buf->size){
98+ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
99+ /*
100+ * Used to provide parsing limits
101+ */
102+ if (needSize >= XML_MAX_TEXT_LENGTH) {
103+ xmlBufMemoryError(buf, "buffer error: text too long\n");
104+ return(-1);
105+ }
106+ }
107 if (!xmlBufResize(buf, needSize)){
108 xmlBufMemoryError(buf, "growing buffer");
109 return XML_ERR_NO_MEMORY;
110diff --git a/include/libxml/tree.h b/include/libxml/tree.h
111index 2f90717..4a9b3bc 100644
112--- a/include/libxml/tree.h
113+++ b/include/libxml/tree.h
114@@ -76,7 +76,8 @@ typedef enum {
115 XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
116 XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
117 XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
118- XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
119+ XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
120+ XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
121 } xmlBufferAllocationScheme;
122
123 /**
124diff --git a/xmlreader.c b/xmlreader.c
125index f19e123..471e7e2 100644
126--- a/xmlreader.c
127+++ b/xmlreader.c
128@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
129 "xmlNewTextReader : malloc failed\n");
130 return(NULL);
131 }
132+ /* no operation on a reader should require a huge buffer */
133+ xmlBufSetAllocationScheme(ret->buffer,
134+ XML_BUFFER_ALLOC_BOUNDED);
135 ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
136 if (ret->sax == NULL) {
137 xmlBufFree(ret->buffer);
138@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
139 return(((xmlNsPtr) node)->href);
140 case XML_ATTRIBUTE_NODE:{
141 xmlAttrPtr attr = (xmlAttrPtr) node;
142+ const xmlChar *ret;
143
144 if ((attr->children != NULL) &&
145 (attr->children->type == XML_TEXT_NODE) &&
146@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
147 "xmlTextReaderSetup : malloc failed\n");
148 return (NULL);
149 }
150+ xmlBufSetAllocationScheme(reader->buffer,
151+ XML_BUFFER_ALLOC_BOUNDED);
152 } else
153 xmlBufEmpty(reader->buffer);
154 xmlBufGetNodeContent(reader->buffer, node);
155- return(xmlBufContent(reader->buffer));
156+ ret = xmlBufContent(reader->buffer);
157+ if (ret == NULL) {
158+ /* error on the buffer best to reallocate */
159+ xmlBufFree(reader->buffer);
160+ reader->buffer = xmlBufCreateSize(100);
161+ xmlBufSetAllocationScheme(reader->buffer,
162+ XML_BUFFER_ALLOC_BOUNDED);
163+ ret = BAD_CAST "";
164+ }
165+ return(ret);
166 }
167 break;
168 }
169@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
170 "xmlTextReaderSetup : malloc failed\n");
171 return (-1);
172 }
173+ /* no operation on a reader should require a huge buffer */
174+ xmlBufSetAllocationScheme(reader->buffer,
175+ XML_BUFFER_ALLOC_BOUNDED);
176 if (reader->sax == NULL)
177 reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
178 if (reader->sax == NULL) {
179--
1801.7.9.5
181
diff --git a/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
new file mode 100644
index 0000000000..10a8112b58
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch
@@ -0,0 +1,30 @@
1From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001
2From: Daniel Veillard <veillard@redhat.com>
3Date: Thu, 23 Oct 2014 11:35:36 +0800
4Subject: Fix missing entities after CVE-2014-3660 fix
5
6For https://bugzilla.gnome.org/show_bug.cgi?id=738805
7
8The fix for CVE-2014-3660 introduced a regression in some case
9where entity substitution is required and the entity is used
10first in anotther entity referenced from an attribute value
11
12Upstream-Status: Backport
13
14diff --git a/parser.c b/parser.c
15index 67c9dfd..a8d1b67 100644
16--- a/parser.c
17+++ b/parser.c
18@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
19 * far more secure as the parser will only process data coming from
20 * the document entity by default.
21 */
22- if ((ent->checked == 0) &&
23+ if (((ent->checked == 0) ||
24+ ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
25 ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
26 (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
27 unsigned long oldnbent = ctxt->nbentities;
28--
29cgit v0.10.1
30
diff --git a/meta/recipes-core/libxml/libxml2/ansidecl.patch b/meta/recipes-core/libxml/libxml2/ansidecl.patch
new file mode 100644
index 0000000000..2452d780d5
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/ansidecl.patch
@@ -0,0 +1,25 @@
1Sadly cmake is broken. If it sees this reference and ansidecl is present, it will add a
2dependency upon it, even if HAVE_ANSIDEC_H is never set.
3
4The easiest solution is to remove these lines, otherwise recipes like libzypp can have a
5dependency on the ansidecl.h header via cmake. This can lead to odd results if the
6header is removed (clean binutils) and then the code is recompiled.
7
8RP 2012/7/10
9
10Upstream-Status: Inappropriate [its really a cmake bug]
11
12Index: libxml2-2.8.0/include/libxml/xmlversion.h.in
13===================================================================
14--- libxml2-2.8.0.orig/include/libxml/xmlversion.h.in 2012-07-10 11:51:52.460750573 +0000
15+++ libxml2-2.8.0/include/libxml/xmlversion.h.in 2012-07-10 11:52:41.436749397 +0000
16@@ -401,9 +401,6 @@
17 #endif
18
19 #ifdef __GNUC__
20-#ifdef HAVE_ANSIDECL_H
21-#include <ansidecl.h>
22-#endif
23
24 /**
25 * ATTRIBUTE_UNUSED:
diff --git a/meta/recipes-core/libxml/libxml2/libxml-64bit.patch b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch
new file mode 100644
index 0000000000..1147017b61
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml-64bit.patch
@@ -0,0 +1,22 @@
1Upstream-Status: Backport [from debian: bugs.debian.org/439843]
2
3---
4 libxml.h | 3 +++
5 1 file changed, 3 insertions(+)
6
7--- libxml2-2.6.29.orig/libxml.h
8+++ libxml2-2.6.29/libxml.h
9@@ -11,10 +11,13 @@
10
11 #ifndef NO_LARGEFILE_SOURCE
12 #ifndef _LARGEFILE_SOURCE
13 #define _LARGEFILE_SOURCE
14 #endif
15+#ifndef _LARGEFILE64_SOURCE
16+#define _LARGEFILE64_SOURCE
17+#endif
18 #ifndef _FILE_OFFSET_BITS
19 #define _FILE_OFFSET_BITS 64
20 #endif
21 #endif
22
diff --git a/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
new file mode 100644
index 0000000000..0fc84070ed
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml-m4-use-pkgconfig.patch
@@ -0,0 +1,204 @@
1AM_PATH_XML2 uses xml-config which we disable through
2binconfig-disabled.bbclass, so port it to use pkg-config instead.
3
4Upstream-Status: Pending
5Signed-off-by: Ross Burton <ross.burton@intel.com>
6
7diff --git a/libxml.m4 b/libxml.m4
8index 68cd824..5fa0a9b 100644
9--- a/libxml.m4
10+++ b/libxml.m4
11@@ -1,188 +1,12 @@
12-# Configure paths for LIBXML2
13-# Mike Hommey 2004-06-19
14-# use CPPFLAGS instead of CFLAGS
15-# Toshio Kuratomi 2001-04-21
16-# Adapted from:
17-# Configure paths for GLIB
18-# Owen Taylor 97-11-3
19-
20 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
21 dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS
22 dnl
23-AC_DEFUN([AM_PATH_XML2],[
24-AC_ARG_WITH(xml-prefix,
25- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
26- xml_config_prefix="$withval", xml_config_prefix="")
27-AC_ARG_WITH(xml-exec-prefix,
28- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
29- xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
30-AC_ARG_ENABLE(xmltest,
31- [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
32- enable_xmltest=yes)
33-
34- if test x$xml_config_exec_prefix != x ; then
35- xml_config_args="$xml_config_args"
36- if test x${XML2_CONFIG+set} != xset ; then
37- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
38- fi
39- fi
40- if test x$xml_config_prefix != x ; then
41- xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
42- if test x${XML2_CONFIG+set} != xset ; then
43- XML2_CONFIG=$xml_config_prefix/bin/xml2-config
44- fi
45- fi
46-
47- AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
48- min_xml_version=ifelse([$1], ,2.0.0,[$1])
49- AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
50- no_xml=""
51- if test "$XML2_CONFIG" = "no" ; then
52- no_xml=yes
53- else
54- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
55- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
56- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
57- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
58- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
59- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
60- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
61- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
62- if test "x$enable_xmltest" = "xyes" ; then
63- ac_save_CPPFLAGS="$CPPFLAGS"
64- ac_save_LIBS="$LIBS"
65- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
66- LIBS="$XML_LIBS $LIBS"
67-dnl
68-dnl Now check if the installed libxml is sufficiently new.
69-dnl (Also sanity checks the results of xml2-config to some extent)
70-dnl
71- rm -f conf.xmltest
72- AC_TRY_RUN([
73-#include <stdlib.h>
74-#include <stdio.h>
75-#include <string.h>
76-#include <libxml/xmlversion.h>
77-
78-int
79-main()
80-{
81- int xml_major_version, xml_minor_version, xml_micro_version;
82- int major, minor, micro;
83- char *tmp_version;
84-
85- system("touch conf.xmltest");
86-
87- /* Capture xml2-config output via autoconf/configure variables */
88- /* HP/UX 9 (%@#!) writes to sscanf strings */
89- tmp_version = (char *)strdup("$min_xml_version");
90- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
91- printf("%s, bad version string from xml2-config\n", "$min_xml_version");
92- exit(1);
93- }
94- free(tmp_version);
95-
96- /* Capture the version information from the header files */
97- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
98- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
99- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
100- exit(1);
101- }
102- free(tmp_version);
103-
104- /* Compare xml2-config output to the libxml headers */
105- if ((xml_major_version != $xml_config_major_version) ||
106- (xml_minor_version != $xml_config_minor_version) ||
107- (xml_micro_version != $xml_config_micro_version))
108- {
109- printf("*** libxml header files (version %d.%d.%d) do not match\n",
110- xml_major_version, xml_minor_version, xml_micro_version);
111- printf("*** xml2-config (version %d.%d.%d)\n",
112- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
113- return 1;
114- }
115-/* Compare the headers to the library to make sure we match */
116- /* Less than ideal -- doesn't provide us with return value feedback,
117- * only exits if there's a serious mismatch between header and library.
118- */
119- LIBXML_TEST_VERSION;
120-
121- /* Test that the library is greater than our minimum version */
122- if ((xml_major_version > major) ||
123- ((xml_major_version == major) && (xml_minor_version > minor)) ||
124- ((xml_major_version == major) && (xml_minor_version == minor) &&
125- (xml_micro_version >= micro)))
126- {
127- return 0;
128- }
129- else
130- {
131- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
132- xml_major_version, xml_minor_version, xml_micro_version);
133- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
134- major, minor, micro);
135- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
136- printf("***\n");
137- printf("*** If you have already installed a sufficiently new version, this error\n");
138- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
139- printf("*** being found. The easiest way to fix this is to remove the old version\n");
140- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
141- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
142- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
143- printf("*** so that the correct libraries are found at run-time))\n");
144- }
145- return 1;
146-}
147-],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
148- CPPFLAGS="$ac_save_CPPFLAGS"
149- LIBS="$ac_save_LIBS"
150- fi
151- fi
152+AC_DEFUN([AM_PATH_XML2],[
153+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
154
155- if test "x$no_xml" = x ; then
156- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
157- ifelse([$2], , :, [$2])
158- else
159- AC_MSG_RESULT(no)
160- if test "$XML2_CONFIG" = "no" ; then
161- echo "*** The xml2-config script installed by LIBXML could not be found"
162- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
163- echo "*** your path, or set the XML2_CONFIG environment variable to the"
164- echo "*** full path to xml2-config."
165- else
166- if test -f conf.xmltest ; then
167- :
168- else
169- echo "*** Could not run libxml test program, checking why..."
170- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
171- LIBS="$LIBS $XML_LIBS"
172- AC_TRY_LINK([
173-#include <libxml/xmlversion.h>
174-#include <stdio.h>
175-], [ LIBXML_TEST_VERSION; return 0;],
176- [ echo "*** The test program compiled, but did not run. This usually means"
177- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
178- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
179- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
180- echo "*** to the installed location Also, make sure you have run ldconfig if that"
181- echo "*** is required on your system"
182- echo "***"
183- echo "*** If you have an old version installed, it is best to remove it, although"
184- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
185- [ echo "*** The test program failed to compile or link. See the file config.log for the"
186- echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
187- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
188- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
189- CPPFLAGS="$ac_save_CPPFLAGS"
190- LIBS="$ac_save_LIBS"
191- fi
192- fi
193+ verdep=ifelse([$1], [], [], [>= $1])
194+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
195
196- XML_CPPFLAGS=""
197- XML_LIBS=""
198- ifelse([$3], , :, [$3])
199- fi
200+ XML_CPPFLAGS=$XML_CFLAGS
201 AC_SUBST(XML_CPPFLAGS)
202- AC_SUBST(XML_LIBS)
203- rm -f conf.xmltest
204 ])
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
new file mode 100644
index 0000000000..1c05ae649e
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-0191-fix.patch
@@ -0,0 +1,37 @@
1From: Daniel Veillard <veillard@redhat.com>
2Date: Tue, 22 Apr 2014 15:30:56 +0800
3Subject: Do not fetch external parameter entities
4
5Unless explicitely asked for when validating or replacing entities
6with their value. Problem pointed out by Daniel Berrange <berrange@redhat.com>
7
8Upstream-Status: Backport
9Reference: https://access.redhat.com/security/cve/CVE-2014-0191
10
11Signed-off-by: Daniel Veillard <veillard@redhat.com>
12Signed-off-by: Maxin B. John <maxin.john@enea.com>
13---
14diff -Naur libxml2-2.9.1-orig/parser.c libxml2-2.9.1/parser.c
15--- libxml2-2.9.1-orig/parser.c 2013-04-16 15:39:18.000000000 +0200
16+++ libxml2-2.9.1/parser.c 2014-05-07 13:35:46.883687946 +0200
17@@ -2595,6 +2595,20 @@
18 xmlCharEncoding enc;
19
20 /*
21+ * Note: external parsed entities will not be loaded, it is
22+ * not required for a non-validating parser, unless the
23+ * option of validating, or substituting entities were
24+ * given. Doing so is far more secure as the parser will
25+ * only process data coming from the document entity by
26+ * default.
27+ */
28+ if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&
29+ ((ctxt->options & XML_PARSE_NOENT) == 0) &&
30+ ((ctxt->options & XML_PARSE_DTDVALID) == 0) &&
31+ (ctxt->validate == 0))
32+ return;
33+
34+ /*
35 * handle the extra spaces added before and after
36 * c.f. http://www.w3.org/TR/REC-xml#as-PE
37 * this is done independently.
diff --git a/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch
new file mode 100644
index 0000000000..b9621c93eb
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/libxml2-CVE-2014-3660.patch
@@ -0,0 +1,147 @@
1From be2a7edaf289c5da74a4f9ed3a0b6c733e775230 Mon Sep 17 00:00:00 2001
2From: Daniel Veillard <veillard@redhat.com>
3Date: Thu, 16 Oct 2014 13:59:47 +0800
4Subject: Fix for CVE-2014-3660
5
6Issues related to the billion laugh entity expansion which happened to
7escape the initial set of fixes
8
9Upstream-status: Backport
10Reference: https://git.gnome.org/browse/libxml2/commit/?id=be2a7edaf289c5da74a4f9ed3a0b6c733e775230&context=3&ignorews=0&ss=0
11
12Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
13
14diff --git a/parser.c b/parser.c
15index f51e8d2..1d93967 100644
16--- a/parser.c
17+++ b/parser.c
18@@ -130,6 +130,29 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
19 return (0);
20 if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
21 return (1);
22+
23+ /*
24+ * This may look absurd but is needed to detect
25+ * entities problems
26+ */
27+ if ((ent != NULL) && (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
28+ (ent->content != NULL) && (ent->checked == 0)) {
29+ unsigned long oldnbent = ctxt->nbentities;
30+ xmlChar *rep;
31+
32+ ent->checked = 1;
33+
34+ rep = xmlStringDecodeEntities(ctxt, ent->content,
35+ XML_SUBSTITUTE_REF, 0, 0, 0);
36+
37+ ent->checked = (ctxt->nbentities - oldnbent + 1) * 2;
38+ if (rep != NULL) {
39+ if (xmlStrchr(rep, '<'))
40+ ent->checked |= 1;
41+ xmlFree(rep);
42+ rep = NULL;
43+ }
44+ }
45 if (replacement != 0) {
46 if (replacement < XML_MAX_TEXT_LENGTH)
47 return(0);
48@@ -189,9 +212,12 @@ xmlParserEntityCheck(xmlParserCtxtPtr ctxt, size_t size,
49 return (0);
50 } else {
51 /*
52- * strange we got no data for checking just return
53+ * strange we got no data for checking
54 */
55- return (0);
56+ if (((ctxt->lastError.code != XML_ERR_UNDECLARED_ENTITY) &&
57+ (ctxt->lastError.code != XML_WAR_UNDECLARED_ENTITY)) ||
58+ (ctxt->nbentities <= 10000))
59+ return (0);
60 }
61 xmlFatalErr(ctxt, XML_ERR_ENTITY_LOOP, NULL);
62 return (1);
63@@ -2589,6 +2615,7 @@ xmlParserHandlePEReference(xmlParserCtxtPtr ctxt) {
64 name, NULL);
65 ctxt->valid = 0;
66 }
67+ xmlParserEntityCheck(ctxt, 0, NULL, 0);
68 } else if (ctxt->input->free != deallocblankswrapper) {
69 input = xmlNewBlanksWrapperInputStream(ctxt, entity);
70 if (xmlPushInput(ctxt, input) < 0)
71@@ -2759,6 +2786,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
72 if ((ctxt->lastError.code == XML_ERR_ENTITY_LOOP) ||
73 (ctxt->lastError.code == XML_ERR_INTERNAL_ERROR))
74 goto int_error;
75+ xmlParserEntityCheck(ctxt, 0, ent, 0);
76 if (ent != NULL)
77 ctxt->nbentities += ent->checked / 2;
78 if ((ent != NULL) &&
79@@ -2810,6 +2838,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len,
80 ent = xmlParseStringPEReference(ctxt, &str);
81 if (ctxt->lastError.code == XML_ERR_ENTITY_LOOP)
82 goto int_error;
83+ xmlParserEntityCheck(ctxt, 0, ent, 0);
84 if (ent != NULL)
85 ctxt->nbentities += ent->checked / 2;
86 if (ent != NULL) {
87@@ -7312,6 +7341,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
88 (ret != XML_WAR_UNDECLARED_ENTITY)) {
89 xmlFatalErrMsgStr(ctxt, XML_ERR_UNDECLARED_ENTITY,
90 "Entity '%s' failed to parse\n", ent->name);
91+ xmlParserEntityCheck(ctxt, 0, ent, 0);
92 } else if (list != NULL) {
93 xmlFreeNodeList(list);
94 list = NULL;
95@@ -7418,7 +7448,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
96 /*
97 * We are copying here, make sure there is no abuse
98 */
99- ctxt->sizeentcopy += ent->length;
100+ ctxt->sizeentcopy += ent->length + 5;
101 if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
102 return;
103
104@@ -7466,7 +7496,7 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
105 /*
106 * We are copying here, make sure there is no abuse
107 */
108- ctxt->sizeentcopy += ent->length;
109+ ctxt->sizeentcopy += ent->length + 5;
110 if (xmlParserEntityCheck(ctxt, 0, ent, ctxt->sizeentcopy))
111 return;
112
113@@ -7652,6 +7682,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
114 ctxt->sax->reference(ctxt->userData, name);
115 }
116 }
117+ xmlParserEntityCheck(ctxt, 0, ent, 0);
118 ctxt->valid = 0;
119 }
120
121@@ -7845,6 +7876,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
122 "Entity '%s' not defined\n",
123 name);
124 }
125+ xmlParserEntityCheck(ctxt, 0, ent, 0);
126 /* TODO ? check regressions ctxt->valid = 0; */
127 }
128
129@@ -8004,6 +8036,7 @@ xmlParsePEReference(xmlParserCtxtPtr ctxt)
130 name, NULL);
131 ctxt->valid = 0;
132 }
133+ xmlParserEntityCheck(ctxt, 0, NULL, 0);
134 } else {
135 /*
136 * Internal checking in case the entity quest barfed
137@@ -8243,6 +8276,7 @@ xmlParseStringPEReference(xmlParserCtxtPtr ctxt, const xmlChar **str) {
138 name, NULL);
139 ctxt->valid = 0;
140 }
141+ xmlParserEntityCheck(ctxt, 0, NULL, 0);
142 } else {
143 /*
144 * Internal checking in case the entity quest barfed
145--
146cgit v0.10.1
147
diff --git a/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
new file mode 100644
index 0000000000..a697ddf873
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/python-sitepackages-dir.patch
@@ -0,0 +1,21 @@
1Allow us to pass in PYTHON_SITE_PACKAGES
2
3The python binary used when building for nativesdk doesn't give us the
4correct path here so we need to be able to specify it ourselves.
5
6Upstream-Status: Inappropriate [config]
7
8Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
9
10--- a/configure.in
11+++ b/configure.in
12@@ -743,7 +743,8 @@ dnl
13
14 PYTHON_VERSION=
15 PYTHON_INCLUDES=
16-PYTHON_SITE_PACKAGES=
17+# Allow this to be set externally
18+#PYTHON_SITE_PACKAGES=
19 PYTHON_TESTS=
20 pythondir=
21 if test "$with_python" != "no" ; then
diff --git a/meta/recipes-core/libxml/libxml2/run-ptest b/meta/recipes-core/libxml/libxml2/run-ptest
new file mode 100644
index 0000000000..473d0b67a7
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2
3make -k runtests
diff --git a/meta/recipes-core/libxml/libxml2/runtest.patch b/meta/recipes-core/libxml/libxml2/runtest.patch
new file mode 100644
index 0000000000..397ab20c30
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/runtest.patch
@@ -0,0 +1,820 @@
1Add 'install-ptest' rule.
2Print a standard result line for each test.
3
4Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
5Upstream-Status: Pending
6
7diff -uNr a/Makefile.am b/Makefile.am
8--- a/Makefile.am 2013-04-17 14:51:42.633386477 +0200
9+++ b/Makefile.am 2013-04-19 14:47:51.544720568 +0200
10@@ -202,10 +202,19 @@
11 #testOOM_DEPENDENCIES = $(DEPS)
12 #testOOM_LDADD= $(LDADDS)
13
14+install-ptest:
15+ @(if [ -d .libs ] ; then cd .libs; fi; \
16+ install $(noinst_PROGRAMS) $(DESTDIR))
17+ cp -r $(srcdir)/test $(DESTDIR)
18+ cp -r $(srcdir)/result $(DESTDIR)
19+ cp -r $(srcdir)/python $(DESTDIR)
20+ cp Makefile $(DESTDIR)
21+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
22+
23 runtests:
24 [ -d test ] || $(LN_S) $(srcdir)/test .
25 [ -d result ] || $(LN_S) $(srcdir)/result .
26- $(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
27+ ./runtest$(EXEEXT) ; ./testrecurse$(EXEEXT) ; ./testapi$(EXEEXT) ; ./testchar$(EXEEXT) ; ./testdict$(EXEEXT) ; ./runxmlconf$(EXEEXT)
28 @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; \
29 $(MAKE) tests ; fi)
30
31diff -uNr a/runsuite.c b/runsuite.c
32--- a/runsuite.c 2013-04-12 16:17:11.462823238 +0200
33+++ b/runsuite.c 2013-04-17 14:07:24.352693211 +0200
34@@ -1162,6 +1162,7 @@
35
36 if (logfile != NULL)
37 fclose(logfile);
38+ printf("%s: runsuite\n\n", (ret == 0) ? "PASS" : "FAIL");
39 return(ret);
40 }
41 #else /* !SCHEMAS */
42diff -uNr a/runtest.c b/runtest.c
43--- a/runtest.c 2013-04-16 13:19:15.087997290 +0200
44+++ b/runtest.c 2013-04-17 14:08:29.529949655 +0200
45@@ -4386,6 +4386,7 @@
46 err++;
47 }
48 }
49+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
50 return(err);
51 }
52
53@@ -4455,6 +4456,7 @@
54 xmlCleanupParser();
55 xmlMemoryDump();
56
57+ printf("%s: runtest\n\n", (ret == 0) ? "PASS" : "FAIL");
58 return(ret);
59 }
60
61diff -uNr a/runxmlconf.c b/runxmlconf.c
62--- a/runxmlconf.c 2013-04-16 12:53:49.900982990 +0200
63+++ b/runxmlconf.c 2013-04-17 14:09:21.111778104 +0200
64@@ -595,6 +595,7 @@
65
66 if (logfile != NULL)
67 fclose(logfile);
68+ printf("%s: runxmlconf\n", (ret == 0) ? "PASS" : "FAIL");
69 return(ret);
70 }
71
72diff -uNr a/testapi.c b/testapi.c
73--- a/testapi.c 2013-04-12 16:16:57.763417659 +0200
74+++ b/testapi.c 2013-04-17 14:10:28.876924881 +0200
75@@ -1245,49 +1245,91 @@
76 testlibxml2(void)
77 {
78 int test_ret = 0;
79+ int ret = 0;
80
81- test_ret += test_HTMLparser();
82- test_ret += test_HTMLtree();
83- test_ret += test_SAX2();
84- test_ret += test_c14n();
85- test_ret += test_catalog();
86- test_ret += test_chvalid();
87- test_ret += test_debugXML();
88- test_ret += test_dict();
89- test_ret += test_encoding();
90- test_ret += test_entities();
91- test_ret += test_hash();
92- test_ret += test_list();
93- test_ret += test_nanoftp();
94- test_ret += test_nanohttp();
95- test_ret += test_parser();
96- test_ret += test_parserInternals();
97- test_ret += test_pattern();
98- test_ret += test_relaxng();
99- test_ret += test_schemasInternals();
100- test_ret += test_schematron();
101- test_ret += test_tree();
102- test_ret += test_uri();
103- test_ret += test_valid();
104- test_ret += test_xinclude();
105- test_ret += test_xmlIO();
106- test_ret += test_xmlautomata();
107- test_ret += test_xmlerror();
108- test_ret += test_xmlmodule();
109- test_ret += test_xmlreader();
110- test_ret += test_xmlregexp();
111- test_ret += test_xmlsave();
112- test_ret += test_xmlschemas();
113- test_ret += test_xmlschemastypes();
114- test_ret += test_xmlstring();
115- test_ret += test_xmlunicode();
116- test_ret += test_xmlwriter();
117- test_ret += test_xpath();
118- test_ret += test_xpathInternals();
119- test_ret += test_xpointer();
120+ test_ret += (ret = test_HTMLparser());
121+ printf("%s: HTMLparser\n", (ret == 0) ? "PASS" : "FAIL");
122+ test_ret += (ret = test_HTMLtree());
123+ printf("%s: HTMLtree\n", (ret == 0) ? "PASS" : "FAIL");
124+ test_ret += (ret = test_SAX2());
125+ printf("%s: SAX2\n", (ret == 0) ? "PASS" : "FAIL");
126+ test_ret += (ret = test_c14n());
127+ printf("%s: c14n\n", (ret == 0) ? "PASS" : "FAIL");
128+ test_ret += (ret = test_catalog());
129+ printf("%s: catalog\n", (ret == 0) ? "PASS" : "FAIL");
130+ test_ret += (ret = test_chvalid());
131+ printf("%s: chvalid\n", (ret == 0) ? "PASS" : "FAIL");
132+ test_ret += (ret = test_debugXML());
133+ printf("%s: debugXML\n", (ret == 0) ? "PASS" : "FAIL");
134+ test_ret += (ret = test_dict());
135+ printf("%s: dict\n", (ret == 0) ? "PASS" : "FAIL");
136+ test_ret += (ret = test_encoding());
137+ printf("%s: encoding\n", (ret == 0) ? "PASS" : "FAIL");
138+ test_ret += (ret = test_entities());
139+ printf("%s: entities\n", (ret == 0) ? "PASS" : "FAIL");
140+ test_ret += (ret = test_hash());
141+ printf("%s: hash\n", (ret == 0) ? "PASS" : "FAIL");
142+ test_ret += (ret = test_list());
143+ printf("%s: list\n", (ret == 0) ? "PASS" : "FAIL");
144+ test_ret += (ret = test_nanoftp());
145+ printf("%s: nanoftp\n", (ret == 0) ? "PASS" : "FAIL");
146+ test_ret += (ret = test_nanohttp());
147+ printf("%s: nanohttp\n", (ret == 0) ? "PASS" : "FAIL");
148+ test_ret += (ret = test_parser());
149+ printf("%s: parser\n", (ret == 0) ? "PASS" : "FAIL");
150+ test_ret += (ret = test_parserInternals());
151+ printf("%s: parserInternals\n", (ret == 0) ? "PASS" : "FAIL");
152+ test_ret += (ret = test_pattern());
153+ printf("%s: pattern\n", (ret == 0) ? "PASS" : "FAIL");
154+ test_ret += (ret = test_relaxng());
155+ printf("%s: relaxng\n", (ret == 0) ? "PASS" : "FAIL");
156+ test_ret += (ret = test_schemasInternals());
157+ printf("%s: schemasInternals\n", (ret == 0) ? "PASS" : "FAIL");
158+ test_ret += (ret = test_schematron());
159+ printf("%s: schematron\n", (ret == 0) ? "PASS" : "FAIL");
160+ test_ret += (ret = test_tree());
161+ printf("%s: tree\n", (ret == 0) ? "PASS" : "FAIL");
162+ test_ret += (ret = test_uri());
163+ printf("%s: uri\n", (ret == 0) ? "PASS" : "FAIL");
164+ test_ret += (ret = test_valid());
165+ printf("%s: valid\n", (ret == 0) ? "PASS" : "FAIL");
166+ test_ret += (ret = test_xinclude());
167+ printf("%s: xinclude\n", (ret == 0) ? "PASS" : "FAIL");
168+ test_ret += (ret = test_xmlIO());
169+ printf("%s: xmlIO\n", (ret == 0) ? "PASS" : "FAIL");
170+ test_ret += (ret = test_xmlautomata());
171+ printf("%s: xmlautomata\n", (ret == 0) ? "PASS" : "FAIL");
172+ test_ret += (ret = test_xmlerror());
173+ printf("%s: xmlerror\n", (ret == 0) ? "PASS" : "FAIL");
174+ test_ret += (ret = test_xmlmodule());
175+ printf("%s: xmlmodule\n", (ret == 0) ? "PASS" : "FAIL");
176+ test_ret += (ret = test_xmlreader());
177+ printf("%s: xmlreader\n", (ret == 0) ? "PASS" : "FAIL");
178+ test_ret += (ret = test_xmlregexp());
179+ printf("%s: xmlregexp\n", (ret == 0) ? "PASS" : "FAIL");
180+ test_ret += (ret = test_xmlsave());
181+ printf("%s: xmlsave\n", (ret == 0) ? "PASS" : "FAIL");
182+ test_ret += (ret = test_xmlschemas());
183+ printf("%s: xmlschemas\n", (ret == 0) ? "PASS" : "FAIL");
184+ test_ret += (ret = test_xmlschemastypes());
185+ printf("%s: xmlschemastypes\n", (ret == 0) ? "PASS" : "FAIL");
186+ test_ret += (ret = test_xmlstring());
187+ printf("%s: xmlstring\n", (ret == 0) ? "PASS" : "FAIL");
188+ test_ret += (ret = test_xmlunicode());
189+ printf("%s: xmlunicode\n", (ret == 0) ? "PASS" : "FAIL");
190+ test_ret += (ret = test_xmlwriter());
191+ printf("%s: xmlwriter\n", (ret == 0) ? "PASS" : "FAIL");
192+ test_ret += (ret = test_xpath());
193+ printf("%s: xpath\n", (ret == 0) ? "PASS" : "FAIL");
194+ test_ret += (ret = test_xpathInternals());
195+ printf("%s: xpathInternals\n", (ret == 0) ? "PASS" : "FAIL");
196+ test_ret += (ret = test_xpointer());
197+ printf("%s: xpointer\n", (ret == 0) ? "PASS" : "FAIL");
198
199 printf("Total: %d functions, %d tests, %d errors\n",
200 function_tests, call_tests, test_ret);
201+
202+ printf("%s: testapi\n\n", (test_ret == 0) ? "PASS" : "FAIL");
203 return(test_ret);
204 }
205
206diff -uNr a/testchar.c b/testchar.c
207--- a/testchar.c 2013-04-17 10:50:30.250147418 +0200
208+++ b/testchar.c 2013-04-18 16:11:28.455733800 +0200
209@@ -23,7 +23,7 @@
210 char document1[100] = "<doc>XXXX</doc>";
211 char document2[100] = "<doc foo='XXXX'/>";
212
213-static void testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
214+static int testDocumentRangeByte1(xmlParserCtxtPtr ctxt, char *document,
215 int len, char *data, int forbid1, int forbid2) {
216 int i;
217 xmlDocPtr res;
218@@ -37,33 +37,41 @@
219 res = xmlReadMemory(document, len, "test", NULL, 0);
220
221 if ((i == forbid1) || (i == forbid2)) {
222- if ((lastError == 0) || (res != NULL))
223+ if ((lastError == 0) || (res != NULL)) {
224 fprintf(stderr,
225 "Failed to detect invalid char for Byte 0x%02X: %c\n",
226 i, i);
227+ return(1);
228+ }
229 }
230
231 else if ((i == '<') || (i == '&')) {
232- if ((lastError == 0) || (res != NULL))
233+ if ((lastError == 0) || (res != NULL)) {
234 fprintf(stderr,
235 "Failed to detect illegal char %c for Byte 0x%02X\n", i, i);
236+ return(1);
237+ }
238 }
239 else if (((i < 0x20) || (i >= 0x80)) &&
240 (i != 0x9) && (i != 0xA) && (i != 0xD)) {
241- if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL))
242+ if ((lastError != XML_ERR_INVALID_CHAR) && (res != NULL)) {
243 fprintf(stderr,
244 "Failed to detect invalid char for Byte 0x%02X\n", i);
245+ return(1);
246+ }
247 }
248 else if (res == NULL) {
249 fprintf(stderr,
250 "Failed to parse valid char for Byte 0x%02X : %c\n", i, i);
251+ return(1);
252 }
253 if (res != NULL)
254 xmlFreeDoc(res);
255 }
256+ return(0);
257 }
258
259-static void testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
260+static int testDocumentRangeByte2(xmlParserCtxtPtr ctxt, char *document,
261 int len, char *data) {
262 int i, j;
263 xmlDocPtr res;
264@@ -80,10 +88,12 @@
265
266 /* if first bit of first char is set, then second bit must too */
267 if ((i & 0x80) && ((i & 0x40) == 0)) {
268- if ((lastError == 0) || (res != NULL))
269+ if ((lastError == 0) || (res != NULL)) {
270 fprintf(stderr,
271 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
272 i, j);
273+ return(1);
274+ }
275 }
276
277 /*
278@@ -91,10 +101,12 @@
279 * bits must be 10
280 */
281 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
282- if ((lastError == 0) || (res != NULL))
283+ if ((lastError == 0) || (res != NULL)) {
284 fprintf(stderr,
285 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
286 i, j);
287+ return(1);
288+ }
289 }
290
291 /*
292@@ -102,10 +114,12 @@
293 * than 0x80, i.e. one of bits 5 to 1 of i must be set
294 */
295 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
296- if ((lastError == 0) || (res != NULL))
297+ if ((lastError == 0) || (res != NULL)) {
298 fprintf(stderr,
299 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
300 i, j);
301+ return(1);
302+ }
303 }
304
305 /*
306@@ -113,10 +127,12 @@
307 * at least 3 bytes, but we give only 2 !
308 */
309 else if ((i & 0xE0) == 0xE0) {
310- if ((lastError == 0) || (res != NULL))
311+ if ((lastError == 0) || (res != NULL)) {
312 fprintf(stderr,
313 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
314 i, j);
315+ return(1);
316+ }
317 }
318
319 /*
320@@ -125,11 +141,13 @@
321 else if ((lastError != 0) || (res == NULL)) {
322 fprintf(stderr,
323 "Failed to parse document for Bytes 0x%02X 0x%02X\n", i, j);
324+ return(1);
325 }
326 if (res != NULL)
327 xmlFreeDoc(res);
328 }
329 }
330+ return(0);
331 }
332
333 /**
334@@ -141,9 +159,10 @@
335 * CDATA in text or in attribute values.
336 */
337
338-static void testDocumentRanges(void) {
339+static int testDocumentRanges(void) {
340 xmlParserCtxtPtr ctxt;
341 char *data;
342+ int test_ret = 0;
343
344 /*
345 * Set up a parsing context using the first document as
346@@ -152,7 +171,7 @@
347 ctxt = xmlNewParserCtxt();
348 if (ctxt == NULL) {
349 fprintf(stderr, "Failed to allocate parser context\n");
350- return;
351+ return(1);
352 }
353
354 printf("testing 1 byte char in document: 1");
355@@ -163,7 +182,7 @@
356 data[2] = ' ';
357 data[3] = ' ';
358 /* test 1 byte injection at beginning of area */
359- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
360+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
361 data, -1, -1);
362 printf(" 2");
363 fflush(stdout);
364@@ -172,7 +191,7 @@
365 data[2] = ' ';
366 data[3] = ' ';
367 /* test 1 byte injection at end of area */
368- testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
369+ test_ret += testDocumentRangeByte1(ctxt, &document1[0], strlen(document1),
370 data + 3, -1, -1);
371
372 printf(" 3");
373@@ -183,7 +202,7 @@
374 data[2] = ' ';
375 data[3] = ' ';
376 /* test 1 byte injection at beginning of area */
377- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
378+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
379 data, '\'', -1);
380 printf(" 4");
381 fflush(stdout);
382@@ -192,7 +211,7 @@
383 data[2] = ' ';
384 data[3] = ' ';
385 /* test 1 byte injection at end of area */
386- testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
387+ test_ret += testDocumentRangeByte1(ctxt, &document2[0], strlen(document2),
388 data + 3, '\'', -1);
389 printf(" done\n");
390
391@@ -204,7 +223,7 @@
392 data[2] = ' ';
393 data[3] = ' ';
394 /* test 2 byte injection at beginning of area */
395- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
396+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
397 data);
398 printf(" 2");
399 fflush(stdout);
400@@ -213,7 +232,7 @@
401 data[2] = ' ';
402 data[3] = ' ';
403 /* test 2 byte injection at end of area */
404- testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
405+ test_ret += testDocumentRangeByte2(ctxt, &document1[0], strlen(document1),
406 data + 2);
407
408 printf(" 3");
409@@ -224,7 +243,7 @@
410 data[2] = ' ';
411 data[3] = ' ';
412 /* test 2 byte injection at beginning of area */
413- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
414+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
415 data);
416 printf(" 4");
417 fflush(stdout);
418@@ -233,14 +252,15 @@
419 data[2] = ' ';
420 data[3] = ' ';
421 /* test 2 byte injection at end of area */
422- testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
423+ test_ret += testDocumentRangeByte2(ctxt, &document2[0], strlen(document2),
424 data + 2);
425 printf(" done\n");
426
427 xmlFreeParserCtxt(ctxt);
428+ return(test_ret);
429 }
430
431-static void testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
432+static int testCharRangeByte1(xmlParserCtxtPtr ctxt, char *data) {
433 int i = 0;
434 int len, c;
435
436@@ -255,19 +275,25 @@
437 c = xmlCurrentChar(ctxt, &len);
438 if ((i == 0) || (i >= 0x80)) {
439 /* we must see an error there */
440- if (lastError != XML_ERR_INVALID_CHAR)
441+ if (lastError != XML_ERR_INVALID_CHAR) {
442 fprintf(stderr,
443 "Failed to detect invalid char for Byte 0x%02X\n", i);
444+ return(1);
445+ }
446 } else if (i == 0xD) {
447- if ((c != 0xA) || (len != 1))
448+ if ((c != 0xA) || (len != 1)) {
449 fprintf(stderr, "Failed to convert char for Byte 0x%02X\n", i);
450+ return(1);
451+ }
452 } else if ((c != i) || (len != 1)) {
453 fprintf(stderr, "Failed to parse char for Byte 0x%02X\n", i);
454+ return(1);
455 }
456 }
457+ return(0);
458 }
459
460-static void testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
461+static int testCharRangeByte2(xmlParserCtxtPtr ctxt, char *data) {
462 int i, j;
463 int len, c;
464
465@@ -284,10 +310,12 @@
466
467 /* if first bit of first char is set, then second bit must too */
468 if ((i & 0x80) && ((i & 0x40) == 0)) {
469- if (lastError != XML_ERR_INVALID_CHAR)
470+ if (lastError != XML_ERR_INVALID_CHAR) {
471 fprintf(stderr,
472 "Failed to detect invalid char for Bytes 0x%02X 0x%02X\n",
473 i, j);
474+ return(1);
475+ }
476 }
477
478 /*
479@@ -295,10 +323,12 @@
480 * bits must be 10
481 */
482 else if ((i & 0x80) && ((j & 0xC0) != 0x80)) {
483- if (lastError != XML_ERR_INVALID_CHAR)
484+ if (lastError != XML_ERR_INVALID_CHAR) {
485 fprintf(stderr,
486 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
487 i, j, c);
488+ return(1);
489+ }
490 }
491
492 /*
493@@ -306,10 +336,12 @@
494 * than 0x80, i.e. one of bits 5 to 1 of i must be set
495 */
496 else if ((i & 0x80) && ((i & 0x1E) == 0)) {
497- if (lastError != XML_ERR_INVALID_CHAR)
498+ if (lastError != XML_ERR_INVALID_CHAR) {
499 fprintf(stderr,
500 "Failed to detect invalid char for Bytes 0x%02X 0x%02X: %d\n",
501 i, j, c);
502+ return(1);
503+ }
504 }
505
506 /*
507@@ -317,10 +349,12 @@
508 * at least 3 bytes, but we give only 2 !
509 */
510 else if ((i & 0xE0) == 0xE0) {
511- if (lastError != XML_ERR_INVALID_CHAR)
512+ if (lastError != XML_ERR_INVALID_CHAR) {
513 fprintf(stderr,
514 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x00\n",
515 i, j);
516+ return(1);
517+ }
518 }
519
520 /*
521@@ -329,6 +363,7 @@
522 else if ((lastError != 0) || (len != 2)) {
523 fprintf(stderr,
524 "Failed to parse char for Bytes 0x%02X 0x%02X\n", i, j);
525+ return(1);
526 }
527
528 /*
529@@ -338,12 +373,14 @@
530 fprintf(stderr,
531 "Failed to parse char for Bytes 0x%02X 0x%02X: expect %d got %d\n",
532 i, j, ((j & 0x3F) + ((i & 0x1F) << 6)), c);
533+ return(1);
534 }
535 }
536 }
537+ return(0);
538 }
539
540-static void testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
541+static int testCharRangeByte3(xmlParserCtxtPtr ctxt, char *data) {
542 int i, j, k, K;
543 int len, c;
544 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
545@@ -368,20 +405,24 @@
546 * at least 4 bytes, but we give only 3 !
547 */
548 if ((i & 0xF0) == 0xF0) {
549- if (lastError != XML_ERR_INVALID_CHAR)
550+ if (lastError != XML_ERR_INVALID_CHAR) {
551 fprintf(stderr,
552 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
553 i, j, K, data[3]);
554+ return(1);
555+ }
556 }
557
558 /*
559 * The second and the third bytes must start with 10
560 */
561 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80)) {
562- if (lastError != XML_ERR_INVALID_CHAR)
563+ if (lastError != XML_ERR_INVALID_CHAR) {
564 fprintf(stderr,
565 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
566 i, j, K);
567+ return(1);
568+ }
569 }
570
571 /*
572@@ -390,10 +431,12 @@
573 * the 6th byte of data[1] must be set
574 */
575 else if (((i & 0xF) == 0) && ((j & 0x20) == 0)) {
576- if (lastError != XML_ERR_INVALID_CHAR)
577+ if (lastError != XML_ERR_INVALID_CHAR) {
578 fprintf(stderr,
579 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X\n",
580 i, j, K);
581+ return(1);
582+ }
583 }
584
585 /*
586@@ -401,10 +444,12 @@
587 */
588 else if (((value > 0xD7FF) && (value <0xE000)) ||
589 ((value > 0xFFFD) && (value <0x10000))) {
590- if (lastError != XML_ERR_INVALID_CHAR)
591+ if (lastError != XML_ERR_INVALID_CHAR) {
592 fprintf(stderr,
593 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X\n",
594 value, i, j, K);
595+ return(1);
596+ }
597 }
598
599 /*
600@@ -414,6 +459,7 @@
601 fprintf(stderr,
602 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
603 i, j, K);
604+ return(1);
605 }
606
607 /*
608@@ -423,13 +469,15 @@
609 fprintf(stderr,
610 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
611 i, j, data[2], value, c);
612+ return(1);
613 }
614 }
615 }
616 }
617+ return(0);
618 }
619
620-static void testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
621+static int testCharRangeByte4(xmlParserCtxtPtr ctxt, char *data) {
622 int i, j, k, K, l, L;
623 int len, c;
624 unsigned char lows[6] = {0, 0x80, 0x81, 0xC1, 0xFF, 0xBF};
625@@ -458,10 +506,12 @@
626 * at least 5 bytes, but we give only 4 !
627 */
628 if ((i & 0xF8) == 0xF8) {
629- if (lastError != XML_ERR_INVALID_CHAR)
630+ if (lastError != XML_ERR_INVALID_CHAR) {
631 fprintf(stderr,
632 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
633 i, j, K, data[3]);
634+ return(1);
635+ }
636 }
637
638 /*
639@@ -469,10 +519,12 @@
640 */
641 else if (((j & 0xC0) != 0x80) || ((K & 0xC0) != 0x80) ||
642 ((L & 0xC0) != 0x80)) {
643- if (lastError != XML_ERR_INVALID_CHAR)
644+ if (lastError != XML_ERR_INVALID_CHAR) {
645 fprintf(stderr,
646 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
647 i, j, K, L);
648+ return(1);
649+ }
650 }
651
652 /*
653@@ -481,10 +533,12 @@
654 * the 6 or 5th byte of j must be set
655 */
656 else if (((i & 0x7) == 0) && ((j & 0x30) == 0)) {
657- if (lastError != XML_ERR_INVALID_CHAR)
658+ if (lastError != XML_ERR_INVALID_CHAR) {
659 fprintf(stderr,
660 "Failed to detect invalid char for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
661 i, j, K, L);
662+ return(1);
663+ }
664 }
665
666 /*
667@@ -493,10 +547,12 @@
668 else if (((value > 0xD7FF) && (value <0xE000)) ||
669 ((value > 0xFFFD) && (value <0x10000)) ||
670 (value > 0x10FFFF)) {
671- if (lastError != XML_ERR_INVALID_CHAR)
672+ if (lastError != XML_ERR_INVALID_CHAR) {
673 fprintf(stderr,
674 "Failed to detect invalid char 0x%04X for Bytes 0x%02X 0x%02X 0x%02X 0x%02X\n",
675 value, i, j, K, L);
676+ return(1);
677+ }
678 }
679
680 /*
681@@ -506,6 +562,7 @@
682 fprintf(stderr,
683 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X\n",
684 i, j, K);
685+ return(1);
686 }
687
688 /*
689@@ -515,11 +572,13 @@
690 fprintf(stderr,
691 "Failed to parse char for Bytes 0x%02X 0x%02X 0x%02X: expect %d got %d\n",
692 i, j, data[2], value, c);
693+ return(1);
694 }
695 }
696 }
697 }
698 }
699+ return(0);
700 }
701
702 /**
703@@ -530,11 +589,12 @@
704 * cover the full range of UTF-8 chars accepted by XML-1.0
705 */
706
707-static void testCharRanges(void) {
708+static int testCharRanges(void) {
709 char data[5];
710 xmlParserCtxtPtr ctxt;
711 xmlParserInputBufferPtr buf;
712 xmlParserInputPtr input;
713+ int test_ret = 0;
714
715 memset(data, 0, 5);
716
717@@ -545,17 +605,19 @@
718 ctxt = xmlNewParserCtxt();
719 if (ctxt == NULL) {
720 fprintf(stderr, "Failed to allocate parser context\n");
721- return;
722+ return(1);
723 }
724 buf = xmlParserInputBufferCreateStatic(data, sizeof(data),
725 XML_CHAR_ENCODING_NONE);
726 if (buf == NULL) {
727 fprintf(stderr, "Failed to allocate input buffer\n");
728+ test_ret = 1;
729 goto error;
730 }
731 input = xmlNewInputStream(ctxt);
732 if (input == NULL) {
733 xmlFreeParserInputBuffer(buf);
734+ test_ret = 1;
735 goto error;
736 }
737 input->filename = NULL;
738@@ -567,25 +629,28 @@
739
740 printf("testing char range: 1");
741 fflush(stdout);
742- testCharRangeByte1(ctxt, data);
743+ test_ret += testCharRangeByte1(ctxt, data);
744 printf(" 2");
745 fflush(stdout);
746- testCharRangeByte2(ctxt, data);
747+ test_ret += testCharRangeByte2(ctxt, data);
748 printf(" 3");
749 fflush(stdout);
750- testCharRangeByte3(ctxt, data);
751+ test_ret += testCharRangeByte3(ctxt, data);
752 printf(" 4");
753 fflush(stdout);
754- testCharRangeByte4(ctxt, data);
755+ test_ret += testCharRangeByte4(ctxt, data);
756 printf(" done\n");
757 fflush(stdout);
758
759 error:
760 xmlFreeParserCtxt(ctxt);
761+ return(test_ret);
762 }
763
764 int main(void) {
765
766+ int ret = 0;
767+
768 /*
769 * this initialize the library and check potential ABI mismatches
770 * between the version it was compiled for and the actual shared
771@@ -602,8 +667,9 @@
772 /*
773 * Run the tests
774 */
775- testCharRanges();
776- testDocumentRanges();
777+ ret += testCharRanges();
778+ ret += testDocumentRanges();
779+ printf("%s: testchar\n\n", (ret == 0) ? "PASS" : "FAIL");
780
781 /*
782 * Cleanup function for the XML library.
783diff -uNr a/testdict.c b/testdict.c
784--- a/testdict.c 2013-04-16 15:08:42.971177193 +0200
785+++ b/testdict.c 2013-04-18 15:59:00.699482439 +0200
786@@ -440,5 +440,6 @@
787 clean_strings();
788 xmlCleanupParser();
789 xmlMemoryDump();
790+ printf("%s: testdict\n\n", (ret == 0) ? "PASS" : "FAIL");
791 return(ret);
792 }
793diff -uNr a/testlimits.c b/testlimits.c
794--- a/testlimits.c 2013-04-12 16:16:36.180354177 +0200
795+++ b/testlimits.c 2013-04-17 14:03:17.203092987 +0200
796@@ -1630,5 +1630,6 @@
797 xmlCleanupParser();
798 xmlMemoryDump();
799
800+ printf("%s: testlimits\n", (ret == 0) ? "PASS" : "FAIL");
801 return(ret);
802 }
803diff -uNr a/testrecurse.c b/testrecurse.c
804--- a/testrecurse.c 2013-04-16 13:19:49.366536295 +0200
805+++ b/testrecurse.c 2013-04-17 14:06:27.367091622 +0200
806@@ -892,6 +892,7 @@
807 err++;
808 }
809 }
810+ printf("%s: %s\n", (err == 0) ? "PASS" : "FAIL", tst->desc);
811 return(err);
812 }
813
814@@ -961,5 +962,6 @@
815 xmlCleanupParser();
816 xmlMemoryDump();
817
818+ printf("%s: testrecurse\n\n", (ret == 0) ? "PASS" : "FAIL");
819 return(ret);
820 }
diff --git a/meta/recipes-core/libxml/libxml2_2.9.1.bb b/meta/recipes-core/libxml/libxml2_2.9.1.bb
new file mode 100644
index 0000000000..e087324590
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2_2.9.1.bb
@@ -0,0 +1,9 @@
1require libxml2.inc
2
3SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;name=testtar \
4 file://72a46a519ce7326d9a00f0b6a7f2a8e958cd1675.patch"
5
6SRC_URI[libtar.md5sum] = "9c0cfef285d5c4a5c80d00904ddab380"
7SRC_URI[libtar.sha256sum] = "fd3c64cb66f2c4ea27e934d275904d92cec494a8e8405613780cbc8a71680fdb"
8SRC_URI[testtar.md5sum] = "ae3d1ebe000a3972afa104ca7f0e1b4a"
9SRC_URI[testtar.sha256sum] = "96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7"
diff --git a/meta/recipes-core/meta/buildtools-tarball.bb b/meta/recipes-core/meta/buildtools-tarball.bb
new file mode 100644
index 0000000000..302510c798
--- /dev/null
+++ b/meta/recipes-core/meta/buildtools-tarball.bb
@@ -0,0 +1,55 @@
1DESCRIPTION = "SDK type target for building a standalone tarball containing python, chrpath, make, git and tar. The \
2 tarball can be used to run bitbake builds on systems which don't meet the usual version requirements."
3SUMMARY = "Standalone tarball for running builds on systems with inadequate software"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
6 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
7
8TOOLCHAIN_TARGET_TASK ?= ""
9
10TOOLCHAIN_HOST_TASK ?= "\
11 nativesdk-python-core \
12 nativesdk-python-modules \
13 nativesdk-python-misc \
14 nativesdk-python-git \
15 nativesdk-ncurses-terminfo-base \
16 nativesdk-chrpath \
17 nativesdk-tar \
18 nativesdk-buildtools-perl-dummy \
19 nativesdk-git \
20 nativesdk-git-perltools \
21 nativesdk-pigz \
22 nativesdk-make \
23 nativesdk-wget \
24 nativesdk-ca-certificates \
25 "
26
27SDK_PACKAGE_ARCHS =+ "buildtools-dummy-${SDKPKGSUFFIX}"
28
29TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-buildtools-nativesdk-standalone-${DISTRO_VERSION}"
30
31RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
32
33EXCLUDE_FROM_WORLD = "1"
34
35inherit meta
36inherit populate_sdk
37
38create_sdk_files_append () {
39 rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-*
40 rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
41 rm -f ${SDK_OUTPUT}/${SDKPATH}/version-*
42
43 # Generate new (mini) sdk-environment-setup file
44 script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
45 touch $script
46 echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
47 # In order for the self-extraction script to correctly extract and set up things,
48 # we need a 'OECORE_NATIVE_SYSROOT=xxx' line in environment setup script.
49 # However, buildtools-tarball is inherently a tool set instead of a fully functional SDK,
50 # so instead of exporting the variable, we use a comment here.
51 echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
52 toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
53
54 echo 'export GIT_SSL_CAINFO="${SDKPATHNATIVE}${sysconfdir}/ssl/certs/ca-certificates.crt"' >>$script
55}
diff --git a/meta/recipes-core/meta/meta-environment.bb b/meta/recipes-core/meta/meta-environment.bb
new file mode 100644
index 0000000000..90959b5fce
--- /dev/null
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -0,0 +1,77 @@
1SUMMARY = "Package of environment files for SDK"
2LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
3 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
4LICENSE = "MIT"
5PR = "r8"
6
7EXCLUDE_FROM_WORLD = "1"
8
9MODIFYTOS = "0"
10
11REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
12
13inherit toolchain-scripts
14TOOLCHAIN_NEED_CONFIGSITE_CACHE += "zlib"
15
16SDK_DIR = "${WORKDIR}/sdk"
17SDK_OUTPUT = "${SDK_DIR}/image"
18SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
19
20inherit cross-canadian
21
22do_generate_content[nostamp] = "1"
23do_generate_content[cleandirs] = "${SDK_OUTPUT}"
24do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
25python do_generate_content() {
26 # Handle multilibs in the SDK environment, siteconfig, etc files...
27 localdata = bb.data.createCopy(d)
28
29 # make sure we only use the WORKDIR value from 'd', or it can change
30 localdata.setVar('WORKDIR', d.getVar('WORKDIR', True))
31
32 # make sure we only use the SDKTARGETSYSROOT value from 'd'
33 localdata.setVar('SDKTARGETSYSROOT', d.getVar('SDKTARGETSYSROOT', True))
34 localdata.setVar('libdir', d.getVar('target_libdir', False))
35
36 # Process DEFAULTTUNE
37 bb.build.exec_func("create_sdk_files", localdata)
38
39 variants = d.getVar("MULTILIB_VARIANTS", True) or ""
40 for item in variants.split():
41 # Load overrides from 'd' to avoid having to reset the value...
42 overrides = d.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
43 localdata.setVar("OVERRIDES", overrides)
44 localdata.setVar("MLPREFIX", item + "-")
45 bb.data.update_data(localdata)
46 bb.build.exec_func("create_sdk_files", localdata)
47}
48addtask generate_content before do_install after do_compile
49
50create_sdk_files() {
51 # Setup site file for external use
52 toolchain_create_sdk_siteconfig ${SDK_OUTPUT}/${SDKPATH}/site-config-${REAL_MULTIMACH_TARGET_SYS}
53
54 toolchain_create_sdk_env_script ${SDK_OUTPUT}/${SDKPATH}/environment-setup-${REAL_MULTIMACH_TARGET_SYS}
55
56 # Add version information
57 toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${REAL_MULTIMACH_TARGET_SYS}
58}
59
60do_install[nostamp] = "1"
61do_install() {
62 install -d ${D}/${SDKPATH}
63 install -m 0644 -t ${D}/${SDKPATH} ${SDK_OUTPUT}/${SDKPATH}/*
64}
65
66PN = "meta-environment-${MACHINE}"
67PACKAGES = "${PN}"
68FILES_${PN}= " \
69 ${SDKPATH}/* \
70 "
71
72do_fetch[noexec] = "1"
73do_unpack[noexec] = "1"
74do_patch[noexec] = "1"
75do_configure[noexec] = "1"
76do_compile[noexec] = "1"
77do_populate_sysroot[noexec] = "1"
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
new file mode 100644
index 0000000000..2f92912816
--- /dev/null
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -0,0 +1,17 @@
1SUMMARY = "Integrated Development Environment support"
2DESCRIPTION = "Meta package for ensuring the build directory contains all appropriate toolchain packages for using an IDE"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
5 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
6
7DEPENDS = "virtual/libc gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native"
8PR = "r3"
9
10inherit meta toolchain-scripts
11
12do_populate_ide_support () {
13 toolchain_create_tree_env_script
14}
15
16do_populate_ide_support[nostamp] = "1"
17addtask 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
new file mode 100644
index 0000000000..ba9fd88805
--- /dev/null
+++ b/meta/recipes-core/meta/meta-toolchain.bb
@@ -0,0 +1,9 @@
1SUMMARY = "Meta package for building a installable toolchain"
2LICENSE = "MIT"
3
4PR = "r7"
5
6LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
7 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
8
9inherit populate_sdk
diff --git a/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
new file mode 100644
index 0000000000..a3cf9d754a
--- /dev/null
+++ b/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb
@@ -0,0 +1,18 @@
1SUMMARY = "Dummy package which ensures perl is excluded from buildtools"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
4
5inherit nativesdk
6
7# Put it somewhere separate to ensure it's never used except when we want it
8PACKAGE_ARCH = "buildtools-dummy-${SDKPKGSUFFIX}"
9
10PERLPACKAGES = "nativesdk-perl \
11 nativesdk-perl-module-file-path"
12
13ALLOW_EMPTY_${PN} = "1"
14
15python populate_packages_prepend() {
16 d.appendVar('RPROVIDES_${PN}', '${PERLPACKAGES}')
17 d.appendVar('RCONFLICTS_${PN}', '${PERLPACKAGES}')
18}
diff --git a/meta/recipes-core/meta/package-index.bb b/meta/recipes-core/meta/package-index.bb
new file mode 100644
index 0000000000..3c46b49977
--- /dev/null
+++ b/meta/recipes-core/meta/package-index.bb
@@ -0,0 +1,28 @@
1SUMMARY = "Rebuilds the package index"
2LICENSE = "MIT"
3
4INHIBIT_DEFAULT_DEPS = "1"
5PACKAGES = ""
6
7do_fetch[noexec] = "1"
8do_unpack[noexec] = "1"
9do_patch[noexec] = "1"
10do_configure[noexec] = "1"
11do_compile[noexec] = "1"
12do_install[noexec] = "1"
13do_package[noexec] = "1"
14do_packagedata[noexec] = "1"
15do_package_write_ipk[noexec] = "1"
16do_package_write_rpm[noexec] = "1"
17do_package_write_deb[noexec] = "1"
18do_populate_sysroot[noexec] = "1"
19
20do_package_index[nostamp] = "1"
21do_package_index[depends] += "${PACKAGEINDEXDEPS}"
22
23python do_package_index() {
24 from oe.rootfs import generate_index_files
25 generate_index_files(d)
26}
27addtask do_package_index before do_build
28EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/recipes-core/meta/uninative-tarball.bb b/meta/recipes-core/meta/uninative-tarball.bb
new file mode 100644
index 0000000000..e17685a117
--- /dev/null
+++ b/meta/recipes-core/meta/uninative-tarball.bb
@@ -0,0 +1,48 @@
1SUMMARY = "libc and patchelf tarball for use with uninative.bbclass"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
4 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6TOOLCHAIN_TARGET_TASK = ""
7
8TOOLCHAIN_HOST_TASK = "\
9 nativesdk-glibc \
10 nativesdk-patchelf \
11 "
12
13INHIBIT_DEFAULT_DEPS = "1"
14DEPENDS += "patchelf-native"
15
16TOOLCHAIN_OUTPUTNAME ?= "${BUILD_ARCH}-nativesdk-libc"
17
18RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
19
20EXCLUDE_FROM_WORLD = "1"
21
22inherit meta
23inherit populate_sdk
24
25deltask install
26deltask package
27
28SDK_PACKAGING_FUNC = ""
29
30fakeroot create_sdk_files() {
31 cp ${COREBASE}/scripts/relocate_sdk.py ${SDK_OUTPUT}/${SDKPATH}/
32
33 # Replace the ##DEFAULT_INSTALL_DIR## with the correct pattern.
34 # Escape special characters like '+' and '.' in the SDKPATH
35 escaped_sdkpath=$(echo ${SDKPATH}/sysroots/${SDK_SYS} |sed -e "s:[\+\.]:\\\\\\\\\0:g")
36 sed -i -e "s:##DEFAULT_INSTALL_DIR##:$escaped_sdkpath:" ${SDK_OUTPUT}/${SDKPATH}/relocate_sdk.py
37}
38
39
40fakeroot tar_sdk() {
41 mkdir -p ${SDK_DEPLOY}
42 cd ${SDK_OUTPUT}/${SDKPATH}
43 mv sysroots/${SDK_SYS} ./${BUILD_SYS}
44 rm sysroots -rf
45 patchelf --set-interpreter ${@''.join('a' for n in xrange(1024))} ./${BUILD_SYS}/usr/bin/patchelf
46 mv ./${BUILD_SYS}/usr/bin/patchelf ./${BUILD_SYS}/usr/bin/patchelf-uninative
47 tar ${SDKTAROPTS} -c --file=${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.tar.bz2 .
48}
diff --git a/meta/recipes-core/ncurses/ncurses-5.9/config.cache b/meta/recipes-core/ncurses/ncurses-5.9/config.cache
new file mode 100644
index 0000000000..6a9217d5bb
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses-5.9/config.cache
@@ -0,0 +1,4 @@
1#! /bin/sh
2
3cf_cv_func_nanosleep=yes
4cf_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
new file mode 100644
index 0000000000..cba89d26f5
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses-5.9/tic-hang.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Inappropriate [configuration]
2
3'tic' of some linux distributions (e.g. fedora 11) hang in an infinite
4loop when processing the original file.
5
6Index: ncurses-5.7/misc/terminfo.src
7===================================================================
8--- ncurses-5.7.orig/misc/terminfo.src
9+++ ncurses-5.7/misc/terminfo.src
10@@ -3706,12 +3706,11 @@ konsole-xf3x|KDE console window with key
11 # The value for kbs reflects local customization rather than the settings used
12 # for XFree86 xterm.
13 konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm,
14- kend=\EOF, khome=\EOH, use=konsole+pcfkeys,
15- use=konsole-vt100,
16-# Konsole does not implement shifted cursor-keys.
17-konsole+pcfkeys|konsole subset of xterm+pcfkeys,
18- kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2,
19- use=xterm+pcf0,
20+ kend=\EOF, kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R,
21+ kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~,
22+ kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~,
23+ kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR, kf4=\EOS,
24+ khome=\EOH, use=konsole-vt100,
25 # KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but
26 # it is still useful for deriving the other entries.
27 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
new file mode 100644
index 0000000000..10f7dd175d
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses.inc
@@ -0,0 +1,296 @@
1SUMMARY = "The New Curses library"
2DESCRIPTION = "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."
3HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
4LICENSE = "MIT"
5LIC_FILES_CHKSUM = "file://ncurses/base/version.c;beginline=1;endline=27;md5=cbc180a8c44ca642e97c35452fab5f66"
6SECTION = "libs"
7DEPENDS = "ncurses-native"
8DEPENDS_class-native = ""
9INC_PR = "r15"
10
11BINCONFIG = "${bindir}/ncurses-config"
12
13inherit autotools binconfig-disabled multilib_header
14
15# Upstream has useful patches at times at ftp://invisible-island.net/ncurses/
16SRC_URI = "${GNU_MIRROR}/ncurses/ncurses-${PV}.tar.gz"
17
18EXTRA_AUTORECONF = "-I m4"
19CONFIG_SITE =+ "${WORKDIR}/config.cache"
20
21# Whether to enable separate widec libraries; must be 'true' or 'false'
22#
23# TODO: remove this variable when widec is supported in every setup?
24ENABLE_WIDEC ?= "true"
25
26# _GNU_SOURCE is required for widec stuff and is detected automatically
27# for target objects. But it must be set manually for native and sdk
28# builds.
29BUILD_CPPFLAGS += "-D_GNU_SOURCE"
30
31# natives don't generally look in base_libdir
32base_libdir_class-native = "${libdir}"
33
34# Display corruption occurs on 64 bit hosts without these settings
35# This was derrived from the upstream debian ncurses which uses
36# these settings for 32 and 64 bit hosts.
37EXCONFIG_ARGS = ""
38EXCONFIG_ARGS_class-native = " \
39 --disable-lp64 \
40 --with-chtype='long' \
41 --with-mmask-t='long'"
42EXCONFIG_ARGS_class-nativesdk = " \
43 --disable-lp64 \
44 --with-chtype='long' \
45 --with-mmask-t='long'"
46
47PACKAGES_DYNAMIC = "^${PN}-lib.*"
48
49# Fall back to the host termcap / terminfo for -nativesdk and -native
50# The reality is a work around for strange problems with things like
51# "bitbake -c menuconfig busybox" where it cannot find the terminfo
52# because the sstate had a hard coded search path. Until this is fixed
53# another way this is deemed good enough.
54EX_TERMCAP = ""
55EX_TERMCAP_class-native = ":/etc/termcap:/usr/share/misc/termcap"
56EX_TERMCAP_class-nativesdk = ":/etc/termcap:/usr/share/misc/termcap"
57EX_TERMINFO = ""
58EX_TERMINFO_class-native = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
59EX_TERMINFO_class-nativesdk = ":/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo"
60
61# Helper function for do_configure to allow multiple configurations
62# $1 the directory to run configure in
63# $@ the arguments to pass to configure
64ncurses_configure() {
65 mkdir -p $1
66 cd $1
67 shift
68 oe_runconf \
69 --disable-static \
70 --without-debug \
71 --without-ada \
72 --without-gpm \
73 --enable-hard-tabs \
74 --enable-xmc-glitch \
75 --enable-colorfgbg \
76 --with-termpath='${sysconfdir}/termcap:${datadir}/misc/termcap${EX_TERMCAP}' \
77 --with-terminfo-dirs='${sysconfdir}/terminfo:${datadir}/terminfo${EX_TERMINFO}' \
78 --with-shared \
79 --disable-big-core \
80 --program-prefix= \
81 --with-ticlib \
82 --with-termlib=tinfo \
83 --enable-sigwinch \
84 --enable-pc-files \
85 --disable-rpath-hack \
86 ${EXCONFIG_ARGS} \
87 --with-manpage-format=normal \
88 "$@" || return 1
89 cd ..
90}
91
92# Override the function from the autotools class; ncurses requires a
93# patched autoconf213 to generate the configure script. This autoconf
94# is not available so that the shipped script will be used.
95do_configure() {
96 # check does not work with cross-compiling and is generally
97 # broken because it requires stdin to be pollable (which is
98 # not the case for /dev/null redirections)
99 export cf_cv_working_poll=yes
100
101 # The --enable-pc-files requires PKG_CONFIG_LIBDIR existed
102 mkdir -p ${PKG_CONFIG_LIBDIR}
103 ( cd ${S}; gnu-configize --force )
104 ncurses_configure "narrowc" || \
105 return 1
106 ! ${ENABLE_WIDEC} || \
107 ncurses_configure "widec" "--enable-widec" "--without-progs"
108}
109
110do_compile() {
111 oe_runmake -C narrowc libs
112 oe_runmake -C narrowc/progs
113
114 ! ${ENABLE_WIDEC} || \
115 oe_runmake -C widec libs
116}
117
118# set of expected differences between narrowc and widec header
119#
120# TODO: the NCURSES_CH_T difference can cause real problems :(
121_unifdef_cleanup = " \
122 -e '\!/\* \$Id: curses.wide,v!,\!/\* \$Id: curses.tail,v!d' \
123 -e '/^#define NCURSES_CH_T /d' \
124 -e '/^#include <wchar.h>/d' \
125 -e '\!^/\* .* \*/!d' \
126"
127
128do_test[depends] = "unifdef-native:do_populate_sysroot"
129do_test[dirs] = "${S}"
130do_test() {
131 ${ENABLE_WIDEC} || return 0
132
133 # make sure that the narrow and widec header are compatible
134 # and differ only in minor details.
135 unifdef -k narrowc/include/curses.h | \
136 sed ${_unifdef_cleanup} > curses-narrowc.h
137 unifdef -k widec/include/curses.h | \
138 sed ${_unifdef_cleanup} > curses-widec.h
139
140 diff curses-narrowc.h curses-widec.h
141}
142
143# Split original _install_opts to two parts.
144# One is the options to install contents, the other is the parameters \
145# when running command "make install"
146_install_opts = "\
147 install.libs install.includes install.man \
148"
149_install_cfgs = "\
150 DESTDIR='${D}' \
151 PKG_CONFIG_LIBDIR='${libdir}/pkgconfig' \
152"
153
154do_install() {
155 # Order of installation is important; widec installs a 'curses.h'
156 # header with more definitions and must be installed last hence.
157 # Compatibility of these headers will be checked in 'do_test()'.
158 oe_runmake -C narrowc ${_install_cfgs} ${_install_opts} \
159 install.progs
160
161 # The install.data should run after install.libs, otherwise
162 # there would be a race issue in a very critical conditon, since
163 # tic will be run by install.data, and tic needs libtinfo.so
164 # which would be regenerated by install.libs.
165 oe_runmake -C narrowc ${_install_cfgs} \
166 install.data
167
168
169 ! ${ENABLE_WIDEC} || \
170 oe_runmake -C widec ${_install_cfgs} ${_install_opts}
171
172 cd narrowc
173
174 # include some basic terminfo files
175 # stolen ;) from gentoo and modified a bit
176 for x in ansi console dumb linux rxvt screen sun vt52 vt100 vt102 vt200 vt220 xterm-color xterm-xfree86 xterm-256color
177 do
178 local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
179 local basedir="$(basename $(dirname "${termfile}"))"
180
181 if [ -n "${termfile}" ]
182 then
183 install -d ${D}${sysconfdir}/terminfo/${basedir}
184 mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
185 ln -s /etc/terminfo/${basedir}/${x} \
186 ${D}${datadir}/terminfo/${basedir}/${x}
187 fi
188 done
189 # i think we can use xterm-color as default xterm
190 if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
191 then
192 ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
193 fi
194
195 rm -f ${D}${libdir}/terminfo
196
197 # create linker scripts for libcurses.so and libncurses to
198 # link against -ltinfo when needed. Some builds might break
199 # else when '-Wl,--no-copy-dt-needed-entries' has been set in
200 # linker flags.
201 for i in libncurses libncursesw; do
202 f=${D}${libdir}/$i.so
203 test -h $f || continue
204 rm -f $f
205 echo '/* GNU ld script */' >$f
206 echo "INPUT($i.so.5 AS_NEEDED(-ltinfo))" >>$f
207 done
208
209 # Make sure that libcurses is linked so that it gets -ltinfo
210 # also, this should be addressed upstream really.
211 ln -sf libncurses.so ${D}${libdir}/libcurses.so
212
213 # create libtermcap.so linker script for backward compatibility
214 f=${D}${libdir}/libtermcap.so
215 echo '/* GNU ld script */' >$f
216 echo 'INPUT(AS_NEEDED(-ltinfo))' >>$f
217
218 if [ ! -d "${D}${base_libdir}" ]; then
219 # Setting base_libdir to libdir as is done in the -native
220 # case will skip this code
221 mkdir ${D}${base_libdir}
222 mv ${D}${libdir}/libncurses.so.* ${D}${base_libdir}
223 ! ${ENABLE_WIDEC} || \
224 mv ${D}${libdir}/libncursesw.so.* ${D}${base_libdir}
225
226 mv ${D}${libdir}/libtinfo.so.* ${D}${base_libdir}
227 rm ${D}${libdir}/libtinfo.so
228
229 # Use lnr to ensure this is a relative link despite absolute paths
230 # (as we can't know the relationship between base_libdir and libdir).
231 # At some point we can rely on coreutils 8.16 which has ln -r.
232 lnr ${D}${base_libdir}/libtinfo.so.5 ${D}${libdir}/libtinfo.so
233 fi
234
235 oe_multilib_header curses.h
236}
237
238python populate_packages_prepend () {
239 libdir = d.expand("${libdir}")
240 base_libdir = d.expand("${base_libdir}")
241 pnbase = d.expand("${PN}-lib%s")
242 do_split_packages(d, libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
243 if libdir is not base_libdir:
244 do_split_packages(d, base_libdir, '^lib(.*)\.so\..*', pnbase, 'ncurses %s library', prepend=True, extra_depends = '', allow_links=True)
245}
246
247
248inherit update-alternatives
249
250ALTERNATIVE_PRIORITY = "100"
251
252ALTERNATIVE_ncurses-tools_class-target = "clear reset"
253
254BBCLASSEXTEND = "native nativesdk"
255
256PACKAGES += " \
257 ${PN}-tools \
258 ${PN}-terminfo \
259 ${PN}-terminfo-base \
260"
261
262FILES_${PN} = "\
263 ${bindir}/tput \
264 ${bindir}/tset \
265 ${bindir}/ncurses5-config \
266 ${bindir}/ncursesw5-config \
267 ${datadir}/tabset \
268"
269
270# This keeps only tput/tset in ncurses
271# clear/reset are in already busybox
272FILES_${PN}-tools = "\
273 ${bindir}/tic \
274 ${bindir}/toe \
275 ${bindir}/infotocap \
276 ${bindir}/captoinfo \
277 ${bindir}/infocmp \
278 ${bindir}/clear${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
279 ${bindir}/reset${@['', '.${BPN\x7d']['${CLASSOVERRIDE}' == 'class-target']} \
280 ${bindir}/tack \
281 ${bindir}/tabs \
282"
283
284# 'reset' is a symlink to 'tset' which is in the 'ncurses' package
285RDEPENDS_${PN}-tools = "${PN}"
286
287FILES_${PN}-terminfo = "\
288 ${datadir}/terminfo \
289"
290
291FILES_${PN}-terminfo-base = "\
292 ${sysconfdir}/terminfo \
293"
294
295RSUGGESTS_${PN}-libtinfo = "${PN}-terminfo"
296RRECOMMENDS_${PN}-libtinfo = "${PN}-terminfo-base"
diff --git a/meta/recipes-core/ncurses/ncurses_5.9.bb b/meta/recipes-core/ncurses/ncurses_5.9.bb
new file mode 100644
index 0000000000..6d23c0c7ea
--- /dev/null
+++ b/meta/recipes-core/ncurses/ncurses_5.9.bb
@@ -0,0 +1,10 @@
1require ncurses.inc
2
3PR = "${INC_PR}.1"
4
5SRC_URI += "file://tic-hang.patch \
6 file://config.cache \
7"
8
9SRC_URI[md5sum] = "8cb9c412e5f2d96bc6f459aa8c6282a1"
10SRC_URI[sha256sum] = "9046298fb440324c9d4135ecea7879ffed8546dd1b58e59430ea07a4633f563b"
diff --git a/meta/recipes-core/ncurses/site_config/headers b/meta/recipes-core/ncurses/site_config/headers
new file mode 100644
index 0000000000..087b7bfd5e
--- /dev/null
+++ b/meta/recipes-core/ncurses/site_config/headers
@@ -0,0 +1,5 @@
1curses.h
2ncurses/curses.h
3ncurses.h
4ncurses/termcap.h
5
diff --git a/meta/recipes-core/netbase/netbase/hosts b/meta/recipes-core/netbase/netbase/hosts
new file mode 100644
index 0000000000..2f332451b5
--- /dev/null
+++ b/meta/recipes-core/netbase/netbase/hosts
@@ -0,0 +1,2 @@
1127.0.0.1 localhost.localdomain localhost
2
diff --git a/meta/recipes-core/netbase/netbase_5.2.bb b/meta/recipes-core/netbase/netbase_5.2.bb
new file mode 100644
index 0000000000..ab7ae6527c
--- /dev/null
+++ b/meta/recipes-core/netbase/netbase_5.2.bb
@@ -0,0 +1,23 @@
1SUMMARY = "Basic TCP/IP networking support"
2DESCRIPTION = "This package provides the necessary infrastructure for basic TCP/IP based networking"
3HOMEPAGE = "http://packages.debian.org/netbase"
4SECTION = "base"
5LICENSE = "GPLv2"
6LIC_FILES_CHKSUM = "file://debian/copyright;md5=3dd6192d306f582dee7687da3d8748ab"
7PE = "1"
8
9SRC_URI = "${DEBIAN_MIRROR}/main/n/netbase/netbase_${PV}.tar.gz \
10 file://hosts"
11
12SRC_URI[md5sum] = "3a01bfce6a28e1743412198abd241262"
13SRC_URI[sha256sum] = "d62ba56d62b9b121664828175c2a237a7014ef32df8a4116ea33cff332de3307"
14
15do_install () {
16 install -d ${D}/${mandir}/man8 ${D}${sysconfdir}
17 install -m 0644 ${WORKDIR}/hosts ${D}${sysconfdir}/hosts
18 install -m 0644 etc-rpc ${D}${sysconfdir}/rpc
19 install -m 0644 etc-protocols ${D}${sysconfdir}/protocols
20 install -m 0644 etc-services ${D}${sysconfdir}/services
21}
22
23CONFFILES_${PN} = "${sysconfdir}/hosts"
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
new file mode 100644
index 0000000000..33e958137f
--- /dev/null
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -0,0 +1,36 @@
1inherit allarch
2
3SUMMARY = "Operating system identification"
4DESCRIPTION = "The /etc/os-release file contains operating system identification data."
5LICENSE = "MIT"
6INHIBIT_DEFAULT_DEPS = "1"
7
8do_fetch[noexec] = "1"
9do_unpack[noexec] = "1"
10do_patch[noexec] = "1"
11do_configure[noexec] = "1"
12
13# Other valid fields: BUILD_ID ID_LIKE ANSI_COLOR CPE_NAME
14# HOME_URL SUPPORT_URL BUG_REPORT_URL
15OS_RELEASE_FIELDS = "ID ID_LIKE NAME VERSION VERSION_ID PRETTY_NAME"
16
17ID = "${DISTRO}"
18NAME = "${DISTRO_NAME}"
19VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}"
20VERSION_ID = "${DISTRO_VERSION}"
21PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
22BUILD_ID ?= "${DATETIME}"
23
24python do_compile () {
25 with open(d.expand('${B}/os-release'), 'w') as f:
26 for field in d.getVar('OS_RELEASE_FIELDS', True).split():
27 value = d.getVar(field, True)
28 if value:
29 f.write('{0}={1}\n'.format(field, value))
30}
31do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
32
33do_install () {
34 install -d ${D}${sysconfdir}
35 install -m 0644 os-release ${D}${sysconfdir}/
36}
diff --git a/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
new file mode 100644
index 0000000000..0c6a530be6
--- /dev/null
+++ b/meta/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bb
@@ -0,0 +1,33 @@
1#
2# Copyright (C) 2007 OpenedHand Ltd
3#
4
5SUMMARY = "Host packages for the standalone SDK or external toolchain"
6PR = "r12"
7LICENSE = "MIT"
8
9inherit packagegroup nativesdk
10
11PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
12
13RDEPENDS_${PN} = "\
14 nativesdk-pkgconfig \
15 nativesdk-qemu \
16 nativesdk-qemu-helper \
17 nativesdk-pseudo \
18 nativesdk-unfs3 \
19 nativesdk-opkg \
20 nativesdk-libtool \
21 nativesdk-autoconf \
22 nativesdk-automake \
23 nativesdk-shadow \
24 nativesdk-makedevs \
25 nativesdk-smartpm \
26 nativesdk-postinst-intercept \
27 "
28
29RDEPENDS_${PN}_darwin = "\
30 nativesdk-pkgconfig \
31 nativesdk-opkg \
32 nativesdk-libtool \
33 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-base.bb b/meta/recipes-core/packagegroups/packagegroup-base.bb
new file mode 100644
index 0000000000..f4b2cd574d
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-base.bb
@@ -0,0 +1,366 @@
1SUMMARY = "Merge machine and distro options to create a basic machine task/package"
2LICENSE = "MIT"
3PR = "r83"
4
5#
6# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH
7#
8PACKAGE_ARCH = "${MACHINE_ARCH}"
9
10inherit packagegroup
11
12PROVIDES = "${PACKAGES}"
13PACKAGES = ' \
14 packagegroup-base \
15 packagegroup-base-extended \
16 packagegroup-distro-base \
17 packagegroup-machine-base \
18 \
19 ${@bb.utils.contains("MACHINE_FEATURES", "acpi", "packagegroup-base-acpi", "",d)} \
20 ${@bb.utils.contains("MACHINE_FEATURES", "alsa", "packagegroup-base-alsa", "", d)} \
21 ${@bb.utils.contains("MACHINE_FEATURES", "apm", "packagegroup-base-apm", "", d)} \
22 ${@bb.utils.contains("MACHINE_FEATURES", "ext2", "packagegroup-base-ext2", "", d)} \
23 ${@bb.utils.contains("MACHINE_FEATURES", "vfat", "packagegroup-base-vfat", "", d)} \
24 ${@bb.utils.contains("MACHINE_FEATURES", "irda", "packagegroup-base-irda", "",d)} \
25 ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "packagegroup-base-keyboard", "", d)} \
26 ${@bb.utils.contains("MACHINE_FEATURES", "pci", "packagegroup-base-pci", "",d)} \
27 ${@bb.utils.contains("MACHINE_FEATURES", "pcmcia", "packagegroup-base-pcmcia", "", d)} \
28 ${@bb.utils.contains("MACHINE_FEATURES", "phone", "packagegroup-base-phone", "", d)} \
29 ${@bb.utils.contains("MACHINE_FEATURES", "serial", "packagegroup-base-serial", "", d)} \
30 ${@bb.utils.contains("MACHINE_FEATURES", "usbgadget", "packagegroup-base-usbgadget", "", d)} \
31 ${@bb.utils.contains("MACHINE_FEATURES", "usbhost", "packagegroup-base-usbhost", "", d)} \
32 \
33 ${@bb.utils.contains("DISTRO_FEATURES", "bluetooth", "packagegroup-base-bluetooth", "", d)} \
34 ${@bb.utils.contains("DISTRO_FEATURES", "wifi", "packagegroup-base-wifi", "", d)} \
35 ${@bb.utils.contains("DISTRO_FEATURES", "3g", "packagegroup-base-3g", "", d)} \
36 ${@bb.utils.contains("DISTRO_FEATURES", "nfc", "packagegroup-base-nfc", "", d)} \
37 ${@bb.utils.contains("DISTRO_FEATURES", "cramfs", "packagegroup-base-cramfs", "", d)} \
38 ${@bb.utils.contains("DISTRO_FEATURES", "ipsec", "packagegroup-base-ipsec", "", d)} \
39 ${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "packagegroup-base-ipv6", "", d)} \
40 ${@bb.utils.contains("DISTRO_FEATURES", "nfs", "packagegroup-base-nfs", "", d)} \
41 ${@bb.utils.contains("DISTRO_FEATURES", "ppp", "packagegroup-base-ppp", "", d)} \
42 ${@bb.utils.contains("DISTRO_FEATURES", "smbfs", "packagegroup-base-smbfs", "", d)} \
43 ${@bb.utils.contains("DISTRO_FEATURES", "zeroconf", "packagegroup-base-zeroconf", "", d)} \
44 \
45 '
46
47# Override by distro if needed
48VIRTUAL-RUNTIME_keymaps ?= "keymaps"
49
50#
51# packagegroup-base contain stuff needed for base system (machine related)
52#
53RDEPENDS_packagegroup-base = "\
54 packagegroup-distro-base \
55 packagegroup-machine-base \
56 \
57 sysfsutils \
58 module-init-tools \
59 ${@bb.utils.contains('MACHINE_FEATURES', 'apm', 'packagegroup-base-apm', '',d)} \
60 ${@bb.utils.contains('MACHINE_FEATURES', 'acpi', 'packagegroup-base-acpi', '',d)} \
61 ${@bb.utils.contains('MACHINE_FEATURES', 'keyboard', 'packagegroup-base-keyboard', '',d)} \
62 ${@bb.utils.contains('MACHINE_FEATURES', 'phone', 'packagegroup-base-phone', '',d)} \
63 \
64 ${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'packagegroup-base-alsa', '',d)} \
65 ${@bb.utils.contains('COMBINED_FEATURES', 'ext2', 'packagegroup-base-ext2', '',d)} \
66 ${@bb.utils.contains('COMBINED_FEATURES', 'vfat', 'packagegroup-base-vfat', '',d)} \
67 ${@bb.utils.contains('COMBINED_FEATURES', 'irda', 'packagegroup-base-irda', '',d)} \
68 ${@bb.utils.contains('COMBINED_FEATURES', 'pci', 'packagegroup-base-pci', '',d)} \
69 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'packagegroup-base-pcmcia', '',d)} \
70 ${@bb.utils.contains('COMBINED_FEATURES', 'usbgadget', 'packagegroup-base-usbgadget', '',d)} \
71 ${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'packagegroup-base-usbhost', '',d)} \
72 ${@bb.utils.contains('COMBINED_FEATURES', 'bluetooth', 'packagegroup-base-bluetooth', '',d)} \
73 ${@bb.utils.contains('COMBINED_FEATURES', 'wifi', 'packagegroup-base-wifi', '',d)} \
74 ${@bb.utils.contains('COMBINED_FEATURES', '3g', 'packagegroup-base-3g', '',d)} \
75 ${@bb.utils.contains('COMBINED_FEATURES', 'nfc', 'packagegroup-base-nfc', '',d)} \
76 \
77 ${@bb.utils.contains('DISTRO_FEATURES', 'nfs', 'packagegroup-base-nfs', '',d)} \
78 ${@bb.utils.contains('DISTRO_FEATURES', 'cramfs', 'packagegroup-base-cramfs', '',d)} \
79 ${@bb.utils.contains('DISTRO_FEATURES', 'smbfs', 'packagegroup-base-smbfs', '',d)} \
80 ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'packagegroup-base-ipv6', '',d)} \
81 ${@bb.utils.contains('DISTRO_FEATURES', 'ipsec', 'packagegroup-base-ipsec', '',d)} \
82 ${@bb.utils.contains('DISTRO_FEATURES', 'ppp', 'packagegroup-base-ppp', '',d)} \
83 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', 'packagegroup-base-zeroconf', '',d)} \
84 "
85
86
87RRECOMMENDS_packagegroup-base = "\
88 kernel-module-nls-utf8 \
89 kernel-module-input \
90 kernel-module-uinput \
91 kernel-module-rtc-dev \
92 kernel-module-rtc-proc \
93 kernel-module-rtc-sysfs \
94 kernel-module-unix"
95
96RDEPENDS_packagegroup-base-extended = "\
97 packagegroup-base \
98 ${ADD_WIFI} \
99 ${ADD_BT} \
100 ${ADD_3G} \
101 ${ADD_NFC} \
102 "
103
104ADD_WIFI = ""
105ADD_BT = ""
106ADD_3G = ""
107ADD_NFC = ""
108
109python __anonymous () {
110 # If Distro want wifi and machine feature wifi/pci/pcmcia/usbhost (one of them)
111 # then include packagegroup-base-wifi in packagegroup-base
112
113 distro_features = set(d.getVar("DISTRO_FEATURES", True).split())
114 machine_features= set(d.getVar("MACHINE_FEATURES", True).split())
115
116 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):
117 d.setVar("ADD_BT", "packagegroup-base-bluetooth")
118
119 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):
120 d.setVar("ADD_WIFI", "packagegroup-base-wifi")
121
122 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):
123 d.setVar("ADD_3G", "packagegroup-base-3g")
124
125 if "nfc" in distro_features and not "nfc" in machine_features and ("usbhost" in machine_features):
126 d.setVar("ADD_NFC", "packagegroup-base-nfc")
127}
128
129#
130# packages added by distribution
131#
132SUMMARY_packagegroup-distro-base = "${DISTRO} extras"
133DEPENDS_packagegroup-distro-base = "${DISTRO_EXTRA_DEPENDS}"
134RDEPENDS_packagegroup-distro-base = "${DISTRO_EXTRA_RDEPENDS}"
135RRECOMMENDS_packagegroup-distro-base = "${DISTRO_EXTRA_RRECOMMENDS}"
136
137#
138# packages added by machine config
139#
140SUMMARY_packagegroup-machine-base = "${MACHINE} extras"
141SUMMARY_packagegroup-machine-base = "Extra packages required to fully support ${MACHINE} hardware"
142RDEPENDS_packagegroup-machine-base = "${MACHINE_EXTRA_RDEPENDS}"
143RRECOMMENDS_packagegroup-machine-base = "${MACHINE_EXTRA_RRECOMMENDS}"
144
145SUMMARY_packagegroup-base-keyboard = "Keyboard support"
146RDEPENDS_packagegroup-base-keyboard = "\
147 ${VIRTUAL-RUNTIME_keymaps}"
148
149SUMMARY_packagegroup-base-pci = "PCI bus support"
150RDEPENDS_packagegroup-base-pci = "\
151 pciutils"
152
153SUMMARY_packagegroup-base-acpi = "ACPI support"
154RDEPENDS_packagegroup-base-acpi = "\
155 acpid \
156 libacpi "
157
158SUMMARY_packagegroup-base-apm = "APM support"
159RDEPENDS_packagegroup-base-apm = "\
160 ${VIRTUAL-RUNTIME_apm} \
161 apmd"
162
163SUMMARY_packagegroup-base-ext2 = "ext2 filesystem support"
164RDEPENDS_packagegroup-base-ext2 = "\
165 hdparm \
166 e2fsprogs \
167 e2fsprogs-e2fsck \
168 e2fsprogs-mke2fs"
169
170SUMMARY_packagegroup-base-vfat = "FAT filesystem support"
171RRECOMMENDS_packagegroup-base-vfat = "\
172 kernel-module-msdos \
173 kernel-module-vfat \
174 kernel-module-nls-iso8859-1 \
175 kernel-module-nls-cp437 \
176 dosfstools"
177
178SUMMARY_packagegroup-base-alsa = "ALSA sound support"
179RDEPENDS_packagegroup-base-alsa = "\
180 alsa-utils-alsactl \
181 alsa-utils-alsamixer \
182 ${VIRTUAL-RUNTIME_alsa-state}"
183
184RRECOMMENDS_packagegroup-base-alsa = "\
185 kernel-module-snd-mixer-oss \
186 kernel-module-snd-pcm-oss"
187
188SUMMARY_packagegroup-base-pcmcia = "PC card slot support"
189RDEPENDS_packagegroup-base-pcmcia = "\
190 pcmciautils \
191 "
192
193RRECOMMENDS_packagegroup-base-pcmcia = "\
194 kernel-module-pcmcia \
195 kernel-module-airo-cs \
196 kernel-module-pcnet-cs \
197 kernel-module-serial-cs \
198 kernel-module-ide-cs \
199 kernel-module-ide-disk \
200 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'kernel-module-hostap-cs', '',d)} \
201 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'kernel-module-orinoco-cs', '',d)} \
202 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'kernel-module-spectrum-cs', '',d)}"
203
204SUMMARY_packagegroup-base-bluetooth = "Bluetooth support"
205RDEPENDS_packagegroup-base-bluetooth = "\
206 bluez4 \
207 ${@bb.utils.contains('COMBINED_FEATURES', 'alsa', 'libasound-module-bluez', '',d)} \
208 "
209
210RRECOMMENDS_packagegroup-base-bluetooth = "\
211 kernel-module-bluetooth \
212 kernel-module-l2cap \
213 kernel-module-rfcomm \
214 kernel-module-hci-vhci \
215 kernel-module-bnep \
216 kernel-module-hidp \
217 kernel-module-hci-uart \
218 kernel-module-sco \
219 ${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-hci-usb', '',d)} \
220 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluetooth3c-cs', '',d)} \
221 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluecard-cs', '',d)} \
222 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-bluetoothuart-cs', '',d)} \
223 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'kernel-module-dtl1-cs', '',d)} \
224 "
225
226SUMMARY_packagegroup-base-irda = "IrDA support"
227RDEPENDS_packagegroup-base-irda = "\
228 irda-utils"
229
230RRECOMMENDS_packagegroup-base-irda = "\
231 kernel-module-pxaficp-ir \
232 kernel-module-irda \
233 kernel-module-ircomm \
234 kernel-module-ircomm-tty \
235 kernel-module-irlan \
236 ${@bb.utils.contains('DISTRO_FEATURES', 'ppp', 'kernel-module-irnet', '',d)} \
237 kernel-module-irport \
238 kernel-module-irtty \
239 kernel-module-irtty-sir \
240 kernel-module-sir-dev \
241 ${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-ir-usb', '',d)} "
242
243SUMMARY_packagegroup-base-usbgadget = "USB gadget support"
244RRECOMMENDS_packagegroup-base-usbgadget = "\
245 kernel-module-pxa27x_udc \
246 kernel-module-gadgetfs \
247 kernel-module-g-file-storage \
248 kernel-module-g-serial \
249 kernel-module-g-ether"
250
251SUMMARY_packagegroup-base-usbhost = "USB host support"
252RDEPENDS_packagegroup-base-usbhost = "\
253 usbutils "
254
255RRECOMMENDS_packagegroup-base-usbhost = "\
256 kernel-module-uhci-hcd \
257 kernel-module-ohci-hcd \
258 kernel-module-ehci-hcd \
259 kernel-module-usbcore \
260 kernel-module-usbhid \
261 kernel-module-usbnet \
262 kernel-module-sd-mod \
263 kernel-module-scsi-mod \
264 kernel-module-usbmouse \
265 kernel-module-mousedev \
266 kernel-module-usbserial \
267 kernel-module-usb-storage "
268
269SUMMARY_packagegroup-base-ppp = "PPP dial-up protocol support"
270RDEPENDS_packagegroup-base-ppp = "\
271 ppp \
272 ppp-dialin"
273
274RRECOMMENDS_packagegroup-base-ppp = "\
275 kernel-module-ppp-async \
276 kernel-module-ppp-deflate \
277 kernel-module-ppp-generic \
278 kernel-module-ppp-mppe \
279 kernel-module-slhc"
280
281SUMMARY_packagegroup-base-ipsec = "IPSEC support"
282RDEPENDS_packagegroup-base-ipsec = "\
283 "
284
285RRECOMMENDS_packagegroup-base-ipsec = "\
286 kernel-module-ipsec"
287
288#
289# packagegroup-base-wifi contain everything needed to get WiFi working
290# WEP/WPA connection needs to be supported out-of-box
291#
292SUMMARY_packagegroup-base-wifi = "WiFi support"
293RDEPENDS_packagegroup-base-wifi = "\
294 wireless-tools \
295 ${@bb.utils.contains('COMBINED_FEATURES', 'pcmcia', 'hostap-utils', '',d)} \
296 ${@bb.utils.contains('COMBINED_FEATURES', 'pci', 'hostap-utils', '',d)} \
297 wpa-supplicant"
298
299RRECOMMENDS_packagegroup-base-wifi = "\
300 ${@bb.utils.contains('COMBINED_FEATURES', 'usbhost', 'kernel-module-zd1211rw', '',d)} \
301 kernel-module-ieee80211-crypt \
302 kernel-module-ieee80211-crypt-ccmp \
303 kernel-module-ieee80211-crypt-tkip \
304 kernel-module-ieee80211-crypt-wep \
305 kernel-module-ecb \
306 kernel-module-arc4 \
307 kernel-module-crypto_algapi \
308 kernel-module-cryptomgr \
309 kernel-module-michael-mic \
310 kernel-module-aes-generic \
311 kernel-module-aes"
312
313SUMMARY_packagegroup-base-nfc = "Near Field Communication support"
314RDEPENDS_packagegroup-base-nfc = "\
315 neard"
316
317RRECOMMENDS_packagegroup-base-nfc = "\
318 kernel-module-nfc"
319
320SUMMARY_packagegroup-base-3g = "Cellular data support"
321RDEPENDS_packagegroup-base-3g = "\
322 ofono"
323
324RRECOMMENDS_packagegroup-base-3g = "\
325 kernel-module-cdc-acm \
326 kernel-module-cdc-wdm"
327
328SUMMARY_packagegroup-base-smbfs = "SMB network filesystem support"
329RRECOMMENDS_packagegroup-base-smbfs = "\
330 kernel-module-cifs \
331 kernel-module-smbfs"
332
333SUMMARY_packagegroup-base-cramfs = "cramfs filesystem support"
334RRECOMMENDS_packagegroup-base-cramfs = "\
335 kernel-module-cramfs"
336
337#
338# packagegroup-base-nfs provides ONLY client support - server is in nfs-utils package
339#
340SUMMARY_packagegroup-base-nfs = "NFS network filesystem support"
341RDEPENDS_packagegroup-base-nfs = "\
342 rpcbind"
343
344RRECOMMENDS_packagegroup-base-nfs = "\
345 kernel-module-nfs "
346
347SUMMARY_packagegroup-base-zeroconf = "Zeroconf support"
348RDEPENDS_packagegroup-base-zeroconf = "\
349 libnss-mdns \
350 avahi-daemon"
351
352SUMMARY_packagegroup-base-ipv6 = "IPv6 support"
353RDEPENDS_packagegroup-base-ipv6 = "\
354 "
355
356RRECOMMENDS_packagegroup-base-ipv6 = "\
357 kernel-module-ipv6 "
358
359SUMMARY_packagegroup-base-serial = "Serial port support"
360RDEPENDS_packagegroup-base-serial = "\
361 setserial \
362 lrzsz "
363
364SUMMARY_packagegroup-base-phone = "Cellular telephony (voice) support"
365RDEPENDS_packagegroup-base-phone = "\
366 ofono"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
new file mode 100644
index 0000000000..09f537372e
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -0,0 +1,47 @@
1#
2# Copyright (C) 2007 OpenedHand Ltd.
3#
4
5SUMMARY = "Minimal boot requirements"
6DESCRIPTION = "The minimal set of packages required to boot the system"
7LICENSE = "MIT"
8PR = "r17"
9
10PACKAGE_ARCH = "${MACHINE_ARCH}"
11
12inherit packagegroup
13
14#
15# Set by the machine configuration with packages essential for device bootup
16#
17MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
18MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
19
20# Distro can override the following VIRTUAL-RUNTIME providers:
21VIRTUAL-RUNTIME_dev_manager ?= "udev"
22VIRTUAL-RUNTIME_login_manager ?= "busybox"
23VIRTUAL-RUNTIME_init_manager ?= "sysvinit"
24VIRTUAL-RUNTIME_initscripts ?= "initscripts"
25VIRTUAL-RUNTIME_keymaps ?= "keymaps"
26
27SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', 'busybox-hwclock', '', d)} \
28 modutils-initscripts \
29 init-ifupdown \
30 ${VIRTUAL-RUNTIME_initscripts} \
31 "
32
33RDEPENDS_${PN} = "\
34 base-files \
35 base-passwd \
36 busybox \
37 ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
38 ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
39 netbase \
40 ${VIRTUAL-RUNTIME_login_manager} \
41 ${VIRTUAL-RUNTIME_init_manager} \
42 ${VIRTUAL-RUNTIME_dev_manager} \
43 ${VIRTUAL-RUNTIME_update-alternatives} \
44 ${MACHINE_ESSENTIAL_EXTRA_RDEPENDS}"
45
46RRECOMMENDS_${PN} = "\
47 ${MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS}"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
new file mode 100644
index 0000000000..74ed247512
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-buildessential.bb
@@ -0,0 +1,29 @@
1#
2# Copyright (C) 2007 OpenedHand Ltd.
3# Copyright (C) 2012 Red Hat, Inc.
4#
5
6SUMMARY = "Essential build dependencies"
7LICENSE = "MIT"
8
9inherit packagegroup
10
11RDEPENDS_packagegroup-core-buildessential = "\
12 autoconf \
13 automake \
14 binutils \
15 binutils-symlinks \
16 cpp \
17 cpp-symlinks \
18 gcc \
19 gcc-symlinks \
20 g++ \
21 g++-symlinks \
22 gettext \
23 make \
24 libstdc++ \
25 libstdc++-dev \
26 libtool \
27 pkgconfig \
28 "
29
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb b/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb
new file mode 100644
index 0000000000..e7b013d406
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-eclipse-debug.bb
@@ -0,0 +1,10 @@
1SUMMARY = "Remote debugging tools for Eclipse integration"
2LICENSE = "MIT"
3
4inherit packagegroup
5
6RDEPENDS_${PN} = "\
7 gdbserver \
8 tcf-agent \
9 openssh-sftp-server \
10 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
new file mode 100644
index 0000000000..247a30e063
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-nfs.bb
@@ -0,0 +1,17 @@
1#
2# Copyright (C) 2008 OpenedHand Ltd.
3#
4
5SUMMARY = "NFS package groups"
6LICENSE = "MIT"
7PR = "r2"
8
9inherit packagegroup
10
11PACKAGES = "${PN}-server"
12
13SUMMARY_${PN}-server = "NFS server"
14RDEPENDS_${PN}-server = "\
15 nfs-utils \
16 nfs-utils-client \
17 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
new file mode 100644
index 0000000000..c066845e07
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-sdk.bb
@@ -0,0 +1,80 @@
1#
2# Copyright (C) 2007 OpenedHand Ltd.
3#
4
5SUMMARY = "Software development tools"
6LICENSE = "MIT"
7PR = "r9"
8
9inherit packagegroup
10
11#PACKAGEFUNCS =+ 'generate_sdk_pkgs'
12
13RDEPENDS_packagegroup-core-sdk = "\
14 packagegroup-core-buildessential \
15 coreutils \
16 ccache \
17 diffutils \
18 intltool \
19 perl-module-re \
20 perl-module-text-wrap \
21 findutils \
22 quilt \
23 less \
24 distcc \
25 ldd \
26 file \
27 tcl"
28
29SANITIZERS = "libasan-dev libubsan-dev"
30SANITIZERS_aarch64 = ""
31SANITIZERS_mips = ""
32SANITIZERS_mips64 = ""
33SANITIZERS_mips64n32 = ""
34SANITIZERS_powerpc64 = ""
35SANITIZERS_sparc = ""
36
37RRECOMMENDS_packagegroup-core-sdk = "\
38 libgomp \
39 libgomp-dev"
40
41#python generate_sdk_pkgs () {
42# poky_pkgs = read_pkgdata('packagegroup-core', d)['PACKAGES']
43# pkgs = d.getVar('PACKAGES', True).split()
44# for pkg in poky_pkgs.split():
45# newpkg = pkg.replace('packagegroup-core', 'packagegroup-core-sdk')
46#
47# # for each of the task packages, add a corresponding sdk task
48# pkgs.append(newpkg)
49#
50# # for each sdk task, take the rdepends of the non-sdk task, and turn
51# # that into rrecommends upon the -dev versions of those, not unlike
52# # the package depchain code
53# spkgdata = read_subpkgdata(pkg, d)
54#
55# rdepends = explode_deps(spkgdata.get('RDEPENDS_%s' % pkg) or '')
56# rreclist = []
57#
58# for depend in rdepends:
59# split_depend = depend.split(' (')
60# name = split_depend[0].strip()
61# if packaged('%s-dev' % name, d):
62# rreclist.append('%s-dev' % name)
63# else:
64# deppkgdata = read_subpkgdata(name, d)
65# rdepends2 = explode_deps(deppkgdata.get('RDEPENDS_%s' % name) or '')
66# for depend in rdepends2:
67# split_depend = depend.split(' (')
68# name = split_depend[0].strip()
69# if packaged('%s-dev' % name, d):
70# rreclist.append('%s-dev' % name)
71#
72# oldrrec = d.getVar('RRECOMMENDS_%s' % newpkg) or ''
73# d.setVar('RRECOMMENDS_%s' % newpkg, oldrrec + ' ' + ' '.join(rreclist))
74# # bb.note('RRECOMMENDS_%s = "%s"' % (newpkg, d.getVar('RRECOMMENDS_%s' % newpkg)))
75#
76# # bb.note('pkgs is %s' % pkgs)
77# d.setVar('PACKAGES', ' '.join(pkgs))
78#}
79#
80#PACKAGES_DYNAMIC += "^packagegroup-core-sdk-.*"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
new file mode 100644
index 0000000000..e99946f0a7
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-dropbear.bb
@@ -0,0 +1,7 @@
1SUMMARY = "Dropbear SSH client/server"
2LICENSE = "MIT"
3PR = "r1"
4
5inherit packagegroup
6
7RDEPENDS_${PN} = "dropbear"
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
new file mode 100644
index 0000000000..32d20e6214
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-ssh-openssh.bb
@@ -0,0 +1,7 @@
1SUMMARY = "OpenSSH SSH client/server"
2LICENSE = "MIT"
3PR = "r1"
4
5inherit packagegroup
6
7RDEPENDS_${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
new file mode 100644
index 0000000000..154a55cea2
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb
@@ -0,0 +1,15 @@
1SUMMARY = "Target packages for the standalone SDK"
2PR = "r8"
3LICENSE = "MIT"
4
5inherit packagegroup
6
7RDEPENDS_${PN} = "\
8 libgcc \
9 libgcc-dev \
10 libgcov-dev \
11 libstdc++ \
12 libstdc++-dev \
13 ${LIBC_DEPENDENCIES} \
14 qemuwrapper-cross \
15 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
new file mode 100644
index 0000000000..82347b975d
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-debug.bb
@@ -0,0 +1,20 @@
1#
2# Copyright (C) 2008 OpenedHand Ltd.
3#
4
5SUMMARY = "Debugging tools"
6LICENSE = "MIT"
7
8inherit packagegroup
9
10PR = "r3"
11
12MTRACE = ""
13MTRACE_libc-glibc = "libc-mtrace"
14
15RDEPENDS_${PN} = "\
16 gdb \
17 gdbserver \
18 strace \
19 ${MTRACE} \
20 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
new file mode 100644
index 0000000000..09e776c30b
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb
@@ -0,0 +1,84 @@
1#
2# Copyright (C) 2008 OpenedHand Ltd.
3#
4
5SUMMARY = "Profiling tools"
6LICENSE = "MIT"
7
8PR = "r3"
9
10PACKAGE_ARCH = "${MACHINE_ARCH}"
11
12inherit packagegroup
13
14PROFILE_TOOLS_X = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'sysprof', '', d)}"
15PROFILE_TOOLS_X_aarch64 = ""
16PROFILE_TOOLS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-analyze', '', d)}"
17
18RRECOMMENDS_${PN} = "\
19 perf \
20 trace-cmd \
21 kernel-module-oprofile \
22 blktrace \
23 ${PROFILE_TOOLS_X} \
24 ${PROFILE_TOOLS_SYSTEMD} \
25 "
26
27LATENCYTOP = "latencytop"
28LATENCYTOP_aarch64 = ""
29
30PROFILETOOLS = "\
31 oprofile \
32 oprofileui-server \
33 powertop \
34 ${LATENCYTOP} \
35 "
36
37# systemtap needs elfutils which is not fully buildable on uclibc
38# hence we exclude it from uclibc based builds
39SYSTEMTAP = "systemtap"
40SYSTEMTAP_libc-uclibc = ""
41SYSTEMTAP_mips = ""
42SYSTEMTAP_mips64 = ""
43SYSTEMTAP_mips64n32 = ""
44SYSTEMTAP_aarch64 = ""
45
46# lttng-ust uses sched_getcpu() which is not there on uclibc
47# for some of the architectures it can be patched to call the
48# syscall directly but for x86_64 __NR_getcpu is a vsyscall
49# which means we can not use syscall() to call it. So we ignore
50# it for x86_64/uclibc
51
52LTTNGUST = "lttng-ust"
53LTTNGUST_libc-uclibc = ""
54
55LTTNGTOOLS = "lttng-tools"
56
57LTTNGMODULES = "lttng-modules"
58LTTNGMODULES_aarch64 = ""
59LTTNGMODULES_arm = ""
60
61BABELTRACE = "babeltrace"
62
63# valgrind does not work on mips
64
65VALGRIND = "valgrind"
66VALGRIND_libc-uclibc = ""
67VALGRIND_mips = ""
68VALGRIND_mips64 = ""
69VALGRIND_mips64n32 = ""
70VALGRIND_arm = ""
71VALGRIND_aarch64 = ""
72
73# exmap-console
74# exmap-server
75
76RDEPENDS_${PN} = "\
77 ${PROFILETOOLS} \
78 ${LTTNGUST} \
79 ${LTTNGTOOLS} \
80 ${LTTNGMODULES} \
81 ${BABELTRACE} \
82 ${SYSTEMTAP} \
83 ${VALGRIND} \
84 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
new file mode 100644
index 0000000000..33a3eee258
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb
@@ -0,0 +1,58 @@
1#
2# Copyright (C) 2008 OpenedHand Ltd.
3#
4
5SUMMARY = "Testing tools/applications"
6LICENSE = "MIT"
7
8PR = "r2"
9
10PACKAGE_ARCH = "${MACHINE_ARCH}"
11
12inherit packagegroup
13
14# kexec-tools doesn't work on Mips
15KEXECTOOLS ?= "kexec"
16KEXECTOOLS_mips ?= ""
17KEXECTOOLS_mipsel ?= ""
18KEXECTOOLS_powerpc ?= ""
19KEXECTOOLS_e5500-64b ?= ""
20KEXECTOOLS_aarch64 ?= ""
21
22X11GLTOOLS = "\
23 mesa-demos \
24 piglit \
25 "
26
273GTOOLS = "\
28 ofono-tests \
29 "
30
31X11TOOLS = "\
32 fstests \
33 owl-video \
34 x11perf \
35 xrestop \
36 xwininfo \
37 xprop \
38 xvideo-tests \
39 "
40
41RDEPENDS_${PN} = "\
42 blktool \
43 tslib-calibrate \
44 tslib-tests \
45 lrzsz \
46 ${KEXECTOOLS} \
47 alsa-utils-amixer \
48 alsa-utils-aplay \
49 gst-meta-video \
50 gst-meta-audio \
51 ltp \
52 connman-tools \
53 connman-tests \
54 connman-client \
55 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', "${X11TOOLS}", "", d)} \
56 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', "${X11GLTOOLS}", "", d)} \
57 ${@bb.utils.contains('DISTRO_FEATURES', '3g', "${3GTOOLS}", "", d)} \
58 "
diff --git a/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb b/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb
new file mode 100644
index 0000000000..e3b1c18fa9
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-cross-canadian.bb
@@ -0,0 +1,18 @@
1SUMMARY = "Host SDK package for cross canadian toolchain"
2PN = "packagegroup-cross-canadian-${MACHINE}"
3LICENSE = "MIT"
4
5# Save TRANSLATED_TARGET_ARCH before allarch tramples it
6TRANSLATED_TARGET_ARCH = "${@d.getVar('TUNE_ARCH', True).replace('_', '-')}"
7
8inherit cross-canadian packagegroup
9
10PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
11
12RDEPENDS_${PN} = "\
13 binutils-cross-canadian-${@' binutils-cross-canadian-'.join(all_multilib_tune_values(d,'TRANSLATED_TARGET_ARCH').split())} \
14 gdb-cross-canadian-${@' gdb-cross-canadian-'.join(all_multilib_tune_values(d, 'TRANSLATED_TARGET_ARCH').split())} \
15 gcc-cross-canadian-${@' gcc-cross-canadian-'.join(all_multilib_tune_values(d, 'TRANSLATED_TARGET_ARCH').split())} \
16 meta-environment-${MACHINE} \
17 "
18
diff --git a/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
new file mode 100644
index 0000000000..c4710205ba
--- /dev/null
+++ b/meta/recipes-core/packagegroups/packagegroup-self-hosted.bb
@@ -0,0 +1,205 @@
1#
2# Copyright (C) 2010 Intel Corporation
3#
4
5SUMMARY = "Self-hosting"
6DESCRIPTION = "Packages required to run the build system"
7PR = "r13"
8LICENSE = "MIT"
9
10inherit packagegroup
11
12PACKAGES = "\
13 packagegroup-self-hosted \
14 packagegroup-self-hosted-debug \
15 packagegroup-self-hosted-sdk \
16 packagegroup-self-hosted-extended \
17 packagegroup-self-hosted-graphics \
18 packagegroup-self-hosted-host-tools \
19 "
20
21RDEPENDS_packagegroup-self-hosted = "\
22 packagegroup-self-hosted-debug \
23 packagegroup-self-hosted-sdk \
24 packagegroup-self-hosted-extended \
25 packagegroup-self-hosted-graphics \
26 packagegroup-self-hosted-host-tools \
27 "
28
29# midori depends on webkit-gtk which could not build for mips64
30MIDORI = "midori"
31MIDORI_mips64 = ""
32MIDORI_mips64n32 = ""
33
34RDEPENDS_packagegroup-self-hosted-host-tools = "\
35 connman \
36 connman-plugin-ethernet \
37 dhcp-client \
38 e2fsprogs \
39 e2fsprogs-e2fsck \
40 e2fsprogs-mke2fs \
41 e2fsprogs-tune2fs \
42 hdparm \
43 iptables \
44 lsb \
45 mc \
46 mc-fish \
47 mc-helpers \
48 mc-helpers-perl \
49 mc-helpers-python \
50 parted \
51 pseudo \
52 screen \
53 "
54
55RRECOMMENDS_packagegroup-self-hosted-host-tools = "\
56 kernel-module-tun \
57 kernel-module-iptable-raw \
58 kernel-module-iptable-nat \
59 kernel-module-iptable-mangle \
60 kernel-module-iptable-filter \
61 "
62
63# glibc-utils: for rpcgen
64RDEPENDS_packagegroup-self-hosted-sdk = "\
65 autoconf \
66 automake \
67 binutils \
68 binutils-symlinks \
69 ccache \
70 coreutils \
71 cpp \
72 cpp-symlinks \
73 distcc \
74 glibc-utils \
75 glibc-gconv-ibm850 \
76 file \
77 findutils \
78 g++ \
79 g++-symlinks \
80 gcc \
81 gcc-symlinks \
82 intltool \
83 ldd \
84 less \
85 libssp \
86 libssp-dev \
87 libssp-staticdev \
88 libstdc++ \
89 libstdc++-dev \
90 libtool \
91 make \
92 mktemp \
93 perl-module-re \
94 perl-module-text-wrap \
95 pkgconfig \
96 quilt \
97 sed \
98 "
99
100RDEPENDS_packagegroup-self-hosted-debug = " \
101 gdb \
102 gdbserver \
103 rsync \
104 strace \
105 tcf-agent"
106
107
108RDEPENDS_packagegroup-self-hosted-extended = "\
109 bzip2 \
110 chkconfig \
111 chrpath \
112 cpio \
113 curl \
114 diffstat \
115 diffutils \
116 elfutils \
117 expat \
118 gamin \
119 gawk \
120 gdbm \
121 gettext \
122 gettext-runtime \
123 git \
124 git-perltools \
125 grep \
126 groff \
127 gzip \
128 settings-daemon \
129 hicolor-icon-theme \
130 sato-icon-theme \
131 libaio \
132 libusb1 \
133 libxml2 \
134 lrzsz \
135 lsof \
136 lzo \
137 man \
138 man-pages \
139 mdadm \
140 minicom \
141 mtools \
142 ncurses \
143 ncurses-terminfo-base \
144 neon \
145 nfs-utils \
146 nfs-utils-client \
147 openssl \
148 openssh-sftp-server \
149 opkg \
150 opkg-utils \
151 patch \
152 perl \
153 perl-dev \
154 perl-modules \
155 perl-pod \
156 ${PTH} \
157 python \
158 python-compiler \
159 python-git \
160 python-misc \
161 python-modules \
162 python-rpm \
163 quota \
164 readline \
165 rpm \
166 setserial \
167 socat \
168 subversion \
169 sudo \
170 sysstat \
171 tar \
172 tcl \
173 texi2html \
174 texinfo \
175 unzip \
176 usbutils \
177 watchdog \
178 wget \
179 which \
180 xinetd \
181 zip \
182 zlib \
183 xz \
184 "
185
186
187RDEPENDS_packagegroup-self-hosted-graphics = "\
188 builder \
189 libgl \
190 libgl-dev \
191 libglu \
192 libglu-dev \
193 libsdl \
194 libsdl-dev \
195 libx11-dev \
196 python-pygtk \
197 gtk-theme-clearlooks \
198 xdg-utils \
199 ${MIDORI} \
200 leafpad \
201 pcmanfm \
202 vte \
203 "
204PTH = "pth"
205PTH_libc-uclibc = ""
diff --git a/meta/recipes-core/psplash/files/psplash-init b/meta/recipes-core/psplash/files/psplash-init
new file mode 100755
index 0000000000..66c85e9335
--- /dev/null
+++ b/meta/recipes-core/psplash/files/psplash-init
@@ -0,0 +1,29 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: psplash
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8### END INIT INFO
9
10read CMDLINE < /proc/cmdline
11for x in $CMDLINE; do
12 case $x in
13 psplash=false)
14 echo "Boot splashscreen disabled"
15 exit 0;
16 ;;
17 esac
18done
19
20export TMPDIR=/mnt/.psplash
21mount tmpfs -t tmpfs $TMPDIR -o,size=40k
22
23rotation=0
24if [ -e /etc/rotation ]; then
25 read rotation < /etc/rotation
26fi
27
28/usr/bin/psplash --angle $rotation &
29
diff --git a/meta/recipes-core/psplash/files/psplash-poky-img.h b/meta/recipes-core/psplash/files/psplash-poky-img.h
new file mode 100644
index 0000000000..8d56aa0201
--- /dev/null
+++ b/meta/recipes-core/psplash/files/psplash-poky-img.h
@@ -0,0 +1,1259 @@
1/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */
2
3#define POKY_IMG_ROWSTRIDE (1920)
4#define POKY_IMG_WIDTH (640)
5#define POKY_IMG_HEIGHT (480)
6#define POKY_IMG_BYTES_PER_PIXEL (3) /* 3:RGB, 4:RGBA */
7#define POKY_IMG_RLE_PIXEL_DATA ((uint8*) \
8 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
9 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
10 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
11 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
12 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
13 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
14 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
15 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
16 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
17 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
18 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
19 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
20 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
21 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
22 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
23 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
24 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
25 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
26 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
27 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
28 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
29 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
30 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
31 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
32 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
33 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
34 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
35 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
36 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
37 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
38 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
39 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
40 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
41 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
42 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
43 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
44 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
45 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
46 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
47 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
48 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
49 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
50 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
51 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
52 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
53 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
54 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
55 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
56 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
57 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
58 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
59 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
60 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
61 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
62 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
63 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
64 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
65 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
66 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
67 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
68 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
69 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
70 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
71 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
72 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
73 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
74 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
75 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
76 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
77 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
78 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
79 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
80 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
81 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
82 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
83 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
84 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
85 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
86 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
87 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
88 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
89 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
90 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
91 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
92 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
93 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
94 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
95 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
96 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
97 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
98 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
99 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
100 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
101 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
102 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
103 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
104 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
105 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
106 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
107 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
108 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
109 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
110 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
111 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
112 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
113 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
114 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
115 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
116 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
117 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
118 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
119 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
120 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
121 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
122 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
123 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
124 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
125 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
126 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
127 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
128 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
129 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
130 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
131 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
132 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
133 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
134 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
135 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
136 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
137 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
138 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
139 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
140 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
141 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
142 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
143 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
144 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
145 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
146 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
147 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
148 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
149 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
150 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
151 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
152 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
153 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
154 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
155 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
156 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
157 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
158 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
159 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
160 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
161 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
162 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
163 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
164 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
165 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
166 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
167 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
168 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
169 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
170 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
171 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
172 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
173 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
174 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
175 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
176 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
177 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
178 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
179 "\237\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377" \
180 "\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376" \
181 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
182 "\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377" \
183 "\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377" \
184 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376" \
185 "\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
186 "\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377" \
187 "\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361" \
188 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
189 "\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377" \
190 "\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374" \
191 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377" \
192 "\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377" \
193 "\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377" \
194 "\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374" \
195 "\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
196 "\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377" \
197 "\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377" \
198 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
199 "\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377" \
200 "\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377" \
201 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377" \
202 "\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
203 "\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377" \
204 "\377\377\377\377\377\377\377\223\377\377\377\363\376\377\374\3\373\375" \
205 "\372\360\366\370\353\360\363\202\347\355\357\5\346\354\356\347\355\357" \
206 "\351\356\360\360\366\370\371\373\370\363\376\377\374\377\377\377\377" \
207 "\377\377\377\377\377\377\377\377\223\377\377\377\353\376\377\374\10\356" \
208 "\363\366\324\331\333\277\304\306\252\262\272\227\237\247}\220\233p\203" \
209 "\216ew\202\212]oz\10dv\201n\201\214~\215\223\216\236\244\247\257\267" \
210 "\274\301\303\320\326\330\352\357\362\353\376\377\374\377\377\377\377" \
211 "\377\377\377\377\377\377\377\377\223\377\377\377\346\376\377\374\5\366" \
212 "\370\364\320\326\330\255\265\275\210\227\235j}\210\232]oz\5gy\204\204" \
213 "\223\231\250\260\270\314\321\324\355\362\365\346\376\377\374\377\377" \
214 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\342\376\377" \
215 "\374\5\373\375\372\327\334\337\253\263\273x\213\227^p{\243]oz\4q\204" \
216 "\217\242\252\262\320\326\330\365\372\375\342\376\377\374\377\377\377" \
217 "\377\377\377\377\377\377\377\377\377\223\377\377\377\337\376\377\374" \
218 "\4\371\373\370\317\324\327\225\245\253ew\202\252]oz\4bt\177\211\230\236" \
219 "\306\314\316\367\371\366\337\376\377\374\377\377\377\377\377\377\377" \
220 "\377\377\377\377\377\223\377\377\377\335\376\377\374\3\333\340\343\236" \
221 "\246\256fx\203\260]oz\3bt\177\225\235\245\320\326\330\335\376\377\374" \
222 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\332" \
223 "\376\377\374\3\367\371\366\276\303\305u\210\224\266]oz\3m\200\213\257" \
224 "\267\277\355\362\365\332\376\377\374\377\377\377\377\377\377\377\377" \
225 "\377\377\377\377\223\377\377\377\330\376\377\374\3\353\360\363\252\262" \
226 "\272fx\203\272]oz\3as~\230\250\256\342\347\352\330\376\377\374\377\377" \
227 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\326\376\377" \
228 "\374\3\352\357\362\236\246\256as~\276]oz\3^p{\216\236\244\341\346\351" \
229 "\326\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
230 "\377\377\377\324\376\377\374\3\354\361\364\246\256\266as~\302]oz\3^p" \
231 "{\227\237\247\346\354\356\324\376\377\374\377\377\377\377\377\377\377" \
232 "\377\377\377\377\377\223\377\377\377\322\376\377\374\3\372\374\371\265" \
233 "\276\306fx\203\306]oz\3as~\250\260\270\362\367\371\322\376\377\374\377" \
234 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\321\376" \
235 "\377\374\2\320\326\330p\203\216\312]oz\2hz\205\302\307\312\321\376\377" \
236 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
237 "\317\376\377\374\2\356\363\366\231\241\251\316]oz\2\204\223\231\345\352" \
238 "\355\317\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
239 "\223\377\377\377\316\376\377\374\2\311\316\321i{\206\320]oz\2bt\177\264" \
240 "\274\305\316\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
241 "\377\223\377\377\377\314\376\377\374\2\362\367\371\226\246\254\324]o" \
242 "z\2\206\225\233\353\360\363\314\376\377\374\377\377\377\377\377\377\377" \
243 "\377\377\377\377\377\223\377\377\377\313\376\377\374\2\334\342\344o\202" \
244 "\215\326]oz\2gy\204\315\322\325\313\376\377\374\377\377\377\377\377\377" \
245 "\377\377\377\377\377\377\223\377\377\377\312\376\377\374\2\302\307\312" \
246 "as~\330]oz\3^p{\254\264\274\373\375\372\311\376\377\374\377\377\377\377" \
247 "\377\377\377\377\377\377\377\377\223\377\377\377\310\376\377\374\2\372" \
248 "\374\371\236\246\256\334]oz\2\210\227\235\360\366\370\310\376\377\374" \
249 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\307" \
250 "\376\377\374\2\360\366\370\205\224\232\336]oz\2s\206\221\347\355\357" \
251 "\307\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
252 "\377\377\377\306\376\377\374\2\347\355\357t\207\222\340]oz\2i{\206\333" \
253 "\340\343\306\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
254 "\377\223\377\377\377\305\376\377\374\2\343\350\353j}\210\251]oz\7bt\177" \
255 "w\212\226\215\234\243\236\246\256\246\256\266\254\264\274\264\274\305" \
256 "\202\300\305\310\7\264\274\305\255\265\275\250\260\270\233\252\261\222" \
257 "\241\247~\215\223ew\202\251]oz\2cu\200\322\330\332\305\376\377\374\377" \
258 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\304\376" \
259 "\377\374\2\337\344\346i{\206\245]oz\5j}\210\230\240\250\270\300\311\322" \
260 "\330\332\351\356\360\220\376\377\374\5\354\361\364\326\333\335\300\305" \
261 "\310\236\246\256p\203\216\245]oz\2as~\316\323\326\304\376\377\374\377" \
262 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\303\376" \
263 "\377\374\2\335\343\345gy\204\242]oz\4ew\202\222\241\247\276\303\305\342" \
264 "\347\352\232\376\377\374\4\352\357\362\304\311\314\233\243\253j}\210" \
265 "\242]oz\2as~\313\320\322\303\376\377\374\377\377\377\377\377\377\377" \
266 "\377\377\377\377\377\223\377\377\377\302\376\377\374\2\341\346\351hz" \
267 "\205\240]oz\4_q|\211\230\236\307\315\317\370\372\367\240\376\377\374" \
268 "\4\373\375\372\320\326\330\231\241\251bt\177\240]oz\2as~\317\324\327" \
269 "\302\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
270 "\377\377\377\301\376\377\374\2\343\350\353i{\206\237]oz\3q\204\217\266" \
271 "\277\307\354\361\364\246\376\377\374\3\366\370\364\303\310\313\177\216" \
272 "\224\237]oz\2bt\177\325\332\334\301\376\377\374\377\377\377\377\377\377" \
273 "\377\377\377\377\377\377\223\377\377\377\300\376\377\374\2\355\362\365" \
274 "l\177\212\236]oz\3u\210\224\307\315\317\373\375\372\253\376\377\374\2" \
275 "\324\331\333\204\223\231\236]oz\2ew\202\341\346\351\300\376\377\374\377" \
276 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\277\376" \
277 "\377\374\2\365\372\375\177\216\224\235]oz\2~\215\223\315\322\325\260" \
278 "\376\377\374\2\331\336\341\211\230\236\235]oz\2l\177\212\353\360\363" \
279 "\277\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
280 "\377\377\377\277\376\377\374\1\214\233\242\234]oz\2i{\206\305\312\315" \
281 "\264\376\377\374\2\324\331\333q\204\217\234]oz\2u\210\224\367\371\366" \
282 "\276\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
283 "\377\377\377\276\376\377\374\1\257\267\277\233]oz\3^p{\242\252\262\362" \
284 "\367\371\266\376\377\374\3\372\374\371\261\271\302bt\177\233]oz\1\225" \
285 "\235\245\276\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
286 "\377\223\377\377\377\275\376\377\374\2\317\324\327^p{\232]oz\2w\212\226" \
287 "\335\343\345\272\376\377\374\2\351\356\360\211\230\236\233]oz\1\264\274" \
288 "\305\275\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
289 "\223\377\377\377\274\376\377\374\2\347\355\357ew\202\232]oz\2\242\252" \
290 "\262\371\373\370\225\376\377\374\10\336\367\374\262\355\370\220\343\361" \
291 "m\332\361G\317\353,\311\352(\307\350#\304\346\202\0\301\350\10\0\304" \
292 "\352(\307\350,\311\352B\314\347i\326\356\207\341\364\260\353\366\333" \
293 "\364\371\226\376\377\374\2\266\277\307as~\231]oz\2_q|\327\334\337\274" \
294 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
295 "\377\377\273\376\377\374\2\373\375\372}\220\233\231]oz\2ew\202\313\320" \
296 "\322\223\376\377\374\4\334\365\372\233\345\364M\323\357\0\304\352\222" \
297 "\25\274\344\4\0\301\350J\321\355\211\342\365\314\361\372\223\376\377" \
298 "\374\2\332\337\342m\200\213\231]oz\2l\177\212\360\366\370\273\376\377" \
299 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
300 "\273\376\377\374\1\257\267\277\231]oz\2x\213\227\347\355\357\221\376" \
301 "\377\374\3\336\367\374\206\340\363*\310\351\232\25\274\344\3#\304\346" \
302 "w\333\356\316\363\374\221\376\377\374\2\360\366\370\214\233\242\231]" \
303 "oz\1\227\237\247\273\376\377\374\377\377\377\377\377\377\377\377\377" \
304 "\377\377\377\223\377\377\377\272\376\377\374\2\335\343\345_q|\230]oz" \
305 "\2\210\227\235\364\371\374\217\376\377\374\3\370\376\377\256\350\364" \
306 "B\314\347\240\25\274\344\3*\310\351\233\345\364\367\375\377\217\376\377" \
307 "\374\2\373\375\372\242\252\262\231]oz\1\305\312\315\272\376\377\374\377" \
308 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\271\376" \
309 "\377\374\2\372\374\371w\212\226\230]oz\2\231\241\251\372\374\371\216" \
310 "\376\377\374\3\367\375\377\233\345\364(\307\350\244\25\274\344\3\0\302" \
311 "\351\206\340\363\356\373\374\217\376\377\374\1\257\267\277\230]oz\2h" \
312 "z\205\356\363\366\271\376\377\374\377\377\377\377\377\377\377\377\377" \
313 "\377\377\377\223\377\377\377\271\376\377\374\1\257\267\277\230]oz\1\246" \
314 "\256\266\217\376\377\374\2\237\350\367\0\304\352\250\25\274\344\3\0\276" \
315 "\345\207\341\364\370\376\377\216\376\377\374\2\277\304\306_q|\227]oz" \
316 "\1\231\241\251\271\376\377\374\377\377\377\377\377\377\377\377\377\377" \
317 "\377\377\223\377\377\377\270\376\377\374\2\346\354\356bt\177\227]oz\1" \
318 "\251\261\271\216\376\377\374\2\315\362\3731\313\354\254\25\274\344\2" \
319 "(\307\350\262\355\370\216\376\377\374\2\305\312\315^p{\227]oz\1\322\330" \
320 "\332\270\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
321 "\223\377\377\377\270\376\377\374\1\215\234\243\227]oz\1\233\252\261\215" \
322 "\376\377\374\3\367\375\377m\332\361\0\276\345\257\25\274\344\2L\322\356" \
323 "\356\373\374\215\376\377\374\1\274\301\303\227]oz\2t\207\222\373\375" \
324 "\372\267\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
325 "\223\377\377\377\267\376\377\374\1\325\332\334\227]oz\2\214\233\242\373" \
326 "\375\372\214\376\377\374\2\333\364\371,\311\352\262\25\274\344\2\0\304" \
327 "\352\301\356\366\215\376\377\374\1\252\262\272\227]oz\1\274\301\303\267" \
328 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
329 "\377\377\267\376\377\374\1v\211\225\226]oz\2\205\224\232\365\372\375" \
330 "\214\376\377\374\2\236\347\366\0\276\345\264\25\274\344\3\0\276\345\203" \
331 "\334\360\370\376\377\214\376\377\374\1\236\246\256\226]oz\2hz\205\362" \
332 "\367\371\266\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
333 "\377\223\377\377\377\266\376\377\374\1\307\315\317\226]oz\2n\201\214" \
334 "\360\366\370\214\376\377\374\1m\332\361\270\25\274\344\2I\320\354\366" \
335 "\373\376\213\376\377\374\2\373\375\372\203\222\230\226]oz\1\254\264\274" \
336 "\266\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
337 "\377\377\377\265\376\377\374\2\373\375\372s\206\221\225]oz\2as~\333\340" \
338 "\343\213\376\377\374\2\370\376\377M\323\357\272\25\274\344\2""1\313\354" \
339 "\356\373\374\213\376\377\374\2\353\360\363i{\206\225]oz\2ew\202\357\365" \
340 "\367\265\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
341 "\223\377\377\377\265\376\377\374\1\305\312\315\226]oz\1\265\276\306\213" \
342 "\376\377\374\2\366\373\376B\314\347\274\25\274\344\2(\307\350\336\367" \
343 "\374\213\376\377\374\2\322\330\332^p{\225]oz\1\252\262\272\265\376\377" \
344 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
345 "\265\376\377\374\1u\210\224\225]oz\1\214\233\242\213\376\377\374\2\366" \
346 "\373\376B\314\347\276\25\274\344\2#\304\346\337\370\375\213\376\377\374" \
347 "\1\253\263\273\225]oz\2fx\203\367\371\366\264\376\377\374\377\377\377" \
348 "\377\377\377\377\377\377\377\377\377\223\377\377\377\264\376\377\374" \
349 "\1\322\330\332\225]oz\2i{\206\360\366\370\212\376\377\374\2\370\376\377" \
350 "I\320\354\300\25\274\344\2*\310\351\357\374\375\212\376\377\374\2\373" \
351 "\375\372~\215\223\225]oz\1\264\274\305\264\376\377\374\377\377\377\377" \
352 "\377\377\377\377\377\377\377\377\223\377\377\377\264\376\377\374\1\210" \
353 "\227\235\225]oz\1\303\310\313\213\376\377\374\1i\326\356\302\25\274\344" \
354 "\2B\314\347\370\376\377\212\376\377\374\2\335\343\345^p{\224]oz\2m\200" \
355 "\213\373\375\372\263\376\377\374\377\377\377\377\377\377\377\377\377" \
356 "\377\377\377\223\377\377\377\263\376\377\374\2\345\352\355^p{\224]oz" \
357 "\1~\221\235\213\376\377\374\1y\336\360\304\25\274\344\1M\323\357\213" \
358 "\376\377\374\1\242\252\262\225]oz\1\315\322\325\263\376\377\374\377\377" \
359 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\263\376\377" \
360 "\374\1\252\262\272\224]oz\2_q|\341\346\351\212\376\377\374\2\274\355" \
361 "\373\0\276\345\305\25\274\344\1\220\343\361\212\376\377\374\2\360\366" \
362 "\370i{\206\224]oz\1\211\230\236\263\376\377\374\377\377\377\377\377\377" \
363 "\377\377\377\377\377\377\223\377\377\377\262\376\377\374\2\372\374\371" \
364 "i{\206\224]oz\1\250\260\270\212\376\377\374\2\350\371\377\0\304\352\306" \
365 "\25\274\344\2\0\276\345\316\363\374\212\376\377\374\1\303\310\313\224" \
366 "]oz\2^p{\352\357\362\262\376\377\374\377\377\377\377\377\377\377\377" \
367 "\377\377\377\377\223\377\377\377\262\376\377\374\1\315\322\325\224]o" \
368 "z\2dv\201\357\365\367\212\376\377\374\1G\317\353\240\25\274\344\3\0\302" \
369 "\351,\311\352J\321\355\203L\322\356\2B\314\347#\304\346\240\25\274\344" \
370 "\2*\310\351\367\375\377\212\376\377\374\1q\204\217\224]oz\1\257\267\277" \
371 "\262\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
372 "\377\377\377\262\376\377\374\1\230\240\250\224]oz\1\247\257\267\212\376" \
373 "\377\374\1\233\345\364\235\25\274\344\4*\310\351n\333\362\273\354\371" \
374 "\360\375\376\210\376\377\374\4\357\374\375\303\361\370\206\340\363/\312" \
375 "\353\235\25\274\344\1w\333\356\212\376\377\374\1\303\310\313\224]oz\1" \
376 "v\211\225\262\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
377 "\377\223\377\377\377\261\376\377\374\2\365\372\375dv\201\223]oz\2as~" \
378 "\353\360\363\211\376\377\374\2\356\373\374\0\302\351\232\25\274\344\3" \
379 "\0\276\345m\332\361\335\366\373\220\376\377\374\2\336\367\374(\307\350" \
380 "\232\25\274\344\2%\305\347\336\367\374\212\376\377\374\2\372\374\371" \
381 "n\201\214\224]oz\1\343\350\353\261\376\377\374\377\377\377\377\377\377" \
382 "\377\377\377\377\377\377\223\377\377\377\261\376\377\374\1\313\320\322" \
383 "\224]oz\1\233\252\261\212\376\377\374\1k\327\357\231\25\274\344\3\0\276" \
384 "\345\206\340\363\357\374\375\222\376\377\374\1k\327\357\232\25\274\344" \
385 "\2%\305\347\336\367\374\214\376\377\374\1\276\303\305\224]oz\1\257\267" \
386 "\277\261\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
387 "\223\377\377\377\261\376\377\374\1\226\246\254\223]oz\2^p{\347\355\357" \
388 "\211\376\377\374\2\316\363\374\0\276\345\230\25\274\344\2J\321\355\337" \
389 "\370\375\223\376\377\374\1k\327\357\232\25\274\344\2%\305\347\336\367" \
390 "\374\215\376\377\374\2\370\372\367i{\206\223]oz\1\177\216\224\261\376" \
391 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
392 "\377\261\376\377\374\1k~\211\223]oz\1\205\224\232\212\376\377\374\1J" \
393 "\321\355\227\25\274\344\2\0\276\345\257\351\365\224\376\377\374\1m\332" \
394 "\361\232\25\274\344\2%\305\347\336\367\374\217\376\377\374\1\246\256" \
395 "\266\223]oz\2^p{\356\363\366\260\376\377\374\377\377\377\377\377\377" \
396 "\377\377\377\377\377\377\223\377\377\377\260\376\377\374\1\335\343\345" \
397 "\224]oz\1\303\310\313\211\376\377\374\2\333\364\371\0\276\345\226\25" \
398 "\274\344\2#\304\346\316\363\374\224\376\377\374\1m\332\361\232\25\274" \
399 "\344\2%\305\347\336\367\374\220\376\377\374\1\335\343\345\224]oz\1\306" \
400 "\314\316\260\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
401 "\377\223\377\377\377\260\376\377\374\1\264\274\305\223]oz\2cu\200\367" \
402 "\371\366\211\376\377\374\1i\326\356\226\25\274\344\2,\311\352\347\370" \
403 "\376\224\376\377\374\1m\332\361\232\25\274\344\2%\305\347\336\367\374" \
404 "\222\376\377\374\1t\207\222\223]oz\1\236\246\256\260\376\377\374\377" \
405 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\260\376" \
406 "\377\374\1\215\234\243\223]oz\1\231\241\251\211\376\377\374\2\347\370" \
407 "\376\0\276\345\225\25\274\344\2*\310\351\357\374\375\224\376\377\374" \
408 "\1m\332\361\232\25\274\344\2%\305\347\336\367\374\223\376\377\374\1\261" \
409 "\271\302\223]oz\1q\204\217\260\376\377\374\377\377\377\377\377\377\377" \
410 "\377\377\377\377\377\223\377\377\377\260\376\377\374\1i{\206\223]oz\1" \
411 "\317\324\327\211\376\377\374\1\207\341\364\225\25\274\344\2#\304\346" \
412 "\337\370\375\224\376\377\374\1m\332\361\232\25\274\344\2%\305\347\336" \
413 "\367\374\224\376\377\374\1\351\356\360\224]oz\1\356\363\366\257\376\377" \
414 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
415 "\257\376\377\374\1\345\352\355\223]oz\2as~\370\372\367\211\376\377\374" \
416 "\1,\311\352\224\25\274\344\2\0\276\345\313\360\371\224\376\377\374\1" \
417 "m\332\361\232\25\274\344\2%\305\347\336\367\374\226\376\377\374\1q\204" \
418 "\217\223]oz\1\314\321\324\257\376\377\374\377\377\377\377\377\377\377" \
419 "\377\377\377\377\377\223\377\377\377\257\376\377\374\1\311\316\321\223" \
420 "]oz\1\202\221\227\211\376\377\374\1\320\365\376\225\25\274\344\1\207" \
421 "\341\364\224\376\377\374\1m\332\361\232\25\274\344\2%\305\347\336\367" \
422 "\374\214\376\377\374\2\236\347\366\237\350\367\211\376\377\374\1\236" \
423 "\246\256\223]oz\1\255\265\275\257\376\377\374\377\377\377\377\377\377" \
424 "\377\377\377\377\377\377\223\377\377\377\257\376\377\374\1\254\264\274" \
425 "\223]oz\1\255\265\275\211\376\377\374\1y\336\360\224\25\274\344\2/\312" \
426 "\353\370\376\377\223\376\377\374\1m\332\361\232\25\274\344\2%\305\347" \
427 "\336\367\374\214\376\377\374\3\236\347\366\0\276\345J\321\355\211\376" \
428 "\377\374\1\311\316\321\223]oz\1\215\234\243\257\376\377\374\377\377\377" \
429 "\377\377\377\377\377\377\377\377\377\223\377\377\377\257\376\377\374" \
430 "\1\214\233\242\223]oz\1\326\333\335\211\376\377\374\1,\311\352\224\25" \
431 "\274\344\1\312\357\370\223\376\377\374\1n\333\362\232\25\274\344\2%\305" \
432 "\347\336\367\374\214\376\377\374\5\236\347\366\0\276\345\25\274\344\0" \
433 "\276\345\367\375\377\210\376\377\374\2\356\363\366^p{\222]oz\1o\202\215" \
434 "\257\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
435 "\377\377\377\257\376\377\374\1o\202\215\222]oz\2as~\366\373\376\210\376" \
436 "\377\374\2\357\374\375\0\276\345\223\25\274\344\1J\321\355\223\376\377" \
437 "\374\1n\333\362\232\25\274\344\2%\305\347\336\367\374\214\376\377\374" \
438 "\2\236\347\366\0\276\345\203\25\274\344\1\274\355\373\211\376\377\374" \
439 "\1u\210\224\222]oz\2^p{\370\372\367\256\376\377\374\377\377\377\377\377" \
440 "\377\377\377\377\377\377\377\223\377\377\377\256\376\377\374\2\373\375" \
441 "\372_q|\222]oz\1u\210\224\211\376\377\374\1\261\354\367\224\25\274\344" \
442 "\1\312\357\370\222\376\377\374\1n\333\362\232\25\274\344\2%\305\347\336" \
443 "\367\374\214\376\377\374\2\236\347\366\0\276\345\204\25\274\344\1\204" \
444 "\335\361\211\376\377\374\1\230\240\250\223]oz\1\342\347\352\256\376\377" \
445 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
446 "\256\376\377\374\1\351\356\360\223]oz\1\225\235\245\211\376\377\374\1" \
447 "n\333\362\223\25\274\344\1,\311\352\222\376\377\374\1n\333\362\232\25" \
448 "\274\344\2%\305\347\336\367\374\214\376\377\374\2\236\347\366\0\276\345" \
449 "\205\25\274\344\1B\314\347\211\376\377\374\1\257\267\277\223]oz\1\317" \
450 "\324\327\256\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
451 "\377\223\377\377\377\256\376\377\374\1\326\333\335\223]oz\1\253\263\273" \
452 "\211\376\377\374\1B\314\347\223\25\274\344\1\211\342\365\221\376\377" \
453 "\374\1n\333\362\232\25\274\344\2%\305\347\336\367\374\214\376\377\374" \
454 "\2\236\347\366\0\276\345\206\25\274\344\1\0\302\351\211\376\377\374\1" \
455 "\307\315\317\223]oz\1\276\303\305\256\376\377\374\377\377\377\377\377" \
456 "\377\377\377\377\377\377\377\223\377\377\377\256\376\377\374\1\306\314" \
457 "\316\223]oz\1\305\312\315\211\376\377\374\1#\304\346\223\25\274\344\1" \
458 "\337\370\375\220\376\377\374\1w\333\356\232\25\274\344\2%\305\347\336" \
459 "\367\374\214\376\377\374\2\236\347\366\0\276\345\210\25\274\344\1\356" \
460 "\373\374\210\376\377\374\1\337\344\346\223]oz\1\253\263\273\256\376\377" \
461 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
462 "\256\376\377\374\1\274\301\303\223]oz\1\333\340\343\210\376\377\374\2" \
463 "\367\375\377\0\276\345\222\25\274\344\1(\307\350\220\376\377\374\1\231" \
464 "\342\362\232\25\274\344\2%\305\347\336\367\374\214\376\377\374\2\236" \
465 "\347\366\0\276\345\211\25\274\344\1\302\357\367\210\376\377\374\2\364" \
466 "\371\374^p{\222]oz\1\236\246\256\256\376\377\374\377\377\377\377\377" \
467 "\377\377\377\377\377\377\377\223\377\377\377\256\376\377\374\1\257\267" \
468 "\277\223]oz\1\353\360\363\210\376\377\374\1\316\363\374\223\25\274\344" \
469 "\1\\\326\355\217\376\377\374\2\320\365\376\31\275\345\231\25\274\344" \
470 "\2%\305\347\336\367\374\214\376\377\374\2\236\347\366\0\276\345\212\25" \
471 "\274\344\1\237\350\367\211\376\377\374\1gy\204\222]oz\1\216\236\244\256" \
472 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
473 "\377\377\256\376\377\374\1\242\252\262\223]oz\1\366\370\364\210\376\377" \
474 "\374\1\262\355\370\223\25\274\344\1\220\343\361\217\376\377\374\1J\321" \
475 "\355\231\25\274\344\2%\305\347\336\367\374\214\376\377\374\2\236\347" \
476 "\366\0\276\345\213\25\274\344\1\211\342\365\211\376\377\374\1m\200\213" \
477 "\222]oz\1\204\223\231\256\376\377\374\377\377\377\377\377\377\377\377" \
478 "\377\377\377\377\223\377\377\377\256\376\377\374\1\226\246\254\223]o" \
479 "z\211\376\377\374\1\237\350\367\223\25\274\344\1\262\355\370\216\376" \
480 "\377\374\2\350\371\377\0\276\345\230\25\274\344\2%\305\347\336\367\374" \
481 "\214\376\377\374\2\236\347\366\0\276\345\214\25\274\344\1n\333\362\211" \
482 "\376\377\374\1u\210\224\222]oz\1y\214\230\256\376\377\374\377\377\377" \
483 "\377\377\377\377\377\377\377\377\377\223\377\377\377\256\376\377\374" \
484 "\1\231\241\251\222]oz\1cu\200\211\376\377\374\1\233\345\364\223\25\274" \
485 "\344\1\316\363\374\216\376\377\374\1\235\346\365\230\25\274\344\2%\305" \
486 "\347\336\367\374\214\376\377\374\2\236\347\366\0\276\345\215\25\274\344" \
487 "\1k\327\357\211\376\377\374\1\200\217\225\222]oz\1u\210\224\256\376\377" \
488 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
489 "\256\376\377\374\1\222\241\247\222]oz\1j}\210\211\376\377\374\1\220\343" \
490 "\361\223\25\274\344\1\336\367\374\216\376\377\374\1w\333\356\227\25\274" \
491 "\344\2#\304\346\336\367\374\214\376\377\374\2\236\347\366\0\276\345\216" \
492 "\25\274\344\1M\323\357\211\376\377\374\1\210\227\235\222]oz\1s\206\221" \
493 "\256\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
494 "\377\377\377\256\376\377\374\1\211\230\236\222]oz\1n\201\214\211\376" \
495 "\377\374\1\206\340\363\223\25\274\344\1\350\371\377\216\376\377\374\1" \
496 "i\326\356\226\25\274\344\2#\304\346\336\367\374\214\376\377\374\2\236" \
497 "\347\366\0\276\345\217\25\274\344\1M\323\357\211\376\377\374\1\215\234" \
498 "\243\222]oz\1m\200\213\256\376\377\374\377\377\377\377\377\377\377\377" \
499 "\377\377\377\377\223\377\377\377\256\376\377\374\1\222\241\247\222]o" \
500 "z\1l\177\212\211\376\377\374\1\207\341\364\223\25\274\344\1\336\367\374" \
501 "\216\376\377\374\1n\333\362\225\25\274\344\2#\304\346\336\367\374\214" \
502 "\376\377\374\2\235\346\365\0\276\345\220\25\274\344\1M\323\357\211\376" \
503 "\377\374\1\211\230\236\222]oz\1s\206\221\256\376\377\374\377\377\377" \
504 "\377\377\377\377\377\377\377\377\377\223\377\377\377\256\376\377\374" \
505 "\1\231\241\251\222]oz\1ew\202\211\376\377\374\1\231\342\362\223\25\274" \
506 "\344\1\320\365\376\216\376\377\374\1\221\344\362\224\25\274\344\2#\304" \
507 "\346\336\367\374\214\376\377\374\2\235\346\365\0\276\345\221\25\274\344" \
508 "\1i\326\356\211\376\377\374\1\202\221\227\222]oz\1u\210\224\256\376\377" \
509 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
510 "\256\376\377\374\1\242\252\262\222]oz\1^p{\211\376\377\374\1\237\350" \
511 "\367\223\25\274\344\1\301\356\366\216\376\377\374\1\333\364\371\223\25" \
512 "\274\344\2#\304\346\336\367\374\214\376\377\374\2\356\373\374\0\276\345" \
513 "\222\25\274\344\1n\333\362\211\376\377\374\1w\212\226\222]oz\1\202\221" \
514 "\227\256\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
515 "\223\377\377\377\256\376\377\374\1\246\256\266\223]oz\1\370\372\367\210" \
516 "\376\377\374\1\260\353\366\223\25\274\344\1\233\345\364\217\376\377\374" \
517 "\1,\311\352\221\25\274\344\2#\304\346\336\367\374\215\376\377\374\1\312" \
518 "\357\370\223\25\274\344\1\204\335\361\211\376\377\374\1o\202\215\222" \
519 "]oz\1\205\224\232\256\376\377\374\377\377\377\377\377\377\377\377\377" \
520 "\377\377\377\223\377\377\377\256\376\377\374\1\252\262\272\223]oz\1\355" \
521 "\362\365\210\376\377\374\1\314\361\372\223\25\274\344\1m\332\361\217" \
522 "\376\377\374\1\273\354\371\220\25\274\344\2#\304\346\336\367\374\216" \
523 "\376\377\374\1\233\345\364\223\25\274\344\1\236\347\366\211\376\377\374" \
524 "\1i{\206\222]oz\1\211\230\236\256\376\377\374\377\377\377\377\377\377" \
525 "\377\377\377\377\377\377\223\377\377\377\256\376\377\374\1\266\277\307" \
526 "\223]oz\1\340\345\350\210\376\377\374\1\356\373\374\223\25\274\344\1" \
527 ",\311\352\220\376\377\374\1i\326\356\216\25\274\344\2#\304\346\336\367" \
528 "\374\217\376\377\374\1\\\326\355\223\25\274\344\1\274\355\373\210\376" \
529 "\377\374\2\372\374\371_q|\222]oz\1\226\246\254\256\376\377\374\377\377" \
530 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\256\376\377" \
531 "\374\1\307\315\317\223]oz\1\313\320\322\211\376\377\374\1\0\302\351\222" \
532 "\25\274\344\2\0\276\345\357\374\375\217\376\377\374\2\370\376\377G\317" \
533 "\353\214\25\274\344\2(\307\350\336\367\374\220\376\377\374\1%\305\347" \
534 "\223\25\274\344\1\336\367\374\210\376\377\374\1\343\350\353\223]oz\1" \
535 "\254\264\274\256\376\377\374\377\377\377\377\377\377\377\377\377\377" \
536 "\377\377\223\377\377\377\256\376\377\374\1\327\334\337\223]oz\1\257\267" \
537 "\277\211\376\377\374\1B\314\347\223\25\274\344\1\237\350\367\220\376" \
538 "\377\374\3\370\376\377n\333\362\31\275\345\211\25\274\344\2J\321\355" \
539 "\356\373\374\220\376\377\374\1\315\362\373\223\25\274\344\1\0\301\350" \
540 "\211\376\377\374\1\316\323\326\223]oz\1\276\303\305\256\376\377\374\377" \
541 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\256\376" \
542 "\377\374\1\346\354\356\223]oz\1\225\245\253\211\376\377\374\1k\327\357" \
543 "\223\25\274\344\1G\317\353\222\376\377\374\3\320\365\376Z\325\354\0\301" \
544 "\350\204\25\274\344\3\0\276\345G\317\353\274\355\373\222\376\377\374" \
545 "\1w\333\356\223\25\274\344\1""3\314\355\211\376\377\374\1\264\274\305" \
546 "\223]oz\1\315\322\325\256\376\377\374\377\377\377\377\377\377\377\377" \
547 "\377\377\377\377\223\377\377\377\256\376\377\374\1\366\373\376\223]o" \
548 "z\1z\215\231\211\376\377\374\1\237\350\367\223\25\274\344\2\31\275\345" \
549 "\335\366\373\223\376\377\374\2\370\376\377\316\363\374\202\261\354\367" \
550 "\2\313\360\371\366\373\376\223\376\377\374\2\370\376\377\0\302\351\223" \
551 "\25\274\344\1n\333\362\211\376\377\374\1\230\250\256\223]oz\1\334\342" \
552 "\344\256\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
553 "\223\377\377\377\257\376\377\374\1m\200\213\222]oz\1ew\202\211\376\377" \
554 "\374\1\347\370\376\224\25\274\344\1m\332\361\254\376\377\374\1\233\345" \
555 "\364\224\25\274\344\1\261\354\367\211\376\377\374\1}\220\233\223]oz\1" \
556 "\366\370\364\256\376\377\374\377\377\377\377\377\377\377\377\377\377" \
557 "\377\377\223\377\377\377\257\376\377\374\1\211\230\236\223]oz\1\335\343" \
558 "\345\211\376\377\374\1%\305\347\223\25\274\344\2\0\276\345\336\367\374" \
559 "\252\376\377\374\2\367\375\377#\304\346\223\25\274\344\2\31\275\345\357" \
560 "\374\375\210\376\377\374\2\370\372\367as~\222]oz\1m\200\213\257\376\377" \
561 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
562 "\257\376\377\374\1\251\261\271\223]oz\1\264\274\305\211\376\377\374\1" \
563 "k\327\357\224\25\274\344\1L\322\356\252\376\377\374\1\206\340\363\224" \
564 "\25\274\344\1""3\314\355\211\376\377\374\1\322\330\332\223]oz\1\211\230" \
565 "\236\257\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
566 "\223\377\377\377\257\376\377\374\1\305\312\315\223]oz\1\211\230\236\211" \
567 "\376\377\374\1\301\356\366\225\25\274\344\1\262\355\370\250\376\377\374" \
568 "\2\334\365\372\0\276\345\224\25\274\344\1\220\343\361\211\376\377\374" \
569 "\1\252\262\272\223]oz\1\251\261\271\257\376\377\374\377\377\377\377\377" \
570 "\377\377\377\377\377\377\377\223\377\377\377\257\376\377\374\1\337\344" \
571 "\346\223]oz\2ew\202\373\375\372\210\376\377\374\2\370\376\377#\304\346" \
572 "\224\25\274\344\2\0\302\351\347\370\376\246\376\377\374\2\367\375\377" \
573 ",\311\352\224\25\274\344\2\0\276\345\337\370\375\211\376\377\374\1\177" \
574 "\216\224\223]oz\1\305\312\315\257\376\377\374\377\377\377\377\377\377" \
575 "\377\377\377\377\377\377\223\377\377\377\257\376\377\374\2\373\375\372" \
576 "dv\201\223]oz\1\331\336\341\211\376\377\374\1n\333\362\225\25\274\344" \
577 "\2B\314\347\370\376\377\245\376\377\374\1i\326\356\225\25\274\344\1B" \
578 "\314\347\211\376\377\374\2\362\367\371_q|\223]oz\1\346\354\356\257\376" \
579 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
580 "\377\260\376\377\374\1\210\227\235\223]oz\1\246\256\266\211\376\377\374" \
581 "\1\316\363\374\226\25\274\344\2M\323\357\370\376\377\243\376\377\374" \
582 "\1\206\340\363\226\25\274\344\1\256\350\364\211\376\377\374\1\301\306" \
583 "\311\223]oz\1k~\211\260\376\377\374\377\377\377\377\377\377\377\377\377" \
584 "\377\377\377\223\377\377\377\260\376\377\374\1\257\267\277\223]oz\2i" \
585 "{\206\373\375\372\211\376\377\374\1G\317\353\226\25\274\344\2\\\326\355" \
586 "\370\376\377\241\376\377\374\1\220\343\361\226\25\274\344\2\0\304\352" \
587 "\370\376\377\211\376\377\374\1\204\223\231\223]oz\1\230\240\250\260\376" \
588 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
589 "\377\260\376\377\374\1\331\336\341\224]oz\1\317\324\327\211\376\377\374" \
590 "\1\301\356\366\227\25\274\344\2J\321\355\367\375\377\237\376\377\374" \
591 "\1w\333\356\227\25\274\344\1\206\340\363\211\376\377\374\2\351\356\360" \
592 "^p{\223]oz\1\277\304\306\260\376\377\374\377\377\377\377\377\377\377" \
593 "\377\377\377\377\377\223\377\377\377\260\376\377\374\2\372\374\371cu" \
594 "\200\223]oz\1\222\241\247\212\376\377\374\1/\312\353\227\25\274\344\2" \
595 ",\311\352\334\365\372\234\376\377\374\2\356\373\374I\320\354\227\25\274" \
596 "\344\2\0\301\350\366\373\376\211\376\377\374\1\261\271\302\224]oz\1\343" \
597 "\350\353\260\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
598 "\377\223\377\377\377\261\376\377\374\1\216\236\244\223]oz\2cu\200\362" \
599 "\367\371\211\376\377\374\1\261\354\367\230\25\274\344\3\0\276\345\233" \
600 "\345\364\370\376\377\231\376\377\374\2\262\355\370\0\304\352\230\25\274" \
601 "\344\1\206\340\363\212\376\377\374\1s\206\221\223]oz\1q\204\217\261\376" \
602 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
603 "\377\261\376\377\374\1\305\312\315\224]oz\1\257\267\277\212\376\377\374" \
604 "\1B\314\347\231\25\274\344\2""1\313\354\303\361\370\226\376\377\374\2" \
605 "\334\365\372J\321\355\231\25\274\344\2#\304\346\366\373\376\211\376\377" \
606 "\374\1\315\322\325\224]oz\1\251\261\271\261\376\377\374\377\377\377\377" \
607 "\377\377\377\377\377\377\377\377\223\377\377\377\261\376\377\374\2\362" \
608 "\367\371as~\223]oz\2hz\205\370\372\367\211\376\377\374\2\334\365\372" \
609 "\0\276\345\232\25\274\344\3B\314\347\262\355\370\370\376\377\221\376" \
610 "\377\374\3\313\360\371L\322\356\0\276\345\232\25\274\344\1\256\350\364" \
611 "\212\376\377\374\1z\215\231\224]oz\1\333\340\343\261\376\377\374\377" \
612 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\262\376" \
613 "\377\374\1\207\226\234\224]oz\1\270\300\311\212\376\377\374\1w\333\356" \
614 "\234\25\274\344\4\0\304\352m\332\361\273\354\371\366\373\376\212\376" \
615 "\377\374\4\370\376\377\302\357\367y\336\360(\307\350\234\25\274\344\1" \
616 "B\314\347\212\376\377\374\1\324\331\333\224]oz\1k~\211\262\376\377\374" \
617 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\262" \
618 "\376\377\374\1\301\306\311\224]oz\2k~\211\372\374\371\211\376\377\374" \
619 "\2\366\373\376(\307\350\236\25\274\344\5\31\275\345,\311\352M\323\357" \
620 "y\336\360\211\342\365\202\233\345\364\5\220\343\361\204\335\361Z\325" \
621 "\3541\313\354\0\276\345\236\25\274\344\2\0\301\350\336\367\374\212\376" \
622 "\377\374\1\205\224\232\224]oz\1\246\256\266\262\376\377\374\377\377\377" \
623 "\377\377\377\377\377\377\377\377\377\223\377\377\377\262\376\377\374" \
624 "\2\367\371\366dv\201\224]oz\1\274\301\303\212\376\377\374\2\315\362\373" \
625 "\0\276\345\307\25\274\344\1\236\347\366\212\376\377\374\1\325\332\334" \
626 "\225]oz\1\341\346\351\262\376\377\374\377\377\377\377\377\377\377\377" \
627 "\377\377\377\377\223\377\377\377\263\376\377\374\1\236\246\256\224]o" \
628 "z\2fx\203\356\363\366\212\376\377\374\1\221\344\362\306\25\274\344\1" \
629 "M\323\357\212\376\377\374\2\372\374\371t\207\222\224]oz\1\177\216\224" \
630 "\263\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
631 "\377\377\377\263\376\377\374\1\333\340\343\225]oz\1\226\246\254\213\376" \
632 "\377\374\1L\322\356\304\25\274\344\2,\311\352\366\373\376\212\376\377" \
633 "\374\1\265\276\306\225]oz\1\302\307\312\263\376\377\374\377\377\377\377" \
634 "\377\377\377\377\377\377\377\377\223\377\377\377\264\376\377\374\1u\210" \
635 "\224\224]oz\2^p{\331\336\341\212\376\377\374\2\366\373\376/\312\353\302" \
636 "\25\274\344\2\0\302\351\336\367\374\212\376\377\374\2\353\360\363dv\201" \
637 "\224]oz\2dv\201\364\371\374\263\376\377\374\377\377\377\377\377\377\377" \
638 "\377\377\377\377\377\223\377\377\377\264\376\377\374\1\302\307\312\225" \
639 "]oz\2w\212\226\372\374\371\212\376\377\374\2\350\371\377%\305\347\300" \
640 "\25\274\344\2\0\301\350\314\361\372\213\376\377\374\1\227\237\247\225" \
641 "]oz\1\246\256\266\264\376\377\374\377\377\377\377\377\377\377\377\377" \
642 "\377\377\377\223\377\377\377\264\376\377\374\2\372\374\371l\177\212\225" \
643 "]oz\1\252\262\272\213\376\377\374\2\337\370\375\0\304\352\276\25\274" \
644 "\344\2\0\276\345\274\355\373\213\376\377\374\1\305\312\315\225]oz\2a" \
645 "s~\353\360\363\264\376\377\374\377\377\377\377\377\377\377\377\377\377" \
646 "\377\377\223\377\377\377\265\376\377\374\1\270\300\311\225]oz\2^p{\322" \
647 "\330\332\213\376\377\374\2\332\363\370#\304\346\274\25\274\344\2\0\276" \
648 "\345\273\354\371\213\376\377\374\2\343\350\353dv\201\225]oz\1\236\246" \
649 "\256\265\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
650 "\223\377\377\377\265\376\377\374\2\365\372\375hz\205\225]oz\2i{\206\354" \
651 "\361\364\213\376\377\374\2\337\370\375*\310\351\272\25\274\344\2\0\302" \
652 "\351\314\361\372\213\376\377\374\2\371\373\370x\213\227\225]oz\2_q|\346" \
653 "\354\356\265\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
654 "\377\223\377\377\377\266\376\377\374\1\261\271\302\226]oz\2\205\224\232" \
655 "\373\375\372\213\376\377\374\2\356\373\374B\314\347\270\25\274\344\2" \
656 "%\305\347\335\366\373\214\376\377\374\1\242\252\262\226]oz\1\231\241" \
657 "\251\266\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
658 "\223\377\377\377\266\376\377\374\2\370\372\367m\200\213\226]oz\1\242" \
659 "\252\262\214\376\377\374\2\367\375\377i\326\356\266\25\274\344\2B\314" \
660 "\347\350\371\377\214\376\377\374\1\277\304\306\226]oz\2bt\177\351\356" \
661 "\360\266\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
662 "\223\377\377\377\267\376\377\374\1\305\312\315\227]oz\1\261\271\302\215" \
663 "\376\377\374\2\250\347\371\0\301\350\262\25\274\344\3\31\275\345\206" \
664 "\340\363\370\376\377\214\376\377\374\2\316\323\326_q|\226]oz\1\251\261" \
665 "\271\267\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
666 "\223\377\377\377\270\376\377\374\1y\214\230\226]oz\2^p{\301\306\311\215" \
667 "\376\377\374\2\335\366\373/\312\353\260\25\274\344\2#\304\346\312\357" \
668 "\370\215\376\377\374\2\330\335\340cu\200\226]oz\2hz\205\366\370\364\267" \
669 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
670 "\377\377\270\376\377\374\1\332\337\342\230\222\241\247\1\353\360\363" \
671 "\215\376\377\374\3\370\376\377\231\342\362\0\301\350\254\25\274\344\3" \
672 "\0\276\345w\333\356\366\373\376\215\376\377\374\2\365\372\375\236\246" \
673 "\256\227\222\241\247\1\307\315\317\270\376\377\374\377\377\377\377\377" \
674 "\377\377\377\377\377\377\377\223\377\377\377\341\376\377\374\3\356\373" \
675 "\374i\326\356\0\276\345\251\25\274\344\2J\321\355\335\366\373\341\376" \
676 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
677 "\377\343\376\377\374\3\316\363\374Z\325\354\31\275\345\245\25\274\344" \
678 "\2G\317\353\302\357\367\343\376\377\374\377\377\377\377\377\377\377\377" \
679 "\377\377\377\377\223\377\377\377\345\376\377\374\3\336\367\374m\332\361" \
680 "\0\276\345\240\25\274\344\3\31\275\345M\323\357\316\363\374\345\376\377" \
681 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
682 "\347\376\377\374\4\366\373\376\237\350\367I\320\354\31\275\345\232\25" \
683 "\274\344\4\0\276\345B\314\347\231\342\362\356\373\374\347\376\377\374" \
684 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\352" \
685 "\376\377\374\4\356\373\374\235\346\365Z\325\354#\304\346\224\25\274\344" \
686 "\4\0\302\351L\322\356\221\344\362\336\367\374\352\376\377\374\377\377" \
687 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\356\376\377" \
688 "\374\6\336\367\374\237\350\367w\333\356M\323\357,\311\352\0\276\345\210" \
689 "\25\274\344\6\0\276\345*\310\351J\321\355n\333\362\233\345\364\320\365" \
690 "\376\356\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
691 "\223\377\377\377\364\376\377\374\10\367\375\377\356\373\374\335\366\373" \
692 "\316\363\374\315\362\373\335\366\373\350\371\377\366\373\376\364\376" \
693 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
694 "\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377" \
695 "\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377" \
696 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376" \
697 "\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
698 "\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377" \
699 "\377\377\377\377\377\377\377\377\223\377\377\377\375\376\377\374\202" \
700 "\370\376\377\250\376\377\374\1\367\375\377\217\376\377\374\1\367\375" \
701 "\377\237\376\377\374\1\367\375\377\230\376\377\374\377\377\377\377\377" \
702 "\377\377\377\377\377\377\377\223\377\377\377\374\376\377\374\4\237\350" \
703 "\367\0\276\345\31\275\345\203\334\360\245\376\377\374\5\316\363\374#" \
704 "\304\346\25\274\344G\317\353\367\375\377\213\376\377\374\5\335\366\373" \
705 "(\307\350\25\274\344B\314\347\366\373\376\233\376\377\374\5\356\373\374" \
706 "/\312\353\25\274\344*\310\351\337\370\375\226\376\377\374\377\377\377" \
707 "\377\377\377\377\377\377\377\377\377\223\377\377\377\374\376\377\374" \
708 "\1#\304\346\203\25\274\344\1\357\374\375\244\376\377\374\1i\326\356\203" \
709 "\25\274\344\1\260\353\366\213\376\377\374\1n\333\362\203\25\274\344\1" \
710 "\235\346\365\233\376\377\374\1\231\342\362\203\25\274\344\1y\336\360" \
711 "\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
712 "\377\377\377\374\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374" \
713 "\244\376\377\374\1I\320\354\203\25\274\344\1\231\342\362\213\376\377" \
714 "\374\1M\323\357\203\25\274\344\1\206\340\363\233\376\377\374\1\206\340" \
715 "\363\203\25\274\344\1k\327\357\226\376\377\374\377\377\377\377\377\377" \
716 "\377\377\377\377\377\377\223\377\377\377\374\376\377\374\1\0\301\350" \
717 "\203\25\274\344\1\336\367\374\244\376\377\374\1I\320\354\203\25\274\344" \
718 "\1\231\342\362\213\376\377\374\1M\323\357\203\25\274\344\1\206\340\363" \
719 "\233\376\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377" \
720 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
721 "\374\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374\244\376\377" \
722 "\374\1I\320\354\203\25\274\344\1\231\342\362\213\376\377\374\1M\323\357" \
723 "\203\25\274\344\1\206\340\363\233\376\377\374\1\206\340\363\203\25\274" \
724 "\344\1k\327\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377" \
725 "\377\377\223\377\377\377\374\376\377\374\1\0\301\350\203\25\274\344\1" \
726 "\336\367\374\244\376\377\374\1I\320\354\203\25\274\344\1\231\342\362" \
727 "\213\376\377\374\1M\323\357\203\25\274\344\1\206\340\363\233\376\377" \
728 "\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377\374\377\377" \
729 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\374\376\377" \
730 "\374\1\0\301\350\203\25\274\344\1\336\367\374\244\376\377\374\1I\320" \
731 "\354\203\25\274\344\1\231\342\362\213\376\377\374\1M\323\357\203\25\274" \
732 "\344\1\206\340\363\233\376\377\374\1\206\340\363\203\25\274\344\1k\327" \
733 "\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
734 "\223\377\377\377\232\376\377\374\7\311\316\321\211\230\236j}\210cu\200" \
735 "n\201\214\233\243\253\333\340\343\206\376\377\374\2\236\246\256dv\201" \
736 "\205]oz\4_q|k~\211\222\241\247\337\344\346\210\376\377\374\7\322\330" \
737 "\332\222\241\247l\177\212cu\200k~\211\222\241\247\322\330\332\206\376" \
738 "\377\374\2\257\267\277gy\204\205]oz\4^p{i{\206\211\230\236\325\332\334" \
739 "\210\376\377\374\10\313\360\371\\\326\355%\305\347\0\276\345\0\302\351" \
740 "G\317\353\237\350\367\370\376\377\205\376\377\374\2\235\346\365\0\304" \
741 "\352\212\25\274\344\4\0\276\345\0\304\352M\323\357\315\362\373\205\376" \
742 "\377\374\1\0\301\350\207\25\274\344\4\0\301\350B\314\347\233\345\364" \
743 "\370\376\377\207\376\377\374\7\302\357\367M\323\357#\304\346\0\276\345" \
744 "\0\304\352J\321\355\260\353\366\210\376\377\374\4\315\362\373M\323\357" \
745 "#\304\346\31\275\345\207\25\274\344\1\231\342\362\204\376\377\374\4\323" \
746 "\364\367\\\326\355%\305\347\0\276\345\207\25\274\344\1\206\340\363\205" \
747 "\376\377\374\10\334\365\372m\332\361(\307\350\0\276\345\0\302\351B\314" \
748 "\347\233\345\364\370\376\377\207\376\377\374\4\336\367\374m\332\361(" \
749 "\307\350\0\276\345\207\25\274\344\1k\327\357\226\376\377\374\377\377" \
750 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\230\376\377" \
751 "\374\2\356\363\366\202\221\227\206]oz\3^p{\247\257\267\373\375\372\203" \
752 "\376\377\374\1\327\334\337\212]oz\2_q|\303\310\313\205\376\377\374\2" \
753 "\364\371\374\222\241\247\207]oz\2\222\241\247\370\372\367\203\376\377" \
754 "\374\2\353\360\363^p{\212]oz\1\254\264\274\205\376\377\374\2\370\376" \
755 "\377m\332\361\207\25\274\344\2B\314\347\350\371\377\203\376\377\374\2" \
756 "\370\376\377\0\276\345\216\25\274\344\2\31\275\345\235\346\365\204\376" \
757 "\377\374\1\0\301\350\212\25\274\344\2B\314\347\357\374\375\204\376\377" \
758 "\374\2\367\375\377Z\325\354\207\25\274\344\2G\317\353\357\374\375\205" \
759 "\376\377\374\2\235\346\365\31\275\345\212\25\274\344\1\231\342\362\203" \
760 "\376\377\374\2\256\350\364\0\276\345\212\25\274\344\1\206\340\363\204" \
761 "\376\377\374\2\206\340\363\31\275\345\206\25\274\344\2*\310\351\335\366" \
762 "\373\205\376\377\374\2\302\357\367\0\301\350\212\25\274\344\1k\327\357" \
763 "\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
764 "\377\377\377\227\376\377\374\2\364\371\374u\210\224\211]oz\1\242\252" \
765 "\262\203\376\377\374\1\306\314\316\213]oz\2_q|\325\332\334\203\376\377" \
766 "\374\2\373\375\372\210\227\235\211]oz\2\211\230\236\373\375\372\202\376" \
767 "\377\374\1\330\335\340\214]oz\1\304\311\314\204\376\377\374\1i\326\356" \
768 "\211\25\274\344\2*\310\351\366\373\376\202\376\377\374\1\357\374\375" \
769 "\220\25\274\344\2\0\276\345\274\355\373\203\376\377\374\1\0\301\350\213" \
770 "\25\274\344\1M\323\357\204\376\377\374\1L\322\356\211\25\274\344\2""3" \
771 "\314\355\370\376\377\203\376\377\374\2\313\360\371\0\276\345\213\25\274" \
772 "\344\1\231\342\362\202\376\377\374\2\333\364\371\0\276\345\213\25\274" \
773 "\344\1\206\340\363\203\376\377\374\1\206\340\363\211\25\274\344\2\0\304" \
774 "\352\347\370\376\203\376\377\374\2\356\373\374\0\304\352\213\25\274\344" \
775 "\1k\327\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
776 "\377\223\377\377\377\227\376\377\374\1\251\261\271\213]oz\1\322\330\332" \
777 "\202\376\377\374\1\306\314\316\214]oz\1\200\217\225\203\376\377\374\1" \
778 "\277\304\306\213]oz\1\277\304\306\202\376\377\374\1\330\335\340\214]" \
779 "oz\2j}\210\373\375\372\202\376\377\374\1\273\354\371\213\25\274\344\1" \
780 "n\333\362\202\376\377\374\1\357\374\375\221\25\274\344\1""1\313\354\203" \
781 "\376\377\374\1\0\301\350\214\25\274\344\1\332\363\370\202\376\377\374" \
782 "\1\237\350\367\213\25\274\344\1\206\340\363\203\376\377\374\1I\320\354" \
783 "\214\25\274\344\1\231\342\362\202\376\377\374\1M\323\357\214\25\274\344" \
784 "\1\206\340\363\202\376\377\374\2\320\365\376\31\275\345\212\25\274\344" \
785 "\1L\322\356\203\376\377\374\1\203\334\360\214\25\274\344\1k\327\357\226" \
786 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
787 "\377\377\226\376\377\374\2\370\372\367cu\200\203]oz\5s\206\221\317\324" \
788 "\327\343\350\353\276\303\305ew\202\203]oz\1\210\227\235\202\376\377\374" \
789 "\1\306\314\316\203]oz\1y\214\230\203\347\355\357\2\346\354\356\264\274" \
790 "\305\203]oz\2^p{\357\365\367\202\376\377\374\1p\203\216\203]oz\5k~\211" \
791 "\307\315\317\343\350\353\306\314\316k~\211\203]oz\1p\203\216\202\376" \
792 "\377\374\1\330\335\340\203]oz\1k~\211\204\347\355\357\2\304\311\314_" \
793 "q|\203]oz\1\334\342\344\202\376\377\374\1B\314\347\203\25\274\344\5\0" \
794 "\301\350\233\345\364\333\364\371\260\353\366(\307\350\203\25\274\344" \
795 "\4\0\276\345\367\375\377\376\377\374\357\374\375\204\25\274\344\203\335" \
796 "\366\373\204\25\274\344\3\302\357\367\335\366\373\206\340\363\204\25" \
797 "\274\344\1\356\373\374\202\376\377\374\1\0\301\350\203\25\274\344\1\302" \
798 "\357\367\203\335\366\373\2\302\357\367\0\304\352\203\25\274\344\1\207" \
799 "\341\364\202\376\377\374\1,\311\352\203\25\274\344\5\0\302\351\236\347" \
800 "\366\332\363\370\256\350\364#\304\346\203\25\274\344\5\0\302\351\370" \
801 "\376\377\376\377\374\370\376\377\0\276\345\203\25\274\344\1w\333\356" \
802 "\204\335\366\373\1B\314\347\203\25\274\344\1\231\342\362\202\376\377" \
803 "\374\1\0\276\345\203\25\274\344\2m\332\361\334\365\372\203\335\366\373" \
804 "\1I\320\354\203\25\274\344\1\206\340\363\202\376\377\374\1i\326\356\203" \
805 "\25\274\344\5\0\276\345\206\340\363\323\364\367\273\354\3711\313\354" \
806 "\204\25\274\344\1\335\366\373\202\376\377\374\1,\311\352\203\25\274\344" \
807 "\2L\322\356\332\363\370\203\335\366\373\1n\333\362\203\25\274\344\1k" \
808 "\327\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
809 "\377\223\377\377\377\226\376\377\374\1\324\331\333\203]oz\2cu\200\353" \
810 "\360\363\203\376\377\374\1\307\315\317\203]oz\4as~\372\374\371\376\377" \
811 "\374\306\314\316\203]oz\1\202\221\227\205\376\377\374\1hz\205\203]oz" \
812 "\3\341\346\351\376\377\374\347\355\357\203]oz\2^p{\335\343\345\203\376" \
813 "\377\374\1\333\340\343\204]oz\3\347\355\357\376\377\374\330\335\340\203" \
814 "]oz\1m\200\213\205\376\377\374\1~\215\223\203]oz\4\313\320\322\376\377" \
815 "\374\370\376\377\31\275\345\203\25\274\344\1\256\350\364\203\376\377" \
816 "\374\2\336\367\374\0\276\345\203\25\274\344\3\274\355\373\376\377\374" \
817 "\357\374\375\204\25\274\344\203\376\377\374\204\25\274\344\1\336\367" \
818 "\374\202\376\377\374\1\0\301\350\203\25\274\344\1\323\364\367\202\376" \
819 "\377\374\1\0\301\350\203\25\274\344\1\336\367\374\204\376\377\374\1n" \
820 "\333\362\203\25\274\344\3m\332\361\376\377\374\356\373\374\204\25\274" \
821 "\344\1\274\355\373\203\376\377\374\2\323\364\367\0\276\345\203\25\274" \
822 "\344\3\315\362\373\376\377\374\335\366\373\203\25\274\344\2\0\276\345" \
823 "\370\376\377\204\376\377\374\1I\320\354\203\25\274\344\3\231\342\362" \
824 "\376\377\374\366\373\376\204\25\274\344\1\366\373\376\204\376\377\374" \
825 "\1M\323\357\203\25\274\344\1\206\340\363\202\376\377\374\1%\305\347\203" \
826 "\25\274\344\1\207\341\364\203\376\377\374\2\360\375\376\0\304\352\203" \
827 "\25\274\344\1\233\345\364\202\376\377\374\1\0\301\350\203\25\274\344" \
828 "\1\323\364\367\204\376\377\374\1\206\340\363\203\25\274\344\1k\327\357" \
829 "\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
830 "\377\377\377\226\376\377\374\1\303\310\313\203]oz\1\204\223\231\204\376" \
831 "\377\374\2\370\372\367_q|\203]oz\3\354\361\364\376\377\374\306\314\316" \
832 "\203]oz\1\202\221\227\205\376\377\374\1m\200\213\203]oz\3\341\346\351" \
833 "\376\377\374\326\333\335\203]oz\1n\201\214\205\376\377\374\1l\177\212" \
834 "\203]oz\3\327\334\337\376\377\374\330\335\340\203]oz\1m\200\213\205\376" \
835 "\377\374\1\202\221\227\203]oz\3\306\314\316\376\377\374\337\370\375\203" \
836 "\25\274\344\2\31\275\345\370\376\377\204\376\377\374\1""3\314\355\203" \
837 "\25\274\344\3\236\347\366\376\377\374\357\374\375\204\25\274\344\203" \
838 "\376\377\374\204\25\274\344\1\336\367\374\202\376\377\374\1#\304\346" \
839 "\203\25\274\344\1\316\363\374\202\376\377\374\1\0\301\350\203\25\274" \
840 "\344\1\336\367\374\204\376\377\374\1w\333\356\203\25\274\344\3k\327\357" \
841 "\376\377\374\315\362\373\203\25\274\344\1\0\301\350\205\376\377\374\1" \
842 "*\310\351\203\25\274\344\3\261\354\367\376\377\374\316\363\374\203\25" \
843 "\274\344\1\0\301\350\205\376\377\374\1I\320\354\203\25\274\344\3\231" \
844 "\342\362\376\377\374\357\374\375\204\25\274\344\205\376\377\374\1M\323" \
845 "\357\203\25\274\344\1\206\340\363\202\376\377\374\1\31\275\345\203\25" \
846 "\274\344\1\335\366\373\204\376\377\374\1M\323\357\203\25\274\344\1\203" \
847 "\334\360\202\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374\204" \
848 "\376\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377\374" \
849 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\226" \
850 "\376\377\374\1\277\304\306\203]oz\1\211\230\236\205\376\377\374\1ew\202" \
851 "\203]oz\3\352\357\362\376\377\374\306\314\316\203]oz\1\202\221\227\205" \
852 "\376\377\374\1m\200\213\203]oz\3\341\346\351\376\377\374\317\324\327" \
853 "\203]oz\1as~\205o\202\215\1as~\203]oz\3\317\324\327\376\377\374\330\335" \
854 "\340\203]oz\1m\200\213\205\376\377\374\1\202\221\227\203]oz\3\306\314" \
855 "\316\376\377\374\336\367\374\203\25\274\344\1\0\276\345\205%\305\347" \
856 "\1\0\276\345\203\25\274\344\3\231\342\362\376\377\374\357\374\375\204" \
857 "\25\274\344\203\376\377\374\204\25\274\344\1\336\367\374\202\376\377" \
858 "\374\1#\304\346\203\25\274\344\1\316\363\374\202\376\377\374\1\0\301" \
859 "\350\203\25\274\344\1\336\367\374\204\376\377\374\1w\333\356\203\25\274" \
860 "\344\3k\327\357\376\377\374\302\357\367\203\25\274\344\1\31\275\345\205" \
861 "%\305\347\1\0\276\345\203\25\274\344\3\237\350\367\376\377\374\316\363" \
862 "\374\203\25\274\344\1\0\301\350\205\376\377\374\1I\320\354\203\25\274" \
863 "\344\3\231\342\362\376\377\374\357\374\375\204\25\274\344\205\376\377" \
864 "\374\1M\323\357\203\25\274\344\1\206\340\363\202\376\377\374\204\25\274" \
865 "\344\1#\304\346\204%\305\347\1\0\301\350\203\25\274\344\1w\333\356\202" \
866 "\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374\204\376\377\374" \
867 "\1\206\340\363\203\25\274\344\1k\327\357\226\376\377\374\377\377\377" \
868 "\377\377\377\377\377\377\377\377\377\223\377\377\377\226\376\377\374" \
869 "\1\277\304\306\203]oz\1\211\230\236\205\376\377\374\1ew\202\203]oz\3" \
870 "\352\357\362\376\377\374\306\314\316\203]oz\1\202\221\227\205\376\377" \
871 "\374\1m\200\213\203]oz\3\341\346\351\376\377\374\317\324\327\215]oz\3" \
872 "\317\324\327\376\377\374\330\335\340\203]oz\1m\200\213\205\376\377\374" \
873 "\1\202\221\227\203]oz\3\306\314\316\376\377\374\336\367\374\215\25\274" \
874 "\344\3\231\342\362\376\377\374\357\374\375\204\25\274\344\203\376\377" \
875 "\374\204\25\274\344\1\336\367\374\202\376\377\374\1#\304\346\203\25\274" \
876 "\344\1\316\363\374\202\376\377\374\1\0\301\350\203\25\274\344\1\336\367" \
877 "\374\204\376\377\374\1w\333\356\203\25\274\344\3k\327\357\376\377\374" \
878 "\302\357\367\215\25\274\344\3\237\350\367\376\377\374\316\363\374\203" \
879 "\25\274\344\1\0\301\350\205\376\377\374\1I\320\354\203\25\274\344\3\231" \
880 "\342\362\376\377\374\357\374\375\204\25\274\344\205\376\377\374\1M\323" \
881 "\357\203\25\274\344\1\206\340\363\202\376\377\374\215\25\274\344\1w\333" \
882 "\356\202\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374\204\376" \
883 "\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377\374\377" \
884 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\226\376" \
885 "\377\374\1\277\304\306\203]oz\1\211\230\236\205\376\377\374\1ew\202\203" \
886 "]oz\3\352\357\362\376\377\374\306\314\316\203]oz\1\202\221\227\205\376" \
887 "\377\374\1m\200\213\203]oz\3\341\346\351\376\377\374\317\324\327\215" \
888 "]oz\3\317\324\327\376\377\374\330\335\340\203]oz\1m\200\213\205\376\377" \
889 "\374\1\202\221\227\203]oz\3\306\314\316\376\377\374\336\367\374\215\25" \
890 "\274\344\3\231\342\362\376\377\374\357\374\375\204\25\274\344\203\376" \
891 "\377\374\204\25\274\344\1\336\367\374\202\376\377\374\1#\304\346\203" \
892 "\25\274\344\1\316\363\374\202\376\377\374\1\0\301\350\203\25\274\344" \
893 "\1\336\367\374\204\376\377\374\1w\333\356\203\25\274\344\3k\327\357\376" \
894 "\377\374\302\357\367\215\25\274\344\3\237\350\367\376\377\374\316\363" \
895 "\374\203\25\274\344\1\0\301\350\205\376\377\374\1I\320\354\203\25\274" \
896 "\344\3\231\342\362\376\377\374\357\374\375\204\25\274\344\205\376\377" \
897 "\374\1M\323\357\203\25\274\344\1\206\340\363\202\376\377\374\215\25\274" \
898 "\344\1w\333\356\202\376\377\374\1\0\301\350\203\25\274\344\1\336\367" \
899 "\374\204\376\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376" \
900 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
901 "\377\226\376\377\374\1\277\304\306\203]oz\1\211\230\236\205\376\377\374" \
902 "\1ew\202\203]oz\3\352\357\362\376\377\374\306\314\316\203]oz\1\202\221" \
903 "\227\205\376\377\374\1m\200\213\203]oz\3\341\346\351\376\377\374\317" \
904 "\324\327\215]oz\3\317\324\327\376\377\374\330\335\340\203]oz\1m\200\213" \
905 "\205\376\377\374\1\202\221\227\203]oz\3\306\314\316\376\377\374\336\367" \
906 "\374\215\25\274\344\3\231\342\362\376\377\374\357\374\375\204\25\274" \
907 "\344\203\376\377\374\204\25\274\344\1\336\367\374\202\376\377\374\1#" \
908 "\304\346\203\25\274\344\1\316\363\374\202\376\377\374\1\0\301\350\203" \
909 "\25\274\344\1\336\367\374\204\376\377\374\1w\333\356\203\25\274\344\3" \
910 "k\327\357\376\377\374\302\357\367\215\25\274\344\3\237\350\367\376\377" \
911 "\374\316\363\374\203\25\274\344\1\0\301\350\205\376\377\374\1I\320\354" \
912 "\203\25\274\344\3\231\342\362\376\377\374\357\374\375\204\25\274\344" \
913 "\205\376\377\374\1M\323\357\203\25\274\344\1\206\340\363\202\376\377" \
914 "\374\215\25\274\344\1w\333\356\202\376\377\374\1\0\301\350\203\25\274" \
915 "\344\1\336\367\374\204\376\377\374\1\206\340\363\203\25\274\344\1k\327" \
916 "\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
917 "\223\377\377\377\226\376\377\374\1\300\305\310\203]oz\1\211\230\236\205" \
918 "\376\377\374\1bt\177\203]oz\3\352\357\362\376\377\374\306\314\316\203" \
919 "]oz\1\202\221\227\205\376\377\374\1m\200\213\203]oz\3\341\346\351\376" \
920 "\377\374\317\324\327\203]oz\1p\203\216\211\335\343\345\3\366\370\364" \
921 "\376\377\374\330\335\340\203]oz\1m\200\213\205\376\377\374\1\202\221" \
922 "\227\203]oz\3\306\314\316\376\377\374\336\367\374\203\25\274\344\1\0" \
923 "\276\345\211\314\361\372\3\350\371\377\376\377\374\357\374\375\204\25" \
924 "\274\344\203\376\377\374\204\25\274\344\1\336\367\374\202\376\377\374" \
925 "\1#\304\346\203\25\274\344\1\316\363\374\202\376\377\374\1\0\301\350" \
926 "\203\25\274\344\1\336\367\374\204\376\377\374\1w\333\356\203\25\274\344" \
927 "\3k\327\357\376\377\374\302\357\367\203\25\274\344\1\0\302\351\211\314" \
928 "\361\372\3\356\373\374\376\377\374\316\363\374\203\25\274\344\1\0\301" \
929 "\350\205\376\377\374\1I\320\354\203\25\274\344\3\231\342\362\376\377" \
930 "\374\357\374\375\204\25\274\344\205\376\377\374\1M\323\357\203\25\274" \
931 "\344\1\206\340\363\202\376\377\374\204\25\274\344\1\301\356\366\210\314" \
932 "\361\372\1\337\370\375\202\376\377\374\1\0\301\350\203\25\274\344\1\336" \
933 "\367\374\204\376\377\374\1\206\340\363\203\25\274\344\1k\327\357\226" \
934 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
935 "\377\377\226\376\377\374\1\314\321\324\203]oz\2l\177\212\372\374\371" \
936 "\203\376\377\374\1\333\340\343\203]oz\4^p{\366\373\376\376\377\374\306" \
937 "\314\316\203]oz\1\202\221\227\205\376\377\374\1k~\211\203]oz\3\341\346" \
938 "\351\376\377\374\320\326\330\203]oz\1t\207\222\213\376\377\374\1\330" \
939 "\335\340\203]oz\1m\200\213\205\376\377\374\1\202\221\227\203]oz\3\306" \
940 "\314\316\376\377\374\336\367\374\203\25\274\344\1\0\276\345\213\376\377" \
941 "\374\1\357\374\375\204\25\274\344\203\376\377\374\204\25\274\344\1\336" \
942 "\367\374\202\376\377\374\1#\304\346\203\25\274\344\1\316\363\374\202" \
943 "\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374\204\376\377\374" \
944 "\1n\333\362\203\25\274\344\3k\327\357\376\377\374\303\361\370\203\25" \
945 "\274\344\1\0\304\352\213\376\377\374\1\332\363\370\203\25\274\344\1\0" \
946 "\276\345\205\376\377\374\1I\320\354\203\25\274\344\3\231\342\362\376" \
947 "\377\374\357\374\375\204\25\274\344\1\370\376\377\204\376\377\374\1M" \
948 "\323\357\203\25\274\344\1\206\340\363\202\376\377\374\204\25\274\344" \
949 "\1\356\373\374\213\376\377\374\1\0\301\350\203\25\274\344\1\335\366\373" \
950 "\204\376\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377" \
951 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
952 "\226\376\377\374\2\353\360\363^p{\203]oz\5\236\246\256\366\373\376\376" \
953 "\377\374\347\355\357w\212\226\203]oz\1~\215\223\202\376\377\374\1\306" \
954 "\314\316\203]oz\1\202\221\227\204\376\377\374\2\335\343\345^p{\203]o" \
955 "z\3\351\356\360\376\377\374\335\343\345\203]oz\2bt\177\343\350\353\212" \
956 "\376\377\374\1\330\335\340\203]oz\1m\200\213\205\376\377\374\1\202\221" \
957 "\227\203]oz\3\306\314\316\376\377\374\356\373\374\204\25\274\344\1\274" \
958 "\355\373\212\376\377\374\1\357\374\375\204\25\274\344\203\376\377\374" \
959 "\204\25\274\344\1\336\367\374\202\376\377\374\1#\304\346\203\25\274\344" \
960 "\1\316\363\374\202\376\377\374\1\0\301\350\203\25\274\344\1\336\367\374" \
961 "\203\376\377\374\2\367\375\377/\312\353\203\25\274\344\3\204\335\361" \
962 "\376\377\374\334\365\372\203\25\274\344\2\0\276\345\314\361\372\212\376" \
963 "\377\374\1\356\373\374\204\25\274\344\1\274\355\373\204\376\377\374\1" \
964 "I\320\354\203\25\274\344\4\231\342\362\376\377\374\370\376\377\0\276" \
965 "\345\203\25\274\344\1\257\351\365\204\376\377\374\1M\323\357\203\25\274" \
966 "\344\1\206\340\363\202\376\377\374\1\0\301\350\203\25\274\344\1\233\345" \
967 "\364\213\376\377\374\1#\304\346\203\25\274\344\1\207\341\364\204\376" \
968 "\377\374\1\206\340\363\203\25\274\344\1k\327\357\226\376\377\374\377" \
969 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\227\376" \
970 "\377\374\1\211\230\236\204]oz\3cu\200p\203\216^p{\204]oz\1\277\304\306" \
971 "\202\376\377\374\1\306\314\316\203]oz\1dv\201\203~\215\223\2v\211\225" \
972 "as~\203]oz\1n\201\214\202\376\377\374\2\371\373\370dv\201\203]oz\2bt" \
973 "\177w\212\226\205~\215\223\2\203\222\230\304\311\314\202\376\377\374" \
974 "\1\330\335\340\203]oz\1m\200\213\205\376\377\374\1\202\221\227\203]o" \
975 "z\1\306\314\316\202\376\377\374\1(\307\350\203\25\274\344\2\0\276\345" \
976 "*\310\351\205,\311\352\2""1\313\354\207\341\364\202\376\377\374\1\357" \
977 "\374\375\204\25\274\344\203\376\377\374\204\25\274\344\1\336\367\374" \
978 "\202\376\377\374\1#\304\346\203\25\274\344\1\316\363\374\202\376\377" \
979 "\374\1\0\301\350\203\25\274\344\1*\310\351\203,\311\352\1\0\302\351\204" \
980 "\25\274\344\4\274\355\373\376\377\374\370\376\377\0\302\351\203\25\274" \
981 "\344\2\31\275\345*\310\351\205,\311\352\2B\314\347\231\342\362\203\376" \
982 "\377\374\1%\305\347\203\25\274\344\2\0\276\345*\310\351\203,\311\352" \
983 "\1\0\301\350\203\25\274\344\1\231\342\362\202\376\377\374\1/\312\353" \
984 "\203\25\274\344\2\0\276\345*\310\351\203,\311\352\1\0\301\350\203\25" \
985 "\274\344\1\206\340\363\202\376\377\374\1G\317\353\204\25\274\344\1(\307" \
986 "\350\205,\311\352\3""1\313\354w\333\356\370\376\377\202\376\377\374\1" \
987 "M\323\357\204\25\274\344\1(\307\350\203,\311\352\1\0\304\352\203\25\274" \
988 "\344\1k\327\357\226\376\377\374\377\377\377\377\377\377\377\377\377\377" \
989 "\377\377\223\377\377\377\227\376\377\374\2\343\350\353ew\202\211]oz\2" \
990 "\177\216\224\373\375\372\202\376\377\374\1\306\314\316\214]oz\1\270\300" \
991 "\311\203\376\377\374\1\253\263\273\213]oz\4_q|\352\357\362\376\377\374" \
992 "\330\335\340\203]oz\1m\200\213\205\376\377\374\1\202\221\227\203]oz\1" \
993 "\306\314\316\202\376\377\374\1\233\345\364\214\25\274\344\3\301\356\366" \
994 "\376\377\374\357\374\375\204\25\274\344\203\376\377\374\204\25\274\344" \
995 "\1\336\367\374\202\376\377\374\1#\304\346\203\25\274\344\1\316\363\374" \
996 "\202\376\377\374\1\0\301\350\213\25\274\344\2,\311\352\370\376\377\202" \
997 "\376\377\374\1\206\340\363\214\25\274\344\1\316\363\374\202\376\377\374" \
998 "\1\233\345\364\214\25\274\344\1\231\342\362\202\376\377\374\1\250\347" \
999 "\371\214\25\274\344\1\206\340\363\202\376\377\374\1\273\354\371\214\25" \
1000 "\274\344\1\236\347\366\202\376\377\374\2\313\360\371\0\276\345\213\25" \
1001 "\274\344\1k\327\357\226\376\377\374\377\377\377\377\377\377\377\377\377" \
1002 "\377\377\377\223\377\377\377\230\376\377\374\2\325\332\334gy\204\207" \
1003 "]oz\2x\213\227\354\361\364\203\376\377\374\1\306\314\316\213]oz\1\225" \
1004 "\235\245\204\376\377\374\2\372\374\371~\221\235\213]oz\3\333\340\343" \
1005 "\376\377\374\342\347\352\203]oz\1t\207\222\205\376\377\374\1\211\230" \
1006 "\236\203]oz\1\317\324\327\203\376\377\374\1M\323\357\213\25\274\344\4" \
1007 "\237\350\367\376\377\374\367\375\377\0\276\345\202\25\274\344\1\0\276" \
1008 "\345\203\376\377\374\1\0\301\350\203\25\274\344\1\357\374\375\202\376" \
1009 "\377\374\1(\307\350\203\25\274\344\1\335\366\373\202\376\377\374\1\0" \
1010 "\302\351\212\25\274\344\2\0\301\350\333\364\371\203\376\377\374\2\370" \
1011 "\376\377G\317\353\213\25\274\344\1\273\354\371\203\376\377\374\1M\323" \
1012 "\357\213\25\274\344\1\237\350\367\203\376\377\374\1k\327\357\213\25\274" \
1013 "\344\1\231\342\362\203\376\377\374\1w\333\356\213\25\274\344\1\206\340" \
1014 "\363\203\376\377\374\1\207\341\364\213\25\274\344\1n\333\362\226\376" \
1015 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
1016 "\377\231\376\377\374\3\351\356\360\231\241\251bt\177\203]oz\3k~\211\257" \
1017 "\267\277\370\372\367\204\376\377\374\1\306\314\316\211]oz\3gy\204\261" \
1018 "\271\302\373\375\372\205\376\377\374\3\371\373\370\252\262\272dv\201" \
1019 "\210]oz\2x\213\227\372\374\371\202\376\377\374\4}\220\233]oz^p{\266\277" \
1020 "\307\205\376\377\374\5\311\316\321_q|]ozq\204\217\370\372\367\203\376" \
1021 "\377\374\3\370\376\377\211\342\365\0\301\350\210\25\274\344\2\0\304\352" \
1022 "\356\373\374\202\376\377\374\1M\323\357\202\25\274\344\1m\332\361\203" \
1023 "\376\377\374\1n\333\362\202\25\274\344\1L\322\356\203\376\377\374\1\206" \
1024 "\340\363\202\25\274\344\2B\314\347\370\376\377\202\376\377\374\1w\333" \
1025 "\356\210\25\274\344\3\0\276\345L\322\356\336\367\374\205\376\377\374" \
1026 "\3\370\376\377\204\335\361\0\301\350\210\25\274\344\2(\307\350\366\373" \
1027 "\376\203\376\377\374\3\370\376\377\211\342\365\0\301\350\210\25\274\344" \
1028 "\2#\304\346\356\373\374\204\376\377\374\2\233\345\364\0\302\351\210\25" \
1029 "\274\344\2\0\302\351\337\370\375\204\376\377\374\2\237\350\367#\304\346" \
1030 "\210\25\274\344\2\0\301\350\333\364\371\204\376\377\374\2\257\351\365" \
1031 "%\305\347\210\25\274\344\2\0\276\345\314\361\372\226\376\377\374\377" \
1032 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\233\376" \
1033 "\377\374\4\365\372\375\335\343\345\325\332\334\343\350\353\207\376\377" \
1034 "\374\1\306\314\316\203]oz\1u\210\224\204\324\331\333\2\335\343\345\373" \
1035 "\375\372\211\376\377\374\2\372\374\371\334\342\344\206\324\331\333\2" \
1036 "\331\336\341\372\374\371\203\376\377\374\3\373\375\372\332\337\342\343" \
1037 "\350\353\207\376\377\374\3\351\356\360\330\335\340\366\373\376\206\376" \
1038 "\377\374\2\370\376\377\316\363\374\206\273\354\371\2\302\357\367\366" \
1039 "\373\376\204\376\377\374\2\314\361\372\315\362\373\205\376\377\374\2" \
1040 "\316\363\374\313\360\371\205\376\377\374\3\332\363\370\312\357\370\370" \
1041 "\376\377\204\376\377\374\1\316\363\374\206\273\354\371\2\302\357\367" \
1042 "\356\373\374\211\376\377\374\2\370\376\377\314\361\372\206\273\354\371" \
1043 "\2\302\357\367\367\375\377\206\376\377\374\2\370\376\377\316\363\374" \
1044 "\206\273\354\371\2\302\357\367\366\373\376\206\376\377\374\2\370\376" \
1045 "\377\316\363\374\206\273\354\371\2\301\356\366\357\374\375\207\376\377" \
1046 "\374\1\332\363\370\206\273\354\371\2\301\356\366\356\373\374\207\376" \
1047 "\377\374\2\333\364\371\274\355\373\205\273\354\371\2\274\355\373\350" \
1048 "\371\377\227\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
1049 "\377\223\377\377\377\246\376\377\374\1\306\314\316\203]oz\1\202\221\227" \
1050 "\377\376\377\374\306\376\377\374\377\377\377\377\377\377\377\377\377" \
1051 "\377\377\377\223\377\377\377\246\376\377\374\1\306\314\316\203]oz\1\202" \
1052 "\221\227\377\376\377\374\306\376\377\374\377\377\377\377\377\377\377" \
1053 "\377\377\377\377\377\223\377\377\377\246\376\377\374\1\306\314\316\203" \
1054 "]oz\1\202\221\227\377\376\377\374\306\376\377\374\377\377\377\377\377" \
1055 "\377\377\377\377\377\377\377\223\377\377\377\246\376\377\374\1\306\314" \
1056 "\316\203]oz\1\202\221\227\377\376\377\374\306\376\377\374\377\377\377" \
1057 "\377\377\377\377\377\377\377\377\377\223\377\377\377\246\376\377\374" \
1058 "\1\315\322\325\203]oz\1\211\230\236\377\376\377\374\306\376\377\374\377" \
1059 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\246\376" \
1060 "\377\374\2\360\366\370i{\206\202]oz\1\302\307\312\377\376\377\374\306" \
1061 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
1062 "\377\377\247\376\377\374\3\357\365\367\313\320\322\335\343\345\377\376" \
1063 "\377\374\307\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
1064 "\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377" \
1065 "\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361" \
1066 "\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377" \
1067 "\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377" \
1068 "\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374" \
1069 "\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377" \
1070 "\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377" \
1071 "\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377" \
1072 "\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374" \
1073 "\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223" \
1074 "\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377" \
1075 "\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377" \
1076 "\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377" \
1077 "\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377" \
1078 "\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377\377" \
1079 "\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376\377" \
1080 "\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377\377" \
1081 "\223\377\377\377\377\376\377\374\361\376\377\374\377\377\377\377\377" \
1082 "\377\377\377\377\377\377\377\223\377\377\377\377\376\377\374\361\376" \
1083 "\377\374\377\377\377\377\377\377\377\377\377\377\377\377\223\377\377" \
1084 "\377\377\376\377\374\361\376\377\374\377\377\377\377\377\377\377\377" \
1085 "\377\377\377\377\223\377\377\377\377\376\377\374\361\376\377\374\377" \
1086 "\377\377\377\377\377\377\377\377\377\377\377\223\377\377\377\377\376" \
1087 "\377\374\361\376\377\374\377\377\377\377\377\377\377\377\377\377\377" \
1088 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1089 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1090 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1091 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1092 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1093 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1094 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1095 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1096 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1097 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1098 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1099 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1100 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1101 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1102 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1103 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1104 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1105 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1106 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1107 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1108 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1109 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1110 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1111 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1112 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1113 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1114 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1115 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1116 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1117 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1118 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1119 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1120 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1121 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1122 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1123 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1124 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1125 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1126 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1127 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1128 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1129 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1130 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1131 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1132 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1133 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1134 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1135 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1136 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1137 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1138 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1139 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1140 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1141 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1142 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1143 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1144 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1145 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1146 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1147 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1148 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1149 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1150 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1151 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1152 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1153 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1154 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1155 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1156 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1157 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1158 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1159 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1160 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1161 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1162 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1163 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1164 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1165 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1166 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1167 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1168 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1169 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1170 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1171 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1172 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1173 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1174 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1175 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1176 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1177 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1178 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1179 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1180 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1181 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1182 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1183 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1184 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1185 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1186 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1187 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1188 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1189 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1190 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1191 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1192 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1193 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1194 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1195 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1196 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1197 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1198 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1199 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1200 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1201 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1202 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1203 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1204 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1205 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1206 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1207 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1208 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1209 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1210 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1211 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1212 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1213 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1214 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1215 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1216 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1217 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1218 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1219 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1220 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1221 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1222 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1223 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1224 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1225 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1226 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1227 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1228 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1229 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1230 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1231 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1232 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1233 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1234 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1235 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1236 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1237 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1238 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1239 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1240 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1241 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1242 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1243 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1244 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1245 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1246 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1247 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1248 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1249 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1250 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1251 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1252 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1253 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1254 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1255 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1256 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" \
1257 "\377\377\377\377\232\377\377\377")
1258
1259
diff --git a/meta/recipes-core/psplash/psplash_git.bb b/meta/recipes-core/psplash/psplash_git.bb
new file mode 100644
index 0000000000..4e8f071a8e
--- /dev/null
+++ b/meta/recipes-core/psplash/psplash_git.bb
@@ -0,0 +1,121 @@
1SUMMARY = "Userspace framebuffer boot logo based on usplash"
2DESCRIPTION = "PSplash is a userspace graphical boot splash screen for mainly embedded Linux devices supporting a 16bpp or 32bpp framebuffer. It has few dependencies (just libc), supports basic images and text and handles rotation. Its visual look is configurable by basic source changes. Also included is a 'client' command utility for sending information to psplash such as boot progress information."
3HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/psplash"
4SECTION = "base"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=16;md5=840fb2356b10a85bed78dd09dc7745c6"
7
8SRCREV = "afd4e228c606a9998feae44a3fed4474803240b7"
9PV = "0.1+git${SRCPV}"
10PR = "r15"
11
12SRC_URI = "git://git.yoctoproject.org/${BPN} \
13 file://psplash-init \
14 ${SPLASH_IMAGES}"
15
16SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
17
18python __anonymous() {
19 oldpkgs = d.getVar("PACKAGES", True).split()
20 splashfiles = d.getVar('SPLASH_IMAGES', True).split()
21 pkgs = []
22 localpaths = []
23 haspng = False
24 for uri in splashfiles:
25 fetcher = bb.fetch2.Fetch([uri], d)
26 flocal = os.path.basename(fetcher.localpath(uri))
27 fbase = os.path.splitext(flocal)[0]
28 outsuffix = fetcher.ud[uri].parm.get("outsuffix")
29 if not outsuffix:
30 if fbase.startswith("psplash-"):
31 outsuffix = fbase[8:]
32 else:
33 outsuffix = fbase
34 if outsuffix.endswith('-img'):
35 outsuffix = outsuffix[:-4]
36 outname = "psplash-%s" % outsuffix
37 if outname == '' or outname in oldpkgs:
38 bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
39 else:
40 pkgs.append(outname)
41 if flocal.endswith(".png"):
42 haspng = True
43 localpaths.append(flocal)
44
45 # Set these so that we have less work to do in do_compile and do_install_append
46 d.setVar("SPLASH_INSTALL", " ".join(pkgs))
47 d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
48
49 if haspng:
50 d.appendVar("DEPENDS", " gdk-pixbuf-native")
51
52 d.prependVar("PACKAGES", "%s " % (" ".join(pkgs)))
53 mlprefix = d.getVar('MLPREFIX', True) or ''
54 pn = d.getVar('PN', True) or ''
55 for p in pkgs:
56 ep = '%s%s' % (mlprefix, p)
57 epsplash = '%s%s' % (mlprefix, 'psplash')
58 d.setVar("FILES_%s" % ep, "${bindir}/%s" % p)
59 d.setVar("ALTERNATIVE_%s" % ep, 'psplash')
60 d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
61 d.appendVar("RDEPENDS_%s" % ep, " %s" % pn)
62 if p == "psplash-default":
63 d.appendVar("RRECOMMENDS_%s" % pn, " %s" % ep)
64}
65
66S = "${WORKDIR}/git"
67
68inherit autotools pkgconfig update-rc.d update-alternatives
69
70ALTERNATIVE_PRIORITY = "100"
71ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
72
73python do_compile () {
74 import shutil
75
76 # Build a separate executable for each splash image
77 workdir = d.getVar('WORKDIR', True)
78 convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
79 destfile = "%s/psplash-poky-img.h" % d.getVar('S', True)
80 localfiles = d.getVar('SPLASH_LOCALPATHS', True).split()
81 outputfiles = d.getVar('SPLASH_INSTALL', True).split()
82 for localfile, outputfile in zip(localfiles, outputfiles):
83 if localfile.endswith(".png"):
84 outp = oe.utils.getstatusoutput('%s %s POKY' % (convertscript, os.path.join(workdir, localfile)))
85 print(outp[1])
86 fbase = os.path.splitext(localfile)[0]
87 shutil.copyfile("%s-img.h" % fbase, destfile)
88 else:
89 shutil.copyfile(os.path.join(workdir, localfile), destfile)
90 # For some reason just updating the header is not enough, we have to touch the .c
91 # file in order to get it to rebuild
92 os.utime("%s/psplash.c" % d.getVar('S', True), None)
93 bb.build.exec_func("oe_runmake", d)
94 shutil.copyfile("psplash", outputfile)
95}
96
97do_install_append() {
98 install -d ${D}/mnt/.psplash/
99 install -d ${D}${sysconfdir}/init.d/
100 install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
101 install -d ${D}${bindir}
102 for i in ${SPLASH_INSTALL} ; do
103 install -m 0755 $i ${D}${bindir}/$i
104 done
105 rm -f ${D}${bindir}/psplash
106}
107
108FILES_${PN} += "/mnt/.psplash"
109
110INITSCRIPT_NAME = "psplash.sh"
111INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
112
113DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
114pkg_postinst_${PN} () {
115 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
116 if [ -n "$D" ]; then
117 OPTS="--root=$D"
118 fi
119 systemctl $OPTS mask psplash.service
120 fi
121}
diff --git a/meta/recipes-core/readline/files/config-dirent-symbols.patch b/meta/recipes-core/readline/files/config-dirent-symbols.patch
new file mode 100644
index 0000000000..cfff03c0f8
--- /dev/null
+++ b/meta/recipes-core/readline/files/config-dirent-symbols.patch
@@ -0,0 +1,34 @@
1Fix the names of the STRUCT_DIRENT_D symbols to match the names used by both
2configure and the source code.
3
4Upstream-Status: Submitted (http://lists.gnu.org/archive/html/bug-readline/2014-05/msg00008.html)
5Signed-off-by: Ross Burton <ross.burton@intel.com>
6
7From e48656811550774892fd4e0f4b3c7d418422da52 Mon Sep 17 00:00:00 2001
8From: Ross Burton <ross.burton@intel.com>
9Date: Tue, 27 May 2014 22:32:31 +0100
10Subject: [PATCH] config.h.in: fix names of STRUCT_DIRENT_D symbols
11
12---
13 config.h.in | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/config.h.in b/config.h.in
17index a67e43e..a42acc5 100644
18--- a/config.h.in
19+++ b/config.h.in
20@@ -244,9 +244,9 @@
21
22 #undef HAVE_GETPW_DECLS
23
24-#undef STRUCT_DIRENT_HAS_D_INO
25+#undef HAVE_STRUCT_DIRENT_D_INO
26
27-#undef STRUCT_DIRENT_HAS_D_FILENO
28+#undef HAVE_STRUCT_DIRENT_D_FILENO
29
30 #undef HAVE_BSD_SIGNALS
31
32--
331.7.10.4
34
diff --git a/meta/recipes-core/readline/files/norpath.patch b/meta/recipes-core/readline/files/norpath.patch
new file mode 100644
index 0000000000..5d71582b70
--- /dev/null
+++ b/meta/recipes-core/readline/files/norpath.patch
@@ -0,0 +1,21 @@
1This support script ends up hardcoding unnecessary rpaths into the libraries. We
2will search $libdir automatically so this is just wastes space. There may be some
3cases this is necessary but our use cases aren't one of them.
4
5Upstream-Status: Inappropriate
6
7RP 2012/2/23
8
9Index: readline-6.2/support/shobj-conf
10===================================================================
11--- readline-6.2.orig/support/shobj-conf 2012-02-23 11:06:37.193179379 +0000
12+++ readline-6.2/support/shobj-conf 2012-02-23 11:06:50.049178918 +0000
13@@ -114,7 +114,7 @@
14 SHOBJ_LD='${CC}'
15 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
16
17- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
18+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
19 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
20 ;;
21
diff --git a/meta/recipes-core/readline/readline-5.2/configure-fix.patch b/meta/recipes-core/readline/readline-5.2/configure-fix.patch
new file mode 100644
index 0000000000..be60a9861e
--- /dev/null
+++ b/meta/recipes-core/readline/readline-5.2/configure-fix.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Pending
2
3Without this it fails to link against libtermcap causing various missing symbols
4issues.
5
6RP - 8/10/08
7
8Index: readline-5.2/configure.in
9===================================================================
10--- readline-5.2.orig/configure.in 2008-10-08 09:58:52.000000000 +0100
11+++ readline-5.2/configure.in 2008-10-08 09:59:03.000000000 +0100
12@@ -211,10 +211,10 @@
13 AC_MSG_CHECKING(configuration for building shared libraries)
14 eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
15
16-# case "$SHLIB_LIBS" in
17-# *curses*|*termcap*|*termlib*) ;;
18-# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
19-# esac
20+ case "$SHLIB_LIBS" in
21+ *curses*|*termcap*|*termlib*) ;;
22+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
23+ esac
24
25 AC_SUBST(SHOBJ_CC)
26 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
new file mode 100644
index 0000000000..3166b470f2
--- /dev/null
+++ b/meta/recipes-core/readline/readline-5.2/fix-redundant-rpath.patch
@@ -0,0 +1,21 @@
1This support script ends up hardcoding unnecessary rpaths into the libraries. We
2will search $libdir automatically so this is just wastes space. There may be some
3cases this is necessary but our use cases aren't one of them.
4
5Upstream-Status: Inappropriate
6
7Signed-off-by: Saul Wold <sgw@linux.intel.com>
8
9Index: readline-5.2/support/shobj-conf
10===================================================================
11--- readline-5.2.orig/support/shobj-conf
12+++ readline-5.2/support/shobj-conf
13@@ -110,7 +110,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
14 SHOBJ_LD='${CC}'
15 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
16
17- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
18+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
19 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
20 ;;
21
diff --git a/meta/recipes-core/readline/readline-6.3/configure-fix.patch b/meta/recipes-core/readline/readline-6.3/configure-fix.patch
new file mode 100644
index 0000000000..ef3104f8a6
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.3/configure-fix.patch
@@ -0,0 +1,35 @@
1Upstream-Status: Pending
2
3Without this it fails to link against libtermcap causing various missing
4symbols issues.
5
6RP - 8/10/08
7
8Support 6.3 which uses configure.ac rather than configure.in.
9Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
10---
11 configure.ac | 8 ++++----
12 1 file changed, 4 insertions(+), 4 deletions(-)
13
14diff --git a/configure.ac b/configure.ac
15index cea8f91..9075b8f 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -218,10 +218,10 @@ if test -f ${srcdir}/support/shobj-conf; then
19 AC_MSG_CHECKING(configuration for building shared libraries)
20 eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh} ${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v ${host_vendor}`
21
22-# case "$SHLIB_LIBS" in
23-# *curses*|*termcap*|*termlib*) ;;
24-# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
25-# esac
26+ case "$SHLIB_LIBS" in
27+ *curses*|*termcap*|*termlib*) ;;
28+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
29+ esac
30
31 AC_SUBST(SHOBJ_CC)
32 AC_SUBST(SHOBJ_CFLAGS)
33--
341.8.1.2
35
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
new file mode 100644
index 0000000000..54d1ac6eb9
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.3/readline-dispatch-multikey.patch
@@ -0,0 +1,32 @@
1From 8ef852a5be72c75e17f2510bea52455f809b56ce Mon Sep 17 00:00:00 2001
2From: Chet Ramey <chet.ramey@case.edu>
3Date: Fri, 28 Mar 2014 14:07:42 -0400
4Subject: [PATCH 04/10] Readline-6.3 patch 2
5
6Fixes multi-key issue identified in this thread:
7http://lists.gnu.org/archive/html/bug-readline/2014-03/msg00010.html
8
9Upstream-Status: Backport
10
11Signed-off-by: Saul Wold <sgw@linux.intel.com>
12---
13 readline.c | 3 ++-
14 1 files changed, 2 insertions(+), 1 deletions(-)
15
16diff --git a/readline.c b/readline.c
17index eb4eae3..abb29a0 100644
18--- a/readline.c
19+++ b/readline.c
20@@ -744,7 +744,8 @@ _rl_dispatch_callback (cxt)
21 r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
22
23 RL_CHECK_SIGNALS ();
24- if (r == 0) /* success! */
25+ /* We only treat values < 0 specially to simulate recursion. */
26+ if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
27 {
28 _rl_keyseq_chain_dispose ();
29 RL_UNSETSTATE (RL_STATE_MULTIKEY);
30--
311.8.3.1
32
diff --git a/meta/recipes-core/readline/readline-6.3/readline63-003 b/meta/recipes-core/readline/readline-6.3/readline63-003
new file mode 100644
index 0000000000..98a9d810b6
--- /dev/null
+++ b/meta/recipes-core/readline/readline-6.3/readline63-003
@@ -0,0 +1,43 @@
1readline: Security Advisory - readline - CVE-2014-2524
2
3Upstream-Status: Backport
4
5Signed-off-by: Yue Tao <yue.tao@windriver.com>
6
7 READLINE PATCH REPORT
8 =====================
9
10Readline-Release: 6.3
11Patch-ID: readline63-003
12
13Bug-Reported-by:
14Bug-Reference-ID:
15Bug-Reference-URL:
16
17Bug-Description:
18
19There are debugging functions in the readline release that are theoretically
20exploitable as security problems. They are not public functions, but have
21global linkage.
22
23Patch (apply with `patch -p0'):
24
25*** ../readline-6.3/util.c 2013-09-02 13:36:12.000000000 -0400
26--- util.c 2014-03-20 10:25:53.000000000 -0400
27***************
28*** 477,480 ****
29--- 479,483 ----
30 }
31
32+ #if defined (DEBUG)
33 #if defined (USE_VARARGS)
34 static FILE *_rl_tracefp;
35***************
36*** 539,542 ****
37--- 542,546 ----
38 }
39 #endif
40+ #endif /* DEBUG */
41
42
43
diff --git a/meta/recipes-core/readline/readline.inc b/meta/recipes-core/readline/readline.inc
new file mode 100644
index 0000000000..0ce3b519e6
--- /dev/null
+++ b/meta/recipes-core/readline/readline.inc
@@ -0,0 +1,41 @@
1SUMMARY = "Library for editing typed command lines"
2DESCRIPTION = "The GNU Readline library provides a set of functions for use by applications that allow users to edit \
3command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes \
4additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \
5lines, and perform csh-like history expansion on previous commands."
6SECTION = "libs"
7
8# GPLv2+ (< 6.0), GPLv3+ (>= 6.0)
9LICENSE = "GPLv3+"
10LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
11
12DEPENDS += "ncurses"
13
14SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
15 file://configure-fix.patch \
16 file://config-dirent-symbols.patch \
17 file://norpath.patch"
18
19S = "${WORKDIR}/${BPN}-${PV}"
20
21inherit autotools texinfo
22
23EXTRA_AUTORECONF += "--exclude=autoheader"
24
25LEAD_SONAME = "libreadline.so"
26
27do_configure_prepend () {
28 if [ ! -e ${S}/acinclude.m4 ]; then
29 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
30 fi
31}
32
33do_install_append () {
34 # Make install doesn't properly install these
35 oe_libinstall -so -C shlib libhistory ${D}${libdir}
36 oe_libinstall -so -C shlib libreadline ${D}${libdir}
37
38 rmdir ${D}${bindir}
39}
40
41BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/readline/readline_5.2.bb b/meta/recipes-core/readline/readline_5.2.bb
new file mode 100644
index 0000000000..fe610e3964
--- /dev/null
+++ b/meta/recipes-core/readline/readline_5.2.bb
@@ -0,0 +1,86 @@
1SUMMARY = "Library for editing typed command lines"
2DESCRIPTION = "The GNU Readline library provides a set of functions for use by applications that allow users to edit \
3command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes \
4additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those \
5lines, and perform csh-like history expansion on previous commands."
6SECTION = "libs"
7
8LICENSE = "GPLv2+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=03b36fdd84f74b8d8189a202b980b67f"
10
11DEPENDS += "ncurses"
12
13PR = "r9"
14
15SRC_URI = "${GNU_MIRROR}/readline/${BPN}-${PV}.tar.gz;name=archive \
16 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-001;name=patch1;apply=yes;striplevel=0 \
17 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-002;name=patch2;apply=yes;striplevel=0 \
18 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-003;name=patch3;apply=yes;striplevel=0 \
19 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-004;name=patch4;apply=yes;striplevel=0 \
20 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-005;name=patch5;apply=yes;striplevel=0 \
21 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-006;name=patch6;apply=yes;striplevel=0 \
22 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-007;name=patch7;apply=yes;striplevel=0 \
23 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-008;name=patch8;apply=yes;striplevel=0 \
24 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-009;name=patch9;apply=yes;striplevel=0 \
25 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-010;name=patch10;apply=yes;striplevel=0 \
26 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-011;name=patch11;apply=yes;striplevel=0 \
27 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-012;name=patch12;apply=yes;striplevel=0 \
28 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-013;name=patch13;apply=yes;striplevel=0 \
29 ${GNU_MIRROR}/readline/readline-5.2-patches/readline52-014;name=patch14;apply=yes;striplevel=0 \
30 file://configure-fix.patch \
31 file://config-dirent-symbols.patch \
32 file://fix-redundant-rpath.patch"
33
34SRC_URI[archive.md5sum] = "e39331f32ad14009b9ff49cc10c5e751"
35SRC_URI[archive.sha256sum] = "12e88d96aee2cd1192500356f0535540db499282ca7f76339fb4228c31249f45"
36
37SRC_URI[patch1.md5sum] = "9d4d41622aa9b230c57f68548ce87d8f"
38SRC_URI[patch1.sha256sum] = "eac304c369154059f93049ada328739faaf40338d3cb1fb4b544c93d5ce3f8d5"
39SRC_URI[patch2.md5sum] = "f03e512d14206e37f7d6a748b56b9476"
40SRC_URI[patch2.sha256sum] = "9deacaef25507a0c2ae0b661bf9342559b59a2954d66ea3c5f5bcd900fdfcf78"
41SRC_URI[patch3.md5sum] = "252b42d8750f1a94b6bdf086612dceb2"
42SRC_URI[patch3.sha256sum] = "2a55d2ecb1c9b0147aeb193a6323616ab31c1c525a83b2db3a994b15594ba934"
43SRC_URI[patch4.md5sum] = "a32333c2e603a3ed250514e91050e552"
44SRC_URI[patch4.sha256sum] = "a03b65633781efa7c3aae5d57162985e7b7a3c10acf0f2621be610e16f27e5f2"
45SRC_URI[patch5.md5sum] = "8106796c09b789523a3a78ab69c04b6d"
46SRC_URI[patch5.sha256sum] = "06001896514148a757ea6edbbd40c4fc4331dc653847244386c37b138b150f64"
47SRC_URI[patch6.md5sum] = "512188e2bf0837f7eca19dbf71f182ae"
48SRC_URI[patch6.sha256sum] = "dfef3e982c0adf8bb5a9b7d0468ec8f5f18138b325e28759437464de5be71013"
49SRC_URI[patch7.md5sum] = "ac17aca62eb6fb398c9f2fe9de540aff"
50SRC_URI[patch7.sha256sum] = "775b028c7b761397ac6ae1bdfbac7e896dc3b9b3adc2f91312499180ca13bdd1"
51SRC_URI[patch8.md5sum] = "2484c392db021905f112cf97a94dfd4c"
52SRC_URI[patch8.sha256sum] = "a21b4e0bf0530b878bad24d5be23d18a9e03a75a31ae30844dc0933bb3d77ecd"
53SRC_URI[patch9.md5sum] = "fc6eb35d07914fae5c57d49c12483ff7"
54SRC_URI[patch9.sha256sum] = "138d5e0f0709a47a2d1621295a3dd5e3cc73b63b5cc28dab03abc4e94fe95ecf"
55SRC_URI[patch10.md5sum] = "7a2bf3dc7ac7680b1461a5701100e91b"
56SRC_URI[patch10.sha256sum] = "83f8c1aadb86b1a2fad8821a9c6be72a8de5afd7fd9fde58a30b3b57d939693e"
57SRC_URI[patch11.md5sum] = "ef6cef6822663470f6ac8c517c5a7ec6"
58SRC_URI[patch11.sha256sum] = "08ad3384ab0906e6fa4cc417eb8c43ff59375bcead15fd5c8e31730f0413b3d6"
59SRC_URI[patch12.md5sum] = "e3e9f441c8111589855bc363e5640f6c"
60SRC_URI[patch12.sha256sum] = "20f0243be2299c23213492cc2c19cfd15cc528d2b566a76a2de58306bb9e4c9e"
61SRC_URI[patch13.md5sum] = "3e2e5f543ed268a68fd1fa839faade1a"
62SRC_URI[patch13.sha256sum] = "0cc649516a5bdfa61c5e56937407570288b6972d75aa1bd060ad30ebe98144d5"
63SRC_URI[patch14.md5sum] = "a1be30e1c6f1099bb5fcef00a2631fb8"
64SRC_URI[patch14.sha256sum] = "6f1a68320d01522ca1ea5a737124ecc8739f3dcbfea2dee21e3ccf839a21a817"
65
66S = "${WORKDIR}/${BPN}-${PV}"
67
68inherit autotools
69
70EXTRA_AUTORECONF += "--exclude=autoheader"
71
72LEAD_SONAME = "libreadline.so"
73
74do_configure_prepend () {
75 if [ ! -e ${S}/acinclude.m4 ]; then
76 cat ${S}/aclocal.m4 > ${S}/acinclude.m4
77 fi
78}
79
80do_install_append () {
81 # Make install doesn't properly install these
82 oe_libinstall -so -C shlib libhistory ${D}${libdir}
83 oe_libinstall -so -C shlib libreadline ${D}${libdir}
84}
85
86BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/readline/readline_6.3.bb b/meta/recipes-core/readline/readline_6.3.bb
new file mode 100644
index 0000000000..55964a6cf8
--- /dev/null
+++ b/meta/recipes-core/readline/readline_6.3.bb
@@ -0,0 +1,8 @@
1require readline.inc
2
3SRC_URI += "file://readline63-003 \
4 file://readline-dispatch-multikey.patch"
5
6SRC_URI[archive.md5sum] = "33c8fb279e981274f485fd91da77e94a"
7SRC_URI[archive.sha256sum] = "56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43"
8
diff --git a/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/obsolete_automake_macros.patch b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/obsolete_automake_macros.patch
new file mode 100644
index 0000000000..9d828d7026
--- /dev/null
+++ b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/obsolete_automake_macros.patch
@@ -0,0 +1,15 @@
1Upstream-Status: Submitted [http://sourceforge.net/tracker/?func=detail&aid=3600345&group_id=44427&atid=439544]
2
3Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
4diff -Nurd sysfsutils-2.1.0/configure.ac sysfsutils-2.1.0/configure.ac
5--- sysfsutils-2.1.0/configure.ac 2006-08-07 08:08:00.000000000 +0300
6+++ sysfsutils-2.1.0/configure.ac 2013-01-11 08:13:08.651550634 +0200
7@@ -2,7 +2,7 @@
8 AC_INIT(sysfsutils, 2.1.0, linux-diag-devel@lists.sourceforge.net)
9 AM_INIT_AUTOMAKE
10 AC_CONFIG_SRCDIR([config.h.in])
11-AM_CONFIG_HEADER([config.h])
12+AC_CONFIG_HEADERS([config.h])
13
14 # Checks for KLIBC support (should be before AC_PROG_LIBTOOL and AC_PROG_CC)
15 AC_CHECK_KLIBC
diff --git a/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/separatebuild.patch b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/separatebuild.patch
new file mode 100644
index 0000000000..82e725e2ac
--- /dev/null
+++ b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/separatebuild.patch
@@ -0,0 +1,65 @@
1Upstream-Status: Pending
2
3Fix out of tree build issues so ${B} != ${S} works.
4
5RP 2013/03/18
6
7Index: sysfsutils-2.1.0/cmd/Makefile.am
8===================================================================
9--- sysfsutils-2.1.0.orig/cmd/Makefile.am 2013-03-08 08:57:27.224556508 +0000
10+++ sysfsutils-2.1.0/cmd/Makefile.am 2013-03-08 08:57:27.480556502 +0000
11@@ -1,6 +1,6 @@
12 bin_PROGRAMS = systool
13 systool_SOURCES = systool.c names.c names.h
14-INCLUDES = -I../include
15+INCLUDES = -I$(srcdir)/../include
16 LDADD = ../lib/libsysfs.la
17 EXTRA_CFLAGS = @EXTRA_CFLAGS@
18 AM_CFLAGS = -Wall -W -Wstrict-prototypes $(EXTRA_CFLAGS)
19Index: sysfsutils-2.1.0/lib/Makefile.am
20===================================================================
21--- sysfsutils-2.1.0.orig/lib/Makefile.am 2013-03-08 08:57:27.224556508 +0000
22+++ sysfsutils-2.1.0/lib/Makefile.am 2013-03-08 08:57:27.480556502 +0000
23@@ -1,7 +1,7 @@
24 lib_LTLIBRARIES = libsysfs.la
25 libsysfs_la_SOURCES = sysfs_utils.c sysfs_attr.c sysfs_class.c dlist.c \
26 sysfs_device.c sysfs_driver.c sysfs_bus.c sysfs_module.c sysfs.h
27-INCLUDES = -I../include
28+INCLUDES = -I$(srcdir)/../include
29 libsysfs_la_LDFLAGS = -version-info 2:1:0
30 EXTRA_CFLAGS = @EXTRA_CLFAGS@
31 libsysfs_la_CFLAGS = -Wall -W -Wstrict-prototypes $(EXTRA_CLFAGS)
32Index: sysfsutils-2.1.0/test/Makefile.am
33===================================================================
34--- sysfsutils-2.1.0.orig/test/Makefile.am 2013-03-08 08:57:27.224556508 +0000
35+++ sysfsutils-2.1.0/test/Makefile.am 2013-03-08 09:06:48.196543326 +0000
36@@ -2,14 +2,14 @@
37 BUILT_SOURCES = test.h
38 CLEANFILES = test.h
39 test.h:
40- ./create-test
41+ $(srcdir)/create-test $(srcdir)/libsysfs.conf
42 get_device_SOURCES = get_device.c
43 get_driver_SOURCES = get_driver.c
44 get_module_SOURCES = get_module.c
45 testlibsysfs_SOURCES = test.c test_attr.c test_bus.c test_class.c \
46 test_device.c test_driver.c test_module.c test_utils.c \
47 testout.c test-defs.h libsysfs.conf create-test
48-INCLUDES = -I../include
49+INCLUDES = -I$(srcdir)/../include
50 LDADD = ../lib/libsysfs.la
51 EXTRA_CFLAGS = @EXTRA_CLFAGS@
52 AM_CFLAGS = -Wall -W -Wstrict-prototypes $(EXTRA_CLFAGS)
53Index: sysfsutils-2.1.0/test/create-test
54===================================================================
55--- sysfsutils-2.1.0.orig/test/create-test 2005-11-28 10:22:10.000000000 +0000
56+++ sysfsutils-2.1.0/test/create-test 2013-03-08 09:07:03.372542838 +0000
57@@ -2,7 +2,7 @@
58
59 rm -f test.h
60
61-conf_file=./libsysfs.conf
62+conf_file=$1
63
64 . $conf_file
65
diff --git a/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/sysfsutils-2.0.0-class-dup.patch b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/sysfsutils-2.0.0-class-dup.patch
new file mode 100644
index 0000000000..1a35b7897a
--- /dev/null
+++ b/meta/recipes-core/sysfsutils/sysfsutils-2.1.0/sysfsutils-2.0.0-class-dup.patch
@@ -0,0 +1,23 @@
1Upstream-Status: Backport [from fedora core 9]
2
3This patch is from the Fedora Core 9 sysfsutils-2.1.0-3.fc9 package.
4
5It fixes a problem in the upstream package where not all devices
6will be returned by the function.
7
8The package License indicates this is GPLv2 licensed.
9
10Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
11
12diff -puN lib/sysfs_class.c~sysfsutils_class_dup lib/sysfs_class.c
13--- sysfsutils-2.1.0/lib/sysfs_class.c~sysfsutils_class_dup 2006-09-07 17:01:26.000000000 -0500
14+++ sysfsutils-2.1.0-bjking1/lib/sysfs_class.c 2006-09-07 17:01:26.000000000 -0500
15@@ -66,7 +66,7 @@ static int cdev_name_equal(void *a, void
16 return 0;
17
18 if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name,
19- strlen((char *)a)) == 0)
20+ SYSFS_NAME_LEN) == 0)
21 return 1;
22
23 return 0;
diff --git a/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb b/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb
new file mode 100644
index 0000000000..1d9c476431
--- /dev/null
+++ b/meta/recipes-core/sysfsutils/sysfsutils_2.1.0.bb
@@ -0,0 +1,29 @@
1SUMMARY = "Tools for working with sysfs"
2DESCRIPTION = "Tools for working with the sysfs virtual filesystem. The tool 'systool' can query devices by bus, class and topology."
3HOMEPAGE = "http://linux-diag.sourceforge.net/Sysfsutils.html"
4
5LICENSE = "GPLv2 & LGPLv2.1"
6LICENSE_${PN} = "GPLv2"
7LICENSE_libsysfs = "LGPLv2.1"
8LIC_FILES_CHKSUM = "file://COPYING;md5=3d06403ea54c7574a9e581c6478cc393 \
9 file://cmd/GPL;md5=d41d4e2e1e108554e0388ea4aecd8d27 \
10 file://lib/LGPL;md5=b75d069791103ffe1c0d6435deeff72e"
11PR = "r5"
12
13SRC_URI = "${SOURCEFORGE_MIRROR}/linux-diag/sysfsutils-${PV}.tar.gz \
14 file://sysfsutils-2.0.0-class-dup.patch \
15 file://obsolete_automake_macros.patch \
16 file://separatebuild.patch"
17
18SRC_URI[md5sum] = "14e7dcd0436d2f49aa403f67e1ef7ddc"
19SRC_URI[sha256sum] = "e865de2c1f559fff0d3fc936e660c0efaf7afe662064f2fb97ccad1ec28d208a"
20S = "${WORKDIR}/sysfsutils-${PV}"
21
22inherit autotools
23
24PACKAGES =+ "libsysfs libsysfs-dev libsysfs-staticdev"
25FILES_libsysfs = "${libdir}/lib*${SOLIBS}"
26FILES_libsysfs-dev = "${libdir}/lib*${SOLIBSDEV} ${includedir}"
27FILES_libsysfs-staticdev = "${libdir}/lib*.a"
28
29export libdir = "${base_libdir}"
diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
new file mode 100644
index 0000000000..6419bc2c65
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -0,0 +1,41 @@
1SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
5
6PR = "r29"
7
8DEPENDS = "systemd-systemctl-native"
9
10inherit allarch
11
12ALLOW_EMPTY_${PN} = "1"
13
14SYSTEMD_DISABLED_SYSV_SERVICES = " \
15 busybox-udhcpc \
16 hwclock \
17 networking \
18 nfsserver \
19 nfscommon \
20 syslog.busybox \
21"
22
23pkg_postinst_${PN} () {
24 cd $D${sysconfdir}/init.d
25
26 echo "Disabling the following sysv scripts: "
27
28 OPTS=""
29
30 if [ -n "$D" ]; then
31 OPTS="--root=$D"
32 fi
33
34 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
35 if [ \( -e $i -o $i.sh \) -a ! \( -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service \) ] ; then
36 echo -n "$i: " ; systemctl ${OPTS} mask $i.service
37 fi
38 done ; echo
39}
40
41RDPEPENDS_${PN} = "systemd"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
new file mode 100644
index 0000000000..1c34d5c747
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -0,0 +1,49 @@
1SUMMARY = "Serial terminal support for systemd"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
5PR = "r5"
6
7SERIAL_CONSOLE ?= "115200 ttyS0"
8
9SRC_URI = "file://serial-getty@.service"
10
11do_install() {
12 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
13 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
14 install -d ${D}${systemd_unitdir}/system/
15 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
16 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
17 sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service
18
19 tmp="${SERIAL_CONSOLES}"
20 for entry in $tmp ; do
21 baudrate=`echo $entry | sed 's/\;.*//'`
22 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
23 if [ "$baudrate" = "$default_baudrate" ] ; then
24 # enable the service
25 ln -sf ${systemd_unitdir}/system/serial-getty@.service \
26 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
27 else
28 # install custom service file for the non-default baudrate
29 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
30 sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
31 # enable the service
32 ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \
33 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
34 fi
35 done
36 fi
37}
38
39RDEPENDS_${PN} = "systemd"
40
41# This is a machine specific file
42FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
43PACKAGE_ARCH = "${MACHINE_ARCH}"
44
45# As this package is tied to systemd, only build it when we're also building systemd.
46python () {
47 if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
48 raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
49}
diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
new file mode 100644
index 0000000000..6dd335c0bc
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
@@ -0,0 +1,37 @@
1# This file is part of systemd.
2#
3# systemd is free software; you can redistribute it and/or modify it
4# under the terms of the GNU Lesser General Public License as published by
5# the Free Software Foundation; either version 2.1 of the License, or
6# (at your option) any later version.
7
8[Unit]
9Description=Serial Getty on %I
10Documentation=man:agetty(8) man:systemd-getty-generator(8)
11Documentation=http://0pointer.de/blog/projects/serial-console.html
12BindsTo=dev-%i.device
13After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
14After=rc-local.service
15
16# If additional gettys are spawned during boot then we should make
17# sure that this is synchronized before getty.target, even though
18# getty.target didn't actually pull it in.
19Before=getty.target
20IgnoreOnIsolate=yes
21
22[Service]
23Environment="TERM=xterm"
24ExecStart=-/sbin/agetty -8 --keep-baud %I @BAUDRATE@ $TERM
25Type=idle
26Restart=always
27RestartSec=0
28UtmpIdentifier=%I
29TTYPath=/dev/%I
30TTYReset=yes
31TTYVHangup=yes
32KillMode=process
33IgnoreSIGPIPE=no
34SendSIGHUP=yes
35
36[Install]
37WantedBy=getty.target
diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb
new file mode 100644
index 0000000000..72bc77df4f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb
@@ -0,0 +1,15 @@
1SUMMARY = "Wrapper for enabling systemd services"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
5
6PR = "r6"
7
8inherit native
9
10SRC_URI = "file://systemctl"
11
12do_install() {
13 install -d ${D}${bindir}
14 install -m 0755 ${WORKDIR}/systemctl ${D}${bindir}
15}
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
new file mode 100755
index 0000000000..b37f27abfb
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -0,0 +1,153 @@
1#!/bin/sh
2echo "Started $0 $*"
3
4ROOT=
5
6# parse command line params
7action=
8while [ $# != 0 ]; do
9 opt="$1"
10
11 case "$opt" in
12 enable)
13 shift
14
15 action="$opt"
16 services="$1"
17 cmd_args="1"
18 shift
19 ;;
20 disable)
21 shift
22
23 action="$opt"
24 services="$1"
25 cmd_args="1"
26 shift
27 ;;
28 mask)
29 shift
30
31 action="$opt"
32 services="$1"
33 cmd_args="1"
34 shift
35 ;;
36 preset)
37 shift
38
39 action="$opt"
40 services="$1"
41 cmd_args="1"
42 shift
43 ;;
44 --root=*)
45 ROOT=${opt##--root=}
46 cmd_args="0"
47 shift
48 ;;
49 *)
50 if [ "$cmd_args" = "1" ]; then
51 services="$services $opt"
52 shift
53 else
54 echo "'$opt' is an unkown option; exiting with error"
55 exit 1
56 fi
57 ;;
58 esac
59done
60if [ "$action" = "preset" -a "$service_file" = "" ]; then
61 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)
62 services="$services $opt"
63 presetall=1
64fi
65
66for service in $services; do
67 if [ "$presetall" = "1" ]; then
68 action="preset"
69 fi
70 if [ "$action" = "mask" ]; then
71 if [ ! -d $ROOT/etc/systemd/system/ ]; then
72 mkdir -p $ROOT/etc/systemd/system/
73 fi
74 cmd="ln -s /dev/null $ROOT/etc/systemd/system/$service"
75 echo "$cmd"
76 $cmd
77 exit 0
78 fi
79
80 echo "Try to find location of $service..."
81 # find service file
82 for p in $ROOT/etc/systemd/system \
83 $ROOT/lib/systemd/system \
84 $ROOT/usr/lib/systemd/system; do
85 if [ -e $p/$service ]; then
86 service_file=$p/$service
87 service_file=${service_file##$ROOT}
88 fi
89 done
90 if [ -z "$service_file" ]; then
91 echo "'$service' couldn't be found; exiting with error"
92 exit 1
93 fi
94 echo "Found $service in $service_file"
95
96 # If any new unit types are added to systemd they should be added
97 # to this regular expression.
98 unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)$'
99 if [ "$action" = "preset" ]; then
100 action=`egrep -sh $service $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
101 if [ -z "$action" ]; then
102 globalpreset=`egrep -sh '\*' $ROOT/etc/systemd/user-preset/*.preset | cut -f1 -d' '`
103 if [ -n "$globalpreset" ]; then
104 action="$globalpreset"
105 else
106 action="enable"
107 fi
108 fi
109 fi
110 # create the required symbolic links
111 wanted_by=$(sed '/^WantedBy[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
112 | tr ',' '\n' \
113 | grep "$unit_types_re")
114
115 for r in $wanted_by; do
116 echo "WantedBy=$r found in $service"
117 if [ "$action" = "enable" ]; then
118 mkdir -p $ROOT/etc/systemd/system/$r.wants
119 ln -s $service_file $ROOT/etc/systemd/system/$r.wants
120 echo "Enabled $service for $wanted_by."
121 else
122 rm -f $ROOT/etc/systemd/system/$r.wants/$service
123 rmdir --ignore-fail-on-non-empty -p $ROOT/etc/systemd/system/$r.wants
124 echo "Disabled $service for $wanted_by."
125 fi
126 done
127
128 # create the required symbolic 'Alias' links
129 alias=$(sed '/^Alias[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
130 | tr ',' '\n' \
131 | grep "$unit_types_re")
132
133 for r in $alias; do
134 if [ "$action" = "enable" ]; then
135 mkdir -p $ROOT/etc/systemd/system
136 ln -s $service_file $ROOT/etc/systemd/system/$r
137 echo "Enabled $service for $alias."
138 else
139 rm -f $ROOT/etc/systemd/system/$r
140 echo "Disabled $service for $alias."
141 fi
142 done
143
144 # call us for the other required scripts
145 also=$(sed '/^Also[[:space:]]*=/s,[^=]*=,,p;d' "$ROOT/$service_file" \
146 | tr ',' '\n')
147 for a in $also; do
148 echo "Also=$a found in $service"
149 if [ "$action" = "enable" ]; then
150 $0 --root=$ROOT enable $a
151 fi
152 done
153done
diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
new file mode 100644
index 0000000000..9ffa88e464
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf
@@ -0,0 +1,7 @@
1#This goes hand-in-hand with the base-files of OE-Core. The file must
2# be sorted before 'systemd.conf' becuase this attempts to create a file
3# inside /var/log.
4
5
6d /var/volatile/log - - - -
7d /var/volatile/tmp - - - -
diff --git a/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
new file mode 100644
index 0000000000..c5ad29174c
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-Make-root-s-home-directory-configurable.patch
@@ -0,0 +1,180 @@
1From 4dc8dee0435bb63cbe474004b0a8df0363fe94dd Mon Sep 17 00:00:00 2001
2From: Dan McGregor <dan.mcgregor@usask.ca>
3Date: Fri, 5 Sep 2014 06:28:58 -0600
4Subject: [PATCH] Make root's home directory configurable.
5
6OpenEmbedded has a configurable home directory for root. Allow
7systemd to be built using its idea of what root's home directory
8should be.
9
10Upstream-Status: Pending
11
12Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
13---
14 Makefile.am | 2 ++
15 configure.ac | 7 +++++++
16 src/core/unit-printf.c | 2 +-
17 src/nspawn/nspawn.c | 4 ++--
18 src/shared/util.c | 4 ++--
19 units/console-shell.service.m4.in | 4 ++--
20 units/emergency.service.in | 4 ++--
21 units/rescue.service.m4.in | 4 ++--
22 8 files changed, 20 insertions(+), 11 deletions(-)
23
24diff --git a/Makefile.am b/Makefile.am
25index 4028112..5d18f5c 100644
26--- a/Makefile.am
27+++ b/Makefile.am
28@@ -191,6 +191,7 @@ AM_CPPFLAGS = \
29 -DKEXEC=\"$(KEXEC)\" \
30 -DLIBDIR=\"$(libdir)\" \
31 -DROOTLIBDIR=\"$(rootlibdir)\" \
32+ -DROOTHOMEDIR=\"$(roothomedir)\" \
33 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
34 -I $(top_srcdir)/src \
35 -I $(top_builddir)/src/shared \
36@@ -5584,6 +5585,7 @@ EXTRA_DIST += \
37 substitutions = \
38 '|rootlibexecdir=$(rootlibexecdir)|' \
39 '|rootbindir=$(rootbindir)|' \
40+ '|roothomedir=$(roothomedir)|' \
41 '|bindir=$(bindir)|' \
42 '|SYSTEMCTL=$(rootbindir)/systemctl|' \
43 '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
44diff --git a/configure.ac b/configure.ac
45index 18b7198..365bc73 100644
46--- a/configure.ac
47+++ b/configure.ac
48@@ -1272,6 +1272,11 @@ AC_ARG_WITH([rootlibdir],
49 [],
50 [with_rootlibdir=${libdir}])
51
52+AC_ARG_WITH([roothomedir],
53+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]),
54+ [],
55+ [with_roothomedir=/root])
56+
57 AC_ARG_WITH([pamlibdir],
58 AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
59 [],
60@@ -1317,6 +1322,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir])
61 AC_SUBST([pamconfdir], [$with_pamconfdir])
62 AC_SUBST([rootprefix], [$with_rootprefix])
63 AC_SUBST([rootlibdir], [$with_rootlibdir])
64+AC_SUBST([roothomedir], [$with_roothomedir])
65
66 AC_CONFIG_FILES([
67 Makefile po/Makefile.in
68@@ -1400,6 +1406,7 @@ AC_MSG_RESULT([
69 include_prefix: ${INCLUDE_PREFIX}
70 lib dir: ${libdir}
71 rootlib dir: ${with_rootlibdir}
72+ root home dir: ${with_roothomedir}
73 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
74 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
75 Build Python: ${PYTHON}
76diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
77index 62599d0..852d34c 100644
78--- a/src/core/unit-printf.c
79+++ b/src/core/unit-printf.c
80@@ -259,7 +259,7 @@ static int specifier_user_home(char specifier, void *data, void *userdata, char
81 * best of it if we can, but fail if we can't */
82
83 if (!c->user || streq(c->user, "root") || streq(c->user, "0"))
84- n = strdup("/root");
85+ n = strdup(ROOTHOMEDIR);
86 else
87 return -ENOTSUP;
88
89diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
90index d01da45..3e876d5 100644
91--- a/src/nspawn/nspawn.c
92+++ b/src/nspawn/nspawn.c
93@@ -3312,7 +3312,7 @@ int main(int argc, char *argv[]) {
94 if (r < 0)
95 _exit(EXIT_FAILURE);
96
97- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) ||
98+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) ||
99 (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) ||
100 (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) {
101 log_oom();
102@@ -3402,7 +3402,7 @@ int main(int argc, char *argv[]) {
103 } else if (argc > optind)
104 execvpe(argv[optind], argv + optind, env_use);
105 else {
106- chdir(home ? home : "/root");
107+ chdir(home ? home : ROOTHOMEDIR);
108 execle("/bin/bash", "-bash", NULL, env_use);
109 execle("/bin/sh", "-sh", NULL, env_use);
110 }
111diff --git a/src/shared/util.c b/src/shared/util.c
112index 85a570a..aef6033 100644
113--- a/src/shared/util.c
114+++ b/src/shared/util.c
115@@ -4377,7 +4377,7 @@ int get_user_creds(
116 *gid = 0;
117
118 if (home)
119- *home = "/root";
120+ *home = ROOTHOMEDIR;
121
122 if (shell)
123 *shell = "/bin/sh";
124@@ -5363,7 +5363,7 @@ int get_home_dir(char **_h) {
125 /* Hardcode home directory for root to avoid NSS */
126 u = getuid();
127 if (u == 0) {
128- h = strdup("/root");
129+ h = strdup(ROOTHOMEDIR);
130 if (!h)
131 return -ENOMEM;
132
133diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in
134index 3f4904a..e2af652 100644
135--- a/units/console-shell.service.m4.in
136+++ b/units/console-shell.service.m4.in
137@@ -15,8 +15,8 @@ After=rc-local.service
138 Before=getty.target
139
140 [Service]
141-Environment=HOME=/root
142-WorkingDirectory=/root
143+Environment=HOME=@roothomedir@
144+WorkingDirectory=@roothomedir@
145 ExecStart=-/sbin/sulogin
146 ExecStopPost=-@SYSTEMCTL@ poweroff
147 Type=idle
148diff --git a/units/emergency.service.in b/units/emergency.service.in
149index 91fc1bb..659547e 100644
150--- a/units/emergency.service.in
151+++ b/units/emergency.service.in
152@@ -13,8 +13,8 @@ Conflicts=shutdown.target
153 Before=shutdown.target
154
155 [Service]
156-Environment=HOME=/root
157-WorkingDirectory=/root
158+Environment=HOME=@roothomedir@
159+WorkingDirectory=@roothomedir@
160 ExecStartPre=-/bin/plymouth quit
161 ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
162 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
163diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in
164index ef54369..7aad86f 100644
165--- a/units/rescue.service.m4.in
166+++ b/units/rescue.service.m4.in
167@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service
168 Before=shutdown.target
169
170 [Service]
171-Environment=HOME=/root
172-WorkingDirectory=/root
173+Environment=HOME=@roothomedir@
174+WorkingDirectory=@roothomedir@
175 ExecStartPre=-/bin/plymouth quit
176 ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
177 ExecStart=-/bin/sh -c "/sbin/sulogin; @SYSTEMCTL@ --fail --no-block default"
178--
1791.9.3
180
diff --git a/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch b/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch
new file mode 100644
index 0000000000..9aa07c1b10
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-add-support-for-executing-scripts-under-etc-rcS.d.patch
@@ -0,0 +1,138 @@
1Upstream-Status: Inappropriate [OE specific]
2
3Subject: add support for executing scripts under /etc/rcS.d/
4
5To be compatible, all services translated from scripts under /etc/rcS.d would
6run before services translated from scripts under /etc/rcN.d.
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/sysv-generator/sysv-generator.c | 50 ++++++++++++++++++++++++++++---------
11 1 file changed, 38 insertions(+), 12 deletions(-)
12
13diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
14index 9a869ba..10c55c0 100644
15--- a/src/sysv-generator/sysv-generator.c
16+++ b/src/sysv-generator/sysv-generator.c
17@@ -43,7 +43,8 @@
18
19 typedef enum RunlevelType {
20 RUNLEVEL_UP,
21- RUNLEVEL_DOWN
22+ RUNLEVEL_DOWN,
23+ RUNLEVEL_SYSINIT
24 } RunlevelType;
25
26 static const struct {
27@@ -58,6 +59,9 @@ static const struct {
28 { "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP },
29 { "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP },
30
31+ /* Debian style rcS.d, also adopted by OE */
32+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT},
33+
34 /* Standard SysV runlevels for shutdown */
35 { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
36 { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
37@@ -66,7 +70,7 @@ static const struct {
38 directories in this order, and we want to make sure that
39 sysv_start_priority is known when we first load the
40 unit. And that value we only know from S links. Hence
41- UP must be read before DOWN */
42+ UP/SYSINIT must be read before DOWN */
43 };
44
45 typedef struct SysvStub {
46@@ -82,6 +86,8 @@ typedef struct SysvStub {
47 char **conflicts;
48 bool has_lsb;
49 bool reload;
50+ bool default_dependencies;
51+ bool from_rcsd;
52 } SysvStub;
53
54 const char *arg_dest = "/tmp";
55@@ -156,6 +162,9 @@ static int generate_unit_file(SysvStub *s) {
56 "Description=%s\n",
57 s->path, s->description);
58
59+ if (!s->default_dependencies)
60+ fprintf(f, "DefaultDependencies=no\n");
61+
62 if (!isempty(before))
63 fprintf(f, "Before=%s\n", before);
64 if (!isempty(after))
65@@ -661,18 +670,30 @@ static int fix_order(SysvStub *s, Hashmap *all_services) {
66 if (s->has_lsb && other->has_lsb)
67 continue;
68
69- if (other->sysv_start_priority < s->sysv_start_priority) {
70- r = strv_extend(&s->after, other->name);
71+ /* All scripts under /etc/rcS.d should execute before scripts under
72+ * /etc/rcN.d */
73+ if (!other->from_rcsd && s->from_rcsd) {
74+ r = strv_extend(&s->before, other->name);
75 if (r < 0)
76 return log_oom();
77- }
78- else if (other->sysv_start_priority > s->sysv_start_priority) {
79- r = strv_extend(&s->before, other->name);
80+ } else if (other->from_rcsd && !s->from_rcsd) {
81+ r = strv_extend(&s->after, other->name);
82 if (r < 0)
83 return log_oom();
84- }
85- else
86- continue;
87+ } else {
88+ if (other->sysv_start_priority < s->sysv_start_priority) {
89+ r = strv_extend(&s->after, other->name);
90+ if (r < 0)
91+ return log_oom();
92+ }
93+ else if (other->sysv_start_priority > s->sysv_start_priority) {
94+ r = strv_extend(&s->before, other->name);
95+ if (r < 0)
96+ return log_oom();
97+ }
98+ else
99+ continue;
100+ }
101
102 /* FIXME: Maybe we should compare the name here lexicographically? */
103 }
104@@ -725,6 +746,8 @@ static int enumerate_sysv(LookupPaths lp, Hashmap *all_services) {
105 return log_oom();
106
107 service->sysv_start_priority = -1;
108+ service->default_dependencies = true;
109+ service->from_rcsd = false;
110 service->name = name;
111 service->path = fpath;
112
113@@ -810,9 +833,11 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
114
115 if (de->d_name[0] == 'S') {
116
117- if (rcnd_table[i].type == RUNLEVEL_UP) {
118+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) {
119 service->sysv_start_priority =
120 MAX(a*10 + b, service->sysv_start_priority);
121+ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true;
122+ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false;
123 }
124
125 r = set_ensure_allocated(&runlevel_services[i],
126@@ -825,7 +850,8 @@ static int set_dependencies_from_rcnd(LookupPaths lp, Hashmap *all_services) {
127 goto finish;
128
129 } else if (de->d_name[0] == 'K' &&
130- (rcnd_table[i].type == RUNLEVEL_DOWN)) {
131+ (rcnd_table[i].type == RUNLEVEL_DOWN ||
132+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) {
133
134 r = set_ensure_allocated(&shutdown_services,
135 trivial_hash_func, trivial_compare_func);
136--
1371.9.1
138
diff --git a/meta/recipes-core/systemd/systemd/0001-build-sys-configure-the-list-of-system-users-files-a.patch b/meta/recipes-core/systemd/systemd/0001-build-sys-configure-the-list-of-system-users-files-a.patch
new file mode 100644
index 0000000000..e0043597a2
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-build-sys-configure-the-list-of-system-users-files-a.patch
@@ -0,0 +1,176 @@
1From 5a16bc264c32237e38a844d55e7a1820a31b8440 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com>
3Date: Fri, 28 Nov 2014 15:59:59 +0100
4Subject: [PATCH] build-sys: configure the list of system users, files and
5 directories
6
7Choose which system users defined in sysusers.d/systemd.conf and files
8or directories in tmpfiles.d/systemd.conf, should be provided depending
9on comile-time configuration.
10
11Upstream-Status: Backport
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 Makefile.am | 4 ++++
15 configure.ac | 2 ++
16 sysusers.d/.gitignore | 1 +
17 sysusers.d/{systemd.conf => systemd.conf.m4} | 8 ++++++++
18 tmpfiles.d/.gitignore | 3 ++-
19 tmpfiles.d/{systemd.conf => systemd.conf.m4} | 2 ++
20 6 files changed, 19 insertions(+), 1 deletion(-)
21 rename sysusers.d/{systemd.conf => systemd.conf.m4} (77%)
22 rename tmpfiles.d/{systemd.conf => systemd.conf.m4} (96%)
23
24Index: git/Makefile.am
25===================================================================
26--- git.orig/Makefile.am 2015-01-23 21:23:04.000000000 +0000
27+++ git/Makefile.am 2015-01-23 21:23:04.000000000 +0000
28@@ -5698,6 +5698,10 @@
29 $(AM_V_at)$(MKDIR_P) $(dir $@)
30 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
31
32+sysusers.d/%: sysusers.d/%.m4
33+ $(AM_V_at)$(MKDIR_P) $(dir $@)
34+ $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
35+
36 tmpfiles.d/%: tmpfiles.d/%.m4
37 $(AM_V_at)$(MKDIR_P) $(dir $@)
38 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
39Index: git/configure.ac
40===================================================================
41--- git.orig/configure.ac 2015-01-23 21:23:04.000000000 +0000
42+++ git/configure.ac 2015-01-23 21:23:04.000000000 +0000
43@@ -971,6 +971,7 @@
44 AC_ARG_ENABLE(timesyncd, AS_HELP_STRING([--disable-timesyncd], [disable timesync daemon]))
45 if test "x$enable_timesyncd" != "xno"; then
46 have_timesyncd=yes
47+ M4_DEFINES="$M4_DEFINES -DENABLE_TIMESYNCD"
48 fi
49 AM_CONDITIONAL(ENABLE_TIMESYNCD, [test "$have_timesyncd" = "yes"])
50
51@@ -1060,6 +1061,7 @@
52 AS_IF([test "x$enable_networkd" != "xno"], [
53 AC_DEFINE(ENABLE_NETWORKD, 1, [Define if networkd support is to be enabled])
54 have_networkd=yes
55+ M4_DEFINES="$M4_DEFINES -DENABLE_NETWORKD"
56 ])
57 AM_CONDITIONAL(ENABLE_NETWORKD, [test "x$have_networkd" = "xyes"])
58
59Index: git/sysusers.d/systemd.conf
60===================================================================
61--- git.orig/sysusers.d/systemd.conf 2015-01-23 21:23:02.000000000 +0000
62+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
63@@ -1,12 +0,0 @@
64-# This file is part of systemd.
65-#
66-# systemd is free software; you can redistribute it and/or modify it
67-# under the terms of the GNU Lesser General Public License as published by
68-# the Free Software Foundation; either version 2.1 of the License, or
69-# (at your option) any later version.
70-
71-g systemd-journal - -
72-u systemd-bus-proxy - "systemd Bus Proxy"
73-u systemd-network - "systemd Network Management"
74-u systemd-resolve - "systemd Resolver"
75-u systemd-timesync - "systemd Time Synchronization"
76Index: git/sysusers.d/systemd.conf.m4
77===================================================================
78--- /dev/null 1970-01-01 00:00:00.000000000 +0000
79+++ git/sysusers.d/systemd.conf.m4 2015-01-23 21:26:30.000000000 +0000
80@@ -0,0 +1,20 @@
81+# This file is part of systemd.
82+#
83+# systemd is free software; you can redistribute it and/or modify it
84+# under the terms of the GNU Lesser General Public License as published by
85+# the Free Software Foundation; either version 2.1 of the License, or
86+# (at your option) any later version.
87+
88+g systemd-journal - -
89+m4_ifdef(`ENABLE_KDBUS',
90+u systemd-bus-proxy - "systemd Bus Proxy"
91+)m4_dnl
92+m4_ifdef(`ENABLE_NETWORKD',
93+u systemd-network - "systemd Network Management"
94+)m4_dnl
95+m4_ifdef(`ENABLE_RESOLVED',
96+u systemd-resolve - "systemd Resolver"
97+)m4_dnl
98+m4_ifdef(`ENABLE_TIMESYNCD',
99+u systemd-timesync - "systemd Time Synchronization"
100+)m4_dnl
101Index: git/tmpfiles.d/systemd.conf
102===================================================================
103--- git.orig/tmpfiles.d/systemd.conf 2015-01-23 21:23:02.000000000 +0000
104+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
105@@ -1,32 +0,0 @@
106-# This file is part of systemd.
107-#
108-# systemd is free software; you can redistribute it and/or modify it
109-# under the terms of the GNU Lesser General Public License as published by
110-# the Free Software Foundation; either version 2.1 of the License, or
111-# (at your option) any later version.
112-
113-# See tmpfiles.d(5) for details
114-
115-d /run/user 0755 root root -
116-F! /run/utmp 0664 root utmp -
117-
118-d /run/systemd/ask-password 0755 root root -
119-d /run/systemd/seats 0755 root root -
120-d /run/systemd/sessions 0755 root root -
121-d /run/systemd/users 0755 root root -
122-d /run/systemd/machines 0755 root root -
123-d /run/systemd/shutdown 0755 root root -
124-d /run/systemd/netif 0755 systemd-network systemd-network -
125-d /run/systemd/netif/links 0755 systemd-network systemd-network -
126-d /run/systemd/netif/leases 0755 systemd-network systemd-network -
127-
128-d /run/log 0755 root root -
129-
130-z /run/log/journal 2755 root systemd-journal - -
131-Z /run/log/journal/%m ~2750 root systemd-journal - -
132-
133-z /var/log/journal 2755 root systemd-journal - -
134-z /var/log/journal/%m 2755 root systemd-journal - -
135-
136-d /var/lib/systemd 0755 root root -
137-d /var/lib/systemd/coredump 0755 root root 3d
138Index: git/tmpfiles.d/systemd.conf.m4
139===================================================================
140--- /dev/null 1970-01-01 00:00:00.000000000 +0000
141+++ git/tmpfiles.d/systemd.conf.m4 2015-01-23 21:26:46.000000000 +0000
142@@ -0,0 +1,34 @@
143+# This file is part of systemd.
144+#
145+# systemd is free software; you can redistribute it and/or modify it
146+# under the terms of the GNU Lesser General Public License as published by
147+# the Free Software Foundation; either version 2.1 of the License, or
148+# (at your option) any later version.
149+
150+# See tmpfiles.d(5) for details
151+
152+d /run/user 0755 root root -
153+F! /run/utmp 0664 root utmp -
154+
155+d /run/systemd/ask-password 0755 root root -
156+d /run/systemd/seats 0755 root root -
157+d /run/systemd/sessions 0755 root root -
158+d /run/systemd/users 0755 root root -
159+d /run/systemd/machines 0755 root root -
160+d /run/systemd/shutdown 0755 root root -
161+m4_ifdef(`ENABLE_NETWORKD',
162+d /run/systemd/netif 0755 systemd-network systemd-network -
163+d /run/systemd/netif/links 0755 systemd-network systemd-network -
164+d /run/systemd/netif/leases 0755 systemd-network systemd-network -
165+)m4_dnl
166+
167+d /run/log 0755 root root -
168+
169+z /run/log/journal 2755 root systemd-journal - -
170+Z /run/log/journal/%m ~2750 root systemd-journal - -
171+
172+z /var/log/journal 2755 root systemd-journal - -
173+z /var/log/journal/%m 2755 root systemd-journal - -
174+
175+d /var/lib/systemd 0755 root root -
176+d /var/lib/systemd/coredump 0755 root root 3d
diff --git a/meta/recipes-core/systemd/systemd/0001-build-sys-do-not-install-tmpfiles-and-sysusers-files.patch b/meta/recipes-core/systemd/systemd/0001-build-sys-do-not-install-tmpfiles-and-sysusers-files.patch
new file mode 100644
index 0000000000..4795f8670f
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-build-sys-do-not-install-tmpfiles-and-sysusers-files.patch
@@ -0,0 +1,56 @@
1From bedd083aaedb3bbb14ef579a047bf4b4fed56d9b Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com>
3Date: Wed, 26 Nov 2014 09:17:50 +0100
4Subject: [PATCH] build-sys: do not install tmpfiles and sysusers files by
5 default
6
7Upstream-Status: Backport
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11---
12 Makefile.am | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15diff --git a/Makefile.am b/Makefile.am
16index ddd0df1..65bb176 100644
17--- a/Makefile.am
18+++ b/Makefile.am
19@@ -2039,7 +2039,6 @@ nodist_tmpfiles_DATA = \
20 dist_tmpfiles_DATA = \
21 tmpfiles.d/systemd.conf \
22 tmpfiles.d/systemd-nologin.conf \
23- tmpfiles.d/systemd-remote.conf \
24 tmpfiles.d/tmp.conf \
25 tmpfiles.d/x11.conf \
26 tmpfiles.d/var.conf
27@@ -2094,8 +2093,7 @@ SYSINIT_TARGET_WANTS += \
28 systemd-sysusers.service
29
30 dist_sysusers_DATA = \
31- sysusers.d/systemd.conf \
32- sysusers.d/systemd-remote.conf
33+ sysusers.d/systemd.conf
34
35 nodist_sysusers_DATA = \
36 sysusers.d/basic.conf
37@@ -3839,6 +3837,16 @@ systemd_journal_remote_CFLAGS = \
38 systemd_journal_remote_LDADD += \
39 $(MICROHTTPD_LIBS)
40
41+if ENABLE_SYSUSERS
42+dist_sysusers_DATA += \
43+ sysusers.d/systemd-remote.conf
44+endif
45+
46+if ENABLE_TMPFILES
47+dist_tmpfiles_DATA += \
48+ tmpfiles.d/systemd-remote.conf
49+endif
50+
51 if HAVE_GNUTLS
52 systemd_journal_remote_LDADD += \
53 $(GNUTLS_LIBS)
54--
551.9.1
56
diff --git a/meta/recipes-core/systemd/systemd/0001-journal-Fix-navigating-backwards-missing-entries.patch b/meta/recipes-core/systemd/systemd/0001-journal-Fix-navigating-backwards-missing-entries.patch
new file mode 100644
index 0000000000..911e2ff1c1
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-journal-Fix-navigating-backwards-missing-entries.patch
@@ -0,0 +1,33 @@
1From 2173cbf847fc53ca24950e77958c902edecfc207 Mon Sep 17 00:00:00 2001
2From: Olivier Brunel <jjk@jjacky.com>
3Date: Fri, 5 Dec 2014 16:06:45 +0100
4Subject: [PATCH] journal: Fix navigating backwards missing entries
5
6With DIRECTION_UP (i.e. navigating backwards) in generic_array_bisect() when the
7needle was found as the last item in the array, it wasn't actually processed as
8match, resulting in entries being missed.
9
10https://bugs.freedesktop.org/show_bug.cgi?id=86855
11
12Upstream-Status: Backport
13
14Signed-off-by: Jonathan Liu <net147@gmail.com>
15---
16 src/journal/journal-file.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
20index 7858435..c5d2d19 100644
21--- a/src/journal/journal-file.c
22+++ b/src/journal/journal-file.c
23@@ -1657,7 +1657,7 @@ static int generic_array_bisect(
24 }
25 }
26
27- if (k > n) {
28+ if (k >= n) {
29 if (direction == DIRECTION_UP) {
30 i = n;
31 subtract_one = true;
32--
332.1.3
diff --git a/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch b/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch
new file mode 100644
index 0000000000..448ef1a917
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch
@@ -0,0 +1,29 @@
1Upstream-Status: Backport
2
3Subject: missing.h: add fake __NR_memfd_create for MIPS
4
5We don't have the correct __NR_memfd_create syscall number yet, so set it to
60xffffffff for now to prevent compile time errors.
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/shared/missing.h | 3 +++
11 1 file changed, 3 insertions(+)
12
13diff --git a/src/shared/missing.h b/src/shared/missing.h
14index 3ff1a21..3051cb5 100644
15--- a/src/shared/missing.h
16+++ b/src/shared/missing.h
17@@ -167,6 +167,9 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
18 # define __NR_fanotify_mark 5296
19 # endif
20 # endif
21+# ifndef __NR_memfd_create
22+# define __NR_memfd_create 0xffffffff /* FIXME */
23+# endif
24 #else
25 # ifndef __NR_fanotify_init
26 # define __NR_fanotify_init 338
27--
281.9.1
29
diff --git a/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch
new file mode 100644
index 0000000000..fbde13f077
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-systemd-user-avoid-using-system-auth.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Inappropriate [oe specific]
2
3Subject: systemd-user: avoid using system-auth
4
5In OE, we don't provide system-auth, instead, we use common-* files.
6So modify systemd-user file to use common-* files.
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/login/systemd-user | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/src/login/systemd-user b/src/login/systemd-user
14index 8112d74..99635af 100644
15--- a/src/login/systemd-user
16+++ b/src/login/systemd-user
17@@ -2,5 +2,5 @@
18 #
19 # Used by systemd --user instances.
20
21-account include system-auth
22-session include system-auth
23+account include common-account
24+session include common-session
25--
261.9.1
diff --git a/meta/recipes-core/systemd/systemd/0001-tmpfiles-make-resolv.conf-entry-conditional-on-resol.patch b/meta/recipes-core/systemd/systemd/0001-tmpfiles-make-resolv.conf-entry-conditional-on-resol.patch
new file mode 100644
index 0000000000..b5b0168149
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/0001-tmpfiles-make-resolv.conf-entry-conditional-on-resol.patch
@@ -0,0 +1,142 @@
1From aeb50ff0bd4bbbca74c4695072232348351d512d Mon Sep 17 00:00:00 2001
2From: Tom Gundersen <teg@jklm.no>
3Date: Wed, 27 Aug 2014 17:45:41 +0200
4Subject: [PATCH] tmpfiles: make resolv.conf entry conditional on resolved
5 support
6
7Upstream-Status: Backport
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10---
11 Makefile.am | 15 +++++++++++++--
12 TODO | 2 --
13 configure.ac | 1 +
14 tmpfiles.d/.gitignore | 1 +
15 tmpfiles.d/{etc.conf => etc.conf.m4} | 2 ++
16 5 files changed, 17 insertions(+), 4 deletions(-)
17 create mode 100644 tmpfiles.d/.gitignore
18 rename tmpfiles.d/{etc.conf => etc.conf.m4} (95%)
19
20Index: git/Makefile.am
21===================================================================
22--- git.orig/Makefile.am 2015-01-24 00:41:20.134716451 -0800
23+++ git/Makefile.am 2015-01-24 00:41:20.126716451 -0800
24@@ -1935,14 +1935,16 @@
25 units/systemd-tmpfiles-setup.service \
26 units/systemd-tmpfiles-clean.service
27
28+nodist_tmpfiles_DATA = \
29+ tmpfiles.d/etc.conf
30+
31 dist_tmpfiles_DATA = \
32 tmpfiles.d/systemd.conf \
33 tmpfiles.d/systemd-nologin.conf \
34 tmpfiles.d/systemd-remote.conf \
35 tmpfiles.d/tmp.conf \
36 tmpfiles.d/x11.conf \
37- tmpfiles.d/var.conf \
38- tmpfiles.d/etc.conf
39+ tmpfiles.d/var.conf
40
41 if HAVE_SYSV_COMPAT
42 dist_tmpfiles_DATA += \
43@@ -1965,10 +1967,14 @@
44 endif
45
46 EXTRA_DIST += \
47+ tmpfiles.d/etc.conf.m4 \
48 units/systemd-tmpfiles-setup-dev.service.in \
49 units/systemd-tmpfiles-setup.service.in \
50 units/systemd-tmpfiles-clean.service.in
51
52+CLEANFILES += \
53+ tmpfiles.d/etc.conf
54+
55 # ------------------------------------------------------------------------------
56 if ENABLE_SYSUSERS
57 systemd_sysusers_SOURCES = \
58@@ -5684,6 +5690,11 @@
59 $(AM_V_at)$(MKDIR_P) $(dir $@)
60 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
61
62+tmpfiles.d/%: tmpfiles.d/%.m4
63+ $(AM_V_at)$(MKDIR_P) $(dir $@)
64+ $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
65+
66+
67 units/%: units/%.m4
68 $(AM_V_at)$(MKDIR_P) $(dir $@)
69 $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
70Index: git/TODO
71===================================================================
72--- git.orig/TODO 2015-01-24 00:41:20.134716451 -0800
73+++ git/TODO 2015-01-24 00:41:20.126716451 -0800
74@@ -111,8 +111,6 @@
75
76 * Allow multiple ExecStart= for all Type= settings, so that we can cover rescue.service nicely
77
78-* the resolv.conf tmpfiles line should be covered by ENABLE_NETWORKD...
79-
80 * Add a new verb "systemctl top"
81
82 * logind: allow users to kill or lock their own sessions
83Index: git/configure.ac
84===================================================================
85--- git.orig/configure.ac 2015-01-24 00:41:20.134716451 -0800
86+++ git/configure.ac 2015-01-24 00:41:20.126716451 -0800
87@@ -1041,6 +1041,7 @@
88 AC_ARG_ENABLE(resolved, AS_HELP_STRING([--disable-resolved], [disable resolve daemon]))
89 if test "x$enable_resolved" != "xno"; then
90 have_resolved=yes
91+ M4_DEFINES="$M4_DEFINES -DENABLE_RESOLVED"
92 fi
93 AM_CONDITIONAL(ENABLE_RESOLVED, [test "$have_resolved" = "yes"])
94
95Index: git/tmpfiles.d/.gitignore
96===================================================================
97--- /dev/null 1970-01-01 00:00:00.000000000 +0000
98+++ git/tmpfiles.d/.gitignore 2015-01-24 00:41:20.126716451 -0800
99@@ -0,0 +1 @@
100+etc.conf
101Index: git/tmpfiles.d/etc.conf
102===================================================================
103--- git.orig/tmpfiles.d/etc.conf 2015-01-24 00:41:20.134716451 -0800
104+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
105@@ -1,15 +0,0 @@
106-# This file is part of systemd.
107-#
108-# systemd is free software; you can redistribute it and/or modify it
109-# under the terms of the GNU Lesser General Public License as published by
110-# the Free Software Foundation; either version 2.1 of the License, or
111-# (at your option) any later version.
112-
113-# See tmpfiles.d(5) for details
114-
115-L /etc/os-release - - - - ../usr/lib/os-release
116-L /etc/localtime - - - - ../usr/share/zoneinfo/UTC
117-L+ /etc/mtab - - - - ../proc/self/mounts
118-L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
119-C /etc/nsswitch.conf - - - -
120-C /etc/pam.d - - - -
121Index: git/tmpfiles.d/etc.conf.m4
122===================================================================
123--- /dev/null 1970-01-01 00:00:00.000000000 +0000
124+++ git/tmpfiles.d/etc.conf.m4 2015-01-24 00:41:20.126716451 -0800
125@@ -0,0 +1,17 @@
126+# This file is part of systemd.
127+#
128+# systemd is free software; you can redistribute it and/or modify it
129+# under the terms of the GNU Lesser General Public License as published by
130+# the Free Software Foundation; either version 2.1 of the License, or
131+# (at your option) any later version.
132+
133+# See tmpfiles.d(5) for details
134+
135+L /etc/os-release - - - - ../usr/lib/os-release
136+L /etc/localtime - - - - ../usr/share/zoneinfo/UTC
137+L+ /etc/mtab - - - - ../proc/self/mounts
138+m4_ifdef(`ENABLE_RESOLVED',
139+L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
140+)
141+C /etc/nsswitch.conf - - - -
142+C /etc/pam.d - - - -
diff --git a/meta/recipes-core/systemd/systemd/binfmt-install.patch b/meta/recipes-core/systemd/systemd/binfmt-install.patch
new file mode 100644
index 0000000000..c2d5099f24
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/binfmt-install.patch
@@ -0,0 +1,56 @@
1Don't install dependency links at install time for the binfmt services, use
2[Install] blocks so that they get created when the service is enabled like a
3traditional service.
4
5The [Install] blocks were rejected upstream as they don't have a way to "enable"
6it on install without static symlinks which can't be disabled, only masked. We
7however can do that in a postinst.
8
9Upstream-Status: Denied
10Signed-off-by: Ross Burton <ross.burton@intel.com>
11
12diff --git a/Makefile.am b/Makefile.am
13index 7933de6..78acb6f 100644
14--- a/Makefile.am
15+++ b/Makefile.am
16@@ -3133,10 +3133,6 @@ INSTALL_DIRS += \
17 $(prefix)/lib/binfmt.d \
18 $(sysconfdir)/binfmt.d
19
20-SYSINIT_TARGET_WANTS += \
21- systemd-binfmt.service \
22- proc-sys-fs-binfmt_misc.automount
23-
24 endif
25
26 EXTRA_DIST += \
27diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
28index 6be3893..709adef 100644
29--- a/units/proc-sys-fs-binfmt_misc.automount
30+++ b/units/proc-sys-fs-binfmt_misc.automount
31@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/
32
33 [Automount]
34 Where=/proc/sys/fs/binfmt_misc
35+
36+[Install]
37+WantedBy=sysinit.target
38diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
39index 02dfe77..86d3481 100644
40--- a/units/systemd-binfmt.service.in
41+++ b/units/systemd-binfmt.service.in
42@@ -11,6 +11,7 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5)
43 Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt
44 DefaultDependencies=no
45 Conflicts=shutdown.target
46+Wants=proc-sys-fs-binfmt_misc.automount
47 After=systemd-readahead-collect.service systemd-readahead-replay.service proc-sys-fs-binfmt_misc.automount
48 Before=sysinit.target shutdown.target
49 ConditionPathIsReadWrite=/proc/sys/
50@@ -24,3 +25,6 @@ ConditionDirectoryNotEmpty=|/run/binfmt.d
51 Type=oneshot
52 RemainAfterExit=yes
53 ExecStart=@rootlibexecdir@/systemd-binfmt
54+
55+[Install]
56+WantedBy=sysinit.target
diff --git a/meta/recipes-core/systemd/systemd/init b/meta/recipes-core/systemd/systemd/init
new file mode 100644
index 0000000000..ea52be4820
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/init
@@ -0,0 +1,104 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: udev
5# Required-Start: mountvirtfs
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: Start udevd, populate /dev and load drivers.
10### END INIT INFO
11
12. /etc/init.d/functions
13
14export TZ=/etc/localtime
15
16[ -d /sys/class ] || exit 1
17[ -r /proc/mounts ] || exit 1
18[ -x @UDEVD@ ] || exit 1
19[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
20[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
21
22readfile () {
23 filename=$1
24 READDATA=""
25 if [ -r $filename ]; then
26 while read line; do
27 READDATA="$READDATA$line"
28 done < $filename
29 fi
30}
31
32case "$1" in
33 start)
34 export ACTION=add
35 # propagate /dev from /sys
36 echo "Starting udev"
37
38 # mount the devtmpfs on /dev, if not already done
39 LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
40 mount -n -o mode=0755 -t devtmpfs none "/dev"
41 }
42 [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
43 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
44 mount -a -t tmpfs 2>/dev/null
45
46 # cache handling
47 if [ "$DEVCACHE" != "" ]; then
48 readfile /proc/version
49 VERSION="$READDATA"
50 readfile /proc/cmdline
51 CMDLINE="$READDATA"
52 readfile /proc/devices
53 DEVICES="$READDATA"
54 readfile /proc/atags
55 ATAGS="$READDATA"
56
57 if [ -e $DEVCACHE ]; then
58 readfile /etc/udev/cache.data
59 if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
60 (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
61 not_first_boot=1
62 [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
63 [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
64 else
65 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
66 fi
67 else
68 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
69 fi
70 fi
71
72 # make_extra_nodes
73 killproc systemd-udevd > "/dev/null" 2>&1
74
75 # trigger the sorted events
76 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
77 @UDEVD@ -d
78
79 udevadm control --env=STARTUP=1
80 if [ "$not_first_boot" != "" ];then
81 udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform
82 (udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
83 else
84 udevadm trigger --action=add
85 udevadm settle
86 fi
87 ;;
88 stop)
89 echo "Stopping udevd"
90 start-stop-daemon --stop --name systemd-udevd --quiet
91 ;;
92 restart)
93 $0 stop
94 sleep 1
95 $0 start
96 ;;
97 status)
98 status systemd-udevd
99 ;;
100 *)
101 echo "Usage: $0 {start|stop|status|restart}"
102 exit 1
103esac
104exit 0
diff --git a/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
new file mode 100644
index 0000000000..2063268246
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/optional_secure_getenv.patch
@@ -0,0 +1,19 @@
1on uclibc secure_getenv is not available
2therefore default to using getenv instead
3
4Upstream-Status: Denied [no desire for uclibc support]
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: git/src/shared/missing.h
8===================================================================
9--- git.orig/src/shared/missing.h 2012-09-22 18:46:44.141282145 -0700
10+++ git/src/shared/missing.h 2012-09-22 18:48:44.081276570 -0700
11@@ -233,6 +233,8 @@
12 #ifndef HAVE_SECURE_GETENV
13 # ifdef HAVE___SECURE_GETENV
14 # define secure_getenv __secure_getenv
15+# elif defined __UCLIBC__
16+# define secure_getenv getenv
17 # else
18 # error neither secure_getenv nor __secure_getenv are available
19 # endif
diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest
new file mode 100644
index 0000000000..a2d61c2894
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/run-ptest
@@ -0,0 +1,5 @@
1#!/bin/sh
2
3tar -C test -xJf test/sys.tar.xz
4make test/rules-test.sh.log
5make test/udev-test.pl.log
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch
new file mode 100644
index 0000000000..4639532236
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-configure-check-uclibc.patch
@@ -0,0 +1,32 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: git/configure.ac
5===================================================================
6--- git.orig/configure.ac 2014-03-15 17:53:51.756340454 -0700
7+++ git/configure.ac 2014-03-15 18:07:34.888355897 -0700
8@@ -78,6 +78,24 @@
9
10 M4_DEFINES=
11
12+# check for few functions not implemented in uClibc
13+
14+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate)
15+
16+# check for %ms format support - assume always no if cross compiling
17+
18+AC_MSG_CHECKING([whether %ms format is supported by *scanf])
19+
20+AC_LINK_IFELSE(
21+ [AC_LANG_PROGRAM([
22+ #include <stdio.h>
23+ ],[
24+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ;
25+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ;
26+ return (rc==3)?0:1;])],
27+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])],
28+ [AC_MSG_RESULT([no])])
29+
30 # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
31 m4_ifdef([GTK_DOC_CHECK], [
32 GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch
new file mode 100644
index 0000000000..7170a38af3
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-execvpe.patch
@@ -0,0 +1,29 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: systemd-209/src/nspawn/nspawn.c
5===================================================================
6--- systemd-209.orig/src/nspawn/nspawn.c 2014-02-19 15:03:09.000000000 -0800
7+++ systemd-209/src/nspawn/nspawn.c 2014-02-19 23:20:38.720628627 -0800
8@@ -91,6 +91,8 @@
9 LINK_GUEST
10 } LinkJournal;
11
12+#include "config.h"
13+
14 static char *arg_directory = NULL;
15 static char *arg_user = NULL;
16 static sd_id128_t arg_uuid = {};
17@@ -2045,7 +2047,12 @@
18 a[0] = (char*) "/sbin/init";
19 execve(a[0], a, env_use);
20 } else if (argc > optind)
21+#ifdef HAVE_EXECVPE
22 execvpe(argv[optind], argv + optind, env_use);
23+#else
24+ environ = env_use;
25+ execvp(argv[optind], argv + optind);
26+#endif /* HAVE_EXECVPE */
27 else {
28 chdir(home ? home : "/root");
29 execle("/bin/bash", "-bash", NULL, env_use);
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
new file mode 100644
index 0000000000..f8e19ce172
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-fallocate.patch
@@ -0,0 +1,92 @@
1Upstream-Status: Denied [no desire for uclibc support]
2
3This patch is uclibc specific, thus not suitable for upstream.
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
7---
8 src/journal/journal-file.c | 16 +++++++++++++++-
9 src/journal/journald-kmsg.c | 16 ++++++++++++++--
10 2 files changed, 29 insertions(+), 3 deletions(-)
11
12diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
13index f2f1f35..092f87b 100644
14--- a/src/journal/journal-file.c
15+++ b/src/journal/journal-file.c
16@@ -38,6 +38,8 @@
17 #include "compress.h"
18 #include "fsprg.h"
19
20+#include "config.h"
21+
22 #define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
23 #define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
24
25@@ -314,7 +316,7 @@ static int journal_file_verify_header(JournalFile *f) {
26
27 static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size) {
28 uint64_t old_size, new_size;
29- int r;
30+ int r = 0;
31
32 assert(f);
33
34@@ -362,9 +364,21 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
35 /* Note that the glibc fallocate() fallback is very
36 inefficient, hence we try to minimize the allocation area
37 as we can. */
38+#ifdef HAVE_POSIX_FALLOCATE
39 r = posix_fallocate(f->fd, old_size, new_size - old_size);
40 if (r != 0)
41 return -r;
42+#else
43+ /* Write something every 512 bytes to make sure the block is allocated */
44+ uint64_t len = new_size - old_size;
45+ uint64_t offset = old_size;
46+ for (offset += (len-1) % 512; len > 0; offset += 512) {
47+ len -= 512;
48+ if (pwrite(f->fd, "", 1, offset) != 1)
49+ return -errno;
50+ }
51+
52+#endif /* HAVE_POSIX_FALLOCATE */
53
54 if (fstat(f->fd, &f->last_stat) < 0)
55 return -errno;
56diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
57index 12992e7..dc4fa93 100644
58--- a/src/journal/journald-kmsg.c
59+++ b/src/journal/journald-kmsg.c
60@@ -437,6 +437,7 @@ fail:
61 int server_open_kernel_seqnum(Server *s) {
62 _cleanup_close_ int fd;
63 uint64_t *p;
64+ int r = 0;
65
66 assert(s);
67
68@@ -449,8 +450,19 @@ int server_open_kernel_seqnum(Server *s) {
69 log_error("Failed to open /run/systemd/journal/kernel-seqnum, ignoring: %m");
70 return 0;
71 }
72-
73- if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
74+#ifdef HAVE_POSIX_FALLOCATE
75+ r = posix_fallocate(fd, 0, sizeof(uint64_t));
76+#else
77+ /* Use good old method to write zeros into the journal file
78+ perhaps very inefficient yet working. */
79+ char *buf = alloca(sizeof(uint64_t));
80+ off_t oldpos = lseek(fd, 0, SEEK_CUR);
81+ bzero(buf, sizeof(uint64_t));
82+ lseek(fd, 0, SEEK_SET);
83+ r = write(fd, buf, sizeof(uint64_t));
84+ lseek(fd, oldpos, SEEK_SET);
85+#endif /* HAVE_POSIX_FALLOCATE */
86+ if (r < 0) {
87 log_error("Failed to allocate sequential number file, ignoring: %m");
88 return 0;
89 }
90--
911.7.9.5
92
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
new file mode 100644
index 0000000000..9b4c940984
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-getty-unit.patch
@@ -0,0 +1,35 @@
1Prefer getty to agetty in console setup systemd units
2
3Upstream-Status: Inappropriate [configuration specific]
4Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
5---
6 units/getty@.service.m4 | 2 +-
7 units/serial-getty@.service.m4 | 2 +-
8 2 files changed, 2 insertions(+), 2 deletions(-)
9
10Index: git/units/getty@.service.m4
11===================================================================
12--- git.orig/units/getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
13+++ git/units/getty@.service.m4 2014-03-15 08:21:11.007695825 -0700
14@@ -27,7 +27,7 @@
15
16 [Service]
17 # the VT is cleared by TTYVTDisallocate
18-ExecStart=-/sbin/agetty --noclear %I $TERM
19+ExecStart=-/sbin/getty -L %I $TERM
20 Type=idle
21 Restart=always
22 RestartSec=0
23Index: git/units/serial-getty@.service.m4
24===================================================================
25--- git.orig/units/serial-getty@.service.m4 2014-03-15 08:16:17.000000000 -0700
26+++ git/units/serial-getty@.service.m4 2014-03-15 08:22:31.291697331 -0700
27@@ -22,7 +22,7 @@
28 IgnoreOnIsolate=yes
29
30 [Service]
31-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
32+ExecStart=-/sbin/getty -L 115200 %I $TERM
33 Type=idle
34 Restart=always
35 RestartSec=0
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
new file mode 100644
index 0000000000..8c7aa072da
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
@@ -0,0 +1,30 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: git/src/shared/util.c
5===================================================================
6--- git.orig/src/shared/util.c 2014-03-15 15:14:21.368160908 -0700
7+++ git/src/shared/util.c 2014-03-15 15:44:21.988194688 -0700
8@@ -85,6 +85,8 @@
9 #include "def.h"
10 #include "missing.h"
11
12+#include "config.h"
13+
14 int saved_argc = 0;
15 char **saved_argv = NULL;
16
17@@ -6222,7 +6224,13 @@
18
19 u = umask(077);
20
21+#ifdef HAVE_MKOSTEMP
22 fd = mkostemp(pattern, flags);
23+#else
24+ fd = mkstemp(pattern);
25+ if (fd >= 0) fcntl(fd, F_SETFD, flags);
26+#endif /* HAVE_MKOSTEMP */
27+
28 if (fd < 0)
29 return -errno;
30
diff --git a/meta/recipes-core/systemd/systemd/touchscreen.rules b/meta/recipes-core/systemd/systemd/touchscreen.rules
new file mode 100644
index 0000000000..d83fd1673d
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/touchscreen.rules
@@ -0,0 +1,18 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Create a symlink to any touchscreen input device
17SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
18SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="ads7846", SYMLINK+="input/touchscreen0"
diff --git a/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch
new file mode 100644
index 0000000000..39dfc9e2ea
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/uclibc-get-physmem.patch
@@ -0,0 +1,37 @@
1bypass unimplemented _SC_PHYS_PAGES system configuration API in uclibc
2
3Upstream-Status: Inappropriate [uclibc-specific]
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: git/src/shared/util.c
8===================================================================
9--- git.orig/src/shared/util.c 2014-03-15 18:09:34.796358146 -0700
10+++ git/src/shared/util.c 2014-03-15 20:16:33.836501084 -0700
11@@ -6332,11 +6332,24 @@
12
13 /* We return this as uint64_t in case we are running as 32bit
14 * process on a 64bit kernel with huge amounts of memory */
15-
16+#ifdef __UCLIBC__
17+ char line[128];
18+ FILE *f = fopen("/proc/meminfo", "r");
19+ if (f == NULL)
20+ return 0;
21+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) {
22+ if (sscanf(line, "MemTotal: %l kB", &mem) == 1) {
23+ mem *= 1024;
24+ break;
25+ }
26+ }
27+ fclose(f);
28+ return (uint64_t) mem;
29+#else
30 mem = sysconf(_SC_PHYS_PAGES);
31 assert(mem > 0);
32-
33 return (uint64_t) mem * (uint64_t) page_size();
34+#endif
35 }
36
37 char* mount_test_option(const char *haystack, const char *needle) {
diff --git a/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
new file mode 100644
index 0000000000..15645dee11
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/uclibc-sysinfo_h.patch
@@ -0,0 +1,19 @@
1Dont include sys/sysinfo.h on uclibc it conflicts with linux/sysinfo.h
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Inappropriate [uclibc specific]
5
6Index: systemd-209/src/readahead/readahead-common.c
7===================================================================
8--- systemd-209.orig/src/readahead/readahead-common.c 2014-02-12 18:42:33.810685053 -0800
9+++ systemd-209/src/readahead/readahead-common.c 2014-02-19 23:49:31.856661142 -0800
10@@ -22,7 +22,9 @@
11 #include <errno.h>
12 #include <stdlib.h>
13 #include <string.h>
14+#ifndef __UCLIBC__
15 #include <sys/sysinfo.h>
16+#endif
17 #include <sys/inotify.h>
18 #include <fcntl.h>
19 #include <sys/mman.h>
diff --git a/meta/recipes-core/systemd/systemd_216.bb b/meta/recipes-core/systemd/systemd_216.bb
new file mode 100644
index 0000000000..1eb401988e
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd_216.bb
@@ -0,0 +1,392 @@
1SUMMARY = "System and service manager for Linux, replacing SysVinit"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3
4LICENSE = "GPLv2 & LGPLv2.1 & MIT"
5LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
6 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c \
7 file://LICENSE.MIT;md5=544799d0b492f119fa04641d1b8868ed"
8
9PROVIDES = "udev"
10
11PE = "1"
12
13DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline dbus libcap libcgroup glib-2.0 qemu-native util-linux"
14DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
15
16SECTION = "base/shell"
17
18inherit gtk-doc useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext
19
20SRCREV = "5d0ae62c665262c4c55536457e84e278c252cc0b"
21
22PV = "216+git${SRCPV}"
23
24SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=git \
25 file://binfmt-install.patch \
26 file://systemd-pam-configure-check-uclibc.patch \
27 file://systemd-pam-fix-execvpe.patch \
28 file://systemd-pam-fix-fallocate.patch \
29 file://systemd-pam-fix-mkostemp.patch \
30 file://optional_secure_getenv.patch \
31 file://uclibc-sysinfo_h.patch \
32 file://uclibc-get-physmem.patch \
33 file://0001-add-support-for-executing-scripts-under-etc-rcS.d.patch \
34 file://0001-missing.h-add-fake-__NR_memfd_create-for-MIPS.patch \
35 file://0001-Make-root-s-home-directory-configurable.patch \
36 file://0001-systemd-user-avoid-using-system-auth.patch \
37 file://0001-journal-Fix-navigating-backwards-missing-entries.patch \
38 file://0001-tmpfiles-make-resolv.conf-entry-conditional-on-resol.patch \
39 file://0001-build-sys-do-not-install-tmpfiles-and-sysusers-files.patch \
40 file://0001-build-sys-configure-the-list-of-system-users-files-a.patch \
41 file://touchscreen.rules \
42 file://00-create-volatile.conf \
43 file://init \
44 file://run-ptest \
45 "
46
47S = "${WORKDIR}/git"
48
49SRC_URI_append_libc-uclibc = "\
50 file://systemd-pam-fix-getty-unit.patch \
51 "
52LDFLAGS_append_libc-uclibc = " -lrt"
53
54GTKDOC_DOCDIR = "${S}/docs/"
55
56PACKAGECONFIG ??= "xz"
57PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl"
58# Sign the journal for anti-tampering
59PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt"
60# regardless of PACKAGECONFIG, libgcrypt is always required to expand
61# the AM_PATH_LIBGCRYPT autoconf macro
62DEPENDS += "libgcrypt"
63# Compress the journal
64PACKAGECONFIG[xz] = "--enable-xz,--disable-xz,xz"
65PACKAGECONFIG[cryptsetup] = "--enable-libcryptsetup,--disable-libcryptsetup,cryptsetup"
66PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicrohttpd"
67PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils"
68PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved"
69PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd"
70PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn"
71PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit"
72
73CACHED_CONFIGUREVARS = "ac_cv_path_KILL=${base_bindir}/kill"
74
75# Helper variables to clarify locations. This mirrors the logic in systemd's
76# build system.
77rootprefix ?= "${base_prefix}"
78rootlibdir ?= "${base_libdir}"
79rootlibexecdir = "${rootprefix}/lib"
80
81# The gtk+ tools should get built as a separate recipe e.g. systemd-tools
82EXTRA_OECONF = " --with-rootprefix=${rootprefix} \
83 --with-rootlibdir=${rootlibdir} \
84 --with-roothomedir=${ROOT_HOME} \
85 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \
86 --disable-manpages \
87 --disable-coredump \
88 --disable-introspection \
89 --disable-kdbus \
90 --enable-split-usr \
91 --without-python \
92 --with-sysvrcnd-path=${sysconfdir} \
93 --with-firmware-path=/lib/firmware \
94 ac_cv_path_KILL=${base_bindir}/kill \
95 "
96# uclibc does not have NSS
97EXTRA_OECONF_append_libc-uclibc = " --disable-myhostname "
98
99do_configure_prepend() {
100 export CPP="${HOST_PREFIX}cpp ${TOOLCHAIN_OPTIONS} ${HOST_CC_ARCH}"
101 export NM="${HOST_PREFIX}gcc-nm"
102 export AR="${HOST_PREFIX}gcc-ar"
103 export RANLIB="${HOST_PREFIX}gcc-ranlib"
104 export KMOD="${base_bindir}/kmod"
105 if [ -d ${S}/units.pre_sed ] ; then
106 cp -r ${S}/units.pre_sed ${S}/units
107 else
108 cp -r ${S}/units ${S}/units.pre_sed
109 fi
110 sed -i '/ln --relative --help/d' ${S}/configure.ac
111 sed -i -e 's:\$(LN_S) --relative -f:lnr:g' ${S}/Makefile.am
112 sed -i -e 's:\$(LN_S) --relative:lnr:g' ${S}/Makefile.am
113}
114
115do_install() {
116 autotools_do_install
117 install -d ${D}/${base_sbindir}
118 # Provided by a separate recipe
119 rm ${D}${systemd_unitdir}/system/serial-getty* -f
120
121 # Provide support for initramfs
122 [ ! -e ${D}/init ] && ln -s ${rootlibexecdir}/systemd/systemd ${D}/init
123 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
124
125 # Create machine-id
126 # 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
127 touch ${D}${sysconfdir}/machine-id
128
129 install -m 0644 ${WORKDIR}/*.rules ${D}${sysconfdir}/udev/rules.d/
130
131 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
132
133 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
134 install -d ${D}${sysconfdir}/init.d
135 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/systemd-udevd
136 sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd
137 fi
138
139 chown root:systemd-journal ${D}/${localstatedir}/log/journal
140
141 # Delete journal README, as log can be symlinked inside volatile.
142 rm -f ${D}/${localstatedir}/log/README
143
144 # Create symlinks for systemd-update-utmp-runlevel.service
145 install -d ${D}${systemd_unitdir}/system/graphical.target.wants
146 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
147 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
148 install -d ${D}${systemd_unitdir}/system/reboot.target.wants
149 install -d ${D}${systemd_unitdir}/system/rescue.target.wants
150 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service
151 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
152 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service
153 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service
154 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service
155
156 # Enable journal to forward message to syslog daemon
157 sed -i -e 's/.*ForwardToSyslog.*/ForwardToSyslog=yes/' ${D}${sysconfdir}/systemd/journald.conf
158 # its needed in 216 upstream has fixed it with 919699ec301ea507edce4a619141ed22e789ac0d
159 # don't order journal flushing afte remote-fs.target
160 sed -i -e 's/ remote-fs.target$//' ${D}${systemd_unitdir}/system/systemd-journal-flush.service
161 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
162 # for existence else it fails
163 ${@bb.utils.contains('PACKAGECONFIG', 'networkd', '', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${libdir}/tmpfiles.d/systemd.conf', d)}
164}
165
166do_install_ptest () {
167 install -d ${D}${PTEST_PATH}/test
168 cp -rf ${S}/test/* ${D}${PTEST_PATH}/test
169 install -m 0755 ${B}/test-udev ${D}${PTEST_PATH}/
170 install -d ${D}${PTEST_PATH}/build-aux
171 cp ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
172 cp -rf ${B}/rules ${D}${PTEST_PATH}/
173 # This directory needs to be there for udev-test.pl to work.
174 install -d ${D}${libdir}/udev/rules.d
175 cp ${B}/Makefile ${D}${PTEST_PATH}/
176 cp ${S}/test/sys.tar.xz ${D}${PTEST_PATH}/test
177 sed -i 's/"tree"/"ls"/' ${D}${PTEST_PATH}/test/udev-test.pl
178 sed -i 's#${S}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
179 sed -i 's#${B}#${PTEST_PATH}#g' ${D}${PTEST_PATH}/Makefile
180}
181
182python populate_packages_prepend (){
183 systemdlibdir = d.getVar("rootlibdir", True)
184 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
185}
186PACKAGES_DYNAMIC += "^lib(udev|systemd).*"
187
188PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \
189 ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh libgudev"
190
191SYSTEMD_PACKAGES = "${PN}-binfmt"
192SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service"
193
194USERADD_PACKAGES = "${PN}"
195USERADD_PARAM_${PN} += "--system systemd-journal-gateway; --system systemd-timesync"
196GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal"
197
198FILES_${PN}-analyze = "${bindir}/systemd-analyze"
199
200FILES_${PN}-initramfs = "/init"
201RDEPENDS_${PN}-initramfs = "${PN}"
202
203FILES_libgudev = "${libdir}/libgudev*${SOLIBS}"
204
205RDEPENDS_${PN}-ptest += "perl python bash"
206FILES_${PN}-ptest += "${libdir}/udev/rules.d"
207
208FILES_${PN}-dbg += "${libdir}/systemd/ptest/.debug"
209
210FILES_${PN}-gui = "${bindir}/systemadm"
211
212FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
213 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
214 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
215
216RDEPENDS_${PN}-kernel-install += "bash"
217FILES_${PN}-kernel-install = "${bindir}/kernel-install \
218 ${sysconfdir}/kernel/ \
219 ${exec_prefix}/lib/kernel \
220 "
221FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
222 "
223
224FILES_${PN}-zsh = "${datadir}/zsh/site-functions"
225
226FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
227 ${exec_prefix}/lib/binfmt.d \
228 ${rootlibexecdir}/systemd/systemd-binfmt \
229 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
230 ${systemd_unitdir}/system/systemd-binfmt.service"
231RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
232
233RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
234
235CONFFILES_${PN} = "${sysconfdir}/systemd/journald.conf \
236 ${sysconfdir}/systemd/logind.conf \
237 ${sysconfdir}/systemd/system.conf \
238 ${sysconfdir}/systemd/user.conf"
239
240FILES_${PN} = " ${base_bindir}/* \
241 ${datadir}/bash-completion \
242 ${datadir}/dbus-1/services \
243 ${datadir}/dbus-1/system-services \
244 ${datadir}/polkit-1 \
245 ${datadir}/${BPN} \
246 ${datadir}/factory \
247 ${sysconfdir}/bash_completion.d/ \
248 ${sysconfdir}/dbus-1/ \
249 ${sysconfdir}/machine-id \
250 ${sysconfdir}/modules-load.d/ \
251 ${sysconfdir}/sysctl.d/ \
252 ${sysconfdir}/systemd/ \
253 ${sysconfdir}/tmpfiles.d/ \
254 ${sysconfdir}/xdg/ \
255 ${sysconfdir}/init.d/README \
256 ${rootlibexecdir}/systemd/* \
257 ${systemd_unitdir}/* \
258 ${base_libdir}/security/*.so \
259 ${libdir}/libnss_* \
260 /cgroup \
261 ${bindir}/systemd* \
262 ${bindir}/busctl \
263 ${bindir}/localectl \
264 ${bindir}/hostnamectl \
265 ${bindir}/timedatectl \
266 ${bindir}/bootctl \
267 ${bindir}/kernel-install \
268 ${exec_prefix}/lib/tmpfiles.d/*.conf \
269 ${exec_prefix}/lib/systemd \
270 ${exec_prefix}/lib/modules-load.d \
271 ${exec_prefix}/lib/sysctl.d \
272 ${exec_prefix}/lib/sysusers.d \
273 ${localstatedir} \
274 /lib/udev/rules.d/70-uaccess.rules \
275 /lib/udev/rules.d/71-seat.rules \
276 /lib/udev/rules.d/73-seat-late.rules \
277 /lib/udev/rules.d/99-systemd.rules \
278 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d', '', d)} \
279 "
280
281FILES_${PN}-dbg += "${rootlibdir}/.debug ${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
282FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
283
284RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})"
285RDEPENDS_${PN} += "volatile-binds"
286
287RRECOMMENDS_${PN} += "systemd-serialgetty systemd-compat-units udev-hwdb\
288 util-linux-agetty \
289 util-linux-fsck e2fsprogs-e2fsck \
290 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 os-release \
291"
292
293PACKAGES =+ "udev-dbg udev udev-hwdb"
294
295FILES_udev-dbg += "/lib/udev/.debug"
296
297RPROVIDES_udev = "hotplug"
298
299RDEPENDS_udev-hwdb += "udev"
300
301FILES_udev += "${base_sbindir}/udevd \
302 ${rootlibexecdir}/systemd/systemd-udevd \
303 ${rootlibexecdir}/udev/accelerometer \
304 ${rootlibexecdir}/udev/ata_id \
305 ${rootlibexecdir}/udev/cdrom_id \
306 ${rootlibexecdir}/udev/collect \
307 ${rootlibexecdir}/udev/findkeyboards \
308 ${rootlibexecdir}/udev/keyboard-force-release.sh \
309 ${rootlibexecdir}/udev/keymap \
310 ${rootlibexecdir}/udev/mtd_probe \
311 ${rootlibexecdir}/udev/scsi_id \
312 ${rootlibexecdir}/udev/v4l_id \
313 ${rootlibexecdir}/udev/keymaps \
314 ${rootlibexecdir}/udev/rules.d/4*.rules \
315 ${rootlibexecdir}/udev/rules.d/5*.rules \
316 ${rootlibexecdir}/udev/rules.d/6*.rules \
317 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
318 ${rootlibexecdir}/udev/rules.d/75*.rules \
319 ${rootlibexecdir}/udev/rules.d/78*.rules \
320 ${rootlibexecdir}/udev/rules.d/8*.rules \
321 ${rootlibexecdir}/udev/rules.d/95*.rules \
322 ${sysconfdir}/udev \
323 ${sysconfdir}/init.d/systemd-udevd \
324 ${systemd_unitdir}/system/*udev* \
325 ${systemd_unitdir}/system/*.wants/*udev* \
326 ${base_bindir}/udevadm \
327 ${datadir}/bash-completion/completions/udevadm \
328 "
329
330FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d"
331
332INITSCRIPT_PACKAGES = "udev"
333INITSCRIPT_NAME_udev = "systemd-udevd"
334INITSCRIPT_PARAMS_udev = "start 03 S ."
335
336python __anonymous() {
337 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
338 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
339}
340
341# TODO:
342# u-a for runlevel and telinit
343
344ALTERNATIVE_${PN} = "init halt reboot shutdown poweroff runlevel"
345
346ALTERNATIVE_TARGET[init] = "${rootlibexecdir}/systemd/systemd"
347ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
348ALTERNATIVE_PRIORITY[init] ?= "300"
349
350ALTERNATIVE_TARGET[halt] = "${base_bindir}/systemctl"
351ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
352ALTERNATIVE_PRIORITY[halt] ?= "300"
353
354ALTERNATIVE_TARGET[reboot] = "${base_bindir}/systemctl"
355ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
356ALTERNATIVE_PRIORITY[reboot] ?= "300"
357
358ALTERNATIVE_TARGET[shutdown] = "${base_bindir}/systemctl"
359ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
360ALTERNATIVE_PRIORITY[shutdown] ?= "300"
361
362ALTERNATIVE_TARGET[poweroff] = "${base_bindir}/systemctl"
363ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
364ALTERNATIVE_PRIORITY[poweroff] ?= "300"
365
366ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
367ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
368ALTERNATIVE_PRIORITY[runlevel] ?= "300"
369
370pkg_postinst_udev-hwdb () {
371 if test -n "$D"; then
372 ${@qemu_run_binary(d, '$D', '${base_bindir}/udevadm')} hwdb --update \
373 --root $D
374 else
375 udevadm hwdb --update
376 fi
377}
378
379pkg_prerm_udev-hwdb () {
380 if test -n "$D"; then
381 exit 1
382 fi
383
384 rm -f ${sysconfdir}/udev/hwdb.bin
385}
386
387# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
388# that we don't build both udev and systemd in world builds.
389python () {
390 if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
391 raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES")
392}
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
new file mode 100644
index 0000000000..7b342901e1
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/crypt-lib.patch
@@ -0,0 +1,25 @@
1Upstream-Status: Inappropriate [configuration]
2
3# The src Makefile was checking for libcrypt.a on the host, not in the
4# build environment. This patch checks for $LCRYPT in the environment
5# and uses it if it's there.
6# - jdike@linux.intel.com
7
8Index: sysvinit-2.88dsf/src/Makefile
9===================================================================
10--- sysvinit-2.88dsf.orig/src/Makefile
11+++ sysvinit-2.88dsf/src/Makefile
12@@ -85,9 +85,13 @@ else
13 endif
14
15 # Additional libs for GNU libc.
16+ifneq ($(LCRYPT),)
17+ SULOGINLIBS += $(LCRYPT)
18+else
19 ifneq ($(wildcard /usr/lib*/libcrypt.a),)
20 SULOGINLIBS += -lcrypt
21 endif
22+endif
23
24 all: $(BIN) $(SBIN) $(USRBIN)
25
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
new file mode 100644
index 0000000000..6c4225a678
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/install.patch
@@ -0,0 +1,83 @@
1Upstream-Status: Pending
2
3diff --git a/src/Makefile b/src/Makefile
4index e2b8028..3e11e92 100644
5--- a/src/Makefile
6+++ b/src/Makefile
7@@ -65,7 +65,14 @@ else
8 INSTALL_DATA = install -m 644
9 endif
10 INSTALL_DIR = install -m 755 -d
11-MANDIR = /usr/share/man
12+
13+ROOT ?=
14+base_bindir ?= /bin
15+base_sbindir ?= /sbin
16+bindir ?= /usr/bin
17+sysconfdir ?= /etc
18+includedir ?= /usr/include
19+mandir ?= /usr/share/man
20
21 ifeq ($(WITH_SELINUX),yes)
22 SELINUX_DEF = -DWITH_SELINUX
23@@ -138,39 +145,39 @@ clobber: cleanobjs
24 distclean: clobber
25
26 install:
27- $(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
28- $(INSTALL_DIR) $(ROOT)/usr/bin/
29+ $(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
30+ $(INSTALL_DIR) $(ROOT)$(bindir)/
31 for i in $(BIN); do \
32- $(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
33+ $(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
34 done
35 for i in $(SBIN); do \
36- $(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
37+ $(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
38 done
39 for i in $(USRBIN); do \
40- $(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
41+ $(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
42 done
43- # $(INSTALL_DIR) $(ROOT)/etc/
44- # $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
45- ln -sf halt $(ROOT)/sbin/reboot
46- ln -sf halt $(ROOT)/sbin/poweroff
47- ln -sf init $(ROOT)/sbin/telinit
48- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
49- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
50- ln -sf last $(ROOT)/usr/bin/lastb; \
51+ # $(INSTALL_DIR) $(ROOT)$(sysconfdir)/
52+ # $(INSTALL_EXEC) initscript.sample $(ROOT)$(sysconfdir)/
53+ ln -sf halt $(ROOT)$(base_sbindir)/reboot
54+ ln -sf halt $(ROOT)$(base_sbindir)/poweroff
55+ ln -sf init $(ROOT)$(base_sbindir)/telinit
56+ ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
57+ if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
58+ ln -sf last $(ROOT)$(bindir)/lastb; \
59 fi
60- $(INSTALL_DIR) $(ROOT)/usr/include/
61- $(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
62- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
63- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
64- $(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
65+ $(INSTALL_DIR) $(ROOT)$(includedir)/
66+ $(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
67+ $(INSTALL_DIR) $(ROOT)$(mandir)/man1/
68+ $(INSTALL_DIR) $(ROOT)$(mandir)/man5/
69+ $(INSTALL_DIR) $(ROOT)$(mandir)/man8/
70 for i in $(MAN1); do \
71- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
72+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man1/; \
73 done
74 for i in $(MAN5); do \
75- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man5/; \
76+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man5/; \
77 done
78 for i in $(MAN8); do \
79- $(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man8/; \
80+ $(INSTALL_DATA) ../man/$$i $(ROOT)$(mandir)/man8/; \
81 done
82 ifeq ($(ROOT),)
83 #
diff --git a/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
new file mode 100644
index 0000000000..5b5dfdc001
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-2.88dsf/pidof-add-m-option.patch
@@ -0,0 +1,189 @@
1pidof: add -m option
2
3When used with -o, will also omit any processes that have the same
4argv[0] and argv[1] as any explicitly omitted process ids. This can be
5used to avoid multiple shell scripts concurrently calling pidof returning
6each other's pids.
7
8https://bugzilla.redhat.com/show_bug.cgi?id=883856
9
10Upstream-Status: backport
11Imported patch from: https://bugzilla.redhat.com/attachment.cgi?id=658166
12
13Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
14---
15 man/pidof.8 | 6 ++++++
16 src/killall5.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
17 2 files changed, 65 insertions(+), 3 deletions(-)
18
19diff --git a/man/pidof.8 b/man/pidof.8
20--- a/man/pidof.8
21+++ b/man/pidof.8
22@@ -24,6 +24,7 @@ pidof -- find the process ID of a running program.
23 .RB [ \-c ]
24 .RB [ \-n ]
25 .RB [ \-x ]
26+.RB [ \-m ]
27 .RB [ \-o
28 .IR omitpid[,omitpid..] ]
29 .RB [ \-o
30@@ -63,6 +64,11 @@ shells running the named scripts.
31 Tells \fIpidof\fP to omit processes with that process id. The special
32 pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
33 program, in other words the calling shell or shell script.
34+.IP -m
35+When used with -o, will also omit any processes that have the same
36+argv[0] and argv[1] as any explicitly omitted process ids. This can be
37+used to avoid multiple shell scripts concurrently calling pidof returning
38+each other's pids.
39 .SH "EXIT STATUS"
40 .TP
41 .B 0
42diff --git a/src/killall5.c b/src/killall5.c
43index 5937d98..e73885e 100644
44--- a/src/killall5.c
45+++ b/src/killall5.c
46@@ -118,6 +118,7 @@ typedef struct _s_nfs
47
48 /* List of processes. */
49 PROC *plist;
50+PROC *olist;
51
52 /* List of processes to omit. */
53 OMIT *omit;
54@@ -345,6 +346,20 @@ static void clear_mnt(void)
55 }
56 }
57
58+static void clear_omit(void)
59+{
60+ OMIT *o;
61+ PROC *p;
62+ for (o = omit; o; o = omit) {
63+ omit = omit->next;
64+ free(o);
65+ }
66+ for (p = olist; p; p = olist) {
67+ olist = olist->next;
68+ free(p);
69+ }
70+}
71+
72 /*
73 * Check if path is ia shadow off a NFS partition.
74 */
75@@ -452,6 +467,7 @@ int readproc(int do_stat)
76 DIR *dir;
77 FILE *fp;
78 PROC *p, *n;
79+ OMIT *o, *m;
80 struct dirent *d;
81 struct stat st;
82 char path[PATH_MAX+1];
83@@ -624,6 +640,17 @@ int readproc(int do_stat)
84 p->next = plist;
85 plist = p;
86 p->pid = pid;
87+ /* Could be smarter, but it's a small list. */
88+ m = omit;
89+ for (o = omit; m; o = m) {
90+ m = o->next;
91+ if (o->pid == p->pid) {
92+ n = (PROC*)xmalloc(sizeof(PROC));
93+ *n = *p;
94+ n->next = olist;
95+ olist = n;
96+ }
97+ }
98 }
99 closedir(dir);
100
101@@ -813,6 +840,26 @@ PIDQ_HEAD *pidof(char *prog)
102 return q;
103 }
104
105+int matches(PROC *o, PROC *p)
106+{
107+ int ret = 0;
108+ char *oargv1, *pargv1;
109+ if ((o->argv0 && p->argv0 && !strcmp(o->argv0,p->argv0))) {
110+ if (o->argv1 && p->argv1) {
111+ if ((oargv1 = canonicalize_file_name(o->argv1)) == NULL)
112+ oargv1 = strdup(o->argv1);
113+ if ((pargv1 = canonicalize_file_name(p->argv1)) == NULL)
114+ pargv1 = strdup(p->argv1);
115+ if (! strcmp(oargv1, pargv1)) {
116+ ret = 1;
117+ }
118+ free(oargv1);
119+ free(pargv1);
120+ }
121+ }
122+ return ret;
123+}
124+
125 /* Give usage message and exit. */
126 void usage(void)
127 {
128@@ -845,6 +892,7 @@ void nsyslog(int pri, char *fmt, ...)
129 #define PIDOF_SINGLE 0x01
130 #define PIDOF_OMIT 0x02
131 #define PIDOF_NETFS 0x04
132+#define PIDOF_OMIT_OMIT_MATCHES 0x08
133
134 /*
135 * Pidof functionality.
136@@ -861,6 +909,7 @@ int main_pidof(int argc, char **argv)
137 struct stat st;
138 char tmp[512];
139
140+ olist = (PROC*)0;
141 omit = (OMIT*)0;
142 nlist = (NFS*)0;
143 opterr = 0;
144@@ -868,7 +917,7 @@ int main_pidof(int argc, char **argv)
145 if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
146 flags |= PIDOF_NETFS;
147
148- while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
149+ while ((opt = getopt(argc,argv,"hcmo:sxn")) != EOF) switch (opt) {
150 case '?':
151 nsyslog(LOG_ERR,"invalid options on command line!\n");
152 closelog();
153@@ -907,6 +956,9 @@ int main_pidof(int argc, char **argv)
154 case 'x':
155 scripts_too++;
156 break;
157+ case 'm':
158+ flags |= PIDOF_OMIT_OMIT_MATCHES;
159+ break;
160 case 'n':
161 flags |= PIDOF_NETFS;
162 break;
163@@ -938,10 +990,13 @@ int main_pidof(int argc, char **argv)
164 pid_t spid = 0;
165 while ((p = get_next_from_pid_q(q))) {
166 if ((flags & PIDOF_OMIT) && omit) {
167- OMIT * optr;
168- for (optr = omit; optr; optr = optr->next) {
169+ PROC * optr;
170+ for (optr = olist; optr; optr = optr->next) {
171 if (optr->pid == p->pid)
172 break;
173+ if (flags & PIDOF_OMIT_OMIT_MATCHES)
174+ if (matches(optr, p))
175+ break;
176 }
177
178 /*
179@@ -977,6 +1032,7 @@ int main_pidof(int argc, char **argv)
180 if (!first)
181 printf("\n");
182
183+ clear_omit();
184 clear_mnt();
185
186 closelog();
187--
1881.8.1.2
189
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/inittab b/meta/recipes-core/sysvinit/sysvinit-inittab/inittab
new file mode 100644
index 0000000000..6abbdf4558
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/inittab
@@ -0,0 +1,30 @@
1# /etc/inittab: init(8) configuration.
2# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
3
4# The default runlevel.
5id:5:initdefault:
6
7# Boot-time system configuration/initialization script.
8# This is run first except when booting in emergency (-b) mode.
9si::sysinit:/etc/init.d/rcS
10
11# What to do in single-user mode.
12~~:S:wait:/sbin/sulogin
13
14# /etc/init.d executes the S and K scripts upon change
15# of runlevel.
16#
17# Runlevel 0 is halt.
18# Runlevel 1 is single-user.
19# Runlevels 2-5 are multi-user.
20# Runlevel 6 is reboot.
21
22l0:0:wait:/etc/init.d/rc 0
23l1:1:wait:/etc/init.d/rc 1
24l2:2:wait:/etc/init.d/rc 2
25l3:3:wait:/etc/init.d/rc 3
26l4:4:wait:/etc/init.d/rc 4
27l5:5:wait:/etc/init.d/rc 5
28l6:6:wait:/etc/init.d/rc 6
29# Normally not reached, but fallthrough in case of emergency.
30z6:6:respawn:/sbin/sulogin
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
new file mode 100644
index 0000000000..657ef02204
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -0,0 +1,82 @@
1SUMMARY = "Inittab configuration for SysVinit"
2LICENSE = "GPLv2"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
5PR = "r10"
6
7SRC_URI = "file://inittab"
8
9S = "${WORKDIR}/sysvinit-${PV}"
10
11INHIBIT_DEFAULT_DEPS = "1"
12
13do_compile() {
14 :
15}
16
17do_install() {
18 install -d ${D}${sysconfdir}
19 install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
20
21 tmp="${SERIAL_CONSOLES}"
22 for i in $tmp
23 do
24 j=`echo ${i} | sed s/\;/\ /g`
25 label=`echo ${i} | sed -e 's/^.*;tty//' -e 's/;.*//'`
26 echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
27 done
28
29 if [ "${USE_VT}" = "1" ]; then
30 cat <<EOF >>${D}${sysconfdir}/inittab
31# ${base_sbindir}/getty invocations for the runlevels.
32#
33# The "id" field MUST be the same as the last
34# characters of the device (after "tty").
35#
36# Format:
37# <id>:<runlevels>:<action>:<process>
38#
39
40EOF
41
42 for n in ${SYSVINIT_ENABLED_GETTYS}
43 do
44 echo "$n:2345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
45 done
46 echo "" >> ${D}${sysconfdir}/inittab
47 fi
48}
49
50pkg_postinst_${PN} () {
51# run this on the target
52if [ "x$D" = "x" ] && [ -e /proc/consoles ]; then
53 tmp="${SERIAL_CONSOLES_CHECK}"
54 for i in $tmp
55 do
56 j=`echo ${i} | sed s/^.*\;//g`
57 if [ -z "`grep ${j} /proc/consoles`" ]; then
58 sed -i /^.*${j}$/d /etc/inittab
59 fi
60 done
61 kill -HUP 1
62else
63 if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
64 exit 0
65 else
66 exit 1
67 fi
68fi
69}
70
71# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
72# Set PACKAGE_ARCH appropriately.
73PACKAGE_ARCH = "${MACHINE_ARCH}"
74
75FILES_${PN} = "${sysconfdir}/inittab"
76CONFFILES_${PN} = "${sysconfdir}/inittab"
77
78USE_VT ?= "1"
79SYSVINIT_ENABLED_GETTYS ?= "1"
80
81
82
diff --git a/meta/recipes-core/sysvinit/sysvinit/01_bootlogd b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
new file mode 100644
index 0000000000..a689d92d63
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/01_bootlogd
@@ -0,0 +1 @@
f root root 0644 /var/log/boot none
diff --git a/meta/recipes-core/sysvinit/sysvinit/bootlogd.init b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
new file mode 100755
index 0000000000..df5aa430cf
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/bootlogd.init
@@ -0,0 +1,98 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: bootlogd
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop: 2 3 4 5
8# Short-Description: One of the first scripts to be executed. Starts or stops
9# the bootlogd log program. If this script is called as
10# "stop-bootlogd", it will stop the daemon instead of
11# starting it even when called with the "start" argument.
12#
13### END INIT INFO
14
15PATH=/sbin:/bin:/usr/sbin:/usr/bin
16DAEMON=/sbin/bootlogd
17NAME=bootlogd
18DESC="Bootlog daemon"
19
20# source function library
21. /etc/init.d/functions
22
23test -f $DAEMON || exit 0
24
25[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
26
27## set -e # not needed
28
29case "$BOOTLOGD_ENABLE" in
30 [Nn]*)
31 exit 0
32 ;;
33esac
34
35STOPPER=
36ACTION="$1"
37case "$0" in
38 *stop-bootlog*)
39 STOPPER=Y
40 if [ "$ACTION" = start ]
41 then
42 ACTION=stop
43 fi
44 ;;
45esac
46
47case "$ACTION" in
48 start)
49 [ "${VERBOSE}" != "no" ] && echo -n "Starting $DESC: "
50 if [ -d /proc/1/. ]
51 then
52 umask 027
53 start-stop-daemon --start --quiet \
54 --exec $DAEMON -- -r -c
55 else
56 $DAEMON -r -c
57 fi
58 [ "${VERBOSE}" != "no" ] && echo "$NAME."
59 ;;
60 stop)
61 # stop may get called during bootup, so let it honor
62 # rcS VERBOSE setting
63 [ "${VERBOSE}" != "no" ] && echo -n "Stopping $DESC: "
64 start-stop-daemon --stop --quiet --exec $DAEMON
65
66 if [ "$STOPPER" ] && [ "$(which savelog 2>/dev/null)" ] && \
67 [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
68 then
69 cd /var/log
70 chgrp adm boot
71 savelog -p -c 5 boot > /dev/null 2>&1
72 mv boot.0 boot
73 mv boot~ boot.0
74 fi
75
76 [ "${VERBOSE}" != "no" ] && echo "$NAME."
77 ;;
78 restart|force-reload)
79 echo -n "Restarting $DESC: "
80 start-stop-daemon --stop --quiet --exec $DAEMON
81 sleep 1
82 start-stop-daemon --start --quiet --exec $DAEMON
83 echo "$NAME."
84 ;;
85 status)
86 status $DAEMON
87 exit $?
88 ;;
89 *)
90 N=${0##*/}
91 N=${N#[SK]??}
92 echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
93 exit 1
94 ;;
95esac
96
97exit 0
98
diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
new file mode 100755
index 0000000000..7ca41ae1ae
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -0,0 +1,182 @@
1#!/bin/sh
2#
3# rc This file is responsible for starting/stopping
4# services when the runlevel changes.
5#
6# Optimization feature:
7# A startup script is _not_ run when the service was
8# running in the previous runlevel and it wasn't stopped
9# in the runlevel transition (most Debian services don't
10# have K?? links in rc{1,2,3,4,5} )
11#
12# Author: Miquel van Smoorenburg <miquels@cistron.nl>
13# Bruce Perens <Bruce@Pixar.com>
14#
15# Version: @(#)rc 2.78 07-Nov-1999 miquels@cistron.nl
16#
17
18. /etc/default/rcS
19export VERBOSE
20
21startup_progress() {
22 step=$(($step + $step_change))
23 if [ "$num_steps" != "0" ]; then
24 progress=$((($step * $progress_size / $num_steps) + $first_step))
25 else
26 progress=$progress_size
27 fi
28 #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
29 #if type psplash-write >/dev/null 2>&1; then
30 # TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
31 #fi
32 if [ -e /mnt/.psplash/psplash_fifo ]; then
33 echo "PROGRESS $progress" > /mnt/.psplash/psplash_fifo
34 fi
35}
36
37
38#
39# Start script or program.
40#
41startup() {
42 # Handle verbosity
43 [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
44
45 case "$1" in
46 *.sh)
47 # Source shell script for speed.
48 (
49 trap - INT QUIT TSTP
50 scriptname=$1
51 shift
52 . $scriptname
53 )
54 ;;
55 *)
56 "$@"
57 ;;
58 esac
59 startup_progress
60}
61
62 # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
63 trap ":" INT QUIT TSTP
64
65 # Set onlcr to avoid staircase effect.
66 stty onlcr 0>&1
67
68 # Limit stack size for startup scripts
69 [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
70
71 # Now find out what the current and what the previous runlevel are.
72
73 runlevel=$RUNLEVEL
74 # Get first argument. Set new runlevel to this argument.
75 [ "$1" != "" ] && runlevel=$1
76 if [ "$runlevel" = "" ]
77 then
78 echo "Usage: $0 <runlevel>" >&2
79 exit 1
80 fi
81 previous=$PREVLEVEL
82 [ "$previous" = "" ] && previous=N
83
84 export runlevel previous
85
86 # Is there an rc directory for this new runlevel?
87 if [ -d /etc/rc$runlevel.d ]
88 then
89 # Find out where in the progress bar the initramfs got to.
90 PROGRESS_STATE=0
91 #if [ -f /dev/.initramfs/progress_state ]; then
92 # . /dev/.initramfs/progress_state
93 #fi
94
95 # Split the remaining portion of the progress bar into thirds
96 progress_size=$(((100 - $PROGRESS_STATE) / 3))
97
98 case "$runlevel" in
99 0|6)
100 # Count down from -100 to 0 and use the entire bar
101 first_step=-100
102 progress_size=100
103 step_change=1
104 ;;
105 S)
106 # Begin where the initramfs left off and use 2/3
107 # of the remaining space
108 first_step=$PROGRESS_STATE
109 progress_size=$(($progress_size * 2))
110 step_change=1
111 ;;
112 *)
113 # Begin where rcS left off and use the final 1/3 of
114 # the space (by leaving progress_size unchanged)
115 first_step=$(($progress_size * 2 + $PROGRESS_STATE))
116 step_change=1
117 ;;
118 esac
119
120 num_steps=0
121 for s in /etc/rc$runlevel.d/[SK]*; do
122 case "${s##/etc/rc$runlevel.d/S??}" in
123 gdm|xdm|kdm|reboot|halt)
124 break
125 ;;
126 esac
127 num_steps=$(($num_steps + 1))
128 done
129 step=0
130
131 # First, run the KILL scripts.
132 if [ $previous != N ]
133 then
134 for i in /etc/rc$runlevel.d/K[0-9][0-9]*
135 do
136 # Check if the script is there.
137 [ ! -f $i ] && continue
138
139 # Stop the service.
140 startup $i stop
141 done
142 fi
143
144 # Now run the START scripts for this runlevel.
145 for i in /etc/rc$runlevel.d/S*
146 do
147 [ ! -f $i ] && continue
148
149 if [ $previous != N ] && [ $previous != S ]
150 then
151 #
152 # Find start script in previous runlevel and
153 # stop script in this runlevel.
154 #
155 suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
156 stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
157 previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
158 #
159 # If there is a start script in the previous level
160 # and _no_ stop script in this level, we don't
161 # have to re-start the service.
162 #
163 [ -f $previous_start ] && [ ! -f $stop ] && continue
164 fi
165 case "$runlevel" in
166 0|6)
167 startup $i stop
168 ;;
169 *)
170 startup $i start
171 ;;
172 esac
173 done
174 fi
175
176#Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
177if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; then
178 if type psplash-write >/dev/null 2>&1; then
179 TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
180 umount -l /mnt/.psplash
181 fi
182fi
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS b/meta/recipes-core/sysvinit/sysvinit/rcS
new file mode 100755
index 0000000000..080b04f32f
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS
@@ -0,0 +1,34 @@
1#!/bin/sh
2#
3# rcS Call all S??* scripts in /etc/rcS.d in
4# numerical/alphabetical order.
5#
6# Version: @(#)/etc/init.d/rcS 2.76 19-Apr-1999 miquels@cistron.nl
7#
8
9PATH=/sbin:/bin:/usr/sbin:/usr/bin
10runlevel=S
11prevlevel=N
12umask 022
13export PATH runlevel prevlevel
14
15# Make sure proc is mounted
16#
17[ -d "/proc/1" ] || mount /proc
18
19#
20# Source defaults.
21#
22. /etc/default/rcS
23
24#
25# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
26#
27trap ":" INT QUIT TSTP
28
29#
30# Call all parts in order.
31#
32exec /etc/init.d/rc S
33
34
diff --git a/meta/recipes-core/sysvinit/sysvinit/rcS-default b/meta/recipes-core/sysvinit/sysvinit/rcS-default
new file mode 100644
index 0000000000..709cdf6ec5
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit/rcS-default
@@ -0,0 +1,29 @@
1#
2# Defaults for the boot scripts in /etc/rcS.d
3#
4
5# Time files in /tmp are kept in days.
6TMPTIME=0
7# Set to yes if you want sulogin to be spawned on bootup
8SULOGIN=no
9# Set to no if you want to be able to login over telnet/rlogin
10# before system startup is complete (as soon as inetd is started)
11DELAYLOGIN=no
12# Assume that the BIOS clock is set to UTC time (recommended)
13UTC=yes
14# Set VERBOSE to "no" if you would like a more quiet bootup.
15VERBOSE=no
16# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
17EDITMOTD=no
18# Whether to fsck root on boot
19ENABLE_ROOTFS_FSCK=no
20# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
21FSCKFIX=yes
22# Set TICKADJ to the correct tick value for this specific machine
23#TICKADJ=10000
24# Enable caching in populate-volatile.sh
25VOLATILE_ENABLE_CACHE=yes
26# Indicate whether the rootfs is intended to be read-only or not.
27# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
28# Normally you should not change this value.
29ROOTFS_READ_ONLY=no
diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
new file mode 100644
index 0000000000..00d333323e
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -0,0 +1,102 @@
1SUMMARY = "System-V like init"
2DESCRIPTION = "This package is required to boot in most configurations. It provides the /sbin/init program. This is the first process started on boot, and the last process terminated before the system halts."
3HOMEPAGE = "http://savannah.nongnu.org/projects/sysvinit/"
4SECTION = "base"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
7 file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
8PR = "r14"
9
10RDEPENDS_${PN} = "${PN}-inittab"
11
12SRC_URI = "${SAVANNAH_GNU_MIRROR}/sysvinit/sysvinit-${PV}.tar.bz2 \
13 file://install.patch \
14 file://crypt-lib.patch \
15 file://pidof-add-m-option.patch \
16 file://rcS-default \
17 file://rc \
18 file://rcS \
19 file://bootlogd.init \
20 file://01_bootlogd \
21"
22
23SRC_URI[md5sum] = "6eda8a97b86e0a6f59dabbf25202aa6f"
24SRC_URI[sha256sum] = "60bbc8c1e1792056e23761d22960b30bb13eccc2cabff8c7310a01f4d5df1519"
25
26S = "${WORKDIR}/sysvinit-${PV}"
27B = "${S}/src"
28
29inherit update-alternatives
30DEPENDS_append = " update-rc.d-native base-passwd"
31
32ALTERNATIVE_${PN} = "init mountpoint halt reboot runlevel shutdown poweroff last mesg utmpdump wall"
33
34ALTERNATIVE_PRIORITY = "200"
35
36ALTERNATIVE_LINK_NAME[init] = "${base_sbindir}/init"
37ALTERNATIVE_PRIORITY[init] = "50"
38
39ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
40ALTERNATIVE_LINK_NAME[halt] = "${base_sbindir}/halt"
41ALTERNATIVE_LINK_NAME[reboot] = "${base_sbindir}/reboot"
42ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
43ALTERNATIVE_LINK_NAME[shutdown] = "${base_sbindir}/shutdown"
44ALTERNATIVE_LINK_NAME[poweroff] = "${base_sbindir}/poweroff"
45
46ALTERNATIVE_${PN}-pidof = "pidof"
47ALTERNATIVE_LINK_NAME[pidof] = "${base_bindir}/pidof"
48
49ALTERNATIVE_${PN}-sulogin = "sulogin"
50ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
51
52ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1"
53
54ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
55ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
56ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
57ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
58ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
59ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
60
61PACKAGES =+ "sysvinit-pidof sysvinit-sulogin"
62FILES_${PN} += "${base_sbindir}/* ${base_bindir}/*"
63FILES_sysvinit-pidof = "${base_bindir}/pidof.sysvinit ${base_sbindir}/killall5"
64FILES_sysvinit-sulogin = "${base_sbindir}/sulogin.sysvinit"
65
66RDEPENDS_${PN} += "sysvinit-pidof initscripts-functions"
67
68CFLAGS_prepend = "-D_GNU_SOURCE "
69export LCRYPT = "-lcrypt"
70EXTRA_OEMAKE += "'base_bindir=${base_bindir}' \
71 'base_sbindir=${base_sbindir}' \
72 'bindir=${bindir}' \
73 'sbindir=${sbindir}' \
74 'sysconfdir=${sysconfdir}' \
75 'includedir=${includedir}' \
76 'mandir=${mandir}'"
77
78do_install () {
79 oe_runmake 'ROOT=${D}' install
80
81 install -d ${D}${sysconfdir} \
82 ${D}${sysconfdir}/default \
83 ${D}${sysconfdir}/init.d
84 for level in S 0 1 2 3 4 5 6; do
85 install -d ${D}${sysconfdir}/rc$level.d
86 done
87
88 install -m 0644 ${WORKDIR}/rcS-default ${D}${sysconfdir}/default/rcS
89 install -m 0755 ${WORKDIR}/rc ${D}${sysconfdir}/init.d
90 install -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d
91 install -m 0755 ${WORKDIR}/bootlogd.init ${D}${sysconfdir}/init.d/bootlogd
92 ln -sf bootlogd ${D}${sysconfdir}/init.d/stop-bootlogd
93
94 update-rc.d -r ${D} bootlogd start 07 S .
95 update-rc.d -r ${D} stop-bootlogd start 99 2 3 4 5 .
96
97 install -d ${D}${sysconfdir}/default/volatiles
98 install -m 0644 ${WORKDIR}/01_bootlogd ${D}${sysconfdir}/default/volatiles
99
100 chown root.shutdown ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
101 chmod o-x,u+s ${D}${base_sbindir}/halt ${D}${base_sbindir}/shutdown
102}
diff --git a/meta/recipes-core/uclibc/site_config/funcs b/meta/recipes-core/uclibc/site_config/funcs
new file mode 100644
index 0000000000..ccc85392d7
--- /dev/null
+++ b/meta/recipes-core/uclibc/site_config/funcs
@@ -0,0 +1,474 @@
1a64l
2abs
3access
4__adjtimex
5alarm
6alphasort
7argz_append
8__argz_count
9argz_create_sep
10argz_insert
11__argz_next
12argz_next
13__argz_stringify
14argz_stringify
15asprintf
16atexit
17atof
18atoi
19bcmp
20bcopy
21bindresvport
22bind_textdomain_codeset
23btowc
24bzero
25calloc
26canonicalize_file_name
27catgets
28cfgetospeed
29cfsetispeed
30cfsetspeed
31chmod
32chown
33chroot
34clock
35close
36closedir
37closelog
38confstr
39connect
40daemon
41dcgettext
42difftime
43dirfd
44dirname
45dngettext
46dup2
47ecvt
48endgrent
49endmntent
50endpwent
51endutent
52endutxent
53epoll_ctl
54err
55ether_hostton
56ether_ntohost
57euidaccess
58execv
59fchdir
60fchmod
61fchmodat
62fchown
63fchownat
64fcntl
65fcvt
66fdatasync
67fdopendir
68feof_unlocked
69fgets_unlocked
70fgetxattr
71finite
72flistxattr
73flock
74flockfile
75fnmatch
76fork
77fpathconf
78__fpending
79fprintf
80free
81freeaddrinfo
82freeifaddrs
83fseeko
84__fsetlocking
85fsetxattr
86fstat64
87fstat
88fstatfs
89fsync
90ftello
91ftime
92ftruncate
93funlockfile
94futimes
95futimesat
96gai_strerror
97gcvt
98getaddrinfo
99getc_unlocked
100getcwd
101getdelim
102getdomainname
103getdtablesize
104getegid
105getenv
106geteuid
107getgid
108getgrent
109getgrent_r
110getgrgid_r
111getgrnam
112getgrnam_r
113getgrouplist
114getgroups
115gethostbyaddr_r
116gethostbyname2
117gethostbyname
118gethostbyname_r
119gethostent
120gethostid
121gethostname
122getifaddrs
123getline
124getloadavg
125getmntent
126getmsg
127getnameinfo
128getnetbyaddr_r
129getnetgrent_r
130getopt
131getopt_long
132getopt_long_only
133getpagesize
134getpass
135getpeername
136getpgrp
137getpid
138getppid
139getprotoent_r
140getpwent
141getpwent_r
142getpwnam
143getpwnam_r
144getpwuid
145getpwuid_r
146getresuid
147getrlimit
148getrusage
149getservbyname
150getservbyname_r
151getservbyport_r
152getservent
153getservent_r
154getspnam
155getspnam_r
156gettimeofday
157getttyent
158getttynam
159getuid
160getusershell
161getutent
162getutid
163getutline
164getutmp
165getutmpx
166getutxent
167getutxid
168getutxline
169getwd
170getxattr
171glob
172gmtime
173gmtime_r
174grantpt
175group_member
176herror
177hstrerror
178iconv
179iconv_open
180if_freenameindex
181if_indextoname
182if_nameindex
183if_nametoindex
184index
185inet_addr
186inet_aton
187inet_ntoa
188inet_ntop
189inet_pton
190initgroups
191innetgr
192iruserok
193isascii
194isatty
195isblank
196isgraph
197isinf
198isnan
199isprint
200isspace
201iswalnum
202iswcntrl
203iswctype
204iswprint
205iswspace
206iswupper
207isxdigit
208kill
209killpg
210lchown
211lckpwdf
212lgetxattr
213link
214listxattr
215llistxattr
216localtime
217localtime_r
218lockf
219lrand48
220lsearch
221lseek64
222lsetxattr
223lstat
224mallinfo
225malloc
226mblen
227mbrlen
228mbrtowc
229mbsinit
230mbsrtowcs
231mbtowc
232memalign
233memchr
234memcmp
235memcpy
236memmove
237mempcpy
238memrchr
239memset
240mkdir
241mkdirat
242mkdtemp
243mkfifo
244mknod
245mkstemp64
246mkstemp
247mktime
248mlock
249mmap
250mtrace
251munlock
252munmap
253nanosleep
254nice
255nl_langinfo
256ntp_adjtime
257ntp_gettime
258_obstack_free
259on_exit
260open64
261open
262openat
263opendir
264openlog
265pathconf
266pipe
267poll
268popen
269posix_memalign
270prctl
271pread
272printf
273__progname
274pselect
275pthread_mutex_lock
276ptsname
277putenv
278putgrent
279putpwent
280putspent
281pututline
282pututxline
283putwc
284pwrite
285qsort
286raise
287rand
288random
289rand_r
290read
291readdir
292readdir_r
293readlink
294realloc
295realpath
296re_comp
297recvmsg
298re_exec
299regcomp
300regexec
301remove
302rename
303re_search
304rmdir
305rpmatch
306rresvport_af
307ruserok
308ruserok_af
309sbrk
310scandir
311sched_setscheduler
312sched_yield
313__secure_getenv
314select
315semctl
316semget
317sendmsg
318setbuf
319setbuffer
320setegid
321setenv
322seteuid
323setgid
324setgroups
325sethostname
326setitimer
327_setjmp
328setjmp
329setlinebuf
330setlocale
331setmntent
332setpgid
333setpgrp
334setpriority
335setregid
336setresgid
337setresuid
338setreuid
339setrlimit
340setsid
341setsockopt
342settimeofday
343setuid
344setutent
345setutxent
346setvbuf
347setxattr
348sgetspent
349shmat
350shmctl
351shmdt
352shmget
353shutdown
354sigaction
355sigaddset
356sigaltstack
357sigblock
358sigemptyset
359sighold
360siginterrupt
361signal
362sigprocmask
363sigset
364sigsetmask
365sigstack
366sigsuspend
367sigvec
368snprintf
369socket
370socketpair
371sprintf
372srand48
373srand
374srandom
375sscanf
376stat
377statfs
378statvfs
379stime
380stpcpy
381strcasecmp
382strcasestr
383strchr
384strchrnul
385strcmp
386strcspn
387strdup
388strerror
389strerror_r
390strftime
391strlen
392strncasecmp
393strncmp
394strndup
395strnlen
396strpbrk
397strptime
398strrchr
399strsep
400strsignal
401strspn
402strstr
403strtod
404strtoimax
405strtok_r
406strtol
407strtoll
408strtoul
409strtoull
410strtoumax
411strverscmp
412strxfrm
413symlink
414sync
415sysconf
416sysctl
417sysinfo
418syslog
419_sys_siglist
420sys_siglist
421system
422tcgetattr
423tcgetpgrp
424tcsetattr
425tcsetpgrp
426time
427timegm
428times
429timezone
430tmpnam
431towlower
432towupper
433truncate
434tsearch
435ttyname
436tzset
437ulimit
438umask
439uname
440unlink
441unsetenv
442unshare
443updwtmp
444updwtmpx
445usleep
446ustat
447utime
448utimes
449utmpname
450utmpxname
451valloc
452vasprintf
453verrx
454vfork
455vfprintf
456vfscanf
457vhangup
458vprintf
459vsnprintf
460vsprintf
461wait3
462wait4
463waitpid
464wcrtomb
465wcscoll
466wcsdup
467wcslen
468wctob
469wctomb
470wctype
471wcwidth
472wmemchr
473wmemcpy
474wmempcpy
diff --git a/meta/recipes-core/uclibc/site_config/headers b/meta/recipes-core/uclibc/site_config/headers
new file mode 100644
index 0000000000..609ab53797
--- /dev/null
+++ b/meta/recipes-core/uclibc/site_config/headers
@@ -0,0 +1,156 @@
1aio.h
2alloca.h
3argz.h
4arpa/inet.h
5arpa/nameser.h
6asm/byteorder.h
7asm/ioctls.h
8asm/page.h
9asm/types.h
10assert.h
11byteswap.h
12crypt.h
13ctype.h
14dirent.h
15dlfcn.h
16elf.h
17endian.h
18err.h
19errno.h
20execinfo.h
21fcntl.h
22features.h
23float.h
24fstab.h
25ftw.h
26getopt.h
27glob.h
28grp.h
29iconv.h
30ifaddrs.h
31inttypes.h
32langinfo.h
33lastlog.h
34libgen.h
35libintl.h
36limits.h
37linux/capability.h
38linux/fd.h
39linux/fs.h
40linux/hayesesp.h
41linux/hdreg.h
42linux/icmp.h
43linux/in6.h
44linux/joystick.h
45linux/ptrace.h
46linux/serial.h
47linux/sonypi.h
48linux/unistd.h
49linux/utsname.h
50linux/version.h
51locale.h
52malloc.h
53math.h
54mcheck.h
55memory.h
56mntent.h
57mqueue.h
58netdb.h
59net/if.h
60netinet/ether.h
61netinet/in.h
62netinet/ip6.h
63netinet/ip.h
64netinet/tcp.h
65netinet/udp.h
66netipx/ipx.h
67net/route.h
68paths.h
69poll.h
70pthread.h
71pty.h
72pwd.h
73regex.h
74resolv.h
75rpc/rpc.h
76rpc/types.h
77sched.h
78scsi/scsi.h
79search.h
80semaphore.h
81setjmp.h
82sgtty.h
83shadow.h
84signal.h
85stdarg.h
86stdbool.h
87stdc
88stddef.h
89stdint.h
90stdio.h
91stdlib.h
92string.h
93strings.h
94stropts.h
95sys/bitypes.h
96sys/cdefs.h
97sys/dir.h
98sys/epoll.h
99sysexits.h
100sys/fcntl.h
101sys/file.h
102sys/fsuid.h
103sys/ioctl.h
104sys/ipc.h
105syslog.h
106sys/mman.h
107sys/mount.h
108sys/mtio.h
109sys/param.h
110sys/poll.h
111sys/prctl.h
112sys/ptrace.h
113sys/queue.h
114sys/reg.h
115sys/resource.h
116sys/select.h
117sys/sem.h
118sys/shm.h
119sys/signal.h
120sys/socket.h
121sys/socketvar.h
122sys/soundcard.h
123sys/statfs.h
124sys/stat.h
125sys/statvfs.h
126sys/stropts.h
127sys/swap.h
128sys/sysctl.h
129sys/sysinfo.h
130sys/sysmacros.h
131sys/termios.h
132sys/timeb.h
133sys/time.h
134sys/times.h
135sys/timex.h
136sys/types.h
137sys/uio.h
138sys/un.h
139sys/unistd.h
140sys/user.h
141sys/utsname.h
142sys/vfs.h
143sys/wait.h
144termio.h
145termios.h
146time.h
147ttyent.h
148ulimit.h
149unistd.h
150ustat.h
151utime.h
152utmp.h
153utmpx.h
154values.h
155wchar.h
156wctype.h
diff --git a/meta/recipes-core/uclibc/site_config/types b/meta/recipes-core/uclibc/site_config/types
new file mode 100644
index 0000000000..178bd85a00
--- /dev/null
+++ b/meta/recipes-core/uclibc/site_config/types
@@ -0,0 +1,21 @@
1char
2char *
3double
4float
5int
6long
7long double
8long int
9long long
10long long int
11short
12short int
13signed char
14unsigned char
15unsigned int
16unsigned long
17unsigned long int
18unsigned long long int
19unsigned short
20unsigned short int
21void *
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc
new file mode 100644
index 0000000000..8b9e41c64d
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-config.inc
@@ -0,0 +1,142 @@
1DEPENDS += "kern-tools-native"
2inherit cml1
3#
4# Set the ARCH environment variable for uClibc compilation.
5# Return value must match one of the architectures known to uClibc:
6# libc/sysdeps/*/*
7#
8
9valid_archs = "\
10alpha \
11arm \
12avr32 \
13bfin \
14c6x \
15cris \
16e1 \
17frv \
18h8300 \
19hppa \
20i386 \
21i960 \
22ia64 \
23m68k \
24microblaze \
25mips \
26nios \
27nios2 \
28powerpc \
29sh \
30sh64 \
31sparc \
32v850 \
33vax \
34x86_64 \
35xtensa \
36"
37def map_uclibc_arch(a, d):
38 """Return the uClibc architecture for the given TARGET_ARCH."""
39 import re
40
41 valid_archs = d.getVar('valid_archs', True).split()
42
43 if re.match('^(arm|sa110).*', a):
44 return 'arm'
45 elif re.match('^(i.86|athlon)$', a):
46 return 'i386'
47 elif re.match('^mips.*', a):
48 return 'mips'
49 elif re.match('^parisc.*', a):
50 return 'hppa'
51 elif re.match('^ppc.*', a):
52 return 'powerpc'
53 elif re.match('^s390.*', a):
54 return 's390'
55 elif re.match('^sh.*', a):
56 return 'sh'
57 elif re.match('^(sun|sparc).*', a):
58 return 'sparc'
59 elif re.match('^xtensa.*', a):
60 return 'xtensa'
61 elif a in valid_archs:
62 return a
63 else:
64 bb.error("cannot map '%s' to a uClibc architecture" % a)
65
66export UCLIBC_ARCH = "${@map_uclibc_arch(d.getVar('TARGET_ARCH', True), d)}"
67
68def map_uclibc_abi(o, d):
69 """Return the uClibc ABI for the given TARGET_OS."""
70 import re
71
72 arch = d.getVar('TARGET_ARCH', True)
73 if map_uclibc_arch(d.getVar('TARGET_ARCH', True), d) == "arm":
74 if re.match('.*eabi$', o):
75 return 'ARM_EABI'
76 else:
77 return 'ARM_OABI'
78 # FIXME: This is inaccurate! Handle o32, n32, n64
79 elif re.match('^mips.*64$', arch):
80 return 'MIPS_N64_ABI'
81 elif re.match('^mips.*', arch):
82 return 'MIPS_O32_ABI'
83 return ""
84
85export UCLIBC_ABI = "${@map_uclibc_abi(d.getVar('TARGET_OS', True), d)}"
86
87def map_uclibc_endian(a, d):
88 """Return the uClibc endianess for the given TARGET_ARCH."""
89 import re
90
91 # Always BE
92 if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a):
93 return 'BIG'
94 # Possibly BE
95 elif re.match('^(((arm|sa110).*eb)|h8300.*eb|(parisc|hppa).*eb|mips|mips64|sh.*eb|xtensa.*eb)$', a):
96 return 'BIG'
97 return 'LITTLE'
98
99export UCLIBC_ENDIAN = "${@map_uclibc_endian(d.getVar('TARGET_ARCH', True), d)}"
100
101# internal helper
102def uclibc_cfg(feature, features, tokens, cnf, rem):
103 if type(tokens) == type(""):
104 tokens = [tokens]
105 rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
106 if type(features) == type([]) and feature in features:
107 cnf.extend([token + '=y' for token in tokens])
108 else:
109 cnf.extend(['# ' + token + ' is not set' for token in tokens])
110
111# Map distro features to config settings
112def features_to_uclibc_settings(d):
113 cnf, rem = ([], [])
114 distro_features = d.getVar('DISTRO_FEATURES', True).split()
115 uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem)
116 uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem)
117 uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem)
118 uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem)
119 uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem)
120 uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem)
121 uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem)
122 uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem)
123 uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem)
124 return "\n".join(cnf), "\n".join(rem)
125# X, Y = ${@features_to_uclibc_settings(d)}
126# unfortunately doesn't seem to work with bitbake, workaround:
127def features_to_uclibc_conf(d):
128 cnf, rem = features_to_uclibc_settings(d)
129 return cnf
130def features_to_uclibc_del(d):
131 cnf, rem = features_to_uclibc_settings(d)
132 return rem
133
134# returns all the elements from the src uri that are .cfg files
135def find_cfgs(d):
136 sources=src_patches(d, True)
137 sources_list=[]
138 for s in sources:
139 if s.endswith('.cfg'):
140 sources_list.append(s)
141
142 return sources_list
diff --git a/meta/recipes-core/uclibc/uclibc-git.inc b/meta/recipes-core/uclibc/uclibc-git.inc
new file mode 100644
index 0000000000..a2b2353c5a
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git.inc
@@ -0,0 +1,29 @@
1SRCREV = "48a0006012679ff0eda6f256da958d73a924fb57"
2
3PV = "0.9.33+git${SRCPV}"
4
5FILESEXTRAPATHS =. "${FILE_DIRNAME}/uclibc-git:"
6
7SRC_URI = "git://uclibc.org/uClibc.git;branch=master \
8 file://uClibc.machine \
9 file://uClibc.distro \
10 file://obstack.cfg \
11 file://locale.cfg \
12 file://uclibc_enable_log2_test.patch \
13 file://powerpc_copysignl.patch \
14 file://argp-support.patch \
15 file://argp-headers.patch \
16 file://remove_attribute_optimize_Os.patch \
17 file://compile-arm-fork-with-O2.patch \
18 file://orign_path.patch \
19 file://0001-atexit_old-Do-not-add-it-to-shared-libc.patch \
20 file://0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch \
21 file://0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch \
22 file://0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch \
23 file://0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch \
24 file://0001-Add-eventfd_read-and-eventfd_write.patch \
25 file://0002-wire-setns-syscall.patch \
26 file://0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch \
27 file://0001-timex-Sync-with-glibc.patch \
28 "
29S = "${WORKDIR}/git"
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Add-eventfd_read-and-eventfd_write.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Add-eventfd_read-and-eventfd_write.patch
new file mode 100644
index 0000000000..dd0efc0f36
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-Add-eventfd_read-and-eventfd_write.patch
@@ -0,0 +1,120 @@
1From e3aae24ede969e2dede1aa19c2ee520cab71ce11 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Feb 2014 00:30:18 -0800
4Subject: [PATCH 1/3] Add eventfd_read() and eventfd_write()
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 libc/sysdeps/linux/common/Makefile.in | 2 ++
10 libc/sysdeps/linux/common/eventfd_read.c | 27 +++++++++++++++++++++++++++
11 libc/sysdeps/linux/common/eventfd_write.c | 28 ++++++++++++++++++++++++++++
12 libc/sysdeps/linux/common/sys/eventfd.h | 4 ----
13 4 files changed, 57 insertions(+), 4 deletions(-)
14 create mode 100644 libc/sysdeps/linux/common/eventfd_read.c
15 create mode 100644 libc/sysdeps/linux/common/eventfd_write.c
16
17diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
18index dbf0b0f..45d2e21 100644
19--- a/libc/sysdeps/linux/common/Makefile.in
20+++ b/libc/sysdeps/linux/common/Makefile.in
21@@ -25,6 +25,8 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
22 capset.c \
23 dup3.c \
24 eventfd.c \
25+ eventfd_read.c \
26+ eventfd_write.c \
27 inotify.c \
28 ioperm.c \
29 iopl.c \
30diff --git a/libc/sysdeps/linux/common/eventfd_read.c b/libc/sysdeps/linux/common/eventfd_read.c
31new file mode 100644
32index 0000000..75f2aaa
33--- /dev/null
34+++ b/libc/sysdeps/linux/common/eventfd_read.c
35@@ -0,0 +1,27 @@
36+/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
37+ This file is part of the GNU C Library.
38+
39+ The GNU C Library is free software; you can redistribute it and/or
40+ modify it under the terms of the GNU Lesser General Public
41+ License as published by the Free Software Foundation; either
42+ version 2.1 of the License, or (at your option) any later version.
43+
44+ The GNU C Library is distributed in the hope that it will be useful,
45+ but WITHOUT ANY WARRANTY; without even the implied warranty of
46+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
47+ Lesser General Public License for more details.
48+
49+ You should have received a copy of the GNU Lesser General Public
50+ License along with the GNU C Library; if not, see
51+ <http://www.gnu.org/licenses/>. */
52+
53+#include <errno.h>
54+#include <unistd.h>
55+#include <sys/eventfd.h>
56+
57+
58+int
59+eventfd_read (int fd, eventfd_t *value)
60+{
61+ return read (fd, value, sizeof (eventfd_t)) != sizeof (eventfd_t) ? -1 : 0;
62+}
63diff --git a/libc/sysdeps/linux/common/eventfd_write.c b/libc/sysdeps/linux/common/eventfd_write.c
64new file mode 100644
65index 0000000..e1509cf
66--- /dev/null
67+++ b/libc/sysdeps/linux/common/eventfd_write.c
68@@ -0,0 +1,28 @@
69+/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
70+ This file is part of the GNU C Library.
71+
72+ The GNU C Library is free software; you can redistribute it and/or
73+ modify it under the terms of the GNU Lesser General Public
74+ License as published by the Free Software Foundation; either
75+ version 2.1 of the License, or (at your option) any later version.
76+
77+ The GNU C Library is distributed in the hope that it will be useful,
78+ but WITHOUT ANY WARRANTY; without even the implied warranty of
79+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
80+ Lesser General Public License for more details.
81+
82+ You should have received a copy of the GNU Lesser General Public
83+ License along with the GNU C Library; if not, see
84+ <http://www.gnu.org/licenses/>. */
85+
86+#include <errno.h>
87+#include <unistd.h>
88+#include <sys/eventfd.h>
89+
90+
91+int
92+eventfd_write (int fd, eventfd_t value)
93+{
94+ return write (fd, &value,
95+ sizeof (eventfd_t)) != sizeof (eventfd_t) ? -1 : 0;
96+}
97diff --git a/libc/sysdeps/linux/common/sys/eventfd.h b/libc/sysdeps/linux/common/sys/eventfd.h
98index 1bf785f..91b265b 100644
99--- a/libc/sysdeps/linux/common/sys/eventfd.h
100+++ b/libc/sysdeps/linux/common/sys/eventfd.h
101@@ -33,16 +33,12 @@ __BEGIN_DECLS
102 value to COUNT. */
103 extern int eventfd (int __count, int __flags) __THROW;
104
105-#if 0 /* not (yet) implemented in uClibc */
106-
107 /* Read event counter and possibly wait for events. */
108 extern int eventfd_read (int __fd, eventfd_t *__value);
109
110 /* Increment event counter. */
111 extern int eventfd_write (int __fd, eventfd_t __value);
112
113-#endif
114-
115 __END_DECLS
116
117 #endif /* sys/eventfd.h */
118--
1191.9.0
120
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch
new file mode 100644
index 0000000000..d613823695
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-Define-IPTOS_CLASS_-macros-according-to-RFC-2474.patch
@@ -0,0 +1,75 @@
1From be8ed13a90c528adfbe3c8543946bb2c5a2ad713 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 25 Aug 2014 15:50:36 -0700
4Subject: [PATCH] Define IPTOS_CLASS_* macros according to RFC 2474
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-status: Pending
8---
9 include/netinet/ip.h | 42 ++++++++++++++++++++++++++++++------------
10 1 file changed, 30 insertions(+), 12 deletions(-)
11
12diff --git a/include/netinet/ip.h b/include/netinet/ip.h
13index 19e1249..3fe58b9 100644
14--- a/include/netinet/ip.h
15+++ b/include/netinet/ip.h
16@@ -188,7 +188,25 @@ struct ip_timestamp
17 #define IPTOS_DSCP_EF 0xb8
18
19 /*
20- * Definitions for IP type of service (ip_tos)
21+ * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
22+ * the old ToS Precedence values.
23+ */
24+#define IPTOS_CLASS_MASK 0xe0
25+#define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK)
26+#define IPTOS_CLASS_CS0 0x00
27+#define IPTOS_CLASS_CS1 0x20
28+#define IPTOS_CLASS_CS2 0x40
29+#define IPTOS_CLASS_CS3 0x60
30+#define IPTOS_CLASS_CS4 0x80
31+#define IPTOS_CLASS_CS5 0xa0
32+#define IPTOS_CLASS_CS6 0xc0
33+#define IPTOS_CLASS_CS7 0xe0
34+
35+#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
36+
37+/*
38+ * Definitions for IP type of service (ip_tos) [deprecated; use DSCP
39+ * and CS definitions above instead.]
40 */
41 #define IPTOS_TOS_MASK 0x1E
42 #define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
43@@ -199,18 +217,18 @@ struct ip_timestamp
44 #define IPTOS_MINCOST IPTOS_LOWCOST
45
46 /*
47- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
48+ * Definitions for IP precedence (also in ip_tos) [also deprecated.]
49 */
50-#define IPTOS_PREC_MASK 0xe0
51-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
52-#define IPTOS_PREC_NETCONTROL 0xe0
53-#define IPTOS_PREC_INTERNETCONTROL 0xc0
54-#define IPTOS_PREC_CRITIC_ECP 0xa0
55-#define IPTOS_PREC_FLASHOVERRIDE 0x80
56-#define IPTOS_PREC_FLASH 0x60
57-#define IPTOS_PREC_IMMEDIATE 0x40
58-#define IPTOS_PREC_PRIORITY 0x20
59-#define IPTOS_PREC_ROUTINE 0x00
60+#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
61+#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
62+#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
63+#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
64+#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
65+#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
66+#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
67+#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
68+#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
69+#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
70
71 /*
72 * Definitions for options.
73--
742.1.0
75
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch b/meta/recipes-core/uclibc/uclibc-git/0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch
new file mode 100644
index 0000000000..4ac765c334
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch
@@ -0,0 +1,319 @@
1Upstream-Status: Pending
2
3From 096abf14d2dc978607ccd8a0d7f42da65d8991f3 Mon Sep 17 00:00:00 2001
4From: Khem Raj <raj.khem@gmail.com>
5Date: Sun, 9 Sep 2012 22:00:04 -0700
6Subject: [PATCH] Revert "utent.c, wtent.c: move functions from utxent.c"
7
8This reverts commit 84135275cfeebc0b233c1c96eeada4d4178a0b18.
9---
10 include/utmp.h | 8 +++++
11 libc/misc/utmp/utent.c | 80 +++++++++++------------------------------------
12 libc/misc/utmp/utxent.c | 4 +--
13 libc/misc/utmp/wtent.c | 14 ++-------
14 4 files changed, 30 insertions(+), 76 deletions(-)
15
16Index: git/include/utmp.h
17===================================================================
18--- git.orig/include/utmp.h 2013-01-21 16:37:18.000000000 -0800
19+++ git/include/utmp.h 2013-01-21 16:40:56.987583099 -0800
20@@ -56,30 +56,37 @@
21 /* Append entry UTMP to the wtmp-like file WTMP_FILE. */
22 extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
23 __THROW;
24+libc_hidden_proto(updwtmp)
25
26 /* Change name of the utmp file to be examined. */
27 extern int utmpname (const char *__file) __THROW;
28+libc_hidden_proto(utmpname)
29
30 /* Read next entry from a utmp-like file. */
31 extern struct utmp *getutent (void) __THROW;
32+libc_hidden_proto(getutent)
33
34 /* Reset the input stream to the beginning of the file. */
35 extern void setutent (void) __THROW;
36+libc_hidden_proto(setutent)
37
38 /* Close the current open file. */
39 extern void endutent (void) __THROW;
40+libc_hidden_proto(endutent)
41
42 /* Search forward from the current point in the utmp file until the
43 next entry with a ut_type matching ID->ut_type. */
44 extern struct utmp *getutid (const struct utmp *__id) __THROW;
45+libc_hidden_proto(getutid)
46
47 /* Search forward from the current point in the utmp file until the
48 next entry with a ut_line matching LINE->ut_line. */
49 extern struct utmp *getutline (const struct utmp *__line) __THROW;
50+libc_hidden_proto(getutline)
51
52 /* Write out entry pointed to by UTMP_PTR into the utmp file. */
53 extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
54-
55+libc_hidden_proto(pututline)
56
57 #if 0 /* def __USE_MISC */
58 /* Reentrant versions of the file for handling utmp files. */
59Index: git/libc/misc/utmp/utent.c
60===================================================================
61--- git.orig/libc/misc/utmp/utent.c 2013-01-21 16:37:18.000000000 -0800
62+++ git/libc/misc/utmp/utent.c 2013-01-21 16:38:14.035578638 -0800
63@@ -19,9 +19,6 @@
64 #include <errno.h>
65 #include <string.h>
66 #include <utmp.h>
67-#ifdef __UCLIBC_HAS_UTMPX__
68-# include <utmpx.h>
69-#endif
70 #include <not-cancel.h>
71
72 #include <bits/uClibc_mutex.h>
73@@ -34,7 +31,7 @@
74 static const char *static_ut_name = default_file_name;
75
76 /* This function must be called with the LOCK held */
77-static void __setutent_unlocked(void)
78+static void __setutent(void)
79 {
80 if (static_fd < 0) {
81 static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
82@@ -53,24 +50,19 @@
83 lseek(static_fd, 0, SEEK_SET);
84 }
85 #if defined __UCLIBC_HAS_THREADS__
86-static void __setutent(void)
87+void setutent(void)
88 {
89 __UCLIBC_MUTEX_LOCK(utmplock);
90- __setutent_unlocked();
91+ __setutent();
92 __UCLIBC_MUTEX_UNLOCK(utmplock);
93 }
94 #else
95-static void __setutent(void);
96-strong_alias(__setutent_unlocked,__setutent)
97-#endif
98 strong_alias(__setutent,setutent)
99-
100-#ifdef __UCLIBC_HAS_UTMPX__
101-strong_alias(__setutent,setutxent)
102 #endif
103+libc_hidden_def(setutent)
104
105 /* This function must be called with the LOCK held */
106-static struct utmp *__getutent_unlocked(void)
107+static struct utmp *__getutent(void)
108 {
109 if (static_fd < 0) {
110 __setutent();
111@@ -86,27 +78,19 @@
112 return NULL;
113 }
114 #if defined __UCLIBC_HAS_THREADS__
115-static struct utmp *__getutent(void)
116+struct utmp *getutent(void)
117 {
118 struct utmp *ret;
119
120 __UCLIBC_MUTEX_LOCK(utmplock);
121- ret = __getutent_unlocked();
122+ ret = __getutent();
123 __UCLIBC_MUTEX_UNLOCK(utmplock);
124 return ret;
125 }
126 #else
127-static struct utmp *__getutent(void);
128-strong_alias(__getutent_unlocked,__getutent)
129-#endif
130 strong_alias(__getutent,getutent)
131-
132-#ifdef __UCLIBC_HAS_UTMPX__
133-struct utmpx *getutxent(void)
134-{
135- return (struct utmpx *) __getutent ();
136-}
137 #endif
138+libc_hidden_def(getutent)
139
140 static void __endutent(void)
141 {
142@@ -117,13 +101,10 @@
143 __UCLIBC_MUTEX_UNLOCK(utmplock);
144 }
145 strong_alias(__endutent,endutent)
146-
147-#ifdef __UCLIBC_HAS_UTMPX__
148-strong_alias(__endutent,endutxent)
149-#endif
150+libc_hidden_def(endutent)
151
152 /* This function must be called with the LOCK held */
153-static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
154+static struct utmp *__getutid(const struct utmp *utmp_entry)
155 {
156 struct utmp *lutmp;
157 unsigned type;
158@@ -133,7 +114,7 @@
159 type = utmp_entry->ut_type - 1;
160 type /= 4;
161
162- while ((lutmp = __getutent_unlocked()) != NULL) {
163+ while ((lutmp = __getutent()) != NULL) {
164 if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
165 /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
166 return lutmp;
167@@ -147,34 +128,26 @@
168 return NULL;
169 }
170 #if defined __UCLIBC_HAS_THREADS__
171-static struct utmp *__getutid(const struct utmp *utmp_entry)
172+struct utmp *getutid(const struct utmp *utmp_entry)
173 {
174 struct utmp *ret;
175
176 __UCLIBC_MUTEX_LOCK(utmplock);
177- ret = __getutid_unlocked(utmp_entry);
178+ ret = __getutid(utmp_entry);
179 __UCLIBC_MUTEX_UNLOCK(utmplock);
180 return ret;
181 }
182 #else
183-static struct utmp *__getutid(const struct utmp *utmp_entry);
184-strong_alias(__getutid_unlocked,__getutid)
185-#endif
186 strong_alias(__getutid,getutid)
187-
188-#ifdef __UCLIBC_HAS_UTMPX__
189-struct utmpx *getutxid(const struct utmpx *utmp_entry)
190-{
191- return (struct utmpx *) __getutid ((const struct utmp *) utmp_entry);
192-}
193 #endif
194+libc_hidden_def(getutid)
195
196 static struct utmp *__getutline(const struct utmp *utmp_entry)
197 {
198 struct utmp *lutmp;
199
200 __UCLIBC_MUTEX_LOCK(utmplock);
201- while ((lutmp = __getutent_unlocked()) != NULL) {
202+ while ((lutmp = __getutent()) != NULL) {
203 if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
204 if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
205 break;
206@@ -185,13 +158,7 @@
207 return lutmp;
208 }
209 strong_alias(__getutline,getutline)
210-
211-#ifdef __UCLIBC_HAS_UTMPX__
212-struct utmpx *getutxline(const struct utmpx *utmp_entry)
213-{
214- return (struct utmpx *) __getutline ((const struct utmp *) utmp_entry);
215-}
216-#endif
217+libc_hidden_def(getutline)
218
219 static struct utmp *__pututline(const struct utmp *utmp_entry)
220 {
221@@ -200,7 +167,7 @@
222 the file pointer where they want it, everything will work out. */
223 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
224
225- if (__getutid_unlocked(utmp_entry) != NULL)
226+ if (__getutid(utmp_entry) != NULL)
227 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
228 else
229 lseek(static_fd, (off_t) 0, SEEK_END);
230@@ -211,13 +178,7 @@
231 return (struct utmp *)utmp_entry;
232 }
233 strong_alias(__pututline,pututline)
234-
235-#ifdef __UCLIBC_HAS_UTMPX__
236-struct utmpx *pututxline (const struct utmpx *utmp_entry)
237-{
238- return (struct utmpx *) __pututline ((const struct utmp *) utmp_entry);
239-}
240-#endif
241+libc_hidden_def(pututline)
242
243 static int __utmpname(const char *new_ut_name)
244 {
245@@ -241,7 +202,4 @@
246 return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
247 }
248 strong_alias(__utmpname,utmpname)
249-
250-#ifdef __UCLIBC_HAS_UTMPX__
251-strong_alias(__utmpname,utmpxname)
252-#endif
253+libc_hidden_def(utmpname)
254Index: git/libc/misc/utmp/utxent.c
255===================================================================
256--- git.orig/libc/misc/utmp/utxent.c 2013-01-21 16:37:18.000000000 -0800
257+++ git/libc/misc/utmp/utxent.c 2013-01-21 16:38:14.035578638 -0800
258@@ -13,7 +13,6 @@
259 #include <utmpx.h>
260 #include <utmp.h>
261
262-#if 0 /* moved to utent.c */
263 void setutxent(void)
264 {
265 setutent ();
266@@ -49,12 +48,10 @@
267 return utmpname (new_ut_name);
268 }
269
270-/* moved to wtent.c */
271 void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
272 {
273 updwtmp (wtmpx_file, (const struct utmp *) utmpx);
274 }
275-#endif
276
277 /* Copy the information in UTMPX to UTMP. */
278 void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
279@@ -107,3 +104,4 @@
280 utmpx->ut_time = utmp->ut_time;
281 #endif
282 }
283+
284Index: git/libc/misc/utmp/wtent.c
285===================================================================
286--- git.orig/libc/misc/utmp/wtent.c 2013-01-21 16:37:18.000000000 -0800
287+++ git/libc/misc/utmp/wtent.c 2013-01-21 16:38:14.035578638 -0800
288@@ -11,9 +11,6 @@
289 #include <time.h>
290 #include <unistd.h>
291 #include <utmp.h>
292-#ifdef __UCLIBC_HAS_UTMPX__
293-# include <utmpx.h>
294-#endif
295 #include <fcntl.h>
296 #include <sys/file.h>
297 #include <not-cancel.h>
298@@ -36,7 +33,7 @@
299 }
300 #endif
301
302-static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
303+void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
304 {
305 int fd;
306
307@@ -49,11 +46,4 @@
308 }
309 }
310 }
311-strong_alias(__updwtmp,updwtmp)
312-
313-#ifdef __UCLIBC_HAS_UTMPX__
314-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
315-{
316- __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
317-}
318-#endif
319+libc_hidden_def(updwtmp)
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch b/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch
new file mode 100644
index 0000000000..b6dfce483e
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-atexit_old-Do-not-add-it-to-shared-libc.patch
@@ -0,0 +1,44 @@
1From 74667582526b39a1906228574d73a6528f4587eb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 13:26:30 -0700
4Subject: [PATCH] atexit_old: Do not add it to shared libc
5
6atexit should only be in either uclibc_nonshared.a
7shared libc case or libc.a in static build case
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10
11Upstream-Status: Pending
12---
13 libc/stdlib/Makefile.in | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
17index 3166b8e..3d686d9 100644
18--- a/libc/stdlib/Makefile.in
19+++ b/libc/stdlib/Makefile.in
20@@ -60,7 +60,6 @@ CSRC-$(if $(findstring yyy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_X
21
22 # multi source _atexit.c
23 CSRC-y += __cxa_atexit.c __cxa_finalize.c __exit_handler.c exit.c on_exit.c
24-CSRC-$(COMPAT_ATEXIT) += old_atexit.c
25
26 STDLIB_DIR := $(top_srcdir)libc/stdlib
27 STDLIB_OUT := $(top_builddir)libc/stdlib
28@@ -70,11 +69,12 @@ STDLIB_OBJ := $(patsubst %.c,$(STDLIB_OUT)/%.o,$(CSRC-y))
29
30 libc-y += $(STDLIB_OBJ)
31 libc-static-y += $(STDLIB_OUT)/atexit.o $(STDLIB_OUT)/system.o
32+libc-static-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.o
33 libc-shared-y += $(STDLIB_OUT)/system.oS
34
35 # this should always be the PIC version, because it could be used in shared libs
36 libc-nonshared-y += $(STDLIB_OUT)/atexit.os
37-
38+libc-nonshared-$(COMPAT_ATEXIT) += $(STDLIB_OUT)/old_atexit.os
39 libc-nomulti-y += $(STDLIB_OUT)/labs.o $(STDLIB_OUT)/atol.o $(STDLIB_OUT)/_stdlib_strto_l.o $(STDLIB_OUT)/_stdlib_strto_ll.o
40 libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STDLIB_OUT)/_stdlib_strto_l_l.o $(STDLIB_OUT)/_stdlib_strto_ll_l.o
41
42--
431.7.9.5
44
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch b/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch
new file mode 100644
index 0000000000..ecb9d31645
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-librt-Use-nodefaultlibs-instead-of-nostdlib.patch
@@ -0,0 +1,33 @@
1From 95f9b6f37152b8316735d3c86c0db963ff59e22d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 16:51:52 -0700
4Subject: [PATCH] librt: Use -nodefaultlibs instead of -nostdlib
5
6nostdlib disables linking in startup files too which is not
7what we want here since it needs to resolve __dso_handle
8which comes from crtbeginS.o, otherwise librt has this
9undefined reference to a weak undefined __dso_handle that
10shows up as error (with gold linker)
11when shared libraries are being built which are
12linking in librt
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Upstream-Status: Pending
16---
17 librt/Makefile.in | 1 +
18 1 file changed, 1 insertion(+)
19
20Index: git/librt/Makefile.in
21===================================================================
22--- git.orig/librt/Makefile.in 2012-06-24 10:32:59.512653237 -0700
23+++ git/librt/Makefile.in 2012-06-24 11:31:00.660821666 -0700
24@@ -15,6 +15,9 @@
25 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
26 LIBS-librt.so += $(top_builddir)lib/libdl.so $(top_builddir)lib/libpthread.so
27 endif
28+START_FILE-librt.so := $(SHARED_START_FILES)
29+END_FILE-librt.so := $(SHARED_END_FILES)
30+
31
32 librt_FULL_NAME := librt-$(VERSION).so
33
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
new file mode 100644
index 0000000000..7e7c5793f1
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-arm-Move-aeabi_read_tp-to-uclibc_nonshared.a.patch
@@ -0,0 +1,28 @@
1From 714f543f4fa8fb3911449b6ce1517481359e0cff Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 14:21:17 -0700
4Subject: [PATCH] nptl/arm: Move aeabi_read_tp to uclibc_nonshared.a
5
6Otherwise it creates wrong references from shared libs
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9Upstream-Status: Pending
10---
11 libc/sysdeps/linux/arm/Makefile.arch | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14Index: git/libc/sysdeps/linux/arm/Makefile.arch
15===================================================================
16--- git.orig/libc/sysdeps/linux/arm/Makefile.arch 2013-05-23 11:13:32.000000000 -0700
17+++ git/libc/sysdeps/linux/arm/Makefile.arch 2013-05-23 11:16:18.304333131 -0700
18@@ -13,7 +13,9 @@
19 vfork.S clone.S
20
21 SSRC-$(UCLIBC_HAS_LFS) += mmap64.S
22-SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-aeabi_read_tp.S libc-thumb_atomics.S
23+SSRC-$(UCLIBC_HAS_THREADS_NATIVE) += libc-thumb_atomics.S
24+libc-nonshared-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.os
25+libc-static-$(UCLIBC_HAS_THREADS_NATIVE) += $(ARCH_OUT)/libc-aeabi_read_tp.o
26 CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c
27 SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S
28
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
new file mode 100644
index 0000000000..297a40bd04
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-nptl-atfork-Hide-pthread_atfork-in-shared-versions.patch
@@ -0,0 +1,74 @@
1From d021e6252b33e779857846714fb1899a25c9965d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 23 Jun 2012 15:59:01 -0700
4Subject: [PATCH] nptl/atfork: Hide pthread_atfork in shared versions
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 libpthread/nptl/Makefile.in | 4 +++-
10 libpthread/nptl/pthread_atfork.c | 12 ++++++++++--
11 2 files changed, 13 insertions(+), 3 deletions(-)
12
13diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
14index 158bcae..3ef7175 100644
15--- a/libpthread/nptl/Makefile.in
16+++ b/libpthread/nptl/Makefile.in
17@@ -16,6 +16,7 @@ libc-shared-routines-y = forward.c libc-cancellation.c
18 libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
19 libpthread-shared-only-routines-y = version.c
20 libpthread-static-only-routines-y = pthread_atfork.c
21+
22 libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
23 libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
24 libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
25@@ -208,7 +209,7 @@ CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
26 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
27
28 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
29-
30+CFLAGS-pthread_atfork.c = -DNOT_IN_libc
31 #
32 # The rest of this file is uClibc specific.
33 #
34@@ -224,3 +225,4 @@ CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-nptl)
35 CFLAGS-OMIT-forward.c = $(CFLAGS-nptl)
36 CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-nptl)
37 CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-nptl)
38+
39diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
40index e607d49..6224c17 100644
41--- a/libpthread/nptl/pthread_atfork.c
42+++ b/libpthread/nptl/pthread_atfork.c
43@@ -38,13 +38,17 @@
44 #include <fork.h>
45
46 /* This is defined by newer gcc version unique for each module. */
47-extern void *__dso_handle __attribute__ ((__weak__));
48- //,__visibility__ ("hidden")));
49+extern void *__dso_handle __attribute__ ((__weak__,
50+ __visibility__ ("hidden")));
51
52
53 /* Hide the symbol so that no definition but the one locally in the
54 executable or DSO is used. */
55 int
56+#ifndef __pthread_atfork
57+/* Don't mark the compatibility function as hidden. */
58+attribute_hidden
59+#endif
60 __pthread_atfork (
61 void (*prepare) (void),
62 void (*parent) (void),
63@@ -53,4 +57,8 @@ __pthread_atfork (
64 return __register_atfork (prepare, parent, child,
65 &__dso_handle == NULL ? NULL : __dso_handle);
66 }
67+#ifndef __pthread_atfork
68+extern int pthread_atfork (void (*prepare) (void), void (*parent) (void),
69+ void (*child) (void)) attribute_hidden;
70 strong_alias (__pthread_atfork, pthread_atfork)
71+#endif
72--
731.7.9.5
74
diff --git a/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch b/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch
new file mode 100644
index 0000000000..5d6a0a5366
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0001-timex-Sync-with-glibc.patch
@@ -0,0 +1,33 @@
1From f489cc44a209f6c4370e94c9c788fc9cc4820be1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 25 Aug 2014 16:22:57 -0700
4Subject: [PATCH] timex: Sync with glibc
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-status: Pending
8---
9 include/sys/timex.h | 8 ++++++--
10 1 file changed, 6 insertions(+), 2 deletions(-)
11
12diff --git a/include/sys/timex.h b/include/sys/timex.h
13index 9082a28..57059bd 100644
14--- a/include/sys/timex.h
15+++ b/include/sys/timex.h
16@@ -67,8 +67,12 @@ struct timex
17 #define ADJ_ESTERROR 0x0008 /* estimated time error */
18 #define ADJ_STATUS 0x0010 /* clock status */
19 #define ADJ_TIMECONST 0x0020 /* pll time constant */
20-#define ADJ_TICK 0x4000 /* tick value */
21-#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
22+#define ADJ_TAI 0x0080 /* set TAI offset */
23+#define ADJ_MICRO 0x1000 /* select microsecond resolution */
24+#define ADJ_NANO 0x2000 /* select nanosecond resolution */
25+#define ADJ_TICK 0x4000 /* tick value */
26+#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
27+#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
28
29 /* xntp 3.4 compatibility names */
30 #define MOD_OFFSET ADJ_OFFSET
31--
322.1.0
33
diff --git a/meta/recipes-core/uclibc/uclibc-git/0002-wire-setns-syscall.patch b/meta/recipes-core/uclibc/uclibc-git/0002-wire-setns-syscall.patch
new file mode 100644
index 0000000000..94c6f68571
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/0002-wire-setns-syscall.patch
@@ -0,0 +1,68 @@
1From db575359d4b8164ad6c2ac5f36c7a50c065a2864 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Feb 2014 00:44:34 -0800
4Subject: [PATCH 2/3] wire setns syscall
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7Upstream-Status: Pending
8---
9 libc/sysdeps/linux/common/Makefile.in | 1 +
10 libc/sysdeps/linux/common/bits/sched.h | 4 ++++
11 libc/sysdeps/linux/common/setns.c | 18 ++++++++++++++++++
12 3 files changed, 23 insertions(+)
13 create mode 100644 libc/sysdeps/linux/common/setns.c
14
15diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
16index 45d2e21..10d9884 100644
17--- a/libc/sysdeps/linux/common/Makefile.in
18+++ b/libc/sysdeps/linux/common/Makefile.in
19@@ -45,6 +45,7 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
20 sendfile.c \
21 setfsgid.c \
22 setfsuid.c \
23+ setns.c \
24 setresgid.c \
25 setresuid.c \
26 signalfd.c \
27diff --git a/libc/sysdeps/linux/common/bits/sched.h b/libc/sysdeps/linux/common/bits/sched.h
28index a5eb6ee..9436f66 100644
29--- a/libc/sysdeps/linux/common/bits/sched.h
30+++ b/libc/sysdeps/linux/common/bits/sched.h
31@@ -85,6 +85,10 @@ extern int unshare (int __flags) __THROW;
32
33 /* Get index of currently used CPU. */
34 extern int sched_getcpu (void) __THROW;
35+
36+/* Switch process to namespace of type NSTYPE indicated by FD. */
37+extern int setns (int __fd, int __nstype) __THROW;
38+
39 #endif
40
41 __END_DECLS
42diff --git a/libc/sysdeps/linux/common/setns.c b/libc/sysdeps/linux/common/setns.c
43new file mode 100644
44index 0000000..376bf26
45--- /dev/null
46+++ b/libc/sysdeps/linux/common/setns.c
47@@ -0,0 +1,18 @@
48+/* vi: set sw=4 ts=4: */
49+/*
50+ * setns() for uClibc
51+ *
52+ * Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
53+ *
54+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
55+ */
56+
57+#include <sys/syscall.h>
58+#include <sched.h>
59+
60+/*
61+ * setns()
62+ */
63+#ifdef __NR_setns
64+_syscall2(int, setns, int, fd, int, nstype)
65+#endif
66--
671.9.0
68
diff --git a/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch b/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch
new file mode 100644
index 0000000000..b31b991846
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/argp-headers.patch
@@ -0,0 +1,583 @@
1Added headers file needed by argp sources.
2
3Signed-off-by: Salvatore Cro <salvatore.cro at st.com>
4---
5 include/argp.h | 566 ++++++++++++++++++++++++++++++++++++++++++++
6 libc/argp/argp-fmtstream.h | 314 ++++++++++++++++++++++++
7 2 files changed, 880 insertions(+), 0 deletions(-)
8 create mode 100644 include/argp.h
9 create mode 100644 libc/argp/argp-fmtstream.h
10
11Upstream-Status: Pending
12
13Index: git/include/argp.h
14===================================================================
15--- /dev/null
16+++ git/include/argp.h
17@@ -0,0 +1,566 @@
18+/* Hierarchial argument parsing, layered over getopt.
19+ Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009
20+ Free Software Foundation, Inc.
21+ This file is part of the GNU C Library.
22+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
23+
24+ The GNU C Library is free software; you can redistribute it and/or
25+ modify it under the terms of the GNU Lesser General Public
26+ License as published by the Free Software Foundation; either
27+ version 2.1 of the License, or (at your option) any later version.
28+
29+ The GNU C Library is distributed in the hope that it will be useful,
30+ but WITHOUT ANY WARRANTY; without even the implied warranty of
31+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32+ Lesser General Public License for more details.
33+
34+ You should have received a copy of the GNU Lesser General Public
35+ License along with the GNU C Library; if not, write to the Free
36+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
37+ 02111-1307 USA.
38+
39+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
40+*/
41+
42+#ifndef _ARGP_H
43+#define _ARGP_H
44+
45+#include <stdio.h>
46+#include <ctype.h>
47+#include <limits.h>
48+
49+#define __need_error_t
50+#include <errno.h>
51+
52+#ifndef __const
53+# define __const const
54+#endif
55+
56+#ifndef __THROW
57+# define __THROW
58+#endif
59+#ifndef __NTH
60+# define __NTH(fct) fct __THROW
61+#endif
62+
63+#ifndef __attribute__
64+/* This feature is available in gcc versions 2.5 and later. */
65+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
66+# define __attribute__(Spec) /* empty */
67+# endif
68+/* The __-protected variants of `format' and `printf' attributes
69+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
70+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
71+# define __format__ format
72+# define __printf__ printf
73+# endif
74+#endif
75+
76+/* GCC 2.95 and later have "__restrict"; C99 compilers have
77+ "restrict", and "configure" may have defined "restrict". */
78+#ifndef __restrict
79+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
80+# if defined restrict || 199901L <= __STDC_VERSION__
81+# define __restrict restrict
82+# else
83+# define __restrict
84+# endif
85+# endif
86+#endif
87+
88+#ifndef __error_t_defined
89+typedef int error_t;
90+# define __error_t_defined
91+#endif
92+
93+#ifdef __cplusplus
94+extern "C" {
95+#endif
96+
97+/* A description of a particular option. A pointer to an array of
98+ these is passed in the OPTIONS field of an argp structure. Each option
99+ entry can correspond to one long option and/or one short option; more
100+ names for the same option can be added by following an entry in an option
101+ array with options having the OPTION_ALIAS flag set. */
102+struct argp_option
103+{
104+ /* The long option name. For more than one name for the same option, you
105+ can use following options with the OPTION_ALIAS flag set. */
106+ __const char *name;
107+
108+ /* What key is returned for this option. If > 0 and printable, then it's
109+ also accepted as a short option. */
110+ int key;
111+
112+ /* If non-NULL, this is the name of the argument associated with this
113+ option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
114+ __const char *arg;
115+
116+ /* OPTION_ flags. */
117+ int flags;
118+
119+ /* The doc string for this option. If both NAME and KEY are 0, This string
120+ will be printed outdented from the normal option column, making it
121+ useful as a group header (it will be the first thing printed in its
122+ group); in this usage, it's conventional to end the string with a `:'. */
123+ __const char *doc;
124+
125+ /* The group this option is in. In a long help message, options are sorted
126+ alphabetically within each group, and the groups presented in the order
127+ 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with
128+ if this field 0 will inherit the group number of the previous entry, or
129+ zero if it's the first one, unless its a group header (NAME and KEY both
130+ 0), in which case, the previous entry + 1 is the default. Automagic
131+ options such as --help are put into group -1. */
132+ int group;
133+};
134+
135+/* The argument associated with this option is optional. */
136+#define OPTION_ARG_OPTIONAL 0x1
137+
138+/* This option isn't displayed in any help messages. */
139+#define OPTION_HIDDEN 0x2
140+
141+/* This option is an alias for the closest previous non-alias option. This
142+ means that it will be displayed in the same help entry, and will inherit
143+ fields other than NAME and KEY from the aliased option. */
144+#define OPTION_ALIAS 0x4
145+
146+/* This option isn't actually an option (and so should be ignored by the
147+ actual option parser), but rather an arbitrary piece of documentation that
148+ should be displayed in much the same manner as the options. If this flag
149+ is set, then the option NAME field is displayed unmodified (e.g., no `--'
150+ prefix is added) at the left-margin (where a *short* option would normally
151+ be displayed), and the documentation string in the normal place. For
152+ purposes of sorting, any leading whitespace and punctuation is ignored,
153+ except that if the first non-whitespace character is not `-', this entry
154+ is displayed after all options (and OPTION_DOC entries with a leading `-')
155+ in the same group. */
156+#define OPTION_DOC 0x8
157+
158+/* This option shouldn't be included in `long' usage messages (but is still
159+ included in help messages). This is mainly intended for options that are
160+ completely documented in an argp's ARGS_DOC field, in which case including
161+ the option in the generic usage list would be redundant. For instance,
162+ if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
163+ distinguish these two cases, -x should probably be marked
164+ OPTION_NO_USAGE. */
165+#define OPTION_NO_USAGE 0x10
166+
167+struct argp; /* fwd declare this type */
168+struct argp_state; /* " */
169+struct argp_child; /* " */
170+
171+/* The type of a pointer to an argp parsing function. */
172+typedef error_t (*argp_parser_t) (int __key, char *__arg,
173+ struct argp_state *__state);
174+
175+/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
176+ returns will simply be ignored. For user keys, this error will be turned
177+ into EINVAL (if the call to argp_parse is such that errors are propagated
178+ back to the user instead of exiting); returning EINVAL itself would result
179+ in an immediate stop to parsing in *all* cases. */
180+#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */
181+
182+/* Special values for the KEY argument to an argument parsing function.
183+ ARGP_ERR_UNKNOWN should be returned if they aren't understood.
184+
185+ The sequence of keys to a parsing function is either (where each
186+ uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
187+
188+ INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all
189+ or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed
190+ or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized
191+
192+ The third case is where every parser returned ARGP_KEY_UNKNOWN for an
193+ argument, in which case parsing stops at that argument (returning the
194+ unparsed arguments to the caller of argp_parse if requested, or stopping
195+ with an error message if not).
196+
197+ If an error occurs (either detected by argp, or because the parsing
198+ function returned an error value), then the parser is called with
199+ ARGP_KEY_ERROR, and no further calls are made. */
200+
201+/* This is not an option at all, but rather a command line argument. If a
202+ parser receiving this key returns success, the fact is recorded, and the
203+ ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the
204+ argument, a parser function decrements the NEXT field of the state it's
205+ passed, the option won't be considered processed; this is to allow you to
206+ actually modify the argument (perhaps into an option), and have it
207+ processed again. */
208+#define ARGP_KEY_ARG 0
209+/* There are remaining arguments not parsed by any parser, which may be found
210+ starting at (STATE->argv + STATE->next). If success is returned, but
211+ STATE->next left untouched, it's assumed that all arguments were consume,
212+ otherwise, the parser should adjust STATE->next to reflect any arguments
213+ consumed. */
214+#define ARGP_KEY_ARGS 0x1000006
215+/* There are no more command line arguments at all. */
216+#define ARGP_KEY_END 0x1000001
217+/* Because it's common to want to do some special processing if there aren't
218+ any non-option args, user parsers are called with this key if they didn't
219+ successfully process any non-option arguments. Called just before
220+ ARGP_KEY_END (where more general validity checks on previously parsed
221+ arguments can take place). */
222+#define ARGP_KEY_NO_ARGS 0x1000002
223+/* Passed in before any parsing is done. Afterwards, the values of each
224+ element of the CHILD_INPUT field, if any, in the state structure is
225+ copied to each child's state to be the initial value of the INPUT field. */
226+#define ARGP_KEY_INIT 0x1000003
227+/* Use after all other keys, including SUCCESS & END. */
228+#define ARGP_KEY_FINI 0x1000007
229+/* Passed in when parsing has successfully been completed (even if there are
230+ still arguments remaining). */
231+#define ARGP_KEY_SUCCESS 0x1000004
232+/* Passed in if an error occurs. */
233+#define ARGP_KEY_ERROR 0x1000005
234+
235+/* An argp structure contains a set of options declarations, a function to
236+ deal with parsing one, documentation string, a possible vector of child
237+ argp's, and perhaps a function to filter help output. When actually
238+ parsing options, getopt is called with the union of all the argp
239+ structures chained together through their CHILD pointers, with conflicts
240+ being resolved in favor of the first occurrence in the chain. */
241+struct argp
242+{
243+ /* An array of argp_option structures, terminated by an entry with both
244+ NAME and KEY having a value of 0. */
245+ __const struct argp_option *options;
246+
247+ /* What to do with an option from this structure. KEY is the key
248+ associated with the option, and ARG is any associated argument (NULL if
249+ none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be
250+ returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
251+ parsing is stopped immediately, and that value is returned from
252+ argp_parse(). For special (non-user-supplied) values of KEY, see the
253+ ARGP_KEY_ definitions below. */
254+ argp_parser_t parser;
255+
256+ /* A string describing what other arguments are wanted by this program. It
257+ is only used by argp_usage to print the `Usage:' message. If it
258+ contains newlines, the strings separated by them are considered
259+ alternative usage patterns, and printed on separate lines (lines after
260+ the first are prefix by ` or: ' instead of `Usage:'). */
261+ __const char *args_doc;
262+
263+ /* If non-NULL, a string containing extra text to be printed before and
264+ after the options in a long help message (separated by a vertical tab
265+ `\v' character). */
266+ __const char *doc;
267+
268+ /* A vector of argp_children structures, terminated by a member with a 0
269+ argp field, pointing to child argps should be parsed with this one. Any
270+ conflicts are resolved in favor of this argp, or early argps in the
271+ CHILDREN list. This field is useful if you use libraries that supply
272+ their own argp structure, which you want to use in conjunction with your
273+ own. */
274+ __const struct argp_child *children;
275+
276+ /* If non-zero, this should be a function to filter the output of help
277+ messages. KEY is either a key from an option, in which case TEXT is
278+ that option's help text, or a special key from the ARGP_KEY_HELP_
279+ defines, below, describing which other help text TEXT is. The function
280+ should return either TEXT, if it should be used as-is, a replacement
281+ string, which should be malloced, and will be freed by argp, or NULL,
282+ meaning `print nothing'. The value for TEXT is *after* any translation
283+ has been done, so if any of the replacement text also needs translation,
284+ that should be done by the filter function. INPUT is either the input
285+ supplied to argp_parse, or NULL, if argp_help was called directly. */
286+ char *(*help_filter) (int __key, __const char *__text, void *__input);
287+
288+ /* If non-zero the strings used in the argp library are translated using
289+ the domain described by this string. Otherwise the currently installed
290+ default domain is used. */
291+ const char *argp_domain;
292+};
293+
294+/* Possible KEY arguments to a help filter function. */
295+#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */
296+#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */
297+#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */
298+#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation;
299+ TEXT is NULL for this key. */
300+/* Explanatory note emitted when duplicate option arguments have been
301+ suppressed. */
302+#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
303+#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
304+
305+/* When an argp has a non-zero CHILDREN field, it should point to a vector of
306+ argp_child structures, each of which describes a subsidiary argp. */
307+struct argp_child
308+{
309+ /* The child parser. */
310+ __const struct argp *argp;
311+
312+ /* Flags for this child. */
313+ int flags;
314+
315+ /* If non-zero, an optional header to be printed in help output before the
316+ child options. As a side-effect, a non-zero value forces the child
317+ options to be grouped together; to achieve this effect without actually
318+ printing a header string, use a value of "". */
319+ __const char *header;
320+
321+ /* Where to group the child options relative to the other (`consolidated')
322+ options in the parent argp; the values are the same as the GROUP field
323+ in argp_option structs, but all child-groupings follow parent options at
324+ a particular group level. If both this field and HEADER are zero, then
325+ they aren't grouped at all, but rather merged with the parent options
326+ (merging the child's grouping levels with the parents). */
327+ int group;
328+};
329+
330+/* Parsing state. This is provided to parsing functions called by argp,
331+ which may examine and, as noted, modify fields. */
332+struct argp_state
333+{
334+ /* The top level ARGP being parsed. */
335+ __const struct argp *root_argp;
336+
337+ /* The argument vector being parsed. May be modified. */
338+ int argc;
339+ char **argv;
340+
341+ /* The index in ARGV of the next arg that to be parsed. May be modified. */
342+ int next;
343+
344+ /* The flags supplied to argp_parse. May be modified. */
345+ unsigned flags;
346+
347+ /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
348+ number of the current arg, starting at zero, and incremented after each
349+ such call returns. At all other times, this is the number of such
350+ arguments that have been processed. */
351+ unsigned arg_num;
352+
353+ /* If non-zero, the index in ARGV of the first argument following a special
354+ `--' argument (which prevents anything following being interpreted as an
355+ option). Only set once argument parsing has proceeded past this point. */
356+ int quoted;
357+
358+ /* An arbitrary pointer passed in from the user. */
359+ void *input;
360+ /* Values to pass to child parsers. This vector will be the same length as
361+ the number of children for the current parser. */
362+ void **child_inputs;
363+
364+ /* For the parser's use. Initialized to 0. */
365+ void *hook;
366+
367+ /* The name used when printing messages. This is initialized to ARGV[0],
368+ or PROGRAM_INVOCATION_NAME if that is unavailable. */
369+ char *name;
370+
371+ /* Streams used when argp prints something. */
372+ FILE *err_stream; /* For errors; initialized to stderr. */
373+ FILE *out_stream; /* For information; initialized to stdout. */
374+
375+ void *pstate; /* Private, for use by argp. */
376+};
377+
378+/* Flags for argp_parse (note that the defaults are those that are
379+ convenient for program command line parsing): */
380+
381+/* Don't ignore the first element of ARGV. Normally (and always unless
382+ ARGP_NO_ERRS is set) the first element of the argument vector is
383+ skipped for option parsing purposes, as it corresponds to the program name
384+ in a command line. */
385+#define ARGP_PARSE_ARGV0 0x01
386+
387+/* Don't print error messages for unknown options to stderr; unless this flag
388+ is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
389+ name in the error messages. This flag implies ARGP_NO_EXIT (on the
390+ assumption that silent exiting upon errors is bad behaviour). */
391+#define ARGP_NO_ERRS 0x02
392+
393+/* Don't parse any non-option args. Normally non-option args are parsed by
394+ calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
395+ as the value. Since it's impossible to know which parse function wants to
396+ handle it, each one is called in turn, until one returns 0 or an error
397+ other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
398+ argp_parse returns prematurely (but with a return value of 0). If all
399+ args have been parsed without error, all parsing functions are called one
400+ last time with a key of ARGP_KEY_END. This flag needn't normally be set,
401+ as the normal behavior is to stop parsing as soon as some argument can't
402+ be handled. */
403+#define ARGP_NO_ARGS 0x04
404+
405+/* Parse options and arguments in the same order they occur on the command
406+ line -- normally they're rearranged so that all options come first. */
407+#define ARGP_IN_ORDER 0x08
408+
409+/* Don't provide the standard long option --help, which causes usage and
410+ option help information to be output to stdout, and exit (0) called. */
411+#define ARGP_NO_HELP 0x10
412+
413+/* Don't exit on errors (they may still result in error messages). */
414+#define ARGP_NO_EXIT 0x20
415+
416+/* Use the gnu getopt `long-only' rules for parsing arguments. */
417+#define ARGP_LONG_ONLY 0x40
418+
419+/* Turns off any message-printing/exiting options. */
420+#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
421+
422+/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
423+ FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the
424+ index in ARGV of the first unparsed option is returned in it. If an
425+ unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
426+ routine returned a non-zero value, it is returned; otherwise 0 is
427+ returned. This function may also call exit unless the ARGP_NO_HELP flag
428+ is set. INPUT is a pointer to a value to be passed in to the parser. */
429+extern error_t argp_parse (__const struct argp *__restrict __argp,
430+ int __argc, char **__restrict __argv,
431+ unsigned __flags, int *__restrict __arg_index,
432+ void *__restrict __input);
433+
434+/* Global variables. */
435+
436+/* If defined or set by the user program to a non-zero value, then a default
437+ option --version is added (unless the ARGP_NO_HELP flag is used), which
438+ will print this string followed by a newline and exit (unless the
439+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
440+extern __const char *argp_program_version;
441+
442+/* If defined or set by the user program to a non-zero value, then a default
443+ option --version is added (unless the ARGP_NO_HELP flag is used), which
444+ calls this function with a stream to print the version to and a pointer to
445+ the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
446+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
447+extern void (*argp_program_version_hook) (FILE *__restrict __stream,
448+ struct argp_state *__restrict
449+ __state);
450+
451+/* If defined or set by the user program, it should point to string that is
452+ the bug-reporting address for the program. It will be printed by
453+ argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
454+ standard help messages), embedded in a sentence that says something like
455+ `Report bugs to ADDR.'. */
456+extern __const char *argp_program_bug_address;
457+
458+/* The exit status that argp will use when exiting due to a parsing error.
459+ If not defined or set by the user program, this defaults to EX_USAGE from
460+ <sysexits.h>. */
461+extern error_t argp_err_exit_status;
462+
463+/* Flags for argp_help. */
464+#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
465+#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
466+#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */
467+#define ARGP_HELP_LONG 0x08 /* a long help message. */
468+#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */
469+#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */
470+#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
471+#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */
472+#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to
473+ reflect ARGP_LONG_ONLY mode. */
474+
475+/* These ARGP_HELP flags are only understood by argp_state_help. */
476+#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */
477+#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */
478+
479+/* The standard thing to do after a program command line parsing error, if an
480+ error message has already been printed. */
481+#define ARGP_HELP_STD_ERR \
482+ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
483+/* The standard thing to do after a program command line parsing error, if no
484+ more specific error message has been printed. */
485+#define ARGP_HELP_STD_USAGE \
486+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
487+/* The standard thing to do in response to a --help option. */
488+#define ARGP_HELP_STD_HELP \
489+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
490+ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
491+
492+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
493+ ARGP_HELP_*. */
494+extern void argp_help (__const struct argp *__restrict __argp,
495+ FILE *__restrict __stream,
496+ unsigned __flags, char *__restrict __name);
497+
498+/* The following routines are intended to be called from within an argp
499+ parsing routine (thus taking an argp_state structure as the first
500+ argument). They may or may not print an error message and exit, depending
501+ on the flags in STATE -- in any case, the caller should be prepared for
502+ them *not* to exit, and should return an appropiate error after calling
503+ them. [argp_usage & argp_error should probably be called argp_state_...,
504+ but they're used often enough that they should be short] */
505+
506+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
507+ from the set ARGP_HELP_*. */
508+extern void argp_state_help (__const struct argp_state *__restrict __state,
509+ FILE *__restrict __stream,
510+ unsigned int __flags);
511+/* Possibly output the standard usage message for ARGP to stderr and exit. */
512+extern void argp_usage (__const struct argp_state *__state);
513+
514+/* If appropriate, print the printf string FMT and following args, preceded
515+ by the program name and `:', to stderr, and followed by a `Try ... --help'
516+ message, then exit (1). */
517+extern void argp_error (__const struct argp_state *__restrict __state,
518+ __const char *__restrict __fmt, ...)
519+ __attribute__ ((__format__ (__printf__, 2, 3)));
520+/* Similar to the standard gnu error-reporting function error(), but will
521+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
522+ to STATE->err_stream. This is useful for argument parsing code that is
523+ shared between program startup (when exiting is desired) and runtime
524+ option parsing (when typically an error code is returned instead). The
525+ difference between this function and argp_error is that the latter is for
526+ *parsing errors*, and the former is for other problems that occur during
527+ parsing but don't reflect a (syntactic) problem with the input. */
528+extern void argp_failure (__const struct argp_state *__restrict __state,
529+ int __status, int __errnum,
530+ __const char *__restrict __fmt, ...)
531+ __attribute__ ((__format__ (__printf__, 4, 5)));
532+/* Returns true if the option OPT is a valid short option. */
533+extern int _option_is_short (__const struct argp_option *__opt) __THROW;
534+extern int __option_is_short (__const struct argp_option *__opt) __THROW;
535+
536+/* Returns true if the option OPT is in fact the last (unused) entry in an
537+ options array. */
538+extern int _option_is_end (__const struct argp_option *__opt) __THROW;
539+extern int __option_is_end (__const struct argp_option *__opt) __THROW;
540+
541+/* Return the input field for ARGP in the parser corresponding to STATE; used
542+ by the help routines. */
543+/* We think this should not be exported */
544+extern void *__argp_input (__const struct argp *__restrict __argp,
545+ __const struct argp_state *__restrict __state)
546+ __THROW;
547+
548+#ifdef __USE_EXTERN_INLINES
549+
550+# ifndef ARGP_EI
551+# define ARGP_EI __extern_inline
552+# endif
553+
554+ARGP_EI void
555+argp_usage (__const struct argp_state *__state)
556+{
557+ argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
558+}
559+
560+ARGP_EI int
561+__NTH (__option_is_short (__const struct argp_option *__opt))
562+{
563+ if (__opt->flags & OPTION_DOC)
564+ return 0;
565+ else
566+ {
567+ int __key = __opt->key;
568+ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
569+ }
570+}
571+
572+ARGP_EI int
573+__NTH (__option_is_end (__const struct argp_option *__opt))
574+{
575+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
576+}
577+#endif /* Use extern inlines. */
578+
579+#ifdef __cplusplus
580+}
581+#endif
582+
583+#endif /* argp.h */
diff --git a/meta/recipes-core/uclibc/uclibc-git/argp-support.patch b/meta/recipes-core/uclibc/uclibc-git/argp-support.patch
new file mode 100644
index 0000000000..bcec6a593a
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/argp-support.patch
@@ -0,0 +1,5192 @@
1From: Salvatore Cro <salvatore.cro at st.com>
2
3Argp is an advanced support for parsing unix-style argument vectors.
4In addition to the common getopt interface, it provides automatic response
5to `--help' and `--version' options and use of custom parser in conjunction
6with argp native option parser, among others.
7Argp support is required by elfutils package and prelink.
8
9In uClibc argp functionalities has been moved from C library to libuargp.so
10Further the libc.so linker script contains an AS_NEEDED entry so that
11it doesn't need to link libuargp.so explicitely.
12
13Signed-off-by: Salvatore Cro <salvatore.cro at st.com>
14Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com>
15Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
16
17Upstream-Status: Pending
18
19---
20 Makefile.in | 8 +
21 Makerules | 8 +-
22 Rules.mak | 7 +
23 extra/Configs/Config.in | 17 +
24 libc/sysdeps/linux/common/bits/getopt_int.h | 136 ++
25 libc/unistd/getopt.c | 18 +-
26 libc/unistd/getopt_int.h | 134 --
27 libuargp/Makefile | 14 +
28 libuargp/Makefile.in | 76 ++
29 libuargp/argp-ba.c | 26 +
30 libuargp/argp-eexst.c | 32 +
31 libuargp/argp-fmtstream.c | 439 +++++++
32 libuargp/argp-fmtstream.h | 314 +++++
33 libuargp/argp-fs-xinl.c | 44 +
34 libuargp/argp-help.c | 1882 +++++++++++++++++++++++++++
35 libuargp/argp-parse.c | 949 ++++++++++++++
36 libuargp/argp-pv.c | 25 +
37 libuargp/argp-pvh.c | 32 +
38 libuargp/argp-xinl.c | 35 +
39 test/argp/Makefile | 7 +
40 test/argp/Makefile.in | 12 +
41 test/argp/argp-ex1.c | 15 +
42 test/argp/argp-ex2.c | 45 +
43 test/argp/argp-ex3.c | 153 +++
44 test/argp/argp-ex4.c | 167 +++
45 test/argp/argp-test.c | 209 +++
46 test/argp/bug-argp1.c | 26 +
47 test/argp/tst-argp1.c | 118 ++
48 test/argp/tst-argp2.c | 101 ++
49 29 files changed, 4911 insertions(+), 138 deletions(-)
50 create mode 100644 libc/sysdeps/linux/common/bits/getopt_int.h
51 delete mode 100644 libc/unistd/getopt_int.h
52 create mode 100644 libuargp/Makefile
53 create mode 100644 libuargp/Makefile.in
54 create mode 100644 libuargp/argp-ba.c
55 create mode 100644 libuargp/argp-eexst.c
56 create mode 100644 libuargp/argp-fmtstream.c
57 create mode 100644 libuargp/argp-fmtstream.h
58 create mode 100644 libuargp/argp-fs-xinl.c
59 create mode 100644 libuargp/argp-help.c
60 create mode 100644 libuargp/argp-parse.c
61 create mode 100644 libuargp/argp-pv.c
62 create mode 100644 libuargp/argp-pvh.c
63 create mode 100644 libuargp/argp-xinl.c
64 create mode 100644 test/argp/Makefile
65 create mode 100644 test/argp/Makefile.in
66 create mode 100644 test/argp/argp-ex1.c
67 create mode 100644 test/argp/argp-ex2.c
68 create mode 100644 test/argp/argp-ex3.c
69 create mode 100644 test/argp/argp-ex4.c
70 create mode 100644 test/argp/argp-test.c
71 create mode 100644 test/argp/bug-argp1.c
72 create mode 100644 test/argp/tst-argp1.c
73 create mode 100644 test/argp/tst-argp2.c
74
75Index: git/Makefile.in
76===================================================================
77--- git.orig/Makefile.in 2012-06-18 13:10:12.000000000 -0700
78+++ git/Makefile.in 2012-06-18 13:12:06.448829343 -0700
79@@ -48,6 +48,7 @@
80 include $(top_srcdir)libutil/Makefile.in
81 include $(top_srcdir)libpthread/Makefile.in
82 include $(top_srcdir)librt/Makefile.in
83+include $(top_srcdir)libuargp/Makefile.in
84 include $(top_srcdir)libubacktrace/Makefile.in
85 include $(top_srcdir)extra/locale/Makefile.in
86
87@@ -250,6 +251,7 @@
88 endif
89 HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h
90 HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h
91+HEADERS_RM-$(UCLIBC_HAS_ARGP) += argp.h
92 HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h
93 HEADERS_RM-$(UCLIBC_HAS_CRYPT) += crypt.h
94 HEADERS_RM-$(UCLIBC_HAS_EPOLL) += sys/epoll.h
95@@ -368,6 +370,12 @@
96 -$(INSTALL) -m 755 $(top_builddir)lib/libc.so $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/
97 endif
98 echo "$(UBACKTRACE_ASNEEDED)" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so
99+ifeq ($(UCLIBC_HAS_ARGP),y)
100+# Add the AS_NEEDED entry for libuargp.so
101+ if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
102+ echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
103+ fi
104+endif
105 ifeq ($(UCLIBC_HAS_THREADS),y)
106 ifneq ($(LINUXTHREADS_OLD),y)
107 ifeq ($(HARDWIRED_ABSPATH),y)
108Index: git/Makerules
109===================================================================
110--- git.orig/Makerules 2012-06-18 13:10:12.000000000 -0700
111+++ git/Makerules 2012-06-18 13:10:44.052825547 -0700
112@@ -32,12 +32,12 @@
113 $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
114 $(libresolv-so-y) $(librt-so-y) \
115 $(ldso-y) \
116- $(libutil-so-y) $(libubacktrace-so-y)
117+ $(libutil-so-y) $(libubacktrace-so-y) $(libuargp-so-y)
118
119 ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
120 $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
121 $(libpthread-a-y) $(libthread_db-a-y) \
122- $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
123+ $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) $(libuargp-a-y)
124 ifeq ($(DOPIC),y)
125 ar_objs := $(ar_objs:.o=.os)
126 endif
127@@ -472,7 +472,7 @@
128 $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
129 $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
130 $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
131- $(libubacktrace-a-y) $(libubacktrace-so-y)
132+ $(libubacktrace-a-y) $(libubacktrace-so-y) $(libuargp-so-y) $(libuargp-a-y)
133 .depends.dep := \
134 $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
135 $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
136Index: git/Rules.mak
137===================================================================
138--- git.orig/Rules.mak 2012-06-18 13:10:12.000000000 -0700
139+++ git/Rules.mak 2012-06-18 13:10:44.056825544 -0700
140@@ -589,6 +589,13 @@
141 else
142 export UBACKTRACE_ASNEEDED:=""
143 endif
144+ifeq ($(UCLIBC_HAS_ARGP),y)
145+# Only used in installed libc.so linker script
146+UARGP_FULL_NAME := $(RUNTIME_PREFIX)lib/libuargp.so.$(MAJOR_VERSION)
147+export UARGP_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UARGP_FULL_NAME) )" || echo "$(UARGP_FULL_NAME)")
148+else
149+export UARGP_ASNEEDED:=""
150+endif
151 endif
152
153 # Add a bunch of extra pedantic annoyingly strict checks
154Index: git/extra/Configs/Config.in
155===================================================================
156--- git.orig/extra/Configs/Config.in 2012-06-18 13:10:12.000000000 -0700
157+++ git/extra/Configs/Config.in 2012-06-18 13:10:44.056825544 -0700
158@@ -1853,6 +1853,23 @@
159 smaller SUSv3 compatible getsubopt().
160
161 Most people will answer Y.
162+
163+config UCLIBC_HAS_ARGP
164+ bool "Support argp (as standalone shared object)"
165+ default n
166+ help
167+ Argp is an interface for parsing unix-style argument vectors. Unlike
168+ the common getopt interface, it provides many advanced features in
169+ addition to parsing options, such as automatic output in response to
170+ `--help' and `--version' options.
171+ A library can export an argp option parser, which programs can easily
172+ use in conjunction with their own option parser.
173+ A new shared object "libuargp" is created. The "libc.so" linker script
174+ contains the AS_NEEDED entry for getting the libuargp linked automatically.
175+ Argp support is needed by elfutils libdw.
176+
177+ Most people can safely answer N.
178+
179 endmenu
180
181
182Index: git/libc/sysdeps/linux/common/bits/getopt_int.h
183===================================================================
184--- /dev/null 1970-01-01 00:00:00.000000000 +0000
185+++ git/libc/sysdeps/linux/common/bits/getopt_int.h 2012-06-18 13:10:44.056825544 -0700
186@@ -0,0 +1,136 @@
187+/* Internal declarations for getopt.
188+ Copyright (C) 1989-1994,1996-1999,2001,2003,2004
189+ Free Software Foundation, Inc.
190+ This file is part of the GNU C Library.
191+
192+ The GNU C Library is free software; you can redistribute it and/or
193+ modify it under the terms of the GNU Lesser General Public
194+ License as published by the Free Software Foundation; either
195+ version 2.1 of the License, or (at your option) any later version.
196+
197+ The GNU C Library is distributed in the hope that it will be useful,
198+ but WITHOUT ANY WARRANTY; without even the implied warranty of
199+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
200+ Lesser General Public License for more details.
201+
202+ You should have received a copy of the GNU Lesser General Public
203+ License along with the GNU C Library; if not, write to the Free
204+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
205+ 02111-1307 USA. */
206+
207+#ifndef _GETOPT_INT_H
208+#define _GETOPT_INT_H 1
209+
210+extern int _getopt_internal (int ___argc, char *const *___argv,
211+ const char *__shortopts,
212+ const struct option *__longopts, int *__longind,
213+ int __long_only) attribute_hidden;
214+
215+
216+/* Reentrant versions which can handle parsing multiple argument
217+ vectors at the same time. */
218+
219+/* For __ordering member */
220+enum {
221+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
222+};
223+
224+/* Data type for reentrant functions. */
225+
226+struct _getopt_data
227+{
228+ /* These have exactly the same meaning as the corresponding global
229+ variables, except that they are used for the reentrant
230+ versions of getopt. */
231+ int optind;
232+ int opterr;
233+ char *optarg;
234+ smalluint optopt; /* we store characters here, a byte is enough */
235+
236+ /* Internal members. */
237+
238+ /* True if the internal members have been initialized. */
239+ smallint __initialized;
240+
241+ /* Describe how to deal with options that follow non-option ARGV-elements.
242+
243+ If the caller did not specify anything,
244+ the default is REQUIRE_ORDER if the environment variable
245+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
246+
247+ REQUIRE_ORDER means don't recognize them as options;
248+ stop option processing when the first non-option is seen.
249+ This is what Unix does.
250+ This mode of operation is selected by either setting the environment
251+ variable POSIXLY_CORRECT, or using `+' as the first character
252+ of the list of option characters.
253+
254+ PERMUTE is the default. We permute the contents of ARGV as we
255+ scan, so that eventually all the non-options are at the end.
256+ This allows options to be given in any order, even with programs
257+ that were not written to expect this.
258+
259+ RETURN_IN_ORDER is an option available to programs that were
260+ written to expect options and other ARGV-elements in any order
261+ and that care about the ordering of the two. We describe each
262+ non-option ARGV-element as if it were the argument of an option
263+ with character code 1. Using `-' as the first character of the
264+ list of option characters selects this mode of operation.
265+
266+ The special argument `--' forces an end of option-scanning regardless
267+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
268+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
269+ smallint __ordering;
270+
271+ /* If the POSIXLY_CORRECT environment variable is set. */
272+ smallint __posixly_correct;
273+
274+ /* The next char to be scanned in the option-element
275+ in which the last option character we returned was found.
276+ This allows us to pick up the scan where we left off.
277+
278+ If this is zero, or a null string, it means resume the scan
279+ by advancing to the next ARGV-element. */
280+ char *__nextchar;
281+
282+
283+ /* Handle permutation of arguments. */
284+
285+ /* Describe the part of ARGV that contains non-options that have
286+ been skipped. `first_nonopt' is the index in ARGV of the first
287+ of them; `last_nonopt' is the index after the last of them. */
288+
289+ int __first_nonopt;
290+ int __last_nonopt;
291+
292+#if defined _LIBC && defined USE_NONOPTION_FLAGS
293+ int __nonoption_flags_max_len;
294+ int __nonoption_flags_len;
295+# endif
296+};
297+
298+/* The initializer is necessary to set OPTIND and OPTERR to their
299+ default values and to clear the initialization flag. */
300+#define _GETOPT_DATA_INITIALIZER { 1, 1 }
301+
302+#if 0 /* first is static on uClibc, the others not used */
303+extern int _getopt_internal_r (int ___argc, char *const *___argv,
304+ const char *__shortopts,
305+ const struct option *__longopts, int *__longind,
306+ int __long_only, struct _getopt_data *__data);
307+#endif
308+#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
309+#ifndef __need_getopt
310+extern int _getopt_long_r (int ___argc, char *const *___argv,
311+ const char *__shortopts,
312+ const struct option *__longopts, int *__longind,
313+ struct _getopt_data *__data);
314+
315+extern int _getopt_long_only_r (int ___argc, char *const *___argv,
316+ const char *__shortopts,
317+ const struct option *__longopts,
318+ int *__longind,
319+ struct _getopt_data *__data);
320+#endif
321+#endif
322+#endif /* getopt_int.h */
323Index: git/libc/unistd/getopt.c
324===================================================================
325--- git.orig/libc/unistd/getopt.c 2012-06-18 13:10:12.000000000 -0700
326+++ git/libc/unistd/getopt.c 2012-06-18 13:10:44.056825544 -0700
327@@ -106,7 +106,7 @@
328 they can distinguish the relative order of options and other arguments. */
329
330 #include <getopt.h>
331-#include "getopt_int.h"
332+#include <bits/getopt_int.h>
333
334
335 /* For communication from `getopt' to the caller.
336@@ -1170,6 +1170,15 @@
337 return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
338 }
339
340+int
341+_getopt_long_r (int argc, char *const *argv, const char *options,
342+ const struct option *long_options, int *opt_index,
343+ struct _getopt_data *d)
344+{
345+ return _getopt_internal_r (argc, argv, options, long_options, opt_index,
346+ 0, d);
347+}
348+
349 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
350 If an option that starts with '-' (not '--') doesn't match a long option,
351 but does match a short option, it is parsed as a short option
352@@ -1182,4 +1191,12 @@
353 return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
354 }
355
356+int
357+_getopt_long_only_r (int argc, char *const *argv, const char *options,
358+ const struct option *long_options, int *opt_index,
359+ struct _getopt_data *d)
360+{
361+ return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d);
362+}
363+
364 #endif /* Not ELIDE_CODE. */
365Index: git/libuargp/Makefile
366===================================================================
367--- /dev/null 1970-01-01 00:00:00.000000000 +0000
368+++ git/libuargp/Makefile 2012-06-18 13:10:44.056825544 -0700
369@@ -0,0 +1,14 @@
370+# Makefile for uClibc (libuargp)
371+#
372+# Copyright (C) 2010 STMicroelectronics Ltd
373+# Author(s): Filippo Arcidiacono <filippo.arcidiacono at st.com>
374+#
375+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
376+#
377+
378+top_srcdir=../
379+top_builddir=../
380+include $(top_builddir)Rules.mak
381+all: libs
382+include Makefile.in
383+include $(top_srcdir)Makerules
384Index: git/libuargp/Makefile.in
385===================================================================
386--- /dev/null 1970-01-01 00:00:00.000000000 +0000
387+++ git/libuargp/Makefile.in 2012-06-18 13:10:44.056825544 -0700
388@@ -0,0 +1,73 @@
389+# Makefile for uClibc (libuargp)
390+#
391+# Copyright (C) 2009, 2010 STMicroelectronics Ltd.
392+# Author(s): Salvatore Cro <salvatore.cro at st.com>
393+# - First implementation, embedded into libc
394+# Filippo Arcidiacono <filippo.arcidiacono at st.com>
395+# - Reworked for stand-alone libuargp implementation
396+
397+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
398+#
399+
400+CFLAGS-libuargp := -DNOT_IN_libc -DIS_IN_libuargp $(SSP_ALL_CFLAGS)
401+
402+LDFLAGS-libuargp.so := $(LDFLAGS)
403+
404+LIBS-libuargp.so := $(LIBS)
405+
406+libuargp_FULL_NAME := libuargp-$(VERSION).so
407+
408+libuargp_DIR := $(top_srcdir)libuargp
409+libuargp_OUT := $(top_builddir)libuargp
410+
411+libuargp_SRC-y :=
412+libuargp_SRC-$(UCLIBC_HAS_ARGP) := $(addsuffix .c,$(addprefix argp-, ba \
413+ eexst fmtstream fs-xinl help parse pv pvh xinl))
414+
415+CFLAGS-argp-xinl.c = -fgnu89-inline
416+
417+libuargp_SRC := $(addprefix $(libuargp_DIR)/,$(libuargp_SRC-y))
418+libuargp_OBJ := $(patsubst $(libuargp_DIR)/%.c,$(libuargp_OUT)/%.o,$(libuargp_SRC))
419+
420+libuargp_SRCS := $(libuargp_SRC)
421+libuargp_OBJS := $(libuargp_OBJ)
422+
423+ifeq ($(DOPIC),y)
424+libuargp-a-y := $(libuargp_OBJS:.o=.os)
425+else
426+libuargp-a-y := $(libuargp_OBJS)
427+endif
428+libuargp-so-y := $(libuargp_OBJS:.o=.os)
429+
430+lib-a-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.a
431+lib-so-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.so
432+
433+objclean-y += CLEAN_libuargp
434+
435+ifeq ($(DOMULTI),n)
436+ifeq ($(DOPIC),y)
437+$(top_builddir)lib/libuargp.so: $(top_builddir)lib/libuargp.a $(libc.depend)
438+else
439+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp_so.a $(libc.depend)
440+endif
441+ $(call link.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
442+else
443+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp.oS $(libc.depend)
444+ $(call linkm.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
445+endif
446+
447+$(libuargp_OUT)/libuargp_so.a: $(libuargp-so-y)
448+ $(Q)$(RM) $@
449+ $(do_ar)
450+
451+$(libuargp_OUT)/libuargp.oS: $(libuargp_SRCS)
452+ $(Q)$(RM) $@
453+ $(compile-m)
454+
455+$(top_builddir)lib/libuargp.a: $(libuargp-a-y)
456+ $(Q)$(INSTALL) -d $(dir $@)
457+ $(Q)$(RM) $@
458+ $(do_ar)
459+
460+CLEAN_libuargp:
461+ $(do_rm) $(addprefix $(libuargp_OUT)/*., o os oS a)
462Index: git/libuargp/argp-ba.c
463===================================================================
464--- /dev/null 1970-01-01 00:00:00.000000000 +0000
465+++ git/libuargp/argp-ba.c 2012-06-18 13:10:44.056825544 -0700
466@@ -0,0 +1,26 @@
467+/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
468+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
469+ This file is part of the GNU C Library.
470+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
471+
472+ The GNU C Library is free software; you can redistribute it and/or
473+ modify it under the terms of the GNU Lesser General Public
474+ License as published by the Free Software Foundation; either
475+ version 2.1 of the License, or (at your option) any later version.
476+
477+ The GNU C Library is distributed in the hope that it will be useful,
478+ but WITHOUT ANY WARRANTY; without even the implied warranty of
479+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
480+ Lesser General Public License for more details.
481+
482+ You should have received a copy of the GNU Lesser General Public
483+ License along with the GNU C Library; if not, write to the Free
484+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
485+ 02111-1307 USA. */
486+
487+/* If set by the user program, it should point to string that is the
488+ bug-reporting address for the program. It will be printed by argp_help if
489+ the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
490+ messages), embedded in a sentence that says something like `Report bugs to
491+ ADDR.'. */
492+const char *argp_program_bug_address;
493Index: git/libuargp/argp-eexst.c
494===================================================================
495--- /dev/null 1970-01-01 00:00:00.000000000 +0000
496+++ git/libuargp/argp-eexst.c 2012-06-18 13:10:44.056825544 -0700
497@@ -0,0 +1,32 @@
498+/* Default definition for ARGP_ERR_EXIT_STATUS
499+ Copyright (C) 1997 Free Software Foundation, Inc.
500+ This file is part of the GNU C Library.
501+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
502+
503+ The GNU C Library is free software; you can redistribute it and/or
504+ modify it under the terms of the GNU Lesser General Public
505+ License as published by the Free Software Foundation; either
506+ version 2.1 of the License, or (at your option) any later version.
507+
508+ The GNU C Library is distributed in the hope that it will be useful,
509+ but WITHOUT ANY WARRANTY; without even the implied warranty of
510+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
511+ Lesser General Public License for more details.
512+
513+ You should have received a copy of the GNU Lesser General Public
514+ License along with the GNU C Library; if not, write to the Free
515+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
516+ 02111-1307 USA. */
517+
518+#ifdef HAVE_CONFIG_H
519+# include <config.h>
520+#endif
521+
522+#include <sysexits.h>
523+
524+#include <argp.h>
525+
526+/* The exit status that argp will use when exiting due to a parsing error.
527+ If not defined or set by the user program, this defaults to EX_USAGE from
528+ <sysexits.h>. */
529+error_t argp_err_exit_status = EX_USAGE;
530Index: git/libuargp/argp-fmtstream.c
531===================================================================
532--- /dev/null 1970-01-01 00:00:00.000000000 +0000
533+++ git/libuargp/argp-fmtstream.c 2012-06-18 13:10:44.056825544 -0700
534@@ -0,0 +1,439 @@
535+/* Word-wrapping and line-truncating streams
536+ Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
537+ This file is part of the GNU C Library.
538+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
539+
540+ The GNU C Library is free software; you can redistribute it and/or
541+ modify it under the terms of the GNU Lesser General Public
542+ License as published by the Free Software Foundation; either
543+ version 2.1 of the License, or (at your option) any later version.
544+
545+ The GNU C Library is distributed in the hope that it will be useful,
546+ but WITHOUT ANY WARRANTY; without even the implied warranty of
547+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
548+ Lesser General Public License for more details.
549+
550+ You should have received a copy of the GNU Lesser General Public
551+ License along with the GNU C Library; if not, write to the Free
552+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
553+ 02111-1307 USA.
554+
555+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
556+*/
557+
558+/* This package emulates glibc `line_wrap_stream' semantics for systems that
559+ don't have that. */
560+
561+#ifdef HAVE_CONFIG_H
562+# include <config.h>
563+#endif
564+
565+#include <stdlib.h>
566+#include <string.h>
567+#include <errno.h>
568+#include <stdarg.h>
569+#include <ctype.h>
570+
571+#include "argp-fmtstream.h"
572+
573+#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
574+
575+#ifndef isblank
576+#define isblank(ch) ((ch)==' ' || (ch)=='\t')
577+#endif
578+
579+#if defined _LIBC && defined USE_IN_LIBIO
580+# include <wchar.h>
581+# include <libio/libioP.h>
582+# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
583+#else
584+# define __vsnprintf(s, l, f, a) vsnprintf (s, l, f, a)
585+#endif
586+
587+#define INIT_BUF_SIZE 200
588+#define PRINTF_SIZE_GUESS 150
589+
590+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
591+ written on it with LMARGIN spaces and limits them to RMARGIN columns
592+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
593+ replacing the whitespace before them with a newline and WMARGIN spaces.
594+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
595+ Returns NULL if there was an error. */
596+argp_fmtstream_t
597+__argp_make_fmtstream (FILE *stream,
598+ size_t lmargin, size_t rmargin, ssize_t wmargin)
599+{
600+ argp_fmtstream_t fs;
601+
602+ fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream));
603+ if (fs != NULL)
604+ {
605+ fs->stream = stream;
606+
607+ fs->lmargin = lmargin;
608+ fs->rmargin = rmargin;
609+ fs->wmargin = wmargin;
610+ fs->point_col = 0;
611+ fs->point_offs = 0;
612+
613+ fs->buf = (char *) malloc (INIT_BUF_SIZE);
614+ if (! fs->buf)
615+ {
616+ free (fs);
617+ fs = 0;
618+ }
619+ else
620+ {
621+ fs->p = fs->buf;
622+ fs->end = fs->buf + INIT_BUF_SIZE;
623+ }
624+ }
625+
626+ return fs;
627+}
628+#if 0
629+/* Not exported. */
630+#ifdef weak_alias
631+weak_alias (__argp_make_fmtstream, argp_make_fmtstream)
632+#endif
633+#endif
634+
635+/* Flush FS to its stream, and free it (but don't close the stream). */
636+void
637+__argp_fmtstream_free (argp_fmtstream_t fs)
638+{
639+ __argp_fmtstream_update (fs);
640+ if (fs->p > fs->buf)
641+ {
642+#ifdef USE_IN_LIBIO
643+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
644+#else
645+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
646+#endif
647+ }
648+ free (fs->buf);
649+ free (fs);
650+}
651+#if 0
652+/* Not exported. */
653+#ifdef weak_alias
654+weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
655+#endif
656+#endif
657+
658+/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
659+ end of its buffer. This code is mostly from glibc stdio/linewrap.c. */
660+void
661+__argp_fmtstream_update (argp_fmtstream_t fs)
662+{
663+ char *buf, *nl;
664+ size_t len;
665+
666+ /* Scan the buffer for newlines. */
667+ buf = fs->buf + fs->point_offs;
668+ while (buf < fs->p)
669+ {
670+ size_t r;
671+
672+ if (fs->point_col == 0 && fs->lmargin != 0)
673+ {
674+ /* We are starting a new line. Print spaces to the left margin. */
675+ const size_t pad = fs->lmargin;
676+ if (fs->p + pad < fs->end)
677+ {
678+ /* We can fit in them in the buffer by moving the
679+ buffer text up and filling in the beginning. */
680+ memmove (buf + pad, buf, fs->p - buf);
681+ fs->p += pad; /* Compensate for bigger buffer. */
682+ memset (buf, ' ', pad); /* Fill in the spaces. */
683+ buf += pad; /* Don't bother searching them. */
684+ }
685+ else
686+ {
687+ /* No buffer space for spaces. Must flush. */
688+ size_t i;
689+ for (i = 0; i < pad; i++)
690+ {
691+#ifdef USE_IN_LIBIO
692+ if (_IO_fwide (fs->stream, 0) > 0)
693+ putwc_unlocked (L' ', fs->stream);
694+ else
695+#endif
696+ putc_unlocked (' ', fs->stream);
697+ }
698+ }
699+ fs->point_col = pad;
700+ }
701+
702+ len = fs->p - buf;
703+ nl = memchr (buf, '\n', len);
704+
705+ if (fs->point_col < 0)
706+ fs->point_col = 0;
707+
708+ if (!nl)
709+ {
710+ /* The buffer ends in a partial line. */
711+
712+ if (fs->point_col + len < fs->rmargin)
713+ {
714+ /* The remaining buffer text is a partial line and fits
715+ within the maximum line width. Advance point for the
716+ characters to be written and stop scanning. */
717+ fs->point_col += len;
718+ break;
719+ }
720+ else
721+ /* Set the end-of-line pointer for the code below to
722+ the end of the buffer. */
723+ nl = fs->p;
724+ }
725+ else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
726+ {
727+ /* The buffer contains a full line that fits within the maximum
728+ line width. Reset point and scan the next line. */
729+ fs->point_col = 0;
730+ buf = nl + 1;
731+ continue;
732+ }
733+
734+ /* This line is too long. */
735+ r = fs->rmargin - 1;
736+
737+ if (fs->wmargin < 0)
738+ {
739+ /* Truncate the line by overwriting the excess with the
740+ newline and anything after it in the buffer. */
741+ if (nl < fs->p)
742+ {
743+ memmove (buf + (r - fs->point_col), nl, fs->p - nl);
744+ fs->p -= buf + (r - fs->point_col) - nl;
745+ /* Reset point for the next line and start scanning it. */
746+ fs->point_col = 0;
747+ buf += r + 1; /* Skip full line plus \n. */
748+ }
749+ else
750+ {
751+ /* The buffer ends with a partial line that is beyond the
752+ maximum line width. Advance point for the characters
753+ written, and discard those past the max from the buffer. */
754+ fs->point_col += len;
755+ fs->p -= fs->point_col - r;
756+ break;
757+ }
758+ }
759+ else
760+ {
761+ /* Do word wrap. Go to the column just past the maximum line
762+ width and scan back for the beginning of the word there.
763+ Then insert a line break. */
764+
765+ char *p, *nextline;
766+ int i;
767+
768+ p = buf + (r + 1 - fs->point_col);
769+ while (p >= buf && !isblank (*p))
770+ --p;
771+ nextline = p + 1; /* This will begin the next line. */
772+
773+ if (nextline > buf)
774+ {
775+ /* Swallow separating blanks. */
776+ if (p >= buf)
777+ do
778+ --p;
779+ while (p >= buf && isblank (*p));
780+ nl = p + 1; /* The newline will replace the first blank. */
781+ }
782+ else
783+ {
784+ /* A single word that is greater than the maximum line width.
785+ Oh well. Put it on an overlong line by itself. */
786+ p = buf + (r + 1 - fs->point_col);
787+ /* Find the end of the long word. */
788+ do
789+ ++p;
790+ while (p < nl && !isblank (*p));
791+ if (p == nl)
792+ {
793+ /* It already ends a line. No fussing required. */
794+ fs->point_col = 0;
795+ buf = nl + 1;
796+ continue;
797+ }
798+ /* We will move the newline to replace the first blank. */
799+ nl = p;
800+ /* Swallow separating blanks. */
801+ do
802+ ++p;
803+ while (isblank (*p));
804+ /* The next line will start here. */
805+ nextline = p;
806+ }
807+
808+ /* Note: There are a bunch of tests below for
809+ NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall
810+ at the end of the buffer, and NEXTLINE is in fact empty (and so
811+ we need not be careful to maintain its contents). */
812+
813+ if ((nextline == buf + len + 1
814+ ? fs->end - nl < fs->wmargin + 1
815+ : nextline - (nl + 1) < fs->wmargin)
816+ && fs->p > nextline)
817+ {
818+ /* The margin needs more blanks than we removed. */
819+ if (fs->end - fs->p > fs->wmargin + 1)
820+ /* Make some space for them. */
821+ {
822+ size_t mv = fs->p - nextline;
823+ memmove (nl + 1 + fs->wmargin, nextline, mv);
824+ nextline = nl + 1 + fs->wmargin;
825+ len = nextline + mv - buf;
826+ *nl++ = '\n';
827+ }
828+ else
829+ /* Output the first line so we can use the space. */
830+ {
831+#if defined _LIBC && defined USE_IN_LIBIO
832+ __fxprintf (fs->stream, "%.*s\n",
833+ (int) (nl - fs->buf), fs->buf);
834+#else
835+ if (nl > fs->buf)
836+ fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
837+ putc_unlocked ('\n', fs->stream);
838+#endif
839+
840+ len += buf - fs->buf;
841+ nl = buf = fs->buf;
842+ }
843+ }
844+ else
845+ /* We can fit the newline and blanks in before
846+ the next word. */
847+ *nl++ = '\n';
848+
849+ if (nextline - nl >= fs->wmargin
850+ || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin))
851+ /* Add blanks up to the wrap margin column. */
852+ for (i = 0; i < fs->wmargin; ++i)
853+ *nl++ = ' ';
854+ else
855+ for (i = 0; i < fs->wmargin; ++i)
856+#ifdef USE_IN_LIBIO
857+ if (_IO_fwide (fs->stream, 0) > 0)
858+ putwc_unlocked (L' ', fs->stream);
859+ else
860+#endif
861+ putc_unlocked (' ', fs->stream);
862+
863+ /* Copy the tail of the original buffer into the current buffer
864+ position. */
865+ if (nl < nextline)
866+ memmove (nl, nextline, buf + len - nextline);
867+ len -= nextline - buf;
868+
869+ /* Continue the scan on the remaining lines in the buffer. */
870+ buf = nl;
871+
872+ /* Restore bufp to include all the remaining text. */
873+ fs->p = nl + len;
874+
875+ /* Reset the counter of what has been output this line. If wmargin
876+ is 0, we want to avoid the lmargin getting added, so we set
877+ point_col to a magic value of -1 in that case. */
878+ fs->point_col = fs->wmargin ? fs->wmargin : -1;
879+ }
880+ }
881+
882+ /* Remember that we've scanned as far as the end of the buffer. */
883+ fs->point_offs = fs->p - fs->buf;
884+}
885+
886+/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by
887+ growing the buffer, or by flushing it. True is returned iff we succeed. */
888+int
889+__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
890+{
891+ if ((size_t) (fs->end - fs->p) < amount)
892+ {
893+ ssize_t wrote;
894+
895+ /* Flush FS's buffer. */
896+ __argp_fmtstream_update (fs);
897+
898+#if defined _LIBC && defined USE_IN_LIBIO
899+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
900+ wrote = fs->p - fs->buf;
901+#else
902+ wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
903+#endif
904+ if (wrote == fs->p - fs->buf)
905+ {
906+ fs->p = fs->buf;
907+ fs->point_offs = 0;
908+ }
909+ else
910+ {
911+ fs->p -= wrote;
912+ fs->point_offs -= wrote;
913+ memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf);
914+ return 0;
915+ }
916+
917+ if ((size_t) (fs->end - fs->buf) < amount)
918+ /* Gotta grow the buffer. */
919+ {
920+ size_t old_size = fs->end - fs->buf;
921+ size_t new_size = old_size + amount;
922+ char *new_buf;
923+
924+ if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size)))
925+ {
926+ __set_errno (ENOMEM);
927+ return 0;
928+ }
929+
930+ fs->buf = new_buf;
931+ fs->end = new_buf + new_size;
932+ fs->p = fs->buf;
933+ }
934+ }
935+
936+ return 1;
937+}
938+
939+ssize_t
940+__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
941+{
942+ int out;
943+ size_t avail;
944+ size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
945+
946+ do
947+ {
948+ va_list args;
949+
950+ if (! __argp_fmtstream_ensure (fs, size_guess))
951+ return -1;
952+
953+ va_start (args, fmt);
954+ avail = fs->end - fs->p;
955+ out = __vsnprintf (fs->p, avail, fmt, args);
956+ va_end (args);
957+ if ((size_t) out >= avail)
958+ size_guess = out + 1;
959+ }
960+ while ((size_t) out >= avail);
961+
962+ fs->p += out;
963+
964+ return out;
965+}
966+#if 0
967+/* Not exported. */
968+#ifdef weak_alias
969+weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
970+#endif
971+#endif
972+
973+#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
974Index: git/libuargp/argp-fmtstream.h
975===================================================================
976--- /dev/null 1970-01-01 00:00:00.000000000 +0000
977+++ git/libuargp/argp-fmtstream.h 2012-06-18 13:10:44.056825544 -0700
978@@ -0,0 +1,314 @@
979+/* Word-wrapping and line-truncating streams.
980+ Copyright (C) 1997 Free Software Foundation, Inc.
981+ This file is part of the GNU C Library.
982+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
983+
984+ The GNU C Library is free software; you can redistribute it and/or
985+ modify it under the terms of the GNU Lesser General Public
986+ License as published by the Free Software Foundation; either
987+ version 2.1 of the License, or (at your option) any later version.
988+
989+ The GNU C Library is distributed in the hope that it will be useful,
990+ but WITHOUT ANY WARRANTY; without even the implied warranty of
991+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992+ Lesser General Public License for more details.
993+
994+ You should have received a copy of the GNU Lesser General Public
995+ License along with the GNU C Library; if not, write to the Free
996+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
997+ 02111-1307 USA.
998+
999+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
1000+*/
1001+
1002+/* This package emulates glibc `line_wrap_stream' semantics for systems that
1003+ don't have that. If the system does have it, it is just a wrapper for
1004+ that. This header file is only used internally while compiling argp, and
1005+ shouldn't be installed. */
1006+
1007+#ifndef _ARGP_FMTSTREAM_H
1008+#define _ARGP_FMTSTREAM_H
1009+
1010+#include <stdio.h>
1011+#include <string.h>
1012+#include <unistd.h>
1013+
1014+#ifndef __attribute__
1015+/* This feature is available in gcc versions 2.5 and later. */
1016+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
1017+# define __attribute__(Spec) /* empty */
1018+# endif
1019+/* The __-protected variants of `format' and `printf' attributes
1020+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
1021+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
1022+# define __format__ format
1023+# define __printf__ printf
1024+# endif
1025+#endif
1026+
1027+#if 0 /* uClibc: disabled */
1028+#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
1029+ || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
1030+/* line_wrap_stream is available, so use that. */
1031+#define ARGP_FMTSTREAM_USE_LINEWRAP
1032+#endif
1033+#else
1034+/* line_wrap stream NOT available */
1035+# undef ARGP_FMTSTREAM_USE_LINEWRAP
1036+#endif
1037+
1038+#ifdef ARGP_FMTSTREAM_USE_LINEWRAP
1039+/* Just be a simple wrapper for line_wrap_stream; the semantics are
1040+ *slightly* different, as line_wrap_stream doesn't actually make a new
1041+ object, it just modifies the given stream (reversibly) to do
1042+ line-wrapping. Since we control who uses this code, it doesn't matter. */
1043+
1044+#include <linewrap.h>
1045+
1046+typedef FILE *argp_fmtstream_t;
1047+
1048+#define argp_make_fmtstream line_wrap_stream
1049+#define __argp_make_fmtstream line_wrap_stream
1050+#define argp_fmtstream_free line_unwrap_stream
1051+#define __argp_fmtstream_free line_unwrap_stream
1052+
1053+#define __argp_fmtstream_putc(fs,ch) putc(ch,fs)
1054+#define argp_fmtstream_putc(fs,ch) putc(ch,fs)
1055+#define __argp_fmtstream_puts(fs,str) fputs(str,fs)
1056+#define argp_fmtstream_puts(fs,str) fputs(str,fs)
1057+#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
1058+#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
1059+#define __argp_fmtstream_printf fprintf
1060+#define argp_fmtstream_printf fprintf
1061+
1062+#define __argp_fmtstream_lmargin line_wrap_lmargin
1063+#define argp_fmtstream_lmargin line_wrap_lmargin
1064+#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin
1065+#define argp_fmtstream_set_lmargin line_wrap_set_lmargin
1066+#define __argp_fmtstream_rmargin line_wrap_rmargin
1067+#define argp_fmtstream_rmargin line_wrap_rmargin
1068+#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin
1069+#define argp_fmtstream_set_rmargin line_wrap_set_rmargin
1070+#define __argp_fmtstream_wmargin line_wrap_wmargin
1071+#define argp_fmtstream_wmargin line_wrap_wmargin
1072+#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin
1073+#define argp_fmtstream_set_wmargin line_wrap_set_wmargin
1074+#define __argp_fmtstream_point line_wrap_point
1075+#define argp_fmtstream_point line_wrap_point
1076+
1077+#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
1078+/* Guess we have to define our own version. */
1079+
1080+#ifndef __const
1081+#define __const const
1082+#endif
1083+
1084+struct argp_fmtstream
1085+{
1086+ FILE *stream; /* The stream we're outputting to. */
1087+
1088+ size_t lmargin, rmargin; /* Left and right margins. */
1089+ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */
1090+
1091+ /* Point in buffer to which we've processed for wrapping, but not output. */
1092+ size_t point_offs;
1093+ /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */
1094+ ssize_t point_col;
1095+
1096+ char *buf; /* Output buffer. */
1097+ char *p; /* Current end of text in BUF. */
1098+ char *end; /* Absolute end of BUF. */
1099+};
1100+
1101+typedef struct argp_fmtstream *argp_fmtstream_t;
1102+
1103+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
1104+ written on it with LMARGIN spaces and limits them to RMARGIN columns
1105+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
1106+ replacing the whitespace before them with a newline and WMARGIN spaces.
1107+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
1108+ Returns NULL if there was an error. */
1109+extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
1110+ size_t __lmargin,
1111+ size_t __rmargin,
1112+ ssize_t __wmargin);
1113+extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
1114+ size_t __lmargin,
1115+ size_t __rmargin,
1116+ ssize_t __wmargin);
1117+
1118+/* Flush __FS to its stream, and free it (but don't close the stream). */
1119+extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
1120+extern void argp_fmtstream_free (argp_fmtstream_t __fs);
1121+
1122+extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
1123+ __const char *__fmt, ...)
1124+ __attribute__ ((__format__ (printf, 2, 3)));
1125+extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
1126+ __const char *__fmt, ...)
1127+ __attribute__ ((__format__ (printf, 2, 3)));
1128+
1129+extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
1130+extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
1131+
1132+extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
1133+extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
1134+
1135+extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
1136+ __const char *__str, size_t __len);
1137+extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
1138+ __const char *__str, size_t __len);
1139+
1140+/* Access macros for various bits of state. */
1141+#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
1142+#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin)
1143+#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin)
1144+#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
1145+#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
1146+#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
1147+
1148+/* Set __FS's left margin to LMARGIN and return the old value. */
1149+extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
1150+ size_t __lmargin);
1151+extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
1152+ size_t __lmargin);
1153+
1154+/* Set __FS's right margin to __RMARGIN and return the old value. */
1155+extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
1156+ size_t __rmargin);
1157+extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
1158+ size_t __rmargin);
1159+
1160+/* Set __FS's wrap margin to __WMARGIN and return the old value. */
1161+extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
1162+ size_t __wmargin);
1163+extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
1164+ size_t __wmargin);
1165+
1166+/* Return the column number of the current output point in __FS. */
1167+extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
1168+extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
1169+
1170+/* Internal routines. */
1171+extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
1172+extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
1173+extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
1174+extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
1175+
1176+#ifdef __OPTIMIZE__
1177+/* Inline versions of above routines. */
1178+
1179+#if !_LIBC
1180+#define __argp_fmtstream_putc argp_fmtstream_putc
1181+#define __argp_fmtstream_puts argp_fmtstream_puts
1182+#define __argp_fmtstream_write argp_fmtstream_write
1183+#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
1184+#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
1185+#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
1186+#define __argp_fmtstream_point argp_fmtstream_point
1187+#define __argp_fmtstream_update _argp_fmtstream_update
1188+#define __argp_fmtstream_ensure _argp_fmtstream_ensure
1189+#endif
1190+
1191+#ifndef ARGP_FS_EI
1192+#define ARGP_FS_EI __extern_inline
1193+#endif
1194+
1195+ARGP_FS_EI size_t
1196+__argp_fmtstream_write (argp_fmtstream_t __fs,
1197+ __const char *__str, size_t __len)
1198+{
1199+ if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
1200+ {
1201+ memcpy (__fs->p, __str, __len);
1202+ __fs->p += __len;
1203+ return __len;
1204+ }
1205+ else
1206+ return 0;
1207+}
1208+
1209+ARGP_FS_EI int
1210+__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
1211+{
1212+ size_t __len = strlen (__str);
1213+ if (__len)
1214+ {
1215+ size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
1216+ return __wrote == __len ? 0 : -1;
1217+ }
1218+ else
1219+ return 0;
1220+}
1221+
1222+ARGP_FS_EI int
1223+__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
1224+{
1225+ if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
1226+ return *__fs->p++ = __ch;
1227+ else
1228+ return EOF;
1229+}
1230+
1231+/* Set __FS's left margin to __LMARGIN and return the old value. */
1232+ARGP_FS_EI size_t
1233+__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
1234+{
1235+ size_t __old;
1236+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1237+ __argp_fmtstream_update (__fs);
1238+ __old = __fs->lmargin;
1239+ __fs->lmargin = __lmargin;
1240+ return __old;
1241+}
1242+
1243+/* Set __FS's right margin to __RMARGIN and return the old value. */
1244+ARGP_FS_EI size_t
1245+__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
1246+{
1247+ size_t __old;
1248+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1249+ __argp_fmtstream_update (__fs);
1250+ __old = __fs->rmargin;
1251+ __fs->rmargin = __rmargin;
1252+ return __old;
1253+}
1254+
1255+/* Set FS's wrap margin to __WMARGIN and return the old value. */
1256+ARGP_FS_EI size_t
1257+__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
1258+{
1259+ size_t __old;
1260+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1261+ __argp_fmtstream_update (__fs);
1262+ __old = __fs->wmargin;
1263+ __fs->wmargin = __wmargin;
1264+ return __old;
1265+}
1266+
1267+/* Return the column number of the current output point in __FS. */
1268+ARGP_FS_EI size_t
1269+__argp_fmtstream_point (argp_fmtstream_t __fs)
1270+{
1271+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1272+ __argp_fmtstream_update (__fs);
1273+ return __fs->point_col >= 0 ? __fs->point_col : 0;
1274+}
1275+
1276+#if !_LIBC
1277+#undef __argp_fmtstream_putc
1278+#undef __argp_fmtstream_puts
1279+#undef __argp_fmtstream_write
1280+#undef __argp_fmtstream_set_lmargin
1281+#undef __argp_fmtstream_set_rmargin
1282+#undef __argp_fmtstream_set_wmargin
1283+#undef __argp_fmtstream_point
1284+#undef __argp_fmtstream_update
1285+#undef __argp_fmtstream_ensure
1286+#endif
1287+
1288+#endif /* __OPTIMIZE__ */
1289+
1290+#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
1291+
1292+#endif /* argp-fmtstream.h */
1293Index: git/libuargp/argp-fs-xinl.c
1294===================================================================
1295--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1296+++ git/libuargp/argp-fs-xinl.c 2012-06-18 13:10:44.056825544 -0700
1297@@ -0,0 +1,44 @@
1298+/* Real definitions for extern inline functions in argp-fmtstream.h
1299+ Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
1300+ This file is part of the GNU C Library.
1301+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
1302+
1303+ The GNU C Library is free software; you can redistribute it and/or
1304+ modify it under the terms of the GNU Lesser General Public
1305+ License as published by the Free Software Foundation; either
1306+ version 2.1 of the License, or (at your option) any later version.
1307+
1308+ The GNU C Library is distributed in the hope that it will be useful,
1309+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1310+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1311+ Lesser General Public License for more details.
1312+
1313+ You should have received a copy of the GNU Lesser General Public
1314+ License along with the GNU C Library; if not, write to the Free
1315+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1316+ 02111-1307 USA. */
1317+
1318+#ifdef HAVE_CONFIG_H
1319+# include <config.h>
1320+#endif
1321+
1322+#define ARGP_FS_EI
1323+#undef __OPTIMIZE__
1324+#define __OPTIMIZE__ 1
1325+#include "argp-fmtstream.h"
1326+
1327+#if 0
1328+/* Not exported. */
1329+/* Add weak aliases. */
1330+#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
1331+
1332+weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
1333+weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
1334+weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
1335+weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
1336+weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
1337+weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
1338+weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
1339+
1340+#endif
1341+#endif
1342Index: git/libuargp/argp-help.c
1343===================================================================
1344--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1345+++ git/libuargp/argp-help.c 2012-06-18 13:10:44.060825542 -0700
1346@@ -0,0 +1,1882 @@
1347+/* Hierarchial argument parsing help output
1348+ Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
1349+ Free Software Foundation, Inc.
1350+ This file is part of the GNU C Library.
1351+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
1352+
1353+ The GNU C Library is free software; you can redistribute it and/or
1354+ modify it under the terms of the GNU Lesser General Public
1355+ License as published by the Free Software Foundation; either
1356+ version 2.1 of the License, or (at your option) any later version.
1357+
1358+ The GNU C Library is distributed in the hope that it will be useful,
1359+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1360+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1361+ Lesser General Public License for more details.
1362+
1363+ You should have received a copy of the GNU Lesser General Public
1364+ License along with the GNU C Library; if not, write to the Free
1365+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1366+ 02111-1307 USA.
1367+
1368+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
1369+*/
1370+
1371+#ifndef _GNU_SOURCE
1372+# define _GNU_SOURCE 1
1373+#endif
1374+
1375+#ifdef HAVE_CONFIG_H
1376+#include <config.h>
1377+#endif
1378+
1379+/* AIX requires this to be the first thing in the file. */
1380+#ifndef __GNUC__
1381+# if HAVE_ALLOCA_H || defined _LIBC
1382+# include <alloca.h>
1383+# else
1384+# ifdef _AIX
1385+#pragma alloca
1386+# else
1387+# ifndef alloca /* predefined by HP cc +Olibcalls */
1388+char *alloca ();
1389+# endif
1390+# endif
1391+# endif
1392+#endif
1393+
1394+#include <stddef.h>
1395+#include <stdlib.h>
1396+#include <string.h>
1397+#include <assert.h>
1398+#include <stdarg.h>
1399+#include <ctype.h>
1400+#include <limits.h>
1401+#ifdef _LIBC
1402+# include <wchar.h>
1403+#endif
1404+
1405+#include <features.h>
1406+#ifndef _
1407+/* This is for other GNU distributions with internationalized messages. */
1408+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
1409+# include <libintl.h>
1410+# ifdef _LIBC
1411+# undef dgettext
1412+# define dgettext(domain, msgid) \
1413+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
1414+# endif
1415+# else
1416+# define dgettext(domain, msgid) (msgid)
1417+# endif
1418+#endif
1419+
1420+#ifndef _LIBC
1421+# if HAVE_STRERROR_R
1422+# if !HAVE_DECL_STRERROR_R
1423+char *strerror_r (int errnum, char *buf, size_t buflen);
1424+# endif
1425+# else
1426+# if !HAVE_DECL_STRERROR
1427+char *strerror (int errnum);
1428+# endif
1429+# endif
1430+#endif
1431+
1432+#include <argp.h>
1433+#include "argp-fmtstream.h"
1434+#include <stdbool.h>
1435+#include <stdint.h>
1436+
1437+#ifndef SIZE_MAX
1438+# define SIZE_MAX ((size_t) -1)
1439+#endif
1440+
1441+/* User-selectable (using an environment variable) formatting parameters.
1442+
1443+ These may be specified in an environment variable called `ARGP_HELP_FMT',
1444+ with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2
1445+ Where VALn must be a positive integer. The list of variables is in the
1446+ UPARAM_NAMES vector, below. */
1447+
1448+/* Default parameters. */
1449+#define DUP_ARGS 0 /* True if option argument can be duplicated. */
1450+#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */
1451+#define SHORT_OPT_COL 2 /* column in which short options start */
1452+#define LONG_OPT_COL 6 /* column in which long options start */
1453+#define DOC_OPT_COL 2 /* column in which doc options start */
1454+#define OPT_DOC_COL 29 /* column in which option text starts */
1455+#define HEADER_COL 1 /* column in which group headers are printed */
1456+#define USAGE_INDENT 12 /* indentation of wrapped usage lines */
1457+#define RMARGIN 79 /* right margin used for wrapping */
1458+
1459+/* User-selectable (using an environment variable) formatting parameters.
1460+ They must all be of type `int' for the parsing code to work. */
1461+struct uparams
1462+{
1463+ /* If true, arguments for an option are shown with both short and long
1464+ options, even when a given option has both, e.g. `-x ARG, --longx=ARG'.
1465+ If false, then if an option has both, the argument is only shown with
1466+ the long one, e.g., `-x, --longx=ARG', and a message indicating that
1467+ this really means both is printed below the options. */
1468+ int dup_args;
1469+
1470+ /* This is true if when DUP_ARGS is false, and some duplicate arguments have
1471+ been suppressed, an explanatory message should be printed. */
1472+ int dup_args_note;
1473+
1474+ /* Various output columns. */
1475+ int short_opt_col;
1476+ int long_opt_col;
1477+ int doc_opt_col;
1478+ int opt_doc_col;
1479+ int header_col;
1480+ int usage_indent;
1481+ int rmargin;
1482+};
1483+
1484+/* This is a global variable, as user options are only ever read once. */
1485+static struct uparams uparams = {
1486+ DUP_ARGS, DUP_ARGS_NOTE,
1487+ SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
1488+ USAGE_INDENT, RMARGIN
1489+};
1490+
1491+/* A particular uparam, and what the user name is. */
1492+struct uparam_name
1493+{
1494+ const char name[14]; /* User name. */
1495+ bool is_bool; /* Whether it's `boolean'. */
1496+ uint8_t uparams_offs; /* Location of the (int) field in UPARAMS. */
1497+};
1498+
1499+/* The name-field mappings we know about. */
1500+static const struct uparam_name uparam_names[] =
1501+{
1502+ { "dup-args", true, offsetof (struct uparams, dup_args) },
1503+ { "dup-args-note", true, offsetof (struct uparams, dup_args_note) },
1504+ { "short-opt-col", false, offsetof (struct uparams, short_opt_col) },
1505+ { "long-opt-col", false, offsetof (struct uparams, long_opt_col) },
1506+ { "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) },
1507+ { "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) },
1508+ { "header-col", false, offsetof (struct uparams, header_col) },
1509+ { "usage-indent", false, offsetof (struct uparams, usage_indent) },
1510+ { "rmargin", false, offsetof (struct uparams, rmargin) }
1511+};
1512+#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
1513+
1514+/* Read user options from the environment, and fill in UPARAMS appropiately. */
1515+static void
1516+fill_in_uparams (const struct argp_state *state)
1517+{
1518+ const char *var = getenv ("ARGP_HELP_FMT");
1519+
1520+#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
1521+
1522+ if (var)
1523+ /* Parse var. */
1524+ while (*var)
1525+ {
1526+ SKIPWS (var);
1527+
1528+ if (isalpha (*var))
1529+ {
1530+ size_t var_len;
1531+ const struct uparam_name *un;
1532+ int unspec = 0, val = 0;
1533+ const char *arg = var;
1534+
1535+ while (isalnum (*arg) || *arg == '-' || *arg == '_')
1536+ arg++;
1537+ var_len = arg - var;
1538+
1539+ SKIPWS (arg);
1540+
1541+ if (*arg == '\0' || *arg == ',')
1542+ unspec = 1;
1543+ else if (*arg == '=')
1544+ {
1545+ arg++;
1546+ SKIPWS (arg);
1547+ }
1548+
1549+ if (unspec)
1550+ {
1551+ if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
1552+ {
1553+ val = 0;
1554+ var += 3;
1555+ var_len -= 3;
1556+ }
1557+ else
1558+ val = 1;
1559+ }
1560+ else if (isdigit (*arg))
1561+ {
1562+ val = atoi (arg);
1563+ while (isdigit (*arg))
1564+ arg++;
1565+ SKIPWS (arg);
1566+ }
1567+
1568+ un = uparam_names;
1569+ size_t u;
1570+ for (u = 0; u < nuparam_names; ++un, ++u)
1571+ if (strlen (un->name) == var_len
1572+ && strncmp (var, un->name, var_len) == 0)
1573+ {
1574+ if (unspec && !un->is_bool)
1575+ argp_failure (state, 0, 0,
1576+ dgettext (state == NULL ? NULL
1577+ : state->root_argp->argp_domain,
1578+ "\
1579+%.*s: ARGP_HELP_FMT parameter requires a value"),
1580+ (int) var_len, var);
1581+ else
1582+ *(int *)((char *)&uparams + un->uparams_offs) = val;
1583+ break;
1584+ }
1585+ if (u == nuparam_names)
1586+ argp_failure (state, 0, 0,
1587+ dgettext (state == NULL ? NULL
1588+ : state->root_argp->argp_domain, "\
1589+%.*s: Unknown ARGP_HELP_FMT parameter"),
1590+ (int) var_len, var);
1591+
1592+ var = arg;
1593+ if (*var == ',')
1594+ var++;
1595+ }
1596+ else if (*var)
1597+ {
1598+ argp_failure (state, 0, 0,
1599+ dgettext (state == NULL ? NULL
1600+ : state->root_argp->argp_domain,
1601+ "Garbage in ARGP_HELP_FMT: %s"), var);
1602+ break;
1603+ }
1604+ }
1605+}
1606+
1607+/* Returns true if OPT hasn't been marked invisible. Visibility only affects
1608+ whether OPT is displayed or used in sorting, not option shadowing. */
1609+#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN))
1610+
1611+/* Returns true if OPT is an alias for an earlier option. */
1612+#define oalias(opt) ((opt)->flags & OPTION_ALIAS)
1613+
1614+/* Returns true if OPT is an documentation-only entry. */
1615+#define odoc(opt) ((opt)->flags & OPTION_DOC)
1616+
1617+/* Returns true if OPT is the end-of-list marker for a list of options. */
1618+#define oend(opt) __option_is_end (opt)
1619+
1620+/* Returns true if OPT has a short option. */
1621+#define oshort(opt) __option_is_short (opt)
1622+
1623+/*
1624+ The help format for a particular option is like:
1625+
1626+ -xARG, -yARG, --long1=ARG, --long2=ARG Documentation...
1627+
1628+ Where ARG will be omitted if there's no argument, for this option, or
1629+ will be surrounded by "[" and "]" appropiately if the argument is
1630+ optional. The documentation string is word-wrapped appropiately, and if
1631+ the list of options is long enough, it will be started on a separate line.
1632+ If there are no short options for a given option, the first long option is
1633+ indented slighly in a way that's supposed to make most long options appear
1634+ to be in a separate column.
1635+
1636+ For example, the following output (from ps):
1637+
1638+ -p PID, --pid=PID List the process PID
1639+ --pgrp=PGRP List processes in the process group PGRP
1640+ -P, -x, --no-parent Include processes without parents
1641+ -Q, --all-fields Don't elide unusable fields (normally if there's
1642+ some reason ps can't print a field for any
1643+ process, it's removed from the output entirely)
1644+ -r, --reverse, --gratuitously-long-reverse-option
1645+ Reverse the order of any sort
1646+ --session[=SID] Add the processes from the session SID (which
1647+ defaults to the sid of the current process)
1648+
1649+ Here are some more options:
1650+ -f ZOT, --foonly=ZOT Glork a foonly
1651+ -z, --zaza Snit a zar
1652+
1653+ -?, --help Give this help list
1654+ --usage Give a short usage message
1655+ -V, --version Print program version
1656+
1657+ The struct argp_option array for the above could look like:
1658+
1659+ {
1660+ {"pid", 'p', "PID", 0, "List the process PID"},
1661+ {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"},
1662+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
1663+ {0, 'x', 0, OPTION_ALIAS},
1664+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
1665+ " if there's some reason ps can't"
1666+ " print a field for any process, it's"
1667+ " removed from the output entirely)" },
1668+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
1669+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
1670+ {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL,
1671+ "Add the processes from the session"
1672+ " SID (which defaults to the sid of"
1673+ " the current process)" },
1674+
1675+ {0,0,0,0, "Here are some more options:"},
1676+ {"foonly", 'f', "ZOT", 0, "Glork a foonly"},
1677+ {"zaza", 'z', 0, 0, "Snit a zar"},
1678+
1679+ {0}
1680+ }
1681+
1682+ Note that the last three options are automatically supplied by argp_parse,
1683+ unless you tell it not to with ARGP_NO_HELP.
1684+
1685+*/
1686+
1687+/* Returns true if CH occurs between BEG and END. */
1688+static int
1689+find_char (char ch, char *beg, char *end)
1690+{
1691+ while (beg < end)
1692+ if (*beg == ch)
1693+ return 1;
1694+ else
1695+ beg++;
1696+ return 0;
1697+}
1698+
1699+struct hol_cluster; /* fwd decl */
1700+
1701+struct hol_entry
1702+{
1703+ /* First option. */
1704+ const struct argp_option *opt;
1705+ /* Number of options (including aliases). */
1706+ unsigned num;
1707+
1708+ /* A pointers into the HOL's short_options field, to the first short option
1709+ letter for this entry. The order of the characters following this point
1710+ corresponds to the order of options pointed to by OPT, and there are at
1711+ most NUM. A short option recorded in a option following OPT is only
1712+ valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's
1713+ probably been shadowed by some other entry). */
1714+ char *short_options;
1715+
1716+ /* Entries are sorted by their group first, in the order:
1717+ 1, 2, ..., n, 0, -m, ..., -2, -1
1718+ and then alphabetically within each group. The default is 0. */
1719+ int group;
1720+
1721+ /* The cluster of options this entry belongs to, or 0 if none. */
1722+ struct hol_cluster *cluster;
1723+
1724+ /* The argp from which this option came. */
1725+ const struct argp *argp;
1726+};
1727+
1728+/* A cluster of entries to reflect the argp tree structure. */
1729+struct hol_cluster
1730+{
1731+ /* A descriptive header printed before options in this cluster. */
1732+ const char *header;
1733+
1734+ /* Used to order clusters within the same group with the same parent,
1735+ according to the order in which they occurred in the parent argp's child
1736+ list. */
1737+ int index;
1738+
1739+ /* How to sort this cluster with respect to options and other clusters at the
1740+ same depth (clusters always follow options in the same group). */
1741+ int group;
1742+
1743+ /* The cluster to which this cluster belongs, or 0 if it's at the base
1744+ level. */
1745+ struct hol_cluster *parent;
1746+
1747+ /* The argp from which this cluster is (eventually) derived. */
1748+ const struct argp *argp;
1749+
1750+ /* The distance this cluster is from the root. */
1751+ int depth;
1752+
1753+ /* Clusters in a given hol are kept in a linked list, to make freeing them
1754+ possible. */
1755+ struct hol_cluster *next;
1756+};
1757+
1758+/* A list of options for help. */
1759+struct hol
1760+{
1761+ /* An array of hol_entry's. */
1762+ struct hol_entry *entries;
1763+ /* The number of entries in this hol. If this field is zero, the others
1764+ are undefined. */
1765+ unsigned num_entries;
1766+
1767+ /* A string containing all short options in this HOL. Each entry contains
1768+ pointers into this string, so the order can't be messed with blindly. */
1769+ char *short_options;
1770+
1771+ /* Clusters of entries in this hol. */
1772+ struct hol_cluster *clusters;
1773+};
1774+
1775+/* Create a struct hol from the options in ARGP. CLUSTER is the
1776+ hol_cluster in which these entries occur, or 0, if at the root. */
1777+static struct hol *
1778+make_hol (const struct argp *argp, struct hol_cluster *cluster)
1779+{
1780+ char *so;
1781+ const struct argp_option *o;
1782+ const struct argp_option *opts = argp->options;
1783+ struct hol_entry *entry;
1784+ unsigned num_short_options = 0;
1785+ struct hol *hol = malloc (sizeof (struct hol));
1786+
1787+ assert (hol);
1788+
1789+ hol->num_entries = 0;
1790+ hol->clusters = 0;
1791+
1792+ if (opts)
1793+ {
1794+ int cur_group = 0;
1795+
1796+ /* The first option must not be an alias. */
1797+ assert (! oalias (opts));
1798+
1799+ /* Calculate the space needed. */
1800+ for (o = opts; ! oend (o); o++)
1801+ {
1802+ if (! oalias (o))
1803+ hol->num_entries++;
1804+ if (oshort (o))
1805+ num_short_options++; /* This is an upper bound. */
1806+ }
1807+
1808+ hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
1809+ hol->short_options = malloc (num_short_options + 1);
1810+
1811+ assert (hol->entries && hol->short_options);
1812+#if SIZE_MAX <= UINT_MAX
1813+ assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
1814+#endif
1815+
1816+ /* Fill in the entries. */
1817+ so = hol->short_options;
1818+ for (o = opts, entry = hol->entries; ! oend (o); entry++)
1819+ {
1820+ entry->opt = o;
1821+ entry->num = 0;
1822+ entry->short_options = so;
1823+ entry->group = cur_group =
1824+ o->group
1825+ ? o->group
1826+ : ((!o->name && !o->key)
1827+ ? cur_group + 1
1828+ : cur_group);
1829+ entry->cluster = cluster;
1830+ entry->argp = argp;
1831+
1832+ do
1833+ {
1834+ entry->num++;
1835+ if (oshort (o) && ! find_char (o->key, hol->short_options, so))
1836+ /* O has a valid short option which hasn't already been used.*/
1837+ *so++ = o->key;
1838+ o++;
1839+ }
1840+ while (! oend (o) && oalias (o));
1841+ }
1842+ *so = '\0'; /* null terminated so we can find the length */
1843+ }
1844+
1845+ return hol;
1846+}
1847+
1848+/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the
1849+ associated argp child list entry), INDEX, and PARENT, and return a pointer
1850+ to it. ARGP is the argp that this cluster results from. */
1851+static struct hol_cluster *
1852+hol_add_cluster (struct hol *hol, int group, const char *header, int index,
1853+ struct hol_cluster *parent, const struct argp *argp)
1854+{
1855+ struct hol_cluster *cl = malloc (sizeof (struct hol_cluster));
1856+ if (cl)
1857+ {
1858+ cl->group = group;
1859+ cl->header = header;
1860+
1861+ cl->index = index;
1862+ cl->parent = parent;
1863+ cl->argp = argp;
1864+ cl->depth = parent ? parent->depth + 1 : 0;
1865+
1866+ cl->next = hol->clusters;
1867+ hol->clusters = cl;
1868+ }
1869+ return cl;
1870+}
1871+
1872+/* Free HOL and any resources it uses. */
1873+static void
1874+hol_free (struct hol *hol)
1875+{
1876+ struct hol_cluster *cl = hol->clusters;
1877+
1878+ while (cl)
1879+ {
1880+ struct hol_cluster *next = cl->next;
1881+ free (cl);
1882+ cl = next;
1883+ }
1884+
1885+ if (hol->num_entries > 0)
1886+ {
1887+ free (hol->entries);
1888+ free (hol->short_options);
1889+ }
1890+
1891+ free (hol);
1892+}
1893+
1894+static int
1895+hol_entry_short_iterate (const struct hol_entry *entry,
1896+ int (*func)(const struct argp_option *opt,
1897+ const struct argp_option *real,
1898+ const char *domain, void *cookie),
1899+ const char *domain, void *cookie)
1900+{
1901+ unsigned nopts;
1902+ int val = 0;
1903+ const struct argp_option *opt, *real = entry->opt;
1904+ char *so = entry->short_options;
1905+
1906+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
1907+ if (oshort (opt) && *so == opt->key)
1908+ {
1909+ if (!oalias (opt))
1910+ real = opt;
1911+ if (ovisible (opt))
1912+ val = (*func)(opt, real, domain, cookie);
1913+ so++;
1914+ }
1915+
1916+ return val;
1917+}
1918+
1919+static __inline__ int
1920+__attribute__ ((always_inline))
1921+hol_entry_long_iterate (const struct hol_entry *entry,
1922+ int (*func)(const struct argp_option *opt,
1923+ const struct argp_option *real,
1924+ const char *domain, void *cookie),
1925+ const char *domain, void *cookie)
1926+{
1927+ unsigned nopts;
1928+ int val = 0;
1929+ const struct argp_option *opt, *real = entry->opt;
1930+
1931+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
1932+ if (opt->name)
1933+ {
1934+ if (!oalias (opt))
1935+ real = opt;
1936+ if (ovisible (opt))
1937+ val = (*func)(opt, real, domain, cookie);
1938+ }
1939+
1940+ return val;
1941+}
1942+
1943+/* Iterator that returns true for the first short option. */
1944+static __inline__ int
1945+until_short (const struct argp_option *opt, const struct argp_option *real,
1946+ const char *domain, void *cookie)
1947+{
1948+ return oshort (opt) ? opt->key : 0;
1949+}
1950+
1951+/* Returns the first valid short option in ENTRY, or 0 if there is none. */
1952+static char
1953+hol_entry_first_short (const struct hol_entry *entry)
1954+{
1955+ return hol_entry_short_iterate (entry, until_short,
1956+ entry->argp->argp_domain, 0);
1957+}
1958+
1959+/* Returns the first valid long option in ENTRY, or 0 if there is none. */
1960+static const char *
1961+hol_entry_first_long (const struct hol_entry *entry)
1962+{
1963+ const struct argp_option *opt;
1964+ unsigned num;
1965+ for (opt = entry->opt, num = entry->num; num > 0; opt++, num--)
1966+ if (opt->name && ovisible (opt))
1967+ return opt->name;
1968+ return 0;
1969+}
1970+
1971+/* Returns the entry in HOL with the long option name NAME, or 0 if there is
1972+ none. */
1973+static struct hol_entry *
1974+hol_find_entry (struct hol *hol, const char *name)
1975+{
1976+ struct hol_entry *entry = hol->entries;
1977+ unsigned num_entries = hol->num_entries;
1978+
1979+ while (num_entries-- > 0)
1980+ {
1981+ const struct argp_option *opt = entry->opt;
1982+ unsigned num_opts = entry->num;
1983+
1984+ while (num_opts-- > 0)
1985+ if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0)
1986+ return entry;
1987+ else
1988+ opt++;
1989+
1990+ entry++;
1991+ }
1992+
1993+ return 0;
1994+}
1995+
1996+/* If an entry with the long option NAME occurs in HOL, set it's special
1997+ sort position to GROUP. */
1998+static void
1999+hol_set_group (struct hol *hol, const char *name, int group)
2000+{
2001+ struct hol_entry *entry = hol_find_entry (hol, name);
2002+ if (entry)
2003+ entry->group = group;
2004+}
2005+
2006+/* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1.
2007+ EQ is what to return if GROUP1 and GROUP2 are the same. */
2008+static int
2009+group_cmp (int group1, int group2, int eq)
2010+{
2011+ if (group1 == group2)
2012+ return eq;
2013+ else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0))
2014+ return group1 - group2;
2015+ else
2016+ return group2 - group1;
2017+}
2018+
2019+/* Compare clusters CL1 & CL2 by the order that they should appear in
2020+ output. */
2021+static int
2022+hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
2023+{
2024+ /* If one cluster is deeper than the other, use its ancestor at the same
2025+ level, so that finding the common ancestor is straightforward. */
2026+ while (cl1->depth > cl2->depth)
2027+ cl1 = cl1->parent;
2028+ while (cl2->depth > cl1->depth)
2029+ cl2 = cl2->parent;
2030+
2031+ /* Now reduce both clusters to their ancestors at the point where both have
2032+ a common parent; these can be directly compared. */
2033+ while (cl1->parent != cl2->parent)
2034+ cl1 = cl1->parent, cl2 = cl2->parent;
2035+
2036+ return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index);
2037+}
2038+
2039+/* Return the ancestor of CL that's just below the root (i.e., has a parent
2040+ of 0). */
2041+static struct hol_cluster *
2042+hol_cluster_base (struct hol_cluster *cl)
2043+{
2044+ while (cl->parent)
2045+ cl = cl->parent;
2046+ return cl;
2047+}
2048+
2049+/* Return true if CL1 is a child of CL2. */
2050+static int
2051+hol_cluster_is_child (const struct hol_cluster *cl1,
2052+ const struct hol_cluster *cl2)
2053+{
2054+ while (cl1 && cl1 != cl2)
2055+ cl1 = cl1->parent;
2056+ return cl1 == cl2;
2057+}
2058+
2059+/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
2060+ that should be used for comparisons, and returns true iff it should be
2061+ treated as a non-option. */
2062+static int
2063+canon_doc_option (const char **name)
2064+{
2065+ int non_opt;
2066+ /* Skip initial whitespace. */
2067+ while (isspace (**name))
2068+ (*name)++;
2069+ /* Decide whether this looks like an option (leading `-') or not. */
2070+ non_opt = (**name != '-');
2071+ /* Skip until part of name used for sorting. */
2072+ while (**name && !isalnum (**name))
2073+ (*name)++;
2074+ return non_opt;
2075+}
2076+
2077+/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help
2078+ listing. */
2079+static int
2080+hol_entry_cmp (const struct hol_entry *entry1,
2081+ const struct hol_entry *entry2)
2082+{
2083+ /* The group numbers by which the entries should be ordered; if either is
2084+ in a cluster, then this is just the group within the cluster. */
2085+ int group1 = entry1->group, group2 = entry2->group;
2086+
2087+ if (entry1->cluster != entry2->cluster)
2088+ {
2089+ /* The entries are not within the same cluster, so we can't compare them
2090+ directly, we have to use the appropiate clustering level too. */
2091+ if (! entry1->cluster)
2092+ /* ENTRY1 is at the `base level', not in a cluster, so we have to
2093+ compare it's group number with that of the base cluster in which
2094+ ENTRY2 resides. Note that if they're in the same group, the
2095+ clustered option always comes laster. */
2096+ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
2097+ else if (! entry2->cluster)
2098+ /* Likewise, but ENTRY2's not in a cluster. */
2099+ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
2100+ else
2101+ /* Both entries are in clusters, we can just compare the clusters. */
2102+ return hol_cluster_cmp (entry1->cluster, entry2->cluster);
2103+ }
2104+ else if (group1 == group2)
2105+ /* The entries are both in the same cluster and group, so compare them
2106+ alphabetically. */
2107+ {
2108+ int short1 = hol_entry_first_short (entry1);
2109+ int short2 = hol_entry_first_short (entry2);
2110+ int doc1 = odoc (entry1->opt);
2111+ int doc2 = odoc (entry2->opt);
2112+ const char *long1 = hol_entry_first_long (entry1);
2113+ const char *long2 = hol_entry_first_long (entry2);
2114+
2115+ if (doc1)
2116+ doc1 = long1 != NULL && canon_doc_option (&long1);
2117+ if (doc2)
2118+ doc2 = long2 != NULL && canon_doc_option (&long2);
2119+
2120+ if (doc1 != doc2)
2121+ /* `documentation' options always follow normal options (or
2122+ documentation options that *look* like normal options). */
2123+ return doc1 - doc2;
2124+ else if (!short1 && !short2 && long1 && long2)
2125+ /* Only long options. */
2126+ return strcasecmp (long1, long2);
2127+ else
2128+ /* Compare short/short, long/short, short/long, using the first
2129+ character of long options. Entries without *any* valid
2130+ options (such as options with OPTION_HIDDEN set) will be put
2131+ first, but as they're not displayed, it doesn't matter where
2132+ they are. */
2133+ {
2134+ char first1 = short1 ? short1 : long1 ? *long1 : 0;
2135+ char first2 = short2 ? short2 : long2 ? *long2 : 0;
2136+#ifdef _tolower
2137+ int lower_cmp = _tolower (first1) - _tolower (first2);
2138+#else
2139+ int lower_cmp = tolower (first1) - tolower (first2);
2140+#endif
2141+ /* Compare ignoring case, except when the options are both the
2142+ same letter, in which case lower-case always comes first. */
2143+ return lower_cmp ? lower_cmp : first2 - first1;
2144+ }
2145+ }
2146+ else
2147+ /* Within the same cluster, but not the same group, so just compare
2148+ groups. */
2149+ return group_cmp (group1, group2, 0);
2150+}
2151+
2152+/* Version of hol_entry_cmp with correct signature for qsort. */
2153+static int
2154+hol_entry_qcmp (const void *entry1_v, const void *entry2_v)
2155+{
2156+ return hol_entry_cmp (entry1_v, entry2_v);
2157+}
2158+
2159+/* Sort HOL by group and alphabetically by option name (with short options
2160+ taking precedence over long). Since the sorting is for display purposes
2161+ only, the shadowing of options isn't effected. */
2162+static void
2163+hol_sort (struct hol *hol)
2164+{
2165+ if (hol->num_entries > 0)
2166+ qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry),
2167+ hol_entry_qcmp);
2168+}
2169+
2170+/* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow
2171+ any in MORE with the same name. */
2172+static void
2173+hol_append (struct hol *hol, struct hol *more)
2174+{
2175+ struct hol_cluster **cl_end = &hol->clusters;
2176+
2177+ /* Steal MORE's cluster list, and add it to the end of HOL's. */
2178+ while (*cl_end)
2179+ cl_end = &(*cl_end)->next;
2180+ *cl_end = more->clusters;
2181+ more->clusters = 0;
2182+
2183+ /* Merge entries. */
2184+ if (more->num_entries > 0)
2185+ {
2186+ if (hol->num_entries == 0)
2187+ {
2188+ hol->num_entries = more->num_entries;
2189+ hol->entries = more->entries;
2190+ hol->short_options = more->short_options;
2191+ more->num_entries = 0; /* Mark MORE's fields as invalid. */
2192+ }
2193+ else
2194+ /* Append the entries in MORE to those in HOL, taking care to only add
2195+ non-shadowed SHORT_OPTIONS values. */
2196+ {
2197+ unsigned left;
2198+ char *so, *more_so;
2199+ struct hol_entry *e;
2200+ unsigned num_entries = hol->num_entries + more->num_entries;
2201+ struct hol_entry *entries =
2202+ malloc (num_entries * sizeof (struct hol_entry));
2203+ unsigned hol_so_len = strlen (hol->short_options);
2204+ char *short_options =
2205+ malloc (hol_so_len + strlen (more->short_options) + 1);
2206+
2207+ assert (entries && short_options);
2208+#if SIZE_MAX <= UINT_MAX
2209+ assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
2210+#endif
2211+
2212+ mempcpy (mempcpy (entries, hol->entries,
2213+ hol->num_entries * sizeof (struct hol_entry)),
2214+ more->entries,
2215+ more->num_entries * sizeof (struct hol_entry));
2216+
2217+ mempcpy (short_options, hol->short_options, hol_so_len);
2218+
2219+ /* Fix up the short options pointers from HOL. */
2220+ for (e = entries, left = hol->num_entries; left > 0; e++, left--)
2221+ e->short_options += (short_options - hol->short_options);
2222+
2223+ /* Now add the short options from MORE, fixing up its entries
2224+ too. */
2225+ so = short_options + hol_so_len;
2226+ more_so = more->short_options;
2227+ for (left = more->num_entries; left > 0; e++, left--)
2228+ {
2229+ int opts_left;
2230+ const struct argp_option *opt;
2231+
2232+ e->short_options = so;
2233+
2234+ for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--)
2235+ {
2236+ int ch = *more_so;
2237+ if (oshort (opt) && ch == opt->key)
2238+ /* The next short option in MORE_SO, CH, is from OPT. */
2239+ {
2240+ if (! find_char (ch, short_options,
2241+ short_options + hol_so_len))
2242+ /* The short option CH isn't shadowed by HOL's options,
2243+ so add it to the sum. */
2244+ *so++ = ch;
2245+ more_so++;
2246+ }
2247+ }
2248+ }
2249+
2250+ *so = '\0';
2251+
2252+ free (hol->entries);
2253+ free (hol->short_options);
2254+
2255+ hol->entries = entries;
2256+ hol->num_entries = num_entries;
2257+ hol->short_options = short_options;
2258+ }
2259+ }
2260+
2261+ hol_free (more);
2262+}
2263+
2264+/* Inserts enough spaces to make sure STREAM is at column COL. */
2265+static void
2266+indent_to (argp_fmtstream_t stream, unsigned col)
2267+{
2268+ int needed = col - __argp_fmtstream_point (stream);
2269+ while (needed-- > 0)
2270+ __argp_fmtstream_putc (stream, ' ');
2271+}
2272+
2273+/* Output to STREAM either a space, or a newline if there isn't room for at
2274+ least ENSURE characters before the right margin. */
2275+static void
2276+space (argp_fmtstream_t stream, size_t ensure)
2277+{
2278+ if (__argp_fmtstream_point (stream) + ensure
2279+ >= __argp_fmtstream_rmargin (stream))
2280+ __argp_fmtstream_putc (stream, '\n');
2281+ else
2282+ __argp_fmtstream_putc (stream, ' ');
2283+}
2284+
2285+/* If the option REAL has an argument, we print it in using the printf
2286+ format REQ_FMT or OPT_FMT depending on whether it's a required or
2287+ optional argument. */
2288+static void
2289+arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
2290+ const char *domain, argp_fmtstream_t stream)
2291+{
2292+ if (real->arg)
2293+ {
2294+ if (real->flags & OPTION_ARG_OPTIONAL)
2295+ __argp_fmtstream_printf (stream, opt_fmt,
2296+ dgettext (domain, real->arg));
2297+ else
2298+ __argp_fmtstream_printf (stream, req_fmt,
2299+ dgettext (domain, real->arg));
2300+ }
2301+}
2302+
2303+/* Helper functions for hol_entry_help. */
2304+
2305+/* State used during the execution of hol_help. */
2306+struct hol_help_state
2307+{
2308+ /* PREV_ENTRY should contain the previous entry printed, or 0. */
2309+ struct hol_entry *prev_entry;
2310+
2311+ /* If an entry is in a different group from the previous one, and SEP_GROUPS
2312+ is true, then a blank line will be printed before any output. */
2313+ int sep_groups;
2314+
2315+ /* True if a duplicate option argument was suppressed (only ever set if
2316+ UPARAMS.dup_args is false). */
2317+ int suppressed_dup_arg;
2318+};
2319+
2320+/* Some state used while printing a help entry (used to communicate with
2321+ helper functions). See the doc for hol_entry_help for more info, as most
2322+ of the fields are copied from its arguments. */
2323+struct pentry_state
2324+{
2325+ const struct hol_entry *entry;
2326+ argp_fmtstream_t stream;
2327+ struct hol_help_state *hhstate;
2328+
2329+ /* True if nothing's been printed so far. */
2330+ int first;
2331+
2332+ /* If non-zero, the state that was used to print this help. */
2333+ const struct argp_state *state;
2334+};
2335+
2336+/* If a user doc filter should be applied to DOC, do so. */
2337+static const char *
2338+filter_doc (const char *doc, int key, const struct argp *argp,
2339+ const struct argp_state *state)
2340+{
2341+ if (argp && argp->help_filter)
2342+ /* We must apply a user filter to this output. */
2343+ {
2344+ void *input = __argp_input (argp, state);
2345+ return (*argp->help_filter) (key, doc, input);
2346+ }
2347+ else
2348+ /* No filter. */
2349+ return doc;
2350+}
2351+
2352+/* Prints STR as a header line, with the margin lines set appropiately, and
2353+ notes the fact that groups should be separated with a blank line. ARGP is
2354+ the argp that should dictate any user doc filtering to take place. Note
2355+ that the previous wrap margin isn't restored, but the left margin is reset
2356+ to 0. */
2357+static void
2358+print_header (const char *str, const struct argp *argp,
2359+ struct pentry_state *pest)
2360+{
2361+ const char *tstr = dgettext (argp->argp_domain, str);
2362+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state);
2363+
2364+ if (fstr)
2365+ {
2366+ if (*fstr)
2367+ {
2368+ if (pest->hhstate->prev_entry)
2369+ /* Precede with a blank line. */
2370+ __argp_fmtstream_putc (pest->stream, '\n');
2371+ indent_to (pest->stream, uparams.header_col);
2372+ __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col);
2373+ __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col);
2374+ __argp_fmtstream_puts (pest->stream, fstr);
2375+ __argp_fmtstream_set_lmargin (pest->stream, 0);
2376+ __argp_fmtstream_putc (pest->stream, '\n');
2377+ }
2378+
2379+ pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */
2380+ }
2381+
2382+ if (fstr != tstr)
2383+ free ((char *) fstr);
2384+}
2385+
2386+/* Inserts a comma if this isn't the first item on the line, and then makes
2387+ sure we're at least to column COL. If this *is* the first item on a line,
2388+ prints any pending whitespace/headers that should precede this line. Also
2389+ clears FIRST. */
2390+static void
2391+comma (unsigned col, struct pentry_state *pest)
2392+{
2393+ if (pest->first)
2394+ {
2395+ const struct hol_entry *pe = pest->hhstate->prev_entry;
2396+ const struct hol_cluster *cl = pest->entry->cluster;
2397+
2398+ if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group)
2399+ __argp_fmtstream_putc (pest->stream, '\n');
2400+
2401+ if (cl && cl->header && *cl->header
2402+ && (!pe
2403+ || (pe->cluster != cl
2404+ && !hol_cluster_is_child (pe->cluster, cl))))
2405+ /* If we're changing clusters, then this must be the start of the
2406+ ENTRY's cluster unless that is an ancestor of the previous one
2407+ (in which case we had just popped into a sub-cluster for a bit).
2408+ If so, then print the cluster's header line. */
2409+ {
2410+ int old_wm = __argp_fmtstream_wmargin (pest->stream);
2411+ print_header (cl->header, cl->argp, pest);
2412+ __argp_fmtstream_set_wmargin (pest->stream, old_wm);
2413+ }
2414+
2415+ pest->first = 0;
2416+ }
2417+ else
2418+ __argp_fmtstream_puts (pest->stream, ", ");
2419+
2420+ indent_to (pest->stream, col);
2421+}
2422+
2423+/* Print help for ENTRY to STREAM. */
2424+static void
2425+hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
2426+ argp_fmtstream_t stream, struct hol_help_state *hhstate)
2427+{
2428+ unsigned num;
2429+ const struct argp_option *real = entry->opt, *opt;
2430+ char *so = entry->short_options;
2431+ int have_long_opt = 0; /* We have any long options. */
2432+ /* Saved margins. */
2433+ int old_lm = __argp_fmtstream_set_lmargin (stream, 0);
2434+ int old_wm = __argp_fmtstream_wmargin (stream);
2435+ /* PEST is a state block holding some of our variables that we'd like to
2436+ share with helper functions. */
2437+ struct pentry_state pest = { entry, stream, hhstate, 1, state };
2438+
2439+ if (! odoc (real))
2440+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2441+ if (opt->name && ovisible (opt))
2442+ {
2443+ have_long_opt = 1;
2444+ break;
2445+ }
2446+
2447+ /* First emit short options. */
2448+ __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */
2449+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2450+ if (oshort (opt) && opt->key == *so)
2451+ /* OPT has a valid (non shadowed) short option. */
2452+ {
2453+ if (ovisible (opt))
2454+ {
2455+ comma (uparams.short_opt_col, &pest);
2456+ __argp_fmtstream_putc (stream, '-');
2457+ __argp_fmtstream_putc (stream, *so);
2458+ if (!have_long_opt || uparams.dup_args)
2459+ arg (real, " %s", "[%s]",
2460+ state == NULL ? NULL : state->root_argp->argp_domain,
2461+ stream);
2462+ else if (real->arg)
2463+ hhstate->suppressed_dup_arg = 1;
2464+ }
2465+ so++;
2466+ }
2467+
2468+ /* Now, long options. */
2469+ if (odoc (real))
2470+ /* A `documentation' option. */
2471+ {
2472+ __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
2473+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2474+ if (opt->name && ovisible (opt))
2475+ {
2476+ comma (uparams.doc_opt_col, &pest);
2477+ /* Calling gettext here isn't quite right, since sorting will
2478+ have been done on the original; but documentation options
2479+ should be pretty rare anyway... */
2480+ __argp_fmtstream_puts (stream,
2481+ dgettext (state == NULL ? NULL
2482+ : state->root_argp->argp_domain,
2483+ opt->name));
2484+ }
2485+ }
2486+ else
2487+ /* A real long option. */
2488+ {
2489+ __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
2490+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2491+ if (opt->name && ovisible (opt))
2492+ {
2493+ comma (uparams.long_opt_col, &pest);
2494+ __argp_fmtstream_printf (stream, "--%s", opt->name);
2495+ arg (real, "=%s", "[=%s]",
2496+ state == NULL ? NULL : state->root_argp->argp_domain, stream);
2497+ }
2498+ }
2499+
2500+ /* Next, documentation strings. */
2501+ __argp_fmtstream_set_lmargin (stream, 0);
2502+
2503+ if (pest.first)
2504+ {
2505+ /* Didn't print any switches, what's up? */
2506+ if (!oshort (real) && !real->name)
2507+ /* This is a group header, print it nicely. */
2508+ print_header (real->doc, entry->argp, &pest);
2509+ else
2510+ /* Just a totally shadowed option or null header; print nothing. */
2511+ goto cleanup; /* Just return, after cleaning up. */
2512+ }
2513+ else
2514+ {
2515+ const char *tstr = real->doc ? dgettext (state == NULL ? NULL
2516+ : state->root_argp->argp_domain,
2517+ real->doc) : 0;
2518+ const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
2519+ if (fstr && *fstr)
2520+ {
2521+ unsigned int col = __argp_fmtstream_point (stream);
2522+
2523+ __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col);
2524+ __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col);
2525+
2526+ if (col > (unsigned int) (uparams.opt_doc_col + 3))
2527+ __argp_fmtstream_putc (stream, '\n');
2528+ else if (col >= (unsigned int) uparams.opt_doc_col)
2529+ __argp_fmtstream_puts (stream, " ");
2530+ else
2531+ indent_to (stream, uparams.opt_doc_col);
2532+
2533+ __argp_fmtstream_puts (stream, fstr);
2534+ }
2535+ if (fstr && fstr != tstr)
2536+ free ((char *) fstr);
2537+
2538+ /* Reset the left margin. */
2539+ __argp_fmtstream_set_lmargin (stream, 0);
2540+ __argp_fmtstream_putc (stream, '\n');
2541+ }
2542+
2543+ hhstate->prev_entry = entry;
2544+
2545+cleanup:
2546+ __argp_fmtstream_set_lmargin (stream, old_lm);
2547+ __argp_fmtstream_set_wmargin (stream, old_wm);
2548+}
2549+
2550+/* Output a long help message about the options in HOL to STREAM. */
2551+static void
2552+hol_help (struct hol *hol, const struct argp_state *state,
2553+ argp_fmtstream_t stream)
2554+{
2555+ unsigned num;
2556+ struct hol_entry *entry;
2557+ struct hol_help_state hhstate = { 0, 0, 0 };
2558+
2559+ for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--)
2560+ hol_entry_help (entry, state, stream, &hhstate);
2561+
2562+ if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
2563+ {
2564+ const char *tstr = dgettext (state == NULL ? NULL
2565+ : state->root_argp->argp_domain, "\
2566+Mandatory or optional arguments to long options are also mandatory or \
2567+optional for any corresponding short options.");
2568+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
2569+ state ? state->root_argp : 0, state);
2570+ if (fstr && *fstr)
2571+ {
2572+ __argp_fmtstream_putc (stream, '\n');
2573+ __argp_fmtstream_puts (stream, fstr);
2574+ __argp_fmtstream_putc (stream, '\n');
2575+ }
2576+ if (fstr && fstr != tstr)
2577+ free ((char *) fstr);
2578+ }
2579+}
2580+
2581+/* Helper functions for hol_usage. */
2582+
2583+/* If OPT is a short option without an arg, append its key to the string
2584+ pointer pointer to by COOKIE, and advance the pointer. */
2585+static int
2586+add_argless_short_opt (const struct argp_option *opt,
2587+ const struct argp_option *real,
2588+ const char *domain, void *cookie)
2589+{
2590+ char **snao_end = cookie;
2591+ if (!(opt->arg || real->arg)
2592+ && !((opt->flags | real->flags) & OPTION_NO_USAGE))
2593+ *(*snao_end)++ = opt->key;
2594+ return 0;
2595+}
2596+
2597+/* If OPT is a short option with an arg, output a usage entry for it to the
2598+ stream pointed at by COOKIE. */
2599+static int
2600+usage_argful_short_opt (const struct argp_option *opt,
2601+ const struct argp_option *real,
2602+ const char *domain, void *cookie)
2603+{
2604+ argp_fmtstream_t stream = cookie;
2605+ const char *arg = opt->arg;
2606+ int flags = opt->flags | real->flags;
2607+
2608+ if (! arg)
2609+ arg = real->arg;
2610+
2611+ if (arg && !(flags & OPTION_NO_USAGE))
2612+ {
2613+ arg = dgettext (domain, arg);
2614+
2615+ if (flags & OPTION_ARG_OPTIONAL)
2616+ __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg);
2617+ else
2618+ {
2619+ /* Manually do line wrapping so that it (probably) won't
2620+ get wrapped at the embedded space. */
2621+ space (stream, 6 + strlen (arg));
2622+ __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg);
2623+ }
2624+ }
2625+
2626+ return 0;
2627+}
2628+
2629+/* Output a usage entry for the long option opt to the stream pointed at by
2630+ COOKIE. */
2631+static int
2632+usage_long_opt (const struct argp_option *opt,
2633+ const struct argp_option *real,
2634+ const char *domain, void *cookie)
2635+{
2636+ argp_fmtstream_t stream = cookie;
2637+ const char *arg = opt->arg;
2638+ int flags = opt->flags | real->flags;
2639+
2640+ if (! arg)
2641+ arg = real->arg;
2642+
2643+ if (! (flags & OPTION_NO_USAGE))
2644+ {
2645+ if (arg)
2646+ {
2647+ arg = dgettext (domain, arg);
2648+ if (flags & OPTION_ARG_OPTIONAL)
2649+ __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg);
2650+ else
2651+ __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg);
2652+ }
2653+ else
2654+ __argp_fmtstream_printf (stream, " [--%s]", opt->name);
2655+ }
2656+
2657+ return 0;
2658+}
2659+
2660+/* Print a short usage description for the arguments in HOL to STREAM. */
2661+static void
2662+hol_usage (struct hol *hol, argp_fmtstream_t stream)
2663+{
2664+ if (hol->num_entries > 0)
2665+ {
2666+ unsigned nentries;
2667+ struct hol_entry *entry;
2668+ char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1);
2669+ char *snao_end = short_no_arg_opts;
2670+
2671+ /* First we put a list of short options without arguments. */
2672+ for (entry = hol->entries, nentries = hol->num_entries
2673+ ; nentries > 0
2674+ ; entry++, nentries--)
2675+ hol_entry_short_iterate (entry, add_argless_short_opt,
2676+ entry->argp->argp_domain, &snao_end);
2677+ if (snao_end > short_no_arg_opts)
2678+ {
2679+ *snao_end++ = 0;
2680+ __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts);
2681+ }
2682+
2683+ /* Now a list of short options *with* arguments. */
2684+ for (entry = hol->entries, nentries = hol->num_entries
2685+ ; nentries > 0
2686+ ; entry++, nentries--)
2687+ hol_entry_short_iterate (entry, usage_argful_short_opt,
2688+ entry->argp->argp_domain, stream);
2689+
2690+ /* Finally, a list of long options (whew!). */
2691+ for (entry = hol->entries, nentries = hol->num_entries
2692+ ; nentries > 0
2693+ ; entry++, nentries--)
2694+ hol_entry_long_iterate (entry, usage_long_opt,
2695+ entry->argp->argp_domain, stream);
2696+ }
2697+}
2698+
2699+/* Make a HOL containing all levels of options in ARGP. CLUSTER is the
2700+ cluster in which ARGP's entries should be clustered, or 0. */
2701+static struct hol *
2702+argp_hol (const struct argp *argp, struct hol_cluster *cluster)
2703+{
2704+ const struct argp_child *child = argp->children;
2705+ struct hol *hol = make_hol (argp, cluster);
2706+ if (child)
2707+ while (child->argp)
2708+ {
2709+ struct hol_cluster *child_cluster =
2710+ ((child->group || child->header)
2711+ /* Put CHILD->argp within its own cluster. */
2712+ ? hol_add_cluster (hol, child->group, child->header,
2713+ child - argp->children, cluster, argp)
2714+ /* Just merge it into the parent's cluster. */
2715+ : cluster);
2716+ hol_append (hol, argp_hol (child->argp, child_cluster)) ;
2717+ child++;
2718+ }
2719+ return hol;
2720+}
2721+
2722+/* Calculate how many different levels with alternative args strings exist in
2723+ ARGP. */
2724+static size_t
2725+argp_args_levels (const struct argp *argp)
2726+{
2727+ size_t levels = 0;
2728+ const struct argp_child *child = argp->children;
2729+
2730+ if (argp->args_doc && strchr (argp->args_doc, '\n'))
2731+ levels++;
2732+
2733+ if (child)
2734+ while (child->argp)
2735+ levels += argp_args_levels ((child++)->argp);
2736+
2737+ return levels;
2738+}
2739+
2740+/* Print all the non-option args documented in ARGP to STREAM. Any output is
2741+ preceded by a space. LEVELS is a pointer to a byte vector the length
2742+ returned by argp_args_levels; it should be initialized to zero, and
2743+ updated by this routine for the next call if ADVANCE is true. True is
2744+ returned as long as there are more patterns to output. */
2745+static int
2746+argp_args_usage (const struct argp *argp, const struct argp_state *state,
2747+ char **levels, int advance, argp_fmtstream_t stream)
2748+{
2749+ char *our_level = *levels;
2750+ int multiple = 0;
2751+ const struct argp_child *child = argp->children;
2752+ const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
2753+ const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
2754+
2755+ if (fdoc)
2756+ {
2757+ const char *cp = fdoc;
2758+ nl = strchrnul (cp, '\n');
2759+ if (*nl != '\0')
2760+ /* This is a `multi-level' args doc; advance to the correct position
2761+ as determined by our state in LEVELS, and update LEVELS. */
2762+ {
2763+ int i;
2764+ multiple = 1;
2765+ for (i = 0; i < *our_level; i++)
2766+ cp = nl + 1, nl = strchrnul (cp, '\n');
2767+ (*levels)++;
2768+ }
2769+
2770+ /* Manually do line wrapping so that it (probably) won't get wrapped at
2771+ any embedded spaces. */
2772+ space (stream, 1 + nl - cp);
2773+
2774+ __argp_fmtstream_write (stream, cp, nl - cp);
2775+ }
2776+ if (fdoc && fdoc != tdoc)
2777+ free ((char *)fdoc); /* Free user's modified doc string. */
2778+
2779+ if (child)
2780+ while (child->argp)
2781+ advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
2782+
2783+ if (advance && multiple)
2784+ {
2785+ /* Need to increment our level. */
2786+ if (*nl)
2787+ /* There's more we can do here. */
2788+ {
2789+ (*our_level)++;
2790+ advance = 0; /* Our parent shouldn't advance also. */
2791+ }
2792+ else if (*our_level > 0)
2793+ /* We had multiple levels, but used them up; reset to zero. */
2794+ *our_level = 0;
2795+ }
2796+
2797+ return !advance;
2798+}
2799+
2800+/* Print the documentation for ARGP to STREAM; if POST is false, then
2801+ everything preceeding a `\v' character in the documentation strings (or
2802+ the whole string, for those with none) is printed, otherwise, everything
2803+ following the `\v' character (nothing for strings without). Each separate
2804+ bit of documentation is separated a blank line, and if PRE_BLANK is true,
2805+ then the first is as well. If FIRST_ONLY is true, only the first
2806+ occurrence is output. Returns true if anything was output. */
2807+static int
2808+argp_doc (const struct argp *argp, const struct argp_state *state,
2809+ int post, int pre_blank, int first_only,
2810+ argp_fmtstream_t stream)
2811+{
2812+ const char *text;
2813+ const char *inp_text;
2814+ void *input = 0;
2815+ int anything = 0;
2816+ size_t inp_text_limit = 0;
2817+ const char *doc = dgettext (argp->argp_domain, argp->doc);
2818+ const struct argp_child *child = argp->children;
2819+
2820+ if (doc)
2821+ {
2822+ char *vt = strchr (doc, '\v');
2823+ inp_text = post ? (vt ? vt + 1 : 0) : doc;
2824+ inp_text_limit = (!post && vt) ? (vt - doc) : 0;
2825+ }
2826+ else
2827+ inp_text = 0;
2828+
2829+ if (argp->help_filter)
2830+ /* We have to filter the doc strings. */
2831+ {
2832+ if (inp_text_limit)
2833+ /* Copy INP_TEXT so that it's nul-terminated. */
2834+ inp_text = strndup (inp_text, inp_text_limit);
2835+ input = __argp_input (argp, state);
2836+ text =
2837+ (*argp->help_filter) (post
2838+ ? ARGP_KEY_HELP_POST_DOC
2839+ : ARGP_KEY_HELP_PRE_DOC,
2840+ inp_text, input);
2841+ }
2842+ else
2843+ text = (const char *) inp_text;
2844+
2845+ if (text)
2846+ {
2847+ if (pre_blank)
2848+ __argp_fmtstream_putc (stream, '\n');
2849+
2850+ if (text == inp_text && inp_text_limit)
2851+ __argp_fmtstream_write (stream, inp_text, inp_text_limit);
2852+ else
2853+ __argp_fmtstream_puts (stream, text);
2854+
2855+ if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream))
2856+ __argp_fmtstream_putc (stream, '\n');
2857+
2858+ anything = 1;
2859+ }
2860+
2861+ if (text && text != inp_text)
2862+ free ((char *) text); /* Free TEXT returned from the help filter. */
2863+ if (inp_text && inp_text_limit && argp->help_filter)
2864+ free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */
2865+
2866+ if (post && argp->help_filter)
2867+ /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
2868+ {
2869+ text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
2870+ if (text)
2871+ {
2872+ if (anything || pre_blank)
2873+ __argp_fmtstream_putc (stream, '\n');
2874+ __argp_fmtstream_puts (stream, text);
2875+ free ((char *) text);
2876+ if (__argp_fmtstream_point (stream)
2877+ > __argp_fmtstream_lmargin (stream))
2878+ __argp_fmtstream_putc (stream, '\n');
2879+ anything = 1;
2880+ }
2881+ }
2882+
2883+ if (child)
2884+ while (child->argp && !(first_only && anything))
2885+ anything |=
2886+ argp_doc ((child++)->argp, state,
2887+ post, anything || pre_blank, first_only,
2888+ stream);
2889+
2890+ return anything;
2891+}
2892+
2893+/* Output a usage message for ARGP to STREAM. If called from
2894+ argp_state_help, STATE is the relevent parsing state. FLAGS are from the
2895+ set ARGP_HELP_*. NAME is what to use wherever a `program name' is
2896+ needed. */
2897+static void
2898+_help (const struct argp *argp, const struct argp_state *state, FILE *stream,
2899+ unsigned flags, char *name)
2900+{
2901+ int anything = 0; /* Whether we've output anything. */
2902+ struct hol *hol = 0;
2903+ argp_fmtstream_t fs;
2904+
2905+ if (! stream)
2906+ return;
2907+
2908+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
2909+ flockfile (stream);
2910+#endif
2911+
2912+ fill_in_uparams (state);
2913+
2914+ fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
2915+ if (! fs)
2916+ {
2917+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
2918+ funlockfile (stream);
2919+#endif
2920+ return;
2921+ }
2922+
2923+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
2924+ {
2925+ hol = argp_hol (argp, 0);
2926+
2927+ /* If present, these options always come last. */
2928+ hol_set_group (hol, "help", -1);
2929+ hol_set_group (hol, "version", -1);
2930+
2931+ hol_sort (hol);
2932+ }
2933+
2934+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE))
2935+ /* Print a short `Usage:' message. */
2936+ {
2937+ int first_pattern = 1, more_patterns;
2938+ size_t num_pattern_levels = argp_args_levels (argp);
2939+ char *pattern_levels = alloca (num_pattern_levels);
2940+
2941+ memset (pattern_levels, 0, num_pattern_levels);
2942+
2943+ do
2944+ {
2945+ int old_lm;
2946+ int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent);
2947+ char *levels = pattern_levels;
2948+
2949+ if (first_pattern)
2950+ __argp_fmtstream_printf (fs, "%s %s",
2951+ dgettext (argp->argp_domain, "Usage:"),
2952+ name);
2953+ else
2954+ __argp_fmtstream_printf (fs, "%s %s",
2955+ dgettext (argp->argp_domain, " or: "),
2956+ name);
2957+
2958+ /* We set the lmargin as well as the wmargin, because hol_usage
2959+ manually wraps options with newline to avoid annoying breaks. */
2960+ old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent);
2961+
2962+ if (flags & ARGP_HELP_SHORT_USAGE)
2963+ /* Just show where the options go. */
2964+ {
2965+ if (hol->num_entries > 0)
2966+ __argp_fmtstream_puts (fs, dgettext (argp->argp_domain,
2967+ " [OPTION...]"));
2968+ }
2969+ else
2970+ /* Actually print the options. */
2971+ {
2972+ hol_usage (hol, fs);
2973+ flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */
2974+ }
2975+
2976+ more_patterns = argp_args_usage (argp, state, &levels, 1, fs);
2977+
2978+ __argp_fmtstream_set_wmargin (fs, old_wm);
2979+ __argp_fmtstream_set_lmargin (fs, old_lm);
2980+
2981+ __argp_fmtstream_putc (fs, '\n');
2982+ anything = 1;
2983+
2984+ first_pattern = 0;
2985+ }
2986+ while (more_patterns);
2987+ }
2988+
2989+ if (flags & ARGP_HELP_PRE_DOC)
2990+ anything |= argp_doc (argp, state, 0, 0, 1, fs);
2991+
2992+ if (flags & ARGP_HELP_SEE)
2993+ {
2994+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\
2995+Try `%s --help' or `%s --usage' for more information.\n"),
2996+ name, name);
2997+ anything = 1;
2998+ }
2999+
3000+ if (flags & ARGP_HELP_LONG)
3001+ /* Print a long, detailed help message. */
3002+ {
3003+ /* Print info about all the options. */
3004+ if (hol->num_entries > 0)
3005+ {
3006+ if (anything)
3007+ __argp_fmtstream_putc (fs, '\n');
3008+ hol_help (hol, state, fs);
3009+ anything = 1;
3010+ }
3011+ }
3012+
3013+ if (flags & ARGP_HELP_POST_DOC)
3014+ /* Print any documentation strings at the end. */
3015+ anything |= argp_doc (argp, state, 1, anything, 0, fs);
3016+
3017+ if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address)
3018+ {
3019+ if (anything)
3020+ __argp_fmtstream_putc (fs, '\n');
3021+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain,
3022+ "Report bugs to %s.\n"),
3023+ argp_program_bug_address);
3024+ anything = 1;
3025+ }
3026+
3027+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3028+ funlockfile (stream);
3029+#endif
3030+
3031+ if (hol)
3032+ hol_free (hol);
3033+
3034+ __argp_fmtstream_free (fs);
3035+}
3036+
3037+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
3038+ ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */
3039+void argp_help (const struct argp *argp, FILE *stream,
3040+ unsigned flags, char *name)
3041+{
3042+ _help (argp, 0, stream, flags, name);
3043+}
3044+
3045+char *
3046+__argp_short_program_name (void)
3047+{
3048+# ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
3049+/*
3050+ * uClibc provides both program_invocation_name and
3051+ * program_invocation_short_name
3052+ */
3053+ return (char *) program_invocation_short_name;
3054+# else
3055+ /* FIXME: What now? Miles suggests that it is better to use NULL,
3056+ but currently the value is passed on directly to fputs_unlocked,
3057+ so that requires more changes. */
3058+# if __GNUC__
3059+# warning No reasonable value to return
3060+# endif /* __GNUC__ */
3061+ return "";
3062+# endif
3063+}
3064+
3065+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
3066+ from the set ARGP_HELP_*. */
3067+void
3068+argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
3069+{
3070+ if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream)
3071+ {
3072+ if (state && (state->flags & ARGP_LONG_ONLY))
3073+ flags |= ARGP_HELP_LONG_ONLY;
3074+
3075+ _help (state ? state->root_argp : 0, state, stream, flags,
3076+ state ? state->name : __argp_short_program_name ());
3077+
3078+ if (!state || ! (state->flags & ARGP_NO_EXIT))
3079+ {
3080+ if (flags & ARGP_HELP_EXIT_ERR)
3081+ exit (argp_err_exit_status);
3082+ if (flags & ARGP_HELP_EXIT_OK)
3083+ exit (0);
3084+ }
3085+ }
3086+}
3087+
3088+/* If appropriate, print the printf string FMT and following args, preceded
3089+ by the program name and `:', to stderr, and followed by a `Try ... --help'
3090+ message, then exit (1). */
3091+void
3092+argp_error (const struct argp_state *state, const char *fmt, ...)
3093+{
3094+ if (!state || !(state->flags & ARGP_NO_ERRS))
3095+ {
3096+ FILE *stream = state ? state->err_stream : stderr;
3097+
3098+ if (stream)
3099+ {
3100+ va_list ap;
3101+
3102+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3103+ flockfile (stream);
3104+#endif
3105+
3106+ va_start (ap, fmt);
3107+
3108+#if defined _LIBC && defined USE_IN_LIBIO
3109+ char *buf;
3110+
3111+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
3112+ buf = NULL;
3113+
3114+ __fxprintf (stream, "%s: %s\n",
3115+ state ? state->name : __argp_short_program_name (), buf);
3116+
3117+ free (buf);
3118+#else
3119+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
3120+ stream);
3121+ putc_unlocked (':', stream);
3122+ putc_unlocked (' ', stream);
3123+
3124+ vfprintf (stream, fmt, ap);
3125+
3126+ putc_unlocked ('\n', stream);
3127+#endif
3128+
3129+ argp_state_help (state, stream, ARGP_HELP_STD_ERR);
3130+
3131+ va_end (ap);
3132+
3133+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3134+ funlockfile (stream);
3135+#endif
3136+ }
3137+ }
3138+}
3139+
3140+/* Similar to the standard gnu error-reporting function error(), but will
3141+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
3142+ to STATE->err_stream. This is useful for argument parsing code that is
3143+ shared between program startup (when exiting is desired) and runtime
3144+ option parsing (when typically an error code is returned instead). The
3145+ difference between this function and argp_error is that the latter is for
3146+ *parsing errors*, and the former is for other problems that occur during
3147+ parsing but don't reflect a (syntactic) problem with the input. */
3148+void
3149+argp_failure (const struct argp_state *state, int status, int errnum,
3150+ const char *fmt, ...)
3151+{
3152+ if (!state || !(state->flags & ARGP_NO_ERRS))
3153+ {
3154+ FILE *stream = state ? state->err_stream : stderr;
3155+
3156+ if (stream)
3157+ {
3158+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3159+ flockfile (stream);
3160+#endif
3161+
3162+#if defined _LIBC && defined USE_IN_LIBIO
3163+ __fxprintf (stream, "%s",
3164+ state ? state->name : __argp_short_program_name ());
3165+#else
3166+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
3167+ stream);
3168+#endif
3169+
3170+ if (fmt)
3171+ {
3172+ va_list ap;
3173+
3174+ va_start (ap, fmt);
3175+#if defined _LIBC && defined USE_IN_LIBIO
3176+ char *buf;
3177+
3178+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
3179+ buf = NULL;
3180+
3181+ __fxprintf (stream, ": %s", buf);
3182+
3183+ free (buf);
3184+#else
3185+ putc_unlocked (':', stream);
3186+ putc_unlocked (' ', stream);
3187+
3188+ vfprintf (stream, fmt, ap);
3189+#endif
3190+
3191+ va_end (ap);
3192+ }
3193+
3194+ if (errnum)
3195+ {
3196+#if (defined _LIBC && defined USE_IN_LIBIO) || defined HAVE_STRERROR_R
3197+ char buf[200];
3198+#endif
3199+#if defined _LIBC && defined USE_IN_LIBIO
3200+ __fxprintf (stream, ": %s",
3201+ strerror_r (errnum, buf, sizeof (buf)));
3202+#else
3203+ putc_unlocked (':', stream);
3204+ putc_unlocked (' ', stream);
3205+# ifdef HAVE_STRERROR_R
3206+ fputs (strerror_r (errnum, buf, sizeof (buf)), stream);
3207+# else
3208+ fputs (strerror (errnum), stream);
3209+# endif
3210+#endif
3211+ }
3212+
3213+#ifdef USE_IN_LIBIO
3214+ if (_IO_fwide (stream, 0) > 0)
3215+ putwc_unlocked (L'\n', stream);
3216+ else
3217+#endif
3218+ putc_unlocked ('\n', stream);
3219+
3220+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3221+ funlockfile (stream);
3222+#endif
3223+
3224+ if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
3225+ exit (status);
3226+ }
3227+ }
3228+}
3229Index: git/libuargp/argp-parse.c
3230===================================================================
3231--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3232+++ git/libuargp/argp-parse.c 2012-06-18 13:10:44.060825542 -0700
3233@@ -0,0 +1,949 @@
3234+/* Hierarchial argument parsing, layered over getopt
3235+ Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
3236+ This file is part of the GNU C Library.
3237+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
3238+
3239+ The GNU C Library is free software; you can redistribute it and/or
3240+ modify it under the terms of the GNU Lesser General Public
3241+ License as published by the Free Software Foundation; either
3242+ version 2.1 of the License, or (at your option) any later version.
3243+
3244+ The GNU C Library is distributed in the hope that it will be useful,
3245+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3246+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3247+ Lesser General Public License for more details.
3248+
3249+ You should have received a copy of the GNU Lesser General Public
3250+ License along with the GNU C Library; if not, write to the Free
3251+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3252+ 02111-1307 USA.
3253+
3254+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
3255+*/
3256+
3257+#ifdef HAVE_CONFIG_H
3258+#include <config.h>
3259+#endif
3260+
3261+/* AIX requires this to be the first thing in the file. */
3262+#ifndef __GNUC__
3263+# if HAVE_ALLOCA_H || defined _LIBC
3264+# include <alloca.h>
3265+# else
3266+# ifdef _AIX
3267+#pragma alloca
3268+# else
3269+# ifndef alloca /* predefined by HP cc +Olibcalls */
3270+char *alloca ();
3271+# endif
3272+# endif
3273+# endif
3274+#endif
3275+
3276+#include <stdlib.h>
3277+#include <string.h>
3278+#include <unistd.h>
3279+#include <limits.h>
3280+#include <getopt.h>
3281+#include <bits/getopt_int.h>
3282+
3283+#include <features.h>
3284+#ifndef _
3285+/* This is for other GNU distributions with internationalized messages.
3286+ When compiling libc, the _ macro is predefined. */
3287+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
3288+# include <libintl.h>
3289+# ifdef _LIBC
3290+# undef dgettext
3291+# define dgettext(domain, msgid) \
3292+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
3293+# endif
3294+# else
3295+# define dgettext(domain, msgid) (msgid)
3296+# define gettext(msgid) (msgid)
3297+# endif
3298+#endif
3299+#ifndef N_
3300+# define N_(msgid) (msgid)
3301+#endif
3302+
3303+#include <argp.h>
3304+
3305+/* Getopt return values. */
3306+#define KEY_END (-1) /* The end of the options. */
3307+#define KEY_ARG 1 /* A non-option argument. */
3308+#define KEY_ERR '?' /* An error parsing the options. */
3309+
3310+/* The meta-argument used to prevent any further arguments being interpreted
3311+ as options. */
3312+#define QUOTE "--"
3313+
3314+/* The number of bits we steal in a long-option value for our own use. */
3315+#define GROUP_BITS CHAR_BIT
3316+
3317+/* The number of bits available for the user value. */
3318+#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
3319+#define USER_MASK ((1 << USER_BITS) - 1)
3320+
3321+/* EZ alias for ARGP_ERR_UNKNOWN. */
3322+#define EBADKEY ARGP_ERR_UNKNOWN
3323+
3324+/* Default options. */
3325+
3326+/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
3327+ for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
3328+ you can force the program to continue by attaching a debugger and setting
3329+ it to 0 yourself. */
3330+static volatile int _argp_hang;
3331+
3332+#define OPT_PROGNAME -2
3333+#define OPT_USAGE -3
3334+#define OPT_HANG -4
3335+
3336+static const struct argp_option argp_default_options[] =
3337+{
3338+ {"help", '?', 0, 0, N_("Give this help list"), -1},
3339+ {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")},
3340+ {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
3341+ {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
3342+ N_("Hang for SECS seconds (default 3600)")},
3343+ {0, 0}
3344+};
3345+
3346+static error_t
3347+argp_default_parser (int key, char *arg, struct argp_state *state)
3348+{
3349+ switch (key)
3350+ {
3351+ case '?':
3352+ argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP);
3353+ break;
3354+ case OPT_USAGE:
3355+ argp_state_help (state, state->out_stream,
3356+ ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
3357+ break;
3358+
3359+ case OPT_PROGNAME: /* Set the program name. */
3360+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME
3361+ program_invocation_name = arg;
3362+#endif
3363+ /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
3364+ __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
3365+ to be that, so we have to be a bit careful here.] */
3366+
3367+ /* Update what we use for messages. */
3368+ state->name = strrchr (arg, '/');
3369+ if (state->name)
3370+ state->name++;
3371+ else
3372+ state->name = arg;
3373+
3374+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
3375+ program_invocation_short_name = state->name;
3376+#endif
3377+
3378+ if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS))
3379+ == ARGP_PARSE_ARGV0)
3380+ /* Update what getopt uses too. */
3381+ state->argv[0] = arg;
3382+
3383+ break;
3384+
3385+ case OPT_HANG:
3386+ _argp_hang = atoi (arg ? arg : "3600");
3387+ while (_argp_hang-- > 0)
3388+ sleep (1);
3389+ break;
3390+
3391+ default:
3392+ return EBADKEY;
3393+ }
3394+ return 0;
3395+}
3396+
3397+static const struct argp argp_default_argp =
3398+ {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"};
3399+
3400+
3401+static const struct argp_option argp_version_options[] =
3402+{
3403+ {"version", 'V', 0, 0, N_("Print program version"), -1},
3404+ {0, 0}
3405+};
3406+
3407+static error_t
3408+argp_version_parser (int key, char *arg, struct argp_state *state)
3409+{
3410+ switch (key)
3411+ {
3412+ case 'V':
3413+ if (argp_program_version_hook)
3414+ (*argp_program_version_hook) (state->out_stream, state);
3415+ else if (argp_program_version)
3416+ fprintf (state->out_stream, "%s\n", argp_program_version);
3417+ else
3418+ argp_error (state, dgettext (state->root_argp->argp_domain,
3419+ "(PROGRAM ERROR) No version known!?"));
3420+ if (! (state->flags & ARGP_NO_EXIT))
3421+ exit (0);
3422+ break;
3423+ default:
3424+ return EBADKEY;
3425+ }
3426+ return 0;
3427+}
3428+
3429+static const struct argp argp_version_argp =
3430+ {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"};
3431+
3432+/* Returns the offset into the getopt long options array LONG_OPTIONS of a
3433+ long option with called NAME, or -1 if none is found. Passing NULL as
3434+ NAME will return the number of options. */
3435+static int
3436+find_long_option (struct option *long_options, const char *name)
3437+{
3438+ struct option *l = long_options;
3439+ while (l->name != NULL)
3440+ if (name != NULL && strcmp (l->name, name) == 0)
3441+ return l - long_options;
3442+ else
3443+ l++;
3444+ if (name == NULL)
3445+ return l - long_options;
3446+ else
3447+ return -1;
3448+}
3449+
3450+
3451+/* The state of a `group' during parsing. Each group corresponds to a
3452+ particular argp structure from the tree of such descending from the top
3453+ level argp passed to argp_parse. */
3454+struct group
3455+{
3456+ /* This group's parsing function. */
3457+ argp_parser_t parser;
3458+
3459+ /* Which argp this group is from. */
3460+ const struct argp *argp;
3461+
3462+ /* Points to the point in SHORT_OPTS corresponding to the end of the short
3463+ options for this group. We use it to determine from which group a
3464+ particular short options is from. */
3465+ char *short_end;
3466+
3467+ /* The number of non-option args sucessfully handled by this parser. */
3468+ unsigned args_processed;
3469+
3470+ /* This group's parser's parent's group. */
3471+ struct group *parent;
3472+ unsigned parent_index; /* And the our position in the parent. */
3473+
3474+ /* These fields are swapped into and out of the state structure when
3475+ calling this group's parser. */
3476+ void *input, **child_inputs;
3477+ void *hook;
3478+};
3479+
3480+/* Call GROUP's parser with KEY and ARG, swapping any group-specific info
3481+ from STATE before calling, and back into state afterwards. If GROUP has
3482+ no parser, EBADKEY is returned. */
3483+static error_t
3484+group_parse (struct group *group, struct argp_state *state, int key, char *arg)
3485+{
3486+ if (group->parser)
3487+ {
3488+ error_t err;
3489+ state->hook = group->hook;
3490+ state->input = group->input;
3491+ state->child_inputs = group->child_inputs;
3492+ state->arg_num = group->args_processed;
3493+ err = (*group->parser)(key, arg, state);
3494+ group->hook = state->hook;
3495+ return err;
3496+ }
3497+ else
3498+ return EBADKEY;
3499+}
3500+
3501+struct parser
3502+{
3503+ const struct argp *argp;
3504+
3505+ /* SHORT_OPTS is the getopt short options string for the union of all the
3506+ groups of options. */
3507+ char *short_opts;
3508+ /* LONG_OPTS is the array of getop long option structures for the union of
3509+ all the groups of options. */
3510+ struct option *long_opts;
3511+ /* OPT_DATA is the getopt data used for the re-entrant getopt. */
3512+ struct _getopt_data opt_data;
3513+
3514+ /* States of the various parsing groups. */
3515+ struct group *groups;
3516+ /* The end of the GROUPS array. */
3517+ struct group *egroup;
3518+ /* An vector containing storage for the CHILD_INPUTS field in all groups. */
3519+ void **child_inputs;
3520+
3521+ /* True if we think using getopt is still useful; if false, then
3522+ remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is
3523+ cleared whenever getopt returns KEY_END, but may be set again if the user
3524+ moves the next argument pointer backwards. */
3525+ int try_getopt;
3526+
3527+ /* State block supplied to parsing routines. */
3528+ struct argp_state state;
3529+
3530+ /* Memory used by this parser. */
3531+ void *storage;
3532+};
3533+
3534+/* The next usable entries in the various parser tables being filled in by
3535+ convert_options. */
3536+struct parser_convert_state
3537+{
3538+ struct parser *parser;
3539+ char *short_end;
3540+ struct option *long_end;
3541+ void **child_inputs_end;
3542+};
3543+
3544+/* Converts all options in ARGP (which is put in GROUP) and ancestors
3545+ into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
3546+ CVT->LONG_END are the points at which new options are added. Returns the
3547+ next unused group entry. CVT holds state used during the conversion. */
3548+static struct group *
3549+convert_options (const struct argp *argp,
3550+ struct group *parent, unsigned parent_index,
3551+ struct group *group, struct parser_convert_state *cvt)
3552+{
3553+ /* REAL is the most recent non-alias value of OPT. */
3554+ const struct argp_option *real = argp->options;
3555+ const struct argp_child *children = argp->children;
3556+
3557+ if (real || argp->parser)
3558+ {
3559+ const struct argp_option *opt;
3560+
3561+ if (real)
3562+ for (opt = real; !__option_is_end (opt); opt++)
3563+ {
3564+ if (! (opt->flags & OPTION_ALIAS))
3565+ /* OPT isn't an alias, so we can use values from it. */
3566+ real = opt;
3567+
3568+ if (! (real->flags & OPTION_DOC))
3569+ /* A real option (not just documentation). */
3570+ {
3571+ if (__option_is_short (opt))
3572+ /* OPT can be used as a short option. */
3573+ {
3574+ *cvt->short_end++ = opt->key;
3575+ if (real->arg)
3576+ {
3577+ *cvt->short_end++ = ':';
3578+ if (real->flags & OPTION_ARG_OPTIONAL)
3579+ *cvt->short_end++ = ':';
3580+ }
3581+ *cvt->short_end = '\0'; /* keep 0 terminated */
3582+ }
3583+
3584+ if (opt->name
3585+ && find_long_option (cvt->parser->long_opts, opt->name) < 0)
3586+ /* OPT can be used as a long option. */
3587+ {
3588+ cvt->long_end->name = opt->name;
3589+ cvt->long_end->has_arg =
3590+ (real->arg
3591+ ? (real->flags & OPTION_ARG_OPTIONAL
3592+ ? optional_argument
3593+ : required_argument)
3594+ : no_argument);
3595+ cvt->long_end->flag = 0;
3596+ /* we add a disambiguating code to all the user's
3597+ values (which is removed before we actually call
3598+ the function to parse the value); this means that
3599+ the user loses use of the high 8 bits in all his
3600+ values (the sign of the lower bits is preserved
3601+ however)... */
3602+ cvt->long_end->val =
3603+ ((opt->key | real->key) & USER_MASK)
3604+ + (((group - cvt->parser->groups) + 1) << USER_BITS);
3605+
3606+ /* Keep the LONG_OPTS list terminated. */
3607+ (++cvt->long_end)->name = NULL;
3608+ }
3609+ }
3610+ }
3611+
3612+ group->parser = argp->parser;
3613+ group->argp = argp;
3614+ group->short_end = cvt->short_end;
3615+ group->args_processed = 0;
3616+ group->parent = parent;
3617+ group->parent_index = parent_index;
3618+ group->input = 0;
3619+ group->hook = 0;
3620+ group->child_inputs = 0;
3621+
3622+ if (children)
3623+ /* Assign GROUP's CHILD_INPUTS field some space from
3624+ CVT->child_inputs_end.*/
3625+ {
3626+ unsigned num_children = 0;
3627+ while (children[num_children].argp)
3628+ num_children++;
3629+ group->child_inputs = cvt->child_inputs_end;
3630+ cvt->child_inputs_end += num_children;
3631+ }
3632+
3633+ parent = group++;
3634+ }
3635+ else
3636+ parent = 0;
3637+
3638+ if (children)
3639+ {
3640+ unsigned index = 0;
3641+ while (children->argp)
3642+ group =
3643+ convert_options (children++->argp, parent, index++, group, cvt);
3644+ }
3645+
3646+ return group;
3647+}
3648+
3649+/* Find the merged set of getopt options, with keys appropiately prefixed. */
3650+static void
3651+parser_convert (struct parser *parser, const struct argp *argp, int flags)
3652+{
3653+ struct parser_convert_state cvt;
3654+
3655+ cvt.parser = parser;
3656+ cvt.short_end = parser->short_opts;
3657+ cvt.long_end = parser->long_opts;
3658+ cvt.child_inputs_end = parser->child_inputs;
3659+
3660+ if (flags & ARGP_IN_ORDER)
3661+ *cvt.short_end++ = '-';
3662+ else if (flags & ARGP_NO_ARGS)
3663+ *cvt.short_end++ = '+';
3664+ *cvt.short_end = '\0';
3665+
3666+ cvt.long_end->name = NULL;
3667+
3668+ parser->argp = argp;
3669+
3670+ if (argp)
3671+ parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
3672+ else
3673+ parser->egroup = parser->groups; /* No parsers at all! */
3674+}
3675+
3676+/* Lengths of various parser fields which we will allocated. */
3677+struct parser_sizes
3678+{
3679+ size_t short_len; /* Getopt short options string. */
3680+ size_t long_len; /* Getopt long options vector. */
3681+ size_t num_groups; /* Group structures we allocate. */
3682+ size_t num_child_inputs; /* Child input slots. */
3683+};
3684+
3685+/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
3686+ argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
3687+ the maximum lengths of the resulting merged getopt short options string and
3688+ long-options array, respectively. */
3689+static void
3690+calc_sizes (const struct argp *argp, struct parser_sizes *szs)
3691+{
3692+ const struct argp_child *child = argp->children;
3693+ const struct argp_option *opt = argp->options;
3694+
3695+ if (opt || argp->parser)
3696+ {
3697+ szs->num_groups++;
3698+ if (opt)
3699+ {
3700+ int num_opts = 0;
3701+ while (!__option_is_end (opt++))
3702+ num_opts++;
3703+ szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
3704+ szs->long_len += num_opts;
3705+ }
3706+ }
3707+
3708+ if (child)
3709+ while (child->argp)
3710+ {
3711+ calc_sizes ((child++)->argp, szs);
3712+ szs->num_child_inputs++;
3713+ }
3714+}
3715+
3716+
3717+extern char * __argp_short_program_name (void);
3718+/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */
3719+static error_t
3720+parser_init (struct parser *parser, const struct argp *argp,
3721+ int argc, char **argv, int flags, void *input)
3722+{
3723+ error_t err = 0;
3724+ struct group *group;
3725+ struct parser_sizes szs;
3726+ struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER;
3727+
3728+ szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1;
3729+ szs.long_len = 0;
3730+ szs.num_groups = 0;
3731+ szs.num_child_inputs = 0;
3732+
3733+ if (argp)
3734+ calc_sizes (argp, &szs);
3735+
3736+ /* Lengths of the various bits of storage used by PARSER. */
3737+#define GLEN (szs.num_groups + 1) * sizeof (struct group)
3738+#define CLEN (szs.num_child_inputs * sizeof (void *))
3739+#define LLEN ((szs.long_len + 1) * sizeof (struct option))
3740+#define SLEN (szs.short_len + 1)
3741+
3742+ parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
3743+ if (! parser->storage)
3744+ return ENOMEM;
3745+
3746+ parser->groups = parser->storage;
3747+ parser->child_inputs = parser->storage + GLEN;
3748+ parser->long_opts = parser->storage + GLEN + CLEN;
3749+ parser->short_opts = parser->storage + GLEN + CLEN + LLEN;
3750+ parser->opt_data = opt_data;
3751+
3752+ memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *));
3753+ parser_convert (parser, argp, flags);
3754+
3755+ memset (&parser->state, 0, sizeof (struct argp_state));
3756+ parser->state.root_argp = parser->argp;
3757+ parser->state.argc = argc;
3758+ parser->state.argv = argv;
3759+ parser->state.flags = flags;
3760+ parser->state.err_stream = stderr;
3761+ parser->state.out_stream = stdout;
3762+ parser->state.next = 0; /* Tell getopt to initialize. */
3763+ parser->state.pstate = parser;
3764+
3765+ parser->try_getopt = 1;
3766+
3767+ /* Call each parser for the first time, giving it a chance to propagate
3768+ values to child parsers. */
3769+ if (parser->groups < parser->egroup)
3770+ parser->groups->input = input;
3771+ for (group = parser->groups;
3772+ group < parser->egroup && (!err || err == EBADKEY);
3773+ group++)
3774+ {
3775+ if (group->parent)
3776+ /* If a child parser, get the initial input value from the parent. */
3777+ group->input = group->parent->child_inputs[group->parent_index];
3778+
3779+ if (!group->parser
3780+ && group->argp->children && group->argp->children->argp)
3781+ /* For the special case where no parsing function is supplied for an
3782+ argp, propagate its input to its first child, if any (this just
3783+ makes very simple wrapper argps more convenient). */
3784+ group->child_inputs[0] = group->input;
3785+
3786+ err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
3787+ }
3788+ if (err == EBADKEY)
3789+ err = 0; /* Some parser didn't understand. */
3790+
3791+ if (err)
3792+ return err;
3793+
3794+ if (parser->state.flags & ARGP_NO_ERRS)
3795+ {
3796+ parser->opt_data.opterr = 0;
3797+ if (parser->state.flags & ARGP_PARSE_ARGV0)
3798+ /* getopt always skips ARGV[0], so we have to fake it out. As long
3799+ as OPTERR is 0, then it shouldn't actually try to access it. */
3800+ parser->state.argv--, parser->state.argc++;
3801+ }
3802+ else
3803+ parser->opt_data.opterr = 1; /* Print error messages. */
3804+
3805+ if (parser->state.argv == argv && argv[0])
3806+ /* There's an argv[0]; use it for messages. */
3807+ {
3808+ char *short_name = strrchr (argv[0], '/');
3809+ parser->state.name = short_name ? short_name + 1 : argv[0];
3810+ }
3811+ else
3812+ parser->state.name = __argp_short_program_name ();
3813+
3814+ return 0;
3815+}
3816+
3817+/* Free any storage consumed by PARSER (but not PARSER itself). */
3818+static error_t
3819+parser_finalize (struct parser *parser,
3820+ error_t err, int arg_ebadkey, int *end_index)
3821+{
3822+ struct group *group;
3823+
3824+ if (err == EBADKEY && arg_ebadkey)
3825+ /* Suppress errors generated by unparsed arguments. */
3826+ err = 0;
3827+
3828+ if (! err)
3829+ {
3830+ if (parser->state.next == parser->state.argc)
3831+ /* We successfully parsed all arguments! Call all the parsers again,
3832+ just a few more times... */
3833+ {
3834+ for (group = parser->groups;
3835+ group < parser->egroup && (!err || err==EBADKEY);
3836+ group++)
3837+ if (group->args_processed == 0)
3838+ err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
3839+ for (group = parser->egroup - 1;
3840+ group >= parser->groups && (!err || err==EBADKEY);
3841+ group--)
3842+ err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
3843+
3844+ if (err == EBADKEY)
3845+ err = 0; /* Some parser didn't understand. */
3846+
3847+ /* Tell the user that all arguments are parsed. */
3848+ if (end_index)
3849+ *end_index = parser->state.next;
3850+ }
3851+ else if (end_index)
3852+ /* Return any remaining arguments to the user. */
3853+ *end_index = parser->state.next;
3854+ else
3855+ /* No way to return the remaining arguments, they must be bogus. */
3856+ {
3857+ if (!(parser->state.flags & ARGP_NO_ERRS)
3858+ && parser->state.err_stream)
3859+ fprintf (parser->state.err_stream,
3860+ dgettext (parser->argp->argp_domain,
3861+ "%s: Too many arguments\n"),
3862+ parser->state.name);
3863+ err = EBADKEY;
3864+ }
3865+ }
3866+
3867+ /* Okay, we're all done, with either an error or success; call the parsers
3868+ to indicate which one. */
3869+
3870+ if (err)
3871+ {
3872+ /* Maybe print an error message. */
3873+ if (err == EBADKEY)
3874+ /* An appropriate message describing what the error was should have
3875+ been printed earlier. */
3876+ argp_state_help (&parser->state, parser->state.err_stream,
3877+ ARGP_HELP_STD_ERR);
3878+
3879+ /* Since we didn't exit, give each parser an error indication. */
3880+ for (group = parser->groups; group < parser->egroup; group++)
3881+ group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
3882+ }
3883+ else
3884+ /* Notify parsers of success, and propagate back values from parsers. */
3885+ {
3886+ /* We pass over the groups in reverse order so that child groups are
3887+ given a chance to do there processing before passing back a value to
3888+ the parent. */
3889+ for (group = parser->egroup - 1
3890+ ; group >= parser->groups && (!err || err == EBADKEY)
3891+ ; group--)
3892+ err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
3893+ if (err == EBADKEY)
3894+ err = 0; /* Some parser didn't understand. */
3895+ }
3896+
3897+ /* Call parsers once more, to do any final cleanup. Errors are ignored. */
3898+ for (group = parser->egroup - 1; group >= parser->groups; group--)
3899+ group_parse (group, &parser->state, ARGP_KEY_FINI, 0);
3900+
3901+ if (err == EBADKEY)
3902+ err = EINVAL;
3903+
3904+ free (parser->storage);
3905+
3906+ return err;
3907+}
3908+
3909+/* Call the user parsers to parse the non-option argument VAL, at the current
3910+ position, returning any error. The state NEXT pointer is assumed to have
3911+ been adjusted (by getopt) to point after this argument; this function will
3912+ adjust it correctly to reflect however many args actually end up being
3913+ consumed. */
3914+static error_t
3915+parser_parse_arg (struct parser *parser, char *val)
3916+{
3917+ /* Save the starting value of NEXT, first adjusting it so that the arg
3918+ we're parsing is again the front of the arg vector. */
3919+ int index = --parser->state.next;
3920+ error_t err = EBADKEY;
3921+ struct group *group;
3922+ int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */
3923+
3924+ /* Try to parse the argument in each parser. */
3925+ for (group = parser->groups
3926+ ; group < parser->egroup && err == EBADKEY
3927+ ; group++)
3928+ {
3929+ parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */
3930+ key = ARGP_KEY_ARG;
3931+ err = group_parse (group, &parser->state, key, val);
3932+
3933+ if (err == EBADKEY)
3934+ /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */
3935+ {
3936+ parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */
3937+ key = ARGP_KEY_ARGS;
3938+ err = group_parse (group, &parser->state, key, 0);
3939+ }
3940+ }
3941+
3942+ if (! err)
3943+ {
3944+ if (key == ARGP_KEY_ARGS)
3945+ /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't
3946+ changed by the user, *all* arguments should be considered
3947+ consumed. */
3948+ parser->state.next = parser->state.argc;
3949+
3950+ if (parser->state.next > index)
3951+ /* Remember that we successfully processed a non-option
3952+ argument -- but only if the user hasn't gotten tricky and set
3953+ the clock back. */
3954+ (--group)->args_processed += (parser->state.next - index);
3955+ else
3956+ /* The user wants to reparse some args, give getopt another try. */
3957+ parser->try_getopt = 1;
3958+ }
3959+
3960+ return err;
3961+}
3962+
3963+/* Call the user parsers to parse the option OPT, with argument VAL, at the
3964+ current position, returning any error. */
3965+static error_t
3966+parser_parse_opt (struct parser *parser, int opt, char *val)
3967+{
3968+ /* The group key encoded in the high bits; 0 for short opts or
3969+ group_number + 1 for long opts. */
3970+ int group_key = opt >> USER_BITS;
3971+ error_t err = EBADKEY;
3972+
3973+ if (group_key == 0)
3974+ /* A short option. By comparing OPT's position in SHORT_OPTS to the
3975+ various starting positions in each group's SHORT_END field, we can
3976+ determine which group OPT came from. */
3977+ {
3978+ struct group *group;
3979+ char *short_index = strchr (parser->short_opts, opt);
3980+
3981+ if (short_index)
3982+ for (group = parser->groups; group < parser->egroup; group++)
3983+ if (group->short_end > short_index)
3984+ {
3985+ err = group_parse (group, &parser->state, opt,
3986+ parser->opt_data.optarg);
3987+ break;
3988+ }
3989+ }
3990+ else
3991+ /* A long option. We use shifts instead of masking for extracting
3992+ the user value in order to preserve the sign. */
3993+ err =
3994+ group_parse (&parser->groups[group_key - 1], &parser->state,
3995+ (opt << GROUP_BITS) >> GROUP_BITS,
3996+ parser->opt_data.optarg);
3997+
3998+ if (err == EBADKEY)
3999+ /* At least currently, an option not recognized is an error in the
4000+ parser, because we pre-compute which parser is supposed to deal
4001+ with each option. */
4002+ {
4003+ static const char bad_key_err[] =
4004+ N_("(PROGRAM ERROR) Option should have been recognized!?");
4005+ if (group_key == 0)
4006+ argp_error (&parser->state, "-%c: %s", opt,
4007+ dgettext (parser->argp->argp_domain, bad_key_err));
4008+ else
4009+ {
4010+ struct option *long_opt = parser->long_opts;
4011+ while (long_opt->val != opt && long_opt->name)
4012+ long_opt++;
4013+ argp_error (&parser->state, "--%s: %s",
4014+ long_opt->name ? long_opt->name : "???",
4015+ dgettext (parser->argp->argp_domain, bad_key_err));
4016+ }
4017+ }
4018+
4019+ return err;
4020+}
4021+
4022+/* Parse the next argument in PARSER (as indicated by PARSER->state.next).
4023+ Any error from the parsers is returned, and *ARGP_EBADKEY indicates
4024+ whether a value of EBADKEY is due to an unrecognized argument (which is
4025+ generally not fatal). */
4026+static error_t
4027+parser_parse_next (struct parser *parser, int *arg_ebadkey)
4028+{
4029+ int opt;
4030+ error_t err = 0;
4031+
4032+ if (parser->state.quoted && parser->state.next < parser->state.quoted)
4033+ /* The next argument pointer has been moved to before the quoted
4034+ region, so pretend we never saw the quoting `--', and give getopt
4035+ another chance. If the user hasn't removed it, getopt will just
4036+ process it again. */
4037+ parser->state.quoted = 0;
4038+
4039+ if (parser->try_getopt && !parser->state.quoted)
4040+ /* Give getopt a chance to parse this. */
4041+ {
4042+ /* Put it back in OPTIND for getopt. */
4043+ parser->opt_data.optind = parser->state.next;
4044+ /* Distinguish KEY_ERR from a real option. */
4045+ parser->opt_data.optopt = KEY_END;
4046+ if (parser->state.flags & ARGP_LONG_ONLY)
4047+ opt = _getopt_long_only_r (parser->state.argc, parser->state.argv,
4048+ parser->short_opts, parser->long_opts, 0,
4049+ &parser->opt_data);
4050+ else
4051+ opt = _getopt_long_r (parser->state.argc, parser->state.argv,
4052+ parser->short_opts, parser->long_opts, 0,
4053+ &parser->opt_data);
4054+ /* And see what getopt did. */
4055+ parser->state.next = parser->opt_data.optind;
4056+
4057+ if (opt == KEY_END)
4058+ /* Getopt says there are no more options, so stop using
4059+ getopt; we'll continue if necessary on our own. */
4060+ {
4061+ parser->try_getopt = 0;
4062+ if (parser->state.next > 1
4063+ && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
4064+ == 0)
4065+ /* Not only is this the end of the options, but it's a
4066+ `quoted' region, which may have args that *look* like
4067+ options, so we definitely shouldn't try to use getopt past
4068+ here, whatever happens. */
4069+ parser->state.quoted = parser->state.next;
4070+ }
4071+ else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END)
4072+ /* KEY_ERR can have the same value as a valid user short
4073+ option, but in the case of a real error, getopt sets OPTOPT
4074+ to the offending character, which can never be KEY_END. */
4075+ {
4076+ *arg_ebadkey = 0;
4077+ return EBADKEY;
4078+ }
4079+ }
4080+ else
4081+ opt = KEY_END;
4082+
4083+ if (opt == KEY_END)
4084+ {
4085+ /* We're past what getopt considers the options. */
4086+ if (parser->state.next >= parser->state.argc
4087+ || (parser->state.flags & ARGP_NO_ARGS))
4088+ /* Indicate that we're done. */
4089+ {
4090+ *arg_ebadkey = 1;
4091+ return EBADKEY;
4092+ }
4093+ else
4094+ /* A non-option arg; simulate what getopt might have done. */
4095+ {
4096+ opt = KEY_ARG;
4097+ parser->opt_data.optarg = parser->state.argv[parser->state.next++];
4098+ }
4099+ }
4100+
4101+ if (opt == KEY_ARG)
4102+ /* A non-option argument; try each parser in turn. */
4103+ err = parser_parse_arg (parser, parser->opt_data.optarg);
4104+ else
4105+ err = parser_parse_opt (parser, opt, parser->opt_data.optarg);
4106+
4107+ if (err == EBADKEY)
4108+ *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);
4109+
4110+ return err;
4111+}
4112+
4113+/* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
4114+ FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the
4115+ index in ARGV of the first unparsed option is returned in it. If an
4116+ unknown option is present, EINVAL is returned; if some parser routine
4117+ returned a non-zero value, it is returned; otherwise 0 is returned. */
4118+error_t
4119+argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
4120+ int *end_index, void *input)
4121+{
4122+ error_t err;
4123+ struct parser parser;
4124+
4125+ /* If true, then err == EBADKEY is a result of a non-option argument failing
4126+ to be parsed (which in some cases isn't actually an error). */
4127+ int arg_ebadkey = 0;
4128+
4129+ if (! (flags & ARGP_NO_HELP))
4130+ /* Add our own options. */
4131+ {
4132+ struct argp_child *child = alloca (4 * sizeof (struct argp_child));
4133+ struct argp *top_argp = alloca (sizeof (struct argp));
4134+
4135+ /* TOP_ARGP has no options, it just serves to group the user & default
4136+ argps. */
4137+ memset (top_argp, 0, sizeof (*top_argp));
4138+ top_argp->children = child;
4139+
4140+ memset (child, 0, 4 * sizeof (struct argp_child));
4141+
4142+ if (argp)
4143+ (child++)->argp = argp;
4144+ (child++)->argp = &argp_default_argp;
4145+ if (argp_program_version || argp_program_version_hook)
4146+ (child++)->argp = &argp_version_argp;
4147+ child->argp = 0;
4148+
4149+ argp = top_argp;
4150+ }
4151+
4152+ /* Construct a parser for these arguments. */
4153+ err = parser_init (&parser, argp, argc, argv, flags, input);
4154+
4155+ if (! err)
4156+ /* Parse! */
4157+ {
4158+ while (! err)
4159+ err = parser_parse_next (&parser, &arg_ebadkey);
4160+ err = parser_finalize (&parser, err, arg_ebadkey, end_index);
4161+ }
4162+
4163+ return err;
4164+}
4165+
4166+/* Return the input field for ARGP in the parser corresponding to STATE; used
4167+ by the help routines. */
4168+void *
4169+__argp_input (const struct argp *argp, const struct argp_state *state)
4170+{
4171+ if (state)
4172+ {
4173+ struct group *group;
4174+ struct parser *parser = state->pstate;
4175+
4176+ for (group = parser->groups; group < parser->egroup; group++)
4177+ if (group->argp == argp)
4178+ return group->input;
4179+ }
4180+
4181+ return 0;
4182+}
4183Index: git/libuargp/argp-pv.c
4184===================================================================
4185--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4186+++ git/libuargp/argp-pv.c 2012-06-18 13:10:44.060825542 -0700
4187@@ -0,0 +1,25 @@
4188+/* Default definition for ARGP_PROGRAM_VERSION.
4189+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4190+ This file is part of the GNU C Library.
4191+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4192+
4193+ The GNU C Library is free software; you can redistribute it and/or
4194+ modify it under the terms of the GNU Lesser General Public
4195+ License as published by the Free Software Foundation; either
4196+ version 2.1 of the License, or (at your option) any later version.
4197+
4198+ The GNU C Library is distributed in the hope that it will be useful,
4199+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4200+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4201+ Lesser General Public License for more details.
4202+
4203+ You should have received a copy of the GNU Lesser General Public
4204+ License along with the GNU C Library; if not, write to the Free
4205+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4206+ 02111-1307 USA. */
4207+
4208+/* If set by the user program to a non-zero value, then a default option
4209+ --version is added (unless the ARGP_NO_HELP flag is used), which will
4210+ print this this string followed by a newline and exit (unless the
4211+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
4212+const char *argp_program_version;
4213Index: git/libuargp/argp-pvh.c
4214===================================================================
4215--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4216+++ git/libuargp/argp-pvh.c 2012-06-18 13:10:44.060825542 -0700
4217@@ -0,0 +1,32 @@
4218+/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
4219+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4220+ This file is part of the GNU C Library.
4221+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4222+
4223+ The GNU C Library is free software; you can redistribute it and/or
4224+ modify it under the terms of the GNU Lesser General Public
4225+ License as published by the Free Software Foundation; either
4226+ version 2.1 of the License, or (at your option) any later version.
4227+
4228+ The GNU C Library is distributed in the hope that it will be useful,
4229+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4230+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4231+ Lesser General Public License for more details.
4232+
4233+ You should have received a copy of the GNU Lesser General Public
4234+ License along with the GNU C Library; if not, write to the Free
4235+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4236+ 02111-1307 USA. */
4237+
4238+#ifdef HAVE_CONFIG_H
4239+#include <config.h>
4240+#endif
4241+
4242+#include <argp.h>
4243+
4244+/* If set by the user program to a non-zero value, then a default option
4245+ --version is added (unless the ARGP_NO_HELP flag is used), which calls
4246+ this function with a stream to print the version to and a pointer to the
4247+ current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
4248+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
4249+void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
4250Index: git/libuargp/argp-xinl.c
4251===================================================================
4252--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4253+++ git/libuargp/argp-xinl.c 2012-06-18 13:10:44.060825542 -0700
4254@@ -0,0 +1,35 @@
4255+/* Real definitions for extern inline functions in argp.h
4256+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
4257+ This file is part of the GNU C Library.
4258+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4259+
4260+ The GNU C Library is free software; you can redistribute it and/or
4261+ modify it under the terms of the GNU Lesser General Public
4262+ License as published by the Free Software Foundation; either
4263+ version 2.1 of the License, or (at your option) any later version.
4264+
4265+ The GNU C Library is distributed in the hope that it will be useful,
4266+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4267+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4268+ Lesser General Public License for more details.
4269+
4270+ You should have received a copy of the GNU Lesser General Public
4271+ License along with the GNU C Library; if not, write to the Free
4272+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4273+ 02111-1307 USA. */
4274+
4275+#ifdef HAVE_CONFIG_H
4276+# include <config.h>
4277+#endif
4278+
4279+#if defined _LIBC || defined HAVE_FEATURES_H
4280+# include <features.h>
4281+#endif
4282+
4283+#ifndef __USE_EXTERN_INLINES
4284+# define __USE_EXTERN_INLINES 1
4285+#endif
4286+#define ARGP_EI
4287+#undef __OPTIMIZE__
4288+#define __OPTIMIZE__ 1
4289+#include <argp.h>
4290Index: git/test/argp/Makefile
4291===================================================================
4292--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4293+++ git/test/argp/Makefile 2012-06-18 13:10:44.060825542 -0700
4294@@ -0,0 +1,7 @@
4295+# uClibc argp tests
4296+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4297+
4298+top_builddir=../../
4299+include ../Rules.mak
4300+-include Makefile.in
4301+include ../Test.mak
4302Index: git/test/argp/Makefile.in
4303===================================================================
4304--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4305+++ git/test/argp/Makefile.in 2012-06-18 13:10:44.060825542 -0700
4306@@ -0,0 +1,12 @@
4307+# uClibc argp tests
4308+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4309+
4310+TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \
4311+ bug-argp1 tst-argp1 tst-argp2
4312+
4313+EXTRA_LDFLAGS = -luargp
4314+
4315+OPTS_argp-ex3 = ARG1 ARG2
4316+OPTS_argp-ex4 = ARG1 string1 string2 string3
4317+OPTS_bug-argp1 = -- --help
4318+
4319Index: git/test/argp/argp-ex1.c
4320===================================================================
4321--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4322+++ git/test/argp/argp-ex1.c 2012-06-18 13:10:44.060825542 -0700
4323@@ -0,0 +1,15 @@
4324+/* Argp example #1 -- a minimal program using argp */
4325+
4326+/* This is (probably) the smallest possible program that
4327+ uses argp. It won't do much except give an error
4328+ messages and exit when there are any arguments, and print
4329+ a (rather pointless) messages for --help. */
4330+
4331+#include <stdlib.h>
4332+#include <argp.h>
4333+
4334+int main (int argc, char **argv)
4335+{
4336+ argp_parse (0, argc, argv, 0, 0, 0);
4337+ exit (0);
4338+}
4339Index: git/test/argp/argp-ex2.c
4340===================================================================
4341--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4342+++ git/test/argp/argp-ex2.c 2012-06-18 13:10:44.060825542 -0700
4343@@ -0,0 +1,45 @@
4344+/* Argp example #2 -- a pretty minimal program using argp */
4345+
4346+/* This program doesn't use any options or arguments, but uses
4347+ argp to be compliant with the GNU standard command line
4348+ format.
4349+
4350+ In addition to making sure no arguments are given, and
4351+ implementing a --help option, this example will have a
4352+ --version option, and will put the given documentation string
4353+ and bug address in the --help output, as per GNU standards.
4354+
4355+ The variable ARGP contains the argument parser specification;
4356+ adding fields to this structure is the way most parameters are
4357+ passed to argp_parse (the first three fields are usually used,
4358+ but not in this small program). There are also two global
4359+ variables that argp knows about defined here,
4360+ ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are
4361+ global variables because they will almost always be constant
4362+ for a given program, even if it uses different argument
4363+ parsers for various tasks). */
4364+
4365+#include <stdlib.h>
4366+#include <argp.h>
4367+
4368+const char *argp_program_version =
4369+ "argp-ex2 1.0";
4370+const char *argp_program_bug_address =
4371+ "<bug-gnu-utils@@gnu.org>";
4372+
4373+/* Program documentation. */
4374+static char doc[] =
4375+ "Argp example #2 -- a pretty minimal program using argp";
4376+
4377+/* Our argument parser. The @code{options}, @code{parser}, and
4378+ @code{args_doc} fields are zero because we have neither options or
4379+ arguments; @code{doc} and @code{argp_program_bug_address} will be
4380+ used in the output for @samp{--help}, and the @samp{--version}
4381+ option will print out @code{argp_program_version}. */
4382+static struct argp argp = { 0, 0, 0, doc };
4383+
4384+int main (int argc, char **argv)
4385+{
4386+ argp_parse (&argp, argc, argv, 0, 0, 0);
4387+ exit (0);
4388+}
4389Index: git/test/argp/argp-ex3.c
4390===================================================================
4391--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4392+++ git/test/argp/argp-ex3.c 2012-06-18 13:10:44.060825542 -0700
4393@@ -0,0 +1,153 @@
4394+/* Argp example #3 -- a program with options and arguments using argp */
4395+
4396+/* This program uses the same features as example 2, and uses options and
4397+ arguments.
4398+
4399+ We now use the first four fields in ARGP, so here's a description of them:
4400+ OPTIONS -- A pointer to a vector of struct argp_option (see below)
4401+ PARSER -- A function to parse a single option, called by argp
4402+ ARGS_DOC -- A string describing how the non-option arguments should look
4403+ DOC -- A descriptive string about this program; if it contains a
4404+ vertical tab character (\v), the part after it will be
4405+ printed *following* the options
4406+
4407+ The function PARSER takes the following arguments:
4408+ KEY -- An integer specifying which option this is (taken
4409+ from the KEY field in each struct argp_option), or
4410+ a special key specifying something else; the only
4411+ special keys we use here are ARGP_KEY_ARG, meaning
4412+ a non-option argument, and ARGP_KEY_END, meaning
4413+ that all arguments have been parsed
4414+ ARG -- For an option KEY, the string value of its
4415+ argument, or NULL if it has none
4416+ STATE-- A pointer to a struct argp_state, containing
4417+ various useful information about the parsing state; used here
4418+ are the INPUT field, which reflects the INPUT argument to
4419+ argp_parse, and the ARG_NUM field, which is the number of the
4420+ current non-option argument being parsed
4421+ It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the
4422+ given KEY wasn't recognized, or an errno value indicating some other
4423+ error.
4424+
4425+ Note that in this example, main uses a structure to communicate with the
4426+ parse_opt function, a pointer to which it passes in the INPUT argument to
4427+ argp_parse. Of course, it's also possible to use global variables
4428+ instead, but this is somewhat more flexible.
4429+
4430+ The OPTIONS field contains a pointer to a vector of struct argp_option's;
4431+ that structure has the following fields (if you assign your option
4432+ structures using array initialization like this example, unspecified
4433+ fields will be defaulted to 0, and need not be specified):
4434+ NAME -- The name of this option's long option (may be zero)
4435+ KEY -- The KEY to pass to the PARSER function when parsing this option,
4436+ *and* the name of this option's short option, if it is a
4437+ printable ascii character
4438+ ARG -- The name of this option's argument, if any
4439+ FLAGS -- Flags describing this option; some of them are:
4440+ OPTION_ARG_OPTIONAL -- The argument to this option is optional
4441+ OPTION_ALIAS -- This option is an alias for the
4442+ previous option
4443+ OPTION_HIDDEN -- Don't show this option in --help output
4444+ DOC -- A documentation string for this option, shown in --help output
4445+
4446+ An options vector should be terminated by an option with all fields zero. */
4447+
4448+#include <stdlib.h>
4449+#include <argp.h>
4450+
4451+const char *argp_program_version =
4452+ "argp-ex3 1.0";
4453+const char *argp_program_bug_address =
4454+ "<bug-gnu-utils@@gnu.org>";
4455+
4456+/* Program documentation. */
4457+static char doc[] =
4458+ "Argp example #3 -- a program with options and arguments using argp";
4459+
4460+/* A description of the arguments we accept. */
4461+static char args_doc[] = "ARG1 ARG2";
4462+
4463+/* The options we understand. */
4464+static struct argp_option options[] = {
4465+ {"verbose", 'v', 0, 0, "Produce verbose output" },
4466+ {"quiet", 'q', 0, 0, "Don't produce any output" },
4467+ {"silent", 's', 0, OPTION_ALIAS },
4468+ {"output", 'o', "FILE", 0,
4469+ "Output to FILE instead of standard output" },
4470+ { 0 }
4471+};
4472+
4473+/* Used by @code{main} to communicate with @code{parse_opt}. */
4474+struct arguments
4475+{
4476+ char *args[2]; /* @var{arg1} & @var{arg2} */
4477+ int silent, verbose;
4478+ char *output_file;
4479+};
4480+
4481+/* Parse a single option. */
4482+static error_t
4483+parse_opt (int key, char *arg, struct argp_state *state)
4484+{
4485+ /* Get the @var{input} argument from @code{argp_parse}, which we
4486+ know is a pointer to our arguments structure. */
4487+ struct arguments *arguments = state->input;
4488+
4489+ switch (key)
4490+ {
4491+ case 'q': case 's':
4492+ arguments->silent = 1;
4493+ break;
4494+ case 'v':
4495+ arguments->verbose = 1;
4496+ break;
4497+ case 'o':
4498+ arguments->output_file = arg;
4499+ break;
4500+
4501+ case ARGP_KEY_ARG:
4502+ if (state->arg_num >= 2)
4503+ /* Too many arguments. */
4504+ argp_usage (state);
4505+
4506+ arguments->args[state->arg_num] = arg;
4507+
4508+ break;
4509+
4510+ case ARGP_KEY_END:
4511+ if (state->arg_num < 2)
4512+ /* Not enough arguments. */
4513+ argp_usage (state);
4514+ break;
4515+
4516+ default:
4517+ return ARGP_ERR_UNKNOWN;
4518+ }
4519+ return 0;
4520+}
4521+
4522+/* Our argp parser. */
4523+static struct argp argp = { options, parse_opt, args_doc, doc };
4524+
4525+int main (int argc, char **argv)
4526+{
4527+ struct arguments arguments;
4528+
4529+ /* Default values. */
4530+ arguments.silent = 0;
4531+ arguments.verbose = 0;
4532+ arguments.output_file = "-";
4533+
4534+ /* Parse our arguments; every option seen by @code{parse_opt} will
4535+ be reflected in @code{arguments}. */
4536+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
4537+
4538+ printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n"
4539+ "VERBOSE = %s\nSILENT = %s\n",
4540+ arguments.args[0], arguments.args[1],
4541+ arguments.output_file,
4542+ arguments.verbose ? "yes" : "no",
4543+ arguments.silent ? "yes" : "no");
4544+
4545+ exit (0);
4546+}
4547Index: git/test/argp/argp-ex4.c
4548===================================================================
4549--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4550+++ git/test/argp/argp-ex4.c 2012-06-18 13:10:44.060825542 -0700
4551@@ -0,0 +1,167 @@
4552+/* Argp example #4 -- a program with somewhat more complicated options */
4553+
4554+/* This program uses the same features as example 3, but has more
4555+ options, and somewhat more structure in the -help output. It
4556+ also shows how you can `steal' the remainder of the input
4557+ arguments past a certain point, for programs that accept a
4558+ list of items. It also shows the special argp KEY value
4559+ ARGP_KEY_NO_ARGS, which is only given if no non-option
4560+ arguments were supplied to the program.
4561+
4562+ For structuring the help output, two features are used,
4563+ *headers* which are entries in the options vector with the
4564+ first four fields being zero, and a two part documentation
4565+ string (in the variable DOC), which allows documentation both
4566+ before and after the options; the two parts of DOC are
4567+ separated by a vertical-tab character ('\v', or '\013'). By
4568+ convention, the documentation before the options is just a
4569+ short string saying what the program does, and that afterwards
4570+ is longer, describing the behavior in more detail. All
4571+ documentation strings are automatically filled for output,
4572+ although newlines may be included to force a line break at a
4573+ particular point. All documentation strings are also passed to
4574+ the `gettext' function, for possible translation into the
4575+ current locale. */
4576+
4577+#include <stdlib.h>
4578+#include <error.h>
4579+#include <argp.h>
4580+
4581+const char *argp_program_version =
4582+ "argp-ex4 1.0";
4583+const char *argp_program_bug_address =
4584+ "<bug-gnu-utils@@prep.ai.mit.edu>";
4585+
4586+/* Program documentation. */
4587+static char doc[] =
4588+ "Argp example #4 -- a program with somewhat more complicated\
4589+options\
4590+\vThis part of the documentation comes *after* the options;\
4591+ note that the text is automatically filled, but it's possible\
4592+ to force a line-break, e.g.\n<-- here.";
4593+
4594+/* A description of the arguments we accept. */
4595+static char args_doc[] = "ARG1 [STRING...]";
4596+
4597+/* Keys for options without short-options. */
4598+#define OPT_ABORT 1 /* --abort */
4599+
4600+/* The options we understand. */
4601+static struct argp_option options[] = {
4602+ {"verbose", 'v', 0, 0, "Produce verbose output" },
4603+ {"quiet", 'q', 0, 0, "Don't produce any output" },
4604+ {"silent", 's', 0, OPTION_ALIAS },
4605+ {"output", 'o', "FILE", 0,
4606+ "Output to FILE instead of standard output" },
4607+
4608+ {0,0,0,0, "The following options should be grouped together:" },
4609+ {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL,
4610+ "Repeat the output COUNT (default 10) times"},
4611+ {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"},
4612+
4613+ { 0 }
4614+};
4615+
4616+/* Used by @code{main} to communicate with @code{parse_opt}. */
4617+struct arguments
4618+{
4619+ char *arg1; /* @var{arg1} */
4620+ char **strings; /* [@var{string}@dots{}] */
4621+ int silent, verbose, abort; /* @samp{-s}, @samp{-v}, @samp{--abort} */
4622+ char *output_file; /* @var{file} arg to @samp{--output} */
4623+ int repeat_count; /* @var{count} arg to @samp{--repeat} */
4624+};
4625+
4626+/* Parse a single option. */
4627+static error_t
4628+parse_opt (int key, char *arg, struct argp_state *state)
4629+{
4630+ /* Get the @code{input} argument from @code{argp_parse}, which we
4631+ know is a pointer to our arguments structure. */
4632+ struct arguments *arguments = state->input;
4633+
4634+ switch (key)
4635+ {
4636+ case 'q': case 's':
4637+ arguments->silent = 1;
4638+ break;
4639+ case 'v':
4640+ arguments->verbose = 1;
4641+ break;
4642+ case 'o':
4643+ arguments->output_file = arg;
4644+ break;
4645+ case 'r':
4646+ arguments->repeat_count = arg ? atoi (arg) : 10;
4647+ break;
4648+ case OPT_ABORT:
4649+ arguments->abort = 1;
4650+ break;
4651+
4652+ case ARGP_KEY_NO_ARGS:
4653+ argp_usage (state);
4654+
4655+ case ARGP_KEY_ARG:
4656+ /* Here we know that @code{state->arg_num == 0}, since we
4657+ force argument parsing to end before any more arguments can
4658+ get here. */
4659+ arguments->arg1 = arg;
4660+
4661+ /* Now we consume all the rest of the arguments.
4662+ @code{state->next} is the index in @code{state->argv} of the
4663+ next argument to be parsed, which is the first @var{string}
4664+ we're interested in, so we can just use
4665+ @code{&state->argv[state->next]} as the value for
4666+ arguments->strings.
4667+
4668+ @emph{In addition}, by setting @code{state->next} to the end
4669+ of the arguments, we can force argp to stop parsing here and
4670+ return. */
4671+ arguments->strings = &state->argv[state->next];
4672+ state->next = state->argc;
4673+
4674+ break;
4675+
4676+ default:
4677+ return ARGP_ERR_UNKNOWN;
4678+ }
4679+ return 0;
4680+}
4681+
4682+/* Our argp parser. */
4683+static struct argp argp = { options, parse_opt, args_doc, doc };
4684+
4685+int main (int argc, char **argv)
4686+{
4687+ int i, j;
4688+ struct arguments arguments;
4689+
4690+ /* Default values. */
4691+ arguments.silent = 0;
4692+ arguments.verbose = 0;
4693+ arguments.output_file = "-";
4694+ arguments.repeat_count = 1;
4695+ arguments.abort = 0;
4696+
4697+ /* Parse our arguments; every option seen by @code{parse_opt} will be
4698+ reflected in @code{arguments}. */
4699+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
4700+
4701+ if (arguments.abort)
4702+ error (10, 0, "ABORTED");
4703+
4704+ for (i = 0; i < arguments.repeat_count; i++)
4705+ {
4706+ printf ("ARG1 = %s\n", arguments.arg1);
4707+ printf ("STRINGS = ");
4708+ for (j = 0; arguments.strings[j]; j++)
4709+ printf (j == 0 ? "%s" : ", %s", arguments.strings[j]);
4710+ printf ("\n");
4711+ printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n",
4712+ arguments.output_file,
4713+ arguments.verbose ? "yes" : "no",
4714+ arguments.silent ? "yes" : "no");
4715+ }
4716+
4717+ exit (0);
4718+}
4719Index: git/test/argp/argp-test.c
4720===================================================================
4721--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4722+++ git/test/argp/argp-test.c 2012-06-18 13:10:44.060825542 -0700
4723@@ -0,0 +1,209 @@
4724+/* Test program for argp argument parser
4725+ Copyright (C) 1997 Free Software Foundation, Inc.
4726+ This file is part of the GNU C Library.
4727+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4728+
4729+ The GNU C Library is free software; you can redistribute it and/or
4730+ modify it under the terms of the GNU Lesser General Public
4731+ License as published by the Free Software Foundation; either
4732+ version 2.1 of the License, or (at your option) any later version.
4733+
4734+ The GNU C Library is distributed in the hope that it will be useful,
4735+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4736+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4737+ Lesser General Public License for more details.
4738+
4739+ You should have received a copy of the GNU Lesser General Public
4740+ License along with the GNU C Library; if not, write to the Free
4741+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4742+ 02111-1307 USA. */
4743+
4744+#ifdef HAVE_CONFIG_H
4745+#include <config.h>
4746+#endif
4747+
4748+#include <stdlib.h>
4749+#include <time.h>
4750+#include <string.h>
4751+#include <argp.h>
4752+
4753+const char *argp_program_version = "argp-test 1.0";
4754+
4755+struct argp_option sub_options[] =
4756+{
4757+ {"subopt1", 's', 0, 0, "Nested option 1"},
4758+ {"subopt2", 'S', 0, 0, "Nested option 2"},
4759+
4760+ { 0, 0, 0, 0, "Some more nested options:", 10},
4761+ {"subopt3", 'p', 0, 0, "Nested option 3"},
4762+
4763+ {"subopt4", 'q', 0, 0, "Nested option 4", 1},
4764+
4765+ {0}
4766+};
4767+
4768+static const char sub_args_doc[] = "STRING...\n-";
4769+static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
4770+
4771+static error_t
4772+sub_parse_opt (int key, char *arg, struct argp_state *state)
4773+{
4774+ switch (key)
4775+ {
4776+ case ARGP_KEY_NO_ARGS:
4777+ printf ("NO SUB ARGS\n");
4778+ break;
4779+ case ARGP_KEY_ARG:
4780+ printf ("SUB ARG: %s\n", arg);
4781+ break;
4782+
4783+ case 's' : case 'S': case 'p': case 'q':
4784+ printf ("SUB KEY %c\n", key);
4785+ break;
4786+
4787+ default:
4788+ return ARGP_ERR_UNKNOWN;
4789+ }
4790+ return 0;
4791+}
4792+
4793+static char *
4794+sub_help_filter (int key, const char *text, void *input)
4795+{
4796+ if (key == ARGP_KEY_HELP_EXTRA)
4797+ return strdup ("This is some extra text from the sub parser (note that it \
4798+is preceded by a blank line).");
4799+ else
4800+ return (char *)text;
4801+}
4802+
4803+static struct argp sub_argp = {
4804+ sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter
4805+};
4806+
4807+/* Structure used to communicate with the parsing functions. */
4808+struct params
4809+{
4810+ unsigned foonly; /* Value parsed for foonly. */
4811+ unsigned foonly_default; /* Default value for it. */
4812+};
4813+
4814+#define OPT_PGRP 1
4815+#define OPT_SESS 2
4816+
4817+struct argp_option options[] =
4818+{
4819+ {"pid", 'p', "PID", 0, "List the process PID"},
4820+ {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"},
4821+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
4822+ {0, 'x', 0, OPTION_ALIAS},
4823+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
4824+ " if there's some reason ps can't"
4825+ " print a field for any process, it's"
4826+ " removed from the output entirely)" },
4827+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
4828+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
4829+ {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL,
4830+ "Add the processes from the session"
4831+ " SID (which defaults to the sid of"
4832+ " the current process)" },
4833+
4834+ {0,0,0,0, "Here are some more options:"},
4835+ {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"},
4836+ {"zaza", 'z', 0, 0, "Snit a zar"},
4837+
4838+ {0}
4839+};
4840+
4841+static const char args_doc[] = "STRING";
4842+static const char doc[] = "Test program for argp."
4843+ "\vThis doc string comes after the options."
4844+ "\nHey! Some manual formatting!"
4845+ "\nThe current time is: %s";
4846+
4847+static void
4848+popt (int key, char *arg)
4849+{
4850+ char buf[10];
4851+ if (isprint (key))
4852+ sprintf (buf, "%c", key);
4853+ else
4854+ sprintf (buf, "%d", key);
4855+ if (arg)
4856+ printf ("KEY %s: %s\n", buf, arg);
4857+ else
4858+ printf ("KEY %s\n", buf);
4859+}
4860+
4861+static error_t
4862+parse_opt (int key, char *arg, struct argp_state *state)
4863+{
4864+ struct params *params = state->input;
4865+
4866+ switch (key)
4867+ {
4868+ case ARGP_KEY_NO_ARGS:
4869+ printf ("NO ARGS\n");
4870+ break;
4871+
4872+ case ARGP_KEY_ARG:
4873+ if (state->arg_num > 0)
4874+ return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */
4875+ printf ("ARG: %s\n", arg);
4876+ break;
4877+
4878+ case 'f':
4879+ if (arg)
4880+ params->foonly = atoi (arg);
4881+ else
4882+ params->foonly = params->foonly_default;
4883+ popt (key, arg);
4884+ break;
4885+
4886+ case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q':
4887+ case 'r': case OPT_SESS: case 'z':
4888+ popt (key, arg);
4889+ break;
4890+
4891+ default:
4892+ return ARGP_ERR_UNKNOWN;
4893+ }
4894+ return 0;
4895+}
4896+
4897+static char *
4898+help_filter (int key, const char *text, void *input)
4899+{
4900+ char *new_text;
4901+ struct params *params = input;
4902+
4903+ if (key == ARGP_KEY_HELP_POST_DOC && text)
4904+ {
4905+ time_t now = time (0);
4906+ asprintf (&new_text, text, ctime (&now));
4907+ }
4908+ else if (key == 'f')
4909+ /* Show the default for the --foonly option. */
4910+ asprintf (&new_text, "%s (ZOT defaults to %x)",
4911+ text, params->foonly_default);
4912+ else
4913+ new_text = (char *)text;
4914+
4915+ return new_text;
4916+}
4917+
4918+static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
4919+static struct argp argp = {
4920+ options, parse_opt, args_doc, doc, argp_children, help_filter
4921+};
4922+
4923+int
4924+main (int argc, char **argv)
4925+{
4926+ struct params params;
4927+ params.foonly = 0;
4928+ params.foonly_default = random ();
4929+ argp_parse (&argp, argc, argv, 0, 0, &params);
4930+ printf ("After parsing: foonly = %x\n", params.foonly);
4931+ return 0;
4932+}
4933Index: git/test/argp/bug-argp1.c
4934===================================================================
4935--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4936+++ git/test/argp/bug-argp1.c 2012-06-18 13:10:44.060825542 -0700
4937@@ -0,0 +1,26 @@
4938+#include <argp.h>
4939+
4940+
4941+static const struct argp_option test_options[] =
4942+{
4943+ { NULL, 'a', NULL, OPTION_DOC, NULL },
4944+ { NULL, 'b', NULL, OPTION_DOC, NULL },
4945+ { NULL, 0, NULL, 0, NULL }
4946+};
4947+
4948+static struct argp test_argp =
4949+{
4950+ test_options
4951+};
4952+
4953+
4954+static int
4955+do_test (int argc, char *argv[])
4956+{
4957+ int i;
4958+ argp_parse (&test_argp, argc, argv, 0, &i, NULL);
4959+ return 0;
4960+}
4961+
4962+#define TEST_FUNCTION do_test (argc, argv)
4963+#include "../test-skeleton.c"
4964Index: git/test/argp/tst-argp1.c
4965===================================================================
4966--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4967+++ git/test/argp/tst-argp1.c 2012-06-18 13:10:44.060825542 -0700
4968@@ -0,0 +1,118 @@
4969+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4970+ This file is part of the GNU C Library.
4971+ Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
4972+
4973+ The GNU C Library is free software; you can redistribute it and/or
4974+ modify it under the terms of the GNU Lesser General Public
4975+ License as published by the Free Software Foundation; either
4976+ version 2.1 of the License, or (at your option) any later version.
4977+
4978+ The GNU C Library is distributed in the hope that it will be useful,
4979+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4980+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4981+ Lesser General Public License for more details.
4982+
4983+ You should have received a copy of the GNU Lesser General Public
4984+ License along with the GNU C Library; if not, write to the Free
4985+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4986+ 02111-1307 USA. */
4987+
4988+#include <argp.h>
4989+
4990+
4991+
4992+
4993+#define OPT_TO_THREAD 300
4994+#define OPT_TO_PROCESS 301
4995+#define OPT_SYNC_SIGNAL 302
4996+#define OPT_SYNC_JOIN 303
4997+#define OPT_TOPLEVEL 304
4998+
4999+
5000+static const struct argp_option test_options[] =
5001+ {
5002+ { NULL, 0, NULL, 0, "\
5003+This is a test for threads so we allow ther user to selection the number of \
5004+threads which are used at any one time. Independently the total number of \
5005+rounds can be selected. This is the total number of threads which will have \
5006+run when the process terminates:" },
5007+ { "threads", 't', "NUMBER", 0, "Number of threads used at once" },
5008+ { "starts", 's', "NUMBER", 0, "Total number of working threads" },
5009+ { "toplevel", OPT_TOPLEVEL, "NUMBER", 0,
5010+ "Number of toplevel threads which start the other threads; this \
5011+implies --sync-join" },
5012+
5013+ { NULL, 0, NULL, 0, "\
5014+Each thread can do one of two things: sleep or do work. The latter is 100% \
5015+CPU bound. The work load is the probability a thread does work. All values \
5016+from zero to 100 (inclusive) are valid. How often each thread repeats this \
5017+can be determined by the number of rounds. The work cost determines how long \
5018+each work session (not sleeping) takes. If it is zero a thread would \
5019+effectively nothing. By setting the number of rounds to zero the thread \
5020+does no work at all and pure thread creation times can be measured." },
5021+ { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" },
5022+ { "workcost", 'c', "NUMBER", 0,
5023+ "Factor in the cost of each round of working" },
5024+ { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" },
5025+
5026+ { NULL, 0, NULL, 0, "\
5027+There are a number of different methods how thread creation can be \
5028+synchronized. Synchronization is necessary since the number of concurrently \
5029+running threads is limited." },
5030+ { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0,
5031+ "Synchronize using a signal (default)" },
5032+ { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" },
5033+
5034+ { NULL, 0, NULL, 0, "\
5035+One parameter for each threads execution is the size of the stack. If this \
5036+parameter is not used the system's default stack size is used. If many \
5037+threads are used the stack size should be chosen quite small." },
5038+ { "stacksize", 'S', "BYTES", 0, "Size of threads stack" },
5039+ { "guardsize", 'g', "BYTES", 0,
5040+ "Size of stack guard area; must fit into the stack" },
5041+
5042+ { NULL, 0, NULL, 0, "Signal options:" },
5043+ { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" },
5044+ { "to-process", OPT_TO_PROCESS, NULL, 0,
5045+ "Send signal to process (default)" },
5046+
5047+ { NULL, 0, NULL, 0, "Administrative options:" },
5048+ { "progress", 'p', NULL, 0, "Show signs of progress" },
5049+ { "timing", 'T', NULL, 0,
5050+ "Measure time from startup to the last thread finishing" },
5051+ { NULL, 0, NULL, 0, NULL }
5052+ };
5053+
5054+/* Prototype for option handler. */
5055+static error_t parse_opt (int key, char *arg, struct argp_state *state);
5056+
5057+/* Data structure to communicate with argp functions. */
5058+static struct argp argp =
5059+{
5060+ test_options, parse_opt
5061+};
5062+
5063+
5064+static int
5065+do_test (void)
5066+{
5067+ int argc = 2;
5068+ char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL };
5069+ int remaining;
5070+
5071+ /* Parse and process arguments. */
5072+ argp_parse (&argp, argc, argv, 0, &remaining, NULL);
5073+
5074+ return 0;
5075+}
5076+
5077+
5078+/* Handle program arguments. */
5079+static error_t
5080+parse_opt (int key, char *arg, struct argp_state *state)
5081+{
5082+ return ARGP_ERR_UNKNOWN;
5083+}
5084+
5085+#define TEST_FUNCTION do_test ()
5086+#include "../test-skeleton.c"
5087Index: git/test/argp/tst-argp2.c
5088===================================================================
5089--- /dev/null 1970-01-01 00:00:00.000000000 +0000
5090+++ git/test/argp/tst-argp2.c 2012-06-18 13:10:44.064825538 -0700
5091@@ -0,0 +1,101 @@
5092+/* Copyright (C) 2007 Free Software Foundation, Inc.
5093+ This file is part of the GNU C Library.
5094+ Contributed by Jakub Jelinek <jakub at redhat.com>, 2007.
5095+
5096+ The GNU C Library is free software; you can redistribute it and/or
5097+ modify it under the terms of the GNU Lesser General Public
5098+ License as published by the Free Software Foundation; either
5099+ version 2.1 of the License, or (at your option) any later version.
5100+
5101+ The GNU C Library is distributed in the hope that it will be useful,
5102+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5103+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5104+ Lesser General Public License for more details.
5105+
5106+ You should have received a copy of the GNU Lesser General Public
5107+ License along with the GNU C Library; if not, write to the Free
5108+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5109+ 02111-1307 USA. */
5110+
5111+#include <argp.h>
5112+
5113+static const struct argp_option opt1[] =
5114+ {
5115+ { "opt1", '1', "NUMBER", 0, "Option 1" },
5116+ { NULL, 0, NULL, 0, NULL }
5117+ };
5118+
5119+static const struct argp_option opt2[] =
5120+ {
5121+ { "opt2", '2', "NUMBER", 0, "Option 2" },
5122+ { NULL, 0, NULL, 0, NULL }
5123+ };
5124+
5125+static const struct argp_option opt3[] =
5126+ {
5127+ { "opt3", '3', "NUMBER", 0, "Option 3" },
5128+ { NULL, 0, NULL, 0, NULL }
5129+ };
5130+
5131+static const struct argp_option opt4[] =
5132+ {
5133+ { "opt4", '4', "NUMBER", 0, "Option 4" },
5134+ { NULL, 0, NULL, 0, NULL }
5135+ };
5136+
5137+static const struct argp_option opt5[] =
5138+ {
5139+ { "opt5", '5', "NUMBER", 0, "Option 5" },
5140+ { NULL, 0, NULL, 0, NULL }
5141+ };
5142+
5143+static struct argp argp5 =
5144+ {
5145+ opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
5146+ };
5147+
5148+static struct argp argp4 =
5149+ {
5150+ opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
5151+ };
5152+
5153+static struct argp argp3 =
5154+ {
5155+ opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
5156+ };
5157+
5158+static struct argp_child children2[] =
5159+ {
5160+ { &argp4, 0, "child3", 3 },
5161+ { &argp5, 0, "child4", 4 },
5162+ { NULL, 0, NULL, 0 }
5163+ };
5164+
5165+static struct argp argp2 =
5166+ {
5167+ opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
5168+ };
5169+
5170+static struct argp_child children1[] =
5171+ {
5172+ { &argp2, 0, "child1", 1 },
5173+ { &argp3, 0, "child2", 2 },
5174+ { NULL, 0, NULL, 0 }
5175+ };
5176+
5177+static struct argp argp1 =
5178+ {
5179+ opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
5180+ };
5181+
5182+
5183+static int
5184+do_test (void)
5185+{
5186+ argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
5187+ return 0;
5188+}
5189+
5190+
5191+#define TEST_FUNCTION do_test ()
5192+#include "../test-skeleton.c"
diff --git a/meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch b/meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch
new file mode 100644
index 0000000000..15ee0ca156
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/compile-arm-fork-with-O2.patch
@@ -0,0 +1,21 @@
1When compiling in thumb mode for arm with -Os gcc gives up since it can not find registers
2to spill. So we use -O2 option for compiling fork.c It may be addressable in gcc.
3
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5
6Upstream-Status: Pending
7
8diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
9index 329d8a9..41e3646 100644
10--- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
11+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/Makefile.arch
12@@ -30,3 +30,9 @@ CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc -DIS_IN_libpthread
13 # This macro should be alternatively implemented in THUMB
14 # assembly.
15 ASFLAGS-vfork.S = -marm
16+
17+# For arm fork.c does not compile with -Os when in compiling
18+# in thumb1 mode
19+ifeq ($(COMPILE_IN_THUMB_MODE),y)
20+CFLAGS-fork.c = -O2
21+endif
diff --git a/meta/recipes-core/uclibc/uclibc-git/locale.cfg b/meta/recipes-core/uclibc/uclibc-git/locale.cfg
new file mode 100644
index 0000000000..fc66435163
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/locale.cfg
@@ -0,0 +1,3 @@
1UCLIBC_HAS_LOCALE=y
2UCLIBC_HAS_XLOCALE=y
3UCLIBC_BUILD_MINIMAL_LOCALE=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/obstack.cfg b/meta/recipes-core/uclibc/uclibc-git/obstack.cfg
new file mode 100644
index 0000000000..36bf9d6e4a
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/obstack.cfg
@@ -0,0 +1 @@
UCLIBC_HAS_OBSTACK=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/orign_path.patch b/meta/recipes-core/uclibc/uclibc-git/orign_path.patch
new file mode 100644
index 0000000000..81bb8f8459
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/orign_path.patch
@@ -0,0 +1,186 @@
1Patch is backported from
2http://lists.busybox.net/pipermail/uclibc/2011-March/045003.html
3
4Upstream-Status: Pending
5
6Index: git/ldso/ldso/dl-elf.c
7===================================================================
8--- git.orig/ldso/ldso/dl-elf.c 2012-06-19 18:29:08.629931662 -0700
9+++ git/ldso/ldso/dl-elf.c 2012-06-19 21:21:14.798431393 -0700
10@@ -133,56 +133,60 @@
11 * in uClibc/ldso/util/ldd.c */
12 static struct elf_resolve *
13 search_for_named_library(const char *name, unsigned rflags, const char *path_list,
14- struct dyn_elf **rpnt)
15+ struct dyn_elf **rpnt, const char* origin)
16 {
17- char *path, *path_n, *mylibname;
18+ char *mylibname;
19 struct elf_resolve *tpnt;
20- int done;
21+ const char *p, *pn;
22+ int plen;
23
24 if (path_list==NULL)
25 return NULL;
26
27- /* We need a writable copy of this string, but we don't
28- * need this allocated permanently since we don't want
29- * to leak memory, so use alloca to put path on the stack */
30- done = _dl_strlen(path_list);
31- path = alloca(done + 1);
32-
33 /* another bit of local storage */
34 mylibname = alloca(2050);
35
36- _dl_memcpy(path, path_list, done+1);
37-
38 /* Unlike ldd.c, don't bother to eliminate double //s */
39
40 /* Replace colons with zeros in path_list */
41 /* : at the beginning or end of path maps to CWD */
42 /* :: anywhere maps CWD */
43 /* "" maps to CWD */
44- done = 0;
45- path_n = path;
46- do {
47- if (*path == 0) {
48- *path = ':';
49- done = 1;
50+ for (p = path_list; p != NULL; p = pn) {
51+ pn = _dl_strchr(p + 1, ':');
52+ if (pn != NULL) {
53+ plen = pn - p;
54+ pn++;
55+ } else
56+ plen = _dl_strlen(p);
57+
58+ if (plen >= 7 && _dl_memcmp(p, "$ORIGIN", 7) == 0) {
59+ int olen;
60+ if (rflags && plen != 7)
61+ continue;
62+ if (origin == NULL)
63+ continue;
64+ for (olen = _dl_strlen(origin) - 1; olen >= 0 && origin[olen] != '/'; olen--)
65+ ;
66+ if (olen <= 0)
67+ continue;
68+ _dl_memcpy(&mylibname[0], origin, olen);
69+ _dl_memcpy(&mylibname[olen], p + 7, plen - 7);
70+ mylibname[olen + plen - 7] = 0;
71+ } else if (plen != 0) {
72+ _dl_memcpy(mylibname, p, plen);
73+ mylibname[plen] = 0;
74+ } else {
75+ _dl_strcpy(mylibname, ".");
76 }
77- if (*path == ':') {
78- *path = 0;
79- if (*path_n)
80- _dl_strcpy(mylibname, path_n);
81- else
82- _dl_strcpy(mylibname, "."); /* Assume current dir if empty path */
83- _dl_strcat(mylibname, "/");
84- _dl_strcat(mylibname, name);
85+ _dl_strcat(mylibname, "/");
86+ _dl_strcat(mylibname, name);
87 #ifdef __LDSO_SAFE_RUNPATH__
88- if (*mylibname == '/')
89+ if (*mylibname == '/')
90 #endif
91- if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
92- return tpnt;
93- path_n = path+1;
94- }
95- path++;
96- } while (!done);
97+ if ((tpnt = _dl_load_elf_shared_library(rflags, rpnt, mylibname)) != NULL)
98+ return tpnt;
99+ }
100 return NULL;
101 }
102
103@@ -234,8 +238,10 @@
104 if (pnt) {
105 pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
106 _dl_if_debug_dprint("\tsearching RPATH='%s'\n", pnt);
107- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
108+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt,
109+ tpnt->libname)) != NULL)
110 return tpnt1;
111+
112 }
113 #endif
114
115@@ -243,7 +249,7 @@
116 /* Check in LD_{ELF_}LIBRARY_PATH, if specified and allowed */
117 if (_dl_library_path) {
118 _dl_if_debug_dprint("\tsearching LD_LIBRARY_PATH='%s'\n", _dl_library_path);
119- if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt)) != NULL)
120+ if ((tpnt1 = search_for_named_library(libname, rflags, _dl_library_path, rpnt, NULL)) != NULL)
121 {
122 return tpnt1;
123 }
124@@ -257,7 +263,7 @@
125 if (pnt) {
126 pnt += (unsigned long) tpnt->dynamic_info[DT_STRTAB];
127 _dl_if_debug_dprint("\tsearching RUNPATH='%s'\n", pnt);
128- if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt)) != NULL)
129+ if ((tpnt1 = search_for_named_library(libname, rflags, pnt, rpnt, NULL)) != NULL)
130 return tpnt1;
131 }
132 #endif
133@@ -291,7 +297,7 @@
134 /* Look for libraries wherever the shared library loader
135 * was installed */
136 _dl_if_debug_dprint("\tsearching ldso dir='%s'\n", _dl_ldsopath);
137- tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt);
138+ tpnt1 = search_for_named_library(libname, rflags, _dl_ldsopath, rpnt, NULL);
139 if (tpnt1 != NULL)
140 return tpnt1;
141 #endif
142@@ -304,7 +310,7 @@
143 #ifndef __LDSO_CACHE_SUPPORT__
144 ":" UCLIBC_RUNTIME_PREFIX "usr/X11R6/lib"
145 #endif
146- , rpnt);
147+ , rpnt, NULL);
148 if (tpnt1 != NULL)
149 return tpnt1;
150
151Index: git/ldso/ldso/ldso.c
152===================================================================
153--- git.orig/ldso/ldso/ldso.c 2012-06-19 18:29:08.633931663 -0700
154+++ git/ldso/ldso/ldso.c 2012-06-19 18:29:10.197931738 -0700
155@@ -403,6 +403,20 @@
156 return p - list;
157 }
158
159+static void _dl_setup_progname(const char *argv0)
160+{
161+ char image[PATH_MAX];
162+ ssize_t s;
163+
164+ s = _dl_readlink("/proc/self/exe", image, sizeof(image));
165+ if (s > 0 && image[0] == '/') {
166+ image[s] = 0;
167+ _dl_progname = _dl_strdup(image);
168+ } else if (argv0) {
169+ _dl_progname = argv0;
170+ }
171+}
172+
173 void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
174 ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
175 DL_GET_READY_TO_RUN_EXTRA_PARMS)
176@@ -454,9 +468,7 @@
177 * been fixed up by now. Still no function calls outside of this
178 * library, since the dynamic resolver is not yet ready.
179 */
180- if (argv[0]) {
181- _dl_progname = argv[0];
182- }
183+ _dl_setup_progname(argv[0]);
184
185 #ifdef __DSBT__
186 _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX];
diff --git a/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch b/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch
new file mode 100644
index 0000000000..2f014cd91e
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch
@@ -0,0 +1,113 @@
1Add ppc copysignl implementation
2
3Upstream-Status: Pending
4
5Signed-off-by: Khem Raj <raj.khem@gmail.com>
6
7Index: git/libc/sysdeps/linux/powerpc/Makefile.arch
8===================================================================
9--- git.orig/libc/sysdeps/linux/powerpc/Makefile.arch 2013-05-23 11:09:50.000000000 -0700
10+++ git/libc/sysdeps/linux/powerpc/Makefile.arch 2013-05-23 11:12:06.072328399 -0700
11@@ -5,7 +5,7 @@
12 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
13 #
14
15-CSRC-y := __syscall_error.c ioctl.c
16+CSRC-y := __syscall_error.c ioctl.c copysignl.c
17
18 SSRC-y := \
19 __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S \
20Index: git/libc/sysdeps/linux/powerpc/copysignl.c
21===================================================================
22--- /dev/null 1970-01-01 00:00:00.000000000 +0000
23+++ git/libc/sysdeps/linux/powerpc/copysignl.c 2013-05-23 11:11:37.600327865 -0700
24@@ -0,0 +1,89 @@
25+/* s_copysignl.c -- long double version of s_copysign.c.
26+ * Conversion to long double by Ulrich Drepper,
27+ * Cygnus Support, drepper@cygnus.com.
28+ */
29+
30+/*
31+ * ====================================================
32+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
33+ *
34+ * Developed at SunPro, a Sun Microsystems, Inc. business.
35+ * Permission to use, copy, modify, and distribute this
36+ * software is freely granted, provided that this notice
37+ * is preserved.
38+ * ====================================================
39+ */
40+
41+/*
42+ * copysignl(long double x, long double y)
43+ * copysignl(x,y) returns a value with the magnitude of x and
44+ * with the sign bit of y.
45+ */
46+
47+#include <endian.h>
48+#include <stdint.h>
49+
50+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
51+
52+typedef union
53+{
54+ long double value;
55+ struct
56+ {
57+ int sign_exponent:16;
58+ unsigned int empty:16;
59+ uint32_t msw;
60+ uint32_t lsw;
61+ } parts;
62+} ieee_long_double_shape_type;
63+
64+#endif
65+
66+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
67+
68+typedef union
69+{
70+ long double value;
71+ struct
72+ {
73+ uint32_t lsw;
74+ uint32_t msw;
75+ int sign_exponent:16;
76+ unsigned int empty:16;
77+ } parts;
78+} ieee_long_double_shape_type;
79+
80+#endif
81+
82+/* Get int from the exponent of a long double. */
83+
84+#define GET_LDOUBLE_EXP(exp,d) \
85+do { \
86+ ieee_long_double_shape_type ge_u; \
87+ ge_u.value = (d); \
88+ (exp) = ge_u.parts.sign_exponent; \
89+} while (0)
90+
91+/* Set exponent of a long double from an int. */
92+
93+#define SET_LDOUBLE_EXP(d,exp) \
94+do { \
95+ ieee_long_double_shape_type se_u; \
96+ se_u.value = (d); \
97+ se_u.parts.sign_exponent = (exp); \
98+ (d) = se_u.value; \
99+} while (0)
100+
101+long double copysignl(long double x, long double y);
102+libc_hidden_proto(copysignl);
103+
104+long double copysignl(long double x, long double y)
105+{
106+ uint32_t es1,es2;
107+ GET_LDOUBLE_EXP(es1,x);
108+ GET_LDOUBLE_EXP(es2,y);
109+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
110+ return x;
111+}
112+
113+libc_hidden_def(copysignl);
diff --git a/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
new file mode 100644
index 0000000000..fb52faa7a0
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
@@ -0,0 +1,19 @@
1Dont support localised optimizations this helps to have a global -O level
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6Index: git/libpthread/nptl/pthread_mutex_timedlock.c
7===================================================================
8--- git.orig/libpthread/nptl/pthread_mutex_timedlock.c 2014-08-25 10:58:06.000000000 -0700
9+++ git/libpthread/nptl/pthread_mutex_timedlock.c 2014-08-25 11:00:42.078242266 -0700
10@@ -28,7 +28,9 @@
11 * error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
12 */
13 int
14+#ifndef __OPTIMIZE__
15 attribute_optimize("Os")
16+#endif
17 pthread_mutex_timedlock (
18 pthread_mutex_t *mutex,
19 const struct timespec *abstime)
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.distro b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
new file mode 100644
index 0000000000..6575482b34
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/uClibc.distro
@@ -0,0 +1,193 @@
1#
2# General Library Settings
3#
4# HAVE_NO_PIC is not set
5# DOPIC is not set
6# HAVE_NO_SHARED is not set
7# ARCH_HAS_NO_LDSO is not set
8HAVE_SHARED=y
9# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
10LDSO_LDD_SUPPORT=y
11LDSO_CACHE_SUPPORT=y
12# LDSO_PRELOAD_FILE_SUPPORT is not set
13LDSO_BASE_FILENAME="ld.so"
14# UCLIBC_STATIC_LDCONFIG is not set
15LDSO_RUNPATH=y
16UCLIBC_CTOR_DTOR=y
17LDSO_GNU_HASH_SUPPORT=y
18# HAS_NO_THREADS is not set
19UCLIBC_HAS_THREADS=y
20UCLIBC_HAS_THREADS_NATIVE=y
21PTHREADS_DEBUG_SUPPORT=y
22# LINUXTHREADS_OLD is not set
23UCLIBC_HAS_LFS=y
24# MALLOC is not set
25# MALLOC_SIMPLE is not set
26MALLOC_STANDARD=y
27MALLOC_GLIBC_COMPAT=y
28UCLIBC_DYNAMIC_ATEXIT=y
29COMPAT_ATEXIT=y
30UCLIBC_SUSV3_LEGACY=y
31UCLIBC_SUSV3_LEGACY_MACROS=y
32UCLIBC_SUSV4_LEGACY=y
33UCLIBC_HAS_SHADOW=y
34UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
35UCLIBC_HAS___PROGNAME=y
36UNIX98PTY_ONLY=y
37ASSUME_DEVPTS=y
38UCLIBC_HAS_LIBUTIL=y
39UCLIBC_HAS_TM_EXTENSIONS=y
40UCLIBC_HAS_TZ_CACHING=y
41UCLIBC_HAS_TZ_FILE=y
42UCLIBC_HAS_TZ_FILE_READ_MANY=y
43UCLIBC_TZ_FILE_PATH="/etc/TZ"
44
45#
46# Advanced Library Settings
47#
48UCLIBC_PWD_BUFFER_SIZE=256
49UCLIBC_GRP_BUFFER_SIZE=256
50
51#
52# Networking Support
53#
54UCLIBC_HAS_IPV6=y
55UCLIBC_HAS_RPC=y
56UCLIBC_HAS_FULL_RPC=y
57UCLIBC_HAS_REENTRANT_RPC=y
58UCLIBC_USE_NETLINK=y
59UCLIBC_SUPPORT_AI_ADDRCONFIG=y
60
61UCLIBC_HAS_BSD_RES_CLOSE=y
62UCLIBC_HAS_LIBRESOLV_STUB=y
63UCLIBC_HAS_LIBNSL_STUB=y
64
65#
66# String and Stdio Support
67#
68UCLIBC_HAS_STRING_GENERIC_OPT=y
69UCLIBC_HAS_STRING_ARCH_OPT=y
70UCLIBC_HAS_CTYPE_TABLES=y
71UCLIBC_HAS_CTYPE_SIGNED=y
72# UCLIBC_HAS_CTYPE_UNSAFE is not set
73UCLIBC_HAS_CTYPE_CHECKED=y
74# UCLIBC_HAS_CTYPE_ENFORCED is not set
75UCLIBC_HAS_WCHAR=y
76# UCLIBC_HAS_LOCALE is not set
77UCLIBC_HAS_HEXADECIMAL_FLOATS=y
78UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
79UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
80UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
81# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
82UCLIBC_HAS_STDIO_BUFSIZ_256=y
83# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
84# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
85# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
86# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
87# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
88UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
89# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
90# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
91# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
92UCLIBC_HAS_STDIO_GETC_MACRO=y
93UCLIBC_HAS_STDIO_PUTC_MACRO=y
94UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
95# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
96UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
97UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
98UCLIBC_HAS_PRINTF_M_SPEC=y
99UCLIBC_HAS_ERRNO_MESSAGES=y
100# UCLIBC_HAS_SYS_ERRLIST is not set
101UCLIBC_HAS_SIGNUM_MESSAGES=y
102# UCLIBC_HAS_SYS_SIGLIST is not set
103UCLIBC_HAS_GNU_GETOPT=y
104UCLIBC_HAS_GNU_GETSUBOPT=y
105
106#
107# Big and Tall
108#
109UCLIBC_HAS_REGEX=y
110# UCLIBC_HAS_REGEX_OLD is not set
111UCLIBC_HAS_FNMATCH=y
112# UCLIBC_HAS_FNMATCH_OLD is not set
113UCLIBC_HAS_WORDEXP=y
114UCLIBC_HAS_NFTW=y
115UCLIBC_HAS_FTW=y
116UCLIBC_HAS_FTS=y
117UCLIBC_HAS_GLOB=y
118UCLIBC_HAS_GNU_GLOB=y
119
120#
121# Library Installation Options
122#
123SHARED_LIB_LOADER_PREFIX="/lib"
124RUNTIME_PREFIX="/"
125DEVEL_PREFIX="//usr"
126MULTILIB_DIR="lib"
127
128#
129# Security options
130#
131# UCLIBC_BUILD_PIE is not set
132# UCLIBC_HAS_ARC4RANDOM is not set
133# HAVE_NO_SSP is not set
134# UCLIBC_HAS_SSP is not set
135UCLIBC_BUILD_RELRO=y
136UCLIBC_BUILD_NOW=y
137UCLIBC_BUILD_NOEXECSTACK=y
138
139#
140# uClibc development/debugging options
141#
142CROSS_COMPILER_PREFIX=""
143UCLIBC_EXTRA_CFLAGS=""
144# DODEBUG is not set
145# DODEBUG_PT is not set
146# DOSTRIP is not set
147# DOASSERTS is not set
148# SUPPORT_LD_DEBUG is not set
149# SUPPORT_LD_DEBUG_EARLY is not set
150# UCLIBC_MALLOC_DEBUGGING is not set
151UCLIBC_HAS_BACKTRACE=y
152WARNINGS="-Wall"
153# EXTRA_WARNINGS is not set
154# DOMULTI is not set
155# UCLIBC_MJN3_ONLY is not set
156
157# math stuff for perl
158DO_C99_MATH=y
159UCLIBC_HAS_LONG_DOUBLE_MATH=y
160UCLIBC_HAS_FENV=y
161UCLIBC_LINUX_MODULE_26=y
162# UCLIBC_LINUX_MODULE_24 is not set
163UCLIBC_LINUX_SPECIFIC=y
164UCLIBC_HAS_REALTIME=y
165UCLIBC_HAS_ADVANCED_REALTIME=y
166UCLIBC_HAS_NETWORK_SUPPORT=y
167UCLIBC_HAS_SOCKET=y
168UCLIBC_HAS_BSD_ERR=y
169UCLIBC_HAS_SYSLOG=y
170UCLIBC_HAS_CRYPT=y
171UCLIBC_HAS_CRYPT_IMPL=y
172UCLIBC_HAS_GNU_ERROR=y
173UCLIBC_HAS_PTY=y
174UCLIBC_BSD_SPECIFIC=y
175UCLIBC_HAS_EPOLL=y
176UCLIBC_HAS_FLOATS=y
177
178# The below option is needed for ARM since depending
179# upong what intruction set is chosen this will be
180# enabled. As such it is harmless and will be punted
181# by menuconfig for other arches.
182
183# COMPILE_IN_THUMB_MODE is not set
184
185# needed by systemd
186UCLIBC_HAS_UTMPX=y
187UCLIBC_LINUX_MODULE_26=y
188UCLIBC_HAS_RESOLVER_SUPPORT=y
189# needed for LTP
190UCLIBC_SUSV4_LEGACY=y
191UCLIBC_HAS_OBSOLETE_BSD_SIGNAL=y
192DO_XSI_MATH=y
193UCLIBC_SV4_DEPRECATED=y
diff --git a/meta/recipes-core/uclibc/uclibc-git/uClibc.machine b/meta/recipes-core/uclibc/uclibc-git/uClibc.machine
new file mode 100644
index 0000000000..595f444dac
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/uClibc.machine
@@ -0,0 +1,14 @@
1#
2# Automatically generated make config: don't edit
3# Version: 0.9.32-git
4# Mon Jul 19 01:34:29 2010
5#
6#
7# Using ELF file format
8#
9FORCE_OPTIONS_FOR_ARCH=y
10ARCH_HAS_MMU=y
11ARCH_USE_MMU=y
12KERNEL_HEADERS="/usr/include"
13HAVE_DOT_CONFIG=y
14
diff --git a/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch b/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch
new file mode 100644
index 0000000000..37a59884b8
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch
@@ -0,0 +1,35 @@
1uclibc now has log2 so enable the tests
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6Index: uClibc/test/math/libm-test.inc
7===================================================================
8--- uClibc/test/math/libm-test.inc (revision 23784)
9+++ uClibc/test/math/libm-test.inc (working copy)
10@@ -3414,7 +3414,6 @@
11 }
12
13
14-#if 0
15 static void
16 log2_test (void)
17 {
18@@ -3444,7 +3443,6 @@
19
20 END (log2);
21 }
22-#endif
23
24
25 static void
26@@ -4967,9 +4965,7 @@
27 log_test ();
28 log10_test ();
29 log1p_test ();
30-#if 0
31 log2_test ();
32-#endif
33 logb_test ();
34 modf_test ();
35 ilogb_test ();
diff --git a/meta/recipes-core/uclibc/uclibc-initial_git.bb b/meta/recipes-core/uclibc/uclibc-initial_git.bb
new file mode 100644
index 0000000000..c937ccb108
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-initial_git.bb
@@ -0,0 +1,36 @@
1SECTION = "base"
2require uclibc.inc
3require uclibc-git.inc
4
5DEPENDS = "linux-libc-headers ncurses-native virtual/${TARGET_PREFIX}gcc-initial libgcc-initial kern-tools-native"
6PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
7
8PACKAGES = ""
9PACKAGES_DYNAMIC = ""
10
11STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
12STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
13
14do_install() {
15 # Install initial headers into the cross dir
16 make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
17 install_headers install_startfiles
18
19 # add links to linux-libc-headers: final uclibc build need this.
20 for t in linux asm asm-generic; do
21 if [ -d ${D}${includedir}/$t ]; then
22 rm -rf ${D}${includedir}/$t
23 fi
24 ln -sf ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
25 done
26
27}
28do_compile() {
29 :
30}
31
32do_siteconfig () {
33 :
34}
35
36do_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
new file mode 100644
index 0000000000..c1815f9a31
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-package.inc
@@ -0,0 +1,37 @@
1# Ensure the uclibc-dev package is processed before uclibc-staticdev to allow
2# *_nonshared.a libraries to be packaged in the uclibc-dev package.
3PACKAGES = "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}"
4
5FILES_uclibc-libcrypt = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so"
6FILES_uclibc-libintl = "${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so"
7FILES_uclibc-libnsl = "${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so"
8FILES_uclibc-libresolv = "${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so"
9FILES_uclibc-libm = "${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so"
10FILES_uclibc-libdl = "${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so"
11FILES_uclibc-libutil = "${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so"
12FILES_uclibc-libpthread = "${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so"
13FILES_uclibc-librt = "${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so"
14
15FILES_ldd = "${bindir}/ldd"
16FILES_uclibc-utils = "${bindir} ${sbindir}"
17FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
18FILES_uclibc-gconv = "${libdir}/gconv"
19FILES_uclibc-thread-db = "${base_libdir}/libthread_db*"
20FILES_uclibc-argp = "${base_libdir}/libuargp-*.so ${base_libdir}/libuargp*.so.*"
21FILES_uclibc-backtrace = "${base_libdir}/libubacktrace-*.so ${base_libdir}/libubacktrace*.so.*"
22
23# The last line (gdb and lib1) is for uclinux-uclibc builds
24uclibc_baselibs = "${base_libdir}/ld*.so.* ${base_libdir}/ld*.so \
25 ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \
26 ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \
27 "
28FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
29FILES_${PN}-dev += "\
30 ${libdir}/lib*.so \
31 ${libdir}/*_nonshared.a \
32 ${libdir}/[S]*crt[1in].o \
33 ${libdir}/crtreloc*.o \
34 ${includedir}/*.h ${includedir}/*/*.h \
35 "
36FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
37 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
diff --git a/meta/recipes-core/uclibc/uclibc.inc b/meta/recipes-core/uclibc/uclibc.inc
new file mode 100644
index 0000000000..18587ca273
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc.inc
@@ -0,0 +1,167 @@
1SUMMARY = "C library for embedded systems"
2DESCRIPTION = "The name uClibc is an abbreviation for 'the \
3microcontroller C library'. For simplicity, uClibc is pronounced \
4'yew-see-lib-see'. The goal of uClibc is to provide as much \
5functionality as possible in a small amount of space, and it is intended \
6primarily for embedded use. It is also highly configurable in supported \
7features, at the cost of ABI differences for different configurations. \
8uClibc has been designed from the ground up to be a C library for \
9embedded Linux. It is NOT compatible with binaries linked against glibc."
10
11LICENSE = "LGPLv2.1+"
12SECTION = "libs"
13LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
14 file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \
15file://${S}/test/regex/testregex.c;beginline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960"
16PR = "r9"
17
18require uclibc-config.inc
19
20PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
21TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
22
23# siteconfig.bbclass runs configure which needs a working compiler
24# For the compiler to work we need a working libc yet libc isn't
25# in the sysroots directory at this point. This means the libc.so
26# linker script won't work as the --sysroot setting isn't correct.
27# Here we create a hacked up libc linker script and pass in the right
28# flags to let configure work. Ugly.
29EXTRASITECONFIG = "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}'"
30siteconfig_do_siteconfig_gencache_prepend = " \
31mkdir -p ${WORKDIR}/site_config_libc; \
32cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
33sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
34"
35
36# For now, we will skip building of a gcc package if it is a uclibc one
37# and our build is not a uclibc one, and we skip a glibc one if our build
38# is a uclibc build.
39COMPATIBLE_HOST = ".*-uclibc.*"
40
41INHIBIT_DEFAULT_DEPS = "1"
42
43# do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in
44# the CFLAGS (when building the utils).
45OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}'"
46EXTRA_OEMAKE = "${OEMAKE_NO_CC} \
47 'HOSTCC=${BUILD_CC}' \
48 'HOST_CFLAGS=${BUILD_CFLAGS}' \
49 'CC=${CC}' \
50 ARCH=${UCLIBC_ARCH}"
51
52EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
53
54# enable verbose output:
55export V="2"
56
57# -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
58# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
59#
60CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
61UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
62UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}', d)}"
63
64do_compile_prepend () {
65 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
66 oe_runmake pregen
67}
68
69configmangle = '/^KERNEL_HEADERS/d; \
70 /^RUNTIME_PREFIX/d; \
71 /^DEVEL_PREFIX/d; \
72 /^SHARED_LIB_LOADER_PREFIX/d; \
73 /^UCLIBC_EXTRA_CFLAGS/d; \
74 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
75 ${@["","s,.*COMPILE_IN_THUMB_MODE.*,COMPILE_IN_THUMB_MODE=y,;"][d.getVar("ARM_INSTRUCTION_SET", True) != "arm"]} \
76 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][d.getVar("USE_NLS", True) == "yes"]} \
77 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][d.getVar("TARGET_ARCH", True) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
78 /^CROSS/d; \
79 /^TARGET_ARCH=/d; \
80 /^TARGET_/s,^\([^=]*\).*,# \1 is not set,g; \
81 s,^DOSTRIP.*,# DOSTRIP is not set,g; \
82 /_[EO]*ABI/d; \
83 /HAS_FPU/d; \
84 ${@["","s,.*MULTILIB_DIR.*,MULTILIB_DIR=\"${baselib}\",;"][d.getVar("baselib", True) != "lib"]} \
85 '
86OE_FEATURES := "${@features_to_uclibc_conf(d)}"
87OE_DEL := "${@features_to_uclibc_del(d)}"
88python () {
89 if "${OE_DEL}":
90 d.setVar('configmangle_append', "${OE_DEL}" + "\n")
91
92 # by default uclibc uses mips1 ISA for o32 ABI
93 # if we use TARGET_CC_ARCH="-march=mips32" we end up
94 # with conflicting march options to gcc. Here we
95 # ask for MIPS32 ISA to match the chosen arch
96 tune = d.getVar("DEFAULTTUNE", True)
97 if tune in ['mips32', 'mips32r2']:
98 d.setVar('configmangle_append',
99 "/^### MIPS32_CHECK$/a\\\nCONFIG_MIPS_ISA_%s=y\n\n" % (tune.upper()))
100 if "${OE_FEATURES}":
101 d.setVar('configmangle_append',
102 "/^### DISTRO FEATURES$/a\\\n%s\n\n" %
103 ("\\n".join((d.expand("${OE_FEATURES}").split("\n")))))
104 d.setVar('configmangle_append',
105 "/^### CROSS$/a\\\n%s\n" %
106 ("\\n".join(["CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
107 "UCLIBC_EXTRA_CFLAGS=\"${UCLIBC_EXTRA_CFLAGS}\"",
108 "KERNEL_HEADERS=\"${STAGING_INCDIR}\"",
109 "RUNTIME_PREFIX=\"/\"",
110 "DEVEL_PREFIX=\"/${prefix}\"",
111 "SHARED_LIB_LOADER_PREFIX=\"/lib\"",
112 ])
113 ))
114 d.setVar('configmangle_append',
115 "/^### TGT$/a\\\nTARGET_ARCH=\"%s\"\\nTARGET_%s=y\n" %
116 ("${UCLIBC_ARCH}", "${UCLIBC_ARCH}"))
117 d.setVar('configmangle_append',
118 "/^### FPU$/a\\\n%s\n\n" % (["UCLIBC_HAS_FPU=y","# UCLIBC_HAS_FPU is not set"][d.getVar('TARGET_FPU', True) in [ 'soft' ]]))
119 if "${UCLIBC_ENDIAN}":
120 d.setVar('configmangle_append',
121 "/^### ABI$/a\\\nARCH_WANTS_%s_ENDIAN=y\n\n" % ("${UCLIBC_ENDIAN}"))
122 if "${UCLIBC_ABI}":
123 d.setVar('configmangle_append',
124 "/^### ABI$/a\\\nCONFIG_%s=y\n\n" % ("${UCLIBC_ABI}"))
125}
126
127python do_patch_append() {
128 import subprocess
129 subprocess.call("ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux", shell=True)
130 subprocess.call("ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm", shell=True)
131}
132
133do_configure() {
134 rm -f ${S}/.config
135
136 # OpenEmbedded splits the uClibc.config in two parts:
137 # uClibc.machine, uClibc.distro
138 echo "### uClibc.machine ###" >${S}/merged.config
139 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
140 echo "### uClibc.distro ###" >>${S}/merged.config
141 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
142 echo "### CROSS" >>${S}/merged.config
143 echo "### TGT" >>${S}/merged.config
144 echo "### MMU" >>${S}/merged.config
145 echo "### FPU" >>${S}/merged.config
146 echo "### ABI" >>${S}/merged.config
147 echo "### DISTRO FEATURES" >>${S}/merged.config
148 echo "### MIPS32_CHECK" >>${S}/merged.config
149
150 # Mangle the resulting .config depending on OE variables
151 sed -i -e '${configmangle}' ${S}/merged.config
152 cp ${S}/merged.config .config
153 merge_config.sh -r -n -m .config ${@" ".join(find_cfgs(d))}
154 cml1_do_configure
155
156}
157
158do_install() {
159 oe_runmake PREFIX=${D} install
160 rm -rf ${D}${includedir}/iconv.h
161}
162
163# build ldd, ldconfig and friends but only for full uclibc
164do_install_append_pn-uclibc () {
165 oe_runmake PREFIX=${D} "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" -C utils utils_install
166}
167
diff --git a/meta/recipes-core/uclibc/uclibc_git.bb b/meta/recipes-core/uclibc/uclibc_git.bb
new file mode 100644
index 0000000000..fd02b3d612
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc_git.bb
@@ -0,0 +1,22 @@
1require uclibc.inc
2require uclibc-package.inc
3require uclibc-git.inc
4
5STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
7
8PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
9
10DEPENDS = "virtual/${TARGET_PREFIX}binutils \
11 virtual/${TARGET_PREFIX}gcc-initial \
12 virtual/${TARGET_PREFIX}libc-initial \
13 linux-libc-headers ncurses-native \
14 libgcc-initial kern-tools-native"
15
16RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
17RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev"
18# uclibc does not really have libsegfault but then using the one from glibc is also not
19# going to work. So we pretend that we have it to make bitbake not pull other recipes
20# to satisfy this dependency for the images/tasks
21
22RPROVIDES_${PN} += "libsegfault rtld(GNU_HASH)"
diff --git a/meta/recipes-core/udev/udev-extraconf/automount.rules b/meta/recipes-core/udev/udev-extraconf/automount.rules
new file mode 100644
index 0000000000..62578ea631
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/automount.rules
@@ -0,0 +1,19 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Media automounting
17SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh"
18SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
19SUBSYSTEM=="block", ACTION=="change", ENV{DISK_MEDIA_CHANGE}=="1" RUN+="/etc/udev/scripts/mount.sh"
diff --git a/meta/recipes-core/udev/udev-extraconf/autonet.rules b/meta/recipes-core/udev/udev-extraconf/autonet.rules
new file mode 100644
index 0000000000..19676aa13b
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/autonet.rules
@@ -0,0 +1,19 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Handle network interface setup
17SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh"
18SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh"
19
diff --git a/meta/recipes-core/udev/udev-extraconf/localextra.rules b/meta/recipes-core/udev/udev-extraconf/localextra.rules
new file mode 100644
index 0000000000..3d51d3e395
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/localextra.rules
@@ -0,0 +1,23 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# The first rtc device is symlinked to /dev/rtc
17KERNEL=="rtc0", SYMLINK+="rtc"
18
19#The first framebuffer is symlinked to /dev/fb
20KERNEL=="fb0", SYMLINK+="fb"
21
22# Make all input devices read-write to the input group
23SUBSYSTEM=="input", GROUP="input", MODE="660"
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.blacklist b/meta/recipes-core/udev/udev-extraconf/mount.blacklist
new file mode 100644
index 0000000000..e49349428b
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/mount.blacklist
@@ -0,0 +1,5 @@
1/dev/loop
2/dev/ram
3/dev/mtdblock
4/dev/md
5/dev/dm-*
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
new file mode 100644
index 0000000000..3eea910854
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -0,0 +1,90 @@
1#!/bin/sh
2#
3# Called from udev
4#
5# Attempt to mount any added block devices and umount any removed devices
6
7
8MOUNT="/bin/mount"
9PMOUNT="/usr/bin/pmount"
10UMOUNT="/bin/umount"
11for line in `grep -v ^# /etc/udev/mount.blacklist`
12do
13 if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
14 then
15 logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
16 exit 0
17 fi
18done
19
20automount() {
21 name="`basename "$DEVNAME"`"
22
23 ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
24 # Silent util-linux's version of mounting auto
25 if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
26 then
27 MOUNT="$MOUNT -o silent"
28 fi
29
30 # If filesystem type is vfat, change the ownership group to 'disk', and
31 # grant it with w/r/x permissions.
32 case $ID_FS_TYPE in
33 vfat|fat)
34 MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`"
35 ;;
36 # TODO
37 *)
38 ;;
39 esac
40
41 if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
42 then
43 #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!"
44 rm_dir "/run/media/$name"
45 else
46 logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful"
47 touch "/tmp/.automount-$name"
48 fi
49}
50
51rm_dir() {
52 # We do not want to rm -r populated directories
53 if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
54 then
55 ! test -z "$1" && rm -r "$1"
56 else
57 logger "mount.sh/automount" "Not removing non-empty directory [$1]"
58 fi
59}
60
61# No ID_FS_TYPE for cdrom device, yet it should be mounted
62name="`basename "$DEVNAME"`"
63[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
64
65if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then
66 if [ -x "$PMOUNT" ]; then
67 $PMOUNT $DEVNAME 2> /dev/null
68 elif [ -x $MOUNT ]; then
69 $MOUNT $DEVNAME 2> /dev/null
70 fi
71
72 # If the device isn't mounted at this point, it isn't
73 # configured in fstab (note the root filesystem can show up as
74 # /dev/root in /proc/mounts, so check the device number too)
75 if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
76 grep -q "^$DEVNAME " /proc/mounts || automount
77 fi
78fi
79
80
81if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then
82 for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
83 do
84 $UMOUNT $mnt
85 done
86
87 # Remove empty directories from auto-mounter
88 name="`basename "$DEVNAME"`"
89 test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
90fi
diff --git a/meta/recipes-core/udev/udev-extraconf/network.sh b/meta/recipes-core/udev/udev-extraconf/network.sh
new file mode 100644
index 0000000000..3ee92714af
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf/network.sh
@@ -0,0 +1,54 @@
1#!/bin/sh
2
3# We get two "add" events for hostap cards due to wifi0
4echo "$INTERFACE" | grep -q wifi && exit 0
5
6# udevd does clearenv(). Export shell PATH to children.
7export PATH
8
9# Check if /etc/init.d/network has been run yet to see if we are
10# called by starting /etc/rcS.d/S03udev and not by hotplugging a device
11#
12# At this stage, network interfaces should not be brought up
13# automatically because:
14# a) /etc/init.d/network has not been run yet (security issue)
15# b) /var has not been populated yet so /etc/resolv,conf points to
16# oblivion, making the network unusable
17#
18
19spoofp="`grep ^spoofprotect /etc/network/options`"
20if test -z "$spoofp"
21then
22 # This is the default from /etc/init.d/network
23 spoofp_val=yes
24else
25 spoofp_val=${spoofp#spoofprotect=}
26fi
27
28test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0
29
30# I think it is safe to assume that "lo" will always be there ;)
31if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val"
32then
33 echo "$INTERFACE" >> /dev/udev_network_queue
34 exit 0
35fi
36
37#
38# Code taken from pcmcia-cs:/etc/pcmcia/network
39#
40
41# if this interface has an entry in /etc/network/interfaces, let ifupdown
42# handle it
43if grep -q "iface \+$INTERFACE" /etc/network/interfaces; then
44 case $ACTION in
45 add)
46 ifconfig | grep -q "^$INTERFACE" || ifup $INTERFACE
47 ;;
48 remove)
49 ifdown $INTERFACE
50 ;;
51 esac
52
53 exit 0
54fi
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
new file mode 100644
index 0000000000..d69056dd76
--- /dev/null
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -0,0 +1,39 @@
1SUMMARY = "Extra machine specific configuration files"
2DESCRIPTION = "Extra machine specific configuration files for udev, specifically blacklist information."
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
5 file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
6
7SRC_URI = " \
8 file://automount.rules \
9 file://mount.sh \
10 file://mount.blacklist \
11 file://autonet.rules \
12 file://network.sh \
13 file://localextra.rules \
14"
15
16
17do_install() {
18 install -d ${D}${sysconfdir}/udev/rules.d
19
20 install -m 0644 ${WORKDIR}/automount.rules ${D}${sysconfdir}/udev/rules.d/automount.rules
21 install -m 0644 ${WORKDIR}/autonet.rules ${D}${sysconfdir}/udev/rules.d/autonet.rules
22 install -m 0644 ${WORKDIR}/localextra.rules ${D}${sysconfdir}/udev/rules.d/localextra.rules
23
24 install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/
25
26 install -d ${D}${sysconfdir}/udev/scripts/
27
28 install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
29 install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts
30}
31
32FILES_${PN} = "${sysconfdir}/udev"
33RDEPENDS_${PN} = "udev"
34CONFFILES_${PN} = "${sysconfdir}/udev/mount.blacklist"
35
36# to replace udev-extra-rules from meta-oe
37RPROVIDES_${PN} = "udev-extra-rules"
38RREPLACES_${PN} = "udev-extra-rules"
39RCONFLICTS_${PN} = "udev-extra-rules"
diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc
new file mode 100644
index 0000000000..24463b1d71
--- /dev/null
+++ b/meta/recipes-core/udev/udev.inc
@@ -0,0 +1,106 @@
1SUMMARY = "/dev/ and hotplug management daemon"
2DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \
3/dev/, handles hotplug events and loads drivers at boot time."
4HOMEPAGE = "http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html"
5LICENSE = "GPLv2.0+ & LGPLv2.1+"
6LICENSE_${PN} = "GPLv2.0+"
7LICENSE_libudev = "LGPLv2.1+"
8LICENSE_libgudev = "LGPLv2.1+"
9LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
10 file://src/COPYING;md5=17c4e5fb495e6707ac92a3864926f979 \
11 file://src/gudev/COPYING;md5=fb494485a7d0505308cb68e4997cc266"
12
13LDFLAGS += "-lrt"
14
15DEPENDS = "acl glib-2.0 libusb usbutils pciutils gperf-native libxslt-native util-linux"
16RPROVIDES_${PN} = "hotplug"
17
18SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
19 file://0001-Fixing-keyboard_force_release.sh-shell-script-path.patch \
20 file://avoid-mouse-autosuspend.patch \
21 file://run.rules \
22 file://udev.rules \
23 file://devfs-udev.rules \
24 file://links.conf \
25 file://permissions.rules \
26 file://local.rules \
27 file://udev-cache \
28 file://udev-cache.default \
29 file://add-install-ptest.patch \
30 file://fix_rule-syntax-regex-ptest.patch \
31 file://run-ptest \
32 file://init"
33
34inherit autotools pkgconfig update-rc.d ptest
35RDEPENDS_${PN}-ptest += "make perl python"
36
37libexecdir = "${base_libdir}"
38EXTRA_OECONF = "--disable-introspection \
39 --with-rootlibdir=${base_libdir} \
40 --with-pci-ids-path=${datadir}/pci.ids \
41 ac_cv_file__usr_share_pci_ids=no \
42 ac_cv_file__usr_share_hwdata_pci_ids=no \
43 ac_cv_file__usr_share_misc_pci_ids=yes \
44 --sbindir=${base_sbindir} \
45 --libexecdir=${nonarch_base_libdir} \
46 --with-rootlibdir=${base_libdir} \
47 --with-rootprefix= \
48 --without-systemdsystemunitdir \
49 "
50
51PACKAGES =+ "udev-cache"
52PACKAGES =+ "libudev"
53PACKAGES =+ "libgudev"
54
55INITSCRIPT_PACKAGES = "udev udev-cache"
56INITSCRIPT_NAME_udev = "udev"
57INITSCRIPT_PARAMS_udev = "start 04 S ."
58INITSCRIPT_NAME_udev-cache = "udev-cache"
59INITSCRIPT_PARAMS_udev-cache = "start 36 S ."
60
61FILES_${PN} += "${libexecdir} ${libdir}/ConsoleKit ${nonarch_base_libdir}/udev ${bindir}/udevadm"
62RRECOMMENDS_${PN} += "udev-cache"
63
64FILES_${PN}-dbg += "${libexecdir}/.debug"
65FILES_${PN}-dbg += "${base_libdir}/udev/.debug/"
66FILES_${PN}-dbg += "${base_libdir}/udev/.debug/*"
67FILES_${PN}-dbg += "${nonarch_base_libdir}/udev/.debug/*"
68FILES_${PN}-dev = "${datadir}/pkgconfig/udev.pc \
69 ${includedir}/libudev.h ${libdir}/libudev.so ${libdir}/libudev.la \
70 ${libdir}/libudev.a ${libdir}/pkgconfig/libudev.pc \
71 ${includedir}/gudev* ${libdir}/libgudev*.so ${libdir}/libgudev*.la \
72 ${libdir}/libgudev*.a ${libdir}/pkgconfig/gudev*.pc"
73FILES_libudev = "${base_libdir}/libudev.so.*"
74FILES_libgudev = "${base_libdir}/libgudev*.so.* ${libdir}/libgudev*.so.*"
75FILES_udev-cache = "${sysconfdir}/init.d/udev-cache ${sysconfdir}/default/udev-cache"
76
77do_install_append () {
78 install -d ${D}${sysconfdir}/init.d
79 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev
80 install -m 0755 ${WORKDIR}/udev-cache ${D}${sysconfdir}/init.d/udev-cache
81 sed -i s%@UDEVD@%${nonarch_base_libdir}/udev/udevd% ${D}${sysconfdir}/init.d/udev
82 sed -i s%@UDEVD@%${nonarch_base_libdir}/udev/udevd% ${D}${sysconfdir}/init.d/udev-cache
83
84 install -d ${D}${sysconfdir}/default
85 install -m 0755 ${WORKDIR}/udev-cache.default ${D}${sysconfdir}/default/udev-cache
86
87 touch ${D}${sysconfdir}/udev/cache.data
88
89 install -d ${D}${sysconfdir}/udev/rules.d/
90
91 install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules
92
93 # hid2hci has moved to bluez4. removed in udev as of version 169
94 rm -f ${D}${base_libdir}/udev/hid2hci
95
96 echo 'udev_run="/var/run/udev"' >> ${D}${sysconfdir}/udev/udev.conf
97}
98
99# As systemd also builds udev, skip this package if we're doing a systemd build.
100python () {
101 if bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d):
102 raise bb.parse.SkipPackage("'systemd' in DISTRO_FEATURES")
103}
104do_compile_ptest() {
105 oe_runmake test-udev
106}
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
new file mode 100644
index 0000000000..41deafa918
--- /dev/null
+++ b/meta/recipes-core/udev/udev/0001-Fixing-keyboard_force_release.sh-shell-script-path.patch
@@ -0,0 +1,35 @@
1From 0f8290c943da298abd269ca60fd8375dfb219971 Mon Sep 17 00:00:00 2001
2From: Alexandru DAMIAN <alexandru.damian@intel.com>
3Date: Thu, 12 Jul 2012 12:54:48 +0300
4Subject: [PATCH] Fixing keyboard_force_release.sh shell script path
5
6With the introduction of rootprefix, the keyboard-force-release.sh.in
7was modified to be executed with @rootprefix@/bin/sh, which is wrong
8because @rootprefix@ defaults to /usr (which is correct), but the
9shell is always at /bin/sh (IEEE Std 1003.2-1992).
10
11Therefore the interpreter for shell scripts needs to be /bin/sh at all times.
12
13The upstream moved to configurable root prefix, this patch taclkes a
14transition bug, and will not be applied upstream.
15
16Upstream-Status: Inappropriate [legacy version]
17
18Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
19---
20 src/keymap/keyboard-force-release.sh.in | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23diff --git a/src/keymap/keyboard-force-release.sh.in b/src/keymap/keyboard-force-release.sh.in
24index dd040ce..597a3a6 100755
25--- a/src/keymap/keyboard-force-release.sh.in
26+++ b/src/keymap/keyboard-force-release.sh.in
27@@ -1,4 +1,4 @@
28-#!@rootprefix@/bin/sh -e
29+#!/bin/sh -e
30 # read list of scancodes, convert hex to decimal and
31 # append to the atkbd force_release sysfs attribute
32 # $1 sysfs devpath for serioX
33--
341.7.9.5
35
diff --git a/meta/recipes-core/udev/udev/add-install-ptest.patch b/meta/recipes-core/udev/udev/add-install-ptest.patch
new file mode 100644
index 0000000000..bfc2e9409d
--- /dev/null
+++ b/meta/recipes-core/udev/udev/add-install-ptest.patch
@@ -0,0 +1,86 @@
1Adjustements for ptest:
2
3- Add 'install-ptest' rule.
4- Print a standard result line for each test.
5- Replace the use of "tree" with "find".
6
7Signed-off-by: Björn Stenberg <bjst@enea.com>
8Signed-off-by: Alexandra Safta <alst@enea.com>
9Upstream-Status: Pending
10
11Add missing files for rule-syntax-check
12- Add rule-syntax-check.py
13- Add the deployed udev rules to the testdata
14
15Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
16Upstream-Status: Pending
17--- a/Makefile.am 2012-03-18 16:28:14.000000000 +0100
18+++ b/Makefile.am 2013-02-18 10:03:36.531101244 +0100
19@@ -708,3 +708,18 @@
20 for i in src/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/libudev/; done
21 for i in src/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done
22 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
23+
24+RULES = rules/* src/accelerometer/61-accelerometer.rules \
25+ src/cdrom_id/60-cdrom_id.rules \
26+ src/keymap/95-keyboard-force-release.rules src/keymap/95-keymap.rules \
27+ src/mtd_probe/75-probe_mtd.rules src/v4l_id/60-persistent-v4l.rules
28+
29+install-ptest:
30+ install test-udev $(DESTDIR)
31+ cp Makefile $(DESTDIR)
32+ sed -i -e 's|^Makefile:|_Makefile:|' $(DESTDIR)/Makefile
33+ install -d $(DESTDIR)/test $(DESTDIR)/rules
34+ (cd $(top_srcdir) && install $(TESTS) $(DESTDIR)/test)
35+ (cd $(top_srcdir) && install test/rule-syntax-check.py $(DESTDIR)/test)
36+ (cd $(top_srcdir) && install $(RULES) $(DESTDIR)/rules)
37+ cp $(top_srcdir)/test/sys.tar.xz $(DESTDIR)/test/
38--- a/test/udev-test.pl 2012-03-18 16:43:36.000000000 +0100
39+++ b/test/udev-test.pl 2013-02-18 10:31:29.706357321 +0100
40@@ -1459,11 +1459,13 @@
41 print "add: error";
42 if ($rules->{exp_add_error}) {
43 print " as expected\n";
44+ print "XFAIL: TEST $number: $rules->{desc}: add\n";
45 } else {
46 print "\n";
47- system("tree $udev_root");
48+ system("find $udev_root");
49 print "\n";
50 $error++;
51+ print "FAIL: TEST $number: $rules->{desc}: add\n";
52 sleep(1);
53 }
54 }
55@@ -1479,15 +1481,18 @@
56 print "remove: error";
57 if ($rules->{exp_rem_error}) {
58 print " as expected\n";
59+ print "XFAIL: TEST $number: $rules->{desc}: remove\n";
60 } else {
61 print "\n";
62- system("tree $udev_root");
63+ system("find $udev_root");
64 print "\n";
65 $error++;
66+ print "FAIL: TEST $number: $rules->{desc}: remove\n";
67 sleep(1);
68 }
69 } else {
70 print "remove: ok\n";
71+ print "PASS: TEST $number: $rules->{desc}: remove\n";
72 }
73
74 print "\n";
75--- a/configure.ac 2013-11-28 09:14:02.814248826 +0100
76+++ b/configure.ac 2013-11-28 09:14:34.260874296 +0100
77@@ -6,7 +6,7 @@
78 [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html])
79 AC_CONFIG_SRCDIR([src/udevd.c])
80 AC_CONFIG_AUX_DIR([build-aux])
81-AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
82+AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
83 AC_USE_SYSTEM_EXTENSIONS
84 AC_SYS_LARGEFILE
85 AC_CONFIG_MACRO_DIR([m4])
86
diff --git a/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch b/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch
new file mode 100644
index 0000000000..2c31b33b02
--- /dev/null
+++ b/meta/recipes-core/udev/udev/avoid-mouse-autosuspend.patch
@@ -0,0 +1,25 @@
1Source: http://cgit.freedesktop.org/systemd/systemd/commit/rules/42-usb-hid-pm.rules?id=e0386cf2809219bbdd30895f46f1f567b56902b6
2
3Some USB ports on external hubs may be reported as "fixed". We only want
4to auto-enable this on ports that are internal to the machine, so check
5the parent state as well.
6
7Upstream-Status: backport
8
9Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
102013/09/13
11
12Index: udev-182/rules/42-usb-hid-pm.rules
13===================================================================
14--- udev-182.orig/rules/42-usb-hid-pm.rules
15+++ udev-182/rules/42-usb-hid-pm.rules
16@@ -46,4 +46,9 @@ ACTION=="add", SUBSYSTEM=="usb", ATTRS{i
17 ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}="0002", TEST=="power/control", ATTR{power/control}="auto"
18
19 # USB HID devices that are internal to the machine should also be safe to autosuspend
20+# And skip it for devices which are external but say "fixed"
21+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="removable", GOTO="usb_hid_pm_end"
22+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="unknown", GOTO="usb_hid_pm_end"
23 ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
24+LABEL="usb_hid_pm_end"
25+
diff --git a/meta/recipes-core/udev/udev/devfs-udev.rules b/meta/recipes-core/udev/udev/devfs-udev.rules
new file mode 100644
index 0000000000..0ba1ad4e7f
--- /dev/null
+++ b/meta/recipes-core/udev/udev/devfs-udev.rules
@@ -0,0 +1,108 @@
1# The use of these rules is not recommended or supported.
2# In a world where devices can come and go at any time, the devfs scheme
3# of simple device enumeration does not help _anything_. Just forget about
4# it. Use custom rules to name your device or look at the persistent device
5# naming scheme, which is implemented for disks and add your subsystem.
6
7# ide block devices
8BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}"
9
10# md block devices
11KERNEL="md[0-9]*", NAME="md/%n"
12
13# floppy devices
14KERNEL="fd[0-9]*", NAME="floppy/%n"
15
16# tty devices
17KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k"
18KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k"
19KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n"
20
21# vc devices
22KERNEL="vcs", NAME="vcc/0"
23KERNEL="vcs[0-9]*", NAME="vcc/%n"
24KERNEL="vcsa", NAME="vcc/a0"
25KERNEL="vcsa[0-9]*", NAME="vcc/a%n"
26
27# v4l devices
28KERNEL="video[0-9]*", NAME="v4l/video%n"
29KERNEL="radio[0-9]*", NAME="v4l/radio%n"
30KERNEL="vbi[0-9]*", NAME="v4l/vbi%n"
31KERNEL="vtx[0-9]*", NAME="v4l/vtx%n"
32
33# dm devices (ignore them)
34KERNEL="dm-[0-9]*", NAME=""
35
36# i2c devices
37KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k"
38
39# loop devices
40KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k"
41
42# ramdisks
43KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k"
44
45# framebuffer devices
46KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k"
47
48# misc
49KERNEL="rtc", NAME="misc/%k", SYMLINK="%k"
50KERNEL="psaux", NAME="misc/%k", SYMLINK="%k"
51KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k"
52KERNEL="rtc", NAME="misc/%k", SYMLINK="%k"
53KERNEL="psaux", NAME="misc/%k", SYMLINK="%k"
54KERNEL="uinput", NAME="misc/%k", SYMLINK="%k"
55
56# alsa devices
57KERNEL="controlC[0-9]*", NAME="snd/%k"
58KERNEL="hw[CD0-9]*", NAME="snd/%k"
59KERNEL="pcm[CD0-9cp]*", NAME="snd/%k"
60KERNEL="midi[CD0-9]*", NAME="snd/%k"
61KERNEL="timer", NAME="snd/%k"
62KERNEL="seq", NAME="snd/%k"
63
64# oss devices
65KERNEL="audio*", NAME="sound/%k", SYMLINK="%k"
66KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k"
67KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k"
68KERNEL="midi*", NAME="sound/%k", SYMLINK="%k"
69KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k"
70KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k"
71
72# input devices
73KERNEL="mice", NAME="input/%k"
74KERNEL="mouse*", NAME="input/%k"
75KERNEL="event*", NAME="input/%k"
76KERNEL="js*", NAME="input/%k"
77KERNEL="ts*", NAME="input/%k"
78
79# USB devices
80KERNEL="hiddev*", NAME="usb/%k"
81KERNEL="auer*", NAME="usb/%k"
82KERNEL="legousbtower*", NAME="usb/%k"
83KERNEL="dabusb*", NAME="usb/%k"
84BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k"
85
86# netlink devices
87KERNEL="route", NAME="netlink/%k"
88KERNEL="skip", NAME="netlink/%k"
89KERNEL="usersock", NAME="netlink/%k"
90KERNEL="fwmonitor", NAME="netlink/%k"
91KERNEL="tcpdiag", NAME="netlink/%k"
92KERNEL="nflog", NAME="netlink/%k"
93KERNEL="xfrm", NAME="netlink/%k"
94KERNEL="arpd", NAME="netlink/%k"
95KERNEL="route6", NAME="netlink/%k"
96KERNEL="ip6_fw", NAME="netlink/%k"
97KERNEL="dnrtmsg", NAME="netlink/%k"
98KERNEL="tap*", NAME="netlink/%k"
99
100# CAPI devices
101KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20"
102KERNEL="capi*", NAME="capi/%n"
103
104# Network devices
105KERNEL="tun", NAME="net/%k"
106
107# raw devices
108KERNEL="raw[0-9]*", NAME="raw/%k"
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
new file mode 100644
index 0000000000..548a241d8a
--- /dev/null
+++ b/meta/recipes-core/udev/udev/fix_rule-syntax-regex-ptest.patch
@@ -0,0 +1,59 @@
1The rule-syntax-check script fails with errors like this:
2
3Invalid 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"
4(' clause:', 'ATTR{[dmi/id]product_name}=="W3J"')
5()
6
7
8Move line comment from end of rules file to its own line, the regex used to
9test correct syntax choke on it.
10
11The rule-syntax-check.py uses regex which errournessly complains on ATTR rules
12of the form ATTR{[dmi/id]board_name}=="30B7"
13Use the regex from systemd's script which allow [] characters and additional
14compare operators
15
16The Makefile passes rules-test.sh script a build host path to the testdata.
17Ignore the argument and use a relative path instead.
18
19
20Signed-off-by: Max Krummenacher <max.oss.09@gmail.com>
21Upstream status pending
22Upstream status Inappropriate (cross environment path)
23
24diff -Naur udev-182.orig/src/keymap/95-keymap.rules udev-182/src/keymap/95-keymap.rules
25--- udev-182.orig/src/keymap/95-keymap.rules 2012-02-07 00:01:55.154640792 +0100
26+++ udev-182/src/keymap/95-keymap.rules 2015-01-24 20:58:40.156930520 +0100
27@@ -94,7 +94,8 @@
28 ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www"
29 ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill"
30 # HP Pavillion dv6315ea has empty DMI_VENDOR
31-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
32+# "quick play"
33+ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media"
34
35 # Gateway clone of Acer Aspire One AOA110/AOA150
36 ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer"
37diff -Naur udev-182.orig/test/rule-syntax-check.py udev-182/test/rule-syntax-check.py
38--- udev-182.orig/test/rule-syntax-check.py 2012-02-15 20:10:12.872333342 +0100
39+++ udev-182/test/rule-syntax-check.py 2015-01-24 21:08:00.496049600 +0100
40@@ -28,7 +28,7 @@
41 no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$')
42 args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$')
43 no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$')
44-args_assign = re.compile('(ATTR|ENV|IMPORT){([a-zA-Z0-9/_.*%-]+)}\s*=\s*"([^"]*)"$')
45+args_assign = re.compile('(ATTR|ENV|IMPORT|RUN){([][a-zA-Z0-9/_.*%-]+)}\s*(=|==|\+=)\s*"([^"]*)"$')
46
47 result = 0
48 buffer = ''
49--- udev-182.orig/test/rules-test.sh 2012-01-29 01:15:46.000000000 +0100
50+++ udev-182/test/rules-test.sh 2015-01-24 17:53:51.201858658 +0100
51@@ -4,7 +4,7 @@
52 # (C) 2010 Canonical Ltd.
53 # Author: Martin Pitt <martin.pitt@ubuntu.com>
54
55-[ -n "$srcdir" ] || srcdir=`dirname $0`/..
56+srcdir=`dirname $0`/..
57
58 # skip if we don't have python
59 type python >/dev/null 2>&1 || {
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
new file mode 100644
index 0000000000..d26cbfca96
--- /dev/null
+++ b/meta/recipes-core/udev/udev/init
@@ -0,0 +1,140 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: udev
5# Required-Start: mountvirtfs
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: Start udevd, populate /dev and load drivers.
10### END INIT INFO
11
12export TZ=/etc/localtime
13
14[ -d /sys/class ] || exit 1
15[ -r /proc/mounts ] || exit 1
16[ -x @UDEVD@ ] || exit 1
17SYSCONF_CACHED="/etc/udev/cache.data"
18SYSCONF_TMP="/dev/shm/udev.cache"
19[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
20[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
21[ -f /etc/default/rcS ] && . /etc/default/rcS
22
23readfiles () {
24 READDATA=""
25 for filename in $@; do
26 if [ -r $filename ]; then
27 while read line; do
28 READDATA="$READDATA$line"
29 done < $filename
30 fi
31 done
32}
33
34kill_udevd () {
35 pid=`pidof -x udevd`
36 [ -n "$pid" ] && kill $pid
37}
38
39case "$1" in
40 start)
41 export ACTION=add
42 # propagate /dev from /sys
43 echo "Starting udev"
44
45 # Check for requireed devtmpfs before trying to start udev and
46 # mount a no-existant fs.
47 if ! grep -q devtmpfs /proc/filesystems
48 then
49 echo "Missing devtmpfs, which is required for udev to run";
50 echo "Halting..."
51 halt
52 fi
53 # mount the devtmpfs on /dev, if not already done
54 LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && {
55 mount -n -o mode=0755 -t devtmpfs none "/dev"
56 }
57 [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
58 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
59 # the automount rule for udev needs /tmp directory available, as /tmp is a symlink
60 # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure
61 # /var/volatile/tmp directory to be available.
62 mkdir -m 1777 -p /var/volatile/tmp
63
64 # Cache handling.
65 # A list of files which are used as a criteria to judge whether the udev cache could be reused.
66 CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
67 if [ "$DEVCACHE" != "" ]; then
68 if [ -e $DEVCACHE ]; then
69 readfiles $CMP_FILE_LIST
70 NEWDATA="$READDATA"
71 readfiles "$SYSCONF_CACHED"
72 OLDDATA="$READDATA"
73 if [ "$OLDDATA" = "$NEWDATA" ]; then
74 tar xmf $DEVCACHE -C / -m
75 not_first_boot=1
76 [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
77 [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP"
78 else
79 # Output detailed reason why the cached /dev is not used
80 if [ "$VERBOSE" != "no" ]; then
81 echo "udev: udev cache not used"
82 echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
83 echo "udev: olddata: $OLDDATA"
84 echo "udev: newdata: $NEWDATA"
85 fi
86 echo "$NEWDATA" > "$SYSCONF_TMP"
87 fi
88 else
89 if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
90 # If rootfs is not read-only, it's possible that a new udev cache would be generated;
91 # otherwise, we do not bother to read files.
92 readfiles $CMP_FILE_LIST
93 echo "$READDATA" > "$SYSCONF_TMP"
94 fi
95 fi
96 fi
97
98 # make_extra_nodes
99 kill_udevd > "/dev/null" 2>&1
100
101 # trigger the sorted events
102 [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
103 @UDEVD@ -d
104
105 udevadm control --env=STARTUP=1
106 if [ "$not_first_boot" != "" ];then
107 if [ "$PROBE_PLATFORM_BUS" != "yes" ]; then
108 PLATFORM_BUS_NOMATCH="--subsystem-nomatch=platform"
109 else
110 PLATFORM_BUS_NOMATCH=""
111 fi
112 udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux $PLATFORM_BUS_NOMATCH
113 (udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
114 else
115 udevadm trigger --action=add
116 udevadm settle
117 fi
118 ;;
119 stop)
120 echo "Stopping udevd"
121 start-stop-daemon --stop --name udevd --quiet
122 ;;
123 restart)
124 $0 stop
125 sleep 1
126 $0 start
127 ;;
128 status)
129 pid=`pidof -x udevd`
130 if [ -n "$pid" ]; then
131 echo "udevd (pid $pid) is running ..."
132 else
133 echo "udevd is stopped"
134 fi
135 ;;
136 *)
137 echo "Usage: $0 {start|stop|status|restart}"
138 exit 1
139esac
140exit 0
diff --git a/meta/recipes-core/udev/udev/links.conf b/meta/recipes-core/udev/udev/links.conf
new file mode 100644
index 0000000000..8fff922db6
--- /dev/null
+++ b/meta/recipes-core/udev/udev/links.conf
@@ -0,0 +1,21 @@
1# This file does not exist. Please do not ask the debian maintainer about it.
2# You may use it to do strange and wonderful things, at your risk.
3
4L fd /proc/self/fd
5L stdin /proc/self/fd/0
6L stdout /proc/self/fd/1
7L stderr /proc/self/fd/2
8L core /proc/kcore
9L sndstat /proc/asound/oss/sndstat
10L MAKEDEV /sbin/MAKEDEV
11
12D pts
13D shm
14
15# Hic sunt leones.
16M ppp c 108 0
17D loop
18M loop/0 b 7 0
19D net
20M net/tun c 10 200
21
diff --git a/meta/recipes-core/udev/udev/local.rules b/meta/recipes-core/udev/udev/local.rules
new file mode 100644
index 0000000000..9d4da493f7
--- /dev/null
+++ b/meta/recipes-core/udev/udev/local.rules
@@ -0,0 +1,22 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# Try and modprobe for drivers for new hardware
17ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
18
19# Create a symlink to any touchscreen input device
20# Trigger based on input type, that the evbit (-e) has EV_SYN and EV_ABS,
21# has an EV_ABS value (-a) which is used for touchscreen type devices.
22SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", SYMLINK+="input/touchscreen0"
diff --git a/meta/recipes-core/udev/udev/permissions.rules b/meta/recipes-core/udev/udev/permissions.rules
new file mode 100644
index 0000000000..205b733292
--- /dev/null
+++ b/meta/recipes-core/udev/udev/permissions.rules
@@ -0,0 +1,131 @@
1ACTION!="add", GOTO="permissions_end"
2
3# workarounds needed to synchronize with sysfs
4# only needed for kernels < v2.6.18-rc1
5ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
6SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt"
7# only needed for kernels < 2.6.16
8SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
9# only needed for kernels < 2.6.17
10SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver"
11
12# devices needed to load the drivers providing them
13KERNEL=="tun", OPTIONS+="ignore_remove"
14KERNEL=="ppp", OPTIONS+="ignore_remove"
15KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove"
16
17# default permissions for block devices
18SUBSYSTEM=="block", GROUP="disk"
19# the aacraid driver is broken and reports that disks removable (see #404927)
20SUBSYSTEM=="block", ATTRS{removable}=="1", \
21 DRIVERS!="aacraid", GROUP="floppy"
22# all block devices on these buses are "removable"
23SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy"
24
25# IDE devices
26KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \
27 IMPORT{program}="cdrom_id --export $tempnode"
28ENV{ID_CDROM}=="?*", GROUP="cdrom"
29KERNEL=="ht[0-9]*", GROUP="tape"
30KERNEL=="nht[0-9]*", GROUP="tape"
31
32# SCSI devices
33KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode"
34SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape"
35SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner"
36SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner"
37SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner"
38SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom"
39SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom"
40SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner"
41SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape"
42
43# USB devices
44KERNEL=="legousbtower*", MODE="0666"
45KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp"
46
47# usbfs-like devices
48SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \
49 MODE="0664"
50
51# iRiver music players
52SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \
53 ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]"
54
55# serial devices
56SUBSYSTEM=="tty", GROUP="dialout"
57SUBSYSTEM=="capi", GROUP="dialout"
58SUBSYSTEM=="slamr", GROUP="dialout"
59SUBSYSTEM=="zaptel", GROUP="dialout"
60
61# vc devices (all members of the tty subsystem)
62KERNEL=="ptmx", MODE="0666", GROUP="root"
63KERNEL=="console", MODE="0600", GROUP="root"
64KERNEL=="tty", MODE="0666", GROUP="root"
65KERNEL=="tty[0-9]*", GROUP="root"
66KERNEL=="pty*", MODE="0666", GROUP="tty"
67
68# video devices
69SUBSYSTEM=="video4linux", GROUP="video"
70SUBSYSTEM=="drm", GROUP="video"
71SUBSYSTEM=="dvb", GROUP="video"
72SUBSYSTEM=="em8300", GROUP="video"
73SUBSYSTEM=="graphics", GROUP="video"
74SUBSYSTEM=="nvidia", GROUP="video"
75
76# misc devices
77KERNEL=="random", MODE="0666"
78KERNEL=="urandom", MODE="0666"
79KERNEL=="mem", MODE="0640", GROUP="kmem"
80KERNEL=="kmem", MODE="0640", GROUP="kmem"
81KERNEL=="port", MODE="0640", GROUP="kmem"
82KERNEL=="full", MODE="0666"
83KERNEL=="null", MODE="0666"
84KERNEL=="zero", MODE="0666"
85KERNEL=="inotify", MODE="0666"
86KERNEL=="sgi_fetchop", MODE="0666"
87KERNEL=="sonypi", MODE="0666"
88KERNEL=="agpgart", GROUP="video"
89KERNEL=="nvram", GROUP="nvram"
90KERNEL=="rtc|rtc[0-9]*", GROUP="audio"
91KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss"
92KERNEL=="fuse", GROUP="fuse"
93KERNEL=="kqemu", MODE="0666"
94KERNEL=="kvm", GROUP="kvm"
95KERNEL=="tun", MODE="0666",
96
97KERNEL=="cdemu[0-9]*", GROUP="cdrom"
98KERNEL=="pktcdvd[0-9]*", GROUP="cdrom"
99KERNEL=="pktcdvd", MODE="0644"
100
101KERNEL=="uverbs*", GROUP="rdma"
102KERNEL=="ucm*", GROUP="rdma"
103KERNEL=="rdma_ucm", GROUP="rdma"
104
105# printers and parallel devices
106SUBSYSTEM=="printer", GROUP="lp"
107SUBSYSTEM=="ppdev", GROUP="lp"
108KERNEL=="irlpt*", GROUP="lp"
109KERNEL=="pt[0-9]*", GROUP="tape"
110KERNEL=="pht[0-9]*", GROUP="tape"
111
112# sound devices
113SUBSYSTEM=="sound", GROUP="audio"
114
115# ieee1394 devices
116KERNEL=="raw1394", GROUP="disk"
117KERNEL=="dv1394*", GROUP="video"
118KERNEL=="video1394*", GROUP="video"
119
120# input devices
121KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \
122 MODE="0664", GROUP="video"
123KERNEL=="js[0-9]*", MODE="0664"
124KERNEL=="lirc[0-9]*", GROUP="video"
125
126# AOE character devices
127SUBSYSTEM=="aoe", MODE="0220", GROUP="disk"
128SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
129
130LABEL="permissions_end"
131
diff --git a/meta/recipes-core/udev/udev/run-ptest b/meta/recipes-core/udev/udev/run-ptest
new file mode 100644
index 0000000000..0e39806b01
--- /dev/null
+++ b/meta/recipes-core/udev/udev/run-ptest
@@ -0,0 +1,5 @@
1#!/bin/sh
2
3tar -C test/ -xJf test/sys.tar.xz
4make -k check-TESTS
5make test-sys-distclean
diff --git a/meta/recipes-core/udev/udev/run.rules b/meta/recipes-core/udev/udev/run.rules
new file mode 100644
index 0000000000..75d71375bb
--- /dev/null
+++ b/meta/recipes-core/udev/udev/run.rules
@@ -0,0 +1,14 @@
1# debugging monitor
2RUN+="socket:/org/kernel/udev/monitor"
3
4# run a command on remove events
5ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}"
6
7# ignore the events generated by virtual consoles
8KERNEL=="ptmx", OPTIONS+="last_rule"
9KERNEL=="console", OPTIONS+="last_rule"
10KERNEL=="tty" , OPTIONS+="last_rule"
11KERNEL=="tty[0-9]*", OPTIONS+="last_rule"
12KERNEL=="pty*", OPTIONS+="last_rule"
13SUBSYSTEM=="vc", OPTIONS+="last_rule"
14
diff --git a/meta/recipes-core/udev/udev/udev-cache b/meta/recipes-core/udev/udev/udev-cache
new file mode 100644
index 0000000000..497d257397
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev-cache
@@ -0,0 +1,38 @@
1#!/bin/sh -e
2
3### BEGIN INIT INFO
4# Provides: udev-cache
5# Required-Start: mountall
6# Required-Stop:
7# Default-Start: S
8# Default-Stop:
9# Short-Description: cache /dev to speedup the udev next boot
10### END INIT INFO
11
12export TZ=/etc/localtime
13
14[ -r /proc/mounts ] || exit 1
15[ -x @UDEVD@ ] || exit 1
16[ -d /sys/class ] || exit 1
17
18[ -f /etc/default/rcS ] && . /etc/default/rcS
19DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar"
20SYSCONF_CACHED="/etc/udev/cache.data"
21SYSCONF_TMP="/dev/shm/udev.cache"
22[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
23
24if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
25 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
26 exit 0
27fi
28
29if [ "$DEVCACHE" != "" -a -e "$SYSCONF_TMP" ]; then
30 echo "Populating dev cache"
31 find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \
32 | xargs tar cf "${DEVCACHE_TMP}" -T-
33 gzip < "${DEVCACHE_TMP}" > "$DEVCACHE"
34 rm -f "${DEVCACHE_TMP}"
35 mv "$SYSCONF_TMP" "$SYSCONF_CACHED"
36fi
37
38exit 0
diff --git a/meta/recipes-core/udev/udev/udev-cache.default b/meta/recipes-core/udev/udev/udev-cache.default
new file mode 100644
index 0000000000..a3b732698d
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev-cache.default
@@ -0,0 +1,5 @@
1# Default for /etc/init.d/udev
2
3# Comment this out to disable device cache
4DEVCACHE="/etc/udev-cache.tar.gz"
5PROBE_PLATFORM_BUS="yes"
diff --git a/meta/recipes-core/udev/udev/udev.rules b/meta/recipes-core/udev/udev/udev.rules
new file mode 100644
index 0000000000..a19d4a0bf6
--- /dev/null
+++ b/meta/recipes-core/udev/udev/udev.rules
@@ -0,0 +1,116 @@
1# There are a number of modifiers that are allowed to be used in some
2# of the different fields. They provide the following subsitutions:
3#
4# %n the "kernel number" of the device.
5# For example, 'sda3' has a "kernel number" of '3'
6# %e the smallest number for that name which does not matches an existing node
7# %k the kernel name for the device
8# %M the kernel major number for the device
9# %m the kernel minor number for the device
10# %b the bus id for the device
11# %c the string returned by the PROGRAM
12# %s{filename} the content of a sysfs attribute
13# %% the '%' char itself
14#
15
16# workaround for devices which do not report media changes
17SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \
18 ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions"
19SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \
20 OPTIONS+="all_partitions"
21
22# SCSI devices
23SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n"
24
25# USB devices
26SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k"
27SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k"
28SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k"
29SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k"
30SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k"
31SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k"
32SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \
33 ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \
34 SYMLINK+="pilot"
35
36# usbfs-like devices
37SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \
38 NAME="%c"
39SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}"
40
41# serial devices
42KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20"
43KERNEL=="capi[0-9]*", NAME="capi/%n"
44
45# video devices
46KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \
47 NAME="%c"
48KERNEL=="card[0-9]*", NAME="dri/%k"
49
50# misc devices
51KERNEL=="hw_random", NAME="hwrng"
52KERNEL=="tun", NAME="net/%k"
53KERNEL=="evtchn", NAME="xen/%k"
54
55KERNEL=="cdemu[0-9]*", NAME="cdemu/%n"
56KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n"
57KERNEL=="pktcdvd", NAME="pktcdvd/control"
58
59KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid"
60KERNEL=="msr[0-9]*", NAME="cpu/%n/msr"
61KERNEL=="microcode", NAME="cpu/microcode"
62
63KERNEL=="umad*", NAME="infiniband/%k"
64KERNEL=="issm*", NAME="infiniband/%k"
65KERNEL=="uverbs*", NAME="infiniband/%k"
66KERNEL=="ucm*", NAME="infiniband/%k"
67KERNEL=="rdma_ucm", NAME="infiniband/%k"
68
69# ALSA devices
70KERNEL=="controlC[0-9]*", NAME="snd/%k"
71KERNEL=="hwC[D0-9]*", NAME="snd/%k"
72KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k"
73KERNEL=="midiC[D0-9]*", NAME="snd/%k"
74KERNEL=="timer", NAME="snd/%k"
75KERNEL=="seq", NAME="snd/%k"
76
77# ieee1394 devices
78KERNEL=="dv1394*", NAME="dv1394/%n"
79KERNEL=="video1394*", NAME="video1394/%n"
80
81# input devices
82KERNEL=="mice", NAME="input/%k"
83KERNEL=="mouse[0-9]*", NAME="input/%k"
84KERNEL=="event[0-9]*", NAME="input/%k"
85KERNEL=="js[0-9]*", NAME="input/%k"
86KERNEL=="ts[0-9]*", NAME="input/%k"
87KERNEL=="uinput", NAME="input/%k"
88
89# Zaptel
90KERNEL=="zapctl", NAME="zap/ctl"
91KERNEL=="zaptimer", NAME="zap/timer"
92KERNEL=="zapchannel", NAME="zap/channel"
93KERNEL=="zappseudo", NAME="zap/pseudo"
94KERNEL=="zap[0-9]*", NAME="zap/%n"
95
96# AOE character devices
97SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k"
98SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k"
99SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k"
100SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k"
101
102# device mapper creates its own device nodes, so ignore these
103KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device"
104KERNEL=="device-mapper", NAME="mapper/control"
105
106KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660"
107
108# Firmware Helper
109ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh"
110
111# Samsung UARTS
112KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n"
113
114# MXC UARTs
115KERNEL=="ttymxc[0-4]", NAME="ttymxc%n"
116
diff --git a/meta/recipes-core/udev/udev_182.bb b/meta/recipes-core/udev/udev_182.bb
new file mode 100644
index 0000000000..b216352035
--- /dev/null
+++ b/meta/recipes-core/udev/udev_182.bb
@@ -0,0 +1,9 @@
1include udev.inc
2
3PR = "r9"
4
5# module-init-tools from kmod_git will provide libkmod runtime
6DEPENDS += "module-init-tools"
7
8SRC_URI[md5sum] = "1b964456177fbf48023dfee7db3a708d"
9SRC_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
new file mode 100644
index 0000000000..fb443ff15e
--- /dev/null
+++ b/meta/recipes-core/update-rc.d/update-rc.d/add-verbose.patch
@@ -0,0 +1,49 @@
1Upstream-Status: Pending
2
3--- update-rc.d/update-rc.d.org 2005-01-03 00:30:47.000000000 +0200
4+++ update-rc.d/update-rc.d 2007-12-01 19:41:08.000000000 +0200
5@@ -19,6 +19,7 @@
6 notreally=0
7 force=0
8 dostart=0
9+verbose=0
10
11 usage()
12 {
13@@ -28,6 +29,7 @@
14 update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] .
15 -n: not really
16 -f: force
17+ -v: verbose
18 -r: alternate root path (default is /)
19 -s: invoke start methods if appropriate to current runlevel
20 EOF
21@@ -69,7 +71,7 @@
22 lev=`echo $2 | cut -d/ -f1`
23 nn=`echo $2 | cut -d/ -f2`
24 fn="${etcd}${lev}.d/${startstop}${nn}${bn}"
25- echo " $fn -> ../init.d/$bn"
26+ [ $verbose -eq 1 ] && echo " $fn -> ../init.d/$bn"
27 if [ $notreally -eq 0 ]; then
28 mkdir -p `dirname $fn`
29 ln -s ../init.d/$bn $fn
30@@ -89,7 +91,7 @@
31 exit 0
32 fi
33
34- echo " Adding system startup for $initd/$bn ..."
35+ echo " Adding system startup for $initd/$bn."
36
37 for i in $startlinks; do
38 dolink S $i
39@@ -105,6 +107,10 @@
40 shift
41 continue
42 ;;
43+ -v) verbose=1
44+ shift
45+ continue
46+ ;;
47 -f) force=1
48 shift
49 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
new file mode 100644
index 0000000000..075171a5a3
--- /dev/null
+++ b/meta/recipes-core/update-rc.d/update-rc.d/check-if-symlinks-are-valid.patch
@@ -0,0 +1,59 @@
1Check if symlinks are valid
2
3When using root option and $initd/$bn is a symlink, the script would fail because
4the symlink points to a path on target. For example:
5
6/path/to/target/rootfs/etc/init.d/syslog -> /etc/init.d/syslog.busybox
7
8Hence, [ -f /path/to/target/rootfs/etc/init.d/syslog ] condition would return
9false.
10
11This patch adds the posibility to check whether the file the symlink points to
12actually exists in rootfs path and then continue.
13
14Upstream-Status: Pending
15
16Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
17Signed-off-by: Christopher Larson <chris_larson@mentor.com>
18
19Index: git/update-rc.d
20===================================================================
21--- git.orig/update-rc.d
22+++ git/update-rc.d
23@@ -147,13 +147,34 @@ fi
24 bn=$1
25 shift
26
27+sn=$initd/$bn
28+if [ -L "$sn" -a -n "$root" ]; then
29+ if which readlink >/dev/null; then
30+ while true; do
31+ linksn="$(readlink "$sn")"
32+ if [ -z "$linksn" ]; then
33+ break
34+ fi
35+
36+ sn="$linksn"
37+ case "$sn" in
38+ /*) sn="$root$sn" ;;
39+ *) sn="$initd/$sn" ;;
40+ esac
41+ done
42+ else
43+ echo "update-rc.d: readlink tool not present, cannot check whether \
44+ $sn symlink points to a valid file." >&2
45+ fi
46+fi
47+
48 if [ $1 != "remove" ]; then
49- if [ ! -f "$initd/$bn" ]; then
50+ if [ ! -f "$sn" ]; then
51 echo "update-rc.d: $initd/$bn: file does not exist" >&2
52 exit 1
53 fi
54 else
55- if [ -f "$initd/$bn" ]; then
56+ if [ -f "$sn" ]; then
57 if [ $force -eq 1 ]; then
58 echo "update-rc.d: $initd/$bn exists during rc.d purge (continuing)" >&2
59 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
new file mode 100644
index 0000000000..85bc234a27
--- /dev/null
+++ b/meta/recipes-core/update-rc.d/update-rc.d/fix-to-handle-priority-numbers-correctly.patch
@@ -0,0 +1,28 @@
1Upstream-Status: Pending
2
3Fix to handle priority numbers correctly.
4Previously, if the priority number is '08' or '09', for example,
5the script cannot handle them correctly as these numbers are treated
6as octal numbers.
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 update-rc.d | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/update-rc.d b/update-rc.d
14index ec50d15..c70b859 100644
15--- a/update-rc.d
16+++ b/update-rc.d
17@@ -205,7 +205,7 @@ case $1 in
18 exit 1
19 fi
20 shift
21- NN=`printf %02d $1`
22+ NN=`printf %02d $(expr $1 + 0)`
23 shift
24 while [ "x$1" != "x." ]; do
25 if [ $# -eq 0 ]; then
26--
271.7.9.5
28
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
new file mode 100644
index 0000000000..c15cb78033
--- /dev/null
+++ b/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb
@@ -0,0 +1,31 @@
1SUMMARY = "manage symlinks in /etc/rcN.d"
2DESCRIPTION = "update-rc.d is a utilities that allows the management of symlinks to the initscripts in the /etc/rcN.d directory structure."
3SECTION = "base"
4
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://update-rc.d;beginline=5;endline=15;md5=148a48321b10eb37c1fa3ee02b940a75"
7
8PR = "r5"
9
10# Revision corresponding to tag update-rc.d_0.7
11SRCREV = "eca680ddf28d024954895f59a241a622dd575c11"
12
13SRC_URI = "git://github.com/philb/update-rc.d.git \
14 file://add-verbose.patch \
15 file://check-if-symlinks-are-valid.patch \
16 file://fix-to-handle-priority-numbers-correctly.patch \
17 "
18
19S = "${WORKDIR}/git"
20
21inherit allarch
22
23do_compile() {
24}
25
26do_install() {
27 install -d ${D}${sbindir}
28 install -m 0755 ${S}/update-rc.d ${D}${sbindir}/update-rc.d
29}
30
31BBCLASSEXTEND = "native"
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
new file mode 100644
index 0000000000..dbc6a2856f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -0,0 +1,276 @@
1SUMMARY = "A suite of basic system administration utilities"
2DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
3commonly found on most Linux systems. Some of the more important utilities include \
4disk partitioning, kernel message management, filesystem creation, and system login."
5
6SECTION = "base"
7
8LICENSE = "GPLv2+ & LGPLv2.1+ & BSD"
9
10LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c \
11 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
12 file://Documentation/licenses/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
13 file://Documentation/licenses/COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \
14 file://Documentation/licenses/COPYING.BSD-3;md5=58dcd8452651fc8b07d1f65ce07ca8af \
15 file://Documentation/licenses/COPYING.UCB;md5=263860f8968d8bafa5392cab74285262 \
16 file://libuuid/COPYING;md5=b442ffb762cf8d3e9df1b99e0bb4af70 \
17 file://libmount/COPYING;md5=fb93f01d4361069c5616327705373b16 \
18 file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16"
19
20inherit autotools gettext pkgconfig systemd ptest
21DEPENDS = "zlib ncurses"
22DEPENDS_append_class-native = " lzo-native"
23DEPENDS_append_class-nativesdk = " lzo-native"
24
25SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
26 file://MCONFIG \
27 file://defines.h \
28 file://make_include \
29 file://swapargs.h \
30 file://ptest.patch \
31 file://run-ptest \
32 file://avoid_unsupported_find_opts.patch \
33 file://avoid_unsupported_grep_opts.patch \
34 file://avoid_unsupported_sleep_param.patch \
35 file://display_testname_for_subtest.patch \
36 "
37
38PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \
39 util-linux-swaponoff util-linux-losetup util-linux-umount \
40 util-linux-mount util-linux-readprofile util-linux-libblkid \
41 util-linux-libmount util-linux-libuuid util-linux-uuidd \
42 util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
43 util-linux-mkfs util-linux-mcookie util-linux-reset \
44 util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \
45 util-linux-partx ${PN}-bash-completion util-linux-hwclock \
46 util-linux-findfs"
47
48SHARED_EXTRA_OECONF = "--disable-use-tty-group \
49 --disable-makeinstall-chown \
50 --enable-kill --enable-last --enable-mesg --enable-partx \
51 --enable-raw --enable-reset --disable-login \
52 --disable-vipw --disable-newgrp --disable-chfn-chsh \
53 --enable-write --enable-mount \
54 --enable-libuuid --enable-libblkid --enable-fsck --without-udev \
55 usrsbin_execdir='${sbindir}' \
56"
57
58EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
59
60PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
61 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} "
62PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
63
64# Respect the systemd feature for uuidd
65PACKAGECONFIG[systemd] = "--enable-socket-activation --with-systemdsystemunitdir=${systemd_unitdir}/system/, --disable-socket-activation --without-systemdsystemunitdir"
66
67# Build setpriv requires libcap-ng
68PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
69
70FILES_${PN}-bash-completion += "${datadir}/bash-completion"
71FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
72
73FILES_util-linux-agetty = "${base_sbindir}/agetty"
74FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}"
75FILES_util-linux-fstrim = "${base_sbindir}/fstrim"
76FILES_util-linux-cfdisk = "${base_sbindir}/cfdisk"
77FILES_util-linux-sfdisk = "${sbindir}/sfdisk"
78FILES_util-linux-swaponoff = "${base_sbindir}/swapon.${BPN} ${base_sbindir}/swapoff.${BPN}"
79FILES_util-linux-losetup = "${base_sbindir}/losetup.${BPN}"
80FILES_util-linux-mount = "${base_bindir}/mount.${BPN}"
81FILES_util-linux-mcookie = "${bindir}/mcookie"
82FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
83FILES_util-linux-readprofile = "${base_sbindir}/readprofile.${BPN}"
84FILES_util-linux-uuidgen = "${bindir}/uuidgen"
85FILES_util-linux-uuidd = "${sbindir}/uuidd"
86FILES_util-linux-reset = "${base_bindir}/reset"
87FILES_util-linux-partx = "${sbindir}/partx"
88FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
89FILES_util-linux-findfs = "${sbindir}/findfs"
90
91FILES_util-linux-libblkid = "${base_libdir}/libblkid.so.*"
92FILES_util-linux-libmount = "${base_libdir}/libmount.so.*"
93FILES_util-linux-libuuid = "${base_libdir}/libuuid.so.*"
94FILES_util-linux-lscpu = "${bindir}/lscpu"
95
96FILES_util-linux-fsck = "${base_sbindir}/fsck*"
97FILES_util-linux-mkfs = "${sbindir}/mkfs"
98
99FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs"
100FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
101
102
103# Util-linux' blkid replaces the e2fsprogs one
104FILES_util-linux-blkid = "${base_sbindir}/blkid*"
105RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
106RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
107
108# reset calls 'tput'
109RDEPENDS_util-linux-reset += "ncurses"
110
111RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup"
112RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs "
113
114RRECOMMENDS_${PN}_class-native = ""
115RRECOMMENDS_${PN}_class-nativesdk = ""
116RDEPENDS_${PN}_class-native = ""
117RDEPENDS_${PN}_class-nativesdk = ""
118
119RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev"
120
121SYSTEMD_PACKAGES = "${PN}-uuidd"
122SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.service"
123
124do_compile () {
125 set -e
126 install ${WORKDIR}/MCONFIG ${S}/MCONFIG
127 install ${WORKDIR}/make_include ${S}/make_include
128 install ${WORKDIR}/swapargs.h ${S}/mount-deprecated/swapargs.h
129 install ${WORKDIR}/defines.h ${S}/defines.h
130 oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'
131}
132
133do_install () {
134 # with ccache the timestamps on compiled files may
135 # end up earlier than on their inputs, this allows
136 # for the resultant compilation in the install step.
137 oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \
138 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \
139 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
140
141 mkdir -p ${D}${base_bindir}
142
143 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
144 sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk readprofile fsck blkid blockdev fstrim sulogin switch_root"
145 usrbinprogs_a="chfn chsh hexdump last logger mesg newgrp renice utmpdump wall setsid chrt flock getopt"
146 binprogs_a="dmesg kill more umount mount login reset su"
147
148 if [ "${base_sbindir}" != "${sbindir}" ]; then
149 mkdir -p ${D}${base_sbindir}
150 for p in $sbinprogs $sbinprogs_a; do
151 if [ -f "${D}${sbindir}/$p" ]; then
152 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
153 fi
154 done
155 fi
156
157 if [ "${base_bindir}" != "${bindir}" ]; then
158 mkdir -p ${D}${base_bindir}
159 for p in $binprogs_a; do
160 if [ -f "${D}${bindir}/$p" ]; then
161 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
162 fi
163 done
164 fi
165
166 install -d ${D}${sysconfdir}/default/
167 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
168
169 rm -f ${D}${bindir}/chkdupexe
170}
171
172inherit update-alternatives
173
174ALTERNATIVE_PRIORITY = "100"
175
176ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root"
177ALTERNATIVE_${PN} += "mkfs.minix hexdump last logger mesg renice wall"
178ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject getopt sulogin"
179
180ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
181ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
182ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
183ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
184ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
185ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
186ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
187ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
188ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
189ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
190ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
191ALTERNATIVE_TARGET[getopt] = "${bindir}/getopt"
192
193ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1 reset.1"
194
195ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
196ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
197ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
198ALTERNATIVE_LINK_NAME[reset.1] = "${mandir}/man1/reset.1"
199ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
200ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
201ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
202
203ALTERNATIVE_util-linux-hwclock = "hwclock"
204# There seems to be problem, atleast on nslu2, with these, untill they are
205# fixed the busybox ones have higher priority
206ALTERNATIVE_PRIORITY[hwclock] = "10"
207ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
208
209ALTERNATIVE_util-linux-fdisk = "fdisk"
210ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
211
212ALTERNATIVE_util-linux-agetty = "getty"
213ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
214ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
215
216ALTERNATIVE_util-linux-mount = "mount"
217ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
218
219ALTERNATIVE_util-linux-umount = "umount"
220ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
221
222ALTERNATIVE_util-linux-readprofile = "readprofile"
223ALTERNATIVE_LINK_NAME[readprofile] = "${base_sbindir}/readprofile"
224
225ALTERNATIVE_util-linux-losetup = "losetup"
226ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
227
228ALTERNATIVE_util-linux-swaponoff = "swapoff swapon"
229ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
230ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
231
232ALTERNATIVE_util-linux-fsck = "fsck.minix fsck"
233ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix"
234ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
235
236ALTERNATIVE_util-linux-blkid = "blkid"
237ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
238
239ALTERNATIVE_util-linux-reset = "reset"
240ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
241ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
242
243BBCLASSEXTEND = "native nativesdk"
244
245python do_package_prepend () {
246 if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
247 alt_name = "su"
248 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
249 d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
250}
251
252do_compile_ptest() {
253 oe_runmake buildtest-TESTS
254}
255
256do_install_ptest() {
257 mkdir -p ${D}${PTEST_PATH}/tests/ts
258 find . -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
259 cp ${S}/tests/functions.sh ${D}${PTEST_PATH}/tests/
260 cp ${S}/tests/commands.sh ${D}${PTEST_PATH}/tests/
261 cp ${S}/tests/run.sh ${D}${PTEST_PATH}/tests/
262 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
263
264 list="bitops build-sys cal col colrm column dmesg fsck hexdump hwclock ipcs isosize login look lscpu md5 misc more namei paths schedutils script swapon tailf utmpdump"
265 # The following tests are not installed yet:
266 # blkid scsi_debug module dependent
267 # cramfs gcc dependent
268 # eject gcc dependent
269 # fdisk scsi_debug module and gcc dependent
270 # libmount uuidgen dependent
271 # mount gcc dependant
272 # partx blkid dependant
273 for d in $list; do
274 cp -pR ${S}/tests/ts/$d ${D}${PTEST_PATH}/tests/ts/
275 done
276}
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch b/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch
new file mode 100644
index 0000000000..46c5e8ecb7
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/CVE-2014-9114.patch
@@ -0,0 +1,176 @@
1Upstream-Status: Backport
2
3This patch is for CVE-2014-9114.
4This patch should be removed once util-linux is upgraded to 2.26.
5
6Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
7
8From 89e90ae7b2826110ea28c1c0eb8e7c56c3907bdc Mon Sep 17 00:00:00 2001
9From: Karel Zak <kzak@redhat.com>
10Date: Thu, 27 Nov 2014 13:39:35 +0100
11Subject: [PATCH] libblkid: care about unsafe chars in cache
12
13The high-level libblkid API uses /run/blkid/blkid.tab cache to
14store probing results. The cache format is
15
16 <device NAME="value" ...>devname</device>
17
18and unfortunately the cache code does not escape quotation marks:
19
20 # mkfs.ext4 -L 'AAA"BBB'
21
22 # cat /run/blkid/blkid.tab
23 ...
24 <device ... LABEL="AAA"BBB" ...>/dev/sdb1</device>
25
26such string is later incorrectly parsed and blkid(8) returns
27nonsenses. And for use-cases like
28
29 # eval $(blkid -o export /dev/sdb1)
30
31it's also insecure.
32
33Note that mount, udevd and blkid -p are based on low-level libblkid
34API, it bypass the cache and directly read data from the devices.
35
36The current udevd upstream does not depend on blkid(8) output at all,
37it's directly linked with the library and all unsafe chars are encoded by
38\x<hex> notation.
39
40 # mkfs.ext4 -L 'X"`/tmp/foo` "' /dev/sdb1
41 # udevadm info --export-db | grep LABEL
42 ...
43 E: ID_FS_LABEL=X__/tmp/foo___
44 E: ID_FS_LABEL_ENC=X\x22\x60\x2ftmp\x2ffoo\x60\x20\x22
45
46Signed-off-by: Karel Zak <kzak@redhat.com>
47---
48 libblkid/src/read.c | 21 ++++++++++++++++++---
49 libblkid/src/save.c | 22 +++++++++++++++++++++-
50 misc-utils/blkid.8 | 5 ++++-
51 misc-utils/blkid.c | 4 ++--
52 4 files changed, 45 insertions(+), 7 deletions(-)
53
54Index: util-linux-2.24.2/libblkid/src/save.c
55===================================================================
56--- util-linux-2.24.2.orig/libblkid/src/save.c
57+++ util-linux-2.24.2/libblkid/src/save.c
58@@ -26,6 +26,21 @@
59
60 #include "blkidP.h"
61
62+
63+static void save_quoted(const char *data, FILE *file)
64+{
65+ const char *p;
66+
67+ fputc('"', file);
68+ for (p = data; p && *p; p++) {
69+ if ((unsigned char) *p == 0x22 || /* " */
70+ (unsigned char) *p == 0x5c) /* \ */
71+ fputc('\\', file);
72+
73+ fputc(*p, file);
74+ }
75+ fputc('"', file);
76+}
77 static int save_dev(blkid_dev dev, FILE *file)
78 {
79 struct list_head *p;
80@@ -43,9 +58,14 @@ static int save_dev(blkid_dev dev, FILE
81
82 if (dev->bid_pri)
83 fprintf(file, " PRI=\"%d\"", dev->bid_pri);
84+
85 list_for_each(p, &dev->bid_tags) {
86 blkid_tag tag = list_entry(p, struct blkid_struct_tag, bit_tags);
87- fprintf(file, " %s=\"%s\"", tag->bit_name,tag->bit_val);
88+
89+ fputc(' ', file); /* space between tags */
90+ fputs(tag->bit_name, file); /* tag NAME */
91+ fputc('=', file); /* separator between NAME and VALUE */
92+ save_quoted(tag->bit_val, file); /* tag "VALUE" */
93 }
94 fprintf(file, ">%s</device>\n", dev->bid_name);
95
96Index: util-linux-2.24.2/misc-utils/blkid.8
97===================================================================
98--- util-linux-2.24.2.orig/misc-utils/blkid.8
99+++ util-linux-2.24.2/misc-utils/blkid.8
100@@ -193,7 +193,10 @@ partitions. This output format is \fBDE
101 .TP
102 .B export
103 print key=value pairs for easy import into the environment; this output format
104-is automatically enabled when I/O Limits (\fB-i\fR option) are requested
105+is automatically enabled when I/O Limits (\fB-i\fR option) are requested.
106+
107+The non-printing characters are encoded by ^ and M- notation and all
108+potentially unsafe characters are escaped.
109 .RE
110 .TP
111 .BI \-O " offset"
112Index: util-linux-2.24.2/misc-utils/blkid.c
113===================================================================
114--- util-linux-2.24.2.orig/misc-utils/blkid.c
115+++ util-linux-2.24.2/misc-utils/blkid.c
116@@ -306,7 +306,7 @@ static void print_value(int output, int
117 printf("DEVNAME=%s\n", devname);
118 fputs(name, stdout);
119 fputs("=", stdout);
120- safe_print(value, valsz, NULL);
121+ safe_print(value, valsz, " \\\"'$`<>");
122 fputs("\n", stdout);
123
124 } else {
125@@ -314,7 +314,7 @@ static void print_value(int output, int
126 printf("%s: ", devname);
127 fputs(name, stdout);
128 fputs("=\"", stdout);
129- safe_print(value, valsz, "\"");
130+ safe_print(value, valsz, "\"\\");
131 fputs("\" ", stdout);
132 }
133 }
134Index: util-linux-2.24.2/libblkid/src/read.c
135===================================================================
136--- util-linux-2.24.2.orig/libblkid/src/read.c
137+++ util-linux-2.24.2/libblkid/src/read.c
138@@ -252,8 +252,23 @@ static int parse_token(char **name, char
139 *value = skip_over_blank(*value + 1);
140
141 if (**value == '"') {
142- end = strchr(*value + 1, '"');
143- if (!end) {
144+ char *p = end = *value + 1;
145+
146+ /* convert 'foo\"bar' to 'foo"bar' */
147+ while (*p) {
148+ if (*p == '\\') {
149+ p++;
150+ *end = *p;
151+ } else {
152+ *end = *p;
153+ if (*p == '"')
154+ break;
155+ }
156+ p++;
157+ end = ++p;
158+ }
159+
160+ if (*end != '"') {
161 DBG(READ, blkid_debug("unbalanced quotes at: %s", *value));
162 *cp = *value;
163 return -BLKID_ERR_CACHE;
164@@ -261,11 +276,11 @@ static int parse_token(char **name, char
165 (*value)++;
166 *end = '\0';
167 end++;
168+ end = ++p;
169 } else {
170 end = skip_over_word(*value);
171 if (*end) {
172 *end = '\0';
173- end++;
174 }
175 }
176 *cp = end;
diff --git a/meta/recipes-core/util-linux/util-linux/MCONFIG b/meta/recipes-core/util-linux/util-linux/MCONFIG
new file mode 100644
index 0000000000..3fea2c02d7
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/MCONFIG
@@ -0,0 +1,223 @@
1# MCONFIG -- Configuration stuff for util-linux
2# Created: Sat Feb 4 15:50:30 1995
3# Copyright 1995 Rickard E. Faith (faith@cs.unc.edu)
4
5# For a user-mode install, make (at least) three changes:
6# - remove the `-o root' part in INSTALLSUID
7# - set USE_TTY_GROUP=no
8# - define DESTDIR
9
10# Select for ARCH one of intel, alpha, sparc, arm, m68k, mips
11# Select for CPU i386 if the binaries must be able to run on an intel 386
12# (by default i486 code is generated, see below)
13CPU=$(shell uname -m)
14ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/')
15
16# If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp
17# will use PAM for authentication. Additionally, passwd will not be
18# installed as it is not PAM aware.
19HAVE_PAM=no
20
21# If HAVE_SHADOW is set to "yes", then login, chfn, chsh, newgrp, passwd,
22# and vipw will not be built or installed from the login-utils
23# subdirectory.
24HAVE_SHADOW=yes
25
26# If HAVE_PASSWD is set to "yes", then passwd will not be built or
27# installed from the login-utils subdirectory (but login, chfn, chsh,
28# newgrp, and vipw *will* be installed).
29HAVE_PASSWD=no
30
31# If you use chfn and chsh from this package, REQUIRE_PASSWORD will require
32# non-root users to enter the account password before updating /etc/passwd.
33REQUIRE_PASSWORD=yes
34#REQUIRE_PASSWORD=no
35
36# If you use chsh from this package, ONLY_LISTED_SHELLS will require that
37# the selected shell be listed in /etc/shells -- otherwise only a warning is
38# printed. This prevents someone from setting their shell to /bin/false.
39ONLY_LISTED_SHELLS=yes
40#ONLY_LISTED_SHELLS=no
41
42
43# If HAVE_SYSVINIT is set to "yes", then simpleinit and shutdown will not
44# be built or installed from the login-utils subdirectory. (The shutdown
45# and halt that come with the SysVinit package should be used with the init
46# found in that package.)
47HAVE_SYSVINIT=no
48
49# If HAVE_SYSVINIT_UTILS is set to "yes", then last, mesg, and wall will
50# not be built or installed from the login-utils subdirectory. (The
51# shutdown and init from the SysVinit package do not depend on the last,
52# mesg, and wall from that package.)
53HAVE_SYSVINIT_UTILS=no
54
55# If HAVE_WRITE is set to "yes", then write will not be built or
56# installed from the misc-utils subdirectory.
57# (There is a network aware write in netwrite from NetKit 0.16 or later.)
58HAVE_WRITE=no
59
60# If HAVE_GETTY is set to "yes", then agetty will not be built or
61# installed from the login-utils subdirectory. Note that agetty can
62# co-exist with other gettys, so this option should never be used.
63HAVE_GETTY=no
64
65# If USE_TTY_GROUP is set to "yes", then wall and write will be installed
66# setgid to the "tty" group, and mesg will only set the group write bit.
67# Note that this is only useful if login/xterm/etc. change the group of the
68# user's tty to "tty" [The login in util-linux does this correctly, and
69# xterm will do it correctly if X is compiled with USE_TTY_GROUP set
70# properly.]
71USE_TTY_GROUP=no
72
73# If HAVE_KILL is set to "yes", then kill will not be built or
74# installed from the misc-utils subdirectory.
75# (There is also a kill in the procps package.)
76HAVE_KILL=no
77
78# If ALLOW_VCS_USE is set to "yes", then login will chown /dev/vcsN
79# to the current user, allowing her to make a screendump and do other
80# nifty things on the console, but also allowing him to keep an open
81# file descriptor after logging out to trick the next user.
82ALLOW_VCS_USE=yes
83
84# If HAVE_RESET is set to "yes", then reset won't be installed. The version
85# of reset that comes with the ncurses package is less aggressive.
86HAVE_RESET=yes
87
88# If HAVE_SLN is set to "yes", then sln won't be installed
89# (but the man page sln.8 will be installed anyway).
90# sln also comes with libc and glibc.
91HAVE_SLN=no
92
93# If HAVE_FDUTILS is set to "yes", then setfdprm won't be installed.
94HAVE_FDUTILS=no
95
96# If SILENT_PG is set to "yes", then pg will not ring the bell
97# when an invalid key is pressed
98SILENT_PG=no
99
100# If configure decides that Native Language Support (NLS) is available,
101# it sets MAY_ENABLE_NLS in defines.h. If you don't want NLS, set
102# DISABLE_NLS to "yes".
103DISABLE_NLS=no
104
105# Different optimizations for different cpus.
106# gcc 3.0 likes options -mcpu=i486 instead of -m486
107ifeq "$(ARCH)" "intel"
108 ifeq "$(HAVE_OLD_GCC)" "yes"
109 CPUHEAD=-m
110 else
111 CPUHEAD=-mcpu=i
112 endif
113 ifeq "$(CPU)" "i386"
114 CPUTAIL=386
115 else
116 CPUTAIL=486
117 endif
118 CPUOPT= $(CPUHEAD)$(CPUTAIL)
119 OPT= -pipe -O2 $(CPUOPT) -fomit-frame-pointer
120else
121 ifeq "$(ARCH)" "arm"
122 OPT= -pipe -O2 -fsigned-char -fomit-frame-pointer
123 else
124 OPT= -O2 -fomit-frame-pointer
125 endif
126endif
127
128WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes
129
130LIB=../lib
131
132ERR_O=$(LIB)/err.o
133
134# Set HAVE_SLANG to yes if you have slang (and prefer to use that for cfdisk)
135# (If neither HAVE_NCURSES nor HAVE_SLANG is defined, cfdisk is not made.)
136# HAVE_SLANG=yes
137# There is a subdirectory /usr/include/slang containing slcurses.h
138# SLANGFLAGS=-I/usr/include/slang
139# No such subdirectory - slcurses.h lives in /usr/include
140# (no extra definition required).
141LIBSLANG=-lslang
142
143#
144# Paths used for compilation (not all are actually used, see CFLAGS below)
145#
146DEV_DIR= /dev
147ETC_DIR= /etc
148SBIN_DIR= /sbin
149USRSBIN_DIR= /usr/sbin
150USRLIB_DIR= /usr/lib
151USRBIN_DIR= /usr/bin
152USRGAMES_DIR= /usr/games
153USRSHAREMISC_DIR=/usr/share/misc
154LOCALE_DIR= /usr/share/locale
155BIN_DIR= /bin
156VAR_PATH= /var
157LOG_DIR= /var/log
158MAN_DIR= /usr/share/man
159INFO_DIR= /usr/share/info
160
161#
162# Paths used for install
163#
164DEVDIR= $(DESTDIR)$(DEV_DIR)
165ETCDIR= $(DESTDIR)$(ETC_DIR)
166SBINDIR= $(DESTDIR)$(SBIN_DIR)
167USRSBINDIR= $(DESTDIR)$(USRSBIN_DIR)
168USRLIBDIR= $(DESTDIR)$(USRLIB_DIR)
169USRBINDIR= $(DESTDIR)$(USRBIN_DIR)
170USRGAMESDIR= $(DESTDIR)$(USRGAMES_DIR)
171USRSHAREMISCDIR=$(DESTDIR)$(USRSHAREMISC_DIR)
172LOCALEDIR= $(DESTDIR)$(LOCALE_DIR)
173BINDIR= $(DESTDIR)$(BIN_DIR)
174VARPATH= $(DESTDIR)$(VAR_PATH)
175LOGDIR= $(DESTDIR)$(LOG_DIR)
176MANDIR= $(DESTDIR)$(MAN_DIR)
177MAN1DIR= $(MANDIR)/man1
178MAN3DIR= $(MANDIR)/man3
179MAN5DIR= $(MANDIR)/man5
180MAN6DIR= $(MANDIR)/man6
181MAN8DIR= $(MANDIR)/man8
182INFODIR= $(DESTDIR)$(INFO_DIR)
183
184# Directory for shutdown, halt, reboot, etc.
185SHUTDOWNDIR= $(SBINDIR)
186
187# Modes
188DIRMODE= 755
189BINMODE= 755
190MANMODE= 644
191DATMODE= 644
192INFOMODE= 644
193SUIDMODE= 4755
194
195CHMOD= chmod
196INSTALL= install
197INSTALLDIR= $(INSTALL) -d -m $(DIRMODE)
198INSTALLBIN= $(INSTALL) -m $(BINMODE)
199INSTALLMAN= $(INSTALL) -m $(MANMODE)
200INSTALLDAT= $(INSTALL) -m $(DATMODE)
201INSTALLSUID= $(INSTALL) -m $(SUIDMODE)
202
203ifeq "$(DISABLE_NLS)" "yes"
204NLSFLAGS = -DDISABLE_NLS
205endif
206
207CFLAGS := $(OPT) -I$(LIB) $(WARNFLAGS) \
208 $(CURSESFLAGS) $(SLANGFLAGS) $(NLSFLAGS) \
209 -D_FILE_OFFSET_BITS=64 \
210 -DSBINDIR=\"$(SBIN_DIR)\" \
211 -DUSRSBINDIR=\"$(USRSBIN_DIR)\" \
212 -DLOGDIR=\"$(LOG_DIR)\" \
213 -DVARPATH=\"$(VAR_PATH)\" \
214 -DLOCALEDIR=\"$(LOCALE_DIR)\" \
215 $(CFLAGS)
216
217
218%.o: %.c
219 $(CC) -c $(CFLAGS) $< -o $@
220
221%: %.cc
222 $(CXX) $(CFLAGS) $< -o $@
223
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..889ed43978
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
@@ -0,0 +1,18 @@
1ptest needs buildtest-TESTS and runtest-TESTS targets.
2serial-tests is required to generate those targets.
3
4Signed-off-by: Alexandra Safta <alexandra.safta@enea.com>
5Upstream-Status: Pending
6
7diff -ruN a/configure.ac b/configure.ac
8--- a/configure.ac 2014-05-27 12:37:42.119772658 +0200
9+++ b/configure.ac 2014-05-27 12:41:46.225573272 +0200
10@@ -10,7 +10,7 @@
11 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
12 dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors.
13 AC_USE_SYSTEM_EXTENSIONS
14-AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects])
15+AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax dist-bzip2 no-dist-gzip dist-xz -Wno-portability subdir-objects serial-tests])
16
17 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
18 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_unsupported_find_opts.patch b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_find_opts.patch
new file mode 100644
index 0000000000..13dc7ddaa1
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_find_opts.patch
@@ -0,0 +1,38 @@
1Avoid unsupported find options
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/tests/run.sh b/tests/run.sh
7--- a/tests/run.sh 2013-08-26 23:48:48.868279097 +0200
8+++ b/tests/run.sh 2013-08-27 00:14:35.646730004 +0200
9@@ -91,7 +91,7 @@
10 # selected tests only
11 for s in $SUBTESTS; do
12 if [ -d "$top_srcdir/tests/ts/$s" ]; then
13- co=$(find $top_srcdir/tests/ts/$s -type f -perm /a+x -regex ".*/[^\.~]*" | sort)
14+ co=$(find $top_srcdir/tests/ts/$s -type f -perm -111 -regex ".*/[^\.~]*" | sort)
15 comps="$comps $co"
16 else
17 echo "Unknown test component '$s'"
18@@ -104,7 +104,7 @@
19 exit 1
20 fi
21
22- comps=$(find $top_srcdir/tests/ts/ -type f -perm /a+x -regex ".*/[^\.~]*" | sort)
23+ comps=$(find $top_srcdir/tests/ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort)
24 fi
25
26
27diff -ruN a/tests/ts/build-sys/config b/tests/ts/build-sys/config
28--- a/tests/ts/build-sys/config 2013-08-26 23:50:26.800131581 +0200
29+++ b/tests/ts/build-sys/config 2013-08-27 00:10:02.806302850 +0200
30@@ -32,7 +32,7 @@
31 ./configure $opts &> /dev/null
32 make -j &> /dev/null
33
34- bins=$(find . -type f -perm /a+x | sort)
35+ bins=$(find . -type f -perm -111 | sort)
36 for b in $bins; do
37 libs=$(readelf --dynamic $b 2> /dev/null | \
38 awk '/NEEDED/ { print $5 }' | \
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch
new file mode 100644
index 0000000000..a0d5efad0f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_grep_opts.patch
@@ -0,0 +1,57 @@
1Avoid unsupported grep options
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/ts/ipcs/headers b/ts/ipcs/headers
7--- a/tests/ts/ipcs/headers 2013-09-04 11:03:36.118613250 +0200
8+++ b/teste/ts/ipcs/headers 2013-09-04 11:03:27.906958437 +0200
9@@ -22,35 +22,35 @@
10 ts_init "$*"
11
12 ts_log "test: shm headers"
13-$TS_CMD_IPCS -m -t | grep --after-context=1 "^---" >> $TS_OUTPUT
14-$TS_CMD_IPCS -m -p | grep --after-context=1 "^---" >> $TS_OUTPUT
15-$TS_CMD_IPCS -m -c | grep --after-context=1 "^---" >> $TS_OUTPUT
16+$TS_CMD_IPCS -m -t | grep -A 1 "^---" >> $TS_OUTPUT
17+$TS_CMD_IPCS -m -p | grep -A 1 "^---" >> $TS_OUTPUT
18+$TS_CMD_IPCS -m -c | grep -A 1 "^---" >> $TS_OUTPUT
19 $TS_CMD_IPCS -m -l | grep "^---" >> $TS_OUTPUT
20 $TS_CMD_IPCS -m -u | grep "^---" >> $TS_OUTPUT
21 echo >> $TS_OUTPUT
22
23 ts_log "test: mesg headers"
24-$TS_CMD_IPCS -q -t | grep --after-context=1 "^---" >> $TS_OUTPUT
25-$TS_CMD_IPCS -q -p | grep --after-context=1 "^---" >> $TS_OUTPUT
26-$TS_CMD_IPCS -q -c | grep --after-context=1 "^---" >> $TS_OUTPUT
27+$TS_CMD_IPCS -q -t | grep -A 1 "^---" >> $TS_OUTPUT
28+$TS_CMD_IPCS -q -p | grep -A 1 "^---" >> $TS_OUTPUT
29+$TS_CMD_IPCS -q -c | grep -A 1 "^---" >> $TS_OUTPUT
30 $TS_CMD_IPCS -q -l | grep "^---" >> $TS_OUTPUT
31 $TS_CMD_IPCS -q -u | grep "^---" >> $TS_OUTPUT
32 echo >> $TS_OUTPUT
33
34 ts_log "test: sem headers"
35-$TS_CMD_IPCS -s -t | grep --after-context=1 "^---" >> $TS_OUTPUT
36-$TS_CMD_IPCS -s -p | grep --after-context=1 "^---" >> $TS_OUTPUT
37-$TS_CMD_IPCS -s -c | grep --after-context=1 "^---" >> $TS_OUTPUT
38+$TS_CMD_IPCS -s -t | grep -A 1 "^---" >> $TS_OUTPUT
39+$TS_CMD_IPCS -s -p | grep -A 1 "^---" >> $TS_OUTPUT
40+$TS_CMD_IPCS -s -c | grep -A 1 "^---" >> $TS_OUTPUT
41 $TS_CMD_IPCS -s -l | grep "^---" >> $TS_OUTPUT
42 $TS_CMD_IPCS -s -u | grep "^---" >> $TS_OUTPUT
43 echo >> $TS_OUTPUT
44
45 ts_log "test: all headers"
46-$TS_CMD_IPCS -a | grep --after-context=1 "^---" >> $TS_OUTPUT
47+$TS_CMD_IPCS -a | grep -A 1 "^---" >> $TS_OUTPUT
48
49-$TS_CMD_IPCS -a -t | grep --after-context=1 "^---" >> $TS_OUTPUT
50-$TS_CMD_IPCS -a -p | grep --after-context=1 "^---" >> $TS_OUTPUT
51-$TS_CMD_IPCS -a -c | grep --after-context=1 "^---" >> $TS_OUTPUT
52+$TS_CMD_IPCS -a -t | grep -A 1 "^---" >> $TS_OUTPUT
53+$TS_CMD_IPCS -a -p | grep -A 1 "^---" >> $TS_OUTPUT
54+$TS_CMD_IPCS -a -c | grep -A 1 "^---" >> $TS_OUTPUT
55 $TS_CMD_IPCS -a -l | grep "^---" >> $TS_OUTPUT
56 $TS_CMD_IPCS -a -u | grep "^---" >> $TS_OUTPUT
57
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch
new file mode 100644
index 0000000000..3a6206704a
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/avoid_unsupported_sleep_param.patch
@@ -0,0 +1,20 @@
1Avoid unsupported sleep parameter
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/simple b/simple
7--- a/tests/ts/tailf/simple 2013-09-04 11:34:49.971817130 +0200
8+++ b/tests/ts/tailf/simple 2013-09-04 11:34:37.876325128 +0200
9@@ -25,9 +25,9 @@
10
11 $TS_CMD_TAILF $INPUT > $TS_OUTPUT 2>&1 &
12
13-sleep 0.1
14+sleep 1
15 echo {0..9} >> $INPUT
16-sleep 0.1
17+sleep 1
18
19 rm -f $INPUT
20
diff --git a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
new file mode 100644
index 0000000000..a5b1ff12e5
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -0,0 +1,23 @@
1util-linux: take ${sbindir} from the environment if it is set there
2fix the test, the [ ] syntax was getting eaten by autoconf
3
4Signed-off-by: Phil Blundell <pb@pbcl.net>
5Signed-off-by: Saul Wold <sgw@linux.intel.com
6Upstream-Status: Inappropriate [configuration]
7
8Index: util-linux-2.22.1/configure.ac
9===================================================================
10--- util-linux-2.22.1.orig/configure.ac
11+++ util-linux-2.22.1/configure.ac
12@@ -73,7 +73,10 @@ AC_SUBST([localstatedir])
13 usrbin_execdir='${exec_prefix}/bin'
14 AC_SUBST([usrbin_execdir])
15
16-usrsbin_execdir='${exec_prefix}/sbin'
17+if test -z "$usrsbin_execdir" ;
18+then
19+ usrsbin_execdir='${exec_prefix}/sbin'
20+fi
21 AC_SUBST([usrsbin_execdir])
22
23 case $libdir in
diff --git a/meta/recipes-core/util-linux/util-linux/defines.h b/meta/recipes-core/util-linux/util-linux/defines.h
new file mode 100644
index 0000000000..6ce6b86df5
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/defines.h
@@ -0,0 +1,10 @@
1#define UTIL_LINUX_VERSION "2.12"
2#define util_linux_version "util-linux-2.12"
3
4#define HAVE_blkpg_h
5#define HAVE_kd_h
6#define HAVE_locale_h
7#define HAVE_langinfo_h
8#define HAVE_sys_user_h
9#define HAVE_asm_types_h
10//#define NEED_tqueue_h
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..64f02d570f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -0,0 +1,17 @@
1Display testname for subtest
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/functions.sh b/functions.sh
7--- a/tests/functions.sh 2013-09-04 12:41:07.625488953 +0200
8+++ b/tests/functions.sh 2013-09-04 17:33:02.402802957 +0200
9@@ -209,7 +209,7 @@
10 [ $TS_NSUBTESTS -eq 0 ] && echo
11 TS_NSUBTESTS=$(( $TS_NSUBTESTS + 1 ))
12
13- printf "%16s: %-27s ..." "" "$TS_SUBNAME"
14+ printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME"
15 }
16
17 function ts_init {
diff --git a/meta/recipes-core/util-linux/util-linux/fix-configure.patch b/meta/recipes-core/util-linux/util-linux/fix-configure.patch
new file mode 100644
index 0000000000..cefae97e9c
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/fix-configure.patch
@@ -0,0 +1,20 @@
1The userlib_execdir was not getting set correctly, the quoting
2was wrong as these quoted items were not getting expanded correctly.
3
4Upstream-Status: Pending
5
6Signed-off-by: Saul Wold <sgw@linux.intel.com>
7
8Index: util-linux-2.24.1/configure.ac
9===================================================================
10--- util-linux-2.24.1.orig/configure.ac
11+++ util-linux-2.24.1/configure.ac
12@@ -76,7 +76,7 @@ fi
13 AC_SUBST([usrsbin_execdir])
14
15 AS_CASE([$libdir],
16- ['${exec_prefix}/'* | '${prefix}/'* | /usr/*],
17+ [${exec_prefix}/* | ${prefix}/* | /usr/*],
18 [usrlib_execdir=$libdir],
19 [usrlib_execdir='${exec_prefix}'$libdir]
20 )
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
new file mode 100644
index 0000000000..adb271ce0d
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/fix-parallel-build.patch
@@ -0,0 +1,35 @@
1From 774f55f9dd22c01e4041a183d8dff14811f29114 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Fri, 4 Apr 2014 17:33:04 +0800
4Subject: [PATCH] sys-utils/Makemodule.am: fix parallel build issue
5
6The rule SETARCH_MAN_LINKS is used for the files under the sys-utils
7dir, for example:
8
9echo ".so man8/setarch.8" > sys-utils/linux32.8
10
11but it depends on nothing so that the sys-utils dir may not exist, we
12can create the sys-utils dir to fix problem.
13
14Upstream-Status: Pending
15
16Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
17---
18 sys-utils/Makemodule.am | 1 +
19 1 file changed, 1 insertion(+)
20
21diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
22index 6265282..62ead37 100644
23--- a/sys-utils/Makemodule.am
24+++ b/sys-utils/Makemodule.am
25@@ -124,6 +124,7 @@ man_MANS += $(SETARCH_MAN_LINKS)
26 CLEANFILES += $(SETARCH_MAN_LINKS)
27
28 $(SETARCH_MAN_LINKS):
29+ $(MKDIR_P) sys-utils
30 $(AM_V_GEN)echo ".so man8/setarch.8" > $@
31
32 install-exec-hook-setarch:
33--
341.8.2.1
35
diff --git a/meta/recipes-core/util-linux/util-linux/make_include b/meta/recipes-core/util-linux/util-linux/make_include
new file mode 100644
index 0000000000..e6abcd91f7
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/make_include
@@ -0,0 +1,17 @@
1VERSION=2.12
2CC=gcc
3CFLAGS=
4LDFLAGS=
5HAVE_OLD_GCC=yes
6HAVE_RAW_H=yes
7HAVE_NCURSES=yes
8CURSESFLAGS=-DNCH=1
9LIBCURSES=-lncurses
10HAVE_TERMCAP=no
11NEED_LIBCRYPT=yes
12FOREIGN = --foreign-user
13HAVE_XGETTEXT=yes
14HAVE_OPENPTY=yes
15HAVE_PIVOT_ROOT=yes
16HAVE_GOOD_RPC=yes
17HAVE_ZLIB=yes
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..e9adc90a21
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -0,0 +1,16 @@
1Define TESTS variable
2
3Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending
5
6diff -ruN a/Makefile.am b/Makefile.am
7--- a/Makefile.am 2013-08-26 16:29:42.151429221 +0200
8+++ b/Makefile.am 2013-08-26 17:52:31.013898120 +0200
9@@ -43,7 +43,7 @@
10 dist_usrbin_exec_SCRIPTS =
11 systemdsystemunit_DATA =
12 check_PROGRAMS =
13-TESTS =
14+TESTS = $(check_PROGRAMS)
15
16 PATHFILES =
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..b04f14a835
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3cd tests || exit 1
4sh ./run.sh 2>&1 | {
5 sed '{
6 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
7 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
8 s/^\(.*\):\(.*\) \.\.\. IGNORE \(.*\)$/SKIP: \1:\2 \3/
9 }'
10}
diff --git a/meta/recipes-core/util-linux/util-linux/swapargs.h b/meta/recipes-core/util-linux/util-linux/swapargs.h
new file mode 100644
index 0000000000..e960eef05f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/swapargs.h
@@ -0,0 +1,3 @@
1#define SWAPON_HAS_TWO_ARGS
2#include <asm/page.h>
3#include <sys/swap.h>
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
new file mode 100644
index 0000000000..5031a7313e
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/uclibc-__progname-conflict.patch
@@ -0,0 +1,32 @@
1configure should include errno.h instead of argp.h when
2checking for presence of program_invocation_short_name
3uclibc defines this to be const char* unlike util-linux-ng
4which defines this to be char* so this error goes unnoticed
5on glibc/eglibc systems.
6
7here is the error it fixes
8
9in file included from mountP.h:14:0,
10 from cache.c:29:
11/home/kraj/work/slugos/build/tmp-slugos-uclibc/sysroots/nslu2le/usr/include/errno.h:55:46: error: conflicting types for '__progname'
12../../../include/c.h:118:14: note: previous declaration of '__progname' was here
13make[3]: *** [cache.lo] Error 1
14
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Signed-off-by: Jonathan Liu <net147@gmail.com>
18
19Upstream-Status: Pending
20Index: util-linux-2.22.1/configure.ac
21===================================================================
22--- util-linux-2.22.1.orig/configure.ac
23+++ util-linux-2.22.1/configure.ac
24@@ -372,7 +372,7 @@ esac
25
26 AC_MSG_CHECKING([whether program_invocation_short_name is defined])
27 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
28- #include <argp.h>
29+ #include <errno.h>
30 ]], [[
31 program_invocation_short_name = "test";
32 ]])], [
diff --git a/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch b/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch
new file mode 100644
index 0000000000..8f26451aa8
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-ensure-the-existence-of-directory-for-PAT.patch
@@ -0,0 +1,34 @@
1Upstream-Status: Pending
2
3util-linux: ensure the existence of directory for PATHFILES
4
5When compiling util-linux, it's possible to encounter the following error.
6 /bin/sh: line 2:: misc-utils/uuidd.8.tmp: No such file or directory
7
8This is because that the misc-utils directory doesn't exist when trying to write to
9misc-utils/uuidd.8.tmp.
10
11When generating misc-utils/uuidd.8 (or anything in PATHFILES), its directory
12may not have been created yet. So we need to ensure the existence of the directory
13to avoid the compilation error.
14
15Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
16---
17 Makefile.am | 1 +
18 1 file changed, 1 insertion(+)
19
20diff --git a/Makefile.am b/Makefile.am
21index 17f4c33..ca3dc0f 100644
22--- a/Makefile.am
23+++ b/Makefile.am
24@@ -123,6 +123,7 @@ EXTRA_DIST += $(PATHFILES:=.in)
25
26 $(PATHFILES): Makefile
27 @ rm -f $@ $@.tmp
28+ @ mkdir -p `dirname $@`
29 $(AM_V_GEN) srcdir=''; \
30 test -f ./$@.in || srcdir=$(srcdir)/; \
31 $(edit_cmd) $${srcdir}$@.in >$@.tmp
32--
331.7.9.5
34
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
new file mode 100644
index 0000000000..68bf22de8c
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-native-qsort.patch
@@ -0,0 +1,33 @@
1From f220d809be1baa654503bf6ff52f3630b0d7015c Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Wed, 26 Mar 2014 01:30:29 +0000
4Subject: [PATCH] sun.c: use qsort() to instead of qsort_r()
5
6qsort_r() was added to glibc in version 2.8, so there is no qsort_r() on
7the host like CentOS 5.x.
8
9Upstream-Status: Inappropriate [Other]
10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
12---
13 libfdisk/src/sun.c | 5 ++---
14 1 file changed, 2 insertions(+), 3 deletions(-)
15
16Index: util-linux-2.24.2/libfdisk/src/sun.c
17===================================================================
18--- util-linux-2.24.2.orig/libfdisk/src/sun.c
19+++ util-linux-2.24.2/libfdisk/src/sun.c
20@@ -431,10 +431,9 @@ static int sun_verify_disklabel(struct f
21 }
22 verify_sun_starts = starts;
23
24- qsort_r(array,ARRAY_SIZE(array),sizeof(array[0]),
25- (int (*)(const void *,const void *,void *)) verify_sun_cmp,
26- verify_sun_starts);
27-
28+ qsort(array,ARRAY_SIZE(array),sizeof(array[0]),
29+ (int (*)(const void *,const void *)) verify_sun_cmp);
30+
31 if (array[0] == -1) {
32 fdisk_info(cxt, _("No partitions defined."));
33 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
new file mode 100644
index 0000000000..afe543c6e8
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-native.patch
@@ -0,0 +1,73 @@
1Support older hosts with latest util-linux-native
2
3mkostemp is not defined on older machines. So we detect this and
4provide a define that uses mkstemp instead.
5
6O_CLOEXEC is not defined on older machines. It is however defined
7in the 'c.h' header. Fix up the users to include 'c.h'.
8
9fdisks/fdisksunlabel.c was modified to use qsort_r, however
10this is not defined on older hosts. Revert:
11 commit c69bbca9c1f6645097bd20fe3a21f5a99a2a0698
12 fdisk: (sun): use ask API, remove global variable
13
14Upstream-Status: Inappropriate [other]
15Patches revert upstream changes in order to support older
16machines.
17
18Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
19
20Index: util-linux-2.24.1/configure.ac
21===================================================================
22--- util-linux-2.24.1.orig/configure.ac
23+++ util-linux-2.24.1/configure.ac
24@@ -302,6 +302,7 @@ AC_CHECK_FUNCS([ \
25 llseek \
26 lseek64 \
27 mempcpy \
28+ mkostemp \
29 nanosleep \
30 personality \
31 posix_fadvise \
32Index: util-linux-2.24.1/include/c.h
33===================================================================
34--- util-linux-2.24.1.orig/include/c.h
35+++ util-linux-2.24.1/include/c.h
36@@ -236,6 +236,13 @@ static inline int dirfd(DIR *d)
37 #endif
38
39 /*
40+ * mkostemp replacement
41+ */
42+#ifndef HAVE_MKOSTEMP
43+#define mkostemp(template, flags) mkstemp(template)
44+#endif
45+
46+/*
47 * MAXHOSTNAMELEN replacement
48 */
49 static inline size_t get_hostname_max(void)
50Index: util-linux-2.24.1/lib/randutils.c
51===================================================================
52--- util-linux-2.24.1.orig/lib/randutils.c
53+++ util-linux-2.24.1/lib/randutils.c
54@@ -16,6 +16,7 @@
55 #include <sys/syscall.h>
56
57 #include "randutils.h"
58+#include "c.h"
59
60 #ifdef HAVE_TLS
61 #define THREAD_LOCAL static __thread
62Index: util-linux-2.24.1/lib/wholedisk.c
63===================================================================
64--- util-linux-2.24.1.orig/lib/wholedisk.c
65+++ util-linux-2.24.1/lib/wholedisk.c
66@@ -10,6 +10,7 @@
67
68 #include "blkdev.h"
69 #include "wholedisk.h"
70+#include "c.h"
71
72 int is_whole_disk_fd(int fd, const char *name)
73 {
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
new file mode 100644
index 0000000000..5773d7ea1b
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-ng-2.16-mount_lock_path.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3The FHS indicates that /etc must be capable of being mounted R/O.
4
5The FHS also indicates that lock files belong in /var/lock, and /var must
6be R/W as soon as possible during boot.
7
8This patch moves the mtab lock file from the potentially R/O /etc, to the
9R/W /var/lock area. This lock file is used when mounting disks and making
10other mount adjustments. The _PATH_MOUNTED_TMP is not adjusted, as failing
11to write to this file does not cause any functional limitations.
12
13(Note, if /etc is R/O, then /etc/mtab should be a symlink to /proc/mounts)
14
15Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16
17--- util-linux-ng-2.16/include/pathnames.h.orig
18+++ util-linux-ng-2.16/include/pathnames.h
19@@ -90,7 +90,7 @@
20 # endif
21 #endif
22
23-#define _PATH_MOUNTED_LOCK _PATH_MOUNTED "~"
24+#define _PATH_MOUNTED_LOCK "/var/lock/mtab~"
25 #define _PATH_MOUNTED_TMP _PATH_MOUNTED ".tmp"
26
27 #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
new file mode 100644
index 0000000000..f131b763ca
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/util-linux-ng-replace-siginterrupt.patch
@@ -0,0 +1,27 @@
1Upstream-Status: Pending
2
3Index: util-linux-2.22.1/login-utils/login.c
4===================================================================
5--- util-linux-2.22.1.orig/login-utils/login.c
6+++ util-linux-2.22.1/login-utils/login.c
7@@ -1239,6 +1239,8 @@ int main(int argc, char **argv)
8 char *buff;
9 int childArgc = 0;
10 int retcode;
11+ struct sigaction act;
12+
13
14 char *pwdbuf = NULL;
15 struct passwd *pwd = NULL, _pwd;
16@@ -1252,7 +1254,10 @@ int main(int argc, char **argv)
17 timeout = (unsigned int)getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);
18
19 signal(SIGALRM, timedout);
20- siginterrupt(SIGALRM, 1); /* we have to interrupt syscalls like ioclt() */
21+ (void) sigaction(SIGALRM, NULL, &act);
22+ act.sa_flags &= ~SA_RESTART;
23+ sigaction(SIGALRM, &act, NULL);
24+
25 alarm(timeout);
26 signal(SIGQUIT, SIG_IGN);
27 signal(SIGINT, SIG_IGN);
diff --git a/meta/recipes-core/util-linux/util-linux_2.24.2.bb b/meta/recipes-core/util-linux/util-linux_2.24.2.bb
new file mode 100644
index 0000000000..81e719058b
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux_2.24.2.bb
@@ -0,0 +1,36 @@
1MAJOR_VERSION = "2.24"
2require util-linux.inc
3PR = "r1"
4
5# To support older hosts, we need to patch and/or revert
6# some upstream changes. Only do this for native packages.
7OLDHOST = ""
8OLDHOST_class-native = "file://util-linux-native.patch \
9 file://util-linux-native-qsort.patch \
10 "
11
12SRC_URI += "file://util-linux-ng-replace-siginterrupt.patch \
13 file://util-linux-ng-2.16-mount_lock_path.patch \
14 file://uclibc-__progname-conflict.patch \
15 file://configure-sbindir.patch \
16 file://fix-configure.patch \
17 file://fix-parallel-build.patch \
18 file://util-linux-ensure-the-existence-of-directory-for-PAT.patch \
19 file://avoid_parallel_tests.patch \
20 file://CVE-2014-9114.patch \
21 ${OLDHOST} \
22"
23
24SRC_URI[md5sum] = "3f191727a0d28f7204b755cf1b6ea0aa"
25SRC_URI[sha256sum] = "1243d6c07f1c5b38aa4c3814c81a71c24cba7dafe08942916bf216a90a460ff0"
26
27CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
28
29EXTRA_OECONF_class-native = "${SHARED_EXTRA_OECONF} \
30 --disable-fallocate --disable-use-tty-group \
31"
32EXTRA_OECONF_class-nativesdk = "${SHARED_EXTRA_OECONF} \
33 --disable-fallocate --disable-use-tty-group \
34"
35
36RDEPENDS_${PN}-ptest += " bash"
diff --git a/meta/recipes-core/volatile-binds/files/COPYING.MIT b/meta/recipes-core/volatile-binds/files/COPYING.MIT
new file mode 100644
index 0000000000..7e7d57413d
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/COPYING.MIT
@@ -0,0 +1,17 @@
1Permission is hereby granted, free of charge, to any person obtaining a copy
2of this software and associated documentation files (the "Software"), to deal
3in the Software without restriction, including without limitation the rights
4to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5copies of the Software, and to permit persons to whom the Software is
6furnished to do so, subject to the following conditions:
7
8The above copyright notice and this permission notice shall be included in all
9copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
14SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
17THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/meta/recipes-core/volatile-binds/files/mount-copybind b/meta/recipes-core/volatile-binds/files/mount-copybind
new file mode 100755
index 0000000000..2aeaf84ddb
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/mount-copybind
@@ -0,0 +1,34 @@
1#!/bin/sh
2#
3# Perform a bind mount, copying existing files as we do so to ensure the
4# overlaid path has the necessary content.
5
6if [ $# -lt 2 ]; then
7 echo >&2 "Usage: $0 spec mountpoint [OPTIONS]"
8 exit 1
9fi
10
11spec=$1
12mountpoint=$2
13
14if [ $# -gt 2 ]; then
15 options=$3
16else
17 options=
18fi
19
20[ -n "$options" ] && options=",$options"
21
22mkdir -p "${spec%/*}"
23if [ -d "$mountpoint" ]; then
24 if [ ! -d "$spec" ]; then
25 mkdir "$spec"
26 cp -pPR "$mountpoint"/. "$spec/"
27 fi
28elif [ -f "$mountpoint" ]; then
29 if [ ! -f "$spec" ]; then
30 cp -pP "$mountpoint" "$spec"
31 fi
32fi
33
34mount -o "bind$options" "$spec" "$mountpoint"
diff --git a/meta/recipes-core/volatile-binds/files/volatile-binds.service.in b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
new file mode 100644
index 0000000000..32be5b4425
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/files/volatile-binds.service.in
@@ -0,0 +1,19 @@
1[Unit]
2Description=Bind mount volatile @where@
3DefaultDependencies=false
4Before=local-fs.target
5RequiresMountsFor=@whatparent@ @whereparent@
6ConditionPathIsReadWrite=@whatparent@
7ConditionPathExists=@where@
8ConditionPathIsReadWrite=!@where@
9
10[Service]
11Type=oneshot
12RemainAfterExit=Yes
13StandardOutput=syslog
14TimeoutSec=0
15ExecStart=/sbin/mount-copybind @what@ @where@
16ExecStop=/sbin/umount @where@
17
18[Install]
19WantedBy=local-fs.target
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb
new file mode 100644
index 0000000000..694ba1e487
--- /dev/null
+++ b/meta/recipes-core/volatile-binds/volatile-binds.bb
@@ -0,0 +1,69 @@
1SUMMARY = "Volatile bind mount setup and configuration for read-only-rootfs"
2DESCRIPTION = "${SUMMARY}"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://../COPYING.MIT;md5=5750f3aa4ea2b00c2bf21b2b2a7b714d"
5
6SRC_URI = "\
7 file://mount-copybind \
8 file://COPYING.MIT \
9 file://volatile-binds.service.in \
10"
11
12inherit allarch systemd distro_features_check
13
14REQUIRED_DISTRO_FEATURES = "systemd"
15
16VOLATILE_BINDS ?= "\
17 /var/volatile/lib /var/lib\n\
18"
19VOLATILE_BINDS[type] = "list"
20VOLATILE_BINDS[separator] = "\n"
21
22def volatile_systemd_services(d):
23 services = []
24 for line in oe.data.typed_value("VOLATILE_BINDS", d):
25 if not line:
26 continue
27 what, where = line.split(None, 1)
28 services.append("%s.service" % what[1:].replace("/", "-"))
29 return " ".join(services)
30
31SYSTEMD_SERVICE_${PN} = "${@volatile_systemd_services(d)}"
32
33FILES_${PN} += "${systemd_unitdir}/system/*.service"
34
35do_compile () {
36 while read spec mountpoint; do
37 if [ -z "$spec" ]; then
38 continue
39 fi
40
41 servicefile="${spec#/}"
42 servicefile="$(echo "$servicefile" | tr / -).service"
43 sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \
44 -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
45 volatile-binds.service.in >$servicefile
46 done <<END
47${@d.getVar('VOLATILE_BINDS', True).replace("\\n", "\n")}
48END
49
50 if [ -e var-volatile-lib.service ]; then
51 # As the seed is stored under /var/lib, ensure that this service runs
52 # after the volatile /var/lib is mounted.
53 sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \
54 -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \
55 var-volatile-lib.service
56 fi
57}
58do_compile[dirs] = "${WORKDIR}"
59
60do_install () {
61 install -d ${D}${base_sbindir}
62 install -m 0755 mount-copybind ${D}${base_sbindir}/
63
64 install -d ${D}${systemd_unitdir}/system
65 for service in ${SYSTEMD_SERVICE_volatile-binds}; do
66 install -m 0644 $service ${D}${systemd_unitdir}/system/
67 done
68}
69do_install[dirs] = "${WORKDIR}"
diff --git a/meta/recipes-core/zlib/site_config/headers b/meta/recipes-core/zlib/site_config/headers
new file mode 100644
index 0000000000..50268918aa
--- /dev/null
+++ b/meta/recipes-core/zlib/site_config/headers
@@ -0,0 +1 @@
zlib.h
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
new file mode 100644
index 0000000000..61eea8238a
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib-1.2.8/Makefile-runtests.patch
@@ -0,0 +1,38 @@
1Add 'ptest' target to Makefile, to run tests without checking dependencies.
2
3Signed-off-by: Anders Roxell <anders.roxell@enea.com>
4Upstream-Status: Pending
5---
6diff -uNr a/Makefile.in b/Makefile.in
7--- a/Makefile.in 2013-06-10 13:48:14.321959162 +0200
8+++ b/Makefile.in 2013-06-10 13:49:36.686476448 +0200
9@@ -83,6 +83,9 @@
10 test: all teststatic testshared
11
12 teststatic: static
13+ @make runteststatic
14+
15+runteststatic:
16 @TMPST=tmpst_$$; \
17 if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
18 echo ' *** zlib test OK ***'; \
19@@ -92,6 +95,9 @@
20 rm -f $$TMPST
21
22 testshared: shared
23+ @make runtestshared
24+
25+runtestshared:
26 @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
27 LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
28 DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
29@@ -105,6 +111,9 @@
30 rm -f $$TMPSH
31
32 test64: all64
33+ @make runtestall64
34+
35+runtestall64:
36 @TMP64=tmp64_$$; \
37 if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
38 echo ' *** zlib 64-bit test OK ***'; \
diff --git a/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch b/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
new file mode 100644
index 0000000000..650794f504
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib-1.2.8/ldflags-tests.patch
@@ -0,0 +1,45 @@
1Obey LDFLAGS for tests
2
3Signed-off-by: Christopher Larson <chris_larson@mentor.com>
4Upstream-status: Pending
5
6--- zlib-1.2.8.orig/Makefile.in
7+++ zlib-1.2.8/Makefile.in
8@@ -26,7 +26,7 @@ CFLAGS=-O
9
10 SFLAGS=-O
11 LDFLAGS=
12-TEST_LDFLAGS=-L. libz.a
13+TEST_LDFLAGS=-L. $(LDFLAGS)
14 LDSHARED=$(CC)
15 CPP=$(CC) -E
16
17@@ -176,22 +176,22 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.
18 -@rmdir objs
19
20 example$(EXE): example.o $(STATICLIB)
21- $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
22+ $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(STATICLIB)
23
24 minigzip$(EXE): minigzip.o $(STATICLIB)
25- $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
26+ $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(STATICLIB)
27
28 examplesh$(EXE): example.o $(SHAREDLIBV)
29- $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
30+ $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(SHAREDLIBV)
31
32 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
33- $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
34+ $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(SHAREDLIBV)
35
36 example64$(EXE): example64.o $(STATICLIB)
37- $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
38+ $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) $(STATICLIB)
39
40 minigzip64$(EXE): minigzip64.o $(STATICLIB)
41- $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
42+ $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) $(STATICLIB)
43
44 install-libs: $(LIBS)
45 -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
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
new file mode 100644
index 0000000000..403b4825c9
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib-1.2.8/remove.ldconfig.call.patch
@@ -0,0 +1,20 @@
1
2When /etc/ld.so.cache is writeable by user running bitbake then it creates invalid cache
3(in my case libstdc++.so cannot be found after building zlib(-native) and I have to call
4touch */libstdc++.so && /sbin/ldconfig to fix it.
5
6So remove ldconfig call from make install-libs
7
8Upstream-Status: Inappropriate [disable feature]
9
10diff -uNr zlib-1.2.6.orig/Makefile.in zlib-1.2.6/Makefile.in
11--- zlib-1.2.6.orig/Makefile.in 2012-01-28 23:48:50.000000000 +0100
12+++ zlib-1.2.6/Makefile.in 2012-02-13 15:38:20.577700723 +0100
13@@ -199,7 +199,6 @@
14 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
15 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
16 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
17- ($(LDCONFIG) || true) >/dev/null 2>&1; \
18 fi
19 cp zlib.3 $(DESTDIR)$(man3dir)
20 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
new file mode 100644
index 0000000000..884d9dc699
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib-1.2.8/run-ptest
@@ -0,0 +1,2 @@
1#!/bin/sh
2make -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.bb b/meta/recipes-core/zlib/zlib_1.2.8.bb
new file mode 100644
index 0000000000..ca0ba3ff6e
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib_1.2.8.bb
@@ -0,0 +1,61 @@
1SUMMARY = "Zlib Compression Library"
2DESCRIPTION = "Zlib is a general-purpose, patent-free, lossless data compression \
3library which is used by many different programs."
4HOMEPAGE = "http://zlib.net/"
5SECTION = "libs"
6LICENSE = "Zlib"
7LIC_FILES_CHKSUM = "file://zlib.h;beginline=4;endline=23;md5=fde612df1e5933c428b73844a0c494fd"
8
9
10SRC_URI = "http://www.zlib.net/${BPN}-${PV}.tar.xz \
11 file://remove.ldconfig.call.patch \
12 file://Makefile-runtests.patch \
13 file://ldflags-tests.patch \
14 file://run-ptest \
15 "
16
17SRC_URI[md5sum] = "28f1205d8dd2001f26fec1e8c2cebe37"
18SRC_URI[sha256sum] = "831df043236df8e9a7667b9e3bb37e1fcb1220a0f163b6de2626774b9590d057"
19
20RDEPENDS_${PN}-ptest += "make"
21
22inherit ptest
23
24do_configure (){
25 ./configure --prefix=${prefix} --shared --libdir=${libdir}
26}
27
28do_compile (){
29 oe_runmake
30}
31
32do_compile_ptest() {
33 oe_runmake static shared
34}
35
36do_install() {
37 oe_runmake DESTDIR=${D} install
38}
39
40do_install_ptest() {
41 install ${B}/Makefile ${D}${PTEST_PATH}
42 install ${B}/example ${D}${PTEST_PATH}
43 install ${B}/minigzip ${D}${PTEST_PATH}
44 install ${B}/examplesh ${D}${PTEST_PATH}
45 install ${B}/minigzipsh ${D}${PTEST_PATH}
46}
47
48# We move zlib shared libraries for target builds to avoid
49# qa warnings.
50#
51do_install_append_class-target() {
52 if [ ${base_libdir} != ${libdir} ]
53 then
54 mkdir -p ${D}/${base_libdir}
55 mv ${D}/${libdir}/libz.so.* ${D}/${base_libdir}
56 tmp=`readlink ${D}/${libdir}/libz.so`
57 ln -sf ../../${base_libdir}/$tmp ${D}/${libdir}/libz.so
58 fi
59}
60
61BBCLASSEXTEND = "native nativesdk"