Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions spork/cc.janet
Original file line number Diff line number Diff line change
Expand Up @@ -731,10 +731,18 @@
[& cmd]
(def pkg-config-path (or (lib-path) (dyn *syspath* ".")))
# Janet may be installed in a non-standard location, so we need to tell pkg-config where to look
(def wp (string "--with-path=" pkg-config-path))
(def pkp (string "--with-path=" (path/join pkg-config-path "pkgconfig")))
# by appending PKG_CONFIG_PATH environment variable.
(def pkp (path/join pkg-config-path "pkgconfig"))
(def s (if (= (target-os) :windows) ";" ":"))
(def pcp (string (if-let [exist (os/getenv "PKG_CONFIG_PATH")] (string exist s) "") pkg-config-path s pkp))
(def extra (dyn *pkg-config-flags* []))
(def output (sh/exec-slurp "pkg-config" wp pkp ;extra ;cmd))
(def output
(with [proc (os/spawn ["pkg-config" ;extra ;cmd] :xpe {:out :pipe "PKG_CONFIG_PATH" pcp})]
(let [[out] (ev/gather
(ev/read (proc :out) :all)
(os/proc-wait proc))]
(if out (string/trimr out) ""))))

(filter next (string/split " " (string/trim output))))

(defn pkg-config
Expand Down