File tree Expand file tree Collapse file tree 10 files changed +39
-36
lines changed
Expand file tree Collapse file tree 10 files changed +39
-36
lines changed Original file line number Diff line number Diff line change 99 - master
1010
1111jobs :
12- lint :
12+ test :
1313 runs-on : ubuntu-latest
1414 steps :
1515 - name : checkout
@@ -18,22 +18,10 @@ jobs:
1818 - name : setup-zig
1919 uses : mlugg/setup-zig@v1
2020 with :
21- version : 0.13.0
22-
23- - name : lint
24- run : |
25- zig fmt --check src/ build.zig build.zig.zon
21+ version : 0.14.0
2622
27- test :
28- runs-on : ubuntu-latest
29- steps :
30- - name : checkout
31- uses : actions/checkout@v2
23+ - name : lint
24+ run : zig fmt --check src/ build.zig build.zig.zon
3225
33- - name : setup-zig
34- uses : mlugg/setup-zig@v1
35- with :
36- version : 0.13.0
37-
3826 - name : build
3927 run : zig build test
Original file line number Diff line number Diff line change @@ -8,14 +8,26 @@ pub fn build(b: *std.Build) void {
88
99 const zstd_dep = b .dependency ("zstd" , .{});
1010
11- const zstd_lib = b .addStaticLibrary (.{
12- .name = "zstd" ,
11+ const translate_c = b .addTranslateC (.{
12+ .root_source_file = b . path ( "src/headers.h" ) ,
1313 .target = target ,
1414 .optimize = optimize ,
1515 });
16+ translate_c .addIncludePath (zstd_dep .path ("lib" ));
17+
18+ const force_pic = b .option (bool , "force_pic" , "Forces PIC enabled for this library" );
19+ const zstd_lib = b .addLibrary (.{
20+ .name = "zstd" ,
21+ .linkage = .static ,
22+ .root_module = b .createModule (.{
23+ .target = target ,
24+ .optimize = optimize ,
25+ .pic = force_pic ,
26+ }),
27+ });
1628 b .installArtifact (zstd_lib );
29+
1730 zstd_lib .linkLibC ();
18- zstd_lib .addIncludePath (zstd_dep .path ("lib" ));
1931 zstd_lib .installHeader (zstd_dep .path ("lib/zstd.h" ), "zstd.h" );
2032 zstd_lib .installHeader (zstd_dep .path ("lib/zstd_errors.h" ), "zstd_errors.h" );
2133
@@ -60,6 +72,7 @@ pub fn build(b: *std.Build) void {
6072 .root_source_file = b .path ("src/lib.zig" ),
6173 });
6274 zstd_mod .linkLibrary (zstd_lib );
75+ zstd_mod .addAnonymousImport ("c" , .{ .root_source_file = translate_c .getOutput () });
6376
6477 const tests_exe = b .addTest (.{
6578 .target = target ,
Original file line number Diff line number Diff line change 11.{
2- .name = "zstd" ,
2+ .name = .zstd ,
3+ .fingerprint = 0x72fd505e092a0bf1 ,
34 .version = "0.0.1" ,
45 .dependencies = .{
56 .zstd = .{
6- .url = "https://github.com/facebook/zstd/archive/ 794ea1b0afca0f020f4e57b6732332231fb23c70.tar.gz " ,
7- .hash = "1220cc97075e331a87cb201c03a018a1522325d6aa844619a461462fbfdaedb38c42 " ,
7+ .url = "git+ https://github.com/facebook/zstd# 794ea1b0afca0f020f4e57b6732332231fb23c70" ,
8+ .hash = "N-V-__8AAGHFfQBd9HkISearYAEoBRuWI2GQG3Bvdcv_4uuN " ,
89 },
910 },
1011 .paths = .{
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11const std = @import ("std" );
2- const c = @import ("c.zig " );
2+ const c = @import ("c" );
33const InBuffer = @import ("types.zig" ).InBuffer ;
44const OutBuffer = @import ("types.zig" ).OutBuffer ;
55const ResetDirective = @import ("types.zig" ).ResetDirective ;
Original file line number Diff line number Diff line change 11const std = @import ("std" );
2- const c = @import ("c.zig " );
2+ const c = @import ("c" );
33const InBuffer = @import ("types.zig" ).InBuffer ;
44const OutBuffer = @import ("types.zig" ).OutBuffer ;
55const ResetDirective = @import ("types.zig" ).ResetDirective ;
Original file line number Diff line number Diff line change 1- const c = @import ("c.zig " );
1+ const c = @import ("c" );
22
33pub const Error = error {
44 Generic ,
Original file line number Diff line number Diff line change 1+ #include "zstd.h"
2+ #include "zstd_errors.h"
Original file line number Diff line number Diff line change 1- pub const c = @import ("c.zig" );
2- pub usingnamespace @import ("compress.zig" );
3- pub usingnamespace @import ("decompress.zig" );
4- pub usingnamespace @import ("types.zig" );
5- pub usingnamespace @import ("error.zig" );
6- pub usingnamespace @import ("reader.zig" );
7- pub usingnamespace @import ("writer.zig" );
1+ const compress = @import ("compress.zig" );
2+ const decompress = @import ("decompress.zig" );
3+ const types = @import ("types.zig" );
4+ const errors = @import ("error.zig" );
5+ const reader = @import ("reader.zig" );
6+ const writer = @import ("writer.zig" );
7+
8+ pub const Compressor = compress .Compressor ;
9+ pub const writerCtx = writer .writerCtx ;
10+ pub const Reader = reader .Reader ;
You can’t perform that action at this time.
0 commit comments