Skip to content

Commit fe01611

Browse files
committed
Merge pull request #2 from uberspot/master
Add LOCAL_LDLIBS to Android.mk so that it compiles and fill in README.md
2 parents 89c7cb8 + ffd9ca4 commit fe01611

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

Android.mk

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ LOCAL_SRC_FILES := $(notdir $(wildcard $(LOCAL_PATH)/*.c))
1313

1414
LOCAL_SHARED_LIBRARIES := -llog
1515

16-
LOCAL_STATIC_LIBRARIES :=
16+
LOCAL_STATIC_LIBRARIES :=
1717

1818
LOCAL_LDFLAGS := -Wl,--version-script=$(LOCAL_PATH)/exports.txt
1919

20+
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
21+
2022
include $(BUILD_SHARED_LIBRARY)

README.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,26 @@ android-shmem
33

44
System V shared memory emulation on Android, using ashmem.
55
That includes shmget, shmat, shmdt and shmctl functions.
6-
It does not use Binder service, and does not link to Java libraries -
7-
it uses Linux sendmsg/recvmsg API to transfer file handlers.
6+
It does not use Binder service, and does not link to Java libraries.
7+
It uses Linux sendmsg/recvmsg API instead to transfer file handlers.
88

99
Before compiling it, run
10-
git submodule update --init libancillary
1110

12-
Also, you will need to add to your CFLAGS:
13-
-D_LINUX_IPC_H -Dipc_perm=debian_ipc_perm
11+
git submodule update --init libancillary
12+
13+
To use in Android add the android-shmem folder to your jni/ directory and add
14+
15+
LOCAL_SHARED_LIBRARIES += android-shmem
16+
17+
to any Android.mk module file using the android-shmem library.
18+
Add `include $(call all-subdir-makefiles)` to the jni/Android.mk
19+
so that it builds the android-shmem module unless you already specify that
20+
explicitly in some other way.
21+
22+
Also, you will need to add the following to your CFLAGS:
23+
24+
-D_LINUX_IPC_H -Dipc_perm=debian_ipc_perm
25+
1426
if you link to this library from Android code.
1527

1628
The most obvious reasons to use this lib is to speed up Linux GUI applications,
@@ -20,8 +32,9 @@ which can be downloaded here:
2032
https://sourceforge.net/projects/libsdl-android/files/apk/XServer-XSDL/
2133

2234
To use it inside Linux chroot installed on Android, do
23-
env LD_PRELOAD="/path/to/libandroid-shmem-gnueabihf.so" linux_command
2435

25-
The shared memory segments it creates will be automatically destoryed
36+
env LD_PRELOAD="/path/to/libandroid-shmem-gnueabihf.so" linux_command
37+
38+
The shared memory segments it creates will be automatically destroyed
2639
when an owner process destroys them or dies,
2740
however Xserver and it's clients do not depend on that functionality.

0 commit comments

Comments
 (0)