Get linux libusb through bazel
Change-Id: I6e67412115b1ac83951ad1ab93b9dc5c28438048
diff --git a/WORKSPACE b/WORKSPACE
index f256eb3..cc93fcb 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -16,6 +16,10 @@
"//debian:pandoc.bzl",
pandoc_debs = "files",
)
+load(
+ "//debian:libusb.bzl",
+ libusb_debs = "files",
+)
load("//debian:packages.bzl", "generate_repositories_for_debs")
generate_repositories_for_debs(python_debs)
@@ -26,6 +30,8 @@
generate_repositories_for_debs(pandoc_debs)
+generate_repositories_for_debs(libusb_debs)
+
new_http_archive(
name = "python_repo",
build_file = "debian/python.BUILD",
@@ -145,21 +151,6 @@
url = "http://frc971.org/Build-Dependencies/empty.tar.gz",
)
-new_local_repository(
- name = "libusb",
- build_file = "debian/libusb.BUILD",
- path = "/usr",
-)
-
-# Created by combining libusb-1.0-0_2%3a1.0.19-1_amd64,
-# libusb-1.0-0-dev_2%3a1.0.19-1, and libudev1_215-17+deb8u7.
-new_http_archive(
- name = "libusb_1_0",
- build_file = "debian/libusb-1.0.BUILD",
- sha256 = "12acb30faacd10e9aa7f3a5e074701e167ce9bbd45694db37d13d55de5398816",
- url = "http://frc971.org/Build-Dependencies/libusb-1.0-1.0.19.tar.xz",
-)
-
# Recompressed from libusb-1.0.21.7z.
http_file(
name = "libusb_1_0_windows",
@@ -197,3 +188,10 @@
sha256 = "9f7a7adb3974a1f14715054c349ff3edc2909e920dbe3438fca437a83845f3c4",
url = "http://frc971.org/Build-Dependencies/pandoc.tar.gz",
)
+
+new_http_archive(
+ name = "libusb",
+ build_file = "debian/libusb.BUILD",
+ sha256 = "3ca5cc2d317226f6646866ff9e8c443db3b0f6c82f828e800240982727531590",
+ url = "http://frc971.org/Build-Dependencies/libusb.tar.gz",
+)
diff --git a/debian/BUILD b/debian/BUILD
index a571b2d..f1f38f4 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -16,6 +16,10 @@
":pandoc.bzl",
pandoc_debs = "files",
)
+load(
+ ":libusb.bzl",
+ libusb_debs = "files",
+)
load("//debian:packages.bzl", "download_packages", "generate_deb_tarball")
py_binary(
@@ -73,6 +77,16 @@
],
)
+download_packages(
+ name = "download_libusb_deps",
+ packages = [
+ "libusb-0.1-4",
+ "libusb-1.0-0",
+ "libusb-1.0-0-dev",
+ "libusb-dev",
+ ],
+)
+
generate_deb_tarball(
name = "python",
files = python_debs,
@@ -92,3 +106,8 @@
name = "pandoc",
files = pandoc_debs,
)
+
+generate_deb_tarball(
+ name = "libusb",
+ files = libusb_debs,
+)
diff --git a/debian/libusb-1.0.BUILD b/debian/libusb-1.0.BUILD
deleted file mode 100644
index a307cec..0000000
--- a/debian/libusb-1.0.BUILD
+++ /dev/null
@@ -1,14 +0,0 @@
-cc_library(
- name = 'libusb_1_0',
- visibility = ['//visibility:public'],
- hdrs = [
- 'usr/include/libusb-1.0/libusb.h',
- ],
- srcs = [
- 'usr/lib/x86_64-linux-gnu/libusb-1.0.so',
- ],
- includes = [
- 'usr/include',
- ],
- restricted_to = ['@//tools:k8'],
-)
diff --git a/debian/libusb.BUILD b/debian/libusb.BUILD
index 3ccffe1..7c41058 100644
--- a/debian/libusb.BUILD
+++ b/debian/libusb.BUILD
@@ -1,13 +1,28 @@
cc_library(
- name = 'libusb',
- visibility = ['//visibility:public'],
- srcs = [
- 'lib/x86_64-linux-gnu/libusb.so',
- ],
- hdrs = [
- 'include/usb.h',
- ],
- includes = [
- 'include',
- ],
+ name = "libusb",
+ srcs = [
+ "usr/lib/x86_64-linux-gnu/libusb.so",
+ ],
+ hdrs = [
+ "usr/include/usb.h",
+ ],
+ includes = [
+ "usr/include",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "libusb_1_0",
+ srcs = [
+ "usr/lib/x86_64-linux-gnu/libusb-1.0.so",
+ ],
+ hdrs = [
+ "usr/include/libusb-1.0/libusb.h",
+ ],
+ includes = [
+ "usr/include",
+ ],
+ restricted_to = ["@//tools:k8"],
+ visibility = ["//visibility:public"],
)
diff --git a/debian/libusb.bzl b/debian/libusb.bzl
new file mode 100644
index 0000000..1bf64f5
--- /dev/null
+++ b/debian/libusb.bzl
@@ -0,0 +1,7 @@
+files = {
+ "libudev1_215-17+deb8u7_amd64.deb": "35cbd0325c5300e86d0bb5c5bf3a538635b78b56e503dc2f22826b2d53343fcd",
+ "libusb-0.1-4_0.1.12-25_amd64.deb": "18a028fec2fc1de8c24c85f53d6af2972f6688f2765a5e6202674da00179b573",
+ "libusb-1.0-0-dev_1.0.19-1_amd64.deb": "e68962767b1f134e910bcf85995c2a87f047a430c6688b06d5955feb6c56c1a1",
+ "libusb-1.0-0_1.0.19-1_amd64.deb": "c37c63f3496145484c93d10ba2ae3edf73ebb19164d477b0e5e96322bef9aa5d",
+ "libusb-dev_0.1.12-25_amd64.deb": "44db0da49d44e508c494367c1d90e5f7a711a2c7ab5e15c29c98caa8730e07b9",
+}
diff --git a/motors/pistol_grip/BUILD b/motors/pistol_grip/BUILD
index 6e6a428..0a24ba8 100644
--- a/motors/pistol_grip/BUILD
+++ b/motors/pistol_grip/BUILD
@@ -58,7 +58,7 @@
deps = [
# Don't add anything else here. :usb_forward_windows still has to build it
# without any other dependencies.
- "@libusb_1_0",
+ "@libusb//:libusb_1_0",
],
)