From 140ccf390dd1e7493a25ea3018ae79fb89f68118 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 27 Nov 2018 23:21:47 +0530 Subject: Add a meson build system MSVC exporting is done using a list of symbols in a .def file --- csslint/meson.build | 5 + docs/reference/meson.build | 8 + meson.build | 107 ++++++++++++ meson_options.txt | 9 + src/cr-rgb.c | 2 - src/libcroco.def | 413 +++++++++++++++++++++++++++++++++++++++++++++ src/meson.build | 108 ++++++++++++ tests/meson.build | 9 + 8 files changed, 659 insertions(+), 2 deletions(-) create mode 100644 csslint/meson.build create mode 100644 docs/reference/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/libcroco.def create mode 100644 src/meson.build create mode 100644 tests/meson.build diff --git a/csslint/meson.build b/csslint/meson.build new file mode 100644 index 0000000..ace2056 --- /dev/null +++ b/csslint/meson.build @@ -0,0 +1,5 @@ +# This is not installed by autotools +#install_man('csslint.1') + +executable('csslint-' + croco_api_version, 'csslint.c', + dependencies: libcroco_dep) diff --git a/docs/reference/meson.build b/docs/reference/meson.build new file mode 100644 index 0000000..e40dc43 --- /dev/null +++ b/docs/reference/meson.build @@ -0,0 +1,8 @@ +gnome = import('gnome') + +gnome.gtkdoc('libcroco', + main_sgml : 'libcroco-docs.sgml', + src_dir : libcroco_inc, + scanobjs_args : ['--type-init-func="g_type_init()"'], + dependencies : libcroco_dep, + install : true) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..536eb4b --- /dev/null +++ b/meson.build @@ -0,0 +1,107 @@ +project('libcroco', 'c', + version : '0.6.13', + meson_version : '>=0.48') + +croco_api_major = '0' +croco_api_minor = '6' +croco_api_version = croco_api_major + '.' + croco_api_minor + +# For historical reasons, these are not a function of the actual project version +# current, revision, age +croco_ltversions = [3, 1, 0] +croco_ltversion = '@0@.@1@.@2@'.format(croco_ltversions[0], croco_ltversions[2], croco_ltversions[1]) +croco_osxversions = '@0@.@1@.0'.format(croco_ltversions[0] + 1, croco_ltversions[1]) + +croco_version = meson.project_version() +croco_versions = croco_version.split('.') + +cc = meson.get_compiler('c') + +glib_dep = dependency('glib-2.0', version : '>=2.0', + fallback: ['glib', 'libglib_dep']) +libxml2_dep = dependency('libxml-2.0', version : '>=2.4.23', + fallback: ['libxml2', 'xml2lib_dep']) + +# Compiler flags +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + warning_c_args = [ + '-Wall', + '-Wextra', + '-Wunused', + '-Wreturn-type', + '-Wswitch', + '-Wcomment', + '-Wtrigraphs', + '-Wchar-subscripts', + '-Wparentheses', + '-Winline', + '-Wredundant-decls', + '-Wformat-nonliteral', + '-Werror=format-security', + '-Wsign-compare', + '-Werror=implicit-function-declaration', + '-Wpointer-arith', + '-Wwrite-strings', + '-Wstrict-prototypes', + '-Waggregate-return', + '-Wcast-align', + '-Wimplicit', + '-Wuninitialized', + '-Wmissing-prototypes', + '-Wmissing-declarations', + '-Wnested-externs', + '-Wpacked', + '-Wmissing-format-attribute', + '-Wshadow', + '-Wstrict-aliasing=2', + '-Winit-self', + '-Wunsafe-loop-optimizations', + '-Wdeclaration-after-statement', + '-Wold-style-definition', + '-Wno-missing-field-initializers', + '-Wno-unused-parameter', + '-fno-common', + '-Wno-switch-enum', + ] + warning_c_link_args = [] + if get_option('bsymbolic_functions') + warning_c_link_args += ['-Wl,-Bsymbolic-functions'] + endif +else + warning_c_args = [] + warning_c_link_args = [] +endif +add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c') +add_project_link_arguments(cc.get_supported_link_arguments(warning_c_link_args), language: 'c') + +debug_cflags = [] +buildtype = get_option('buildtype') +if buildtype.startswith('debug') + debug_cflags += ['-DG_ENABLE_DEBUG'] +elif buildtype == 'release' + debug_cflags += ['-DG_DISABLE_CAST_CHECKS'] +endif +add_project_arguments(debug_cflags, language: 'c') + +# For generating libcroco.pc +pcdata = configuration_data() +pcdata.set('prefix', get_option('prefix')) +pcdata.set('exec_prefix', get_option('prefix')) +pcdata.set('libdir', join_paths('${prefix}', get_option('libdir'))) +pcdata.set('includedir', join_paths('${prefix}', get_option('includedir'))) +pcdata.set('VERSION', croco_version) +pcdata.set('LIBCROCO_MAJOR_VERSION', croco_api_major) +pcdata.set('LIBCROCO_MINOR_VERSION', croco_api_minor) +configure_file(input : 'libcroco.pc.in', + output : 'libcroco-@0@.pc'.format(croco_api_version), + configuration : pcdata, + install_dir : join_paths(get_option('libdir'), + 'pkgconfig')) +subdir('src') +subdir('csslint') +subdir('tests') +if find_program('gtkdoc-scan', required : get_option('gtk_doc')).found() + subdir('docs/reference') +else + message('Not building documentation as gtk-doc was not found') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..55f6987 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,9 @@ +option('bsymbolic_functions', + type : 'boolean', + value : true, + description : 'Link with -Bsymbolic-functions if supported') + +option('gtk_doc', + type : 'feature', + value : 'auto', + description : 'Use gtk-doc to build documentation') diff --git a/src/cr-rgb.c b/src/cr-rgb.c index 1b8b662..8cee87b 100644 --- a/src/cr-rgb.c +++ b/src/cr-rgb.c @@ -21,8 +21,6 @@ * See COPYRIGHTS file for copyrights information. */ -#include "config.h" - #include #include #include diff --git a/src/libcroco.def b/src/libcroco.def new file mode 100644 index 0000000..9d87c2a --- /dev/null +++ b/src/libcroco.def @@ -0,0 +1,413 @@ +EXPORTS +cr_additional_sel_append +cr_additional_sel_destroy +cr_additional_sel_dump +cr_additional_sel_new +cr_additional_sel_new_with_type +cr_additional_sel_one_to_string +cr_additional_sel_prepend +cr_additional_sel_set_attr_sel +cr_additional_sel_set_class_name +cr_additional_sel_set_id_name +cr_additional_sel_set_pseudo +cr_additional_sel_to_string +cr_attr_sel_append_attr_sel +cr_attr_sel_destroy +cr_attr_sel_dump +cr_attr_sel_new +cr_attr_sel_prepend_attr_sel +cr_attr_sel_to_string +cr_cascade_destroy +cr_cascade_get_sheet +cr_cascade_new +cr_cascade_ref +cr_cascade_set_sheet +cr_cascade_unref +cr_declaration_append +cr_declaration_append2 +cr_declaration_destroy +cr_declaration_dump +cr_declaration_dump_one +cr_declaration_get_by_prop_name +cr_declaration_get_from_list +cr_declaration_list_to_string +cr_declaration_list_to_string2 +cr_declaration_new +cr_declaration_nr_props +cr_declaration_parse_from_buf +cr_declaration_parse_list_from_buf +cr_declaration_prepend +cr_declaration_ref +cr_declaration_to_string +cr_declaration_unlink +cr_declaration_unref +cr_doc_handler_associate_a_parser +cr_doc_handler_destroy +cr_doc_handler_get_ctxt +cr_doc_handler_get_result +cr_doc_handler_new +cr_doc_handler_ref +cr_doc_handler_set_ctxt +cr_doc_handler_set_default_sac_handler +cr_doc_handler_set_result +cr_doc_handler_unref +cr_enc_handler_convert_input +cr_enc_handler_get_instance +cr_enc_handler_resolve_enc_alias +cr_font_family_append +cr_font_family_destroy +cr_font_family_new +cr_font_family_prepend +cr_font_family_set_name +cr_font_family_to_string +cr_font_size_adjust_destroy +cr_font_size_adjust_new +cr_font_size_adjust_to_string +cr_font_size_clear +cr_font_size_copy +cr_font_size_destroy +cr_font_size_get_larger_predefined_font_size +cr_font_size_get_smaller_predefined_font_size +cr_font_size_is_predefined_absolute_font_size +cr_font_size_is_set_to_inherit +cr_font_size_new +cr_font_size_set_absolute_font_size +cr_font_size_set_predefined_absolute_font_size +cr_font_size_set_relative_font_size +cr_font_size_set_to_inherit +cr_font_size_to_string +cr_font_stretch_to_string +cr_font_style_to_string +cr_font_variant_to_string +cr_font_weight_get_bolder +cr_font_weight_to_string +cr_input_consume_char +cr_input_consume_chars +cr_input_consume_white_spaces +cr_input_destroy +cr_input_end_of_input +cr_input_get_byte_addr +cr_input_get_column_num +cr_input_get_cur_byte_addr +cr_input_get_cur_index +cr_input_get_cur_pos +cr_input_get_end_of_file +cr_input_get_end_of_line +cr_input_get_line_num +cr_input_get_nb_bytes_left +cr_input_get_parsing_location +cr_input_increment_col_num +cr_input_increment_line_num +cr_input_new_from_buf +cr_input_new_from_uri +cr_input_peek_byte +cr_input_peek_byte2 +cr_input_peek_char +cr_input_read_byte +cr_input_read_char +cr_input_ref +cr_input_seek_index +cr_input_set_column_num +cr_input_set_cur_index +cr_input_set_cur_pos +cr_input_set_end_of_file +cr_input_set_end_of_line +cr_input_set_line_num +cr_input_unref +cr_num_copy +cr_num_destroy +cr_num_dup +cr_num_is_fixed_length +cr_num_new +cr_num_new_with_val +cr_num_set +cr_num_to_string +cr_om_parser_destroy +cr_om_parser_new +cr_om_parser_parse_buf +cr_om_parser_parse_file +cr_om_parser_parse_paths_to_cascade +cr_om_parser_simply_parse_buf +cr_om_parser_simply_parse_file +cr_om_parser_simply_parse_paths_to_cascade +cr_parser_destroy +cr_parser_get_parsing_location +cr_parser_get_sac_handler +cr_parser_get_tknzr +cr_parser_get_use_core_grammar +cr_parser_new +cr_parser_new_from_buf +cr_parser_new_from_file +cr_parser_new_from_input +cr_parser_parse +cr_parser_parse_buf +cr_parser_parse_charset +cr_parser_parse_declaration +cr_parser_parse_expr +cr_parser_parse_file +cr_parser_parse_font_face +cr_parser_parse_import +cr_parser_parse_media +cr_parser_parse_page +cr_parser_parse_prio +cr_parser_parse_ruleset +cr_parser_parse_statement_core +cr_parser_parse_term +cr_parser_set_default_sac_handler +cr_parser_set_sac_handler +cr_parser_set_tknzr +cr_parser_set_use_core_grammar +cr_parser_try_to_skip_spaces_and_comments +cr_parsing_location_copy +cr_parsing_location_destroy +cr_parsing_location_dump +cr_parsing_location_init +cr_parsing_location_new +cr_parsing_location_to_string +cr_prop_list_append +cr_prop_list_append2 +cr_prop_list_destroy +cr_prop_list_get_decl +cr_prop_list_get_next +cr_prop_list_get_prev +cr_prop_list_get_prop +cr_prop_list_lookup_prop +cr_prop_list_prepend +cr_prop_list_prepend2 +cr_prop_list_set_decl +cr_prop_list_set_prop +cr_prop_list_unlink +cr_pseudo_destroy +cr_pseudo_dump +cr_pseudo_new +cr_pseudo_to_string +cr_rgb_compute_from_percentage +cr_rgb_copy +cr_rgb_destroy +cr_rgb_dump +cr_rgb_is_set_to_inherit +cr_rgb_is_set_to_transparent +cr_rgb_new +cr_rgb_new_with_vals +cr_rgb_parse_from_buf +cr_rgb_set +cr_rgb_set_from_hex_str +cr_rgb_set_from_name +cr_rgb_set_from_rgb +cr_rgb_set_from_term +cr_rgb_set_to_inherit +cr_rgb_set_to_transparent +cr_rgb_to_string +cr_sel_eng_destroy +cr_sel_eng_get_matched_properties_from_cascade +cr_sel_eng_get_matched_rulesets +cr_sel_eng_get_matched_style +cr_sel_eng_get_pseudo_class_selector_handler +cr_sel_eng_matches_node +cr_sel_eng_new +cr_sel_eng_register_pseudo_class_sel_handler +cr_sel_eng_unregister_all_pseudo_class_sel_handlers +cr_sel_eng_unregister_pseudo_class_sel_handler +cr_selector_append +cr_selector_append_simple_sel +cr_selector_destroy +cr_selector_dump +cr_selector_new +cr_selector_parse_from_buf +cr_selector_prepend +cr_selector_ref +cr_selector_to_string +cr_selector_unref +cr_simple_sel_append_simple_sel +cr_simple_sel_compute_specificity +cr_simple_sel_destroy +cr_simple_sel_dump +cr_simple_sel_new +cr_simple_sel_one_to_string +cr_simple_sel_prepend_simple_sel +cr_simple_sel_to_string +cr_statement_append +cr_statement_at_charset_rule_get_charset +cr_statement_at_charset_rule_parse_from_buf +cr_statement_at_charset_rule_set_charset +cr_statement_at_font_face_rule_add_decl +cr_statement_at_font_face_rule_get_decls +cr_statement_at_font_face_rule_set_decls +cr_statement_at_import_rule_get_imported_sheet +cr_statement_at_import_rule_get_url +cr_statement_at_import_rule_parse_from_buf +cr_statement_at_import_rule_set_imported_sheet +cr_statement_at_import_rule_set_url +cr_statement_at_media_get_from_list +cr_statement_at_media_nr_rules +cr_statement_at_media_rule_parse_from_buf +cr_statement_at_page_rule_get_declarations +cr_statement_at_page_rule_parse_from_buf +cr_statement_at_page_rule_set_declarations +cr_statement_destroy +cr_statement_does_buf_parses_against_core +cr_statement_dump +cr_statement_dump_charset +cr_statement_dump_font_face_rule +cr_statement_dump_import_rule +cr_statement_dump_media_rule +cr_statement_dump_page +cr_statement_dump_ruleset +cr_statement_font_face_rule_parse_from_buf +cr_statement_get_from_list +cr_statement_get_parent_sheet +cr_statement_list_to_string +cr_statement_new_at_charset_rule +cr_statement_new_at_font_face_rule +cr_statement_new_at_import_rule +cr_statement_new_at_media_rule +cr_statement_new_at_page_rule +cr_statement_new_ruleset +cr_statement_nr_rules +cr_statement_parse_from_buf +cr_statement_prepend +cr_statement_ruleset_append_decl +cr_statement_ruleset_append_decl2 +cr_statement_ruleset_get_declarations +cr_statement_ruleset_get_sel_list +cr_statement_ruleset_parse_from_buf +cr_statement_ruleset_set_decl_list +cr_statement_ruleset_set_sel_list +cr_statement_set_parent_sheet +cr_statement_to_string +cr_statement_unlink +cr_string_destroy +cr_string_dup +cr_string_dup2 +cr_string_new +cr_string_new_from_gstring +cr_string_new_from_string +cr_string_peek_raw_str +cr_string_peek_raw_str_len +cr_style_border_style_to_string +cr_style_copy +cr_style_destroy +cr_style_display_type_to_string +cr_style_dup +cr_style_float_type_to_string +cr_style_new +cr_style_num_prop_val_to_string +cr_style_position_type_to_string +cr_style_ref +cr_style_resolve_inherited_properties +cr_style_rgb_prop_val_to_string +cr_style_set_props_to_default_values +cr_style_set_props_to_initial_values +cr_style_set_style_from_decl +cr_style_to_string +cr_style_unref +cr_style_white_space_type_to_string +cr_stylesheet_destroy +cr_stylesheet_dump +cr_stylesheet_new +cr_stylesheet_nr_rules +cr_stylesheet_ref +cr_stylesheet_statement_get_from_list +cr_stylesheet_to_string +cr_stylesheet_unref +cr_term_append_term +cr_term_destroy +cr_term_dump +cr_term_get_from_list +cr_term_new +cr_term_nr_values +cr_term_one_to_string +cr_term_parse_expression_from_buf +cr_term_prepend_term +cr_term_ref +cr_term_set_function +cr_term_set_hash +cr_term_set_ident +cr_term_set_number +cr_term_set_rgb +cr_term_set_string +cr_term_set_uri +cr_term_to_string +cr_term_unref +cr_tknzr_consume_chars +cr_tknzr_destroy +cr_tknzr_get_cur_byte_addr +cr_tknzr_get_cur_pos +cr_tknzr_get_input +cr_tknzr_get_nb_bytes_left +cr_tknzr_get_next_token +cr_tknzr_get_parsing_location +cr_tknzr_new +cr_tknzr_new_from_buf +cr_tknzr_new_from_uri +cr_tknzr_parse_token +cr_tknzr_peek_byte +cr_tknzr_peek_byte2 +cr_tknzr_peek_char +cr_tknzr_read_byte +cr_tknzr_read_char +cr_tknzr_ref +cr_tknzr_seek_index +cr_tknzr_set_cur_pos +cr_tknzr_set_input +cr_tknzr_unget_token +cr_tknzr_unref +cr_token_destroy +cr_token_new +cr_token_set_angle +cr_token_set_atkeyword +cr_token_set_bc +cr_token_set_bo +cr_token_set_cbc +cr_token_set_cbo +cr_token_set_cdc +cr_token_set_cdo +cr_token_set_charset_sym +cr_token_set_comment +cr_token_set_dashmatch +cr_token_set_delim +cr_token_set_dimen +cr_token_set_ems +cr_token_set_exs +cr_token_set_font_face_sym +cr_token_set_freq +cr_token_set_function +cr_token_set_hash +cr_token_set_ident +cr_token_set_import_sym +cr_token_set_important_sym +cr_token_set_includes +cr_token_set_length +cr_token_set_media_sym +cr_token_set_number +cr_token_set_page_sym +cr_token_set_pc +cr_token_set_percentage +cr_token_set_po +cr_token_set_rgb +cr_token_set_s +cr_token_set_semicolon +cr_token_set_string +cr_token_set_time +cr_token_set_uri +cr_utils_dump_n_chars +cr_utils_dump_n_chars2 +cr_utils_dup_glist_of_cr_string +cr_utils_dup_glist_of_string +cr_utils_is_hexa_char +cr_utils_is_newline +cr_utils_is_nonascii +cr_utils_is_white_space +cr_utils_read_char_from_utf8_buf +cr_utils_ucs1_str_len_as_utf8 +cr_utils_ucs1_str_to_utf8 +cr_utils_ucs1_to_utf8 +cr_utils_ucs4_str_len_as_utf8 +cr_utils_ucs4_str_to_utf8 +cr_utils_ucs4_to_utf8 +cr_utils_utf8_str_len_as_ucs1 +cr_utils_utf8_str_len_as_ucs4 +cr_utils_utf8_str_to_ucs1 +cr_utils_utf8_str_to_ucs4 +cr_utils_utf8_to_ucs1 +cr_utils_utf8_to_ucs4 diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..40f2466 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,108 @@ +croco_headers = [ + 'libcroco.h', + 'cr-additional-sel.h', + 'cr-attr-sel.h', + 'cr-cascade.h', + 'cr-declaration.h', + 'cr-doc-handler.h', + 'cr-enc-handler.h', + 'cr-input.h', + 'cr-num.h', + 'cr-om-parser.h', + 'cr-parser.h', + 'cr-pseudo.h', + 'cr-rgb.h', + 'cr-selector.h', + 'cr-simple-sel.h', + 'cr-statement.h', + 'cr-stylesheet.h', + 'cr-term.h', + 'cr-tknzr.h', + 'cr-token.h', + 'cr-utils.h', + 'cr-fonts.h', + 'cr-sel-eng.h', + 'cr-style.h', + 'cr-prop-list.h', + 'cr-parsing-location.h', + 'cr-string.h', +] +inc_subdir = join_paths('libcroco-' + croco_api_version, 'libcroco') +install_headers(croco_headers, subdir: inc_subdir) + +crocodata = configuration_data() +croco_vernum = 10000 * croco_versions[0].to_int() + 100 * croco_versions[1].to_int() + croco_versions[2].to_int() +crocodata.set('LIBCROCO_VERSION_NUMBER', croco_vernum) +crocodata.set('LIBCROCO_VERSION', croco_version) +crocodata.set('G_DISABLE_CHECKS', 0) +configure_file(input: 'libcroco-config.h.in', + output: 'libcroco-config.h', + configuration: crocodata, + install_dir: join_paths(get_option('includedir'), inc_subdir)) + +croco_sources = [ + 'cr-utils.c', + 'cr-utils.h', + 'cr-input.c', + 'cr-input.h', + 'cr-enc-handler.c', + 'cr-enc-handler.h', + 'cr-num.c', + 'cr-num.h', + 'cr-rgb.c', + 'cr-rgb.h', + 'cr-token.c', + 'cr-token.h', + 'cr-tknzr.c', + 'cr-tknzr.h', + 'cr-term.c', + 'cr-term.h', + 'cr-attr-sel.c', + 'cr-attr-sel.h', + 'cr-pseudo.c', + 'cr-pseudo.h', + 'cr-additional-sel.c', + 'cr-additional-sel.h', + 'cr-simple-sel.c', + 'cr-simple-sel.h', + 'cr-selector.c', + 'cr-selector.h', + 'cr-doc-handler.c', + 'cr-doc-handler.h', + 'cr-parser.c', + 'cr-parser.h', + 'cr-declaration.c', + 'cr-declaration.h', + 'cr-statement.c', + 'cr-statement.h', + 'cr-stylesheet.c', + 'cr-stylesheet.h', + 'cr-cascade.c', + 'cr-cascade.h', + 'cr-om-parser.c', + 'cr-om-parser.h', + 'cr-style.c', + 'cr-style.h', + 'cr-sel-eng.c', + 'cr-sel-eng.h', + 'cr-fonts.c', + 'cr-fonts.h', + 'cr-prop-list.c', + 'cr-prop-list.h', + 'cr-parsing-location.c', + 'cr-parsing-location.h', + 'cr-string.c', + 'cr-string.h', +] + +libcroco = library('croco-' + croco_api_version, croco_sources, + version: croco_ltversion, + darwin_versions: croco_osxversions, + dependencies: [glib_dep, libxml2_dep], + vs_module_defs: 'libcroco.def', + install: true) + +libcroco_inc = include_directories('.') +libcroco_dep = declare_dependency(link_with: libcroco, + include_directories: libcroco_inc, + dependencies: [glib_dep, libxml2_dep]) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..8c49d04 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,9 @@ +libtest_utils = static_library('test-utils', 'cr-test-utils.c', + dependencies: libcroco_dep) + +foreach i : [0, 1, 2, 3, 4, 5, 6] + name = 'test@0@-main'.format(i) + test(name, executable(name, name + '.c', + link_with: libtest_utils, + dependencies: libcroco_dep)) +endforeach -- cgit v1.2.1