summaryrefslogtreecommitdiffstats
path: root/setup.sh
blob: c458f1209097b8f73d9e491a115c6d68748f4c5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash

# RUN ME after pulling the code from git!
#
# This script is handy after pulling the code out of git without having
# to remember all the typing needed to build up and tear down all the
# crap that autotools puts in your source repo.  The intent is to keep
# all generated files out of git.

if [ "clean" == "$1" ]; then
  make distclean || echo "continuing..."
  find config/m4 -type f \( -name libtool\* -o -name lt\* \) | xargs rm -f
  find config -name m4 -prune -o -type f -print | xargs rm -f
  rm -rf tmp autom4te.cache
  rm -f INSTALL Makefile.in aclocal.m4 configure config.h.in ChangeLog
  rm -f jv_utf8_tables.gen.h lexer.c lexer.h parser.c parser.h
elif [ "superclean" == "$1" ]; then
  # if autoconf errors during distcheck, it leaves files that need chmod'ing
  ver=$(scripts/version|tr -d '\n')
  if [ "x${ver}" != "x" ]; then
    if [ -d jq-${ver} ]; then
      chmod -R u+w jq-${ver}
      rm -rf jq-${ver}
    fi
    rm -f jq-${ver}*
  fi
else
  autoreconf --install
  ./configure --prefix=/opt/junk
  make check
  [ -d tmp ] && mv tmp tmp-
  mkdir tmp
  make DESTDIR=./tmp install
  make distcheck
fi