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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Makefile ('k') | build_tools/naclports.py » ('j') | 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) 2012 The Native Client Authors. All rights reserved. 1 # Copyright (c) 2012 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 # Environment variable NACL_ARCH should be set to one of the following 5 # Environment variable NACL_ARCH should be set to one of the following
6 # values: i686 x86_64 pnacl arm 6 # values: i686 x86_64 pnacl arm
7 7
8 8
9 # NAMING CONVENTION 9 # NAMING CONVENTION
10 # ================= 10 # =================
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 if [ ${NACL_ARCH} = "pnacl" ]; then 111 if [ ${NACL_ARCH} = "pnacl" ]; then
112 NACLPORTS_LDFLAGS+=" -O2" 112 NACLPORTS_LDFLAGS+=" -O2"
113 fi 113 fi
114 fi 114 fi
115 115
116 # libcli_main.a has a circular dependency which makes static link fail 116 # libcli_main.a has a circular dependency which makes static link fail
117 # (cli_main => nacl_io => ppapi_cpp => cli_main). To break this loop, 117 # (cli_main => nacl_io => ppapi_cpp => cli_main). To break this loop,
118 # you should use this instead of -lcli_main. 118 # you should use this instead of -lcli_main.
119 export NACL_CLI_MAIN_LIB="-Wl,--undefined=PSUserCreateInstance -lcli_main" 119 export NACL_CLI_MAIN_LIB="-Wl,--undefined=PSUserCreateInstance -lcli_main"
120 120
121 # Python variables
122 NACL_PYSETUP_ARGS=""
123 NACL_BUILD_SUBDIR=build
124 NACL_INSTALL_SUBDIR=install
125
121 # output directories 126 # output directories
122 readonly NACL_PACKAGES_OUT=${NACL_SRC}/out 127 readonly NACL_PACKAGES_OUT=${NACL_SRC}/out
123 readonly NACL_PACKAGES_ROOT=${NACL_PACKAGES_OUT}/packages 128 readonly NACL_PACKAGES_ROOT=${NACL_PACKAGES_OUT}/packages
124 readonly NACL_PACKAGES_BUILD=${NACL_PACKAGES_OUT}/build 129 readonly NACL_PACKAGES_BUILD=${NACL_PACKAGES_OUT}/build
125 readonly NACL_PACKAGES_PUBLISH=${NACL_PACKAGES_OUT}/publish 130 readonly NACL_PACKAGES_PUBLISH=${NACL_PACKAGES_OUT}/publish
126 readonly NACL_PACKAGES_TARBALLS=${NACL_PACKAGES_OUT}/tarballs 131 readonly NACL_PACKAGES_TARBALLS=${NACL_PACKAGES_OUT}/tarballs
127 readonly NACL_PACKAGES_STAMPDIR=${NACL_PACKAGES_OUT}/stamp 132 readonly NACL_PACKAGES_STAMPDIR=${NACL_PACKAGES_OUT}/stamp
128 133 readonly NACL_HOST_PYROOT=${NACL_PACKAGES_BUILD}/host_python-2.7.5
129 NACL_BUILD_SUBDIR=build 134 readonly NACL_HOST_PYTHON=${NACL_HOST_PYROOT}/bin/python2.7
130 NACL_INSTALL_SUBDIR=install 135 readonly NACL_DEST_PYROOT=${NACLPORTS_PREFIX}
136 readonly DEST_PYTHON_OBJS=${NACL_HOST_PYROOT}/${NACL_BUILD_SUBDIR}
137 readonly SITE_PACKAGES="lib/python2.7/site-packages/"
131 138
132 # The components of package names cannot contain underscore 139 # The components of package names cannot contain underscore
133 # characters so use x86-64 rather then x86_64 for arch component. 140 # characters so use x86-64 rather then x86_64 for arch component.
134 if [ ${NACL_ARCH} = "x86_64" ]; then 141 if [ ${NACL_ARCH} = "x86_64" ]; then
135 PACKAGE_SUFFIX="_x86-64" 142 PACKAGE_SUFFIX="_x86-64"
136 else 143 else
137 PACKAGE_SUFFIX="_${NACL_ARCH}" 144 PACKAGE_SUFFIX="_${NACL_ARCH}"
138 fi 145 fi
139 146
140 if [ ${NACL_ARCH} != "pnacl" ]; then 147 if [ ${NACL_ARCH} != "pnacl" ]; then
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 echo "MAKEFLAGS=${MAKEFLAGS}" 938 echo "MAKEFLAGS=${MAKEFLAGS}"
932 export MAKEFLAGS 939 export MAKEFLAGS
933 fi 940 fi
934 if [ "${VERBOSE:-}" = "1" ]; then 941 if [ "${VERBOSE:-}" = "1" ]; then
935 MAKE_TARGETS+=" VERBOSE=1 V=1" 942 MAKE_TARGETS+=" VERBOSE=1 V=1"
936 fi 943 fi
937 export PATH=${NACL_BIN_PATH}:${PATH} 944 export PATH=${NACL_BIN_PATH}:${PATH}
938 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-} 945 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-}
939 } 946 }
940 947
948 DefaultPythonModuleBuildStep() {
949 SetupCrossEnvironment
950 Banner "Build ${PACKAGE_NAME} python module"
951 ChangeDir ${SRC_DIR}
952 if CheckStamp install_dest_${PACKAGE_NAME} ; then
953 return
954 fi
955 LogExecute rm -rf build dist
956 export PYTHONPATH="${NACL_HOST_PYROOT}/${SITE_PACKAGES}"
957 export PYTHONPATH="${PYTHONPATH}:${NACL_DEST_PYROOT}/${SITE_PACKAGES}"
958 export NACL_PORT_BUILD=${1:-dest}
959 export NACL_BUILD_TREE=${NACL_DEST_PYROOT}
960 export CFLAGS="${NACLPORTS_CPPFLAGS} ${NACLPORTS_CFLAGS}"
961 export CXXFLAGS="${NACLPORTS_CPPFLAGS} ${NACLPORTS_CXXFLAGS}"
962 export LDFLAGS=${NACLPORTS_LDFLAGS}
963 LogExecute ${NACL_HOST_PYTHON} setup.py \
964 ${NACL_PYSETUP_ARGS:-} \
965 install --prefix=${NACL_DEST_PYROOT}
966 MakeDir ${DEST_PYTHON_OBJS}
967 LogExecute find build -name "*.o" -exec cp -v {} ${DEST_PYTHON_OBJS} \;
968 TouchStamp install_dest_${PACKAGE_NAME}
969 }
941 970
942 DefaultTestStep() { 971 DefaultTestStep() {
943 echo "No tests defined for ${PACKAGE_NAME}" 972 echo "No tests defined for ${PACKAGE_NAME}"
944 } 973 }
945 974
946 975
947 DefaultPostInstallTestStep() { 976 DefaultPostInstallTestStep() {
948 echo "No post-packaging tests defined for ${PACKAGE_NAME}" 977 echo "No post-packaging tests defined for ${PACKAGE_NAME}"
949 } 978 }
950 979
951 980
952 DefaultInstallStep() { 981 DefaultInstallStep() {
953 # assumes pwd has makefile 982 # assumes pwd has makefile
954 if [ -n "${MAKEFLAGS:-}" ]; then 983 if [ -n "${MAKEFLAGS:-}" ]; then
955 echo "MAKEFLAGS=${MAKEFLAGS}" 984 echo "MAKEFLAGS=${MAKEFLAGS}"
956 export MAKEFLAGS 985 export MAKEFLAGS
957 fi 986 fi
958 export PATH=${NACL_BIN_PATH}:${PATH} 987 export PATH=${NACL_BIN_PATH}:${PATH}
959 LogExecute make ${INSTALL_TARGETS:-install} DESTDIR=${DESTDIR} 988 LogExecute make ${INSTALL_TARGETS:-install} DESTDIR=${DESTDIR}
960 } 989 }
961 990
991 DefaultPythonModuleInstallStep() {
992 Banner "Installing ${PACKAGE_NAME}"
993 # We've installed already previously. We just need to collect our modules.
994 MakeDir ${NACL_HOST_PYROOT}/python_modules/
995 if [ -e ${START_DIR}/modules.list ] ; then
996 LogExecute cp ${START_DIR}/modules.list \
997 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.list
998 fi
999 if [ -e ${START_DIR}/modules.libs ] ; then
1000 LogExecute cp ${START_DIR}/modules.libs \
1001 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.libs
1002 fi
1003 }
962 1004
963 # 1005 #
964 # echo a command before exexuting it under 'time' 1006 # echo a command before exexuting it under 'time'
965 # 1007 #
966 TimeCommand() { 1008 TimeCommand() {
967 echo "$@" 1009 echo "$@"
968 time "$@" 1010 time "$@"
969 } 1011 }
970 1012
971 1013
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 # Always run 1366 # Always run
1325 # These functions are called when this script is imported to do 1367 # These functions are called when this script is imported to do
1326 # any essential checking/setup operations. 1368 # any essential checking/setup operations.
1327 ###################################################################### 1369 ######################################################################
1328 CheckToolchain 1370 CheckToolchain
1329 CheckPatchVersion 1371 CheckPatchVersion
1330 CheckSDKVersion 1372 CheckSDKVersion
1331 PatchSpecFile 1373 PatchSpecFile
1332 InjectSystemHeaders 1374 InjectSystemHeaders
1333 InstallConfigSite 1375 InstallConfigSite
OLDNEW
« 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