[libvirt] [PATCH 0/2] Setup libvirt OCAML bindings for automated builds

These two patches update the build system to work now we're using GIT instead of HG, and add the scripts + RPM spec to perform automated builds

* .hgignore: Delete, obsoleted by .gitignore * Makefile.am: Update dist-check to use GIT * MANIFEST: Replace .hgignore with .gitignore * config.h.in, libvirt/.depend, mlvirsh/.depend: Re-generate with newer toolchain --- .hgignore | 46 ---------------------------------------------- MANIFEST | 2 +- Makefile.in | 2 +- config.h.in | 3 +++ libvirt/.depend | 6 +++--- mlvirsh/.depend | 4 ++-- 6 files changed, 10 insertions(+), 53 deletions(-) delete mode 100644 .hgignore diff --git a/.hgignore b/.hgignore deleted file mode 100644 index f78c6f6..0000000 --- a/.hgignore +++ /dev/null @@ -1,46 +0,0 @@ -syntax: glob -META -ocaml-libvirt-*.tar.gz -ocaml-libvirt-*.exe -html -configure -config.log -config.status -config.h -config.cache -Makefile -Make.rules -*/Makefile -autom4te.cache -core -core.* -*.cmi -*.cmo -*.cmx -*.cma -*.cmxa -*.o -*.so -*.a -*.opt -*.dll -*.exe -*~ -libvirt/libvirt_version.ml -examples/list_domains -examples/node_info -mlvirsh/mlvirsh -virt-ctrl/virt-ctrl -virt-top/virt-top -virt-df/virt-df -wininstaller.nsis -*.orig -mlvirsh/mlvirsh_gettext.ml -virt-ctrl/virt_ctrl_gettext.ml -virt-df/virt_df_gettext.ml -virt-top/virt_top_gettext.ml -po/*.mo -po/*.po.bak -virt-df/virt_df_lvm2_lexer.ml -virt-df/virt_df_lvm2_parser.ml -virt-df/virt_df_lvm2_parser.mli \ No newline at end of file diff --git a/MANIFEST b/MANIFEST index 9106d17..fc82490 100644 --- a/MANIFEST +++ b/MANIFEST @@ -10,7 +10,7 @@ examples/.depend examples/list_domains.ml examples/node_info.ml examples/Makefile.in -.hgignore +.gitignore install-sh libvirt/.depend libvirt/generator.pl diff --git a/Makefile.in b/Makefile.in index e816d3b..c2e1f17 100644 --- a/Makefile.in +++ b/Makefile.in @@ -100,7 +100,7 @@ dist: ChangeLog ls -l $(PACKAGE)-$(VERSION).tar.gz check-manifest: - hg manifest | sort > .check-manifest; \ + git ls-tree -r HEAD | awk '{print $$4}' | sort > .check-manifest; \ sort MANIFEST > .orig-manifest; \ diff -u .orig-manifest .check-manifest; rv=$$?; \ rm -f .orig-manifest .check-manifest; \ diff --git a/config.h.in b/config.h.in index 50d3724..96054c1 100644 --- a/config.h.in +++ b/config.h.in @@ -209,6 +209,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION diff --git a/libvirt/.depend b/libvirt/.depend index ee5d514..af1ea85 100644 --- a/libvirt/.depend +++ b/libvirt/.depend @@ -1,6 +1,6 @@ -libvirt.cmi: libvirt_version.cmi: -libvirt.cmo: libvirt.cmi -libvirt.cmx: libvirt.cmi +libvirt.cmi: libvirt_version.cmo: libvirt_version.cmi libvirt_version.cmx: libvirt_version.cmi +libvirt.cmo: libvirt.cmi +libvirt.cmx: libvirt.cmi diff --git a/mlvirsh/.depend b/mlvirsh/.depend index 9026a04..1367ab8 100644 --- a/mlvirsh/.depend +++ b/mlvirsh/.depend @@ -1,4 +1,4 @@ -mlvirsh_gettext.cmo: -mlvirsh_gettext.cmx: mlvirsh.cmo: mlvirsh_gettext.cmo ../libvirt/libvirt.cmi mlvirsh.cmx: mlvirsh_gettext.cmx ../libvirt/libvirt.cmx +mlvirsh_gettext.cmo: +mlvirsh_gettext.cmx: -- 1.7.4

* MANIFEST: Include autogen.sh, autobuild.sh, ocaml-libvirt.spec * Makefile.in: Add EXTRA_DIST to list files which should be in tar.gz, but not committed in GIT * autogen.sh: Re-generate autotools files & run configure * autobuild.sh: Perform a fully automated build from source + RPM build * configure.ac: Generate ocaml-libvirt.spec * ocaml-libvirt.spec.in: Generic RPM specfile --- .gitignore | 1 + MANIFEST | 3 + Makefile.in | 2 +- autobuild.sh | 45 +++++++++++++++++ autogen.sh | 41 ++++++++++++++++ configure.ac | 1 + ocaml-libvirt.spec.in | 126 +++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 218 insertions(+), 1 deletions(-) create mode 100755 autobuild.sh create mode 100755 autogen.sh create mode 100644 ocaml-libvirt.spec.in diff --git a/.gitignore b/.gitignore index 25bceb8..30b240f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ META ocaml-libvirt-*.tar.gz ocaml-libvirt-*.exe +ocaml-libvirt.spec html configure config.log diff --git a/MANIFEST b/MANIFEST index fc82490..31e316f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,6 @@ aclocal.m4 +autobuild.sh +autogen.sh ChangeLog config.guess config.h.in @@ -31,6 +33,7 @@ META.in mlvirsh/.depend mlvirsh/Makefile.in mlvirsh/mlvirsh.ml +ocaml-libvirt.spec.in po/ja.po po/LINGUAS po/Makefile.in diff --git a/Makefile.in b/Makefile.in index c2e1f17..8df009d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,7 +93,7 @@ dist: ChangeLog $(MAKE) check-manifest rm -rf $(PACKAGE)-$(VERSION) mkdir $(PACKAGE)-$(VERSION) - tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf - + tar -cf - -T MANIFEST $(PACKAGE).spec | tar -C $(PACKAGE)-$(VERSION) -xf - $(INSTALL) -m 0755 configure $(PACKAGE)-$(VERSION)/ tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) rm -rf $(PACKAGE)-$(VERSION) diff --git a/autobuild.sh b/autobuild.sh new file mode 100755 index 0000000..de4505a --- /dev/null +++ b/autobuild.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e +set -v + +# Make things clean. + +test -n "$1" && RESULTS=$1 || RESULTS=results.log +: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder} + +test -f Makefile && make -k distclean || : + +./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" + +# If the MAKEFLAGS envvar does not yet include a -j option, +# add -jN where N depends on the number of processors. +case $MAKEFLAGS in + *-j*) ;; + *) n=$(getconf _NPROCESSORS_ONLN 2> /dev/null) + test "$n" -gt 0 || n=1 + n=$(expr $n + 1) + MAKEFLAGS="$MAKEFLAGS -j$n" + export MAKEFLAGS + ;; +esac + +make +make install + +rm -f *.tar.gz +make dist + +if [ -n "$AUTOBUILD_COUNTER" ]; then + EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" +else + NOW=`date +"%s"` + EXTRA_RELEASE=".$USER$NOW" +fi + +if [ -f /usr/bin/rpmbuild ]; then + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean ocaml-libvirt.spec +fi diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..3f646ba --- /dev/null +++ b/autogen.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +THEDIR=`pwd` +cd $srcdir +DIE=0 + + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile libvirt." + echo "Download the appropriate package for your distribution," + echo "or see http://www.gnu.org/software/autoconf" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "I am going to run ./configure with no arguments - if you wish " + echo "to pass any to it, please specify them on the $0 command line." +fi + +autoreconf -i -f + +cd $THEDIR + +if test x$OBJ_DIR != x; then + mkdir -p "$OBJ_DIR" + cd "$OBJ_DIR" +fi + +$srcdir/configure "$@" && { + echo + echo "Now type 'make' to compile ocaml-libvirt." +} diff --git a/configure.ac b/configure.ac index 8a3d8ad..e8286a1 100644 --- a/configure.ac +++ b/configure.ac @@ -306,6 +306,7 @@ dnl Produce output files. AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([META libvirt/libvirt_version.ml + ocaml-libvirt.spec Makefile Make.rules po/Makefile diff --git a/ocaml-libvirt.spec.in b/ocaml-libvirt.spec.in new file mode 100644 index 0000000..7ba91e6 --- /dev/null +++ b/ocaml-libvirt.spec.in @@ -0,0 +1,126 @@ +%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) +%define debug_package %{nil} + +# Select what subpackages to build. +%define build_mlvirsh 1 + +Name: ocaml-libvirt +Version: @PACKAGE_VERSION@ +Release: 1%{?dist}%{?extra_release} +Summary: OCaml binding for libvirt + +Group: Development/Libraries +License: LGPLv2+ +URL: http://libvirt.org/ocaml/ +Source0: http://libvirt.org/sources/ocaml/%{name}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +ExcludeArch: sparc64 s390 s390x + +BuildRequires: ocaml >= 3.10.0 +BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-findlib-devel + +BuildRequires: libvirt-devel >= 0.2.1 +BuildRequires: perl +BuildRequires: gawk + +%define _use_internal_dependency_generator 0 +%define __find_requires /usr/lib/rpm/ocaml-find-requires.sh +%define __find_provides /usr/lib/rpm/ocaml-find-provides.sh + +%description +OCaml binding for libvirt. + + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + + +%description devel +The %{name}-devel package contains libraries and signature files for +developing applications that use %{name}. + + +%if %build_mlvirsh +%package -n mlvirsh +Summary: OCaml virsh utility +Group: Applications/Emulators +License: GPLv2+ + + +%description -n mlvirsh +OCaml virtualization shell. +%endif + + +%prep +%setup -q + + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --libdir=%{_libdir} --prefix=%{_prefix} +make all doc +%if %opt +make opt +strip libvirt/dllmllibvirt.so +%endif + + +%install +# These rules work if the library uses 'ocamlfind install' to install itself. +rm -rf $RPM_BUILD_ROOT +export DESTDIR=$RPM_BUILD_ROOT +export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml +mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs +mkdir -p $RPM_BUILD_ROOT%{_bindir} +%if %opt +make install-opt +%else +make install-byte +%endif + +%if !%build_mlvirsh +rm -f $RPM_BUILD_ROOT%{_bindir}/mlvirsh +%endif + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc COPYING.LIB README ChangeLog +%{_libdir}/ocaml/libvirt +%if %opt +%exclude %{_libdir}/ocaml/libvirt/*.a +%exclude %{_libdir}/ocaml/libvirt/*.cmxa +%exclude %{_libdir}/ocaml/libvirt/*.cmx +%endif +%exclude %{_libdir}/ocaml/libvirt/*.mli +%{_libdir}/ocaml/stublibs/*.so +%{_libdir}/ocaml/stublibs/*.so.owner + + +%files devel +%defattr(-,root,root,-) +%doc COPYING.LIB README TODO.libvirt ChangeLog html/* +%if %opt +%{_libdir}/ocaml/libvirt/*.a +%{_libdir}/ocaml/libvirt/*.cmxa +%{_libdir}/ocaml/libvirt/*.cmx +%endif +%{_libdir}/ocaml/libvirt/*.mli + + +%if %build_mlvirsh +%files -n mlvirsh +%defattr(-,root,root,-) +%doc COPYING README ChangeLog +%{_bindir}/mlvirsh +%endif + + +%changelog -- 1.7.4
participants (1)
-
Daniel P. Berrange