Merge remote-tracking branch 'stagrlee/master' into autotools
Conflicts: Makefile jq_test.c
This commit is contained in:
commit
2363246eea
17 files changed
+388
-157
No files matched your search
+1
-4
@@ -1,13 +1,10 @@
|
||||
*.o
|
||||
*~
|
||||
|
||||
# Autogenerated
|
||||
*.gen.*
|
||||
|
||||
jq_test
|
||||
build
|
||||
jq
|
||||
jq.1
|
||||
|
||||
# Something delightfully recursive happens otherwise
|
||||
docs/content/2.download/source/*
|
||||
docs/content/2.download/source/*
|
||||
@@ -0,0 +1,6 @@
|
||||
Created By:
|
||||
Stephen Dolan <mu@netsoc.tcd.ie>
|
||||
|
||||
Contributions by
|
||||
Anthony Shortland <anthony.shortland@me.com> - rpmbuild target
|
||||
Lee Thompson <stagr.lee@gmail.com> - autoconf stuff
|
||||
@@ -1,142 +0,0 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function $(EXTRA_CFLAGS)
|
||||
|
||||
prefix=/usr/local
|
||||
mandir=$(prefix)/share/man
|
||||
|
||||
|
||||
.PHONY: all clean releasedep tarball install uninstall test releasetag
|
||||
all: jq
|
||||
|
||||
lexer.gen.c: lexer.l
|
||||
flex -o lexer.gen.c --header-file=lexer.gen.h lexer.l
|
||||
lexer.gen.h: lexer.gen.c
|
||||
|
||||
parser.gen.c: parser.y lexer.gen.h
|
||||
bison -W -d parser.y -v --report-file=parser.gen.info -o $@
|
||||
parser.gen.h: parser.gen.c
|
||||
|
||||
jv_utf8_tables.gen.h: gen_utf8_tables.py
|
||||
python $^ > $@
|
||||
jv_unicode.c: jv_utf8_tables.gen.h
|
||||
|
||||
version.gen.h: VERSION
|
||||
sed 's/.*/#define JQ_VERSION "&"/' $^ > $@
|
||||
main.c: version.gen.h
|
||||
|
||||
JQ_SRC=parser.gen.c lexer.gen.c 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
|
||||
|
||||
|
||||
jq: $(JQ_SRC) main.c jq_test.c
|
||||
$(CC) $(CFLAGS) $(CFLAGS_OPT) -o $@ $^
|
||||
|
||||
test: jq
|
||||
valgrind --error-exitcode=1 -q --leak-check=full ./jq --run-tests >/dev/null
|
||||
|
||||
LIBRARIES=libjq
|
||||
BINARIES=jq
|
||||
PLATFORMS=linux32 linux64 osx32 osx64 win32 win64
|
||||
|
||||
build/linux32%: CC='x86_64-linux-gnu-gcc -m32'
|
||||
build/linux64%: CC='x86_64-linux-gnu-gcc -m64'
|
||||
|
||||
# OS X cross compilers can be gotten from
|
||||
# https://launchpad.net/~flosoft/+archive/cross-apple
|
||||
build/osx32%: CC='i686-apple-darwin10-gcc -m32'
|
||||
build/osx64%: CC='i686-apple-darwin10-gcc -m64'
|
||||
|
||||
# On Debian, you can get windows compilers in the
|
||||
# gcc-mingw-w64-i686 and gcc-mingw-w64-x86-64 packages.
|
||||
build/win32%: CC='i686-w64-mingw32-gcc -m32' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=0
|
||||
build/win64%: CC='x86_64-w64-mingw32-gcc -m64' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=0
|
||||
|
||||
BIN_SUFFIX_win32 = .exe
|
||||
BIN_SUFFIX_win64 = .exe
|
||||
LIB_SUFFIX_win32 = .dll
|
||||
LIB_SUFFIX_win64 = .dll
|
||||
|
||||
LIB_SUFFIX_linux32 = .so
|
||||
LIB_SUFFIX_linux64 = .so
|
||||
|
||||
LIB_SUFFIX_osx32 = .so
|
||||
LIB_SUFFIX_osx64 = .so
|
||||
|
||||
ALL_BINARIES=\
|
||||
$(foreach platform, $(PLATFORMS), \
|
||||
$(foreach binary, $(BINARIES), \
|
||||
build/$(platform)/$(binary)$(BIN_SUFFIX_$(platform))))
|
||||
|
||||
$(ALL_BINARIES): build/%:
|
||||
mkdir -p $(@D)
|
||||
echo $(dir $*)
|
||||
make -B $(BINARIES) CC=$(CC)
|
||||
$(foreach binary, $(BINARIES), cp $(binary) $(@D)/$(binary)$(suffix $*);)
|
||||
|
||||
libjq: CFLAGS += -fPIC
|
||||
libjq: $(JQ_SRC)
|
||||
$(CC) -shared -Wl,-soname,libjq.so.1 $(CFLAGS) $(CFLAGS_OPT) -o $@ $^
|
||||
|
||||
ALL_LIBRARIES=\
|
||||
$(foreach platform, $(PLATFORMS), \
|
||||
$(foreach library, $(LIBRARIES), \
|
||||
build/$(platform)/$(library)$(LIB_SUFFIX_$(platform))))
|
||||
|
||||
$(ALL_LIBRARIES): build/%:
|
||||
mkdir -p $(@D)
|
||||
echo $(dir $*)
|
||||
make -B $(LIBRARIES) CC=$(CC)
|
||||
$(foreach library, $(LIBRARIES), cp $(library) $(@D)/$(library)$(suffix $*);)
|
||||
|
||||
binaries: $(ALL_BINARIES)
|
||||
libraries: $(ALL_LIBRARIES)
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -f $(LIBRARIES) $(BINARIES) *.gen.*
|
||||
|
||||
releasedep: lexer.gen.c parser.gen.c jv_utf8_tables.gen.h
|
||||
|
||||
releasetag:
|
||||
git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
|
||||
|
||||
docs/content/2.download/source/jq.tgz: jq
|
||||
mkdir -p `dirname $@`
|
||||
tar -czvf $@ `git ls-files; ls *.gen.*`
|
||||
|
||||
tarball: docs/content/2.download/source/jq.tgz
|
||||
|
||||
jq.1: docs/content/3.manual/manual.yml
|
||||
( cd docs; bundle exec rake manpage; ) > $@
|
||||
|
||||
install: jq jq.1 libjq
|
||||
install -d -m 0755 $(prefix)/bin
|
||||
install -d -m 0755 $(prefix)/lib
|
||||
install -d -m 0755 $(prefix)/include
|
||||
install -d -m 0755 $(prefix)/include/jq
|
||||
install -m 0755 jq $(prefix)/bin
|
||||
ln libjq libjq.so.1
|
||||
install -m 0755 execute.h $(prefix)/include/jq
|
||||
install -m 0755 compile.h $(prefix)/include/jq
|
||||
install -m 0755 jv.h $(prefix)/include/jq
|
||||
install -m 0755 jv_parse.h $(prefix)/include/jq
|
||||
install -m 0755 jv_alloc.h $(prefix)/include/jq
|
||||
install -m 0755 libjq.so.1 $(prefix)/bin
|
||||
install -m 0644 execute.h $(prefix)/bin
|
||||
install -d -m 0755 $(mandir)/man1
|
||||
install -m 0644 jq.1 $(mandir)/man1
|
||||
|
||||
uninstall:
|
||||
rm -vf $(prefix)/bin/jq
|
||||
rm -vf $(prefix)/lib/libjq.so.1
|
||||
rm -vf $(mandir)/man1/jq.1
|
||||
|
||||
|
||||
www: docs/output www_binaries
|
||||
|
||||
docs/output:
|
||||
cd docs; rake build
|
||||
|
||||
www_binaries: docs/output binaries
|
||||
$(foreach platform, $(PLATFORMS), \
|
||||
mkdir -p docs/output/download/$(platform); \
|
||||
cp build/$(platform)/* docs/output/download/$(platform)/; )
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
# Converted to automake by thompson@dtosolutions.com 26NOV12
|
||||
|
||||
# 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 \
|
||||
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
|
||||
# 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
|
||||
|
||||
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 = \
|
||||
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
|
||||
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
|
||||
|
||||
# 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
|
||||
# OSX ships an old bison, so update with homebrew or macports
|
||||
AM_YFLAGS = --warnings=all -d
|
||||
|
||||
bin_PROGRAMS = jq
|
||||
BUILT_SOURCES = jv_utf8_tables.gen.h lexer.h lexer.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
|
||||
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
|
||||
LOG_COMPILER = valgrind
|
||||
AM_LOG_FLAGS = --error-exitcode=1 -q --leak-check=full
|
||||
|
||||
man_MANS = jq.1
|
||||
|
||||
jq.1 :
|
||||
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:
|
||||
git log --name-status > $@ || echo "no changelog" > $@
|
||||
|
||||
main.c: config.h
|
||||
|
||||
releasetag:
|
||||
git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
|
||||
|
||||
RELEASE ?= 1
|
||||
rpm: ${RPMBINS}
|
||||
@echo "Packaging jq as an RPM ..."
|
||||
mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS
|
||||
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
|
||||
find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;
|
||||
rm -rf rpm
|
||||
|
||||
dist-clean-local:
|
||||
rm -f ${BUILT_SOURCES}
|
||||
|
||||
# Not sure why this doesn't get cleaned up automatically, guess
|
||||
# automake used to man pages which are hand coded?
|
||||
clean-local:
|
||||
rm -f jq.1
|
||||
@@ -0,0 +1,10 @@
|
||||
Since this is a github project and an autoconf project, the
|
||||
README file is not used, README.md is the file to READ!
|
||||
|
||||
When you checkout the file, run "setup.sh" which gets autoconf initialized.
|
||||
Then follow the instructions in INSTALL. Real standard stuff...
|
||||
|
||||
|
||||
$ ./setup.sh # initializes Autoconf and builds your release
|
||||
$ ./setup.sh clean # cleans all the temp files out of your tree
|
||||
$ ./setup.sh superclean # deletes your release files so you can try again
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <string.h>
|
||||
#include "builtin.h"
|
||||
#include "compile.h"
|
||||
#include "parser.h"
|
||||
#include "jq_parser.h"
|
||||
#include "locfile.h"
|
||||
#include "jv_aux.h"
|
||||
#include "jv_unicode.h"
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
AC_INIT([jq], m4_esyscmd([tr -d '\n' <VERSION]), [mu@netsoc.tcd.ie],
|
||||
[jq], [http://stedolan.github.com/jq/])
|
||||
|
||||
dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
|
||||
AC_PREREQ([2.61])
|
||||
AC_CONFIG_AUX_DIR([config])
|
||||
AM_INIT_AUTOMAKE([parallel-tests])
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_STDC
|
||||
AC_PROG_CPP_WERROR
|
||||
AC_PROG_YACC
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
|
||||
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 these program checks should probably be deleted
|
||||
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
|
||||
AC_CHECK_PROGS(flex_cmd, flex)
|
||||
if test x$flex_cmd = "x" ; then
|
||||
AC_MSG_NOTICE([flex is required to patch jq.])
|
||||
fi
|
||||
|
||||
dnl Check for bison
|
||||
AC_CHECK_PROGS(bison_cmd, bison)
|
||||
if test x$bison_cmd = "x" ; then
|
||||
AC_MSG_NOTICE([bison is required to patch jq.])
|
||||
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
|
||||
AC_CHECK_PROGS(valgrind_cmd, valgrind)
|
||||
if test x$valgrind_cmd = "x" ; then
|
||||
AC_MSG_NOTICE([valgrind is required to test jq.])
|
||||
fi
|
||||
|
||||
dnl AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS(config.h)
|
||||
AM_INIT_AUTOMAKE([-Wall dist-bzip2 dist-zip])
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
@@ -1,3 +1,4 @@
|
||||
require 'yaml'
|
||||
require 'bonsai'
|
||||
require 'liquid'
|
||||
require 'maruku'
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "frame_layout.h"
|
||||
|
||||
#include "jv_alloc.h"
|
||||
#include "jq_parser.h"
|
||||
#include "locfile.h"
|
||||
#include "jv.h"
|
||||
#include "jv_aux.h"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# This is spec file maintained by developers of JQ, not by a OS distro.
|
||||
# Your OS of choice will likely ignore this RPM spec file.
|
||||
Summary: Command-line JSON processor
|
||||
Name: jq
|
||||
Version: %{myver}
|
||||
Release: %{myrel}%{?dist}
|
||||
Source0: jq-%{myver}.tar.gz
|
||||
URL: https://github.com/stedolan/jq
|
||||
License: BSD
|
||||
AutoReqProv: no
|
||||
#BuildPrereq: autoconf, libtool, automake, flex, bison, python
|
||||
|
||||
Group: Applications/System
|
||||
# Requires:
|
||||
|
||||
# Disables debug packages and stripping of binaries:
|
||||
%global _enable_debug_package 0
|
||||
%global debug_package %{nil}
|
||||
%global __os_install_post %{nil}
|
||||
|
||||
# Crank up the compression
|
||||
%define _binary_payload w7.lzdio
|
||||
|
||||
%description
|
||||
jq is a command-line JSON processor
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
echo "Building in: \"$(pwd)\""
|
||||
%if "%{devbuild}" == "yes"
|
||||
./configure --prefix=%{_prefix} --enable-devel
|
||||
%else
|
||||
./configure --prefix=%{_prefix}
|
||||
%endif
|
||||
make
|
||||
|
||||
%install
|
||||
echo "Installing to: \"%{buildroot}\""
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/jq
|
||||
%if "%{devbuild}" == "yes"
|
||||
%{_libexecdir}/%{name}/jq_test
|
||||
%{_libexecdir}/%{name}/testdata
|
||||
%endif
|
||||
%{_datadir}/doc/%{name}/AUTHORS
|
||||
%{_datadir}/doc/%{name}/COPYING
|
||||
%{_datadir}/doc/%{name}/INSTALL
|
||||
%{_datadir}/doc/%{name}/NEWS
|
||||
%{_datadir}/doc/%{name}/README
|
||||
%{_datadir}/doc/%{name}/README.md
|
||||
%{_datadir}/man/man1/jq.1
|
||||
|
||||
%changelog
|
||||
|
||||
%pre
|
||||
|
||||
%post
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef PARSER_H
|
||||
#define PARSER_H
|
||||
#ifndef JQ_PARSER_H
|
||||
#define JQ_PARSER_H
|
||||
|
||||
int jq_parse(struct locfile* source, block* answer);
|
||||
int jq_parse_library(struct locfile* locations, block* answer);
|
||||
@@ -8,12 +8,23 @@
|
||||
static void jv_test();
|
||||
static void run_jq_tests();
|
||||
|
||||
FILE* testdata;
|
||||
|
||||
int jq_testsuite(int argc, char* argv[]) {
|
||||
FILE* testdata;
|
||||
jv_test();
|
||||
if (argc == 1) {
|
||||
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;
|
||||
@@ -24,7 +35,7 @@ int jq_testsuite(int argc, char* argv[]) {
|
||||
printf("usage: %s OR cat testdata | %s - OR %s testdata\n", argv[0], argv[0], argv[0]);
|
||||
return 127;
|
||||
}
|
||||
run_jq_tests();
|
||||
run_jq_tests(testdata);
|
||||
if (testdata != stdin) fclose(testdata);
|
||||
return 0;
|
||||
}
|
||||
@@ -39,7 +50,7 @@ static int skipline(const char* buf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void run_jq_tests() {
|
||||
static void run_jq_tests(FILE *testdata) {
|
||||
char buf[4096];
|
||||
int tests = 0, passed = 0, invalid = 0;
|
||||
jq_state *jq = NULL;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
struct lexer_param;
|
||||
|
||||
#include "parser.gen.h" /* Generated by bison. */
|
||||
#include "parser.h" /* Generated by bison. */
|
||||
|
||||
#define YY_USER_ACTION \
|
||||
do { \
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
#include "jv.h"
|
||||
#include "jv_parse.h"
|
||||
#include "execute.h"
|
||||
#include "config.h" /* Autoconf generated header file */
|
||||
#include "jv_alloc.h"
|
||||
#include "version.gen.h"
|
||||
|
||||
int jq_testsuite(int argc, char* argv[]);
|
||||
|
||||
static const char* progname;
|
||||
|
||||
static void usage() {
|
||||
fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", JQ_VERSION);
|
||||
fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", PACKAGE_VERSION);
|
||||
fprintf(stderr, "Usage: %s [options] <jq filter> [file...]\n\n", progname);
|
||||
fprintf(stderr, "For a description of the command line options and\n");
|
||||
fprintf(stderr, "how to write jq filters (and why you might want to)\n");
|
||||
@@ -203,7 +203,7 @@ int main(int argc, char* argv[]) {
|
||||
} else if (isoption(argv[i], 'h', "help")) {
|
||||
usage();
|
||||
} else if (isoption(argv[i], 'V', "version")) {
|
||||
fprintf(stderr, "jq version %s\n", JQ_VERSION);
|
||||
fprintf(stderr, "jq version %s\n", PACKAGE_VERSION);
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);
|
||||
|
||||
@@ -92,7 +92,7 @@ struct lexer_param;
|
||||
|
||||
%type <blk> Exp Term MkDict MkDictPair ExpD ElseBody QQString FuncDef FuncDefs String
|
||||
%{
|
||||
#include "lexer.gen.h"
|
||||
#include "lexer.h"
|
||||
struct lexer_param {
|
||||
yyscan_t lexer;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
make distclean || echo "continuing..."
|
||||
rm -rf tmp autom4te.cache config
|
||||
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
|
||||
elif [ "superclean" == "$1" ]; then
|
||||
# if autoconf errors during distcheck, it leaves files that need chmod'ing
|
||||
ver=$(tr -d '\n' <VERSION)
|
||||
if [ "x${ver}" != "x" ]; then
|
||||
if [ -d jq-${ver} ]; then
|
||||
chmod -R u+w jq-${ver}
|
||||
rm -rf jq-${ver}
|
||||
fi
|
||||
rm -f jq-${ver}*
|
||||
fi
|
||||
else
|
||||
autoreconf --install
|
||||
./configure --enable-devel --prefix=/opt/junk
|
||||
make check
|
||||
mkdir tmp
|
||||
make DESTDIR=./tmp install
|
||||
make distcheck
|
||||
fi
|
||||
Reference in new issue
Block a user