diff options
| author | Shagun Agrawal <agrawalshagun07@gmail.com> | 2024-07-24 18:51:24 +0530 |
|---|---|---|
| committer | Shagun Agrawal <agrawalshagun07@gmail.com> | 2024-07-24 18:51:24 +0530 |
| commit | ab32a441a6aafb29cf615e14dcd284e9f62786ef (patch) | |
| tree | c4f3cdd4e75bc0e9a0f6f2bf5405fccc0bbe87ad /src/cljcc/util.clj | |
| parent | 76041390b66ae1a7e903bfd40b3b176dc895b385 (diff) | |
Add initial compiler implementation
Diffstat (limited to 'src/cljcc/util.clj')
| -rw-r--r-- | src/cljcc/util.clj | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cljcc/util.clj b/src/cljcc/util.clj new file mode 100644 index 0000000..1087029 --- /dev/null +++ b/src/cljcc/util.clj @@ -0,0 +1,19 @@ +(ns cljcc.util + (:require [clojure.java.shell :refer [sh]])) + +(defn get-os [] + (let [os-name (.toLowerCase (System/getProperty "os.name"))] + (cond + (.contains os-name "mac") :mac + (.contains os-name "linux") :linux + :else :unsupported))) + +(defn mac-aarch64? [] + (and (= :mac (get-os)) (= (System/getProperty "os.arch" "aarch64")))) + +(defn handle-sh + "Preprends arch -x86_64 if running under Mac M chips." + [command & args] + (if (mac-aarch64?) + (apply sh "arch" "-x86_64" command args) + (apply sh command args))) |
