scripts/build/libc/uClibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jul 03 01:15:28 2010 +0200 (2010-07-03)
changeset 2009 7e19c1de65cd
parent 2008 b13d0db6fa95
child 2033 ffc1121618fa
permissions -rw-r--r--
libc/uClibc: enable NPTL for snapshots

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