forked from swoole/swoole-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
socat.php
47 lines (43 loc) · 1.68 KB
/
socat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
use SwooleCli\Library;
use SwooleCli\Preprocessor;
return function (Preprocessor $p) {
// https://github.com/aledbf/socat-static-binary/blob/master/build.sh
$socat_prefix = SOCAT_PREFIX;
$openssl_prefix = OPENSSL_PREFIX;
$cflags = $p->getOsType() == 'macos' ? "" : '-static';
$p->addLibrary(
(new Library('socat'))
->withHomePage('http://www.dest-unreach.org/socat/')
->withLicense('http://www.dest-unreach.org/socat/doc/README', Library::LICENSE_GPL)
//->withUrl('http://www.dest-unreach.org/socat/download/socat-1.7.4.4.tar.gz')
->withFile('socat-1.8.0.0.tar.gz')
->withDownloadScript(
'socat',
<<<EOF
git clone -b tag-1.8.0.0 https://repo.or.cz/socat.git
EOF
)
->withBuildScript(
<<<EOF
libtoolize -ci
autoreconf -fi
pkg-config --cflags --static readline
pkg-config --libs --static readline
./configure --help ;
PACKAGES='openssl readline'
CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES)" \
LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES)" \
LIBS="$(pkg-config --libs-only-l --static \$PACKAGES)" \
CFLAGS="{$cflags} -O2 -Wall -fPIC -DWITH_OPENSSL" \
./configure \
--prefix={$socat_prefix} \
--enable-readline \
--enable-openssl-base={$openssl_prefix}
make -j {$p->maxJob}
EOF
)
->withBinPath($socat_prefix . '/bin/')
->withDependentLibraries('openssl', 'readline')
);
};