From f80618785d03d8170f12d48ca18ddf99704cbf1a Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Tue, 30 Jul 2024 17:09:09 +0900 Subject: [PATCH 1/2] Fix macOS support in cc.janet --- spork/cc.janet | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spork/cc.janet b/spork/cc.janet index df65bb7..b86c641 100644 --- a/spork/cc.janet +++ b/spork/cc.janet @@ -147,20 +147,24 @@ (defn- rpath [] (if (dyn *use-rpath* true) - [(string "-Wl,-rpath=" (lib-path)) - (string "-Wl,-rpath=" (dyn *syspath* "."))] + [(string "-Wl,-rpath," (lib-path)) + (string "-Wl,-rpath," (dyn *syspath* "."))] [])) (defn- smart-libs [] - (def dflt (index-of (target-os) [:linux :macos])) + (def dflt (index-of (target-os) [:linux])) (dyn *smart-libs* dflt)) (defn- libs [] (def sg (if (smart-libs) ["-Wl,--start-group"] [])) (def eg (if (smart-libs) ["-Wl,--end-group"] [])) + (def bs (if (not= (target-os) :macos) ["-Wl,-Bstatic"] [])) + (def bd (if (not= (target-os) :macos) ["-Wl,-Bdynamic"] [])) [;(lflags) ;sg ;(default-libs) - "-Wl,-Bstatic" ;(static-libs) - "-Wl,-Bdynamic" ;(dynamic-libs) + ;bs + ;(static-libs) + ;bd + ;(dynamic-libs) ;eg ;(rpath)]) (defn- rdynamic From 42f6fdd3cba36e4c93015bedf4ca176c0c1f1c26 Mon Sep 17 00:00:00 2001 From: Michael Camilleri Date: Fri, 9 Aug 2024 08:24:54 +0900 Subject: [PATCH 2/2] Add dynamic lookup for macOS compilations --- spork/cc.janet | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spork/cc.janet b/spork/cc.janet index b86c641..6f011a9 100644 --- a/spork/cc.janet +++ b/spork/cc.janet @@ -154,11 +154,13 @@ (def dflt (index-of (target-os) [:linux])) (dyn *smart-libs* dflt)) (defn- libs [] + (def dl (if (= (target-os) :macos) ["-undefined" "dynamic_lookup"] [])) (def sg (if (smart-libs) ["-Wl,--start-group"] [])) (def eg (if (smart-libs) ["-Wl,--end-group"] [])) (def bs (if (not= (target-os) :macos) ["-Wl,-Bstatic"] [])) (def bd (if (not= (target-os) :macos) ["-Wl,-Bdynamic"] [])) [;(lflags) + ;dl ;sg ;(default-libs) ;bs