~fractalcat/gearmand/docfixes

« back to all changes in this revision

Viewing changes to bootstrap.sh

  • Committer: Brian Aker
  • Date: 2012-09-30 23:55:03 UTC
  • mto: (621.4.21 workspace)
  • mto: This revision was merged to the branch mainline in revision 656.
  • Revision ID: brian@tangent.org-20120930235503-u6r0uq1hl0mdj5an
Fix it so that we don't need to store the manpages in the tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
die() { echo "$@"; exit 1; }
35
35
 
 
36
command_exists () {
 
37
  type "$1" &> /dev/null ;
 
38
}
 
39
 
36
40
run() {
 
41
  echo $TESTS_ENVIRONMENT
37
42
  echo "\`$@' $ARGS"
38
43
  $@ $ARGS
39
44
40
45
 
41
 
if [ -d .git ]
42
 
then
43
 
  AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
44
 
elif [ -d .bzr ]
45
 
then
46
 
  AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
47
 
elif [ -d .svn ]
48
 
then
49
 
  AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
50
 
elif [ -d .hg ]
51
 
then
52
 
  AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
53
 
else
54
 
  AUTORECONF_FLAGS="--install --force --verbose -Wall"
55
 
fi
56
 
 
57
 
LIBTOOLIZE_FLAGS="--force --verbose"
58
 
 
59
 
if [ $(uname) = "Darwin" ]
60
 
then
61
 
  LIBTOOLIZE=glibtoolize
62
 
elif [ -z "$LIBTOOLIZE" ]
63
 
then 
64
 
  LIBTOOLIZE=libtoolize
65
 
fi
66
 
 
67
 
AUTORECONF=autoreconf
68
 
 
69
 
# Set ENV DEBUG in order to enable debugging
70
 
if [ -n "$DEBUG" ]
71
 
then 
72
 
  DEBUG="--enable-debug"
73
 
fi
74
 
 
75
 
# Set ENV ASSERT in order to enable assert
76
 
if [ -n "$ASSERT" ]
77
 
then 
78
 
  ASSERT="--enable-assert"
79
 
fi
80
 
 
81
 
# Set ENV MAKE in order to override "make"
82
 
if [ -z "$MAKE" ]
83
 
then 
84
 
  MAKE="make"
85
 
fi
86
 
 
87
 
# Set ENV MAKE_J in order to override "-j2"
88
 
if [ -z "$MAKE_J" ]
89
 
then
90
 
  MAKE_J="-j2"
91
 
fi
92
 
 
93
 
# Set ENV PREFIX in order to set --prefix for ./configure
94
 
if [ -n "$PREFIX" ]
95
 
then 
96
 
  PREFIX="--prefix=$PREFIX"
97
 
fi
98
 
 
99
 
if [ -f Makefile ]
100
 
then
101
 
  $MAKE $MAKE_J maintainer-clean
102
 
fi
103
 
 
104
 
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute $LIBTOOLIZE"
105
 
run $AUTORECONF $AUTORECONF_FLAGS || die "Can't execute $AUTORECONF"
106
 
 
107
 
# If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
108
 
if [ $(uname) = "Darwin" ]
109
 
then
110
 
  CC=clang CXX=clang++ ./configure $DEBUG $ASSERT $PREFIX || die "configure failed to run"
111
 
else
112
 
  ./configure $DEBUG $ASSERT $PREFIX || die "configure failed to run"
113
 
fi
114
 
 
115
 
# Set ENV MAKE_TARGET in order to override default of "all"
116
 
if [ -z "$MAKE_TARGET" ]
117
 
then 
118
 
  MAKE_TARGET="all"
119
 
fi
120
 
 
121
 
run $MAKE $MAKE_J $MAKE_TARGET || die "Can't execute make"
 
46
bootstrap() {
 
47
  if [ -d .git ]
 
48
  then
 
49
    AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
 
50
  elif [ -d .bzr ]
 
51
  then
 
52
    AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
 
53
  elif [ -d .svn ]
 
54
  then
 
55
    AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
 
56
  elif [ -d .hg ]
 
57
  then
 
58
    AUTORECONF_FLAGS="--install --force --verbose -Wall -Werror"
 
59
  else
 
60
    AUTORECONF_FLAGS="--install --force --verbose -Wall"
 
61
  fi
 
62
 
 
63
  LIBTOOLIZE_FLAGS="--force --verbose"
 
64
 
 
65
  if [ $(uname) = "Darwin" ]
 
66
  then
 
67
    LIBTOOLIZE=glibtoolize
 
68
  elif [ -z "$LIBTOOLIZE" ]
 
69
  then 
 
70
    LIBTOOLIZE=libtoolize
 
71
  fi
 
72
 
 
73
  AUTOMAKE=automake
 
74
  AUTORECONF=autoreconf
 
75
 
 
76
  AUTOMAKE_FLAGS=--add-missing
 
77
 
 
78
 
 
79
  # Set ENV DEBUG in order to enable debugging
 
80
  if [ -n "$DEBUG" ]
 
81
  then 
 
82
    DEBUG="--enable-debug"
 
83
  fi
 
84
 
 
85
  # Set ENV ASSERT in order to enable assert
 
86
  if [ -n "$ASSERT" ]
 
87
  then 
 
88
    ASSERT="--enable-assert"
 
89
  fi
 
90
 
 
91
  # Set ENV VALGRIND in order to enable assert
 
92
  if [ -n "$VALGRIND" ] && command_exists valgrind
 
93
  then 
 
94
    VALGRIND="valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE"
 
95
    TESTS_ENVIRONMENT="$VALGRIND"
 
96
  fi
 
97
 
 
98
  # Set ENV MAKE in order to override "make"
 
99
  if [ -z "$MAKE" ]
 
100
  then 
 
101
    MAKE="make"
 
102
  fi
 
103
 
 
104
  # Set ENV MAKE_J in order to override "-j2"
 
105
  if [ -z "$MAKE_J" ]
 
106
  then
 
107
    MAKE_J="-j2"
 
108
  fi
 
109
 
 
110
  # Set ENV PREFIX in order to set --prefix for ./configure
 
111
  if [ -n "$PREFIX" ]
 
112
  then 
 
113
    PREFIX="--prefix=$PREFIX"
 
114
  fi
 
115
 
 
116
  if [ -f Makefile ]
 
117
  then
 
118
    $MAKE $MAKE_J maintainer-clean
 
119
  fi
 
120
 
 
121
  run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute $LIBTOOLIZE"
 
122
  run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute $AUTORECONF"
 
123
  run $AUTORECONF $AUTORECONF_FLAGS || die "Can't execute $AUTORECONF"
 
124
 
 
125
  # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
 
126
  if [ $(uname) = "Darwin" ]
 
127
  then
 
128
    CC=clang CXX=clang++ ./configure $DEBUG $ASSERT $PREFIX || die "configure failed to run"
 
129
  else
 
130
    ./configure $DEBUG $ASSERT $PREFIX || die "configure failed to run"
 
131
  fi
 
132
 
 
133
  if [[ -n "$TESTS_ENVIRONMENT" ]] && [[ -f libtool ]]
 
134
  then
 
135
    TESTS_ENVIRONMENT="./libtool --mode=execute $TESTS_ENVIRONMENT"
 
136
    export TESTS_ENVIRONMENT
 
137
  fi
 
138
 
 
139
  if [ -f docs/conf.py ]
 
140
  then 
 
141
    run $MAKE $MAKE_J man || die "Can't execute make"
 
142
  fi
 
143
 
 
144
  # Set ENV MAKE_TARGET in order to override default of "all"
 
145
  if [ -z "$MAKE_TARGET" ]
 
146
  then 
 
147
    MAKE_TARGET="all"
 
148
  fi
 
149
 
 
150
  run $MAKE $MAKE_J $MAKE_TARGET || die "Can't execute make"
 
151
}
 
152
 
 
153
bootstrap