Chromium Code Reviews| 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, |
| 11 # hard-float, mips32 target. | 11 # hard-float, mips32 target. |
| 12 | 12 |
| 13 ###################################################################### | 13 ###################################################################### |
| 14 # Config | 14 # Config |
| 15 ###################################################################### | 15 ###################################################################### |
| 16 | 16 |
| 17 set -o nounset | 17 set -o nounset |
| 18 set -o errexit | 18 set -o errexit |
| 19 | 19 |
| 20 readonly SCRIPT_DIR=$(dirname $0) | 20 readonly SCRIPT_DIR=$(dirname $0) |
| 21 readonly NACL_ROOT=$(cd ${SCRIPT_DIR}/../.. && pwd) | |
| 21 | 22 |
| 22 readonly MAKE_OPTS="-j8" | 23 readonly MAKE_OPTS="-j8" |
| 23 readonly ARCH="mips32" | 24 readonly ARCH="mips32" |
| 24 | 25 |
| 25 readonly GMP_URL="http://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2" | 26 readonly GMP_URL="http://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.bz2" |
| 26 readonly GMP_SHA1SUM="b35928e2927b272711fdfbf71b7cfd5f86a6b165" | 27 readonly GMP_SHA1SUM="b35928e2927b272711fdfbf71b7cfd5f86a6b165" |
| 27 | 28 |
| 28 readonly MPFR_URL="http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2" | 29 readonly MPFR_URL="http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.2.tar.bz2" |
| 29 readonly MPFR_SHA1SUM="46d5a11a59a4e31f74f73dd70c5d57a59de2d0b4" | 30 readonly MPFR_SHA1SUM="46d5a11a59a4e31f74f73dd70c5d57a59de2d0b4" |
| 30 | 31 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 41 readonly KERNEL_SHA1SUM="9b094e817a7a9b7c09b5bc268e23de642c6c407a" | 42 readonly KERNEL_SHA1SUM="9b094e817a7a9b7c09b5bc268e23de642c6c407a" |
| 42 | 43 |
| 43 readonly GDB_URL="http://ftp.gnu.org/gnu/gdb/gdb-7.7.1.tar.bz2" | 44 readonly GDB_URL="http://ftp.gnu.org/gnu/gdb/gdb-7.7.1.tar.bz2" |
| 44 readonly GDB_SHA1SUM="35228319f7c715074a80be42fff64c7645227a80" | 45 readonly GDB_SHA1SUM="35228319f7c715074a80be42fff64c7645227a80" |
| 45 | 46 |
| 46 readonly GLIBC_URL="http://ftp.gnu.org/gnu/glibc/glibc-2.19.tar.bz2" | 47 readonly GLIBC_URL="http://ftp.gnu.org/gnu/glibc/glibc-2.19.tar.bz2" |
| 47 readonly GLIBC_SHA1SUM="382f4438a7321dc29ea1a3da8e7852d2c2b3208c" | 48 readonly GLIBC_SHA1SUM="382f4438a7321dc29ea1a3da8e7852d2c2b3208c" |
| 48 | 49 |
| 49 readonly DOWNLOAD_QEMU_URL="http://wiki.qemu-project.org/download/qemu-2.0.0.tar .bz2" | 50 readonly DOWNLOAD_QEMU_URL="http://wiki.qemu-project.org/download/qemu-2.0.0.tar .bz2" |
| 50 | 51 |
| 51 readonly INSTALL_ROOT=$(pwd)/toolchain/linux_x86/mips_trusted | 52 readonly OUT_DIR=$(dirname ${NACL_ROOT})/out |
| 52 | 53 |
| 53 readonly TMP=$(pwd)/toolchain/tmp/crosstool-trusted | 54 readonly INSTALL_ROOT=${NACL_ROOT}/toolchain/linux_x86/mips_trusted |
| 55 | |
| 56 readonly TMP=${OUT_DIR}/sysroot_mips_trusted | |
| 54 | 57 |
| 55 readonly BUILD_DIR=${TMP}/build | 58 readonly BUILD_DIR=${TMP}/build |
| 56 | 59 |
| 57 readonly JAIL_MIPS32=${INSTALL_ROOT}/sysroot | 60 readonly CROSS_TARBALL="chromesdk_linux_mipsel" |
|
petarj
2015/06/24 15:42:04
If sysroot does not exist anymore, you need to mod
Sam Clegg
2015/06/24 23:25:51
Ok.. I reverted that part of the change. sysroot
| |
| 58 | 61 |
| 59 readonly CROSS_TARBALL="chromesdk_linux_mipsel" | 62 readonly TAR_ARCHIVE=${OUT_DIR}/out/sysroot_mipsel_trusted_wheezy.tgz |
| 63 | |
| 64 readonly PACKAGES=" | |
| 65 libssl1.0.0 | |
| 66 libssl-dev | |
| 67 zlib1g | |
| 68 zlib1g-dev | |
| 69 " | |
| 60 | 70 |
| 61 ###################################################################### | 71 ###################################################################### |
| 62 # Helper | 72 # Helper |
| 63 ###################################################################### | 73 ###################################################################### |
| 64 | 74 |
| 65 Banner() { | 75 Banner() { |
| 66 echo "######################################################################" | 76 echo "######################################################################" |
| 67 echo $* | 77 echo $* |
| 68 echo "######################################################################" | 78 echo "######################################################################" |
| 69 } | 79 } |
| 70 | 80 |
| 71 SubBanner() { | 81 SubBanner() { |
| 72 echo "......................................................................" | 82 echo "......................................................................" |
| 73 echo $* | 83 echo $* |
| 74 echo "......................................................................" | 84 echo "......................................................................" |
| 75 } | 85 } |
| 76 | 86 |
| 87 | |
| 77 Usage() { | 88 Usage() { |
| 78 echo | 89 egrep "^#@" $0 | cut --bytes=3- |
| 79 echo "$0 <nacl_sdk|chrome_sdk>" | |
| 80 echo | |
| 81 echo "nacl_sdk - Build nacl toolchain and package it" | |
| 82 echo "chrome_sdk - Build chrome toolchain and package it" | |
| 83 echo | |
| 84 } | 90 } |
| 85 | 91 |
| 86 DownloadOrCopy() { | 92 DownloadOrCopy() { |
| 87 local url=$1 | 93 local url=$1 |
| 88 local filename="${TMP}/${url##*/}" | 94 local filename="${TMP}/${url##*/}" |
| 89 local filetype="${url%%:*}" | 95 local filetype="${url%%:*}" |
| 90 | 96 |
| 91 if [ "${filename}" == "" ]; then | 97 if [ "${filename}" == "" ]; then |
| 92 echo "Unknown error occured. Aborting." | 98 echo "Unknown error occured. Aborting." |
| 93 exit 1 | 99 exit 1 |
| 94 fi | 100 fi |
| 95 | 101 |
| 96 if [[ "${filetype}" == "http" || ${filetype} == "https" ]] ; then | 102 if [[ "${filetype}" == "http" || ${filetype} == "https" ]] ; then |
| 97 if [ ! -f "${filename}" ]; then | 103 if [ ! -f "${filename}" ]; then |
| 98 SubBanner "downloading from ${url} -> ${filename}" | 104 SubBanner "downloading from ${url} -> ${filename}" |
| 99 wget ${url} -O ${filename} | 105 wget ${url} -O ${filename} |
| 106 else | |
| 107 SubBanner "using existing file: ${filename}" | |
| 100 fi | 108 fi |
| 101 else | 109 else |
| 102 SubBanner "copying from ${url}" | 110 SubBanner "copying from ${url}" |
| 103 cp ${url} ${filename} | 111 cp ${url} ${filename} |
| 104 fi | 112 fi |
| 105 } | 113 } |
| 106 | 114 |
| 107 DownloadOrCopyAndVerify() { | 115 DownloadOrCopyAndVerify() { |
| 108 local url=$1 | 116 local url=$1 |
| 109 local checksum=$2 | 117 local checksum=$2 |
| 110 local filename="${TMP}/${url##*/}" | 118 local filename="${TMP}/${url##*/}" |
| 111 local filetype="${url%%:*}" | 119 local filetype="${url%%:*}" |
| 112 | 120 |
| 113 if [ "${filename}" == "" ]; then | 121 if [ "${filename}" == "" ]; then |
| 114 echo "Unknown error occured. Aborting." | 122 echo "Unknown error occured. Aborting." |
| 115 exit 1 | 123 exit 1 |
| 116 fi | 124 fi |
| 117 | 125 |
| 118 if [[ "${filetype}" == "http" || ${filetype} == "https" ]] ; then | 126 if [[ "${filetype}" == "http" || ${filetype} == "https" ]] ; then |
| 119 if [ ! -f "${filename}" ]; then | 127 if [ ! -f "${filename}" ]; then |
| 120 SubBanner "downloading from ${url} -> ${filename}" | 128 SubBanner "downloading from ${url} -> ${filename}" |
| 121 wget ${url} -O ${filename} | 129 wget ${url} -O ${filename} |
| 130 else | |
| 131 SubBanner "using existing file: ${filename}" | |
| 122 fi | 132 fi |
| 123 if [ "${checksum}" != "nochecksum" ]; then | 133 if [ "${checksum}" != "nochecksum" ]; then |
| 124 if [ "$(sha1sum ${filename} | cut -d ' ' -f 1)" != "${checksum}" ]; then | 134 if [ "$(sha1sum ${filename} | cut -d ' ' -f 1)" != "${checksum}" ]; then |
| 125 echo "${filename} sha1sum failed. Deleting file and aborting." | 135 echo "${filename} sha1sum failed. Deleting file and aborting." |
| 126 rm -f ${filename} | 136 rm -f ${filename} |
| 127 exit 1 | 137 exit 1 |
| 128 fi | 138 fi |
| 129 fi | 139 fi |
| 130 else | 140 else |
| 131 SubBanner "copying from ${url}" | 141 SubBanner "copying from ${url}" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 156 echo "Required binary $tool not found." | 166 echo "Required binary $tool not found." |
| 157 echo "Exiting." | 167 echo "Exiting." |
| 158 exit 1 | 168 exit 1 |
| 159 fi | 169 fi |
| 160 done | 170 done |
| 161 } | 171 } |
| 162 | 172 |
| 163 | 173 |
| 164 ClearInstallDir() { | 174 ClearInstallDir() { |
| 165 Banner "clearing dirs in ${INSTALL_ROOT}" | 175 Banner "clearing dirs in ${INSTALL_ROOT}" |
| 166 rm -rf ${INSTALL_ROOT}/* | 176 rm -rf ${INSTALL_ROOT} |
| 167 mkdir -p ${JAIL_MIPS32} | 177 mkdir -p ${INSTALL_ROOT} |
| 168 } | 178 } |
| 169 | 179 |
| 170 ClearBuildDir() { | 180 ClearBuildDir() { |
| 171 Banner "clearing dirs in ${BUILD_DIR}" | 181 Banner "clearing dirs in ${BUILD_DIR}" |
| 172 rm -rf ${BUILD_DIR}/* | 182 rm -rf ${BUILD_DIR}/* |
| 173 } | 183 } |
| 174 | 184 |
| 175 CreateTarBall() { | 185 CreateTarBall() { |
| 176 local tarball=$1 | 186 Banner "creating tar ball ${TAR_ARCHIVE}" |
| 177 Banner "creating tar ball ${tarball}" | 187 tar cfz ${TAR_ARCHIVE} -C ${INSTALL_ROOT} . |
| 178 tar cfz ${tarball}.tgz -C ${INSTALL_ROOT} . | |
| 179 } | 188 } |
| 180 | 189 |
| 181 | 190 |
| 182 # Download the toolchain source tarballs or use a local copy when available. | 191 # Download the toolchain source tarballs or use a local copy when available. |
| 183 DownloadOrCopyAndInstallToolchain() { | 192 DownloadOrCopyAndInstallToolchain() { |
| 184 Banner "Installing toolchain" | 193 Banner "Installing toolchain" |
| 185 | 194 |
| 186 tarball="${TMP}/${GCC_URL##*/}" | 195 tarball="${TMP}/${GCC_URL##*/}" |
| 187 DownloadOrCopyAndVerify ${GCC_URL} ${GCC_SHA1SUM} | 196 DownloadOrCopyAndVerify ${GCC_URL} ${GCC_SHA1SUM} |
| 188 SubBanner "extracting from ${tarball}" | 197 SubBanner "extracting from ${tarball}" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 Banner "Building binutils" | 262 Banner "Building binutils" |
| 254 | 263 |
| 255 rm -rf ${BUILD_DIR}/binutils/ | 264 rm -rf ${BUILD_DIR}/binutils/ |
| 256 mkdir -p ${BUILD_DIR}/binutils/ | 265 mkdir -p ${BUILD_DIR}/binutils/ |
| 257 pushd ${BUILD_DIR}/binutils/ | 266 pushd ${BUILD_DIR}/binutils/ |
| 258 | 267 |
| 259 SubBanner "Configuring" | 268 SubBanner "Configuring" |
| 260 ${TMP}/binutils-2.24/configure \ | 269 ${TMP}/binutils-2.24/configure \ |
| 261 --prefix=${INSTALL_ROOT} \ | 270 --prefix=${INSTALL_ROOT} \ |
| 262 --target=mipsel-linux-gnu \ | 271 --target=mipsel-linux-gnu \ |
| 263 --with-sysroot=${JAIL_MIPS32} | 272 --with-sysroot=${INSTALL_ROOT} |
| 264 | 273 |
| 265 SubBanner "Make" | 274 SubBanner "Make" |
| 266 make ${MAKE_OPTS} all-binutils all-gas all-ld | 275 make ${MAKE_OPTS} all-binutils all-gas all-ld |
| 267 | 276 |
| 268 SubBanner "Install" | 277 SubBanner "Install" |
| 269 make ${MAKE_OPTS} install-binutils install-gas install-ld | 278 make ${MAKE_OPTS} install-binutils install-gas install-ld |
| 270 | 279 |
| 271 popd | 280 popd |
| 272 | 281 |
| 273 | 282 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 301 make ${MAKE_OPTS} all | 310 make ${MAKE_OPTS} all |
| 302 | 311 |
| 303 SubBanner "Install" | 312 SubBanner "Install" |
| 304 make ${MAKE_OPTS} install | 313 make ${MAKE_OPTS} install |
| 305 | 314 |
| 306 popd | 315 popd |
| 307 | 316 |
| 308 | 317 |
| 309 Banner "Installing Linux kernel headers" | 318 Banner "Installing Linux kernel headers" |
| 310 pushd ${TMP}/linux-3.14.2 | 319 pushd ${TMP}/linux-3.14.2 |
| 311 make headers_install ARCH=mips INSTALL_HDR_PATH=${JAIL_MIPS32}/usr | 320 make headers_install ARCH=mips INSTALL_HDR_PATH=${INSTALL_ROOT}/usr |
| 312 popd | 321 popd |
| 313 | 322 |
| 314 Banner "Building GLIBC" | 323 Banner "Building GLIBC" |
| 315 | 324 |
| 316 rm -rf ${BUILD_DIR}/glibc/final | 325 rm -rf ${BUILD_DIR}/glibc/final |
| 317 mkdir -p ${BUILD_DIR}/glibc/final | 326 mkdir -p ${BUILD_DIR}/glibc/final |
| 318 pushd ${BUILD_DIR}/glibc/final | 327 pushd ${BUILD_DIR}/glibc/final |
| 319 | 328 |
| 320 BUILD_CC=gcc \ | 329 BUILD_CC=gcc \ |
| 321 AR=mipsel-linux-gnu-ar \ | 330 AR=mipsel-linux-gnu-ar \ |
| 322 RANLIB=mipsel-linux-gnu-ranlibi \ | 331 RANLIB=mipsel-linux-gnu-ranlibi \ |
| 323 CC=mipsel-linux-gnu-gcc \ | 332 CC=mipsel-linux-gnu-gcc \ |
| 324 CXX=mipsel-linux-gnu-g++ \ | 333 CXX=mipsel-linux-gnu-g++ \ |
| 325 ${TMP}/glibc-2.19/configure \ | 334 ${TMP}/glibc-2.19/configure \ |
| 326 --prefix=/usr \ | 335 --prefix=/usr \ |
| 327 --enable-add-ons \ | 336 --enable-add-ons \ |
| 328 --host=mipsel-linux-gnu \ | 337 --host=mipsel-linux-gnu \ |
| 329 --disable-profile \ | 338 --disable-profile \ |
| 330 --without-gd \ | 339 --without-gd \ |
| 331 --without-cvs \ | 340 --without-cvs \ |
| 332 --build=i686-pc-linux-gnu \ | 341 --build=i686-pc-linux-gnu \ |
| 333 --with-headers=${JAIL_MIPS32}/usr/include | 342 --with-headers=${INSTALL_ROOT}/usr/include |
| 334 | 343 |
| 335 SubBanner "Make" | 344 SubBanner "Make" |
| 336 make ${MAKE_OPTS} all | 345 make ${MAKE_OPTS} all |
| 337 | 346 |
| 338 SubBanner "Install" | 347 SubBanner "Install" |
| 339 make ${MAKE_OPTS} install install_root=${JAIL_MIPS32} | 348 make ${MAKE_OPTS} install install_root=${INSTALL_ROOT} |
| 340 | 349 |
| 341 popd | 350 popd |
| 342 | 351 |
| 343 | 352 |
| 344 Banner "Building GCC (final)" | 353 Banner "Building GCC (final)" |
| 345 | 354 |
| 346 rm -rf ${BUILD_DIR}/gcc/final | 355 rm -rf ${BUILD_DIR}/gcc/final |
| 347 mkdir -p ${BUILD_DIR}/gcc/final | 356 mkdir -p ${BUILD_DIR}/gcc/final |
| 348 pushd ${BUILD_DIR}/gcc/final | 357 pushd ${BUILD_DIR}/gcc/final |
| 349 | 358 |
| 350 ${TMP}/gcc-4.9.0/configure \ | 359 ${TMP}/gcc-4.9.0/configure \ |
| 351 --prefix=${INSTALL_ROOT} \ | 360 --prefix=${INSTALL_ROOT} \ |
| 352 --disable-libssp \ | 361 --disable-libssp \ |
| 353 --disable-libgomp \ | 362 --disable-libgomp \ |
| 354 --disable-libmudflap \ | 363 --disable-libmudflap \ |
| 355 --disable-fixed-point \ | 364 --disable-fixed-point \ |
| 356 --disable-decimal-float \ | 365 --disable-decimal-float \ |
| 357 --with-mips-plt \ | 366 --with-mips-plt \ |
| 358 --with-endian=little \ | 367 --with-endian=little \ |
| 359 --with-arch=${ARCH} \ | 368 --with-arch=${ARCH} \ |
| 360 --target=mipsel-linux-gnu \ | 369 --target=mipsel-linux-gnu \ |
| 361 --enable-__cxa_atexit \ | 370 --enable-__cxa_atexit \ |
| 362 --enable-languages=c,c++ \ | 371 --enable-languages=c,c++ \ |
| 363 --with-sysroot=${JAIL_MIPS32} | 372 --with-sysroot=${INSTALL_ROOT} |
| 364 | 373 |
| 365 SubBanner "Make" | 374 SubBanner "Make" |
| 366 make ${MAKE_OPTS} all | 375 make ${MAKE_OPTS} all |
| 367 | 376 |
| 368 SubBanner "Install" | 377 SubBanner "Install" |
| 369 make ${MAKE_OPTS} install | 378 make ${MAKE_OPTS} install |
| 370 | 379 |
| 371 popd | 380 popd |
| 372 | 381 |
| 373 | 382 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 390 popd | 399 popd |
| 391 } | 400 } |
| 392 | 401 |
| 393 | 402 |
| 394 # ---------------------------------------------------------------------- | 403 # ---------------------------------------------------------------------- |
| 395 # mips32 deb files to complete our code sourcery jail | 404 # mips32 deb files to complete our code sourcery jail |
| 396 # ---------------------------------------------------------------------- | 405 # ---------------------------------------------------------------------- |
| 397 | 406 |
| 398 readonly REPO_DEBIAN=http://ftp.debian.org/debian | 407 readonly REPO_DEBIAN=http://ftp.debian.org/debian |
| 399 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/wheezy/main/binary-mipsel/Packages .bz2 | 408 readonly MIPS32_PACKAGES=${REPO_DEBIAN}/dists/wheezy/main/binary-mipsel/Packages .bz2 |
| 400 | 409 readonly PACKAGE_LIST=${SCRIPT_DIR}/packagelist.wheezy.mipsel.base |
| 401 readonly BASE_PACKAGELIST_MIPS32=${SCRIPT_DIR}/packagelist.wheezy.mipsel.base | |
| 402 readonly EXTRA_PACKAGELIST_MIPS32=${SCRIPT_DIR}/packagelist.wheezy.mipsel.extra | |
| 403 readonly TMP_BASE_PKG_MIPS32=${TMP}/packagelist.generated.wheezy.mipsel.base | |
| 404 readonly TMP_EXTRA_PKG_MIPS32=${TMP}/packagelist.generated.wheezy.mipsel.extra | |
| 405 | 410 |
| 406 GeneratePackageLists() { | 411 GeneratePackageLists() { |
| 407 local sdk_target=$1 | 412 Banner "generating package lists for mips32" |
| 408 local packages= | |
| 409 local TMP_PACKAGELIST= | |
| 410 Banner "generating ${sdk_target} package lists for mips32" | |
| 411 rm -f ${TMP}/Packages.bz2 | 413 rm -f ${TMP}/Packages.bz2 |
| 412 DownloadOrCopy ${MIPS32_PACKAGES} | 414 DownloadOrCopy ${MIPS32_PACKAGES} |
| 413 bzcat ${TMP}/Packages.bz2\ | 415 bzcat ${TMP}/Packages.bz2\ |
| 414 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel | 416 | egrep '^(Package:|Filename:)' > ${TMP}/Packages_mipsel |
| 415 | 417 |
| 416 if [ ${sdk_target} == "nacl_sdk" ] ; then | 418 echo -n > ${PACKAGE_LIST} |
| 417 echo -n > ${TMP_BASE_PKG_MIPS32} | |
| 418 TMP_PACKAGELIST=${TMP_BASE_PKG_MIPS32} | |
| 419 packages=$(cat ${BASE_PACKAGELIST_MIPS32}) | |
| 420 elif [ ${sdk_target} == "chrome_sdk" ] ; then | |
| 421 echo -n > ${TMP_EXTRA_PKG_MIPS32} | |
| 422 TMP_PACKAGELIST=${TMP_EXTRA_PKG_MIPS32} | |
| 423 packages=$(cat ${EXTRA_PACKAGELIST_MIPS32}) | |
| 424 else | |
| 425 Banner "ERROR: Packages for \"${sdk_taget}\" not defined." | |
| 426 exit -1 | |
| 427 fi | |
| 428 | 419 |
| 429 for pkg in ${packages} ; do | 420 for pkg in ${PACKAGES} ; do |
| 430 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\ | 421 grep -A 1 "${pkg}\$" ${TMP}/Packages_mipsel\ |
| 431 | egrep -o "pool/.*" >> ${TMP_PACKAGELIST} | 422 | egrep -o "pool/.*" >> ${PACKAGE_LIST} |
| 432 done | 423 done |
| 433 } | 424 } |
| 434 | 425 |
| 435 InstallMissingLibraries() { | 426 InstallMissingLibraries() { |
| 436 local sdk_target=$1 | |
| 437 local DEP_FILES_NEEDED_MIPS32= | 427 local DEP_FILES_NEEDED_MIPS32= |
| 438 | 428 DEP_FILES_NEEDED_MIPS32=$(cat ${PACKAGE_LIST}) |
| 439 if [ ${sdk_target} == "nacl_sdk" ] ; then | |
| 440 DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_BASE_PKG_MIPS32}) | |
| 441 elif [ ${sdk_target} == "chrome_sdk" ] ; then | |
| 442 DEP_FILES_NEEDED_MIPS32=$(cat ${TMP_EXTRA_PKG_MIPS32}) | |
| 443 else | |
| 444 Banner "ERROR: Target \"${sdk_taget}\" not defined." | |
| 445 exit -1 | |
| 446 fi | |
| 447 | 429 |
| 448 for file in ${DEP_FILES_NEEDED_MIPS32} ; do | 430 for file in ${DEP_FILES_NEEDED_MIPS32} ; do |
| 449 local package="${TMP}/${file##*/}" | 431 local package="${TMP}/${file##*/}" |
| 450 Banner "installing ${file}" | 432 Banner "installing ${file}" |
| 451 DownloadOrCopy ${REPO_DEBIAN}/${file} | 433 DownloadOrCopy ${REPO_DEBIAN}/${file} |
| 452 SubBanner "extracting to ${JAIL_MIPS32}" | 434 SubBanner "extracting to ${INSTALL_ROOT}" |
| 453 dpkg --fsys-tarfile ${package}\ | 435 dpkg --fsys-tarfile ${package}\ |
| 454 | tar -xvf - --exclude=./usr/share -C ${JAIL_MIPS32} | 436 | tar -xvf - --exclude=./usr/share -C ${INSTALL_ROOT} |
| 455 done | 437 done |
| 456 } | 438 } |
| 457 | 439 |
| 458 # Workaround for missing headers since pkg-config is not working correctly. | |
| 459 FixIncludes() { | |
| 460 Banner "Fixing includes" | |
| 461 pushd ${JAIL_MIPS32}/usr/include/glib-2.0 | |
| 462 ln -s ../../lib/glib-2.0/include/glibconfig.h . | |
| 463 popd | |
| 464 | |
| 465 pushd ${JAIL_MIPS32}/usr/include/gtk-2.0 | |
| 466 ln -s ../../lib/gtk-2.0/include/gdkconfig.h . | |
| 467 popd | |
| 468 | |
| 469 pushd ${JAIL_MIPS32}/usr/include/dbus-1.0/dbus | |
| 470 ln -s ../../../lib/dbus-1.0/include/dbus/dbus-arch-deps.h . | |
| 471 popd | |
| 472 } | |
| 473 | |
| 474 FixLinks() { | 440 FixLinks() { |
| 475 Banner "Fixing links" | 441 Banner "Fixing links" |
| 476 pushd ${JAIL_MIPS32}/lib/ | 442 pushd ${INSTALL_ROOT}/lib/ |
| 477 mv mipsel-linux-gnu/* . | 443 mv mipsel-linux-gnu/* . |
| 478 rm -rf mipsel-linux-gnu | 444 rm -rf mipsel-linux-gnu |
| 479 ln -s . mipsel-linux-gnu | 445 ln -s . mipsel-linux-gnu |
| 480 popd | 446 popd |
| 481 | 447 |
| 482 pushd ${JAIL_MIPS32}/usr/lib/ | 448 pushd ${INSTALL_ROOT}/usr/lib/ |
| 483 mkdir -p pkgconfig | 449 mkdir -p pkgconfig |
| 484 mv mipsel-linux-gnu/pkgconfig/* pkgconfig/ | 450 mv mipsel-linux-gnu/pkgconfig/* pkgconfig/ |
| 485 rm -rf mipsel-linux-gnu/pkgconfig | 451 rm -rf mipsel-linux-gnu/pkgconfig |
| 486 mv mipsel-linux-gnu/* . | 452 mv mipsel-linux-gnu/* . |
| 487 rm -rf mipsel-linux-gnu | 453 rm -rf mipsel-linux-gnu |
| 488 ln -s . mipsel-linux-gnu | 454 ln -s . mipsel-linux-gnu |
| 489 popd | 455 popd |
| 490 | 456 |
| 491 pushd ${JAIL_MIPS32}/usr/lib/ | 457 pushd ${INSTALL_ROOT}/usr/lib/ |
| 492 rm -f libstdc++.so* | 458 rm -f libstdc++.so* |
| 493 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.20 . | 459 ln -s ../../../mipsel-linux-gnu/lib/libstdc++.so.6.0.20 . |
|
petarj
2015/06/24 15:42:04
I believe you need to modify this line too.
Sam Clegg
2015/06/24 23:25:51
I removed all of this. The new debian stable is r
| |
| 494 ln -s libstdc++.so.6.0.20 libstdc++.so.6 | 460 ln -s libstdc++.so.6.0.20 libstdc++.so.6 |
| 495 ln -s libstdc++.so.6.0.20 libstdc++.so | 461 ln -s libstdc++.so.6.0.20 libstdc++.so |
| 496 | 462 |
| 497 rm -f libgcc_s.so* | 463 rm -f libgcc_s.so* |
| 498 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 . | 464 ln -s ../../../mipsel-linux-gnu/lib/libgcc_s.so.1 . |
|
petarj
2015/06/24 15:42:04
Ditto.
Sam Clegg
2015/06/24 23:25:51
Acknowledged.
| |
| 499 ln -s libgcc_s.so.1 libgcc_s.so | 465 ln -s libgcc_s.so.1 libgcc_s.so |
| 500 popd | 466 popd |
| 501 } | 467 } |
| 502 | 468 |
| 503 FixLibs() { | |
| 504 Banner "Fixing libraries" | |
| 505 | |
| 506 readonly liblist="libbz2.so \ | |
| 507 libcom_err.so \ | |
| 508 libdbus-1.so \ | |
| 509 libexpat.so \ | |
| 510 libglib-2.0.so \ | |
| 511 libgpg-error.so \ | |
| 512 libkeyutils.so \ | |
| 513 libpamc.so \ | |
| 514 libpam_misc.so \ | |
| 515 libpam.so \ | |
| 516 libpci.so \ | |
| 517 libpcre.so \ | |
| 518 libpng12.so \ | |
| 519 libudev.so \ | |
| 520 libz.so" | |
| 521 | |
| 522 pushd ${JAIL_MIPS32}/usr/lib/ | |
| 523 for library in ${liblist}; do | |
| 524 rm -f ${library} | |
| 525 ln -s ../../lib/${library}.[0123] ${library} | |
| 526 done | |
| 527 popd | |
| 528 } | |
| 529 | |
| 530 BuildAndInstallQemu() { | 469 BuildAndInstallQemu() { |
| 531 local saved_dir=$(pwd) | 470 local saved_dir=$(pwd) |
| 532 local tmpdir="${TMP}/qemu-mips.nacl" | 471 local tmpdir="${TMP}/qemu-mips.nacl" |
| 533 local tarball="qemu-2.0.0.tar.bz2" | 472 local tarball="qemu-2.0.0.tar.bz2" |
| 534 | 473 |
| 535 Banner "Building qemu in ${tmpdir}" | 474 Banner "Building qemu in ${tmpdir}" |
| 536 | 475 |
| 537 rm -rf ${tmpdir} | 476 rm -rf ${tmpdir} |
| 538 mkdir ${tmpdir} | 477 mkdir ${tmpdir} |
| 539 cd ${tmpdir} | 478 cd ${tmpdir} |
| 540 | 479 |
| 541 SubBanner "Downloading" | 480 SubBanner "Downloading" |
| 542 wget -c ${DOWNLOAD_QEMU_URL} | 481 wget -c ${DOWNLOAD_QEMU_URL} |
| 543 | 482 |
| 544 SubBanner "Untarring" | 483 SubBanner "Untarring" |
| 545 tar xf ${tarball} | 484 tar xf ${tarball} |
| 546 cd qemu-2.0.0 | 485 cd qemu-2.0.0 |
| 547 | 486 |
| 548 SubBanner "Configuring" | 487 SubBanner "Configuring" |
| 549 env -i PATH=/usr/bin/:/bin \ | 488 env -i PATH=/usr/bin/:/bin \ |
| 550 ./configure \ | 489 ./configure \ |
| 551 --disable-system \ | 490 --disable-system \ |
| 552 --enable-linux-user \ | 491 --enable-linux-user \ |
| 553 --disable-bsd-user \ | 492 --disable-bsd-user \ |
| 554 --target-list=mipsel-linux-user \ | 493 --target-list=mipsel-linux-user \ |
| 555 --disable-sdl \ | 494 --disable-sdl \ |
| 556 --disable-linux-aio | 495 --disable-linux-aio |
| 557 | 496 |
| 558 SubBanner "Make" | 497 SubBanner "Make" |
| 559 env -i PATH=/usr/bin/:/bin \ | 498 env -i PATH=/usr/bin/:/bin make ${MAKE_OPTS} |
| 560 make MAKE_OPTS=${MAKE_OPTS} | |
| 561 | 499 |
| 562 SubBanner "Install" | 500 SubBanner "Install" |
| 563 cp mipsel-linux-user/qemu-mipsel ${INSTALL_ROOT}/qemu-mips32 | 501 cp mipsel-linux-user/qemu-mipsel ${INSTALL_ROOT}/qemu-mips32 |
| 564 cd ${saved_dir} | 502 cd ${saved_dir} |
| 565 cp tools/trusted_cross_toolchains/qemu_tool_mips32.sh ${INSTALL_ROOT} | 503 cp tools/trusted_cross_toolchains/qemu_tool_mips32.sh ${INSTALL_ROOT} |
| 566 ln -sf qemu_tool_mips32.sh ${INSTALL_ROOT}/run_under_qemu_mips32 | 504 ln -sf qemu_tool_mips32.sh ${INSTALL_ROOT}/run_under_qemu_mips32 |
| 567 } | 505 } |
| 568 | 506 |
| 507 #@ | |
| 508 #@ UploadArchive <revision> | |
| 509 #@ | |
| 510 #@ Upload archive to Cloud Storage along with json manifest and | |
| 511 #@ update toolchain_revisions to point to new version. | |
| 512 #@ This requires write access the Cloud Storage bucket for Native Client. | |
| 513 UploadArchive() { | |
| 514 local REV=$1 | |
| 515 local TAR_NAME=$(basename ${TAR_ARCHIVE}) | |
| 516 local GS_FILE=nativeclient-archive2/toolchain/${REV}/${TAR_NAME} | |
| 517 local URL=https://storage.googleapis.com/${GS_FILE} | |
| 518 set -x | |
| 519 gsutil cp -a public-read ${TAR_ARCHIVE} gs://${GS_FILE} | |
| 520 local package_version=build/package_version/package_version.py | |
| 521 ${package_version} archive --archive-package linux_x86/mips_trusted \ | |
| 522 ${TAR_ARCHIVE}@${URL} | |
| 523 ${package_version} upload --upload-package linux_x86/mips_trusted \ | |
| 524 --revision ${REV} | |
| 525 ${package_version} setrevision --revision-package linux_x86/mips_trusted \ | |
| 526 --revision ${REV} | |
| 527 set +x | |
| 528 } | |
| 529 | |
| 530 help() { | |
| 531 Usage | |
| 532 } | |
| 533 | |
| 569 ###################################################################### | 534 ###################################################################### |
| 570 # Main | 535 # Main |
| 571 ###################################################################### | 536 ###################################################################### |
| 572 | 537 |
| 573 if [[ $# -eq 0 ]] ; then | 538 mkdir -p ${TMP} |
| 574 echo "you must specify a mode on the commandline:" | |
| 575 echo | |
| 576 Usage | |
| 577 exit -1 | |
| 578 | 539 |
| 579 elif [[ $1 == "nacl_sdk" || $1 == "chrome_sdk" ]] ; then | 540 BuildSysroot() { |
| 580 mkdir -p ${TMP} | |
| 581 SanityCheck | 541 SanityCheck |
| 582 ClearInstallDir | 542 ClearInstallDir |
| 583 ClearBuildDir | 543 ClearBuildDir |
| 584 DownloadOrCopyAndInstallToolchain | 544 DownloadOrCopyAndInstallToolchain |
| 585 GeneratePackageLists $1 | 545 GeneratePackageLists |
| 586 InstallMissingLibraries $1 | 546 InstallMissingLibraries |
| 587 FixLinks | 547 FixLinks |
| 588 if [[ $1 == "nacl_sdk" ]] ; then | 548 BuildAndInstallQemu |
| 589 BuildAndInstallQemu | 549 CreateTarBall |
| 590 CreateTarBall $1 | 550 } |
| 591 else | |
| 592 FixLibs | |
| 593 FixIncludes | |
| 594 CreateTarBall ${CROSS_TARBALL} | |
| 595 fi | |
| 596 | 551 |
| 552 if [[ $# -eq 0 ]] ; then | |
| 553 BuildSysroot | |
| 554 elif [[ "$(type -t $1)" != "function" ]]; then | |
| 555 echo "ERROR: unknown function '$1'." >&2 | |
| 556 echo "For help, try:" | |
| 557 echo " $0 help" | |
| 558 exit 1 | |
| 597 else | 559 else |
| 598 Usage | 560 "$@" |
| 599 exit -1 | |
| 600 | |
| 601 fi | 561 fi |
| 602 | |
| OLD | NEW |