mirror of https://github.com/GNOME/gimp.git
libgimp, pdb: (meson) fix building of libgimp/gimpenums.h inside the source tree.
This was not working properly and needed some external build script as well as the stamp/bogus header trick like for other similar in-source generated code. In the same time, I get rid of old meson code which was meant for when using meson < 0.57.0 (since our requirement is now meson >= 0.59.0).
This commit is contained in:
parent
a40357a165
commit
1d16c1584f
|
@ -3,7 +3,7 @@
|
||||||
# Moreover it is generated in 2 steps, first with common mkenums
|
# Moreover it is generated in 2 steps, first with common mkenums
|
||||||
# arguments, then concatenating with a "tail" file.
|
# arguments, then concatenating with a "tail" file.
|
||||||
gimpenums_notail = custom_target('gimpenums.c.notail',
|
gimpenums_notail = custom_target('gimpenums.c.notail',
|
||||||
input : [ 'gimpenums.h', ],
|
input : [ 'gimpenums.h', stamp_enumcode],
|
||||||
output: [ 'gimpenums.c.notail', ],
|
output: [ 'gimpenums.c.notail', ],
|
||||||
command: [
|
command: [
|
||||||
gimp_mkenums,
|
gimp_mkenums,
|
||||||
|
@ -14,6 +14,7 @@ gimpenums_notail = custom_target('gimpenums.c.notail',
|
||||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||||
+ '#include "libgimpbase/gimpbase-private.h"\n'
|
+ '#include "libgimpbase/gimpbase-private.h"\n'
|
||||||
+ '#include "libgimpconfig/gimpconfigenums.h"\n'
|
+ '#include "libgimpconfig/gimpconfigenums.h"\n'
|
||||||
|
+ '#include "pdb/stamp-enumcode.h"\n'
|
||||||
+ '#include "gimpenums.h"\n',
|
+ '#include "gimpenums.h"\n',
|
||||||
'--fprod',
|
'--fprod',
|
||||||
'/* enumerations from "@basename@" */',
|
'/* enumerations from "@basename@" */',
|
||||||
|
@ -40,7 +41,7 @@ gimpenums_notail = custom_target('gimpenums.c.notail',
|
||||||
'@endif@',
|
'@endif@',
|
||||||
'--dtail',
|
'--dtail',
|
||||||
libgimp_mkenums_dtails,
|
libgimp_mkenums_dtails,
|
||||||
'@INPUT@',
|
'@INPUT0@',
|
||||||
],
|
],
|
||||||
capture: true,
|
capture: true,
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,6 +20,7 @@ BEGIN {
|
||||||
$srcdir = $ENV{srcdir} || '.';
|
$srcdir = $ENV{srcdir} || '.';
|
||||||
$destdir = $ENV{destdir} || '.';
|
$destdir = $ENV{destdir} || '.';
|
||||||
$builddir = $ENV{builddir} || '.';
|
$builddir = $ENV{builddir} || '.';
|
||||||
|
$topsrcdir = $ENV{topsrcdir} || '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
use lib $srcdir;
|
use lib $srcdir;
|
||||||
|
@ -244,7 +245,7 @@ while (<>) {
|
||||||
}
|
}
|
||||||
$mapping =~ s/,\n\s*$//s;
|
$mapping =~ s/,\n\s*$//s;
|
||||||
|
|
||||||
$ARGV =~ s@(?:(?:..|app)/)*@@;
|
$ARGV =~ s@($topsrcdir/)?(?:(?:..|app)/)*@@;
|
||||||
|
|
||||||
$code .= <<ENTRY;
|
$code .= <<ENTRY;
|
||||||
: $enumname =>
|
: $enumname =>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/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"/
|
||||||
|
$PERL -I "$top_builddir/pdb" -I "$top_srcdir/pdb" pdb/enumcode.pl
|
||||||
|
RET=$?
|
||||||
|
if [ $RET -eq 0 ]; then
|
||||||
|
echo "/* Generated on `date`. */" > $top_builddir/pdb/stamp-enumcode.h
|
||||||
|
fi
|
||||||
|
exit $RET
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/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
|
||||||
|
shift 3
|
||||||
|
$PERL enumgen.pl "${@}"
|
||||||
|
RET=$?
|
||||||
|
if [ $RET -eq 0 ]; then
|
||||||
|
echo "/* Generated on `date`. */" > $top_builddir/pdb/stamp-enumgen.h
|
||||||
|
fi
|
||||||
|
exit $RET
|
153
pdb/meson.build
153
pdb/meson.build
|
@ -80,15 +80,11 @@ perlbindir = meson.current_build_dir()
|
||||||
perl_env = [
|
perl_env = [
|
||||||
'PDBGEN_BACKUP=' + (pdbgen_backup ? '1' : '0'),
|
'PDBGEN_BACKUP=' + (pdbgen_backup ? '1' : '0'),
|
||||||
'PDBGEN_GROUPS=' + (pdbgen_groups ? '1' : '0'),
|
'PDBGEN_GROUPS=' + (pdbgen_groups ? '1' : '0'),
|
||||||
'rootme=' + perlbindir,
|
'rootme=' + perlbindir,
|
||||||
'srcdir=' + perlsrcdir,
|
'srcdir=' + perlsrcdir,
|
||||||
'destdir=' + meson.project_build_root(),
|
'destdir=' + meson.project_build_root(),
|
||||||
'builddir=' + meson.project_build_root(),
|
'builddir=' + meson.project_build_root(),
|
||||||
]
|
'topsrcdir=' + meson.project_source_root(),
|
||||||
perl_opts = [
|
|
||||||
perl,
|
|
||||||
'-I', perlbindir,
|
|
||||||
'-I', perlsrcdir,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
groups_pl_content = '# This file is autogenerated\n'
|
groups_pl_content = '# This file is autogenerated\n'
|
||||||
|
@ -99,7 +95,6 @@ endforeach
|
||||||
groups_pl_content += ');\n'
|
groups_pl_content += ');\n'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# All perl files
|
# All perl files
|
||||||
|
|
||||||
groups_pl = custom_target('groups.pl',
|
groups_pl = custom_target('groups.pl',
|
||||||
|
@ -109,93 +104,61 @@ groups_pl = custom_target('groups.pl',
|
||||||
capture: true,
|
capture: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
pdbgen_run = find_program('meson-pdbgen.sh')
|
enumgen_run = find_program('meson-enumgen.sh')
|
||||||
|
pdbgen_run = find_program('meson-pdbgen.sh')
|
||||||
|
enumcode_run = find_program('meson-enumcode.sh')
|
||||||
|
|
||||||
if meson.version().version_compare('>=0.57.0')
|
enums_pl = custom_target('enums.pl',
|
||||||
enums_pl = custom_target('enums.pl',
|
input : [ 'meson-enumgen.sh', 'enumgen.pl', 'enums-external.pl', enum_headers, ],
|
||||||
input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
|
output: [ 'stamp-enumgen.h', ],
|
||||||
output: [ 'enums.pl', ],
|
env: perl_env,
|
||||||
env: perl_env,
|
command: [
|
||||||
command: [
|
enumgen_run, perl, meson.project_source_root(), meson.project_build_root(),
|
||||||
perl, '@INPUT0@',
|
enum_headers,
|
||||||
enum_headers,
|
],
|
||||||
],
|
build_by_default: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
pdbgen = custom_target('stamp-pdbgen.h',
|
pdbgen = custom_target('stamp-pdbgen.h',
|
||||||
input : [
|
input : [
|
||||||
files(
|
files(
|
||||||
'meson-pdbgen.sh',
|
'meson-pdbgen.sh',
|
||||||
'pdbgen.pl',
|
'pdbgen.pl',
|
||||||
|
|
||||||
'app.pl',
|
'app.pl',
|
||||||
'lib.pl',
|
'lib.pl',
|
||||||
'pdb.pl',
|
'pdb.pl',
|
||||||
'stddefs.pdb',
|
'stddefs.pdb',
|
||||||
'util.pl',
|
'util.pl',
|
||||||
),
|
),
|
||||||
enums_pl,
|
enums_pl,
|
||||||
groups_pl,
|
groups_pl,
|
||||||
pdb_sources,
|
pdb_sources,
|
||||||
],
|
],
|
||||||
output: [ 'stamp-pdbgen.h', ],
|
output: [ 'stamp-pdbgen.h', ],
|
||||||
env: perl_env,
|
env: perl_env,
|
||||||
command: [
|
command: [
|
||||||
pdbgen_run, perl, meson.project_source_root(), meson.project_build_root()
|
pdbgen_run, perl, meson.project_source_root(), meson.project_build_root()
|
||||||
],
|
],
|
||||||
)
|
build_by_default: true,
|
||||||
|
)
|
||||||
|
|
||||||
stamp_enumcode = custom_target('stamp-enum-code',
|
stamp_enumcode = custom_target('gimpenums.h',
|
||||||
input : [ 'enumcode.pl', ],
|
input : [
|
||||||
output: [ 'stamp-enum-code', ],
|
files(
|
||||||
env: perl_env,
|
'meson-enumcode.sh',
|
||||||
command: [
|
'enumcode.pl',
|
||||||
perl_opts, '@INPUT0@',
|
'enumgen.pl',
|
||||||
],
|
|
||||||
)
|
|
||||||
else
|
|
||||||
# TODO: remove this workaround when we bump meson requirement to >= 0.57.0
|
|
||||||
# See MR !506.
|
|
||||||
# In the meantime, make sure the 2 if/else blocks are well synced.
|
|
||||||
env = find_program('env')
|
|
||||||
|
|
||||||
enums_pl = custom_target('enums.pl',
|
'util.pl',
|
||||||
input : [ 'enumgen.pl', 'enums-external.pl', enum_headers, ],
|
),
|
||||||
output: [ 'enums.pl', ],
|
enums_pl,
|
||||||
command: [
|
enum_headers,
|
||||||
env, perl_env, perl_opts, '@INPUT0@',
|
],
|
||||||
enum_headers,
|
output: [ 'stamp-enumcode.h', ],
|
||||||
],
|
env: perl_env,
|
||||||
)
|
command: [
|
||||||
|
enumcode_run, perl, meson.project_source_root(), meson.project_build_root()
|
||||||
pdbgen = custom_target('stamp-pdbgen.h',
|
],
|
||||||
input : [
|
build_by_default: true,
|
||||||
files(
|
)
|
||||||
'meson-pdbgen.sh',
|
|
||||||
'pdbgen.pl',
|
|
||||||
|
|
||||||
'app.pl',
|
|
||||||
'lib.pl',
|
|
||||||
'pdb.pl',
|
|
||||||
'stddefs.pdb',
|
|
||||||
'util.pl',
|
|
||||||
),
|
|
||||||
enums_pl,
|
|
||||||
groups_pl,
|
|
||||||
pdb_sources,
|
|
||||||
],
|
|
||||||
output: [ 'stamp-pdbgen.h', ],
|
|
||||||
command: [
|
|
||||||
env, perl_env, pdbgen_run, perl, meson.project_source_root(), meson.project_build_root()
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
stamp_enumcode = custom_target('stamp-enum-code',
|
|
||||||
input : [ 'enumcode.pl', ],
|
|
||||||
output: [ 'stamp-enum-code', ],
|
|
||||||
command: [
|
|
||||||
env, perl_env, perl_opts, '@INPUT0@',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
endif
|
|
||||||
|
|
Loading…
Reference in New Issue