Skip to content

Commit ab4c1a6

Browse files
committed
python@3.8: build --with-system-libmpdec
via Homebrew/homebrew-core@079d29a
1 parent 94b985a commit ab4c1a6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Formula/python@3.8.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class PythonAT38 < Formula
3030

3131
depends_on "pkg-config" => :build
3232
depends_on "gdbm"
33+
depends_on "mpdecimal"
3334
depends_on "openssl@1.1"
3435
depends_on "readline"
3536
depends_on "sqlite"
@@ -68,12 +69,23 @@ class PythonAT38 < Formula
6869
end
6970
end
7071

72+
# Link against libmpdec.so.3, update for mpdecimal.h symbol cleanup.
73+
patch do
74+
url "https://www.bytereef.org/contrib/decimal-3.8.diff"
75+
sha256 "104083617f086375974908f619369cd64005d5ffc314038c31b8b49032280148"
76+
end
77+
7178
def install
7279
# Unset these so that installing pip and setuptools puts them where we want
7380
# and not into some other Python the user has installed.
7481
ENV["PYTHONHOME"] = nil
7582
ENV["PYTHONPATH"] = nil
7683

84+
# Override the auto-detection in setup.py, which assumes a universal build.
85+
on_macos do
86+
ENV["PYTHON_DECIMAL_WITH_MACHINE"] = Hardware::CPU.arm? ? "uint128" : "x64"
87+
end
88+
7789
xy = (buildpath/"configure.ac").read.slice(/PYTHON_VERSION, (3\.\d)/, 1)
7890
lib_cellar = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}"
7991

@@ -87,6 +99,7 @@ def install
8799
--without-ensurepip
88100
--with-dtrace
89101
--with-openssl=#{Formula["openssl@1.1"].opt_prefix}
102+
--with-system-libmpdec
90103
]
91104

92105
cflags = ["-I#{HOMEBREW_PREFIX}/include"]
@@ -317,7 +330,7 @@ def caveats
317330
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
318331
system "#{bin}/python#{xy}", "-c", "import sqlite3"
319332
# Check if some other modules import. Then the linked libs are working.
320-
333+
system "#{bin}/python#{xy}", "-c", "import _decimal"
321334
system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()"
322335

323336
system "#{bin}/python#{xy}", "-c", "import _gdbm"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy