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

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: Responding to comments Created 6 years, 10 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 unset or set to "i686" 5 # Environment variable NACL_ARCH should be unset or set to "i686"
6 # for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm" 6 # for a 32-bit build. It should be set to "x86_64", "pnacl", or "arm"
7 # for a 64-bit, pnacl, or arm builds. 7 # for a 64-bit, pnacl, or arm builds.
8 8
9 9
10 # NAMING CONVENTION 10 # NAMING CONVENTION
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 fi 131 fi
132 132
133 # Don't support building with SDKs older than the current stable release 133 # Don't support building with SDKs older than the current stable release
134 MIN_SDK_VERSION=${MIN_SDK_VERSION:-31} 134 MIN_SDK_VERSION=${MIN_SDK_VERSION:-31}
135 135
136 readonly NACL_PACKAGES_REPOSITORY=${REPOSITORY} 136 readonly NACL_PACKAGES_REPOSITORY=${REPOSITORY}
137 readonly NACL_PACKAGES_PUBLISH=${NACL_PACKAGES_OUT}/publish 137 readonly NACL_PACKAGES_PUBLISH=${NACL_PACKAGES_OUT}/publish
138 readonly NACL_PACKAGES_TARBALLS=${NACL_PACKAGES_OUT}/tarballs 138 readonly NACL_PACKAGES_TARBALLS=${NACL_PACKAGES_OUT}/tarballs
139 readonly NACL_PACKAGES_STAMPDIR=${NACL_PACKAGES_OUT}/stamp 139 readonly NACL_PACKAGES_STAMPDIR=${NACL_PACKAGES_OUT}/stamp
140 140
141 readonly NACL_HOST_PYROOT=${NACL_PACKAGES_REPOSITORY}/host_python-2.7.5
142 readonly NACL_HOST_PYTHON=${NACL_HOST_PYROOT}/bin/python2.7
143 readonly NACL_DEST_PYROOT=${NACLPORTS_PREFIX}
144 readonly DEST_PYTHON_OBJS=${NACL_HOST_PYROOT}/${NACL_BUILD_SUBDIR}
145 readonly SITE_PACKAGES="lib/python2.7/site-packages/"
146 NACL_PYSETUP_ARGS=""
147
141 if [ $OS_NAME = "Darwin" ]; then 148 if [ $OS_NAME = "Darwin" ]; then
142 OS_JOBS=4 149 OS_JOBS=4
143 elif [ $OS_NAME = "Linux" ]; then 150 elif [ $OS_NAME = "Linux" ]; then
144 OS_JOBS=`nproc` 151 OS_JOBS=`nproc`
145 else 152 else
146 OS_JOBS=1 153 OS_JOBS=1
147 fi 154 fi
148 155
149 GomaTest() { 156 GomaTest() {
150 # test the goma compiler 157 # test the goma compiler
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 fi 195 fi
189 196
190 # PACKAGE_DIR (the folder contained within that archive) defaults to 197 # PACKAGE_DIR (the folder contained within that archive) defaults to
191 # the PACKAGE_NAME. Packages with non-standard contents can override 198 # the PACKAGE_NAME. Packages with non-standard contents can override
192 # this before including common.sh 199 # this before including common.sh
193 PACKAGE_DIR=${PACKAGE_DIR:-${PACKAGE_NAME:-}} 200 PACKAGE_DIR=${PACKAGE_DIR:-${PACKAGE_NAME:-}}
194 SRC_DIR=${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR} 201 SRC_DIR=${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR}
195 DEFAULT_BUILD_DIR=${SRC_DIR}/${NACL_BUILD_SUBDIR} 202 DEFAULT_BUILD_DIR=${SRC_DIR}/${NACL_BUILD_SUBDIR}
196 BUILD_DIR=${NACL_BUILD_DIR:-${DEFAULT_BUILD_DIR}} 203 BUILD_DIR=${NACL_BUILD_DIR:-${DEFAULT_BUILD_DIR}}
197 204
198
199 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}" 205 PUBLISH_DIR="${NACL_PACKAGES_PUBLISH}/${PACKAGE_NAME}"
200 if [ "${NACL_ARCH}" = "pnacl" ]; then 206 if [ "${NACL_ARCH}" = "pnacl" ]; then
201 PUBLISH_DIR+=/pnacl 207 PUBLISH_DIR+=/pnacl
202 else 208 else
203 PUBLISH_DIR+=/${NACL_LIBC} 209 PUBLISH_DIR+=/${NACL_LIBC}
204 fi 210 fi
205 211
206 if [ "${NACL_ARCH}" != "pnacl" -a -z "${NACL_SEL_LDR:-}" ]; then 212 if [ "${NACL_ARCH}" != "pnacl" -a -z "${NACL_SEL_LDR:-}" ]; then
207 SKIP_SEL_LDR_TESTS=1 213 SKIP_SEL_LDR_TESTS=1
208 else 214 else
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 ChangeDir ${BUILD_DIR} 855 ChangeDir ${BUILD_DIR}
850 # Build ${MAKE_TARGETS} or default target if it is not defined 856 # Build ${MAKE_TARGETS} or default target if it is not defined
851 if [ -n "${MAKEFLAGS:-}" ]; then 857 if [ -n "${MAKEFLAGS:-}" ]; then
852 echo "MAKEFLAGS=${MAKEFLAGS}" 858 echo "MAKEFLAGS=${MAKEFLAGS}"
853 export MAKEFLAGS 859 export MAKEFLAGS
854 fi 860 fi
855 export PATH=${NACL_BIN_PATH}:${PATH}; 861 export PATH=${NACL_BIN_PATH}:${PATH};
856 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-} 862 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-}
857 } 863 }
858 864
865 DefaultPythonModuleBuildStep() {
866 Banner "Build ${PACKAGE_NAME} python module"
867 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR}
868 if CheckStamp install_dest_${PACKAGE_NAME} ; then
869 return
870 fi
871 LogExecute rm -rf build dist
872 export PYTHONPATH="${NACL_HOST_PYROOT}/${SITE_PACKAGES}"
873 export PYTHONPATH="${PYTHONPATH}:${NACL_DEST_PYROOT}/${SITE_PACKAGES}"
874 export NACL_PORT_BUILD=${1:-dest}
875 export NACL_BUILD_TREE=${NACL_DEST_PYROOT}
876 export CC=${NACLCC}
877 export CXX=${NACLCXX}
878 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig
879 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR}
880 export FREETYPE_CONFIG=${NACLPORTS_PREFIX_BIN}/freetype-config
881 export CFLAGS=${NACLPORTS_CFLAGS}
882 export CXXFLAGS=${NACLPORTS_CXXFLAGS}
883 export LDFLAGS=${NACLPORTS_LDFLAGS}
884 LogExecute ${NACL_HOST_PYTHON} setup.py \
885 ${NACL_PYSETUP_ARGS:-} \
886 install --prefix=${NACL_DEST_PYROOT}
887 MakeDir ${DEST_PYTHON_OBJS}
888 LogExecute find build -name "*.o" -exec cp -v {} ${DEST_PYTHON_OBJS} \;
889 TouchStamp install_dest_${PACKAGE_NAME}
890 }
859 891
860 DefaultTestStep() { 892 DefaultTestStep() {
861 echo "No tests defined for ${PACKAGE_NAME}" 893 echo "No tests defined for ${PACKAGE_NAME}"
862 } 894 }
863 895
864 896
865 DefaultInstallStep() { 897 DefaultInstallStep() {
866 # assumes pwd has makefile 898 # assumes pwd has makefile
867 if [ -n "${MAKEFLAGS:-}" ]; then 899 if [ -n "${MAKEFLAGS:-}" ]; then
868 echo "MAKEFLAGS=${MAKEFLAGS}" 900 echo "MAKEFLAGS=${MAKEFLAGS}"
869 export MAKEFLAGS 901 export MAKEFLAGS
870 fi 902 fi
871 export PATH=${NACL_BIN_PATH}:${PATH}; 903 export PATH=${NACL_BIN_PATH}:${PATH};
872 LogExecute make ${INSTALL_TARGETS:-install} 904 LogExecute make ${INSTALL_TARGETS:-install}
873 } 905 }
874 906
907 DefaultPythonModuleInstallStep() {
908 Banner "Installing ${PACKAGE_NAME}"
909 # We've installed already previously. We just need to collect our modules.
910 MakeDir ${NACL_HOST_PYROOT}/python_modules/
911 if [ -e ${START_DIR}/modules.list ] ; then
912 LogExecute cp ${START_DIR}/modules.list \
913 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.list
914 fi
915 if [ -e ${START_DIR}/modules.libs ] ; then
916 LogExecute cp ${START_DIR}/modules.libs \
917 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.libs
918 fi
919 }
875 920
876 # 921 #
877 # echo a command before exexuting it under 'time' 922 # echo a command before exexuting it under 'time'
878 # 923 #
879 TimeCommand() { 924 TimeCommand() {
880 echo "$@" 925 echo "$@"
881 time "$@" 926 time "$@"
882 } 927 }
883 928
884 929
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 # Always run 1237 # Always run
1193 # These functions are called when this script is imported to do 1238 # These functions are called when this script is imported to do
1194 # any essential checking/setup operations. 1239 # any essential checking/setup operations.
1195 ###################################################################### 1240 ######################################################################
1196 CheckToolchain 1241 CheckToolchain
1197 CheckPatchVersion 1242 CheckPatchVersion
1198 CheckSDKVersion 1243 CheckSDKVersion
1199 PatchSpecFile 1244 PatchSpecFile
1200 InjectSystemHeaders 1245 InjectSystemHeaders
1201 InstallConfigSite 1246 InstallConfigSite
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698