Skip to content

Commit

Permalink
sets up checkers
Browse files Browse the repository at this point in the history
  • Loading branch information
benbierens committed May 15, 2024
1 parent dfe142f commit 819e9a3
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 44 deletions.
9 changes: 9 additions & 0 deletions checkers/check_crc32c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <crc32c/crc32c.h>

int main(int argc, char** argv)
{
char* buffer;
size_t size;
::crc32c::Extend(0, buffer, size);
return 0;
}
1 change: 0 additions & 1 deletion tests/compileme.c → checkers/check_fdatasync.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ int main(int argc, char** argv)
fdatasync(-1);
return 0;
}

1 change: 0 additions & 1 deletion tests/compileme2.c → checkers/check_fullfsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ int main(int argc, char** argv)
int i = F_FULLSYNC;
return 0;
}

1 change: 0 additions & 1 deletion tests/compileme3.c → checkers/check_ocloexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ int main(int argc, char** argv)
int i = O_CLOEXEC;
return 0;
}

10 changes: 10 additions & 0 deletions checkers/check_snappy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <snappy.h>

int main(int argc, char** argv)
{
char* input;
size_t length;
size_t result;
snappy::GetUncompressedLength(input, length, &result);
return 0;
}
8 changes: 8 additions & 0 deletions checkers/check_zstd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <zstd.h>

int main(int argc, char** argv)
{
size_t length;
ZSTD_compressBound(length);
return 0;
}
22 changes: 15 additions & 7 deletions leveldbstatic/prelude.nim
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import os
const root = currentSourcePath.parentDir.parentDir
const envWindows = root/"vendor"/"util"/"env_windows.cc"
const envPosix = root/"vendor"/"util"/"env_posix.cc"
const checkers = root/"checkers"

when defined(windows):
{.compile: envWindows.}
Expand All @@ -15,11 +16,18 @@ when defined(posix):
{.passc: "-DLEVELDB_PLATFORM_POSIX".}


{.passc: "-DHAVE_FDATASYNC=0".}
{.passc: "-DHAVE_FULLFSYNC=0".}
{.passc: "-DHAVE_O_CLOEXEC=0".}
{.passc: "-DHAVE_CRC32C=0".}
{.passc: "-DHAVE_SNAPPY=0".}
{.passc: "-DHAVE_ZSTD=0".}
{.passc: "-DHAVE_Zstd=0".}
static:
proc doesCompile(cfile: string): int =
let rv = gorgeEx("gcc " & cfile)
if rv[1] == 0:
return 1
return 0

{.passc: "-DHAVE_FDATASYNC=" & $doesCompile(checkers/"check_fdatasync.c").}
{.passc: "-DHAVE_FULLFSYNC=" & $doesCompile(checkers/"check_fullfsync.c").}
{.passc: "-DHAVE_O_CLOEXEC=" & $doesCompile(checkers/"check_ocloexec.c").}
{.passc: "-DHAVE_CRC32C=" & $doesCompile(checkers/"check_crc32c.c").}
{.passc: "-DHAVE_SNAPPY=" & $doesCompile(checkers/"check_snappy.c").}
{.passc: "-DHAVE_ZSTD=" & $doesCompile(checkers/"check_zstd.c").}
{.passc: "-DHAVE_Zstd=" & $doesCompile(checkers/"check_zstd.c").}

Loading

0 comments on commit 819e9a3

Please sign in to comment.