Skip to content
/ janet Public
forked from janet-lang/janet

Commit

Permalink
Fix build on NetBSD.
Browse files Browse the repository at this point in the history
The NetBSD C library's headers do not expose extensions when
compiling with -std=c99 (as opposed to -std=gnu99 or no -std=
option), so define _NETBSD_SOURCE to get timegm, and functions
that would otherwise require an _XOPEN_SOURCE definition, e.g.
realpath.

Note that, as with FreeBSD, you need gmake to compile janet
on NetBSD, and can also install it from packages.
  • Loading branch information
alarixnia committed Jul 26, 2020
1 parent 4cc6809 commit b731f6a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ gmake test
gmake repl
```

### NetBSD

NetBSD build instructions are the same as the FreeBSD build instuctions.
Alternatively, install directly from packages, using `pkgin install janet`.

### Windows

1. Install [Visual Studio](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#) or [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15#)
Expand Down
7 changes: 7 additions & 0 deletions src/core/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,11 @@
#define _XOPEN_SOURCE 500
#endif

/* Needed for timegm and other extensions when building with -std=c99.
* It also defines realpath, etc, which would normally require
* _XOPEN_SOURCE >= 500. */
#if !defined(_NETBSD_SOURCE) && defined(__NetBSD__)
#define _NETBSD_SOURCE
#endif

#endif

0 comments on commit b731f6a

Please sign in to comment.