1*4882a593SmuzhiyunFrom 322724e166d7ec0393aec577c12fdf6ef2b61e1d Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3*4882a593SmuzhiyunDate: Wed, 22 Feb 2017 16:21:31 -0800
4*4882a593SmuzhiyunSubject: [PATCH] Make the build of pyc files conditional
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis commit adds a new configure option --disable-pyc-build to disable
7*4882a593Smuzhiyunthe compilation of pyc.
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10*4882a593Smuzhiyun[ Andrey Smrinov: ported to Python 3.6 ]
11*4882a593SmuzhiyunSigned-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
12*4882a593Smuzhiyun---
13*4882a593Smuzhiyun Makefile.pre.in | 2 ++
14*4882a593Smuzhiyun configure.ac    | 6 ++++++
15*4882a593Smuzhiyun 2 files changed, 8 insertions(+)
16*4882a593Smuzhiyun
17*4882a593Smuzhiyundiff --git a/Makefile.pre.in b/Makefile.pre.in
18*4882a593Smuzhiyunindex 77f91e72b1..0c809f3d8a 100644
19*4882a593Smuzhiyun--- a/Makefile.pre.in
20*4882a593Smuzhiyun+++ b/Makefile.pre.in
21*4882a593Smuzhiyun@@ -1600,6 +1600,7 @@ libinstall:	build_all $(srcdir)/Modules/xxmodule.c
22*4882a593Smuzhiyun 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
23*4882a593Smuzhiyun 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
24*4882a593Smuzhiyun 	fi
25*4882a593Smuzhiyun+ifeq (@PYC_BUILD@,yes)
26*4882a593Smuzhiyun 	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
27*4882a593Smuzhiyun 		$(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
28*4882a593Smuzhiyun 		-j0 -d $(LIBDEST) -f \
29*4882a593Smuzhiyun@@ -1627,6 +1628,7 @@ libinstall:	build_all $(srcdir)/Modules/xxmodule.c
30*4882a593Smuzhiyun 		$(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \
31*4882a593Smuzhiyun 		-j0 -d $(LIBDEST)/site-packages -f \
32*4882a593Smuzhiyun 		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
33*4882a593Smuzhiyun+endif
34*4882a593Smuzhiyun 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
35*4882a593Smuzhiyun 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
36*4882a593Smuzhiyun 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
37*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
38*4882a593Smuzhiyunindex d60f05251a..1ee5a09588 100644
39*4882a593Smuzhiyun--- a/configure.ac
40*4882a593Smuzhiyun+++ b/configure.ac
41*4882a593Smuzhiyun@@ -1110,6 +1110,12 @@ fi
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun AC_MSG_CHECKING(LDLIBRARY)
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun+AC_SUBST(PYC_BUILD)
46*4882a593Smuzhiyun+
47*4882a593Smuzhiyun+AC_ARG_ENABLE(pyc-build,
48*4882a593Smuzhiyun+	AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
49*4882a593Smuzhiyun+	[ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
50*4882a593Smuzhiyun+
51*4882a593Smuzhiyun # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
52*4882a593Smuzhiyun # library that we build, but we do not want to link against it (we
53*4882a593Smuzhiyun # will find it with a -framework option). For this reason there is an
54*4882a593Smuzhiyun--
55*4882a593Smuzhiyun2.25.1
56*4882a593Smuzhiyun
57