From 6e87b673ec6bf4f9a1597a18b43401df76cb5d8d Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 3 Aug 2021 09:15:10 -0400 Subject: [PATCH 1/4] test: add freebsd to the vagrantfile for testing Related to #2298 --- Vagrantfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 50d95c35af..282574b96a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -24,6 +24,9 @@ boxen << Box.new("bionic32", "mkorenkov/ubuntu-bionic32", <<~EOF) apt-get install -y libxslt-dev libxml2-dev pkg-config apt-get install -y ruby ruby-dev bundler git EOF +boxen << Box.new("freebsd", "freebsd/FreeBSD-13.0-CURRENT", <<~EOF) + pkg install rbenv ruby-build +EOF Vagrant.configure("2") do |config| boxen.each do |box| From 66dace2071a3b9a0d189de269d8c4bcd1cae9674 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 3 Aug 2021 09:40:28 -0400 Subject: [PATCH 2/4] ci: add coverage for freebsd --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bc40ea6bd..df9267bae4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -272,3 +272,24 @@ jobs: bundler-cache: true - run: bundle exec rake compile - run: bundle exec rake test + + bsd: + needs: ["basic"] + strategy: + fail-fast: false + matrix: + sys: ["enable", "disable"] + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - uses: vmactions/freebsd-vm@v0.1.5 + with: + usesh: true + prepare: pkg install -y ruby devel/ruby-gems pkgconf libxml2 libxslt + run: | + gem install bundler + bundle install --local || bundle install + bundle exec rake compile -- --${{matrix.sys}}-system-libraries + bundle exec rake test From 2e7ab22d8ad455019920fe4e84449930c5368621 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 3 Aug 2021 09:15:39 -0400 Subject: [PATCH 3/4] ext(gumbo): Makefile variable override is not necessary since 5c6f7c1 when we started passing CFLAGS, et al through environment variables instead of through the make command line. Although this wasn't doing any harm on gnu-based systems, `override` is a gnu-ism and we need to support builds on bsd systems. Related to #2298 --- gumbo-parser/src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gumbo-parser/src/Makefile b/gumbo-parser/src/Makefile index 3a50bc96fa..0594e0892c 100644 --- a/gumbo-parser/src/Makefile +++ b/gumbo-parser/src/Makefile @@ -2,7 +2,7 @@ # to enable a mini_portile2 recipe to build the gumbo parser .PHONY: clean -override CFLAGS += -std=c99 -Wall +CFLAGS += -std=c99 -Wall # allow the ENV var to override this RANLIB ?= ranlib From 1159a9bb1e7f4fb31bfbbdbe70fc2a736bca8b5d Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 3 Aug 2021 09:16:44 -0400 Subject: [PATCH 4/4] ext(gumbo): avoid Gnu-isms in the Makefile The wildcard and patsubst functions, as well as $^, don't work in BSD make. Let's just inline everything to make it simple and portable. Related to #2298 --- gumbo-parser/src/Makefile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/gumbo-parser/src/Makefile b/gumbo-parser/src/Makefile index 0594e0892c..6bd4a18fbe 100644 --- a/gumbo-parser/src/Makefile +++ b/gumbo-parser/src/Makefile @@ -7,10 +7,27 @@ CFLAGS += -std=c99 -Wall # allow the ENV var to override this RANLIB ?= ranlib -gumbo_objs := $(patsubst %.c,%.o,$(wildcard *.c)) +gumbo_objs := \ + ascii.o \ + attribute.o \ + char_ref.o \ + error.o \ + foreign_attrs.o \ + parser.o \ + string_buffer.o \ + string_piece.o \ + svg_attrs.o \ + svg_tags.o \ + tag.o \ + tag_lookup.o \ + token_buffer.o \ + tokenizer.o \ + utf8.o \ + util.o \ + vector.o libgumbo.a: $(gumbo_objs) - $(AR) $(ARFLAGS) $@ $^ + $(AR) $(ARFLAGS) $@ $(gumbo_objs) - ($(RANLIB) $@ || true) >/dev/null 2>&1 clean: