Hi Jim,
thanks for the input.. patch take2 in attachment should address all your
bits.
Fabio
On Thu, 2009-06-25 at 14:04 +0200, Jim Meyering wrote:
> Fabio M. Di Nitto wrote:
> > Howto:
> >
> > svn co...
> > ./autogen.sh
> > ./configure
> > make rpm or make srpm
> >
> > The resulting srpm can be built _without_ autotools installed
> > and the resulting rpm is equivalent of the one you would get from Fedora
> > rawhide.
>
> I know what you mean, but just to clarify:
> - building (i.e., creating) the srpm requires autoconf and automake.
> - building *from* the srpm (as from any distribution tarball) does not.
>
> ...
> > Index: Makefile.am
> > ===================================================================
> ...
> > clean-generic:
> > - rm -rf doc/api
> > + rm -rf doc/api $(SPEC) $(TARFILE) *.rpm .build-*
>
> Please don't remove names via wildcards like that.
> I might have a directory named PRECIOUS_IMPORTANT.rpm.build-DO_NOT_DELETE.
>
> > +## make rpm/srpm section.
> > +
> > +$(SPEC): $(SPEC).in
> > + LC_ALL=C date="$(shell date "+%a %b %d %Y")" && \
> > + alphatag="$(shell svnversion)" && \
> > + cat $^ | sed \
> > + -e "s...@alphatag@#r$$alphatag#g" \
> > + -e "s...@version@#$(VERSION)#g" \
> > + -e "s...@date@#$$date#g" \
> > + > $@
>
> You can save a process, i.e., remove the cat:
> (also,
> - using $< is slightly more precise than $^
> - don't "redirect directly to target" (for why, search for that phrase)
> - make the generated file read-only (i.e., harder to accidentally modify)
>
> sed \
> -e "s...@alphatag@#r$$alphatag#g" \
> -e "s...@version@#$(VERSION)#g" \
> -e "s...@date@#$$date#g" \
> $< > $...@-t
> chmod a-w $...@-t
> mv $...@-t $@
>
> > +srpm: clean $(SPEC) $(TARFILE)
> > + rpmbuild \
> > + $(RPMBUILDOPTS) \
> > + --nodeps -bs $(SPEC)
>
> These (above and below) don't do what you want when built with -jN.
> I.e., they'll run the clean rule and the ones to create
> $(SPEC) and $(TARFILE) in parallel.
>
> You can use this in place of the above.
>
> srpm: clean
> $(MAKE) $(SPEC) $(TARFILE)
> rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
>
>
> > +rpm: clean $(SPEC) $(TARFILE)
> > + rpmbuild \
> > + $(RPMBUILDOPTS) \
> > + -ba $(SPEC) 2>&1 | \
> > + tee .build-$(VERSION).log
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
Index: corosync.spec.in
===================================================================
--- corosync.spec.in (revision 0)
+++ corosync.spec.in (revision 0)
@@ -0,0 +1,205 @@
+%define alphatag @alphatag@
+
+Name: corosync
+Summary: The Corosync Cluster Engine and Application Programming Interfaces
+Version: @version@
+Release: 1%{?alphatag:.%{alphatag}}%{?dist}
+License: BSD
+Group: System Environment/Base
+URL: http://www.openais.org
+Source0: http://developer.osdl.org/dev/openais/downloads/corosync-%{version}/corosync-%{version}.tar.gz
+
+# Runtime bits
+Requires: corosynclib = %{version}-%{release}
+Requires(pre): /usr/sbin/useradd
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Conflicts: openais <= 0.89, openais-devel <= 0.89
+
+%define buildtrunk 0
+%{?_with_buildtrunk: %define buildtrunk 1}
+
+%if %{buildtrunk}
+BuildRequires: autoconf automake
+%endif
+BuildRequires: nss-devel
+
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+%prep
+%setup -q -n corosync-%{version}
+
+%if %{buildtrunk}
+./autogen.sh
+%endif
+
+%{_configure} CFLAGS="$(echo '%{optflags}')" \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --libdir=%{_libdir}
+
+%build
+make %{_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+
+make install DESTDIR=%{buildroot}
+install -d %{buildroot}%{_initddir}
+install -m 755 init/redhat %{buildroot}%{_initddir}/corosync
+
+## tree fixup
+# drop static libs
+rm -f %{buildroot}%{_libdir}/*.a
+# drop docs and html docs for now
+rm -rf %{buildroot}%{_docdir}/*
+
+%clean
+rm -rf %{buildroot}
+
+%description
+This package contains the Corosync Cluster Engine Executive, several default
+APIs and libraries, default configuration files, and an init script.
+
+%post
+/sbin/chkconfig --add corosync || :
+
+%preun
+if [ $1 -eq 0 ]; then
+ /sbin/service corosync stop &>/dev/null || :
+ /sbin/chkconfig --del corosync || :
+fi
+
+%postun
+[ "$1" -ge "1" ] && /sbin/service corosync condrestart &>/dev/null || :
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE SECURITY
+%{_sbindir}/corosync
+%{_sbindir}/corosync-keygen
+%{_sbindir}/corosync-objctl
+%{_sbindir}/corosync-cfgtool
+%{_sbindir}/corosync-fplay
+%{_sbindir}/corosync-pload
+%dir /etc/corosync
+%dir /etc/corosync/uidgid.d
+%config(noreplace) /etc/corosync/corosync.conf.example
+%{_initddir}/corosync
+%dir %{_libexecdir}/lcrso
+%{_libexecdir}/lcrso/coroparse.lcrso
+%{_libexecdir}/lcrso/objdb.lcrso
+%{_libexecdir}/lcrso/service_cfg.lcrso
+%{_libexecdir}/lcrso/service_cpg.lcrso
+%{_libexecdir}/lcrso/service_evs.lcrso
+%{_libexecdir}/lcrso/service_confdb.lcrso
+%{_libexecdir}/lcrso/service_pload.lcrso
+%{_libexecdir}/lcrso/quorum_votequorum.lcrso
+%{_libexecdir}/lcrso/quorum_testquorum.lcrso
+%{_libexecdir}/lcrso/vsf_quorum.lcrso
+%{_libexecdir}/lcrso/vsf_ykd.lcrso
+%{_mandir}/man8/corosync_overview.8*
+%{_mandir}/man8/corosync-objctl.8*
+%{_mandir}/man5/corosync.conf.5*
+
+%package -n corosynclib
+Summary: The Corosync Cluster Engine Libraries
+Group: System Environment/Libraries
+Conflicts: corosync < 0.92-7
+
+%description -n corosynclib
+This package contains corosync libraries.
+
+%files -n corosynclib
+%defattr(-,root,root,-)
+%doc LICENSE
+%{_libdir}/libcfg.so.*
+%{_libdir}/libcpg.so.*
+%{_libdir}/libconfdb.so.*
+%{_libdir}/libevs.so.*
+%{_libdir}/libtotem_pg.so.*
+%{_libdir}/liblogsys.so.*
+%{_libdir}/libcoroipcc.so.*
+%{_libdir}/libcoroipcs.so.*
+%{_libdir}/libquorum.so.*
+%{_libdir}/libvotequorum.so.*
+%{_libdir}/libpload.so.*
+
+%post -n corosynclib -p /sbin/ldconfig
+
+%postun -n corosynclib -p /sbin/ldconfig
+
+%package -n corosynclib-devel
+Summary: The Corosync Cluster Engine Development Kit
+Group: Development/Libraries
+Requires: corosynclib = %{version}-%{release}
+Requires: pkgconfig
+Provides: corosync-devel = %{version}
+Obsoletes: corosync-devel < 0.92-7
+
+%description -n corosynclib-devel
+This package contains include files and man pages used to develop using
+The Corosync Cluster Engine APIs.
+
+%files -n corosynclib-devel
+%defattr(-,root,root,-)
+%doc LICENSE README.devmap
+%dir %{_includedir}/corosync/
+%{_includedir}/corosync/cs_config.h
+%{_includedir}/corosync/corodefs.h
+%{_includedir}/corosync/coroipc_types.h
+%{_includedir}/corosync/coroipcs.h
+%{_includedir}/corosync/coroipcc.h
+%{_includedir}/corosync/cfg.h
+%{_includedir}/corosync/confdb.h
+%{_includedir}/corosync/corotypes.h
+%{_includedir}/corosync/cpg.h
+%{_includedir}/corosync/evs.h
+%{_includedir}/corosync/hdb.h
+%{_includedir}/corosync/list.h
+%{_includedir}/corosync/mar_gen.h
+%{_includedir}/corosync/swab.h
+%{_includedir}/corosync/quorum.h
+%{_includedir}/corosync/votequorum.h
+%dir %{_includedir}/corosync/totem/
+%{_includedir}/corosync/totem/coropoll.h
+%{_includedir}/corosync/totem/totem.h
+%{_includedir}/corosync/totem/totemip.h
+%{_includedir}/corosync/totem/totempg.h
+%dir %{_includedir}/corosync/lcr/
+%{_includedir}/corosync/lcr/lcr_ckpt.h
+%{_includedir}/corosync/lcr/lcr_comp.h
+%{_includedir}/corosync/lcr/lcr_ifact.h
+%dir %{_includedir}/corosync/engine
+%{_includedir}/corosync/engine/config.h
+%{_includedir}/corosync/engine/coroapi.h
+%{_includedir}/corosync/engine/logsys.h
+%{_includedir}/corosync/engine/objdb.h
+%{_includedir}/corosync/engine/quorum.h
+%{_libdir}/libcfg.so
+%{_libdir}/libcpg.so
+%{_libdir}/libconfdb.so
+%{_libdir}/libevs.so
+%{_libdir}/libtotem_pg.so
+%{_libdir}/liblogsys.so
+%{_libdir}/libcoroipcc.so
+%{_libdir}/libcoroipcs.so
+%{_libdir}/libquorum.so
+%{_libdir}/libvotequorum.so
+%{_libdir}/libpload.so
+%{_libdir}/pkgconfig/*.pc
+%{_mandir}/man3/cpg_*3*
+%{_mandir}/man3/evs_*3*
+%{_mandir}/man3/confdb_*3*
+%{_mandir}/man3/votequorum_*3*
+%{_mandir}/man8/cpg_overview.8*
+%{_mandir}/man8/evs_overview.8*
+%{_mandir}/man8/confdb_overview.8*
+%{_mandir}/man8/logsys_overview.8*
+%{_mandir}/man8/votequorum_overview.8*
+%{_mandir}/man8/coroipc_overview.8*
+
+%changelog
+* @date@ Autotools generated version <[email protected]> - @vers...@-1.@alphatag@
+- Autotools generated version
Index: configure.ac
===================================================================
--- configure.ac (revision 2292)
+++ configure.ac (working copy)
@@ -107,7 +107,6 @@
pthread_spin_unlock pthread_setschedparam \
sched_get_priority_max])
-# add man and init dirs?
AC_CONFIG_FILES([Makefile
exec/Makefile
include/Makefile
Index: Makefile.am
===================================================================
--- Makefile.am (revision 2292)
+++ Makefile.am (working copy)
@@ -29,10 +29,15 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
-EXTRA_DIST = autogen.sh conf/corosync.conf.example
+SPEC = $(PACKAGE_NAME).spec
+
+TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
+
+EXTRA_DIST = autogen.sh conf/corosync.conf.example $(SPEC).in
+
AUTOMAKE_OPTIONS = foreign
-MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
+MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
config.guess config.sub missing install-sh \
autoheader automake autoconf
@@ -63,7 +68,39 @@
mkdir -p doc/api && doxygen
dist-clean-local:
- rm -f autoconf automake autoheader $(TARFILE)
+ rm -f autoconf automake autoheader
clean-generic:
- rm -rf doc/api
+ rm -rf doc/api $(SPEC) $(TARFILE)
+
+## make rpm/srpm section.
+
+$(SPEC): $(SPEC).in
+ LC_ALL=C date="$(shell date "+%a %b %d %Y")" && \
+ alphatag="$(shell svnversion)" && \
+ sed \
+ -e "s...@alphatag@#r$$alphatag#g" \
+ -e "s...@version@#$(VERSION)#g" \
+ -e "s...@date@#$$date#g" \
+ $< > $...@-t
+ chmod a-w $...@-t
+ mv $...@-t $@
+
+$(TARFILE):
+ $(MAKE) dist
+
+RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
+ --define "_specdir $(abs_builddir)" \
+ --define "_builddir $(abs_builddir)" \
+ --define "_srcrpmdir $(abs_builddir)" \
+ --define "_rpmdir $(abs_builddir)"
+
+srpm: clean
+ $(MAKE) $(SPEC) $(TARFILE)
+ rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
+
+rpm: clean
+ $(MAKE) $(SPEC) $(TARFILE)
+ rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) 2>&1 | \
+ tee .build-$(VERSION).log
+
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais