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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: build_tools/common.sh
diff --git a/build_tools/common.sh b/build_tools/common.sh
index dc68cec124d8a2aec74caa56144ce94f65e29cf3..5803e0ab65711ab0bc37ae6108d6a8afed82a9f5 100644
--- a/build_tools/common.sh
+++ b/build_tools/common.sh
@@ -2,8 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
-# Environment variable NACL_PACKAGES_BITSIZE should be unset or set to "32"
-# for a 32-bit build. It should be set to "64" for a 64-bit build.
+# Environment variable NACL_ARCH should be unset or set to "i686"
+# for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm"
+# for a 64-bit, pnacl, or arm builds.
# NAMING CONVENTION
@@ -42,24 +43,37 @@ else
readonly OS_JOBS=1
fi
-# Get the desired bit size,
+# Set default NACL_ARCH based on legacy NACL_PACKAGES_BITSIZE
+if [ "${NACL_PACKAGES_BITSIZE:-}" = "64" ] ; then
+ export NACL_ARCH=${NACL_ARCH:-"x86_64"}
+elif [ "${NACL_PACKAGES_BITSIZE:-}" = "pnacl" ] ; then
+ export NACL_ARCH=${NACL_ARCH:-"pnacl"}
+else
+ export NACL_ARCH=${NACL_ARCH:-"i686"}
+fi
+
+# Set CROSS_ID (and legacy NACL_PACKAGES_BITSIZE) based on NACL_ARCH
# Note(robertm): we abuse this to introduce a "pnacl" flavor.
-export NACL_PACKAGES_BITSIZE=${NACL_PACKAGES_BITSIZE:-"32"}
-if [ ${NACL_PACKAGES_BITSIZE} = "32" ] ; then
+if [ ${NACL_ARCH} = "i686" ] ; then
readonly CROSS_ID=i686
-elif [ ${NACL_PACKAGES_BITSIZE} = "64" ] ; then
+ export NACL_PACKAGES_BITSIZE=32
+elif [ ${NACL_ARCH} = "x86_64" ] ; then
readonly CROSS_ID=x86_64
-elif [ ${NACL_PACKAGES_BITSIZE} = "pnacl" ] ; then
+ export NACL_PACKAGES_BITSIZE=64
+elif [ ${NACL_ARCH} = "arm" ] ; then
+ readonly CROSS_ID=arm
+elif [ ${NACL_ARCH} = "pnacl" ] ; then
+ export NACL_PACKAGES_BITSIZE=pnacl
readonly CROSS_ID=pnacl
else
- echo "Unknown value for NACL_PACKAGES_BITSIZE: '${NACL_PACKAGES_BITSIZE}'" 1>&2
+ echo "Unknown value for NACL_ARCH: '${NACL_ARCH}'" 1>&2
exit -1
fi
-if [ ${NACL_PACKAGES_BITSIZE} = "32" ] ; then
+if [ ${NACL_ARCH} = "i686" ] ; then
readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_32
readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_32.nexe
-else
+elif [ ${NACL_ARCH} = "x86_64" ] ; then
# TODO(eugenis): Is this correct for PNACL?
readonly NACL_SEL_LDR=${NACL_SDK_ROOT}/tools/sel_ldr_x86_64
readonly NACL_IRT=${NACL_SDK_ROOT}/tools/irt_x86_64.nexe
@@ -67,7 +81,7 @@ fi
# NACL_CROSS_PREFIX is the prefix of the executables in the
# toolchain's "bin" directory. For example: i686-nacl-<toolname>.
-if [ ${NACL_PACKAGES_BITSIZE} == "pnacl" ]; then
+if [ ${NACL_ARCH} = "pnacl" ]; then
export NACL_CROSS_PREFIX=pnacl
else
export NACL_CROSS_PREFIX=${CROSS_ID}-nacl
@@ -76,7 +90,7 @@ fi
# configure spec for if MMX/SSE/SSE2/Assembly should be enabled/disabled
# TODO: Currently only x86-32 will encourage MMX, SSE & SSE2 intrinsics
# and handcoded assembly.
-if [ $NACL_PACKAGES_BITSIZE = "32" ] ; then
+if [ $NACL_ARCH = "i686" ] ; then
readonly NACL_OPTION="enable"
else
readonly NACL_OPTION="disable"
@@ -161,7 +175,7 @@ InitializeNaClGccToolchain() {
# NACL_SDK_USR is where the headers, libraries, etc. will be installed
readonly NACL_SDK_USR=${NACL_TOOLCHAIN_ROOT}/${NACL_CROSS_PREFIX}/usr
readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include
- readonly NACL_SDK_LIB=${NACL_TOOLCHAIN_ROOT}/x86_64-nacl/lib${NACL_PACKAGES_BITSIZE}
+ readonly NACL_SDK_LIB=${NACL_TOOLCHAIN_ROOT}/${NACL_ARCH}-nacl/lib${NACL_PACKAGES_BITSIZE}
readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib
readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin
@@ -211,7 +225,7 @@ InitializePNaClToolchain() {
readonly NACL_SDK_USR_BIN=${NACL_SDK_USR}/bin
}
-if [ ${NACL_PACKAGES_BITSIZE} = "pnacl" ] ; then
+if [ ${NACL_ARCH} = "pnacl" ] ; then
InitializePNaClToolchain
else
InitializeNaClGccToolchain
@@ -506,7 +520,7 @@ DefaultConfigureStep() {
echo "Directory: $(pwd)"
local conf_host=${NACL_CROSS_PREFIX}
- if [[ ${NACL_PACKAGES_BITSIZE} == "pnacl" ]]; then
+ if [[ ${NACL_ARCH} = "pnacl" ]]; then
# The PNaCl tools use "pnacl-" as the prefix, but config.sub
# does not know about "pnacl". It only knows about "le32-nacl".
# Unfortunately, most of the config.subs here are so old that
@@ -543,7 +557,7 @@ DefaultBuildStep() {
DefaultTouchStep() {
FULL_PACKAGE="${START_DIR/#${NACL_PACKAGES}\//}"
- SENTFILE="${NACL_PACKAGES_OUT}/sentinels/bits${NACL_PACKAGES_BITSIZE}/${FULL_PACKAGE}"
+ SENTFILE="${NACL_PACKAGES_OUT}/sentinels/${NACL_ARCH}/${FULL_PACKAGE}"
SENTDIR=$(dirname "${SENTFILE}")
mkdir -p "${SENTDIR}" && touch "${SENTFILE}"
}
@@ -557,7 +571,7 @@ DefaultInstallStep() {
DefaultCleanUpStep() {
- if [ ${NACL_PACKAGES_BITSIZE} != "pnacl" ] ; then
+ if [ ${NACL_ARCH} != "pnacl" ] ; then
PatchSpecFile
fi
AddToInstallFile ${PACKAGE_NAME}

Powered by Google App Engine
This is Rietveld 408576698