OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 EXECUTABLES=python${NACL_EXEEXT} | |
7 | |
8 # Currently this package only builds on linux. | |
9 # The build relies on certain host binaries and python's configure | |
10 # requires us to set --build= as well as --host=. | |
11 # | |
12 # The module downloader is patterned after the Bochs image downloading step. | |
13 | |
14 ConfigureStep() { | |
15 export CROSS_COMPILE=true | |
16 # We pre-seed configure with certain results that it cannot determine | |
17 # since we are doing a cross compile. The $CONFIG_SITE file is sourced | |
18 # by configure early on. | |
19 export CONFIG_SITE=${START_DIR}/config.site | |
20 # Disable ipv6 since configure claims it requires a working getaddrinfo | |
21 # which we do not provide. TODO(sbc): remove this once nacl_io supports | |
22 # getaddrinfo. | |
23 EXTRA_CONFIGURE_ARGS="--disable-ipv6" | |
24 EXTRA_CONFIGURE_ARGS+=" --with-suffix=${NACL_EXEEXT}" | |
25 EXTRA_CONFIGURE_ARGS+=" --build=i686-linux-gnu --disable-shared --enable-stati c" | |
26 export SO=.a | |
27 export MAKEFLAGS="PGEN=../build-nacl-host/Parser/pgen" | |
28 export LIBS="-ltermcap" | |
29 export DYNLOADFILE=dynload_ppapi.o | |
30 export MACHDEP=ppapi | |
31 export LINKCC=${NACLCXX} | |
32 LIBS+=" -lglibc-compat -lc" | |
33 LogExecute cp ${START_DIR}/dynload_ppapi.c ${NACL_PACKAGES_REPOSITORY}/${PACKA GE_DIR}/Python/ | |
34 # This next step is costly, but it sets the environment variables correctly. | |
35 DefaultConfigureStep | |
36 | |
37 local SRC_DIR=${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR} | |
38 LogExecute cp ${START_DIR}/Setup.local Modules/ | |
39 cat ${DEST_PYTHON_OBJS}/*.list >> Modules/Setup.local | |
40 PY_MOD_LIBS="" | |
41 for MODFILE in ${DEST_PYTHON_OBJS}/*.libs ; do | |
42 source ${MODFILE} | |
Kester Tong
2014/01/29 20:38:47
in the case that the glob ${DEST_PYTHON_OBJS}/*.li
Matthew Turk
2014/01/31 15:56:57
Done.
| |
43 done | |
44 LogExecute rm -vf libpython2.7.a | |
45 PY_LINK_LINE+="ppapi_simple ${DEST_PYTHON_OBJS}/\*.o" | |
46 PY_LINK_LINE+=" ${PY_MOD_LIBS} -lz -lppapi -lppapi_cpp -lnacl" | |
47 PY_LINK_LINE+=" -lnacl_io -lc -lglibc-compat" | |
48 echo ${PY_LINK_LINE} >> Modules/Setup.local | |
49 # At this point we use the existing environment variables from | |
50 # DefaultConfigureStep to build our destination Python modules | |
51 } | |
52 | |
53 BuildStep() { | |
54 DefaultBuildStep | |
55 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR}/${NACL_BUILD_SUBDIR} | |
56 Banner "Rebuilding libpython2.7.a" | |
57 ${AR} cr libpython2.7.a ${DEST_PYTHON_OBJS}/*.o | |
58 ${RANLIB} libpython2.7.a | |
59 # To avoid rebuilding python.nexe with the new libpython2.7.a and duplicating | |
60 # symbols | |
61 LogExecute touch python${NACL_EXEEXT} | |
62 # The modules get built with SO=so, but they need to be SO=a inside the | |
63 # destination filesystem. | |
64 for fn in `find ${NACL_DEST_PYROOT}/${SITE_PACKAGES} -name "*.so"` | |
65 do | |
66 LogExecute touch ${fn%%so}a | |
67 LogExecute rm -v ${fn} | |
68 done | |
69 } | |
OLD | NEW |