Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-45881: configure --with-freeze-module --with-build-python (GH-29835)#29835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits Select commit Hold shift + click to select a range
2a31f90 bpo-45881: configure --with-freeze-module --with-build-python
tiran 0a8c339 Rename arg to freeze-module
tiran 47f9e2e it's called _freeze_module
tiran ad8c9da Update configure.ac
tiran deab8e9 Update configure.ac
tiran 04d8eb0 More docs
tiran e4eff12 blurb
tiran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions 2 Misc/NEWS.d/next/Build/2021-11-29-16-32-55.bpo-45881.7597J6.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| The :program:`configure` script now accepts ``--with-build-python`` and | ||
| ``--with-freeze-module`` options to make cross compiling easier. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -93,9 +93,69 @@ AC_CANONICAL_HOST | ||
| AC_SUBST(build) | ||
| AC_SUBST(host) | ||
| AS_VAR_IF([cross_compiling], [maybe], | ||
| [AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])] | ||
| ) | ||
| # pybuilddir.txt will be created by --generate-posix-vars in the Makefile | ||
| rm -f pybuilddir.txt | ||
| dnl cross-compiling needs a freeze_module binary for build platform | ||
tiran marked this conversation as resolved. Outdated Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| AC_ARG_WITH( | ||
| [freeze-module], | ||
| [AS_HELP_STRING([--with-freeze-module=Programs/_freeze_module], | ||
| [path to _freeze_module binary for cross compiling])], | ||
| [ | ||
| AC_MSG_CHECKING([for --with-freeze-module]) | ||
| AS_VAR_IF([cross_compiling], [no], AC_MSG_ERROR([--with-freeze-module only applies to cross compiling])) | ||
| if test "$with_freeze_module" = yes -o "$with_freeze_module" = no; then | ||
| AC_MSG_ERROR([invalid --with-freeze-module option: expected path, not "$with_freeze_module"]) | ||
| fi | ||
| if ! $(command -v "$with_freeze_module" >/dev/null 2>&1); then | ||
| AC_MSG_ERROR([invalid or missing freeze module binary "$with_freeze_module"]) | ||
| fi | ||
| FREEZE_MODULE="$with_freeze_module" | ||
| AC_MSG_RESULT([$FREEZE_MODULE]) | ||
| ], [ | ||
| AS_VAR_IF([cross_compiling], [yes], | ||
| [AC_MSG_ERROR([Cross compiling requires --with-freeze-module])] | ||
| ) | ||
| FREEZE_MODULE=Programs/_freeze_module | ||
| ] | ||
| ) | ||
| AC_SUBST([FREEZE_MODULE]) | ||
| AC_ARG_WITH( | ||
| [build-python], | ||
| [AS_HELP_STRING([--with-build-python=python]PYTHON_VERSION, | ||
| [path to build python binary for cross compiling (default: python]PYTHON_VERSION[)])], | ||
| [ | ||
| AC_MSG_CHECKING([for --with-build-python]) | ||
| AS_VAR_IF([cross_compiling], [no], AC_MSG_ERROR([--with-build-python only applies to cross compiling])) | ||
| AS_VAR_IF([with_build_python], [yes], [with_build_python=python$PACKAGE_VERSION]) | ||
| AS_VAR_IF([with_build_python], [no], [AC_MSG_ERROR([invalid --with-build-python option: expected path, not "no"])]) | ||
| if ! $(command -v "$with_build_python" >/dev/null 2>&1); then | ||
| AC_MSG_ERROR([invalid or missing build python binary "$with_build_python"]) | ||
| fi | ||
| build_python_ver=$($with_build_python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | ||
tiran marked this conversation as resolved. Outdated Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| if test "$build_python_ver" != "$PACKAGE_VERSION" then | ||
| AC_MSG_ERROR(["$with_build_python" has incompatible version $build_python_ver (expected: $PACKAGE_VERSION)]) | ||
| fi | ||
| dnl use build Python for regeneration, too | ||
| ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python | ||
| PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$with_build_python | ||
| AC_MSG_RESULT([$with_build_python]) | ||
| ], [ | ||
| AS_VAR_IF([cross_compiling], [yes], | ||
| [AC_MSG_ERROR([Cross compiling requires --with-build-python])] | ||
| ) | ||
| PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' | ||
| ] | ||
| ) | ||
| AC_SUBST([PYTHON_FOR_BUILD]) | ||
| AC_CHECK_PROGS([PYTHON_FOR_REGEN], | ||
| [python$PACKAGE_VERSION python3.10 python3.9 python3.8 python3.7 python3.6 python3 python], | ||
| [python3]) | ||
| @@ -108,29 +168,6 @@ else | ||
| AC_MSG_RESULT([missing]) | ||
| fi | ||
| if test "$cross_compiling" = yes; then | ||
| AC_MSG_CHECKING([for python interpreter for cross build]) | ||
| if test -z "$PYTHON_FOR_BUILD" then | ||
| for interp in python$PACKAGE_VERSION python3 python; do | ||
| which $interp >/dev/null 2>&1 || continue | ||
| if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info@<:@:2@:>@) == '$PACKAGE_VERSION')" then | ||
| break | ||
| fi | ||
| interp= | ||
| done | ||
| if test x$interp = x; then | ||
| AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) | ||
| fi | ||
| AC_MSG_RESULT($interp) | ||
| PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp | ||
| fi | ||
| elif test "$cross_compiling" = maybe; then | ||
| AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) | ||
| else | ||
| PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' | ||
| fi | ||
| AC_SUBST(PYTHON_FOR_BUILD) | ||
| dnl Ensure that if prefix is specified, it does not end in a slash. If | ||
| dnl it does, we get path names containing '//' which is both ugly and | ||
| dnl can cause trouble. | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.