summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2009-06-02 14:31:21 -0500
committerDavid Teigland <teigland@redhat.com>2009-06-02 14:33:05 -0500
commitdf2f314bdd152fa6622a7374b2ee2366e83655e7 (patch)
treec43c46f5c1ce9c923f70d8a59c9aecdba4a73945
parentde35a795c61d339211f00119127a8e31fdab6fc8 (diff)
downloaddct-stuff-df2f314bdd152fa6622a7374b2ee2366e83655e7.tar.gz
dct-stuff-df2f314bdd152fa6622a7374b2ee2366e83655e7.tar.xz
dct-stuff-df2f314bdd152fa6622a7374b2ee2366e83655e7.zip
cpgx: version and build stuff
copying various build-related stuff from Nate, http://fedorapeople.org/gitweb?p=nstraz/public_git/gxpp.git Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--cpgx/Makefile29
-rw-r--r--cpgx/VERSION1
-rw-r--r--cpgx/cpgx.c7
-rw-r--r--cpgx/cpgx.spec40
4 files changed, 74 insertions, 3 deletions
diff --git a/cpgx/Makefile b/cpgx/Makefile
index 6a13264..ecca21a 100644
--- a/cpgx/Makefile
+++ b/cpgx/Makefile
@@ -12,6 +12,9 @@ LDFLAGS := -L/usr/lib/openais
endif
endif
+VER=$(shell cat VERSION)
+CFLAGS += -DVERSION=\"$(VER)\"
+
all: cpgx
cpgx: cpgx.o
@@ -24,6 +27,28 @@ clean:
rm -f *.o cpgx
install: all
- install cpgx /usr/bin
-
+ install cpgx $(DESTDIR)/usr/bin
+
+VERSION := $(shell cat VERSION)
+
+ifdef DIST
+ RPMDEFS := -D "dist $(DIST)"
+endif
+
+tarfiles := cpgx.c list.h cpgx.spec Makefile VERSION
+tarball := cpgx-$(VERSION).tar.gz
+
+# requires git tag of the release be made first,
+# e.g. git tag -a cpgx-v1.0 -m "release 1.0"
+
+$(tarball): $(tarfiles)
+ -$(RM) $@
+ git archive --format=tar --prefix=cpgx-$(VERSION)/ cpgx-v$(VERSION) | gzip > $@
+
+tarball: $(tarball)
+
+rpm: $(tarball) $(tarfiles)
+ rpmbuild -ta $< $(RPMDEFS)
+srpm: $(tarball) $(tarfiles)
+ rpmbuild -ts $< $(RPMDEFS)
diff --git a/cpgx/VERSION b/cpgx/VERSION
new file mode 100644
index 0000000..48194c8
--- /dev/null
+++ b/cpgx/VERSION
@@ -0,0 +1 @@
+0.1-git
diff --git a/cpgx/cpgx.c b/cpgx/cpgx.c
index 7d49ce5..6bdfa14 100644
--- a/cpgx/cpgx.c
+++ b/cpgx/cpgx.c
@@ -1619,6 +1619,7 @@ void print_usage(void)
printf(" -t <sec> timeout after no dispatch for this many seconds, default 0 (never)\n");
printf(" -i <sec> run for this many seconds, default 0 (forever)\n");
printf(" -c continue after error\n");
+ printf(" -V print version\n");
printf("\n");
printf("Output:\n");
printf(" <time> ERROR: <error string> (stderr)\n");
@@ -1640,7 +1641,7 @@ int main(int argc, char **argv)
int optchar;
while (cont) {
- optchar = getopt(argc, argv, "H:D:l:e:d:s:t:i:ch");
+ optchar = getopt(argc, argv, "H:D:l:e:d:s:t:i:chV");
switch (optchar) {
case 'H':
@@ -1683,6 +1684,10 @@ int main(int argc, char **argv)
print_usage();
exit(EXIT_SUCCESS);
+ case 'V':
+ printf("cpgx version %s\n", VERSION);
+ exit(EXIT_SUCCESS);
+
case EOF:
cont = 0;
break;
diff --git a/cpgx/cpgx.spec b/cpgx/cpgx.spec
new file mode 100644
index 0000000..a3c7749
--- /dev/null
+++ b/cpgx/cpgx.spec
@@ -0,0 +1,40 @@
+Name: cpgx
+Version: 1.0
+Release: 1%{?dist}
+Summary: corosync cpg test
+
+Group: QA
+License: GPL
+Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+Source0: cpgx-%{version}.tar.gz
+BuildRequires: corosync-devel
+
+
+%description
+This program tests the virtual synchrony guarantees of corosync and cpg.
+
+%prep
+%setup -q
+
+
+%build
+make
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+/usr/bin/cpgx
+
+
+%changelog
+* Tues Jun 02 2009 David Teigland <teigland@redhat.com> 1.0-1
+- Initial packaging