This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: build: add support for building with meson
Author:  Sebastian Wick <sebastian.w...@redhat.com>
Date:    Tue Apr 2 22:13:47 2024 +0200

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 <sebastian.w...@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 Makefile                      | 50 ---------------------------------
 README                        | 28 +++++++++++--------
 emscripten/wasm-crossfile.txt | 14 ++++++++++
 meson.build                   | 65 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+), 61 deletions(-)

---

diff --git a/Makefile b/Makefile
deleted file mode 100644
index 375fedb8fe25..000000000000
diff --git a/README b/README
index 4c2b7fe87a2e..bf4e66870503 100644
--- a/README
+++ b/README
@@ -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 linux-me...@vger.kernel.org
 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
diff --git a/emscripten/wasm-crossfile.txt b/emscripten/wasm-crossfile.txt
new file mode 100644
index 000000000000..a41f46ca2ede
--- /dev/null
+++ b/emscripten/wasm-crossfile.txt
@@ -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'
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 000000000000..ca5765276bc5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,65 @@
+project(
+       'edid-decode',
+       'cpp',
+)
+
+edid_decode_args = [
+       '-Wno-missing-field-initializers',
+       '-Wno-unused-parameter',
+       '-Wimplicit-fallthrough',
+]
+edid_decode_link_args = []
+
+git = find_program('git', native: true, required: false)
+if git.found()
+       git_commit = run_command(
+               [git, 'rev-parse', '--short=12', 'HEAD'],
+               check: false,
+       )
+       git_date = run_command(
+               [git, 'show', '--quiet', '--date=format-local:%F %T', 
'--format=%cd'],
+               env: {'TZ': 'UTC'},
+               check: false,
+       )
+
+       if git_commit.returncode() == 0
+               edid_decode_args += ['-DSHA=' + git_commit.stdout().strip()]
+       endif
+       if git_date.returncode() == 0
+               edid_decode_args += ['-DDATE=' + git_date.stdout().strip()]
+       endif
+endif
+
+if target_machine.system() == 'emscripten'
+       edid_decode_link_args += [
+               '-sEXPORTED_FUNCTIONS=_parse_edid',
+               '-sEXPORTED_RUNTIME_METHODS=ccall,cwrap'
+       ]
+
+       fs = import('fs')
+       foreach filename : ['edid-decode.html', 'edid-decode.ico']
+               fs.copyfile(
+                       'emscripten' / filename,
+                       install: true,
+                       install_dir: 'bin',
+               )
+       endforeach
+endif
+
+edid_decode = executable(
+       'edid-decode',
+       'calc-gtf-cvt.cpp',
+       'calc-ovt.cpp',
+       'edid-decode.cpp',
+       'parse-base-block.cpp',
+       'parse-cta-block.cpp',
+       'parse-di-ext-block.cpp',
+       'parse-displayid-block.cpp',
+       'parse-ls-ext-block.cpp',
+       'parse-vtb-ext-block.cpp',
+       cpp_args : edid_decode_args,
+       link_args: edid_decode_link_args,
+       install : true,
+)
+
+install_man('edid-decode.1')
\ No newline at end of file

Reply via email to