~vcs-imports-ii/gpgme/master

824 by Werner Koch
Updated the CVS build stuff
1
#! /bin/sh
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
2
# Run this to generate all the initial makefiles, etc.
824 by Werner Koch
Updated the CVS build stuff
3
#
4
# Copyright (C) 2003 g10 Code GmbH
5
#
6
# This file is free software; as a special exception the author gives
7
# unlimited permission to copy and/or distribute it, with or without
8
# modifications, as long as this notice is preserved.
9
#
10
# This program is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
12
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14
configure_ac="configure.ac"
15
16
cvtver () {
17
  awk 'NR==1 {split($NF,A,".");X=1000000*A[1]+1000*A[2]+A[3];print X;exit 0}'
18
}
19
20
check_version () {
836 by Werner Koch
(memrchr): Fixed implementation. Problem pointed out
21
    if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
824 by Werner Koch
Updated the CVS build stuff
22
       return 0
23
    fi
24
    echo "**Error**: "\`$1\'" not installed or too old." >&2
25
    echo '           Version '$3' or newer is required.' >&2
26
    [ -n "$4" ] && echo '           Note that this is part of '\`$4\''.' >&2
27
    DIE="yes"
28
    return 1
29
}
30
31
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
32
DIE=no
1104 by Werner Koch
Preparing a new release
33
FORCE=
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
34
if test x"$1" = x"--force"; then
1104 by Werner Koch
Preparing a new release
35
  FORCE=" --force"
36
  shift
37
fi
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
38
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
39
# Begin list of optional variables sourced from ~/.gnupg-autogen.rc
40
w32_toolprefixes=
41
w32_extraoptions=
42
w32ce_toolprefixes=
43
w32ce_extraoptions=
44
amd64_toolprefixes=
45
# End list of optional variables sourced from ~/.gnupg-autogen.rc
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
46
# What follows are variables which are sourced but default to
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
47
# environment variables or lacking them hardcoded values.
48
#w32root=
49
#w32ce_root=
50
#amd64root=
51
52
if [ -f "$HOME/.gnupg-autogen.rc" ]; then
53
    echo "sourcing extra definitions from $HOME/.gnupg-autogen.rc"
54
    . "$HOME/.gnupg-autogen.rc"
55
fi
56
57
# Convenience option to use certain configure options for some hosts.
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
58
myhost=""
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
59
myhostsub=""
60
case "$1" in
61
    --build-w32)
62
        myhost="w32"
63
        ;;
64
    --build-w32ce)
65
        myhost="w32"
66
        myhostsub="ce"
67
        ;;
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
68
    --build-w64)
69
        myhost="w32"
70
        myhostsub="64"
71
        ;;
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
72
    --build-amd64)
73
        myhost="amd64"
74
        ;;
75
    --build*)
76
        echo "**Error**: invalid build option $1" >&2
77
        exit 1
78
        ;;
79
    *)
80
        ;;
81
esac
82
83
84
# ***** W32 build script *******
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
85
# Used to cross-compile for Windows.
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
86
if [ "$myhost" = "w32" ]; then
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
87
    tmp=`dirname $0`
88
    tsdir=`cd "$tmp"; pwd`
89
    shift
1480 by Werner Koch
Update helper scripts.
90
    if [ ! -f $tsdir/build-aux/config.guess ]; then
91
        echo "$tsdir/build-aux/config.guess not found" >&2
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
92
        exit 1
93
    fi
1480 by Werner Koch
Update helper scripts.
94
    build=`$tsdir/build-aux/config.guess`
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
95
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
96
    case $myhostsub in
97
        ce)
98
          w32root="$w32ce_root"
99
          [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
100
          toolprefixes="arm-mingw32ce"
101
          ;;
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
102
        64)
103
          w32root="$w64root"
104
          [ -z "$w32root" ] && w32root="$HOME/w64root"
1480 by Werner Koch
Update helper scripts.
105
          toolprefixes="$amd64_toolprefixes amd64-mingw32msvc"
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
106
          ;;
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
107
        *)
108
          [ -z "$w32root" ] && w32root="$HOME/w32root"
1480 by Werner Koch
Update helper scripts.
109
          toolprefixes="$w32_toolprefixes i686-w64-mingw32 i586-mingw32msvc"
110
          toolprefixes="$toolprefixes i386-mingw32msvc mingw32"
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
111
          ;;
112
    esac
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
113
    echo "Using $w32root as standard install directory" >&2
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
114
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
115
    crossbindir=
116
    for host in $toolprefixes; do
117
        if ${host}-gcc --version >/dev/null 2>&1 ; then
118
            crossbindir=/usr/${host}/bin
119
            conf_CC="CC=${host}-gcc"
120
            break;
121
        fi
122
    done
123
    if [ -z "$crossbindir" ]; then
124
        echo "Cross compiler kit not installed" >&2
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
125
        if [ -z "$myhostsub" ]; then
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
126
          echo "Under Debian GNU/Linux, you may install it using" >&2
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
127
          echo "  apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
128
        fi
129
        echo "Stop." >&2
130
        exit 1
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
131
    fi
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
132
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
133
    if [ -f "$tsdir/config.log" ]; then
134
        if ! head $tsdir/config.log | grep "$host" >/dev/null; then
135
            echo "Pease run a 'make distclean' first" >&2
136
            exit 1
137
        fi
138
    fi
139
1381 by Werner Koch
First take on changes to allow building with MSC for W32CE.
140
    $tsdir/configure --enable-maintainer-mode  --prefix=${w32root}  \
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
141
            --host=${host} --build=${build} \
1120 by Werner Koch
Changes for W32
142
            --with-gpg-error-prefix=${w32root} \
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
143
            --with-libassuan-prefix=${w32root} "$@"
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
144
145
    exit $?
146
fi
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
147
# ***** end W32 build script *******
148
149
150
# ***** AMD64 cross build script *******
151
# Used to cross-compile for AMD64 (for testing)
152
if [ "$myhost" = "amd64" ]; then
153
    tmp=`dirname $0`
154
    tsdir=`cd "$tmp"; pwd`
155
    shift
1480 by Werner Koch
Update helper scripts.
156
    if [ ! -f $tsdir/build-aux/config.guess ]; then
157
        echo "$tsdir/build-aux/config.guess not found" >&2
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
158
        exit 1
159
    fi
1480 by Werner Koch
Update helper scripts.
160
    build=`$tsdir/build-aux/config.guess`
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
161
162
    [ -z "$amd64root" ] && amd64root="$HOME/amd64root"
163
    echo "Using $amd64root as standard install directory" >&2
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
164
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
165
    # Locate the cross compiler
166
    crossbindir=
167
    for host in x86_64-linux-gnu amd64-linux-gnu; do
168
        if ${host}-gcc --version >/dev/null 2>&1 ; then
169
            crossbindir=/usr/${host}/bin
170
            conf_CC="CC=${host}-gcc"
171
            break;
172
        fi
173
    done
174
    if [ -z "$crossbindir" ]; then
175
        echo "Cross compiler kit not installed" >&2
176
        echo "Stop." >&2
177
        exit 1
178
    fi
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
179
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
180
    if [ -f "$tsdir/config.log" ]; then
181
        if ! head $tsdir/config.log | grep "$host" >/dev/null; then
182
            echo "Please run a 'make distclean' first" >&2
183
            exit 1
184
        fi
185
    fi
186
187
    $tsdir/configure --enable-maintainer-mode --prefix=${amd64root}  \
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
188
             --host=${host} --build=${build}
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
189
    rc=$?
190
    exit $rc
191
fi
192
# ***** end AMD64 cross build script *******
961 by Werner Koch
* acinclude.m4 (GNUPG_CHECK_VA_COPY): Assume no when cross-compiling.
193
194
195
824 by Werner Koch
Updated the CVS build stuff
196
# Grep the required versions from configure.ac
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
197
autoconf_vers=`sed -n '/^AC_PREREQ(/ {
824 by Werner Koch
Updated the CVS build stuff
198
s/^.*(\(.*\))/\1/p
199
q
200
}' ${configure_ac}`
201
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
202
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
203
automake_vers=`sed -n '/^min_automake_version=/ {
824 by Werner Koch
Updated the CVS build stuff
204
s/^.*="\(.*\)"/\1/p
205
q
206
}' ${configure_ac}`
207
automake_vers_num=`echo "$automake_vers" | cvtver`
208
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
209
#gettext_vers=`sed -n '/^AM_GNU_GETTEXT_VERSION(/ {
824 by Werner Koch
Updated the CVS build stuff
210
#s/^.*(\(.*\))/\1/p
211
#q
212
#}' ${configure_ac}`
213
#gettext_vers_num=`echo "$gettext_vers" | cvtver`
214
215
216
if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
217
then
218
  echo "**Error**: version information not found in "\`${configure_ac}\'"." >&2
219
  exit 1
220
fi
221
222
# Allow to override the default tool names
223
AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
224
AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
225
226
AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
227
ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
228
229
#GETTEXT=${GETTEXT_PREFIX}${GETTEXT:-gettext}${GETTEXT_SUFFIX}
230
#MSGMERGE=${GETTEXT_PREFIX}${MSGMERGE:-msgmerge}${GETTEXT_SUFFIX}
28 by Werner Koch
Does now compile under MingW32/CPD 0.3
231
824 by Werner Koch
Updated the CVS build stuff
232
233
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
234
    check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
235
fi
236
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
1351 by Marcus Brinkmann
2010-05-07 Marcus Brinkmann <marcus@g10code.de>
237
  check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
824 by Werner Koch
Updated the CVS build stuff
238
fi
239
#if check_version $GETTEXT $gettext_vers_num $gettext_vers; then
240
#  check_version $MSGMERGE $gettext_vers_num $gettext_vers gettext
241
#fi
25 by Werner Koch
Add 2 missing files and other changes
242
243
if test "$DIE" = "yes"; then
824 by Werner Koch
Updated the CVS build stuff
244
    cat <<EOF
245
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
246
Note that you may use alternative versions of the tools by setting
1422 by Werner Koch
Generate the ChangeLog from commit logs.
247
the corresponding environment variables; see README.GIT for details.
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
248
824 by Werner Koch
Updated the CVS build stuff
249
EOF
25 by Werner Koch
Add 2 missing files and other changes
250
    exit 1
251
fi
252
1422 by Werner Koch
Generate the ChangeLog from commit logs.
253
254
# Update the git setup.
255
if [ -d .git ]; then
256
  if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
257
    cat <<EOF >&2
258
*** Activating trailing whitespace git pre-commit hook. ***
259
    For more information see this thread:
260
      http://mail.gnome.org/archives/desktop-devel-list/2009-May/msg00084html
261
    To deactivate this pre-commit hook again move .git/hooks/pre-commit
262
    and .git/hooks/pre-commit.sample out of the way.
263
EOF
264
      cp -av .git/hooks/pre-commit.sample .git/hooks/pre-commit
1470 by Werner Koch
Fix non-portable use of chmod in autogen.sh.
265
      chmod +x  .git/hooks/pre-commit
1422 by Werner Koch
Generate the ChangeLog from commit logs.
266
  fi
267
  if [ -f build-aux/git-hooks/commit-msg -a ! -f .git/hooks/commit-msg ] ; then
268
    cat <<EOF >&2
269
*** Activating commit log message check hook. ***
270
EOF
271
      cp -av build-aux/git-hooks/commit-msg .git/hooks/commit-msg
1470 by Werner Koch
Fix non-portable use of chmod in autogen.sh.
272
      chmod +x  .git/hooks/commit-msg
1422 by Werner Koch
Generate the ChangeLog from commit logs.
273
  fi
274
fi
275
276
277
871 by Marcus Brinkmann
2004-04-02 Thomas Schwinge <schwinge@nic-nac-project.de>
278
echo "Running aclocal -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
279
$ACLOCAL -I m4 $ACLOCAL_FLAGS
25 by Werner Koch
Add 2 missing files and other changes
280
echo "Running autoheader..."
824 by Werner Koch
Updated the CVS build stuff
281
$AUTOHEADER
282
echo "Running automake --gnu ..."
283
$AUTOMAKE --gnu;
1104 by Werner Koch
Preparing a new release
284
echo "Running autoconf${FORCE} ..."
285
$AUTOCONF${FORCE}
824 by Werner Koch
Updated the CVS build stuff
286
1403 by Werner Koch
Insert platform dependent typedefs into gpgme.h
287
echo "You may now run
1242 by Werner Koch
First take on the low-level assuan interface.
288
  ./configure --enable-maintainer-mode && make
289
"