diff --git a/README.md b/README.md index 49a282363d4cf..b76c8930f94f1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ +# SDL for Zig + This is a fork of [SDL](https://www.libsdl.org/), packaged for [Zig](https://ziglang.org). Unnecessary files have been deleted, and the build system has been replaced with `build.zig`. The package provides version 2 of SDL. For version 3, consider https://github.com/castholm/SDL. + +## Getting started + +### Linking SDL2 to your project + +Fetch SDL and add to your `build.zig.zon` : +```bash +zig fetch --save=SDL git+https://github.com/allyourcodebase/SDL +``` + +Add this to your `build.zig` : +```zig +pub fn build(b: *std.Build) void { +// ... + +const sdl_dep = b.dependency("SDL", .{ + .optimize = .ReleaseFast, + .target = target, +}); + +// ... + +exe.linkLibrary(sdl_dep.artifact("SDL2")); + +// ... +} +``` diff --git a/build.zig b/build.zig index 9934ed875a951..d5a4337703525 100644 --- a/build.zig +++ b/build.zig @@ -1082,8 +1082,8 @@ fn configHeader(b: *std.Build, t: std.Target) *std.Build.Step.ConfigHeader { .HAVE_MEMMOVE = 1, .HAVE_MEMCMP = 1, .HAVE_WCSLEN = 1, - .HAVE_WCSLCPY = !is_musl, - .HAVE_WCSLCAT = !is_musl, + .HAVE_WCSLCPY = !is_linux and !is_musl, + .HAVE_WCSLCAT = !is_linux and !is_musl, .HAVE__WCSDUP = 0, .HAVE_WCSDUP = 1, .HAVE_WCSSTR = 1, @@ -1094,8 +1094,8 @@ fn configHeader(b: *std.Build, t: std.Target) *std.Build.Step.ConfigHeader { .HAVE_WCSNCASECMP = 1, .HAVE__WCSNICMP = 0, .HAVE_STRLEN = 1, - .HAVE_STRLCPY = 1, - .HAVE_STRLCAT = 1, + .HAVE_STRLCPY = !is_linux, + .HAVE_STRLCAT = !is_linux, .HAVE__STRREV = 0, .HAVE__STRUPR = 0, .HAVE__STRLWR = 0,