0003-Make-the-build-of-pyc-and-pyo-files-conditional.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 7c5338161263c290f18b1ff90859084d314be98c Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 23 Dec 2015 11:29:35 +0100
  4. Subject: [PATCH] Make the build of pyc and pyo files conditional
  5. This commit adds two new configure options: --disable-pyc-build and
  6. --disable-pyo-build to disable the compilation of pyc and pyo files
  7. respectively.
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. ---
  10. Makefile.pre.in | 8 ++++++++
  11. configure.ac | 12 ++++++++++++
  12. 2 files changed, 20 insertions(+)
  13. diff --git a/Makefile.pre.in b/Makefile.pre.in
  14. index 58dab28..f1bdd99 100644
  15. --- a/Makefile.pre.in
  16. +++ b/Makefile.pre.in
  17. @@ -1245,24 +1245,32 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  18. $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
  19. $(DESTDIR)$(LIBDEST)/distutils/tests ; \
  20. fi
  21. +ifeq (@PYC_BUILD@,yes)
  22. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  23. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  24. -d $(LIBDEST) -f \
  25. -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
  26. $(DESTDIR)$(LIBDEST)
  27. +endif
  28. +ifeq (@PYO_BUILD@,yes)
  29. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  30. $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
  31. -d $(LIBDEST) -f \
  32. -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
  33. $(DESTDIR)$(LIBDEST)
  34. +endif
  35. +ifeq (@PYC_BUILD@,yes)
  36. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  37. $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \
  38. -d $(LIBDEST)/site-packages -f \
  39. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  40. +endif
  41. +ifeq (@PYO_BUILD@,yes)
  42. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  43. $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \
  44. -d $(LIBDEST)/site-packages -f \
  45. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  46. +endif
  47. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  48. $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
  49. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  50. diff --git a/configure.ac b/configure.ac
  51. index 7b491b4..f2c4705 100644
  52. --- a/configure.ac
  53. +++ b/configure.ac
  54. @@ -922,6 +922,18 @@ fi
  55. AC_MSG_CHECKING(LDLIBRARY)
  56. +AC_SUBST(PYC_BUILD)
  57. +
  58. +AC_ARG_ENABLE(pyc-build,
  59. + AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]),
  60. + [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ])
  61. +
  62. +AC_SUBST(PYO_BUILD)
  63. +
  64. +AC_ARG_ENABLE(pyo-build,
  65. + AS_HELP_STRING([--disable-pyo-build], [disable build of pyo files]),
  66. + [ PYO_BUILD="${enableval}" ], [ PYO_BUILD=yes ])
  67. +
  68. # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
  69. # library that we build, but we do not want to link against it (we
  70. # will find it with a -framework option). For this reason there is an
  71. --
  72. 2.6.4