build: Generate pkg-config files

...instead of using templates for the sake of autotools build support.
This will hopefully attempt to clean things up a bit while attempting to
retain compatibility.

This ensures that the items in here are correct in terms of the libraries
and packages that are being used.
This commit is contained in:
Chun-wei Fan 2023-02-09 20:08:54 +08:00
parent b668e6d8a1
commit f0d0a8f5ed
13 changed files with 214 additions and 272 deletions

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Gail
Description: GNOME Accessibility Implementation Library
Version: @VERSION@
Requires: atk gtk+-3.0
Libs: -L${libdir} -lgailutil-3
Cflags: -I${includedir}/gail-3.0

View File

@ -1,13 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
targets=@GDK_BACKENDS@
Name: GDK
Description: GTK+ Drawing Kit
Version: @VERSION@
Requires: @GDK_PACKAGES@
Requires.private: @GDK_PRIVATE_PACKAGES@
Libs: -L${libdir} -lgdk-3 @GDK_EXTRA_LIBS@
Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GDK_EXTRA_CFLAGS@

View File

@ -28,7 +28,18 @@ gdk_broadway_public_headers = files(
install_headers(gdk_broadway_public_headers, subdir: 'gtk-3.0/gdk/broadway/') install_headers(gdk_broadway_public_headers, subdir: 'gtk-3.0/gdk/broadway/')
install_headers('gdkbroadway.h', subdir: 'gtk-3.0/gdk/') install_headers('gdkbroadway.h', subdir: 'gtk-3.0/gdk/')
gdk_broadway_deps = [shmlib] zlib_dep = dependency('zlib')
gdk_broadway_pkg_deps = []
gdk_broadway_lib_deps = [shmlib]
if zlib_dep.type_name() == 'pkgconfig'
gdk_broadway_pkg_deps += zlib_dep
else
gdk_broadway_lib_deps += zlib_dep
endif
gdk_backend_extra_pkgs += gdk_broadway_pkg_deps
gdk_backend_extra_libs += gdk_broadway_lib_deps
gdk_broadway_deps = gdk_broadway_lib_deps + gdk_broadway_pkg_deps
gen_c_array = find_program('gen-c-array.py') gen_c_array = find_program('gen-c-array.py')

View File

@ -197,28 +197,18 @@ wlinc = include_directories('.')
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros] gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]
gdk_deps = [ pango_pkg_dep = win32_enabled ? pangowin32_dep : pango_dep
libm,
pixbuf_dep, gdk_pkg_deps = [pango_pkg_dep, pangocairo_dep, pixbuf_dep] + cairo_pkg_deps
cairo_dep, gdk_pkg_private_deps = [platform_gio_dep, fontconfig_dep, epoxy_dep, fribidi_dep]
pango_dep, gdk_lib_deps = [libm, cairo_lib_deps]
fribidi_dep, if profiler_enabled
cairogobj_dep, if profiler_dep.found()
glib_dep, gdk_pkg_private_deps += profiler_dep
epoxy_dep, endif
fontconfig_dep, endif
platform_gio_dep,
pangocairo_dep
]
if win32_enabled if win32_enabled
gdk_deps += [cc.find_library('advapi32'),
cc.find_library('comctl32'),
cc.find_library('dwmapi'),
cc.find_library('imm32'),
cc.find_library('setupapi'),
cc.find_library('winmm')]
gdk_rc = configure_file( gdk_rc = configure_file(
input: 'win32/rc/gdk.rc.in', input: 'win32/rc/gdk.rc.in',
output: 'gdk.rc', output: 'gdk.rc',
@ -228,11 +218,7 @@ if win32_enabled
gdk_sources += gdk_res gdk_sources += gdk_res
endif endif
if profiler_enabled gdk_deps = gdk_lib_deps + gdk_pkg_deps + gdk_pkg_private_deps
if profiler_dep.found()
gdk_deps += [profiler_dep]
endif
endif
gdk_sources = [ gdk_sources = [
# Generated # Generated
@ -257,6 +243,9 @@ if wayland_enabled or broadway_enabled
endif endif
gdk_backends = [] gdk_backends = []
gdk_backend_extra_libs = []
gdk_backend_extra_pkgs = []
gdk_backends_gen_headers = [] # non-public generated headers gdk_backends_gen_headers = [] # non-public generated headers
foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11'] foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11']
if get_variable('@0@_enabled'.format(backend)) if get_variable('@0@_enabled'.format(backend))
@ -302,6 +291,26 @@ libgdk = library('gdk-3',
install: true) install: true)
gdk_dep_sources = [gdkconfig, gdkenum_h] gdk_dep_sources = [gdkconfig, gdkenum_h]
if cloudproviders_dep.found()
gdk_backend_extra_pkgs += cloudproviders_dep
endif
# pkg-config
foreach gdk_pc: gdk_pcs
pkg.generate(libgdk,
name: 'GDK',
description: 'Gtk+ Drawing Kit',
filebase: gdk_pc,
libraries: ['-L${libdir}', '-lgdk-@0@'.format(gtk_major_version)] + \
gdk_lib_deps + gdk_backend_extra_libs,
requires: gdk_pkg_deps,
requires_private: gdk_pkg_private_deps + gdk_backend_extra_pkgs,
subdirs: ['gtk-@0@'.format(gtk_api_version)],
unescaped_variables: gdk_pc_variables,
)
endforeach
# Introspection # Introspection
if build_gir if build_gir
gir_args = ['--quiet'] gir_args = ['--quiet']

View File

@ -54,6 +54,8 @@ iosurface_dep = dependency('appleframeworks', modules: 'IOSurface', required: tr
gdk_quartz_deps = [ core_graphics_dep, appkit_dep, cocoa_dep, carbon_dep, quartzcore_dep, iosurface_dep ] gdk_quartz_deps = [ core_graphics_dep, appkit_dep, cocoa_dep, carbon_dep, quartzcore_dep, iosurface_dep ]
gdk_backend_extra_libs += gdk_quartz_deps
libgdk_quartz = static_library('gdk-quartz', libgdk_quartz = static_library('gdk-quartz',
gdk_quartz_sources, gdkconfig, gdkenum_h, gdk_quartz_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc], include_directories: [confinc, gdkinc],

View File

@ -26,8 +26,8 @@ gdk_wayland_public_headers = files(
install_headers(gdk_wayland_public_headers, subdir: 'gtk-3.0/gdk/wayland') install_headers(gdk_wayland_public_headers, subdir: 'gtk-3.0/gdk/wayland')
install_headers('gdkwayland.h', subdir: 'gtk-3.0/gdk') install_headers('gdkwayland.h', subdir: 'gtk-3.0/gdk')
gdk_wayland_deps = [ gdk_wayland_lib_deps = [shmlib]
shmlib, gdk_wayland_pkg_deps = [
xkbdep, xkbdep,
wlclientdep, wlclientdep,
wlprotocolsdep, wlprotocolsdep,
@ -35,6 +35,11 @@ gdk_wayland_deps = [
wlegldep, wlegldep,
] ]
gdk_wayland_deps = gdk_wayland_lib_deps + gdk_wayland_pkg_deps
gdk_backend_extra_pkgs += gdk_wayland_pkg_deps
gdk_backend_extra_libs += gdk_wayland_lib_deps
# wayland protocols # wayland protocols
wlprotocolsdep = dependency('wayland-protocols') wlprotocolsdep = dependency('wayland-protocols')
proto_dir = wlprotocolsdep.get_variable(pkgconfig: 'pkgdatadir') proto_dir = wlprotocolsdep.get_variable(pkgconfig: 'pkgdatadir')

View File

@ -48,12 +48,40 @@ endif
install_headers(gdk_win32_public_headers, subdir: 'gtk-3.0/gdk/win32') install_headers(gdk_win32_public_headers, subdir: 'gtk-3.0/gdk/win32')
install_headers('gdkwin32.h', subdir: 'gtk-3.0/gdk') install_headers('gdkwin32.h', subdir: 'gtk-3.0/gdk')
gdk_pkg_deps = [pangowin32_dep] + gdk_pkg_deps
gdk_win32_deps = [ # FIXME gdk_backend_extra_pkgs += dependency(
pangowin32_dep, 'cairo-win32',
meson.get_compiler('c').find_library('hid') version: cairo_req,
required: false
)
gdk_win32_lib_deps = [
cc.find_library('advapi32'),
cc.find_library('dwmapi'),
cc.find_library('gdi32'),
cc.find_library('hid'),
cc.find_library('imm32'),
cc.find_library('ole32'),
cc.find_library('setupapi'),
cc.find_library('shell32'),
cc.find_library('user32'),
cc.find_library('winmm'),
] ]
gdk_backend_extra_libs = gdk_win32_lib_deps
# For Go users, should check whether we should ask people to
# whitelist -Wl,-l.... items, since we are dynamically linking
# items
if cc.get_argument_syntax() != 'msvc'
if get_option('default_library') == 'shared'
gdk_backend_extra_libs += [ '-Wl,-luuid' ]
else
gdk_backend_extra_libs += cc.find_library('uuid')
endif
endif
gdk_win32_deps = [gdk_pkg_deps, gdk_win32_lib_deps]
libgdk_win32 = static_library('gdk-win32', libgdk_win32 = static_library('gdk-win32',
gdk_win32_sources, gdkconfig, gdkenum_h, gdk_win32_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc], include_directories: [confinc, gdkinc],

View File

@ -68,6 +68,7 @@ gdk_x11_deps = [
xrandr_dep, xrandr_dep,
xinerama_dep, xinerama_dep,
] ]
gdk_backend_extra_pkgs = gdk_x11_deps
libgdk_x11 = static_library('gdk-x11', gdkmarshal_h, libgdk_x11 = static_library('gdk-x11', gdkmarshal_h,
gdk_x11_sources, gdkconfig, gdkenum_h, gdk_x11_sources, gdkconfig, gdkenum_h,

View File

@ -1,16 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@
gtk_host=@host@
Name: GTK+
Description: GTK+ Graphical UI Library
Version: @VERSION@
Requires: gdk-@GTK_API_VERSION@ @GTK_PACKAGES@
Requires.private: @GTK_PRIVATE_PACKAGES@
Libs: -L${libdir} -lgtk-3 @GTK_EXTRA_LIBS@
Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GTK_EXTRA_CFLAGS@

View File

@ -1,14 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@
gtk_host=@host@
Name: GTK+
Description: GTK+ Unix print support
Version: @VERSION@
Requires: gtk+-@GTK_API_VERSION@ @GTK_PACKAGES@
Cflags: -I${includedir}/gtk-@GTK_API_VERSION@/unix-print

View File

@ -831,41 +831,62 @@ gtk_sources += [
gtktypebuiltins, gtktypebuiltins,
] ]
gtk_deps = [ harfbuzz_pkg = []
harfbuzz_lib = []
if harfbuzz_dep.found()
if harfbuzz_dep.type_name() == 'pkgconfig' or harfbuzz_dep.type_name() == 'internal'
harfbuzz_pkg = harfbuzz_dep
else
harfbuzz_lib = harfbuzz_dep
endif
endif
gtk_pkg_deps = [
atk_dep,
gmodule_dep, gmodule_dep,
glib_dep, glib_dep,
gobject_dep, gobject_dep,
platform_gio_dep,
pangocairo_dep, pangocairo_dep,
pango_dep, pango_dep,
pangoft_dep, harfbuzz_pkg,
harfbuzz_dep, ] + cairo_pkg_deps + [
fribidi_dep,
cairogobj_dep,
cairo_dep,
fontconfig_dep, fontconfig_dep,
pixbuf_dep, pixbuf_dep,
atk_dep,
epoxy_dep,
libm,
] ]
gtk_private_pkg_deps = [atk_dep, epoxy_dep, fribidi_dep]
gtk_extra_private_pkg_deps = []
gtk_lib_deps = [harfbuzz_lib] + cairo_lib_deps + [libm]
if x11_enabled if x11_enabled
x11_data_prefix = dependency('x11').get_variable(pkgconfig: 'prefix') x11_data_prefix = dependency('x11').get_variable(pkgconfig: 'prefix')
gtk_cargs += [ '-DX11_DATA_PREFIX="@0@"'.format(x11_data_prefix), ] gtk_cargs += [ '-DX11_DATA_PREFIX="@0@"'.format(x11_data_prefix), ]
gtk_sources += gtk_use_x11_sources gtk_sources += gtk_use_x11_sources
gtk_deps += [ xi_dep, x11_dep, ] gtk_extra_private_pkg_deps += [ xi_dep, x11_dep, ]
endif endif
if wayland_enabled if wayland_enabled
gtk_sources += gtk_use_wayland_sources gtk_sources += gtk_use_wayland_sources
gtk_extra_private_pkg_deps += [
wlclientdep,
xkbdep,
wlcursordep,
wlegldep,
]
endif endif
if win32_enabled if win32_enabled
gtk_cargs += [] gtk_cargs += []
gtk_sources += gtk_use_win32_sources gtk_sources += gtk_use_win32_sources
gtk_deps += [ giowin32_dep, pangowin32_dep ] gtk_pkg_deps += [ giowin32_dep, pangowin32_dep ]
gtk_lib_deps += [
cc.find_library('comctl32'),
cc.find_library('comdlg32'),
cc.find_library('winspool'),
]
gtk_rc_body = configure_file( gtk_rc_body = configure_file(
input: 'gtk-win32.rc.body.in', input: 'gtk-win32.rc.body.in',
@ -902,8 +923,9 @@ if win32_enabled
gtk_res = import('windows').compile_resources(gtk_rc) gtk_res = import('windows').compile_resources(gtk_rc)
gtk_sources += gtk_res gtk_sources += gtk_res
else else
gtk_deps += [ atkbridge_dep, ] gtk_private_pkg_deps += [ atkbridge_dep, ]
endif endif
gtk_private_pkg_deps += platform_gio_dep
if quartz_enabled if quartz_enabled
gtk_sources += gtk_use_quartz_sources gtk_sources += gtk_use_quartz_sources
@ -913,7 +935,7 @@ endif
# So we don't add these twice # So we don't add these twice
if x11_enabled or wayland_enabled if x11_enabled or wayland_enabled
gtk_sources += gtk_use_wayland_or_x11_sources gtk_sources += gtk_use_wayland_or_x11_sources
gtk_deps += pangoft_dep gtk_extra_private_pkg_deps += pangoft_dep
endif endif
if not (x11_enabled or win32_enabled or quartz_enabled) if not (x11_enabled or win32_enabled or quartz_enabled)
@ -921,16 +943,22 @@ if not (x11_enabled or win32_enabled or quartz_enabled)
endif endif
if cloudproviders_enabled if cloudproviders_enabled
gtk_deps += cloudproviders_dep gtk_pkg_deps += cloudproviders_dep
endif endif
if os_unix and tracker3_enabled if os_unix and tracker3_enabled
gtk_deps += tracker3_dep gtk_pkg_deps += tracker3_dep
endif endif
# Unconditional. If libintl isn't found, # Unconditional. If libintl isn't found,
# the object just does nothing being in the deplist # the object just does nothing being in the deplist
gtk_deps += libintl_dep gtk_lib_deps += libintl_dep
gtk_deps = \
gtk_pkg_deps + \
gtk_private_pkg_deps + \
gtk_lib_deps + \
gtk_extra_private_pkg_deps
gtk_settings_schemas = [ gtk_settings_schemas = [
'org.gtk.Settings.FileChooser.gschema.xml', 'org.gtk.Settings.FileChooser.gschema.xml',
@ -988,6 +1016,34 @@ libgtk = library('gtk-3',
darwin_versions : gtk_osxversions, darwin_versions : gtk_osxversions,
install: true) install: true)
# pkg-config
foreach gtk_pc: gtk_pcs
pkg.generate(libgtk,
name: 'GTK+',
description: 'GTK+ Graphical UI Library',
filebase: gtk_pc,
libraries: ['-L${libdir}', '-lgtk-@0@'.format(gtk_major_version)] + \
gtk_lib_deps,
requires: [libgdk] + gtk_pkg_deps,
requires_private: gtk_private_pkg_deps,
subdirs: ['gtk-@0@'.format(gtk_api_version)],
unescaped_variables: gdk_pc_variables,
variables: gtk_pc_variables,
)
endforeach
if os_unix
pkg.generate(libgtk,
name: 'GTK+',
description: 'GTK+ Unix print support',
filebase: 'gtk+-unix-print-@0@'.format(gtk_api_version),
requires: ['gtk+-@0@'.format(gtk_api_version)] + gtk_pkg_deps,
subdirs: ['gtk-@0@/unix-print/gtk'.format(gtk_api_version)],
unescaped_variables: gdk_pc_variables,
variables: gtk_pc_variables,
)
endif
# Introspection # Introspection
if build_gir if build_gir
gir_args = ['--quiet'] gir_args = ['--quiet']

View File

@ -30,3 +30,12 @@ libgailutil = library('gailutil-3',
] + common_cflags, ] + common_cflags,
link_args: gailutil_link_args, link_args: gailutil_link_args,
install: true) install: true)
pkg.generate(libgailutil,
name: 'Gail',
filebase: 'gail-3.0',
description: 'GNOME Accessibility Implementation Library',
libraries: ['-L${libdir}', '-lgailutil-@0@'.format(gtk_major_version)],
requires: [atk_dep, libgtk],
subdirs: ['gail-@0@'.format(gtk_api_version)],
)

View File

@ -39,6 +39,7 @@ cloudproviders_req = '>= 0.2.5'
xkbcommon_req = '>= 0.2.0' xkbcommon_req = '>= 0.2.0'
gnome = import('gnome') gnome = import('gnome')
pkg = import('pkgconfig')
add_project_arguments('-DG_LOG_USE_STRUCTURED=1', language: 'c') add_project_arguments('-DG_LOG_USE_STRUCTURED=1', language: 'c')
add_project_arguments('-DGLIB_MIN_REQUIRED_VERSION=' + glib_min_required, language: 'c') add_project_arguments('-DGLIB_MIN_REQUIRED_VERSION=' + glib_min_required, language: 'c')
@ -423,7 +424,8 @@ endif
if win32_enabled if win32_enabled
# for GTK_IM_CONTEXT_IME # for GTK_IM_CONTEXT_IME
pangowin32_dep = dependency('pangowin32', fallback : ['pango', 'libpangowin32_dep']) pangowin32_dep = dependency('pangowin32', version: pango_req,
fallback : ['pango', 'libpangowin32_dep'])
endif endif
pangocairo_dep = dependency('pangocairo', version: cairo_req, pangocairo_dep = dependency('pangocairo', version: cairo_req,
@ -484,8 +486,6 @@ endif
backend_immodules = [] backend_immodules = []
pc_gdk_extra_libs = []
cairo_found_type = cairo_dep.type_name() cairo_found_type = cairo_dep.type_name()
if cairo_found_type == 'internal' if cairo_found_type == 'internal'
cairo_features = subproject('cairo').get_variable('built_features') cairo_features = subproject('cairo').get_variable('built_features')
@ -516,24 +516,9 @@ foreach backend: [ ['cairo-xlib', cairo_req, x11_enabled],
endif endif
endforeach endforeach
cairo_pkg_found = false
cairogobj_pkg_found = false
if cairo_found_type == 'internal' or cairo_found_type == 'pkgconfig'
cairo_pkg_found = true
endif
if cairogobj_found_type == 'internal' or cairogobj_found_type == 'pkgconfig'
cairogobj_pkg_found = true
endif
cairo_libs = []
cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found() ? 1 : false) cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found() ? 1 : false)
cdata.set('HAVE_PANGOFT', pangoft_dep.found() ? 1 : false) cdata.set('HAVE_PANGOFT', pangoft_dep.found() ? 1 : false)
atk_pkgs = ['atk']
wayland_pkgs = []
if wayland_enabled if wayland_enabled
wlclientdep = dependency('wayland-client', version: wayland_req) wlclientdep = dependency('wayland-client', version: wayland_req)
wlprotocolsdep = dependency('wayland-protocols', version: wayland_proto_req) wlprotocolsdep = dependency('wayland-protocols', version: wayland_proto_req)
@ -542,16 +527,8 @@ if wayland_enabled
backend_immodules += ['wayland'] backend_immodules += ['wayland']
cdata.set('HAVE_XDG_ACTIVATION', wlprotocolsdep.version().version_compare('>=1.21')) cdata.set('HAVE_XDG_ACTIVATION', wlprotocolsdep.version().version_compare('>=1.21'))
wayland_pkgs = [
'wayland-client', wayland_req,
'xkbcommon', xkbcommon_req,
'wayland-cursor', wayland_req,
'wayland-egl',
]
endif endif
x11_pkgs = []
if x11_enabled if x11_enabled
xrandr_dep = dependency('xrandr', version: '>= 1.2.99') xrandr_dep = dependency('xrandr', version: '>= 1.2.99')
xrandr15_dep = dependency('xrandr', version: '>= 1.5', required: false) xrandr15_dep = dependency('xrandr', version: '>= 1.5', required: false)
@ -568,23 +545,6 @@ if x11_enabled
backend_immodules += ['xim'] backend_immodules += ['xim']
x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr']
if xcursor_dep.found()
x11_pkgs += ['xcursor']
endif
if xfixes_dep.found()
x11_pkgs += ['xfixes']
endif
if xcomposite_dep.found()
x11_pkgs += ['xcomposite']
endif
if xdamage_dep.found()
x11_pkgs += ['xdamage']
endif
atk_pkgs += ['atk-bridge-2.0']
cdata.set('HAVE_XDAMAGE', xdamage_dep.found() ? 1 : false) cdata.set('HAVE_XDAMAGE', xdamage_dep.found() ? 1 : false)
cdata.set('HAVE_XCURSOR', xcursor_dep.found() ? 1 : false) cdata.set('HAVE_XCURSOR', xcursor_dep.found() ? 1 : false)
cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found() ? 1 : false) cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found() ? 1 : false)
@ -634,7 +594,6 @@ if x11_enabled
if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep) if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep)
cdata.set('HAVE_XFREE_XINERAMA', 1) cdata.set('HAVE_XFREE_XINERAMA', 1)
cdata.set('HAVE_XINERAMA', 1) cdata.set('HAVE_XINERAMA', 1)
x11_pkgs += ['xinerama']
endif endif
else else
xinerama_dep = [] xinerama_dep = []
@ -645,28 +604,22 @@ if x11_enabled
endif endif
if broadway_enabled if broadway_enabled
pc_gdk_extra_libs += ['-lz']
backend_immodules += ['broadway'] backend_immodules += ['broadway']
endif endif
if quartz_enabled if quartz_enabled
pc_gdk_extra_libs += ['-Wl,-framework,Cocoa', '-Wl,-framework,Carbon', '-Wl,-framework,CoreGraphics']
backend_immodules += ['quartz'] backend_immodules += ['quartz']
cdata.set('QUARTZ_RELOCATION', 1) cdata.set('QUARTZ_RELOCATION', 1)
endif endif
extra_demo_ldflags = [] extra_demo_ldflags = []
if win32_enabled if win32_enabled
pc_gdk_extra_libs += ['-lgdi32', '-limm32', '-lshell32', '-lole32']
if cc.get_id() == 'msvc' if cc.get_id() == 'msvc'
# Since the demo programs are now built as pure GUI programs, we # Since the demo programs are now built as pure GUI programs, we
# need to pass in /entry:mainCRTStartup so that they will properly # need to pass in /entry:mainCRTStartup so that they will properly
# link on Visual Studio builds # link on Visual Studio builds
extra_demo_ldflags = ['/entry:mainCRTStartup'] extra_demo_ldflags = ['/entry:mainCRTStartup']
else
pc_gdk_extra_libs += ['-Wl,-luuid']
endif endif
pc_gdk_extra_libs += ['-lwinmm', '-ldwmapi', '-lsetupapi', '-lcfgmgr32', '-lhid', '-lwinspool', '-lcomctl32', '-lcomdlg32']
backend_immodules += ['ime'] backend_immodules += ['ime']
# Check whether libepoxy is built with EGL support on Windows # Check whether libepoxy is built with EGL support on Windows
@ -819,11 +772,14 @@ if os_unix
endif endif
cloudproviders_enabled = get_option('cloudproviders') cloudproviders_enabled = get_option('cloudproviders')
cloudproviders_packages = [] cloudproviders_dep = dependency(
'cloudproviders',
version: cloudproviders_req,
required: cloudproviders_enabled,
)
if cloudproviders_enabled if cloudproviders_enabled
cloudproviders_dep = dependency('cloudproviders', version: cloudproviders_req, required: true)
if cloudproviders_dep.found() if cloudproviders_dep.found()
cloudproviders_packages += ['cloudproviders', cloudproviders_req]
cdata.set('HAVE_CLOUDPROVIDERS', cloudproviders_dep.found() ? 1 : false) cdata.set('HAVE_CLOUDPROVIDERS', cloudproviders_dep.found() ? 1 : false)
else else
error('Cloudproviders support not found, but was explicitly requested.') error('Cloudproviders support not found, but was explicitly requested.')
@ -849,6 +805,41 @@ endif
gir = find_program('g-ir-scanner', required : get_option('introspection')) gir = find_program('g-ir-scanner', required : get_option('introspection'))
build_gir = gir.found() and get_option('introspection') build_gir = gir.found() and get_option('introspection')
gtk_pcs = ['gtk+-@0@'.format(gtk_api_version)]
gdk_pcs = ['gdk-@0@'.format(gtk_api_version)]
pkg_targets = []
disabled_backends = []
foreach backend: [ 'broadway', 'quartz', 'wayland', 'win32', 'x11']
if get_variable('@0@_enabled'.format(backend))
gtk_pcs += ['gtk+-@0@-@1@'.format(backend, gtk_api_version)]
gdk_pcs += ['gdk-@0@-@1@'.format(backend, gtk_api_version)]
pkg_targets += [backend]
else
disabled_backends += [backend]
endif
endforeach
gdk_pc_variables = [
'targets=@0@'.format(' '.join(pkg_targets))
]
gtk_pc_variables = [
'gtk_binary_version=@0@'.format(gtk_binary_version),
'gtk_host=@0@-@1@'.format(host_machine.cpu_family(), host_machine.system()), # FIXME
]
# Sadly, Cairo only gained Meson build support quite a bit after 3.24.x was released
cairo_lib_deps = []
cairo_pkg_deps = []
foreach dep: [cairogobj_dep, cairo_dep]
if dep.type_name() == 'library'
cairo_lib_deps += dep
else
cairo_pkg_deps += dep
endif
endforeach
subdir('gdk') subdir('gdk')
subdir('gtk') subdir('gtk')
subdir('modules') subdir('modules')
@ -870,122 +861,6 @@ configure_file(
configuration: cdata, configuration: cdata,
) )
# pkg-config files - bit of a mess all of this
pkgconf = configuration_data()
pkgconf.set('prefix', get_option('prefix'))
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('libdir', '${prefix}' / get_option('libdir'))
pkgconf.set('includedir', '${prefix}' / get_option('includedir'))
pkgconf.set('GTK_API_VERSION', gtk_api_version)
pkgconf.set('VERSION', meson.project_version())
pkgconf.set('GTK_BINARY_VERSION', gtk_binary_version)
pkgconf.set('host', '@0@-@1@'.format(host_machine.cpu_family(), host_machine.system())) # FIXME
# Requires
pango_pkgname = win32_enabled ? 'pangowin32' : 'pango'
gdk_packages = ' '.join([ pango_pkgname, pango_req,
'pangocairo', pango_req,
'gdk-pixbuf-2.0', gdk_pixbuf_req ])
cairo_packages = ''
if cairo_pkg_found
cairo_packages += ' '.join([ ' cairo', cairo_req ])
elif cc.get_id() == 'msvc' and cairo_dep.found()
cairo_libs += '-lcairo'
endif
if cairogobj_pkg_found
cairo_packages += ' '.join([ ' cairo-gobject', cairo_req ])
elif cc.get_id() == 'msvc' and cairogobj_dep.found()
cairo_libs += '-lcairo-gobject'
endif
gdk_packages += cairo_packages
pkgconf.set('GDK_PACKAGES', gdk_packages)
if have_gio_unix
gio_packages = ['gio-unix-2.0', glib_req]
else
gio_packages = ['gio-2.0', glib_req]
endif
pkgconf.set('GDK_PRIVATE_PACKAGES',
' '.join(gio_packages + x11_pkgs + wayland_pkgs + cairo_backends +
['epoxy', epoxy_req] + cloudproviders_packages +
['fribidi', fribidi_req]))
gtk_packages = ' '.join([
atk_dep.name(), atk_req,
cairo_packages,
pixbuf_dep.name(), gdk_pixbuf_req,
'gio-2.0', glib_req,
])
pkgconf.set('GTK_PACKAGES', gtk_packages)
# Requires.private
pc_gdk_extra_libs += cairo_libs
gtk_private_packages = atk_pkgs + wayland_pkgs + ['epoxy', epoxy_req, 'fribidi', fribidi_req]
if wayland_enabled or x11_enabled
gtk_private_packages += ['pangoft2']
endif
gtk_private_packages += gio_packages
pkgconf.set('GTK_PRIVATE_PACKAGES', ' '.join(gtk_private_packages))
pkgconf.set('GDK_EXTRA_LIBS', ' '.join(pc_gdk_extra_libs))
pkgconf.set('GSK_EXTRA_LIBS', '')
pkgconf.set('GTK_EXTRA_LIBS', '')
pkgconf.set('GDK_EXTRA_CFLAGS', '')
pkgconf.set('GSK_EXTRA_CFLAGS', '')
pkgconf.set('GTK_EXTRA_CFLAGS', '')
pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
gtk_pcs = ['gtk+-3.0.pc']
gdk_pcs = ['gdk-3.0.pc']
pkg_targets = ''
disabled_backends = []
foreach backend: [ 'broadway', 'quartz', 'wayland', 'win32', 'x11']
if get_variable('@0@_enabled'.format(backend))
gtk_pcs += ['gtk+-@0@-3.0.pc'.format(backend)]
gdk_pcs += ['gdk-@0@-3.0.pc'.format(backend)]
pkg_targets += ' ' + backend
else
disabled_backends += [backend]
endif
endforeach
pkgconf.set('GDK_BACKENDS', pkg_targets.strip())
configure_file(input: 'gail-3.0.pc.in',
output: 'gail-3.0.pc',
configuration: pkgconf,
install_dir: pkg_install_dir)
foreach pkg: gdk_pcs
configure_file(input: 'gdk-3.0.pc.in',
output: pkg,
configuration: pkgconf,
install_dir: pkg_install_dir)
endforeach
foreach pkg: gtk_pcs
configure_file(input: 'gtk+-3.0.pc.in',
output: pkg,
configuration: pkgconf,
install_dir: pkg_install_dir)
endforeach
if os_unix
configure_file(input: 'gtk+-unix-print-3.0.pc.in',
output: 'gtk+-unix-print-3.0.pc',
configuration: pkgconf,
install_dir: pkg_install_dir)
endif
subdir('po') subdir('po')
subdir('po-properties') subdir('po-properties')
subdir('docs/tools') subdir('docs/tools')
@ -1015,7 +890,7 @@ summary = [
'------', '------',
'GTK+ @0@ (@1@)'.format(gtk_version, gtk_api_version), 'GTK+ @0@ (@1@)'.format(gtk_version, gtk_api_version),
'', '',
' Display backends: @0@ [disabled: @1@]'.format(pkg_targets.strip(), ' '.join(disabled_backends)), ' Display backends: @0@ [disabled: @1@]'.format(' '.join(pkg_targets), ' '.join(disabled_backends)),
' Print backends: @0@ [disabled: @1@]'.format(' '.join(print_backends), ' '.join(disabled_print_backends)), ' Print backends: @0@ [disabled: @1@]'.format(' '.join(print_backends), ' '.join(disabled_print_backends)),
' Cloud support: @0@'.format(get_option('cloudproviders')), ' Cloud support: @0@'.format(get_option('cloudproviders')),
' Colord support: @0@'.format(get_option('colord')), ' Colord support: @0@'.format(get_option('colord')),