From f3521e88be02230dc979a8b0fa82df8e0c007a57 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Fri, 23 Sep 2022 12:16:39 +0300 Subject: [PATCH] Allow to build CPython with --with-dsymutil Since 3.12, CPython can provide debug symbols in Apple's nonstandard way, "dSYM bundles" --- plugins/python-build/bin/python-build | 11 +++++ plugins/python-build/test/build.bats | 69 +++++++++++++++++++++++++-- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 5ae819cb..4531f1dc 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -779,6 +779,7 @@ build_package_standard_build() { else use_homebrew_zlib || true fi + use_dsymutil || true fi ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then @@ -1626,6 +1627,16 @@ use_tcltk() { fi } +# Since 3.12, CPython can add DWARF debug information in MacOS +# using Apple's nonstandard way, `dsymutil', that creates a "dSYM bundle" +# that's supposed to be installed alongside executables +# (https://github.com/python/cpython/issues/95973). +use_dsymutil() { + if [[ -n "$PYTHON_BUILD_CONFIGURE_WITH_DSYMUTIL" ]] && is_mac; then + package_option python configure --with-dsymutil + fi +} + build_package_enable_shared() { package_option python configure --enable-shared } diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index e770a690..f761c8f1 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -515,14 +515,41 @@ make install DOGE="such wow" OUT } -@test "setting MAKE_INSTALL_OPTS to a multi-word string" { +@test "configuring with dSYM in MacOS" { cached_tarball "Python-3.6.2" - for i in {1..8}; do stub uname '-s : echo Linux'; done + for i in {1..9}; do stub uname '-s : echo Darwin'; done + for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done + for i in {1..4}; do stub brew false; done stub_make_install - export MAKE_INSTALL_OPTS="DOGE=\"such wow\"" run_inline_definition <