diff options
| author | Andrey Listopadov <andreyorst@gmail.com> | 2023-08-26 19:40:29 +0000 |
|---|---|---|
| committer | Andrey Listopadov <andreyorst@gmail.com> | 2023-08-26 19:40:29 +0000 |
| commit | 3332e86562d9381c5fcf6a6f5205240f5e9d4f39 (patch) | |
| tree | 22f8663094bd618f191a13a1f20b5c664666071f /build.fnl | |
| parent | a11d9a991b96178f5a572473841434ebe1715d72 (diff) | |
Move everything to a single file
Now the library is fully self-contained and doesn't require any
special flags to be used. Macros are now shipped inside the library
itself and can be required by user code by requiring the same module
name as the library.
Diffstat (limited to 'build.fnl')
| -rw-r--r-- | build.fnl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/build.fnl b/build.fnl new file mode 100644 index 0000000..4c3c3db --- /dev/null +++ b/build.fnl @@ -0,0 +1,17 @@ +(fn spit-lib [path to] + (with-open [lib (io.open path)] + (each [line (lib:lines)] + ;; patching compile-time variable used to store macro module + ;; namr because when loafing the combined file it will always + ;; equal the the main module and will break macros in vendored + ;; libraries. + (case (line:match "%(local lib%-name %(or %.%.%. (.*)") + name (to:write (.. "(local lib-name (or " name "\n")) + _ (to:write line "\n"))))) + +(with-open [cljlib (io.open "./cljlib.fnl" :w)] + (let [main (io.open "src/cljlib.fnl")] + (each [line (main:lines)] + (case (line:match ";;;###include (.*)") + (path) (spit-lib path cljlib) + _ (cljlib:write line "\n"))))) |