Skip to content

Commit 962de5b

Browse files
committed
add edant/watcher, to make spc-packages easier
1 parent b265d6d commit 962de5b

6 files changed

Lines changed: 82 additions & 0 deletions

File tree

config/lib.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,5 +854,14 @@
854854
"zstd.h",
855855
"zstd_errors.h"
856856
]
857+
},
858+
"watcher": {
859+
"source": "watcher",
860+
"static-libs-unix": [
861+
"libwatcher-c.a"
862+
],
863+
"headers": [
864+
"wtr/watcher-c.h"
865+
]
857866
}
858867
}

config/source.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,5 +1070,14 @@
10701070
"type": "file",
10711071
"path": "LICENSE"
10721072
}
1073+
},
1074+
"watcher": {
1075+
"type": "ghtar",
1076+
"repo": "e-dant/watcher",
1077+
"prefer-stable": true,
1078+
"license": {
1079+
"type": "file",
1080+
"path": "license"
1081+
}
10731082
}
10741083
}
Lines changed: 12 additions & 0 deletions
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\freebsd\library;
6+
7+
class watcher extends BSDLibraryBase
8+
{
9+
use \SPC\builder\unix\library\watcher;
10+
11+
public const NAME = 'watcher';
12+
}
Lines changed: 12 additions & 0 deletions
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 watcher extends LinuxLibraryBase
8+
{
9+
use \SPC\builder\unix\library\watcher;
10+
11+
public const NAME = 'watcher';
12+
}
Lines changed: 12 additions & 0 deletions
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\macos\library;
6+
7+
class watcher extends MacOSLibraryBase
8+
{
9+
use \SPC\builder\unix\library\watcher;
10+
11+
public const NAME = 'watcher';
12+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\unix\library;
6+
7+
use SPC\exception\FileSystemException;
8+
use SPC\exception\RuntimeException;
9+
use SPC\store\FileSystem;
10+
11+
trait watcher
12+
{
13+
/**
14+
* @throws RuntimeException
15+
* @throws FileSystemException
16+
*/
17+
protected function build(): void
18+
{
19+
shell()->cd($this->source_dir . '/watcher-c')
20+
->initializeEnv($this)
21+
->exec(getenv('CC') . ' -c -o libwatcher-c.o ./src/watcher-c.cpp -I ./include -I ../include -std=c++17 -Wall -Wextra -fPIC')
22+
->exec(getenv('AR') . ' rcs libwatcher-c.a libwatcher-c.o');
23+
24+
copy($this->source_dir . '/watcher-c/libwatcher-c.a', BUILD_LIB_PATH . '/libwatcher-c.a');
25+
FileSystem::createDir(BUILD_INCLUDE_PATH . '/wtr');
26+
copy($this->source_dir . '/watcher-c/include/wtr/watcher-c.h', BUILD_INCLUDE_PATH . '/wtr/watcher-c.h');
27+
}
28+
}

0 commit comments

Comments
 (0)