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

Side by Side Diff: tools/trusted_cross_toolchains/trusted-toolchain-creator.mipsel.squeeze.sh

Issue 12315003: [MIPS] Update the toolchain script with packages for Chromium (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: Updated patch set. Created 7 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
« 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/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,
11 # hard-float, mips32 target. 11 # hard-float, mips32 target.
12 # 12 #
13 # It expects the host machine to have relatively recent versions of GMP (4.2.0 13 # It expects the host machine to have relatively recent versions of GMP (4.2.0
14 # or later), MPFR (2.4.2), and MPC (0.8.1) in order to build the GCC. 14 # or later), MPFR (2.4.2), and MPC (0.8.1) in order to build the GCC.
15 # 15 #
16 # Common way to get those is: 16 # Common way to get those is:
17 # sudo apt-get install libmpfr-dev libmpc-dev libgmp3-dev 17 # sudo apt-get install libmpfr-dev libmpc-dev libgmp3-dev
18 18
19 ###################################################################### 19 ######################################################################
20 # Config 20 # Config
21 ###################################################################### 21 ######################################################################
22 22
23 set -o nounset 23 set -o nounset
24 set -o errexit 24 set -o errexit
25 set -o xtrace 25 set -o xtrace
26 26
27 readonly SCRIPT_DIR=$(dirname $0)
28
27 readonly MAKE_OPTS="-j8" 29 readonly MAKE_OPTS="-j8"
28 readonly ARCH="mips32" 30 readonly ARCH="mips32"
29 31
30 readonly GCC_URL="http://ftp.gnu.org/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2" 32 readonly GCC_URL="http://ftp.gnu.org/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2"
31 readonly GCC_SHA1SUM="a464ba0f26eef24c29bcd1e7489421117fb9ee35" 33 readonly GCC_SHA1SUM="a464ba0f26eef24c29bcd1e7489421117fb9ee35"
32 34
33 readonly BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2" 35 readonly BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2"
34 readonly BINUTILS_SHA1SUM="65b304a0b9a53a686ce50a01173d1f40f8efe404" 36 readonly BINUTILS_SHA1SUM="65b304a0b9a53a686ce50a01173d1f40f8efe404"
35 37
36 readonly KERNEL_URL="http://www.linux-mips.org/pub/linux/mips/kernel/v2.6/linux- 2.6.38.4.tar.gz" 38 readonly KERNEL_URL="http://www.linux-mips.org/pub/linux/mips/kernel/v2.6/linux- 2.6.38.4.tar.gz"
(...skipping 10 matching lines...) Expand all
47 readonly INSTALL_ROOT=$(pwd)/toolchain/linux_mips-trusted 49 readonly INSTALL_ROOT=$(pwd)/toolchain/linux_mips-trusted
48 50
49 readonly TMP=$(pwd)/toolchain/tmp/crosstool-trusted 51 readonly TMP=$(pwd)/toolchain/tmp/crosstool-trusted
50 52
51 readonly BUILD_DIR=${TMP}/build 53 readonly BUILD_DIR=${TMP}/build
52 54
53 readonly PATCH_MIPS32=$(readlink -f ../third_party/qemu/qemu-0.12.5.patch_mips) 55 readonly PATCH_MIPS32=$(readlink -f ../third_party/qemu/qemu-0.12.5.patch_mips)
54 56
55 readonly JAIL_MIPS32=${INSTALL_ROOT}/sysroot 57 readonly JAIL_MIPS32=${INSTALL_ROOT}/sysroot
56 58
59 readonly CROSS_TARBALL="naclsdk_linux_mipsel-trusted"
60
57 # These are simple compiler wrappers to force 32bit builds. 61 # These are simple compiler wrappers to force 32bit builds.
58 readonly CC32=$(readlink -f pnacl/scripts/mygcc32) 62 readonly CC32=$(readlink -f pnacl/scripts/mygcc32)
59 readonly CXX32=$(readlink -f pnacl/scripts/myg++32) 63 readonly CXX32=$(readlink -f pnacl/scripts/myg++32)
60 64
61 ###################################################################### 65 ######################################################################
62 # Helper 66 # Helper
63 ###################################################################### 67 ######################################################################
64 68
65 Banner() { 69 Banner() {
66 echo "######################################################################" 70 echo "######################################################################"
67 echo $* 71 echo $*
68 echo "######################################################################" 72 echo "######################################################################"
69 } 73 }
70 74
71 SubBanner() { 75 SubBanner() {
72 echo "......................................................................" 76 echo "......................................................................"
73 echo $* 77 echo $*
74 echo "......................................................................" 78 echo "......................................................................"
75 } 79 }
76 80
77 Usage() { 81 Usage() {
78 echo 82 echo
79 echo "$0 trusted_sdk" 83 echo "$0 <nacl_sdk|chrome_sdk>"
80 echo 84 echo
81 echo "trusted_sdk - Build everything and package it" 85 echo "nacl_sdk - Build nacl toolchain and package it"
86 echo "chrome_sdk - Build chrome toolchain and package it"
Mark Seaborn 2013/03/06 00:43:43 Nit: put only one space before "-" (be consistent)
petarj 2013/03/07 23:59:50 Done.
82 echo 87 echo
83 } 88 }
84 89
85 CheckoutOrCopy() { 90 CheckoutOrCopy() {
86 local url=$1 91 local url=$1
87 local revision=$2 92 local revision=$2
88 local filename="${TMP}/${url##*/}" 93 local filename="${TMP}/${url##*/}"
89 local filetype="${url%%:*}" 94 local filetype="${url%%:*}"
90 95
91 if [ "${filename}" == "" ]; then 96 if [ "${filename}" == "" ]; then
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 echo "Exiting." 181 echo "Exiting."
177 exit 1 182 exit 1
178 fi 183 fi
179 done 184 done
180 } 185 }
181 186
182 187
183 ClearInstallDir() { 188 ClearInstallDir() {
184 Banner "clearing dirs in ${INSTALL_ROOT}" 189 Banner "clearing dirs in ${INSTALL_ROOT}"
185 rm -rf ${INSTALL_ROOT}/* 190 rm -rf ${INSTALL_ROOT}/*
191 mkdir -p ${JAIL_MIPS32}
186 } 192 }
187 193
188 ClearBuildDir() { 194 ClearBuildDir() {
189 Banner "clearing dirs in ${BUILD_DIR}" 195 Banner "clearing dirs in ${BUILD_DIR}"
190 rm -rf ${BUILD_DIR}/* 196 rm -rf ${BUILD_DIR}/*
191 } 197 }
192 198
193 CreateTarBall() { 199 CreateTarBall() {
194 local tarball=$1 200 local tarball=$1
195 Banner "creating tar ball ${tarball}" 201 Banner "creating tar ball ${tarball}"
196 tar cfz ${tarball}-mips.tgz -C ${INSTALL_ROOT} . 202 tar cfz ${tarball}.tgz -C ${INSTALL_ROOT} .
197 } 203 }
198 204
199 205
200 # Download the toolchain source tarballs or use a local copy when available. 206 # Download the toolchain source tarballs or use a local copy when available.
201 DownloadOrCopyAndInstallToolchain() { 207 DownloadOrCopyAndInstallToolchain() {
202 Banner "Installing toolchain" 208 Banner "Installing toolchain"
203 209
204 local tarball="${TMP}/${BINUTILS_URL##*/}" 210 local tarball="${TMP}/${BINUTILS_URL##*/}"
205 DownloadOrCopyAndVerify ${BINUTILS_URL} ${BINUTILS_SHA1SUM} 211 DownloadOrCopyAndVerify ${BINUTILS_URL} ${BINUTILS_SHA1SUM}
206 SubBanner "extracting from ${tarball}" 212 SubBanner "extracting from ${tarball}"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 467 }
462 468
463 469
464 # ---------------------------------------------------------------------- 470 # ----------------------------------------------------------------------
465 # mips32 deb files to complete our code sourcery jail 471 # mips32 deb files to complete our code sourcery jail
466 # ---------------------------------------------------------------------- 472 # ----------------------------------------------------------------------
467 473
468 readonly REPO_DEBIAN=http://ftp.debian.org/debian 474 readonly REPO_DEBIAN=http://ftp.debian.org/debian
469 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/squeeze/main/binary-mipsel/Package s.bz2 475 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/squeeze/main/binary-mipsel/Package s.bz2
470 476
471 readonly TMP_PACKAGELIST_MIPS32=${TMP}/../packagelist_mipsel.tmp 477 readonly TMP_BASE_PACKAGELIST_MIPS32=${SCRIPT_DIR}/packagelist.squeeze.mipsel.ba se
478 readonly TMP_EXTRA_PACKAGELIST_MIPS32=${SCRIPT_DIR}/packagelist.squeeze.mipsel.e xtra
472 479
473 # These are good enough for native client. 480 # Jail packages: these are good enough for native client
481 # NOTE: the package listing here should be updated using the
482 # GeneratePackageList() function below
474 readonly BASE_PACKAGES="\ 483 readonly BASE_PACKAGES="\
475 libssl0.9.8 \ 484 libssl0.9.8 \
476 libssl-dev \ 485 libssl-dev \
486 zlib1g \
487 zlib1g-dev"
488
489 # Additional jail packages needed to build chrome
490 # NOTE: the package listing here should be updated using the
491 # GeneratePackageList() functions below
492 readonly EXTRA_PACKAGES="\
493 comerr-dev \
494 krb5-multidev \
495 libaa1 \
496 libaa1-dev \
497 libasound2 \
498 libasound2-dev \
499 libatk1.0-0 \
500 libatk1.0-dev \
501 libxau6 \
502 libxau-dev \
503 libavahi-client3 \
504 libavahi-client-dev \
505 libavahi-common3 \
506 libavahi-common-dev \
507 libbz2-1.0 \
508 libbz2-dev \
509 libcairo2 \
510 libcairo2-dev \
511 libcups2 \
512 libcups2-dev \
513 libdbus-1-3 \
514 libdbus-1-dev \
515 libdbus-glib-1-2 \
516 libdbus-glib-1-dev \
517 libcomerr2 \
518 libexpat1 \
519 libexpat1-dev \
520 libfontconfig1 \
521 libfontconfig1-dev \
522 libfreetype6 \
523 libfreetype6-dev \
524 libgconf2-4 \
525 libgconf2-dev \
526 libgcrypt11 \
527 libgcrypt11-dev \
528 libgnutls26 \
529 libgnutls-dev \
530 libgpg-error0 \
531 libgpg-error-dev \
532 libgssapi-krb5-2 \
533 libgtk2.0-0 \
534 libgtk2.0-dev \
535 libglib2.0-0 \
536 libglib2.0-dev \
537 libgnome-keyring-dev \
538 libjpeg62 \
539 libjpeg62-dev \
540 libk5crypto3 \
541 libkeyutils1 \
542 libkeyutils-dev \
543 libkrb5-3 \
544 libkrb5-dev \
545 libkrb5support0 \
546 libnspr4-0d \
547 libnspr4-dev \
548 libnss3-1d \
549 libnss3-dev \
550 liborbit2 \
551 liborbit2-dev \
552 libpam0g \
553 libpam0g-dev \
554 libpango1.0-0 \
555 libpango1.0-dev \
556 libpci3 \
557 libpci-dev \
558 libpcre3 \
559 libpcre3-dev \
560 libpixman-1-0 \
561 libpixman-1-dev \
562 libpng12-0 \
563 libpng12-dev \
564 libselinux1 \
565 libspeechd2 \
566 libspeechd-dev \
567 libtasn1-3 \
568 libtasn1-3-dev \
569 libudev0 \
570 libudev-dev \
477 libx11-6 \ 571 libx11-6 \
478 libx11-dev \ 572 libx11-dev \
479 x11proto-core-dev \ 573 libxext6 \
480 libxt6 \ 574 libxext-dev \
481 libxt-dev \ 575 libxau6 \
482 zlib1g \
483 zlib1g-dev \
484 libasound2 \
485 libasound2-dev \
486 libaa1 \
487 libaa1-dev \
488 libxau-dev \ 576 libxau-dev \
489 libxau6 \
490 libxcb1 \ 577 libxcb1 \
491 libxcb1-dev \ 578 libxcb1-dev \
492 libxcb-render0 \ 579 libxcb-render0 \
493 libxcb-render0-dev \ 580 libxcb-render0-dev \
494 libxcb-render-util0 \ 581 libxcb-render-util0 \
495 libxcb-render-util0-dev \ 582 libxcb-render-util0-dev \
496 libxcb-shm0 \ 583 libxcb-shm0 \
497 libxcb-shm0-dev \ 584 libxcb-shm0-dev \
585 libxcomposite1 \
586 libxcomposite-dev \
587 libxcursor1 \
588 libxcursor-dev \
589 libxdamage1 \
590 libxdamage-dev \
498 libxdmcp6 \ 591 libxdmcp6 \
499 libxdmcp-dev \ 592 libxdmcp-dev \
593 libxfixes3 \
594 libxfixes-dev \
595 libxi6 \
596 libxi-dev \
597 libxinerama1 \
598 libxinerama-dev \
599 libxrandr2 \
600 libxrandr-dev \
601 libxrender1 \
602 libxrender-dev \
500 libxss1 \ 603 libxss1 \
501 libxss-dev" 604 libxss-dev \
605 libxt6 \
606 libxt-dev \
607 libxtst6 \
608 libxtst-dev \
609 python2.6 \
610 python2.6-dev \
611 x11proto-core-dev \
612 x11proto-composite-dev \
613 x11proto-damage-dev \
614 x11proto-fixes-dev \
615 x11proto-input-dev \
616 x11proto-kb-dev \
617 x11proto-randr-dev \
618 x11proto-record-dev \
619 x11proto-render-dev \
620 x11proto-scrnsaver-dev \
621 x11proto-xext-dev"
502 622
503 GeneratePackageLists() { 623 GeneratePackageLists() {
504 Banner "generating package lists for mips32" 624 local sdk_target=$1
505 echo -n > ${TMP_PACKAGELIST_MIPS32} 625 local packages=
626 local TMP_PACKAGELIST=
627 Banner "generating ${sdk_target} package lists for mips32"
506 DownloadOrCopy ${MIPS32_PACKAGES} 628 DownloadOrCopy ${MIPS32_PACKAGES}
507 bzcat ${TMP}/Packages.bz2\ 629 bzcat ${TMP}/Packages.bz2\
508 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel 630 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel
509 for pkg in ${BASE_PACKAGES} ; do 631
632 if [ ${sdk_target} == "nacl_sdk" ] ; then
633 echo -n > ${TMP_BASE_PACKAGELIST_MIPS32}
634 TMP_PACKAGELIST=${TMP_BASE_PACKAGELIST_MIPS32}
635 packages=${BASE_PACKAGES}
636 elif [ ${sdk_target} == "chrome_sdk" ] ; then
637 echo -n > ${TMP_EXTRA_PACKAGELIST_MIPS32}
638 TMP_PACKAGELIST=${TMP_EXTRA_PACKAGELIST_MIPS32}
639 packages=${BASE_PACKAGES}${EXTRA_PACKAGES}
640 else
641 Banner "ERROR: Packages for \"${sdk_taget}\" not defined."
642 exit -1
643 fi
644
645 for pkg in ${packages} ; do
510 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\ 646 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\
511 | egrep -o "pool/.*" >> ${TMP_PACKAGELIST_MIPS32} 647 | egrep -o "pool/.*" >> ${TMP_PACKAGELIST}
512 done 648 done
513 } 649 }
514 650
515 InstallMissingLibraries() { 651 InstallMissingLibraries() {
516 readonly DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_PACKAGELIST_MIPS32}) 652 local sdk_target=$1
653 local DEP_FILES_NEEDED_MIPS32=
654
655 if [ ${sdk_target} == "nacl_sdk" ] ; then
656 DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_BASE_PACKAGELIST_MIPS32})
657 elif [ ${sdk_target} == "chrome_sdk" ] ; then
658 DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_EXTRA_PACKAGELIST_MIPS32})
659 else
660 Banner "ERROR: Target \"${sdk_taget}\" not defined."
661 exit -1
662 fi
663
517 for file in ${DEP_FILES_NEEDED_MIPS32} ; do 664 for file in ${DEP_FILES_NEEDED_MIPS32} ; do
518 local package="${TMP}/${file##*/}" 665 local package="${TMP}/${file##*/}"
519 Banner "installing ${file}" 666 Banner "installing ${file}"
520 DownloadOrCopy ${REPO_DEBIAN}/${file} 667 DownloadOrCopy ${REPO_DEBIAN}/${file}
521 SubBanner "extracting to ${JAIL_MIPS32}" 668 SubBanner "extracting to ${JAIL_MIPS32}"
522 dpkg --fsys-tarfile ${package}\ 669 dpkg --fsys-tarfile ${package}\
523 | tar -xvf - --exclude=./usr/share -C ${JAIL_MIPS32} 670 | tar -xvf - --exclude=./usr/share -C ${JAIL_MIPS32}
524 done 671 done
525 672
526 Banner "some cleanup" 673 Banner "some cleanup"
(...skipping 18 matching lines...) Expand all
545 692
546 rm -f librt.so 693 rm -f librt.so
547 ln -s ../../lib/librt.so.1 librt.so 694 ln -s ../../lib/librt.so.1 librt.so
548 695
549 rm -f libpcre.so 696 rm -f libpcre.so
550 ln -s ../../lib/libpcre.so.3 libpcre.so 697 ln -s ../../lib/libpcre.so.3 libpcre.so
551 698
552 rm -f libresolv.so 699 rm -f libresolv.so
553 ln -s ../../lib/libresolv.so.2 libresolv.so 700 ln -s ../../lib/libresolv.so.2 libresolv.so
554 701
702 rm -f libglib-2.0.so
703 ln -s ../../lib/libglib-2.0.so.0 libglib-2.0.so
704
705 rm -f libudev.so
706 ln -s ../../lib/libudev.so.0 libudev.so
707
708 rm -f libcom_err.so
709 ln -s ../../lib/libcom_err.so.2 libcom_err.so
710
711 rm -f libXdmcp.so
712 ln -s ../../lib/libXdmcp.so.6 libXdmcp.so
713
714 rm -f libstdc++.so*
555 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.17 . 715 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.17 .
556 ln -s libstdc++.so.6.0.17 libstdc++.so.6 716 ln -s libstdc++.so.6.0.17 libstdc++.so.6
557 ln -s libstdc++.so.6.0.17 libstdc++.so 717 ln -s libstdc++.so.6.0.17 libstdc++.so
558 718
719 rm -f libgcc_s.so*
559 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 . 720 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 .
560 ln -s libgcc_s.so.1 libgcc_s.so 721 ln -s libgcc_s.so.1 libgcc_s.so
561 } 722 }
562 723
563 BuildAndInstallQemu() { 724 BuildAndInstallQemu() {
564 local saved_dir=$(pwd) 725 local saved_dir=$(pwd)
565 local tmpdir="${TMP}/qemu-mips.nacl" 726 local tmpdir="${TMP}/qemu-mips.nacl"
566 local tarball="qemu-0.12.5.tar.gz" 727 local tarball="qemu-0.12.5.tar.gz"
567 728
568 Banner "Building qemu in ${tmpdir}" 729 Banner "Building qemu in ${tmpdir}"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 ###################################################################### 773 ######################################################################
613 # Main 774 # Main
614 ###################################################################### 775 ######################################################################
615 776
616 if [[ $# -eq 0 ]] ; then 777 if [[ $# -eq 0 ]] ; then
617 echo "you must specify a mode on the commandline:" 778 echo "you must specify a mode on the commandline:"
618 echo 779 echo
619 Usage 780 Usage
620 exit -1 781 exit -1
621 782
622 elif [[ $1 == "trusted_sdk" ]]; then 783 elif [[ $1 == "nacl_sdk" || $1 == "chrome_sdk" ]] ; then
623 mkdir -p ${TMP} 784 mkdir -p ${TMP}
624 SanityCheck 785 SanityCheck
625 ClearInstallDir 786 ClearInstallDir
626 ClearBuildDir 787 ClearBuildDir
627 DownloadOrCopyAndInstallToolchain 788 DownloadOrCopyAndInstallToolchain
628 GeneratePackageLists 789 GeneratePackageLists $1
629 InstallMissingLibraries 790 InstallMissingLibraries $1
630 InstallTrustedLinkerScript 791 if [[ $1 == "nacl_sdk" ]] ; then
631 BuildAndInstallQemu 792 InstallTrustedLinkerScript
632 CreateTarBall $1 793 BuildAndInstallQemu
794 CreateTarBall $1
795 else
796 CreateTarBall ${CROSS_TARBALL}
797 fi
633 798
634 else 799 else
635 Usage 800 Usage
636 exit -1 801 exit -1
637 802
638 fi 803 fi
639 804
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