Skip to content

Commit

Permalink
Android: Don't include Apache code under LGPLv2 license
Browse files Browse the repository at this point in the history
The code which extracts style assets for the Android style
is licensed under the Apache license, which is not compatible
with LGPLv2.1. It is, however, compatible with LGPLv3. This
means that the Android platform plugin cannot be LGPLv2.1
as long as this code is included.

To minimize licensing confusion, we default to only providing
LGPLv3 for Android. If you want to build a LGPLv2.1-compatible
library, you can add -no-android-style-assets to the
configuration. This will in turn enable the LGPLv2.1 in
the configure output, and it will disable the extraction
code in the platform plugin.

Running the Android style with an LGPLv2.1-compatible platform
plugin will work, but it will look horrible.

[ChangeLog][Android] Default open-source license for
Qt for Android is now LGPLv3. For compatibility with the LGPLv2.1
license, add "-no-android-style-assets" to your configuration.

Change-Id: I6c7b52140f38138520871fa7c69debbb4ee90e6c
Task-number: QTBUG-41365
Reviewed-by: Oswald Buddenhagen <[email protected]>
Reviewed-by: Christian Stromme <[email protected]>
  • Loading branch information
Eskil Abrahamsen Blomfeldt committed Oct 2, 2014
1 parent 08c523a commit 538248d
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 24 deletions.
44 changes: 37 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ CFG_PPS=auto
CFG_QNX_IMF=auto
CFG_LGMON=auto
CFG_SYSTEM_PROXIES=no
CFG_ANDROID_STYLE_ASSETS=yes

# Target architecture
CFG_ARCH=
Expand Down Expand Up @@ -2144,6 +2145,13 @@ while [ "$#" -gt 0 ]; do
android-toolchain-version)
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL"
;;
android-style-assets)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_ANDROID_STYLE_ASSETS="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
l*) # -lfoo
if [ "$VAL" = "yes" ]; then
L_FLAGS="$L_FLAGS -l\"${VAR#l}\""
Expand Down Expand Up @@ -2565,6 +2573,14 @@ Android options:
-android-toolchain-version ..... Sets the android toolchain version
(default $CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION)
-no-android-style-assets ....... Do not compile in the code which automatically extracts
style assets from the run-time device. Setting this will
make the Android style behave incorrectly, but will enable
compatibility with the LGPL2.1 license.
* -android-style-assets .......... Compile the code which automatically extracts style assets
from the run-time device. This option will make the
Android platform plugin incompatible with the LGPL2.1.
EOF

exit 0
Expand Down Expand Up @@ -2826,11 +2842,20 @@ fi

if [ "$Edition" = "OpenSource" ]; then
while true; do
echo "You are licensed to use this software under the terms of"
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
echo "You are also licensed to use this software under the terms of"
echo "the GNU Lesser General Public License (LGPL) versions 3."
affix="either"
if [ "$CFG_ANDROID_STYLE_ASSETS" = "no" ] || [ "$XPLATFORM_ANDROID" = "no" ]; then
echo "You are licensed to use this software under the terms of"
echo "the Lesser GNU General Public License (LGPL) versions 2.1."
echo "You are also licensed to use this software under the terms of"
echo "the GNU Lesser General Public License (LGPL) versions 3."
affix="either"
showLGPL2="yes"
else
echo "You are licensed to use this software under the terms of"
echo "the GNU Lesser General Public License (LGPL) versions 3."
showLGPL2="no"
affix="the"
fi

echo
if [ "$OPT_CONFIRM_LICENSE" = "yes" ]; then
echo "You have already accepted the terms of the $EditionString license."
Expand All @@ -2839,7 +2864,9 @@ if [ "$Edition" = "OpenSource" ]; then
if [ -f "$relpath/LICENSE.LGPLv3" ]; then
echo "Type '3' to view the GNU Lesser General Public License version 3."
fi
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
if [ "$showLGPL2" = "yes" ]; then
echo "Type 'L' to view the Lesser GNU General Public License version 2.1."
fi
echo "Type 'yes' to accept this license offer."
echo "Type 'no' to decline this license offer."
echo
Expand All @@ -2855,7 +2882,7 @@ if [ "$Edition" = "OpenSource" ]; then
exit 1
elif [ "$acceptance" = "3" ]; then
more "$relpath/LICENSE.LGPLv3"
elif [ "$acceptance" = "L" ]; then
elif [ "$acceptance" = "L" ] && [ "$showLGPL2" = "yes" ]; then
more "$relpath/LICENSE.LGPLv21"
fi
done
Expand Down Expand Up @@ -3167,6 +3194,9 @@ if [ "$XPLATFORM_ANDROID" = "yes" ] ; then
esac
QMAKE_CONF_COMPILER=$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/$ANDROID_NDK_TOOLS_PREFIX-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST/bin/$ANDROID_NDK_TOOLS_PREFIX-g++
TEST_COMPILER="$QMAKE_CONF_COMPILER --sysroot=$CFG_DEFAULT_ANDROID_NDK_ROOT/platforms/$CFG_DEFAULT_ANDROID_PLATFORM/$ANDROID_PLATFORM_ARCH/"
if [ "$CFG_ANDROID_STYLE_ASSETS" = "yes" ]; then
QMAKE_CONFIG="$QMAKE_CONFIG android-style-assets"
fi
fi

if [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
Expand Down
28 changes: 28 additions & 0 deletions header.LGPL3
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the FOO module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** 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 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,9 @@ private JSONArray getJsonArray(float[] array) throws JSONException
private JSONObject getJsonChunkInfo(int[] chunkData) throws JSONException
{
JSONObject jsonRect = new JSONObject();
if (chunkData == null)
return jsonRect;

jsonRect.put("xdivs", getJsonArray(chunkData, 3, chunkData[0]));
jsonRect.put("ydivs", getJsonArray(chunkData, 3 + chunkData[0], chunkData[1]));
jsonRect.put("colors", getJsonArray(chunkData, 3 + chunkData[0] + chunkData[1], chunkData[2]));
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/platforms/android/android.pro
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ SOURCES += $$PWD/androidplatformplugin.cpp \
$$PWD/qandroidplatformbackingstore.cpp \
$$PWD/qandroidplatformopenglcontext.cpp \
$$PWD/qandroidplatformforeignwindow.cpp \
$$PWD/extract.cpp \
$$PWD/qandroideventdispatcher.cpp

HEADERS += $$PWD/qandroidplatformintegration.h \
Expand Down Expand Up @@ -80,6 +79,9 @@ HEADERS += $$PWD/qandroidplatformintegration.h \
$$PWD/qandroidplatformforeignwindow.h \
$$PWD/qandroideventdispatcher.h

android-style-assets: SOURCES += $$PWD/extract.cpp
else: SOURCES += $$PWD/extract-dummy.cpp

#Non-standard install directory, QTBUG-29859
DESTDIR = $$DESTDIR/android
target.path = $${target.path}/android
55 changes: 55 additions & 0 deletions src/plugins/platforms/android/extract-dummy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** 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.
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include <jni.h>
#include <extract.h>

extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo(JNIEnv *, jobject, Res_png_9patch*)
{
return 0;
}

extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo(JNIEnv *, jobject, jbyteArray)
{
return 0;
}

extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractNativeChunkInfo20(JNIEnv *, jobject, long)
{
return 0;
}

extern "C" JNIEXPORT jintArray JNICALL Java_org_qtproject_qt5_android_ExtractStyle_extractChunkInfo20(JNIEnv *, jobject, jbyteArray)
{
return 0;
}
21 changes: 8 additions & 13 deletions src/plugins/platforms/android/extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** $QT_BEGIN_LICENSE:LGPL3$
** 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
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** 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.
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** $QT_END_LICENSE$
**
Expand Down
23 changes: 20 additions & 3 deletions tools/configure/configureapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,12 @@ void Configure::parseCmdLine()
dictionary[ "ANDROID_NDK_TOOLCHAIN_VERSION" ] = configCmdLine.at(i);
}

else if (configCmdLine.at(i) == "-no-android-style-assets") {
dictionary[ "ANDROID_STYLE_ASSETS" ] = "no";
} else if (configCmdLine.at(i) == "-android-style-assets") {
dictionary[ "ANDROID_STYLE_ASSETS" ] = "yes";
}

else {
dictionary[ "DONE" ] = "error";
cout << "Unknown option " << configCmdLine.at(i) << endl;
Expand Down Expand Up @@ -1693,6 +1699,7 @@ void Configure::applySpecSpecifics()
dictionary[ "REDUCE_RELOCATIONS" ] = "yes";
dictionary[ "QT_GETIFADDRS" ] = "no";
dictionary[ "QT_XKBCOMMON" ] = "no";
dictionary["ANDROID_STYLE_ASSETS"] = "yes";
}
}

Expand Down Expand Up @@ -3355,6 +3362,9 @@ void Configure::generateQConfigPri()
if (dictionary["DIRECTWRITE"] == "yes")
configStream << " directwrite";

if (dictionary["ANDROID_STYLE_ASSETS"] == "yes")
configStream << " android-style-assets";

// ### For compatibility only, should be removed later.
configStream << " qpa";

Expand Down Expand Up @@ -4219,11 +4229,17 @@ bool Configure::showLicense(QString orgLicenseFile)
return true;
}

bool showLgpl2 = true;
QString licenseFile = orgLicenseFile;
QString theLicense;
if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
theLicense = "GNU Lesser General Public License (LGPL) version 2.1"
"\nor the GNU Lesser General Public License (LGPL) version 3";
if (platform() != ANDROID || dictionary["ANDROID_STYLE_ASSETS"] == "no") {
theLicense = "GNU Lesser General Public License (LGPL) version 2.1"
"\nor the GNU Lesser General Public License (LGPL) version 3";
} else {
theLicense = "GNU Lesser General Public License (LGPL) version 3";
showLgpl2 = false;
}
} else {
// the first line of the license file tells us which license it is
QFile file(licenseFile);
Expand All @@ -4241,7 +4257,8 @@ bool Configure::showLicense(QString orgLicenseFile)
<< endl;
if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
cout << "Type '3' to view the Lesser GNU General Public License version 3 (LGPLv3)." << endl;
cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
if (showLgpl2)
cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
} else {
cout << "Type '?' to view the " << theLicense << "." << endl;
}
Expand Down

0 comments on commit 538248d

Please sign in to comment.