public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/3] GCC: Copy minimal sysroot instead of just headers
@ 2014-02-04  8:43 Ray Donnelly
  0 siblings, 0 replies; 2+ messages in thread
From: Ray Donnelly @ 2014-02-04  8:43 UTC (permalink / raw)
  To: crossgcc

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0002-GCC__Copy_minimal_sysroot_instead_of_just_headers.patch --]
[-- Type: application/octet-stream, Size: 2962 bytes --]

# HG changeset patch
# User Ray Donnelly <mingw.android@gmail.com>
# Date 1391500511 0
#      Tue Feb 04 07:55:11 2014 +0000
# Node ID 45760158aca33981b5bb882191043bd708b57dbb
# Parent  2eab7ceda925402555d7d3107e5828734ac74c11
GCC: Copy minimal sysroot instead of just headers

Before starting the build of the 2nd stage GCC,
as well as copying the headers, it is necessary
to also copy the start libraries and stub libc.
copy_headers is renamed to copy_minimal_sysroot
and find is used to copy ${CT_SYSROOT_DIR}/lib*
and ${CT_SYSROOT_DIR}/include otherwise linking
libgcc_s.so fails since GCC "cannot find -lc".

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>

diff -r 2eab7ceda925 -r 45760158aca3 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Tue Feb 04 07:40:45 2014 +0000
+++ b/scripts/build/cc/gcc.sh	Tue Feb 04 07:55:11 2014 +0000
@@ -189,6 +189,7 @@
     local -a core_LDFLAGS
     local -a core_targets
     local arg
+    local sysroot_dirs
 
     for arg in "$@"; do
         eval "${arg// /\\ }"
@@ -201,18 +202,18 @@
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=y  # For baremetal, as there's no headers to copy,
-                            # we copy an empty directory. So, who cares?
+            copy_minimal_sysroot=y  # For baremetal, as there's no minimal sysroot to copy,
+                                    # we copy some empty directories. So, who cares?
             ;;
         shared)
             extra_config+=("--enable-shared")
-            copy_headers=y
+            copy_minimal_sysroot=y
             ;;
         baremetal)
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=n
+            copy_minimal_sysroot=n
             ;;
         *)
             CT_Abort "Internal Error: 'mode' must be one of: 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'"
@@ -225,9 +226,14 @@
         [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
     fi
 
-    if [ "${copy_headers}" = "y" ]; then
-        CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
-        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include"
+    if [ "${copy_minimal_sysroot}" = "y" ]; then
+        CT_DoLog DEBUG "Copying headers and libs to install area of bootstrap gcc, so it can build libgcc2"
+        CT_Pushd "${CT_HEADERS_DIR}/.."
+        sysroot_dirs=$(find . -mindepth 1 -maxdepth 1 -type d \( -name "lib*" -or -name "include" \) -exec basename {} \;)
+        for sysroot_dir in $sysroot_dirs; do
+          CT_DoExecLog ALL cp -a "${sysroot_dir}" "${prefix}/${CT_TARGET}/${sysroot_dir}"
+        done
+        CT_Popd
     fi
 
     for tmp in ARCH ABI CPU TUNE FPU FLOAT; do

[-- Attachment #3: Type: text/plain, Size: 71 bytes --]

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/3] GCC: Copy minimal sysroot instead of just headers
@ 2014-02-04  8:34 Ray Donnelly
  0 siblings, 0 replies; 2+ messages in thread
From: Ray Donnelly @ 2014-02-04  8:34 UTC (permalink / raw)
  To: crossgcc

# HG changeset patch
# User Ray Donnelly <mingw.android@gmail.com>
# Date 1391500511 0
#      Tue Feb 04 07:55:11 2014 +0000
# Node ID 45760158aca33981b5bb882191043bd708b57dbb
# Parent  2eab7ceda925402555d7d3107e5828734ac74c11
GCC: Copy minimal sysroot instead of just headers

Before starting the build of the 2nd stage GCC,
as well as copying the headers, it is necessary
to also copy the start libraries and stub libc.
copy_headers is renamed to copy_minimal_sysroot
and find is used to copy ${CT_SYSROOT_DIR}/lib*
and ${CT_SYSROOT_DIR}/include otherwise linking
libgcc_s.so fails since GCC "cannot find -lc".

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>

diff -r 2eab7ceda925 -r 45760158aca3 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh Tue Feb 04 07:40:45 2014 +0000
+++ b/scripts/build/cc/gcc.sh Tue Feb 04 07:55:11 2014 +0000
@@ -189,6 +189,7 @@
     local -a core_LDFLAGS
     local -a core_targets
     local arg
+    local sysroot_dirs

     for arg in "$@"; do
         eval "${arg// /\\ }"
@@ -201,18 +202,18 @@
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=y  # For baremetal, as there's no headers to copy,
-                            # we copy an empty directory. So, who cares?
+            copy_minimal_sysroot=y  # For baremetal, as there's no
minimal sysroot to copy,
+                                    # we copy some empty directories.
So, who cares?
             ;;
         shared)
             extra_config+=("--enable-shared")
-            copy_headers=y
+            copy_minimal_sysroot=y
             ;;
         baremetal)
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=n
+            copy_minimal_sysroot=n
             ;;
         *)
             CT_Abort "Internal Error: 'mode' must be one of:
'static', 'shared' or 'baremetal', not '${mode:-(empty)}'"
@@ -225,9 +226,14 @@
         [ -n "${CT_TOOLCHAIN_BUGURL}" ] &&
extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
     fi

-    if [ "${copy_headers}" = "y" ]; then
-        CT_DoLog DEBUG "Copying headers to install area of bootstrap
gcc, so it can build libgcc2"
-        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
"${prefix}/${CT_TARGET}/include"
+    if [ "${copy_minimal_sysroot}" = "y" ]; then
+        CT_DoLog DEBUG "Copying headers and libs to install area of
bootstrap gcc, so it can build libgcc2"
+        CT_Pushd "${CT_HEADERS_DIR}/.."
+        sysroot_dirs=$(find . -mindepth 1 -maxdepth 1 -type d \(
-name "lib*" -or -name "include" \) -exec basename {} \;)
+        for sysroot_dir in $sysroot_dirs; do
+          CT_DoExecLog ALL cp -a "${sysroot_dir}"
"${prefix}/${CT_TARGET}/${sysroot_dir}"
+        done
+        CT_Popd
     fi

     for tmp in ARCH ABI CPU TUNE FPU FLOAT; do

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-04  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04  8:43 [PATCH 2/3] GCC: Copy minimal sysroot instead of just headers Ray Donnelly
  -- strict thread matches above, loose matches on Subject: below --
2014-02-04  8:34 Ray Donnelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).