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

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

Powered by Google App Engine
This is Rietveld 408576698