Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

fix build on darwin and r19b #43

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dependencies instructions
- [Apache ant](http://ant.apache.org/bindownload.cgi) v1.8 or later
- [Qt5 for android >= 5.11] Install ARMv7 arch support. Also read the [upstream Qt information on building Qt5 code for Android](http://doc.qt.io/qt-5/androidgs.html)
- Android SDK ([Download from developer.android.com](https://developer.android.com/studio/index.html#downloads) just command line tools, API 15)
- Android NDK ([Android NDK r19](https://developer.android.com/ndk/downloads)
- Android NDK ([Android NDK r19+](https://developer.android.com/ndk/downloads)

[Here](http://doc.qt.io/qt-5/androidgs.html) are more information on building QT5 code for android

Expand All @@ -31,6 +31,15 @@ cp config.conf.default config.conf
./distribute.sh -dqgis -mqgis
```

NDK-r19b
--------
To be able to build with r19b, override the toolchain file in the NDK
```
sudo mv /opt/android-ndk-r19b/build/cmake/android.toolchain.cmake /opt/android-ndk-r19b/build/cmake/android.toolchain.cmake.old
sudo cp OSGeo4A/tools/android.toolchain.cmake.r19b /opt/android-ndk-r19b/build/cmake/android.toolchain.cmake
```
for details, see [issue 41](https://github.com/opengisch/OSGeo4A/issues/41)

MacOS Specific instructions
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion config.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export QT_ANDROID_BASE="/path/to/qt/sdk/Qt/5.11.2"

# For example:
# export ANDROIDSDK="/opt/android/sdk"
# export ANDROIDNDK="/opt/android-ndk-r19/"
# export ANDROIDNDK="/opt/android-ndk-r19b/"
# export QT_ANDROID_BASE="/opt/Qt/5.11.2"

# QGIS needs a bison 3. On MacOS you may need
Expand Down
5 changes: 4 additions & 1 deletion distribute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function push_arm() {
export OLD_STRIP=$STRIP
export OLD_MAKE=$MAKE
export OLD_LD=$LD
export OLD_CMAKECMD=$CMAKECMD

# to override the default optimization, set OFLAG
#export OFLAG="-Os"
Expand Down Expand Up @@ -254,7 +255,7 @@ function push_arm() {
export CXXFLAGS="$CFLAGS"
export CPPFLAGS="$CFLAGS"

export LDFLAGS="-lm -L$STAGE_PATH/lib -L$ANDROIDNDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/$ANDROIDAPI"
export LDFLAGS="-lm -L$STAGE_PATH/lib -L$ANDROIDNDK/toolchains/llvm/prebuilt/$PYPLATFORM-x86_64/sysroot/usr/lib/arm-linux-androideabi/$ANDROIDAPI"

export PATH="$ANDROIDNDK/toolchains/llvm/prebuilt/$PYPLATFORM-x86_64/bin/:$ANDROIDSDK/tools:$ANDROIDNDK:$QT_ANDROID/bin:$PATH"

Expand All @@ -278,6 +279,7 @@ function push_arm() {
export MAKESMP="make -j$CORES"
export MAKE="make"
export READELF="$TOOLCHAIN_SHORT_PREFIX-readelf"
export CMAKECMD="cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH:PATH=$ANDROID_NDK;$QT_ANDROID;$BUILD_PATH;$STAGE_PATH -DANDROID_ABI=$ARCH -DANDROID_NDK=$ANDROID_NDK -DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI -DANDROID=ON"

# export environment for Qt
export ANDROID_NDK_ROOT=$ANDROIDNDK
Expand Down Expand Up @@ -308,6 +310,7 @@ function pop_arm() {
export RANLIB=$OLD_RANLIB
export STRIP=$OLD_STRIP
export MAKE=$OLD_MAKE
export CMAKECMD=$OLD_CMAKECMD
}

function usage() {
Expand Down
9 changes: 2 additions & 7 deletions recipes/exiv2/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function prebuild_exiv2() {

function shouldbuild_exiv2() {
# If lib is newer than the sourcecode skip build
if [ $BUILD_PATH/exiv2/build-$ARCH/exiv2/exiv2.so -nt $BUILD_exiv2/.patched ]; then
if [ $STAGE_PATH/lib/libexiv2.so -nt $BUILD_exiv2/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -45,16 +45,11 @@ function build_exiv2() {
try mkdir -p $BUILD_PATH/exiv2/build-$ARCH
try cd $BUILD_PATH/exiv2/build-$ARCH
push_arm
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DEXIV2_ENABLE_NLS=OFF \
-DICONV_INCLUDE_DIR=$STAGE_PATH/include \
-DICONV_LIBRARY=$STAGE_PATH/lib/libiconv.so \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID=ON \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
$BUILD_exiv2
try $MAKESMP
try $MAKESMP install
Expand Down
5 changes: 3 additions & 2 deletions recipes/gdal/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ function build_gdal() {
try cd $BUILD_PATH/gdal/build-$ARCH

push_arm
try ${BUILD_PATH}/gdal/build-$ARCH/configure \

try ${BUILD_PATH}/gdal/build-$ARCH/configure \
--host=$TOOLCHAIN_PREFIX \
--build=x86_64 \
--prefix=$STAGE_PATH \
Expand All @@ -58,7 +59,7 @@ function build_gdal() {
--with-pg=no \
--with-expat=$STAGE_PATH
try $MAKESMP
try make install &> install.log
try $MAKESMP install &> install.log
pop_arm
}

Expand Down
7 changes: 1 addition & 6 deletions recipes/geos/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,8 @@ function build_geos() {
try cd $BUILD_PATH/geos/build-$ARCH
push_arm
# -DANDROID_STL=gnustl_shared \
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID=ON \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
$BUILD_geos
echo '#define GEOS_SVN_REVISION 0' > $BUILD_PATH/geos/build-$ARCH/geos_svn_revision.h
try $MAKESMP
Expand Down
9 changes: 2 additions & 7 deletions recipes/libspatialindex/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function prebuild_libspatialindex() {

function shouldbuild_libspatialindex() {
# If lib is newer than the sourcecode skip build
if [ $BUILD_PATH/libspatialindex/build-$ARCH/.libs/libspatialindex.so -nt $BUILD_libspatialindex/.patched ]; then
if [ $STAGE_PATH/lib/libspatialindex.so -nt $BUILD_libspatialindex/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -47,13 +47,8 @@ function build_libspatialindex() {

push_arm

try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID=ON \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
$BUILD_libspatialindex

try $MAKESMP
Expand Down
6 changes: 1 addition & 5 deletions recipes/libtiff/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@ function build_libtiff() {
try mkdir -p $BUILD_PATH/libtiff/build-$ARCH
try cd $BUILD_PATH/libtiff/build-$ARCH
push_arm
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
try $CMAKECMD \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
$BUILD_libtiff
try $MAKESMP install
pop_arm
Expand Down
8 changes: 5 additions & 3 deletions recipes/openssl/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function prebuild_openssl() {

function shouldbuild_openssl() {
# If lib is newer than the sourcecode skip build
if [ $STAGE_PATH/liblibssl.so -nt $BUILD_PATH/openssl/openssl-${VERSION_openssl}/.patched ]; then
if [ $STAGE_PATH/lib/libssl.so -nt $BUILD_PATH/openssl/openssl-${VERSION_openssl}/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -52,12 +52,14 @@ function build_openssl() {
try $BUILD_openssl/config \
shared \
no-asm \
no-makedepend \
--prefix=$STAGE_PATH \
-D__ANDROID_API__=$ANDROIDAPI
try make SHLIB_EXT=".so" CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" MAKE="make -e" all

try $MAKESMP SHLIB_EXT=".so" CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" MAKE="make -e" all
mkdir -p $STAGE_PATH/lib
echo "place-holder make target for avoiding symlinks" >> $STAGE_PATH/lib/link-shared
try make SHLIB_EXT=.so install_sw &> install.log
try $MAKESMP SHLIB_EXT=.so install &> install.log
rm $STAGE_PATH/lib/link-shared

pop_arm
Expand Down
9 changes: 2 additions & 7 deletions recipes/proj/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function prebuild_proj() {

function shouldbuild_proj() {
# If lib is newer than the sourcecode skip build
if [ $BUILD_PATH/proj/build-$ARCH/src/.libs/libproj.so -nt $BUILD_proj/.patched ]; then
if [ $STAGE_PATH/lib/libproj.so -nt $BUILD_proj/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -51,13 +51,8 @@ function build_proj() {
# --prefix=$STAGE_PATH \
# --host=$TOOLCHAIN_PREFIX \
# --build=x86_64
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID=ON \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
-DPROJ_TESTS=OFF \
-DEXE_SQLITE3=$(which sqlite3) \
$BUILD_proj
Expand Down
7 changes: 1 addition & 6 deletions recipes/qca/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,7 @@ function build_qca() {
push_arm

# configure
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
try $CMAKECMD \
-DQT4_BUILD=OFF \
-DQCA_SUFFIX=qt5 \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
Expand Down
4 changes: 1 addition & 3 deletions recipes/qfield/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ function build_qfield() {
try cd $BUILD_PATH/qfield/build
push_arm
CMAKE_INCLUDE_PATH=$STAGE_PATH/include \
try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ROOT_PATH/tools/android.toolchain.cmake \
try $CMAKECMD \
-DANDROID_STL=gnustl_shared \
-DQGIS_ANALYSIS_LIBRARY:FILEPATH=$STAGE_PATH/lib/libqgis_analysis.so \
-DQGIS_CORE_LIBRARY:FILEPATH=$STAGE_PATH/lib/libqgis_core.so\
Expand All @@ -46,7 +45,6 @@ function build_qfield() {
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DLIBRARY_OUTPUT_PATH_ROOT:PATH=$STAGE_PATH \
-DENABLE_TESTS:BOOL=FALSE \
-DANDROID_NATIVE_API_LEVEL=19 \
-DGIT_EXECUTABLE=`which git` \
$BUILD_qfield
try $MAKESMP
Expand Down
7 changes: 1 addition & 6 deletions recipes/qgis/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ function build_qgis() {

push_arm

try cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DCMAKE_DISABLE_FIND_PACKAGE_HDF5=TRUE \
-DWITH_DESKTOP=OFF \
-DWITH_ANALYSIS=OFF \
Expand Down Expand Up @@ -84,9 +82,6 @@ function build_qgis() {
-DWITH_ASTYLE=OFF \
-DWITH_QUICK=ON \
-DWITH_QT5SERIALPORT=OFF \
-DANDROID_NDK=$ANDROIDNDK \
-DANDROID_ABI=$ARCH \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
$BUILD_qgis

try $MAKESMP install
Expand Down
7 changes: 1 addition & 6 deletions recipes/qtkeychain/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ function build_qtkeychain() {
push_arm

# configure
try cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
try $CMAKECMD \
-DQT4_BUILD=OFF \
-DQCA_SUFFIX=qt5 \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
Expand Down
9 changes: 2 additions & 7 deletions recipes/zlib/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function prebuild_zlib() {

function shouldbuild_zlib() {
# If lib is newer than the sourcecode skip build
if [ $BUILD_PATH/zlib/build-$ARCH/.libs/libzlib.so -nt $BUILD_zlib/.patched ]; then
if [ $STAGE_PATH/lib/libz.so -nt $BUILD_zlib/.patched ]; then
DO_BUILD=0
fi
}
Expand All @@ -47,13 +47,8 @@ function build_zlib() {

push_arm

try cmake \
-DCMAKE_TOOLCHAIN_FILE=$ANDROIDNDK/build/cmake/android.toolchain.cmake \
try $CMAKECMD \
-DCMAKE_INSTALL_PREFIX:PATH=$STAGE_PATH \
-DANDROID=ON \
-DANDROID_ABI=$ARCH \
-DANDROID_NDK=$ANDROID_NDK \
-DANDROID_NATIVE_API_LEVEL=$ANDROIDAPI \
$BUILD_zlib
try $MAKESMP install

Expand Down
2 changes: 1 addition & 1 deletion src/apk/project.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
target=android-16
target=android-21
Loading