extern crate gcc;

fn main() {
    let target = std::env::var("TARGET").unwrap();

    let mut config = gcc::Config::new();
    config.file("mdb/libraries/liblmdb/mdb.c")
          .file("mdb/libraries/liblmdb/midl.c");

    if target.contains("dragonfly") {
        config.flag("-DMDB_DSYNC=O_SYNC");
        config.flag("-DMDB_FDATASYNC=fsync");
    }

    config.compile("liblmdb.a");
}

extern crate gcc;

fn main() {
    let target = std::env::var("TARGET").unwrap();

    let mut config = gcc::Config::new();
    config.file("mdb/libraries/liblmdb/mdb.c")
          .file("mdb/libraries/liblmdb/midl.c");
    config.opt_level(2);

    if target.contains("dragonfly") {
        config.flag("-DMDB_DSYNC=O_SYNC");
        config.flag("-DMDB_FDATASYNC=fsync");
    }

    config.compile("liblmdb.a");
}

Build sys crate with opt-level 2
Build sys crate with opt-level 2

It looks like by default optimization level for C code was the same as
for Rust, which caused LMDB to be built with -O3 in release mode and
that is not supported officially => sometimes it crashed.

Fixes #40
