Add local oniguruma submodule
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Configure should still allow use of prebuilt onigurumas (whether system-installed or in a special prefix). If these are not found, and configure was not called with `--without-oniguruma`, then use the vendored oniguruma module. If configure was called with `--without-oniguruma`, then we do not build regex functionality into jq.
authored by Erik Brinkman · committed by William Langford · parent 9b21790 · Browse files · 6 files·+55 added−37 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+55 added−37 removed
- other:+55 added−37 removed
Provenance
- Commit
02bad4b- Tree
9c1c336- Author
Erik Brinkman <erik.brinkman@gmail.com>- Committer
William Langford <wlangfor@gmail.com>- Parent
9b21790
6 files changed+55 added−37 removed
added:modules/onigurumanot shown
Its text is not shown, added.
modified:src/builtin.c+4 added-4 removed
27 unmodified lines28 #include <assert.h>29 #include <ctype.h>30 #include <limits.h>31 #include <math.h>32-#ifdef HAVE_ONIGURUMA32+#ifdef HAVE_LIBONIG33 #include <oniguruma.h>34 #endif35 #include <string.h>36 #include <time.h>659 unmodified lines696 return type_error2(input, keys, "cannot be sorted, as they are not both arrays");697 }698 }699 700-#ifdef HAVE_ONIGURUMA700+#ifdef HAVE_LIBONIG701 static int f_match_name_iter(const UChar* name, const UChar *name_end, int ngroups,702 int *groups, regex_t *reg, void *arg) {703 jv captures = *(jv*)arg;704 for (int i = 0; i < ngroups; ++i) {195 unmodified lines900 jv_free(input);901 jv_free(regex);902 return result;903 }904-#else /* ! HAVE_ONIGURUMA */904+#else /* !HAVE_LIBONIG */905 static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) {906 return jv_invalid_with_msg(jv_string("jq was compiled without ONIGURUMA regex libary. match/test/sub and related functions are not available."));907 }908-#endif /* HAVE_ONIGURUMA */908+#endif /* HAVE_LIBONIG */909 910 static jv minmax_by(jv values, jv keys, int is_min) {911 if (jv_get_kind(values) != JV_KIND_ARRAY)912 return type_error2(values, keys, "cannot be iterated over");634 unmodified linesadded:.gitmodules+3 added
1+[submodule "modules/oniguruma"]2+ path = modules/oniguruma3+ url = https://github.com/kkos/oniguruma.gitmodified:.travis.yml+3 added-3 removed
17 unmodified lines181920212222232425262728293031323233343536377 unmodified lines4546474849495051525322 unmodified lines17 unmodified lines
addons: apt: packages: - libonig-dev - valgrind - bison - automake
before_install: - echo "$TRAVIS_OS_NAME" - uname -s - brew update || true; brew install flex || true; brew install bison || true; brew install oniguruma || true; - rm src/{lexer,parser}.{c,h} - sed -i.bak '/^AM_INIT_AUTOMAKE(\[-Wno-portability 1\.14\])$/s/14/11/' modules/oniguruma/configure.ac
install: - bundle install --gemfile=docs/Gemfile - wget http://ftp.debian.org/debian/pool/main/b/bison/bison_3.0.2.dfsg-2_amd64.deb7 unmodified lines - echo SHELL=$SHELL - echo PATH=$PATH - which bison - bison --version - autoreconf -i - autoreconf -if - ./configure YACC="$(which bison) -y" $COVERAGE
script: # When using the bison from Debian we need to tell that bison where22 unmodified linesmodified:configure.ac+35 added-29 removed
42 unmodified lines43 LEX="$SHELL $missing_dir/missing flex"44 fi45 fi46 47-48-##########################################################################49-# check for ONIGURUMA library50-##########################################################################51-52-AC_ARG_WITH([oniguruma],53- [AS_HELP_STRING([--with-oniguruma=prefix],54- [try this for a non-standard install prefix of the oniguruma library])],55- [],56- [with_oniguruma=yes])57-58-AS_IF([test "x$with_oniguruma" != xno], [59- AS_IF([test "x$with_oniguruma" != xyes], [60- CFLAGS="$CFLAGS -I${with_oniguruma}/include"61- LDFLAGS="$LDFLAGS -L${with_oniguruma}/lib"62- ])63- # check for ONIGURUMA library64- have_oniguruma=065- AC_CHECK_HEADER("oniguruma.h",66- AC_CHECK_LIB([onig],[onig_version],[LIBS="$LIBS -lonig"; have_oniguruma=1;]))67- # handle check results68- AS_IF([test $have_oniguruma = 1], [69- AC_DEFINE([HAVE_ONIGURUMA], 1, [Define to 1 if Oniguruma is installed])70- ], [71- AC_MSG_NOTICE([Oniguruma was not found.])72- AC_MSG_NOTICE([Try setting the location using '--with-oniguruma=PREFIX'])73- ])74-])75-47 dnl Check for valgrind48 AC_CHECK_PROGS(valgrind_cmd, valgrind)49 if test "x$valgrind_cmd" = "x" ; then50 AC_MSG_WARN([valgrind is required to test jq.])173 unmodified lines224 AC_MSG_ERROR(unknown endianess),225 AC_MSG_ERROR(universial endianess not supported)226 )227 228+dnl Oniguruma229+AC_ARG_WITH([oniguruma],230+ [AS_HELP_STRING([--with-oniguruma=prefix],231+ [try this for a non-standard install prefix of the oniguruma library])], ,232+ [with_oniguruma=yes])233+234+build_oniguruma=no235+AS_IF([test "x$with_oniguruma" != xno], [236+ save_CFLAGS="$CFLAGS"237+ save_LDFLAGS="$LDFLAGS"238+ AS_IF([test "x$with_oniguruma" != xyes], [239+ onig_CFLAGS="-I${with_oniguruma}/include"240+ onig_LDFLAGS="-L${with_oniguruma}/lib"241+ CFLAGS="$CFLAGS $onig_CFLAGS"242+ LDFLAGS="$LDFLAGS $onig_LDFLAGS"243+ ])244+ # check for ONIGURUMA library245+ AC_CHECK_HEADER("oniguruma.h",246+ AC_CHECK_LIB([onig],[onig_version]))247+ CFLAGS="$save_CFLAGS"248+ LDFLAGS="$save_LDFLAGS"249+250+ # handle check results251+ AS_IF([test "x$ac_cv_lib_onig_onig_version" != "xyes"], [252+ onig_CFLAGS="-I${srcdir}/modules/oniguruma/src"253+ onig_LDFLAGS=254+ AC_CONFIG_SUBDIRS([modules/oniguruma])255+ build_oniguruma=yes256+ AC_MSG_NOTICE([Oniguruma was not found. Will use the packaged oniguruma.])257+ ])258+ AC_SUBST(onig_CFLAGS)259+ AC_SUBST(onig_LDFLAGS)260+])261+262+AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])263 AC_SUBST([BUNDLER], ["$bundle_cmd"])264 265 AC_CONFIG_MACRO_DIR([config/m4])266 AC_CONFIG_FILES([Makefile])2 unmodified linesmodified:Makefile.am+10 added-1 removed
46 unmodified lines47 48 lib_LTLIBRARIES = libjq.la49 libjq_la_SOURCES = ${LIBJQ_SRC}50 libjq_la_LIBADD = -lm51-libjq_la_LDFLAGS = -export-symbols-regex '^j[qv]_' -version-info 1:4:051+libjq_la_LDFLAGS = $(onig_LDFLAGS) -export-symbols-regex '^j[qv]_' -version-info 1:4:052 53 if WIN3254 libjq_la_LIBADD += -lshlwapi55 endif76 unmodified lines132 $(AM_V_GEN) cp $^ $@133 endif134 135 136+### Build oniguruma137+138+if BUILD_ONIGURUMA139+libjq_la_LIBADD += modules/oniguruma/src/.libs/libonig.la140+SUBDIRS = modules/oniguruma141+endif142+143+AM_CFLAGS += $(onig_CFLAGS)144+145 ### Packaging146 147 docs/site.yml: configure.ac148 sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new56 unmodified lines