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

Side by Side Diff: build_tools/common.sh

Issue 11636027: Add ARM toolchain support. (Closed) Base URL: git@github.com:samclegg/naclports.git@sbc
Patch Set: Created 8 years 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
OLDNEW
1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # Environment variable NACL_PACKAGES_BITSIZE should be unset or set to "32" 5 # Environment variable NACL_ARCH should be unset or set to "i686"
6 # for a 32-bit build. It should be set to "64" for a 64-bit build. 6 # for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm"
7 # for a 64-bit, pnacl, or arm builds.
7 8
8 9
9 # NAMING CONVENTION 10 # NAMING CONVENTION
10 # ================= 11 # =================
11 # 12 #
12 # This file is source'd by other scripts especially those inside libraries/ 13 # This file is source'd by other scripts especially those inside libraries/
13 # and makes functions env variables available to those scripts. 14 # and makes functions env variables available to those scripts.
14 # Only variables beginging with "NACL_" are intended to be used by those 15 # Only variables beginging with "NACL_" are intended to be used by those
15 # scripts! 16 # scripts!
16 17
(...skipping 18 matching lines...) Expand all
35 elif [ $OS_NAME = "Linux" ]; then 36 elif [ $OS_NAME = "Linux" ]; then
36 readonly OS_SUBDIR="linux" 37 readonly OS_SUBDIR="linux"
37 readonly OS_SUBDIR_SHORT="linux" 38 readonly OS_SUBDIR_SHORT="linux"
38 readonly OS_JOBS=4 39 readonly OS_JOBS=4
39 else 40 else
40 readonly OS_SUBDIR="windows" 41 readonly OS_SUBDIR="windows"
41 readonly OS_SUBDIR_SHORT="win" 42 readonly OS_SUBDIR_SHORT="win"
42 readonly OS_JOBS=1 43 readonly OS_JOBS=1
43 fi 44 fi
44 45
45 # Get the desired bit size, 46 # Set default NACL_ARCH based on legacy NACL_PACKAGES_BITSIZE
47 if [ "${NACL_PACKAGES_BITSIZE:-}" = "64" ] ; then
48 export NACL_ARCH=${NACL_ARCH:-"x86_64"}
49 elif [ "${NACL_PACKAGES_BITSIZE:-}" = "pnacl" ] ; then
50 export NACL_ARCH=${NACL_ARCH:-"pnacl"}
51 else
52 export NACL_ARCH=${NACL_ARCH:-"i686"}
53 fi
54
55 # Set CROSS_ID (and legacy NACL_PACKAGES_BITSIZE) based on NACL_ARCH
46 # Note(robertm): we abuse this to introduce a "pnacl" flavor. 56 # Note(robertm): we abuse this to introduce a "pnacl" flavor.
47 export NACL_PACKAGES_BITSIZE=${NACL_PACKAGES_BITSIZE:-"32"} 57 if [ ${NACL_ARCH} = "i686" ] ; then
48 if [ ${NACL_PACKAGES_BITSIZE} = "32" ] ; then
49 readonly CROSS_ID=i686 58 readonly CROSS_ID=i686
50 elif [ ${NACL_PACKAGES_BITSIZE} = "64" ] ; then 59 export NACL_PACKAGES_BITSIZE=32
60 elif [ ${NACL_ARCH} = "x86_64" ] ; then
51 readonly CROSS_ID=x86_64 61 readonly CROSS_ID=x86_64
52 elif [ ${NACL_PACKAGES_BITSIZE} = "pnacl" ] ; then 62 export NACL_PACKAGES_BITSIZE=64
63 elif [ ${NACL_ARCH} = "arm" ] ; then
64 readonly CROSS_ID=arm
65 elif [ ${NACL_ARCH} = "pnacl" ] ; then
66 export NACL_PACKAGES_BITSIZE=pnacl
53 readonly CROSS_ID=pnacl 67 readonly CROSS_ID=pnacl
54 else 68 else
55 echo "Unknown value for NACL_PACKAGES_BITSIZE: '${NACL_PACKAGES_BITSIZE}'" 1>& 2 69 echo "Unknown value for NACL_ARCH: '${NACL_ARCH}'" 1>&2
56 exit -1 70 exit -1
57 fi 71 fi
58 72
59 if [ ${NACL_PACKAGES_BITSIZE} = "32" ] ; then 73 if [ ${NACL_ARCH} = "i686" ] ; then
60 readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_32 74 readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_32
61 readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_32.nexe 75 readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_32.nexe
62 else 76 elif [ ${NACL_ARCH} = "x86_64" ] ; then
63 # TODO(eugenis): Is this correct for PNACL? 77 # TODO(eugenis): Is this correct for PNACL?
64 readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_64 78 readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_64
65 readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_64.nexe 79 readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_64.nexe
66 fi 80 fi
67 81
68 # NACL_CROSS_PREFIX is the prefix of the executables in the 82 # NACL_CROSS_PREFIX is the prefix of the executables in the
69 # toolchain's "bin" directory. For example: i686-nacl-<toolname>. 83 # toolchain's "bin" directory. For example: i686-nacl-<toolname>.
70 if [ ${NACL_PACKAGES_BITSIZE} == "pnacl" ]; then 84 if [ ${NACL_ARCH} = "pnacl" ]; then
71 export NACL_CROSS_PREFIX=pnacl 85 export NACL_CROSS_PREFIX=pnacl
72 else 86 else
73 export NACL_CROSS_PREFIX=${CROSS_ID}-nacl 87 export NACL_CROSS_PREFIX=${CROSS_ID}-nacl
74 fi 88 fi
75 89
76 # configure spec for if MMX/SSE/SSE2/Assembly should be enabled/disabled 90 # configure spec for if MMX/SSE/SSE2/Assembly should be enabled/disabled
77 # TODO: Currently only x86-32 will encourage MMX, SSE & SSE2 intrinsics 91 # TODO: Currently only x86-32 will encourage MMX, SSE & SSE2 intrinsics
78 # and handcoded assembly. 92 # and handcoded assembly.
79 if [ $NACL_PACKAGES_BITSIZE = "32" ] ; then 93 if [ $NACL_ARCH = "i686" ] ; then
80 readonly NACL_OPTION="enable" 94 readonly NACL_OPTION="enable"
81 else 95 else
82 readonly NACL_OPTION="disable" 96 readonly NACL_OPTION="disable"
83 fi 97 fi
84 98
85 if [ -z "${NACL_SDK_ROOT:-}" ]; then 99 if [ -z "${NACL_SDK_ROOT:-}" ]; then
86 echo "-------------------------------------------------------------------" 100 echo "-------------------------------------------------------------------"
87 echo "NACL_SDK_ROOT is unset." 101 echo "NACL_SDK_ROOT is unset."
88 echo "This environment variable needs to be pointed at some version of" 102 echo "This environment variable needs to be pointed at some version of"
89 echo "the Native Client SDK (the directory containing toolchain/)." 103 echo "the Native Client SDK (the directory containing toolchain/)."
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 export NACLLD=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ld 168 export NACLLD=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-ld
155 export NACLSTRINGS=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strings 169 export NACLSTRINGS=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strings
156 export NACLSTRIP=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strip 170 export NACLSTRIP=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX}-strip
157 171
158 # NACL_SDK_GCC_SPECS_PATH is where nacl-gcc 'specs' file will be installed 172 # NACL_SDK_GCC_SPECS_PATH is where nacl-gcc 'specs' file will be installed
159 readonly NACL_SDK_GCC_SPECS_PATH=${NACL_TOOLCHAIN_ROOT}/lib/gcc/x86_64-nacl/4. 4.3 173 readonly NACL_SDK_GCC_SPECS_PATH=${NACL_TOOLCHAIN_ROOT}/lib/gcc/x86_64-nacl/4. 4.3
160 174
161 # NACL_SDK_USR is where the headers, libraries, etc. will be installed 175 # NACL_SDK_USR is where the headers, libraries, etc. will be installed
162 readonly NACL_SDK_USR=${NACL_TOOLCHAIN_ROOT}/${NACL_CROSS_PREFIX}/usr 176 readonly NACL_SDK_USR=${NACL_TOOLCHAIN_ROOT}/${NACL_CROSS_PREFIX}/usr
163 readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include 177 readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include
164 readonly NACL_SDK_LIB=${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib${NACL_PACKAGES_BI TSIZE} 178 readonly NACL_SDK_LIB=${NACL_TOOLCHAIN_ROOT}/${NACL_ARCH}-nacl/lib${NACL_PACKA GES_BITSIZE}
165 readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib 179 readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib
166 readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin 180 readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin
167 181
168 # NACL_SDK_MULITARCH_USR is a version of NACL_SDK_USR that gets passed into 182 # NACL_SDK_MULITARCH_USR is a version of NACL_SDK_USR that gets passed into
169 # the gcc specs file. It has a gcc spec-file conditional for ${CROSS_ID} 183 # the gcc specs file. It has a gcc spec-file conditional for ${CROSS_ID}
170 readonly NACL_SDK_MULTIARCH_USR=${NACL_TOOLCHAIN_ROOT}/\%\(nacl_arch\)/usr 184 readonly NACL_SDK_MULTIARCH_USR=${NACL_TOOLCHAIN_ROOT}/\%\(nacl_arch\)/usr
171 readonly NACL_SDK_MULTIARCH_USR_INCLUDE=${NACL_SDK_MULTIARCH_USR}/include 185 readonly NACL_SDK_MULTIARCH_USR_INCLUDE=${NACL_SDK_MULTIARCH_USR}/include
172 readonly NACL_SDK_MULTIARCH_USR_LIB=${NACL_SDK_MULTIARCH_USR}/lib 186 readonly NACL_SDK_MULTIARCH_USR_LIB=${NACL_SDK_MULTIARCH_USR}/lib
173 } 187 }
174 188
(...skipping 29 matching lines...) Expand all
204 export NACLSTRINGS="$(which strings)" 218 export NACLSTRINGS="$(which strings)"
205 219
206 # NACL_SDK_USR is where the headers, libraries, etc. will be installed 220 # NACL_SDK_USR is where the headers, libraries, etc. will be installed
207 # FIXME: 221 # FIXME:
208 readonly NACL_SDK_USR=${NACL_SDK_BASE}/usr 222 readonly NACL_SDK_USR=${NACL_SDK_BASE}/usr
209 readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include 223 readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include
210 readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib 224 readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib
211 readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin 225 readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin
212 } 226 }
213 227
214 if [ ${NACL_PACKAGES_BITSIZE} = "pnacl" ] ; then 228 if [ ${NACL_ARCH} = "pnacl" ] ; then
215 InitializePNaClToolchain 229 InitializePNaClToolchain
216 else 230 else
217 InitializeNaClGccToolchain 231 InitializeNaClGccToolchain
218 fi 232 fi
219 233
220 ###################################################################### 234 ######################################################################
221 # Always run 235 # Always run
222 ###################################################################### 236 ######################################################################
223 237
224 CheckPatchVersion() { 238 CheckPatchVersion() {
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 export PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} 513 export PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB}
500 export FREETYPE_CONFIG=${NACL_SDK_USR_BIN}/freetype-config 514 export FREETYPE_CONFIG=${NACL_SDK_USR_BIN}/freetype-config
501 export PATH=${NACL_BIN_PATH}:${PATH}; 515 export PATH=${NACL_BIN_PATH}:${PATH};
502 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME} 516 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME}
503 Remove ${PACKAGE_NAME}-build 517 Remove ${PACKAGE_NAME}-build
504 MakeDir ${PACKAGE_NAME}-build 518 MakeDir ${PACKAGE_NAME}-build
505 cd ${PACKAGE_NAME}-build 519 cd ${PACKAGE_NAME}-build
506 echo "Directory: $(pwd)" 520 echo "Directory: $(pwd)"
507 521
508 local conf_host=${NACL_CROSS_PREFIX} 522 local conf_host=${NACL_CROSS_PREFIX}
509 if [[ ${NACL_PACKAGES_BITSIZE} == "pnacl" ]]; then 523 if [[ ${NACL_ARCH} = "pnacl" ]]; then
510 # The PNaCl tools use "pnacl-" as the prefix, but config.sub 524 # The PNaCl tools use "pnacl-" as the prefix, but config.sub
511 # does not know about "pnacl". It only knows about "le32-nacl". 525 # does not know about "pnacl". It only knows about "le32-nacl".
512 # Unfortunately, most of the config.subs here are so old that 526 # Unfortunately, most of the config.subs here are so old that
513 # it doesn't know about that "le32" either. So we just say "nacl". 527 # it doesn't know about that "le32" either. So we just say "nacl".
514 conf_host="nacl" 528 conf_host="nacl"
515 fi 529 fi
516 ../configure \ 530 ../configure \
517 --host=${conf_host} \ 531 --host=${conf_host} \
518 --disable-shared \ 532 --disable-shared \
519 --prefix=${NACL_SDK_USR} \ 533 --prefix=${NACL_SDK_USR} \
(...skipping 16 matching lines...) Expand all
536 Banner "Build ${PACKAGE_NAME}" 550 Banner "Build ${PACKAGE_NAME}"
537 echo "Directory: $(pwd)" 551 echo "Directory: $(pwd)"
538 # assumes pwd has makefile 552 # assumes pwd has makefile
539 make clean 553 make clean
540 make -j${OS_JOBS} 554 make -j${OS_JOBS}
541 } 555 }
542 556
543 557
544 DefaultTouchStep() { 558 DefaultTouchStep() {
545 FULL_PACKAGE="${START_DIR/#${NACL_PACKAGES}\//}" 559 FULL_PACKAGE="${START_DIR/#${NACL_PACKAGES}\//}"
546 SENTFILE="${NACL_PACKAGES_OUT}/sentinels/bits${NACL_PACKAGES_BITSIZE}/${FULL_P ACKAGE}" 560 SENTFILE="${NACL_PACKAGES_OUT}/sentinels/${NACL_ARCH}/${FULL_PACKAGE}"
547 SENTDIR=$(dirname "${SENTFILE}") 561 SENTDIR=$(dirname "${SENTFILE}")
548 mkdir -p "${SENTDIR}" && touch "${SENTFILE}" 562 mkdir -p "${SENTDIR}" && touch "${SENTFILE}"
549 } 563 }
550 564
551 565
552 DefaultInstallStep() { 566 DefaultInstallStep() {
553 # assumes pwd has makefile 567 # assumes pwd has makefile
554 make install 568 make install
555 DefaultTouchStep 569 DefaultTouchStep
556 } 570 }
557 571
558 572
559 DefaultCleanUpStep() { 573 DefaultCleanUpStep() {
560 if [ ${NACL_PACKAGES_BITSIZE} != "pnacl" ] ; then 574 if [ ${NACL_ARCH} != "pnacl" ] ; then
561 PatchSpecFile 575 PatchSpecFile
562 fi 576 fi
563 AddToInstallFile ${PACKAGE_NAME} 577 AddToInstallFile ${PACKAGE_NAME}
564 ChangeDir ${SAVE_PWD} 578 ChangeDir ${SAVE_PWD}
565 } 579 }
566 580
567 581
568 RunCommand() { 582 RunCommand() {
569 echo "$@" 583 echo "$@"
570 time "$@" 584 time "$@"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 DefaultPackageInstall() { 655 DefaultPackageInstall() {
642 DefaultPreInstallStep 656 DefaultPreInstallStep
643 DefaultDownloadStep 657 DefaultDownloadStep
644 DefaultExtractStep 658 DefaultExtractStep
645 DefaultPatchStep 659 DefaultPatchStep
646 DefaultConfigureStep 660 DefaultConfigureStep
647 DefaultBuildStep 661 DefaultBuildStep
648 DefaultInstallStep 662 DefaultInstallStep
649 DefaultCleanUpStep 663 DefaultCleanUpStep
650 } 664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698