fix: support Nimble-installed runtime archives
1119f58 parent: bd1db92 modified
clonim.nimble +1 -1 | @@ -1,4 +1,4 @@ | ||
| 1 | -version = "0.1.16" | |
| 1 | +version = "0.1.17" | |
| 2 | 2 | author = "clonim contributors" |
| 3 | 3 | description = "A Clojure compiler hosted on Nim" |
| 4 | 4 | license = "MIT" |
| @@ -1,4 +1,4 @@ | |||
| 1 | -version = "0.1.16" | 1 | +version = "0.1.17" |
| 2 | author = "clonim contributors" | 2 | author = "clonim contributors" |
| 3 | description = "A Clojure compiler hosted on Nim" | 3 | description = "A Clojure compiler hosted on Nim" |
| 4 | license = "MIT" | 4 | license = "MIT" |
modified
src/clonim.nim +9 -2 | @@ -67,9 +67,16 @@ proc srcDir(): string = | ||
| 67 | 67 | |
| 68 | 68 | proc runtimeLib(release: bool): string = |
| 69 | 69 | ## Release archives place the private runtime beside bin/. A source checkout |
| 70 | - ## builds the same archive into lib/ on first use. | |
| 70 | + ## builds the same archive into lib/ on first use. Nimble installs the | |
| 71 | + ## executable beside its sources rather than under bin/, so keep its archive | |
| 72 | + ## inside the installed package; putting it in pkgs2/lib makes Nim interpret | |
| 73 | + ## that directory as a malformed package on later invocations. | |
| 71 | 74 | let libName = (if release: "libclonim_runtime.a" else: "libclonim_runtime_debug.a") |
| 72 | - let installed = getAppDir().parentDir / "lib" / libName | |
| 75 | + let appDir = getAppDir() | |
| 76 | + let installedRoot = | |
| 77 | + if fileExists(appDir / "app_runtime.nim"): appDir | |
| 78 | + else: appDir.parentDir | |
| 79 | + let installed = installedRoot / "lib" / libName | |
| 73 | 80 | let source = srcDir() / "runtime_lib.nim" |
| 74 | 81 | if fileExists(installed): |
| 75 | 82 | if not fileExists(source): return installed |
| @@ -67,9 +67,16 @@ proc srcDir(): string = | |||
| 67 | 67 | ||
| 68 | proc runtimeLib(release: bool): string = | 68 | proc runtimeLib(release: bool): string = |
| 69 | ## Release archives place the private runtime beside bin/. A source checkout | 69 | ## Release archives place the private runtime beside bin/. A source checkout |
| 70 | - ## builds the same archive into lib/ on first use. | 70 | + ## builds the same archive into lib/ on first use. Nimble installs the |
| 71 | + ## executable beside its sources rather than under bin/, so keep its archive | ||
| 72 | + ## inside the installed package; putting it in pkgs2/lib makes Nim interpret | ||
| 73 | + ## that directory as a malformed package on later invocations. | ||
| 71 | let libName = (if release: "libclonim_runtime.a" else: "libclonim_runtime_debug.a") | 74 | let libName = (if release: "libclonim_runtime.a" else: "libclonim_runtime_debug.a") |
| 72 | - let installed = getAppDir().parentDir / "lib" / libName | 75 | + let appDir = getAppDir() |
| 76 | + let installedRoot = | ||
| 77 | + if fileExists(appDir / "app_runtime.nim"): appDir | ||
| 78 | + else: appDir.parentDir | ||
| 79 | + let installed = installedRoot / "lib" / libName | ||
| 73 | let source = srcDir() / "runtime_lib.nim" | 80 | let source = srcDir() / "runtime_lib.nim" |
| 74 | if fileExists(installed): | 81 | if fileExists(installed): |
| 75 | if not fileExists(source): return installed | 82 | if not fileExists(source): return installed |