~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to build/autoconf/android.m4

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl This Source Code Form is subject to the terms of the Mozilla Public
2
 
dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3
 
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
 
 
5
 
AC_DEFUN([MOZ_ANDROID_NDK],
6
 
[
7
 
 
8
 
MOZ_ARG_WITH_STRING(android-ndk,
9
 
[  --with-android-ndk=DIR
10
 
                          location where the Android NDK can be found],
11
 
    android_ndk=$withval)
12
 
 
13
 
MOZ_ARG_WITH_STRING(android-toolchain,
14
 
[  --with-android-toolchain=DIR
15
 
                          location of the android toolchain],
16
 
    android_toolchain=$withval)
17
 
 
18
 
dnl default android_version is different per target cpu
19
 
case "$target_cpu" in
20
 
arm)
21
 
    android_version=5
22
 
    ;;
23
 
i?86|mipsel)
24
 
    android_version=9
25
 
    ;;
26
 
esac
27
 
 
28
 
MOZ_ARG_WITH_STRING(android-version,
29
 
[  --with-android-version=VER
30
 
                          android platform version, default 5 for arm, 9 for x86/mips],
31
 
    android_version=$withval)
32
 
 
33
 
MOZ_ARG_WITH_STRING(android-platform,
34
 
[  --with-android-platform=DIR
35
 
                           location of platform dir],
36
 
    android_platform=$withval)
37
 
 
38
 
case "$target" in
39
 
arm-linux*-android*|*-linuxandroid*)
40
 
    android_tool_prefix="arm-linux-androideabi"
41
 
    ;;
42
 
i?86-*android*)
43
 
    android_tool_prefix="i686-android-linux"
44
 
    ;;
45
 
mipsel-*android*)
46
 
    android_tool_prefix="mipsel-linux-android"
47
 
    ;;
48
 
*)
49
 
    android_tool_prefix="$target_os"
50
 
    ;;
51
 
esac
52
 
 
53
 
case "$target" in
54
 
*-android*|*-linuxandroid*)
55
 
    if test -z "$android_ndk" ; then
56
 
        AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
57
 
    fi
58
 
 
59
 
    if test -z "$android_toolchain" ; then
60
 
        AC_MSG_CHECKING([for android toolchain directory])
61
 
 
62
 
        kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
63
 
 
64
 
        case "$target_cpu" in
65
 
        arm)
66
 
            target_name=arm-linux-androideabi-4.4.3
67
 
            ;;
68
 
        i?86)
69
 
            target_name=x86-4.4.3
70
 
            ;;
71
 
        mipsel)
72
 
            target_name=mipsel-linux-android-4.4.3
73
 
            ;;
74
 
        esac
75
 
        android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
76
 
 
77
 
        if test -d "$android_toolchain" ; then
78
 
            AC_MSG_RESULT([$android_toolchain])
79
 
        else
80
 
            AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
81
 
        fi
82
 
    fi
83
 
 
84
 
    if test -z "$android_platform" ; then
85
 
        AC_MSG_CHECKING([for android platform directory])
86
 
 
87
 
        case "$target_cpu" in
88
 
        arm)
89
 
            target_name=arm
90
 
            ;;
91
 
        i?86)
92
 
            target_name=x86
93
 
            ;;
94
 
        mipsel)
95
 
            target_name=mips
96
 
            ;;
97
 
        esac
98
 
 
99
 
        android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
100
 
 
101
 
        if test -d "$android_platform" ; then
102
 
            AC_MSG_RESULT([$android_platform])
103
 
        else
104
 
            AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
105
 
        fi
106
 
    fi
107
 
 
108
 
    dnl set up compilers
109
 
    TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
110
 
    AS="$android_toolchain"/bin/"$android_tool_prefix"-as
111
 
    CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
112
 
    CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
113
 
    CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
114
 
    LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
115
 
    AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
116
 
    RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
117
 
    STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
118
 
    OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
119
 
 
120
 
    CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
121
 
    CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
122
 
    CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS"
123
 
    ASFLAGS="-isystem $android_platform/usr/include -DANDROID $ASFLAGS"
124
 
 
125
 
    dnl Add -llog by default, since we use it all over the place.
126
 
    dnl Add --allow-shlib-undefined, because libGLESv2 links to an
127
 
    dnl undefined symbol (present on the hardware, just not in the
128
 
    dnl NDK.)
129
 
    LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
130
 
    dnl prevent cross compile section from using these flags as host flags
131
 
    if test -z "$HOST_CPPFLAGS" ; then
132
 
        HOST_CPPFLAGS=" "
133
 
    fi
134
 
    if test -z "$HOST_CFLAGS" ; then
135
 
        HOST_CFLAGS=" "
136
 
    fi
137
 
    if test -z "$HOST_CXXFLAGS" ; then
138
 
        HOST_CXXFLAGS=" "
139
 
    fi
140
 
    if test -z "$HOST_LDFLAGS" ; then
141
 
        HOST_LDFLAGS=" "
142
 
    fi
143
 
 
144
 
    ANDROID_NDK="${android_ndk}"
145
 
    ANDROID_TOOLCHAIN="${android_toolchain}"
146
 
    ANDROID_PLATFORM="${android_platform}"
147
 
    ANDROID_VERSION="${android_version}"
148
 
 
149
 
    AC_DEFINE(ANDROID)
150
 
    AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
151
 
    AC_SUBST(ANDROID_VERSION)
152
 
    CROSS_COMPILE=1
153
 
    AC_SUBST(ANDROID_NDK)
154
 
    AC_SUBST(ANDROID_TOOLCHAIN)
155
 
    AC_SUBST(ANDROID_PLATFORM)
156
 
 
157
 
    ;;
158
 
esac
159
 
 
160
 
])
161
 
    
162
 
AC_DEFUN([MOZ_ANDROID_STLPORT],
163
 
[
164
 
 
165
 
if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
166
 
    case "${CPU_ARCH}-${MOZ_ARCH}" in
167
 
    arm-armv7*)
168
 
        ANDROID_CPU_ARCH=armeabi-v7a
169
 
        ;;
170
 
    arm-*)
171
 
        ANDROID_CPU_ARCH=armeabi
172
 
        ;;
173
 
    x86-*)
174
 
        ANDROID_CPU_ARCH=x86
175
 
        ;;
176
 
    mips-*) # When target_cpu is mipsel, CPU_ARCH is mips
177
 
        ANDROID_CPU_ARCH=mips
178
 
        ;;
179
 
    esac
180
 
 
181
 
    if test -z "$STLPORT_CPPFLAGS$STLPORT_LDFLAGS$STLPORT_LIBS"; then
182
 
        if test -e "$android_ndk/sources/cxx-stl/stlport/src/iostream.cpp" ; then
183
 
            if test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
184
 
                STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
185
 
            elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a"; then
186
 
                STLPORT_LDFLAGS="-L$_objdir/build/stlport -L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
187
 
            else
188
 
                AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
189
 
            fi
190
 
            STLPORT_SOURCES="$android_ndk/sources/cxx-stl/stlport"
191
 
            STLPORT_CPPFLAGS="-I$_objdir/build/stlport -I$android_ndk/sources/cxx-stl/stlport/stlport"
192
 
            STLPORT_LIBS="-lstlport_static"
193
 
        elif test "$target" != "arm-android-eabi"; then
194
 
            dnl fail if we're not building with NDKr4
195
 
            AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
196
 
        fi
197
 
    fi
198
 
    CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
199
 
    LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
200
 
    LIBS="$LIBS $STLPORT_LIBS"
201
 
fi
202
 
AC_SUBST([STLPORT_SOURCES])
203
 
 
204
 
])
205
 
 
206
 
AC_DEFUN([MOZ_ANDROID_SDK],
207
 
[
208
 
 
209
 
MOZ_ARG_WITH_STRING(android-sdk,
210
 
[  --with-android-sdk=DIR
211
 
                          location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
212
 
    android_sdk=$withval)
213
 
 
214
 
case "$target" in
215
 
*-android*|*-linuxandroid*)
216
 
    if test -z "$android_sdk" ; then
217
 
        AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
218
 
    else
219
 
        if ! test -e "$android_sdk"/source.properties ; then
220
 
            AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
221
 
        fi
222
 
 
223
 
        # Get the api level from "$android_sdk"/source.properties.
224
 
        android_api_level=`$AWK -F = changequote(<<, >>)'<<$>>1 == "AndroidVersion.ApiLevel" {print <<$>>2}'changequote([, ]) "$android_sdk"/source.properties`
225
 
 
226
 
        if test -z "$android_api_level" ; then
227
 
            AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
228
 
        fi
229
 
 
230
 
        if ! test "$android_api_level" -eq "$android_api_level" ; then
231
 
            AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
232
 
        fi
233
 
 
234
 
        if test $android_api_level -lt $1 ; then
235
 
            AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($1 or higher required).])
236
 
        fi
237
 
    fi
238
 
 
239
 
    android_platform_tools="$android_sdk"/../../platform-tools
240
 
    if test ! -d "$android_platform_tools" ; then
241
 
        android_platform_tools="$android_sdk"/tools # SDK Tools < r8
242
 
    fi
243
 
    ANDROID_SDK="${android_sdk}"
244
 
    ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
245
 
    AC_SUBST(ANDROID_SDK)
246
 
    AC_SUBST(ANDROID_PLATFORM_TOOLS)
247
 
    ;;
248
 
esac
249
 
 
250
 
])