Update scripts for per-board libraries.

Update the various scripts for compiler libraries being built on a
per-board bases, rather than on a per-architecture bases.

BUG=chromium:197654
TEST=Successfully built and installed the compiler and the libraries
(libstdc++, libgcc) separately, using their (new) separate ebuild.
Successfully built and tested (with the three CLs) on remote trybots for
x86-alex-full, lumpy-full and daisy-full.

CQ-DEPEND=CL:60289
CQ-DEPEND=CL:60350

Change-Id: I557c826e5a22500e225ccd3b71555b1fb98ac3ed
Reviewed-on: https://chromium-review.googlesource.com/60303
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Tested-by: Caroline Tice <cmtice@chromium.org>
Commit-Queue: Caroline Tice <cmtice@chromium.org>
diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh
index 5991dfb..b7729ac 100755
--- a/build_library/base_image_util.sh
+++ b/build_library/base_image_util.sh
@@ -211,11 +211,6 @@
     sudo tar xpf - -C "${root_fs_dir}" ./usr/${CHOST} \
       --strip-components=3 "${libc_excludes[@]/#/--exclude=}"
 
-  board_ctarget=$(get_ctarget_from_board "${BOARD}")
-  for atom in $(portageq match / cross-$board_ctarget/gcc); do
-    copy_gcc_libs "${root_fs_dir}" $atom
-  done
-
   if should_build_image ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}; then
     # Install our custom factory install kernel with the appropriate use flags
     # to the image.
diff --git a/common.sh b/common.sh
index 587c767..de0c3d1 100644
--- a/common.sh
+++ b/common.sh
@@ -406,7 +406,6 @@
   /usr/include/nspr/*
   /usr/include/X11/*
   /usr/lib/debug
-  /usr/lib/gcc
   /usr/lib*/pkgconfig
   /usr/local/autotest-chrome
   /usr/man
diff --git a/install_toolchain b/install_toolchain
index b423e04..493a1be 100755
--- a/install_toolchain
+++ b/install_toolchain
@@ -130,7 +130,6 @@
       cmd+=("rm -f '${board_gcc_dir}'")
     fi
     sudo_multi "${cmds[@]}"
-    copy_gcc_libs "${BOARD_ROOT}" "cross-$FLAGS_toolchain/gcc-$gcc_ver"
   else
     cmds=(
       "mkdir -p '${BOARD_ROOT}'{/usr,}/lib64 '${BOARD_ROOT}/usr/lib/debug'"
diff --git a/setup_board b/setup_board
index fd0b963..ce9432e 100755
--- a/setup_board
+++ b/setup_board
@@ -553,15 +553,15 @@
         ${FLAGS_skip_board_pkg_init} -eq ${FLAGS_FALSE} ]]; then
     # Emerge the kernel headers into the board build root.  Use rdeps to
     # avoid pulling any spurious DEPEND things in that we don't care about.
-    KERNEL_EMERGE_FLAGS="--select --quiet --root-deps=rdeps"
+    BASE_EMERGE_FLAGS="--select --quiet --root-deps=rdeps"
     if [[ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ||
           "${FLAGS_reuse_pkgs_from_local_boards}" -eq "${FLAGS_TRUE}" ]]; then
-      KERNEL_EMERGE_FLAGS+=" --getbinpkg --usepkg"
+      BASE_EMERGE_FLAGS+=" --getbinpkg --usepkg"
     fi
 
-    sudo -E "${EMERGE_WRAPPER}" ${KERNEL_EMERGE_FLAGS} \
-      sys-kernel/linux-headers
-    unset KERNEL_EMERGE_FLAGS
+    sudo -E "${EMERGE_WRAPPER}" ${BASE_EMERGE_FLAGS} \
+      sys-kernel/linux-headers sys-libs/gcc-libs
+    unset BASE_EMERGE_FLAGS
   fi
 fi