Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: Support Meson #996

Merged
merged 4 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ If there is more than one issue fixed then use:

```
Fixes #XXX, fixes #YYY, fixes #ZZZ
```
```
47 changes: 39 additions & 8 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,44 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container:
image: ${{ matrix.os == 'alpine' && 'fvwmorg/fvwm3-build-alpine:latest' || 'fvwmorg/fvwm3-build:latest' }}
env:
GO111MODULE: "on"

strategy:
matrix:
os: [ubuntu-latest, alpine]
build-system: [autotools, meson]
compiler: [gcc, clang]

steps:
- uses: actions/checkout@v2
- name: Pulling docker image
run: docker pull fvwmorg/fvwm3-build:latest
- name: Build Package
run: 'docker build -t fvwm3 .'
- name: Checkout repository
uses: actions/checkout@v4

- name: Set git safe directory
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}

- name: Configure and Build
run: |
if [ "${{ matrix.build-system }}" = "autotools" ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
export CFLAGS="-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
else
export CC_LD=lld
fi
export CC=${{ matrix.compiler }}
./autogen.sh && ./configure --enable-mandoc --enable-golang && make -j
fi
if [ "${{ matrix.build-system }}" = "meson" ]; then
if [ "${{ matrix.compiler }}" = "gcc" ]; then
export CFLAGS="-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
else
export CC_LD=lld
fi
export CC=${{ matrix.compiler }}
meson setup builddir -Dhtmldoc=true -Dmandoc=true && ninja -C builddir
fi

notification:
runs-on: ubuntu-20.04
Expand All @@ -26,7 +57,7 @@ jobs:
uses: Gottox/irc-message-action@v2.1.3
if: github.event_name == 'pull_request'
with:
server: "irc.libera.chat"
server: irc.libera.chat
notice: false
channel: "#fvwm"
nickname: fvwm3-gh-pr
Expand All @@ -35,8 +66,8 @@ jobs:
uses: Gottox/irc-message-action@v2.1.3
if: github.event_name == 'create' && github.event.ref_type == 'tag'
with:
server: "irc.libera.chat"
server: irc.libera.chat
notice: false
channel: "#fvwm"
nickname: fvwm-gh
message: ${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}
message: ${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
body: |
Hello,
This PR was created in response to a release workflow running.
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.
I've updated the version name and code commit: ${{ steps.make-commit.outputs.commit }}.
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.

Kangie marked this conversation as resolved.
Show resolved Hide resolved
# 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()
Kangie marked this conversation as resolved.
Show resolved Hide resolved
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,
)
1 change: 1 addition & 0 deletions bin/fvwm-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "libs/Picture.h"
#include "libs/Graphics.h"
#include "libs/Fsvg.h"
#include "libs/log.h"

int save_colors = 0;
Display *dpy;
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ expression a, b;
free(a);
a = \(0 \| NULL\);
}
)
)
2 changes: 1 addition & 1 deletion default-config/config
Original file line number Diff line number Diff line change
Expand Up @@ -702,4 +702,4 @@ DestroyModuleConfig EventNewDesk:*
# exists, then read it. This allows changes to default-config settings
# without needing a full copy of the default-config. This will also allow
# default-config changes to get used after upgrades (if applicable).
Test (f $[FVWM_USERDIR]/local.config) Read $[FVWM_USERDIR]/local.config
Test (f $[FVWM_USERDIR]/local.config) Read $[FVWM_USERDIR]/local.config
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,
)
2 changes: 1 addition & 1 deletion dev-docs/DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,4 @@ Updating fvwm-web
2. Update the `RELEASE` variable in `Makefile` to the desired version which
has been released.
3. Run `make`. This will update all relevant files.
4. `git commit -a` the result, and push it out.
4. `git commit -a` the result, and push it out.
Loading
Loading