Skip to content

Commit

Permalink
chore: add Bazel BUILD file
Browse files Browse the repository at this point in the history
This allows users of the Bazel build tool https://bazel.build to build zopfli
as a library dependency or a binary within their Bazel workspace.
  • Loading branch information
alexeagle committed Jun 26, 2023
1 parent 831773b commit 6e4b451
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.2.0
22 changes: 22 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cc_library(
# Named to produce "libzopfli.{a,so}"
# avoiding https://github.com/bazelbuild/bazel-central-registry/issues/716
name = "zopfli",
srcs = glob(["src/zopfli/*.c"], exclude = ["**/*_bin.c"]),
hdrs = glob(["src/zopfli/*.h"]),
# From the README:
# Build instructions:
linkopts = ["-lm"],
strip_include_prefix = "src/",
visibility = ["//visibility:public"],
)

cc_binary(
name = "bin",
srcs = ["src/zopfli/zopfli_bin.c"],
# To build zopfli, compile all .c source files under src/zopfli to a single binary
# with C, and link to the standard C math library, e.g.:
# gcc src/zopfli/*.c -O2 -W -Wall -Wextra -Wno-unused-function -ansi -pedantic -lm -o zopfli
copts = ["-O2", "-W", "-Wall", "-Wextra", "-Wno-unused-function", "-ansi", "-pedantic"],
deps = [":zopfli"],
)
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"Bazel module declaration"
module(
name = "zopfli",
version = "1.0.3",
)
1 change: 1 addition & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker that this is the root of a Bazel workspace

0 comments on commit 6e4b451

Please sign in to comment.