Skip to content

Commit 0a7f5cf

Browse files
committed
Add Mac std lib overrides
1 parent 773db8a commit 0a7f5cf

File tree

14 files changed

+142
-0
lines changed

14 files changed

+142
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ else ifneq ($(shell uname),Darwin)
3535
# This is done this way because -nostdinc would prevent a system install of libc++ from being included as well.
3636
CXXFLAGS += -I include/libc/stdlib_override
3737
else
38+
# Intercept specific includes on MacOS to prevent them from including the MacOS SDK counterparts.
39+
# This is done this way because -nostdinc would prevent a system install of libc++ from being included as well.
40+
CXXFLAGS += -I include/libc/stdlib_override_mac
3841
endif
3942

4043
rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_CTYPE_H__
2+
#define __STDLIB_OVERRIDE_MAC_CTYPE_H__
3+
4+
#define _CTYPE_H_
5+
6+
#if __has_include_next(<ctype.h>)
7+
# include_next <ctype.h>
8+
#endif
9+
10+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_ERRNO_H__
2+
#define __STDLIB_OVERRIDE_MAC_ERRNO_H__
3+
4+
#define _SYS_ERRNO_H_
5+
#include "libc/errno.h"
6+
7+
#if __has_include_next(<errno.h>)
8+
# include_next <errno.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_LIMITS_H__
2+
#define __STDLIB_OVERRIDE_MAC_LIMITS_H__
3+
4+
#define _LIMITS_H_
5+
#include "libc/limits.h"
6+
7+
#if __has_include_next(<limits.h>)
8+
# include_next <limits.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_MATH_H__
2+
#define __STDLIB_OVERRIDE_MAC_MATH_H__
3+
4+
#define __MATH_H__
5+
#include "libc/math.h"
6+
7+
#if __has_include_next(<math.h>)
8+
# include_next <math.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_STDINT_H__
2+
#define __STDLIB_OVERRIDE_MAC_STDINT_H__
3+
4+
#define _STDINT_H_
5+
#include "libc/stdint.h"
6+
7+
#if __has_include_next(<stdint.h>)
8+
# include_next <stdint.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_STDIO_H__
2+
#define __STDLIB_OVERRIDE_MAC_STDIO_H__
3+
4+
#define _STDIO_H_
5+
#include "libc/stdio.h"
6+
7+
#if __has_include_next(<stdio.h>)
8+
# include_next <stdio.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_STDLIB_H__
2+
#define __STDLIB_OVERRIDE_MAC_STDLIB_H__
3+
4+
#define _STDLIB_H_
5+
#include "libc/stdlib.h"
6+
7+
#if __has_include_next(<stdlib.h>)
8+
# include_next <stdlib.h>
9+
#endif
10+
11+
#endif
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_STRING_H__
2+
#define __STDLIB_OVERRIDE_MAC_STRING_H__
3+
4+
#define _STRING_H_
5+
#include "libc/string.h"
6+
7+
#if __has_include_next(<string.h>)
8+
# include_next <string.h>
9+
#endif
10+
11+
#endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef __STDLIB_OVERRIDE_MAC_MBSTATE_T_H__
2+
#define __STDLIB_OVERRIDE_MAC_MBSTATE_T_H__
3+
4+
#include "libc/uchar.h"
5+
6+
#define _MBSTATE_T
7+
8+
#endif

0 commit comments

Comments
 (0)