commit:     0bbfb8c456266ce3e192d329bbf1f47f4c51f6cc
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Sat Feb 15 07:12:42 2025 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Sun Feb 16 20:09:05 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bbfb8c4

x11-plugins/wmmaiload: Switch build system to meson

Original build system was made by someone who didn't know how to use
make correctly and was too smart about it. Eg. it uses call to compiler:
`$(CPP) $(ALL_CPPFLAGS) -MM $$i >> .dependencies` to generate actual build
commands and `$(shell ls *.c)` to find source files in the directory.
There is no propagation of errors upwards, so if one of two executables
fails to compile, it would only be seen at install stage.
Meson.build replicates end product of configure by passing build
parameters defined in Config.make. Builds in Gentoo enabled all if them,
unconditionally.
Meson.build also gets rid of per-executable config.h and replaces it with
more build paratemers, as config.h only contains build metadata, like
OS type, author name, package name and build date. Original build system
regenerated this mostly-static metadata file on compile, I pass static
parameters explicitly, with date being an empty string.
This is supported in program.
I do not like the end result, but original system is not fit for purpose.

Bug: https://bugs.gentoo.org/943914
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/40578
Signed-off-by: Bernard Cafarelli <voyageur <AT> gentoo.org>

 x11-plugins/wmmaiload/files/meson.build         | 77 +++++++++++++++++++++++++
 x11-plugins/wmmaiload/wmmaiload-2.3.0-r3.ebuild | 23 +++-----
 2 files changed, 85 insertions(+), 15 deletions(-)

diff --git a/x11-plugins/wmmaiload/files/meson.build 
b/x11-plugins/wmmaiload/files/meson.build
new file mode 100644
index 000000000000..5791ebb405db
--- /dev/null
+++ b/x11-plugins/wmmaiload/files/meson.build
@@ -0,0 +1,77 @@
+project('wmmaiload', 'c', version: '2.3.0')
+
+add_project_arguments(
+    '-DHAVE_THREADS',
+    '-DHAVE_IMAP',
+    '-DHAVE_MAILDIR',
+    '-DHAVE_MBOX',
+    '-DHAVE_MH',
+    '-DHAVE_POP3',
+    '-DHAVE_SSL',
+    '-DHAVE_SELECT',
+    '-DHAVE_STRING_H',
+    '-DHAVE_STRINGS_H',
+    '-DHAVE_UNISTD_H',
+    language: 'c',
+)
+
+# Originally, this was generated and regenerated
+# by a set of shell functions embedded into makefile
+# replacing with sane defaults
+
+add_project_arguments(
+    '-DVERSION="2.3.0"',
+    '-DAUTHORS="Thomas Nemeth"',
+    '-DOSTYPE="linux"',
+    '-DBUILD=""',
+    language: 'c',
+)
+
+threads_dep = dependency('threads')
+ssl = dependency('openssl')
+xext = dependency('xext')
+xpm = dependency('xpm')
+gtk = dependency('gtk+-2.0')
+x11 = dependency('X11')
+
+wmmaiload_sources = [
+    'wmmaiload/checkthread.c',
+    'wmmaiload/dockapp.c',
+    'wmmaiload/imapclient.c',
+    'wmmaiload/main.c',
+    'wmmaiload/options.c',
+    'wmmaiload/pop3client.c',
+    'wmmaiload/ssl.c',
+]
+
+wmmaiload_include = include_directories('wmmaiload')
+
+wmmaiload = executable(
+    'wmmaiload',
+    wmmaiload_sources,
+    include_directories: wmmaiload_include,
+    dependencies: [threads_dep, ssl, xext, xpm],
+    install: true,
+    c_args: ['-DPACKAGE="WMMaiLoad"', '-DPROGRAM="wmmaiload"'],
+)
+
+wmmail_conf_sources = [
+    'wmmaiload-config/actions.c',
+    'wmmaiload-config/dialogs.c',
+    'wmmaiload-config/main.c',
+    'wmmaiload-config/mainwindow.c',
+    'wmmaiload-config/popedit.c',
+    'wmmaiload-config/tools.c',
+]
+
+wmmail_conf_include = include_directories('wmmaiload-config')
+
+wmmail_conf = executable(
+    'wmmaiload-config',
+    wmmail_conf_sources,
+    dependencies: [gtk, x11],
+    include_directories: wmmail_conf_include,
+    c_args: ['-DPACKAGE="WMMaiLoad-Config"', '-DPROGRAM="wmmaiload-config"'],
+    install: true,
+)
+

diff --git a/x11-plugins/wmmaiload/wmmaiload-2.3.0-r3.ebuild 
b/x11-plugins/wmmaiload/wmmaiload-2.3.0-r3.ebuild
index e679cd0294c4..c364c8d24fcd 100644
--- a/x11-plugins/wmmaiload/wmmaiload-2.3.0-r3.ebuild
+++ b/x11-plugins/wmmaiload/wmmaiload-2.3.0-r3.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
-inherit toolchain-funcs
+inherit meson
 
 DESCRIPTION="dockapp that monitors one or more mailboxes"
 HOMEPAGE="http://tnemeth.free.fr/projets/dockapps.html";
@@ -18,7 +18,6 @@ RDEPEND="x11-libs/gtk+:2
 
 DEPEND="${RDEPEND}
        virtual/pkgconfig"
-
 PATCHES=(
        "${FILESDIR}"/${PN}-2.2.1-checkthread.patch
        "${FILESDIR}"/${P}-fno-common.patch
@@ -26,23 +25,17 @@ PATCHES=(
        "${FILESDIR}"/${P}-c23.patch
 )
 
-src_configure() {
-       # The ./configure script is not autoconf based, therefore don't use 
econf:
-       ./configure -p /usr || die
-}
+src_prepare() {
+       default
 
-src_compile() {
-       emake \
-               CC="$(tc-getCC)" \
-               CPP="$(tc-getCPP)" \
-               CFLAGS="${CFLAGS}" \
-               DEBUG_LDFLAGS="" \
-               LDFLAGS="${LDFLAGS}" \
-               DEBUG_CFLAGS=""
+       cp "${FILESDIR}"/meson.build . || die "No new build file"
+       rm -f wmmaiload/config.h && touch wmmaiload/config.h || die "Can't 
remove stale config"
+       rm -f wmmaiload-config/config.h && touch wmmaiload-config/config.h || 
die "Can't remove stale config"
 }
 
 src_install() {
-       dobin ${PN}/${PN} ${PN}-config/${PN}-config
+       meson_install
+
        doman doc/*.1
        dodoc AUTHORS ChangeLog FAQ NEWS README THANKS TODO doc/sample.${PN}rc
 }

Reply via email to