-
Notifications
You must be signed in to change notification settings - Fork 2
/
BUILD.bazel
53 lines (46 loc) · 1.55 KB
/
BUILD.bazel
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
load("//lib:defs.bzl", "library_path", "make_args", "root_path", "static_lib")
load("//lib:lib.bzl", "package_lib")
load("//toolchains/cmake:cmake.bzl", "cmake_lib")
load("//toolchains/make:make.bzl", "make_lib")
load(":package.bzl", "NAME", "NAME_C")
package(default_visibility = ["//:__subpackages__"])
package_lib(
version_regex = r">\s*blas-([^<]+)\.tgz\s*<",
version_url = "https://www.netlib.org/blas/",
)
# NOTE: Currently building this package requires a working "gfortran" binary.
# TODO: Build gfortran, and set the F18_FC environment variable to that binary.
cmake_lib(
name = NAME,
build_data = ["@llvm//:flang"],
env = {"FC": root_path(
"$(execpaths @llvm//:flang)",
double_escape = True,
)},
)
CP_HEADERS = 'cp --dereference "{build_tmpdir}/include"/{name}{{,_f77}}.h "{install_dir}/include"'.format(
name = NAME_C,
build_tmpdir = "${BUILD_TMPDIR}",
install_dir = "${INSTALLDIR}",
)
CP_LIBS = 'cp --dereference "{build_tmpdir}/{static_lib}" "{install_dir}/lib"'.format(
build_tmpdir = "${BUILD_TMPDIR}",
install_dir = "${INSTALLDIR}",
static_lib = static_lib(NAME_C),
)
make_lib(
name = NAME_C,
args = make_args(
blib = library_path(NAME),
cblib = "../" + static_lib(NAME_C),
cflags = "-Wno-header-guard",
fc = root_path(
"$(execpaths @llvm//:flang)",
double_escape = False,
),
),
build_data = ["@llvm//:flang"],
postfix_script = "\n".join((CP_HEADERS, CP_LIBS)),
targets = ["alllib"],
deps = [":" + NAME],
)