summaryrefslogtreecommitdiff
path: root/bin/bootstrap
blob: 2c7da6225c61f68dae081f3943d318ac6a3b9e47 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#! /bin/sh

# -------------------------------------------------------------------------
#       $Id$
# 
# Bootstrap ACE/TAO configuration tools when checked out from CVS.
# Requires GNU autoconf, GNU automake and GNU libtool.
#
# This script is only meant to be run by ACE/TAO maintainers.
# 
# -------------------------------------------------------------------------

#  Copyright (C) 1999  Ossama Othman
#
#  All Rights Reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the current ACE distribution terms.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


set -e

# If paginator environment variable isn't set then use `more'.
test -z $PAGER && PAGER=more

# Flag that determines if dependency tracking should be enabled in
# GNU Automake generated Makefile.in files.
enable_deps=no

# By default, assume that a workspace, not a release, is being bootstrapped.
bootstrap_release=no

usage()
{
    cat <<EOF | $PAGER
Usage: bootstrap [OPTIONS] [workspace | release]

Generic options:
  --help	  display this help and exit

Supported options:
  --enable-deps   enable dependency tracking for workspace    [default=no]

Workspace Bootstrapping
-----------------------
    Bootstrapping a workspace causes all files necessary for
    maintainers to build ACE or TAO to be generated.

    Enabling dependency tracking via the \`--enable-deps' option causes
    GNU Automake to generate dependency tracking rules in generated
    Makefile.in files.  Currently those dependency tracking rules only
    work with GNU C++, which is why dependency tracking is disabled by
    default.

Release Bootstrapping
---------------------
    Bootstrapping a workspace for release does the same things as the
    standard workspace bootstrapping procedure except that files that
    are needed to build an ACE/TAO distribution are also generated
    (e.g. man pages).  Dependency tracking is enabled by default since
    Makefile dependencies should be included in ACE/TAO distributions.

EOF

    exit $1
}


if test $# -gt 2; then
    usage 1
fi

while test $# -gt 0; do
    case "$1" in
    --help)
	usage 0
	;;
    --enable-deps)
        enable_deps=yes
	;;
    workspace)
	bootstrap_release=no
        ;;
    release)
	bootstrap_release=yes
        enable_deps=yes
        ;;
    esac
    shift
done


# This script must be run from the top-level ACE source directory
if test -d m4; then

  # Set the PATH containing the GNU tools
  if (uname | grep SunOS > /dev/null 2>&1); then
    PATH=/project/danzon/pkg/gnu/bin:$PATH
    export PATH
  fi

  # Provide some "useful" information.
  echo Bootstrapping...

  # Update the NEWS file
  # For now just copy the contents of the `VERSION' file to make automake
  # happy.  Eventually, we should start putting real news in to it.
  echo Creating a NEWS file
  cp VERSION NEWS

  # Generate an `aclocal.m4' file from all existing m4 macro files
  # including those in the `m4' directory.
  echo Running aclocal
  aclocal -I m4

  # Generate a `config.h.in' configuration header template from `acconfig.h'.
  echo 'Running autoheader (expect some "AC_TRY_RUN" warnings)'
  autoheader

  # Generate the `configure' script from the `configure.in'.
  echo 'Running autoconf (expect some "AC_TRY_RUN" warnings)'
  autoconf

  # Generate all `Makefile.in' templates in the directories listed in
  # `configure.in' and add any missing files that GNU Automake needs so
  # that the distribution and configuration processes will run properly.
  echo Running automake
  if test $bootstrap_release = no && test $enable_deps = no; then
    automake --add-missing --include-deps #--verbose
  else
    automake --add-missing #--verbose
  fi

  # Generate the man pages.
  # Only generate man pages if bootstrapping a release.
  if test $bootstrap_release = yes; then
    if test -f man/man3/ACE.3; then
      echo ACE man pages have already been generated.
    else
      echo 'Generating the ACE man pages (this may take several minutes)'

      (cd man/man3; \
       ACE_ROOT=../..; \
       export ACE_ROOT; \
       ACE_HEADERS=`find $ACE_ROOT/ace -name CLASSIX -prune -o \
                   -name '*.h' ! -name 'config*.h' ! -name \
                   'ws2tcpip.h' -print`; \
       $ACE_ROOT/bin/class2man $ACE_HEADERS > /dev/null)
    fi  # test -f man/man3/ACE.3
  fi  # test $bootstrap_release = yes

  # Regenerate the man pages lists in the man page Makefiles.

  if test -f man/man3/Makefile.am && test -f man/html/Makefile.am; then
    # Only insert man page lists if bootstrapping a release.
    if test $bootstrap_release = yes; then
      echo 'Inserting ACE man page lists into appropriate Makefile.am files.'
      ACE_MAN_PAGES=`(cd man/man3 && echo *.3)`
      ACE_HTML_MAN_PAGES=`echo $ACE_MAN_PAGES | sed -e 's/.3$/.html/g'`
    else
      ACE_MAN_PAGES=
      ACE_HTML_MAN_PAGES=
    fi

    (cd man/man3; \
     eval "sed -e 's/^man_MANS =.*$/man_MANS = $ACE_MAN_PAGES/' \
       Makefile.am > Makefile.am.new"; \
     mv Makefile.am.new Makefile.am)
    (cd man/html; \
     eval "sed -e 's/^html_DATA =.*$/html_DATA = $ACE_HTML_MAN_PAGES/' \
       Makefile.am > Makefile.am.new"; \
     mv Makefile.am.new Makefile.am)
  else
    test -f man/man3/Makefile.am || echo 'man/man3/Makefile.am is missing!'
    test -f man/html/Makefile.am || echo 'man/html/Makefile.am is missing!'
    exit 1;
  fi  # test -f man/man3/Makefile.am && test -f man/html/Makefile.am

  # Provide some more "useful" information.
  echo Done bootstrapping.
else
  echo ACE must be bootstrapped from the top-level ACE source directory.
  exit 1;
fi  # test -d m4