mirror of
https://github.com/janet-lang/janet
synced 2024-12-12 09:40:26 +00:00
Make jpm configurable for environments like MinGW.
This commit is contained in:
parent
2db7945d6f
commit
7c757ef3bf
@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Remove the `tarray` module. The functionality of typed arrays will be moved to an external module
|
- Remove the `tarray` module. The functionality of typed arrays will be moved to an external module
|
||||||
that can be installed via `jpm`.
|
that can be installed via `jpm`.
|
||||||
- Add `from-pairs` to core.
|
- Add `from-pairs` to core.
|
||||||
|
- Add `JPM_OS_WHICH` environment variable to jpm to allow changing auto-detection behavior.
|
||||||
|
- The flychecker will consider any top-level calls of functions that start with `define-` to
|
||||||
|
be safe to execute and execute them. This allows certain patterns (like spork/path) to be
|
||||||
|
better processed by the flychecker.
|
||||||
|
|
||||||
## 1.15.5 - 2021-04-25
|
## 1.15.5 - 2021-04-25
|
||||||
- Add `declare-headers` to jpm.
|
- Add `declare-headers` to jpm.
|
||||||
|
35
README.md
35
README.md
@ -234,7 +234,7 @@ See the examples directory for some example janet code.
|
|||||||
## Discussion
|
## Discussion
|
||||||
|
|
||||||
Feel free to ask questions and join the discussion on the [Janet Gitter Channel](https://gitter.im/janet-language/community).
|
Feel free to ask questions and join the discussion on the [Janet Gitter Channel](https://gitter.im/janet-language/community).
|
||||||
Alternatively, check out [the #janet channel on Freenode](https://webchat.freenode.net/)
|
Gitter provides Matrix and irc bridges as well.
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
@ -246,8 +246,35 @@ will not. If your terminal does not support ANSI escape codes, run the REPL with
|
|||||||
the `-n` flag, which disables color output. You can also try the `-s` if further issues
|
the `-n` flag, which disables color output. You can also try the `-s` if further issues
|
||||||
ensue.
|
ensue.
|
||||||
|
|
||||||
## Why Janet
|
### Where is (favorite feature from other language)?
|
||||||
|
|
||||||
|
It may exist, it may not. If you want to propose major language features, go ahead and open an issue, but
|
||||||
|
they will likely by closed as "will not implement". Often, such features make one usecase simpler at the expense
|
||||||
|
of 5 others by making the language more complicated.
|
||||||
|
|
||||||
|
### Where is the example code?
|
||||||
|
|
||||||
|
In the examples directory.
|
||||||
|
|
||||||
|
### Is this a Clojure port?
|
||||||
|
|
||||||
|
No. It's similar to Clojure superficially because I like Lisps and I like the asthetics.
|
||||||
|
Internally, Janet is not at all like Clojure.
|
||||||
|
|
||||||
|
### Are the immutable data structures (tuples and structs) implemented as hash tries?
|
||||||
|
|
||||||
|
No. They are immutable arrays and hash tables. Don't try and use them like Clojure's vectors
|
||||||
|
and maps, instead they work well as table keys or other identifiers.
|
||||||
|
|
||||||
|
### Why can't we add (feature from Clojure) into the core?
|
||||||
|
|
||||||
|
Usually, one of a few reasons:
|
||||||
|
- Often, it already exists in a different form and the Clojure port would be redundant.
|
||||||
|
- Clojure programs often generate a lot of garbage and rely on the JVM to clean it up.
|
||||||
|
Janet does not run on the JVM. We admittedly have a much more primitive GC.
|
||||||
|
- We want to keep the Janet core small. With Lisps, usually a feature can be added as a library
|
||||||
|
without feeling "bolted on", especially when compared to ALGOL like languages.
|
||||||
|
|
||||||
|
## Why is it called "Janet"?
|
||||||
|
|
||||||
Janet is named after the almost omniscient and friendly artificial being in [The Good Place](https://en.wikipedia.org/wiki/The_Good_Place).
|
Janet is named after the almost omniscient and friendly artificial being in [The Good Place](https://en.wikipedia.org/wiki/The_Good_Place).
|
||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/janet-lang/janet/master/assets/janet-the-good-place.gif" alt="Janet logo" width="115px" align="left">
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 109 KiB |
28
jpm
28
jpm
@ -6,14 +6,21 @@
|
|||||||
# Basic Path Settings
|
# Basic Path Settings
|
||||||
#
|
#
|
||||||
|
|
||||||
# Windows is the OS outlier
|
# Allow changing the behavior via an environment variable
|
||||||
(def- is-win (= (os/which) :windows))
|
(def- host-os (keyword (string/ascii-lower (os/getenv "JPM_OS_WHICH" (os/which)))))
|
||||||
(def- is-mac (= (os/which) :macos))
|
(defn- define-utils
|
||||||
(def- sep (if is-win "\\" "/"))
|
[]
|
||||||
(def- objext (if is-win ".obj" ".o"))
|
(def is-win (= host-os :windows))
|
||||||
(def- modext (if is-win ".dll" ".so"))
|
(defglobal 'is-win is-win)
|
||||||
(def- statext (if is-win ".static.lib" ".a"))
|
(defglobal 'is-mac (= host-os :macos))
|
||||||
(def- absprefix (if is-win "C:\\" "/"))
|
(def sep (if is-win "\\" "/"))
|
||||||
|
(defglobal 'sep sep)
|
||||||
|
(defglobal 'objext (if is-win ".obj" ".o"))
|
||||||
|
(defglobal 'modext (if is-win ".dll" ".so"))
|
||||||
|
(defglobal 'statext (if is-win ".static.lib" ".a"))
|
||||||
|
(defglobal 'absprefix (if is-win "C:\\" "/")))
|
||||||
|
|
||||||
|
(define-utils)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Defaults
|
# Defaults
|
||||||
@ -58,6 +65,9 @@
|
|||||||
|
|
||||||
###END###
|
###END###
|
||||||
|
|
||||||
|
# Redefine utils in case the above section is overriden on some installs.
|
||||||
|
(define-utils)
|
||||||
|
|
||||||
(compwhen (not (dyn 'extra-lflags))
|
(compwhen (not (dyn 'extra-lflags))
|
||||||
(def- extra-lflags []))
|
(def- extra-lflags []))
|
||||||
|
|
||||||
@ -370,7 +380,7 @@
|
|||||||
# flags needed for the janet binary and compiling standalone
|
# flags needed for the janet binary and compiling standalone
|
||||||
# executables.
|
# executables.
|
||||||
(def janet-lflags
|
(def janet-lflags
|
||||||
(case (os/which)
|
(case host-os
|
||||||
:macos ["-ldl" "-lm" ;thread-flags ;extra-lflags]
|
:macos ["-ldl" "-lm" ;thread-flags ;extra-lflags]
|
||||||
:windows [;thread-flags ;extra-lflags]
|
:windows [;thread-flags ;extra-lflags]
|
||||||
:linux ["-lm" "-ldl" "-lrt" ;thread-flags ;extra-lflags]
|
:linux ["-lm" "-ldl" "-lrt" ;thread-flags ;extra-lflags]
|
||||||
|
25
jpm.1
25
jpm.1
@ -269,5 +269,30 @@ An optional path to a git executable to use to clone git dependencies. By defaul
|
|||||||
if you have a normal install of git.
|
if you have a normal install of git.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
.B JPM_OS_WHICH
|
||||||
|
.RS
|
||||||
|
Use this option to override the C compiler and build system auto-detection for the host operating system. For example, set this
|
||||||
|
environment variable to "posix" to make sure that on platforms like MinGW, you will use GCC instead of MSVC. On most platforms, users will not need to
|
||||||
|
set this environment variable. Set this to one of the following
|
||||||
|
strings:
|
||||||
|
.IP
|
||||||
|
\- windows
|
||||||
|
.IP
|
||||||
|
\- macos
|
||||||
|
.IP
|
||||||
|
\- linux
|
||||||
|
.IP
|
||||||
|
\- freebsd
|
||||||
|
.IP
|
||||||
|
\- openbsd
|
||||||
|
.IP
|
||||||
|
\- netbsd
|
||||||
|
.IP
|
||||||
|
\- bsd
|
||||||
|
.IP
|
||||||
|
\- posix
|
||||||
|
.RE
|
||||||
|
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Written by Calvin Rose <calsrose@gmail.com>
|
Written by Calvin Rose <calsrose@gmail.com>
|
||||||
|
@ -3315,7 +3315,11 @@
|
|||||||
[thunk source env where]
|
[thunk source env where]
|
||||||
(when (tuple? source)
|
(when (tuple? source)
|
||||||
(def head (source 0))
|
(def head (source 0))
|
||||||
(def safe-check (safe-forms head))
|
(def safe-check
|
||||||
|
(or
|
||||||
|
(safe-forms head)
|
||||||
|
(if (symbol? head)
|
||||||
|
(if (string/has-prefix? "define-" head) is-safe-def))))
|
||||||
(cond
|
(cond
|
||||||
# Sometimes safe form
|
# Sometimes safe form
|
||||||
(function? safe-check)
|
(function? safe-check)
|
||||||
|
Loading…
Reference in New Issue
Block a user