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

Unified Diff: build_tools/common.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Makefile ('k') | build_tools/naclports.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build_tools/common.sh
===================================================================
--- a/build_tools/common.sh
+++ b/build_tools/common.sh
@@ -118,6 +118,11 @@
# you should use this instead of -lcli_main.
export NACL_CLI_MAIN_LIB="-Wl,--undefined=PSUserCreateInstance -lcli_main"
+# Python variables
+NACL_PYSETUP_ARGS=""
+NACL_BUILD_SUBDIR=build
+NACL_INSTALL_SUBDIR=install
+
# output directories
readonly NACL_PACKAGES_OUT=${NACL_SRC}/out
readonly NACL_PACKAGES_ROOT=${NACL_PACKAGES_OUT}/packages
@@ -125,9 +130,11 @@
readonly NACL_PACKAGES_PUBLISH=${NACL_PACKAGES_OUT}/publish
readonly NACL_PACKAGES_TARBALLS=${NACL_PACKAGES_OUT}/tarballs
readonly NACL_PACKAGES_STAMPDIR=${NACL_PACKAGES_OUT}/stamp
-
-NACL_BUILD_SUBDIR=build
-NACL_INSTALL_SUBDIR=install
+readonly NACL_HOST_PYROOT=${NACL_PACKAGES_BUILD}/host_python-2.7.5
+readonly NACL_HOST_PYTHON=${NACL_HOST_PYROOT}/bin/python2.7
+readonly NACL_DEST_PYROOT=${NACLPORTS_PREFIX}
+readonly DEST_PYTHON_OBJS=${NACL_HOST_PYROOT}/${NACL_BUILD_SUBDIR}
+readonly SITE_PACKAGES="lib/python2.7/site-packages/"
# The components of package names cannot contain underscore
# characters so use x86-64 rather then x86_64 for arch component.
@@ -938,6 +945,28 @@
LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-}
}
+DefaultPythonModuleBuildStep() {
+ SetupCrossEnvironment
+ Banner "Build ${PACKAGE_NAME} python module"
+ ChangeDir ${SRC_DIR}
+ if CheckStamp install_dest_${PACKAGE_NAME} ; then
+ return
+ fi
+ LogExecute rm -rf build dist
+ export PYTHONPATH="${NACL_HOST_PYROOT}/${SITE_PACKAGES}"
+ export PYTHONPATH="${PYTHONPATH}:${NACL_DEST_PYROOT}/${SITE_PACKAGES}"
+ export NACL_PORT_BUILD=${1:-dest}
+ export NACL_BUILD_TREE=${NACL_DEST_PYROOT}
+ export CFLAGS="${NACLPORTS_CPPFLAGS} ${NACLPORTS_CFLAGS}"
+ export CXXFLAGS="${NACLPORTS_CPPFLAGS} ${NACLPORTS_CXXFLAGS}"
+ export LDFLAGS=${NACLPORTS_LDFLAGS}
+ LogExecute ${NACL_HOST_PYTHON} setup.py \
+ ${NACL_PYSETUP_ARGS:-} \
+ install --prefix=${NACL_DEST_PYROOT}
+ MakeDir ${DEST_PYTHON_OBJS}
+ LogExecute find build -name "*.o" -exec cp -v {} ${DEST_PYTHON_OBJS} \;
+ TouchStamp install_dest_${PACKAGE_NAME}
+}
DefaultTestStep() {
echo "No tests defined for ${PACKAGE_NAME}"
@@ -959,6 +988,19 @@
LogExecute make ${INSTALL_TARGETS:-install} DESTDIR=${DESTDIR}
}
+DefaultPythonModuleInstallStep() {
+ Banner "Installing ${PACKAGE_NAME}"
+ # We've installed already previously. We just need to collect our modules.
+ MakeDir ${NACL_HOST_PYROOT}/python_modules/
+ if [ -e ${START_DIR}/modules.list ] ; then
+ LogExecute cp ${START_DIR}/modules.list \
+ ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.list
+ fi
+ if [ -e ${START_DIR}/modules.libs ] ; then
+ LogExecute cp ${START_DIR}/modules.libs \
+ ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.libs
+ fi
+}
#
# echo a command before exexuting it under 'time'
« no previous file with comments | « Makefile ('k') | build_tools/naclports.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698