From 3ca82ea98fc46e3365c514aa3398f54df91bf329 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 8 Mar 2016 04:44:43 +0100 Subject: build: added make rule to build srpm --- .travis.yml | 4 ++++ Makefile.am | 10 ++++++++++ blogc.spec.in | 4 ++-- configure.ac | 25 +++++++++++++++++++++++++ 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} ") -- cgit v1.2.3-18-g5258