mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-14 09:48:01 +08:00
Added Android makefile
This commit is contained in:
parent
7409166409
commit
3b242ec68b
@ -453,25 +453,11 @@ as well, please comment or drop an email in the mailing list.
|
||||
Note : You dont need root access to run mongoose on Android.
|
||||
|
||||
- Download the source from the Downloads page.
|
||||
- Download the Android NDK from
|
||||
[here](http://developer.android.com/tools/sdk/ndk/index.html)
|
||||
- Make a folder (e.g. mongoose) and inside that make a folder named "jni".
|
||||
- Add `mongoose.h`, `mongoose.c` and `main.c` from the source to the jni folder.
|
||||
- Make a new file in the jni folder named "Android.mk".
|
||||
This is the make file for ndk-build.
|
||||
|
||||
Android.mk:
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := mongoose
|
||||
LOCAL_SRC_FILES := main.c mongoose.c
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
||||
- Run `./ndk-build -C /path/to/mongoose/`.
|
||||
This should generate mongoose/lib/armeabi/mongoose
|
||||
- Using the adb tool, push the generated mongoose binary to `/data/local`
|
||||
folder on device.
|
||||
- Download the Android NDK from [http://developer.android.com/tools/sdk/ndk/index.html](http://developer.android.com/tools/sdk/ndk/index.html)
|
||||
- Run `/path-to-ndk/ndk-build -C /path-to-mongoose/build`
|
||||
That should generate mongoose/lib/armeabi/mongoose
|
||||
- Using the adb tool (you need to have Android SDK installed for that),
|
||||
push the generated mongoose binary to `/data/local` folder on device.
|
||||
- From adb shell, navigate to `/data/local` and execute `./mongoose`.
|
||||
- To test if the server is running fine, visit your web-browser and
|
||||
navigate to `http://127.0.0.1:8080` You should see the `Index of /` page.
|
||||
@ -480,10 +466,10 @@ Android.mk:
|
||||
|
||||
|
||||
Notes:
|
||||
- jni stands for Java Native Interface. Read up on Android NDK if you want
|
||||
|
||||
- `jni` stands for Java Native Interface. Read up on Android NDK if you want
|
||||
to know how to interact with the native C functions of mongoose in Android
|
||||
Java applications.
|
||||
- Download android-sdk for the adb tool.
|
||||
- TODO: A Java application that interacts with the native binary or a
|
||||
shared library.
|
||||
|
||||
|
6
build/jni/Android.mk
Normal file
6
build/jni/Android.mk
Normal file
@ -0,0 +1,6 @@
|
||||
LOCAL_PATH := $(call my-dir)/../..
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_CFLAGS := -std=c99 -O2 -W -Wall -pthread -pipe $(COPT)
|
||||
LOCAL_MODULE := mongoose
|
||||
LOCAL_SRC_FILES := main.c mongoose.c
|
||||
include $(BUILD_EXECUTABLE)
|
Loading…
x
Reference in New Issue
Block a user