Skip to content

Commit 5b0bbaa

Browse files
author
Gerry Manoim
committed
use ld_flags.py instead of python-configure
1 parent e333da6 commit 5b0bbaa

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ CXXFLAGS = $(BASE_CXXFLAGS) $($(COMPILER)_FLAGS)
6262

6363
# https://github.com/quantopian/libpy/pull/86/files#r309288697
6464
INCLUDE_DIRS := include/ \
65-
$(shell $(PYTHON) -c "from distutils import sysconfig; \
66-
print(sysconfig.get_config_var('INCLUDEPY'))") \
67-
$(shell $(PYTHON) -c "from distutils import sysconfig; \
68-
print(sysconfig.get_config_var('INCLUDEDIR'))") \
65+
$(shell $(PYTHON) -c "import sysconfig; \
66+
print(sysconfig.get_config_var('INCLDIRSTOMAKE'))") \
6967
$(shell $(PYTHON) -c 'import numpy as np;print(np.get_include())') \
7068
$(EXTRA_INCLUDE_DIRS)
7169
INCLUDE := $(foreach d,$(INCLUDE_DIRS), -I$d)
@@ -92,7 +90,7 @@ else
9290
CXXFLAGS += -fstack-protector-strong
9391
SONAME_FLAG := soname
9492
SONAME_PATH := $(SONAME)
95-
LDFLAGS += $(shell $(PYTHON)-config --ldflags)
93+
LDFLAGS += $(shell $(PYTHON) etc/ld_flags.py)
9694
LDFLAGS += -lstdc++fs
9795
LD_PRELOAD_VAR := LD_PRELOAD
9896
endif

etc/ld_flags.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# via https://github.com/python/cpython/blob/deb016224cc506503fb05e821a60158c83918ed4/Misc/python-config.in#L50 # noqa
2+
3+
import sysconfig
4+
5+
libs = []
6+
libpl = sysconfig.get_config_vars('LIBPL')
7+
if libpl:
8+
libs.append("-L"+libpl[0])
9+
10+
libpython = sysconfig.get_config_var('LIBPYTHON')
11+
if libpython:
12+
libs.append(libpython)
13+
libs.extend(sysconfig.get_config_vars("LIBS", "SYSLIBS"))
14+
print(' '.join(libs))

0 commit comments

Comments
 (0)