Skip to content

rapidyaml: Add optional static linking via musl #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: rapidyaml
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/rapidyaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: rapidyaml

defaults:
run:
shell: bash -xeo pipefail {0}
'on':
workflow_dispatch: null
push:
branches:
- main
pull_request:

jobs:

# check that the spec'ed version of rapidyaml passes its own tests
ryml:
runs-on: ubuntu-24.04
if: always()
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- bt: Debug
- bt: Release
steps:
- name: checkout (action)
uses: actions/checkout@v4
with: {submodules: recursive, fetch-depth: 0} # use fetch-depth to ensure all tags are fetched
- name: checkout rapidyaml
run: |
cd rapidyaml/native
make rapidyaml
- name: configure
run: |
cd rapidyaml/native/rapidyaml
cmake -B build -D CMAKE_BUILD_TYPE=${{matrix.bt}} -D RYML_BUILD_TESTS=ON
- name: build
run: |
cd rapidyaml/native/rapidyaml
cmake --build build --target ryml-test-build --parallel --verbose
- name: run tests
run: |
cd rapidyaml/native/rapidyaml
cmake --build build --target ryml-test-run

# run the c++ tests, also in Debug to test with assertions
cpp:
runs-on: ubuntu-24.04
if: always()
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- {bt: Debug, musl: 0}
- {bt: Debug, musl: 1}
- {bt: Release, musl: 0}
- {bt: Release, musl: 1}
env:
MKOPTS: RAPIDYAML_BUILD_TYPE=${{matrix.bt}} RAPIDYAML_MUSL=${{matrix.musl}}
steps:
- name: checkout (action)
uses: actions/checkout@v4
with: {submodules: recursive, fetch-depth: 0} # use fetch-depth to ensure all tags are fetched
- name: check jni header up to date
run: make -C rapidyaml/native -B jni jnicheck
- name: get rapidyaml
run: make -C rapidyaml/native rapidyaml
- name: run c++ tests, static -----------------------------
run: echo
- name: cfg c++, static
run: $MKOPTS make -C rapidyaml/native cfg-static
- name: build c++ tests, static
run: $MKOPTS make -C rapidyaml/native build-static
- name: run c++ tests, static
run: $MKOPTS make -C rapidyaml/native test-static
- name: run c++ tests, static with timing
run: $MKOPTS make -C rapidyaml/native test-static-timing
- name: run c++ tests, shared -----------------------------
run: echo
- name: cfg c++, shared
run: $MKOPTS make -C rapidyaml/native cfg-shared
- name: build c++ tests, shared
run: $MKOPTS make -C rapidyaml/native build-shared
- name: run c++ tests, shared
run: $MKOPTS make -C rapidyaml/native test-shared
- name: run c++ tests, shared with timing
run: $MKOPTS make -C rapidyaml/native test-shared-timing

# run the java tests, also in Debug to test with assertions
java:
runs-on: ubuntu-24.04
if: always()
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- {bt: Debug, musl: 0}
- {bt: Debug, musl: 1}
- {bt: Release, musl: 0}
- {bt: Release, musl: 1}
env:
MKOPTS: RAPIDYAML_BUILD_TYPE=${{matrix.bt}} RAPIDYAML_MUSL=${{matrix.musl}}
steps:
- name: checkout (action)
uses: actions/checkout@v4
with: {submodules: recursive, fetch-depth: 0} # use fetch-depth to ensure all tags are fetched
- name: build lib
run: $MKOPTS make -C rapidyaml build
- name: build jar
run: $MKOPTS make -C rapidyaml jar
- name: install
run: $MKOPTS make -C rapidyaml install
- name: run java tests
run: $MKOPTS make -C rapidyaml test
49 changes: 49 additions & 0 deletions .github/workflows/ys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ys

defaults:
run:
shell: bash -xeo pipefail {0}
'on':
workflow_dispatch: null
push:
branches:
- main
pull_request:

jobs:

# run ys tests, also in Debug to test with assertions
ys:
name: ys/${{matrix.ysparser}}/${{matrix.bt}}
runs-on: ubuntu-24.04
if: always()
continue-on-error: false
strategy:
fail-fast: false
matrix:
include:
- {v: 1, ysparser: snake}
- {v: 1, ysparser: ryml, bt: Debug}
- {v: 1, ysparser: ryml, bt: Release}
steps:
- name: checkout (action)
uses: actions/checkout@v4
with: {submodules: recursive, fetch-depth: 0} # use fetch-depth to ensure all tags are fetched
- name: run core tests
run: |
. .profile
RAPIDYAML_BUILD_TYPE=${{matrix.bt}} \
YS_PARSER=${{matrix.ysparser}} \
make test-core v=${{matrix.v}}
- name: run ys tests
run: |
. .profile
RAPIDYAML_BUILD_TYPE=${{matrix.bt}} \
YS_PARSER=${{matrix.ysparser}} \
make -C ys test-run v=${{matrix.v}}
- name: run ys tests ?
run: |
. .profile
RAPIDYAML_BUILD_TYPE=${{matrix.bt}} \
YS_PARSER=${{matrix.ysparser}} \
make test-ys v=${{matrix.v}}
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ BINDINGS := \
rust \

DIRS := \
rapidyaml \
core \
libyamlscript \
$(BINDINGS) \
ys \

BUILD_DIRS := \
rapidyaml \
libyamlscript \
go \
nodejs \
Expand Down Expand Up @@ -293,6 +295,9 @@ sysclean: realclean
ifeq (ingy,$(USER))
$(RM) -r $(HOME)/.m2
endif
ifeq (jpmag,$(USER))
$(RM) -r $(HOME)/.m2
endif

$(DOCKER_BUILD):
docker-build: $(DOCKER_BUILD)
Expand Down
7 changes: 7 additions & 0 deletions common/java.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
export JAVA_HOME := $(GRAALVM_HOME)
export PATH := $(JAVA_HOME)/bin:$(PATH)

MVN ?= mvn
JAR ?= $(GRAALVM_HOME)/bin/jar
JAVAC ?= $(GRAALVM_HOME)/bin/javac

YAMLSCRIPT_JAVA_INSTALLED := \
$(MAVEN_REPOSITORY)/org/yamlscript/yamlscript/maven-metadata-local.xml

Expand All @@ -31,3 +35,6 @@ endif

$(YAMLSCRIPT_JAVA_INSTALLED): $(YAMLSCRIPT_JAVA_SRC)
$(MAKE) -C $(ROOT)/java install

$(JAVAC): $(GRAALVM_INSTALLED)
$(JAR): $(GRAALVM_INSTALLED)
43 changes: 40 additions & 3 deletions common/vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ ifneq (,$(findstring linux,$(ostype)))
GCC := gcc -std=gnu99 -fPIC -shared
SO := so
DY :=
DOTLIB := a
else ifneq (,$(findstring darwin,$(ostype)))
IS_MACOS := true
GCC := gcc -dynamiclib
SO := dylib
DY := DY
DOTLIB := a
else
DOTLIB := lib
$(error Unsupported OSTYPE: $(ostype))
endif

Expand Down Expand Up @@ -83,9 +86,8 @@ CURL := $(shell command -v curl)
TIME := time -p

LIBYAMLSCRIPT_DIR := $(ROOT)/libyamlscript/lib
LIBRARY_PATH := $(LIBYAMLSCRIPT_DIR)
export $(DY)LD_LIBRARY_PATH := $(LIBRARY_PATH)
export LD_LIBRARY_PATH := $(LIBRARY_PATH)
LIBRARY_PATH := $(LIBYAMLSCRIPT_DIR):$(ROOT)/rapidyaml/native
export $(DY)LD_LIBRARY_PATH := $(LIBRARY_PATH):$(ROOT)/rapidyaml/native
LIBYAMLSCRIPT_SO_NAME := $(LIBYAMLSCRIPT_DIR)/libyamlscript
LIBYAMLSCRIPT_SO_FQNP := $(LIBYAMLSCRIPT_SO_NAME).$(SO).$(YS_VERSION)
LIBYAMLSCRIPT_SO_BASE := $(LIBYAMLSCRIPT_DIR)/libyamlscript.$(SO)
Expand Down Expand Up @@ -221,6 +223,41 @@ RELEASE_LYS_NAME := libyamlscript-$(YS_VERSION)-$(GRAALVM_ARCH)
RELEASE_LYS_TAR := $(RELEASE_LYS_NAME).tar.xz


#------------------------------------------------------------------------------
# RapidYAML variables:
#------------------------------------------------------------------------------
RAPIDYAML := $(ROOT)/rapidyaml

RAPIDYAML_VERSION := 0.8.0
#RAPIDYAML_TAG ?= v$(RAPIDYAML_VERSION)
RAPIDYAML_TAG ?= 8c37616378aefd376690a19459c31a56ce596b5e
RAPIDYAML_REPO := https://github.com/biojppm/rapidyaml
RAPIDYAML_BUILD_TYPE ?= Release
RAPIDYAML_DBG ?= 0
RAPIDYAML_TIMED ?= 1
RAPIDYAML_MUSL ?= 1
RAPIDYAML_JAVA := \
$(ROOT)/rapidyaml/src/main/java/org/rapidyaml/Rapidyaml.java \
$(ROOT)/rapidyaml/src/main/java/org/rapidyaml/Evt.java \
$(ROOT)/rapidyaml/src/main/java/org/rapidyaml/YamlParseErrorException.java
RAPIDYAML_JNI_H := $(ROOT)/rapidyaml/native/org_rapidyaml_Rapidyaml.h
RAPIDYAML_SO := $(ROOT)/rapidyaml/native/librapidyaml.$(RAPIDYAML_VERSION).$(SO)
RAPIDYAML_LIB := $(ROOT)/rapidyaml/native/librapidyaml.$(DOTLIB)
RAPIDYAML_JAR := $(ROOT)/rapidyaml/target/rapidyaml-$(RAPIDYAML_VERSION).jar
RAPIDYAML_INSTALLED_DIR := \
$(MAVEN_REPOSITORY)/org/rapidyaml/rapidyaml/$(RAPIDYAML_VERSION)/
RAPIDYAML_INSTALLED := \
$(RAPIDYAML_INSTALLED_DIR)/rapidyaml-$(RAPIDYAML_VERSION).jar


#------------------------------------------------------------------------------
# Programs
#------------------------------------------------------------------------------

GIT ?= git
CMAKE ?= cmake


#------------------------------------------------------------------------------
default::

Expand Down
8 changes: 7 additions & 1 deletion core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ include $(COMMON)/docker.mk
export PATH := $(ROOT)/core/bin:$(PATH)

#------------------------------------------------------------------------------
build::
build:: $(RAPIDYAML_SO) $(RAPIDYAML_INSTALLED)

install test:: $(LEIN) build
$< $@

$(RAPIDYAML_SO):
$(MAKE) -C $(ROOT)/rapidyaml build

$(RAPIDYAML_INSTALLED):
$(MAKE) -C $(ROOT)/rapidyaml install

Dockerfile:: $(COMMON) Makefile
cat \
$</docker-from-ubuntu.dockerfile \
Expand Down
1 change: 1 addition & 0 deletions core/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
org.clojure/data.json {:mvn/version "2.4.0"},
clj-commons/clj-yaml {:mvn/version "1.0.27"},
org.flatland/ordered {:mvn/version "1.15.11"},
org.rapidyaml/rapidyaml {:mvn/version "0.8.0"},
org.snakeyaml/snakeyaml-engine {:mvn/version "2.7"},
babashka/babashka.pods {:mvn/version "0.2.0"},
babashka/fs {:mvn/version "0.5.20"},
Expand Down
1 change: 1 addition & 0 deletions core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[org.clojure/data.json "2.4.0"]
[clj-commons/clj-yaml "1.0.27"]
[org.flatland/ordered "1.15.11"]
[org.rapidyaml/rapidyaml "0.8.0"]
[org.snakeyaml/snakeyaml-engine "2.7"]
[babashka/babashka.pods "0.2.0"]
[babashka/fs "0.5.20"]
Expand Down
Loading
Loading