[PATCH 2/2] Add files for performing automated builds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]