Skip to content

Commit f91db81

Browse files
xingskycnxingskycn
authored andcommitted
add 13.md
1 parent d0dbc22 commit f91db81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+72496
-0
lines changed

13.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 包装第三方库
2+
3+
1,创建一个扩展
4+
5+
./ext_skel --extname=libs
6+
7+
2,配置(config.m4)
8+
9+
SEARCH_PATH="/usr/local /usr" #lib搜索的目录
10+
SEARCH_FOR="/include/curl/curl.h" #lib头文件的路径
11+
if test -r $PHP_LIBS/$SEARCH_FOR; then
12+
LIBS_DIR=$PHP_LIBS
13+
else # search default path list
14+
AC_MSG_CHECKING([for libs files in default path])
15+
for i in $SEARCH_PATH ; do
16+
if test -r $i/$SEARCH_FOR; then
17+
LIBS_DIR=$i #搜索到的lib的路径
18+
AC_MSG_RESULT(found in $i)
19+
fi
20+
done
21+
fi
22+
23+
/*验证lib是否存在*/
24+
if test -z "$LIBS_DIR"; then
25+
AC_MSG_RESULT([not found])
26+
AC_MSG_ERROR([Please reinstall the libs distribution])
27+
fi
28+
29+
30+
/*编译的时候添加lib的include目录, -I/usr/include*/
31+
PHP_ADD_INCLUDE($LIBS_DIR/include)
32+
33+
LIBNAME=curl #lib名称
34+
LIBSYMBOL=curl_version #lib的一个函数,用来PHP_CHECK_LIBRARY验证lib
35+
36+
/*验证lib*/
37+
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
38+
[
39+
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $LIBS_DIR/$PHP_LIBDIR, LIBS_SHARED_LIBADD) #编译的时候链接lib, -llibcurl
40+
AC_DEFINE(HAVE_LIBSLIB,1,[ ])
41+
],[
42+
AC_MSG_ERROR([wrong libs lib version or lib not found])
43+
],[
44+
-L$LIBS_DIR/$PHP_LIBDIR -lm
45+
])
46+
47+
48+
PHP_SUBST(LIBS_SHARED_LIBADD)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
[12,资源](https://github.com/Leon2012/php-ext/blob/master/12.md)
2828

29+
[13,包装第三方库](https://github.com/Leon2012/php-ext/blob/master/13.md)
2930

3031
#### 附录
3132

codes/libs/.deps

Whitespace-only changes.

codes/libs/.libs/libs.la

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../libs.la

codes/libs/.libs/libs.lai

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# libs.la - a libtool library file
2+
# Generated by ltmain.sh - GNU libtool 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)
3+
#
4+
# Please DO NOT delete this file!
5+
# It is necessary for linking the library.
6+
7+
# The name that we can dlopen(3).
8+
dlname='libs.so'
9+
10+
# Names of this library.
11+
library_names='libs.so libs.so libs.so'
12+
13+
# The name of the static archive.
14+
old_library=''
15+
16+
# Libraries that this one depends upon.
17+
dependency_libs=' -lcurl'
18+
19+
# Version information for libs.
20+
current=0
21+
age=0
22+
revision=0
23+
24+
# Is this an already installed library?
25+
installed=yes
26+
27+
# Should we warn about portability when linking against -modules?
28+
shouldnotlink=yes
29+
30+
# Files to dlopen/dlpreopen
31+
dlopen=''
32+
dlpreopen=''
33+
34+
# Directory that this library needs to be installed in:
35+
libdir='/Users/kentchen/GitHub/php/php-5.5.20/ext/libs/modules'

codes/libs/.libs/libs.o

20.9 KB
Binary file not shown.

codes/libs/.libs/libs.so

9.05 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>com.apple.xcode.dsym.libs.so</string>
9+
<key>CFBundleInfoDictionaryVersion</key>
10+
<string>6.0</string>
11+
<key>CFBundlePackageType</key>
12+
<string>dSYM</string>
13+
<key>CFBundleSignature</key>
14+
<string>????</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
</dict>
20+
</plist>
27.3 KB
Binary file not shown.

codes/libs/.svnignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.deps
2+
*.lo
3+
*.la

0 commit comments

Comments
 (0)