aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-23 03:30:23 +0200
committerGitHub <noreply@github.com>2019-05-23 03:30:23 +0200
commit0a8e57248b913851640c64375600f05157c997df (patch)
tree79352007eef8deb7530c38d460554183e6c960a2 /Makefile.pre.in
parentbpo-27737: Allow whitespace only headers encoding (#13478) (diff)
downloadcpython-0a8e57248b913851640c64375600f05157c997df.tar.gz
cpython-0a8e57248b913851640c64375600f05157c997df.tar.bz2
cpython-0a8e57248b913851640c64375600f05157c997df.zip
bpo-36721: Add --embed option to python-config (GH-13500)
To embed Python into an application, a new --embed option must be passed to "python3-config --libs --embed" to get "-lpython3.8" (link the application to libpython). To support both 3.8 and older, try "python3-config --libs --embed" first and fallback to "python3-config --libs" (without --embed) if the previous command fails. Add a pkg-config "python-3.8-embed" module to embed Python into an application: "pkg-config python-3.8-embed --libs" includes "-lpython3.8". To support both 3.8 and older, try "pkg-config python-X.Y-embed --libs" first and fallback to "pkg-config python-X.Y --libs" (without --embed) if the previous command fails (replace "X.Y" with the Python version). On the other hand, "pkg-config python3.8 --libs" no longer contains "-lpython3.8". C extensions must not be linked to libpython (except on Android, case handled by the script); this change is backward incompatible on purpose. "make install" now also installs "python-3.8-embed.pc".
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 9f70cd515eb..d006a73c38b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1258,11 +1258,15 @@ bininstall: altbininstall
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(LDVERSION)-config python$(VERSION)-config); \
rm -f $(DESTDIR)$(LIBPC)/python-$(LDVERSION).pc; \
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python-$(LDVERSION).pc); \
+ rm -f $(DESTDIR)$(LIBPC)/python-embed-$(LDVERSION).pc; \
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-embed-$(VERSION).pc python-embed-$(LDVERSION).pc); \
fi
-rm -f $(DESTDIR)$(BINDIR)/python3-config
(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-config python3-config)
-rm -f $(DESTDIR)$(LIBPC)/python3.pc
(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python3.pc)
+ -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
+ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
-rm -f $(DESTDIR)$(BINDIR)/idle3
(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
-rm -f $(DESTDIR)$(BINDIR)/pydoc3
@@ -1552,6 +1556,7 @@ libainstall: @DEF_MAKE_RULE@ python-config
$(INSTALL_DATA) $(srcdir)/Modules/Setup $(DESTDIR)$(LIBPL)/Setup
$(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local
$(INSTALL_DATA) Misc/python.pc $(DESTDIR)$(LIBPC)/python-$(VERSION).pc
+ $(INSTALL_DATA) Misc/python-embed.pc $(DESTDIR)$(LIBPC)/python-$(VERSION)-embed.pc
$(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup
$(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
$(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
@@ -1766,7 +1771,7 @@ distclean: clobber
done
-rm -f core Makefile Makefile.pre config.status Modules/Setup.local \
Modules/ld_so_aix Modules/python.exp Misc/python.pc \
- Misc/python-config.sh
+ Misc/python-embed.pc Misc/python-config.sh
-rm -f python*-gdb.py
# Issue #28258: set LC_ALL to avoid issues with Estonian locale.
# Expansion is performed here by shell (spawned by make) itself before