aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-08 04:44:43 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-03-08 04:44:43 +0100
commit3ca82ea98fc46e3365c514aa3398f54df91bf329 (patch)
tree0b12c50c17ecdb46d9f201218bbcd4d128665bfc
parent99661b01b0dbf6a0ccb34574f599992e714ac726 (diff)
downloadblogc-3ca82ea98fc46e3365c514aa3398f54df91bf329.tar.gz
blogc-3ca82ea98fc46e3365c514aa3398f54df91bf329.tar.bz2
blogc-3ca82ea98fc46e3365c514aa3398f54df91bf329.zip
build: added make rule to build srpm
-rw-r--r--.travis.yml4
-rw-r--r--Makefile.am10
-rw-r--r--blogc.spec.in4
-rw-r--r--configure.ac25
4 files changed, 41 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml
index 2788f8d..a32e4e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ addons:
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- libcmocka-dev
+ - rpm
- valgrind
compiler:
@@ -17,6 +18,7 @@ compiler:
env:
- TARGET=valgrind
- TARGET=distcheck
+ - TARGET=dist-srpm
- TARGET=w32
- TARGET=w64
@@ -26,6 +28,8 @@ matrix:
env: TARGET=w32
- compiler: clang
env: TARGET=w64
+ - compiler: clang
+ env: TARGET=dist-srpm
install: gem install ronn
diff --git a/Makefile.am b/Makefile.am
index cb91a50..1c5388d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,6 +314,16 @@ TESTS = \
$(check_PROGRAMS)
+## Helpers: dist-srpm
+if USE_RPMBUILD
+dist-srpm: blogc.spec dist-xz
+ $(RPMBUILD) \
+ --define "_srcrpmdir $(top_builddir)" \
+ --define "_sourcedir $(top_builddir)" \
+ -bs blogc.spec
+endif
+
+
## Helpers: git-version-gen
$(top_srcdir)/.version:
diff --git a/blogc.spec.in b/blogc.spec.in
index 1b10635..dc3983e 100644
--- a/blogc.spec.in
+++ b/blogc.spec.in
@@ -1,11 +1,11 @@
Name: @PACKAGE_NAME@
-Version: @PACKAGE_VERSION@
+Version: @RPM_VERSION@
Release: 1%{?dist}
License: BSD
Group: Applications/Text
Summary: A blog compiler
URL: @PACKAGE_URL@
-Source0: https://github.com/blogc/blogc/releases/download/v%{version}/blogc-%{version}.tar.xz
+Source0: https://github.com/blogc/blogc/releases/download/v@PACKAGE_VERSION@/blogc-@PACKAGE_VERSION@.tar.xz
BuildRequires: squareball-devel
diff --git a/configure.ac b/configure.ac
index 1fc00aa..ad759c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,30 @@ AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
PKG_PROG_PKG_CONFIG
+AC_PROG_SED
+
+RPM_VERSION=`echo ${PACKAGE_VERSION} | sed "s/-/./g"`
+AC_SUBST(RPM_VERSION)
+
+AC_ARG_ENABLE([rpmbuild], AS_HELP_STRING([--disable-rpmbuild],
+ [ignore presence of rpmbuild and disable srpm generation]))
+AS_IF([test "x$enable_rpmbuild" != "xno"], [
+ AC_PATH_PROG([rpmbuild], [rpmbuild])
+ AS_IF([test "x$ac_cv_path_rpmbuild" = "x"], [
+ have_rpmbuild=no
+ ], [
+ have_rpmbuild=yes
+ ])
+])
+AS_IF([test "x$have_rpmbuild" = "xyes"], , [
+ AS_IF([test "x$enable_rpmbuild" = "xyes"], [
+ AC_MSG_ERROR([rpmbuild requested but not found])
+ ])
+])
+AM_CONDITIONAL([USE_RPMBUILD], [test "x$ac_cv_path_rpmbuild" != "x"])
+RPMBUILD="$ac_cv_path_rpmbuild"
+AC_SUBST(RPMBUILD)
+
AC_ARG_ENABLE([ronn], AS_HELP_STRING([--disable-ronn],
[ignore presence of ronn and disable man pages generation]))
AS_IF([test "x$enable_ronn" != "xno"], [
@@ -145,4 +169,5 @@ AS_ECHO("
ronn: ${RONN}
valgrind: ${VALGRIND}
+ rpmbuild: ${RPMBUILD}
")