diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 467 |
1 files changed, 467 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..4dc04200 --- /dev/null +++ b/meson.build @@ -0,0 +1,467 @@ +# Meson file for Sylpheed + +project('sylpheed', 'c', + version : '3.7.0', + license : ['GPL2+', 'LGPL2+'], + default_options : ['buildtype=debugoptimized']) + +gnome = import('gnome') + + +# Localisation +subdir('po') + + +# Dependency packages + +gtk = dependency('gtk+-2.0') +glib = dependency('glib-2.0') +gobject = dependency('gobject-2.0') +gmodule = dependency('gmodule-2.0') +openssl = dependency('openssl', required : false) +gtkspell = dependency('gtkspell-2.0', required : false) +aspell = dependency('aspell', required : false) +enchant = dependency('enchant', required : false) +oniguruma = dependency('oniguruma', required : false) +gpgme = dependency('gpgme', version: '>= 1.0', required : false) # Needs Meson 0.51.0 +# Compface check is further down + +# Suppress some compiler warnings (for now) + +add_project_arguments('-Wno-deprecated-declarations', language : 'c') +add_project_arguments('-Wno-unused-but-set-variable', language : 'c') +add_project_arguments('-Wno-format', language : 'c') + + +# Configuration + +compiler = meson.get_compiler('c') +conf_data = configuration_data() + +add_project_arguments('-DHAVE_CONFIG_H', language : 'c') +add_project_arguments('-DUSE_THREADS', language : 'c') +add_project_arguments('-DSYSCONFDIR="'+join_paths(get_option('prefix'), + get_option('sysconfdir'))+'"', + language : 'c') +add_project_arguments('-DMANUALDIR="'+join_paths(get_option('prefix'), + get_option('datadir'), + 'sylpheed', + 'manual')+'"', + language : 'c') +add_project_arguments('-DFAQDIR="'+join_paths(get_option('prefix'), + get_option('datadir'), + 'sylpheed', + 'faq')+'"', + language : 'c') +add_project_arguments('-DTHEMEDIR="'+join_paths(get_option('prefix'), + get_option('datadir'), + 'sylpheed', + 'icons')+'"', + language : 'c') +add_project_arguments('-DPLUGINDIR="'+join_paths(get_option('prefix'), + get_option('libdir'), + 'sylpheed', + 'plugins')+'"', + language : 'c') +add_project_arguments('-DLOCALEDIR="'+join_paths(get_option('prefix'), + get_option('localedir'))+'"', + language : 'c') + +# NB Code uses TARGET_ALIAS where it should really be HOST_ALIAS +# "*_ALIAS" is an autotools-ism, so make something similar here. +add_project_arguments('-DTARGET_ALIAS="'+host_machine.cpu_family()+'-'+host_machine.system()+'"', + language : 'c') + +if get_option('update_check') + add_project_arguments('-DUSE_UPDATE_CHECK', language : 'c') + if get_option('update_check_plugin') + add_project_arguments('-DUSE_UPDATE_CHECK_PLUGIN', language : 'c') + endif +else + if get_option('update_check_plugin') + warning('You must set update_check=true to use update_check_plugin=true') + endif +endif + +if openssl.found() + add_project_arguments('-DUSE_SSL', language : 'c') +endif + +if enchant.found() + add_project_arguments('-DUSE_ENCHANT', language : 'c') +endif + +if gtkspell.found() and (aspell.found() or enchant.found()) + add_project_arguments('-DUSE_GTKSPELL', language : 'c') +endif + +if oniguruma.found() + add_project_arguments('-DUSE_ONIGURUMA', language : 'c') +endif + +if compiler.has_header('compface.h') + conf_data.set('HAVE_LIBCOMPFACE', 1) + compface_link_args = ['-lcompface'] +else + compface_link_args = [] +endif + +compface = declare_dependency(compile_args : [], + link_args : compface_link_args) + +if gpgme.found() + if compiler.has_function('gpgme_io_writen', prefix : '#include <gpgme.h>') + conf_data.set('HAVE_GPGME_IO_WRITEN', 1) + endif + conf_data.set('USE_GPGME', 1) +endif + +if compiler.has_header('sys/wait.h') + conf_data.set('HAVE_SYS_WAIT_H', 1) +endif + +if compiler.has_header('sys/select.h') + conf_data.set('HAVE_SYS_SELECT_H', 1) +endif + +if compiler.has_header('netdb.h') + conf_data.set('HAVE_NETDB_H', 1) +endif + +if compiler.has_header('sys/utsname.h') + conf_data.set('HAVE_SYS_UTSNAME_H', 1) +endif + +if compiler.has_header('alloca.h') + conf_data.set('HAVE_ALLOCA_H', 1) +endif + +if compiler.has_header('paths.h') + conf_data.set('HAVE_PATHS_H', 1) +endif + +if compiler.has_header('locale.h') + conf_data.set('HAVE_LOCALE_H', 1) +endif + +if compiler.has_header('sys/mman.h') + conf_data.set('HAVE_SYS_MMAN_H', 1) +endif + +if compiler.has_header('lockfile.h') + conf_data.set('HAVE_LOCKFILE_H', 1) + conf_data.set('HAVE_LIBLOCKFILE', 1) + lockfile_link_args = ['-llockfile'] +else + lockfile_link_args = [] +endif + +lockfile = declare_dependency(compile_args : [], + link_args : lockfile_link_args) + +if compiler.has_header('regex.h') + conf_data.set('HAVE_REGEX_H', 1) +endif + +if compiler.has_function('regcomp', prefix : '#include <regex.h>') + conf_data.set('HAVE_REGCOMP', 1) +endif + +if compiler.has_function('lockf', prefix : '#include <unistd.h>') + conf_data.set('HAVE_LOCKF', 1) +endif + +if compiler.has_function('flock', prefix : '#include <sys/file.h>') + conf_data.set('HAVE_FLOCK', 1) +endif + +if compiler.has_function('mlock', prefix : '#include <sys/mman.h>') + conf_data.set('HAVE_MLOCK', 1) +endif + +if compiler.has_function('iconv', prefix : '#include <iconv.h>') + conf_data.set('HAVE_ICONV', 1) +endif +conf_data.set('ICONV_CONST', '') + +if compiler.has_function('truncate', prefix : '''#include <unistd.h> + #include <sys/types.h> +''') + conf_data.set('HAVE_TRUNCATE', 1) +endif + +code = '''#include <dirent.h> + void func() { + struct dirent d; d.d_type = DT_REG; + } +''' +if compiler.compiles(code, name : 'struct dirent has d_type member') + conf_data.set('HAVE_DIRENT_D_TYPE', 1) +endif + +if host_machine.system() == 'windows' + code = '''#define INET6 + #include <sys/types.h> + #include <winsock2.h> + #include <ws2tcpip.h> + void func() { + int x = IPPROTO_IPV6; struct in6_addr a; + } + ''' +else + code = '''#define INET6 + #include <sys/types.h> + #include <netinet/in.h> + void func() { + int x = IPPROTO_IPV6; struct in6_addr a; + } + ''' +endif +if compiler.compiles(code, name : 'IPv6 is available') + conf_data.set('INET6', 1) +endif + +# FIXME: JPilot + +configure_file(output : 'config.h', + configuration : conf_data) + + +# version.h file + +version_data = configuration_data() + +version_data.set('MAJOR_VERSION', '3') +version_data.set('MINOR_VERSION', '7') +version_data.set('MICRO_VERSION', '0') +version_data.set('EXTRA_VERSION', '') +version_data.set('PACKAGE', 'sylpheed') +version_data.set('VERSION', '3.7.0') + +version_h_tmp = configure_file(input : 'src/version.h.in', + output : 'version.h.tmp', + configuration : version_data) + +version_h = vcs_tag(output : 'version.h', + input : version_h_tmp, + replace_string : 'VCS_TAG', + command: ['git', 'rev-parse', '--short', 'HEAD']) + +# Instructions for building libsylph + +libsylph_includes = include_directories('libsylph') + +libsylph = library('sylph', + ['libsylph/account.c', + 'libsylph/base64.c', + 'libsylph/codeconv.c', + 'libsylph/customheader.c', + 'libsylph/displayheader.c', + 'libsylph/filter.c', + 'libsylph/folder.c', + 'libsylph/html.c', + 'libsylph/imap.c', + 'libsylph/mbox.c', + 'libsylph/md5.c', + 'libsylph/md5_hmac.c', + 'libsylph/mh.c', + 'libsylph/news.c', + 'libsylph/nntp.c', + 'libsylph/pop.c', + 'libsylph/prefs_account.c', + 'libsylph/prefs.c', + 'libsylph/prefs_common.c', + 'libsylph/procheader.c', + 'libsylph/procmime.c', + 'libsylph/procmsg.c', + 'libsylph/quoted-printable.c', + 'libsylph/recv.c', + 'libsylph/session.c', + 'libsylph/smtp.c', + 'libsylph/socket.c', + 'libsylph/socks.c', + 'libsylph/ssl.c', + 'libsylph/ssl_hostname_validation.c', + 'libsylph/stringtable.c', + 'libsylph/sylmain.c', + 'libsylph/syl-marshal.c', + 'libsylph/unmime.c', + 'libsylph/utils.c', + 'libsylph/uuencode.c', + 'libsylph/virtual.c', + 'libsylph/xml.c'], + include_directories : libsylph_includes, + dependencies : [glib, gobject, openssl, oniguruma, lockfile], + install : true) + +libsylph_dep = declare_dependency(include_directories : libsylph_includes, + link_with : libsylph) + + +# Instructions for building sylpheed executable + +flex = find_program('flex') +bison = find_program('bison') + +quote_fmt_parse_tab_ch = custom_target('quote_fmt_parse.tab.c', + output : ['quote_fmt_parse.tab.c', + 'quote_fmt_parse.tab.h'], + input : 'src/quote_fmt_parse.y', + command : [bison, '--defines=@OUTPUT1@', + '-p', 'quote_fmt', + '--output=@OUTPUT0@', + '@INPUT@']) + +quote_fmt_c = custom_target('quote_fmt.c', + output : ['quote_fmt.c', 'quote_fmt.h'], + input : ['src/quote_fmt_lex.l', quote_fmt_parse_tab_ch], + command : [flex, '--outfile=@OUTPUT0@', + '--header-file=@OUTPUT1@', + '-P', 'quote_fmt', + '@INPUT@']) + +plugin_marshal_ch = gnome.genmarshal('plugin-marshal', + prefix : 'syl_plugin_marshal', + sources : 'src/plugin-marshal.list') + + +gdk_pixbuf_source = find_program('gdk-pixbuf-csource') + +gen_icon = generator(gdk_pixbuf_source, + output : 'icon_@BASENAME@.h', + arguments : ['--name=@BASENAME@', '@INPUT@'], + capture : true) + +icons = gen_icon.process('src/icons/folder_close.png', + 'src/icons/stock_inbox.png', + 'src/icons/stock_notspam.png', + 'src/icons/folder_noselect.png', + 'src/icons/stock_insert_file.png', + 'src/icons/stock_outbox.png', + 'src/icons/folder_open.png', + 'src/icons/stock_mail_compose_16.png', + 'src/icons/stock_person.png', + 'src/icons/folder_search.png', + 'src/icons/stock_mail_compose.png', + 'src/icons/stock_spam_16.png', + 'src/icons/group.png', + 'src/icons/stock_mail_forward.png', + 'src/icons/stock_spam.png', + 'src/icons/html.png', + 'src/icons/stock_mail.png', + 'src/icons/stock_sylpheed_16.png', + 'src/icons/stock_addressbook.png', + 'src/icons/stock_mail_receive_all.png', + 'src/icons/stock_sylpheed_32.png', + 'src/icons/stock_attach.png', + 'src/icons/stock_mail_receive.png', + 'src/icons/stock_sylpheed_newmail_16.png', + 'src/icons/stock_book.png', + 'src/icons/stock_mail_reply.png', + 'src/icons/stock_sylpheed_newmail.png', + 'src/icons/stock_delete_16.png', + 'src/icons/stock_mail_reply_to_all.png', + 'src/icons/stock_sylpheed.png', + 'src/icons/stock_delete.png', + 'src/icons/stock_mail_send.png', + 'src/icons/sylpheed_logo.png', + 'src/icons/stock_hand_signed.png', + 'src/icons/stock_mail_send_queue.png') + +executable('sylpheed', + [icons, + 'src/about.c', + 'src/account_dialog.c', + 'src/action.c', + 'src/addrbook.c', + 'src/addrcache.c', + 'src/addr_compl.c', + 'src/addressadd.c', + 'src/addressbook.c', + 'src/addrindex.c', + 'src/addritem.c', + 'src/alertpanel.c', + 'src/colorlabel.c', + 'src/compose.c', + 'src/editaddress.c', + 'src/editbook.c', + 'src/editgroup.c', + 'src/editjpilot.c', + 'src/editldap_basedn.c', + 'src/editldap.c', + 'src/editvcard.c', + 'src/eggtrayicon.c', + 'src/export.c', + 'src/exportcsv.c', + 'src/filesel.c', + 'src/foldersel.c', + 'src/folderview.c', + 'src/gtkshruler.c', + 'src/gtkutils.c', + 'src/headerview.c', + 'src/imageview.c', + 'src/import.c', + 'src/importcsv.c', + 'src/importldif.c', + 'src/inc.c', + 'src/inputdialog.c', + 'src/jpilot.c', + 'src/ldif.c', + 'src/logwindow.c', + 'src/main.c', + 'src/mainwindow.c', + 'src/manage_window.c', + 'src/manual.c', + 'src/menu.c', + 'src/message_search.c', + 'src/messageview.c', + 'src/mgutils.c', + 'src/mimeview.c', + 'src/notificationwindow.c', + 'src/passphrase.c', + 'src/plugin.c', + 'src/plugin_manager.c', + plugin_marshal_ch, + 'src/prefs_account_dialog.c', + 'src/prefs_actions.c', + 'src/prefs_common_dialog.c', + 'src/prefs_customheader.c', + 'src/prefs_display_header.c', + 'src/prefs_display_items.c', + 'src/prefs_filter.c', + 'src/prefs_filter_edit.c', + 'src/prefs_folder_item.c', + 'src/prefs_search_folder.c', + 'src/prefs_summary_column.c', + 'src/prefs_template.c', + 'src/prefs_toolbar.c', + 'src/prefs_ui.c', + 'src/printing.c', + 'src/progressdialog.c', + quote_fmt_c, + 'src/query_search.c', + 'src/quick_search.c', + 'src/rfc2015.c', + 'src/rpop3.c', + 'src/select-keys.c', + 'src/send_message.c', + 'src/setup.c', + 'src/sigstatus.c', + 'src/simple-gettext.c', + 'src/sourcewindow.c', + 'src/sslmanager.c', + 'src/statusbar.c', + 'src/stock_pixmap.c', + 'src/subscribedialog.c', + 'src/summaryview.c', + 'src/syldap.c', + 'src/template.c', + 'src/textview.c', + 'src/trayicon.c', + 'src/undo.c', + 'src/update_check.c', + 'src/vcard.c', + version_h], + dependencies : [gtk, glib, gobject, gmodule, libsylph_dep, openssl, + gtkspell, aspell, enchant, oniguruma, compface, gpgme], + install : true) |