Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #!/bin/sh |
michael@0 | 2 | # libevent rpcgen_wrapper.sh |
michael@0 | 3 | # Transforms event_rpcgen.py failure into success for make, only if |
michael@0 | 4 | # regress.gen.c and regress.gen.h already exist in $srcdir. This |
michael@0 | 5 | # is needed for "make distcheck" to pass the read-only $srcdir build, |
michael@0 | 6 | # as with read-only sources fresh from tarball, regress.gen.[ch] will |
michael@0 | 7 | # be correct in $srcdir but unwritable. This previously triggered |
michael@0 | 8 | # Makefile.am to create stub regress.gen.c and regress.gen.h in the |
michael@0 | 9 | # distcheck _build directory, which were then detected as leftover |
michael@0 | 10 | # files in the build tree after distclean, breaking distcheck. |
michael@0 | 11 | # Note that regress.gen.[ch] are not in fresh git clones, making |
michael@0 | 12 | # working Python a requirement for make distcheck of a git tree. |
michael@0 | 13 | |
michael@0 | 14 | exit_updated() { |
michael@0 | 15 | echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" |
michael@0 | 16 | exit 0 |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | exit_reuse() { |
michael@0 | 20 | echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 |
michael@0 | 21 | exit 0 |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | exit_failed() { |
michael@0 | 25 | echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 |
michael@0 | 26 | exit 1 |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | if [ -x /usr/bin/python2 ] ; then |
michael@0 | 30 | PYTHON2=/usr/bin/python2 |
michael@0 | 31 | elif [ "x`which python2`" != x ] ; then |
michael@0 | 32 | PYTHON2=python2 |
michael@0 | 33 | else |
michael@0 | 34 | PYTHON2=python |
michael@0 | 35 | fi |
michael@0 | 36 | |
michael@0 | 37 | srcdir=$1 |
michael@0 | 38 | srcdir=${srcdir:-.} |
michael@0 | 39 | ${PYTHON2} ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc |
michael@0 | 40 | case "$?" in |
michael@0 | 41 | 0) |
michael@0 | 42 | exit_updated |
michael@0 | 43 | ;; |
michael@0 | 44 | *) |
michael@0 | 45 | test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ |
michael@0 | 46 | exit_reuse |
michael@0 | 47 | exit_failed |
michael@0 | 48 | ;; |
michael@0 | 49 | esac |