Skip to content

Commit

Permalink
Implement Meson
Browse files Browse the repository at this point in the history
The intent of this commit is to provide a working
meson build that implementation that is as close
to the existing autotools build as is reasonable.

Autotools should be considered deprecated; followup
commits that modernise the codebase (e.g `time.h` vs
`sys/time.h`) may include changes to autotools, and
bugs will be fixed, however no enhancements to the
autotools build will be made.

Porting notes:

FwvmPrompt: We use a script that calls 'find' to generate
a list of sources to feed to golang in a custom target as
there is not currently direct support for golang in Meson.

bin/: Configured scripts are manually set to 'rwxr-xr-x'.

drop -Wno-implicit-int:

Modern compilers complain about this for a reason;
we should not mask this.

I can't find any current occurrances in the codebase
and this will catch any future instances before they
are merged.

po:

- Set GETTEXT_PACKAGE (mandatory for i18n module)
- Add POTFILES to define files which need to be scanned
  for strings to translate

See:

- https://mesonbuild.com/Localisation.html
- https://mesonbuild.com/i18n-module.html#i18n-module

PRIVATE_COLORSET: always assume this is true

For years, we've been setting FVWM_COLORSET_PRIVATE=1, so there
is no need for the include guards.

Co-authored-by: Thomas Adam <[email protected]>
Signed-off-by: Matt Jolly <[email protected]>
  • Loading branch information
Kangie and ThomasAdam committed Sep 29, 2024
1 parent d1f2cff commit 9b0d2ec
Show file tree
Hide file tree
Showing 118 changed files with 10,535 additions and 21 deletions.
2 changes: 2 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,8 @@ AC_DEFUN([AM_GNU_FGETTEXT],
if test "$no_dgettext" != "yes"; then
CFLAGS="$CFLAGS $intl_LIBS $iconv_LIBS"
LIBS="$LIBS $intl_LIBS $iconv_LIBS"
echo "LIBS: $LIBS"
echo "CFLAGS: $CFLAGS"
AC_MSG_CHECKING(if a simple gettext program link)
AC_TRY_LINK([
#include <libintl.h>
Expand Down
6 changes: 6 additions & 0 deletions bin/FvwmPrompt/find-go-sources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

# Find all Go source files in the current directory and its subdirectories.
# That is all

find "$(pwd)" -type f -name '*.go'
28 changes: 28 additions & 0 deletions bin/FvwmPrompt/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Fvwmprompt is written in golang. Unfortunately there is still
# no automagic in meson to handle golang projects. So we have to
# do it manually.

# Extract all of the go sources from the current directory
r = run_command('find-go-sources.sh', meson.current_source_dir(), check: true)
fvwmprompt_files = r.stdout().strip().split()
fvwmprompt_files += 'go.mod'
fvwmprompt_files += 'go.sum'

fvwmprompt_build = meson.current_source_dir()
fvwmprompt_output = meson.current_build_dir() + '/FvwmPrompt'

fvwmprompt = custom_target(
'FvwmPrompt',
output: 'FvwmPrompt',
input: fvwmprompt_files,
command: [
golang,
'build',
'-C', fvwmprompt_build,
'-v',
'-mod=vendor',
'-o', fvwmprompt_output,
],
install: true,
install_dir: bindir,
)
72 changes: 72 additions & 0 deletions bin/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
if golang.found()
subdir('FvwmPrompt')
endif

FvwmCommand = configure_file(
input: 'FvwmCommand.in',
output: 'FvwmCommand',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

# We should tighten up the dependencies here, but for now we'll just use all_found_deps.
fvwm_root = executable(
'fvwm-root',
'fvwm-root.c',
include_directories: includedirs,
link_with: libfvwm3,
dependencies: all_found_deps,
install: true,
)

fvwm_perllib = configure_file(
input: 'fvwm-perllib.in',
output: 'fvwm-perllib',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

fvwm_convert = configure_file(
input: 'fvwm-convert-2.6.in',
output: 'fvwm-convert-2.6',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

fvwm_menu_xlock = configure_file(
input: 'fvwm-menu-xlock.in',
output: 'fvwm-menu-xlock',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

fvwm_menu_directory = configure_file(
input: 'fvwm-menu-directory.in',
output: 'fvwm-menu-directory',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

fvwm_menu_desktop = configure_file(
input: 'fvwm-menu-desktop.in',
output: 'fvwm-menu-desktop',
configuration: file_config,
install: true,
install_dir: bindir,
install_mode: install_mask_755,
)

config_data = install_data(
'fvwm-menu-desktop-config.fpl',
install_dir: fvwm_datadir,
)
88 changes: 88 additions & 0 deletions config_defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#include <stdio.h>

#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_MEMORY_H
# include <memory.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif

#if defined (HAVE_MALLOC_H) && !defined (__FreeBSD__) && !defined (__OpenBSD__) && !defined(__NetBSD__)
# include <malloc.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifndef HAVE_STRCHR
# define strchr(_s,_c) index((_s),(_c))
# define strrchr(_s,_c) rindex((_s),(_c))
#endif

#ifndef HAVE_MEMCPY
# define memcpy(_d,_s,_l) bcopy((_s),(_d),(_l))
#endif
#ifndef HAVE_MEMMOVE
# define memmove(_d,_s,_l) bcopy((_s),(_d),(_l))
#endif

#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif

#if HAVE_UNISTD_H
# include <unistd.h>
#endif

#ifndef min
# define min(a,b) (((a)<(b)) ? (a) : (b))
#endif
#ifndef max
# define max(a,b) (((a)>(b)) ? (a) : (b))
#endif
#ifndef abs
# define abs(a) (((a)>=0)?(a):-(a))
#endif

//#include "libs/defaults.h"

#ifndef O_NOFOLLOW
#define O_NOFOLLOW 0
#endif

#ifdef HAVE_LSTAT
#define DO_USE_LSTAT 1
#define fvwm_lstat(x,y) lstat(x,y)
#else
#define DO_USE_LSTAT 0
#define fvwm_lstat(x,y) -1
#endif

/* A macro that touches a variable in a compiler independent way to suppress
* warnings. */
#define SUPPRESS_UNUSED_VAR_WARNING(x) \
do { void *p; p = (void *)&x; (void)p; } while (0);

#ifdef HOST_MACOS
#undef HAVE_STRLCAT
#undef HAVE_STRLCPY
#else
#ifndef HAVE_STRLCAT
# include "libs/strlcat.h"
#endif

#ifndef HAVE_STRLCPY
# include "libs/strlcpy.h"
#endif
#endif

#ifndef HAVE_ASPRINTF
# include <stdarg.h>
int asprintf(char **, const char *, ...);
int vasprintf(char **, const char *, va_list);
#endif
53 changes: 53 additions & 0 deletions default-config/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
default_confdir = join_paths(
get_option('datadir'),
meson.project_name(),
'default-config',
)

default_conf_files = [
'images/background/bg1.png',
'images/background/bg2.png',
'images/background/bg3.png',
'images/bgicons/bg1.png',
'images/bgicons/bg2.png',
'images/bgicons/bg3.png',
'images/icons/win/bottom.png',
'images/icons/win/close.png',
'images/icons/win/destroy.png',
'images/icons/win/done.png',
'images/icons/win/iconify.png',
'images/icons/win/lower.png',
'images/icons/win/max.png',
'images/icons/win/move.png',
'images/icons/win/raise.png',
'images/icons/win/resize.png',
'images/icons/win/sendto.png',
'images/icons/win/shade.png',
'images/icons/win/stays.png',
'images/icons/win/sticky.png',
'images/icons/win/title.png',
'images/icons/win/top.png',
'images/icons/apps.png',
'images/icons/conf.png',
'images/icons/help.png',
'images/icons/info.png',
'images/icons/programs.png',
'images/icons/quit.png',
'images/icons/refresh.png',
'images/icons/restart.png',
'images/icons/run_arrow.png',
'images/icons/terminal.png',
'images/icons/wallpaper.png',
'images/fvwm-logo-small.png',
'FvwmScript-ConfirmCopyConfig',
'FvwmScript-ConfirmQuit',
'FvwmScript-DateTime',
'stalonetrayrc',
'config',
]

install_data(
default_conf_files,
install_dir: default_confdir,
preserve_path: true,
)
6 changes: 6 additions & 0 deletions doc/generate_ad_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

cat $2 | \
grep -A 1000000 -- "^// BEGIN '$1'" | \
grep -B 1000000 -- "^// END '$1'" | \
grep -v "^// .* '$1'"
Loading

0 comments on commit 9b0d2ec

Please sign in to comment.