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

Side by Side Diff: ports/python-static/build.sh

Issue 138913004: Build system for statically-linked Python. (Closed) Base URL: https://naclports.googlecode.com/svn/trunk/src
Patch Set: Final update with merge against current naclports.py Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ports/python-static/Setup.local ('k') | ports/python-static/config.site » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 SetupCrossEnvironment
16 export CROSS_COMPILE=true
17 # We pre-seed configure with certain results that it cannot determine
18 # since we are doing a cross compile. The $CONFIG_SITE file is sourced
19 # by configure early on.
20 export CONFIG_SITE=${START_DIR}/config.site
21 # Disable ipv6 since configure claims it requires a working getaddrinfo
22 # which we do not provide. TODO(sbc): remove this once nacl_io supports
23 # getaddrinfo.
24 EXTRA_CONFIGURE_ARGS="--disable-ipv6"
25 EXTRA_CONFIGURE_ARGS+=" --with-suffix=${NACL_EXEEXT}"
26 EXTRA_CONFIGURE_ARGS+=" --build=i686-linux-gnu --disable-shared --enable-stati c"
27 export SO=.a
28 export MAKEFLAGS="PGEN=${NACL_HOST_PYROOT}/../python-host/build-nacl-host/Pars er/pgen"
29 export LIBS="-ltermcap"
30 export DYNLOADFILE=dynload_ppapi.o
31 export MACHDEP=ppapi
32 export LINKCC=${NACLCXX}
33 LIBS+=" -lglibc-compat -lc"
34 LogExecute cp ${START_DIR}/dynload_ppapi.c ${SRC_DIR}/Python/
35 # This next step is costly, but it sets the environment variables correctly.
36 DefaultConfigureStep
37
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 if [ -e ${MODFILE} ]; then
43 source ${MODFILE}
44 fi
45 done
46 LogExecute rm -vf libpython2.7.a
47 PY_LINK_LINE+="ppapi_simple ${DEST_PYTHON_OBJS}/\*.o"
48 PY_LINK_LINE+=" ${PY_MOD_LIBS} -lz -lppapi -lppapi_cpp -lnacl"
49 PY_LINK_LINE+=" -lnacl_io -lc -lglibc-compat -lbz2"
50 echo ${PY_LINK_LINE} >> Modules/Setup.local
51 # At this point we use the existing environment variables from
52 # DefaultConfigureStep to build our destination Python modules
53 }
54
55 BuildStep() {
56 SetupCrossEnvironment
57 export CROSS_COMPILE=true
58 export MAKEFLAGS="PGEN=${NACL_HOST_PYROOT}/../python-host/build-nacl-host/Pars er/pgen"
59 DefaultBuildStep
60 ChangeDir ${WORK_DIR}
61 Banner "Rebuilding libpython2.7.a"
62 ${AR} cr libpython2.7.a ${DEST_PYTHON_OBJS}/*.o
63 ${RANLIB} libpython2.7.a
64 # To avoid rebuilding python.nexe with the new libpython2.7.a and duplicating
65 # symbols
66 LogExecute touch python${NACL_EXEEXT}
67 # The modules get built with SO=so, but they need to be SO=a inside the
68 # destination filesystem.
69 for fn in `find ${NACL_DEST_PYROOT}/${SITE_PACKAGES} -name "*.so"`
70 do
71 LogExecute touch ${fn%%so}a
72 LogExecute rm -v ${fn}
73 done
74 }
OLDNEW
« no previous file with comments | « ports/python-static/Setup.local ('k') | ports/python-static/config.site » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698