blob: eddd37fde383162a84b242f79dbcf214e1ece22b [file] [log] [blame]
[email protected]e041ed12009-03-10 16:43:011#!/bin/bash -e
2
[email protected]e46cdae2009-08-25 20:59:273# Copyright (c) 2009 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
[email protected]cf1df402008-10-31 21:45:307# Script to install everything needed to build chromium (well, ideally, anyway)
[email protected]592ea8ca2008-11-03 19:47:368# See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions
9# and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit
[email protected]cf1df402008-10-31 21:45:3010
[email protected]1eae2bfb2010-01-26 18:17:5311usage() {
12 echo "Usage: $0 [--options]"
13 echo "Options:"
14 echo "--[no-]syms: enable or disable installation of debugging symbols"
15 echo "--[no-]gold: enable or disable installation of gold linker"
16 echo "--[no-]lib32: enable or disable installation of 32 bit libraries"
17 echo "Script will prompt interactively if options not given."
18 exit 1
19}
20
21while test "$1" != ""
22do
23 case "$1" in
24 --syms) do_inst_syms=1;;
25 --no-syms) do_inst_syms=0;;
26 --gold) do_inst_gold=1;;
27 --no-gold) do_inst_gold=0;;
28 --lib32) do_inst_lib32=1;;
29 --no-lib32) do_inst_lib32=0;;
30 *) usage;;
31 esac
32 shift
33done
34
[email protected]c87aa982009-06-11 17:44:0435install_gold() {
36 # Gold is optional; it's a faster replacement for ld,
37 # and makes life on 2GB machines much more pleasant.
38
[email protected]b62f11e72010-05-03 17:20:4539 # First make sure root can access this directory, as that's tripped
40 # up some folks.
[email protected]1bf2ac972009-06-30 23:57:4841 if sudo touch xyz.$$
42 then
43 sudo rm xyz.$$
44 else
45 echo root cannot write to the current directory, not installing gold
46 return
47 fi
48
[email protected]d42915d42009-11-18 10:36:4649 BINUTILS=binutils-2.20
[email protected]c87aa982009-06-11 17:44:0450 BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
[email protected]d42915d42009-11-18 10:36:4651 BINUTILS_SHA1=747e7b4d94bce46587236dc5f428e5b412a590dc
[email protected]c87aa982009-06-11 17:44:0452
53 test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL
[email protected]d42915d42009-11-18 10:36:4654 if test "`sha1sum $BINUTILS.tar.bz2|cut -d' ' -f1`" != "$BINUTILS_SHA1"
[email protected]c87aa982009-06-11 17:44:0455 then
56 echo Bad sha1sum for $BINUTILS.tar.bz2
57 exit 1
58 fi
[email protected]0b53eb02009-09-23 22:22:4759
[email protected]c87aa982009-06-11 17:44:0460 cat > binutils-fix.patch <<__EOF__
[email protected]d42915d42009-11-18 10:36:4661--- binutils-2.20/gold/output.cc.orig 2009-11-17 17:40:49.000000000 -0800
62+++ binutils-2.20/gold/output.cc 2009-11-17 18:27:21.000000000 -0800
63@@ -22,6 +22,10 @@
[email protected]c87aa982009-06-11 17:44:0464
[email protected]d42915d42009-11-18 10:36:4665 #include "gold.h"
[email protected]c87aa982009-06-11 17:44:0466
[email protected]d42915d42009-11-18 10:36:4667+#if !defined(__STDC_FORMAT_MACROS)
68+#define __STDC_FORMAT_MACROS
69+#endif
70+
71 #include <cstdlib>
72 #include <cstring>
73 #include <cerrno>
74@@ -29,6 +33,7 @@
75 #include <unistd.h>
76 #include <sys/mman.h>
77 #include <sys/stat.h>
78+#include <inttypes.h>
79 #include <algorithm>
80 #include "libiberty.h"
[email protected]0b53eb02009-09-23 22:22:4781
[email protected]d42915d42009-11-18 10:36:4682@@ -3505,11 +3510,11 @@
83 Output_section* os = (*p)->output_section();
84 if (os == NULL)
85 gold_error(_("dot moves backward in linker script "
86- "from 0x%llx to 0x%llx"),
87+ "from 0x%"PRIx64" to 0x%"PRIx64),
88 addr + (off - startoff), (*p)->address());
89 else
90 gold_error(_("address of section '%s' moves backward "
91- "from 0x%llx to 0x%llx"),
92+ "from 0x%"PRIx64" to 0x%"PRIx64),
93 os->name(), addr + (off - startoff),
94 (*p)->address());
95 }
[email protected]c87aa982009-06-11 17:44:0496__EOF__
97
98 tar -xjvf $BINUTILS.tar.bz2
99 cd $BINUTILS
100 patch -p1 < ../binutils-fix.patch
101 ./configure --prefix=/usr/local/gold --enable-gold
102 make -j3
[email protected]1bf2ac972009-06-30 23:57:48103 if sudo make install
104 then
105 # Still need to figure out graceful way of pointing gyp to use
106 # /usr/local/gold/bin/ld without requiring him to set environment
107 # variables. That will go into bootstrap-linux.sh when it's ready.
108 echo "Installing gold as /usr/bin/ld."
109 echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'"
[email protected]803c45c52009-11-18 10:58:00110 test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \
111 sudo mv /usr/bin/ld /usr/bin/ld.orig
[email protected]b2e24bd2009-09-10 17:45:39112 sudo strip /usr/local/gold/bin/ld
[email protected]1bf2ac972009-06-30 23:57:48113 sudo ln -fs /usr/local/gold/bin/ld /usr/bin/ld.gold
114 sudo ln -fs /usr/bin/ld.gold /usr/bin/ld
115 else
116 echo "make install failed, not installing gold"
117 fi
[email protected]c87aa982009-06-11 17:44:04118}
119
[email protected]b62f11e72010-05-03 17:20:45120if ! egrep -q 'Ubuntu (8\.04|8\.10|9\.04|9\.10|10\.04|karmic|lucid)' /etc/issue; then
121 echo "Only Ubuntu 8.04 (hardy) through 10.04 (lucid) are currently supported" >&2
[email protected]cf1df402008-10-31 21:45:30122 exit 1
123fi
[email protected]cf1df402008-10-31 21:45:30124
[email protected]e041ed12009-03-10 16:43:01125if ! uname -m | egrep -q "i686|x86_64"; then
126 echo "Only x86 architectures are currently supported" >&2
127 exit
128fi
129
130if [ "x$(id -u)" != x0 ]; then
131 echo "Running as non-root user."
132 echo "You might have to enter your password one or more times for 'sudo'."
[email protected]8ada8c52009-03-10 21:53:08133 echo
[email protected]e041ed12009-03-10 16:43:01134fi
135
[email protected]fdc6bf52010-06-07 22:01:57136# Packages needed for chromeos only
137chromeos_dev_list="libpulse-dev"
138
[email protected]e041ed12009-03-10 16:43:01139# Packages need for development
[email protected]b62f11e72010-05-03 17:20:45140dev_list="apache2 bison fakeroot flex g++ gperf libapache2-mod-php5
[email protected]cd03d822010-05-13 21:11:20141 libasound2-dev libbz2-dev libcairo2-dev libdbus-glib-1-dev
142 libgconf2-dev libgl1-mesa-dev libglu1-mesa-dev libglib2.0-dev
143 libgtk2.0-dev libjpeg62-dev libnspr4-dev libnss3-dev libpam0g-dev
144 libsqlite3-dev libxslt1-dev libxss-dev lighttpd mesa-common-dev
145 msttcorefonts patch perl php5-cgi pkg-config python python-dev rpm
[email protected]69e297f2010-05-21 23:13:39146 subversion ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho wdiff
[email protected]fdc6bf52010-06-07 22:01:57147 libcurl4-gnutls-dev $chromeos_dev_list"
148
149# Run-time libraries required by chromeos only
150chromeos_lib_list="libpulse0"
[email protected]e041ed12009-03-10 16:43:01151
152# Full list of required run-time libraries
[email protected]e3212ba2010-03-11 15:27:24153lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libdbus-glib-1-2 libexpat1
[email protected]e20189e2009-10-30 22:38:55154 libfontconfig1 libfreetype6 libglib2.0-0 libgtk2.0-0 libnspr4-0d
155 libnss3-1d libpango1.0-0 libpcre3 libpixman-1-0 libpng12-0 libstdc++6
[email protected]c87aa982009-06-11 17:44:04156 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1
[email protected]c8975ad2009-05-13 00:33:29157 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6
[email protected]fdc6bf52010-06-07 22:01:57158 libxinerama1 libxrandr2 libxrender1 zlib1g $chromeos_lib_list"
[email protected]e041ed12009-03-10 16:43:01159
160# Debugging symbols for all of the run-time libraries
[email protected]84421462010-03-11 17:20:25161dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg
[email protected]e759c4b2010-03-10 19:04:58162 libfontconfig1-dbg libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg
163 libnss3-1d-dbg libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg
164 libx11-6-dbg libxau6-dbg libxcb1-dbg libxcomposite1-dbg
[email protected]e041ed12009-03-10 16:43:01165 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg
166 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg
167 libxrender1-dbg zlib1g-dbg"
168
[email protected]cd03d822010-05-13 21:11:20169# CUPS package changed it's name from hardy to the next version. Include
170# proper package here depending on the system.
[email protected]1437d242010-05-14 03:10:46171if egrep -q 'Ubuntu (8\.04|8\.10)' /etc/issue; then
[email protected]cd03d822010-05-13 21:11:20172 dev_list="${dev_list} libcupsys2-dev"
173else
174 dev_list="${dev_list} libcups2-dev"
175fi
176
[email protected]8ada8c52009-03-10 21:53:08177# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
178# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
179# been provided to yes_no(), the function also accepts RETURN as a user input.
180# The parameter specifies the exit code that should be returned in that case.
181# The function will echo the user's selection followed by a newline character.
182# Users can abort the function by pressing CTRL-C. This will call "exit 1".
183yes_no() {
184 local c
185 while :; do
186 c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
187 stty -echo iuclc -icanon 2>/dev/null
188 dd count=1 bs=1 2>/dev/null | od -An -tx1)"
189 case "$c" in
190 " 0a") if [ -n "$1" ]; then
191 [ $1 -eq 0 ] && echo "Y" || echo "N"
192 return $1
193 fi
194 ;;
195 " 79") echo "Y"
196 return 0
197 ;;
198 " 6e") echo "N"
199 return 1
200 ;;
201 "") echo "Aborted" >&2
202 exit 1
203 ;;
204 *) # The user pressed an unrecognized key. As we are not echoing
205 # any incorrect user input, alert the user by ringing the bell.
206 (tput bel) 2>/dev/null
207 ;;
208 esac
209 done
210}
211
[email protected]1eae2bfb2010-01-26 18:17:53212if test "$do_inst_syms" = ""
213then
214 echo "This script installs all tools and libraries needed to build Chromium."
215 echo ""
216 echo "For most of the libraries, it can also install debugging symbols, which"
217 echo "will allow you to debug code in the system libraries. Most developers"
218 echo "won't need these symbols."
219 echo -n "Do you want me to install them for you (y/N) "
220 if yes_no 1; then
221 do_inst_syms=1
222 fi
223fi
224if test "$do_inst_syms" = "1"; then
[email protected]8ada8c52009-03-10 21:53:08225 echo "Installing debugging symbols."
226else
227 echo "Skipping installation of debugging symbols."
228 dbg_list=
229fi
230
[email protected]e041ed12009-03-10 16:43:01231sudo apt-get update
232
233# We initially run "apt-get" with the --reinstall option and parse its output.
234# This way, we can find all the packages that need to be newly installed
235# without accidentally promoting any packages from "auto" to "manual".
236# We then re-run "apt-get" with just the list of missing packages.
237echo "Finding missing packages..."
[email protected]12de04f2009-08-11 17:30:48238packages="${dev_list} ${lib_list} ${dbg_list}"
[email protected]b6e064522009-08-10 18:47:51239# Intentially leaving $packages unquoted so it's more readable.
240echo "Packages required: " $packages
241echo
[email protected]79a9d2962009-08-06 21:10:58242new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
[email protected]b62f11e72010-05-03 17:20:45243if new_list="$(yes n | LANG=C $new_list_cmd)"; then
[email protected]b6e064522009-08-10 18:47:51244 # We probably never hit this following line.
[email protected]79a9d2962009-08-06 21:10:58245 echo "No missing packages, and the packages are up-to-date."
[email protected]b62f11e72010-05-03 17:20:45246elif [ $? -eq 1 ]; then
[email protected]79a9d2962009-08-06 21:10:58247 # We expect apt-get to have exit status of 1.
248 # This indicates that we canceled the install with "yes n|".
[email protected]b6e064522009-08-10 18:47:51249 new_list=$(echo "$new_list" |
[email protected]79a9d2962009-08-06 21:10:58250 sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
[email protected]b6e064522009-08-10 18:47:51251 new_list=$(echo "$new_list" | sed 's/ *$//')
252 if [ -z "$new_list" ] ; then
253 echo "No missing packages, and the packages are up-to-date."
254 else
255 echo "Installing missing packages: $new_list."
256 sudo apt-get install ${new_list}
257 fi
258 echo
[email protected]79a9d2962009-08-06 21:10:58259else
260 # An apt-get exit status of 100 indicates that a real error has occurred.
[email protected]e041ed12009-03-10 16:43:01261
[email protected]79a9d2962009-08-06 21:10:58262 # I am intentionally leaving out the '"'s around new_list_cmd,
263 # as this makes it easier to cut and paste the output
[email protected]79a9d2962009-08-06 21:10:58264 echo "The following command failed: " ${new_list_cmd}
265 echo
266 echo "It produces the following output:"
267 yes n | $new_list_cmd || true
268 echo
269 echo "You will have to install the above packages yourself."
270 echo
271 exit 100
272fi
[email protected]e041ed12009-03-10 16:43:01273
[email protected]b62f11e72010-05-03 17:20:45274# Some operating systems already ship gold (on recent Debian and
275# Ubuntu you can do "apt-get install binutils-gold" to get it), but
276# older releases didn't. So install from source if it isn't the
277# default linker.
[email protected]c87aa982009-06-11 17:44:04278
279case `ld --version` in
[email protected]db2ff4b42010-01-12 21:28:33280*gold*2.2*) ;;
[email protected]c87aa982009-06-11 17:44:04281* )
[email protected]1eae2bfb2010-01-26 18:17:53282 if test "$do_inst_gold" = ""
283 then
284 echo "Gold is a new linker that links Chrome 5x faster than ld."
285 echo "Don't use it if you need to link other apps (e.g. valgrind, wine)"
286 echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) "
287 if yes_no 1; then
288 do_inst_gold=1
289 fi
290 fi
291 if test "$do_inst_gold" = "1"
292 then
[email protected]f95691682009-11-17 05:19:56293 # If the system provides gold, just install it.
294 if apt-cache show binutils-gold >/dev/null; then
295 echo "Installing binutils-gold. Backing up ld as ld.single."
296 sudo apt-get install binutils-gold
297 else
298 # FIXME: avoid installing as /usr/bin/ld
299 echo "Building binutils. Backing up ld as ld.orig."
300 install_gold || exit 99
301 fi
[email protected]c87aa982009-06-11 17:44:04302 else
303 echo "Not installing gold."
304 fi
305esac
306
[email protected]e041ed12009-03-10 16:43:01307# Install 32bit backwards compatibility support for 64bit systems
[email protected]b6e064522009-08-10 18:47:51308if [ "$(uname -m)" = "x86_64" ]; then
[email protected]1eae2bfb2010-01-26 18:17:53309 if test "$do_inst_lib32" = ""
310 then
311 echo "Installing 32bit libraries not already provided by the system"
312 echo
[email protected]b62f11e72010-05-03 17:20:45313 echo "This is only needed to build a 32-bit Chrome on your 64-bit system."
314 echo
[email protected]1eae2bfb2010-01-26 18:17:53315 echo "While we only need to install a relatively small number of library"
316 echo "files, we temporarily need to download a lot of large *.deb packages"
317 echo "that contain these files. We will create new *.deb packages that"
318 echo "include just the 32bit libraries. These files will then be found on"
319 echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32,"
320 echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files,"
321 echo "look for packages named *-ia32.deb."
322 echo "Do you want me to download all packages needed to build new 32bit"
323 echo -n "package files (Y/n) "
[email protected]628b7ca2010-01-28 02:44:26324 if yes_no 0; then
[email protected]1eae2bfb2010-01-26 18:17:53325 do_inst_lib32=1
326 fi
327 fi
328 if test "$do_inst_lib32" != "1"
329 then
[email protected]8ada8c52009-03-10 21:53:08330 echo "Exiting without installing any 32bit libraries."
331 exit 0
332 fi
[email protected]b62f11e72010-05-03 17:20:45333
334 # Standard 32bit compatibility libraries
335 echo "First, installing the limited existing 32-bit support..."
336 cmp_list="ia32-libs lib32asound2-dev lib32readline5-dev lib32stdc++6 lib32z1
337 lib32z1-dev libc6-dev-i386 libc6-i386 g++-multilib"
[email protected]a81e44e12010-05-17 21:16:53338 sudo apt-get install $cmp_list
[email protected]b62f11e72010-05-03 17:20:45339
[email protected]e041ed12009-03-10 16:43:01340 tmp=/tmp/install-32bit.$$
341 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
342 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
343 touch "${tmp}/status"
344
345 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
[email protected]b6e064522009-08-10 18:47:51346 cat >>"${tmp}/apt/apt.conf" <<EOF
[email protected]79a9d2962009-08-06 21:10:58347 Apt::Architecture "i386";
348 Dir::Cache "${tmp}/cache";
349 Dir::Cache::Archives "${tmp}/";
350 Dir::State::Lists "${tmp}/apt/lists/";
351 Dir::State::status "${tmp}/status";
[email protected]b6e064522009-08-10 18:47:51352EOF
[email protected]1bf2ac972009-06-30 23:57:48353
[email protected]e041ed12009-03-10 16:43:01354 # Download 32bit packages
355 echo "Computing list of available 32bit packages..."
[email protected]a81e44e12010-05-17 21:16:53356 sudo apt-get -c="${tmp}/apt/apt.conf" update
[email protected]e041ed12009-03-10 16:43:01357
358 echo "Downloading available 32bit packages..."
[email protected]a81e44e12010-05-17 21:16:53359 sudo apt-get -c="${tmp}/apt/apt.conf" \
360 --yes --download-only --force-yes --reinstall install \
[email protected]e041ed12009-03-10 16:43:01361 ${lib_list} ${dbg_list}
362
363 # Open packages, remove everything that is not a library, move the
364 # library to a lib32 directory and package everything as a *.deb file.
365 echo "Repackaging and installing 32bit packages for use on 64bit systems..."
366 for i in ${lib_list} ${dbg_list}; do
367 orig="$(echo "${tmp}/${i}"_*_i386.deb)"
368 compat="$(echo "${orig}" |
369 sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')"
370 rm -rf "${tmp}/staging"
371 msg="$(fakeroot -u sh -exc '
372 # Unpack 32bit Debian archive
373 umask 022
374 mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN"
375 cd "'"${tmp}"'/staging"
376 ar x "'${orig}'"
377 tar zCfx dpkg data.tar.gz
378 tar zCfx dpkg/DEBIAN control.tar.gz
379
380 # Rename package, change architecture, remove dependencies
381 sed -i -e "s/\(Package:.*\)/\1-ia32/" \
382 -e "s/\(Architecture:\).*/\1 amd64/" \
383 -e "s/\(Depends:\).*/\1 ia32-libs/" \
384 -e "/Recommends/d" \
385 -e "/Conflicts/d" \
386 dpkg/DEBIAN/control
387
388 # Only keep files that live in "lib" directories
389 sed -i -e "/\/lib64\//d" -e "/\/.?bin\//d" \
390 -e "s,\([ /]lib\)/,\132/g,;t1;d;:1" \
391 -e "s,^/usr/lib32/debug\(.*/lib32\),/usr/lib/debug\1," \
392 dpkg/DEBIAN/md5sums
393
394 # Re-run ldconfig after installation/removal
395 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \
396 >dpkg/DEBIAN/postinst
397 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \
398 >dpkg/DEBIAN/postrm
399 chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm
400
401 # Remove any other control files
402 find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \
403 -name postinst -o -name postrm ")" -o -print |
404 xargs -r rm -rf
405
406 # Remove any files/dirs that live outside of "lib" directories
407 find dpkg -mindepth 1 "(" -name DEBIAN -o -name lib ")" -prune -o \
408 -print | tac | xargs -r -n 1 sh -c \
409 "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : "
410 find dpkg -name lib64 -o -name bin -o -name "?bin" |
411 tac | xargs -r rm -rf
412
413 # Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32
414 # That is where gdb looks for them.
415 find dpkg -type d -o -path "*/lib/*" -print |
416 xargs -r -n 1 sh -c "
417 i=\$(echo \"\${0}\" |
418 sed -e s,/lib/,/lib32/,g \
419 -e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,);
420 mkdir -p \"\${i%/*}\";
421 mv \"\${0}\" \"\${i}\""
422
423 # Prune any empty directories
424 find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || :
425
426 # Create our own Debian package
427 cd ..
428 dpkg --build staging/dpkg .' 2>&1)"
429 compat="$(eval echo $(echo "${compat}" |
430 sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))"
431 [ -r "${compat}" ] || {
432 echo "${msg}" >&2
433 echo "Failed to build new Debian archive!" >&2
434 exit 1
435 }
436
437 msg="$(sudo dpkg -i "${compat}" 2>&1)" && {
438 echo "Installed ${compat##*/}"
439 } || {
440 # echo "${msg}" >&2
441 echo "Skipped ${compat##*/}"
442 }
443 done
444
445 # Add symbolic links for developing 32bit code
446 echo "Adding missing symbolic links, enabling 32bit code development..."
447 for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* |
448 sed -e 's/[.]so[.][0-9].*/.so/' |
449 sort -u); do
450 [ "x${i##*/}" = "xld-linux.so" ] && continue
451 [ -r "$i" ] && continue
452 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
453 sort -n | tail -n 1)"
454 [ -r "$i.$j" ] || continue
455 sudo ln -s "${i##*/}.$j" "$i"
456 done
457fi