OLD | NEW |
---|---|
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to install everything needed to build chromium (well, ideally, anyway) | 7 # Script to install everything needed to build chromium (well, ideally, anyway) |
8 # See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_i nstructions.md | 8 # See https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_i nstructions.md |
9 | 9 |
10 usage() { | 10 usage() { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 if test "$do_inst_arm" = "1"; then | 103 if test "$do_inst_arm" = "1"; then |
104 do_inst_lib32=1 | 104 do_inst_lib32=1 |
105 fi | 105 fi |
106 | 106 |
107 # Check for lsb_release command in $PATH | 107 # Check for lsb_release command in $PATH |
108 if ! which lsb_release > /dev/null; then | 108 if ! which lsb_release > /dev/null; then |
109 echo "ERROR: lsb_release not found in \$PATH" >&2 | 109 echo "ERROR: lsb_release not found in \$PATH" >&2 |
110 exit 1; | 110 exit 1; |
111 fi | 111 fi |
112 | 112 |
113 lsb_release=$(lsb_release --codename --short) | 113 distro_codename=$(lsb_release --codename --short) |
114 supported_releases="(trusty|xenial|yakkety|jessie)" | 114 distro_id=$(lsb_release --id --short) |
115 supported_codenames="(trusty|xenial|yakkety)" | |
116 supported_ids="(Debian)" | |
115 if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then | 117 if [ 0 -eq "${do_unsupported-0}" ] && [ 0 -eq "${do_quick_check-0}" ] ; then |
116 if [[ ! $lsb_release =~ $supported_releases ]]; then | 118 if [[ ! $distro_codename =~ $supported_codenames && |
119 ! $distro_id =~ $supported_ids ]]; then | |
117 echo -e "ERROR: The only supported distros are\n" \ | 120 echo -e "ERROR: The only supported distros are\n" \ |
118 "\tUbuntu 14.04 (trusty)\n" \ | 121 "\tUbuntu 14.04 (trusty)\n" \ |
119 "\tUbuntu 16.04 (xenial)\n" \ | 122 "\tUbuntu 16.04 (xenial)\n" \ |
120 "\tUbuntu 16.10 (yakkety)\n" \ | 123 "\tUbuntu 16.10 (yakkety)\n" \ |
121 "\tDebian 8 (jessie)" >&2 | 124 "\tDebian 8 (jessie) or later" >&2 |
122 exit 1 | 125 exit 1 |
123 fi | 126 fi |
124 | 127 |
125 if ! uname -m | egrep -q "i686|x86_64"; then | 128 if ! uname -m | egrep -q "i686|x86_64"; then |
126 echo "Only x86 architectures are currently supported" >&2 | 129 echo "Only x86 architectures are currently supported" >&2 |
127 exit | 130 exit |
128 fi | 131 fi |
129 fi | 132 fi |
130 | 133 |
131 if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then | 134 if [ "x$(id -u)" != x0 ] && [ 0 -eq "${do_quick_check-0}" ]; then |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 libxdmcp6-dbg | 288 libxdmcp6-dbg |
286 libxext6-dbg | 289 libxext6-dbg |
287 libxi6-dbg | 290 libxi6-dbg |
288 libxinerama1-dbg | 291 libxinerama1-dbg |
289 libxrandr2-dbg | 292 libxrandr2-dbg |
290 libxrender1-dbg | 293 libxrender1-dbg |
291 libxtst6-dbg | 294 libxtst6-dbg |
292 zlib1g-dbg | 295 zlib1g-dbg |
293 " | 296 " |
294 | 297 |
295 if [[ ! $lsb_release =~ "yakkety" ]]; then | 298 if [[ ! $distro_codename =~ "yakkety" ]]; then |
296 dbg_list="${dbg_list} libxfixes3-dbg" | 299 dbg_list="${dbg_list} libxfixes3-dbg" |
297 fi | 300 fi |
298 | 301 |
299 # Find the proper version of libstdc++6-4.x-dbg. | 302 # Find the proper version of libstdc++6-4.x-dbg. |
300 if [ "x$lsb_release" = "xtrusty" ]; then | 303 if [ "x$distro_codename" = "xtrusty" ]; then |
301 dbg_list="${dbg_list} libstdc++6-4.8-dbg" | 304 dbg_list="${dbg_list} libstdc++6-4.8-dbg" |
302 else | 305 else |
303 dbg_list="${dbg_list} libstdc++6-4.9-dbg" | 306 dbg_list="${dbg_list} libstdc++6-4.9-dbg" |
304 fi | 307 fi |
305 | 308 |
306 # 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf | 309 # 32-bit libraries needed e.g. to compile V8 snapshot for Android or armhf |
307 lib32_list="linux-libc-dev:i386" | 310 lib32_list="linux-libc-dev:i386" |
308 | 311 |
309 # arm cross toolchain packages needed to build chrome on armhf | 312 # arm cross toolchain packages needed to build chrome on armhf |
310 EM_REPO="deb http://emdebian.org/tools/debian/ jessie main" | 313 EM_REPO="deb http://emdebian.org/tools/debian/ jessie main" |
311 EM_SOURCE=$(cat <<EOF | 314 EM_SOURCE=$(cat <<EOF |
312 # Repo added by Chromium $0 | 315 # Repo added by Chromium $0 |
313 ${EM_REPO} | 316 ${EM_REPO} |
314 # deb-src http://emdebian.org/tools/debian/ jessie main | 317 # deb-src http://emdebian.org/tools/debian/ jessie main |
315 EOF | 318 EOF |
316 ) | 319 ) |
317 EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E" | 320 EM_ARCHIVE_KEY_FINGER="084C6C6F39159EDB67969AA87DE089671804772E" |
318 GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf" | 321 GPP_ARM_PACKAGE="g++-arm-linux-gnueabihf" |
319 case $lsb_release in | 322 case $distro_codename in |
320 jessie) | 323 jessie) |
321 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d') | 324 eval $(apt-config shell APT_SOURCESDIR 'Dir::Etc::sourceparts/d') |
322 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list" | 325 CROSSTOOLS_LIST="${APT_SOURCESDIR}/crosstools.list" |
323 arm_list="libc6-dev:armhf | 326 arm_list="libc6-dev:armhf |
324 linux-libc-dev:armhf" | 327 linux-libc-dev:armhf" |
325 if test "$do_inst_arm" = "1"; then | 328 if test "$do_inst_arm" = "1"; then |
326 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then | 329 if $(dpkg-query -W ${GPP_ARM_PACKAGE} &>/dev/null); then |
327 arm_list+=" ${GPP_ARM_PACKAGE}" | 330 arm_list+=" ${GPP_ARM_PACKAGE}" |
328 else | 331 else |
329 echo "The Debian Cross-toolchains repository is necessary to" | 332 echo "The Debian Cross-toolchains repository is necessary to" |
330 echo "cross-compile Chromium for arm." | 333 echo "cross-compile Chromium for arm." |
331 echo -n "Do you want me to add it for you (y/N) " | 334 echo -n "Do you want me to add it for you (y/N) " |
332 if yes_no 1; then | 335 if yes_no 1; then |
333 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER} | 336 gpg --keyserver pgp.mit.edu --recv-keys ${EM_ARCHIVE_KEY_FINGER} |
334 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add - | 337 gpg -a --export ${EM_ARCHIVE_KEY_FINGER} | sudo apt-key add - |
335 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then | 338 if ! grep "^${EM_REPO}" "${CROSSTOOLS_LIST}" &>/dev/null; then |
336 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null | 339 echo "${EM_SOURCE}" | sudo tee -a "${CROSSTOOLS_LIST}" >/dev/null |
337 fi | 340 fi |
338 arm_list+=" ${GPP_ARM_PACKAGE}" | 341 arm_list+=" ${GPP_ARM_PACKAGE}" |
339 fi | 342 fi |
340 fi | 343 fi |
341 fi | 344 fi |
342 ;; | 345 ;; |
346 # All necessary ARM packages are available on the default repos on | |
347 # Debian 9 and later. | |
343 *) | 348 *) |
344 arm_list="binutils-aarch64-linux-gnu | 349 arm_list="binutils-aarch64-linux-gnu |
345 libc6-dev-armhf-cross | 350 libc6-dev-armhf-cross |
346 linux-libc-dev-armhf-cross | 351 linux-libc-dev-armhf-cross |
347 ${GPP_ARM_PACKAGE}" | 352 ${GPP_ARM_PACKAGE}" |
348 ;; | 353 ;; |
349 esac | 354 esac |
350 | 355 |
351 # Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056 | 356 # Work around for dependency issue Ubuntu/Trusty: http://crbug.com/435056 |
352 case $lsb_release in | 357 case $distro_codename in |
353 trusty) | 358 trusty) |
354 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf | 359 arm_list+=" g++-4.8-multilib-arm-linux-gnueabihf |
355 gcc-4.8-multilib-arm-linux-gnueabihf" | 360 gcc-4.8-multilib-arm-linux-gnueabihf" |
356 ;; | 361 ;; |
357 xenial|yakkety) | 362 xenial|yakkety) |
358 arm_list+=" g++-5-multilib-arm-linux-gnueabihf | 363 arm_list+=" g++-5-multilib-arm-linux-gnueabihf |
359 gcc-5-multilib-arm-linux-gnueabihf | 364 gcc-5-multilib-arm-linux-gnueabihf |
360 gcc-arm-linux-gnueabihf" | 365 gcc-arm-linux-gnueabihf" |
361 ;; | 366 ;; |
362 esac | 367 esac |
363 | 368 |
364 # Packages to build NaCl, its toolchains, and its ports. | 369 # Packages to build NaCl, its toolchains, and its ports. |
365 naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" | 370 naclports_list="ant autoconf bison cmake gawk intltool xutils-dev xsltproc" |
366 nacl_list="\ | 371 nacl_list="\ |
367 g++-mingw-w64-i686 | 372 g++-mingw-w64-i686 |
368 lib32z1-dev | 373 lib32z1-dev |
369 libasound2:i386 | 374 libasound2:i386 |
370 libcap2:i386 | 375 libcap2:i386 |
371 libelf-dev:i386 | 376 libelf-dev:i386 |
372 libfontconfig1:i386 | 377 libfontconfig1:i386 |
373 libgconf-2-4:i386 | 378 libgconf-2-4:i386 |
374 libglib2.0-0:i386 | 379 libglib2.0-0:i386 |
375 libgpm2:i386 | 380 libgpm2:i386 |
376 libgtk2.0-0:i386 | 381 libgtk2.0-0:i386 |
377 libgtk-3-0:i386 | 382 libgtk-3-0:i386 |
378 libncurses5:i386 | 383 libncurses5:i386 |
379 lib32ncurses5-dev | 384 lib32ncurses5-dev |
380 libnss3:i386 | 385 libnss3:i386 |
381 libpango1.0-0:i386 | 386 libpango1.0-0:i386 |
382 libssl1.0.0:i386 | 387 libssl-dev:i386 |
383 libtinfo-dev | 388 libtinfo-dev |
384 libtinfo-dev:i386 | 389 libtinfo-dev:i386 |
385 libtool | 390 libtool |
386 libxcomposite1:i386 | 391 libxcomposite1:i386 |
387 libxcursor1:i386 | 392 libxcursor1:i386 |
388 libxdamage1:i386 | 393 libxdamage1:i386 |
389 libxi6:i386 | 394 libxi6:i386 |
390 libxrandr2:i386 | 395 libxrandr2:i386 |
391 libxss1:i386 | 396 libxss1:i386 |
392 libxtst6:i386 | 397 libxtst6:i386 |
393 texinfo | 398 texinfo |
394 xvfb | 399 xvfb |
395 ${naclports_list} | 400 ${naclports_list} |
396 " | 401 " |
397 | 402 |
403 if package_exists libssl1.0.0; then | |
404 nacl_list="${nacl_list} libssl1.0.0:i386" | |
405 else | |
406 nacl_list="${nacl_list} libssl1.0.2:i386" | |
407 fi | |
408 | |
398 # Find the proper version of packages that depend on mesa. Only one -lts variant | 409 # Find the proper version of packages that depend on mesa. Only one -lts variant |
399 # of mesa can be installed and everything that depends on it must match. | 410 # of mesa can be installed and everything that depends on it must match. |
400 | 411 |
401 # Query for the name and status of all mesa LTS variants, filter for only | 412 # Query for the name and status of all mesa LTS variants, filter for only |
402 # installed packages, extract just the name, and eliminate duplicates (there can | 413 # installed packages, extract just the name, and eliminate duplicates (there can |
403 # be more than one with the same name in the case of multiarch). Expand into an | 414 # be more than one with the same name in the case of multiarch). Expand into an |
404 # array. | 415 # array. |
405 mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \ | 416 mesa_packages=($(dpkg-query -Wf'${package} ${status}\n' \ |
406 libgl1-mesa-glx-lts-\* 2>/dev/null | \ | 417 libgl1-mesa-glx-lts-\* 2>/dev/null | \ |
407 grep " ok installed" | cut -d " " -f 1 | sort -u)) | 418 grep " ok installed" | cut -d " " -f 1 | sort -u)) |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 echo "For most of the libraries, it can also install debugging symbols, which" | 521 echo "For most of the libraries, it can also install debugging symbols, which" |
511 echo "will allow you to debug code in the system libraries. Most developers" | 522 echo "will allow you to debug code in the system libraries. Most developers" |
512 echo "won't need these symbols." | 523 echo "won't need these symbols." |
513 echo -n "Do you want me to install them for you (y/N) " | 524 echo -n "Do you want me to install them for you (y/N) " |
514 if yes_no 1; then | 525 if yes_no 1; then |
515 do_inst_syms=1 | 526 do_inst_syms=1 |
516 fi | 527 fi |
517 fi | 528 fi |
518 if test "$do_inst_syms" = "1"; then | 529 if test "$do_inst_syms" = "1"; then |
519 echo "Including debugging symbols." | 530 echo "Including debugging symbols." |
531 # Many debug packages are not available in Debian stretch, | |
532 # so exclude the ones that are missing. | |
533 available_dbg_packages="" | |
534 for package in ${dbg_list}; do | |
535 if package_exists ${package}; then | |
536 available_dbg_packages="${available_dbg_packages} ${package}" | |
537 fi | |
538 done | |
539 dbg_list="${available_dbg_packages}" | |
520 else | 540 else |
521 echo "Skipping debugging symbols." | 541 echo "Skipping debugging symbols." |
522 dbg_list= | 542 dbg_list= |
523 fi | 543 fi |
524 | 544 |
525 if test "$do_inst_lib32" = "1" ; then | 545 if test "$do_inst_lib32" = "1" ; then |
526 echo "Including 32-bit libraries for ARM/Android." | 546 echo "Including 32-bit libraries for ARM/Android." |
527 else | 547 else |
528 echo "Skipping 32-bit libraries for ARM/Android." | 548 echo "Skipping 32-bit libraries for ARM/Android." |
529 lib32_list= | 549 lib32_list= |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 echo "(maybe missing a repo or need to 'sudo apt-get update'):" | 594 echo "(maybe missing a repo or need to 'sudo apt-get update'):" |
575 echo -e "${unknown}" | sed -e "s/^/ /" | 595 echo -e "${unknown}" | sed -e "s/^/ /" |
576 fi | 596 fi |
577 exit 1 | 597 exit 1 |
578 fi | 598 fi |
579 exit 0 | 599 exit 0 |
580 fi | 600 fi |
581 | 601 |
582 if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then | 602 if test "$do_inst_lib32" = "1" || test "$do_inst_nacl" = "1"; then |
583 sudo dpkg --add-architecture i386 | 603 sudo dpkg --add-architecture i386 |
584 if [[ $lsb_release = "jessie" ]]; then | 604 if [[ $distro_id == "Debian" ]]; then |
585 sudo dpkg --add-architecture armhf | 605 sudo dpkg --add-architecture armhf |
586 fi | 606 fi |
587 fi | 607 fi |
588 sudo apt-get update | 608 sudo apt-get update |
589 | 609 |
590 # We initially run "apt-get" with the --reinstall option and parse its output. | 610 # We initially run "apt-get" with the --reinstall option and parse its output. |
591 # This way, we can find all the packages that need to be newly installed | 611 # This way, we can find all the packages that need to be newly installed |
592 # without accidentally promoting any packages from "auto" to "manual". | 612 # without accidentally promoting any packages from "auto" to "manual". |
593 # We then re-run "apt-get" with just the list of missing packages. | 613 # We then re-run "apt-get" with just the list of missing packages. |
594 echo "Finding missing packages..." | 614 echo "Finding missing packages..." |
595 # Intentionally leaving $packages unquoted so it's more readable. | 615 # Intentionally leaving $packages unquoted so it's more readable. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 fi | 662 fi |
643 echo "It is recommended to install your repo on a local file system." | 663 echo "It is recommended to install your repo on a local file system." |
644 echo "You can skip the installation of the Chrome OS default founts with" | 664 echo "You can skip the installation of the Chrome OS default founts with" |
645 echo "the command line option: --no-chromeos-fonts." | 665 echo "the command line option: --no-chromeos-fonts." |
646 exit 1 | 666 exit 1 |
647 fi | 667 fi |
648 else | 668 else |
649 echo "Skipping installation of Chrome OS fonts." | 669 echo "Skipping installation of Chrome OS fonts." |
650 fi | 670 fi |
651 | 671 |
652 # $1 - target name | |
653 # $2 - link name | |
654 create_library_symlink() { | |
655 target=$1 | |
656 linkname=$2 | |
657 if [ -L $linkname ]; then | |
658 if [ "$(basename $(readlink $linkname))" != "$(basename $target)" ]; then | |
659 sudo rm $linkname | |
660 fi | |
661 fi | |
662 if [ ! -r $linkname ]; then | |
663 echo "Creating link: $linkname" | |
664 sudo ln -fs $target $linkname | |
665 fi | |
666 } | |
667 | |
668 if test "$do_inst_nacl" = "1"; then | |
669 echo "Installing symbolic links for NaCl." | |
670 # naclports needs to cross build python for i386, but libssl1.0.0:i386 | |
671 # only contains libcrypto.so.1.0.0 and not the symlink needed for | |
672 # linking (libcrypto.so). | |
673 create_library_symlink /lib/i386-linux-gnu/libcrypto.so.1.0.0 \ | |
674 /usr/lib/i386-linux-gnu/libcrypto.so | |
Tom (Use chromium acct)
2017/04/27 18:33:13
libcrypto.so and libssl.so are installed with the
| |
675 | |
676 create_library_symlink /lib/i386-linux-gnu/libssl.so.1.0.0 \ | |
677 /usr/lib/i386-linux-gnu/libssl.so | |
678 else | |
679 echo "Skipping symbolic links for NaCl." | |
680 fi | |
681 | |
682 echo "Installing locales." | 672 echo "Installing locales." |
683 CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8" | 673 CHROMIUM_LOCALES="da_DK.UTF-8 fr_FR.UTF-8 he_IL.UTF-8 zh_TW.UTF-8" |
684 LOCALE_GEN=/etc/locale.gen | 674 LOCALE_GEN=/etc/locale.gen |
685 if [ -e ${LOCALE_GEN} ]; then | 675 if [ -e ${LOCALE_GEN} ]; then |
686 OLD_LOCALE_GEN="$(cat /etc/locale.gen)" | 676 OLD_LOCALE_GEN="$(cat /etc/locale.gen)" |
687 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do | 677 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
688 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN} | 678 sudo sed -i "s/^# ${CHROMIUM_LOCALE}/${CHROMIUM_LOCALE}/" ${LOCALE_GEN} |
689 done | 679 done |
690 # Regenerating locales can take a while, so only do it if we need to. | 680 # Regenerating locales can take a while, so only do it if we need to. |
691 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then | 681 if (echo "${OLD_LOCALE_GEN}" | cmp -s ${LOCALE_GEN}); then |
692 echo "Locales already up-to-date." | 682 echo "Locales already up-to-date." |
693 else | 683 else |
694 sudo locale-gen | 684 sudo locale-gen |
695 fi | 685 fi |
696 else | 686 else |
697 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do | 687 for CHROMIUM_LOCALE in ${CHROMIUM_LOCALES}; do |
698 sudo locale-gen ${CHROMIUM_LOCALE} | 688 sudo locale-gen ${CHROMIUM_LOCALE} |
699 done | 689 done |
700 fi | 690 fi |
OLD | NEW |