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.
This commit is contained in:
Tobias Brunner
2015-05-21 17:22:01 +02:00
parent 5a817407bc
commit f16f792e17
3 changed files with 23 additions and 5 deletions
+19 -5
View File
@@ -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_DISBL_SET([load-warning], [disable the charon plugin load option warning in starter.])
ARG_ENABL_SET([mediation], [enable IKEv2 Mediation Extension.]) 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([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([ruby-gems], [enable build of provided ruby gems.])
ARG_ENABL_SET([python-eggs], [enable installation of provided python eggs.]) 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 # compile options
ARG_ENABL_SET([coverage], [enable lcov coverage report generation.]) ARG_ENABL_SET([coverage], [enable lcov coverage report generation.])
ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.]) ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.])
@@ -433,6 +435,14 @@ if test x$medcli = xtrue; then
mediation=true mediation=true
fi 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 # check required libraries and header files
# =========================================== # ===========================================
@@ -1199,11 +1209,14 @@ if test x$ruby_gems = xtrue; then
fi fi
AC_SUBST(RUBYGEMDIR, "$rubygemdir") AC_SUBST(RUBYGEMDIR, "$rubygemdir")
fi fi
AM_CONDITIONAL(RUBY_GEMS_INSTALL, [test "x$ruby_gems_install" = xtrue])
if test x$python_eggs = xtrue; then if test x$python_eggs = xtrue; then
AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) if test x$python_eggs_install = xtrue; then
if test x$EASY_INSTALL = x; then AC_PATH_PROG([EASY_INSTALL], [easy_install], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
AC_MSG_ERROR(Python easy_install not found) if test x$EASY_INSTALL = x; then
AC_MSG_ERROR(Python easy_install not found)
fi
fi fi
if test "x$pythoneggdir" = "xmain site-packages directory"; then if test "x$pythoneggdir" = "xmain site-packages directory"; then
AC_SUBST(PYTHONEGGINSTALLDIR, "") AC_SUBST(PYTHONEGGINSTALLDIR, "")
@@ -1212,6 +1225,7 @@ if test x$python_eggs = xtrue; then
fi fi
AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin]) AC_PATH_PROG([PY_TEST], [py.test], [], [$PATH:/bin:/usr/bin:/usr/local/bin])
fi fi
AM_CONDITIONAL(PYTHON_EGGS_INSTALL, [test "x$python_eggs_install" = xtrue])
# =============================================== # ===============================================
# collect plugin list for strongSwan components # collect plugin list for strongSwan components
@@ -24,9 +24,11 @@ clean-local:
(cd $(srcdir); [ ! -f setup.py ] || $(PYTHON) setup.py clean -a) (cd $(srcdir); [ ! -f setup.py ] || $(PYTHON) setup.py clean -a)
rm -rf $(srcdir)/setup.py $(srcdir)/vici.egg-info $(builddir)/dist 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 install-exec-local: dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg
$(EASY_INSTALL) $(PYTHONEGGINSTALLDIR) \ $(EASY_INSTALL) $(PYTHONEGGINSTALLDIR) \
dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg
endif
if USE_PY_TEST if USE_PY_TEST
TESTS = $(PY_TEST) TESTS = $(PY_TEST)
@@ -15,6 +15,7 @@ all-local: vici-$(PACKAGE_VERSION).gem
clean-local: clean-local:
rm -f vici.gemspec vici-$(PACKAGE_VERSION).gem rm -f vici.gemspec vici-$(PACKAGE_VERSION).gem
if RUBY_GEMS_INSTALL
install-data-local: vici-$(PACKAGE_VERSION).gem install-data-local: vici-$(PACKAGE_VERSION).gem
$(GEM) install --install-dir $(DESTDIR)$(RUBYGEMDIR) \ $(GEM) install --install-dir $(DESTDIR)$(RUBYGEMDIR) \
vici-$(PACKAGE_VERSION).gem vici-$(PACKAGE_VERSION).gem
@@ -22,3 +23,4 @@ install-data-local: vici-$(PACKAGE_VERSION).gem
uninstall-local: uninstall-local:
$(GEM) uninstall --install-dir $(DESTDIR)$(RUBYGEMDIR) \ $(GEM) uninstall --install-dir $(DESTDIR)$(RUBYGEMDIR) \
--version $(PACKAGE_VERSION) vici --version $(PACKAGE_VERSION) vici
endif