-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split bundle hooks into separate files.
Allow `janet bundle/build.janet`, `janet bundle/clean.janet`, etc. to run things.
- Loading branch information
Showing
4 changed files
with
86 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(import "/spork/cc" :as cc) | ||
|
||
(defn main | ||
[& argv] | ||
(os/mkdir "build") | ||
(os/mkdir "build/objects") | ||
|
||
(def suffix | ||
(case (os/which) | ||
:windows ".dll" | ||
".so")) | ||
|
||
(def asuffix | ||
(case (os/which) | ||
:windows ".lib" | ||
".a")) | ||
|
||
(def cc | ||
(case (os/which) | ||
:windows cc/msvc-compile-and-link-shared | ||
cc/compile-and-link-shared)) | ||
|
||
(def static-cc | ||
(case (os/which) | ||
:windows cc/msvc-compile-and-make-archive | ||
cc/compile-and-make-archive)) | ||
|
||
(when (= :windows (os/which)) | ||
(cc/msvc-find) | ||
(assert (cc/msvc-setup?)) | ||
(setdyn cc/*msvc-libs* @[(cc/msvc-janet-import-lib)])) | ||
|
||
(defn make1 | ||
[name & other-srcs] | ||
(def from (string "src/" name ".c")) | ||
(def to (string "build/" name suffix)) | ||
(def toa (string "build/" name asuffix)) | ||
(cc to from ;other-srcs) | ||
(static-cc toa from ;other-srcs)) | ||
|
||
(setdyn cc/*visit* cc/visit-execute-if-stale) | ||
(setdyn cc/*build-dir* "build/objects") | ||
(make1 "crc") | ||
(make1 "json") | ||
(make1 "cmath") | ||
(make1 "utf8") | ||
(make1 "rawterm") | ||
(make1 "tarray") | ||
(make1 "base64") | ||
(setdyn cc/*defines* {"_LARGEFILE64_SOURCE" true}) | ||
(make1 "zip" "deps/miniz/miniz.c") | ||
|
||
(print "done!")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(import "/spork/sh" :as sh) | ||
|
||
(defn main | ||
[&] | ||
(sh/rm "build")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# | ||
# Run test scripts, and error if any fail. | ||
# Pass through any args | ||
# | ||
|
||
(defn main [& argv] | ||
(def failures-array @[]) | ||
(each suite (sorted (os/dir "test")) | ||
(when (string/has-prefix? "suite-" suite) | ||
(eprint "Running suite " suite) | ||
(def result (os/execute [(dyn *executable*) (string "test/" suite) ;argv] :p)) | ||
(if-not (zero? result) | ||
(array/push failures-array suite)))) | ||
(if (empty? failures-array) | ||
(eprint "All Passed.") | ||
(errorf "Failures in: %s" (string/join failures-array ", ")))) |