Skip to content

Commit 4ab5c49

Browse files
DubbleClickmhpcc
authored andcommitted
unfinished: enable ldap
1 parent 2d74977 commit 4ab5c49

File tree

9 files changed

+82
-8
lines changed

9 files changed

+82
-8
lines changed

config/ext.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@
153153
},
154154
"ldap": {
155155
"type": "builtin",
156-
"arg-type": "with",
156+
"arg-type": "with-prefix",
157157
"lib-depends": [
158+
"openssl",
158159
"ldap"
159160
]
160161
},

config/lib.json

+7
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@
139139
"libxml2"
140140
]
141141
},
142+
"ldap": {
143+
"source": "ldap",
144+
"static-libs-unix": [
145+
"liblber.a",
146+
"libldap.a"
147+
]
148+
},
142149
"libavif": {
143150
"source": "libavif",
144151
"static-libs-unix": [

config/source.json

+9
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@
4242
"path": "COPYING"
4343
}
4444
},
45+
"ldap": {
46+
"type": "filelist",
47+
"url": "https://www.openldap.org/software/download/OpenLDAP/openldap-release/",
48+
"regex": "/href=\"(?<file>openldap-(?<version>[^\"]+)\\.tgz)\"/",
49+
"license": {
50+
"type": "file",
51+
"path": "LICENSE"
52+
}
53+
},
4554
"ext-event": {
4655
"type": "url",
4756
"url": "https://bitbucket.org/osmanov/pecl-event/get/3.0.8.tar.gz",
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\linux\library;
6+
7+
class ldap extends LinuxLibraryBase
8+
{
9+
use \SPC\builder\unix\library\ldap;
10+
11+
public const NAME = 'ldap';
12+
}

src/SPC/builder/unix/library/curl.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ protected function build(): void
3939
} else {
4040
$extra .= '-DUSE_NGHTTP2=OFF ';
4141
}
42-
// TODO: ldap is not supported yet
43-
$extra .= '-DCURL_DISABLE_LDAP=ON ';
42+
// lib:ldap
43+
$extra .= $this->builder->getLib('ldap') ? '-DCURL_DISABLE_LDAP=OFF ' : '-DCURL_DISABLE_LDAP=ON ';
4444
// lib:zstd
4545
$extra .= $this->builder->getLib('zstd') ? '-DCURL_ZSTD=ON ' : '-DCURL_ZSTD=OFF ';
4646
// lib:idn2

src/SPC/builder/unix/library/ldap.php

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\unix\library;
6+
7+
trait ldap
8+
{
9+
protected function build(): void
10+
{
11+
$openssl_include = BUILD_INCLUDE_PATH;
12+
$openssl_lib = BUILD_LIB_PATH;
13+
shell()->cd($this->source_dir)
14+
->exec(
15+
'CC="musl-gcc -I' . $openssl_include . ' -L' . $openssl_lib . '" LDFLAGS="-static" ./configure ' .
16+
'--enable-static=yes ' .
17+
'--disable-shared ' .
18+
'--disable-slapd ' .
19+
'--without-systemd ' .
20+
'--with-tls=openssl ' .
21+
'--prefix=' . BUILD_ROOT_PATH
22+
)
23+
->exec('make clean')
24+
->exec('make depend')
25+
->exec("make -j{$this->builder->concurrency}")
26+
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
27+
$this->patchPkgconfPrefix(['libldap.pc', 'liblber.pc']);
28+
}
29+
}

src/SPC/builder/unix/library/postgresql.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,14 @@ protected function build(): void
5757
'--with-ssl=openssl ' .
5858
'--with-readline ' .
5959
'--with-libxml ' .
60+
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
6061
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
61-
'--without-ldap ' .
6262
'--without-libxslt ' .
6363
'--without-lz4 ' .
6464
'--without-zstd ' .
6565
'--without-perl ' .
6666
'--without-python ' .
6767
'--without-pam ' .
68-
'--without-ldap ' .
6968
'--without-bonjour ' .
7069
'--without-tcl '
7170
);

src/SPC/doctor/item/LinuxMuslCheck.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,18 @@ public function checkMusl(): ?CheckResult
3636
#[AsFixItem('fix-musl')]
3737
public function fixMusl(array $distro): bool
3838
{
39+
$rhel_install = 'dnf install tar wget git zip bison flex bzip2 cmake patch && \
40+
wget https://musl.libc.org/releases/musl-1.2.4.tar.gz && tar -zxvf musl-1.2.4.tar.gz && \
41+
rm -f musl-1.2.4.tar.gz && cd musl-1.2.4 &&
42+
if [[ ! "$PATH" =~ (^|:)"/usr/local/musl/bin"(:|$) ]]; then export PATH="/usr/local/musl/bin:$PATH"
43+
fi && \
44+
./configure --disable-shared --enable-wrapper=gcc && \
45+
make -j && make install && cd ..';
3946
$install_cmd = match ($distro['dist']) {
4047
'ubuntu', 'debian' => 'apt-get install musl musl-tools -y',
4148
'alpine' => 'apk add musl musl-utils musl-dev',
42-
'rhel' => 'dnf install tar wget git zip bison flex bzip2 cmake patch && wget https://musl.libc.org/releases/musl-1.2.4.tar.gz && tar -zxvf musl-1.2.4.tar.gz && rm musl-1.2.4.tar.gz && cd musl-1.2.4 && ./configure && make -j && make install && cd ..',
43-
'almalinux' => 'dnf install bison flex bzip2 cmake patch && wget https://musl.libc.org/releases/musl-1.2.4.tar.gz && tar -zxvf musl-1.2.4.tar.gz && rm musl-1.2.4.tar.gz && cd musl-1.2.4 && ./configure && make -j && make install && export PATH="/usr/local/musl/bin:$PATH" cd ..',
49+
'rhel' => $rhel_install,
50+
'almalinux' => $rhel_install,
4451
default => throw new RuntimeException('Current linux distro does not have an auto-install script for musl packages yet.'),
4552
};
4653
$prefix = '';

src/SPC/doctor/item/LinuxToolCheckList.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,21 @@ class LinuxToolCheckList
2424
];
2525

2626
public const TOOLS_DEBIAN = [
27-
'perl', 'make', 'bison', 'flex',
27+
'make', 'bison', 'flex',
2828
'git', 'autoconf', 'automake',
2929
'tar', 'unzip', 'gzip',
3030
'bzip2', 'cmake', 'patch',
3131
'xz',
3232
];
3333

34+
public const TOOLS_RHEL = [
35+
'perl', 'make', 'bison', 'flex',
36+
'git', 'autoconf', 'automake',
37+
'tar', 'unzip', 'gzip', 'gcc',
38+
'bzip2', 'cmake', 'patch',
39+
'xz',
40+
];
41+
3442
/** @noinspection PhpUnused */
3543
#[AsCheckItem('if necessary tools are installed', limit_os: 'Linux')]
3644
public function checkCliTools(): ?CheckResult
@@ -39,6 +47,8 @@ public function checkCliTools(): ?CheckResult
3947

4048
$required = match ($distro['dist']) {
4149
'alpine' => self::TOOLS_ALPINE,
50+
'almalinux' => self::TOOLS_RHEL,
51+
'rhel' => self::TOOLS_RHEL,
4252
default => self::TOOLS_DEBIAN,
4353
};
4454
$missing = [];

0 commit comments

Comments
 (0)