edid-decode: build: add support for building with meson
Subsystems (3)
PATCH v3 1/1 edid-decode: build: add support for building with meson
This also removes the old Makefile based build-system.
The immediate reason for adding support for meson is that this allows us to include edid-decode as a subproject in libdisplay-info.
v3:
* Declare a meson variable for the executable to make it possible to get it via subproject.get_variable()
v2:
* Remove the make build-system
* Adjust the README on how to build/install with meson
* Fix installing for the wasm-build
Signed-off-by Sebastian Wick <[email protected]>
--- Makefile | 50 --------------------------- README | 28 +++++++++------ emscripten/wasm-crossfile.txt | 14 ++++++++ meson.build | 65 +++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 61 deletions(-) delete mode 100644 Makefile create mode 100644 emscripten/wasm-crossfile.txt create mode 100644 meson.build
Makefile deleted +0 -50
@@ -1,50 +0,0 @@ -ifeq ($(OS),Windows_NT) - bindir ?= /usr/bin - mandir ?= /usr/share/man -else - UNAME_S := $(shell uname -s) - ifeq ($(UNAME_S),Darwin) - bindir ?= /usr/local/sbin - mandir ?= /usr/local/share/man - else - bindir ?= /usr/bin - mandir ?= /usr/share/man - endif -endif - -EMXX ?= em++ - -SOURCES = $(wildcard *.cpp) -OBJECTS := $(patsubst %.cpp, %.o, $(SOURCES)) -EMOBJECTS := $(patsubst %.cpp, emscripten/%.o, $(SOURCES)) - -WARN_FLAGS = -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wimplicit-fallthrough - -all: edid-decode - -sha = -DSHA=$(shell if test -d .git ; then git rev-parse --short=12 HEAD ; fi) -date = -DDATE=$(shell if test -d .git ; then TZ=UTC git show --quiet --date='format-local:"%F %T"' --format='%cd'; fi) - -edid-decode: $(OBJECTS) - $(CXX) $(LDFLAGS) -g -o $@ $(OBJECTS) -lm - -edid-decode.js: emscripten/edid-decode.js - -emscripten/edid-decode.js: $(EMOBJECTS) - $(EMXX) $(LDFLAGS) -s EXPORTED_FUNCTIONS='["_parse_edid"]' -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -o $@ $(EMOBJECTS) -lm - -%.o: %.cpp edid-decode.h oui.h Makefile - $(CXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) -g $(sha) $(date) -o $@ -c $< - -emscripten/%.o: %.cpp edid-decode.h oui.h Makefile - $(EMXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) $(sha) $(date) -o $@ -c $< - -clean: - rm -f *.o emscripten/*.o - rm -f edid-decode emscripten/edid-decode.js emscripten/edid-decode.wasm - -install: - mkdir -p $(DESTDIR)$(bindir) - install -m 0755 edid-decode $(DESTDIR)$(bindir) - mkdir -p $(DESTDIR)$(mandir)/man1 - install -m 0644 edid-decode.1 $(DESTDIR)$(mandir)/man1
README +17 -11
@@ -6,8 +6,9 @@ To build this do: git clone git://linuxtv.org/edid-decode.git cd edid-decode -make -make install +meson setup _build +meson compile -C _build +meson install -C _build Patches and bug reports can be sent to the [email protected] mailinglist (see https://www.linuxtv.org/lists.php). Please make sure
@@ -46,15 +47,20 @@ https://hverkuil.home.xs4all.nl/edid-decode/edid-decode.html This is updated regularly with the latest edid-decode. It uses emscripten and the html file is maintained in the emscripten directory of edid-decode. -To build edid-decode.js/wasm run 'make edid-decode.js'. This assumes -that emscripten is installed, of course. - -You can use the konqueror browser to run it locally: - - konqueror emscripten/edid-decode.html - -For other browsers you need to serve the files using a local webserver. -See also https://emscripten.org/docs/getting_started/Tutorial.html +To build it, set the project up using the provided crossfile: + + meson setup _build-wasm \ + --cross-file ./emscripten/wasm-crossfile.txt \ + --prefix=$(pwd)/_install-wasm + meson install _build-wasm + # serve the files using a local webserver + cd _install-wasm/bin + python3 -m http.server + +This assumes that emscripten is installed, of course. The location of the +toolchain can be adjusted in emscripten/wasm-crossfile.txt. +See also https://emscripten.org/docs/getting_started/Tutorial.html and +https://mesonbuild.com/Cross-compilation.html. You can find a very large collection of EDIDs here: https://github.com/linuxhw/EDID
emscripten/wasm-crossfile.txt new file +14 -0
@@ -0,0 +1,14 @@ +[binaries] +c = '/usr/lib/emscripten/emcc' +cpp = '/usr/lib/emscripten/em++' +ar = '/usr/lib/emscripten/emar' +strip = '/usr/lib/emscripten/emstrip' + +[built-in options] +default_library = 'static' + +[host_machine] +system = 'emscripten' +cpu_family = 'wasm32' +cpu = 'wasm32' +endian = 'little'
meson.build new file +65 -0
66 lines not on this page · raw message
Signature · 1 line
2.44.0