--- /dev/null
+# For COPR builds directly from git.
+#
+# https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm
+#
+
+GITCOMMIT := $(shell git rev-parse HEAD)
+GITDESC := $(shell git describe --tags HEAD)
+GITDESC_WORDS := $(subst -, ,$(GITDESC))
+GITTAG := $(patsubst v%,%,$(word 1,$(GITDESC_WORDS)))
+GITCOUNT := $(word 2,$(GITDESC_WORDS))
+
+ifeq ($(GITCOUNT),)
+ISSNAP := 0
+TARNAME := $(GITTAG)
+TARPREFIX := $(GITTAG)
+else
+ISSNAP := 1
+TARNAME := $(shell echo $(GITCOMMIT) | cut -c1-7)
+TARPREFIX := $(GITCOMMIT)
+endif
+
+srpm: pidgin-chime.spec pidgin-chime-$(TARNAME).tar.gz
+ rpmbuild -bs pidgin-chime.spec --define "_sourcedir ." --define "_srcrpmdir $(outdir)"
+
+pidgin-chime.spec: ../pidgin-chime.spec.in Makefile
+ sed -e "s/@ISSNAP@/$(ISSNAP)/" \
+ -e "s/@VERSION@/$(GITTAG)/" \
+ -e "s/@SNAPCOMMIT@/$(GITCOMMIT)/" \
+ -e "s/@SNAPCOUNT@/$(GITCOUNT)/" \
+ $< > $@
+
+
+pidgin-chime-$(TARNAME).tar.gz Makefile:
+ cd .. && git archive --prefix=pidgin-chime-$(TARPREFIX)/ $(GITCOMMIT) -o .copr/$@
LINGUAS=`echo $RAWLINGUAS`
AC_SUBST(LINGUAS)
+if git diff --name-only --exit-code v${PACKAGE_VERSION} HEAD > /dev/null; then
+ gitdesc=$(git describe --tags HEAD)
+ AC_SUBST(SNAPCOUNT, $(echo "$gitdesc" | cut -f2 -d-))
+ AC_SUBST(SNAPCOMMIT, $(git rev-parse HEAD))
+ AC_SUBST(ISSNAP, 1)
+else
+ AC_SUBST(ISSNAP, 0)
+fi
+
AC_CONFIG_FILES([
Makefile
po/Makefile
fs-app-transmitter/Makefile
gst-chime/Makefile
chimeseen/Makefile
+ pidgin-chime.spec
])
AC_OUTPUT
-#global gitsnapshot 1
+%global gitsnapshot @ISSNAP@
%if 0%{?gitsnapshot}
%global snapcommit @SNAPCOMMIT@
%global snapcount @SNAPCOUNT@
%global snapver .git.%{snapcount}.%{shortcommit}
%endif
-%global tagver 0.9
+%global tagver @VERSION@
%bcond_without evolution # with
Name: pidgin-chime
Summary: libpurple / Pidgin protocol plugin for Amazon Chime
Version: %{tagver}%{?snapver}
-Release: 1%{?dist}
+Release: 0%{?dist}
Group: Applications/Communications
License: LGPLv2
URL: https://github.com/awslabs/%{name}
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
Source0: https://github.com/awslabs/%{name}/archive/%{snapcommit}/%{name}-%{shortcommit}.tar.gz
%else
Source0: %{name}-%{version}.tar.gz
%endif # with evolution
BuildRequires: gcc
BuildRequires: gettext
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
BuildRequires: libtool
BuildRequires: autoconf
BuildRequires: automake
%endif # with evolution
%prep
-%if 0%{?gitsnapshot:1}
+%if 0%{?gitsnapshot}
%setup -q -n %{name}-%{snapcommit}
NOCONFIGURE=x ./autogen.sh
%else
%setup -q
+if [ ! -x configure ]; then
+ NOCONFIGURE=x ./autogen.sh
+fi
%endif
%build