mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Clean up autotools config.
Remove some of @stagrlee's hard work since jq's testsuite is less silly than when he wrote the autotools config.
This commit is contained in:
175
Makefile.am
175
Makefile.am
@@ -1,164 +1,83 @@
|
|||||||
# Converted to automake by thompson@dtosolutions.com 26NOV12
|
### C source files to be built
|
||||||
|
|
||||||
# setup is only used by distribution developers, not package developers.
|
JQ_INCS = jq_parser.h builtin.h bytecode.h compile.h execute.h \
|
||||||
# Still, as a matter of allowing patching, its not a bad idea to distribute
|
forkable_stack.h frame_layout.h jv.h jv_alloc.h jv_aux.h jv_dtoa.h \
|
||||||
# the developer setup script in the tarball.
|
jv_parse.h jv_unicode.h locfile.h opcode.h opcode_list.h parser.y \
|
||||||
EXTRA_DIST = \
|
jv_utf8_tables.h
|
||||||
setup.sh \
|
|
||||||
config.h.in \
|
|
||||||
ChangeLog \
|
|
||||||
VERSION \
|
|
||||||
lexer.l \
|
|
||||||
lexer.h \
|
|
||||||
gen_utf8_tables.py \
|
|
||||||
jq.spec \
|
|
||||||
testdata \
|
|
||||||
docs/content/1.tutorial/default.yml \
|
|
||||||
docs/content/2.download/default.yml \
|
|
||||||
docs/content/3.manual/manual.yml \
|
|
||||||
docs/content/index/index.yml \
|
|
||||||
docs/Gemfile \
|
|
||||||
docs/Gemfile.lock \
|
|
||||||
docs/public/.htaccess \
|
|
||||||
docs/public/bootstrap/css/bootstrap-responsive.css \
|
|
||||||
docs/public/bootstrap/css/bootstrap-responsive.min.css \
|
|
||||||
docs/public/bootstrap/css/bootstrap.css \
|
|
||||||
docs/public/bootstrap/css/bootstrap.min.css \
|
|
||||||
docs/public/bootstrap/img/glyphicons-halflings-white.png \
|
|
||||||
docs/public/bootstrap/img/glyphicons-halflings.png \
|
|
||||||
docs/public/bootstrap/js/bootstrap.js \
|
|
||||||
docs/public/bootstrap/js/bootstrap.min.js \
|
|
||||||
docs/public/css/base.scss \
|
|
||||||
docs/public/jq.png \
|
|
||||||
docs/public/robots.txt \
|
|
||||||
docs/Rakefile \
|
|
||||||
docs/site.yml \
|
|
||||||
docs/templates/default.liquid \
|
|
||||||
docs/templates/index.liquid \
|
|
||||||
docs/templates/manual.liquid \
|
|
||||||
docs/templates/shared/_footer.liquid \
|
|
||||||
docs/templates/shared/_head.liquid \
|
|
||||||
docs/templates/shared/_header.liquid
|
|
||||||
|
|
||||||
# README.md is expected in Github projects, good stuff in it, so we'll
|
JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c \
|
||||||
# distribute it and install it with the package in the doc directory.
|
jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_alloc.c \
|
||||||
docdir = ${datadir}/doc/${PACKAGE}
|
lexer.c jq_test.c ${JQ_INCS}
|
||||||
dist_doc_DATA = README.md INSTALL COPYING AUTHORS README NEWS
|
|
||||||
|
|
||||||
JQ_INCS = \
|
|
||||||
jq_parser.h \
|
|
||||||
builtin.h \
|
|
||||||
bytecode.h \
|
|
||||||
compile.h \
|
|
||||||
execute.h \
|
|
||||||
forkable_stack.h \
|
|
||||||
frame_layout.h \
|
|
||||||
jv.h \
|
|
||||||
jv_alloc.h \
|
|
||||||
jv_aux.h \
|
|
||||||
jv_dtoa.h \
|
|
||||||
jv_parse.h \
|
|
||||||
jv_unicode.h \
|
|
||||||
locfile.h \
|
|
||||||
opcode.h \
|
|
||||||
opcode_list.h \
|
|
||||||
parser.y \
|
|
||||||
jv_utf8_tables.gen.h
|
|
||||||
|
|
||||||
JQ_SRC = \
|
### C build options
|
||||||
opcode.c \
|
|
||||||
bytecode.c \
|
|
||||||
compile.c \
|
|
||||||
execute.c \
|
|
||||||
builtin.c \
|
|
||||||
jv.c \
|
|
||||||
jv_parse.c \
|
|
||||||
jv_print.c \
|
|
||||||
jv_dtoa.c \
|
|
||||||
jv_unicode.c \
|
|
||||||
jv_aux.c \
|
|
||||||
jv_alloc.c \
|
|
||||||
lexer.c \
|
|
||||||
${JQ_INCS}
|
|
||||||
|
|
||||||
if DEVELOPMENT_ENABLED
|
AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
|
||||||
DEVCFLAGS = -Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function -O0 -DJQ_DEBUG=1
|
-Wno-unused-parameter -Wno-unused-function
|
||||||
RPMBINS = jq jq_test
|
|
||||||
else
|
|
||||||
DEVCFLAGS = -DJQ_DEBUG=0
|
### Generating the lexer and parser
|
||||||
RPMBINS = jq
|
|
||||||
endif
|
# While there is some autoconf macro support for lex/flex, it doesn't support
|
||||||
|
# header file creation so we'll use good old make
|
||||||
|
BUILT_SOURCES = lexer.h lexer.c
|
||||||
|
lexer.c: lexer.l
|
||||||
|
flex -o lexer.c --header-file=lexer.h lexer.l
|
||||||
|
lexer.h: lexer.c
|
||||||
|
|
||||||
# Tell YACC (bison) autoconf macros that you want a header file created.
|
# Tell YACC (bison) autoconf macros that you want a header file created.
|
||||||
# If the --warnings=all fails, you probably have an old version of bison
|
# If the --warnings=all fails, you probably have an old version of bison
|
||||||
# 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Building the jq binary
|
||||||
|
|
||||||
|
main.c: config.h
|
||||||
|
|
||||||
bin_PROGRAMS = jq
|
bin_PROGRAMS = jq
|
||||||
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}
|
|
||||||
|
|
||||||
# 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
|
### Tests
|
||||||
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
|
# this is what gets "make check" to work
|
||||||
TESTS = jq_test
|
TESTS = tests/all.test
|
||||||
LOG_COMPILER = valgrind
|
TEST_LOG_COMPILER = tests/run
|
||||||
AM_LOG_FLAGS = --error-exitcode=1 -q --leak-check=full
|
|
||||||
|
|
||||||
|
|
||||||
|
### Packaging
|
||||||
|
|
||||||
|
# setup is only used by distribution developers, not package developers.
|
||||||
|
# Still, as a matter of allowing patching, its not a bad idea to distribute
|
||||||
|
# the developer setup script in the tarball.
|
||||||
|
EXTRA_DIST = setup.sh config.h.in ChangeLog VERSION lexer.l lexer.h \
|
||||||
|
gen_utf8_tables.py jq.spec testdata
|
||||||
|
|
||||||
|
# README.md is expected in Github projects, good stuff in it, so we'll
|
||||||
|
# distribute it and install it with the package in the doc directory.
|
||||||
|
docdir = ${datadir}/doc/${PACKAGE}
|
||||||
|
dist_doc_DATA = README.md INSTALL COPYING AUTHORS README NEWS
|
||||||
|
|
||||||
man_MANS = jq.1
|
man_MANS = jq.1
|
||||||
|
|
||||||
jq.1 :
|
jq.1 :
|
||||||
cd ${abs_srcdir}/docs; rake manpage > ${abs_builddir}/$@
|
cd ${abs_srcdir}/docs; rake manpage > ${abs_builddir}/$@
|
||||||
|
|
||||||
# nasty circular dependency on header files between the generated C files
|
|
||||||
parser.o: lexer.c
|
|
||||||
|
|
||||||
lexer.o: parcer.c
|
|
||||||
|
|
||||||
lexer.c: parser.h
|
|
||||||
|
|
||||||
# While there is some autoconf macro support for lex/flex, it doesn't support
|
|
||||||
# header file creation so we'll use good old make
|
|
||||||
lexer.c: lexer.l
|
|
||||||
flex -o lexer.c --header-file=lexer.h lexer.l
|
|
||||||
lexer.h: lexer.c
|
|
||||||
|
|
||||||
jv_utf8_tables.gen.h: gen_utf8_tables.py
|
|
||||||
python $^ > $@
|
|
||||||
|
|
||||||
jv_unicode.c: jv_utf8_tables.gen.h
|
|
||||||
|
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
git log --name-status > $@ || echo "no changelog" > $@
|
git log --name-status > $@ || echo "no changelog" > $@
|
||||||
|
|
||||||
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)"
|
||||||
|
|
||||||
RELEASE ?= 1
|
RELEASE ?= 1
|
||||||
rpm: ${RPMBINS}
|
rpm: jq
|
||||||
@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 "myver $$(cat VERSION)" --define "myrel ${RELEASE}" --define "devbuild ${DEVBUILD}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz
|
rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $$(cat VERSION)" --define "myrel ${RELEASE}" 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
|
||||||
|
|
||||||
|
32
configure.ac
32
configure.ac
@@ -16,33 +16,10 @@ AM_PROG_CC_C_O
|
|||||||
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
|
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
|
||||||
dnl AC_PROG_YACC macros...
|
dnl AC_PROG_YACC macros...
|
||||||
|
|
||||||
dnl CFLAGS is concidered a packagers variable, not a developer variable
|
|
||||||
dnl in Auto-tools. For developer ease of use, CFLAGS are set how the
|
|
||||||
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 for distros that need to heavily tweek the compiler (gentoo, ARM cpu
|
|
||||||
dnl linux's, etc)
|
|
||||||
AC_ARG_ENABLE(
|
|
||||||
[devel],
|
|
||||||
[AC_HELP_STRING(
|
|
||||||
[--enable-devel],
|
|
||||||
[Build the tests and enable the same CFLAGS used by jq developers @<:@default=no@:>@])],
|
|
||||||
[],
|
|
||||||
[enable_devel=no]
|
|
||||||
)
|
|
||||||
AC_MSG_RESULT($enable_devel)
|
|
||||||
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
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
dnl Check for sed
|
|
||||||
AC_CHECK_PROGS(regex_cmd, sed)
|
|
||||||
if test x$regex_cmd = "x" ; then
|
|
||||||
AC_MSG_NOTICE([sed is required to patch jq.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check for flex
|
dnl Check for flex
|
||||||
AC_CHECK_PROGS(flex_cmd, flex)
|
AC_CHECK_PROGS(flex_cmd, flex)
|
||||||
if test x$flex_cmd = "x" ; then
|
if test x$flex_cmd = "x" ; then
|
||||||
@@ -55,12 +32,6 @@ if test x$bison_cmd = "x" ; then
|
|||||||
AC_MSG_NOTICE([bison is required to patch jq.])
|
AC_MSG_NOTICE([bison is required to patch jq.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Check for python
|
|
||||||
AC_CHECK_PROGS(python_cmd, python)
|
|
||||||
if test x$python_cmd = "x" ; then
|
|
||||||
AC_MSG_NOTICE([python is required to patch jq.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check for valgrind
|
dnl Check for valgrind
|
||||||
AC_CHECK_PROGS(valgrind_cmd, valgrind)
|
AC_CHECK_PROGS(valgrind_cmd, valgrind)
|
||||||
if test x$valgrind_cmd = "x" ; then
|
if test x$valgrind_cmd = "x" ; then
|
||||||
@@ -72,3 +43,6 @@ AC_CONFIG_HEADERS(config.h)
|
|||||||
AM_INIT_AUTOMAKE([-Wall dist-bzip2 dist-zip])
|
AM_INIT_AUTOMAKE([-Wall dist-bzip2 dist-zip])
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
dnl FIXME should disable colour output on windows somehow
|
||||||
|
30
jq_test.c
30
jq_test.c
@@ -10,39 +10,11 @@ static void run_jq_tests();
|
|||||||
|
|
||||||
|
|
||||||
int jq_testsuite(int argc, char* argv[]) {
|
int jq_testsuite(int argc, char* argv[]) {
|
||||||
FILE* testdata;
|
|
||||||
jv_test();
|
jv_test();
|
||||||
if (argc == 1) {
|
run_jq_tests(stdin);
|
||||||
testdata = fopen("testdata", "r");
|
|
||||||
if ( NULL == testdata )
|
|
||||||
{
|
|
||||||
/* in an autoconf distcheck, the binary file will be in a _build subdirectory */
|
|
||||||
testdata = fopen("../testdata", "r");
|
|
||||||
if ( NULL == testdata )
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Could not find testdata file\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (argc == 2) {
|
|
||||||
if (!strcmp(argv[1], "-")) {
|
|
||||||
testdata = stdin;
|
|
||||||
} else {
|
|
||||||
testdata = fopen(argv[1], "r");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
printf("usage: %s OR cat testdata | %s - OR %s testdata\n", argv[0], argv[0], argv[0]);
|
|
||||||
return 127;
|
|
||||||
}
|
|
||||||
run_jq_tests(testdata);
|
|
||||||
if (testdata != stdin) fclose(testdata);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int skipline(const char* buf) {
|
static int skipline(const char* buf) {
|
||||||
int p = 0;
|
int p = 0;
|
||||||
while (buf[p] == ' ' || buf[p] == '\t') p++;
|
while (buf[p] == ' ' || buf[p] == '\t') p++;
|
||||||
|
2
setup.sh
2
setup.sh
@@ -24,7 +24,7 @@ elif [ "superclean" == "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
autoreconf --install
|
autoreconf --install
|
||||||
./configure --enable-devel --prefix=/opt/junk
|
./configure --prefix=/opt/junk
|
||||||
make check
|
make check
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
make DESTDIR=./tmp install
|
make DESTDIR=./tmp install
|
||||||
|
Reference in New Issue
Block a user