Skip to content

Commit b3e561c

Browse files
Use targeted env vars for overriding compiler/linker flags on macOS (#1058)
1 parent 8ffeda5 commit b3e561c

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

getting-started/setup-building.rst

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -419,46 +419,53 @@ For example, with **Homebrew**, install the dependencies::
419419

420420
$ brew install pkg-config [email protected] xz gdbm tcl-tk
421421

422-
Then, for Python 3.10 and newer, run ``configure``::
422+
Then, for Python 3.11 and newer, run ``configure``::
423423

424-
$ CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
425-
LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
426-
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
424+
$ GDBM_CFLAGS="-I$(brew --prefix gdbm)/include" \
425+
GDBM_LIBS="-L$(brew --prefix gdbm)/lib -lgdbm" \
427426
./configure --with-pydebug \
428427
--with-openssl="$(brew --prefix [email protected])"
429428

429+
Or, for Python 3.7 through 3.10::
430430

431-
Or, for Python 3.7 through 3.9::
432-
433-
$ export PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig"; \
434-
CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
431+
$ CPPFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
435432
LDFLAGS="-L$(brew --prefix gdbm)/lib -L$(brew --prefix xz)/lib" \
436433
./configure --with-pydebug \
437-
--with-openssl="$(brew --prefix [email protected])" \
438-
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
439-
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"
434+
--with-openssl="$(brew --prefix [email protected])" \
435+
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
436+
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"
440437

441438
And finally, run ``make``::
442439

443440
$ make -s -j2
444441

445442
Alternatively, with **MacPorts**::
446443

447-
$ sudo port install pkgconfig openssl xz gdbm
444+
$ sudo port install pkgconfig openssl11 xz gdbm tcl tk +quartz
445+
446+
Then, for Python 3.11 and newer, run ``configure``::
447+
448+
$ GDBM_CFLAGS="-I$(dirname $(dirname $(which port)))/include" \
449+
GDBM_LIBS="-L$(dirname $(dirname $(which port)))/lib -lgdbm" \
450+
./configure --with-pydebug \
451+
--with-openssl="$(dirname $(dirname $(which port)))/libexec/openssl11"
448452

449-
and ``configure``::
453+
Or, for Python 3.7 through 3.10::
450454

451-
$ CPPFLAGS="-I/opt/local/include" \
452-
LDFLAGS="-L/opt/local/lib" \
453-
./configure --with-pydebug
455+
$ CPPFLAGS="-I$(dirname $(dirname $(which port)))/include" \
456+
LDFLAGS="-L$(dirname $(dirname $(which port)))/lib" \
457+
./configure --with-pydebug \
458+
--with-openssl="$(dirname $(dirname $(which port)))/libexec/openssl11" \
459+
--with-tcltk-libs="$(pkg-config --libs tcl tk)" \
460+
--with-tcltk-includes="$(pkg-config --cflags tcl tk)"
454461

455-
and ``make``::
462+
And finally, run ``make``::
456463

457464
$ make -s -j2
458465

459466
There will sometimes be optional modules added for a new release which
460467
won't yet be identified in the OS-level build dependencies. In those cases,
461-
just ask for assistance on the core-mentorship list.
468+
just ask for assistance in the *Core Development* category on :ref:`help-discourse`.
462469

463470
Explaining how to build optional dependencies on a Unix-based system without
464471
root access is beyond the scope of this guide.

0 commit comments

Comments
 (0)