forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace] Simplify pkg-config (especially for homebrew) (RobotLocom…
…otion#20582) Remove the homebrew_subdir option; it is no longer useful. Remove redundant wrapping of libblas, liblapack, and openblas; there is no need to proactively fail when run on an unexpected OS. Remove brittle argument override forwarding. Users who need to customize their WORKSPACE should write their own rules. Drop the dead (and outdated) check on minimum Eigen version. Our eigen_types.h assertion is the single source of truth.
- Loading branch information
1 parent
5babd52
commit c809bbc
Showing
18 changed files
with
76 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def clp_repository( | ||
name, | ||
licenses = [ | ||
"reciprocal", # EPL-2.0 | ||
], | ||
modname = "clp", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/clp/lib/pkgconfig", | ||
**kwargs): | ||
def clp_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
homebrew_subdir = homebrew_subdir, | ||
licenses = ["reciprocal"], # EPL-2.0 | ||
modname = "clp", | ||
extra_deprecation = "The @clp external is deprecated in Drake's WORKSPACE and will be removed on or after 2023-12-01.", # noqa | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,13 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def eigen_repository( | ||
name, | ||
def eigen_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = [ | ||
"notice", # BSD-3-Clause | ||
"reciprocal", # MPL-2.0 | ||
"unencumbered", # Public-Domain | ||
], | ||
modname = "eigen3", | ||
# Keep this version in sync with drake/common/eigen_types.h. | ||
atleast_version = "3.3.4", | ||
extra_defines = ["EIGEN_MPL2_ONLY"], | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/eigen/share/pkgconfig", | ||
**kwargs): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
extra_defines = extra_defines, | ||
pkg_config_paths = pkg_config_paths, | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def glew_repository( | ||
name, | ||
licenses = ["notice"], # BSD-3-Clause AND MIT | ||
modname = "glew", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/glew/lib/pkgconfig", | ||
**kwargs): | ||
def glew_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["notice"], # BSD-3-Clause AND MIT | ||
modname = "glew", | ||
extra_deprecation = "The @glew external is deprecated in Drake's WORKSPACE and will be removed on or after 2024-01-01.", # noqa | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def glib_repository( | ||
name, | ||
licenses = ["restricted"], # LGPL-2.0+ | ||
modname = "glib-2.0", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/glib/lib/pkgconfig", | ||
**kwargs): | ||
def glib_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
**kwargs | ||
licenses = ["restricted"], # LGPL-2.0+ | ||
modname = "glib-2.0", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def ipopt_internal_pkgconfig_repository( | ||
name, | ||
licenses = [ | ||
"reciprocal", # CPL-1.0 | ||
], | ||
modname = "ipopt", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/ipopt/lib/pkgconfig", | ||
**kwargs): | ||
def ipopt_internal_pkgconfig_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["reciprocal"], # CPL-1.0 | ||
modname = "ipopt", | ||
# When using ipopt from pkg-config, there is nothing to install. | ||
build_epilog = """ | ||
load("@drake//tools/install:install.bzl", "install") | ||
install(name = "install") | ||
""", | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,13 @@ | ||
load("//tools/workspace:os.bzl", "determine_os") | ||
load("//tools/workspace:pkg_config.bzl", "setup_pkg_config_repository") | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def _impl(repo_ctx): | ||
# TLDR: Use @blas instead of this repository (@libblas) in the deps of your | ||
# target. | ||
# | ||
# On Ubuntu, we will use pkg-config to find libblas.so (the vendor of which | ||
# is typically chosen by the Ubuntu alternatives system). On macOS, no | ||
# targets should depend on @libblas. However, on both macOS and Ubuntu, | ||
# targets should normally depend on the alias @blas instead of @libblas (or | ||
# @openblas) to install an operating-system-specific BLAS implementation. | ||
os_result = determine_os(repo_ctx) | ||
if os_result.error != None: | ||
fail(os_result.error) | ||
if os_result.is_ubuntu or os_result.is_manylinux: | ||
error = setup_pkg_config_repository(repo_ctx).error | ||
if error != None: | ||
fail(error) | ||
else: | ||
repo_ctx.symlink( | ||
Label("@drake//tools/workspace/libblas:package-macos.BUILD.bazel"), | ||
"BUILD.bazel", | ||
) | ||
|
||
libblas_repository = repository_rule( | ||
attrs = { | ||
"modname": attr.string(default = "blas"), | ||
"licenses": attr.string_list(default = ["notice"]), # BSD-3-Clause | ||
}, | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) | ||
def libblas_repository(name): | ||
# Note that @libblas is typically only available on Linux. | ||
# See drake/tools/workspace/blas for the OS-specific selection policy. | ||
# Note that on Debian and Ubuntu in particular, @libblas refers to the | ||
# implementation chosen by the Ubuntu alternatives system, which might be | ||
# one of any number of different vendor implementations. | ||
pkg_config_repository( | ||
name = name, | ||
licenses = ["notice"], # BSD-3-Clause | ||
modname = "blas", | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,17 @@ | ||
load("//tools/workspace:os.bzl", "determine_os") | ||
load("//tools/workspace:pkg_config.bzl", "setup_pkg_config_repository") | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def _impl(repo_ctx): | ||
# TLDR: Use @lapack instead of this repository (@liblapack) in the deps of | ||
# your target. | ||
# | ||
# On Ubuntu, we will use pkg-config to find liblapack.so (the vendor of | ||
# which is typically chosen by the Ubuntu alternatives system). On macOS, | ||
# no targets should depend on @liblapack. However, on both macOS and | ||
# Ubuntu, targets should normally depend on the alias @lapack instead of | ||
# @liblapack (or @openblas) to install an operating-system-specific LAPACK | ||
# implementation. | ||
os_result = determine_os(repo_ctx) | ||
if os_result.error != None: | ||
fail(os_result.error) | ||
if os_result.is_ubuntu or os_result.is_manylinux: | ||
error = setup_pkg_config_repository(repo_ctx).error | ||
if error != None: | ||
fail(error) | ||
else: | ||
repo_ctx.symlink( | ||
Label("@drake//tools/workspace/liblapack:package-macos.BUILD.bazel"), # noqa | ||
"BUILD.bazel", | ||
) | ||
|
||
liblapack_repository = repository_rule( | ||
attrs = { | ||
"modname": attr.string(default = "lapack"), | ||
"licenses": attr.string_list(default = ["notice"]), # BSD-3-Clause | ||
# Explicitly specify transitive dependencies; these are needed when | ||
# using static LAPACK as in the PyPI wheel builds. | ||
"extra_linkopts": attr.string_list(default = ["-lblas", "-lgfortran"]), | ||
}, | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) | ||
def liblapack_repository(name): | ||
# Note that @liblapack is typically only available on Linux. | ||
# See drake/tools/workspace/lapack for the OS-specific selection policy. | ||
# Note that on Debian and Ubuntu in particular, @liblapack refers to the | ||
# implementation chosen by the Ubuntu alternatives system, which might be | ||
# one of any number of different vendor implementations. | ||
pkg_config_repository( | ||
name = name, | ||
licenses = ["notice"], # BSD-3-Clause | ||
modname = "lapack", | ||
extra_deps = [ | ||
"@gfortran//:runtime", | ||
"@libblas", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def liblz4_repository( | ||
name, | ||
licenses = ["notice"], # BSD-2-Clause | ||
modname = "liblz4", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/lz4/lib/pkgconfig", | ||
**kwargs): | ||
def liblz4_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["notice"], # BSD-2-Clause | ||
modname = "liblz4", | ||
extra_deprecation = "The @liblz4 external is deprecated in Drake's WORKSPACE and will be removed on or after 2024-01-01.", # noqa | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def liblzma_repository( | ||
name, | ||
licenses = ["unencumbered"], # Public-Domain | ||
modname = "liblzma", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/xz/lib/pkgconfig", | ||
**kwargs): | ||
def liblzma_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["unencumbered"], # Public-Domain | ||
modname = "liblzma", | ||
extra_deprecation = "The @liblzma external is deprecated in Drake's WORKSPACE and will be removed on or after 2024-01-01.", # noqa | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def libpng_repository( | ||
name, | ||
licenses = ["notice"], # Libpng | ||
modname = "libpng", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/libpng/lib/pkgconfig", | ||
**kwargs): | ||
def libpng_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["notice"], # Libpng | ||
modname = "libpng", | ||
extra_deprecation = "The @libpng external is deprecated in Drake's WORKSPACE and will be removed on or after 2024-02-01.", # noqa | ||
**kwargs | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,9 @@ | ||
load("//tools/workspace:pkg_config.bzl", "pkg_config_repository") | ||
|
||
def libtiff_repository( | ||
name, | ||
licenses = ["notice"], # Libtiff | ||
modname = "libtiff-4", | ||
pkg_config_paths = [], | ||
homebrew_subdir = "opt/libtiff/lib/pkgconfig", | ||
**kwargs): | ||
def libtiff_repository(name): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
licenses = ["notice"], # Libtiff | ||
modname = "libtiff-4", | ||
extra_deprecation = "The @libtiff external is deprecated in Drake's WORKSPACE and will be removed on or after 2024-02-01.", # noqa | ||
**kwargs | ||
) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.