Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | dnl This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | dnl License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 4 | |
michael@0 | 5 | AC_DEFUN([MOZ_PYTHON], |
michael@0 | 6 | [ |
michael@0 | 7 | |
michael@0 | 8 | dnl We honor the Python path defined in an environment variable. This is used |
michael@0 | 9 | dnl to pass the virtualenv's Python from the main configure to SpiderMonkey's |
michael@0 | 10 | dnl configure, for example. |
michael@0 | 11 | if test -z "$PYTHON"; then |
michael@0 | 12 | MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python) |
michael@0 | 13 | if test -z "$PYTHON"; then |
michael@0 | 14 | AC_MSG_ERROR([python was not found in \$PATH]) |
michael@0 | 15 | fi |
michael@0 | 16 | else |
michael@0 | 17 | AC_MSG_RESULT([Using Python from environment variable \$PYTHON]) |
michael@0 | 18 | fi |
michael@0 | 19 | |
michael@0 | 20 | _virtualenv_topsrcdir= |
michael@0 | 21 | _virtualenv_populate_path= |
michael@0 | 22 | |
michael@0 | 23 | dnl If this is a mozilla-central, we'll find the virtualenv in the top |
michael@0 | 24 | dnl source directory. If this is a SpiderMonkey build, we assume we're at |
michael@0 | 25 | dnl js/src and try to find the virtualenv from the mozilla-central root. |
michael@0 | 26 | for base in $MOZILLA_CENTRAL_PATH $_topsrcdir $_topsrcdir/../..; do |
michael@0 | 27 | possible=$base/python/mozbuild/mozbuild/virtualenv.py |
michael@0 | 28 | |
michael@0 | 29 | if test -e $possible; then |
michael@0 | 30 | _virtualenv_topsrcdir=$base |
michael@0 | 31 | _virtualenv_populate_path=$possible |
michael@0 | 32 | break |
michael@0 | 33 | fi |
michael@0 | 34 | done |
michael@0 | 35 | |
michael@0 | 36 | if test -z $_virtualenv_populate_path; then |
michael@0 | 37 | AC_MSG_ERROR([Unable to find Virtualenv population script. In order |
michael@0 | 38 | to build, you will need mozilla-central's virtualenv. |
michael@0 | 39 | |
michael@0 | 40 | If you are building from a mozilla-central checkout, you should never see this |
michael@0 | 41 | message. If you are building from a source archive, the source archive was |
michael@0 | 42 | likely not created properly (it is missing the virtualenv files). |
michael@0 | 43 | |
michael@0 | 44 | If you have a copy of mozilla-central available, define the |
michael@0 | 45 | MOZILLA_CENTRAL_PATH environment variable to the top source directory of |
michael@0 | 46 | mozilla-central and relaunch configure.]) |
michael@0 | 47 | |
michael@0 | 48 | fi |
michael@0 | 49 | |
michael@0 | 50 | if test -z $DONT_POPULATE_VIRTUALENV; then |
michael@0 | 51 | AC_MSG_RESULT([Creating Python environment]) |
michael@0 | 52 | dnl This verifies our Python version is sane and ensures the Python |
michael@0 | 53 | dnl virtualenv is present and up to date. It sanitizes the environment |
michael@0 | 54 | dnl for us, so we don't need to clean anything out. |
michael@0 | 55 | $PYTHON $_virtualenv_populate_path \ |
michael@0 | 56 | $_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv \ |
michael@0 | 57 | $_virtualenv_topsrcdir/build/virtualenv_packages.txt || exit 1 |
michael@0 | 58 | |
michael@0 | 59 | case "$host_os" in |
michael@0 | 60 | mingw*) |
michael@0 | 61 | PYTHON=`cd $MOZ_BUILD_ROOT && pwd -W`/_virtualenv/Scripts/python.exe |
michael@0 | 62 | ;; |
michael@0 | 63 | *) |
michael@0 | 64 | PYTHON=$MOZ_BUILD_ROOT/_virtualenv/bin/python |
michael@0 | 65 | ;; |
michael@0 | 66 | esac |
michael@0 | 67 | fi |
michael@0 | 68 | |
michael@0 | 69 | AC_SUBST(PYTHON) |
michael@0 | 70 | |
michael@0 | 71 | AC_MSG_CHECKING([Python environment is Mozilla virtualenv]) |
michael@0 | 72 | $PYTHON -c "import mozbuild.base" |
michael@0 | 73 | if test "$?" != 0; then |
michael@0 | 74 | AC_MSG_ERROR([Python environment does not appear to be sane.]) |
michael@0 | 75 | fi |
michael@0 | 76 | AC_MSG_RESULT([yes]) |
michael@0 | 77 | |
michael@0 | 78 | PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib()"` |
michael@0 | 79 | if test -z "$PYTHON_SITE_PACKAGES"; then |
michael@0 | 80 | AC_MSG_ERROR([Could not determine python site packages directory.]) |
michael@0 | 81 | fi |
michael@0 | 82 | AC_SUBST([PYTHON_SITE_PACKAGES]) |
michael@0 | 83 | |
michael@0 | 84 | ]) |
michael@0 | 85 |