[gimp] Issue #4291: meson: pdbgen not working.



commit 79615541d93ad7480d4e9507c2d831425de783cc
Author: Jehan <jehan girinstud io>
Date:   Sun Mar 27 22:07:32 2022 +0200

    Issue #4291: meson: pdbgen not working.
    
    The build now successfully build the PDB files into the source folder
    itself. Unfortunately it seems I can't get meson dependencies to work
    properly, once more! I added a "sources" argument to the relevant
    library() or static_library() but it still uses old versions to build
    these. E.g. if I add an error on purpose to a pdb file, the next build
    still passes, yet the second-next fails (as it should have before).
    
    Note that I even tested a declare_dependency() with just the "sources"
    arguments, because it says "sources to add to targets (or generated
    header files that should be built before sources including them are
    built)" (so I assume it means that it should be trigger a rebuild,
    otherwise it's useless) but it's just not working. I'll investigate
    more.
    
    Still going with this for now, because at least generating the PDB
    source was a big miss until now. But we should

 app/pdb/meson.build |  3 +++
 libgimp/meson.build |  3 +++
 meson.build         |  2 +-
 pdb/meson-pdbgen.sh | 15 +++++++++++++++
 pdb/meson.build     | 29 ++++++++++++++++-------------
 5 files changed, 38 insertions(+), 14 deletions(-)
---
diff --git a/app/pdb/meson.build b/app/pdb/meson.build
index 11ba6223c6..e73a1f37a3 100644
--- a/app/pdb/meson.build
+++ b/app/pdb/meson.build
@@ -80,4 +80,7 @@ libappinternalprocs = static_library('appinternalprocs',
   dependencies: [
     cairo, gegl, gdk_pixbuf,
   ],
+  sources: [
+    pdbgen
+  ],
 )
diff --git a/libgimp/meson.build b/libgimp/meson.build
index a5c14c7319..125a85a46a 100644
--- a/libgimp/meson.build
+++ b/libgimp/meson.build
@@ -298,6 +298,9 @@ libgimp = library('gimp-'+ gimp_api_version,
     drmingw,
     gtk3,
   ],
+  sources: [
+    pdbgen
+  ],
   c_args: [ '-DG_LOG_DOMAIN="LibGimp"', '-DGIMP_COMPILATION', ],
   link_with: [
     libgimpbase,
diff --git a/meson.build b/meson.build
index a69529ef07..58fe2e368b 100644
--- a/meson.build
+++ b/meson.build
@@ -1667,6 +1667,7 @@ endif
 # Tools
 subdir('libgimpbase')
 subdir('tools')
+subdir('pdb')
 
 # Translations
 subdir('po')
@@ -1700,7 +1701,6 @@ subdir('extensions')
 subdir('modules')
 subdir('plug-ins')
 subdir('app')
-subdir('pdb')
 subdir('app-tools')
 
 # Docs
diff --git a/pdb/meson-pdbgen.sh b/pdb/meson-pdbgen.sh
new file mode 100755
index 0000000000..b822b2f048
--- /dev/null
+++ b/pdb/meson-pdbgen.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+PERL="$1"
+top_srcdir="$2"
+top_builddir="$3"
+
+# Environment for the pdbgen.pl file.
+destdir=`cd "$top_srcdir" && pwd`
+export destdir
+builddir=`cd "$top_builddir" && pwd`
+export BUILD builddir
+
+cd "$top_srcdir"/pdb
+$PERL pdbgen.pl app lib
+echo `date` > $top_builddir/pdb/stamp-pdbgen
diff --git a/pdb/meson.build b/pdb/meson.build
index 9ed44cb901..0241912da2 100644
--- a/pdb/meson.build
+++ b/pdb/meson.build
@@ -63,11 +63,11 @@ endforeach
 
 
 enum_headers = [
-  gimpbaseenums,
-  appconfigenums,
-  appoperationsenums,
-  appcoreenums,
-  apppaintenums,
+  meson.source_root() + '/libgimpbase/gimpbaseenums.h',
+  meson.source_root() + '/libgimpconfig/gimpconfigenums.h',
+  meson.source_root() + '/app/operations/operations-enums.h',
+  meson.source_root() + '/app/core/core-enums.h',
+  meson.source_root() + '/app/paint/paint-enums.h'
 ]
 
 # Perl environment
@@ -82,7 +82,7 @@ perl_env = [
   'destdir='  + meson.build_root(),
   'builddir=' + meson.build_root(),
 ]
-perl= [
+perl_opts = [
   perl,
   '-I', perlbindir,
   '-I', perlsrcdir,
@@ -106,6 +106,8 @@ groups_pl = custom_target('groups.pl',
   capture: true,
 )
 
+pdbgen_run = find_program('meson-pdbgen.sh')
+
 if meson.version().version_compare('>=0.57.0')
   enums_pl = custom_target('enums.pl',
     input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
@@ -122,6 +124,7 @@ if meson.version().version_compare('>=0.57.0')
   pdbgen = custom_target('stamp-pdbgen',
     input : [
       files(
+        'meson-pdbgen.sh',
         'pdbgen.pl',
 
         'app.pl',
@@ -137,8 +140,7 @@ if meson.version().version_compare('>=0.57.0')
     output: [ 'stamp-pdbgen', ],
     env: perl_env,
     command: [
-      perl, '@INPUT0@',
-      'app', 'lib',
+      pdbgen_run, perl, meson.source_root(), meson.build_root()
     ],
   )
 
@@ -147,7 +149,7 @@ if meson.version().version_compare('>=0.57.0')
     output: [ 'stamp-enum-code', ],
     env: perl_env,
     command: [
-      perl, '@INPUT0@',
+      perl_opts, '@INPUT0@',
     ],
   )
 else
@@ -160,7 +162,7 @@ else
     input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
     output: [ 'enums.pl', ],
     command: [
-      env, perl_env, perl, '@INPUT0@',
+      env, perl_env, perl_opts, '@INPUT0@',
       enum_headers,
     ],
   )
@@ -168,6 +170,7 @@ else
   pdbgen = custom_target('stamp-pdbgen',
     input : [
       files(
+        'meson-pdbgen.sh',
         'pdbgen.pl',
 
         'app.pl',
@@ -182,16 +185,16 @@ else
     ],
     output: [ 'stamp-pdbgen', ],
     command: [
-      env, perl_env, perl, '@INPUT0@',
-      'app', 'lib',
+      env, perl_env, pdbgen_run, perl, meson.source_root(), meson.build_root()
     ],
   )
 
+
   stamp_enumcode = custom_target('stamp-enum-code',
     input : [ 'enumcode.pl', ],
     output: [ 'stamp-enum-code', ],
     command: [
-      env, perl_env, perl, '@INPUT0@',
+      env, perl_env, perl_opts, '@INPUT0@',
     ],
   )
 endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]