diff --git a/leveldbstatic/prelude.nim b/leveldbstatic/prelude.nim index ee10adf..c27e1b9 100644 --- a/leveldbstatic/prelude.nim +++ b/leveldbstatic/prelude.nim @@ -16,7 +16,11 @@ const LevelDbDir {.strdefine.} = $(root/"vendor") buildDir = $(root/"build") -static: +proc buildLevelDb() = + if fileExists(buildDir/"Makefile"): + echo "LevelDB already build. Delete '" & buildDir & "' to force rebuild." + return + echo "Initializing submodule..." discard gorge "git submodule deinit -f \"" & root & "\"" discard gorge "git submodule update --init --recursive --checkout \"" & root & "\"" @@ -33,6 +37,9 @@ static: echo output raise (ref Defect)(msg: "Failed to build LevelDB") +static: + buildLevelDb() + when defined(windows): {.compile: envWindows.} {.passc: "-DLEVELDB_PLATFORM_WINDOWS".} diff --git a/leveldbstatic/raw.nim b/leveldbstatic/raw.nim index b7fd307..ea90034 100644 --- a/leveldbstatic/raw.nim +++ b/leveldbstatic/raw.nim @@ -16,7 +16,11 @@ const LevelDbDir {.strdefine.} = $(root/"vendor") buildDir = $(root/"build") -static: +proc buildLevelDb() = + if fileExists(buildDir/"Makefile"): + echo "LevelDB already build. Delete '" & buildDir & "' to force rebuild." + return + echo "Initializing submodule..." discard gorge "git submodule deinit -f \"" & root & "\"" discard gorge "git submodule update --init --recursive --checkout \"" & root & "\"" @@ -33,6 +37,9 @@ static: echo output raise (ref Defect)(msg: "Failed to build LevelDB") +static: + buildLevelDb() + when defined(windows): {.compile: envWindows.} {.passc: "-DLEVELDB_PLATFORM_WINDOWS".}