summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2021-02-12 16:18:55 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2021-02-12 16:18:55 +0000
commit0674d038f535ece1bafb65ae54be5fb3b17308e5 (patch)
tree944f3e8a1a4744eddcf04d07839fcd825b640ea0
parentdd0f6e5351d9e902b786b0b9acb60992da6bd8c2 (diff)
meson build system
Test Plan: compilation Reviewers: raster, devilhorns Differential Revision: https://phab.enlightenment.org/D12238
-rw-r--r--data/desktop/meson.build10
-rw-r--r--data/fonts/meson.build31
-rw-r--r--data/images/meson.build5
-rw-r--r--data/themes/meson.build23
-rw-r--r--meson.build148
-rw-r--r--meson_options.txt6
-rw-r--r--src/bin/meson.build53
-rw-r--r--src/lib/meson.build49
8 files changed, 325 insertions, 0 deletions
diff --git a/data/desktop/meson.build b/data/desktop/meson.build
new file mode 100644
index 0000000..b6aa39b
--- /dev/null
+++ b/data/desktop/meson.build
@@ -0,0 +1,10 @@
1
2install_data(
3 sources : 'express.desktop',
4 install_dir : join_paths(dir_data, 'applications')
5)
6
7install_data(
8 sources : 'express.png',
9 install_dir : join_paths(dir_data, 'icons')
10)
diff --git a/data/fonts/meson.build b/data/fonts/meson.build
new file mode 100644
index 0000000..e222439
--- /dev/null
+++ b/data/fonts/meson.build
@@ -0,0 +1,31 @@
1
2font_files = [
3 '10x20.pcf',
4 '4x6.pcf',
5 '5x7.pcf',
6 '5x8.pcf',
7 '6x10.pcf',
8 '6x12.pcf',
9 '6x13.pcf',
10 '6x9.pcf',
11 '7x13.pcf',
12 '7x14.pcf',
13 '8x13.pcf',
14 '9x15.pcf',
15 '9x18.pcf',
16 'nexus.pcf',
17 'terminus-12.pcf',
18 'terminus-14-bold.pcf',
19 'terminus-14.pcf',
20 'terminus-16-bold.pcf',
21 'terminus-16.pcf',
22 'terminus-18-bold.pcf',
23 'terminus-18.pcf',
24 'terminus-20-bold.pcf',
25 'terminus-20.pcf'
26]
27
28install_data(
29 sources : font_files,
30 install_dir : join_paths(dir_pkgdata, 'fonts')
31)
diff --git a/data/images/meson.build b/data/images/meson.build
new file mode 100644
index 0000000..65e7102
--- /dev/null
+++ b/data/images/meson.build
@@ -0,0 +1,5 @@
1
2install_data(
3 sources : 'operator.png',
4 install_dir : join_paths(dir_pkgdata, 'images')
5)
diff --git a/data/themes/meson.build b/data/themes/meson.build
new file mode 100644
index 0000000..1f347a5
--- /dev/null
+++ b/data/themes/meson.build
@@ -0,0 +1,23 @@
1
2edc_files = [
3 'default.edc'
4]
5
6express_themes = []
7
8_edje_cc = find_program('edje_cc', native: true)
9edje_cc_exe = [_edje_cc]
10
11foreach edc_file : edc_files
12 express_themes += custom_target('edje_cc_' + edc_file,
13 input : edc_file,
14 depfile: '@BASENAME@.edj.d',
15 output : '@BASENAME@.edj',
16 command : edje_cc_exe + [ '-beta', '-fastcomp',
17 '-sd', join_paths(meson.current_source_dir(), 'sounds'),
18 '-id', join_paths(meson.current_source_dir(), 'images'),
19 '@INPUT@', '@OUTPUT@'],
20 install : true,
21 install_dir : join_paths(dir_pkgdata, 'themes'),
22 )
23endforeach
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..e4cb4b9
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,148 @@
1project('express', 'c',
2 version : '0.0.2',
3 meson_version : '>= 0.53',
4 default_options : [
5 'warning_level=2',
6 'buildtype=debugoptimized'
7 ]
8)
9
10v_array = meson.project_version().split('.')
11v_maj = v_array[0]
12v_min = v_array[1]
13v_mic = v_array[2]
14
15# install paths
16
17dir_prefix = get_option('prefix')
18dir_include = join_paths(dir_prefix, get_option('includedir'))
19dir_pkginclude = join_paths(dir_include, meson.project_name())
20dir_bin = join_paths(dir_prefix, get_option('bindir'))
21dir_lib = join_paths(dir_prefix, get_option('libdir'))
22dir_data = join_paths(dir_prefix, get_option('datadir'))
23dir_pkgdata = join_paths(dir_data, meson.project_name())
24dir_locale = join_paths(dir_prefix, get_option('localedir'))
25
26# host
27
28host_os = host_machine.system()
29
30# binaries
31
32cc = meson.get_compiler('c')
33
34express_cflags = []
35express_cflags_try = [
36 '-fvisibility=hidden',
37 '-fdata-sections',
38 '-ffunction-sections',
39 '-fno-strict-aliasing',
40 '-Wl,--gc-sections',
41 '-Wl,--as-needed',
42 '-Wl,--no-copy-dt-needed-entries',
43 '-Wshadow',
44 '-Wstrict-prototypes',
45 '-Werror=missing-prototypes',
46 '-Werror=pointer-arith',
47 '-Wno-missing-field-initializers']
48
49foreach cf: express_cflags_try
50 if cc.has_argument(cf) == true
51 express_cflags += cf
52 endif
53endforeach
54add_global_arguments(express_cflags, language: 'c')
55
56have_visibility_hidden = cc.has_argument('-fvisibility=hidden')
57if have_visibility_hidden
58 add_global_arguments('-fvisibility=hidden', language: 'c')
59endif
60
61pkgconfig = import('pkgconfig')
62windows = import('windows')
63
64edje_cc = find_program('edje_cc', native: true)
65edje_cc_exe = [ edje_cc ]
66
67# libraries
68
69config_dir = [include_directories('.')]
70
71efl_req = '>= 1.12.0'
72express_lib_deps = [
73 dependency('eina', version : efl_req),
74 dependency('ecore', version : efl_req),
75 dependency('ecore-con', version : efl_req)
76]
77
78requirement_express_pc = ' eina ' + efl_req + ' ecore ' + efl_req + ' ecore-con ' + efl_req
79
80if get_option('nls') == true
81 express_lib_deps += cc.find_library('intl', required: false)
82endif
83
84express_cargs = [ ]
85
86# configuration
87
88config_h = configuration_data()
89config_h.set_quoted('PACKAGE_NAME', meson.project_name())
90config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
91config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
92config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
93config_h.set_quoted('PACKAGE_DATA_DIR', dir_data)
94config_h.set_quoted('PACKAGE_LOCALE_DIR', dir_locale)
95
96subdir('data/desktop')
97subdir('data/fonts')
98subdir('data/images')
99subdir('data/themes')
100subdir('src/lib')
101subdir('src/bin')
102#if get_option('nls') == true
103# subdir('po')
104#endif
105
106# Use config_h after all subdirs have set values
107
108configure_file(output : 'express_config.h', configuration : config_h)
109
110# pkg-config
111
112pkgconf = configuration_data()
113
114pkgconf.set('prefix', get_option('prefix'))
115pkgconf.set('exec_prefix', '${prefix}')
116pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
117pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
118pkgconf.set('pkgincludedir', '${prefix}/@0@'.format(get_option('includedir')) + '/express')
119pkgconf.set('VMAJ', v_maj)
120pkgconf.set('VERSION', meson.project_version())
121pkgconf.set('requirements_libexpress_pc', requirement_express_pc)
122
123pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
124
125configure_file(
126 input : join_paths(meson.source_root(), 'express.pc.in'),
127 output : 'express.pc',
128 configuration : pkgconf,
129 install_dir : pkg_install_dir
130)
131
132# output
133
134summary({'OS': host_os,
135 }, section: 'Configuration Options Summary:')
136
137summary({'prefix': dir_prefix,
138 'bindir': dir_bin,
139 'libdir': dir_lib,
140 'incdir': dir_include,
141 'pkgincdir': dir_pkginclude,
142 'datadir': dir_data,
143 'pkgdatadir': dir_pkgdata,
144 }, section: 'Directories:')
145
146summary({'compilation': 'ninja',
147 'installation': 'ninja install',
148 }, section: 'Compilation')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..d48dc63
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
1
2option('nls',
3 type: 'boolean',
4 value: true,
5 description: 'enable localization: (default=true)'
6)
diff --git a/src/bin/meson.build b/src/bin/meson.build
new file mode 100644
index 0000000..7141dd5
--- /dev/null
+++ b/src/bin/meson.build
@@ -0,0 +1,53 @@
1
2express_bin_src = [
3 'callbacks.c',
4 'channel.c',
5 'colors.c',
6 'commands.c',
7 'config.c',
8 'dbus.c',
9 'gravatar.c',
10 'grid.c',
11 'grid_save.c',
12 'main.c',
13 'media.c',
14 'options.c',
15 'options_channels.c',
16 'options_colors.c',
17 'options_font.c',
18 'options_general.c',
19 'options_network.c',
20 'options_networks.c',
21 'options_servers.c',
22 'options_tools.c',
23 'options_video.c',
24 'selector.c',
25 'theme.c',
26 'utils.c',
27 'window.c',
28 'lz4/lz4.c',
29 'md5/md5.c'
30]
31
32express_bin_args = [ ]
33
34if get_option('nls')
35 express_bin_args += [ '-DGETTEXT_PACKAGE="express"' ]
36endif
37
38express_headers = [
39 'sys/mman.h'
40]
41
42foreach header : express_headers
43 if cc.has_header(header)
44 config_h.set10('HAVE_'+header.underscorify().to_upper(), true)
45 endif
46endforeach
47
48express_bin = executable('express', express_bin_src,
49 c_args : [ express_bin_args, '-DHAVE_CONFIG_H' ],
50 dependencies : [ express, dependency('elementary', version : efl_req) ],
51 include_directories : config_dir,
52 install : true
53)
diff --git a/src/lib/meson.build b/src/lib/meson.build
new file mode 100644
index 0000000..760d797
--- /dev/null
+++ b/src/lib/meson.build
@@ -0,0 +1,49 @@
1
2express_header_src = [ 'Express.h' ]
3
4install_headers(express_header_src,
5 install_dir : dir_pkginclude + '-' + v_maj
6)
7
8express_lib_src = [
9 'main.c',
10 'network.c'
11]
12
13express_headers = [
14 'arpa/inet.h',
15 'netinet/in.h',
16 'sys/socket.h',
17]
18
19foreach header : express_headers
20 if cc.has_header(header)
21 config_h.set10('HAVE_'+header.underscorify().to_upper(), true)
22 endif
23endforeach
24
25win32 = ['windows']
26sys_windows = win32.contains(host_os)
27if sys_windows == true
28 ws2_32 = cc.find_library('ws2_32')
29 express_ext_deps = [ ws2_32 ]
30else
31 express_ext_deps = [ ]
32endif
33
34express_lib = library('express', express_lib_src,
35 c_args : [ express_cargs,
36 '-DHAVE_CONFIG_H',
37 '-DEXPRESS_WIN32_BUILD'
38 ],
39 dependencies : [ express_lib_deps, express_ext_deps ],
40 include_directories : config_dir,
41 install : true,
42 version : meson.project_version()
43)
44
45express = declare_dependency(
46 include_directories : [ include_directories('.')],
47 link_with : express_lib,
48 dependencies : express_lib_deps
49)