Skip to content

Commit 237ff55

Browse files
committed
Added MacOS install instructions and fixed code
1 parent f1db85f commit 237ff55

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ To build kscript, you first need to get a copy of the source code. To get the la
6363

6464
Then, open a shell (`bash`, `zsh`, etc.) in the directory with the source code and follow the instructions below for your platform
6565

66-
67-
### On Linux/Unix/MacOS
66+
### On Linux/UNIX Systems
6867

6968
Requirements:
7069

@@ -97,6 +96,17 @@ $ make
9796
$ make check # runs the standard tests
9897
```
9998

99+
### On MacOS Systems
100+
101+
Due to some library incompatibilities, the surefire way to build kscript on MacOS is:
102+
103+
```shell
104+
$ ./configure --with-ffi off --with-readline off
105+
$ make bin/ks -j16
106+
```
107+
108+
Some builds (external shared libraries, extra modules) may not work directly (TODO/WIP), but the basic functionality and the standard library should work just fine
109+
100110
### On Windows
101111

102112
TODO: I've gotten it to build on Windows, but I need to make it more complete so others can reproduce it

src/modules/net/SocketIO.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bool ksnet_SocketIO_connect(ksnet_SocketIO self, kso addr) {
263263
memset(&serv_addr,0,sizeof(serv_addr));
264264
serv_addr.sin_family = ufk;
265265
serv_addr.sin_port = htons((uint16_t)port);
266-
memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length);
266+
memcpy(&serv_addr.sin_addr.s_addr, server->h_addr_list[0], server->h_length);
267267

268268
/* Connect to address */
269269
if (connect(self->fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {

src/modules/os/stat.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ static KS_TFUNC(T, getattr) {
9494
} else if (ks_str_eq_c(attr, "mode", 4)) {
9595
return (kso)ks_int_new(self->val.val.st_mode);
9696
} else if (ks_str_eq_c(attr, "mtime", 5)) {
97-
struct timespec t = self->val.val.st_mtim;
98-
ks_cfloat x = t.tv_sec + t.tv_nsec / 1000000000.0;
97+
time_t t = self->val.val.st_mtime;
98+
ks_cfloat x = t;//t.tv_sec + t.tv_nsec / 1000000000.0;
9999
return (kso)ks_float_new(x);
100100
} else if (ks_str_eq_c(attr, "atime", 5)) {
101-
struct timespec t = self->val.val.st_atim;
102-
ks_cfloat x = t.tv_sec + t.tv_nsec / 1000000000.0;
101+
time_t t = self->val.val.st_atime;
102+
ks_cfloat x = t;//t.tv_sec + t.tv_nsec / 1000000000.0;
103103
return (kso)ks_float_new(x);
104104
} else if (ks_str_eq_c(attr, "ctime", 5)) {
105-
struct timespec t = self->val.val.st_ctim;
106-
ks_cfloat x = t.tv_sec + t.tv_nsec / 1000000000.0;
105+
time_t t = self->val.val.st_ctime;
106+
ks_cfloat x = t;//t.tv_sec + t.tv_nsec / 1000000000.0;
107107
return (kso)ks_float_new(x);
108108
}
109109

0 commit comments

Comments
 (0)