mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
separate linux and macos patches
This commit is contained in:
parent
347da67b71
commit
5fdeb33031
@ -6,7 +6,6 @@ namespace SPC\builder\linux\library;
|
|||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\store\SourcePatcher;
|
use SPC\store\SourcePatcher;
|
||||||
|
|
||||||
@ -16,31 +15,28 @@ class imap extends LinuxLibraryBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
*/
|
||||||
public function patchBeforeBuild(): bool
|
public function patchBeforeBuild(): bool
|
||||||
{
|
{
|
||||||
$cc = getenv('CC') ?: 'gcc';
|
$cc = getenv('CC') ?: 'gcc';
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', '');
|
// FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', '');
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}");
|
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}");
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto');
|
/* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto');
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz');
|
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz');
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
$this->source_dir . '/src/osdep/unix/ssl_unix.c',
|
$this->source_dir . '/src/osdep/unix/ssl_unix.c',
|
||||||
"#include <x509v3.h>\n#include <ssl.h>",
|
"#include <x509v3.h>\n#include <ssl.h>",
|
||||||
"#include <ssl.h>\n#include <x509v3.h>"
|
"#include <ssl.h>\n#include <x509v3.h>"
|
||||||
);
|
);
|
||||||
SourcePatcher::patchFile('1007_openssl1.1_autoverify.patch', $this->source_dir);
|
// SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir);
|
||||||
SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir);
|
SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH);
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH);
|
||||||
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH);
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws WrongUsageException
|
|
||||||
*/
|
*/
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
|
|||||||
66
src/SPC/builder/macos/library/imap.php
Normal file
66
src/SPC/builder/macos/library/imap.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\store\SourcePatcher;
|
||||||
|
|
||||||
|
class imap extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'imap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function patchBeforeBuild(): bool
|
||||||
|
{
|
||||||
|
$cc = getenv('CC') ?: 'clang';
|
||||||
|
SourcePatcher::patchFile('0001_imap_macos.patch', $this->source_dir);
|
||||||
|
// FileSystem::replaceFileStr($this->source_dir . '/Makefile', '-DMAC_OSX_KLUDGE=1', '');
|
||||||
|
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', 'CC=cc', "CC={$cc}");
|
||||||
|
/* FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto -lz', '-lcrypto');
|
||||||
|
FileSystem::replaceFileStr($this->source_dir . '/src/osdep/unix/Makefile', '-lcrypto', '-lcrypto -lz');
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/src/osdep/unix/ssl_unix.c',
|
||||||
|
"#include <x509v3.h>\n#include <ssl.h>",
|
||||||
|
"#include <ssl.h>\n#include <x509v3.h>"
|
||||||
|
);
|
||||||
|
// SourcePatcher::patchFile('1006_openssl1.1_autoverify.patch', $this->source_dir);
|
||||||
|
SourcePatcher::patchFile('2014_openssl1.1.1_sni.patch', $this->source_dir); */
|
||||||
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLINCLUDE=/usr/include/openssl', 'SSLINCLUDE=' . BUILD_INCLUDE_PATH);
|
||||||
|
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'SSLLIB=/usr/lib', 'SSLLIB=' . BUILD_LIB_PATH);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
if ($this->builder->getLib('openssl')) {
|
||||||
|
$ssl_options = 'SPECIALAUTHENTICATORS=ssl SSLTYPE=unix.nopwd SSLINCLUDE=' . BUILD_INCLUDE_PATH . ' SSLLIB=' . BUILD_LIB_PATH;
|
||||||
|
} else {
|
||||||
|
$ssl_options = 'SSLTYPE=none';
|
||||||
|
}
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec('make clean')
|
||||||
|
->exec('touch ip6')
|
||||||
|
->exec(
|
||||||
|
"yes | EXTRACFLAGS='-Wimplicit-function-declaration -include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h' make osx {$ssl_options}"
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
shell()
|
||||||
|
->exec("cp -rf {$this->source_dir}/c-client/c-client.a " . BUILD_LIB_PATH . '/libc-client.a')
|
||||||
|
->exec("cp -rf {$this->source_dir}/c-client/*.c " . BUILD_LIB_PATH . '/')
|
||||||
|
->exec("cp -rf {$this->source_dir}/c-client/*.h " . BUILD_INCLUDE_PATH . '/')
|
||||||
|
->exec("cp -rf {$this->source_dir}/src/osdep/unix/*.h " . BUILD_INCLUDE_PATH . '/');
|
||||||
|
} catch (\Throwable) {
|
||||||
|
// last command throws an exception, no idea why since it works
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user