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

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: Setting minimum SDK version Created 6 years, 11 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 ChangeDir ${BUILD_DIR} 858 ChangeDir ${BUILD_DIR}
853 # Build ${MAKE_TARGETS} or default target if it is not defined 859 # Build ${MAKE_TARGETS} or default target if it is not defined
854 if [ -n "${MAKEFLAGS:-}" ]; then 860 if [ -n "${MAKEFLAGS:-}" ]; then
855 echo "MAKEFLAGS=${MAKEFLAGS}" 861 echo "MAKEFLAGS=${MAKEFLAGS}"
856 export MAKEFLAGS 862 export MAKEFLAGS
857 fi 863 fi
858 export PATH=${NACL_BIN_PATH}:${PATH}; 864 export PATH=${NACL_BIN_PATH}:${PATH};
859 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-} 865 LogExecute make -j${OS_JOBS} ${MAKE_TARGETS:-}
860 } 866 }
861 867
868 DefaultPythonModuleBuildStep() {
869 Banner "Build ${PACKAGE_NAME} python module"
870 ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_DIR}
871 if CheckStamp install_dest_${PACKAGE_NAME} ; then
872 return
873 fi
874 LogExecute rm -rf build dist
875 export PYTHONPATH="${NACL_HOST_PYROOT}/${SITE_PACKAGES}"
876 export PYTHONPATH="${PYTHONPATH}:${NACL_DEST_PYROOT}/${SITE_PACKAGES}"
877 export NACL_PORT_BUILD=${1:-dest}
878 export NACL_BUILD_TREE=${NACL_DEST_PYROOT}
879 export CC=${NACLCC}
880 export CXX=${NACLCXX}
881 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig
882 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR}
883 export FREETYPE_CONFIG=${NACLPORTS_PREFIX_BIN}/freetype-config
884 export CFLAGS=${NACLPORTS_CFLAGS}
885 export CXXFLAGS=${NACLPORTS_CXXFLAGS}
886 export LDFLAGS=${NACLPORTS_LDFLAGS}
887 LogExecute ${NACL_HOST_PYTHON} setup.py \
888 ${NACL_PYSETUP_ARGS:-} \
889 install --prefix=${NACL_DEST_PYROOT}
890 MakeDir ${DEST_PYTHON_OBJS}
891 LogExecute find build -name "*.o" -exec cp -v {} ${DEST_PYTHON_OBJS} \;
892 TouchStamp install_dest_${PACKAGE_NAME}
893 }
862 894
863 DefaultTestStep() { 895 DefaultTestStep() {
864 Banner "Testing ${PACKAGE_NAME} (no tests)" 896 Banner "Testing ${PACKAGE_NAME} (no tests)"
865 } 897 }
866 898
867 899
868 DefaultInstallStep() { 900 DefaultInstallStep() {
869 Banner "Installing" 901 Banner "Installing"
870 # assumes pwd has makefile 902 # assumes pwd has makefile
871 if [ -n "${MAKEFLAGS:-}" ]; then 903 if [ -n "${MAKEFLAGS:-}" ]; then
872 echo "MAKEFLAGS=${MAKEFLAGS}" 904 echo "MAKEFLAGS=${MAKEFLAGS}"
873 export MAKEFLAGS 905 export MAKEFLAGS
874 fi 906 fi
875 export PATH=${NACL_BIN_PATH}:${PATH}; 907 export PATH=${NACL_BIN_PATH}:${PATH};
876 LogExecute make ${INSTALL_TARGETS:-install} 908 LogExecute make ${INSTALL_TARGETS:-install}
877 } 909 }
878 910
911 DefaultPythonModuleInstallStep() {
912 Banner "Installing"
hamaji 2014/01/24 14:32:48 "Installing ${PACKAGE_NAME}" ?
Matthew Turk 2014/01/28 19:39:20 Done.
913 # We've installed already previously. We just need to collect our modules.
914 MakeDir ${NACL_HOST_PYROOT}/python_modules/
915 if [ -e ${START_DIR}/modules.list ] ; then
916 LogExecute cp ${START_DIR}/modules.list \
917 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.list
918 fi
919 if [ -e ${START_DIR}/modules.libs ] ; then
920 LogExecute cp ${START_DIR}/modules.libs \
921 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.libs
922 fi
923 }
879 924
880 # 925 #
881 # echo a command before exexuting it under 'time' 926 # echo a command before exexuting it under 'time'
882 # 927 #
883 TimeCommand() { 928 TimeCommand() {
884 echo "$@" 929 echo "$@"
885 time "$@" 930 time "$@"
886 } 931 }
887 932
888 933
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 # Always run 1218 # Always run
1174 # These functions are called when this script is imported to do 1219 # These functions are called when this script is imported to do
1175 # any essential checking/setup operations. 1220 # any essential checking/setup operations.
1176 ###################################################################### 1221 ######################################################################
1177 CheckToolchain 1222 CheckToolchain
1178 CheckPatchVersion 1223 CheckPatchVersion
1179 CheckSDKVersion 1224 CheckSDKVersion
1180 PatchSpecFile 1225 PatchSpecFile
1181 InjectSystemHeaders 1226 InjectSystemHeaders
1182 InstallConfigSite 1227 InstallConfigSite
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698