From 02fa1e4356e1d5ccf7a5514a29a0cc5e781aed45 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 11 Aug 2025 13:27:22 -0400 Subject: [PATCH] Rest of the conversion to meson/ninja missed in the first push. Thanks again Claud for the assist. --- .gitignore | 18 +++++++ Makefile.am | 57 ---------------------- icons/Makefile.am | 57 ---------------------- icons/meson.build | 53 ++++++++++++++++++++ meson.build | 120 ++++++++++++++++++++++++++++++++++++++++++++++ meson_options.txt | 3 ++ po/meson.build | 6 +++ 7 files changed, 200 insertions(+), 114 deletions(-) delete mode 100644 Makefile.am delete mode 100644 icons/Makefile.am create mode 100644 icons/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 po/meson.build diff --git a/.gitignore b/.gitignore index 0ec6bf3..2a35779 100644 --- a/.gitignore +++ b/.gitignore @@ -55,9 +55,27 @@ __pycache__/ # Local build directory and artifacts local-build/ debug-*.out +debug.log *.gmo *.pot +# Package artifacts +*.pkg.tar.zst +distro-packages/*/cthulhu/ + +# Generated makefiles (should not be committed) +Makefile +Makefile.in + +# Sound files (if binary) +sounds/ + +# Test files that might be temporary +test-dbus.sh +test-local-meson.sh +test_displayversion.py +PORTING-NOTES.md + # Translation files po/stamp-po po/insert-header.sed diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index e4999e0..0000000 --- a/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - -if BUILD_HELP -SUBDIRS = docs icons po src help -else -SUBDIRS = docs icons po src -endif - -DISTCHECK_CONFIGURE_FLAGS = \ - --disable-scrollkeeper - -DISTCLEANFILES = \ - cthulhu-autostart.desktop - -README: README.md - cp $< $@ - -gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor - -install-data-hook: update-icon-cache -uninstall-hook: update-icon-cache -update-icon-cache: - @-if test -z "$(DESTDIR)"; then \ - echo "Updating Gtk icon cache."; \ - $(gtk_update_icon_cache); \ - else \ - echo "*** Icon cache not updated. After (un)install, run this:"; \ - echo "*** $(gtk_update_icon_cache)"; \ - fi - -autostartdir = $(sysconfdir)/xdg/autostart -autostart_in_files = cthulhu-autostart.desktop.in -autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) - -$(autostart_DATA): $(autostart_in_files) - $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@ - -EXTRA_DIST = \ - $(autostart_in_files) \ - $(icon_DATA) \ - ChangeLog \ - MAINTAINERS \ - README.md - -dist-hook: - @if test -d "$(srcdir)/.git"; \ - then \ - echo Creating ChangeLog && \ - ( cd "$(top_srcdir)" && \ - echo '# Generated by Makefile. Do not edit.'; echo; \ - $(top_srcdir)/missing --run git log --pretty=format:"%ai %an <%ae>%n%n %s%n" --name-status CTHULHU_2_26_0.. ) > ChangeLog.tmp \ - && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ - || ( rm -f ChangeLog.tmp ; \ - echo Failed to generate ChangeLog >&2 ); \ - else \ - echo A git clone is required to generate a ChangeLog >&2; \ - fi diff --git a/icons/Makefile.am b/icons/Makefile.am deleted file mode 100644 index a8949ea..0000000 --- a/icons/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -hicolordir = $(datadir)/icons/hicolor -app_icons = \ - cthulhu-16x16.png \ - cthulhu-22x22.png \ - cthulhu-24x24.png \ - cthulhu-32x32.png \ - cthulhu-48x48.png \ - cthulhu-256x256.png \ - cthulhu-scalable.svg \ - cthulhu-symbolic.svg - -install-data-local: - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/16x16/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-16x16.png $(DESTDIR)$(hicolordir)/16x16/apps/cthulhu.png - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/22x22/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-22x22.png $(DESTDIR)$(hicolordir)/22x22/apps/cthulhu.png - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/24x24/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-24x24.png $(DESTDIR)$(hicolordir)/24x24/apps/cthulhu.png - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/32x32/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-32x32.png $(DESTDIR)$(hicolordir)/32x32/apps/cthulhu.png - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/48x48/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-48x48.png $(DESTDIR)$(hicolordir)/48x48/apps/cthulhu.png - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/scalable/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-scalable.svg $(DESTDIR)$(hicolordir)/scalable/apps/cthulhu.svg - @-$(mkinstalldirs) $(DESTDIR)$(hicolordir)/symbolic/apps - $(INSTALL_DATA) $(srcdir)/cthulhu-symbolic.svg $(DESTDIR)$(hicolordir)/symbolic/apps/cthulhu-symbolic.svg - -gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor - -install-data-hook: - @-if test -z "$(DESTDIR)"; then \ - echo "Updating Gtk icon cache."; \ - $(gtk_update_icon_cache); \ - else \ - echo "*** Icon cache not updated. After install, run this:"; \ - echo "*** $(gtk_update_icon_cache)"; \ - fi - -uninstall-hook: - rm -f $(DESTDIR)$(hicolordir)/16x16/apps/cthulhu.png - rm -f $(DESTDIR)$(hicolordir)/22x22/apps/cthulhu.png - rm -f $(DESTDIR)$(hicolordir)/24x24/apps/cthulhu.png - rm -f $(DESTDIR)$(hicolordir)/32x32/apps/cthulhu.png - rm -f $(DESTDIR)$(hicolordir)/48x48/apps/cthulhu.png - rm -f $(DESTDIR)$(hicolordir)/scalable/apps/cthulhu.svg - rm -f $(DESTDIR)$(hicolordir)/symbolic/apps/cthulhu-symbolic.svg - @-if test -z "$(DESTDIR)"; then \ - echo "Updating Gtk icon cache."; \ - $(gtk_update_icon_cache); \ - else \ - echo "*** Icon cache not updated. After uninstall, run this:"; \ - echo "*** $(gtk_update_icon_cache)"; \ - fi - -update-icon-cache: - -EXTRA_DIST = $(app_icons) diff --git a/icons/meson.build b/icons/meson.build new file mode 100644 index 0000000..086876f --- /dev/null +++ b/icons/meson.build @@ -0,0 +1,53 @@ +# Install icons in hicolor icon theme locations +install_data( + 'cthulhu-16x16.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '16x16' / 'apps' +) + +install_data( + 'cthulhu-22x22.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '22x22' / 'apps' +) + +install_data( + 'cthulhu-24x24.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '24x24' / 'apps' +) + +install_data( + 'cthulhu-32x32.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '32x32' / 'apps' +) + +install_data( + 'cthulhu-48x48.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '48x48' / 'apps' +) + +install_data( + 'cthulhu-256x256.png', + rename: 'cthulhu.png', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / '256x256' / 'apps' +) + +install_data( + 'cthulhu-scalable.svg', + rename: 'cthulhu.svg', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps' +) + +install_data( + 'cthulhu-symbolic.svg', + install_dir: get_option('datadir') / 'icons' / 'hicolor' / 'symbolic' / 'apps' +) + +# Additional icons +install_data( + 'cthulhu-splash.svg', + install_dir: get_option('datadir') / 'cthulhu' / 'icons' +) \ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..a6dddd9 --- /dev/null +++ b/meson.build @@ -0,0 +1,120 @@ +project('cthulhu', + version: '2025.08.11', + meson_version: '>= 1.0.0', +) + +python = import('python') +gnome = import('gnome') +i18n = import('i18n') + +python_minimum_version = '3.3' +python3 = python.find_installation('python3', required: true) +if not python3.language_version().version_compare(f'>= @python_minimum_version@') + error(f'Python @python_minimum_version@ or newer is required.') +endif + +# Hard dependencies (checked via pkg-config) +dependency('atspi-2', version: '>= 2.48.0') +dependency('atk-bridge-2.0', version: '>= 2.26.0') +dependency('pygobject-3.0', version: '>= 3.18') + +# Hard Python module dependencies +gi_result = python.find_installation('python3', modules:['gi'], required: false) +if not gi_result.found() + error('gi (PyGObject) is required') +endif + +json_result = python.find_installation('python3', modules:['json'], required: false) +if not json_result.found() + error('json module is required') +endif + +# End users might not have the Gtk development libraries installed, making pkg-config fail. +# Therefore, check this dependency via python. +gtk_major_version = '3' +gtk_minor_version = '0' +gtk_command = ' '.join([ + 'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk;', + 'print(f"{Gtk.get_major_version()}.{Gtk.get_minor_version()}.{Gtk.get_micro_version()}");', + f'failed = Gtk.get_major_version() != @gtk_major_version@;', + 'exit(failed)' +]) +gtk_test = run_command(python3, '-c', gtk_command, check: false) +description = f'GTK @gtk_major_version@.@gtk_minor_version@' +version = gtk_test.stdout().strip() +if gtk_test.returncode() != 0 + error(f'@description@ failed (found @version@)') +endif + +# Optional python modules with their descriptions +optional_modules = { + 'brlapi': 'braille output', + 'louis': 'contracted braille', + 'speechd': 'speech output', + 'pluggy': 'plugin system', + 'dasbus': 'D-Bus remote controller', + 'psutil': 'system information commands', + 'gi.repository.Wnck': 'mouse review', +} + +summary = {} +foreach module, description : optional_modules + result = python.find_installation('python3', modules:[module], required: false) + if result.found() + summary += {description: f'yes (found @module@)'} + else + summary += {description: f'no (missing @module@)'} + endif +endforeach + +# Optional synthesizer services +speech_output = [] +if python.find_installation('python3', modules:['speechd'], required: false).found() + speech_output += ['speechd'] +endif + +if speech_output.length() > 0 + summary += {'speech output': 'yes (found @0@)'.format(', '.join(speech_output))} +else + summary += {'speech output': 'no (missing speechd)'} +endif + +# Check for GStreamer +gstreamer_dep = dependency('gstreamer-1.0', required: false) +if gstreamer_dep.found() + summary += {'sound support': 'yes (found gstreamer)'} +else + summary += {'sound support': 'no (missing gstreamer)'} +endif + +# Check for libpeas +libpeas_dep = dependency('libpeas-1.0', required: false) +if libpeas_dep.found() + summary += {'plugin loading': 'yes (found libpeas)'} +else + summary += {'plugin loading': 'no (missing libpeas)'} +endif + +# Integration with session startup +i18n.merge_file( + input: 'cthulhu-autostart.desktop.in', + output: '@BASENAME@', + type: 'desktop', + po_dir: meson.project_source_root() / 'po', + install: true, + install_dir: get_option('sysconfdir') / 'xdg' / 'autostart', +) + +gnome.post_install( + gtk_update_icon_cache: true, +) + +summary += {'Install dir': python.find_installation('python3').get_install_dir()} + +subdir('docs') +subdir('help') +subdir('icons') +subdir('po') +subdir('src') + +summary(summary) \ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..8adbdf9 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,3 @@ +option('help', type: 'boolean', value: true, description: 'Build help documentation') +option('plugin-system', type: 'boolean', value: true, description: 'Enable plugin system support') +option('d-bus-service', type: 'boolean', value: true, description: 'Enable D-Bus remote controller service') \ No newline at end of file diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000..94bb642 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,6 @@ +i18n.gettext('cthulhu', + args: [ + '--default-domain=cthulhu', + '--from-code=UTF-8', + ] +) \ No newline at end of file