Build: add meson build system

Test Plan: Compilation, comparison with autotools, and run of enventor (on Windows)

Reviewers: Hermet, raster

Differential Revision: https://phab.enlightenment.org/D12304
This commit is contained in:
Vincent Torri 2021-11-04 16:47:57 +09:00 committed by Hermet Park
parent 2f2bf09b1a
commit f1f92e6abb
16 changed files with 478 additions and 0 deletions

14
data/autocomp/meson.build Normal file
View File

@ -0,0 +1,14 @@
custom_target('autocomp.eet',
input : 'autocomp.src',
output : 'autocomp.eet',
command : eet_exe + [
'-e',
join_paths(meson.current_build_dir(), 'autocomp.eet'),
'node',
join_paths(meson.current_source_dir(), 'autocomp.src'),
'1'
],
install : true,
install_dir : join_paths(dir_pkgdata, 'autocomp')
)

19
data/color/meson.build Normal file
View File

@ -0,0 +1,19 @@
custom_target('color.eet',
input : 'edc.src',
output : 'edc.eet',
command : eet_exe + [
'-e',
join_paths(meson.current_build_dir(), 'edc.eet'),
'color',
join_paths(meson.current_source_dir(), 'edc.src'),
'1'
],
install : true,
install_dir : join_paths(dir_pkgdata, 'color')
)
install_data(
sources : 'syntax_template.dat',
install_dir : join_paths(dir_pkgdata, 'color')
)

5
data/desktop/meson.build Normal file
View File

@ -0,0 +1,5 @@
install_data(
sources : 'enventor.desktop',
install_dir : join_paths(dir_data, 'applications')
)

13
data/help/meson.build Normal file
View File

@ -0,0 +1,13 @@
help_files = [
'INTRO',
'HISTORY',
'SHORTCUT',
'COMMAND',
'DEVEL'
]
install_data(
sources : help_files,
install_dir : join_paths(dir_pkgdata, 'help')
)

5
data/icon/meson.build Normal file
View File

@ -0,0 +1,5 @@
install_data(
sources : 'enventor.png',
install_dir : join_paths(dir_data, 'icons')
)

59
data/images/meson.build Normal file
View File

@ -0,0 +1,59 @@
image_files = [
'ENVENTOR_EMBEDDED_BAT1.svg',
'ENVENTOR_EMBEDDED_BAT2.svg',
'ENVENTOR_EMBEDDED_BG1.png',
'ENVENTOR_EMBEDDED_BG2.png',
'ENVENTOR_EMBEDDED_BG3.png',
'ENVENTOR_EMBEDDED_BUTTON_BG.png',
'ENVENTOR_EMBEDDED_BUTTON_BG_DOWN.png',
'ENVENTOR_EMBEDDED_BUTTON_BG_HOVER.png',
'ENVENTOR_EMBEDDED_CHERRY.png',
'ENVENTOR_EMBEDDED_FIELD.png',
'ENVENTOR_EMBEDDED_ICON_ARROW.png',
'ENVENTOR_EMBEDDED_ICON_BADGE.png',
'ENVENTOR_EMBEDDED_ICON_BADGE_DOWN.png',
'ENVENTOR_EMBEDDED_ICON_CLIP.png',
'ENVENTOR_EMBEDDED_ICON_CLIP_DOWN.png',
'ENVENTOR_EMBEDDED_ICON_DOCK.png',
'ENVENTOR_EMBEDDED_ICON_DOCK_DOWN.png',
'ENVENTOR_EMBEDDED_ICON_LOCK.png',
'ENVENTOR_EMBEDDED_ICON_LOCK_DOWN.png',
'ENVENTOR_EMBEDDED_IMAGE.png',
'ENVENTOR_EMBEDDED_LADDER.png',
'ENVENTOR_EMBEDDED_MASK.png',
'ENVENTOR_EMBEDDED_MELON.png',
'ENVENTOR_EMBEDDED_MONTH_STROKE.png',
'ENVENTOR_EMBEDDED_MOONPHASE_COVER.png',
'ENVENTOR_EMBEDDED_MOONPHASE_MOON.png',
'ENVENTOR_EMBEDDED_NEEDLE_HOUR.png',
'ENVENTOR_EMBEDDED_NEEDLE_HOUR_RECT.png',
'ENVENTOR_EMBEDDED_NEEDLE_MINUTE.png',
'ENVENTOR_EMBEDDED_NEEDLE_MINUTE_RECT.png',
'ENVENTOR_EMBEDDED_NEEDLE_SECOND.png',
'ENVENTOR_EMBEDDED_NEEDLE_SECOND_RECT.png',
'ENVENTOR_EMBEDDED_PLATFORM.png',
'ENVENTOR_EMBEDDED_SVG.svg',
'ENVENTOR_EMBEDDED_TACK.png',
'ENVENTOR_EMBEDDED_TRIAB-01.png',
'ENVENTOR_EMBEDDED_TRIAB-02.png',
'ENVENTOR_EMBEDDED_TRIAB-03.png',
'ENVENTOR_EMBEDDED_TRIAB-04.png',
'ENVENTOR_EMBEDDED_TRIAB-05.png',
'ENVENTOR_EMBEDDED_TRIAB-06.png',
'ENVENTOR_EMBEDDED_TRIAB-07.png',
'ENVENTOR_EMBEDDED_TRIAB-08.png',
'ENVENTOR_EMBEDDED_TRIAB-09.png',
'ENVENTOR_EMBEDDED_TRIAB-10.png',
'ENVENTOR_EMBEDDED_TRIAB-11.png',
'ENVENTOR_EMBEDDED_TRIAB-12.png',
'ENVENTOR_EMBEDDED_WATCHFACE.png',
'ENVENTOR_EMBEDDED_WATCHFACE_RECT.png',
'ENVENTOR_EMBEDDED_WATERMELON.png',
'enventor_logo.png',
]
install_data(
sources : image_files,
install_dir : join_paths(dir_pkgdata, 'images')
)

View File

@ -0,0 +1,5 @@
install_data(
sources : 'reference.src',
install_dir : join_paths(dir_pkgdata, 'reference')
)

5
data/sounds/meson.build Normal file
View File

@ -0,0 +1,5 @@
install_data(
sources : 'ENVENTOR_EMBEDDED_TAP.wav',
install_dir : join_paths(dir_pkgdata, 'sounds')
)

View File

@ -0,0 +1,54 @@
edc_template_files = [
'Basic.edc',
'BgAnimation.edc',
'Clip.edc',
'CustomButton.edc',
'Empty.edc',
'GameStage.edc',
'Group.edc',
'Image.edc',
'Interpolation.edc',
'Listitem.edc',
'Map.edc',
'Mask.edc',
'MobileLayout.edc',
'Morphing.edc',
'MouseEvent.edc',
'Proxy.edc',
'Rect.edc',
'Rotation+Zoom.edc',
'Sound.edc',
'Spacer.edc',
'Text.edc',
'Textblock.edc',
'Transition.edc',
'Tween.edc',
'Vector.edc',
'Watchface.edc',
'Watchface2.edc'
]
enventor_templates = []
foreach edc_file : edc_template_files
enventor_templates += custom_target('edje_cc_' + edc_file,
input : edc_file,
depfile : '@BASENAME@.edj.d',
output : '@BASENAME@.edj',
command : edje_cc_exe +
[
'-beta',
'-sd', join_paths(meson.source_root(), 'data/sounds'),
'-id', join_paths(meson.source_root(), 'data/images'),
'@INPUT@', '@OUTPUT@'
],
install : true,
install_dir : join_paths(dir_pkgdata, 'templates'),
)
endforeach
install_data(
sources : edc_template_files,
install_dir : join_paths(dir_pkgdata, 'templates')
)

View File

@ -0,0 +1,25 @@
edc_theme_files = [
'enventor.edc'
]
enventor_themes = []
_edje_cc = find_program('edje_cc', native: true)
edje_cc_exe = [_edje_cc]
foreach edc_file : edc_theme_files
enventor_themes += custom_target('edje_cc_' + edc_file,
input : edc_file,
depfile : '@BASENAME@.edj.d',
output : '@BASENAME@.edj',
command : edje_cc_exe +
[
'-sd', join_paths(meson.current_source_dir(), 'sounds'),
'-id', join_paths(meson.current_source_dir(), 'images'),
'@INPUT@', '@OUTPUT@'
],
install : true,
install_dir : join_paths(dir_pkgdata, 'themes'),
)
endforeach

152
meson.build Normal file
View File

@ -0,0 +1,152 @@
project('enventor', 'c',
version : '1.0.99',
meson_version : '>= 0.53',
default_options : [
'warning_level=2',
'buildtype=debugoptimized',
'c_std=c99'
]
)
v_array = meson.project_version().split('.')
v_maj = v_array[0]
v_min = v_array[1]
v_mic = v_array[2]
# install paths
dir_prefix = get_option('prefix')
dir_include = join_paths(dir_prefix, get_option('includedir'))
dir_pkginclude = join_paths(dir_include, meson.project_name())
dir_bin = join_paths(dir_prefix, get_option('bindir'))
dir_lib = join_paths(dir_prefix, get_option('libdir'))
dir_data = join_paths(dir_prefix, get_option('datadir'))
dir_pkgdata = join_paths(dir_data, meson.project_name())
dir_locale = join_paths(dir_prefix, get_option('localedir'))
# binaries
cc = meson.get_compiler('c')
enventor_cflags = []
enventor_cflags_try = [
'-Wshadow',
'-Wstrict-prototypes',
'-Werror=missing-prototypes',
'-Werror=pointer-arith',
'-Wno-missing-field-initializers']
foreach cf: enventor_cflags_try
if cc.has_argument(cf) == true
enventor_cflags += cf
endif
endforeach
add_global_arguments(enventor_cflags, language: 'c')
have_visibility_hidden = cc.has_argument('-fvisibility=hidden')
if have_visibility_hidden
add_global_arguments('-fvisibility=hidden', language: 'c')
endif
pkgconfig = import('pkgconfig')
windows = import('windows')
eet = find_program('eet', native: true)
eet_exe = [ eet ]
edje_cc = find_program('edje_cc', native: true)
edje_cc_exe = [ edje_cc ]
# libraries
config_dir = [include_directories('.')]
efl_req = '>= 1.18.0'
enventor_deps = [
dependency('eina', version : efl_req),
dependency('eo', version : efl_req),
dependency('efl', version : efl_req),
dependency('eet', version : efl_req),
dependency('ecore', version : efl_req),
dependency('ecore-file', version : efl_req),
dependency('evas', version : efl_req),
dependency('eio', version : efl_req),
dependency('efreet', version : efl_req),
dependency('edje', version : efl_req),
dependency('elementary', version : efl_req)
]
requirement_enventor_pc = ' eina ' + efl_req + ' eo ' + efl_req + ' efl ' + efl_req + ' eet ' + efl_req + ' ecore ' + efl_req + ' ecore-file ' + efl_req + ' evas ' + efl_req + ' eio ' + efl_req + ' efreet ' + efl_req + ' edje ' + efl_req + ' elementary ' + efl_req
enventor_cargs = [
'-D_POSIX_C_SOURCE=200809L',
'-D_XOPEN_SOURCE=500' ]
have_nls = false
if get_option('nls') == true
intl_dep = cc.find_library('intl', required: false)
if intl_dep.found() == true and cc.has_header('libintl.h') == true
enventor_deps += cc.find_library('intl', required: true)
enventor_cargs += '-DENABLE_NLS'
have_nls = true
endif
endif
# configuration
config_h = configuration_data()
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
config_h.set_quoted('PACKAGE_DATA_DIR', dir_pkgdata)
config_h.set_quoted('LOCALE_DIR', dir_locale)
config_h.set('EFL_BETA_API_SUPPORT', '1')
config_h.set('EFL_UI_FOCUS_OBJECT_PROTECTED', '1')
config_h.set('ENVENTOR_BETA_API_SUPPORT', '1')
subdir('src/lib')
subdir('src/bin')
subdir('data/autocomp')
subdir('data/color')
subdir('data/desktop')
subdir('data/help')
subdir('data/icon')
subdir('data/images')
subdir('data/reference')
subdir('data/sounds')
subdir('data/templates')
subdir('data/themes/default')
subdir('pc')
if have_nls == true
subdir('po')
endif
install_data(
sources : 'README',
install_dir : join_paths(dir_pkgdata, 'docs')
)
# Use config_h after all subdirs have set values
configure_file(output : 'config.h', configuration : config_h)
# output
summary({'OS': host_machine.system(),
'NLS': have_nls ? 'yes' : 'no'
}, section: 'Configuration Options Summary:')
summary({'prefix': dir_prefix,
'bindir': dir_bin,
'libdir': dir_lib,
'incdir': dir_include,
'pkgincdir': dir_pkginclude,
'datadir': dir_data,
'pkgdatadir': dir_pkgdata,
'localedir': dir_locale,
}, section: 'Directories:')
summary({'compilation': 'ninja',
'installation': 'ninja install',
}, section: 'Compilation')

6
meson_options.txt Normal file
View File

@ -0,0 +1,6 @@
option('nls',
type: 'boolean',
value: true,
description: 'enable localization: (default=true)'
)

20
pc/meson.build Normal file
View File

@ -0,0 +1,20 @@
pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix'))
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
pkgconf.set('pkgincludedir', '${prefix}/@0@'.format(get_option('includedir')) + '/enventor')
pkgconf.set('ENVENTOR_VERSION_MAJOR', v_maj)
pkgconf.set('VERSION', meson.project_version())
pkgconf.set('requirement_enventor', requirement_enventor_pc)
pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
configure_file(
input : join_paths(meson.source_root(), 'pc/enventor.pc.in'),
output : 'enventor.pc',
configuration : pkgconf,
install_dir : pkg_install_dir
)

17
po/meson.build Normal file
View File

@ -0,0 +1,17 @@
if get_option('nls')
i18n = import('i18n')
i18n.gettext(meson.project_name(),
args: [
'--directory=' + meson.source_root(),
'--keyword=_',
'--keyword=d_:1',
'--keyword=P_:1,2',
'--keyword=dP_:1,2',
'--keyword=N_',
'--keyword=NP_:1,2',
'--from-code=UTF-8',
'--foreign-user'
])
config_h.set('ENABLE_NLS', '1')
endif

34
src/bin/meson.build Normal file
View File

@ -0,0 +1,34 @@
enventor_bin_src = [
'base_gui.c',
'build_setting.c',
'config_data.c',
'console.c',
'edc_navigator.c',
'file_browser.c',
'file_mgr.c',
'file_tab.c',
'goto.c',
'help.c',
'live_edit.c',
'main.c',
'menu.c',
'newfile.c',
'panes.c',
'preference_setting.c',
'search.c',
'setting.c',
'statusbar.c',
'text_setting.c',
'tools.c',
'utils.c'
]
enventor_bin = executable('enventor', enventor_bin_src,
c_args : [ enventor_cargs,
'-DHAVE_CONFIG_H',
'-I' + join_paths(meson.source_root(), 'src/include') ],
dependencies : [ enventor, dependency('elementary', version : efl_req) ],
include_directories : config_dir,
install : true
)

45
src/lib/meson.build Normal file
View File

@ -0,0 +1,45 @@
enventor_header_src = [ 'Enventor.h' ]
install_headers(enventor_header_src,
install_dir : dir_pkginclude + '-' + v_maj
)
enventor_src = [
'auto_comp.c',
'build.c',
'ctxpopup.c',
'dummy_obj.c',
'edc_editor.c',
'edc_parser.c',
'edj_mgr.c',
'edj_viewer.c',
'enventor_main.c',
'enventor_smart.c',
'redoundo.c',
'reference.c',
'syntax_color.c',
'syntax_helper.c',
'syntax_indent.c',
'template.c',
'util.c',
'wireframes_obj.c'
]
enventor_lib = library('enventor', enventor_src,
c_args : [ enventor_cargs,
'-DHAVE_CONFIG_H',
'-DENVENTOR_WIN32_BUILD_SUPPORT',
'-I' + join_paths(meson.source_root(), 'src/include')
],
dependencies : enventor_deps,
include_directories : config_dir,
install : true,
version : meson.project_version()
)
enventor = declare_dependency(
include_directories : [ include_directories('.')],
link_with : enventor_lib,
dependencies : enventor_deps
)