meson: generate .def file for MSVC symbol export on the fly

Fix symbol export with MSVC when features are disabled,
such as GLib. We need to generate the list of exported
symbols on the fly to make sure we only export symbols
that are actually available.

Needs some minor modifications to the gen-def.py script:
 - accept header list also via command line args; we can't
   pass things to a configure_file() command via the environment
   in Meson.
 - strip any leading 'src/' from library filename. This might
   be there because in Meson the script might be called from
   the top-level directory and not the current source directory.

Remove .def files again which had been checked in for earlier
versions of the Meson port.
This commit is contained in:
Tim-Philipp Müller 2018-11-12 19:41:39 +00:00 committed by Ebrahim Byagowi
parent 4840c8237e
commit d230a02048
6 changed files with 38 additions and 380 deletions

View File

@ -17,6 +17,6 @@ symbols = "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_c
result = symbols if os.environ.get('PLAIN_LIST', '') else """EXPORTS
%s
LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('.def', ''))
LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', ''))
with open (output_file, "w") as f: f.write (result)

View File

@ -1,33 +0,0 @@
EXPORTS
hb_gobject_blob_get_type
hb_gobject_buffer_cluster_level_get_type
hb_gobject_buffer_content_type_get_type
hb_gobject_buffer_diff_flags_get_type
hb_gobject_buffer_flags_get_type
hb_gobject_buffer_get_type
hb_gobject_buffer_serialize_flags_get_type
hb_gobject_buffer_serialize_format_get_type
hb_gobject_direction_get_type
hb_gobject_face_get_type
hb_gobject_feature_get_type
hb_gobject_font_funcs_get_type
hb_gobject_font_get_type
hb_gobject_glyph_flags_get_type
hb_gobject_glyph_info_get_type
hb_gobject_glyph_position_get_type
hb_gobject_memory_mode_get_type
hb_gobject_ot_layout_glyph_class_get_type
hb_gobject_ot_math_constant_get_type
hb_gobject_ot_math_glyph_part_flags_get_type
hb_gobject_ot_math_glyph_part_get_type
hb_gobject_ot_math_glyph_variant_get_type
hb_gobject_ot_math_kern_get_type
hb_gobject_script_get_type
hb_gobject_segment_properties_get_type
hb_gobject_set_get_type
hb_gobject_shape_plan_get_type
hb_gobject_unicode_combining_class_get_type
hb_gobject_unicode_funcs_get_type
hb_gobject_unicode_general_category_get_type
hb_gobject_user_data_key_get_type
LIBRARY libharfbuzz-gobject-0.dll

View File

@ -1,5 +0,0 @@
EXPORTS
hb_icu_get_unicode_funcs
hb_icu_script_from_script
hb_icu_script_to_script
LIBRARY libharfbuzz-icu-0.dll

View File

@ -1,12 +0,0 @@
EXPORTS
hb_subset
hb_subset_get_all_codepoints
hb_subset_input_create_or_fail
hb_subset_input_destroy
hb_subset_input_drop_hints
hb_subset_input_glyph_set
hb_subset_input_reference
hb_subset_input_unicode_set
hb_subset_profile_create
hb_subset_profile_destroy
LIBRARY libharfbuzz-subset-0.dll

View File

@ -1,310 +0,0 @@
EXPORTS
hb_blob_copy_writable_or_fail
hb_blob_create
hb_blob_create_from_file
hb_blob_create_sub_blob
hb_blob_destroy
hb_blob_get_data
hb_blob_get_data_writable
hb_blob_get_empty
hb_blob_get_length
hb_blob_get_user_data
hb_blob_is_immutable
hb_blob_make_immutable
hb_blob_reference
hb_blob_set_user_data
hb_buffer_add
hb_buffer_add_codepoints
hb_buffer_add_latin1
hb_buffer_add_utf16
hb_buffer_add_utf32
hb_buffer_add_utf8
hb_buffer_allocation_successful
hb_buffer_append
hb_buffer_clear_contents
hb_buffer_create
hb_buffer_deserialize_glyphs
hb_buffer_destroy
hb_buffer_diff
hb_buffer_get_cluster_level
hb_buffer_get_content_type
hb_buffer_get_direction
hb_buffer_get_empty
hb_buffer_get_flags
hb_buffer_get_glyph_infos
hb_buffer_get_glyph_positions
hb_buffer_get_language
hb_buffer_get_length
hb_buffer_get_replacement_codepoint
hb_buffer_get_script
hb_buffer_get_segment_properties
hb_buffer_get_unicode_funcs
hb_buffer_get_user_data
hb_buffer_guess_segment_properties
hb_buffer_normalize_glyphs
hb_buffer_pre_allocate
hb_buffer_reference
hb_buffer_reset
hb_buffer_reverse
hb_buffer_reverse_clusters
hb_buffer_reverse_range
hb_buffer_serialize_format_from_string
hb_buffer_serialize_format_to_string
hb_buffer_serialize_glyphs
hb_buffer_serialize_list_formats
hb_buffer_set_cluster_level
hb_buffer_set_content_type
hb_buffer_set_direction
hb_buffer_set_flags
hb_buffer_set_language
hb_buffer_set_length
hb_buffer_set_message_func
hb_buffer_set_replacement_codepoint
hb_buffer_set_script
hb_buffer_set_segment_properties
hb_buffer_set_unicode_funcs
hb_buffer_set_user_data
hb_direction_from_string
hb_direction_to_string
hb_face_create
hb_face_create_for_tables
hb_face_destroy
hb_face_get_empty
hb_face_get_glyph_count
hb_face_get_index
hb_face_get_table_tags
hb_face_get_upem
hb_face_get_user_data
hb_face_is_immutable
hb_face_make_immutable
hb_face_reference
hb_face_reference_blob
hb_face_reference_table
hb_face_set_glyph_count
hb_face_set_index
hb_face_set_upem
hb_face_set_user_data
hb_feature_from_string
hb_feature_to_string
hb_font_add_glyph_origin_for_direction
hb_font_create
hb_font_create_sub_font
hb_font_destroy
hb_font_funcs_create
hb_font_funcs_destroy
hb_font_funcs_get_empty
hb_font_funcs_get_user_data
hb_font_funcs_is_immutable
hb_font_funcs_make_immutable
hb_font_funcs_reference
hb_font_funcs_set_font_h_extents_func
hb_font_funcs_set_font_v_extents_func
hb_font_funcs_set_glyph_contour_point_func
hb_font_funcs_set_glyph_extents_func
hb_font_funcs_set_glyph_from_name_func
hb_font_funcs_set_glyph_func
hb_font_funcs_set_glyph_h_advance_func
hb_font_funcs_set_glyph_h_kerning_func
hb_font_funcs_set_glyph_h_origin_func
hb_font_funcs_set_glyph_name_func
hb_font_funcs_set_glyph_v_advance_func
hb_font_funcs_set_glyph_v_kerning_func
hb_font_funcs_set_glyph_v_origin_func
hb_font_funcs_set_nominal_glyph_func
hb_font_funcs_set_user_data
hb_font_funcs_set_variation_glyph_func
hb_font_get_empty
hb_font_get_extents_for_direction
hb_font_get_face
hb_font_get_glyph
hb_font_get_glyph_advance_for_direction
hb_font_get_glyph_contour_point
hb_font_get_glyph_contour_point_for_origin
hb_font_get_glyph_extents
hb_font_get_glyph_extents_for_origin
hb_font_get_glyph_from_name
hb_font_get_glyph_h_advance
hb_font_get_glyph_h_kerning
hb_font_get_glyph_h_origin
hb_font_get_glyph_kerning_for_direction
hb_font_get_glyph_name
hb_font_get_glyph_origin_for_direction
hb_font_get_glyph_v_advance
hb_font_get_glyph_v_kerning
hb_font_get_glyph_v_origin
hb_font_get_h_extents
hb_font_get_nominal_glyph
hb_font_get_parent
hb_font_get_ppem
hb_font_get_ptem
hb_font_get_scale
hb_font_get_user_data
hb_font_get_v_extents
hb_font_get_var_coords_normalized
hb_font_get_variation_glyph
hb_font_glyph_from_string
hb_font_glyph_to_string
hb_font_is_immutable
hb_font_make_immutable
hb_font_reference
hb_font_set_face
hb_font_set_funcs
hb_font_set_funcs_data
hb_font_set_parent
hb_font_set_ppem
hb_font_set_ptem
hb_font_set_scale
hb_font_set_user_data
hb_font_set_var_coords_design
hb_font_set_var_coords_normalized
hb_font_set_variations
hb_font_subtract_glyph_origin_for_direction
hb_ft_face_create
hb_ft_face_create_cached
hb_ft_face_create_referenced
hb_ft_font_changed
hb_ft_font_create
hb_ft_font_create_referenced
hb_ft_font_get_face
hb_ft_font_get_load_flags
hb_ft_font_set_funcs
hb_ft_font_set_load_flags
hb_glib_blob_create
hb_glib_get_unicode_funcs
hb_glib_script_from_script
hb_glib_script_to_script
hb_glyph_info_get_glyph_flags
hb_language_from_string
hb_language_get_default
hb_language_to_string
hb_ot_font_set_funcs
hb_ot_layout_collect_lookups
hb_ot_layout_feature_get_lookups
hb_ot_layout_feature_with_variations_get_lookups
hb_ot_layout_get_attach_points
hb_ot_layout_get_glyph_class
hb_ot_layout_get_glyphs_in_class
hb_ot_layout_get_ligature_carets
hb_ot_layout_get_size_params
hb_ot_layout_has_glyph_classes
hb_ot_layout_has_positioning
hb_ot_layout_has_substitution
hb_ot_layout_language_find_feature
hb_ot_layout_language_get_feature_indexes
hb_ot_layout_language_get_feature_tags
hb_ot_layout_language_get_required_feature
hb_ot_layout_language_get_required_feature_index
hb_ot_layout_lookup_collect_glyphs
hb_ot_layout_lookup_substitute_closure
hb_ot_layout_lookup_would_substitute
hb_ot_layout_script_find_language
hb_ot_layout_script_get_language_tags
hb_ot_layout_table_choose_script
hb_ot_layout_table_find_feature_variations
hb_ot_layout_table_find_script
hb_ot_layout_table_get_feature_tags
hb_ot_layout_table_get_lookup_count
hb_ot_layout_table_get_script_tags
hb_ot_math_get_constant
hb_ot_math_get_glyph_assembly
hb_ot_math_get_glyph_italics_correction
hb_ot_math_get_glyph_kerning
hb_ot_math_get_glyph_top_accent_attachment
hb_ot_math_get_glyph_variants
hb_ot_math_get_min_connector_overlap
hb_ot_math_has_data
hb_ot_math_is_glyph_extended_shape
hb_ot_shape_glyphs_closure
hb_ot_shape_plan_collect_lookups
hb_ot_tag_from_language
hb_ot_tag_to_language
hb_ot_tag_to_script
hb_ot_tags_from_script
hb_ot_var_find_axis
hb_ot_var_get_axes
hb_ot_var_get_axis_count
hb_ot_var_has_data
hb_ot_var_normalize_coords
hb_ot_var_normalize_variations
hb_script_from_iso15924_tag
hb_script_from_string
hb_script_get_horizontal_direction
hb_script_to_iso15924_tag
hb_segment_properties_equal
hb_segment_properties_hash
hb_set_add
hb_set_add_range
hb_set_allocation_successful
hb_set_clear
hb_set_create
hb_set_del
hb_set_del_range
hb_set_destroy
hb_set_get_empty
hb_set_get_max
hb_set_get_min
hb_set_get_population
hb_set_get_user_data
hb_set_has
hb_set_intersect
hb_set_invert
hb_set_is_empty
hb_set_is_equal
hb_set_next
hb_set_next_range
hb_set_previous
hb_set_previous_range
hb_set_reference
hb_set_set
hb_set_set_user_data
hb_set_subtract
hb_set_symmetric_difference
hb_set_union
hb_shape
hb_shape_full
hb_shape_list_shapers
hb_shape_plan_create
hb_shape_plan_create2
hb_shape_plan_create_cached
hb_shape_plan_create_cached2
hb_shape_plan_destroy
hb_shape_plan_execute
hb_shape_plan_get_empty
hb_shape_plan_get_shaper
hb_shape_plan_get_user_data
hb_shape_plan_reference
hb_shape_plan_set_user_data
hb_tag_from_string
hb_tag_to_string
hb_unicode_combining_class
hb_unicode_compose
hb_unicode_decompose
hb_unicode_decompose_compatibility
hb_unicode_eastasian_width
hb_unicode_funcs_create
hb_unicode_funcs_destroy
hb_unicode_funcs_get_default
hb_unicode_funcs_get_empty
hb_unicode_funcs_get_parent
hb_unicode_funcs_get_user_data
hb_unicode_funcs_is_immutable
hb_unicode_funcs_make_immutable
hb_unicode_funcs_reference
hb_unicode_funcs_set_combining_class_func
hb_unicode_funcs_set_compose_func
hb_unicode_funcs_set_decompose_compatibility_func
hb_unicode_funcs_set_decompose_func
hb_unicode_funcs_set_eastasian_width_func
hb_unicode_funcs_set_general_category_func
hb_unicode_funcs_set_mirroring_func
hb_unicode_funcs_set_script_func
hb_unicode_funcs_set_user_data
hb_unicode_general_category
hb_unicode_mirroring
hb_unicode_script
hb_variation_from_string
hb_variation_to_string
hb_version
hb_version_atleast
hb_version_string
LIBRARY libharfbuzz-0.dll

View File

@ -14,7 +14,7 @@ hb_base_sources = [
'hb-warning.cc',
]
hb_base_headers = [
hb_base_headers = files([
'hb.h',
'hb-blob.h',
'hb-buffer.h',
@ -27,7 +27,7 @@ hb_base_headers = [
'hb-shape-plan.h',
'hb-unicode.h',
'hb-version.h',
]
])
hb_base_ragel_sources = [
'hb-buffer-deserialize-json.rl',
@ -63,7 +63,7 @@ hb_ot_sources = [
'hb-ot-var.cc',
]
hb_ot_headers = [
hb_ot_headers = files([
'hb-ot.h',
'hb-ot-font.h',
'hb-ot-layout.h',
@ -71,7 +71,7 @@ hb_ot_headers = [
'hb-ot-shape.h',
'hb-ot-tag.h',
'hb-ot-var.h',
]
])
hb_ot_ragel_sources = [
'hb-ot-shape-complex-indic-machine.rl',
@ -84,33 +84,33 @@ hb_ft_sources = [
'hb-ft.cc',
]
hb_ft_headers = [
hb_ft_headers = files([
'hb-ft.h',
]
])
hb_glib_sources = [
'hb-glib.cc',
]
hb_glib_headers = [
hb_glib_headers = files([
'hb-glib.h',
]
])
hb_graphite2_sources = [
'hb-graphite2.cc',
]
hb_graphite2_headers = [
hb_graphite2_headers = files([
'hb-graphite2.h',
]
])
hb_icu_sources = [
'hb-icu.cc',
]
hb_icu_headers = [
hb_icu_headers = files([
'hb-icu.h',
]
])
hb_subset_sources = [
'hb-subset.cc',
@ -119,21 +119,21 @@ hb_subset_sources = [
'hb-subset-plan.cc',
]
hb_subset_headers = [
hb_subset_headers = files([
'hb-subset.h',
'hb-subset-glyf.hh',
'hb-subset-plan.hh',
'hb-subset-private.hh',
]
])
hb_gobject_sources = [
'hb-gobject-structs.cc'
]
hb_gobject_headers = [
hb_gobject_headers = files([
'hb-gobject.h',
'hb-gobject-structs.h',
]
])
incucdn = []
incsrc = include_directories('.')
@ -182,13 +182,20 @@ if conf.get('HAVE_CORETEXT', 0) == 1
hb_headers += ['hb-coretext.h']
endif
# harfbuzz
gen_def = find_program('gen-def.py')
harfbuzz_def = custom_target('harfbuzz.def',
command: [gen_def, '@OUTPUT@', '@INPUT@'],
input: hb_headers,
output: 'harfbuzz.def')
version = '0.' + '0'.join(meson.project_version().split('.')) + '.0'
libharfbuzz = library('harfbuzz', hb_sources,
include_directories: [incbase, incucdn],
dependencies: deps,
cpp_args: cpp_args,
vs_module_defs: 'harfbuzz.def',
vs_module_defs: harfbuzz_def,
soversion: '0',
version: version,
install: true,
@ -199,11 +206,17 @@ libharfbuzz_dep = declare_dependency(
include_directories: [incbase, incucdn],
dependencies: deps)
# harfbuzz-subset
harfbuzz_subset_def = custom_target('harfbuzz-subset.def',
command: [gen_def, '@OUTPUT@', '@INPUT@'],
input: hb_subset_headers,
output: 'harfbuzz-subset.def')
libharfbuzz_subset = library('harfbuzz-subset', hb_subset_sources,
include_directories: incbase,
link_with: [libharfbuzz],
cpp_args: cpp_args,
vs_module_defs: 'harfbuzz-subset.def',
vs_module_defs: harfbuzz_subset_def,
soversion: '0',
version: version,
install: true,
@ -265,12 +278,17 @@ if conf.get('HAVE_GOBJECT', 0) == 1
hb_gobject_sources += [enum_c]
harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def',
command: [gen_def, '@OUTPUT@', '@INPUT@'],
input: [hb_gobject_headers, enum_h],
output: 'harfbuzz-gobject.def')
libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, enum_c, enum_h],
include_directories: incbase,
dependencies: deps,
link_with: [libharfbuzz],
cpp_args: cpp_args,
vs_module_defs: 'harfbuzz-gobject.def',
vs_module_defs: harfbuzz_gobject_def,
soversion: '0',
version: version,
install: true,