-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use pkg-config to find libjpeg and yaml-cpp (#13335)
- Loading branch information
1 parent
c80fb53
commit 29e09b2
Showing
7 changed files
with
149 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- python -*- | ||
|
||
licenses(["notice"]) # IJG | ||
|
||
cc_library( | ||
name = "libjpeg", | ||
hdrs = glob(["include/*.h"]), | ||
includes = ["include"], | ||
linkopts = [ | ||
"-L/usr/local/opt/jpeg/lib", | ||
"-Wl,-rpath,/usr/local/opt/jpeg/lib", | ||
"-ljpeg", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- python -*- | ||
|
||
licenses(["notice"]) # IJG | ||
|
||
cc_library( | ||
name = "libjpeg", | ||
hdrs = glob(["include/*.h"]), | ||
includes = ["include"], | ||
linkopts = [ | ||
"-L/usr/lib/x86_64-linux-gnu", | ||
"-ljpeg", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
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,40 @@ | ||
# -*- mode: python -*- | ||
# -*- python -*- | ||
|
||
load( | ||
"@drake//tools/workspace:pkg_config.bzl", | ||
"pkg_config_repository", | ||
) | ||
load("@drake//tools/workspace:os.bzl", "determine_os") | ||
|
||
def _impl(repository_ctx): | ||
os_result = determine_os(repository_ctx) | ||
|
||
if os_result.error != None: | ||
fail(os_result.error) | ||
|
||
def libjpeg_repository( | ||
name, | ||
licenses = ["notice"], # IJG | ||
modname = "libjpeg", | ||
pkg_config_paths = ["/usr/local/opt/libjpeg/lib/pkgconfig"], | ||
**kwargs): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
pkg_config_paths = pkg_config_paths, | ||
**kwargs | ||
) | ||
if os_result.is_macos: | ||
repository_ctx.symlink("/usr/local/opt/jpeg/include", "include") | ||
repository_ctx.symlink( | ||
Label("@drake//tools/workspace/libjpeg:package-macos.BUILD.bazel"), | ||
"BUILD.bazel", | ||
) | ||
elif os_result.is_ubuntu: | ||
for hdr in ["jerror.h", "jmorecfg.h", "jpegint.h", "jpeglib.h"]: | ||
repository_ctx.symlink( | ||
"/usr/include/{}".format(hdr), | ||
"include/{}".format(hdr), | ||
) | ||
repository_ctx.symlink( | ||
"/usr/include/x86_64-linux-gnu/jconfig.h", | ||
"include/jconfig.h", | ||
) | ||
repository_ctx.symlink( | ||
Label( | ||
"@drake//tools/workspace/libjpeg:package-ubuntu.BUILD.bazel", | ||
), | ||
"BUILD.bazel", | ||
) | ||
else: | ||
fail("Operating system is NOT supported", attr = os_result) | ||
|
||
libjpeg_repository = repository_rule( | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- python -*- | ||
|
||
licenses(["notice"]) # X11 | ||
|
||
cc_library( | ||
name = "yaml_cpp", | ||
hdrs = glob(["include/yaml-cpp/*.h"]), | ||
includes = ["include"], | ||
linkopts = [ | ||
"-L/usr/local/opt/yaml-cpp/lib", | ||
"-Wl,-rpath,/usr/local/opt/yaml-cpp/lib", | ||
"-lyaml-cpp", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- python -*- | ||
|
||
licenses(["notice"]) # X11 | ||
|
||
cc_library( | ||
name = "yaml_cpp", | ||
hdrs = glob(["include/yaml-cpp/*.h"]), | ||
includes = ["include"], | ||
linkopts = [ | ||
"-L/usr/lib/x86_64-linux-gnu", | ||
"-lyaml-cpp", | ||
], | ||
visibility = ["//visibility:public"], | ||
deps = ["@boost//:boost_headers"], | ||
) |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- python -*- | ||
|
||
licenses(["notice"]) # X11 | ||
|
||
cc_library( | ||
name = "yaml_cpp", | ||
hdrs = glob(["include/yaml-cpp/*.h"]), | ||
includes = ["include"], | ||
linkopts = [ | ||
"-L/usr/lib/x86_64-linux-gnu", | ||
"-lyaml-cpp", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
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,40 @@ | ||
# -*- mode: python -*- | ||
# -*- python -*- | ||
|
||
load( | ||
"@drake//tools/workspace:pkg_config.bzl", | ||
"pkg_config_repository", | ||
) | ||
load("@drake//tools/workspace:os.bzl", "determine_os") | ||
|
||
def _impl(repository_ctx): | ||
os_result = determine_os(repository_ctx) | ||
|
||
if os_result.error != None: | ||
fail(os_result.error) | ||
|
||
def yaml_cpp_repository( | ||
name, | ||
licenses = ["notice"], # X11 | ||
modname = "yaml-cpp", | ||
atleast_version = "0.5.2", | ||
extra_deps = ["@boost//:boost_headers"], | ||
pkg_config_paths = ["/usr/local/opt/yaml-cpp/lib/pkgconfig"], | ||
**kwargs): | ||
pkg_config_repository( | ||
name = name, | ||
licenses = licenses, | ||
modname = modname, | ||
atleast_version = atleast_version, | ||
extra_deps = extra_deps, | ||
pkg_config_paths = pkg_config_paths, | ||
**kwargs | ||
) | ||
if os_result.is_macos: | ||
repository_ctx.symlink( | ||
"/usr/local/opt/yaml-cpp/include/yaml-cpp", | ||
"include/yaml-cpp", | ||
) | ||
repository_ctx.symlink( | ||
Label( | ||
"@drake//tools/workspace/yaml_cpp:package-macos.BUILD.bazel", | ||
), | ||
"BUILD.bazel", | ||
) | ||
elif os_result.is_ubuntu: | ||
repository_ctx.symlink("/usr/include/yaml-cpp", "include/yaml-cpp") | ||
repository_ctx.symlink( | ||
Label( | ||
("@drake//tools/workspace/yaml_cpp" + | ||
":package-ubuntu-{}.BUILD.bazel").format( | ||
os_result.ubuntu_release, | ||
), | ||
), | ||
"BUILD.bazel", | ||
) | ||
else: | ||
fail("Operating system is NOT supported", attr = os_result) | ||
|
||
yaml_cpp_repository = repository_rule( | ||
local = True, | ||
configure = True, | ||
implementation = _impl, | ||
) |