Use native linking on Arch linux.

This commit is contained in:
Yuriy Glukhov 2018-10-01 15:39:30 +03:00 committed by zah
parent 1edab645d9
commit e2433f0651
1 changed files with 11 additions and 1 deletions

View File

@ -45,6 +45,12 @@ else:
const librocksdb = "librocksdb(|_lite).so"
## Exported types
proc shouldUseNativeLinking(): bool {.compileTime.} =
when defined(linux):
let uname = staticExec("uname -a")
if uname.find("ARCH") != -1: # Arch linux
return true
template rocksType(T) =
type T* = distinct pointer
proc isNil*(v: T): bool {.borrow.}
@ -97,7 +103,11 @@ rocksType rocksdb_transaction_t
rocksType rocksdb_checkpoint_t
## DB operations
{.pragma: importrocks, importc, cdecl, dynlib: librocksdb.}
when shouldUseNativeLinking():
{.pragma: importrocks, importc, cdecl.}
{.passL: "-lrocksdb".}
else:
{.pragma: importrocks, importc, cdecl, dynlib: librocksdb.}
proc rocksdb_open*(options: rocksdb_options_t; name: cstring; errptr: ptr cstring): rocksdb_t {.importrocks.}
proc rocksdb_open_for_read_only*(options: rocksdb_options_t; name: cstring;