app, devel-socs, icons, plug-ins, tools: remove various autotools artifacts.

* generate-icon-makefiles.py was a tool to generate the icon-list.mk files.
* mkgen.pl was used to generate plug-ins/common/Makefile.am
This commit is contained in:
Jehan 2023-09-27 15:34:42 +02:00
parent c8e4f399d0
commit d88f6f9733
8 changed files with 10 additions and 2580 deletions

View File

@ -661,10 +661,11 @@ gimp_plug_in_manager_add_from_file (GimpPlugInManager *manager,
basename = g_path_get_basename (filename);
g_free (filename);
/* When we scan build dirs for plug-ins, there will be some
/* When we scan build dirs for plug-ins, there might be some
* executable files that are not plug-ins that we want to ignore,
* for example plug-ins/common/mkgen.pl if
* GIMP_TESTING_PLUGINDIRS=plug-ins/common
* for example back with autotools, there used to be a file
* plug-ins/common/mkgen.pl if GIMP_TESTING_PLUGINDIRS=plug-ins/common
* Such files should be listed in GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES
*/
if (gimp_plug_in_manager_ignore_plugin_basename (basename))
{

View File

@ -66,8 +66,7 @@ foreach test_name : app_tests
env: [
'GIMP_TESTING_ABS_TOP_SRCDIR=' + meson.project_source_root(),
'GIMP_TESTING_ABS_TOP_BUILDDIR='+ meson.project_build_root(),
'GIMP_TESTING_PLUGINDIRS=' + meson.project_build_root()/'plug-ins'/'common',
'GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES=mkgen.pl',
'GIMP_TESTING_PLUGINDIRS=' + meson.project_build_root()/'plug-ins'/'common',
'UI_TEST=yes',
],
suite: 'app',

View File

@ -152,8 +152,4 @@ files in `pdb/groups`.
Other files are:
* `plug-ins/common/Makefile.am` generated by running
`plug-ins/common/mkgen.pl`.
* `icons/Color/Makefile.am` and `icons/Symbolic/Makefile.am` generated
by `tools/generate-icon-makefiles.py`
* `AUTHORS` from `authors.xml`

View File

@ -66,14 +66,11 @@ Please make sure that you provide both the Symbolic as well as the Color
icons. You are welcome to add a raster version for Legacy, but this is
not mandatory anymore.
- Add the icons in relevant listing files in `icons/icon-lists/` then
run `tools/generate-icon-makefiles.py` which will regenerate files for
the autotools build integrating your new icons and `touch` the
`meson.build` files to make sure the next build will trigger a
reconfiguration. The meson build indeed also uses the same listing
files so you only have to add your icon names in the right categories,
run the script and you are done.
- Add the icons in relevant listing files in `icons/icon-lists/` then run
`touch icons/Color/meson.build icons/Symbolic/meson.build` to force-trigger
their re-processing (hence re-configuration) at next build. Otherwise even
with image list changed, meson might not see it as it uses the list from the
last configuration.
### Pixel perfection

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,234 +0,0 @@
#!/usr/bin/perl -w
use lib '../../pdb';
require 'util.pl';
*write_file = \&Gimp::CodeGen::util::write_file;
*FILE_EXT = \$Gimp::CodeGen::util::FILE_EXT;
$destdir = ".";
$builddir = ".";
$ignorefile = ".gitignore";
$rcfile = "gimprc.common";
$outmk = "$builddir/Makefile.am$FILE_EXT";
$outignore = "$builddir/$ignorefile$FILE_EXT";
$outrc = "$builddir/$rcfile$FILE_EXT";
open MK, "> $outmk";
open IGNORE, "> $outignore";
open RC, "> $outrc";
require './plugin-defs.pl';
$bins = ""; $opts = ""; $dirs = "";
foreach (sort keys %plugins) {
my $makename = $_;
$makename =~ s/-/_/g;
if (exists $plugins{$_}->{optional}) {
$bins .= "${makename}_libexec_PROGRAMS = \$(\U$makename\E)\n";
$opts .= "\t$_ \\\n";
}
else {
$bins .= "${makename}_libexec_PROGRAMS = $_\n";
}
$dirs .= "${makename}_libexecdir = \$(gimpplugindir)/plug-ins/$_\n";
}
$extra = "";
foreach (@extra) { $extra .= "\t$_\t\\\n" }
if ($extra) {
$extra =~ s/\t\\\n$//s;
$extra = "\t\\\n$extra";
}
foreach ($bins, $opts) { s/ \\\n$//s }
print MK <<EOT;
## ---------------------------------------------------------
## This file is autogenerated by mkgen.pl and plugin-defs.pl
## ---------------------------------------------------------
## Modify those two files instead of this one; for most
## plug-ins you should only need to modify plugin-defs.pl.
if OS_WIN32
mwindows = -mwindows
else
libm = -lm
endif
if PLATFORM_OSX
xobjective_c = "-xobjective-c"
framework_cocoa = -framework Cocoa
endif
if HAVE_WINDRES
include \$(top_srcdir)/build/windows/gimprc-plug-ins.rule
include $rcfile
endif
libgimp = \$(top_builddir)/libgimp/libgimp-\$(GIMP_API_VERSION).la
libgimpbase = \$(top_builddir)/libgimpbase/libgimpbase-\$(GIMP_API_VERSION).la
libgimpcolor = \$(top_builddir)/libgimpcolor/libgimpcolor-\$(GIMP_API_VERSION).la
libgimpconfig = \$(top_builddir)/libgimpconfig/libgimpconfig-\$(GIMP_API_VERSION).la
libgimpmath = \$(top_builddir)/libgimpmath/libgimpmath-\$(GIMP_API_VERSION).la \$(libm)
libgimpmodule = \$(top_builddir)/libgimpmodule/libgimpmodule-\$(GIMP_API_VERSION).la
libgimpui = \$(top_builddir)/libgimp/libgimpui-\$(GIMP_API_VERSION).la
libgimpwidgets = \$(top_builddir)/libgimpwidgets/libgimpwidgets-\$(GIMP_API_VERSION).la
AM_LDFLAGS = \$(mwindows)
EXTRA_DIST = \\
mkgen.pl \\
plugin-defs.pl$extra \\
$rcfile
AM_CPPFLAGS = \\
-I\$(top_srcdir) \\
\$(GTK_CFLAGS) \\
\$(GEGL_CFLAGS) \\
-I\$(includedir)
$dirs
$bins
EXTRA_PROGRAMS = \\
$opts
install-\%: \%
\@\$(NORMAL_INSTALL)
\$(mkinstalldirs) \$(DESTDIR)\$(gimpplugindir)/plug-ins/\$<
\@p=\$<; p1=`echo \$\$p|sed 's/\$(EXEEXT)\$\$//'`; \\
if test -f \$\$p \\
|| test -f \$\$p1 \\
; then \\
f=`echo "\$\$p1" | sed 's,^.*/,,;\$(transform);s/\$\$/\$(EXEEXT)/'`; \\
echo " \$(INSTALL_PROGRAM_ENV) \$(LIBTOOL) --mode=install \$(INSTALL_PROGRAM) \$\$p \$(DESTDIR)\$(gimpplugindir)/plug-ins/\$\$p/\$\$f"; \\
\$(INSTALL_PROGRAM_ENV) \$(LIBTOOL) --mode=install \$(INSTALL_PROGRAM) \$\$p \$(DESTDIR)\$(gimpplugindir)/plug-ins/\$\$p/\$\$f || exit 1; \\
else :; fi
EOT
print IGNORE <<EOT;
/.deps
/.libs
/Makefile
/Makefile.in
EOT
foreach (sort keys %plugins) {
my $makename = $_;
$makename =~ s/-/_/g;
my $libgimp = "";
if (exists $plugins{$_}->{ui}) {
$libgimp .= "\$(libgimpui)";
$libgimp .= "\t\t\\\n\t\$(libgimpwidgets)";
$libgimp .= "\t\\\n\t\$(libgimpmodule)";
$libgimp .= "\t\\\n\t";
}
$libgimp .= "\$(libgimp)";
$libgimp .= "\t\t\\\n\t\$(libgimpmath)";
$libgimp .= "\t\t\\\n\t\$(libgimpconfig)";
$libgimp .= "\t\\\n\t\$(libgimpcolor)";
$libgimp .= "\t\t\\\n\t\$(libgimpbase)";
my $glib;
if (exists $plugins{$_}->{ui}) {
$glib = "\$(GTK_LIBS)\t\t\\";
} else {
$glib = "\$(CAIRO_LIBS)\t\t\\\n\t\$(GDK_PIXBUF_LIBS)\t\\";
if (exists $plugins{$_}->{gio} &&
! exists $plugins{$_}->{gegl}) {
$glib .= "\n\t\$(GIO_LIBS)\t\t\\";
}
}
if (exists $plugins{$_}->{gegl}) {
$glib .= "\n\t\$(GEGL_LIBS)\t\t\\";
}
my $optlib = "";
if (exists $plugins{$_}->{libs}) {
$optlib = "\n\t\$(" . $plugins{$_}->{libs} . ")\t\t\\";
}
if (exists $plugins{$_}->{ldflags}) {
my $ldflags = $plugins{$_}->{ldflags};
print MK <<EOT;
${makename}_LDFLAGS = $ldflags
EOT
}
if (exists $plugins{$_}->{cflags}) {
my $cflags = $plugins{$_}->{cflags};
my $cflagsvalue = $cflags =~ /FLAGS/ ? "\$($cflags)" : $cflags;
print MK <<EOT;
${makename}_CFLAGS = $cflagsvalue
EOT
}
if (exists $plugins{$_}->{cppflags}) {
my $cppflags = $plugins{$_}->{cppflags};
print MK <<EOT;
${makename}_CPPFLAGS = $cppflags
EOT
}
my $deplib = "\$(RT_LIBS)\t\t\\\n\t\$(INTLLIBS)";
if (exists $plugins{$_}->{libdep}) {
my @lib = split(/:/, $plugins{$_}->{libdep});
foreach $lib (@lib) {
$deplib = "\$(\U$lib\E_LIBS)\t\t\\\n\t$deplib";
}
}
my $rclib = "\$(${makename}_RC)";
print MK <<EOT;
${makename}_SOURCES = \\
$_.c
${makename}_LDADD = \\
$libgimp \\
$glib$optlib
$deplib \\
$rclib
EOT
print RC <<EOT;
${makename}_RC = $_.rc.o
EOT
print IGNORE "/$_\n";
print IGNORE "/$_.exe\n";
}
close RC;
close MK;
close IGNORE;
&write_file($outmk, $destdir);
&write_file($outignore, $destdir);
&write_file($outrc, $destdir);

View File

@ -1,229 +0,0 @@
#!/usr/bin/env python3
"""
generate-icon-makefiles.py -- Generate icons/(Color|Symbolic)/icon-list.mk
Copyright (C) 2022 Jehan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Usage: generate-icon-makefiles.py
"""
import os.path
tools_dir = os.path.dirname(os.path.realpath(__file__))
icons_dir = os.path.join(tools_dir, '../icons')
list_dir = os.path.join(icons_dir, 'icon-lists')
color_mk = os.path.join(icons_dir, 'Color', 'icon-list.mk')
symbolic_mk = os.path.join(icons_dir, 'Symbolic', 'icon-list.mk')
def print_icons(indir, filenames, max_len, prefix, suffix, outfile, endlist=True):
icons = []
for filename in filenames:
icon_list = os.path.join(indir, filename)
with open(icon_list, mode='r') as f:
icons += [line.strip() for line in f]
# Replace comment lines with empty strings.
prev_blank = False
pop_list = []
for i, icon in enumerate(icons):
if icon != '' and icon[0] == '#':
icons[i] = ''
if icons[i] == '':
if prev_blank:
pop_list += [i]
prev_blank = True
else:
prev_blank = False
if icons[i] in icons[:i]:
pop_list += [i]
pop_list.reverse()
for i in pop_list:
# Remove successive blanks and duplicate icons.
icons.pop(i)
# Strip empty lines in extremities.
while icons[-1] == '':
icons.pop()
while icons[0] == '':
icons.pop(0)
if max_len is None:
max_len = len(max(icons, key=len)) + len(prefix + suffix)
prev_empty = False
# Using tabs, displayed as 8 chars in our coding style. Computing
# needed tabs for proper alignment.
needed_tabs = int(max_len / 8) + (1 if max_len % 8 != 0 else 0)
for icon in icons[:-1]:
if icon == '':
# Only keep one empty line.
if not prev_empty:
print("\t\\", file=outfile)
prev_empty = True
else:
icon_path = prefix + icon + suffix
tab_mult = needed_tabs - int(len(icon_path) / 8) + 1
icon_path = "\t{}{}\\".format(icon_path, "\t" * tab_mult)
print(icon_path, file=outfile)
prev_empty = False
else:
if endlist:
icon_path = "\t{}".format(prefix) + icons[-1] + suffix
print(icon_path, file=outfile)
else:
icon_path = prefix + icons[-1] + suffix
tab_mult = needed_tabs - int(len(icon_path) / 8) + 1
icon_path = "\t{}{}\\".format(icon_path, "\t" * tab_mult)
print(icon_path, file=outfile)
return max_len
if __name__ == "__main__":
with open(color_mk, mode='w') as colorf, open(symbolic_mk, mode='w') as symbolicf:
top_comment = '''
## --------------------------------------------------------------
## This file is autogenerated by tools/generate-icon-makefiles.py
## --------------------------------------------------------------
## Modify this script or files inside icons/icon-lists/ instead of this one.
## Then run tools/generate-icon-makefiles.py again.
'''
print(top_comment, file=colorf)
print(top_comment, file=symbolicf)
# Scalable icons.
print("scalable_images = \\", file=colorf)
print("scalable_images = \\", file=symbolicf)
# Let's assume that scalable icons are the biggest list since it
# should contain nearly all images. So we compute max_len once and
# reuse this value on all lists.
col_max_len = print_icons(list_dir,
['scalable.list',
'color-selectors.list', 'controllers.list', 'display-filters.list',
'locks.list', 'prefs.list', 'templates.list', 'tools.list'],
None, "scalable/", ".svg", colorf)
sym_max_len = print_icons(list_dir,
['scalable.list',
'color-selectors.list', 'controllers.list', 'display-filters.list',
'locks.list', 'prefs.list', 'templates.list', 'tools.list'],
None, "scalable/", "-symbolic.svg", symbolicf)
# 12x12 bitmap
print("\nicons12_images = \\", file=colorf)
print("\nicons12_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_12.list'], col_max_len, "12/", ".png", colorf)
print_icons(list_dir, ['bitmap_12.list'], sym_max_len, "12/", "-symbolic.symbolic.png", symbolicf)
# 16x16 bitmap
print("\nicons16_images = \\", file=colorf)
print("\nicons16_images = \\", file=symbolicf)
print_icons(list_dir,
['bitmap_16.list',
'color-selectors.list', 'controllers.list', 'display-filters.list',
'locks.list', 'prefs.list', 'templates.list', 'tools.list'],
col_max_len, "16/", ".png", colorf)
print_icons(list_dir,
['bitmap_16.list',
'color-selectors.list', 'controllers.list', 'display-filters.list',
'locks.list', 'prefs.list', 'templates.list', 'tools.list'],
sym_max_len, "16/", "-symbolic.symbolic.png", symbolicf)
# 18x18 bitmap
print("\nicons18_images = \\", file=colorf)
print("\nicons18_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_18.list'], col_max_len, "18/", ".png", colorf)
print_icons(list_dir, ['bitmap_18.list'], sym_max_len, "18/", "-symbolic.symbolic.png", symbolicf)
# 22x22 bitmap
print("\nicons22_images = \\", file=colorf)
print("\nicons22_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_22.list'], col_max_len, "22/", ".png", colorf)
print_icons(list_dir, ['bitmap_22.list'], sym_max_len, "22/", "-symbolic.symbolic.png", symbolicf)
# 24x24 bitmap
print("\nicons24_images = \\", file=colorf)
print("\nicons24_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_24.list', 'templates.list', 'tools.list'],
col_max_len, "24/", ".png", colorf)
print_icons(list_dir, ['bitmap_24.list', 'templates.list', 'tools.list'],
sym_max_len, "24/", "-symbolic.symbolic.png", symbolicf)
# 32x32 bitmap
print("\nicons32_images = \\", file=colorf)
print("\nicons32_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_32.list'], col_max_len, "32/", ".png", colorf)
print_icons(list_dir, ['bitmap_32.list'], sym_max_len, "32/", "-symbolic.symbolic.png", symbolicf)
# 48x48 bitmap
print("\nicons48_images = \\", file=colorf)
print("\nicons48_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_48.list', 'prefs.list'], col_max_len, "48/", ".png", colorf)
print_icons(list_dir, ['bitmap_48.list', 'prefs.list'], sym_max_len, "48/", "-symbolic.symbolic.png", symbolicf)
# 64x64 bitmap
print("\nicons64_images = \\", file=colorf)
print("\nicons64_images = \\", file=symbolicf)
print_icons(list_dir, [ 'bitmap_64-always.list', 'bitmap_64.list'], col_max_len, "64/", ".png", colorf)
print_icons(list_dir, [ 'bitmap_64-always.list' ], sym_max_len, "64/", ".png", symbolicf, endlist=False)
print_icons(list_dir, [ 'bitmap_64.list'], sym_max_len, "64/", "-symbolic.symbolic.png", symbolicf)
print("\nicons64_system_images = \\", file=colorf)
print("\nicons64_system_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_64-system.list'], col_max_len, "64/", ".png", colorf)
print_icons(list_dir, ['bitmap_64-system.list'], sym_max_len, "64/", "-symbolic.symbolic.png", symbolicf)
# 96x96 bitmap
print("\nicons96_images = \\", file=colorf)
print("\nicons96_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_96.list'], col_max_len, "96/", ".png", colorf)
print_icons(list_dir, ['bitmap_96.list'], sym_max_len, "96/", "-symbolic.symbolic.png", symbolicf)
# 128x128 bitmap
print("\nicons128_images = \\", file=colorf)
print("\nicons128_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_128.list'], col_max_len, "128/", ".png", colorf)
print_icons(list_dir, ['bitmap_128.list'], sym_max_len, "128/", "-symbolic.symbolic.png", symbolicf)
# 192x192 bitmap
print("\nicons192_images = \\", file=colorf)
print("\nicons192_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_192.list'], col_max_len, "192/", ".png", colorf)
print_icons(list_dir, ['bitmap_192.list'], sym_max_len, "192/", "-symbolic.symbolic.png", symbolicf)
# 256x256 bitmap
print("\nicons256_images = \\", file=colorf)
print("\nicons256_images = \\", file=symbolicf)
print_icons(list_dir, ['bitmap_256.list'], col_max_len, "256/", ".png", colorf)
print_icons(list_dir, ['bitmap_256.list'], sym_max_len, "256/", "-symbolic.symbolic.png", symbolicf)
print(file=colorf)
print(file=symbolicf)
eof = os.path.join(list_dir, "icon-list.mk.eof")
with open(eof, mode='r') as f:
for line in f:
colorf.write(line)
symbolicf.write(line)
# Touch the 2 meson.build to force-trigger their re-processing (hence
# re-configuration) at next build. Otherwise even with image list
# changed, meson might not see it as it uses the list from the last
# configuration.
os.utime(os.path.join(icons_dir, 'Color', 'meson.build'), times=None)
os.utime(os.path.join(icons_dir, 'Symbolic', 'meson.build'), times=None)