fix the build on OS X
Patch status: merged
Patch by Jean-Philippe Ouellet
Long description:
OS X doesn't have posix_fallocate() yet, so put bf760d0241f0f078735e230b4bf6da4fc83368fe in #if defined(__APPLE__) the cd fails with: /bin/sh: line 0: cd: include: No such file or directory so give it a path relative to the top directory
To apply this patch, use:
curl http://cr.i3wm.org/patch/335/raw.patch | git am
b/src/i3.mk
22 |
@@ -54,12 +54,12 @@ src/config_parser.o: src/config_parser.c $(i3_HEADERS_DEP) i3-config-parser.stam |
23 |
|
24 |
i3-command-parser.stamp: generate-command-parser.pl parser-specs/commands.spec |
25 |
echo "[i3] Generating command parser" |
26 |
- (cd include; ../generate-command-parser.pl --input=../parser-specs/commands.spec --prefix=command) |
27 |
+ (cd $(TOPDIR)/include; ../generate-command-parser.pl --input=../parser-specs/commands.spec --prefix=command) |
28 |
touch $@ |
29 |
|
30 |
i3-config-parser.stamp: generate-command-parser.pl parser-specs/config.spec |
31 |
echo "[i3] Generating config parser" |
32 |
- (cd include; ../generate-command-parser.pl --input=../parser-specs/config.spec --prefix=config) |
33 |
+ (cd $(TOPDIR)/include; ../generate-command-parser.pl --input=../parser-specs/config.spec --prefix=config) |
34 |
touch $@ |
35 |
|
36 |
i3: libi3.a $(i3_OBJECTS) |
b/src/log.c
41 |
@@ -129,11 +129,16 @@ void open_logbuffer(void) { |
42 |
return; |
43 |
} |
44 |
|
45 |
+#if defined(__APPLE__) |
46 |
+ if (ftruncate(logbuffer_shm, logbuffer_size) == -1) { |
47 |
+ fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(errno)); |
48 |
+#else |
49 |
int ret; |
50 |
if ((ret = posix_fallocate(logbuffer_shm, 0, logbuffer_size)) != 0) { |
51 |
+ fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(ret)); |
52 |
+#endif |
53 |
close(logbuffer_shm); |
54 |
shm_unlink(shmlogname); |
55 |
- fprintf(stderr, "Could not ftruncate SHM segment for the i3 log: %s\n", strerror(ret)); |
56 |
return; |
57 |
} |
58 |
|