rework build to not distribute tests unless --enable-devel is specificied to autoconf

This commit is contained in:
Lee Thompson committed 2013-02-03 14:49:03 -06:00
1 parent d8a072ca01
commit 43fd939f16
4 files changed
+69 -34

No files matched your search

+31 -12
View File
@@ -44,10 +44,14 @@ JQ_SRC = \
jv_aux.c \ jv_aux.c \
jv_alloc.c \ jv_alloc.c \
lexer.c \ lexer.c \
$(JQ_INCS) ${JQ_INCS}
if DEVCFLAGS_ENABLED if DEVELOPMENT_ENABLED
DEVCFLAGS = -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function DEVCFLAGS = -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function -O0 -DJQ_DEBUG=1
RPMBINS = jq jq_test
else
DEVCFLAGS = -DJQ_DEBUG=0
RPMBINS = jq
endif endif
# Tell YACC (bison) autoconf macros that you want a header file created. # Tell YACC (bison) autoconf macros that you want a header file created.
@@ -55,15 +59,31 @@ endif
# OSX ships an old bison, so update with homebrew or macports # OSX ships an old bison, so update with homebrew or macports
AM_YFLAGS = --warnings=all -d AM_YFLAGS = --warnings=all -d
bin_PROGRAMS = jq jq_test bin_PROGRAMS = jq
BUILT_SOURCES = jv_utf8_tables.gen.h lexer.h lexer.c BUILT_SOURCES = jv_utf8_tables.gen.h lexer.h lexer.c
jq_SOURCES = $(JQ_SRC) main.c jq_SOURCES = ${JQ_SRC} main.c
jq_CPPFLAGS = $(DEVCFLAGS) -O -DJQ_DEBUG=0 jq_CPPFLAGS = ${DEVCFLAGS}
# always test, but conditionally distribute to /usr/libexec/jq/jq_test
if DEVELOPMENT_ENABLED
pkglibexec_PROGRAMS = jq_test
# automake doesn't like putting data in libexec (pkglibexec_DATA)
# so we'll create our own macro and distribute testdata
mydatadir = ${libexecdir}/${PACKAGE}
mydata_DATA = testdata
DEVBUILD=yes
else
noinst_PROGRAMS = jq_test
DEVBUILD=no
endif
jq_test_SOURCES = ${JQ_SRC} jq_test.c
jq_test_CPPFLAGS = ${DEVCFLAGS}
# this is what gets "make check" to work
TESTS = jq_test TESTS = jq_test
jq_test_SOURCES = $(JQ_SRC) jq_test.c
jq_test_CPPFLAGS = $(DEVCFLAGS) -DJQ_DEBUG=1
LOG_COMPILER = valgrind LOG_COMPILER = valgrind
AM_LOG_FLAGS = --error-exitcode=1 -q --leak-check=full AM_LOG_FLAGS = --error-exitcode=1 -q --leak-check=full
@@ -93,15 +113,14 @@ main.c: config.h
releasetag: releasetag:
git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)" git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
# can probably delete and have RPM created off autoconf generated tarball releases
RELEASE ?= 1 RELEASE ?= 1
rpm: jq jq_test rpm: ${RPMBINS}
@echo "Packaging jq as an RPM ..." @echo "Packaging jq as an RPM ..."
mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS
cp jq-$$(cat VERSION).tar.gz rpm/SOURCES/ cp jq-$$(cat VERSION).tar.gz rpm/SOURCES/
rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "version $$(cat VERSION)" --define "release ${RELEASE}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $$(cat VERSION)" --define "myrel ${RELEASE}" --define "devbuild ${DEVBUILD}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz
find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \; find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;
rm -rf rpm rm -rf rpm
dist-clean-local: dist-clean-local:
rm -f $(BUILT_SOURCES) rm -f ${BUILT_SOURCES}
+10 -10
View File
@@ -22,16 +22,16 @@ dnl developers like them by default but the packager can disable if so
dnl desired. This is useful if something other than gcc is needed or dnl desired. This is useful if something other than gcc is needed or
dnl for distros that need to heavily tweek the compiler (gentoo, ARM cpu dnl for distros that need to heavily tweek the compiler (gentoo, ARM cpu
dnl linux's, etc) dnl linux's, etc)
AC_ARG_ENABLE([devcflags], AC_ARG_ENABLE(
[AC_HELP_STRING([--enable-devcflags=@<:@yes/no@:>@], [devel],
[Enable the same CFLAGS used by jq developers @<:@default=yes@:>@])], [AC_HELP_STRING(
[enable_devcflags=$enableval], [--enable-devel],
[enable_devcflags=yes]) [Build the tests and enable the same CFLAGS used by jq developers @<:@default=no@:>@])],
AC_MSG_RESULT($enable_devcflags) [],
dnl AM_CONDITIONAL(DEVCFLAGS, test x$enable_devcflags = xyes) [enable_devel=no]
if test "$enable_devcflags" = "yes"; then )
AM_CONDITIONAL(DEVCFLAGS_ENABLED, true) AC_MSG_RESULT($enable_devel)
fi AM_CONDITIONAL([DEVELOPMENT_ENABLED], [test x$enable_devel = xyes])
dnl dnl
dnl these program checks should probably be deleted dnl these program checks should probably be deleted
+20 -11
View File
@@ -2,9 +2,9 @@
# Your OS of choice will likely ignore this RPM spec file. # Your OS of choice will likely ignore this RPM spec file.
Summary: Command-line JSON processor Summary: Command-line JSON processor
Name: jq Name: jq
Version: %{version} Version: %{myver}
Release: %{release} Release: %{myrel}%{?dist}
Source0: jq-%{version}.tar.gz Source0: jq-%{myver}.tar.gz
URL: https://github.com/stedolan/jq URL: https://github.com/stedolan/jq
License: BSD License: BSD
AutoReqProv: no AutoReqProv: no
@@ -18,16 +18,22 @@ Group: Applications/System
%global debug_package %{nil} %global debug_package %{nil}
%global __os_install_post %{nil} %global __os_install_post %{nil}
# Crank up the compression
%define _binary_payload w7.lzdio
%description %description
jq is a command-line JSON processor jq is a command-line JSON processor
%prep %prep
%setup %setup
%build %build
echo "Building in: \"$(pwd)\"" echo "Building in: \"$(pwd)\""
%if "%{devbuild}" == "yes"
./configure --prefix=%{_prefix} --enable-devel
%else
./configure --prefix=%{_prefix} ./configure --prefix=%{_prefix}
%endif
make make
%install %install
@@ -40,13 +46,16 @@ rm -rf %{buildroot}
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%{_bindir}/jq %{_bindir}/jq
%{_bindir}/jq_test %if "%{devbuild}" == "yes"
%{_datadir}/doc/jq/AUTHORS %{_libexecdir}/%{name}/jq_test
%{_datadir}/doc/jq/COPYING %{_libexecdir}/%{name}/testdata
%{_datadir}/doc/jq/INSTALL %endif
%{_datadir}/doc/jq/NEWS %{_datadir}/doc/%{name}/AUTHORS
%{_datadir}/doc/jq/README %{_datadir}/doc/%{name}/COPYING
%{_datadir}/doc/jq/README.md %{_datadir}/doc/%{name}/INSTALL
%{_datadir}/doc/%{name}/NEWS
%{_datadir}/doc/%{name}/README
%{_datadir}/doc/%{name}/README.md
%changelog %changelog
+8 -1
View File
@@ -1,12 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# RUN ME after pulling the code from git! # RUN ME after pulling the code from git!
#
# This script is handy after pulling the code out of git without having
# to remember all the typing needed to build up and tear down all the
# crap that autotools puts in your source repo. The intent is to keep
# all generated files out of git.
if [ "clean" == "$1" ]; then if [ "clean" == "$1" ]; then
make distclean || echo "continuing..." make distclean || echo "continuing..."
rm -rf tmp autom4te.cache config rm -rf tmp autom4te.cache config
rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in ChangeLog rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in ChangeLog
rm -f jv_utf8_tables.gen.h lexer.c lexer.h parser.c parser.h rm -f jv_utf8_tables.gen.h lexer.c lexer.h parser.c parser.h
elif [ "superclean" == "$1" ]; then elif [ "superclean" == "$1" ]; then
# if autoconf errors during distcheck, it leaves files that need chmod'ing
ver=$(tr -d '\n' <VERSION) ver=$(tr -d '\n' <VERSION)
if [ "x${ver}" != "x" ]; then if [ "x${ver}" != "x" ]; then
if [ -d jq-${ver} ]; then if [ -d jq-${ver} ]; then
@@ -17,7 +24,7 @@ elif [ "superclean" == "$1" ]; then
fi fi
else else
autoreconf --install autoreconf --install
./configure --prefix=/opt/junk ./configure --enable-devel --prefix=/opt/junk
make check make check
mkdir tmp mkdir tmp
make DESTDIR=./tmp install make DESTDIR=./tmp install