Merge branch 'autotools'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Stephen Dolan · committed by Stephen Dolan · parents 7813f36, 4b1b9c2 · Browse files · 38 files·+3291 added−767 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
38 files+3291 added−767 removed
- tests:+579 added−0 removed
- other:+2712 added−767 removed
Provenance
- Commit
7ca5127- Tree
07985eb- Author
Stephen Dolan <mu@netsoc.tcd.ie>- Committer
Stephen Dolan <mu@netsoc.tcd.ie>- Parent 1
7813f36- Parent 2
4b1b9c2
38 files changed+3291 added−767 removed
added:build/.gitignore+1 added
1+*added:config/compile+343 added
1+#! /bin/sh2+# Wrapper for compilers which do not understand '-c -o'.3+4+scriptversion=2012-03-05.13; # UTC5+6+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free7+# Software Foundation, Inc.8+# Written by Tom Tromey <tromey@cygnus.com>.9+#10+# This program is free software; you can redistribute it and/or modify11+# it under the terms of the GNU General Public License as published by12+# the Free Software Foundation; either version 2, or (at your option)13+# any later version.14+#15+# This program is distributed in the hope that it will be useful,16+# but WITHOUT ANY WARRANTY; without even the implied warranty of17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18+# GNU General Public License for more details.19+#20+# You should have received a copy of the GNU General Public License21+# along with this program. If not, see <http://www.gnu.org/licenses/>.22+23+# As a special exception to the GNU General Public License, if you24+# distribute this file as part of a program that contains a25+# configuration script generated by Autoconf, you may include it under26+# the same distribution terms that you use for the rest of that program.27+28+# This file is maintained in Automake, please report29+# bugs to <bug-automake@gnu.org> or send patches to30+# <automake-patches@gnu.org>.31+32+nl='33+'34+35+# We need space, tab and new line, in precisely that order. Quoting is36+# there to prevent tools from complaining about whitespace usage.37+IFS=" "" $nl"38+39+file_conv=40+41+# func_file_conv build_file lazy42+# Convert a $build file to $host form and store it in $file43+# Currently only supports Windows hosts. If the determined conversion44+# type is listed in (the comma separated) LAZY, no conversion will45+# take place.46+func_file_conv ()47+{48+ file=$149+ case $file in50+ / | /[!/]*) # absolute file, and not a UNC file51+ if test -z "$file_conv"; then52+ # lazily determine how to convert abs files53+ case `uname -s` in54+ MINGW*)55+ file_conv=mingw56+ ;;57+ CYGWIN*)58+ file_conv=cygwin59+ ;;60+ *)61+ file_conv=wine62+ ;;63+ esac64+ fi65+ case $file_conv/,$2, in66+ *,$file_conv,*)67+ ;;68+ mingw/*)69+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`70+ ;;71+ cygwin/*)72+ file=`cygpath -m "$file" || echo "$file"`73+ ;;74+ wine/*)75+ file=`winepath -w "$file" || echo "$file"`76+ ;;77+ esac78+ ;;79+ esac80+}81+82+# func_cl_dashL linkdir83+# Make cl look for libraries in LINKDIR84+func_cl_dashL ()85+{86+ func_file_conv "$1"87+ if test -z "$lib_path"; then88+ lib_path=$file89+ else90+ lib_path="$lib_path;$file"91+ fi92+ linker_opts="$linker_opts -LIBPATH:$file"93+}94+95+# func_cl_dashl library96+# Do a library search-path lookup for cl97+func_cl_dashl ()98+{99+ lib=$1100+ found=no101+ save_IFS=$IFS102+ IFS=';'103+ for dir in $lib_path $LIB104+ do105+ IFS=$save_IFS106+ if $shared && test -f "$dir/$lib.dll.lib"; then107+ found=yes108+ lib=$dir/$lib.dll.lib109+ break110+ fi111+ if test -f "$dir/$lib.lib"; then112+ found=yes113+ lib=$dir/$lib.lib114+ break115+ fi116+ done117+ IFS=$save_IFS118+119+ if test "$found" != yes; then120+ lib=$lib.lib121+ fi122+}123+124+# func_cl_wrapper cl arg...125+# Adjust compile command to suit cl126+func_cl_wrapper ()127+{128+ # Assume a capable shell129+ lib_path=130+ shared=:131+ linker_opts=132+ for arg133+ do134+ if test -n "$eat"; then135+ eat=136+ else137+ case $1 in138+ -o)139+ # configure might choose to run compile as 'compile cc -o foo foo.c'.140+ eat=1141+ case $2 in142+ *.o | *.[oO][bB][jJ])143+ func_file_conv "$2"144+ set x "$@" -Fo"$file"145+ shift146+ ;;147+ *)148+ func_file_conv "$2"149+ set x "$@" -Fe"$file"150+ shift151+ ;;152+ esac153+ ;;154+ -I)155+ eat=1156+ func_file_conv "$2" mingw157+ set x "$@" -I"$file"158+ shift159+ ;;160+ -I*)161+ func_file_conv "${1#-I}" mingw162+ set x "$@" -I"$file"163+ shift164+ ;;165+ -l)166+ eat=1167+ func_cl_dashl "$2"168+ set x "$@" "$lib"169+ shift170+ ;;171+ -l*)172+ func_cl_dashl "${1#-l}"173+ set x "$@" "$lib"174+ shift175+ ;;176+ -L)177+ eat=1178+ func_cl_dashL "$2"179+ ;;180+ -L*)181+ func_cl_dashL "${1#-L}"182+ ;;183+ -static)184+ shared=false185+ ;;186+ -Wl,*)187+ arg=${1#-Wl,}188+ save_ifs="$IFS"; IFS=','189+ for flag in $arg; do190+ IFS="$save_ifs"191+ linker_opts="$linker_opts $flag"192+ done193+ IFS="$save_ifs"194+ ;;195+ -Xlinker)196+ eat=1197+ linker_opts="$linker_opts $2"198+ ;;199+ -*)200+ set x "$@" "$1"201+ shift202+ ;;203+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)204+ func_file_conv "$1"205+ set x "$@" -Tp"$file"206+ shift207+ ;;208+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])209+ func_file_conv "$1" mingw210+ set x "$@" "$file"211+ shift212+ ;;213+ *)214+ set x "$@" "$1"215+ shift216+ ;;217+ esac218+ fi219+ shift220+ done221+ if test -n "$linker_opts"; then222+ linker_opts="-link$linker_opts"223+ fi224+ exec "$@" $linker_opts225+ exit 1226+}227+228+eat=229+230+case $1 in231+ '')232+ echo "$0: No command. Try '$0 --help' for more information." 1>&2233+ exit 1;234+ ;;235+ -h | --h*)236+ cat <<\EOF237+Usage: compile [--help] [--version] PROGRAM [ARGS]238+239+Wrapper for compilers which do not understand '-c -o'.240+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining241+arguments, and rename the output as expected.242+243+If you are trying to build a whole package this is not the244+right script to run: please start by reading the file 'INSTALL'.245+246+Report bugs to <bug-automake@gnu.org>.247+EOF248+ exit $?249+ ;;250+ -v | --v*)251+ echo "compile $scriptversion"252+ exit $?253+ ;;254+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )255+ func_cl_wrapper "$@" # Doesn't return...256+ ;;257+esac258+259+ofile=260+cfile=261+262+for arg263+do264+ if test -n "$eat"; then265+ eat=266+ else267+ case $1 in268+ -o)269+ # configure might choose to run compile as 'compile cc -o foo foo.c'.270+ # So we strip '-o arg' only if arg is an object.271+ eat=1272+ case $2 in273+ *.o | *.obj)274+ ofile=$2275+ ;;276+ *)277+ set x "$@" -o "$2"278+ shift279+ ;;280+ esac281+ ;;282+ *.c)283+ cfile=$1284+ set x "$@" "$1"285+ shift286+ ;;287+ *)288+ set x "$@" "$1"289+ shift290+ ;;291+ esac292+ fi293+ shift294+done295+296+if test -z "$ofile" || test -z "$cfile"; then297+ # If no '-o' option was seen then we might have been invoked from a298+ # pattern rule where we don't need one. That is ok -- this is a299+ # normal compilation that the losing compiler can handle. If no300+ # '.c' file was seen then we are probably linking. That is also301+ # ok.302+ exec "$@"303+fi304+305+# Name of file we expect compiler to create.306+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`307+308+# Create the lock directory.309+# Note: use '[/\\:.-]' here to ensure that we don't use the same name310+# that we are using for the .o file. Also, base the name on the expected311+# object file name, since that is what matters with a parallel build.312+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d313+while true; do314+ if mkdir "$lockdir" >/dev/null 2>&1; then315+ break316+ fi317+ sleep 1318+done319+# FIXME: race condition here if user kills between mkdir and trap.320+trap "rmdir '$lockdir'; exit 1" 1 2 15321+322+# Run the compile.323+"$@"324+ret=$?325+326+if test -f "$cofile"; then327+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"328+elif test -f "${cofile}bj"; then329+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"330+fi331+332+rmdir "$lockdir"333+exit $ret334+335+# Local Variables:336+# mode: shell-script337+# sh-indentation: 2338+# eval: (add-hook 'write-file-hooks 'time-stamp)339+# time-stamp-start: "scriptversion="340+# time-stamp-format: "%:y-%02m-%02d.%02H"341+# time-stamp-time-zone: "UTC"342+# time-stamp-end: "; # UTC"343+# End:added:config/depcomp+708 added
1+#! /bin/sh2+# depcomp - compile a program generating dependencies as side-effects3+4+scriptversion=2012-03-27.16; # UTC5+6+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,7+# 2011, 2012 Free Software Foundation, Inc.8+9+# This program is free software; you can redistribute it and/or modify10+# it under the terms of the GNU General Public License as published by11+# the Free Software Foundation; either version 2, or (at your option)12+# any later version.13+14+# This program is distributed in the hope that it will be useful,15+# but WITHOUT ANY WARRANTY; without even the implied warranty of16+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17+# GNU General Public License for more details.18+19+# You should have received a copy of the GNU General Public License20+# along with this program. If not, see <http://www.gnu.org/licenses/>.21+22+# As a special exception to the GNU General Public License, if you23+# distribute this file as part of a program that contains a24+# configuration script generated by Autoconf, you may include it under25+# the same distribution terms that you use for the rest of that program.26+27+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.28+29+case $1 in30+ '')31+ echo "$0: No command. Try '$0 --help' for more information." 1>&232+ exit 1;33+ ;;34+ -h | --h*)35+ cat <<\EOF36+Usage: depcomp [--help] [--version] PROGRAM [ARGS]37+38+Run PROGRAMS ARGS to compile a file, generating dependencies39+as side-effects.40+41+Environment variables:42+ depmode Dependency tracking mode.43+ source Source file read by 'PROGRAMS ARGS'.44+ object Object file output by 'PROGRAMS ARGS'.45+ DEPDIR directory where to store dependencies.46+ depfile Dependency file to output.47+ tmpdepfile Temporary file to use when outputting dependencies.48+ libtool Whether libtool is used (yes/no).49+50+Report bugs to <bug-automake@gnu.org>.51+EOF52+ exit $?53+ ;;54+ -v | --v*)55+ echo "depcomp $scriptversion"56+ exit $?57+ ;;58+esac59+60+# A tabulation character.61+tab=' '62+# A newline character.63+nl='64+'65+66+if test -z "$depmode" || test -z "$source" || test -z "$object"; then67+ echo "depcomp: Variables source, object and depmode must be set" 1>&268+ exit 169+fi70+71+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.72+depfile=${depfile-`echo "$object" |73+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}74+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}75+76+rm -f "$tmpdepfile"77+78+# Some modes work just like other modes, but use different flags. We79+# parameterize here, but still list the modes in the big case below,80+# to make depend.m4 easier to write. Note that we *cannot* use a case81+# here, because this file can only contain one case statement.82+if test "$depmode" = hp; then83+ # HP compiler uses -M and no extra arg.84+ gccflag=-M85+ depmode=gcc86+fi87+88+if test "$depmode" = dashXmstdout; then89+ # This is just like dashmstdout with a different argument.90+ dashmflag=-xM91+ depmode=dashmstdout92+fi93+94+cygpath_u="cygpath -u -f -"95+if test "$depmode" = msvcmsys; then96+ # This is just like msvisualcpp but w/o cygpath translation.97+ # Just convert the backslash-escaped backslashes to single forward98+ # slashes to satisfy depend.m499+ cygpath_u='sed s,\\\\,/,g'100+ depmode=msvisualcpp101+fi102+103+if test "$depmode" = msvc7msys; then104+ # This is just like msvc7 but w/o cygpath translation.105+ # Just convert the backslash-escaped backslashes to single forward106+ # slashes to satisfy depend.m4107+ cygpath_u='sed s,\\\\,/,g'108+ depmode=msvc7109+fi110+111+if test "$depmode" = xlc; then112+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.113+ gccflag=-qmakedep=gcc,-MF114+ depmode=gcc115+fi116+117+case "$depmode" in118+gcc3)119+## gcc 3 implements dependency tracking that does exactly what120+## we want. Yay! Note: for some reason libtool 1.4 doesn't like121+## it if -MD -MP comes after the -MF stuff. Hmm.122+## Unfortunately, FreeBSD c89 acceptance of flags depends upon123+## the command line argument order; so add the flags where they124+## appear in depend2.am. Note that the slowdown incurred here125+## affects only configure: in makefiles, %FASTDEP% shortcuts this.126+ for arg127+ do128+ case $arg in129+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;130+ *) set fnord "$@" "$arg" ;;131+ esac132+ shift # fnord133+ shift # $arg134+ done135+ "$@"136+ stat=$?137+ if test $stat -eq 0; then :138+ else139+ rm -f "$tmpdepfile"140+ exit $stat141+ fi142+ mv "$tmpdepfile" "$depfile"143+ ;;144+145+gcc)146+## There are various ways to get dependency output from gcc. Here's147+## why we pick this rather obscure method:148+## - Don't want to use -MD because we'd like the dependencies to end149+## up in a subdir. Having to rename by hand is ugly.150+## (We might end up doing this anyway to support other compilers.)151+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like152+## -MM, not -M (despite what the docs say).153+## - Using -M directly means running the compiler twice (even worse154+## than renaming).155+ if test -z "$gccflag"; then156+ gccflag=-MD,157+ fi158+ "$@" -Wp,"$gccflag$tmpdepfile"159+ stat=$?160+ if test $stat -eq 0; then :161+ else162+ rm -f "$tmpdepfile"163+ exit $stat164+ fi165+ rm -f "$depfile"166+ echo "$object : \\" > "$depfile"167+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz168+## The second -e expression handles DOS-style file names with drive letters.169+ sed -e 's/^[^:]*: / /' \170+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"171+## This next piece of magic avoids the "deleted header file" problem.172+## The problem is that when a header file which appears in a .P file173+## is deleted, the dependency causes make to die (because there is174+## typically no way to rebuild the header). We avoid this by adding175+## dummy dependencies for each header file. Too bad gcc doesn't do176+## this for us directly.177+ tr ' ' "$nl" < "$tmpdepfile" |178+## Some versions of gcc put a space before the ':'. On the theory179+## that the space means something, we add a space to the output as180+## well. hp depmode also adds that space, but also prefixes the VPATH181+## to the object. Take care to not repeat it in the output.182+## Some versions of the HPUX 10.20 sed can't process this invocation183+## correctly. Breaking it into two sed invocations is a workaround.184+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \185+ | sed -e 's/$/ :/' >> "$depfile"186+ rm -f "$tmpdepfile"187+ ;;188+189+hp)190+ # This case exists only to let depend.m4 do its work. It works by191+ # looking at the text of this script. This case will never be run,192+ # since it is checked for above.193+ exit 1194+ ;;195+196+sgi)197+ if test "$libtool" = yes; then198+ "$@" "-Wp,-MDupdate,$tmpdepfile"199+ else200+ "$@" -MDupdate "$tmpdepfile"201+ fi202+ stat=$?203+ if test $stat -eq 0; then :204+ else205+ rm -f "$tmpdepfile"206+ exit $stat207+ fi208+ rm -f "$depfile"209+210+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files211+ echo "$object : \\" > "$depfile"212+213+ # Clip off the initial element (the dependent). Don't try to be214+ # clever and replace this with sed code, as IRIX sed won't handle215+ # lines with more than a fixed number of characters (4096 in216+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;217+ # the IRIX cc adds comments like '#:fec' to the end of the218+ # dependency line.219+ tr ' ' "$nl" < "$tmpdepfile" \220+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \221+ tr "$nl" ' ' >> "$depfile"222+ echo >> "$depfile"223+224+ # The second pass generates a dummy entry for each header file.225+ tr ' ' "$nl" < "$tmpdepfile" \226+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \227+ >> "$depfile"228+ else229+ # The sourcefile does not contain any dependencies, so just230+ # store a dummy comment line, to avoid errors with the Makefile231+ # "include basename.Plo" scheme.232+ echo "#dummy" > "$depfile"233+ fi234+ rm -f "$tmpdepfile"235+ ;;236+237+xlc)238+ # This case exists only to let depend.m4 do its work. It works by239+ # looking at the text of this script. This case will never be run,240+ # since it is checked for above.241+ exit 1242+ ;;243+244+aix)245+ # The C for AIX Compiler uses -M and outputs the dependencies246+ # in a .u file. In older versions, this file always lives in the247+ # current directory. Also, the AIX compiler puts '$object:' at the248+ # start of each line; $object doesn't have directory information.249+ # Version 6 uses the directory in both cases.250+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`251+ test "x$dir" = "x$object" && dir=252+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`253+ if test "$libtool" = yes; then254+ tmpdepfile1=$dir$base.u255+ tmpdepfile2=$base.u256+ tmpdepfile3=$dir.libs/$base.u257+ "$@" -Wc,-M258+ else259+ tmpdepfile1=$dir$base.u260+ tmpdepfile2=$dir$base.u261+ tmpdepfile3=$dir$base.u262+ "$@" -M263+ fi264+ stat=$?265+266+ if test $stat -eq 0; then :267+ else268+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"269+ exit $stat270+ fi271+272+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"273+ do274+ test -f "$tmpdepfile" && break275+ done276+ if test -f "$tmpdepfile"; then277+ # Each line is of the form 'foo.o: dependent.h'.278+ # Do two passes, one to just change these to279+ # '$object: dependent.h' and one to simply 'dependent.h:'.280+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"281+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"282+ else283+ # The sourcefile does not contain any dependencies, so just284+ # store a dummy comment line, to avoid errors with the Makefile285+ # "include basename.Plo" scheme.286+ echo "#dummy" > "$depfile"287+ fi288+ rm -f "$tmpdepfile"289+ ;;290+291+icc)292+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.293+ # However on294+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c295+ # ICC 7.0 will fill foo.d with something like296+ # foo.o: sub/foo.c297+ # foo.o: sub/foo.h298+ # which is wrong. We want299+ # sub/foo.o: sub/foo.c300+ # sub/foo.o: sub/foo.h301+ # sub/foo.c:302+ # sub/foo.h:303+ # ICC 7.1 will output304+ # foo.o: sub/foo.c sub/foo.h305+ # and will wrap long lines using '\':306+ # foo.o: sub/foo.c ... \307+ # sub/foo.h ... \308+ # ...309+ # tcc 0.9.26 (FIXME still under development at the moment of writing)310+ # will emit a similar output, but also prepend the continuation lines311+ # with horizontal tabulation characters.312+ "$@" -MD -MF "$tmpdepfile"313+ stat=$?314+ if test $stat -eq 0; then :315+ else316+ rm -f "$tmpdepfile"317+ exit $stat318+ fi319+ rm -f "$depfile"320+ # Each line is of the form 'foo.o: dependent.h',321+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.322+ # Do two passes, one to just change these to323+ # '$object: dependent.h' and one to simply 'dependent.h:'.324+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \325+ < "$tmpdepfile" > "$depfile"326+ sed '327+ s/[ '"$tab"'][ '"$tab"']*/ /g328+ s/^ *//329+ s/ *\\*$//330+ s/^[^:]*: *//331+ /^$/d332+ /:$/d333+ s/$/ :/334+ ' < "$tmpdepfile" >> "$depfile"335+ rm -f "$tmpdepfile"336+ ;;337+338+hp2)339+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64340+ # compilers, which have integrated preprocessors. The correct option341+ # to use with these is +Maked; it writes dependencies to a file named342+ # 'foo.d', which lands next to the object file, wherever that343+ # happens to be.344+ # Much of this is similar to the tru64 case; see comments there.345+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`346+ test "x$dir" = "x$object" && dir=347+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`348+ if test "$libtool" = yes; then349+ tmpdepfile1=$dir$base.d350+ tmpdepfile2=$dir.libs/$base.d351+ "$@" -Wc,+Maked352+ else353+ tmpdepfile1=$dir$base.d354+ tmpdepfile2=$dir$base.d355+ "$@" +Maked356+ fi357+ stat=$?358+ if test $stat -eq 0; then :359+ else360+ rm -f "$tmpdepfile1" "$tmpdepfile2"361+ exit $stat362+ fi363+364+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"365+ do366+ test -f "$tmpdepfile" && break367+ done368+ if test -f "$tmpdepfile"; then369+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"370+ # Add 'dependent.h:' lines.371+ sed -ne '2,${372+ s/^ *//373+ s/ \\*$//374+ s/$/:/375+ p376+ }' "$tmpdepfile" >> "$depfile"377+ else378+ echo "#dummy" > "$depfile"379+ fi380+ rm -f "$tmpdepfile" "$tmpdepfile2"381+ ;;382+383+tru64)384+ # The Tru64 compiler uses -MD to generate dependencies as a side385+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.386+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put387+ # dependencies in 'foo.d' instead, so we check for that too.388+ # Subdirectories are respected.389+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`390+ test "x$dir" = "x$object" && dir=391+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`392+393+ if test "$libtool" = yes; then394+ # With Tru64 cc, shared objects can also be used to make a395+ # static library. This mechanism is used in libtool 1.4 series to396+ # handle both shared and static libraries in a single compilation.397+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.398+ #399+ # With libtool 1.5 this exception was removed, and libtool now400+ # generates 2 separate objects for the 2 libraries. These two401+ # compilations output dependencies in $dir.libs/$base.o.d and402+ # in $dir$base.o.d. We have to check for both files, because403+ # one of the two compilations can be disabled. We should prefer404+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is405+ # automatically cleaned when .libs/ is deleted, while ignoring406+ # the former would cause a distcleancheck panic.407+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4408+ tmpdepfile2=$dir$base.o.d # libtool 1.5409+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5410+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504411+ "$@" -Wc,-MD412+ else413+ tmpdepfile1=$dir$base.o.d414+ tmpdepfile2=$dir$base.d415+ tmpdepfile3=$dir$base.d416+ tmpdepfile4=$dir$base.d417+ "$@" -MD418+ fi419+420+ stat=$?421+ if test $stat -eq 0; then :422+ else423+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"424+ exit $stat425+ fi426+427+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"428+ do429+ test -f "$tmpdepfile" && break430+ done431+ if test -f "$tmpdepfile"; then432+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"433+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"434+ else435+ echo "#dummy" > "$depfile"436+ fi437+ rm -f "$tmpdepfile"438+ ;;439+440+msvc7)441+ if test "$libtool" = yes; then442+ showIncludes=-Wc,-showIncludes443+ else444+ showIncludes=-showIncludes445+ fi446+ "$@" $showIncludes > "$tmpdepfile"447+ stat=$?448+ grep -v '^Note: including file: ' "$tmpdepfile"449+ if test "$stat" = 0; then :450+ else451+ rm -f "$tmpdepfile"452+ exit $stat453+ fi454+ rm -f "$depfile"455+ echo "$object : \\" > "$depfile"456+ # The first sed program below extracts the file names and escapes457+ # backslashes for cygpath. The second sed program outputs the file458+ # name when reading, but also accumulates all include files in the459+ # hold buffer in order to output them again at the end. This only460+ # works with sed implementations that can handle large buffers.461+ sed < "$tmpdepfile" -n '462+/^Note: including file: *\(.*\)/ {463+ s//\1/464+ s/\\/\\\\/g465+ p466+}' | $cygpath_u | sort -u | sed -n '467+s/ /\\ /g468+s/\(.*\)/'"$tab"'\1 \\/p469+s/.\(.*\) \\/\1:/470+H471+$ {472+ s/.*/'"$tab"'/473+ G474+ p475+}' >> "$depfile"476+ rm -f "$tmpdepfile"477+ ;;478+479+msvc7msys)480+ # This case exists only to let depend.m4 do its work. It works by481+ # looking at the text of this script. This case will never be run,482+ # since it is checked for above.483+ exit 1484+ ;;485+486+#nosideeffect)487+ # This comment above is used by automake to tell side-effect488+ # dependency tracking mechanisms from slower ones.489+490+dashmstdout)491+ # Important note: in order to support this mode, a compiler *must*492+ # always write the preprocessed file to stdout, regardless of -o.493+ "$@" || exit $?494+495+ # Remove the call to Libtool.496+ if test "$libtool" = yes; then497+ while test "X$1" != 'X--mode=compile'; do498+ shift499+ done500+ shift501+ fi502+503+ # Remove '-o $object'.504+ IFS=" "505+ for arg506+ do507+ case $arg in508+ -o)509+ shift510+ ;;511+ $object)512+ shift513+ ;;514+ *)515+ set fnord "$@" "$arg"516+ shift # fnord517+ shift # $arg518+ ;;519+ esac520+ done521+522+ test -z "$dashmflag" && dashmflag=-M523+ # Require at least two characters before searching for ':'524+ # in the target name. This is to cope with DOS-style filenames:525+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.526+ "$@" $dashmflag |527+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"528+ rm -f "$depfile"529+ cat < "$tmpdepfile" > "$depfile"530+ tr ' ' "$nl" < "$tmpdepfile" | \531+## Some versions of the HPUX 10.20 sed can't process this invocation532+## correctly. Breaking it into two sed invocations is a workaround.533+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"534+ rm -f "$tmpdepfile"535+ ;;536+537+dashXmstdout)538+ # This case only exists to satisfy depend.m4. It is never actually539+ # run, as this mode is specially recognized in the preamble.540+ exit 1541+ ;;542+543+makedepend)544+ "$@" || exit $?545+ # Remove any Libtool call546+ if test "$libtool" = yes; then547+ while test "X$1" != 'X--mode=compile'; do548+ shift549+ done550+ shift551+ fi552+ # X makedepend553+ shift554+ cleared=no eat=no555+ for arg556+ do557+ case $cleared in558+ no)559+ set ""; shift560+ cleared=yes ;;561+ esac562+ if test $eat = yes; then563+ eat=no564+ continue565+ fi566+ case "$arg" in567+ -D*|-I*)568+ set fnord "$@" "$arg"; shift ;;569+ # Strip any option that makedepend may not understand. Remove570+ # the object too, otherwise makedepend will parse it as a source file.571+ -arch)572+ eat=yes ;;573+ -*|$object)574+ ;;575+ *)576+ set fnord "$@" "$arg"; shift ;;577+ esac578+ done579+ obj_suffix=`echo "$object" | sed 's/^.*\././'`580+ touch "$tmpdepfile"581+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"582+ rm -f "$depfile"583+ # makedepend may prepend the VPATH from the source file name to the object.584+ # No need to regex-escape $object, excess matching of '.' is harmless.585+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"586+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \587+## Some versions of the HPUX 10.20 sed can't process this invocation588+## correctly. Breaking it into two sed invocations is a workaround.589+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"590+ rm -f "$tmpdepfile" "$tmpdepfile".bak591+ ;;592+593+cpp)594+ # Important note: in order to support this mode, a compiler *must*595+ # always write the preprocessed file to stdout.596+ "$@" || exit $?597+598+ # Remove the call to Libtool.599+ if test "$libtool" = yes; then600+ while test "X$1" != 'X--mode=compile'; do601+ shift602+ done603+ shift604+ fi605+606+ # Remove '-o $object'.607+ IFS=" "608+ for arg609+ do610+ case $arg in611+ -o)612+ shift613+ ;;614+ $object)615+ shift616+ ;;617+ *)618+ set fnord "$@" "$arg"619+ shift # fnord620+ shift # $arg621+ ;;622+ esac623+ done624+625+ "$@" -E |626+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \627+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |628+ sed '$ s: \\$::' > "$tmpdepfile"629+ rm -f "$depfile"630+ echo "$object : \\" > "$depfile"631+ cat < "$tmpdepfile" >> "$depfile"632+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"633+ rm -f "$tmpdepfile"634+ ;;635+636+msvisualcpp)637+ # Important note: in order to support this mode, a compiler *must*638+ # always write the preprocessed file to stdout.639+ "$@" || exit $?640+641+ # Remove the call to Libtool.642+ if test "$libtool" = yes; then643+ while test "X$1" != 'X--mode=compile'; do644+ shift645+ done646+ shift647+ fi648+649+ IFS=" "650+ for arg651+ do652+ case "$arg" in653+ -o)654+ shift655+ ;;656+ $object)657+ shift658+ ;;659+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")660+ set fnord "$@"661+ shift662+ shift663+ ;;664+ *)665+ set fnord "$@" "$arg"666+ shift667+ shift668+ ;;669+ esac670+ done671+ "$@" -E 2>/dev/null |672+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"673+ rm -f "$depfile"674+ echo "$object : \\" > "$depfile"675+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"676+ echo "$tab" >> "$depfile"677+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"678+ rm -f "$tmpdepfile"679+ ;;680+681+msvcmsys)682+ # This case exists only to let depend.m4 do its work. It works by683+ # looking at the text of this script. This case will never be run,684+ # since it is checked for above.685+ exit 1686+ ;;687+688+none)689+ exec "$@"690+ ;;691+692+*)693+ echo "Unknown depmode $depmode" 1>&2694+ exit 1695+ ;;696+esac697+698+exit 0699+700+# Local Variables:701+# mode: shell-script702+# sh-indentation: 2703+# eval: (add-hook 'write-file-hooks 'time-stamp)704+# time-stamp-start: "scriptversion="705+# time-stamp-format: "%:y-%02m-%02d.%02H"706+# time-stamp-time-zone: "UTC"707+# time-stamp-end: "; # UTC"708+# End:added:config/install-sh+527 added
1+#!/bin/sh2+# install - install a program, script, or datafile3+4+scriptversion=2011-01-19.21; # UTC5+6+# This originates from X11R5 (mit/util/scripts/install.sh), which was7+# later released in X11R6 (xc/config/util/install.sh) with the8+# following copyright and license.9+#10+# Copyright (C) 1994 X Consortium11+#12+# Permission is hereby granted, free of charge, to any person obtaining a copy13+# of this software and associated documentation files (the "Software"), to14+# deal in the Software without restriction, including without limitation the15+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or16+# sell copies of the Software, and to permit persons to whom the Software is17+# furnished to do so, subject to the following conditions:18+#19+# The above copyright notice and this permission notice shall be included in20+# all copies or substantial portions of the Software.21+#22+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR23+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,24+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE25+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN26+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-27+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.28+#29+# Except as contained in this notice, the name of the X Consortium shall not30+# be used in advertising or otherwise to promote the sale, use or other deal-31+# ings in this Software without prior written authorization from the X Consor-32+# tium.33+#34+#35+# FSF changes to this file are in the public domain.36+#37+# Calling this script install-sh is preferred over install.sh, to prevent38+# `make' implicit rules from creating a file called install from it39+# when there is no Makefile.40+#41+# This script is compatible with the BSD install script, but was written42+# from scratch.43+44+nl='45+'46+IFS=" "" $nl"47+48+# set DOITPROG to echo to test this script49+50+# Don't use :- since 4.3BSD and earlier shells don't like it.51+doit=${DOITPROG-}52+if test -z "$doit"; then53+ doit_exec=exec54+else55+ doit_exec=$doit56+fi57+58+# Put in absolute file names if you don't have them in your path;59+# or use environment vars.60+61+chgrpprog=${CHGRPPROG-chgrp}62+chmodprog=${CHMODPROG-chmod}63+chownprog=${CHOWNPROG-chown}64+cmpprog=${CMPPROG-cmp}65+cpprog=${CPPROG-cp}66+mkdirprog=${MKDIRPROG-mkdir}67+mvprog=${MVPROG-mv}68+rmprog=${RMPROG-rm}69+stripprog=${STRIPPROG-strip}70+71+posix_glob='?'72+initialize_posix_glob='73+ test "$posix_glob" != "?" || {74+ if (set -f) 2>/dev/null; then75+ posix_glob=76+ else77+ posix_glob=:78+ fi79+ }80+'81+82+posix_mkdir=83+84+# Desired mode of installed file.85+mode=075586+87+chgrpcmd=88+chmodcmd=$chmodprog89+chowncmd=90+mvcmd=$mvprog91+rmcmd="$rmprog -f"92+stripcmd=93+94+src=95+dst=96+dir_arg=97+dst_arg=98+99+copy_on_change=false100+no_target_directory=101+102+usage="\103+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE104+ or: $0 [OPTION]... SRCFILES... DIRECTORY105+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...106+ or: $0 [OPTION]... -d DIRECTORIES...107+108+In the 1st form, copy SRCFILE to DSTFILE.109+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.110+In the 4th, create DIRECTORIES.111+112+Options:113+ --help display this help and exit.114+ --version display version info and exit.115+116+ -c (ignored)117+ -C install only if different (preserve the last data modification time)118+ -d create directories instead of installing files.119+ -g GROUP $chgrpprog installed files to GROUP.120+ -m MODE $chmodprog installed files to MODE.121+ -o USER $chownprog installed files to USER.122+ -s $stripprog installed files.123+ -t DIRECTORY install into DIRECTORY.124+ -T report an error if DSTFILE is a directory.125+126+Environment variables override the default commands:127+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG128+ RMPROG STRIPPROG129+"130+131+while test $# -ne 0; do132+ case $1 in133+ -c) ;;134+135+ -C) copy_on_change=true;;136+137+ -d) dir_arg=true;;138+139+ -g) chgrpcmd="$chgrpprog $2"140+ shift;;141+142+ --help) echo "$usage"; exit $?;;143+144+ -m) mode=$2145+ case $mode in146+ *' '* | *' '* | *'147+'* | *'*'* | *'?'* | *'['*)148+ echo "$0: invalid mode: $mode" >&2149+ exit 1;;150+ esac151+ shift;;152+153+ -o) chowncmd="$chownprog $2"154+ shift;;155+156+ -s) stripcmd=$stripprog;;157+158+ -t) dst_arg=$2159+ # Protect names problematic for `test' and other utilities.160+ case $dst_arg in161+ -* | [=\(\)!]) dst_arg=./$dst_arg;;162+ esac163+ shift;;164+165+ -T) no_target_directory=true;;166+167+ --version) echo "$0 $scriptversion"; exit $?;;168+169+ --) shift170+ break;;171+172+ -*) echo "$0: invalid option: $1" >&2173+ exit 1;;174+175+ *) break;;176+ esac177+ shift178+done179+180+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then181+ # When -d is used, all remaining arguments are directories to create.182+ # When -t is used, the destination is already specified.183+ # Otherwise, the last argument is the destination. Remove it from $@.184+ for arg185+ do186+ if test -n "$dst_arg"; then187+ # $@ is not empty: it contains at least $arg.188+ set fnord "$@" "$dst_arg"189+ shift # fnord190+ fi191+ shift # arg192+ dst_arg=$arg193+ # Protect names problematic for `test' and other utilities.194+ case $dst_arg in195+ -* | [=\(\)!]) dst_arg=./$dst_arg;;196+ esac197+ done198+fi199+200+if test $# -eq 0; then201+ if test -z "$dir_arg"; then202+ echo "$0: no input file specified." >&2203+ exit 1204+ fi205+ # It's OK to call `install-sh -d' without argument.206+ # This can happen when creating conditional directories.207+ exit 0208+fi209+210+if test -z "$dir_arg"; then211+ do_exit='(exit $ret); exit $ret'212+ trap "ret=129; $do_exit" 1213+ trap "ret=130; $do_exit" 2214+ trap "ret=141; $do_exit" 13215+ trap "ret=143; $do_exit" 15216+217+ # Set umask so as not to create temps with too-generous modes.218+ # However, 'strip' requires both read and write access to temps.219+ case $mode in220+ # Optimize common cases.221+ *644) cp_umask=133;;222+ *755) cp_umask=22;;223+224+ *[0-7])225+ if test -z "$stripcmd"; then226+ u_plus_rw=227+ else228+ u_plus_rw='% 200'229+ fi230+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;231+ *)232+ if test -z "$stripcmd"; then233+ u_plus_rw=234+ else235+ u_plus_rw=,u+rw236+ fi237+ cp_umask=$mode$u_plus_rw;;238+ esac239+fi240+241+for src242+do243+ # Protect names problematic for `test' and other utilities.244+ case $src in245+ -* | [=\(\)!]) src=./$src;;246+ esac247+248+ if test -n "$dir_arg"; then249+ dst=$src250+ dstdir=$dst251+ test -d "$dstdir"252+ dstdir_status=$?253+ else254+255+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command256+ # might cause directories to be created, which would be especially bad257+ # if $src (and thus $dsttmp) contains '*'.258+ if test ! -f "$src" && test ! -d "$src"; then259+ echo "$0: $src does not exist." >&2260+ exit 1261+ fi262+263+ if test -z "$dst_arg"; then264+ echo "$0: no destination specified." >&2265+ exit 1266+ fi267+ dst=$dst_arg268+269+ # If destination is a directory, append the input filename; won't work270+ # if double slashes aren't ignored.271+ if test -d "$dst"; then272+ if test -n "$no_target_directory"; then273+ echo "$0: $dst_arg: Is a directory" >&2274+ exit 1275+ fi276+ dstdir=$dst277+ dst=$dstdir/`basename "$src"`278+ dstdir_status=0279+ else280+ # Prefer dirname, but fall back on a substitute if dirname fails.281+ dstdir=`282+ (dirname "$dst") 2>/dev/null ||283+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \284+ X"$dst" : 'X\(//\)[^/]' \| \285+ X"$dst" : 'X\(//\)$' \| \286+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||287+ echo X"$dst" |288+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{289+ s//\1/290+ q291+ }292+ /^X\(\/\/\)[^/].*/{293+ s//\1/294+ q295+ }296+ /^X\(\/\/\)$/{297+ s//\1/298+ q299+ }300+ /^X\(\/\).*/{301+ s//\1/302+ q303+ }304+ s/.*/./; q'305+ `306+307+ test -d "$dstdir"308+ dstdir_status=$?309+ fi310+ fi311+312+ obsolete_mkdir_used=false313+314+ if test $dstdir_status != 0; then315+ case $posix_mkdir in316+ '')317+ # Create intermediate dirs using mode 755 as modified by the umask.318+ # This is like FreeBSD 'install' as of 1997-10-28.319+ umask=`umask`320+ case $stripcmd.$umask in321+ # Optimize common cases.322+ *[2367][2367]) mkdir_umask=$umask;;323+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;324+325+ *[0-7])326+ mkdir_umask=`expr $umask + 22 \327+ - $umask % 100 % 40 + $umask % 20 \328+ - $umask % 10 % 4 + $umask % 2329+ `;;330+ *) mkdir_umask=$umask,go-w;;331+ esac332+333+ # With -d, create the new directory with the user-specified mode.334+ # Otherwise, rely on $mkdir_umask.335+ if test -n "$dir_arg"; then336+ mkdir_mode=-m$mode337+ else338+ mkdir_mode=339+ fi340+341+ posix_mkdir=false342+ case $umask in343+ *[123567][0-7][0-7])344+ # POSIX mkdir -p sets u+wx bits regardless of umask, which345+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.346+ ;;347+ *)348+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$349+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0350+351+ if (umask $mkdir_umask &&352+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1353+ then354+ if test -z "$dir_arg" || {355+ # Check for POSIX incompatibilities with -m.356+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or357+ # other-writeable bit of parent directory when it shouldn't.358+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.359+ ls_ld_tmpdir=`ls -ld "$tmpdir"`360+ case $ls_ld_tmpdir in361+ d????-?r-*) different_mode=700;;362+ d????-?--*) different_mode=755;;363+ *) false;;364+ esac &&365+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {366+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`367+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"368+ }369+ }370+ then posix_mkdir=:371+ fi372+ rmdir "$tmpdir/d" "$tmpdir"373+ else374+ # Remove any dirs left behind by ancient mkdir implementations.375+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null376+ fi377+ trap '' 0;;378+ esac;;379+ esac380+381+ if382+ $posix_mkdir && (383+ umask $mkdir_umask &&384+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"385+ )386+ then :387+ else388+389+ # The umask is ridiculous, or mkdir does not conform to POSIX,390+ # or it failed possibly due to a race condition. Create the391+ # directory the slow way, step by step, checking for races as we go.392+393+ case $dstdir in394+ /*) prefix='/';;395+ [-=\(\)!]*) prefix='./';;396+ *) prefix='';;397+ esac398+399+ eval "$initialize_posix_glob"400+401+ oIFS=$IFS402+ IFS=/403+ $posix_glob set -f404+ set fnord $dstdir405+ shift406+ $posix_glob set +f407+ IFS=$oIFS408+409+ prefixes=410+411+ for d412+ do413+ test X"$d" = X && continue414+415+ prefix=$prefix$d416+ if test -d "$prefix"; then417+ prefixes=418+ else419+ if $posix_mkdir; then420+ (umask=$mkdir_umask &&421+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break422+ # Don't fail if two instances are running concurrently.423+ test -d "$prefix" || exit 1424+ else425+ case $prefix in426+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;427+ *) qprefix=$prefix;;428+ esac429+ prefixes="$prefixes '$qprefix'"430+ fi431+ fi432+ prefix=$prefix/433+ done434+435+ if test -n "$prefixes"; then436+ # Don't fail if two instances are running concurrently.437+ (umask $mkdir_umask &&438+ eval "\$doit_exec \$mkdirprog $prefixes") ||439+ test -d "$dstdir" || exit 1440+ obsolete_mkdir_used=true441+ fi442+ fi443+ fi444+445+ if test -n "$dir_arg"; then446+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&447+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&448+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||449+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1450+ else451+452+ # Make a couple of temp file names in the proper directory.453+ dsttmp=$dstdir/_inst.$$_454+ rmtmp=$dstdir/_rm.$$_455+456+ # Trap to clean up those temp files at exit.457+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0458+459+ # Copy the file name to the temp name.460+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&461+462+ # and set any options; do chmod last to preserve setuid bits.463+ #464+ # If any of these fail, we abort the whole thing. If we want to465+ # ignore errors from any of these, just make sure not to ignore466+ # errors from the above "$doit $cpprog $src $dsttmp" command.467+ #468+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&469+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&470+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&471+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&472+473+ # If -C, don't bother to copy if it wouldn't change the file.474+ if $copy_on_change &&475+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&476+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&477+478+ eval "$initialize_posix_glob" &&479+ $posix_glob set -f &&480+ set X $old && old=:$2:$4:$5:$6 &&481+ set X $new && new=:$2:$4:$5:$6 &&482+ $posix_glob set +f &&483+484+ test "$old" = "$new" &&485+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1486+ then487+ rm -f "$dsttmp"488+ else489+ # Rename the file to the real destination.490+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||491+492+ # The rename failed, perhaps because mv can't rename something else493+ # to itself, or perhaps because mv is so ancient that it does not494+ # support -f.495+ {496+ # Now remove or move aside any old file at destination location.497+ # We try this two ways since rm can't unlink itself on some498+ # systems and the destination file might be busy for other499+ # reasons. In this case, the final cleanup might fail but the new500+ # file should still install successfully.501+ {502+ test ! -f "$dst" ||503+ $doit $rmcmd -f "$dst" 2>/dev/null ||504+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&505+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }506+ } ||507+ { echo "$0: cannot unlink or rename $dst" >&2508+ (exit 1); exit 1509+ }510+ } &&511+512+ # Now rename the file to the real destination.513+ $doit $mvcmd "$dsttmp" "$dst"514+ }515+ fi || exit 1516+517+ trap '' 0518+ fi519+done520+521+# Local variables:522+# eval: (add-hook 'write-file-hooks 'time-stamp)523+# time-stamp-start: "scriptversion="524+# time-stamp-format: "%:y-%02m-%02d.%02H"525+# time-stamp-time-zone: "UTC"526+# time-stamp-end: "; # UTC"527+# End:added:config/missing+331 added
1+#! /bin/sh2+# Common stub for a few missing GNU programs while installing.3+4+scriptversion=2012-01-06.13; # UTC5+6+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,7+# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.8+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.9+10+# This program is free software; you can redistribute it and/or modify11+# it under the terms of the GNU General Public License as published by12+# the Free Software Foundation; either version 2, or (at your option)13+# any later version.14+15+# This program is distributed in the hope that it will be useful,16+# but WITHOUT ANY WARRANTY; without even the implied warranty of17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18+# GNU General Public License for more details.19+20+# You should have received a copy of the GNU General Public License21+# along with this program. If not, see <http://www.gnu.org/licenses/>.22+23+# As a special exception to the GNU General Public License, if you24+# distribute this file as part of a program that contains a25+# configuration script generated by Autoconf, you may include it under26+# the same distribution terms that you use for the rest of that program.27+28+if test $# -eq 0; then29+ echo 1>&2 "Try \`$0 --help' for more information"30+ exit 131+fi32+33+run=:34+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'35+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'36+37+# In the cases where this matters, `missing' is being run in the38+# srcdir already.39+if test -f configure.ac; then40+ configure_ac=configure.ac41+else42+ configure_ac=configure.in43+fi44+45+msg="missing on your system"46+47+case $1 in48+--run)49+ # Try to run requested program, and just exit if it succeeds.50+ run=51+ shift52+ "$@" && exit 053+ # Exit code 63 means version mismatch. This often happens54+ # when the user try to use an ancient version of a tool on55+ # a file that requires a minimum version. In this case we56+ # we should proceed has if the program had been absent, or57+ # if --run hadn't been passed.58+ if test $? = 63; then59+ run=:60+ msg="probably too old"61+ fi62+ ;;63+64+ -h|--h|--he|--hel|--help)65+ echo "\66+$0 [OPTION]... PROGRAM [ARGUMENT]...67+68+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an69+error status if there is no known handling for PROGRAM.70+71+Options:72+ -h, --help display this help and exit73+ -v, --version output version information and exit74+ --run try to run the given command, and emulate it if it fails75+76+Supported PROGRAM values:77+ aclocal touch file \`aclocal.m4'78+ autoconf touch file \`configure'79+ autoheader touch file \`config.h.in'80+ autom4te touch the output file, or create a stub one81+ automake touch all \`Makefile.in' files82+ bison create \`y.tab.[ch]', if possible, from existing .[ch]83+ flex create \`lex.yy.c', if possible, from existing .c84+ help2man touch the output file85+ lex create \`lex.yy.c', if possible, from existing .c86+ makeinfo touch the output file87+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]88+89+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and90+\`g' are ignored when checking the name.91+92+Send bug reports to <bug-automake@gnu.org>."93+ exit $?94+ ;;95+96+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)97+ echo "missing $scriptversion (GNU Automake)"98+ exit $?99+ ;;100+101+ -*)102+ echo 1>&2 "$0: Unknown \`$1' option"103+ echo 1>&2 "Try \`$0 --help' for more information"104+ exit 1105+ ;;106+107+esac108+109+# normalize program name to check for.110+program=`echo "$1" | sed '111+ s/^gnu-//; t112+ s/^gnu//; t113+ s/^g//; t'`114+115+# Now exit if we have it, but it failed. Also exit now if we116+# don't have it and --version was passed (most likely to detect117+# the program). This is about non-GNU programs, so use $1 not118+# $program.119+case $1 in120+ lex*|yacc*)121+ # Not GNU programs, they don't have --version.122+ ;;123+124+ *)125+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then126+ # We have it, but it failed.127+ exit 1128+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then129+ # Could not run --version or --help. This is probably someone130+ # running `$TOOL --version' or `$TOOL --help' to check whether131+ # $TOOL exists and not knowing $TOOL uses missing.132+ exit 1133+ fi134+ ;;135+esac136+137+# If it does not exist, or fails to run (possibly an outdated version),138+# try to emulate it.139+case $program in140+ aclocal*)141+ echo 1>&2 "\142+WARNING: \`$1' is $msg. You should only need it if143+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want144+ to install the \`Automake' and \`Perl' packages. Grab them from145+ any GNU archive site."146+ touch aclocal.m4147+ ;;148+149+ autoconf*)150+ echo 1>&2 "\151+WARNING: \`$1' is $msg. You should only need it if152+ you modified \`${configure_ac}'. You might want to install the153+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU154+ archive site."155+ touch configure156+ ;;157+158+ autoheader*)159+ echo 1>&2 "\160+WARNING: \`$1' is $msg. You should only need it if161+ you modified \`acconfig.h' or \`${configure_ac}'. You might want162+ to install the \`Autoconf' and \`GNU m4' packages. Grab them163+ from any GNU archive site."164+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`165+ test -z "$files" && files="config.h"166+ touch_files=167+ for f in $files; do168+ case $f in169+ *:*) touch_files="$touch_files "`echo "$f" |170+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;171+ *) touch_files="$touch_files $f.in";;172+ esac173+ done174+ touch $touch_files175+ ;;176+177+ automake*)178+ echo 1>&2 "\179+WARNING: \`$1' is $msg. You should only need it if180+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.181+ You might want to install the \`Automake' and \`Perl' packages.182+ Grab them from any GNU archive site."183+ find . -type f -name Makefile.am -print |184+ sed 's/\.am$/.in/' |185+ while read f; do touch "$f"; done186+ ;;187+188+ autom4te*)189+ echo 1>&2 "\190+WARNING: \`$1' is needed, but is $msg.191+ You might have modified some files without having the192+ proper tools for further handling them.193+ You can get \`$1' as part of \`Autoconf' from any GNU194+ archive site."195+196+ file=`echo "$*" | sed -n "$sed_output"`197+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`198+ if test -f "$file"; then199+ touch $file200+ else201+ test -z "$file" || exec >$file202+ echo "#! /bin/sh"203+ echo "# Created by GNU Automake missing as a replacement of"204+ echo "# $ $@"205+ echo "exit 0"206+ chmod +x $file207+ exit 1208+ fi209+ ;;210+211+ bison*|yacc*)212+ echo 1>&2 "\213+WARNING: \`$1' $msg. You should only need it if214+ you modified a \`.y' file. You may need the \`Bison' package215+ in order for those modifications to take effect. You can get216+ \`Bison' from any GNU archive site."217+ rm -f y.tab.c y.tab.h218+ if test $# -ne 1; then219+ eval LASTARG=\${$#}220+ case $LASTARG in221+ *.y)222+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`223+ if test -f "$SRCFILE"; then224+ cp "$SRCFILE" y.tab.c225+ fi226+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`227+ if test -f "$SRCFILE"; then228+ cp "$SRCFILE" y.tab.h229+ fi230+ ;;231+ esac232+ fi233+ if test ! -f y.tab.h; then234+ echo >y.tab.h235+ fi236+ if test ! -f y.tab.c; then237+ echo 'main() { return 0; }' >y.tab.c238+ fi239+ ;;240+241+ lex*|flex*)242+ echo 1>&2 "\243+WARNING: \`$1' is $msg. You should only need it if244+ you modified a \`.l' file. You may need the \`Flex' package245+ in order for those modifications to take effect. You can get246+ \`Flex' from any GNU archive site."247+ rm -f lex.yy.c248+ if test $# -ne 1; then249+ eval LASTARG=\${$#}250+ case $LASTARG in251+ *.l)252+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`253+ if test -f "$SRCFILE"; then254+ cp "$SRCFILE" lex.yy.c255+ fi256+ ;;257+ esac258+ fi259+ if test ! -f lex.yy.c; then260+ echo 'main() { return 0; }' >lex.yy.c261+ fi262+ ;;263+264+ help2man*)265+ echo 1>&2 "\266+WARNING: \`$1' is $msg. You should only need it if267+ you modified a dependency of a manual page. You may need the268+ \`Help2man' package in order for those modifications to take269+ effect. You can get \`Help2man' from any GNU archive site."270+271+ file=`echo "$*" | sed -n "$sed_output"`272+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`273+ if test -f "$file"; then274+ touch $file275+ else276+ test -z "$file" || exec >$file277+ echo ".ab help2man is required to generate this page"278+ exit $?279+ fi280+ ;;281+282+ makeinfo*)283+ echo 1>&2 "\284+WARNING: \`$1' is $msg. You should only need it if285+ you modified a \`.texi' or \`.texinfo' file, or any other file286+ indirectly affecting the aspect of the manual. The spurious287+ call might also be the consequence of using a buggy \`make' (AIX,288+ DU, IRIX). You might want to install the \`Texinfo' package or289+ the \`GNU make' package. Grab either from any GNU archive site."290+ # The file to touch is that specified with -o ...291+ file=`echo "$*" | sed -n "$sed_output"`292+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`293+ if test -z "$file"; then294+ # ... or it is the one specified with @setfilename ...295+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`296+ file=`sed -n '297+ /^@setfilename/{298+ s/.* \([^ ]*\) *$/\1/299+ p300+ q301+ }' $infile`302+ # ... or it is derived from the source name (dir/f.texi becomes f.info)303+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info304+ fi305+ # If the file does not exist, the user really needs makeinfo;306+ # let's fail without touching anything.307+ test -f $file || exit 1308+ touch $file309+ ;;310+311+ *)312+ echo 1>&2 "\313+WARNING: \`$1' is needed, and is $msg.314+ You might have modified some files without having the315+ proper tools for further handling them. Check the \`README' file,316+ it often tells you about the needed prerequisites for installing317+ this package. You may also peek at any GNU archive site, in case318+ some other package would contain this missing \`$1' program."319+ exit 1320+ ;;321+esac322+323+exit 0324+325+# Local variables:326+# eval: (add-hook 'write-file-hooks 'time-stamp)327+# time-stamp-start: "scriptversion="328+# time-stamp-format: "%:y-%02m-%02d.%02H"329+# time-stamp-time-zone: "UTC"330+# time-stamp-end: "; # UTC"331+# End:added:config/ylwrap+226 added
1+#! /bin/sh2+# ylwrap - wrapper for lex/yacc invocations.3+4+scriptversion=2011-08-25.18; # UTC5+6+# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,7+# 2007, 2009, 2010, 2011 Free Software Foundation, Inc.8+#9+# Written by Tom Tromey <tromey@cygnus.com>.10+#11+# This program is free software; you can redistribute it and/or modify12+# it under the terms of the GNU General Public License as published by13+# the Free Software Foundation; either version 2, or (at your option)14+# any later version.15+#16+# This program is distributed in the hope that it will be useful,17+# but WITHOUT ANY WARRANTY; without even the implied warranty of18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19+# GNU General Public License for more details.20+#21+# You should have received a copy of the GNU General Public License22+# along with this program. If not, see <http://www.gnu.org/licenses/>.23+24+# As a special exception to the GNU General Public License, if you25+# distribute this file as part of a program that contains a26+# configuration script generated by Autoconf, you may include it under27+# the same distribution terms that you use for the rest of that program.28+29+# This file is maintained in Automake, please report30+# bugs to <bug-automake@gnu.org> or send patches to31+# <automake-patches@gnu.org>.32+33+case "$1" in34+ '')35+ echo "$0: No files given. Try \`$0 --help' for more information." 1>&236+ exit 137+ ;;38+ --basedir)39+ basedir=$240+ shift 241+ ;;42+ -h|--h*)43+ cat <<\EOF44+Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...45+46+Wrapper for lex/yacc invocations, renaming files as desired.47+48+ INPUT is the input file49+ OUTPUT is one file PROG generates50+ DESIRED is the file we actually want instead of OUTPUT51+ PROGRAM is program to run52+ ARGS are passed to PROG53+54+Any number of OUTPUT,DESIRED pairs may be used.55+56+Report bugs to <bug-automake@gnu.org>.57+EOF58+ exit $?59+ ;;60+ -v|--v*)61+ echo "ylwrap $scriptversion"62+ exit $?63+ ;;64+esac65+66+67+# The input.68+input="$1"69+shift70+case "$input" in71+ [\\/]* | ?:[\\/]*)72+ # Absolute path; do nothing.73+ ;;74+ *)75+ # Relative path. Make it absolute.76+ input="`pwd`/$input"77+ ;;78+esac79+80+pairlist=81+while test "$#" -ne 0; do82+ if test "$1" = "--"; then83+ shift84+ break85+ fi86+ pairlist="$pairlist $1"87+ shift88+done89+90+# The program to run.91+prog="$1"92+shift93+# Make any relative path in $prog absolute.94+case "$prog" in95+ [\\/]* | ?:[\\/]*) ;;96+ *[\\/]*) prog="`pwd`/$prog" ;;97+esac98+99+# FIXME: add hostname here for parallel makes that run commands on100+# other machines. But that might take us over the 14-char limit.101+dirname=ylwrap$$102+do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'103+trap "ret=129; $do_exit" 1104+trap "ret=130; $do_exit" 2105+trap "ret=141; $do_exit" 13106+trap "ret=143; $do_exit" 15107+mkdir $dirname || exit 1108+109+cd $dirname110+111+case $# in112+ 0) "$prog" "$input" ;;113+ *) "$prog" "$@" "$input" ;;114+esac115+ret=$?116+117+if test $ret -eq 0; then118+ set X $pairlist119+ shift120+ first=yes121+ # Since DOS filename conventions don't allow two dots,122+ # the DOS version of Bison writes out y_tab.c instead of y.tab.c123+ # and y_tab.h instead of y.tab.h. Test to see if this is the case.124+ y_tab_nodot="no"125+ if test -f y_tab.c || test -f y_tab.h; then126+ y_tab_nodot="yes"127+ fi128+129+ # The directory holding the input.130+ input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`131+ # Quote $INPUT_DIR so we can use it in a regexp.132+ # FIXME: really we should care about more than `.' and `\'.133+ input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`134+135+ while test "$#" -ne 0; do136+ from="$1"137+ # Handle y_tab.c and y_tab.h output by DOS138+ if test $y_tab_nodot = "yes"; then139+ if test $from = "y.tab.c"; then140+ from="y_tab.c"141+ else142+ if test $from = "y.tab.h"; then143+ from="y_tab.h"144+ fi145+ fi146+ fi147+ if test -f "$from"; then148+ # If $2 is an absolute path name, then just use that,149+ # otherwise prepend `../'.150+ case "$2" in151+ [\\/]* | ?:[\\/]*) target="$2";;152+ *) target="../$2";;153+ esac154+155+ # We do not want to overwrite a header file if it hasn't156+ # changed. This avoid useless recompilations. However the157+ # parser itself (the first file) should always be updated,158+ # because it is the destination of the .y.c rule in the159+ # Makefile. Divert the output of all other files to a temporary160+ # file so we can compare them to existing versions.161+ if test $first = no; then162+ realtarget="$target"163+ target="tmp-`echo $target | sed s/.*[\\/]//g`"164+ fi165+ # Edit out `#line' or `#' directives.166+ #167+ # We don't want the resulting debug information to point at168+ # an absolute srcdir; it is better for it to just mention the169+ # .y file with no path.170+ #171+ # We want to use the real output file name, not yy.lex.c for172+ # instance.173+ #174+ # We want the include guards to be adjusted too.175+ FROM=`echo "$from" | sed \176+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\177+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`178+ TARGET=`echo "$2" | sed \179+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\180+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`181+182+ sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \183+ -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?184+185+ # Check whether header files must be updated.186+ if test $first = no; then187+ if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then188+ echo "$2" is unchanged189+ rm -f "$target"190+ else191+ echo updating "$2"192+ mv -f "$target" "$realtarget"193+ fi194+ fi195+ else196+ # A missing file is only an error for the first file. This197+ # is a blatant hack to let us support using "yacc -d". If -d198+ # is not specified, we don't want an error when the header199+ # file is "missing".200+ if test $first = yes; then201+ ret=1202+ fi203+ fi204+ shift205+ shift206+ first=no207+ done208+else209+ ret=$?210+fi211+212+# Remove the directory.213+cd ..214+rm -rf $dirname215+216+exit $ret217+218+# Local Variables:219+# mode: shell-script220+# sh-indentation: 2221+# eval: (add-hook 'write-file-hooks 'time-stamp)222+# time-stamp-start: "scriptversion="223+# time-stamp-format: "%:y-%02m-%02d.%02H"224+# time-stamp-time-zone: "UTC"225+# time-stamp-end: "; # UTC"226+# End:modified:docs/content/3.manual/manual.yml+2 added-2 removed
164 unmodified lines165 166 You can also look up fields of an object using syntax like167 `.["foo"]` (.foo above is a shorthand version of this). This168 one works for arrays as well, if the key is an169- integer. Arrays are zero-based (like javascript), so .[2]169+ integer. Arrays are zero-based (like javascript), so `.[2]`170 returns the third element of the array.171 172 examples:173 - program: '.[0]'96 unmodified lines270 in `[.foo, .bar, .baz]`) or to "collect" all the results of a271 filter into an array (as in `[.items[].name]`)272 273 Once you understand the "," operator, you can look at jq's array274- syntax in a different light: the expression [1,2,3] is not using a274+ syntax in a different light: the expression `[1,2,3]` is not using a275 built-in syntax for comma-separated arrays, but is instead applying276 the `[]` operator (collect results) to the expression 1,2,3 (which277 produces three different results).278 922 unmodified linesadded:docs/default_manpage.md+22 added
12345678910111213141516171819202122jq(1) -- Command-line JSON processor====================================
## DESCRIPTION
`jq` can transform JSON in various ways, by selecting, iterating,reducing and otherwise mangling JSON documents.
This version of `jq` was built without a manual, so this manpage is astub. For full documentation of the `jq` language, see:
http://stedolan.github.com/jq ## BUGS
Presumably. Report them or discuss them at:
https://github.com/stedolan/jq/issues
## AUTHOR
Stephen Dolan `<mu@netsoc.tcd.ie>`modified:docs/Rakefile+35 added
1+require 'yaml'2 require 'bonsai'3 require 'liquid'4 require 'maruku'5 require 'json'57 unmodified lines63 Bonsai.root_dir = Dir.pwd64 Bonsai::Exporter.publish!65 end66 67+$BINARIES = {68+ :osx32 => "--host=i686-apple-darwin10 CFLAGS='-m32 -g -O'",69+ :osx64 => "--host=i686-apple-darwin10 CFLAGS='-m64 -g -O'",70+ :win32 => "--host=i686-w64-mingw32 CFLAGS='-g -O'",71+ :win64 => "--host=x86_64-w64-mingw32 CFLAGS='-g -O'",72+ :linux32 => "--host=x86_64-linux-gnu CFLAGS='-m32 -g -O'",73+ :linux64 => "--host=x86_64-linux-gnu CFLAGS='-m64 -g -O'"74+}75+76+$BINARIES.each do |name, args|77+ file "../build/#{name}" do |t|78+ sh "MAKEFLAGS=-j4 ../scripts/crosscompile #{name} #{args}"79+ end80+ task :binaries => ["../build/#{name}"]81+end82+83+task :binaries => ["output/download"] do84+ $BINARIES.each do |name, args|85+ FileUtils.cp_r "../build/#{name}", "output/download/"86+ end87+end88+89 def load_manual90 YAML::ENGINE.yamler = 'syck'91 YAML::load(File.open("content/3.manual/manual.yml"))92 end26 unmodified lines119 puts Ronn::Document.new(f.path).convert('roff').gsub(/<\/?code>/,"")120 end 121 end122 123+task :manpage_default => ["default_manpage.md"] do124+ puts Ronn::Document.new("default_manpage.md").convert('roff').gsub(/<\/?code>/,"")125+end126+127 task :mantests do128 load_manual['sections'].each do |section|129 (section['entries'] || []).each do |entry|130 (entry['examples'] || []).each do |example|4 unmodified lines135 end136 end137 end138 end139+140+directory "output/download/source"141+task :tarball => ["output/download/source"] do142+ sh "cd ..; ./configure && make dist && make distclean"143+ sh "cp ../jq-*.tar.gz output/download/source"144+end145+146+task :dist => [:build, :binaries, :tarball]added:docs/README.md+25 added
12345678910111213141516171819202122232425Documentation=============
The jq website, manpages and some of the tests are generated from thisdirectory. The directory holds a [Bonsai](http://tinytree.info)website, and the manual is a YAML file in `content/3.manual`.
To build the documentation (including building the jq manpage), you'llneed a working Ruby setup. The easiest way to get one is to installRVM and Ruby 1.9.3 like so:
\curl -L https://get.rvm.io | bash -s stable --ruby=1.9.3
After that finishes installing, you'll need to make sure RVM is onyour path by doing `source $HOME/.rvm/scripts/rvm`, or just opening anew shell. See <http://rvm.io> for more info on RVM.
Once RVM is installed, you can install all the dependencies for jq'sdocumentation build by running this from the `docs` directory:
bundle install
When bundle manages to install the dependencies, rerun `./configure`in the jq root directory and then the Makefile will be able togenerate the jq manpage.modified:docs/site.yml+5 added-1 removed
12345678910111213141516171418# The key value pairs found below are available within the templates.
:url: http://stedolan.github.io/jq
# This line is modified by the Makefile. To change the version number,# edit the Autoconf version number at the top of configure.acjq_version: 1.2
root: '/jq'footer: | This website is made with [Bonsai](http://www.tinytree.info) and [Twitter Bootstrap](http://twitter.github.com/bootstrap/), themed with [Bootswatch](http://bootswatch.com).
jq is licensed under the MIT license (code) and the [CC-BY-3.0](http://creativecommons.org/licenses/by/3.0/) license (docs).No newline at end of file (docs).added:scripts/crosscompile+31 added
1+#!/bin/sh2+3+# This script is used to cross-compile binaries for 4+# platforms other than the current one5+6+# Usage: $0 <platformname> <configure options>7+# <platformname> is arbitrary, it is the name8+# of the directory which will be created to contain9+# the output binaries.10+11+# e.g. $0 win32 --host=i686-w64-mingw3212+13+set -e14+cd `dirname "$0"`/../build15+16+plat="$1"17+[ -z "$plat" ] && exit 118+shift19+20+[ -d "$plat" ] || mkdir "$plat"21+rm -rf "$plat/tmp"22+mkdir "$plat/tmp"23+cd "$plat/tmp"24+mkdir install_other25+../../../configure \26+ --prefix="`pwd`/install_other" \27+ --bindir="`pwd`/.." \28+ "$@"29+make install-binaries30+cd ..31+rm -rf tmpadded:tests/all.test+576 added
1+# Tests are groups of three lines: program, input, expected output2+# Blank lines and lines starting with # are ignored3+4+#5+# Simple value tests to check parser. Input is irrelevant6+#7+8+true9+null10+true11+12+false13+null14+false15+16+null17+4218+null19+20+121+null22+123+24+25+-126+null27+-128+29+# FIXME: much more number testing needed30+31+{}32+null33+{}34+35+[]36+null37+[]38+39+# The input line starts with a 0xFEFF (byte order mark) codepoint40+# No, there is no reason to have a byte order mark in UTF8 text.41+# But apparently people do, so jq shouldn't break on it.42+.43+"byte order mark"44+"byte order mark"45+46+# We test escapes by matching them against Unicode codepoints47+# FIXME: more tests needed for weird unicode stuff (e.g. utf16 pairs)48+"Aa\r\n\t\b\f\u03bc"49+null50+"Aa\u000d\u000a\u0009\u0008\u000c\u03bc"51+52+.53+"Aa\r\n\t\b\f\u03bc"54+"Aa\u000d\u000a\u0009\u0008\u000c\u03bc"55+56+"inter\("pol" + "ation")"57+null58+"interpolation"59+60+@text,@json,([1,.] | @csv),@html,@uri,@sh,@base6461+"<>&'\""62+"<>&'\""63+"\"<>&'\\\"\""64+"1,\"<>&'\"\"\""65+"<>&'""66+"%3c%3e%26'%22"67+"'<>&'\\''\"'"68+"PD4mJyI="69+70+@uri71+"\u03bc"72+"%ce%bc"73+74+@html "<b>\(.)</b>"75+"<script>hax</script>"76+"<b><script>hax</script></b>"77+78+#79+# Dictionary construction syntax80+#81+82+{a: 1}83+null84+{"a":1}85+86+{a,b,(.d):.a,e:.b}87+{"a":1, "b":2, "c":3, "d":"c"}88+{"a":1, "b":2, "c":1, "e":2}89+90+{"a",b,"a$\(1+1)"}91+{"a":1, "b":2, "c":3, "a$2":4}92+{"a":1, "b":2, "a$2":4}93+94+#95+# Field access, piping96+#97+98+.foo99+{"foo": 42, "bar": 43}100+42101+102+.foo | .bar103+{"foo": {"bar": 42}, "bar": "badvalue"}104+42105+106+.foo.bar107+{"foo": {"bar": 42}, "bar": "badvalue"}108+42109+110+.foo_bar111+{"foo_bar": 2}112+2113+114+.["foo"].bar115+{"foo": {"bar": 42}, "bar": "badvalue"}116+42117+118+119+#120+# Multiple outputs, iteration121+#122+123+.[]124+[1,2,3]125+1126+2127+3128+129+1,1130+[]131+1132+1133+134+1,.135+[]136+1137+[]138+139+[.]140+[2]141+[[2]]142+143+[[2]]144+[3]145+[[2]]146+147+[{}]148+[2]149+[{}]150+151+[.[]]152+["a"]153+["a"]154+155+[(.,1),((.,.[]),(2,3))]156+["a","b"]157+[["a","b"],1,["a","b"],"a","b",2,3]158+159+[([5,5][]),.,.[]]160+[1,2,3]161+[5,5,[1,2,3],1,2,3]162+163+{x: (1,2)},{x:3} | .x164+null165+1166+2167+3168+169+#170+# Variables171+#172+173+1 as $x | 2 as $y | [$x,$y,$x]174+null175+[1,2,1]176+177+[1,2,3][] as $x | [[4,5,6,7][$x]]178+null179+[5]180+[6]181+[7]182+183+42 as $x | . | . | . + 432 | $x + 1184+34324185+43186+187+1 as $x | [$x,$x,$x as $x | $x]188+null189+[1,1,1]190+191+# [.,(.[] | {x:.},.),.,.[]]192+193+#194+# Builtin functions195+#196+197+1+1198+null199+2200+201+1+1202+"wtasdf"203+2.0204+205+2-1206+null207+1208+209+2-(-1)210+null211+3212+213+1e+0+0.001e3214+"I wonder what this will be?"215+20e-1216+217+.+4218+15219+19.0220+221+.+null222+{"a":42}223+{"a":42}224+225+null+.226+null227+null228+229+.a+.b230+{"a":42}231+42232+233+[1,2,3] + [.]234+null235+[1,2,3,null]236+237+{"a":1} + {"b":2} + {"c":3}238+"asdfasdf"239+{"a":1, "b":2, "c":3}240+241+"asdf" + "jkl;" + . + . + .242+"some string"243+"asdfjkl;some stringsome stringsome string"244+245+"\u0000\u0020\u0000" + .246+"\u0000\u0020\u0000"247+"\u0000 \u0000\u0000 \u0000"248+249+42 - .250+11251+31252+253+[1,2,3,4,1] - [.,3]254+1255+[2,4]256+257+[10 * 20, 20 / .]258+4259+[200, 5]260+261+1 + 2 * 2 + 10 / 2262+null263+10264+265+[16 / 4 / 2, 16 / 4 * 2, 16 - 4 - 2, 16 - 4 + 2]266+null267+[2, 8, 10, 14]268+269+1 + tonumber + ("10" | tonumber)270+4271+15272+273+[{"a":42},.object,10,.num,false,true,null,"b",[1,4]] | .[] as $x | [$x == .[]]274+{"object": {"a":42}, "num":10.0}275+[true, true, false, false, false, false, false, false, false]276+[true, true, false, false, false, false, false, false, false]277+[false, false, true, true, false, false, false, false, false]278+[false, false, true, true, false, false, false, false, false]279+[false, false, false, false, true, false, false, false, false]280+[false, false, false, false, false, true, false, false, false]281+[false, false, false, false, false, false, true, false, false]282+[false, false, false, false, false, false, false, true, false]283+[false, false, false, false, false, false, false, false, true ]284+285+[.[] | length]286+[[], {}, [1,2], {"a":42}, "asdf"]287+[0, 0, 2, 1, 4]288+289+map(keys)290+[{}, {"abcd":1,"abc":2,"abcde":3}, {"x":1, "z": 3, "y":2}]291+[[], ["abc","abcd","abcde"], ["x","y","z"]]292+293+[1,2,empty,3,empty,4]294+null295+[1,2,3,4]296+297+map(add)298+[[], [1,2,3], ["a","b","c"], [[3],[4,5],[6]], [{"a":1}, {"b":2}, {"a":3}]]299+[null, 6, "abc", [3,4,5,6], {"a":3, "b": 2}]300+301+#302+# User-defined functions303+# Oh god.304+#305+306+def f: . + 1; def g: def g: . + 100; f | g | f; (f | g), g307+3.0308+106.0309+105.0310+311+def f: (1000,2000); f312+123412345313+1000314+2000315+316+([1,2] + [4,5])317+[1,2,3]318+[1,2,4,5]319+320+true321+[1]322+true323+324+null,1,null325+"hello"326+null327+1328+null329+330+[1,2,3]331+[5,6]332+[1,2,3]333+334+def f(x): x | x; f([.], . + [42])335+[1,2,3]336+[[[1,2,3]]]337+[[1,2,3],42]338+[[1,2,3,42]]339+[1,2,3,42,42]340+341+# test closures and lexical scoping342+def id(x):x; 2000 as $x | def f(x):1 as $x | id([$x, x, x]); def g(x): 100 as $x | f($x,$x+x); g($x)343+"more testing"344+[1,100,2100.0,100,2100.0]345+346+# test backtracking through function calls and returns347+# this test is *evil*348+[[20,10][1,0] as $x | def f: (100,200) as $y | def g: [$x + $y, .]; . + $x | g; f[0] | [f][0][1] | f]349+999999999350+[[110.0, 130.0], [210.0, 130.0], [110.0, 230.0], [210.0, 230.0], [120.0, 160.0], [220.0, 160.0], [120.0, 260.0], [220.0, 260.0]]351+352+# test recursion353+def fac: if . == 1 then 1 else . * (. - 1 | fac) end; [.[] | fac]354+[1,2,3,4]355+[1,2,6,24]356+357+# test stack overflow and reallocation358+# this test is disabled for now, it takes a realllllly long time.359+# def f: if length > 1000 then . else .+[1]|f end; f | length360+# []361+# 1001362+363+fold 0 as $s (.[] | $s + .)364+[1,2,4]365+7366+367+#368+# Paths369+#370+371+path(.foo[0,1])372+null373+["foo", 0]374+["foo", 1]375+376+path(.[] | select(.>3))377+[1,5,3]378+[1]379+380+path(.)381+42382+[]383+384+["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])385+{"bar": 42, "foo": ["a", "b", "c", "d"]}386+"b"387+{"bar": 42, "foo": ["a", 20, "c", "d"]}388+{"bar": 42, "foo": ["a", "c", "d"]}389+390+map(getpath([2])), map(setpath([2]; 42)), map(delpaths([[2]]))391+[[0], [0,1], [0,1,2]]392+[null, null, 2]393+[[0,null,42], [0,1,42], [0,1,42]]394+[[0], [0,1], [0,1]]395+396+map(delpaths([[0,"foo"]]))397+[[{"foo":2, "x":1}], [{"bar":2}]]398+[[{"x":1}], [{"bar":2}]]399+400+["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])401+{"bar":false}402+null403+{"bar":false, "foo": [null, 20]}404+{"bar":false}405+406+delpaths([[-200]])407+[1,2,3]408+[1,2,3]409+410+del(.), del(empty), del((.foo,.bar,.baz) | .[2,3,0]), del(.foo[0], .bar[0], .foo, .baz.bar[0].x)411+{"foo": [0,1,2,3,4], "bar": [0,1]}412+null413+{"foo": [0,1,2,3,4], "bar": [0,1]}414+{"foo": [1,4], "bar": [1]}415+{"bar": [1]}416+417+#418+# Assignment419+#420+.message = "goodbye"421+{"message": "hello"}422+{"message": "goodbye"}423+424+.foo = .bar425+{"bar":42}426+{"foo":42, "bar":42}427+428+.foo |= .+1429+{"foo": 42}430+{"foo": 43}431+432+.[] += 2, .[] *= 2, .[] -= 2, .[] /= 2433+[1,3,5]434+[3,5,7]435+[2,6,10]436+[-1,1,3]437+[0.5, 1.5, 2.5]438+439+.foo += .foo440+{"foo":2}441+{"foo":4}442+443+.[0].a |= {"old":., "new":(.+1)}444+[{"a":1,"b":2}]445+[{"a":{"old":1, "new":2},"b":2}]446+447+def inc(x): x |= .+1; inc(.[].a)448+[{"a":1,"b":2},{"a":2,"b":4},{"a":7,"b":8}]449+[{"a":2,"b":2},{"a":3,"b":4},{"a":8,"b":8}]450+451+.[2][3] = 1452+[4]453+[4, null, [null, null, null, 1]]454+455+.foo[2].bar = 1456+{"foo":[11], "bar":42}457+{"foo":[11,null,{"bar":1}], "bar":42}458+459+#460+# Conditionals461+#462+463+[.[] | if .foo then "yep" else "nope" end]464+[{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}]465+["yep","yep","yep","yep","nope","nope","yep","nope"]466+467+[.[] | if .baz then "strange" elif .foo then "yep" else "nope" end]468+[{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}]469+["yep","yep","yep","yep","nope","nope","yep","nope"]470+471+472+# FIXME: define/test behaviour of 'if (.foo,.bar) then A else B end'473+474+[.[] | [.foo[] // .bar]]475+[{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}]476+[[1,2], [1], [3], [42], [41]]477+478+# FIXME: behaviour of update operators479+# .[] //= .[0]480+# ["hello",true,false,[false],null]481+# ["hello",true,"hello",[false],"hello"]482+483+.[] | [.[0] and .[1], .[0] or .[1]]484+[[true,[]], [false,1], [42,null], [null,false]]485+[true,true]486+[false,true]487+[false,true]488+[false,false]489+490+[.[] | not]491+[1,0,false,null,true,"hello"]492+[false,false,true,true,false,false]493+494+# Check numeric comparison binops495+[10 > 0, 10 > 10, 10 > 20, 10 < 0, 10 < 10, 10 < 20]496+{}497+[true,false,false,false,false,true]498+499+[10 >= 0, 10 >= 10, 10 >= 20, 10 <= 0, 10 <= 10, 10 <= 20]500+{}501+[true,true,false,false,true,true]502+503+# And some in/equality tests504+[ 10 == 10, 10 != 10, 10 != 11, 10 == 11]505+{}506+[true,false,true,false]507+508+["hello" == "hello", "hello" != "hello", "hello" == "world", "hello" != "world" ]509+{}510+[true,false,false,true]511+512+[[1,2,3] == [1,2,3], [1,2,3] != [1,2,3], [1,2,3] == [4,5,6], [1,2,3] != [4,5,6]]513+{}514+[true,false,false,true]515+516+[{"foo":42} == {"foo":42},{"foo":42} != {"foo":42}, {"foo":42} != {"bar":42}, {"foo":42} == {"bar":42}]517+{}518+[true,false,true,false]519+520+# ugly complicated thing521+[{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":18},"world"]},{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":19},"world"]}]522+{}523+[true,false]524+525+# containment operator526+[("foo" | contains("foo")), ("foobar" | contains("foo")), ("foo" | contains("foobar"))]527+{}528+[true, true, false]529+530+map(.[1] as $needle | .[0] | contains($needle))531+[[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]]532+[true, true, true, false, false]533+534+map(.[1] as $needle | .[0] | contains($needle))535+[[["foobar", "foobaz"], ["baz", "bar"]], [["foobar", "foobaz"], ["foo"]], [["foobar", "foobaz"], ["blap"]]]536+[true, true, false]537+538+[({foo: 12, bar:13} | contains({foo: 12})), ({foo: 12} | contains({})), ({foo: 12, bar:13} | contains({baz:14}))]539+{}540+[true, true, false]541+542+{foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {}}})543+{}544+true545+546+{foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {bar: 14}}})547+{}548+false549+550+sort551+[42,[2,5,3,11],10,{"a":42,"b":2},{"a":42},true,2,[2,6],"hello",null,[2,5,6],{"a":[],"b":1},"abc","ab",[3,10],{},false,"abcd",null]552+[null,null,false,true,2,10,42,"ab","abc","abcd","hello",[2,5,3,11],[2,5,6],[2,6],[3,10],{},{"a":42},{"a":42,"b":2},{"a":[],"b":1}]553+554+(sort_by(.b) | sort_by(.a)), sort_by(.a, .b), sort_by(.b, .c), group_by(.b), group_by(.a + .b - .c == 2)555+[{"a": 1, "b": 4, "c": 14}, {"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}, {"a": 0, "b": 2, "c": 43}]556+[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]557+[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]558+[{"a": 4, "b": 1, "c": 3}, {"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 3}, {"a": 1, "b": 4, "c": 14}]559+[[{"a": 4, "b": 1, "c": 3}], [{"a": 0, "b": 2, "c": 43}], [{"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}]]560+[[{"a": 1, "b": 4, "c": 14}, {"a": 0, "b": 2, "c": 43}], [{"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}]]561+562+unique563+[1,2,5,3,5,3,1,3]564+[1,2,3,5]565+566+[min, max, min_by(.[1]), max_by(.[1]), min_by(.[2]), max_by(.[2])]567+[[4,2,"a"],[3,1,"a"],[2,4,"a"],[1,3,"a"]]568+[[1,3,"a"],[4,2,"a"],[3,1,"a"],[2,4,"a"],[4,2,"a"],[1,3,"a"]]569+570+[min,max,min_by(.),max_by(.)]571+[]572+[null,null,null,null]573+574+.foo[.baz]575+{"foo":{"bar":4},"baz":"bar"}576+4added:tests/run+3 added
1+#!/bin/sh2+3+cat $@ | valgrind --error-exitcode=1 -q --leak-check=full ./jq --run-testsmodified:.gitignore+21 added-6 removed
1 *.o2 *~3 4-# Autogenerated5-*.gen.*6-7-jq_test8-build4 jq5 jq.16 7 # Something delightfully recursive happens otherwise13-docs/content/2.download/source/*8+docs/content/2.download/source/*9+10+# Autogenerated11+lexer.c12+lexer.h13+parser.c14+parser.h15+16+# Autotools junk17+.deps18+*.log19+stamp-h120+config.log21+config.status22+autom4te.cache23+config.h24+Makefile25+jq-*.tar.gz26+configure27+aclocal.m428+Makefile.inadded:AUTHORS+6 added
1+Created By:2+Stephen Dolan <mu@netsoc.tcd.ie>3+4+Contributions by5+Anthony Shortland <anthony.shortland@me.com> - rpmbuild target6+Lee Thompson <stagr.lee@gmail.com> - autoconf stuffmodified:builtin.c+1 added-1 removed
1 #include <string.h>2 #include "builtin.h"3 #include "compile.h"4-#include "parser.h"4+#include "jq_parser.h"5 #include "locfile.h"6 #include "jv_aux.h"7 #include "jv_unicode.h"8 557 unmodified linesadded:config.h.in+32 added
1+/* config.h.in. Generated from configure.ac by autoheader. */2+3+/* Define to 1 if your C compiler doesn't accept -c and -o together. */4+#undef NO_MINUS_C_MINUS_O5+6+/* Name of package */7+#undef PACKAGE8+9+/* Define to the address where bug reports for this package should be sent. */10+#undef PACKAGE_BUGREPORT11+12+/* Define to the full name of this package. */13+#undef PACKAGE_NAME14+15+/* Define to the full name and version of this package. */16+#undef PACKAGE_STRING17+18+/* Define to the one symbol short name of this package. */19+#undef PACKAGE_TARNAME20+21+/* Define to the home page for this package. */22+#undef PACKAGE_URL23+24+/* Define to the version of this package. */25+#undef PACKAGE_VERSION26+27+/* Version number of package */28+#undef VERSION29+30+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a31+ `char[]'. */32+#undef YYTEXT_POINTERadded:configure.ac+66 added
1+AC_INIT([jq], [1.2], [mu@netsoc.tcd.ie],2+ [jq], [http://stedolan.github.com/jq/])3+4+dnl Created autoconf implementation thompson@dtosolutions, 26NOV125+AC_PREREQ([2.61])6+AC_CONFIG_AUX_DIR([config])7+AM_INIT_AUTOMAKE([parallel-tests foreign])8+AM_SILENT_RULES([yes])9+AC_PROG_CC10+AC_PROG_CC_STDC11+AC_PROG_CPP_WERROR12+AC_PROG_YACC13+14+AM_PROG_CC_C_O15+16+dnl couldn't use AM_PROG_LEX as it doesn't support header files like the17+dnl AC_PROG_YACC macros...18+19+dnl20+dnl these program checks should probably be deleted21+dnl22+23+AC_PROG_LEX24+if test "x$LEX" != xflex; then25+ LEX="$SHELL $missing_dir/missing flex"26+fi27+28+29+dnl Check for valgrind30+AC_CHECK_PROGS(valgrind_cmd, valgrind)31+if test "x$valgrind_cmd" = "x" ; then32+ AC_MSG_WARN([valgrind is required to test jq.])33+fi34+35+36+dnl Don't attempt to build docs if there's no Ruby lying around37+AC_ARG_ENABLE([docs],38+ AC_HELP_STRING([--disable-docs], [don't build docs]))39+40+AS_IF([test "x$enable_docs" != "xno"],[41+ AC_CHECK_PROGS(bundle_cmd, bundle)42+ AS_IF([test "x$bundle_cmd" = "x" || \43+ ! ( cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null )],[44+ AC_MSG_WARN([no bundler])45+ cat <<EOF46+*****************************************************************47+* Ruby dependencies for building jq documentation not found. *48+* You can still build, install and hack on jq, but the manpage *49+* will not be rebuilt and some of the tests won't run. *50+* See docs/README.md for how to install the docs dependencies. *51+*****************************************************************52+EOF53+ enable_docs=no54+ ])55+])56+57+AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])58+AC_SUBST([BUNDLER], ["$bundle_cmd"])59+60+dnl AC_CONFIG_MACRO_DIR([m4])61+AC_CONFIG_HEADERS(config.h)62+AM_INIT_AUTOMAKE([-Wall])63+AC_CONFIG_FILES([Makefile])64+AC_OUTPUT65+66+modified:execute.c+2 added-1 removed
10 unmodified lines11 #include "forkable_stack.h"12 #include "frame_layout.h"13 14 #include "jv_alloc.h"15+#include "jq_parser.h"16 #include "locfile.h"17 #include "jv.h"18 #include "jv_aux.h"19 #include "parser.h"147 unmodified lines167 if (jq->debug_trace_enabled) {168 dump_operation(frame_current_bytecode(&jq->frame_stk), pc);169 printf("\t");170 const struct opcode_description* opdesc = opcode_describe(opcode);170- data_stk_elem* param;171+ data_stk_elem* param = 0;172 int stack_in = opdesc->stack_in;173 if (stack_in == -1) stack_in = pc[1];174 for (int i=0; i<stack_in; i++) {175 if (i == 0) {363 unmodified linesmodified:gen_utf8_tables.py+2 added
1 #!/usr/bin/python2 3+# This program was used to generate jv_utf8_tables.gen.h4+5 mask = lambda n: (1 << n) - 16 7 8 def print_table(type, name, t):24 unmodified linesadded:jq_parser.h+7 added
1+#ifndef JQ_PARSER_H2+#define JQ_PARSER_H3+4+int jq_parse(struct locfile* source, block* answer);5+int jq_parse_library(struct locfile* locations, block* answer);6+7+#endifmodified:jq_test.c+2 added-19 removed
6 unmodified lines7 8 static void jv_test();9 static void run_jq_tests();10 11-FILE* testdata;11 12 int jq_testsuite(int argc, char* argv[]) {13 jv_test();15- if (argc == 1) {16- testdata = fopen("testdata", "r");17- } else if (argc == 2) {18- if (!strcmp(argv[1], "-")) {19- testdata = stdin;20- } else {21- testdata = fopen(argv[1], "r");22- }23- } else {24- printf("usage: %s OR cat testdata | %s - OR %s testdata\n", argv[0], argv[0], argv[0]);25- return 127;26- }27- run_jq_tests();14+ run_jq_tests(stdin);28- if (testdata != stdin) fclose(testdata);15 return 0;16 }17 32-33-34-18 static int skipline(const char* buf) {19 int p = 0;20 while (buf[p] == ' ' || buf[p] == '\t') p++;21 if (buf[p] == '#' || buf[p] == '\n' || buf[p] == 0) return 1;22 return 0;23 }24 42-static void run_jq_tests() {25+static void run_jq_tests(FILE *testdata) {26 char buf[4096];27 int tests = 0, passed = 0, invalid = 0;28 jq_state *jq = NULL;29 200 unmodified linesadded:jq.1.default+39 added
1+.\" generated with Ronn/v0.7.32+.\" http://github.com/rtomayko/ronn/tree/0.7.33+.4+.TH "JQ" "1" "May 2013" "" ""5+.6+.SH "NAME"7+\fBjq\fR \- Command\-line JSON processor8+.9+.SH "DESCRIPTION"10+\fBjq\fR can transform JSON in various ways, by selecting, iterating, reducing and otherwise mangling JSON documents\.11+.12+.P13+This version of \fBjq\fR was built without a manual, so this manpage is a stub\. For full documentation of the \fBjq\fR language, see:14+.15+.IP "" 416+.17+.nf18+19+http://stedolan\.github\.com/jq20+.21+.fi22+.23+.IP "" 024+.25+.SH "BUGS"26+Presumably\. Report them or discuss them at:27+.28+.IP "" 429+.30+.nf31+32+https://github\.com/stedolan/jq/issues33+.34+.fi35+.36+.IP "" 037+.38+.SH "AUTHOR"39+Stephen Dolan \fB<mu@netsoc\.tcd\.ie>\fRadded:jq.spec+65 added
1+# This is spec file maintained by developers of JQ, not by a OS distro.2+# Your OS of choice will likely ignore this RPM spec file.3+Summary: Command-line JSON processor4+Name: jq5+Version: %{myver}6+Release: %{myrel}%{?dist}7+Source0: jq-%{myver}.tar.gz8+URL: https://github.com/stedolan/jq9+License: BSD10+AutoReqProv: no11+#BuildPrereq: autoconf, libtool, automake, flex, bison, python12+13+Group: Applications/System14+# Requires:15+16+# Disables debug packages and stripping of binaries:17+%global _enable_debug_package 018+%global debug_package %{nil}19+%global __os_install_post %{nil}20+21+# Crank up the compression22+%define _binary_payload w7.lzdio23+24+%description25+jq is a command-line JSON processor26+27+%prep28+%setup29+30+%build31+echo "Building in: \"$(pwd)\""32+%if "%{devbuild}" == "yes"33+./configure --prefix=%{_prefix} --enable-devel34+%else35+./configure --prefix=%{_prefix}36+%endif37+make38+39+%install40+echo "Installing to: \"%{buildroot}\""41+make install DESTDIR=%{buildroot}42+43+%clean44+rm -rf %{buildroot}45+46+%files47+%defattr(-,root,root)48+%{_bindir}/jq49+%if "%{devbuild}" == "yes"50+%{_libexecdir}/%{name}/jq_test51+%{_libexecdir}/%{name}/testdata52+%endif53+%{_datadir}/doc/%{name}/AUTHORS54+%{_datadir}/doc/%{name}/COPYING55+%{_datadir}/doc/%{name}/INSTALL56+%{_datadir}/doc/%{name}/NEWS57+%{_datadir}/doc/%{name}/README58+%{_datadir}/doc/%{name}/README.md59+%{_datadir}/man/man1/jq.160+61+%changelog62+63+%pre64+65+%postmodified:jv_unicode.c+1 added-1 removed
1 #include <stdio.h>2 #include <assert.h>3 #include "jv_unicode.h"4-#include "jv_utf8_tables.gen.h"4+#include "jv_utf8_tables.h"5 6 const char* jvp_utf8_next(const char* in, const char* end, int* codepoint) {7 if (in == end) {8 codepoint = 0;56 unmodified linesadded:jv_utf8_tables.h+35 added
1+#define UTF8_CONTINUATION_BYTE ((unsigned char)255)2+static const unsigned char utf8_coding_length[] =3+ {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,4+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,5+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,6+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,7+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,8+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,9+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,10+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,11+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,12+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,13+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,14+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,15+ 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,16+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,17+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,18+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};19+static const unsigned char utf8_coding_bits[] =20+ {0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,21+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,22+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,23+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,24+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,25+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,26+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,27+ 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,28+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,29+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,30+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,31+ 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,32+ 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,33+ 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,34+ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,35+ 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};modified:lexer.l+1 added-1 removed
2 unmodified lines3 #include "compile.h"4 5 struct lexer_param;6 7-#include "parser.gen.h" /* Generated by bison. */7+#include "parser.h" /* Generated by bison. */8 9 #define YY_USER_ACTION \10 do { \11 yylloc->start = yyget_extra(yyscanner); \160 unmodified linesmodified:main.c+7 added-5 removed
6 unmodified lines7 #include "compile.h"8 #include "jv.h"9 #include "jv_parse.h"10 #include "execute.h"11+#include "config.h" /* Autoconf generated header file */12 #include "jv_alloc.h"12-#include "version.gen.h"13 14 int jq_testsuite(int argc, char* argv[]);15 16 static const char* progname;17 18 static void usage() {19- fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", JQ_VERSION);19+ fprintf(stderr, "\njq - commandline JSON processor [version %s]\n", PACKAGE_VERSION);20 fprintf(stderr, "Usage: %s [options] <jq filter> [file...]\n\n", progname);21 fprintf(stderr, "For a description of the command line options and\n");22 fprintf(stderr, "how to write jq filters (and why you might want to)\n");23 fprintf(stderr, "see the jq manpage, or the online documentation at\n");49 unmodified lines73 fwrite(jv_string_value(result), 1, jv_string_length(jv_copy(result)), stdout);74 jv_free(result);75 } else {76 int dumpopts;77-#ifdef JQ_DEFAULT_ENABLE_COLOR78- dumpopts = JQ_DEFAULT_ENABLE_COLOR ? JV_PRINT_COLOUR : 0;77+ /* Disable colour by default on Windows builds as Windows78+ terminals tend not to display it correctly */79+#ifdef WIN3280+ dumpopts = 0;81 #else82 dumpopts = isatty(fileno(stdout)) ? JV_PRINT_COLOUR : 0;83 #endif84 if (!(options & COMPACT_OUTPUT)) dumpopts |= JV_PRINT_PRETTY;119 unmodified lines204 jq_flags |= JQ_DEBUG_TRACE;205 } else if (isoption(argv[i], 'h', "help")) {206 usage();207 } else if (isoption(argv[i], 'V', "version")) {206- fprintf(stderr, "jq version %s\n", JQ_VERSION);208+ fprintf(stderr, "jq version %s\n", PACKAGE_VERSION);209 return 0;210 } else {211 fprintf(stderr, "%s: Unknown option %s\n", progname, argv[i]);212 die();88 unmodified linesdeleted:Makefile-142 removed
1-CC=gcc2-CFLAGS=-Wextra -Wall -Wno-missing-field-initializers -Wno-unused-parameter -std=gnu99 -ggdb -Wno-unused-function $(EXTRA_CFLAGS)3-4-prefix=/usr/local5-mandir=$(prefix)/share/man6-7-8-.PHONY: all clean releasedep tarball install uninstall test releasetag9-all: jq10-11-lexer.gen.c: lexer.l12- flex -o lexer.gen.c --header-file=lexer.gen.h lexer.l13-lexer.gen.h: lexer.gen.c14-15-parser.gen.c: parser.y lexer.gen.h16- bison -W -d parser.y -v --report-file=parser.gen.info -o $@17-parser.gen.h: parser.gen.c18-19-jv_utf8_tables.gen.h: gen_utf8_tables.py20- python $^ > $@21-jv_unicode.c: jv_utf8_tables.gen.h22-23-version.gen.h: VERSION24- sed 's/.*/#define JQ_VERSION "&"/' $^ > $@25-main.c: version.gen.h26-27-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.c28-29-30-jq: $(JQ_SRC) main.c jq_test.c31- $(CC) $(CFLAGS) $(CFLAGS_OPT) -o $@ $^32-33-test: jq34- valgrind --error-exitcode=1 -q --leak-check=full ./jq --run-tests >/dev/null35-36-LIBRARIES=libjq37-BINARIES=jq38-PLATFORMS=linux32 linux64 osx32 osx64 win32 win6439-40-build/linux32%: CC='x86_64-linux-gnu-gcc -m32'41-build/linux64%: CC='x86_64-linux-gnu-gcc -m64'42-43-# OS X cross compilers can be gotten from44-# https://launchpad.net/~flosoft/+archive/cross-apple45-build/osx32%: CC='i686-apple-darwin10-gcc -m32'46-build/osx64%: CC='i686-apple-darwin10-gcc -m64'47-48-# On Debian, you can get windows compilers in the49-# gcc-mingw-w64-i686 and gcc-mingw-w64-x86-64 packages.50-build/win32%: CC='i686-w64-mingw32-gcc -m32' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=051-build/win64%: CC='x86_64-w64-mingw32-gcc -m64' EXTRA_CFLAGS=-DJQ_DEFAULT_ENABLE_COLOR=052-53-BIN_SUFFIX_win32 = .exe54-BIN_SUFFIX_win64 = .exe55-LIB_SUFFIX_win32 = .dll56-LIB_SUFFIX_win64 = .dll57-58-LIB_SUFFIX_linux32 = .so59-LIB_SUFFIX_linux64 = .so60-61-LIB_SUFFIX_osx32 = .so62-LIB_SUFFIX_osx64 = .so63-64-ALL_BINARIES=\65- $(foreach platform, $(PLATFORMS), \66- $(foreach binary, $(BINARIES), \67- build/$(platform)/$(binary)$(BIN_SUFFIX_$(platform))))68-69-$(ALL_BINARIES): build/%:70- mkdir -p $(@D)71- echo $(dir $*)72- make -B $(BINARIES) CC=$(CC)73- $(foreach binary, $(BINARIES), cp $(binary) $(@D)/$(binary)$(suffix $*);)74-75-libjq: CFLAGS += -fPIC76-libjq: $(JQ_SRC)77- $(CC) -shared -Wl,-soname,libjq.so.1 $(CFLAGS) $(CFLAGS_OPT) -o $@ $^78-79-ALL_LIBRARIES=\80- $(foreach platform, $(PLATFORMS), \81- $(foreach library, $(LIBRARIES), \82- build/$(platform)/$(library)$(LIB_SUFFIX_$(platform))))83-84-$(ALL_LIBRARIES): build/%:85- mkdir -p $(@D)86- echo $(dir $*)87- make -B $(LIBRARIES) CC=$(CC)88- $(foreach library, $(LIBRARIES), cp $(library) $(@D)/$(library)$(suffix $*);)89-90-binaries: $(ALL_BINARIES)91-libraries: $(ALL_LIBRARIES)92-93-clean:94- rm -rf build95- rm -f $(LIBRARIES) $(BINARIES) *.gen.*96-97-releasedep: lexer.gen.c parser.gen.c jv_utf8_tables.gen.h98-99-releasetag:100- git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"101-102-docs/content/2.download/source/jq.tgz: jq103- mkdir -p `dirname $@`104- tar -czvf $@ `git ls-files; ls *.gen.*`105-106-tarball: docs/content/2.download/source/jq.tgz107-108-jq.1: docs/content/3.manual/manual.yml109- ( cd docs; bundle exec rake manpage; ) > $@110-111-install: jq jq.1 libjq112- install -d -m 0755 $(prefix)/bin113- install -d -m 0755 $(prefix)/lib114- install -d -m 0755 $(prefix)/include115- install -d -m 0755 $(prefix)/include/jq116- install -m 0755 jq $(prefix)/bin117- ln libjq libjq.so.1118- install -m 0755 execute.h $(prefix)/include/jq119- install -m 0755 compile.h $(prefix)/include/jq120- install -m 0755 jv.h $(prefix)/include/jq121- install -m 0755 jv_parse.h $(prefix)/include/jq122- install -m 0755 jv_alloc.h $(prefix)/include/jq123- install -m 0755 libjq.so.1 $(prefix)/bin124- install -m 0644 execute.h $(prefix)/bin125- install -d -m 0755 $(mandir)/man1126- install -m 0644 jq.1 $(mandir)/man1127-128-uninstall:129- rm -vf $(prefix)/bin/jq130- rm -vf $(prefix)/lib/libjq.so.1131- rm -vf $(mandir)/man1/jq.1132-133-134-www: docs/output www_binaries135-136-docs/output:137- cd docs; rake build138-139-www_binaries: docs/output binaries140- $(foreach platform, $(PLATFORMS), \141- mkdir -p docs/output/download/$(platform); \142- cp build/$(platform)/* docs/output/download/$(platform)/; )added:Makefile.am+123 added
1+### C source files to be built and distributed.2+3+JQ_INCS = jq_parser.h builtin.h bytecode.h compile.h execute.h \4+ forkable_stack.h frame_layout.h jv.h jv_alloc.h jv_aux.h jv_dtoa.h \5+ jv_parse.h jv_unicode.h locfile.h opcode.h opcode_list.h parser.y \6+ jv_utf8_tables.h lexer.l7+8+JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c \9+ jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_alloc.c \10+ jq_test.c ${JQ_INCS}11+12+13+### C build options14+15+AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \16+ -Wno-unused-parameter -Wno-unused-function17+18+19+### Generating the lexer and parser20+21+# While there is some autoconf macro support for lex/flex, it doesn't support22+# header file creation so we'll use good old make23+BUILT_SOURCES = lexer.h lexer.c parser.h parser.c24+lexer.c: lexer.l25+ flex -o lexer.c --header-file=lexer.h $<26+lexer.h: lexer.c27+28+# Tell YACC (bison) autoconf macros that you want a header file created.29+# If the --warnings=all fails, you probably have an old version of bison30+# OSX ships an old bison, so update with homebrew or macports31+AM_YFLAGS = --warnings=all -d32+33+34+### Building the jq binary35+36+main.c: config.h37+38+bin_PROGRAMS = jq39+jq_SOURCES = ${JQ_SRC} main.c40+41+42+### Tests (make check)43+44+TESTS = tests/all.test45+TEST_LOG_COMPILER = ${srcdir}/tests/run46+47+48+### Building the manpage49+50+# If ENABLE_DOCS is not set, just copy jq.1.default to jq.151+# The real_docs target succeeds (possibly after building jq.1) only if ENABLE_DOCS is set52+# Thus, making "dist" depend on "real_docs" ensures that we never build a tarball with53+# a stub manpage.54+55+man_MANS = jq.156+.PHONY: real_docs57+if ENABLE_DOCS58+jq.1: $(srcdir)/docs/content/3.manual/manual.yml59+ ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $@ || { rm -f $@; false; }60+jq.1.default: $(srcdir)/docs/default_manpage.md61+ ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage_default ) > $@ || { rm -f $@; false; }62+real_docs: jq.163+ if cmp jq.1 $(srcdir)/jq.1.default > /dev/null; then\64+ rm -f jq.1; $(MAKE) $(AM_MAKEFLAGS) jq.1;\65+ fi66+else67+jq.1: $(srcdir)/jq.1.default68+ cp $^ $@69+real_docs:70+ @echo "Ruby dependencies not found, cannot build manpage." > /dev/stderr71+ @echo "Follow the instructions in docs/README.md to install them" > /dev/stderr72+ @echo "and then rerun ./configure" > /dev/stderr73+ false74+endif75+76+77+### Packaging78+79+docs/site.yml: configure.ac80+ sed 's/^jq_version: .*/jq_version: $(VERSION)/' $@ > $@.new81+ mv $@.new $@82+83+install-binaries: $(BUILT_SOURCES)84+ $(MAKE) $(AM_MAKEFLAGS) install-exec85+86+# Ensure "make dist" fails when we can't build the real manpage87+dist-hook: real_docs88+89+DOC_FILES = docs/content docs/public docs/templates docs/site.yml \90+ docs/Gemfile docs/Gemfile.lock docs/Rakefile docs/README.md \91+ docs/default_manpage.md jq.1.default92+93+# setup is only used by distribution developers, not package developers.94+# Still, as a matter of allowing patching, its not a bad idea to distribute 95+# the developer setup script in the tarball.96+EXTRA_DIST = config.h.in $(BUILT_SOURCES) $(man_MANS) $(TESTS) \97+ $(TEST_LOG_COMPILER) gen_utf8_tables.py jq.spec \98+ $(DOC_FILES)99+100+# README.md is expected in Github projects, good stuff in it, so we'll 101+# distribute it and install it with the package in the doc directory.102+docdir = ${datadir}/doc/${PACKAGE}103+dist_doc_DATA = README.md COPYING AUTHORS README104+105+releasetag:106+ git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"107+108+RELEASE ?= 1109+rpm: jq110+ @echo "Packaging jq as an RPM ..."111+ mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS112+ cp jq-$$(cat VERSION).tar.gz rpm/SOURCES/113+ rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $$(cat VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz114+ find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;115+ rm -rf rpm116+117+dist-clean-local:118+ rm -f ${BUILT_SOURCES}119+120+# Not sure why this doesn't get cleaned up automatically, guess121+# automake used to man pages which are hand coded?122+clean-local:123+ rm -f jq.1deleted:parser.h-7 removed
1-#ifndef PARSER_H2-#define PARSER_H3-4-int jq_parse(struct locfile* source, block* answer);5-int jq_parse_library(struct locfile* locations, block* answer);6-7-#endifmodified:parser.y+1 added-1 removed
90 unmodified lines91 92 93 %type <blk> Exp Term MkDict MkDictPair ExpD ElseBody QQString FuncDef FuncDefs String94 %{95-#include "lexer.gen.h"95+#include "lexer.h"96 struct lexer_param {97 yyscan_t lexer;98 };99 #define FAIL(loc, msg) \400 unmodified linesadded:README+1 added
1+README.mdmodified:README.md+12 added-3 removed
6 unmodified lines7 [http://stedolan.github.com/jq](http://stedolan.github.com/jq). This8 documentation is generated from the docs/ folder of this repository.9 10 If you want to hack on jq, feel free, but be warned that its internals11-are not well-documented at the moment. Bring a hard hat and a shovel.11+are not well-documented at the moment. Bring a hard hat and a12+shovel. Also, read the wiki: http://github.com/stedolan/jq/wiki13 13-You can find some basic build instructions at14-[http://stedolan.github.com/jq/download](http://stedolan.github.com/jq/download)14+To build jq, run15+16+ ./configure17+ make18+ sudo make install (optionally)19+20+If you've just checked out the latest version from git (rather than21+using a released source tarball) then you'll need to run this first:22+23+ autoreconfadded:setup.sh+32 added
1+#!/usr/bin/env bash2+3+# RUN ME after pulling the code from git!4+#5+# This script is handy after pulling the code out of git without having6+# to remember all the typing needed to build up and tear down all the7+# crap that autotools puts in your source repo. The intent is to keep8+# all generated files out of git.9+10+if [ "clean" == "$1" ]; then11+ make distclean || echo "continuing..."12+ rm -rf tmp autom4te.cache config13+ rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in ChangeLog14+ rm -f jv_utf8_tables.gen.h lexer.c lexer.h parser.c parser.h15+elif [ "superclean" == "$1" ]; then16+ # if autoconf errors during distcheck, it leaves files that need chmod'ing17+ ver=$(tr -d '\n' <VERSION)18+ if [ "x${ver}" != "x" ]; then19+ if [ -d jq-${ver} ]; then20+ chmod -R u+w jq-${ver}21+ rm -rf jq-${ver}22+ fi23+ rm -f jq-${ver}*24+ fi25+else26+ autoreconf --install27+ ./configure --prefix=/opt/junk28+ make check29+ mkdir tmp30+ make DESTDIR=./tmp install31+ make distcheck32+fideleted:testdata-576 removed
1-# Tests are groups of three lines: program, input, expected output2-# Blank lines and lines starting with # are ignored3-4-#5-# Simple value tests to check parser. Input is irrelevant6-#7-8-true9-null10-true11-12-false13-null14-false15-16-null17-4218-null19-20-121-null22-123-24-25--126-null27--128-29-# FIXME: much more number testing needed30-31-{}32-null33-{}34-35-[]36-null37-[]38-39-# The input line starts with a 0xFEFF (byte order mark) codepoint40-# No, there is no reason to have a byte order mark in UTF8 text.41-# But apparently people do, so jq shouldn't break on it.42-.43-"byte order mark"44-"byte order mark"45-46-# We test escapes by matching them against Unicode codepoints47-# FIXME: more tests needed for weird unicode stuff (e.g. utf16 pairs)48-"Aa\r\n\t\b\f\u03bc"49-null50-"Aa\u000d\u000a\u0009\u0008\u000c\u03bc"51-52-.53-"Aa\r\n\t\b\f\u03bc"54-"Aa\u000d\u000a\u0009\u0008\u000c\u03bc"55-56-"inter\("pol" + "ation")"57-null58-"interpolation"59-60-@text,@json,([1,.] | @csv),@html,@uri,@sh,@base6461-"<>&'\""62-"<>&'\""63-"\"<>&'\\\"\""64-"1,\"<>&'\"\"\""65-"<>&'""66-"%3c%3e%26'%22"67-"'<>&'\\''\"'"68-"PD4mJyI="69-70-@uri71-"\u03bc"72-"%ce%bc"73-74-@html "<b>\(.)</b>"75-"<script>hax</script>"76-"<b><script>hax</script></b>"77-78-#79-# Dictionary construction syntax80-#81-82-{a: 1}83-null84-{"a":1}85-86-{a,b,(.d):.a,e:.b}87-{"a":1, "b":2, "c":3, "d":"c"}88-{"a":1, "b":2, "c":1, "e":2}89-90-{"a",b,"a$\(1+1)"}91-{"a":1, "b":2, "c":3, "a$2":4}92-{"a":1, "b":2, "a$2":4}93-94-#95-# Field access, piping96-#97-98-.foo99-{"foo": 42, "bar": 43}100-42101-102-.foo | .bar103-{"foo": {"bar": 42}, "bar": "badvalue"}104-42105-106-.foo.bar107-{"foo": {"bar": 42}, "bar": "badvalue"}108-42109-110-.foo_bar111-{"foo_bar": 2}112-2113-114-.["foo"].bar115-{"foo": {"bar": 42}, "bar": "badvalue"}116-42117-118-119-#120-# Multiple outputs, iteration121-#122-123-.[]124-[1,2,3]125-1126-2127-3128-129-1,1130-[]131-1132-1133-134-1,.135-[]136-1137-[]138-139-[.]140-[2]141-[[2]]142-143-[[2]]144-[3]145-[[2]]146-147-[{}]148-[2]149-[{}]150-151-[.[]]152-["a"]153-["a"]154-155-[(.,1),((.,.[]),(2,3))]156-["a","b"]157-[["a","b"],1,["a","b"],"a","b",2,3]158-159-[([5,5][]),.,.[]]160-[1,2,3]161-[5,5,[1,2,3],1,2,3]162-163-{x: (1,2)},{x:3} | .x164-null165-1166-2167-3168-169-#170-# Variables171-#172-173-1 as $x | 2 as $y | [$x,$y,$x]174-null175-[1,2,1]176-177-[1,2,3][] as $x | [[4,5,6,7][$x]]178-null179-[5]180-[6]181-[7]182-183-42 as $x | . | . | . + 432 | $x + 1184-34324185-43186-187-1 as $x | [$x,$x,$x as $x | $x]188-null189-[1,1,1]190-191-# [.,(.[] | {x:.},.),.,.[]]192-193-#194-# Builtin functions195-#196-197-1+1198-null199-2200-201-1+1202-"wtasdf"203-2.0204-205-2-1206-null207-1208-209-2-(-1)210-null211-3212-213-1e+0+0.001e3214-"I wonder what this will be?"215-20e-1216-217-.+4218-15219-19.0220-221-.+null222-{"a":42}223-{"a":42}224-225-null+.226-null227-null228-229-.a+.b230-{"a":42}231-42232-233-[1,2,3] + [.]234-null235-[1,2,3,null]236-237-{"a":1} + {"b":2} + {"c":3}238-"asdfasdf"239-{"a":1, "b":2, "c":3}240-241-"asdf" + "jkl;" + . + . + .242-"some string"243-"asdfjkl;some stringsome stringsome string"244-245-"\u0000\u0020\u0000" + .246-"\u0000\u0020\u0000"247-"\u0000 \u0000\u0000 \u0000"248-249-42 - .250-11251-31252-253-[1,2,3,4,1] - [.,3]254-1255-[2,4]256-257-[10 * 20, 20 / .]258-4259-[200, 5]260-261-1 + 2 * 2 + 10 / 2262-null263-10264-265-[16 / 4 / 2, 16 / 4 * 2, 16 - 4 - 2, 16 - 4 + 2]266-null267-[2, 8, 10, 14]268-269-1 + tonumber + ("10" | tonumber)270-4271-15272-273-[{"a":42},.object,10,.num,false,true,null,"b",[1,4]] | .[] as $x | [$x == .[]]274-{"object": {"a":42}, "num":10.0}275-[true, true, false, false, false, false, false, false, false]276-[true, true, false, false, false, false, false, false, false]277-[false, false, true, true, false, false, false, false, false]278-[false, false, true, true, false, false, false, false, false]279-[false, false, false, false, true, false, false, false, false]280-[false, false, false, false, false, true, false, false, false]281-[false, false, false, false, false, false, true, false, false]282-[false, false, false, false, false, false, false, true, false]283-[false, false, false, false, false, false, false, false, true ]284-285-[.[] | length]286-[[], {}, [1,2], {"a":42}, "asdf"]287-[0, 0, 2, 1, 4]288-289-map(keys)290-[{}, {"abcd":1,"abc":2,"abcde":3}, {"x":1, "z": 3, "y":2}]291-[[], ["abc","abcd","abcde"], ["x","y","z"]]292-293-[1,2,empty,3,empty,4]294-null295-[1,2,3,4]296-297-map(add)298-[[], [1,2,3], ["a","b","c"], [[3],[4,5],[6]], [{"a":1}, {"b":2}, {"a":3}]]299-[null, 6, "abc", [3,4,5,6], {"a":3, "b": 2}]300-301-#302-# User-defined functions303-# Oh god.304-#305-306-def f: . + 1; def g: def g: . + 100; f | g | f; (f | g), g307-3.0308-106.0309-105.0310-311-def f: (1000,2000); f312-123412345313-1000314-2000315-316-([1,2] + [4,5])317-[1,2,3]318-[1,2,4,5]319-320-true321-[1]322-true323-324-null,1,null325-"hello"326-null327-1328-null329-330-[1,2,3]331-[5,6]332-[1,2,3]333-334-def f(x): x | x; f([.], . + [42])335-[1,2,3]336-[[[1,2,3]]]337-[[1,2,3],42]338-[[1,2,3,42]]339-[1,2,3,42,42]340-341-# test closures and lexical scoping342-def id(x):x; 2000 as $x | def f(x):1 as $x | id([$x, x, x]); def g(x): 100 as $x | f($x,$x+x); g($x)343-"more testing"344-[1,100,2100.0,100,2100.0]345-346-# test backtracking through function calls and returns347-# this test is *evil*348-[[20,10][1,0] as $x | def f: (100,200) as $y | def g: [$x + $y, .]; . + $x | g; f[0] | [f][0][1] | f]349-999999999350-[[110.0, 130.0], [210.0, 130.0], [110.0, 230.0], [210.0, 230.0], [120.0, 160.0], [220.0, 160.0], [120.0, 260.0], [220.0, 260.0]]351-352-# test recursion353-def fac: if . == 1 then 1 else . * (. - 1 | fac) end; [.[] | fac]354-[1,2,3,4]355-[1,2,6,24]356-357-# test stack overflow and reallocation358-# this test is disabled for now, it takes a realllllly long time.359-# def f: if length > 1000 then . else .+[1]|f end; f | length360-# []361-# 1001362-363-fold 0 as $s (.[] | $s + .)364-[1,2,4]365-7366-367-#368-# Paths369-#370-371-path(.foo[0,1])372-null373-["foo", 0]374-["foo", 1]375-376-path(.[] | select(.>3))377-[1,5,3]378-[1]379-380-path(.)381-42382-[]383-384-["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])385-{"bar": 42, "foo": ["a", "b", "c", "d"]}386-"b"387-{"bar": 42, "foo": ["a", 20, "c", "d"]}388-{"bar": 42, "foo": ["a", "c", "d"]}389-390-map(getpath([2])), map(setpath([2]; 42)), map(delpaths([[2]]))391-[[0], [0,1], [0,1,2]]392-[null, null, 2]393-[[0,null,42], [0,1,42], [0,1,42]]394-[[0], [0,1], [0,1]]395-396-map(delpaths([[0,"foo"]]))397-[[{"foo":2, "x":1}], [{"bar":2}]]398-[[{"x":1}], [{"bar":2}]]399-400-["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])401-{"bar":false}402-null403-{"bar":false, "foo": [null, 20]}404-{"bar":false}405-406-delpaths([[-200]])407-[1,2,3]408-[1,2,3]409-410-del(.), del(empty), del((.foo,.bar,.baz) | .[2,3,0]), del(.foo[0], .bar[0], .foo, .baz.bar[0].x)411-{"foo": [0,1,2,3,4], "bar": [0,1]}412-null413-{"foo": [0,1,2,3,4], "bar": [0,1]}414-{"foo": [1,4], "bar": [1]}415-{"bar": [1]}416-417-#418-# Assignment419-#420-.message = "goodbye"421-{"message": "hello"}422-{"message": "goodbye"}423-424-.foo = .bar425-{"bar":42}426-{"foo":42, "bar":42}427-428-.foo |= .+1429-{"foo": 42}430-{"foo": 43}431-432-.[] += 2, .[] *= 2, .[] -= 2, .[] /= 2433-[1,3,5]434-[3,5,7]435-[2,6,10]436-[-1,1,3]437-[0.5, 1.5, 2.5]438-439-.foo += .foo440-{"foo":2}441-{"foo":4}442-443-.[0].a |= {"old":., "new":(.+1)}444-[{"a":1,"b":2}]445-[{"a":{"old":1, "new":2},"b":2}]446-447-def inc(x): x |= .+1; inc(.[].a)448-[{"a":1,"b":2},{"a":2,"b":4},{"a":7,"b":8}]449-[{"a":2,"b":2},{"a":3,"b":4},{"a":8,"b":8}]450-451-.[2][3] = 1452-[4]453-[4, null, [null, null, null, 1]]454-455-.foo[2].bar = 1456-{"foo":[11], "bar":42}457-{"foo":[11,null,{"bar":1}], "bar":42}458-459-#460-# Conditionals461-#462-463-[.[] | if .foo then "yep" else "nope" end]464-[{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}]465-["yep","yep","yep","yep","nope","nope","yep","nope"]466-467-[.[] | if .baz then "strange" elif .foo then "yep" else "nope" end]468-[{"foo":0},{"foo":1},{"foo":[]},{"foo":true},{"foo":false},{"foo":null},{"foo":"foo"},{}]469-["yep","yep","yep","yep","nope","nope","yep","nope"]470-471-472-# FIXME: define/test behaviour of 'if (.foo,.bar) then A else B end'473-474-[.[] | [.foo[] // .bar]]475-[{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}]476-[[1,2], [1], [3], [42], [41]]477-478-# FIXME: behaviour of update operators479-# .[] //= .[0]480-# ["hello",true,false,[false],null]481-# ["hello",true,"hello",[false],"hello"]482-483-.[] | [.[0] and .[1], .[0] or .[1]]484-[[true,[]], [false,1], [42,null], [null,false]]485-[true,true]486-[false,true]487-[false,true]488-[false,false]489-490-[.[] | not]491-[1,0,false,null,true,"hello"]492-[false,false,true,true,false,false]493-494-# Check numeric comparison binops495-[10 > 0, 10 > 10, 10 > 20, 10 < 0, 10 < 10, 10 < 20]496-{}497-[true,false,false,false,false,true]498-499-[10 >= 0, 10 >= 10, 10 >= 20, 10 <= 0, 10 <= 10, 10 <= 20]500-{}501-[true,true,false,false,true,true]502-503-# And some in/equality tests504-[ 10 == 10, 10 != 10, 10 != 11, 10 == 11]505-{}506-[true,false,true,false]507-508-["hello" == "hello", "hello" != "hello", "hello" == "world", "hello" != "world" ]509-{}510-[true,false,false,true]511-512-[[1,2,3] == [1,2,3], [1,2,3] != [1,2,3], [1,2,3] == [4,5,6], [1,2,3] != [4,5,6]]513-{}514-[true,false,false,true]515-516-[{"foo":42} == {"foo":42},{"foo":42} != {"foo":42}, {"foo":42} != {"bar":42}, {"foo":42} == {"bar":42}]517-{}518-[true,false,true,false]519-520-# ugly complicated thing521-[{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":18},"world"]},{"foo":[1,2,{"bar":18},"world"]} == {"foo":[1,2,{"bar":19},"world"]}]522-{}523-[true,false]524-525-# containment operator526-[("foo" | contains("foo")), ("foobar" | contains("foo")), ("foo" | contains("foobar"))]527-{}528-[true, true, false]529-530-map(.[1] as $needle | .[0] | contains($needle))531-[[[],[]], [[1,2,3], [1,2]], [[1,2,3], [3,1]], [[1,2,3], [4]], [[1,2,3], [1,4]]]532-[true, true, true, false, false]533-534-map(.[1] as $needle | .[0] | contains($needle))535-[[["foobar", "foobaz"], ["baz", "bar"]], [["foobar", "foobaz"], ["foo"]], [["foobar", "foobaz"], ["blap"]]]536-[true, true, false]537-538-[({foo: 12, bar:13} | contains({foo: 12})), ({foo: 12} | contains({})), ({foo: 12, bar:13} | contains({baz:14}))]539-{}540-[true, true, false]541-542-{foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {}}})543-{}544-true545-546-{foo: {baz: 12, blap: {bar: 13}}, bar: 14} | contains({bar: 14, foo: {blap: {bar: 14}}})547-{}548-false549-550-sort551-[42,[2,5,3,11],10,{"a":42,"b":2},{"a":42},true,2,[2,6],"hello",null,[2,5,6],{"a":[],"b":1},"abc","ab",[3,10],{},false,"abcd",null]552-[null,null,false,true,2,10,42,"ab","abc","abcd","hello",[2,5,3,11],[2,5,6],[2,6],[3,10],{},{"a":42},{"a":42,"b":2},{"a":[],"b":1}]553-554-(sort_by(.b) | sort_by(.a)), sort_by(.a, .b), sort_by(.b, .c), group_by(.b), group_by(.a + .b - .c == 2)555-[{"a": 1, "b": 4, "c": 14}, {"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}, {"a": 0, "b": 2, "c": 43}]556-[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]557-[{"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}, {"a": 4, "b": 1, "c": 3}]558-[{"a": 4, "b": 1, "c": 3}, {"a": 0, "b": 2, "c": 43}, {"a": 1, "b": 4, "c": 3}, {"a": 1, "b": 4, "c": 14}]559-[[{"a": 4, "b": 1, "c": 3}], [{"a": 0, "b": 2, "c": 43}], [{"a": 1, "b": 4, "c": 14}, {"a": 1, "b": 4, "c": 3}]]560-[[{"a": 1, "b": 4, "c": 14}, {"a": 0, "b": 2, "c": 43}], [{"a": 4, "b": 1, "c": 3}, {"a": 1, "b": 4, "c": 3}]]561-562-unique563-[1,2,5,3,5,3,1,3]564-[1,2,3,5]565-566-[min, max, min_by(.[1]), max_by(.[1]), min_by(.[2]), max_by(.[2])]567-[[4,2,"a"],[3,1,"a"],[2,4,"a"],[1,3,"a"]]568-[[1,3,"a"],[4,2,"a"],[3,1,"a"],[2,4,"a"],[4,2,"a"],[1,3,"a"]]569-570-[min,max,min_by(.),max_by(.)]571-[]572-[null,null,null,null]573-574-.foo[.baz]575-{"foo":{"bar":4},"baz":"bar"}576-4deleted:VERSION-1 removed
1-1.2