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

Side by Side Diff: ports/pnacl/build.sh

Issue 1587053004: Use out-of-tree build directory for pnacl build (Closed) Base URL: https://chromium.googlesource.com/webports.git@master
Patch Set: Created 4 years, 11 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 | « build_tools/common.sh ('k') | 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 # Copyright (c) 2013 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2013 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 EXECUTABLES="arm-nacl-readelf le32-nacl-strings clang clang++" 5 EXECUTABLES="bin/arm-nacl-readelf bin/le32-nacl-strings bin/clang bin/clang++"
6 EnableGlibcCompat 6 EnableGlibcCompat
7 EnableCliMain 7 EnableCliMain
8 8
9 PatchStep() { 9 PatchStep() {
10 DefaultPatchStep 10 DefaultPatchStep
11 MakeDir ${SRC_DIR}/toolchain_build/src 11 MakeDir ${SRC_DIR}/toolchain_build/src
12 Remove ${SRC_DIR}/toolchain_build/src/llvm 12 Remove ${SRC_DIR}/toolchain_build/src/llvm
13 LogExecute ln -fs ${SRC_DIR}/../../pnacl-llvm-src/llvm \ 13 LogExecute ln -fs ${SRC_DIR}/../../pnacl-llvm-src/llvm \
14 ${SRC_DIR}/toolchain_build/src/llvm 14 ${SRC_DIR}/toolchain_build/src/llvm
15 Remove ${SRC_DIR}/toolchain_build/src/binutils 15 Remove ${SRC_DIR}/toolchain_build/src/binutils
16 LogExecute ln -fs ${SRC_DIR}/../../pnacl-binutils-src/binutils \ 16 LogExecute ln -fs ${SRC_DIR}/../../pnacl-binutils-src/binutils \
17 ${SRC_DIR}/toolchain_build/src/binutils 17 ${SRC_DIR}/toolchain_build/src/binutils
18 Remove ${SRC_DIR}/toolchain_build/src/clang 18 Remove ${SRC_DIR}/toolchain_build/src/clang
19 LogExecute ln -fs ${SRC_DIR}/../../pnacl-clang-src/clang \ 19 LogExecute ln -fs ${SRC_DIR}/../../pnacl-clang-src/clang \
20 ${SRC_DIR}/toolchain_build/src/clang 20 ${SRC_DIR}/toolchain_build/src/clang
21 Remove ${SRC_DIR}/toolchain_build/src/llvm/tools/clang 21 Remove ${SRC_DIR}/toolchain_build/src/llvm/tools/clang
22 LogExecute ln -fs ${SRC_DIR}/../../pnacl-clang-src/clang \ 22 LogExecute ln -fs ${SRC_DIR}/../../pnacl-clang-src/clang \
23 ${SRC_DIR}/toolchain_build/src/llvm/tools/clang 23 ${SRC_DIR}/toolchain_build/src/llvm/tools/clang
24 } 24 }
25 25
26 ConfigureStep() { 26 ConfigureStep() {
27 return 27 return
28 } 28 }
29 29
30 OUT_DIR=${BUILD_DIR}/out
31 OUT_BIN=${BUILD_DIR}/bin
32
30 BuildStep() { 33 BuildStep() {
31 PNACL_DIR=${NACL_SDK_ROOT}/toolchain/linux_pnacl 34 PNACL_DIR=${NACL_SDK_ROOT}/toolchain/linux_pnacl
32 export PATH=${PNACL_DIR}/bin:${PATH} 35 export PATH=${PNACL_DIR}/bin:${PATH}
33 export LD_LIBRARY_PATH=${PNACL_DIR}/lib:${LD_LIBRARY_PATH:-} 36 export LD_LIBRARY_PATH=${PNACL_DIR}/lib:${LD_LIBRARY_PATH:-}
34 export BUILD_CC=clang 37 export BUILD_CC=clang
35 export BUILD_CXX=clang++ 38 export BUILD_CXX=clang++
36 39
37 export STRIPPROG=echo 40 export STRIPPROG=echo
38 41
39 export HOST_OS=NativeClient 42 export HOST_OS=NativeClient
(...skipping 20 matching lines...) Expand all
60 GOLD_LDADD+=" -lLLVMTransformUtils -lLLVMipa -lLLVMBitWriter" 63 GOLD_LDADD+=" -lLLVMTransformUtils -lLLVMipa -lLLVMBitWriter"
61 GOLD_LDADD+=" -lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMMC" 64 GOLD_LDADD+=" -lLLVMBitReader -lLLVMAnalysis -lLLVMTarget -lLLVMMC"
62 GOLD_LDADD+=" -lLLVMObject -lLLVMCore -lLLVMSupport" 65 GOLD_LDADD+=" -lLLVMObject -lLLVMCore -lLLVMSupport"
63 GOLD_LDADD+=" -Wl,--end-group" 66 GOLD_LDADD+=" -Wl,--end-group"
64 67
65 EXTRA_CONFIGURE="--extra-configure-arg=ac_cv_func_vfork_works=no" 68 EXTRA_CONFIGURE="--extra-configure-arg=ac_cv_func_vfork_works=no"
66 EXTRA_CONFIGURE+=" --extra-configure-arg=--disable-compiler-version-checks" 69 EXTRA_CONFIGURE+=" --extra-configure-arg=--disable-compiler-version-checks"
67 EXTRA_CONFIGURE+=" --extra-configure-arg=--enable-libcpp" 70 EXTRA_CONFIGURE+=" --extra-configure-arg=--enable-libcpp"
68 71
69 # Some code in llvm uses intrisics not supported in the pnacl stable abi. 72 # Some code in llvm uses intrisics not supported in the pnacl stable abi.
70 EXTRA_CC_ARGS="-fgnu-inline-asm" 73 if [[ ${TOOLCHAIN} == pnacl ]]; then
71 EXTRA_CC_ARGS+=" --pnacl-disable-abi-check" 74 EXTRA_CC_ARGS="-fgnu-inline-asm"
75 EXTRA_CC_ARGS+=" --pnacl-disable-abi-check"
76 fi
72 LINUX_PNACL=${NACL_SDK_ROOT}/toolchain/linux_pnacl 77 LINUX_PNACL=${NACL_SDK_ROOT}/toolchain/linux_pnacl
73 USR_LOCAL=${LINUX_PNACL}/le32-nacl/usr 78 USR_LOCAL=${LINUX_PNACL}/le32-nacl/usr
74 EXTRA_CC_ARGS+=" -include spawn.h" 79 EXTRA_CC_ARGS+=" -include spawn.h"
75 EXTRA_CC_ARGS+=" -I${USR_LOCAL}/include/glibc-compat" 80 EXTRA_CC_ARGS+=" -I${USR_LOCAL}/include/glibc-compat"
76 EXTRA_CC_ARGS+=" -I${NACL_SDK_ROOT}/include" 81 EXTRA_CC_ARGS+=" -I${NACL_SDK_ROOT}/include"
77 EXTRA_CC_ARGS+=" -I${USR_LOCAL}/include" 82 EXTRA_CC_ARGS+=" -I${USR_LOCAL}/include"
78 83
79 # export EXTRA_LIBS so that compiler_wapper.py can access it 84 # export EXTRA_LIBS so that compiler_wapper.py can access it
80 export EXTRA_LIBS="${NACLPORTS_LDFLAGS} ${NACLPORTS_LIBS}" 85 export EXTRA_LIBS="${NACLPORTS_LDFLAGS} ${NACLPORTS_LIBS}"
81 echo "EXTRA_LIBS=${EXTRA_LIBS}" 86 echo "EXTRA_LIBS=${EXTRA_LIBS}"
82 87
88 # Without this configure will detect vfork as missing and define
89 # vfork to fork which clobbers that define in "spawn.h".
90 export ac_cv_func_vfork_works=yes
91
83 # Inject a shim that speed up pnacl invocations for configure. 92 # Inject a shim that speed up pnacl invocations for configure.
84 if [ "${NACL_ARCH}" = "pnacl" ]; then 93 if [ "${NACL_ARCH}" = "pnacl" ]; then
85 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py" 94 local PNACL_CONF_SHIM="${TOOLS_DIR}/pnacl-configure-shim.py"
86 NACLCC="${PNACL_CONF_SHIM} ${NACLCC}" 95 NACLCC="${PNACL_CONF_SHIM} ${NACLCC}"
87 NACLCXX="${PNACL_CONF_SHIM} ${NACLCXX}" 96 NACLCXX="${PNACL_CONF_SHIM} ${NACLCXX}"
88 fi 97 fi
89 98
90 NACLCC="${START_DIR}/compiler_wrapper.py ${NACLCC}" 99 NACLCC="${START_DIR}/compiler_wrapper.py ${NACLCC}"
91 NACLCXX="${START_DIR}/compiler_wrapper.py ${NACLCXX}" 100 NACLCXX="${START_DIR}/compiler_wrapper.py ${NACLCXX}"
92 101
93 export CC=${NACLCC} 102 export CC=${NACLCC}
94 export CXX=${NACLCXX} 103 export CXX=${NACLCXX}
95 export AR=${NACLAR} 104 export AR=${NACLAR}
96 export RANLIB=${NACLRANLIB} 105 export RANLIB=${NACLRANLIB}
97 LogExecute ${SRC_DIR}/toolchain_build/toolchain_build_pnacl.py -v \ 106 LogExecute ${SRC_DIR}/toolchain_build/toolchain_build_pnacl.py -v \
98 --no-use-cached-results \ 107 --no-use-cached-results \
99 --no-use-remote-cache \ 108 --no-use-remote-cache \
100 --no-annotator \ 109 --no-annotator \
101 --pnacl-in-pnacl \ 110 --pnacl-in-pnacl \
111 --output=${OUT_DIR} \
102 "--extra-cc-args=${EXTRA_CC_ARGS}" \ 112 "--extra-cc-args=${EXTRA_CC_ARGS}" \
103 ${EXTRA_CONFIGURE} \ 113 ${EXTRA_CONFIGURE} \
104 "--binutils-pnacl-extra-configure=${GOLD_LDADD}" 114 "--binutils-pnacl-extra-configure=${GOLD_LDADD}"
105 115
106 Remove ${BUILD_DIR} 116 Remove ${OUT_BIN}
107 MakeDir ${BUILD_DIR} 117 MakeDir ${OUT_BIN}
108 LogExecute cp \ 118 LogExecute cp ${OUT_DIR}/llvm_le32_nacl_install/bin/* ${OUT_BIN}
109 ${SRC_DIR}/toolchain_build/out/llvm_le32_nacl_install/bin/* ${BUILD_DIR}/ 119 LogExecute cp ${OUT_DIR}/binutils_pnacl_le32_nacl_install/bin/* \
110 LogExecute cp \ 120 ${OUT_BIN}
111 ${SRC_DIR}/toolchain_build/out/binutils_pnacl_le32_nacl_install/bin/* \
112 ${BUILD_DIR}/
113 # TODO(bradnelson): Drop this once shell script fix is done. 121 # TODO(bradnelson): Drop this once shell script fix is done.
114 MakeDir ${BUILD_DIR}/driver 122 MakeDir ${OUT_BIN}/driver
115 LogExecute cp ${SRC_DIR}/pnacl/driver/redirect.sh ${BUILD_DIR}/driver/ 123 LogExecute cp ${SRC_DIR}/pnacl/driver/redirect.sh ${OUT_BIN}/driver/
116 LogExecute cp ${SRC_DIR}/pnacl/driver/*.py ${BUILD_DIR}/driver/ 124 LogExecute cp ${SRC_DIR}/pnacl/driver/*.py ${OUT_BIN}/driver/
117 } 125 }
118 126
119 InstallStep() { 127 InstallStep() {
120 local ASSEMBLY_DIR=${DESTDIR}/${PREFIX}/pnacl 128 local INSTALL_DIR=${DESTDIR}/${PREFIX}/pnacl
121 Remove ${ASSEMBLY_DIR}/ 129 Remove ${INSTALL_DIR}/
122 MakeDir ${ASSEMBLY_DIR}/ 130 MakeDir ${INSTALL_DIR}/
123 131
124 LogExecute cp -r ${NACL_SDK_ROOT}/toolchain/linux_pnacl/* ${ASSEMBLY_DIR} 132 LogExecute cp -r ${NACL_SDK_ROOT}/toolchain/linux_pnacl/* ${INSTALL_DIR}
125 133
126 # Drop pyc files. 134 # Drop pyc files.
127 LogExecute find ${ASSEMBLY_DIR} -name "*.pyc" -exec rm {} \; 135 LogExecute find ${INSTALL_DIR} -name "*.pyc" -exec rm {} \;
136
137 LogExecute rm -r ${INSTALL_DIR}/mipsel-nacl
138 LogExecute rm -r ${INSTALL_DIR}/translator
128 139
129 # TODO(bradnelson): Drop this once shell script fix is done. 140 # TODO(bradnelson): Drop this once shell script fix is done.
130 LogExecute cp ${BUILD_DIR}/driver/*.py ${ASSEMBLY_DIR}/bin/pydir/ 141 LogExecute cp ${OUT_BIN}/driver/*.py ${INSTALL_DIR}/bin/pydir/
131 142
132 # Swap in nacl executables. 143 # Swap in nacl executables.
133 Remove ${ASSEMBLY_DIR}/lib/*.so 144 Remove ${INSTALL_DIR}/lib/*.so
134 for f in $(find ${ASSEMBLY_DIR} -executable -type f); do 145 for f in $(find ${INSTALL_DIR} -executable -type f); do
135 if [ "$(file ${f} | grep ELF)" != "" ]; then 146 if [ "$(file ${f} | grep ELF)" != "" ]; then
136 local pexe="${BUILD_DIR}/$(basename ${f})" 147 local pexe="${OUT_BIN}/$(basename ${f})"
137 if [ -f "${pexe}" ]; then 148 if [ -f "${pexe}" ]; then
138 LogExecute ${PNACLFINALIZE} ${pexe} -o ${f} 149 echo "Finalizing ${pexe}"
150 ${PNACLFINALIZE} ${pexe} -o ${f}
139 else 151 else
140 echo "Warning: dropping ${f} without a nacl replacement." 152 echo "Warning: dropping ${f} without a nacl replacement."
141 LogExecute rm -f ${f} 153 LogExecute rm -f ${f}
142 fi 154 fi
143 elif [ "$(head -n 1 ${f} | grep /bin/sh)" != "" ]; then 155 elif [ "$(head -n 1 ${f} | grep /bin/sh)" != "" ]; then
144 # TODO(bradnelson): Drop this once shell script fix is done. 156 # TODO(bradnelson): Drop this once shell script fix is done.
145 LogExecute cp -f ${BUILD_DIR}/driver/redirect.sh ${f} 157 LogExecute cp -f ${OUT_BIN}/driver/redirect.sh ${f}
146 LogExecute chmod a+x ${f} 158 LogExecute chmod a+x ${f}
147 fi 159 fi
148 done 160 done
149 } 161 }
150 162
151 PostInstallTestStep() { 163 PostInstallTestStep() {
152 # Verify that binaries at least load under sel_ldr 164 # Verify that binaries at least load under sel_ldr
153 LogExecute ./le32-nacl-strings.sh --version 165 LogExecute ./bin/le32-nacl-strings.sh --version
154 LogExecute ./arm-nacl-readelf.sh --version 166 LogExecute ./bin/arm-nacl-readelf.sh --version
155 LogExecute ./clang.sh --version 167 LogExecute ./bin/clang.sh --version
156 } 168 }
OLDNEW
« no previous file with comments | « build_tools/common.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698