Skip to content

Commit

Permalink
Add libyaml module definition (#1104)
Browse files Browse the repository at this point in the history
* Add libyaml module definition

* fixup

* s/yaml/libyaml/

* add bazel matrix

* add (no) maintainers

* fix config_h template

* Fix to use defines instead of template

as that's not available in the release archive (only in source)

* Fix MODULE.bazel

* not sure what's up with windows, leave it out for now

---------

Co-authored-by: Laurenz <git@laure.nz>
  • Loading branch information
jondo2010 and lalten committed Jan 29, 2024
1 parent ebf82d1 commit f3e29bd
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/libyaml/0.2.5/MODULE.bazel
@@ -0,0 +1,6 @@
module(
name = "libyaml",
version = "0.2.5",
compatibility_level = 1,
)
bazel_dep(name = "rules_cc", version = "0.0.9")
32 changes: 32 additions & 0 deletions modules/libyaml/0.2.5/patches/add_build_file.patch
@@ -0,0 +1,32 @@
--- /dev/null
+++ BUILD.bazel
@@ -0,0 +1,29 @@
+""" Builds libyaml.
+"""
+
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "libyaml",
+ srcs = [
+ "src/api.c",
+ "src/dumper.c",
+ "src/emitter.c",
+ "src/loader.c",
+ "src/parser.c",
+ "src/reader.c",
+ "src/scanner.c",
+ "src/writer.c",
+ "src/yaml_private.h",
+ ],
+ hdrs = ["include/yaml.h"],
+ copts = ["-w"],
+ includes = ["include"],
+ local_defines = [
+ "YAML_VERSION_MAJOR=0",
+ "YAML_VERSION_MINOR=2",
+ "YAML_VERSION_PATCH=5",
+ 'YAML_VERSION_STRING=\\"0.2.5\\"',
+ ],
+ visibility = ["//visibility:public"],
+)
9 changes: 9 additions & 0 deletions modules/libyaml/0.2.5/patches/module_dot_bazel.patch
@@ -0,0 +1,9 @@
--- /dev/null
+++ MODULE.bazel
@@ -0,0 +1,6 @@
+module(
+ name = "libyaml",
+ version = "0.2.5",
+ compatibility_level = 1,
+)
+bazel_dep(name = "rules_cc", version = "0.0.9")
14 changes: 14 additions & 0 deletions modules/libyaml/0.2.5/presubmit.yml
@@ -0,0 +1,14 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos
- macos_arm64
bazel: [6.x, 7.x]
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- '@libyaml'
10 changes: 10 additions & 0 deletions modules/libyaml/0.2.5/source.json
@@ -0,0 +1,10 @@
{
"url": "https://github.com/yaml/libyaml/releases/download/0.2.5/yaml-0.2.5.tar.gz",
"integrity": "sha256-xkKum3X+4SCy2WxxJTi9LPKDIo0jN98s8piOPAJnjvQ=",
"strip_prefix": "yaml-0.2.5",
"patches": {
"add_build_file.patch": "sha256-/v4tc0vcSCT1ztwhNQoCSvt/YuDUWJ8uQUfr6cAk51w=",
"module_dot_bazel.patch": "sha256-nafHcADd1Yx3bXwUrNemoevJPRtRAWyUtxGmOg4QHs8="
},
"patch_strip": 0
}
16 changes: 16 additions & 0 deletions modules/libyaml/metadata.json
@@ -0,0 +1,16 @@
{
"homepage": "https://github.com/yaml/libyaml",
"maintainers": [
{
"email": "bcr-maintainers@bazel.build",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:yaml/libyaml"
],
"versions": [
"0.2.5"
],
"yanked_versions": {}
}

0 comments on commit f3e29bd

Please sign in to comment.