Skip to content

Commit 01f4347

Browse files
authored
refactor: move lapack patches to its own file (#72)
Signed-off-by: Thulio Ferraz Assis <3149049+f0rmiga@users.noreply.github.com>
1 parent 092e2d7 commit 01f4347

File tree

2 files changed

+58
-32
lines changed

2 files changed

+58
-32
lines changed

examples/lapack/patches.bzl

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright (c) Joby Aviation 2022
2+
# Original authors: Thulio Ferraz Assis (thulio@aspect.dev), Aspect.dev
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
"""This module provides patches for LAPACK archive.
17+
"""
18+
19+
# make.inc is required to be present when calling `make` to build LAPACK.
20+
# We override these values with arguments and environment variables passed to
21+
# the build action, so this file remains static for determinism during build.
22+
_create_make_inc = """\
23+
cat > make.inc <<EOF
24+
####################################################################
25+
# LAPACK make include file. #
26+
####################################################################
27+
28+
SHELL = $0
29+
30+
CC ?=
31+
32+
FC ?=
33+
FFLAGS ?=
34+
FFLAGS_DRV ?=
35+
FFLAGS_NOOPT ?=
36+
37+
LDFLAGS ?=
38+
39+
AR ?=
40+
ARFLAGS = cr
41+
RANLIB = echo
42+
43+
BLASLIB ?=
44+
CBLASLIB ?=
45+
LAPACKLIB ?=
46+
TMGLIB ?=
47+
LAPACKELIB ?=
48+
49+
DOCSDIR ?=
50+
51+
TIMER ?=
52+
EOF
53+
"""
54+
55+
LAPACK_PATCHES = [_create_make_inc]

internal.bzl

+3-32
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1919
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2020

21+
load("//examples/lapack:patches.bzl", "LAPACK_PATCHES")
22+
2123
# buildifier: disable=function-docstring
2224
def internal_dependencies():
2325
maybe(
@@ -59,38 +61,7 @@ def internal_dependencies():
5961
http_archive,
6062
name = "lapack",
6163
build_file_content = _ALL_SRCS,
62-
patch_cmds = ["""\
63-
cat > make.inc <<EOF
64-
####################################################################
65-
# LAPACK make include file. #
66-
####################################################################
67-
68-
SHELL = $0
69-
70-
CC ?=
71-
72-
FC ?=
73-
FFLAGS ?=
74-
FFLAGS_DRV ?=
75-
FFLAGS_NOOPT ?=
76-
77-
LDFLAGS ?=
78-
79-
AR ?=
80-
ARFLAGS = cr
81-
RANLIB = echo
82-
83-
BLASLIB ?=
84-
CBLASLIB ?=
85-
LAPACKLIB ?=
86-
TMGLIB ?=
87-
LAPACKELIB ?=
88-
89-
DOCSDIR ?=
90-
91-
TIMER ?=
92-
EOF
93-
"""],
64+
patch_cmds = LAPACK_PATCHES,
9465
sha256 = "cd005cd021f144d7d5f7f33c943942db9f03a28d110d6a3b80d718a295f7f714",
9566
strip_prefix = "lapack-3.10.1",
9667
url = "https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.10.1.tar.gz",

0 commit comments

Comments
 (0)