diff --git a/libgimp/meson.build b/libgimp/meson.build index 8f0fffc8db..d379acb328 100644 --- a/libgimp/meson.build +++ b/libgimp/meson.build @@ -491,3 +491,36 @@ else ) endif endif + +if have_python + # Check .def files for Windows. + custom_target('check-def-files', + input: [ + '../libgimpbase/gimpbase.def', + '../libgimpcolor/gimpcolor.def', + '../libgimpconfig/gimpconfig.def', + '../libgimp/gimp.def', + '../libgimp/gimpui.def', + '../libgimpmath/gimpmath.def', + '../libgimpmodule/gimpmodule.def', + '../libgimpthumb/gimpthumb.def', + '../libgimpwidgets/gimpwidgets.def', + ], + depends: [ + libgimpbase, + libgimpcolor, + libgimpconfig, + libgimp, + libgimpui, + libgimpmath, + libgimpmodule, + libgimpthumb, + libgimpwidgets + ], + output: [ 'check-def-files', ], + command: [ + python, meson.source_root() / 'tools' / 'defcheck.py', meson.source_root(), + ], + build_by_default: true, + ) +endif diff --git a/tools/defcheck.py b/tools/defcheck.py index 0f6571aa81..3eeaf3168f 100755 --- a/tools/defcheck.py +++ b/tools/defcheck.py @@ -84,8 +84,14 @@ for df in def_files: status, nm = subprocess.getstatusoutput ("nm --defined-only --extern-only " + libname) if status != 0: - print("trouble reading %s - has it been compiled?" % libname) - continue + libname_meson = path.join(directory, "lib" + basename + "-*.so") + print("trouble reading {} - trying {}".format(libname, libname_meson)) + status, nm = subprocess.getstatusoutput ("nm --defined-only --extern-only " + + libname_meson) + if status != 0: + print("trouble reading {} - has it been compiled?".format(libname_meson)) + have_errors = -1 + continue nmsymbols = nm.split()[2::3] nmsymbols = [s for s in nmsymbols if s[0] != '_']