OLD | NEW |
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=python${NACL_EXEEXT} | 5 EXECUTABLES=python${NACL_EXEEXT} |
6 | 6 |
7 # This build relies on certain host binaries and python's configure | 7 # This build relies on certain host binaries and python's configure |
8 # requires us to set --build= as well as --host=. | 8 # requires us to set --build= as well as --host=. |
9 HOST_BUILD_DIR=${WORK_DIR}/build-nacl-host | 9 HOST_BUILD_DIR=${WORK_DIR}/build_host |
10 | |
11 BuildHostPython() { | |
12 # Seems that python builds to python.exe on mac (!) so they | |
13 # can avoid a name conflict with the "Python" folder, since | |
14 # the mac filesystem is case insensistive. | |
15 if [ ${OS_NAME} != "Linux" ]; then | |
16 local EXT=.exe | |
17 else | |
18 local EXT= | |
19 fi | |
20 | |
21 MakeDir ${HOST_BUILD_DIR} | |
22 ChangeDir ${HOST_BUILD_DIR} | |
23 if [ -f python${EXT} -a -f Parser/pgen ]; then | |
24 return | |
25 fi | |
26 LogExecute ${SRC_DIR}/configure | |
27 LogExecute make -j${OS_JOBS} python${EXT} Parser/pgen | |
28 } | |
29 | 10 |
30 ConfigureStep() { | 11 ConfigureStep() { |
31 BuildHostPython | |
32 ChangeDir ${BUILD_DIR} | |
33 # We pre-seed configure with certain results that it cannot determine | 12 # We pre-seed configure with certain results that it cannot determine |
34 # since we are doing a cross compile. The $CONFIG_SITE file is sourced | 13 # since we are doing a cross compile. The $CONFIG_SITE file is sourced |
35 # by configure early on. | 14 # by configure early on. |
36 export CROSS_COMPILE=true | 15 export CROSS_COMPILE=true |
37 export CONFIG_SITE=${START_DIR}/config.site | 16 export CONFIG_SITE=${START_DIR}/config.site |
38 # Disable ipv6 since configure claims it requires a working getaddrinfo | 17 # Disable ipv6 since configure claims it requires a working getaddrinfo |
39 # which we do not provide. TODO(sbc): remove this once nacl_io supports | 18 # which we do not provide. TODO(sbc): remove this once nacl_io supports |
40 # getaddrinfo. | 19 # getaddrinfo. |
41 EXTRA_CONFIGURE_ARGS="--disable-ipv6" | 20 EXTRA_CONFIGURE_ARGS="--disable-ipv6" |
42 EXTRA_CONFIGURE_ARGS+=" --with-suffix=${NACL_EXEEXT}" | 21 EXTRA_CONFIGURE_ARGS+=" --with-suffix=${NACL_EXEEXT}" |
43 EXTRA_CONFIGURE_ARGS+=" --build=x86_64-linux-gnu" | 22 EXTRA_CONFIGURE_ARGS+=" --build=x86_64-linux-gnu" |
44 export LIBS="-ltermcap" | 23 export LIBS="-ltermcap" |
45 if [ "${NACL_LIBC}" = "newlib" ]; then | 24 if [ "${NACL_LIBC}" = "newlib" ]; then |
46 LIBS+=" -lglibc-compat" | 25 LIBS+=" -lglibc-compat" |
47 fi | 26 fi |
48 DefaultConfigureStep | 27 DefaultConfigureStep |
49 if [ "${NACL_LIBC}" = "newlib" ]; then | 28 if [ "${NACL_LIBC}" = "newlib" ]; then |
50 # For static linking we copy in a pre-baked Setup.local | 29 # For static linking we copy in a pre-baked Setup.local |
51 LogExecute cp ${START_DIR}/Setup.local Modules/ | 30 LogExecute cp ${START_DIR}/Setup.local Modules/ |
52 fi | 31 fi |
53 } | 32 } |
54 | 33 |
55 BuildStep() { | 34 BuildStep() { |
56 export CROSS_COMPILE=true | 35 export CROSS_COMPILE=true |
57 export MAKEFLAGS="PGEN=${HOST_BUILD_DIR}/Parser/pgen" | 36 export MAKEFLAGS="PGEN=${NACL_HOST_PYBUILD}/Parser/pgen" |
58 SetupCrossEnvironment | 37 SetupCrossEnvironment |
59 DefaultBuildStep | 38 DefaultBuildStep |
60 } | 39 } |
61 | 40 |
62 InstallStep() { | 41 InstallStep() { |
63 export CROSS_COMPILE=true | 42 export CROSS_COMPILE=true |
64 DefaultInstallStep | 43 DefaultInstallStep |
65 } | 44 } |
66 | 45 |
67 TestStep() { | 46 TestStep() { |
68 if [ ${NACL_ARCH} = "pnacl" ]; then | 47 if [ ${NACL_ARCH} = "pnacl" ]; then |
69 local pexe=python${NACL_EXEEXT} | 48 local pexe=python${NACL_EXEEXT} |
70 local script=python | 49 local script=python |
71 # on Mac/Windows the folder called Python prevents us from creating a | 50 # on Mac/Windows the folder called Python prevents us from creating a |
72 # script called python (lowercase). | 51 # script called python (lowercase). |
73 if [ ${OS_NAME} != "Linux" ]; then | 52 if [ ${OS_NAME} != "Linux" ]; then |
74 script+=".sh" | 53 script+=".sh" |
75 fi | 54 fi |
76 TranslateAndWriteSelLdrScript ${pexe} x86-64 python.x86-64.nexe ${script} | 55 TranslateAndWriteSelLdrScript ${pexe} x86-64 python.x86-64.nexe ${script} |
77 fi | 56 fi |
78 } | 57 } |
OLD | NEW |