Skip to content

Commit c490af0

Browse files
committed
Add meson build
Signed-off-by: Gaël Bonithon <gael@xfce.org>
1 parent 41848d0 commit c490af0

22 files changed

+747
-11
lines changed

Makefile.am

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
55
EXTRA_DIST = \
66
example.gtkrc-2.0 \
77
COMPOSITOR \
8-
README.md
8+
README.md \
9+
po/meson.build \
10+
meson_options.txt \
11+
meson.build \
12+
xfce-revision.h.in \
13+
$(NULL)
914

1015
SUBDIRS = \
1116
defaults \

common/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ libxfwm_common_la_LIBADD = \
1818
libxfwm_common_la_LDFLAGS = \
1919
-no-undefined \
2020
$(PLATFORM_LDFLAGS)
21+
22+
EXTRA_DIST = \
23+
meson.build \
24+
$(NULL)

common/meson.build

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
libxfwm_common = static_library(
2+
'xfwm-common',
3+
[
4+
'xfwm-common.c',
5+
'xfwm-common.h',
6+
],
7+
c_args: [
8+
'-DG_LOG_DOMAIN="@0@"'.format('libxfwm-common'),
9+
],
10+
include_directories: [
11+
include_directories('..'),
12+
],
13+
dependencies: [
14+
gtk,
15+
],
16+
install: false,
17+
)

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ AC_CONFIG_HEADERS([config.h])
3333

3434
AM_MAINTAINER_MODE()
3535
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36+
AC_DEFINE([VERSION_FULL], [PACKAGE_VERSION], [Alias for VERSION and PACKAGE_VERSION for meson compatibility])
3637

3738
dnl set helper path prefix
3839
AC_ARG_WITH([helper-path-prefix],

defaults/Makefile.am

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
defaultsdir = $(pkgdatadir)
22
defaults_DATA = defaults
3-
EXTRA_DIST = $(defaults_DATA)
3+
4+
EXTRA_DIST = \
5+
$(defaults_DATA) \
6+
meson.build \
7+
$(NULL)

defaults/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
install_data(
2+
'defaults',
3+
install_dir: pkgdatadir,
4+
)

helper-dialog/Makefile.am

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ helper_dialog_LDADD = \
2525
$(LIBX11_LDFLAGS) \
2626
$(GTK_LIBS)
2727

28+
EXTRA_DIST = \
29+
meson.build \
30+
$(NULL)

helper-dialog/meson.build

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
executable(
2+
'helper-dialog',
3+
[
4+
'helper-dialog.c',
5+
],
6+
c_args: [
7+
'-DG_LOG_DOMAIN="@0@"'.format('xfwm-helper-dialog'),
8+
],
9+
include_directories: [
10+
include_directories('..'),
11+
],
12+
dependencies: [
13+
gtk,
14+
libxfce4util,
15+
libx11,
16+
],
17+
install: true,
18+
install_dir: helper_path_prefix / 'xfce4' / 'xfwm4',
19+
)

icons/Makefile.am

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ SUBDIRS = \
55
128x128 \
66
scalable
77

8+
EXTRA_DIST = \
9+
meson.build \
10+
$(NULL)
11+
812
# install-data-local:
913
# @echo "Updating Gtk icon cache."
1014
# gtk-update-icon-cache -f -t $(datadir)/icons/hicolor/

icons/meson.build

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
sizes = [16, 48, 128]
2+
names = [
3+
'org.xfce.workspaces',
4+
'org.xfce.xfwm4-tweaks',
5+
'org.xfce.xfwm4',
6+
]
7+
8+
foreach name : names
9+
foreach size : sizes
10+
install_data(
11+
'@0@x@0@'.format(size) / '@0@.png'.format(name),
12+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '@0@x@0@'.format(size) / 'apps',
13+
)
14+
endforeach
15+
16+
install_data(
17+
'scalable' / '@0@.svg'.format(name),
18+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps',
19+
)
20+
endforeach
21+
22+
install_data(
23+
'48x48' / 'xfwm4-default.png',
24+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '48x48' / 'apps',
25+
)
26+
install_data(
27+
'scalable' / 'xfwm4-default.svg',
28+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps',
29+
)
30+
31+
sizes = [22]
32+
names = [
33+
'xfce-wm-close',
34+
'xfce-wm-maximize',
35+
'xfce-wm-menu',
36+
'xfce-wm-minimize',
37+
'xfce-wm-shade',
38+
'xfce-wm-stick',
39+
'xfce-wm-unmaximize',
40+
'xfce-wm-unshade',
41+
'xfce-wm-unstick',
42+
]
43+
44+
foreach name : names
45+
foreach size : sizes
46+
install_data(
47+
'@0@x@0@'.format(size) / '@0@.png'.format(name),
48+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '@0@x@0@'.format(size) / 'actions',
49+
)
50+
endforeach
51+
52+
install_data(
53+
'scalable' / '@0@.svg'.format(name),
54+
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'actions',
55+
)
56+
endforeach

meson.build

+235
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
project(
2+
'xfwm4',
3+
'c',
4+
version : '4.20.0-dev',
5+
license : 'GPL-2.0-or-later',
6+
meson_version : '>= 0.56.0',
7+
default_options : ['c_std=gnu11', 'buildtype=debugoptimized', 'warning_level=2']
8+
)
9+
10+
project_namespace = 'xfce'
11+
pkgdatadir = get_option('prefix') / get_option('datadir') / meson.project_name()
12+
13+
cc = meson.get_compiler('c')
14+
pkgconfig = import('pkgconfig')
15+
gnome = import('gnome')
16+
i18n = import('i18n')
17+
fs = import('fs')
18+
19+
dependency_versions = {
20+
'glib': '>= 2.72.0',
21+
'gtk': '>= 3.24.0',
22+
'libxfce4ui': '>= 4.12.0',
23+
'libxfce4util': '>= 4.8.0',
24+
'xfconf': '>= 4.13.0',
25+
'libwnck': '>= 3.14',
26+
'libx11': '>= 1.6.7',
27+
'xinerama': '>= 1.1.4',
28+
29+
'libxi': '>= 1.7.10',
30+
'libxres': '>= 1.2.0',
31+
'libxext': '>= 1.0.0',
32+
'libepoxy': '>= 1.0',
33+
'libstartup': '>= 0.5',
34+
'libxrender': '>= 0.9.10',
35+
'libxcomposite': '>= 0.2',
36+
'libxdamage': '>= 1.1.5',
37+
'libxfixes': '>= 5.0.3',
38+
'libxrandr': '>= 1.5.2',
39+
'libxpresent': '>= 1.0',
40+
'presentproto': '>= 1.1',
41+
}
42+
43+
glib = dependency('glib-2.0', version: dependency_versions['glib'])
44+
gtk = dependency('gtk+-3.0', version: dependency_versions['gtk'])
45+
libxfce4ui = dependency('libxfce4ui-2', version: dependency_versions['libxfce4ui'])
46+
libxfce4kbd = dependency('libxfce4kbd-private-3', version: dependency_versions['libxfce4ui'])
47+
libxfce4util = dependency('libxfce4util-1.0', version: dependency_versions['libxfce4util'])
48+
xfconf = dependency('libxfconf-0', version: dependency_versions['xfconf'])
49+
libwnck = dependency('libwnck-3.0', version: dependency_versions['libwnck'])
50+
libx11 = dependency('x11', version: dependency_versions['libx11'])
51+
xinerama = dependency('xinerama', version: dependency_versions['xinerama'])
52+
53+
xdt_csource = find_program('xdt-csource', required: true)
54+
55+
feature_cflags = []
56+
57+
libxi = dependency('xi', version: dependency_versions['libxi'], required: get_option('xi2'))
58+
if libxi.found()
59+
feature_cflags += '-DHAVE_XI2=1'
60+
endif
61+
62+
libxres = dependency('xres', version: dependency_versions['libxres'], required: get_option('xres'))
63+
if libxres.found()
64+
feature_cflags += '-DHAVE_XRES=1'
65+
endif
66+
67+
libxext = dependency('xext', version: dependency_versions['libxext'], required: get_option('xsync'))
68+
if libxext.found()
69+
feature_cflags += '-DHAVE_XSYNC=1'
70+
endif
71+
72+
libepoxy = dependency('epoxy', version: dependency_versions['libepoxy'], required: get_option('epoxy'))
73+
if libepoxy.found()
74+
feature_cflags += '-DHAVE_EPOXY=1'
75+
endif
76+
77+
libstartup = dependency('libstartup-notification-1.0', version: dependency_versions['libstartup'], required: get_option('startup-notification'))
78+
if libstartup.found()
79+
feature_cflags += '-DHAVE_LIBSTARTUP_NOTIFICATION=1'
80+
endif
81+
82+
libxrender = dependency('xrender', version: dependency_versions['libxrender'], required: get_option('render'))
83+
if libxrender.found()
84+
feature_cflags += '-DHAVE_RENDER=1'
85+
endif
86+
87+
libxrandr = dependency('xrandr', version: dependency_versions['libxrandr'], required: get_option('randr'))
88+
if libxrandr.found()
89+
feature_cflags += '-DHAVE_RANDR=1'
90+
endif
91+
92+
xpresent_deps = []
93+
xpresent_deps += dependency('xpresent', version: dependency_versions['libxpresent'], required: get_option('xpresent'))
94+
xpresent_deps += dependency('presentproto', version: dependency_versions['presentproto'], required: get_option('xpresent'))
95+
enable_xpresent = not get_option('xpresent').disabled()
96+
foreach dep : xpresent_deps
97+
enable_xpresent = enable_xpresent and dep.found()
98+
endforeach
99+
if enable_xpresent
100+
feature_cflags += '-DHAVE_PRESENT_EXTENSION=1'
101+
endif
102+
103+
compositor_deps = []
104+
compositor_deps += dependency('xrender', version: dependency_versions['libxrender'], required: get_option('compositor'))
105+
compositor_deps += dependency('xcomposite', version: dependency_versions['libxcomposite'], required: get_option('compositor'))
106+
compositor_deps += dependency('xdamage', version: dependency_versions['libxdamage'], required: get_option('compositor'))
107+
compositor_deps += dependency('xfixes', version: dependency_versions['libxfixes'], required: get_option('compositor'))
108+
enable_compositor = not get_option('compositor').disabled()
109+
foreach dep : compositor_deps
110+
enable_compositor = enable_compositor and dep.found()
111+
endforeach
112+
if enable_compositor
113+
feature_cflags += '-DHAVE_COMPOSITOR=1'
114+
endif
115+
116+
if get_option('poswin')
117+
feature_cflags += '-DSHOW_POSITION=1'
118+
endif
119+
120+
helper_path_prefix = get_option('helper-path-prefix')
121+
if helper_path_prefix == ''
122+
helper_path_prefix = get_option('prefix') / get_option('libdir')
123+
endif
124+
125+
headers = [
126+
'math.h',
127+
'memory.h',
128+
'stdlib.h',
129+
'string.h',
130+
]
131+
foreach header : headers
132+
if cc.check_header(header)
133+
feature_cflags += '-DHAVE_@0@=1'.format(header.underscorify().to_upper())
134+
endif
135+
endforeach
136+
137+
libm = cc.find_library('m', required: true)
138+
139+
extra_cflags = []
140+
extra_cflags_check = [
141+
'-Wmissing-declarations',
142+
'-Wmissing-noreturn',
143+
'-Wold-style-definition',
144+
'-Wredundant-decls',
145+
'-Wpointer-arith',
146+
'-Wcast-align',
147+
'-Winit-self',
148+
'-Wshadow',
149+
'-Wmissing-include-dirs',
150+
'-Wundef',
151+
'-Wformat',
152+
'-Wformat-security',
153+
'-Wformat-y2k',
154+
'-Wnested-externs',
155+
'-Wno-unused-parameter',
156+
'-Wno-declaration-after-statement',
157+
'-Wno-missing-field-initializers',
158+
'-Werror=implicit-function-declaration',
159+
'-Wno-error=deprecated-declarations',
160+
]
161+
162+
optimization = get_option('optimization')
163+
if get_option('debug') and optimization in ['0', 'g']
164+
extra_cflags_check += '-fstack-protector-strong'
165+
extra_cflags += [
166+
'-DDEBUG=1',
167+
'-DDEBUG_TRACE=1',
168+
'-DG_ENABLE_DEBUG',
169+
]
170+
elif optimization in ['3', 'minsize']
171+
extra_cflags += [
172+
'-DNDEBUG',
173+
'-DG_DISABLE_CAST_CHECKS',
174+
'-DG_DISABLE_ASSERT',
175+
]
176+
endif
177+
178+
if dependency_versions.has_key('glib')
179+
glib_version_parts = dependency_versions['glib'].split(' ')
180+
glib_min_version_parts = glib_version_parts[1].split('.')
181+
glib_min_version_define = 'GLIB_VERSION_@0@_@1@'.format(glib_min_version_parts[0], glib_min_version_parts[1])
182+
extra_cflags += [
183+
'-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_min_version_define),
184+
'-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_min_version_define),
185+
'-DG_LOG_USE_STRUCTURED=1',
186+
]
187+
endif
188+
189+
version_parts = meson.project_version().split('-dev')[0].split('.')
190+
version_short = '@0@.@1@'.format(version_parts[0], version_parts[1])
191+
192+
extra_cflags += [
193+
'-DPACKAGE="@0@"'.format(meson.project_name()),
194+
'-DPACKAGE_NAME="@0@"'.format(meson.project_name()),
195+
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
196+
'-DVERSION="@0@"'.format(meson.project_version()),
197+
'-DVERSION_SHORT="@0@"'.format(version_short),
198+
'-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version()),
199+
'-DPACKAGE_DATADIR="@0@"'.format(pkgdatadir),
200+
'-DPACKAGE_LOCALE_DIR="@0@"'.format(get_option('prefix') / get_option('localedir')),
201+
'-DPACKAGE_BUGREPORT="https://gitlab.xfce.org/@0@/@1@/-/issues"'.format(project_namespace, meson.project_name()),
202+
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
203+
'-DPREFIX="@0@"'.format(get_option('prefix')),
204+
'-DBINDIR="@0@"'.format(get_option('prefix') / get_option('bindir')),
205+
'-DDATADIR="@0@"'.format(get_option('prefix') / get_option('datadir')),
206+
'-DINCLUDEDIR="@0@"'.format(get_option('prefix') / get_option('includedir')),
207+
'-DLIBDIR="@0@"'.format(get_option('prefix') / get_option('libdir')),
208+
'-DLIBEXECDIR="@0@"'.format(get_option('prefix') / get_option('libexecdir')),
209+
'-DLOCALEDIR="@0@"'.format(get_option('prefix') / get_option('localedir')),
210+
'-DLOCALSTATEDIR="@0@"'.format(get_option('prefix') / get_option('localstatedir')),
211+
'-DSBINDIR="@0@"'.format(get_option('prefix') / get_option('sbindir')),
212+
'-DSYSCONFDIR="@0@"'.format(get_option('prefix') / get_option('sysconfdir')),
213+
'-DHAVE_XFCE_REVISION_H=1',
214+
]
215+
216+
add_project_arguments(cc.get_supported_arguments(extra_cflags_check), language: 'c')
217+
add_project_arguments(extra_cflags, language: 'c')
218+
add_project_arguments(feature_cflags, language: 'c')
219+
220+
xfce_revision_h = vcs_tag(
221+
command: ['git', 'rev-parse', '--short', 'HEAD'],
222+
fallback: 'UNKNOWN',
223+
input: 'xfce-revision.h.in',
224+
output: 'xfce-revision.h',
225+
replace_string: '@REVISION@',
226+
)
227+
228+
subdir('common')
229+
subdir('defaults')
230+
subdir('helper-dialog')
231+
subdir('icons')
232+
subdir('po')
233+
subdir('settings-dialogs')
234+
subdir('src')
235+
subdir('themes')

0 commit comments

Comments
 (0)