Add libargon2

This commit is contained in:
crazywhalecc 2026-02-06 10:11:24 +08:00
parent 3cfab10f85
commit 39a207076e
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
6 changed files with 88 additions and 32 deletions

View File

@ -1,18 +1,11 @@
imagemagick: imagemagick:
type: library type: library
artifact: artifact:
source: { source:
"type": "ghtar", type: ghtar
"repo": "ImageMagick/ImageMagick" repo: ImageMagick/ImageMagick
}
metadata: metadata:
license-files: [LICENSE] license-files: [LICENSE]
lang: cpp
pkg-configs: [
"Magick++-7.Q16HDRI",
"MagickCore-7.Q16HDRI",
"MagickWand-7.Q16HDRI"
]
depends: depends:
- zlib - zlib
- libjpeg - libjpeg
@ -28,5 +21,8 @@ imagemagick:
- xz - xz
- libzip - libzip
- libxml2 - libxml2
lang: cpp
pkg-configs:
- Magick++-7.Q16HDRI
- MagickCore-7.Q16HDRI
- MagickWand-7.Q16HDRI

View File

@ -1,14 +1,13 @@
imap: imap:
type: library type: library
artifact: artifact:
source: { source:
"type": "git", type: git
"url": "https://github.com/static-php/imap.git", url: 'https://github.com/static-php/imap.git'
"rev": "master" rev: master
}
metadata: metadata:
license-files: [LICENSE] license-files: [LICENSE]
static-libs@unix:
- libc-client.a
suggests@unix: suggests@unix:
- openssl - openssl
static-libs@unix:
- libc-client.a

View File

@ -6,7 +6,7 @@ libacl:
metadata: metadata:
license-files: [doc/COPYING.LGPL] license-files: [doc/COPYING.LGPL]
license: LGPL-2.1-or-later license: LGPL-2.1-or-later
static-libs@unix:
- libacl.a
depends: depends:
- attr - attr
static-libs@unix:
- libacl.a

View File

@ -0,0 +1,14 @@
libargon2:
type: library
artifact:
source:
type: git
rev: master
url: 'https://github.com/static-php/phc-winner-argon2'
metadata:
license-files: [LICENSE]
license: BSD-2-Clause
suggests:
- libsodium
static-libs@unix:
- libargon2.a

View File

@ -1,19 +1,13 @@
libzip: libzip:
type: library type: library
artifact: artifact:
source: { source:
"type": "ghrel", type: ghrel
"repo": "nih-at/libzip", repo: nih-at/libzip
"match": "libzip.+\\.tar\\.xz", match: libzip.+\.tar\.xz
"prefer-stable": true prefer-stable: true
}
metadata: metadata:
license-files: [LICENSE] license-files: [LICENSE]
static-libs@unix:
- libzip.a
headers:
- zip.h
- zipconf.h
depends@unix: depends@unix:
- zlib - zlib
suggests@unix: suggests@unix:
@ -21,3 +15,8 @@ libzip:
- xz - xz
- zstd - zstd
- openssl - openssl
headers:
- zip.h
- zipconf.h
static-libs@unix:
- libzip.a

View File

@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
namespace Package\Library;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Attribute\Package\PatchBeforeBuild;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Package\PackageBuilder;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Util\FileSystem;
#[Library('libargon2')]
class libargon2
{
#[PatchBeforeBuild]
#[PatchDescription('Fix library path for Linux builds')]
public function patchBeforeLinuxBuild(LibraryPackage $lib): void
{
spc_skip_if(SystemTarget::getTargetOS() !== 'Linux', 'Not a Linux build, skipping lib path patch.');
FileSystem::replaceFileStr("{$lib->getSourceDir()}/Makefile", 'LIBRARY_REL ?= lib/x86_64-linux-gnu', 'LIBRARY_REL ?= lib');
}
#[BuildFor('Darwin')]
#[BuildFor('Linux')]
public function buildUnix(LibraryPackage $lib, PackageBuilder $builder): void
{
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
->exec("make PREFIX='' clean")
->exec("make -j{$builder->concurrency} PREFIX=''")
->exec("make install PREFIX='' DESTDIR={$lib->getBuildRootPath()}");
$lib->patchPkgconfPrefix(['libargon2.pc']);
foreach (FileSystem::scanDirFiles("{$lib->getBuildRootPath()}/lib/", false, true) as $filename) {
if (str_starts_with($filename, 'libargon2') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink("{$lib->getBuildRootPath()}/lib/{$filename}");
}
}
if (file_exists("{$lib->getBinDir()}/argon2")) {
unlink("{$lib->getBinDir()}/argon2");
}
}
}