-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
105 lines (97 loc) · 3.44 KB
/
Copy pathbuild.zig
File metadata and controls
105 lines (97 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const editline_dep = b.dependency("editline_upstream", .{
.target = target,
.optimize = optimize,
});
const lib_mod = b.createModule(.{
.root_source_file = null,
.target = target,
.optimize = optimize,
.link_libc = true,
.sanitize_c = .off,
});
lib_mod.addCSourceFiles(.{
.root = editline_dep.path("src"),
.files = &.{ "editline.c", "complete.c", "sysunix.c" },
});
lib_mod.addIncludePath(editline_dep.path(""));
const is_x86_linux = target.result.cpu.arch.isX86() and target.result.os.tag == .linux;
const lib = b.addLibrary(.{
.linkage = .static,
.name = "editline",
.root_module = lib_mod,
.use_llvm = !is_x86_linux,
});
// Generate config.h natively instead of relying on host autotools
// (./configure detects host features, which breaks under cross-compilation,
// and newer autoconf releases choke on upstream's macros).
addDefaultConfigHeader(b, lib_mod);
const install_header = b.addInstallHeaderFile(editline_dep.path("include/editline.h"), "editline.h");
b.getInstallStep().dependOn(&install_header.step);
b.installArtifact(lib);
}
fn addDefaultConfigHeader(b: *std.Build, lib_mod: *std.Build.Module) void {
const config_header = b.addConfigHeader(
.{},
.{
.CLOSEDIR_VOID = null,
.CONFIG_ANSI_ARROWS = 1,
.CONFIG_EOF = 1,
.CONFIG_SIGINT = 1,
.CONFIG_SIGSTOP = null,
.CONFIG_TERMINAL_BELL = null,
.CONFIG_UNIQUE_HISTORY = 1,
.CONFIG_USE_TERMCAP = null,
.GWINSZ_IN_SYS_IOCTL = 1,
.HAVE_DIRENT_H = 1,
.HAVE_DLFCN_H = 1,
.HAVE_INTTYPES_H = 1,
.HAVE_LIBCURSES = null,
.HAVE_LIBNCURSES = null,
.HAVE_LIBTERMCAP = null,
.HAVE_LIBTERMINFO = null,
.HAVE_LIBTINFO = null,
.HAVE_MALLOC_H = 1,
.HAVE_NDIR_H = null,
.HAVE_PERROR = 1,
.HAVE_SGTTY_H = 1,
.HAVE_SIGNAL_H = 1,
.HAVE_STAT_EMPTY_STRING_BUG = null,
.HAVE_STDINT_H = 1,
.HAVE_STDIO_H = 1,
.HAVE_STDLIB_H = 1,
.HAVE_STRCHR = 1,
.HAVE_STRDUP = 1,
.HAVE_STRINGS_H = 1,
.HAVE_STRING_H = 1,
.HAVE_STRRCHR = 1,
.HAVE_SYS_DIR_H = null,
.HAVE_SYS_NDIR_H = null,
.HAVE_SYS_STAT_H = 1,
.HAVE_SYS_TYPES_H = 1,
.HAVE_TCGETATTR = 1,
.HAVE_TERMCAP_H = 1,
.HAVE_TERMIOS_H = 1,
.HAVE_TERMIO_H = 1,
.HAVE_UNISTD_H = 1,
.LSTAT_FOLLOWS_SLASHED_SYMLINK = 1,
.LT_OBJDIR = ".libs/",
.PACKAGE = "editline",
.PACKAGE_BUGREPORT = "https://github.com/troglobit/editline/issues",
.PACKAGE_NAME = "editline",
.PACKAGE_STRING = "editline 2.1.0",
.PACKAGE_TARNAME = "editline",
.PACKAGE_URL = "",
.PACKAGE_VERSION = "2.1.0",
.STAT_MACROS_BROKEN = null,
.STDC_HEADERS = 1,
.SYS_UNIX = 1,
.VERSION = "2.1.0",
.size_t = null,
},
);
lib_mod.addConfigHeader(config_header);
}