summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2013-03-04 10:16:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-05 08:31:23 +0100
commit97fcf3bc987a18f32233fea550eb4a5a22e2b822 (patch)
tree31d75557fdc4a525af8f5053db514066c63bd1bd /mkspecs
parent1b582d64eb6d13e60a02ebc40956302a4864eb6c (diff)
Introducing the Qt Android port
Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/android-g++/qmake.conf178
-rw-r--r--mkspecs/android-g++/qplatformdefs.h187
-rw-r--r--mkspecs/features/android.prf14
-rw-r--r--mkspecs/features/java.prf61
-rw-r--r--mkspecs/features/qpa/genericunixfontdatabase.prf2
-rw-r--r--mkspecs/features/qt_android_deps.prf53
-rw-r--r--mkspecs/features/qt_module.prf2
-rw-r--r--mkspecs/unsupported/android-g++/qmake.conf2
-rw-r--r--mkspecs/unsupported/linux-android-armeabi-g++/qmake.conf14
-rw-r--r--mkspecs/unsupported/linux-android-armeabi-g++/qplatformdefs.h42
-rw-r--r--mkspecs/unsupported/linux-android-armeabi-v7a-g++/qmake.conf14
-rw-r--r--mkspecs/unsupported/linux-android-armeabi-v7a-g++/qplatformdefs.h42
-rw-r--r--mkspecs/unsupported/linux-android-x86-g++/qmake.conf14
-rw-r--r--mkspecs/unsupported/linux-android-x86-g++/qplatformdefs.h42
14 files changed, 497 insertions, 170 deletions
diff --git a/mkspecs/android-g++/qmake.conf b/mkspecs/android-g++/qmake.conf
new file mode 100644
index 0000000000..4901f0b0e2
--- /dev/null
+++ b/mkspecs/android-g++/qmake.conf
@@ -0,0 +1,178 @@
+# qmake configuration for building with android-g++
+MAKEFILE_GENERATOR = UNIX
+QMAKE_PLATFORM = android
+QMAKE_COMPILER = gcc
+
+CONFIG += android_install
+DEFINES += QT_NO_PRINTDIALOG
+
+include(../qdevice.pri)
+include(../common/linux.conf)
+include(../common/gcc-base-unix.conf)
+
+# Passing in -win32 to qmake (from NQTC) causes this condition to pass, however
+# qmake complains that -win32 is deprecated; should find another way, Q_OS_WIN
+# should really be all QMAKE_HOST.os needs to depend on?
+contains(QMAKE_HOST.os,Windows) {
+ # Not having sh.exe in your path causes this condition to pass
+ # To build Android Qt on Windows, this block must not be evaluated.
+ isEmpty(QMAKE_SH) {
+ include(../common/shell-win32.conf)
+ QMAKE_DEL_TREE = rmdir /s /q
+ QMAKE_INSTALL_FILE = copy /y
+ QMAKE_INSTALL_PROGRAM = copy /y
+ }
+}
+
+NDK_ROOT = $$(ANDROID_NDK_ROOT)
+!exists($$NDK_ROOT) {
+ NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT
+ !exists($$NDK_ROOT): error("You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.")
+}
+
+NDK_HOST = $$(ANDROID_NDK_HOST)
+isEmpty(NDK_HOST): NDK_HOST = $$DEFAULT_ANDROID_NDK_HOST
+
+ANDROID_PLATFORM = $$(ANDROID_NDK_PLATFORM)
+isEmpty(ANDROID_PLATFORM): ANDROID_PLATFORM = $$DEFAULT_ANDROID_PLATFORM
+
+ANDROID_TARGET_ARCH = $$(ANDROID_TARGET_ARCH)
+isEmpty(ANDROID_TARGET_ARCH): ANDROID_TARGET_ARCH = $$DEFAULT_ANDROID_TARGET_ARCH
+
+NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
+isEmpty(NDK_TOOLCHAIN_PREFIX) {
+ equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86
+ else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android
+ else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
+}
+
+NDK_TOOLS_PREFIX = $$(ANDROID_NDK_TOOLS_PREFIX)
+isEmpty(NDK_TOOLS_PREFIX) {
+ equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLS_PREFIX = i686-linux-android
+ else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLS_PREFIX = mipsel-linux-android
+ else: NDK_TOOLS_PREFIX = arm-linux-androideabi
+}
+
+NDK_TOOLCHAIN_VERSION = $$(ANDROID_NDK_TOOLCHAIN_VERSION)
+isEmpty(NDK_TOOLCHAIN_VERSION): NDK_TOOLCHAIN_VERSION = $$DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION
+
+equals(ANDROID_TARGET_ARCH, x86): ANDROID_ARCHITECTURE = x86
+else: equals(ANDROID_TARGET_ARCH, mips): ANDROID_ARCHITECTURE = mips
+else: ANDROID_ARCHITECTURE = arm
+
+!equals(NDK_TOOLCHAIN_VERSION, 4.4.3): ANDROID_CXXSTL_SUFFIX = -$$NDK_TOOLCHAIN_VERSION
+
+NDK_TOOLCHAIN = $$NDK_TOOLCHAIN_PREFIX-$$NDK_TOOLCHAIN_VERSION
+NDK_TOOLCHAIN_PATH = $$NDK_ROOT/toolchains/$$NDK_TOOLCHAIN/prebuilt/$$NDK_HOST
+
+CONFIG += $$ANDROID_PLATFORM
+ANDROID_PLATFORM_ROOT_PATH = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/
+ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr
+
+# used to compile platform plugins for android-4 and android-5
+QMAKE_ANDROID_PLATFORM_INCDIR = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/usr/include
+QMAKE_ANDROID_PLATFORM_LIBDIR = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/usr/lib
+
+ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
+ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
+
+# modifications to g++.conf
+QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
+
+equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
+ QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
+else: equals(ANDROID_TARGET_ARCH, armeabi): \
+ QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
+else: equals(ANDROID_TARGET_ARCH, x86): \
+ QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
+else: equals(ANDROID_TARGET_ARCH, mips): \
+ QMAKE_CFLAGS = -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -O2 -fomit-frame-pointer -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
+
+QMAKE_CFLAGS_WARN_ON = -Wall -Wno-psabi -W
+QMAKE_CFLAGS_WARN_OFF = -Wno-psabi
+equals(ANDROID_TARGET_ARCH, x86) {
+ QMAKE_CFLAGS_RELEASE = -O2
+ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
+ QMAKE_CFLAGS_DEBUG = -g
+} else: equals(ANDROID_TARGET_ARCH, mips) {
+ QMAKE_CFLAGS_RELEASE = -O2
+ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -O2
+ QMAKE_CFLAGS_DEBUG = -g -fno-omit-frame-pointer
+} else { # arm
+ QMAKE_CFLAGS_RELEASE = -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
+ QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
+ QMAKE_CFLAGS_DEBUG = -g -marm -O0 -fno-omit-frame-pointer
+}
+
+QMAKE_CFLAGS_SHLIB = -fPIC
+QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
+QMAKE_CFLAGS_THREAD = -D_REENTRANT
+QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden
+
+QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
+QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -std=gnu++0x
+QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
+QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
+QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
+QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG
+QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
+QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
+QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
+QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
+
+QMAKE_LINK = $$QMAKE_CXX
+QMAKE_LINK_SHLIB = $$QMAKE_LINK
+
+# modifications to linux.conf
+QMAKE_AR = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ar cqs
+QMAKE_OBJCOPY = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-objcopy
+
+QMAKE_STRIP =
+#$$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-strip
+
+QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
+
+QMAKE_INCDIR = $$ANDROID_SOURCES_CXX_STL_INCDIR $$ANDROID_PLATFORM_PATH/include
+QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$ANDROID_PLATFORM_PATH/lib $$LIBGCC_PATH
+QMAKE_INCDIR_X11 =
+QMAKE_LIBDIR_X11 =
+QMAKE_INCDIR_OPENGL = $$ANDROID_PLATFORM_PATH/include
+QMAKE_LIBDIR_OPENGL = $$ANDROID_PLATFORM_PATH/lib
+
+equals(ANDROID_TARGET_ARCH, x86)|equals(ANDROID_TARGET_ARCH, mips): \
+ LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -print-libgcc-file-name")
+else: \
+ LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -mthumb-interwork -print-libgcc-file-name")
+
+LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)
+
+QMAKE_LINK = $$QMAKE_CXX
+QMAKE_LINK_SHLIB = $$QMAKE_CXX
+QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
+QMAKE_RPATHLINK = $$ANDROID_PLATFORM_PATH/lib
+QMAKE_LFLAGS_APP = -Wl,--no-undefined -Wl,-z,noexecstack -shared
+QMAKE_LFLAGS_SHLIB = -Wl,--no-undefined -Wl,-z,noexecstack -shared
+
+contains(NDK_ROOT, ".*r6")|contains(NDK_ROOT, ".*r5.*") {
+ !equals(ANDROID_PLATFORM, android-4):!equals(ANDROID_PLATFORM, android-5):!equals(ANDROID_PLATFORM, android-8) {
+ warning("Your NDK version is outdated. A workaround is enabled. Consider updating your NDK (workarounds are required until r6(a))")
+ QMAKE_LFLAGS_SHLIB += $$ANDROID_PLATFORM_PATH/lib/crtbegin_so.o $$ANDROID_PLATFORM_PATH/lib/crtend_so.o
+ }
+}
+
+QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
+QMAKE_LFLAGS_SONAME =
+QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
+QMAKE_LFLAGS_RPATH = -Wl,-rpath=
+QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link=
+
+QMAKE_LIBS = -lgnustl_shared -lsupc++ -llog -lz -lm -ldl -lc -lgcc
+QMAKE_LIBS_X11 =
+QMAKE_LIBS_THREAD =
+QMAKE_LIBS_EGL = -lEGL
+QMAKE_LIBS_OPENGL =
+QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
+QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $$QMAKE_LIBS
+
+load(qt_config)
diff --git a/mkspecs/android-g++/qplatformdefs.h b/mkspecs/android-g++/qplatformdefs.h
new file mode 100644
index 0000000000..0acd19ea5d
--- /dev/null
+++ b/mkspecs/android-g++/qplatformdefs.h
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#define QT_QPA_DEFAULT_PLATFORM_NAME "android"
+
+// Get Qt defines/settings
+
+#include "qglobal.h"
+
+// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
+
+// 1) need to reset default environment if _BSD_SOURCE is defined
+// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
+// 3) it seems older glibc need this to include the X/Open stuff
+
+#include <unistd.h>
+
+// We are hot - unistd.h should have turned on the specific APIs we requested
+
+#include <features.h>
+#include <pthread.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <pwd.h>
+#include <signal.h>
+#include <dlfcn.h>
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/ipc.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#ifndef QT_NO_IPV6IFNAME
+#include <net/if.h>
+#endif
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_STATBUF struct stat64
+#define QT_STATBUF4TSTAT struct stat64
+#define QT_STAT ::stat64
+#define QT_FSTAT ::fstat64
+#define QT_LSTAT ::lstat64
+#define QT_OPEN ::open64
+#define QT_TRUNCATE ::truncate64
+#define QT_FTRUNCATE ::ftruncate64
+#define QT_LSEEK ::lseek64
+#else
+#define QT_STATBUF struct stat
+#define QT_STATBUF4TSTAT struct stat
+#define QT_STAT ::stat
+#define QT_FSTAT ::fstat
+#define QT_LSTAT ::lstat
+#define QT_OPEN ::open
+#define QT_TRUNCATE ::truncate
+#define QT_FTRUNCATE ::ftruncate
+#define QT_LSEEK ::lseek
+#endif
+
+#ifdef QT_LARGEFILE_SUPPORT
+#define QT_FOPEN ::fopen64
+#define QT_FSEEK ::fseeko64
+#define QT_FTELL ::ftello64
+#define QT_FGETPOS ::fgetpos64
+#define QT_FSETPOS ::fsetpos64
+#define QT_MMAP ::mmap64
+#define QT_FPOS_T fpos64_t
+#define QT_OFF_T off64_t
+#else
+#define QT_FOPEN ::fopen
+#define QT_FSEEK ::fseek
+#define QT_FTELL ::ftell
+#define QT_FGETPOS ::fgetpos
+#define QT_FSETPOS ::fsetpos
+#define QT_MMAP ::mmap
+#define QT_FPOS_T fpos_t
+#define QT_OFF_T long
+#endif
+
+#define QT_STAT_REG S_IFREG
+#define QT_STAT_DIR S_IFDIR
+#define QT_STAT_MASK S_IFMT
+#define QT_STAT_LNK S_IFLNK
+#define QT_SOCKET_CONNECT ::connect
+#define QT_SOCKET_BIND ::bind
+#define QT_FILENO fileno
+#define QT_CLOSE ::close
+#define QT_READ ::read
+#define QT_WRITE ::write
+#define QT_ACCESS ::access
+#define QT_GETCWD ::getcwd
+#define QT_CHDIR ::chdir
+#define QT_MKDIR ::mkdir
+#define QT_RMDIR ::rmdir
+#define QT_OPEN_LARGEFILE O_LARGEFILE
+#define QT_OPEN_RDONLY O_RDONLY
+#define QT_OPEN_WRONLY O_WRONLY
+#define QT_OPEN_RDWR O_RDWR
+#define QT_OPEN_CREAT O_CREAT
+#define QT_OPEN_TRUNC O_TRUNC
+#define QT_OPEN_APPEND O_APPEND
+
+// Directory iteration
+#define QT_DIR DIR
+
+#define QT_OPENDIR ::opendir
+#define QT_CLOSEDIR ::closedir
+
+#if defined(QT_LARGEFILE_SUPPORT) \
+ && defined(QT_USE_XOPEN_LFS_EXTENSIONS) \
+ && !defined(QT_NO_READDIR64)
+#define QT_DIRENT struct dirent64
+#define QT_READDIR ::readdir64
+#define QT_READDIR_R ::readdir64_r
+#else
+#define QT_DIRENT struct dirent
+#define QT_READDIR ::readdir
+#define QT_READDIR_R ::readdir_r
+#endif
+
+#define QT_SOCKET_CONNECT ::connect
+#define QT_SOCKET_BIND ::bind
+
+
+#define QT_SIGNAL_RETTYPE void
+#define QT_SIGNAL_ARGS int
+#define QT_SIGNAL_IGNORE SIG_IGN
+
+#if defined(__GLIBC__) && (__GLIBC__ >= 2)
+#define QT_SOCKLEN_T socklen_t
+#else
+#define QT_SOCKLEN_T int
+#endif
+
+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+#define QT_SNPRINTF ::snprintf
+#define QT_VSNPRINTF ::vsnprintf
+#endif
+
+#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/features/android.prf b/mkspecs/features/android.prf
new file mode 100644
index 0000000000..2a3086d4ad
--- /dev/null
+++ b/mkspecs/features/android.prf
@@ -0,0 +1,14 @@
+contains(TEMPLATE, ".*app") {
+ !android_app {
+ !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so
+ QMAKE_LFLAGS += -Wl,-soname,$$TARGET
+ }
+}
+!QTDIR_build:android_install {
+ isEmpty(QT_BUILD_TREE) {
+ target.path=/libs/$$ANDROID_TARGET_ARCH/
+ } else {
+ target.path = /
+ }
+ INSTALLS *= target
+}
diff --git a/mkspecs/features/java.prf b/mkspecs/features/java.prf
new file mode 100644
index 0000000000..05350db48d
--- /dev/null
+++ b/mkspecs/features/java.prf
@@ -0,0 +1,61 @@
+TEMPLATE = lib
+android {
+ isEmpty(SDK_ROOT): SDK_ROOT = $$(ANDROID_SDK_ROOT)
+ isEmpty(SDK_ROOT): SDK_ROOT = $$DEFAULT_ANDROID_SDK_ROOT
+ isEmpty(API_VERSION) {
+ API_VERSION = $$(ANDROID_API_VERSION)
+ isEmpty(API_VERSION): API_VERSION = android-10
+ }
+
+ !exists($$SDK_ROOT/platforms/$$API_VERSION/android.jar) {
+ error("The Path $$SDK_ROOT/platforms/$$API_VERSION/android.jar does not exist. Make sure the ANDROID_SDK_ROOT and ANDROID_API_VERSION environment variables are correctly set.")
+ }
+ JAVACLASSPATH += $$SDK_ROOT/platforms/$$API_VERSION/android.jar
+
+ # FIXME: This is a hack to work around some hardcoded values in the android.prf. The
+ # android.prf should be fixed and this should be removed.
+ CONFIG += android_app
+}
+
+isEmpty(CLASS_DIR): CLASS_DIR = .classes
+
+CONFIG -= qt
+
+# Without these, qmake adds a name prefix and versioning postfixes (as well as file
+# links) to the target. This is hardcoded in the qmake code, so for now we use
+# the plugin configs to get what we want.
+CONFIG += plugin no_plugin_name_prefix
+
+javac.input = JAVASOURCES
+javac.output = $$CLASS_DIR
+javac.CONFIG += combine
+javac.commands = javac -source 6 -target 6 -cp $$shell_quote($$join(JAVACLASSPATH, ":")) -d $$shell_quote($$CLASS_DIR) ${QMAKE_FILE_IN}
+# Force rebuild every time, because we don't know the paths of the destination files
+# as they depend on the code.
+javac.depends = FORCE
+QMAKE_EXTRA_COMPILERS += javac
+
+mkpath($$absolute_path($$CLASS_DIR, $$OUT_PWD)) | error("Aborting.")
+
+# Disable all linker flags since we are overriding the regular linker
+QMAKE_LFLAGS =
+QMAKE_CFLAGS =
+QMAKE_LFLAGS_RPATH =
+QMAKE_LFLAGS_PLUGIN =
+QMAKE_LIBS =
+QMAKE_LIBS_OPENGL_ES2 =
+QMAKE_LIBDIR =
+QMAKE_EXTENSION_SHLIB = jar
+
+# Override linker with dex (for Android) or jar (for other java builds)
+android {
+ QMAKE_LINK_O_FLAG = --output=
+ QMAKE_LINK = $$SDK_ROOT/platform-tools/dx --dex
+} else {
+ QMAKE_LINK_O_FLAG = "cf "
+ QMAKE_LINK = jar
+}
+
+# Force link step to always happen, since we are always updating the
+# .class files
+PRE_TARGETDEPS += FORCE
diff --git a/mkspecs/features/qpa/genericunixfontdatabase.prf b/mkspecs/features/qpa/genericunixfontdatabase.prf
index 36a358271c..fc11bea470 100644
--- a/mkspecs/features/qpa/genericunixfontdatabase.prf
+++ b/mkspecs/features/qpa/genericunixfontdatabase.prf
@@ -2,7 +2,7 @@ CONFIG += qpa/basicunixfontdatabase
contains(QT_CONFIG, fontconfig) {
DEFINES += Q_FONTCONFIGDATABASE
LIBS += -lfontconfig
-} else {
+} else:!android {
fonts.path = $$[QT_INSTALL_LIBS]/fonts
fonts.files = $$QT_SOURCE_TREE/lib/fonts/*
INSTALLS += fonts
diff --git a/mkspecs/features/qt_android_deps.prf b/mkspecs/features/qt_android_deps.prf
new file mode 100644
index 0000000000..27814a90a5
--- /dev/null
+++ b/mkspecs/features/qt_android_deps.prf
@@ -0,0 +1,53 @@
+
+# W A R N I N G
+# -------------
+#
+# This file is not part of the Qt API. It exists purely as an
+# implementation detail. It may change from version to version
+# without notice, or even be removed.
+#
+# We mean it.
+#
+
+# Generates an xml file to match the library in lib/ listing the dependencies
+# of the module on JNI-based libraries etc. Used for deployment of an Android
+# app.
+
+ANDROID_DEPENDS_DIR = $$MODULE_QMAKE_OUTDIR/lib/
+DEPENDENCY_FILE = $$ANDROID_DEPENDS_DIR$$TARGET-android-dependencies.xml
+
+!build_pass {
+ !isEmpty(ANDROID_JAR_DEPENDENCIES) {
+ for(JAR_FILE, ANDROID_JAR_DEPENDENCIES) {
+ INIT_CLASS = $$section(JAR_FILE, ":", 1, 1)
+ !isEmpty(INIT_CLASS): INIT_CLASS = "initClass=\"$$INIT_CLASS\""
+ JAR_FILE = $$section(JAR_FILE, ":", 0, 0)
+ FILE_CONTENT += "<jar file=\"$$JAR_FILE\" $$INIT_CLASS />"
+ }
+ }
+
+ !isEmpty(ANDROID_LIB_DEPENDENCIES) {
+ for(LIB_FILE, ANDROID_LIB_DEPENDENCIES) {
+ FILE_CONTENT += "<lib file=\"$$LIB_FILE\" />"
+ }
+ }
+
+ !isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
+ for(REPLACEMENT, ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
+ REPLACEMENT_FILE = $$section(REPLACEMENT, ":", 0, 0)
+ LIB_FILE = $$section(REPLACEMENT, ":", 1, 1)
+ FILE_CONTENT += "<lib file=\"$$LIB_FILE\" replaces=\"$$REPLACEMENT_FILE\" />"
+ }
+ }
+
+ !isEmpty(FILE_CONTENT) {
+ FILE_CONTENT = "<rules><dependencies><lib name=\"$$TARGET\"><depends>" $$FILE_CONTENT "</depends></lib></dependencies></rules>"
+ write_file($$DEPENDENCY_FILE, FILE_CONTENT) | error("Aborting.")
+ }
+}
+
+!isEmpty(ANDROID_JAR_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCIES)|!isEmpty(ANDROID_LIB_DEPENDENCY_REPLACEMENTS) {
+ install_dependencies_file.files = $$DEPENDENCY_FILE
+ install_dependencies_file.path = $$[QT_INSTALL_LIBS]
+ INSTALLS += install_dependencies_file
+}
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 0a34245e3c..4635f3a42a 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -107,6 +107,8 @@ aix-g++* {
QMAKE_CXXFLAGS += -mminimal-toc
}
+android: CONFIG += qt_android_deps
+
#install directives
load(qt_installs)
diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf
index e78f8ba4b1..fb325f156c 100644
--- a/mkspecs/unsupported/android-g++/qmake.conf
+++ b/mkspecs/unsupported/android-g++/qmake.conf
@@ -174,7 +174,7 @@ QMAKE_LIBS_OPENGL =
QMAKE_LIBS_OPENGL_ES1 = -lGLESv1_CM
QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGLESv2 $$QMAKE_LIBS
-CONFIG += linux-android-9 android-9 linux-android android
+CONFIG += linux-android-9 android-9 linux-android android android-no-sdk android_app
load(qt_config)
QT_CONFIG -=accessibility
diff --git a/mkspecs/unsupported/linux-android-armeabi-g++/qmake.conf b/mkspecs/unsupported/linux-android-armeabi-g++/qmake.conf
deleted file mode 100644
index ea988d3a51..0000000000
--- a/mkspecs/unsupported/linux-android-armeabi-g++/qmake.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# qmake configuration for building with android-g++ for ARMv5
-#
-
-ANDROID_TARGET_ARCH = armeabi
-ANDROID_ARCHITECTURE = arm
-ANDROID_NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
-ANDROID_NDK_TOOLS_PREFIX = arm-linux-androideabi
-QMAKE_CFLAGS = -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
-QMAKE_CFLAGS_RELEASE = -g -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
-QMAKE_CFLAGS_DEBUG = -g -marm -O0 -fno-omit-frame-pointer
-
-include(../../common/linux-android.conf)
-
diff --git a/mkspecs/unsupported/linux-android-armeabi-g++/qplatformdefs.h b/mkspecs/unsupported/linux-android-armeabi-g++/qplatformdefs.h
deleted file mode 100644
index 38b5f6e6d2..0000000000
--- a/mkspecs/unsupported/linux-android-armeabi-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Collabora Ltd, author <robin.burchell@collabora.co.uk>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../common/android/qplatformdefs.h"
diff --git a/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qmake.conf b/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qmake.conf
deleted file mode 100644
index 70445a536f..0000000000
--- a/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qmake.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# qmake configuration for building with android-g++ for ARMv7
-#
-
-ANDROID_TARGET_ARCH = armeabi-v7a
-ANDROID_ARCHITECTURE = arm
-ANDROID_NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
-ANDROID_NDK_TOOLS_PREFIX = arm-linux-androideabi
-QMAKE_CFLAGS = -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack
-QMAKE_CFLAGS_RELEASE = -g -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64
-QMAKE_CFLAGS_DEBUG = -g -marm -O0 -fno-omit-frame-pointer
-
-include(../../common/linux-android.conf)
-
diff --git a/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qplatformdefs.h b/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qplatformdefs.h
deleted file mode 100644
index 38b5f6e6d2..0000000000
--- a/mkspecs/unsupported/linux-android-armeabi-v7a-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Collabora Ltd, author <robin.burchell@collabora.co.uk>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../common/android/qplatformdefs.h"
diff --git a/mkspecs/unsupported/linux-android-x86-g++/qmake.conf b/mkspecs/unsupported/linux-android-x86-g++/qmake.conf
deleted file mode 100644
index 5a51704b38..0000000000
--- a/mkspecs/unsupported/linux-android-x86-g++/qmake.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# qmake configuration for building with android-g++ for x86
-#
-
-ANDROID_TARGET_ARCH = x86
-ANDROID_ARCHITECTURE = x86
-ANDROID_NDK_TOOLCHAIN_PREFIX = x86
-ANDROID_NDK_TOOLS_PREFIX = i686-android-linux
-QMAKE_CFLAGS = -ffunction-sections -funwind-tables -O2 -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -DANDROID -Wa,--noexecstack
-QMAKE_CFLAGS_RELEASE = -g -O2
-QMAKE_CFLAGS_DEBUG = -g
-
-include(../../common/linux-android.conf)
-
diff --git a/mkspecs/unsupported/linux-android-x86-g++/qplatformdefs.h b/mkspecs/unsupported/linux-android-x86-g++/qplatformdefs.h
deleted file mode 100644
index 38b5f6e6d2..0000000000
--- a/mkspecs/unsupported/linux-android-x86-g++/qplatformdefs.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Collabora Ltd, author <robin.burchell@collabora.co.uk>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../../common/android/qplatformdefs.h"