scripts/build/libc/uClibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Jul 28 01:03:07 2010 +0200 (2010-07-28)
changeset 2036 67e02b48b595
parent 2033 ffc1121618fa
child 2037 cd00fdab6117
permissions -rw-r--r--
libc/uClibc: do not systematically use pre-generated locale data

It seems that using pre-generated locale data can be more problematic
than usefull in some circumstances.

Offer a config knob to enable/disable use of the pregen locale data.
Also, do not extract pregen locales data ourselves, it's broken.
     1 # This file declares functions to install the uClibc C library
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # Download uClibc
     6 do_libc_get() {
     7     libc_src="http://www.uclibc.org/downloads
     8               http://www.uclibc.org/downloads/snapshots
     9               http://www.uclibc.org/downloads/old-releases"
    10     # For uClibc, we have almost every thing: releases, and snapshots
    11     # for the last month or so. We'll have to deal with svn revisions
    12     # later...
    13     CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
    14     # uClibc locales
    15     if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then
    16         CT_GetFile "uClibc-locale-030818" ${libc_src}
    17     fi
    18 
    19     return 0
    20 }
    21 
    22 libc_uclibc_src_dir() {
    23     if [    -z "${CT_LIBC_V_snapshot}"      \
    24          -a -z "${CT_LIBC_V_specific_date}" \
    25        ]; then
    26         echo "${CT_SRC_DIR}/uClibc-${CT_LIBC_VERSION}"
    27     else
    28         echo "${CT_SRC_DIR}/uClibc"
    29     fi
    30 }
    31 
    32 # Extract uClibc
    33 do_libc_extract() {
    34     CT_Extract "uClibc-${CT_LIBC_VERSION}"
    35     # Don't patch snapshots
    36     if [    -z "${CT_LIBC_V_snapshot}"      \
    37          -a -z "${CT_LIBC_V_specific_date}" \
    38        ]; then
    39         CT_Patch "uClibc" "${CT_LIBC_VERSION}"
    40     fi
    41 
    42     # uClibc locales
    43     # Extracting pregen locales ourselves is kinda
    44     # broken, so just link it in place...
    45     if [    "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y"           \
    46          -a ! -f "${CT_SRC_DIR}/.uClibc-locales-030818.extracted"   ]; then
    47         CT_Pushd "$(libc_uclibc_src_dir)/extra/locale"
    48         CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/uClibc-locale-030818.tgz" .
    49         CT_Popd
    50         touch "${CT_SRC_DIR}/.uClibc-locales-030818.extracted"
    51     fi
    52 
    53     return 0
    54 }
    55 
    56 # Check that uClibc has been previously configured
    57 do_libc_check_config() {
    58     CT_DoStep INFO "Checking C library configuration"
    59 
    60     CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}"
    61 
    62     if grep -E '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
    63         CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
    64         CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
    65     fi
    66 
    67     CT_DoLog EXTRA "Munging uClibc configuration"
    68     mungeuClibcConfig "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_CONFIG_DIR}/uClibc.config"
    69 
    70     CT_EndStep
    71 }
    72 
    73 # This functions installs uClibc's headers
    74 do_libc_headers() {
    75     local install_rule
    76     local cross
    77 
    78     CT_DoStep INFO "Installing C library headers"
    79 
    80     # Simply copy files until uClibc has the ability to build out-of-tree
    81     CT_DoLog EXTRA "Copying sources to build dir"
    82     CT_DoExecLog ALL cp -av "$(libc_uclibc_src_dir)"            \
    83                             "${CT_BUILD_DIR}/build-libc-headers"
    84     cd "${CT_BUILD_DIR}/build-libc-headers"
    85 
    86     # Retrieve the config file
    87     CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
    88 
    89     # uClibc uses the CROSS environment variable as a prefix to the
    90     # compiler tools to use.  Setting it to the empty string forces
    91     # use of the native build host tools, which we need at this
    92     # stage, as we don't have target tools yet.
    93     # BUT! With NPTL, we need a cross-compiler (and we have it)
    94     if [ "${CT_THREADS}" = "nptl" ]; then
    95         cross="${CT_TARGET}-"
    96     fi
    97 
    98     CT_DoLog EXTRA "Applying configuration"
    99     CT_DoYes "" |CT_DoExecLog ALL               \
   100                  make CROSS="${cross}"          \
   101                  PREFIX="${CT_SYSROOT_DIR}/"    \
   102                  oldconfig
   103 
   104     CT_DoLog EXTRA "Building headers"
   105     CT_DoExecLog ALL                    \
   106     make ${CT_LIBC_UCLIBC_VERBOSITY}    \
   107          CROSS="${cross}"               \
   108          PREFIX="${CT_SYSROOT_DIR}/"    \
   109          headers
   110 
   111     if [ "${CT_LIBC_UCLIBC_0_9_30_or_later}" = "y" ]; then
   112         install_rule=install_headers
   113     else
   114         install_rule=install_dev
   115     fi
   116 
   117     CT_DoLog EXTRA "Installing headers"
   118     CT_DoExecLog ALL                    \
   119     make ${CT_LIBC_UCLIBC_VERBOSITY}    \
   120          CROSS="${cross}"               \
   121          PREFIX="${CT_SYSROOT_DIR}/"    \
   122          ${install_rule}
   123 
   124     if [ "${CT_THREADS}" = "nptl" ]; then
   125         CT_DoLog EXTRA "Building start files"
   126         CT_DoExecLog ALL                                    \
   127         make ${CT_LIBC_UCLIBC_PARALLEL:+${PARALLELMFLAGS}}  \
   128              CROSS="${cross}"                               \
   129              PREFIX="${CT_SYSROOT_DIR}/"                    \
   130              STRIPTOOL=true                                 \
   131              ${CT_LIBC_UCLIBC_VERBOSITY}                    \
   132              lib/crt1.o lib/crti.o lib/crtn.o
   133 
   134         # From:  http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
   135         # libm.so is needed for ppc, as libgcc is linked against libm.so
   136         # No problem to create it for other archs.
   137         CT_DoLog EXTRA "Building dummy shared libs"
   138         CT_DoExecLog ALL "${cross}gcc" -nostdlib        \
   139                                        -nostartfiles    \
   140                                        -shared          \
   141                                        -x c /dev/null   \
   142                                        -o libdummy.so
   143 
   144         CT_DoLog EXTRA "Installing start files"
   145         CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o   \
   146                                          "${CT_SYSROOT_DIR}/usr/lib"
   147 
   148         CT_DoLog EXTRA "Installing dummy shared libs"
   149         CT_DoExecLog ALL install -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libc.so"
   150         CT_DoExecLog ALL install -m 0755 libdummy.so "${CT_SYSROOT_DIR}/usr/lib/libm.so"
   151     fi # CT_THREADS == nptl
   152 
   153     CT_EndStep
   154 }
   155 
   156 # Build and install start files
   157 do_libc_start_files() {
   158     :
   159 }
   160 
   161 # This function build and install the full uClibc
   162 do_libc() {
   163     CT_DoStep INFO "Installing C library"
   164 
   165     # Simply copy files until uClibc has the ability to build out-of-tree
   166     CT_DoLog EXTRA "Copying sources to build dir"
   167     CT_DoExecLog ALL cp -av "$(libc_uclibc_src_dir)"    \
   168                             "${CT_BUILD_DIR}/build-libc"
   169     cd "${CT_BUILD_DIR}/build-libc"
   170 
   171     # Retrieve the config file
   172     CT_DoExecLog ALL cp "${CT_CONFIG_DIR}/uClibc.config" .config
   173 
   174     # uClibc uses the CROSS environment variable as a prefix to the compiler
   175     # tools to use.  The newly built tools should be in our path, so we need
   176     # only give the correct name for them.
   177     # Note about CFLAGS: In uClibc, CFLAGS are generated by Rules.mak,
   178     # depending  on the configuration of the library. That is, they are tailored
   179     # to best fit the target. So it is useless and seems to be a bad thing to
   180     # use LIBC_EXTRA_CFLAGS here.
   181     CT_DoLog EXTRA "Applying configuration"
   182     CT_DoYes "" |CT_DoExecLog ALL               \
   183                  make CROSS=${CT_TARGET}-       \
   184                  PREFIX="${CT_SYSROOT_DIR}/"    \
   185                  oldconfig
   186 
   187     # We do _not_ want to strip anything for now, in case we specifically
   188     # asked for a debug toolchain, thus the STRIPTOOL= assignment
   189     # /Old/ versions can not build in //
   190     CT_DoLog EXTRA "Building C library"
   191     CT_DoExecLog ALL                                    \
   192     make -j1                                            \
   193          CROSS=${CT_TARGET}-                            \
   194          PREFIX="${CT_SYSROOT_DIR}/"                    \
   195          STRIPTOOL=true                                 \
   196          ${CT_LIBC_UCLIBC_VERBOSITY}                    \
   197          pregen
   198     CT_DoExecLog ALL                                    \
   199     make ${CT_LIBC_UCLIBC_PARALLEL:+${PARALLELMFLAGS}}  \
   200          CROSS=${CT_TARGET}-                            \
   201          PREFIX="${CT_SYSROOT_DIR}/"                    \
   202          STRIPTOOL=true                                 \
   203          ${CT_LIBC_UCLIBC_VERBOSITY}                    \
   204          all
   205 
   206     # YEM-FIXME:
   207     # - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
   208     #   such files, except the headers as they already are installed
   209     # - "make install_dev" installs the headers, the crti.o... and the
   210     #   static libs, but not the dynamic libs
   211     # - "make install_runtime" installs the dynamic libs only
   212     # - "make install" calls install_runtime and install_dev
   213     # - so we're left with re-installing the headers... Sigh...
   214     #
   215     # We do _not_ want to strip anything for now, in case we specifically
   216     # asked for a debug toolchain, hence the STRIPTOOL= assignment
   217     #
   218     # Note: PARALLELMFLAGS is not usefull for installation.
   219     #
   220     CT_DoLog EXTRA "Installing C library"
   221     CT_DoExecLog ALL                    \
   222     make CROSS=${CT_TARGET}-            \
   223          PREFIX="${CT_SYSROOT_DIR}/"    \
   224          STRIPTOOL=true                 \
   225          ${CT_LIBC_UCLIBC_VERBOSITY}    \
   226          install
   227 
   228     CT_EndStep
   229 }
   230 
   231 # This function is used to install those components needing the final C compiler
   232 do_libc_finish() {
   233     :
   234 }
   235 
   236 # Initialises the .config file to sensible values
   237 # $1: original file
   238 # $2: munged file
   239 mungeuClibcConfig() {
   240     src_config_file="$1"
   241     dst_config_file="$2"
   242     munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed"
   243 
   244     # Start with a fresh file
   245     rm -f "${munge_file}"
   246     touch "${munge_file}"
   247 
   248     # Do it all in a sub-shell, it's easier to redirect output
   249     (
   250 
   251     # Hack our target in the config file.
   252     case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
   253         x86:32)      arch=i386;;
   254         x86:64)      arch=x86_64;;
   255         sh:32)       arch="sh";;
   256         sh:64)       arch="sh64";;
   257         blackfin:32) arch="bfin";;
   258         *)           arch="${CT_ARCH}";;
   259     esac
   260     # Also remove stripping: its the responsibility of the
   261     # firmware builder to strip or not.
   262     cat <<-ENDSED
   263 		s/^(TARGET_.*)=y$/# \\1 is not set/
   264 		s/^# TARGET_${arch} is not set/TARGET_${arch}=y/
   265 		s/^TARGET_ARCH=".*"/TARGET_ARCH="${arch}"/
   266 		s/.*(DOSTRIP).*/# \\1 is not set/
   267 		ENDSED
   268 
   269     # Ah. We may one day need architecture-specific handler here...
   270     if [ "${CT_ARCH}" = "arm" ]; then
   271         # Hack the ARM {E,O}ABI into the config file
   272         if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
   273             cat <<-ENDSED
   274 				s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
   275 				s/.*(CONFIG_ARM_EABI).*/\\1=y/
   276 				ENDSED
   277         else
   278             cat <<-ENDSED
   279 				s/.*(CONFIG_ARM_OABI).*/\\1=y/
   280 				s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
   281 				ENDSED
   282         fi
   283     fi
   284 
   285     # Accomodate for old and new uClibc versions, where the
   286     # way to select between big/little endian has changed
   287     case "${CT_ARCH_BE},${CT_ARCH_LE}" in
   288         y,) cat <<-ENDSED
   289 				s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
   290 				s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
   291 				s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
   292 				s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
   293 				ENDSED
   294         ;;
   295         ,y) cat <<-ENDSED
   296 				s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
   297 				s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
   298 				s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
   299 				s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
   300 				ENDSED
   301         ;;
   302     esac
   303 
   304     # Accomodate for old and new uClibc version, where the
   305     # way to select between hard/soft float has changed
   306     case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
   307         y,) cat <<-ENDSED
   308 				s/^[^_]*(HAS_FPU).*/\\1=y/
   309 				s/.*(UCLIBC_HAS_FPU).*/\\1=y/
   310 				ENDSED
   311             ;;
   312         ,y) cat <<-ENDSED
   313 				s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
   314 				s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
   315 				ENDSED
   316             ;;
   317     esac
   318 
   319     # Change paths to work with crosstool-NG
   320     # From http://www.uclibc.org/cgi-bin/viewcvs.cgi?rev=16846&view=rev
   321     #  " we just want the kernel headers, not the whole kernel source ...
   322     #  " so people may need to update their paths slightly
   323     quoted_kernel_source=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/include/?$,,; s,/,\\/,g;')
   324     quoted_headers_dir=$(echo "${CT_HEADERS_DIR}" | sed -r -e 's,/,\\/,g;')
   325     # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
   326     # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
   327     # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and
   328     # newer versions use KERNEL_HEADERS (which is right).
   329     cat <<-ENDSED
   330 		s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
   331 		s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
   332 		s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
   333 		s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
   334 		s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
   335 		s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
   336 		ENDSED
   337 
   338     if [ "${CT_USE_PIPES}" = "y" ]; then
   339         if grep UCLIBC_EXTRA_CFLAGS extra/Configs/Config.in >/dev/null 2>&1; then
   340             # Good, there is special provision for such things as -pipe!
   341             cat <<-ENDSED
   342 				s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
   343 				ENDSED
   344         else
   345             # Hack our -pipe into WARNINGS, which will be internally incorporated to
   346             # CFLAGS. This a dirty hack, but yet needed
   347             cat <<-ENDSED
   348 				s/^(WARNINGS=".*)"$/\\1 -pipe"/
   349 				ENDSED
   350         fi
   351     fi
   352 
   353     # Locales support
   354     # Note that the two PREGEN_LOCALE and the XLOCALE lines may be missing
   355     # entirely if LOCALE is not set.  If LOCALE was already set, we'll
   356     # assume the user has already made all the appropriate generation
   357     # arrangements.  Note that having the uClibc Makefile download the
   358     # pregenerated locales is not compatible with crosstool; besides,
   359     # crosstool downloads them as part of getandpatch.sh.
   360     case "${CT_LIBC_UCLIBC_LOCALES}:${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" in
   361         :*)
   362             ;;
   363         y:)
   364             cat <<-ENDSED
   365 				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
   366 				# UCLIBC_PREGENERATED_LOCALE_DATA is not set\\
   367 				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
   368 				# UCLIBC_HAS_XLOCALE is not set/
   369 				ENDSED
   370             ;;
   371         y:y)
   372             cat <<-ENDSED
   373 				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
   374 				UCLIBC_PREGENERATED_LOCALE_DATA=y\\
   375 				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
   376 				# UCLIBC_HAS_XLOCALE is not set/
   377 				ENDSED
   378             ;;
   379     esac
   380 
   381     # WCHAR support
   382     if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ] ; then
   383         cat <<-ENDSED
   384 			s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=y/
   385 			ENDSED
   386     else
   387         cat <<-ENDSED
   388 			s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=n/
   389 			ENDSED
   390     fi
   391 
   392     # Force on options needed for C++ if we'll be making a C++ compiler.
   393     # I'm not sure locales are a requirement for doing C++... Are they?
   394     if [ "${CT_CC_LANG_CXX}" = "y" ]; then
   395         cat <<-ENDSED
   396 			s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
   397 			s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
   398 			s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
   399 			ENDSED
   400     fi
   401 
   402     # Push the threading model
   403     # Note: we take into account all of the .28, .29, .30 and .31
   404     #       versions, here. Even snapshots with NPTL.
   405     case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in
   406         none:)
   407             cat <<-ENDSED
   408 				s/^UCLIBC_HAS_THREADS=y/# UCLIBC_HAS_THREADS is not set/
   409 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   410 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   411 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   412 				ENDSED
   413             ;;
   414         linuxthreads:old)
   415             cat <<-ENDSED
   416 				s/^# UCLIBC_HAS_THREADS is not set/UCLIBC_HAS_THREADS=y/
   417 				s/^# LINUXTHREADS_OLD is not set/LINUXTHREADS_OLD=y/
   418 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   419 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   420 				ENDSED
   421             ;;
   422         linuxthreads:new)
   423             cat <<-ENDSED
   424 				s/^# UCLIBC_HAS_THREADS is not set/UCLIBC_HAS_THREADS=y/
   425 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   426 				s/^# LINUXTHREADS_NEW is not set/LINUXTHREADS_NEW=y/
   427 				s/^UCLIBC_HAS_THREADS_NATIVE=y/# UCLIBC_HAS_THREADS_NATIVE is not set/
   428 				ENDSED
   429             ;;
   430         nptl:)
   431             cat <<-ENDSED
   432 				s/^HAS_NO_THREADS=y/# HAS_NO_THREADS is not set/
   433 				s/^UCLIBC_HAS_THREADS=y/# UCLIBC_HAS_THREADS is not set/
   434 				s/^LINUXTHREADS_OLD=y/# LINUXTHREADS_OLD is not set/
   435 				s/^LINUXTHREADS_NEW=y/# LINUXTHREADS_NEW is not set/
   436 				s/^# UCLIBC_HAS_THREADS_NATIVE is not set/UCLIBC_HAS_THREADS_NATIVE=y/
   437 				ENDSED
   438             ;;
   439         *)
   440             CT_Abort "Incorrect thread settings: CT_THREADS='${CT_THREAD}' CT_LIBC_UCLIBC_LNXTHRD='${CT_LIBC_UCLIBC_LNXTHRD}'"
   441             ;;
   442     esac
   443 
   444     # Always build the libpthread_db
   445     cat <<-ENDSED
   446 		s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
   447 		ENDSED
   448 
   449     # Force on debug options if asked for
   450     case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
   451       0)
   452         cat <<-ENDSED
   453 			s/^DODEBUG=y/# DODEBUG is not set/
   454 			s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
   455 			s/^DOASSERTS=y/# DOASSERTS is not set/
   456 			s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
   457 			s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
   458 			s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
   459 			ENDSED
   460         ;;
   461       1)
   462         cat <<-ENDSED
   463 			s/^# DODEBUG is not set.*/DODEBUG=y/
   464 			s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
   465 			s/^DOASSERTS=y/# DOASSERTS is not set/
   466 			s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
   467 			s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
   468 			s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
   469 			ENDSED
   470         ;;
   471       2)
   472         cat <<-ENDSED
   473 			s/^# DODEBUG is not set.*/DODEBUG=y/
   474 			s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
   475 			s/^# DOASSERTS is not set.*/DOASSERTS=y/
   476 			s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
   477 			s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
   478 			s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
   479 			ENDSED
   480         ;;
   481     esac
   482 
   483     # And now, this is the end
   484     ) >>"${munge_file}"
   485 
   486     sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
   487 }