File tree Expand file tree Collapse file tree 5 files changed +116
-0
lines changed
Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,22 @@ bzip2:
3131 metadata :
3232 license-files : ['{registry_root}/src/globals/licenses/bzip2.txt']
3333 license : bzip2-1.0.6
34+
35+ fastlz :
36+ source :
37+ type : git
38+ url : ' https://github.com/ariya/FastLZ.git'
39+ rev : master
40+ metadata :
41+ license-files : ['LICENSE.MIT']
42+ license : MIT
43+
44+ zlib :
45+ source :
46+ type : ghrel
47+ repo : madler/zlib
48+ match : ' zlib.+\.tar\.gz'
49+ binary : hosted
50+ metadata :
51+ license-files : ['{registry_root}/src/globals/licenses/zlib.txt']
52+ license : Zlib-Custom
Original file line number Diff line number Diff line change @@ -19,3 +19,20 @@ bzip2:
1919 headers :
2020 - bzlib.h
2121 artifact : bzip2
22+
23+ fastlz :
24+ type : library
25+ static-libs@unix :
26+ - libfastlz.a
27+ headers :
28+ - fastlz.h
29+ artifact : fastlz
30+
31+ zlib :
32+ type : library
33+ static-libs@unix :
34+ - libz.a
35+ headers :
36+ - zlib.h
37+ - zconf.h
38+ artifact : zlib
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Package \Library ;
6+
7+ use StaticPHP \Attribute \Package \BuildFor ;
8+ use StaticPHP \Attribute \Package \Library ;
9+ use StaticPHP \Exception \BuildFailureException ;
10+ use StaticPHP \Package \LibraryPackage ;
11+
12+ #[Library('fastlz ' )]
13+ class fastlz
14+ {
15+ #[BuildFor('Linux ' )]
16+ #[BuildFor('Darwin ' )]
17+ public function build (LibraryPackage $ lib ): void
18+ {
19+ $ cc = getenv ('CC ' ) ?: 'cc ' ;
20+ $ ar = getenv ('AR ' ) ?: 'ar ' ;
21+
22+ shell ()->cd ($ lib ->getSourceDir ())->initializeEnv ($ lib )
23+ ->exec ("{$ cc } -c -O3 -fPIC fastlz.c -o fastlz.o " )
24+ ->exec ("{$ ar } rcs libfastlz.a fastlz.o " );
25+
26+ // Copy header file
27+ if (!copy ($ lib ->getSourceDir () . '/fastlz.h ' , $ lib ->getIncludeDir () . '/fastlz.h ' )) {
28+ throw new BuildFailureException ('Failed to copy fastlz.h ' );
29+ }
30+
31+ // Copy static library
32+ if (!copy ($ lib ->getSourceDir () . '/libfastlz.a ' , $ lib ->getLibDir () . '/libfastlz.a ' )) {
33+ throw new BuildFailureException ('Failed to copy libfastlz.a ' );
34+ }
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Package \Library ;
6+
7+ use StaticPHP \Attribute \Package \BuildFor ;
8+ use StaticPHP \Attribute \Package \Library ;
9+ use StaticPHP \Package \LibraryPackage ;
10+ use StaticPHP \Runtime \Executor \UnixAutoconfExecutor ;
11+
12+ #[Library('zlib ' )]
13+ class zlib
14+ {
15+ #[BuildFor('Linux ' )]
16+ #[BuildFor('Darwin ' )]
17+ public function build (LibraryPackage $ lib ): void
18+ {
19+ UnixAutoconfExecutor::create ($ lib )->exec ("./configure --static --prefix= {$ lib ->getBuildRootPath ()}" )->make ();
20+
21+ // Patch pkg-config file
22+ $ lib ->patchPkgconfPrefix (['zlib.pc ' ], PKGCONF_PATCH_PREFIX );
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ (C) 1995-2022 Jean-loup Gailly and Mark Adler
2+
3+ This software is provided 'as-is', without any express or implied
4+ warranty. In no event will the authors be held liable for any damages
5+ arising from the use of this software.
6+
7+ Permission is granted to anyone to use this software for any purpose,
8+ including commercial applications, and to alter it and redistribute it
9+ freely, subject to the following restrictions:
10+
11+ 1. The origin of this software must not be misrepresented; you must not
12+ claim that you wrote the original software. If you use this software
13+ in a product, an acknowledgment in the product documentation would be
14+ appreciated but is not required.
15+ 2. Altered source versions must be plainly marked as such, and must not be
16+ misrepresented as being the original software.
17+ 3. This notice may not be removed or altered from any source distribution.
18+
19+ Jean-loup Gailly Mark Adler
20+
You can’t perform that action at this time.
0 commit comments