Add support for libargon2

This commit is contained in:
Marcel Pociot 2023-05-31 10:03:40 +02:00
parent 09ba11affb
commit 4537bfb247
5 changed files with 59 additions and 0 deletions

View File

@ -295,6 +295,13 @@
"libsodium"
]
},
"password-argon2": {
"type": "builtin",
"arg-type": "with-prefix",
"lib-depends": [
"libargon2"
]
},
"sqlite3": {
"type": "builtin",
"arg-type": "with-prefix",

View File

@ -460,5 +460,11 @@
"static-libs-unix": [
"libsodium.a"
]
},
"libargon2": {
"source": "libargon2",
"static-libs-unix": [
"libargon2.a"
]
}
}

View File

@ -419,5 +419,13 @@
"type": "file",
"path": "LICENSE"
}
},
"libargon2": {
"type": "ghtar",
"repo": "P-H-C/phc-winner-argon2",
"license": {
"type": "file",
"path": "LICENSE"
}
}
}

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libargon2 extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libargon2;
public const NAME = 'libargon2';
}

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait libargon2
{
protected function build()
{
shell()->cd($this->source_dir)
->exec("make {$this->builder->configure_env} PREFIX='' clean")
->exec("make -j{$this->builder->concurrency} PREFIX=''")
->exec("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['libargon2.pc']);
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'libargon2') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
}
}
}
}