summaryrefslogtreecommitdiff
path: root/scripts/build/libc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/libc')
-rw-r--r--scripts/build/libc/avr-libc.sh6
-rw-r--r--scripts/build/libc/glibc.sh29
-rw-r--r--scripts/build/libc/mingw.sh35
-rw-r--r--scripts/build/libc/musl.sh8
-rw-r--r--scripts/build/libc/newlib.sh10
-rw-r--r--scripts/build/libc/uClibc.sh29
6 files changed, 75 insertions, 42 deletions
diff --git a/scripts/build/libc/avr-libc.sh b/scripts/build/libc/avr-libc.sh
index 3dc91a4..431e876 100644
--- a/scripts/build/libc/avr-libc.sh
+++ b/scripts/build/libc/avr-libc.sh
@@ -41,17 +41,17 @@ do_libc_post_cc() {
CT_DoStep INFO "Installing C library"
CT_DoLog EXTRA "Copying sources to build directory"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc-${CT_LIBC_VERSION}" \
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/avr-libc-${CT_LIBC_VERSION}/." \
"${CT_BUILD_DIR}/build-libc-post-cc"
cd "${CT_BUILD_DIR}/build-libc-post-cc"
do_libc_configure
CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS}
+ CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} install
+ CT_DoExecLog ALL make install
CT_EndStep
}
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 8027b8f..2db69cb 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -11,9 +11,9 @@ do_libc_get() {
CT_GetCustom "glibc" "${CT_LIBC_GLIBC_CUSTOM_VERSION}" \
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
else
- if echo ${CT_LIBC_VERSION} |${grep} -q linaro; then
+ if echo ${CT_LIBC_VERSION} |grep -q linaro; then
# Linaro glibc releases come from regular downloads...
- YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'`
+ YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
CT_GetFile "glibc-${CT_LIBC_VERSION}" \
https://releases.linaro.org/${YYMM}/components/toolchain/glibc-linaro \
http://cbuild.validation.linaro.org/snapshots
@@ -30,7 +30,8 @@ do_libc_get() {
do_libc_extract() {
CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
- # Attempt CT_PATCH only if NOT custom
+ # Custom glibc won't get patched, because CT_GetCustom
+ # marks custom glibc as patched.
CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
# The configure files may be older than the configure.in files
@@ -300,7 +301,7 @@ do_libc_backend_once() {
# use the 'install-headers' makefile target to install the
# headers
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
install_root=${multi_root} \
install-bootstrap-headers=yes \
"${extra_make_args[@]}" \
@@ -353,7 +354,7 @@ do_libc_backend_once() {
# there are a few object files needed to link shared libraries,
# which we build and install by hand
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
"${extra_make_args[@]}" \
csu/subdir_lib
CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
@@ -374,12 +375,12 @@ do_libc_backend_once() {
if [ "${libc_mode}" = "final" ]; then
CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
"${extra_make_args[@]}" \
all
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
"${extra_make_args[@]}" \
install_root="${multi_root}" \
install
@@ -391,7 +392,7 @@ do_libc_backend_once() {
CT_DoLog EXTRA "Building and installing the C library manual"
# Omit JOBSFLAGS as GLIBC has problems building the
# manuals in parallel
- CT_DoExecLog ALL ${make} pdf html
+ CT_DoExecLog ALL make pdf html
CT_DoExecLog ALL mkdir -p ${CT_PREFIX_DIR}/share/doc
CT_DoExecLog ALL cp -av ${src_dir}/manual/*.pdf \
${src_dir}/manual/libc \
@@ -410,7 +411,7 @@ do_libc_backend_once() {
do_libc_add_ons_list() {
local sep="$1"
local addons_list="$( echo "${CT_LIBC_ADDONS_LIST}" \
- |${sed} -r -e "s/[[:space:],]/${sep}/g;" \
+ |sed -r -e "s/[[:space:],]/${sep}/g;" \
)"
if [ "${CT_LIBC_GLIBC_2_20_or_later}" != "y" ]; then
case "${CT_THREADS}" in
@@ -420,7 +421,7 @@ do_libc_add_ons_list() {
fi
[ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
# Remove duplicate, leading and trailing separators
- echo "${addons_list}" |${sed} -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
+ echo "${addons_list}" |sed -r -e "s/${sep}+/${sep}/g; s/^${sep}//; s/${sep}\$//;"
}
# Compute up the minimum supported Linux kernel version
@@ -439,7 +440,7 @@ do_libc_min_kernel_config() {
if [ ! -f "${version_code_file}" -o ! -r "${version_code_file}" ]; then
CT_Abort "Linux version is unavailable in installed headers files"
fi
- version_code="$(${grep} -E LINUX_VERSION_CODE "${version_code_file}" \
+ version_code="$(grep -E LINUX_VERSION_CODE "${version_code_file}" \
|cut -d' ' -f 3 \
)"
version=$(((version_code>>16)&0xFF))
@@ -449,7 +450,7 @@ do_libc_min_kernel_config() {
elif [ "${CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN}" = "y" ]; then
# Trim the fourth part of the linux version, keeping only the first three numbers
min_kernel_config="$( echo "${CT_LIBC_GLIBC_MIN_KERNEL_VERSION}" \
- |${sed} -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \
+ |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;' \
)"
fi
echo "--enable-kernel=${min_kernel_config}"
@@ -514,7 +515,7 @@ do_libc_locales() {
"${extra_config[@]}"
CT_DoLog EXTRA "Building C library localedef"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS}
+ CT_DoExecLog ALL make ${JOBSFLAGS}
# The target's endianness and uint32_t alignment should be passed as options
# to localedef, but glibc's localedef does not support these options, which
@@ -522,7 +523,7 @@ do_libc_locales() {
# only if it has the same endianness and uint32_t alignment as the host's.
CT_DoLog EXTRA "Installing C library locales"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS} \
+ CT_DoExecLog ALL make ${JOBSFLAGS} \
install_root="${CT_SYSROOT_DIR}" \
localedata/install-locales
}
diff --git a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw.sh
index 44ca008..705f8c9 100644
--- a/scripts/build/libc/mingw.sh
+++ b/scripts/build/libc/mingw.sh
@@ -55,10 +55,10 @@ do_libc_start_files() {
"${sdk_opts[@]}"
CT_DoLog EXTRA "Compile Headers"
- CT_DoExecLog ALL ${make}
+ CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing Headers"
- CT_DoExecLog ALL ${make} install DESTDIR=${CT_SYSROOT_DIR}
+ CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
CT_Popd
@@ -104,14 +104,41 @@ do_libc() {
# parallel build. See https://github.com/crosstool-ng/crosstool-ng/issues/246
# Do not pass ${JOBSFLAGS} - build serially.
CT_DoLog EXTRA "Building mingw-w64-crt"
- CT_DoExecLog ALL ${make}
+ CT_DoExecLog ALL make
CT_DoLog EXTRA "Installing mingw-w64-crt"
- CT_DoExecLog ALL ${make} install DESTDIR=${CT_SYSROOT_DIR}
+ CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
CT_EndStep
+
+ if [ "${CT_THREADS}" = "posix" ]; then
+ do_pthreads
+ fi
}
do_libc_post_cc() {
:
}
+
+do_pthreads() {
+ CT_DoStep INFO "Building mingw-w64-winpthreads files"
+
+ CT_DoLog EXTRA "Configuring mingw-w64-winpthreads"
+
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-winpthreads"
+
+ CT_DoExecLog CFG \
+ "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-libraries/winpthreads/configure" \
+ --with-sysroot=${CT_SYSROOT_DIR} \
+ --prefix=${MINGW_INSTALL_PREFIX} \
+ --build=${CT_BUILD} \
+ --host=${CT_TARGET} \
+
+ CT_DoLog EXTRA "Building mingw-w64-winpthreads"
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing mingw-w64-winpthreads"
+ CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
+
+ CT_EndStep
+}
diff --git a/scripts/build/libc/musl.sh b/scripts/build/libc/musl.sh
index 2a0c04f..acd14c2 100644
--- a/scripts/build/libc/musl.sh
+++ b/scripts/build/libc/musl.sh
@@ -120,9 +120,9 @@ do_libc_backend_once() {
if [ "${libc_mode}" = "startfiles" ]; then
CT_DoLog EXTRA "Installing C library headers"
- CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" install-headers
+ CT_DoExecLog ALL make DESTDIR="${multi_root}" install-headers
CT_DoLog EXTRA "Building C library start files"
- CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" \
+ CT_DoExecLog ALL make DESTDIR="${multi_root}" \
obj/crt/crt1.o obj/crt/crti.o obj/crt/crtn.o
CT_DoLog EXTRA "Installing C library start files"
CT_DoExecLog ALL cp -av obj/crt/crt*.o "${multi_root}${multilib_dir}"
@@ -137,10 +137,10 @@ do_libc_backend_once() {
"${multi_root}${multilib_dir}/libc.so"
CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS}
+ CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} DESTDIR="${multi_root}" install
+ CT_DoExecLog ALL make DESTDIR="${multi_root}" install
# Convert /lib/ld-* symlinks to relative paths so that they are valid
# both on the host and on the target.
diff --git a/scripts/build/libc/newlib.sh b/scripts/build/libc/newlib.sh
index d9bda06..6ae579b 100644
--- a/scripts/build/libc/newlib.sh
+++ b/scripts/build/libc/newlib.sh
@@ -17,8 +17,8 @@ do_libc_get() {
CT_GetCustom "newlib" "${CT_LIBC_NEWLIB_CUSTOM_VERSION}" \
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
else # ! custom location
- if echo ${CT_LIBC_VERSION} |${grep} -q linaro; then
- YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'`
+ if echo ${CT_LIBC_VERSION} |grep -q linaro; then
+ YYMM=`echo ${CT_LIBC_VERSION} |cut -d- -f3 |sed -e 's,^..,,'`
CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src} \
https://releases.linaro.org/${YYMM}/components/toolchain/newlib-linaro \
http://cbuild.validation.linaro.org/snapshots
@@ -121,16 +121,16 @@ do_libc() {
"${CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY[@]}"
CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS}
+ CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} install install_root="${CT_SYSROOT_DIR}"
+ CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
if [ "${CT_BUILD_MANUALS}" = "y" ]; then
local -a doc_dir="${CT_BUILD_DIR}/build-libc/${CT_TARGET}"
CT_DoLog EXTRA "Building and installing the C library manual"
- CT_DoExecLog ALL ${make} pdf html
+ CT_DoExecLog ALL make pdf html
# NEWLIB install-{pdf.html} fail for some versions
CT_DoExecLog ALL mkdir -p "${CT_PREFIX_DIR}/share/doc/newlib"
diff --git a/scripts/build/libc/uClibc.sh b/scripts/build/libc/uClibc.sh
index 47e135b..96d4b51 100644
--- a/scripts/build/libc/uClibc.sh
+++ b/scripts/build/libc/uClibc.sh
@@ -104,7 +104,7 @@ do_libc_backend_once() {
# Simply copy files until uClibc has the ability to build out-of-tree
CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}" .
+ CT_DoExecLog ALL cp -aT "${CT_SRC_DIR}/${uclibc_name}-${CT_LIBC_VERSION}/." .
multilib_dir="lib/${multi_os_dir}"
startfiles_dir="${multi_root}/usr/${multilib_dir}"
@@ -138,7 +138,7 @@ do_libc_backend_once() {
fi
manage_uClibc_config "${CT_LIBC_UCLIBC_CONFIG_FILE}" .config "${multi_flags}"
- CT_DoYes | CT_DoExecLog ALL ${make} "${make_args[@]}" oldconfig
+ CT_DoYes | CT_DoExecLog ALL make "${make_args[@]}" oldconfig
# Now filter the multilib flags. manage_uClibc_config did the opposite of
# what Rules.mak in uClibc would do: by the multilib's CFLAGS, it determined
@@ -149,7 +149,7 @@ do_libc_backend_once() {
extra_cflags="-pipe"
{ echo "include Rules.mak"; echo "show-cpu-flags:"; printf '\t@echo $(CPU_CFLAGS)\n'; } \
> .show-cpu-cflags.mk
- cfg_cflags=$( ${make} "${make_args[@]}" \
+ cfg_cflags=$( make "${make_args[@]}" \
--no-print-directory -f .show-cpu-cflags.mk show-cpu-flags )
CT_DoExecLog ALL rm -f .show-cpu-cflags.mk
CT_DoLog DEBUG "CPU_CFLAGS detected by uClibc: ${cfg_cflags[@]}"
@@ -178,19 +178,19 @@ do_libc_backend_once() {
if [ "${libc_mode}" = "startfiles" ]; then
CT_DoLog EXTRA "Building headers"
- CT_DoExecLog ALL ${make} "${make_args[@]}" headers
+ CT_DoExecLog ALL make "${make_args[@]}" headers
# Ensure the directory for installing multilib-specific binaries exists.
CT_DoExecLog ALL mkdir -p "${startfiles_dir}"
CT_DoLog EXTRA "Installing headers"
- CT_DoExecLog ALL ${make} "${make_args[@]}" install_headers
+ CT_DoExecLog ALL make "${make_args[@]}" install_headers
# The check might look bogus, but it is the same condition as is used
# by GCC build script to enable/disable shared library support.
if [ "${CT_THREADS}" = "nptl" ]; then
CT_DoLog EXTRA "Building start files"
- CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" \
+ CT_DoExecLog ALL make ${jflag} "${make_args[@]}" \
lib/crt1.o lib/crti.o lib/crtn.o
# From: http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=ad5668a7ac7e0436db92e55caaf3fdf782b6ba3b
@@ -201,12 +201,12 @@ do_libc_backend_once() {
-shared ${multi_flags} -x c /dev/null -o libdummy.so
CT_DoLog EXTRA "Installing start files"
- CT_DoExecLog ALL ${install} -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
+ CT_DoExecLog ALL install -m 0644 lib/crt1.o lib/crti.o lib/crtn.o \
"${startfiles_dir}"
CT_DoLog EXTRA "Installing dummy shared libs"
- CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libc.so"
- CT_DoExecLog ALL ${install} -m 0755 libdummy.so "${startfiles_dir}/libm.so"
+ CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libc.so"
+ CT_DoExecLog ALL install -m 0755 libdummy.so "${startfiles_dir}/libm.so"
fi # CT_THREADS == nptl
fi # libc_mode == startfiles
@@ -219,8 +219,8 @@ do_libc_backend_once() {
"${startfiles_dir}/libm.so"
CT_DoLog EXTRA "Building C library"
- CT_DoExecLog ALL ${make} "${make_args[@]}" pregen
- CT_DoExecLog ALL ${make} ${jflag} "${make_args[@]}" all
+ CT_DoExecLog ALL make "${make_args[@]}" pregen
+ CT_DoExecLog ALL make ${jflag} "${make_args[@]}" all
# YEM-FIXME:
# - we want to install 'runtime' files, eg. lib*.{a,so*}, crti.o and
@@ -231,7 +231,7 @@ do_libc_backend_once() {
# - "make install" calls install_runtime and install_dev
# - so we're left with re-installing the headers... Sigh...
CT_DoLog EXTRA "Installing C library"
- CT_DoExecLog ALL ${make} "${make_args[@]}" install install_utils
+ CT_DoExecLog ALL make "${make_args[@]}" install install_utils
fi # libc_mode == final
# Now, if installing headers into a subdirectory, put everything in its place.
@@ -377,6 +377,11 @@ manage_uClibc_config() {
case "${CT_THREADS}:${CT_LIBC_UCLIBC_LNXTHRD}" in
none:)
;;
+ linuxthreads:)
+ # Newer version of uClibc-ng, no old/new dichotomy
+ CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
+ CT_KconfigEnableOption "UCLIBC_HAS_LINUXTHREADS" "${dst}"
+ ;;
linuxthreads:old)
CT_KconfigEnableOption "UCLIBC_HAS_THREADS" "${dst}"
CT_KconfigEnableOption "LINUXTHREADS_OLD" "${dst}"