Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: build/install-build-deps.sh

Issue 40288: Re-implemented the install-build-deps.sh script file, so that on 64 bit... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/bash -e
2
2 # Script to install everything needed to build chromium (well, ideally, anyway) 3 # Script to install everything needed to build chromium (well, ideally, anyway)
3 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions 4 # See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions
4 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit 5 # and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit
5 set -ex
6 6
7 # Root can't access files on all filesystems, but /tmp should always be ok 7 if ! egrep -q "Ubuntu 8.04|Ubuntu 8.10" /etc/issue; then
8 # (unless it's full). 8 echo "Only Ubuntu 8.04 and 8.10 are currently supported" >&2
9 DIR=`mktemp -d` 9 exit 1
10 cd $DIR 10 fi
11 touch .created
12 11
13 cleanup() { 12 if ! uname -m | egrep -q "i686|x86_64"; then
14 test -f $DIR/.created && rm -rf $DIR 13 echo "Only x86 architectures are currently supported" >&2
15 } 14 exit
15 fi
16 16
17 # TODO(dkegel): add sha1sum verification 17 if [ "x$(id -u)" != x0 ]; then
18 download() { 18 echo "Running as non-root user."
19 dir=$1 19 echo "You might have to enter your password one or more times for 'sudo'."
20 file=$2 20 fi
21 if ! test -f $file
22 then
23 wget $MIRROR/$dir/$file
24 fi
25 }
26 21
27 unpack_deb() { 22 # Packages need for development
28 file=$1 23 dev_list="subversion pkg-config python perl g++ g++-multilib bison flex gperf
29 ar x $file 24 libnss3-dev libglib2.0-dev libgtk2.0-dev libnspr4-dev libsqlite3-dev
30 tar -xzvf data.tar.gz 25 wdiff lighttpd php5-cgi msttcorefonts sun-java6-fonts"
31 rm -f data.tar.gz control.tar.gz
32 }
33 26
34 download_deb() { 27 # Full list of required run-time libraries
35 download $1 $2 28 lib_list="libatk1.0-0 libc6 libcairo2 libexpat1 libfontconfig1 libfreetype6
36 unpack_deb $2 29 libglib2.0-0 libgtk2.0-0 libnspr4-0d libnss3-1d libpango1.0-0
37 } 30 libpcre3 libpixman-1-0 libpng12-0 libstdc++6 libsqlite3-0 libx11-6
31 libxau6 libxcb-xlib0 libxcb1 libxcomposite1 libxcursor1 libxdamage1
32 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxrandr2
33 libxrender1 zlib1g"
38 34
39 install_hardy() { 35 # Debugging symbols for all of the run-time libraries
40 sudo apt-get install subversion pkg-config python perl g++ g++-multilib \ 36 dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg libfontconfig1-dbg
41 bison flex gperf libnss3-dev libglib2.0-dev libgtk2.0-dev \ 37 libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg libnss3-1d-dbg
42 libnspr4-0d libnspr4-dev wdiff lighttpd php5-cgi msttcorefonts \ 38 libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg libx11-6-dbg
43 sun-java6-fonts 39 libxau6-dbg libxcb-xlib0-dbg libxcb1-dbg libxcomposite1-dbg
44 } 40 libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg
41 libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg
42 libxrender1-dbg zlib1g-dbg"
45 43
46 install_hardy_64() { 44 # Standard 32bit compatibility libraries
47 install_hardy 45 cmp_list="ia32-libs lib32stdc++6 lib32z1 lib32z1-dev libc6-dev-i386 libc6-i386"
48 46
49 # The packages libnspr4, libnss3, and libsqlite don't have 32 47 echo "Updating list of available packages..."
50 # bit compabibility versions on 64 bit ubuntu hardy, 48 sudo apt-get update
51 # so install them packages the hard way
52 # See https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/246911
53 # TODO: There is no bug report yet for 32 bit sqlite runtime
54 49
55 mkdir -p workdir-hardy64 50 # We initially run "apt-get" with the --reinstall option and parse its output.
56 cd workdir-hardy64 51 # This way, we can find all the packages that need to be newly installed
57 rm -rf usr 52 # without accidentally promoting any packages from "auto" to "manual".
53 # We then re-run "apt-get" with just the list of missing packages.
54 echo "Finding missing packages..."
55 new_list="$(yes n |
56 sudo apt-get install --reinstall \
57 ${pkg_list} ${lib_list} ${dbg_list} \
58 $([ "$(uname -m)" = x86_64 ] && echo ${cmp_list}) \
59 2>/dev/null |
60 sed -e 's/^ //;t;d')"
58 61
59 MIRROR=http://mirrors.kernel.org/ubuntu 62 echo "Installing missing packages..."
60 download_deb pool/main/n/nspr libnspr4-0d_4.7.1~beta2-0ubuntu1_i386.deb 63 sudo apt-get install ${new_list}
61 download_deb pool/main/n/nss libnss3-1d_3.12.0~beta3-0ubuntu1_i386.deb
62 download_deb pool/main/s/sqlite3 libsqlite3-0_3.4.2-2_i386.deb
63 64
64 sudo rsync -v -a usr/lib/* /usr/lib32/ 65 # Install 32bit backwards compatibility support for 64bit systems
65 sudo ldconfig 66 if [ "$(uname -m)" = x86_64 ]; then
67 echo "Installing 32bit libraries that are not already provided by the system"
68 tmp=/tmp/install-32bit.$$
69 trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
70 mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
71 touch "${tmp}/status"
66 72
67 # Make missing symlinks as described by 73 [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
68 # https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/277772 74 cat >>"${tmp}/apt/apt.conf" <<-EOF
69 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492453 75 » Apt::Architecture "i386";
70 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=497087 76 » Dir::Cache "${tmp}/cache";
71 cd /usr/lib32 77 » Dir::Cache::Archives "${tmp}/";
72 for lib in gio-2.0 gdk-x11-2.0 atk-1.0 gdk_pixbuf-2.0 \ 78 » Dir::State::Lists "${tmp}/apt/lists/";
73 pangocairo-1.0 pango-1.0 pangoft2-1.0 \ 79 » Dir::State::status "${tmp}/status";
74 gobject-2.0 gmodule-2.0 glib-2.0 gtk-x11-2.0; do 80 » EOF
75 sudo ln -s -f lib$lib.so.0 lib$lib.so 81
76 done 82 # Download 32bit packages
77 for lib in z fontconfig 83 echo "Computing list of available 32bit packages..."
78 do 84 apt-get -c="${tmp}/apt/apt.conf" update
79 sudo ln -s -f lib$lib.so.1 lib$lib.so 85
80 done 86 echo "Downloading available 32bit packages..."
81 for lib in cairo 87 apt-get -c="${tmp}/apt/apt.conf" \
82 do 88 --yes --download-only --force-yes --reinstall install \
83 sudo ln -s -f lib$lib.so.2 lib$lib.so 89 ${lib_list} ${dbg_list}
84 done 90
85 for lib in freetype 91 # Open packages, remove everything that is not a library, move the
86 do 92 # library to a lib32 directory and package everything as a *.deb file.
87 sudo ln -s -f lib$lib.so.6 lib$lib.so 93 echo "Repackaging and installing 32bit packages for use on 64bit systems..."
88 done 94 for i in ${lib_list} ${dbg_list}; do
89 for lib in plds4 plc4 nspr4 95 orig="$(echo "${tmp}/${i}"_*_i386.deb)"
90 do 96 compat="$(echo "${orig}" |
91 sudo ln -s -f /usr/lib32/lib$lib.so.0d /usr/lib32/lib$lib.so 97 sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')"
98 rm -rf "${tmp}/staging"
99 msg="$(fakeroot -u sh -exc '
100 # Unpack 32bit Debian archive
101 umask 022
102 mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN"
103 cd "'"${tmp}"'/staging"
104 ar x "'${orig}'"
105 tar zCfx dpkg data.tar.gz
106 tar zCfx dpkg/DEBIAN control.tar.gz
107
108 # Rename package, change architecture, remove dependencies
109 sed -i -e "s/\(Package:.*\)/\1-ia32/" \
110 -e "s/\(Architecture:\).*/\1 amd64/" \
111 -e "s/\(Depends:\).*/\1 ia32-libs/" \
112 -e "/Recommends/d" \
113 -e "/Conflicts/d" \
114 dpkg/DEBIAN/control
115
116 # Only keep files that live in "lib" directories
117 sed -i -e "/\/lib64\//d" -e "/\/.?bin\//d" \
118 -e "s,\([ /]lib\)/,\132/g,;t1;d;:1" \
119 -e "s,^/usr/lib32/debug\(.*/lib32\),/usr/lib/debug\1," \
120 dpkg/DEBIAN/md5sums
121
122 # Re-run ldconfig after installation/removal
123 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \
124 >dpkg/DEBIAN/postinst
125 { echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \
126 >dpkg/DEBIAN/postrm
127 chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm
128
129 # Remove any other control files
130 find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \
131 -name postinst -o -name postrm ")" -o -print |
132 xargs -r rm -rf
133
134 # Remove any files/dirs that live outside of "lib" directories
135 find dpkg -mindepth 1 "(" -name DEBIAN -o -name lib ")" -prune -o \
136 -print | tac | xargs -r -n 1 sh -c \
137 "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : "
138 find dpkg -name lib64 -o -name bin -o -name "?bin" |
139 tac | xargs -r rm -rf
140
141 # Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32
142 # That is where gdb looks for them.
143 find dpkg -type d -o -path "*/lib/*" -print |
144 xargs -r -n 1 sh -c "
145 i=\$(echo \"\${0}\" |
146 sed -e s,/lib/,/lib32/,g \
147 -e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,);
148 mkdir -p \"\${i%/*}\";
149 mv \"\${0}\" \"\${i}\""
150
151 # Prune any empty directories
152 find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || :
153
154 # Create our own Debian package
155 cd ..
156 dpkg --build staging/dpkg .' 2>&1)"
157 compat="$(eval echo $(echo "${compat}" |
158 sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))"
159 [ -r "${compat}" ] || {
160 echo "${msg}" >&2
161 echo "Failed to build new Debian archive!" >&2
162 exit 1
163 }
164
165 msg="$(sudo dpkg -i "${compat}" 2>&1)" && {
166 echo "Installed ${compat##*/}"
167 } || {
168 # echo "${msg}" >&2
169 echo "Skipped ${compat##*/}"
170 }
92 done 171 done
93 172
94 for lib in nss3 nssutil3 smime3 ssl3 173 # Add symbolic links for developing 32bit code
95 do 174 echo "Adding missing symbolic links, enabling 32bit code development..."
96 sudo ln -s -f /usr/lib32/lib$lib.so.1d /usr/lib32/lib$lib.so 175 for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* |
176 sed -e 's/[.]so[.][0-9].*/.so/' |
177 sort -u); do
178 [ "x${i##*/}" = "xld-linux.so" ] && continue
179 [ -r "$i" ] && continue
180 j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
181 sort -n | tail -n 1)"
182 [ -r "$i.$j" ] || continue
183 sudo ln -s "${i##*/}.$j" "$i"
97 done 184 done
98
99 sudo ln -s -f /usr/lib32/libX11.so.6 /usr/lib32/libX11.so
100 sudo ln -s -f /usr/lib32/libXrender.so.1 /usr/lib32/libXrender.so
101 sudo ln -s -f /usr/lib32/libXext.so.6 /usr/lib32/libXext.so
102 }
103
104 if egrep -q "Ubuntu 8.04|Ubuntu 8.10" /etc/issue && test `uname -m` = i686
105 then
106 install_hardy
107 elif egrep -q "Ubuntu 8.04|Ubuntu 8.10" /etc/issue && test `uname -m` = x86_64
108 then
109 install_hardy_64
110 else
111 echo "Unsupported system"
112 cleanup
113 exit 1
114 fi 185 fi
115 cleanup
116
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698