1.1 --- a/arch/arm/functions Mon Aug 11 09:42:13 2008 +0000
1.2 +++ b/arch/arm/functions Mon Aug 11 12:22:47 2008 +0000
1.3 @@ -6,8 +6,8 @@
1.4
1.5 # The system part of the tuple:
1.6 case "${CT_LIBC},${CT_ARCH_ARM_EABI}" in
1.7 - glibc,) CT_TARGET_SYS=gnu;;
1.8 - glibc,y) CT_TARGET_SYS=gnueabi;;
1.9 + *glibc,) CT_TARGET_SYS=gnu;;
1.10 + *glibc,y) CT_TARGET_SYS=gnueabi;;
1.11 uClibc,) CT_TARGET_SYS=uclibc;;
1.12 uClibc,y) CT_TARGET_SYS=uclibcgnueabi;;
1.13 esac
2.1 --- a/config/libc.in Mon Aug 11 09:42:13 2008 +0000
2.2 +++ b/config/libc.in Mon Aug 11 12:22:47 2008 +0000
2.3 @@ -13,6 +13,13 @@
2.4 select LIBC_SUPPORT_NPTL
2.5 select LIBC_SUPPORT_LINUXTHREADS
2.6
2.7 +config LIBC_EGLIBC
2.8 + bool
2.9 + prompt "eglibc (EXPERIMENTAL)"
2.10 + select LIBC_SUPPORT_NPTL
2.11 + select LIBC_SUPPORT_LINUXTHREADS
2.12 + depends on EXPERIMENTAL
2.13 +
2.14 config LIBC_UCLIBC
2.15 bool
2.16 prompt "uClibc"
2.17 @@ -26,6 +33,7 @@
2.18 config LIBC
2.19 string
2.20 default "glibc" if LIBC_GLIBC
2.21 + default "eglibc" if LIBC_EGLIBC
2.22 default "uClibc" if LIBC_UCLIBC
2.23
2.24 config LIBC_SUPPORT_NPTL
2.25 @@ -40,6 +48,10 @@
2.26 source config/libc/glibc.in
2.27 endif
2.28
2.29 +if LIBC_EGLIBC
2.30 +source config/libc/eglibc.in
2.31 +endif
2.32 +
2.33 if LIBC_UCLIBC
2.34 source config/libc/uClibc.in
2.35 endif
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/config/libc/eglibc.in Mon Aug 11 12:22:47 2008 +0000
3.3 @@ -0,0 +1,131 @@
3.4 +# eglibc options
3.5 +
3.6 +choice
3.7 + bool
3.8 + prompt "eglibc version"
3.9 +
3.10 +config EGLIBC_V_TRUNK
3.11 + bool
3.12 + prompt "'trunk'"
3.13 + help
3.14 + Selecting this will export the trunk of the eglibc subversion repository.
3.15 +
3.16 +config EGLIBC_V_2_5
3.17 + bool
3.18 + prompt "2.5"
3.19 +
3.20 +config EGLIBC_V_2_6
3.21 + bool
3.22 + prompt "2.6"
3.23 +
3.24 +config EGLIBC_V_2_7
3.25 + bool
3.26 + prompt "2.7"
3.27 +
3.28 +config EGLIBC_V_2_8
3.29 + bool
3.30 + prompt "2.8"
3.31 +
3.32 +# CT_INSERT_VERSION_ABOVE
3.33 +# Don't remove above line!
3.34 +endchoice
3.35 +
3.36 +config LIBC_VERSION
3.37 + string
3.38 + default "trunk" if EGLIBC_V_TRUNK
3.39 + default "2_5" if EGLIBC_V_2_5
3.40 + default "2_6" if EGLIBC_V_2_6
3.41 + default "2_7" if EGLIBC_V_2_7
3.42 + default "2_8" if EGLIBC_V_2_8
3.43 +# CT_INSERT_VERSION_STRING_ABOVE
3.44 +# Don't remove above line!
3.45 +
3.46 +config EGLIBC_REVISION
3.47 + string
3.48 + prompt "Revision to use"
3.49 + default "HEAD"
3.50 + help
3.51 + Enter the revision of trunk you want to use.
3.52 + Default is HEAD.
3.53 +
3.54 + A revision argument can be one of:
3.55 + NUMBER revision number
3.56 + '{' DATE '}' revision at start of the date (*)
3.57 + 'HEAD' latest in repository
3.58 +
3.59 + (*) If you want to use a date, please use ISO-8601 formats if
3.60 + at all possible.
3.61 +
3.62 +config EGLIBC_CHECKOUT
3.63 + bool
3.64 + prompt "checkout instead of export"
3.65 + default y if EGLIBC_V_TRUNK
3.66 + default n if ! EGLIBC_V_TRUNK
3.67 + help
3.68 + By default, the eglibc download will be an export of the subversion
3.69 + repository. If you say 'y' here, then the repository will instead be
3.70 + checked-out, so that you can update it later.
3.71 +
3.72 + Note that crosstool-NG will *not* update your working copy, you will
3.73 + have to do that yourself.
3.74 +
3.75 +config LIBC_EGLIBC_EXTRA_CONFIG
3.76 + string
3.77 + prompt "eglibc extra config"
3.78 + default ""
3.79 + help
3.80 + Extra flags to pass onto ./configure when configuring eglibc.
3.81 +
3.82 + Eg.: --enable-static-nss
3.83 +
3.84 +config LIBC_EGLIBC_EXTRA_CFLAGS
3.85 + string
3.86 + prompt "eglibc extra target CFLAGS"
3.87 + default ""
3.88 + help
3.89 + Extra target CFLAGS to use when building eglibc.
3.90 +
3.91 +config LIBC_EXTRA_CC_ARGS
3.92 + string
3.93 + prompt "gcc extra flags"
3.94 + default ""
3.95 + help
3.96 + Extra flags to pass gcc when building eglibc.
3.97 +
3.98 + Seldom used, except for sparc64 which seems to need the flag -64
3.99 + to be passed onto gcc.
3.100 +
3.101 +config LIBC_EGLIBC_USE_PORTS
3.102 + bool
3.103 + prompt "Use the ports addon"
3.104 + default n
3.105 + help
3.106 + The ports addon contains some architecture ports that are not available
3.107 + in the official glibc distribution.
3.108 +
3.109 + For example, this is the case for ARM with glibc >= 2.4
3.110 +
3.111 + Say n only if you're sure that your architecture is in the official
3.112 + glibc distribution for your chosen version.
3.113 +
3.114 +config LIBC_ADDONS
3.115 + bool
3.116 + prompt "Pass extra addons list"
3.117 + default n
3.118 + help
3.119 + If you say Y here, you'll be able to give the list of addons you want to
3.120 + include in your C library.
3.121 +
3.122 +config LIBC_ADDONS_LIST
3.123 + string
3.124 + prompt "Extra addons"
3.125 + default ""
3.126 + depends on LIBC_ADDONS
3.127 + help
3.128 + Extra addons to include in eglibc. Space separated list.
3.129 +
3.130 + You need to specify neither linuxthreads nor nptl, as they are added
3.131 + automagically for you depending on the threading model you choosed
3.132 + earlier.
3.133 +
3.134 + Eg.: crypt (for very old glibces)
4.1 --- a/docs/CREDITS Mon Aug 11 09:42:13 2008 +0000
4.2 +++ b/docs/CREDITS Mon Aug 11 12:22:47 2008 +0000
4.3 @@ -56,6 +56,7 @@
4.4
4.5 Thomas Jourdan:
4.6 - intense gcc-4.3 brainstorming
4.7 + - eglibc support
4.8
4.9 Many others have contributed, either in form of patches, suggestions,
4.10 comments, or testing... Thank you to all of you!
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/scripts/build/libc_eglibc.sh Mon Aug 11 12:22:47 2008 +0000
5.3 @@ -0,0 +1,283 @@
5.4 +# eglibc build functions (initially by Thomas JOURDAN).
5.5 +
5.6 +do_print_filename() {
5.7 + [ "${CT_LIBC}" = "eglibc" ] || return 0
5.8 + echo "eglibc-${CT_LIBC_VERSION}"
5.9 + for addon in $(do_libc_add_ons_list " "); do
5.10 + # NPTL addon is not to be downloaded, in any case
5.11 + [ "${addon}" = "nptl" ] && continue || true
5.12 + echo "eglibc-${addon}-${CT_LIBC_VERSION}"
5.13 + done
5.14 +}
5.15 +
5.16 +# Download eglibc repository
5.17 +do_eglibc_get() {
5.18 + CT_HasOrAbort svn
5.19 +
5.20 + case "${CT_LIBC_VERSION}" in
5.21 + trunk) svn_url="svn://svn.eglibc.org/trunk";;
5.22 + *) svn_url="svn://svn.eglibc.org/branches/eglibc-${CT_LIBC_VERSION}";;
5.23 + esac
5.24 +
5.25 + CT_MktempDir tmp_dir
5.26 + CT_Pushd "${tmp_dir}"
5.27 +
5.28 + case "${CT_EGLIBC_CHECKOUT}" in
5.29 + y) svn_action="checkout";;
5.30 + *) svn_action="export --force";;
5.31 + esac
5.32 +
5.33 + CT_DoSetProxy ${CT_PROXY_TYPE}
5.34 + CT_DoExecLog ALL svn ${svn_action} -r "${CT_EGLIBC_REVISION:-HEAD}" "${svn_url}" . 2>&1
5.35 +
5.36 + # Compress eglibc
5.37 + CT_DoExecLog ALL mv libc "${CT_LIBC_FILE}"
5.38 + CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC_FILE}.tar.bz2" "${CT_LIBC_FILE}"
5.39 +
5.40 + # Compress linuxthreads, localedef and ports
5.41 + # Assign them the name the way ct-ng like it
5.42 + for addon in linuxthreads localedef ports; do
5.43 + CT_DoExecLog ALL tar cjf "${CT_TARBALLS_DIR}/${CT_LIBC}-${addon}-${CT_LIBC_VERSION}.tar.bz2" "${addon}"
5.44 + done
5.45 +
5.46 + CT_Popd
5.47 +
5.48 + # Remove source files
5.49 + CT_DoExecLog ALL rm -rf "${tmp_dir}"
5.50 +}
5.51 +
5.52 +# Download glibc
5.53 +do_libc_get() {
5.54 + # eglibc is only available through subversion, there are no
5.55 + # snapshots available. Moreover, addons will be downloaded
5.56 + # simultaneously.
5.57 +
5.58 + # build filename
5.59 + eglibc="${CT_LIBC_FILE}.tar.bz2"
5.60 + eglibc_linuxthreads="${CT_LIBC}-linuxthreads-${CT_LIBC_VERSION}.tar.bz2"
5.61 + eglibc_localedef="${CT_LIBC}-localedef-${CT_LIBC_VERSION}.tar.bz2"
5.62 + eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
5.63 +
5.64 + # Check if every tarballs are already present
5.65 + if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ] && \
5.66 + [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
5.67 + [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ] && \
5.68 + [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
5.69 + CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
5.70 + return 0
5.71 + fi
5.72 +
5.73 + if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ] && \
5.74 + [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
5.75 + [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ] && \
5.76 + [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ] && \
5.77 + [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
5.78 + CT_DoLog EXTRA "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
5.79 + for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
5.80 + CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${file}"
5.81 + done
5.82 + return 0
5.83 + fi
5.84 +
5.85 + # Not found locally, try from the network
5.86 + CT_DoLog EXTRA "Retrieving eglibc from network"
5.87 + do_eglibc_get
5.88 +
5.89 + if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
5.90 + CT_DoLog EXTRA "Saving eglibc files to local storage"
5.91 + for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
5.92 + CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"
5.93 + CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${file}"
5.94 + done
5.95 + fi
5.96 +
5.97 + return 0
5.98 +}
5.99 +
5.100 +# Extract eglibc
5.101 +do_libc_extract() {
5.102 + CT_ExtractAndPatch "${CT_LIBC_FILE}"
5.103 +
5.104 + # C library addons
5.105 + for addon in $(do_libc_add_ons_list " "); do
5.106 + # NPTL addon is not to be extracted, in any case
5.107 + [ "${addon}" = "nptl" ] && continue || true
5.108 + CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
5.109 + done
5.110 +
5.111 + return 0
5.112 +}
5.113 +
5.114 +# There is nothing to do for eglibc check config
5.115 +do_libc_check_config() {
5.116 + :
5.117 +}
5.118 +
5.119 +# This function installs the glibc headers needed to build the core compiler
5.120 +do_libc_headers() {
5.121 + # Instead of doing two time the same actions, headers will
5.122 + # be installed with start files
5.123 + :
5.124 +}
5.125 +
5.126 +# Build and install start files
5.127 +do_libc_start_files() {
5.128 + CT_DoStep INFO "Installing C library headers / start files"
5.129 +
5.130 + mkdir -p "${CT_BUILD_DIR}/build-libc-startfiles"
5.131 + cd "${CT_BUILD_DIR}/build-libc-startfiles"
5.132 +
5.133 + CT_DoLog EXTRA "Configuring C library"
5.134 +
5.135 + cross_cc=$(CT_Which "${CT_TARGET}-gcc")
5.136 + cross_cxx=$(CT_Which "${CT_TARGET}-g++")
5.137 + cross_ar=$(CT_Which "${CT_TARGET}-ar")
5.138 + cross_ranlib=$(CT_Which "${CT_TARGET}-ranlib")
5.139 +
5.140 + CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
5.141 + CT_DoLog DEBUG "Using g++ for target: '${cross_cxx}'"
5.142 + CT_DoLog DEBUG "Using ar for target: '${cross_ar}'"
5.143 + CT_DoLog DEBUG "Using ranlib for target: '${cross_ranlib}'"
5.144 +
5.145 + BUILD_CC=${CT_CC_NATIVE} \
5.146 + CC=${cross_cc} \
5.147 + CXX=${cross_cxx} \
5.148 + AR=${cross_ar} \
5.149 + RANLIB=${cross_ranlib} \
5.150 + CT_DoExecLog ALL \
5.151 + "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
5.152 + --prefix=/usr \
5.153 + --with-headers="${CT_HEADERS_DIR}" \
5.154 + --build="${CT_UNIQ_BUILD}" \
5.155 + --host="${CT_TARGET}" \
5.156 + --disable-profile \
5.157 + --without-gd \
5.158 + --without-cvs \
5.159 + --enable-add-ons
5.160 +
5.161 + CT_DoLog EXTRA "Installing C library headers"
5.162 +
5.163 + # use the 'install-headers' makefile target to install the
5.164 + # headers
5.165 +
5.166 + CT_DoExecLog ALL \
5.167 + make install-headers \
5.168 + install_root=${CT_SYSROOT_DIR} \
5.169 + install-bootstrap-headers=yes
5.170 +
5.171 + CT_DoLog EXTRA "Installing C library start files"
5.172 +
5.173 + # there are a few object files needed to link shared libraries,
5.174 + # which we build and install by hand
5.175 +
5.176 + CT_DoExecLog ALL mkdir -p ${CT_SYSROOT_DIR}/usr/lib
5.177 + CT_DoExecLog ALL make csu/subdir_lib
5.178 + CT_DoExecLog ALL cp csu/crt1.o csu/crti.o csu/crtn.o \
5.179 + ${CT_SYSROOT_DIR}/usr/lib
5.180 +
5.181 + # Finally, 'libgcc_s.so' requires a 'libc.so' to link against.
5.182 + # However, since we will never actually execute its code,
5.183 + # it doesn't matter what it contains. So, treating '/dev/null'
5.184 + # as a C source file, we produce a dummy 'libc.so' in one step
5.185 +
5.186 + CT_DoExecLog ALL ${cross_cc} -nostdlib -nostartfiles -shared -x c /dev/null -o ${CT_SYSROOT_DIR}/usr/lib/libc.so
5.187 +
5.188 + CT_EndStep
5.189 +}
5.190 +
5.191 +# This function builds and install the full glibc
5.192 +do_libc() {
5.193 + CT_DoStep INFO "Installing C library"
5.194 +
5.195 + mkdir -p "${CT_BUILD_DIR}/build-libc"
5.196 + cd "${CT_BUILD_DIR}/build-libc"
5.197 +
5.198 + CT_DoLog EXTRA "Configuring C library"
5.199 +
5.200 + # Add some default glibc config options if not given by user.
5.201 + # We don't need to be conditional on wether the user did set different
5.202 + # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
5.203 +
5.204 + extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
5.205 +
5.206 + case "${CT_THREADS}" in
5.207 + nptl) extra_config="${extra_config} --with-__thread --with-tls";;
5.208 + linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
5.209 + none) extra_config="${extra_config} --without-__thread --without-nptl"
5.210 + case "${CT_LIBC_EGLIBC_EXTRA_CONFIG}" in
5.211 + *-tls*) ;;
5.212 + *) extra_config="${extra_config} --without-tls";;
5.213 + esac
5.214 + ;;
5.215 + esac
5.216 +
5.217 + case "${CT_SHARED_LIBS}" in
5.218 + y) extra_config="${extra_config} --enable-shared";;
5.219 + *) extra_config="${extra_config} --disable-shared";;
5.220 + esac
5.221 +
5.222 + case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
5.223 + y,) extra_config="${extra_config} --with-fp";;
5.224 + ,y) extra_config="${extra_config} --without-fp";;
5.225 + esac
5.226 +
5.227 + case "$(do_libc_add_ons_list ,)" in
5.228 + "") ;;
5.229 + *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
5.230 + esac
5.231 +
5.232 + extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
5.233 +
5.234 + cross_cc=$(CT_Which "${CT_TARGET}-gcc")
5.235 +
5.236 + CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
5.237 + CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
5.238 + CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
5.239 + CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
5.240 +
5.241 + BUILD_CC=${CT_CC_NATIVE} \
5.242 + CFLAGS="${CT_TARGET_CFLAGS} ${CT_LIBC_EGLIBC_EXTRA_CFLAGS} -O" \
5.243 + CC="${CT_TARGET}-gcc ${CT_LIBC_EXTRA_CC_ARGS} ${extra_cc_args}" \
5.244 + AR=${CT_TARGET}-ar \
5.245 + RANLIB=${CT_TARGET}-ranlib \
5.246 + CT_DoExecLog ALL \
5.247 + "${CT_SRC_DIR}/${CT_LIBC_FILE}/configure" \
5.248 + --prefix=/usr \
5.249 + --with-headers="${CT_HEADERS_DIR}" \
5.250 + --build=${CT_UNIQ_BUILD} \
5.251 + --host=${CT_TARGET} \
5.252 + --disable-profile \
5.253 + --without-gd \
5.254 + --without-cvs \
5.255 + ${extra_config} \
5.256 + ${CT_LIBC_EGLIBC_EXTRA_CONFIG}
5.257 +
5.258 + CT_DoLog EXTRA "Building C library"
5.259 +
5.260 + CT_DoExecLog ALL make
5.261 +
5.262 + CT_DoLog EXTRA "Installing C library"
5.263 +
5.264 + CT_DoExecLog ALL make install install_root="${CT_SYSROOT_DIR}"
5.265 +
5.266 + CT_EndStep
5.267 +}
5.268 +
5.269 +# This function finishes the glibc install
5.270 +do_libc_finish() {
5.271 + # Nothing to be done for eglibc
5.272 + :
5.273 +}
5.274 +
5.275 +# Build up the addons list, separated with $1
5.276 +do_libc_add_ons_list() {
5.277 + local sep="$1"
5.278 + local addons_list=$(echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,)
5.279 + case "${CT_THREADS}" in
5.280 + none) ;;
5.281 + *) addons_list="${addons_list}${sep}${CT_THREADS}";;
5.282 + esac
5.283 + [ "${CT_LIBC_EGLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
5.284 + addons_list="${addons_list%%${sep}}"
5.285 + echo "${addons_list##${sep}}"
5.286 +}
6.1 --- a/scripts/functions Mon Aug 11 09:42:13 2008 +0000
6.2 +++ b/scripts/functions Mon Aug 11 12:22:47 2008 +0000
6.3 @@ -253,6 +253,8 @@
6.4 # Some mktemp do not allow more than 6 Xs
6.5 eval "$1"=$(mktemp -q -d "${CT_BUILD_DIR}/.XXXXXX")
6.6 CT_TestOrAbort "Could not make temporary directory" -n "${!1}" -a -d "${!1}"
6.7 + CT_DoLog DEBUG "Made temporary directory '${!1}'"
6.8 + return 0
6.9 }
6.10
6.11 # Echoes the specified string on stdout until the pipe breaks.
6.12 @@ -546,7 +548,7 @@
6.13
6.14 # Add-ons need a little love, really.
6.15 case "${file}" in
6.16 - glibc-[a-z]*-*)
6.17 + glibc-[a-z]*-*|eglibc-[a-z]*-*)
6.18 CT_TestAndAbort "Trying to extract the C-library addon/locales '${file}' when C-library not yet extracted" ! -d "${CT_LIBC_FILE}"
6.19 cd "${CT_LIBC_FILE}"
6.20 libc_addon=y
6.21 @@ -674,7 +676,7 @@
6.22 # Set defaults for the system part of the tuple. Can be overriden
6.23 # by architecture-specific values.
6.24 case "${CT_LIBC}" in
6.25 - glibc) CT_TARGET_SYS=gnu;;
6.26 + *glibc) CT_TARGET_SYS=gnu;;
6.27 uClibc) CT_TARGET_SYS=uclibc;;
6.28 esac
6.29