-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathBUILD
134 lines (120 loc) · 4.01 KB
/
BUILD
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright 2015-2020 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
# Author: [email protected] (Andrzej Walczak)
# Description:
# The package implements the Common Lisp build extension for Bazel.
# This BUILD file describes a Lisp compilation image used with the
# Starlark rules which are defined in rules.bzl. See README.md for
# more info about this package.
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_tools//tools/build_defs/license:license.bzl", "license")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
package(default_applicable_licenses = ["//:license"])
license(
name = "license",
package_name = "bazel",
)
licenses(["notice"])
exports_files([
"LICENSE",
"imagesave.lisp",
])
bzl_library(
name = "build_rules",
srcs = glob(["*.bzl"]),
visibility = ["//visibility:public"],
deps = [
"@bazel_skylib//rules:common_settings",
"@rules_cc//cc:find_cc_toolchain.bzl",
],
)
stardoc(
name = "rules_stardoc",
out = "rules.md",
header_template = "stardoc_header.vm",
input = "rules.bzl",
deps = [":build_rules"],
)
# This is not the same as @bazel_tools//tools/cpp:msan_build, but that matches whether the
# build is run with --config=msan at all, as opposed to whether particular
# targets are actually compiled in msan (e.g. anything in host config is not).
config_setting(
name = "msan_compiler",
flag_values = {"@bazel_tools//tools/cpp:compiler": "msan"},
visibility = ["//visibility:private"],
)
config_setting(
name = "msan-track-origins_compiler",
flag_values = {"@bazel_tools//tools/cpp:compiler": "msan-track-origins"},
visibility = ["//visibility:private"],
)
alias(
name = "msan",
actual = select({
":msan_compiler": ":msan_compiler",
":msan-track-origins_compiler": ":msan-track-origins_compiler",
"//conditions:default": ":msan_compiler", # arbitrary non-matching choice
}),
visibility = ["//visibility:public"],
)
genrule(
name = "make-image",
srcs = [
"utils.lisp",
"warning.lisp",
"log.lisp",
"sbcl.lisp",
"main.lisp",
"@local_sbcl//:contrib/sb-md5",
"@local_sbcl//:contrib/sb-rotate-byte",
"@local_sbcl//:core",
"@local_sbcl//:sbcl",
],
outs = ["image"],
cmd = (
"$(location @local_sbcl//:sbcl)" +
" --noinform" +
" --eval '(setf sb-ext:*evaluator-mode* :compile)'" +
" --load '$(location utils.lisp)'" +
" --load '$(location warning.lisp)'" +
" --load '$(location log.lisp)'" +
" --load '$(location sbcl.lisp)'" +
" --load '$(location main.lisp)'" +
" --eval '(bazel.main:save-image \"$@\" (quote bazel.main:main) :executable t)'"
),
executable = 1,
output_to_bindir = 1,
visibility = ["//visibility:public"],
)
# Elfinator reads an SBCL-native core file and produces two outputs:
# (1) an assembly-language file with a '.text' section whose contents
# are the code components from the input core file.
# This file is fully relocatable at link time.
# (2) a '.o' file containing all other Lisp objects.
# The assembly file is compiled, and then the resulting '.o' as well
# as the '.o' from elfinator can both be used as srcs to a cc_binary
# which depends on ":c-support". The SBCL runtime auto-detects
# presence of text-in-ELF and data-in-ELF.
sh_binary(
name = "elfinate",
srcs = [
"elfconvert.sh",
],
data = [
"@local_sbcl//:core",
"@local_sbcl//:sbcl",
"@sbcl//:tools-for-build/corefile.lisp",
"@sbcl//:tools-for-build/editcore.lisp",
"@sbcl//:tools-for-build/elftool.lisp",
],
visibility = ["//visibility:public"],
)
bool_flag(
name = "additional_dynamic_load_outputs",
build_setting_default = False,
visibility = ["//visibility:public"],
)