From 940860755cee99d77f175f9d8dff2ac5ca2ff807 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 21 Sep 2019 18:57:04 -0500 Subject: [PATCH] jpm: Read :lflags from meta file when linking. Let us link in native code that itself neads to be linked to native code when creating standalone executables. --- CHANGELOG.md | 2 ++ auxbin/jpm | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a4bbd71..af335cd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## Unreleased +- Fix some linking issues when creating executables with native dependencies. +- jpm now runs each test script in a new interpreter. - Fix an issue that prevent some valid programs from compiling. - Add `mean` to core. - Allow (length x) on typed arrays an other abstract types that implement diff --git a/auxbin/jpm b/auxbin/jpm index 4386549e..e97109bc 100755 --- a/auxbin/jpm +++ b/auxbin/jpm @@ -385,6 +385,7 @@ # Load entry environment and get main function. (def entry-env (dofile source)) (def main ((entry-env 'main) :value)) + (def dep-lflags @[]) # Create marshalling dictionary (def mdict (invert (env-lookup root-env))) @@ -416,6 +417,8 @@ " janet_env_lookup_into(lookup, temptab, \"" prefix "\", 0);\n\n") + (when-let [lfs (meta :lflags)] + (array/concat dep-lflags lfs)) (buffer/push-string declarations "extern void " (meta :static-entry) @@ -500,7 +503,7 @@ int main(int argc, const char **argv) { #default ["-lm"])) (def cc (opt opts :compiler default-compiler)) - (def lflags [;(opt opts :lflags default-lflags) ;extra-lflags]) + (def lflags [;dep-lflags ;(opt opts :lflags default-lflags) ;extra-lflags]) (def cflags (getcflags opts)) (def defines (make-defines (opt opts :defines {}))) (print "compiling and linking " dest "...")