[PATCH 2/3] Add automated build control script

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

 



Provide a script for performing automated builds

* autobuild.sh: Automated build control script
* docs/Makefile.am: Remove unused todo.html stuff and allow
  customization of HTML install dir
* php-libvirt.spec: Fix URLs, source dir name & configure
  invocation. Don't try to install non-existant docs
* src/Makefile.am: Use $DESTDIR in install rules. Avoid
  rule named 'compile' since that clashes with a automake
  object. Add source files to EXTRA_DIST
* configure.ac: Add customization of HTML install dir
---
 autobuild.sh     |   35 +++++++++++++++++++++++++++++++++++
 configure.ac     |   11 +++++++++++
 docs/Makefile.am |   31 +++++++------------------------
 php-libvirt.spec |   25 +++++++++----------------
 src/Makefile.am  |   16 ++++++++++------
 5 files changed, 72 insertions(+), 46 deletions(-)
 create mode 100755 autobuild.sh

diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..5d059fc
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -e
+set -v
+
+make distclean || :
+
+aclocal
+autoreconf -i -f
+#phpize
+
+PHPEDIR=`php-config --extension-dir | sed -s "s,/usr,$AUTOBUILD_INSTALL_ROOT,"`
+
+./configure --prefix=$AUTOBUILD_INSTALL_ROOT
+
+make
+make install PHPEDIR=$PHPEDIR
+
+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 [ -x /usr/bin/rpmbuild ]
+then
+  rpmbuild --nodeps \
+     --define "extra_release $EXTRA_RELEASE" \
+     --define "_sourcedir `pwd`" \
+     -ba --clean php-libvirt.spec
+fi
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 9c198ef..3a0effa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,17 @@ AC_PATH_PROG([XSLTPROC], [xsltproc], [/usr/bin/xsltproc])
 AC_PATH_PROG([XMLLINT], [xmllint], [/usr/bin/xmllint])
 AC_PATH_PROG([XMLCATALOG], [xmlcatalog], [/usr/bin/xmlcatalog])
 
+dnl Specific dir for HTML output ?
+AC_ARG_WITH([html-dir], [AC_HELP_STRING([--with-html-dir=path],
+            [path to base html directory, default $datadir/doc/html])],
+            [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
+
+AC_ARG_WITH([html-subdir], [AC_HELP_STRING([--with-html-subdir=path],
+            [directory used under html-dir, default $PACKAGE-$VERSION/html])],
+            [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
+            [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
+AC_SUBST([HTML_DIR])
+
 AC_PATH_PROG([PHPIZE], [phpize], [no])
 if test "x$PHPIZE" = "xno"; then
     AC_MSG_ERROR([phpize not found; please install the PHP SDK])
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ea37f10..5831143 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -13,14 +13,13 @@ png = \
   graphics/libvirt-header-bg.png \
   graphics/libvirt-php-header-logo.png
 
-dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in
+dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in))
 dot_html = $(dot_html_in:%.html.in=%.html)
 
 EXTRA_DIST=					\
-  site.xsl newapi.xsl news.xsl page.xsl \
+  site.xsl news.xsl page.xsl \
   $(dot_html) $(dot_html_in) $(png) $(css) \
-  sitemap.html.in \
-  todo.pl todo.cfg-example
+  sitemap.html.in
 
 MAINTAINERCLEANFILES = $(dot_html)
 
@@ -28,22 +27,6 @@ all-am: web
 
 web: $(dot_html)
 
-todo.html.in: todo.pl
-	if [ -f  todo.cfg ]; then \
-		echo "Generating $@"; \
-		$(PERL) $(srcdir)/$< > $@ \
-		|| { rm $@ && exit 1; }; \
-	else \
-		echo "Stubbing $@"; \
-		echo "<html><body><h1>Todo list</h1></body></html>" > $@ ; \
-	fi
-
-todo:
-	rm -f todo.html.in
-	$(MAKE) todo.html
-
-.PHONY: todo
-
 %.png: %.fig
 	convert -rotate 90 $< $@
 
@@ -75,12 +58,12 @@ maintainer-clean-local: clean-local
 rebuild: all
 
 install-data-local:
-	$(mkinstalldirs) $(pkgdatadir)
+	$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
 	for f in $(css) $(dot_html) $(png); do \
-	  $(INSTALL) -m 0644 $(srcdir)/$$f $(pkgdatadir); \
+	  $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); \
 	done
 
 uninstall-local:
-	for f in $(css) $(dot_html) $($png); do \
-	  rm -f $(pkgdatadir)/$$(basename $$f); \
+	for f in $(css) $(dot_html) $(png); do \
+	  rm -f $(DESTDIR)$(HTML_DIR)/$$(basename $$f); \
 	done
diff --git a/php-libvirt.spec b/php-libvirt.spec
index ca36e7f..b7bc92d 100644
--- a/php-libvirt.spec
+++ b/php-libvirt.spec
@@ -1,11 +1,11 @@
 Name:		php-libvirt
 Version:	0.4
-Release:	1%{?dist}
+Release:	1%{?dist}%{?extra_release}
 Summary:	PHP language binding for Libvirt
 Group:		Development/Libraries
 License:	PHP
-URL:		http://phplibvirt.cybersales.cz/
-Source0:	http://phplibvirt.cybersales.cz/php-libvirt-%{version}.tar.gz
+URL:		http://libvirt.org/
+Source0:	http://libvirt.org/sources/libvirt-php-%{version}.tar.gz
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:	php-devel
@@ -21,30 +21,23 @@ PHP language bindings for Libvirt API.
 For more details see: http://phplibvirt.cybersales.cz/ http://www.libvirt.org/ http://www.php.net/
 
 %prep
-%setup -q -n php-libvirt-%{version}
-phpize
+%setup -q -n libvirt-php-%{version}
 
 %build
-%configure
-./configure --enable-libvirt
+%configure --with-html-dir=%{_datadir}/doc --with-html-subdir=%{name}-%{version}/html
 make %{?_smp_mflags}
 
 %install
 rm -rf %{buildroot}
-make install DESTDIR=%{buildroot} INSTALL_ROOT=%{buildroot}
-mkdir -p "%{buildroot}%{_defaultdocdir}/php-libvirt/"
-cp -r doc "%{buildroot}%{_defaultdocdir}/php-libvirt/"
-mkdir -p "%{buildroot}%{_sysconfdir}/php.d/"
-echo -e "; Enable libvirt extension module\nextension=libvirt.so" > "%{buildroot}%{_sysconfdir}/php.d/libvirt.ini"
+make install DESTDIR=%{buildroot}
 
 %clean
 rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root,-)
-%{_libdir}/php/modules/libvirt.so
-%{_sysconfdir}/php.d/libvirt.ini
-%doc
-%{_defaultdocdir}/php-libvirt/
+%{_libdir}/php/modules/libvirt-php.so
+%{_sysconfdir}/php.d/libvirt-php.ini
+%doc %{_datadir}/doc/%{name}-%{version}/html
 
 %changelog
diff --git a/src/Makefile.am b/src/Makefile.am
index fc6e635..206fa68 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,20 +8,24 @@ PHPEDIR=`php-config --extension-dir`
 XMLCFLAGS=`pkg-config libxml-2.0 --cflags`
 XMLLIBS=`pkg-config libxml-2.0 --libs`
 
-all: compile clean-temp
+EXTRA_DIST = libvirt.c php_libvirt.h
 
-compile:
+all: build clean-temp
+
+build:
 	$(CC) -fpic -DCOMPILE_DL_LIBVIRT=1 $(PHPINC) -c -o $(NAME).o libvirt.c $(XMLCFLAGS)
 	$(CC) -shared $(LIBS) -rdynamic -o $(NAME).so $(NAME).o -ldl -lvirt $(XMLLIBS)
 	$(ECHO) "Extension compiled as $(NAME).so"
 
 install-exec-local:
-	$(CP) $(NAME).so $(PHPEDIR)
-	$(ECHO) "extension=$(NAME)" > /etc/php.d/libvirt-php.ini
+	mkdir -p $(DESTDIR)$(PHPEDIR)
+	$(CP) $(NAME).so $(DESTDIR)$(PHPEDIR)
+	mkdir -p $(DESTDIR)$(sysconfdir)/php.d
+	$(ECHO) "extension=$(NAME)" > $(DESTDIR)$(sysconfdir)/php.d/libvirt-php.ini
 
 uninstall-local:
-	$(RM) -f /etc/php.d/$(NAME).ini
-	$(RM) -f $(PHPEDIR)/$(NAME).so
+	$(RM) -f $(sysconfdir)/php.d/$(NAME).ini
+	$(RM) -f $(DESTDIR)$(PHPEDIR)/$(NAME).so
 
 clean-temp:
 	$(RM) -f *.o
-- 
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]