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