[lxc-devel] [PATCH] fixes for rpmbuild
Greg Kurz
gkurz at fr.ibm.com
Thu Sep 8 12:44:02 UTC 2011
This patch fixes some makefile/specfile issues when running
rpmbuild with the distributed lxc specfile:
- fixes usage of installation directories for config files,
rootfs, templates and lxc-init so that they're calculated
at make time instead of configure time. Thanks to this,
all installed items go under $RPM_BUILD_ROOT when running
rpmbuild
- introduce --disable-rpath option to configure to avoid
check-rpaths errors when building non-root.
- introduce a lxc-libs package in the default spec file
to allow concurrent installation of 32 bit and 64 bit
libraries.
v2: - fix circular reference in lxc.pc
- ship lxc.pc with lxc-devel
Signed-off-by: Greg Kurz <gkurz at fr.ibm.com>
---
configure.ac | 24 ++++++++++++------------
lxc.pc.in | 2 +-
lxc.spec.in | 26 +++++++++++++++++++-------
src/lxc/Makefile.am | 10 ++++++++--
4 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/configure.ac b/configure.ac
index 56c5f98..6fa8c4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,12 @@ AM_PROG_CC_C_O
AC_GNU_SOURCE
AC_CHECK_PROG(SETCAP, setcap, yes, no, $PATH$PATH_SEPARATOR/sbin)
+AC_ARG_ENABLE([rpath],
+ [AC_HELP_STRING([--disable-rpath], [do not set rpath in executables])],
+ [], [enable_rpath=yes])
+
+AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
+
AC_ARG_ENABLE([doc],
[AC_HELP_STRING([--enable-doc], [make mans (require docbook2man installed) [default=auto]])],
[], [enable_doc=auto])
@@ -44,26 +50,20 @@ AC_ARG_WITH([config-path],
[AC_HELP_STRING(
[--with-config-path=dir],
[lxc configuration repository path]
- )], [], [with_config_path="${localstatedir}/lib/lxc"])
+ )], [], [with_config_path=['${localstatedir}/lib/lxc']])
AC_ARG_WITH([rootfs-path],
[AC_HELP_STRING(
[--with-rootfs-path=dir],
[lxc rootfs mount point]
- )], [], [with_rootfs_path="${libdir}/lxc/rootfs"])
+ )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date)")
-AS_AC_EXPAND(LXCPATH, "${with_config_path}")
-AS_AC_EXPAND(LXCROOTFSMOUNT, "${with_rootfs_path}")
-AS_AC_EXPAND(LXCINITDIR, $libdir/lxc)
-AS_AC_EXPAND(LXCTEMPLATEDIR, $libdir/lxc/templates)
-AH_TEMPLATE([LXCPATH], [lxc configuration repository])
-AH_TEMPLATE([LXCINITDIR], [lxc-init directory location])
-AH_TEMPLATE([LXCROOTFSMOUNT], [lxc default rootfs mount point])
-AC_DEFINE_UNQUOTED(LXCPATH, "$LXCPATH")
-AC_DEFINE_UNQUOTED(LXCINITDIR, "$LXCINITDIR")
-AC_DEFINE_UNQUOTED(LXCROOTFSMOUNT, "$LXCROOTFSMOUNT")
+AC_SUBST(LXCPATH, "${with_config_path}")
+AC_SUBST(LXCROOTFSMOUNT, "${with_rootfs_path}")
+AC_SUBST(LXCINITDIR, ['${libdir}/lxc'])
+AC_SUBST(LXCTEMPLATEDIR, ['${libdir}/lxc/templates'])
AC_CHECK_HEADERS([linux/netlink.h linux/genetlink.h],
[],
diff --git a/lxc.pc.in b/lxc.pc.in
index b99354b..ac5ce09 100644
--- a/lxc.pc.in
+++ b/lxc.pc.in
@@ -1,6 +1,6 @@
bindir=@BINDIR@
libdir=@LIBDIR@
-localstatedir=@LXCPATH@
+localstatedir=@LOCALSTATEDIR@
includedir=@INCLUDEDIR@
rootfsmountdir=@LXCROOTFSMOUNT@
diff --git a/lxc.spec.in b/lxc.spec.in
index f22cd06..d0bb7a1 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -44,6 +44,13 @@ or the freeze of the container. This package is useful to create
Virtual Private Server, or to run isolated applications like bash or
sshd.
+%package libs
+Summary: runtime library files for %{name}
+Group: System Environment/Libraries
+
+%description libs
+The %{name}-libs package contains libraries for running %{name} applications.
+
%package devel
Release: 1
Summary: development library for %{name}
@@ -57,7 +64,7 @@ development of the linux containers.
%setup
%build
test "%{ksrc}" != "none" && args="--with-linuxdir=%{ksrc}"
-PATH=$PATH:/usr/sbin:/sbin %configure $args
+PATH=$PATH:/usr/sbin:/sbin %configure $args --disable-rpath
make %{?_smp_mflags}
%install
@@ -72,9 +79,6 @@ rm -rf %{buildroot}
%files
%defattr(-,root,root)
-%{_libdir}/*.so*
-%{_libdir}/%{name}
-%attr(4555,root,root) %{_libdir}/%{name}/lxc-init
%{_bindir}/*
%attr(4111,root,root) %{_bindir}/lxc-attach
%attr(4111,root,root) %{_bindir}/lxc-create
@@ -86,20 +90,28 @@ rm -rf %{buildroot}
%attr(4111,root,root) %{_bindir}/lxc-checkpoint
%attr(4111,root,root) %{_bindir}/lxc-restart
%{_mandir}/*
-%{_datadir}/pkgconfig/*
%{_datadir}/doc/*
+%files libs
+%defattr(-,root,root)
+%{_libdir}/*.so.*
+%{_libdir}/%{name}
+%attr(4555,root,root) %{_libdir}/%{name}/lxc-init
+
%files devel
%defattr(-,root,root)
%{_includedir}/%{name}/*
-%{_libdir}/*.so.*
+%{_libdir}/*.so
+%{_datadir}/pkgconfig/*
%changelog
+* Thu Sep 8 2011 Greg Kurz <gkurz at fr.ibm.com> - Version 0.7.5.1
+- fix installed files for rpmbuild
+- introduce lxc-libs package
* Fri Jul 23 2010 Daniel Lezcano <dlezcano at fr.ibm.com> - Version 0.7.2
- set attribute for installed files
- fix libraries installation
--
* Mon Mar 24 2009 Daniel Lezcano <daniel.lezcano at free.fr> - Version 0.6.1
- Removed capability setting, let the user to do that through "lxc-setcap"
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 1dfca00..d2c4720 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -51,7 +51,10 @@ liblxc_so_SOURCES = \
\
utmp.c utmp.h
-AM_CFLAGS=-I$(top_srcdir)/src
+AM_CFLAGS=-I$(top_srcdir)/src \
+ -DLXCROOTFSMOUNT=\"$(LXCROOTFSMOUNT)\" \
+ -DLXCPATH=\"$(LXCPATH)\" \
+ -DLXCINITDIR=\"$(LXCINITDIR)\"
liblxc_so_CFLAGS = -fPIC -DPIC $(AM_CFLAGS)
@@ -93,7 +96,10 @@ bin_PROGRAMS = \
pkglib_PROGRAMS = \
lxc-init
-AM_LDFLAGS=-Wl,-E -Wl,-rpath -Wl,$(libdir)
+AM_LDFLAGS = -Wl,-E
+if ENABLE_RPATH
+AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
+endif
LDADD=liblxc.so @CAP_LIBS@
lxc_attach_SOURCES = lxc_attach.c
More information about the lxc-devel
mailing list