We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2839 - No way to create pre-built libraries for Android
Summary: No way to create pre-built libraries for Android
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: 2.0.3
Hardware: x86_64 Other
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-09 06:34 UTC by Mark Callow
Modified: 2017-08-14 01:00 UTC (History)
1 user (show)

See Also:


Attachments
Script to build android version of SDL2. (1.62 KB, application/x-shellscript)
2015-01-09 06:34 UTC, Mark Callow
Details
Patch to Android.mk adding SDL2_main module (712 bytes, text/plain)
2015-01-09 06:35 UTC, Mark Callow
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Callow 2015-01-09 06:34:05 UTC
Created attachment 1985 [details]
Script to build android version of SDL2.

This is really an RFE but there is no way set that in this bugzilla.

README-android says to copy or link the SDL source tree to the jni folder in your Android project. It is not desirable to have to compile SDL with every application; furthermore the Android NDK has support for prebuilt libraries.

Attached is script (to be put in build-scripts) that builds the Android version of the libraries. The script builds both the existing SDL2 module and a new SDL2_main module. This is a static library containing the code from src/main/android/SDL_android_main.c. Also attached is a patch for Android.mk adding this module.

Note that when building an application's native .so using this prebuilt libSDL2main, you must use a link option, such as --whole-archive, that forces inclusion of the code in the .so because the functions in SDL_android_main are called only from Java.
Comment 1 Mark Callow 2015-01-09 06:35:04 UTC
Created attachment 1986 [details]
Patch to Android.mk adding SDL2_main module
Comment 2 Mark Callow 2015-01-09 06:39:44 UTC
P.S. The addition of SDL2_main to Android.mk won't affect any existing users because the Android build system defaults to building only the loadable (shared library) modules it finds in the .mk files. To build the new module, it must be explicitly specified to the build system, something the new script does.
Comment 3 Sam Lantinga 2017-08-14 01:00:18 UTC
This has been added, thanks!
https://hg.libsdl.org/SDL/rev/8e5441ab6c63