From 3805148c2f3e620e5e10f1e30b400a14c687f434 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 15 Aug 2024 10:33:33 +0200 Subject: [PATCH] Skip building leveldb if already built --- leveldbstatic/prelude.nim | 9 ++++++++- leveldbstatic/raw.nim | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) 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".}