Skip to content

Commit 693fe9b

Browse files
committed
新增:加入去除编译so库版本号的补丁
更新:文档更新
1 parent c0b3235 commit 693fe9b

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

CMakeLists.txt.patch

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- CMakeLists.txt 2017-10-28 15:47:37.000000000 +0800
2+
+++ ../CMakeLists.txt 2017-10-28 15:41:29.000000000 +0800
3+
@@ -834,13 +834,13 @@
4+
5+
# Set the so version of the lib.
6+
# Equivalent to LDFLAGS=-version-info x:x:x
7+
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_C_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
8+
- foreach(lib ${LWS_LIBRARIES})
9+
- set_target_properties(${lib}
10+
- PROPERTIES
11+
- SOVERSION ${SOVERSION})
12+
- endforeach()
13+
-endif()
14+
+# if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_C_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
15+
+# foreach(lib ${LWS_LIBRARIES})
16+
+# set_target_properties(${lib}
17+
+# PROPERTIES
18+
+# SOVERSION ${SOVERSION})
19+
+# endforeach()
20+
+# endif()
21+
22+
set(LIB_LIST)
23+

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
1-
# libwebsockets-android
1+
# build libwebsockets for android
22

3-
使用NDK将libwebsockets编译到android上的脚本,目前默认编译架构为arm64
3+
编译libwebsockets到Android平台上,arm或者arm64架构
44

55
## 编译环境
66

7-
* Ubuntu14.04 64位
8-
7+
* Ubuntu16.04 64位
98
* android-ndk-r13b
9+
* libwebsockets v2.3.0
1010

1111
## 编译步骤
1212

13-
1. 修改编译脚本,指定ndk所在路径。
13+
* 修改**build.sh**设定NDK路径,默认为
14+
15+
```shell
16+
export NDK=/opt/android-ndk
17+
```
18+
19+
* 执行**build.sh**脚本,根据提示选择编译架构
20+
21+
```shell
22+
bash build.sh
23+
```
24+
* 编译后头文件位于 **$ARCH/include**, 静态库位于 **$ARCH/lib**
1425

15-
1. 按照编号执行编译脚本。
26+
## 注意事项
1627

17-
sh 01-download.sh
18-
sh 02-prebuild.sh
19-
sh 03-build.sh
28+
* Android平台不支持带版本号的so库,需要改动CMakeLists.txt,脚本通过补丁方式修改原始CMakeLists.txt
2029

21-
## Docker镜像
30+
## 辅助工程
2231

23-
TODO……
32+
* [zlib for android](https://github.com/alvisisme/android-zlib)
33+
* [openssl for android](https://github.com/alvisisme/android-openssl)
34+
* [libuv for android](https://github.com/alvisisme/android-libuv)

build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ export NDK=/opt/android-ndk
77

88
[ ! -d libwebsockets ] && {
99
git clone https://github.com/warmcat/libwebsockets.git
10-
cd libwebsockets && git checkout -b v2.3.0 v2.3.0 && cd ..
10+
cd libwebsockets
11+
git checkout -b v2.3.0 v2.3.0
12+
patch -p0 <../CMakeLists.txt.patch
13+
cd ..
1114
}
1215

1316

0 commit comments

Comments
 (0)