OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 #@ This script creates the mips trusted SDK. | 6 #@ This script creates the mips trusted SDK. |
7 #@ It must be run from the native_client directory. | 7 #@ It must be run from the native_client directory. |
8 | 8 |
9 # This script is intended to build a mipsel-linux-gnu cross compilation | 9 # This script is intended to build a mipsel-linux-gnu cross compilation |
10 # toolchain that runs on x86 linux and generates code for a little-endian, | 10 # toolchain that runs on x86 linux and generates code for a little-endian, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 readonly INSTALL_ROOT=$(pwd)/toolchain/linux_mips-trusted | 47 readonly INSTALL_ROOT=$(pwd)/toolchain/linux_mips-trusted |
48 | 48 |
49 readonly TMP=$(pwd)/toolchain/tmp/crosstool-trusted | 49 readonly TMP=$(pwd)/toolchain/tmp/crosstool-trusted |
50 | 50 |
51 readonly BUILD_DIR=${TMP}/build | 51 readonly BUILD_DIR=${TMP}/build |
52 | 52 |
53 readonly PATCH_MIPS32=$(readlink -f ../third_party/qemu/qemu-0.12.5.patch_mips) | 53 readonly PATCH_MIPS32=$(readlink -f ../third_party/qemu/qemu-0.12.5.patch_mips) |
54 | 54 |
55 readonly JAIL_MIPS32=${INSTALL_ROOT}/sysroot | 55 readonly JAIL_MIPS32=${INSTALL_ROOT}/sysroot |
56 | 56 |
57 readonly CROSS_TARBALL="naclsdk_linux_mipsel-trusted" | |
58 | |
57 # These are simple compiler wrappers to force 32bit builds. | 59 # These are simple compiler wrappers to force 32bit builds. |
58 readonly CC32=$(readlink -f pnacl/scripts/mygcc32) | 60 readonly CC32=$(readlink -f pnacl/scripts/mygcc32) |
59 readonly CXX32=$(readlink -f pnacl/scripts/myg++32) | 61 readonly CXX32=$(readlink -f pnacl/scripts/myg++32) |
60 | 62 |
61 ###################################################################### | 63 ###################################################################### |
62 # Helper | 64 # Helper |
63 ###################################################################### | 65 ###################################################################### |
64 | 66 |
65 Banner() { | 67 Banner() { |
66 echo "######################################################################" | 68 echo "######################################################################" |
67 echo $* | 69 echo $* |
68 echo "######################################################################" | 70 echo "######################################################################" |
69 } | 71 } |
70 | 72 |
71 SubBanner() { | 73 SubBanner() { |
72 echo "......................................................................" | 74 echo "......................................................................" |
73 echo $* | 75 echo $* |
74 echo "......................................................................" | 76 echo "......................................................................" |
75 } | 77 } |
76 | 78 |
77 Usage() { | 79 Usage() { |
78 echo | 80 echo |
79 echo "$0 trusted_sdk" | 81 echo "$0 <trusted_sdk|chrome_sdk>" |
Mark Seaborn
2013/02/28 20:40:28
The "trusted" vs. "chrome" naming doesn't really m
petarj
2013/03/06 00:32:10
Done. It's "nacl_sdk" vs "chrome_sdk" now.
| |
80 echo | 82 echo |
81 echo "trusted_sdk - Build everything and package it" | 83 echo "trusted_sdk - Build nacl toolchain and package it" |
84 echo "chrome_sdk - Build chrome toolchain and package it" | |
82 echo | 85 echo |
83 } | 86 } |
84 | 87 |
85 CheckoutOrCopy() { | 88 CheckoutOrCopy() { |
86 local url=$1 | 89 local url=$1 |
87 local revision=$2 | 90 local revision=$2 |
88 local filename="${TMP}/${url##*/}" | 91 local filename="${TMP}/${url##*/}" |
89 local filetype="${url%%:*}" | 92 local filetype="${url%%:*}" |
90 | 93 |
91 if [ "${filename}" == "" ]; then | 94 if [ "${filename}" == "" ]; then |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 } | 189 } |
187 | 190 |
188 ClearBuildDir() { | 191 ClearBuildDir() { |
189 Banner "clearing dirs in ${BUILD_DIR}" | 192 Banner "clearing dirs in ${BUILD_DIR}" |
190 rm -rf ${BUILD_DIR}/* | 193 rm -rf ${BUILD_DIR}/* |
191 } | 194 } |
192 | 195 |
193 CreateTarBall() { | 196 CreateTarBall() { |
194 local tarball=$1 | 197 local tarball=$1 |
195 Banner "creating tar ball ${tarball}" | 198 Banner "creating tar ball ${tarball}" |
196 tar cfz ${tarball}-mips.tgz -C ${INSTALL_ROOT} . | 199 tar cfz ${tarball}.tgz -C ${INSTALL_ROOT} . |
197 } | 200 } |
198 | 201 |
199 | 202 |
200 # Download the toolchain source tarballs or use a local copy when available. | 203 # Download the toolchain source tarballs or use a local copy when available. |
201 DownloadOrCopyAndInstallToolchain() { | 204 DownloadOrCopyAndInstallToolchain() { |
202 Banner "Installing toolchain" | 205 Banner "Installing toolchain" |
203 | 206 |
204 local tarball="${TMP}/${BINUTILS_URL##*/}" | 207 local tarball="${TMP}/${BINUTILS_URL##*/}" |
205 DownloadOrCopyAndVerify ${BINUTILS_URL} ${BINUTILS_SHA1SUM} | 208 DownloadOrCopyAndVerify ${BINUTILS_URL} ${BINUTILS_SHA1SUM} |
206 SubBanner "extracting from ${tarball}" | 209 SubBanner "extracting from ${tarball}" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 readonly REPO_DEBIAN=http://ftp.debian.org/debian | 471 readonly REPO_DEBIAN=http://ftp.debian.org/debian |
469 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/squeeze/main/binary-mipsel/Package s.bz2 | 472 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/squeeze/main/binary-mipsel/Package s.bz2 |
470 | 473 |
471 readonly TMP_PACKAGELIST_MIPS32=${TMP}/../packagelist_mipsel.tmp | 474 readonly TMP_PACKAGELIST_MIPS32=${TMP}/../packagelist_mipsel.tmp |
472 | 475 |
473 # These are good enough for native client. | 476 # These are good enough for native client. |
474 readonly BASE_PACKAGES="\ | 477 readonly BASE_PACKAGES="\ |
475 libssl0.9.8 \ | 478 libssl0.9.8 \ |
476 libssl-dev \ | 479 libssl-dev \ |
477 libx11-6 \ | 480 libx11-6 \ |
478 libx11-dev \ | 481 libx11-dev \ |
Mark Seaborn
2013/02/28 20:40:28
NaCl doesn't depend on X11, so can you move this t
petarj
2013/03/06 00:32:10
Done. Maybe you will want to change it for ARM too
| |
479 x11proto-core-dev \ | 482 x11proto-core-dev \ |
480 libxt6 \ | 483 libxt6 \ |
481 libxt-dev \ | 484 libxt-dev \ |
482 zlib1g \ | 485 zlib1g \ |
483 zlib1g-dev \ | 486 zlib1g-dev" |
487 | |
488 # Packages needed for chrome sysroot. | |
489 readonly CHROME_PACKAGES="\ | |
Mark Seaborn
2013/02/28 20:40:28
Maybe you could move these lists to live in text f
petarj
2013/03/06 00:32:10
The change has been made so
packagelist.squeeze.m
Mark Seaborn
2013/03/06 00:43:43
What I meant was: can you move the lists of packag
| |
490 comerr-dev \ | |
491 krb5-multidev \ | |
492 libaa1 \ | |
493 libaa1-dev \ | |
484 libasound2 \ | 494 libasound2 \ |
485 libasound2-dev \ | 495 libasound2-dev \ |
486 libaa1 \ | 496 libatk1.0-0 \ |
487 libaa1-dev \ | 497 libatk1.0-dev \ |
498 libxau6 \ | |
488 libxau-dev \ | 499 libxau-dev \ |
500 libavahi-client3 \ | |
501 libavahi-client-dev \ | |
502 libavahi-common3 \ | |
503 libavahi-common-dev \ | |
504 libbz2-1.0 \ | |
505 libbz2-dev \ | |
506 libcairo2 \ | |
507 libcairo2-dev \ | |
508 libcups2 \ | |
509 libcups2-dev \ | |
510 libdbus-1-3 \ | |
511 libdbus-1-dev \ | |
512 libdbus-glib-1-2 \ | |
513 libdbus-glib-1-dev \ | |
514 libcomerr2 \ | |
515 libexpat1 \ | |
516 libexpat1-dev \ | |
517 libfontconfig1 \ | |
518 libfontconfig1-dev \ | |
519 libfreetype6 \ | |
520 libfreetype6-dev \ | |
521 libgconf2-4 \ | |
522 libgconf2-dev \ | |
523 libgcrypt11 \ | |
524 libgcrypt11-dev \ | |
525 libgnutls26 \ | |
526 libgnutls-dev \ | |
527 libgpg-error0 \ | |
528 libgpg-error-dev \ | |
529 libgssapi-krb5-2 \ | |
530 libgtk2.0-0 \ | |
531 libgtk2.0-dev \ | |
532 libglib2.0-0 \ | |
533 libglib2.0-dev \ | |
534 libgnome-keyring-dev \ | |
535 libjpeg62 \ | |
536 libjpeg62-dev \ | |
537 libk5crypto3 \ | |
538 libkeyutils1 \ | |
539 libkeyutils-dev \ | |
540 libkrb5-3 \ | |
541 libkrb5-dev \ | |
542 libkrb5support0 \ | |
543 libnspr4-0d \ | |
544 libnspr4-dev \ | |
545 libnss3-1d \ | |
546 libnss3-dev \ | |
547 liborbit2 \ | |
548 liborbit2-dev \ | |
549 libpam0g \ | |
550 libpam0g-dev \ | |
551 libpango1.0-0 \ | |
552 libpango1.0-dev \ | |
553 libpci3 \ | |
554 libpci-dev \ | |
555 libpcre3 \ | |
556 libpcre3-dev \ | |
557 libpixman-1-0 \ | |
558 libpixman-1-dev \ | |
559 libpng12-0 \ | |
560 libpng12-dev \ | |
561 libselinux1 \ | |
562 libspeechd2 \ | |
563 libspeechd-dev \ | |
564 libssl0.9.8 \ | |
565 libssl-dev \ | |
566 libtasn1-3 \ | |
567 libtasn1-3-dev \ | |
568 libudev0 \ | |
569 libudev-dev \ | |
570 libx11-6 \ | |
571 libx11-dev \ | |
572 libxext6 \ | |
573 libxext-dev \ | |
489 libxau6 \ | 574 libxau6 \ |
575 libxau-dev \ | |
490 libxcb1 \ | 576 libxcb1 \ |
491 libxcb1-dev \ | 577 libxcb1-dev \ |
492 libxcb-render0 \ | 578 libxcb-render0 \ |
493 libxcb-render0-dev \ | 579 libxcb-render0-dev \ |
494 libxcb-render-util0 \ | 580 libxcb-render-util0 \ |
495 libxcb-render-util0-dev \ | 581 libxcb-render-util0-dev \ |
496 libxcb-shm0 \ | 582 libxcb-shm0 \ |
497 libxcb-shm0-dev \ | 583 libxcb-shm0-dev \ |
584 libxcomposite1 \ | |
585 libxcomposite-dev \ | |
586 libxcursor1 \ | |
587 libxcursor-dev \ | |
588 libxdamage1 \ | |
589 libxdamage-dev \ | |
498 libxdmcp6 \ | 590 libxdmcp6 \ |
499 libxdmcp-dev \ | 591 libxdmcp-dev \ |
592 libxfixes3 \ | |
593 libxfixes-dev \ | |
594 libxi6 \ | |
595 libxi-dev \ | |
596 libxinerama1 \ | |
597 libxinerama-dev \ | |
598 libxrandr2 \ | |
599 libxrandr-dev \ | |
600 libxrender1 \ | |
601 libxrender-dev \ | |
500 libxss1 \ | 602 libxss1 \ |
501 libxss-dev" | 603 libxss-dev \ |
604 libxt6 \ | |
605 libxt-dev \ | |
606 libxtst6 \ | |
607 libxtst-dev \ | |
608 python2.6 \ | |
609 python2.6-dev \ | |
610 x11proto-core-dev \ | |
611 x11proto-composite-dev \ | |
612 x11proto-damage-dev \ | |
613 x11proto-fixes-dev \ | |
614 x11proto-input-dev \ | |
615 x11proto-kb-dev \ | |
616 x11proto-randr-dev \ | |
617 x11proto-record-dev \ | |
618 x11proto-render-dev \ | |
619 x11proto-scrnsaver-dev \ | |
620 x11proto-xext-dev \ | |
621 zlib1g \ | |
622 zlib1g-dev" | |
502 | 623 |
503 GeneratePackageLists() { | 624 GeneratePackageLists() { |
504 Banner "generating package lists for mips32" | 625 readonly sdk_target=$1 |
626 local packages= | |
627 Banner "generating ${sdk_target} package lists for mips32" | |
505 echo -n > ${TMP_PACKAGELIST_MIPS32} | 628 echo -n > ${TMP_PACKAGELIST_MIPS32} |
506 DownloadOrCopy ${MIPS32_PACKAGES} | 629 DownloadOrCopy ${MIPS32_PACKAGES} |
507 bzcat ${TMP}/Packages.bz2\ | 630 bzcat ${TMP}/Packages.bz2\ |
508 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel | 631 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel |
509 for pkg in ${BASE_PACKAGES} ; do | 632 |
633 if [ ${sdk_target} == "trusted_sdk" ] ; then | |
634 packages=${BASE_PACKAGES} | |
635 elif [ ${sdk_target} == "chrome_sdk" ] ; then | |
636 packages=${CHROME_PACKAGES} | |
637 else | |
638 Banner "ERROR: Packages for \"${sdk_taget}\" not defined." | |
639 exit -1 | |
640 fi | |
641 | |
642 for pkg in ${packages} ; do | |
510 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\ | 643 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\ |
511 | egrep -o "pool/.*" >> ${TMP_PACKAGELIST_MIPS32} | 644 | egrep -o "pool/.*" >> ${TMP_PACKAGELIST_MIPS32} |
512 done | 645 done |
513 } | 646 } |
514 | 647 |
515 InstallMissingLibraries() { | 648 InstallMissingLibraries() { |
516 readonly DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_PACKAGELIST_MIPS32}) | 649 readonly DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_PACKAGELIST_MIPS32}) |
517 for file in ${DEP_FILES_NEEDED_MIPS32} ; do | 650 for file in ${DEP_FILES_NEEDED_MIPS32} ; do |
518 local package="${TMP}/${file##*/}" | 651 local package="${TMP}/${file##*/}" |
519 Banner "installing ${file}" | 652 Banner "installing ${file}" |
(...skipping 25 matching lines...) Expand all Loading... | |
545 | 678 |
546 rm -f librt.so | 679 rm -f librt.so |
547 ln -s ../../lib/librt.so.1 librt.so | 680 ln -s ../../lib/librt.so.1 librt.so |
548 | 681 |
549 rm -f libpcre.so | 682 rm -f libpcre.so |
550 ln -s ../../lib/libpcre.so.3 libpcre.so | 683 ln -s ../../lib/libpcre.so.3 libpcre.so |
551 | 684 |
552 rm -f libresolv.so | 685 rm -f libresolv.so |
553 ln -s ../../lib/libresolv.so.2 libresolv.so | 686 ln -s ../../lib/libresolv.so.2 libresolv.so |
554 | 687 |
688 rm -f libglib-2.0.so | |
689 ln -s ../../lib/libglib-2.0.so.0 libglib-2.0.so | |
690 | |
691 rm -f libudev.so | |
692 ln -s ../../lib/libudev.so.0 libudev.so | |
693 | |
694 rm -f libcom_err.so | |
695 ln -s ../../lib/libcom_err.so.2 libcom_err.so | |
696 | |
697 rm -f libXdmcp.so | |
698 ln -s ../../lib/libXdmcp.so.6 libXdmcp.so | |
699 | |
700 rm -f libstdc++.so* | |
555 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.17 . | 701 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.17 . |
556 ln -s libstdc++.so.6.0.17 libstdc++.so.6 | 702 ln -s libstdc++.so.6.0.17 libstdc++.so.6 |
557 ln -s libstdc++.so.6.0.17 libstdc++.so | 703 ln -s libstdc++.so.6.0.17 libstdc++.so |
558 | 704 |
705 rm -f libgcc_s.so* | |
559 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 . | 706 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 . |
560 ln -s libgcc_s.so.1 libgcc_s.so | 707 ln -s libgcc_s.so.1 libgcc_s.so |
561 } | 708 } |
562 | 709 |
563 BuildAndInstallQemu() { | 710 BuildAndInstallQemu() { |
564 local saved_dir=$(pwd) | 711 local saved_dir=$(pwd) |
565 local tmpdir="${TMP}/qemu-mips.nacl" | 712 local tmpdir="${TMP}/qemu-mips.nacl" |
566 local tarball="qemu-0.12.5.tar.gz" | 713 local tarball="qemu-0.12.5.tar.gz" |
567 | 714 |
568 Banner "Building qemu in ${tmpdir}" | 715 Banner "Building qemu in ${tmpdir}" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 echo | 765 echo |
619 Usage | 766 Usage |
620 exit -1 | 767 exit -1 |
621 | 768 |
622 elif [[ $1 == "trusted_sdk" ]]; then | 769 elif [[ $1 == "trusted_sdk" ]]; then |
623 mkdir -p ${TMP} | 770 mkdir -p ${TMP} |
624 SanityCheck | 771 SanityCheck |
625 ClearInstallDir | 772 ClearInstallDir |
626 ClearBuildDir | 773 ClearBuildDir |
627 DownloadOrCopyAndInstallToolchain | 774 DownloadOrCopyAndInstallToolchain |
628 GeneratePackageLists | 775 GeneratePackageLists $1 |
629 InstallMissingLibraries | 776 InstallMissingLibraries |
630 InstallTrustedLinkerScript | 777 InstallTrustedLinkerScript |
631 BuildAndInstallQemu | 778 BuildAndInstallQemu |
632 CreateTarBall $1 | 779 CreateTarBall $1 |
633 | 780 |
781 elif [[ $1 == "chrome_sdk" ]]; then | |
782 mkdir -p ${TMP} | |
783 SanityCheck | |
784 ClearInstallDir | |
785 ClearBuildDir | |
786 DownloadOrCopyAndInstallToolchain | |
787 GeneratePackageLists $1 | |
788 InstallMissingLibraries | |
Mark Seaborn
2013/02/28 20:40:28
Duplicating this list of actions is rather icky.
petarj
2013/03/06 00:32:10
Done.
| |
789 CreateTarBall ${CROSS_TARBALL} | |
790 | |
634 else | 791 else |
635 Usage | 792 Usage |
636 exit -1 | 793 exit -1 |
637 | 794 |
638 fi | 795 fi |
639 | 796 |
OLD | NEW |