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

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: 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
Sam Clegg 2014/01/22 01:46:50 Maybe early return here rather than indent to whol
Matthew Turk 2014/01/22 21:14:31 Done.
872 LogExecute rm -rf build dist
873 export PYTHONPATH="${NACL_HOST_PYROOT}/${SITE_PACKAGES}"
874 export PYTHONPATH="${PYTHONPATH}:${NACL_DEST_PYROOT}/${SITE_PACKAGES}"
875 export NACL_PORT_BUILD=${1:-dest}
876 export NACL_BUILD_TREE=${NACL_DEST_PYROOT}
877 export CC=${NACLCC}
878 export CXX=${NACLCXX}
879 export PKG_CONFIG_PATH=${NACLPORTS_LIBDIR}/pkgconfig
880 export PKG_CONFIG_LIBDIR=${NACLPORTS_LIBDIR}
881 export FREETYPE_CONFIG=${NACLPORTS_PREFIX_BIN}/freetype-config
882 export CFLAGS=${NACLPORTS_CFLAGS}
883 export CXXFLAGS=${NACLPORTS_CXXFLAGS}
884 export LDFLAGS=${NACLPORTS_LDFLAGS}
885 LogExecute ${NACL_HOST_PYTHON} setup.py \
886 ${NACL_PYSETUP_ARGS:-} \
887 install --prefix=${NACL_DEST_PYROOT}
888 MakeDir ${DEST_PYTHON_OBJS}
889 LogExecute find build -name "*.o" -exec cp -v {} ${DEST_PYTHON_OBJS} \;
890 TouchStamp install_dest_${PACKAGE_NAME}
891 fi
892 }
862 893
863 DefaultTestStep() { 894 DefaultTestStep() {
864 Banner "Testing ${PACKAGE_NAME} (no tests)" 895 Banner "Testing ${PACKAGE_NAME} (no tests)"
865 } 896 }
866 897
867 898
868 DefaultInstallStep() { 899 DefaultInstallStep() {
869 Banner "Installing" 900 Banner "Installing"
870 # assumes pwd has makefile 901 # assumes pwd has makefile
871 if [ -n "${MAKEFLAGS:-}" ]; then 902 if [ -n "${MAKEFLAGS:-}" ]; then
872 echo "MAKEFLAGS=${MAKEFLAGS}" 903 echo "MAKEFLAGS=${MAKEFLAGS}"
873 export MAKEFLAGS 904 export MAKEFLAGS
874 fi 905 fi
875 export PATH=${NACL_BIN_PATH}:${PATH}; 906 export PATH=${NACL_BIN_PATH}:${PATH};
876 LogExecute make ${INSTALL_TARGETS:-install} 907 LogExecute make ${INSTALL_TARGETS:-install}
877 } 908 }
878 909
910 DefaultPythonModuleInstallStep() {
911 Banner "Installing"
912 # We've installed already previously. We just need to collect our modules.
913 MakeDir ${NACL_HOST_PYROOT}/python_modules/
914 if [ -e ${START_DIR}/modules.list ] ; then
915 LogExecute cp ${START_DIR}/modules.list \
916 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.list
917 fi
918 if [ -e ${START_DIR}/modules.libs ] ; then
919 LogExecute cp ${START_DIR}/modules.libs \
920 ${DEST_PYTHON_OBJS}/${PACKAGE_NAME}.libs
921 fi
922 }
879 923
880 # 924 #
881 # echo a command before exexuting it under 'time' 925 # echo a command before exexuting it under 'time'
882 # 926 #
883 TimeCommand() { 927 TimeCommand() {
884 echo "$@" 928 echo "$@"
885 time "$@" 929 time "$@"
886 } 930 }
887 931
888 932
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 # Always run 1217 # Always run
1174 # These functions are called when this script is imported to do 1218 # These functions are called when this script is imported to do
1175 # any essential checking/setup operations. 1219 # any essential checking/setup operations.
1176 ###################################################################### 1220 ######################################################################
1177 CheckToolchain 1221 CheckToolchain
1178 CheckPatchVersion 1222 CheckPatchVersion
1179 CheckSDKVersion 1223 CheckSDKVersion
1180 PatchSpecFile 1224 PatchSpecFile
1181 InjectSystemHeaders 1225 InjectSystemHeaders
1182 InstallConfigSite 1226 InstallConfigSite
OLDNEW
« no previous file with comments | « Makefile ('k') | ports/python/pkg_info » ('j') | ports/python_modules/ipython/nacl.patch » ('J')

Powered by Google App Engine
This is Rietveld 408576698