Remove lib32 code from install-build-deps.sh

Please see https://groups.google.com/a/chromium.org/d/msg/chromium-dev/_bkkbzJTLWw/SrLN3_XgEJQJ
for more info.

BUG=none
R=mmoss@chromium.org

Review URL: https://codereview.chromium.org/472863002

git-svn-id: http://src.chromium.org/svn/trunk/src/build@290235 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
phajdan.jr@chromium.org 2014-08-18 12:30:23 +00:00
Родитель 11f22f58d6
Коммит 6c603c1d3a
1 изменённых файлов: 2 добавлений и 216 удалений

Просмотреть файл

@ -12,7 +12,6 @@ usage() {
echo "Usage: $0 [--options]"
echo "Options:"
echo "--[no-]syms: enable or disable installation of debugging symbols"
echo "--[no-]lib32: enable or disable installation of 32 bit libraries"
echo "--[no-]arm: enable or disable installation of arm cross toolchain"
echo "--[no-]chromeos-fonts: enable or disable installation of Chrome OS"\
"fonts"
@ -45,6 +44,7 @@ do
case "$1" in
--syms) do_inst_syms=1;;
--no-syms) do_inst_syms=0;;
# TODO(phajdan.jr): Remove the lib32 flags when nothing else refers to them.
--lib32) do_inst_lib32=1;;
--no-lib32) do_inst_lib32=0;;
--arm) do_inst_arm=1;;
@ -110,8 +110,7 @@ dev_list="apache2.2-bin bison curl dpkg-dev elfutils devscripts fakeroot flex
wdiff xfonts-mathml zip $chromeos_dev_list"
# 64-bit systems need a minimum set of 32-bit compat packages for the pre-built
# NaCl binaries. These are always needed, regardless of whether or not we want
# the full 32-bit "cross-compile" support (--lib32).
# NaCl binaries.
if file /sbin/init | grep -q 'ELF 64-bit'; then
dev_list="${dev_list} libc6-i386 lib32gcc1 lib32stdc++6"
fi
@ -405,216 +404,3 @@ if test "$do_inst_nacl" = "1"; then
else
echo "Skipping symbolic links for NaCl."
fi
# Install 32bit backwards compatibility support for 64bit systems
if file /sbin/init | grep -q 'ELF 64-bit'; then
if test "$do_inst_lib32" != "1"
then
echo "NOTE: If you were expecting the option to install 32bit libs,"
echo "please run with the --lib32 flag."
echo
echo "Installation complete."
exit 0
else
# This conditional statement has been added to deprecate and eventually
# remove support for 32bit libraries on 64bit systems. But for the time
# being, we still have to support a few legacy systems (e.g. bots), where
# this feature is needed.
# We only even give the user the option to install these libraries, if
# they explicitly requested doing so by setting the --lib32 command line
# flag.
# And even then, we interactively ask them one more time whether they are
# absolutely sure.
# In order for that to work, we must reset the ${do_inst_lib32} variable.
# There are other ways to achieve the same goal. But resetting the
# variable is the best way to document the intended behavior -- and to
# allow us to gradually deprecate and then remove the obsolete code.
if test "${do_default-0}" -ne 1; then
do_inst_lib32=
fi
fi
echo "WARNING"
echo
echo "We no longer recommend that you use this script to install"
echo "32bit libraries on a 64bit system. Instead, consider using the"
echo "install-chroot.sh script to help you set up a 32bit environment"
echo "for building and testing 32bit versions of Chrome."
echo
echo "The code for installing 32bit libraries on a 64bit system is"
echo "unmaintained and might not work with modern versions of Ubuntu"
echo "or Debian."
if test "$do_inst_lib32" != "" ; then
echo
echo -n "Are you sure you want to proceed (y/N) "
if yes_no 1; then
do_inst_lib32=1
fi
fi
if test "$do_inst_lib32" != "1"
then
exit 0
fi
# Standard 32bit compatibility libraries
echo "First, installing the limited existing 32-bit support..."
cmp_list="ia32-libs lib32asound2-dev lib32stdc++6 lib32z1
lib32z1-dev libc6-dev-i386 libc6-i386 g++-multilib"
if [ -n "`apt-cache search lib32readline-gplv2-dev 2>/dev/null`" ]; then
cmp_list="${cmp_list} lib32readline-gplv2-dev"
else
cmp_list="${cmp_list} lib32readline5-dev"
fi
sudo apt-get install ${do_quietly-} $cmp_list
tmp=/tmp/install-32bit.$$
trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
touch "${tmp}/status"
[ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
cat >>"${tmp}/apt/apt.conf" <<EOF
Apt::Architecture "i386";
Dir::Cache "${tmp}/cache";
Dir::Cache::Archives "${tmp}/";
Dir::State::Lists "${tmp}/apt/lists/";
Dir::State::status "${tmp}/status";
EOF
# Download 32bit packages
echo "Computing list of available 32bit packages..."
sudo apt-get -c="${tmp}/apt/apt.conf" update
echo "Downloading available 32bit packages..."
sudo apt-get -c="${tmp}/apt/apt.conf" \
--yes --download-only --force-yes --reinstall install \
${lib_list} ${dbg_list}
# Open packages, remove everything that is not a library, move the
# library to a lib32 directory and package everything as a *.deb file.
echo "Repackaging and installing 32bit packages for use on 64bit systems..."
for i in ${lib_list} ${dbg_list}; do
orig="$(echo "${tmp}/${i}"_*_i386.deb)"
compat="$(echo "${orig}" |
sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')"
rm -rf "${tmp}/staging"
msg="$(fakeroot -u sh -exc '
# Unpack 32bit Debian archive
umask 022
mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN"
cd "'"${tmp}"'/staging"
ar x "'${orig}'"
tar Cfx dpkg data.tar*
tar zCfx dpkg/DEBIAN control.tar.gz
# Create a posix extended regular expression fragment that will
# recognize the includes which have changed. Should be rare,
# will almost always be empty.
includes=`sed -n -e "s/^[0-9a-z]* //g" \
-e "\,usr/include/,p" dpkg/DEBIAN/md5sums |
xargs -n 1 -I FILE /bin/sh -c \
"cmp -s dpkg/FILE /FILE || echo FILE" |
tr "\n" "|" |
sed -e "s,|$,,"`
# If empty, set it to not match anything.
test -z "$includes" && includes="^//"
# Turn the conflicts into an extended RE for removal from the
# Provides line.
conflicts=`sed -n -e "/Conflicts/s/Conflicts: *//;T;s/, */|/g;p" \
dpkg/DEBIAN/control`
# Rename package, change architecture, remove conflicts and dependencies
sed -r -i \
-e "/Package/s/$/-ia32/" \
-e "/Architecture/s/:.*$/: amd64/" \
-e "/Depends/s/:.*/: ia32-libs/" \
-e "/Provides/s/($conflicts)(, *)?//g;T1;s/, *$//;:1" \
-e "/Recommends/d" \
-e "/Conflicts/d" \
dpkg/DEBIAN/control
# Only keep files that live in "lib" directories or the includes
# that have changed.
sed -r -i \
-e "/\/lib64\//d" -e "/\/.?bin\//d" \
-e "\,$includes,s,[ /]include/,&32/,g;s,include/32/,include32/,g" \
-e "s, lib/, lib32/,g" \
-e "s,/lib/,/lib32/,g" \
-e "t;d" \
-e "\,^/usr/lib32/debug\(.*/lib32\),s,^/usr/lib32/debug,/usr/lib/debug," \
dpkg/DEBIAN/md5sums
# Re-run ldconfig after installation/removal
{ echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \
>dpkg/DEBIAN/postinst
{ echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \
>dpkg/DEBIAN/postrm
chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm
# Remove any other control files
find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \
-name postinst -o -name postrm ")" -o -print |
xargs -r rm -rf
# Remove any files/dirs that live outside of "lib" directories,
# or are not in our list of changed includes.
find dpkg -mindepth 1 -regextype posix-extended \
"(" -name DEBIAN -o -name lib -o -regex "dpkg/($includes)" ")" \
-prune -o -print | tac |
xargs -r -n 1 sh -c "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : "
find dpkg -name lib64 -o -name bin -o -name "?bin" |
tac | xargs -r rm -rf
# Remove any symbolic links that were broken by the above steps.
find -L dpkg -type l -print | tac | xargs -r rm -rf
# Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32
# That is where gdb looks for them.
find dpkg -type d -o -path "*/lib/*" -print |
xargs -r -n 1 sh -c "
i=\$(echo \"\${0}\" |
sed -e s,/lib/,/lib32/,g \
-e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,);
mkdir -p \"\${i%/*}\";
mv \"\${0}\" \"\${i}\""
# Rename include to include32.
[ -d "dpkg/usr/include" ] && mv "dpkg/usr/include" "dpkg/usr/include32"
# Prune any empty directories
find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || :
# Create our own Debian package
cd ..
dpkg --build staging/dpkg .' 2>&1)"
compat="$(eval echo $(echo "${compat}" |
sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))"
[ -r "${compat}" ] || {
echo "${msg}" >&2
echo "Failed to build new Debian archive!" >&2
exit 1
}
msg="$(sudo dpkg -i "${compat}" 2>&1)" && {
echo "Installed ${compat##*/}"
} || {
# echo "${msg}" >&2
echo "Skipped ${compat##*/}"
}
done
# Add symbolic links for developing 32bit code
echo "Adding missing symbolic links, enabling 32bit code development..."
for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* |
sed -e 's/[.]so[.][0-9].*/.so/' |
sort -u); do
[ "x${i##*/}" = "xld-linux.so" ] && continue
[ -r "$i" ] && continue
j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
sort -n | tail -n 1)"
[ -r "$i.$j" ] || continue
sudo ln -s "${i##*/}.$j" "$i"
done
fi