gtk/build/win32/gtkpc.py
Chun-wei Fan 8b8f378050 Visual Studio builds: Update from [gdk|gtk]-3 to [gdk|gtk]-4
This updates all the projects files to be be named appropriately as we move from GTK-3.x to 4.x,
and updates the autotools files so that things are distributed and generated properly.

Also remove deprecated/gtkstatusicon-quartz.c from gtk/Makefile.am, as that was causing 'make dist'
to fail as that file has been removed.

This fixes 'make dist' with the updated existing project files in proper order.

Note that this does not include the new GSK, which will be added later, so the project files do
not yet build the whole stack on Visual Studio at this point.
2016-10-19 18:39:36 +08:00

90 lines
3.3 KiB
Python

#!/usr/bin/python
#
# Utility script to generate .pc files for GTK+
# for Visual Studio builds, to be used for
# building introspection files
# Author: Fan, Chun-wei
# Date: April 26, 2016
import os
import sys
import argparse
from replace import replace_multi, replace
from pc_base import BasePCItems
def main(argv):
base_pc = BasePCItems()
gdk_parser = argparse.ArgumentParser(description='Setup basic .pc file info')
gdk_parser.add_argument('--broadway',
action='store_const',
const=1,
help='GDK with Broadway backend')
gdk_parser.add_argument('--host',
required=True,
help='Build type')
base_pc.setup(argv, gdk_parser)
atk_min_ver = '2.15.1'
cairo_min_ver = '1.14.0'
gdk_pixbuf_min_ver = '2.30.0'
gdk_win32_sys_libs = '-lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi'
glib_min_ver = '2.45.8'
cairo_backends = 'cairo-win32'
gdk_backends = 'win32'
gio_package = 'gio-2.0 >= ' + glib_min_ver
broadway_extra_libs = ''
gdk_args = gdk_parser.parse_args()
if getattr(gdk_args, 'broadway', None) is 1:
# On Visual Studio, we link to zlib1.lib
broadway_extra_libs = '-lzlib1'
gdk_backends += ' broadway'
cairo_backends += ' cairo'
pkg_replace_items = {'@GTK_API_VERSION@': '4.0',
'@GDK_BACKENDS@': gdk_backends}
pkg_required_packages = 'gdk-pixbuf >= ' + gdk_pixbuf_min_ver + ' ' + \
'cairo >= ' + cairo_min_ver + ' ' + \
'cairo-gobject >= ' + cairo_min_ver
gdk_pc_replace_items = {'@GDK_PACKAGES@': gio_package + ' ' + \
'pangowin32 pangocairo' + ' ' + \
pkg_required_packages,
'@GDK_PRIVATE_PACKAGES@': gio_package + ' ' + cairo_backends,
'@GDK_EXTRA_LIBS@': gdk_win32_sys_libs + broadway_extra_libs,
'@GDK_EXTRA_CFLAGS@': '',
'gdk-4': 'gdk-4.0'}
gtk_pc_replace_items = {'@host@': gdk_args.host,
'@GTK_BINARY_VERSION@': '4.0.0',
'@GTK_PACKAGES@': 'atk >= ' + atk_min_ver + ' ' + \
pkg_required_packages + ' ' + \
gio_package,
'@GTK_PRIVATE_PACKAGES@': 'atk',
'@GTK_EXTRA_CFLAGS@': '',
'@GTK_EXTRA_LIBS@': '',
'@GTK_EXTRA_CFLAGS@': '',
'gtk-4': 'gtk-4.0'}
pkg_replace_items.update(base_pc.base_replace_items)
gdk_pc_replace_items.update(pkg_replace_items)
gtk_pc_replace_items.update(pkg_replace_items)
# Generate gdk-4.0.pc
replace_multi(base_pc.top_srcdir + '/gdk-4.0.pc.in',
base_pc.srcdir + '/gdk-4.0.pc',
gdk_pc_replace_items)
# Generate gtk+-4.0.pc
replace_multi(base_pc.top_srcdir + '/gtk+-4.0.pc.in',
base_pc.srcdir + '/gtk+-4.0.pc',
gtk_pc_replace_items)
if __name__ == '__main__':
sys.exit(main(sys.argv))