
I'm taking a page from Dolphin's book, and including copies of each dependency's source code. This combines the ease of use of including pre-built libraries instead of needing to navigate a package manager - as is (or was) the case for MSVC - with the portability of using packages. Granted, this method's more of a jack of all trades, master of none, since it's *less* user-friendly than prebuilt packages (compilation times), and you don't get the per-distro compatibility fixes you'd get from a package manager. You can still use system libs if you want. In fact, it's still the default behaviour: compiling the libs manually is just a fallback. I'll add an option to force-enable this soon, however, since it's a nicer way to produce static MSYS2 builds than the hackish nightmare that I was using before. Not to mention, having my own copy of the sources means I can provide my own fixes and tweaks your package manager may not. For example, I can combine MSYS2's FreeType subpixel rendering with vcpkg's fix for SDL2 exporting its symbols in static builds.
74 lines
1.6 KiB
Bash
Executable file
74 lines
1.6 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Build the Android libraries without needing a project
|
|
# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.)
|
|
#
|
|
# Usage: androidbuildlibs.sh [arg for ndk-build ...]"
|
|
#
|
|
# Useful NDK arguments:
|
|
#
|
|
# NDK_DEBUG=1 - build debug version
|
|
# NDK_LIBS_OUT=<dest> - specify alternate destination for installable
|
|
# modules.
|
|
#
|
|
# Note that SDLmain is not an installable module (.so) so libSDLmain.a
|
|
# can be found in $obj/local/<abi> along with the unstripped libSDL.so.
|
|
#
|
|
|
|
|
|
# Android.mk is in srcdir
|
|
srcdir=`dirname $0`/..
|
|
srcdir=`cd $srcdir && pwd`
|
|
cd $srcdir
|
|
|
|
|
|
#
|
|
# Create the build directories
|
|
#
|
|
|
|
build=build
|
|
buildandroid=$build/android
|
|
obj=
|
|
lib=
|
|
ndk_args=
|
|
|
|
# Allow an external caller to specify locations.
|
|
for arg in $*
|
|
do
|
|
if [ "${arg:0:8}" == "NDK_OUT=" ]; then
|
|
obj=${arg#NDK_OUT=}
|
|
elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then
|
|
lib=${arg#NDK_LIBS_OUT=}
|
|
else
|
|
ndk_args="$ndk_args $arg"
|
|
fi
|
|
done
|
|
|
|
if [ -z $obj ]; then
|
|
obj=$buildandroid/obj
|
|
fi
|
|
if [ -z $lib ]; then
|
|
lib=$buildandroid/lib
|
|
fi
|
|
|
|
for dir in $build $buildandroid $obj $lib; do
|
|
if test -d $dir; then
|
|
:
|
|
else
|
|
mkdir $dir || exit 1
|
|
fi
|
|
done
|
|
|
|
|
|
# APP_* variables set in the environment here will not be seen by the
|
|
# ndk-build makefile segments that use them, e.g., default-application.mk.
|
|
# For consistency, pass all values on the command line.
|
|
ndk-build \
|
|
NDK_PROJECT_PATH=null \
|
|
NDK_OUT=$obj \
|
|
NDK_LIBS_OUT=$lib \
|
|
APP_BUILD_SCRIPT=Android.mk \
|
|
APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \
|
|
APP_PLATFORM=android-14 \
|
|
APP_MODULES="SDL2 SDL2_main" \
|
|
$ndk_args
|