diff options
-rw-r--r-- | examples/meson.build | 18 | ||||
-rw-r--r-- | libsoup/meson.build | 245 | ||||
-rw-r--r-- | meson.build | 119 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | po/meson.build | 2 | ||||
-rw-r--r-- | tests/meson.build | 11 |
6 files changed, 135 insertions, 262 deletions
diff --git a/examples/meson.build b/examples/meson.build index 6e01b47d..b290afca 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,8 +1,14 @@ -get_example = executable('get', 'get.c', - dependencies : [glib_dep, libsoup_dep]) +deps = [ + glib_dep, + libsoup_dep +] -simple_httpd_example = executable('simple_httpd', 'simple-httpd.c', - dependencies : [glib_dep, libsoup_dep]) +examples = [ + 'get', + 'simple-httpd', + 'simple-proxy' +] -simple_proxy_example = executable('simple_proxy', 'simple-proxy.c', - dependencies : [glib_dep, libsoup_dep]) +foreach example: examples + executable(example, example + '.c', dependencies: deps) +endforeach diff --git a/libsoup/meson.build b/libsoup/meson.build index 99bbe2e0..f23d3383 100644 --- a/libsoup/meson.build +++ b/libsoup/meson.build @@ -1,3 +1,5 @@ +pkg = import('pkgconfig') + soup_sources = [ 'soup-address.c', 'soup-auth.c', @@ -74,8 +76,7 @@ soup_sources = [ 'soup-xmlrpc-old.c', ] -soup_headers = [ - 'soup.h', +soup_shared_headers = [ 'soup-address.h', 'soup-auth.h', 'soup-auth-domain.h', @@ -103,7 +104,6 @@ soup_headers = [ 'soup-multipart-input-stream.h', 'soup-password-manager.h', 'soup-portability.h', - 'soup-proxy-resolver.h', 'soup-proxy-resolver-default.h', 'soup-proxy-uri-resolver.h', 'soup-request.h', @@ -128,6 +128,11 @@ soup_headers = [ 'soup-xmlrpc-old.h', ] +soup_headers = soup_shared_headers + [ + 'soup.h', + 'soup-proxy-resolver.h' +] + soup_gnome_sources = [ 'soup-cookie-jar-sqlite.c', 'soup-gnome-features.c', @@ -146,7 +151,7 @@ soup_gnome_include_headers = [ 'soup-gnome-features.h' ] -includedir = 'libsoup-@0@/libsoup'.format(apiversion) +includedir = join_paths(libsoup_api_name, meson.project_name()) install_headers(soup_headers, subdir : includedir) version_cdata = configuration_data() @@ -159,10 +164,11 @@ configure_file(input : 'soup-version.h.in', install_dir : join_paths(get_option('includedir'), includedir), configuration : version_cdata) +enum_types = 'soup-enum-types' soup_enums = gnome.mkenums('soup-enum-types', sources : soup_headers, - h_template : 'soup-enum-types.h.template', - c_template : 'soup-enum-types.c.template', + h_template : enum_types + '.h.template', + c_template : enum_types + '.c.template', install_header : true, install_dir : join_paths(get_option('includedir'), includedir)) @@ -176,9 +182,11 @@ tlddata = custom_target('tlddata', install : false, command : [tldparser, '@INPUT@', '@OUTPUT@']) -libsoup_c_args = ['-DHAVE_CONFIG_H'] -libsoup_c_args += ['-DG_LOG_DOMAIN="libsoup"'] -libsoup_c_args += ['-DLIBSOUP_COMPILATION'] +libsoup_c_args = [ + '-DHAVE_CONFIG_H', + '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()), + '-DLIBSOUP_COMPILATION' +] deps = [ glib_dep, @@ -192,193 +200,91 @@ libsoup = library('soup-@0@'.format(apiversion), soup_sources, version : libversion, soversion : soversion, c_args : libsoup_c_args, - include_directories : [configinc], + include_directories : configinc, install : true, - dependencies : deps -) + dependencies : deps) + +pkg.generate( + libraries : libsoup, + version : soup_version, + name : meson.project_name(), + description : 'A glib-based HTTP library', + filebase : libsoup_api_name, + requires : [ + 'glib-2.0 ' + glib_required_version, + 'gobject-2.0 ' + glib_required_version, + 'gio-2.0 ' + glib_required_version + ], + requires_private : 'libxml-2.0', + subdirs: libsoup_api_name, + variables: 'exec_prefix=${prefix}') libsoup_dep = declare_dependency(link_with : libsoup, include_directories : configinc, - sources : soup_enums) + sources : soupenum_h) if enable_gnome - includedir = 'libsoup-gnome-@0@/libsoup'.format(apiversion) + soup_gnome_api_name = 'soup-gnome-' + apiversion + libsoup_gnome_api_name = 'lib' + soup_gnome_api_name + + includedir = join_paths(libsoup_gnome_api_name, meson.project_name()) install_headers( soup_gnome_headers + ['soup-gnome.h', 'soup-gnome-features.h'], subdir : includedir) - libsoup_gnome = library('soup-gnome-@0@'.format(apiversion), soup_gnome_sources, + libsoup_gnome = library(soup_gnome_api_name, soup_gnome_sources, version : libversion, soversion : soversion, c_args : libsoup_c_args, - include_directories : [configinc], + include_directories : configinc, install : true, - dependencies : [deps, libsoup_dep]) + dependencies : deps + [libsoup_dep]) + + pkg.generate( + libraries : libsoup_gnome, + version : soup_version, + name : meson.project_name(), + description : 'A glib-based HTTP library', + filebase : libsoup_gnome_api_name, + requires : libsoup_api_name, + subdirs: libsoup_gnome_api_name, + variables: 'exec_prefix=${prefix}') endif if get_option('introspection') or get_option('vapi') - soup_introspection_sources = [ - 'soup-address.c', - 'soup-address.h', - 'soup-auth-basic.c', - 'soup-auth.c', - 'soup-auth-digest.c', - 'soup-auth-domain-basic.c', - 'soup-auth-domain-basic.h', - 'soup-auth-domain.c', - 'soup-auth-domain-digest.c', - 'soup-auth-domain-digest.h', - 'soup-auth-domain.h', - 'soup-auth.h', - 'soup-auth-manager.c', - 'soup-auth-manager.h', - 'soup-auth-negotiate.c', - 'soup-auth-ntlm.c', - 'soup-autocleanups.h', - 'soup-body-input-stream.c', - 'soup-body-output-stream.c', - 'soup-cache.c', - 'soup-cache-client-input-stream.c', - 'soup-cache.h', - 'soup-cache-input-stream.c', - 'soup-client-input-stream.c', - 'soup-connection-auth.c', - 'soup-connection.c', - 'soup-content-decoder.c', - 'soup-content-decoder.h', - 'soup-content-processor.c', - 'soup-content-sniffer.c', - 'soup-content-sniffer.h', - 'soup-content-sniffer-stream.c', - 'soup-converter-wrapper.c', - 'soup-cookie.c', - 'soup-cookie.h', - 'soup-cookie-jar.c', - 'soup-cookie-jar-db.c', - 'soup-cookie-jar-db.h', - 'soup-cookie-jar.h', - 'soup-cookie-jar-text.c', - 'soup-cookie-jar-text.h', - 'soup-date.c', - 'soup-date.h', - 'soup-directory-input-stream.c', - 'soup-filter-input-stream.c', - 'soup-form.c', - 'soup-form.h', - 'soup-headers.c', - 'soup-headers.h', - 'soup-init.c', - 'soup-io-stream.c', - 'soup-logger.c', - 'soup-logger.h', - 'soup-message-body.c', - 'soup-message-body.h', - 'soup-message.c', - 'soup-message-client-io.c', - 'soup-message.h', - 'soup-message-headers.c', - 'soup-message-headers.h', - 'soup-message-io.c', - 'soup-message-queue.c', - 'soup-message-server-io.c', - 'soup-method.c', - 'soup-method.h', - 'soup-misc.c', - 'soup-misc.h', - 'soup-multipart.c', - 'soup-multipart.h', - 'soup-multipart-input-stream.c', - 'soup-multipart-input-stream.h', - 'soup-password-manager.c', - 'soup-password-manager.h', - 'soup-path-map.c', - 'soup-portability.h', - 'soup-proxy-resolver.c', - 'soup-proxy-resolver-default.c', - 'soup-proxy-resolver-default.h', - 'soup-proxy-resolver-wrapper.c', - 'soup-proxy-uri-resolver.c', - 'soup-proxy-uri-resolver.h', - 'soup-request.c', - 'soup-request-data.c', - 'soup-request-data.h', - 'soup-requester.c', - 'soup-requester.h', - 'soup-request-file.c', - 'soup-request-file.h', - 'soup-request.h', - 'soup-request-http.c', - 'soup-request-http.h', - 'soup-server.c', - 'soup-server.h', - 'soup-session-async.c', - 'soup-session-async.h', - 'soup-session.c', - 'soup-session-feature.c', - 'soup-session-feature.h', - 'soup-session.h', - 'soup-session-sync.c', - 'soup-session-sync.h', - 'soup-socket.c', - 'soup-socket.h', - 'soup-socket-properties.c', - 'soup-status.c', - 'soup-status.h', - 'soup-tld.c', - 'soup-tld.h', - 'soup-types.h', - 'soup-uri.c', - 'soup-uri.h', - 'soup-value-utils.c', - 'soup-value-utils.h', - 'soup-version.c', - 'soup-websocket.c', - 'soup-websocket-connection.c', - 'soup-websocket-connection.h', - 'soup-websocket.h', - 'soup-xmlrpc.c', - 'soup-xmlrpc.h', - 'soup-xmlrpc-old.c', - 'soup-xmlrpc-old.h', - ] + gir_args = libsoup_c_args + ['-DLIBSOUP_USE_UNSTABLE_REQUEST_API'] - gir_args = libsoup_c_args + [ - '-DLIBSOUP_USE_UNSTABLE_REQUEST_API', - '--c-include=libsoup/soup.h' - ] + soup_ns = 'Soup' - soup_gir_gen_sources = [gnome.generate_gir(libsoup, - sources : soup_introspection_sources + [soupenum_h, soupenum_c], - nsversion : '2.4', - namespace : 'Soup', - symbol_prefix : 'soup_', - identifier_prefix : 'Soup', - export_packages : 'libsoup-2.4', + soup_gir_gen_sources = gnome.generate_gir(libsoup, + sources : soup_sources + soup_shared_headers + [soupenum_h, soupenum_c], + nsversion : apiversion, + namespace : soup_ns, + symbol_prefix : soup_ns.to_lower() + '_', + identifier_prefix : soup_ns, + export_packages : libsoup_api_name, extra_args : gir_args, - dependencies : [deps, libsoup], - includes : ['Gio-2.0'], + includes : 'Gio-2.0', install : true, - )] + header: join_paths(meson.project_name(), 'soup.h'), + ) soup_gir_gen_dep = declare_dependency(link_with : libsoup, - include_directories : [configinc], + include_directories : configinc, dependencies : deps, sources : soup_gir_gen_sources) if get_option('vapi') - gnome.generate_vapi('libsoup-2.4', - sources : [soup_gir_gen_sources[0][0]], - packages : ['gio-2.0'], + gnome.generate_vapi(libsoup_api_name, + sources : soup_gir_gen_sources[0], + packages : 'gio-2.0', install : true, ) endif if enable_gnome gir_gnome_args = libsoup_c_args + [ - '--identifier-prefix=Soup', - '--symbol-prefix=soup', - '--c-include=libsoup/soup-gnome.h', - '--include-uninstalled=@0@/Soup-2.4.gir'.format(meson.current_build_dir()) + '--include-uninstalled=' + soup_gir_gen_sources[0].full_path() ] gnome.generate_gir(libsoup_gnome, @@ -389,15 +295,16 @@ if get_option('introspection') or get_option('vapi') 'soup-cookie-jar-sqlite.h', 'soup-gnome-features.h' ], - nsversion : '2.4', + nsversion : apiversion, namespace : 'SoupGNOME', - symbol_prefix : 'soup_', - identifier_prefix : 'Soup', - export_packages : 'libsoup-gnome-2.4', + symbol_prefix : soup_ns.to_lower() + '_', + identifier_prefix : soup_ns, + export_packages : libsoup_gnome_api_name, extra_args : gir_gnome_args, - dependencies : [deps, libsoup, libsoup_gnome, soup_gir_gen_dep], - includes : ['Gio-2.0'], + dependencies : soup_gir_gen_dep, + includes : 'Gio-2.0', install : true, + header: join_paths(meson.project_name(), 'soup-gnome.h'), ) endif endif diff --git a/meson.build b/meson.build index b920a380..0f3a22e5 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,10 @@ project('libsoup', 'c', version: '2.61.90', meson_version : '>=0.40.1', - license : 'LGPL', - default_options : ['warning_level=1', 'c_std=c89']) + license : 'LGPL2', + default_options : 'c_std=c89') gnome = import('gnome') -i18n = import('i18n') cc = meson.get_compiler('c') soup_version = meson.project_version() @@ -17,14 +16,15 @@ soup_version_micro = version_arr[2] libversion = '1.8.0' apiversion = '2.4' soversion = '0' +libsoup_api_name = '@0@-@1@'.format(meson.project_name(), apiversion) host_system = host_machine.system() # Enable extra warnings if compiler supports them. if cc.get_id() == 'msvc' - add_project_arguments('/FImsvc_recommended_pragmas.h', language : 'c') + common_flags = ['/FImsvc_recommended_pragmas.h'] else - foreach arg : [ + test_cflags = [ '-Wall', '-Wmissing-include-dirs', '-Wpointer-arith', @@ -36,16 +36,17 @@ else '-Werror=format=2', '-Wstrict-prototypes', '-Wno-format-zero-length', - ] - if cc.has_argument(arg) - add_project_arguments(arg, language : 'c') - endif - endforeach + ] + + common_flags = cc.get_supported_arguments(test_cflags) endif -glib_dep = [dependency('glib-2.0', version : '>=2.38'), - dependency('gobject-2.0', version : '>=2.38'), - dependency('gio-2.0', version : '>=2.38')] +add_project_arguments(common_flags, language : 'c') + +glib_required_version = '>= 2.38' +glib_dep = [dependency('glib-2.0', version : glib_required_version), + dependency('gobject-2.0', version : glib_required_version), + dependency('gio-2.0', version : glib_required_version)] sqlite_dep = dependency('sqlite3', required: cc.get_id() != 'msvc') @@ -88,14 +89,13 @@ int main(void) { enable_tls_check = get_option('tls_check') if enable_tls_check - if not cc.compiles(check_gio_tls_src, name : 'GIO has real TLS support', dependencies : glib_dep) - error('libsoup requires glib-networking or glib-openssl for TLS support') - endif + assert(cc.compiles(check_gio_tls_src, name : 'GIO has real TLS support', dependencies : glib_dep), + 'libsoup requires glib-networking or glib-openssl for TLS support') endif -################################ -# Regresion tests dependencies # -################################ +################################# +# Regression tests dependencies # +################################# apache_httpd2 = find_program('httpd2', 'httpd', 'apache2', 'apache', required : false) have_apache=false apache_httpd2_version = '' @@ -106,7 +106,7 @@ if apache_httpd2.found() apache_httpd2_version = apache_httpd2_version.split('/')[1].split(' ')[0] if apache_httpd2_version.version_compare('>=2.4') have_apache = true - cdata.set('APACHE_HTTPD', '"@0@"'.format(apache_httpd2.path())) + cdata.set_quoted('APACHE_HTTPD', apache_httpd2.path()) else message('Found ' + apache_httpd2_version + ', but at least 2.4 is needed - ignoring') endif @@ -123,8 +123,7 @@ if have_apache cdata.set('APACHE_SSL_MODULE_DIR', apache_ssl_module_dir) if apache_module_dir != '' and apache_ssl_module_dir != '' have_apache = true - add_project_arguments('-DHAVE_APACHE=1', language : 'c') - add_project_arguments('-DAPACHE_HTTPD=' + cdata.get('APACHE_HTTPD'), language : 'c') + cdata.set('HAVE_APACHE', '1') endif cdata.set('APACHE_PHP_MODULE_DIR', apache_modules.stdout().split(':')[2]) endif @@ -139,7 +138,7 @@ if have_apache php_xmlrpc = run_command(php, '--rf', 'xmlrpc_server_create') if php_xmlrpc.returncode() == 0 message('php-xmlrpc found') - add_project_arguments('-DHAVE_PHP_XMLRPC=1', language : 'c') + cdata.set('HAVE_PHP_XMLRPC', '1') else message('php-xmlrpc not found') endif @@ -150,7 +149,7 @@ if have_apache endif if find_program('curl', required : false).found() - add_project_arguments('-DHAVE_CURL=1', language : 'c') + cdata.set('HAVE_CURL', '1') endif ################## @@ -165,39 +164,24 @@ if enable_gssapi else gssapi_lib_type = '64' endif - gssapi_header = cc.has_header('gssapi/gssapi.h', required: false) - if gssapi_header - gssapi_lib = cc.find_library('gssapi@0@'.format(gssapi_lib_type), required: false) - endif - if gssapi_header and gssapi_lib.found() + if cc.has_header('gssapi/gssapi.h', required: false) + gssapi_lib = cc.find_library('gssapi' + gssapi_lib_type, required: false) + assert(gssapi_lib.found(), 'GSSAPI support requested, but the MIT Keberos 5 headers and libraries are not found') add_project_link_arguments('gssapi@0@.lib'.format(gssapi_lib_type), language : 'c') - else - error('GSSAPI support requested, but the MIT Keberos 5 headers and libraries are not found') endif else krb5_config_path = krb5_config_option != '' ? krb5_config_option : 'krb5-config' krb5_config = find_program(krb5_config_path, required : false) - if krb5_config.found() - krb5_config_output = run_command (krb5_config, '--libs', 'gssapi') - if krb5_config_output.returncode() == 0 - add_project_link_arguments(krb5_config_output.stdout().split(), language : 'c') - else - error('Failed to obtain cflags for GSSAPI from krb5-config') - enable_gssapi = false - endif - - krb5_config_output = run_command (krb5_config, '--cflags', 'gssapi') - if krb5_config_output.returncode() == 0 - add_project_arguments(krb5_config_output.stdout().split(), language : 'c') - else - error('Failed to obtain cflags for GSSAPI from krb5-config') - enable_gssapi = false - endif - else - error('GSSAPI support requested, but krb5-config not found. Please specify its path with -Dkrb5-config=PATH') - enable_gssapi = false - endif + assert(krb5_config.found(), 'GSSAPI support requested, but krb5-config not found. Please specify its path with -Dkrb5-config=PATH') + + krb5_config_output = run_command (krb5_config, '--libs', 'gssapi') + assert(krb5_config_output.returncode() == 0, 'Failed to obtain cflags for GSSAPI from krb5-config') + add_project_link_arguments(krb5_config_output.stdout().split(), language : 'c') + + krb5_config_output = run_command (krb5_config, '--cflags', 'gssapi') + assert(krb5_config_output.returncode() == 0, 'Failed to obtain cflags for GSSAPI from krb5-config') + add_project_arguments(krb5_config_output.stdout().split(), language : 'c') endif if enable_gssapi @@ -212,9 +196,7 @@ endif if host_machine.system() != 'windows' enable_ntlm = get_option('ntlm') if enable_ntlm - ntlm_auth_option = get_option('ntlm_auth') - ntlm_auth_path = ntlm_auth_option != '' ? ntlm_auth_option : 'ntlm_auth' - ntlm_auth = find_program(ntlm_auth_path, required : false) + ntlm_auth = find_program(get_option('ntlm_auth'), required: false) if ntlm_auth.found() add_project_arguments('-DUSE_NTLM_AUTH=1', language : 'c') @@ -230,39 +212,16 @@ enable_gnome = get_option('gnome') if host_machine.system() == 'windows' enable_gnome = false endif -cdata.set('BUILD_LIBSOUP_GNOME', enable_gnome) configinc = include_directories('.') prefix = get_option('prefix') -cdata.set('PACKAGE_VERSION', '"@0@"'.format(soup_version)) -cdata.set('LOCALEDIR', '"@0@/@1@"'.format(prefix, get_option('localedir'))) -cdata.set('GETTEXT_PACKAGE', '"libsoup-2.4"') +cdata.set_quoted('PACKAGE_VERSION', soup_version) +cdata.set_quoted('LOCALEDIR', join_paths(prefix, get_option('localedir'))) +cdata.set_quoted('GETTEXT_PACKAGE', libsoup_api_name) configure_file(output : 'config.h', configuration : cdata) -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('VERSION', soup_version) - -pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir')) - -configure_file(output : 'libsoup-2.4.pc', - input : 'libsoup-2.4.pc.in', - configuration : pkgconf, - install_dir : pkg_install_dir) - -if enable_gnome - configure_file(output : 'libsoup-gnome-2.4.pc', - input : 'libsoup-gnome-2.4.pc.in', - configuration : pkgconf, - install_dir : pkg_install_dir) -endif - subdir('libsoup') subdir('po') subdir('examples') diff --git a/meson_options.txt b/meson_options.txt index 18199534..35474caa 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,7 +18,7 @@ option('ntlm', option('ntlm_auth', type : 'string', - value : '', + value : 'ntlm_auth', description : 'Where to look for ntlm_auth, path points to ntlm_auth installation (defaultly looking in PATH)' ) diff --git a/po/meson.build b/po/meson.build index 6b9a7bc3..b024aeaf 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1,3 +1,5 @@ +i18n = import('i18n') + i18n.gettext(meson.project_name(), preset : 'glib', args: [ diff --git a/tests/meson.build b/tests/meson.build index 5a9460ae..6c4751c2 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,10 +1,10 @@ +test_utils_name = 'test-utils' + if cc.get_id() == 'msvc' - test_utils = static_library('test-utils', 'test-utils.c', 'test-utils.h', - install : false, + test_utils = static_library(test_utils_name, test_utils_name + '.c', dependencies : [glib_dep, libsoup_dep]) else - test_utils = library('test-utils', 'test-utils.c', 'test-utils.h', - install : false, + test_utils = library(test_utils_name, test_utils_name + '.c', dependencies : [glib_dep, libsoup_dep]) endif @@ -97,5 +97,4 @@ gnome.compile_resources('soup-tests', 'soup-tests.gresource.xml', gresource_bundle : true, install : true, - install_dir : meson.current_build_dir() + '/tests', - source_dir : '.') + install_dir : meson.current_build_dir() + '/tests') |