From f16f792e17c2b9704e319f17da7d20c201b74141 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 21 May 2015 11:05:05 +0200 Subject: [PATCH] vici: Make installation of Ruby Gem and Python Egg optional Installing them might not work well when building distro packages (e.g. with DESTDIR installs). It might be easier to install them later with a script in the distro package. When building from source on the local system it could still be useful to install the packages directly, which can be enabled with separate configure options. The main problem with DESTDIR installations of the Python Egg is that easy_install creates or modifies a file called easy-install.pth in the installation directory. So it's not actually possible to simply copy the results in DESTDIR over to the actual system as that file would have to be merged with any existing one. Fixes #914. --- configure.ac | 24 +++++++++++++++++++----- src/libcharon/plugins/vici/python/Makefile.am | 2 ++ src/libcharon/plugins/vici/ruby/Makefile.am | 2 ++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 80d23cc..760a277 100644 --- a/configure.ac +++ b/configure.ac @@ -291,8 +291,10 @@ ARG_ENABL_SET([integrity-test], [enable integrity testing of libstrongswan and p ARG_DISBL_SET([load-warning], [disable the charon plugin load option warning in starter.]) ARG_ENABL_SET([mediation], [enable IKEv2 Mediation Extension.]) ARG_ENABL_SET([unwind-backtraces],[use libunwind to create backtraces for memory leaks and segfaults.]) -ARG_ENABL_SET([ruby-gems], [enable installation of provided ruby gems.]) -ARG_ENABL_SET([python-eggs], [enable installation of provided python eggs.]) +ARG_ENABL_SET([ruby-gems], [enable build of provided ruby gems.]) +ARG_ENABL_SET([ruby-gems-install],[enable installation of provided ruby gems.]) +ARG_ENABL_SET([python-eggs], [enable build of provided python eggs.]) +ARG_ENABL_SET([python-eggs-install],[enable installation of provided python eggs.]) # compile options ARG_ENABL_SET([coverage], [enable lcov coverage report generation.]) ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.]) @@ -433,6 +435,14 @@ if test x$medcli = xtrue; then mediation=true fi +if test x$ruby_gems_install = xtrue; then + ruby_gems=true +fi + +if test x$python_eggs_install = xtrue; then + python_eggs=true +fi + # =========================================== # check required libraries and header files # =========================================== @@ -1199,11 +1209,14 @@ if test x$ruby_gems = xtrue; then fi AC_SUBST(RUBYGEMDIR, "$rubygemdir") fi +AM_CONDITIONAL(RUBY_GEMS_INSTALL, [test "x$ruby_gems_install" = xtrue]) if test x$python_eggs = xtrue; then - AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) - if test x$EASY_INSTALL = x; then - AC_MSG_ERROR(Python easy_install not found) + if test x$python_eggs_install = xtrue; then + AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) + if test x$EASY_INSTALL = x; then + AC_MSG_ERROR(Python easy_install not found) + fi fi if test "x$pythoneggdir" = "xmain site-packages directory"; then AC_SUBST(PYTHONEGGINSTALLDIR, "") @@ -1212,6 +1225,7 @@ if test x$python_eggs = xtrue; then fi AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) fi +AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue]) # =============================================== # collect plugin list for strongSwan components diff --git a/src/libcharon/plugins/vici/python/Makefile.am b/src/libcharon/plugins/vici/python/Makefile.am index 163b234..5936f2a 100644 --- a/src/libcharon/plugins/vici/python/Makefile.am +++ b/src/libcharon/plugins/vici/python/Makefile.am @@ -24,9 +24,11 @@ clean-local: (cd $(srcdir); [ ! -f setup.py ] || $(PYTHON) setup.py clean -a) rm -rf $(srcdir)/setup.py $(srcdir)/vici.egg-info $(builddir)/dist +if PYTHON_EGGS_INSTALL install-exec-local: dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg $(EASY_INSTALL) $(PYTHONEGGINSTALLDIR) \ dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg +endif if USE_PY_TEST TESTS = $(PY_TEST) diff --git a/src/libcharon/plugins/vici/ruby/Makefile.am b/src/libcharon/plugins/vici/ruby/Makefile.am index 3e12f86..a66a662 100644 --- a/src/libcharon/plugins/vici/ruby/Makefile.am +++ b/src/libcharon/plugins/vici/ruby/Makefile.am @@ -15,6 +15,7 @@ all-local: vici-$(PACKAGE_VERSION).gem clean-local: rm -f vici.gemspec vici-$(PACKAGE_VERSION).gem +if RUBY_GEMS_INSTALL install-data-local: vici-$(PACKAGE_VERSION).gem $(GEM) install --install-dir $(DESTDIR)$(RUBYGEMDIR) \ vici-$(PACKAGE_VERSION).gem @@ -22,3 +23,4 @@ install-data-local: vici-$(PACKAGE_VERSION).gem uninstall-local: $(GEM) uninstall --install-dir $(DESTDIR)$(RUBYGEMDIR) \ --version $(PACKAGE_VERSION) vici +endif -- 2.7.4