Hi,

I would like to adopt gobject-introsection package, because the latest
glib2.0 2.83.4 requires newer gobject-introspection.

Thanks in advance.

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>
inherit gnome2 python3 meson

NAME="gobject-introspection"
VERSION=1.82.0
RELEASE=1
CATEGORY="Libs"
SUMMARY="GObject Introspection tools"
DESCRIPTION="The goal of the project is to describe GObject APIs and collect
them in a uniform, machine readable format."
HOMEPAGE="https://gi.readthedocs.io/en/latest/";
LICENSE="GPL-2.0-or-later AND LGPL-2.0-or-later AND MIT"

PATCH_URI="
        1.62.0-cygwin-fixes.patch
        1.62.0-python-linkage.patch
        1.60.2-shlib-tests.patch
        fix-cairo-library-name.patch
        drop-unbuildable-gir-tests.patch
"

CYGMESON_ARGS="
        --auto-features=auto
        -Dcairo=enabled
        -Ddoctool=enabled
        -Dgtk_doc=true
        -Dpython=${PYTHON3}
"

PKG_NAMES="${NAME} libgirepository1.0_1 libgirepository1.0-devel 
libgirepository1.0-doc"
gobject_introspection_CATEGORY="Devel"
gobject_introspection_SUMMARY="GObject Introspection tools"
gobject_introspection_REQUIRES="libgirepository1.0-devel 
python${PYTHON3_PKGVERSION}-mako"
gobject_introspection_CONTENTS="--exclude=gir-1.0 --exclude=gtk-doc
                                usr/bin/g-ir-* usr/lib/${NAME}/ usr/share/"
libgirepository1_0_1_SUMMARY="GObject Introspection library (runtime)"
libgirepository1_0_1_CONTENTS="usr/bin/cyggirepository-1.0-1.dll"
libgirepository1_0_devel_REQUIRES="girepository-GIRepository2.0"
libgirepository1_0_devel_SUMMARY="GObject Introspection library (development)"
libgirepository1_0_devel_CONTENTS="usr/include/ usr/lib/libgirepository-1.0.*
                                   usr/lib/pkgconfig/"
libgirepository1_0_doc_CATEGORY="Doc"
libgirepository1_0_doc_SUMMARY="GObject Introspection library (API docs)"
libgirepository1_0_doc_CONTENTS="usr/share/gtk-doc/"

PKG_NAMES+=" girepository-cairo1.0 girepository-GIRepository2.0
             girepository-GLib2.0 girepository-x11"
girepository_cairo1_0_SUMMARY="GObject Introspection data for libcairo"
girepository_cairo1_0_CONTENTS="usr/*/gir*/cairo-1.0.*"
girepository_GIRepository2_0_SUMMARY="GObject Introspection library (GObject 
Introspection data)"
girepository_GIRepository2_0_CONTENTS="usr/*/gir*/GIRepository-2.0.*"
girepository_GLib2_0_SUMMARY="GLib GObjectIntrospection data"
girepository_GLib2_0_CONTENTS="--exclude=GIR* --exclude=GL-* 
usr/*/gir*/G*-2.0.*"
girepository_x11_SUMMARY="GObject Introspection data for X11 libraries"
girepository_x11_CONTENTS="--exclude=cairo-1.0.* --exclude=G*-2.0.* usr/*/gir*/"

BUILD_REQUIRES=" \
        bison \
        docbook-xml45 \
        flex \
        gnome-common \
        gtk-doc \
        libcairo-devel \
        libffi-devel \
        libglib2.0-devel \
        python3-devel \
        python39-mako \
        python39-markdown \
"

DEPS_PATH="/usr/lib/gobject-introspection/giscanner"
From a6e392e504353c4c987b6ff56eb36cf090d2b7f5 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.tur...@dronecode.org.uk>
Date: Thu, 2 Jan 2025 19:30:21 +0000
Subject: [PATCH] Cygwin patch

---
 girepository/girepository.c |  2 +-
 giscanner/ccompiler.py      |  4 ++++
 giscanner/shlibs.py         | 11 +++++++++++
 giscanner/utils.py          |  2 +-
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/girepository/girepository.c b/girepository/girepository.c
index 08149da8..86f43d92 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -85,7 +85,7 @@ struct _GIRepositoryPrivate
 
 G_DEFINE_TYPE_WITH_CODE (GIRepository, g_irepository, G_TYPE_OBJECT, 
G_ADD_PRIVATE (GIRepository));
 
-#ifdef G_PLATFORM_WIN32
+#ifdef G_OS_WIN32
 
 #include <windows.h>
 
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index 35549da2..81022dac 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -183,6 +183,10 @@ class CCompiler(object):
 
         if os.name == 'nt':
             runtime_path_envvar = ['LIB', 'PATH']
+        elif os.name == 'nt' or sys.platform == 'cygwin':
+            runtime_path_envvar = ['PATH']
+            # Search the current directory first
+            args.append('-L.')
         else:
             runtime_path_envvar = ['LD_LIBRARY_PATH', 
'DYLD_FALLBACK_LIBRARY_PATH']
             # Search the current directory first
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index e6de7bb6..34ca4d4d 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -46,6 +46,17 @@ def _resolve_libtool(options, binary, libraries):
 # We say that if something in the output looks like libpangoft2<blah>
 # then the *first* such in the output is the soname.
 def _ldd_library_pattern(library_name):
+    if platform.platform().startswith('CYGWIN'):
+        return re.compile(r"""^
+        # Require trailing slash to avoid matching liblibfoo when looking for 
libfoo.
+        (.*[/])?
+        cyg%s
+        # Prohibit library name characters to avoid matching libpangoft2 when 
looking for libpango.
+        [^/A-Za-z0-9_]
+        # Anything but the path separator to avoid matching directories.
+        [^/]*
+        $""" % re.escape(library_name), re.VERBOSE)
+
     return re.compile(r"""^
     # Require trailing slash to avoid matching liblibfoo when looking for 
libfoo.
     (.*[/])?
diff --git a/giscanner/utils.py b/giscanner/utils.py
index 25160c3e..3c91ae27 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -78,7 +78,7 @@ def to_underscores_noprefix(name):
     return name
 
 
-_libtool_pat = re.compile("dlname='([A-z0-9\\.\\-\\+]+)'\n")
+_libtool_pat = re.compile("dlname='([A-z0-9/\\.\\-\\+]+)'\n")
 
 
 def _extract_dlname_field(la_file):
-- 
2.45.1

--- origsrc/gobject-introspection-1.62.0/giscanner/meson.build  2025-01-05 
20:27:13.679459400 +0000
+++ src/gobject-introspection-1.62.0/giscanner/meson.build      2025-01-05 
21:03:13.093453100 +0000
@@ -92,7 +92,7 @@ giscanner_lib = static_library('giscanne
 )
 
 # https://github.com/mesonbuild/meson/issues/4117
-if host_machine.system() == 'windows'
+if host_machine.system() == 'windows' or host_machine.system() == 'cygwin'
   python_ext_dep = python.dependency()
 else
   python_ext_dep = python.dependency().partial_dependency(compile_args: true)
--- origsrc/gobject-introspection-1.60.2/tests/scanner/test_shlibs.py   
2019-03-25 20:17:44.000000000 +0000
+++ src/gobject-introspection-1.60.2/tests/scanner/test_shlibs.py       
2025-01-06 18:09:53.452858600 +0000
@@ -4,33 +4,40 @@ import os
 
 from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path
 
+# XXX: maybe we should also accept 'lib' as a prefix in _ldd_library_pattern to
+# avoid having to change all these tests? and add some cygwin specific ones?
+if os.uname()[0].startswith('CYGWIN'):
+    libprefix='cyg'
+else:
+    libprefix='lib'
+
 
 class TestLddParser(unittest.TestCase):
 
     def test_resolve_from_ldd_output(self):
         output = '''\
-            libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 
(0x00007fbe12d68000)
-            libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 
(0x00007fbe12462000)
-            libgdk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 
(0x00007fbe1216c000)
-            libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 
(0x00007fbe11d1a000)
-            libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 
(0x00007fbe11af4000)'''
+            {0}glib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/{0}glib-2.0.so.0 
(0x00007fbe12d68000)
+            {0}gtk-3.so.0 => /usr/lib/x86_64-linux-gnu/{0}gtk-3.so.0 
(0x00007fbe12462000)
+            {0}gdk-3.so.0 => /usr/lib/x86_64-linux-gnu/{0}gdk-3.so.0 
(0x00007fbe1216c000)
+            {0}pango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/{0}pango-1.0.so.0 
(0x00007fbe11d1a000)
+            {0}atk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/{0}atk-1.0.so.0 
(0x00007fbe11af4000)'''.format(libprefix)
         libraries = ['glib-2.0', 'gtk-3', 'pango-1.0']
 
         self.assertEqual(
-            ['libglib-2.0.so.0', 'libgtk-3.so.0', 'libpango-1.0.so.0'],
+            ['{0}glib-2.0.so.0'.format(libprefix), 
'{0}gtk-3.so.0'.format(libprefix), '{0}pango-1.0.so.0'.format(libprefix)],
             resolve_from_ldd_output(libraries, output))
 
     @unittest.skipUnless(os.name == "posix", "posix only")
     def test_resolve_from_ldd_output_macos_rpath(self):
         output = '''\
-            @rpath/libbarapp-1.0.dylib (compatibility version 0.0.0, current 
version 0.0.0)
-            /foo/libgio-2.0.0.dylib (compatibility version 5801.0.0, current 
version 5801.3.0)
-            /foo/libgmodule-2.0.0.dylib (compatibility version 5801.0.0, 
current version 5801.3.0)'''
+            @rpath/{0}barapp-1.0.dylib (compatibility version 0.0.0, current 
version 0.0.0)
+            /foo/{0}gio-2.0.0.dylib (compatibility version 5801.0.0, current 
version 5801.3.0)
+            /foo/{0}gmodule-2.0.0.dylib (compatibility version 5801.0.0, 
current version 5801.3.0)'''.format(libprefix)
 
         libraries = ['barapp-1.0']
         shlibs = resolve_from_ldd_output(libraries, output)
-        self.assertEqual(shlibs, ['@rpath/libbarapp-1.0.dylib'])
-        self.assertEqual(sanitize_shlib_path(shlibs[0]), 'libbarapp-1.0.dylib')
+        self.assertEqual(shlibs, 
['@rpath/{0}barapp-1.0.dylib'.format(libprefix)])
+        self.assertEqual(sanitize_shlib_path(shlibs[0]), 
'{0}barapp-1.0.dylib'.format(libprefix))
 
     @unittest.skipUnless(os.name == "posix", "posix only")
     def test_sanitize_shlib_path(self):
@@ -51,34 +58,34 @@ class TestLddParser(unittest.TestCase):
 
     def test_prefixed_library_name(self):
         output = '''\
-           /usr/lib/liblibX.so
-           /usr/lib/libX.so'''
+           /usr/lib/{0}{0}X.so
+           /usr/lib/{0}X.so'''.format(libprefix)
 
         self.assertEqual(
-            ['/usr/lib/libX.so'],
+            ['/usr/lib/{0}X.so'.format(libprefix)],
             resolve_from_ldd_output(['X'], output))
         self.assertEqual(
-            ['/usr/lib/liblibX.so'],
-            resolve_from_ldd_output(['libX'], output))
+            ['/usr/lib/{0}{0}X.so'.format(libprefix)],
+            resolve_from_ldd_output(['{0}X'.format(libprefix)], output))
 
     def test_suffixed_library_name(self):
         output = '''\
-            libpangocairo.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo.so.0 
(0x00)
-            libpangoft2.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2.so.0 
(0x00)
-            libpango.so.0 => /usr/lib/x86_64-linux-gnu/libpango.so.0 (0x00)'''
+            {0}pangocairo.so.0 => /usr/lib/x86_64-linux-gnu/{0}pangocairo.so.0 
(0x00)
+            {0}pangoft2.so.0 => /usr/lib/x86_64-linux-gnu/{0}pangoft2.so.0 
(0x00)
+            {0}pango.so.0 => /usr/lib/x86_64-linux-gnu/{0}pango.so.0 
(0x00)'''.format(libprefix)
         libraries = ['pango']
 
         self.assertEqual(
-            ['libpango.so.0'],
+            ['{0}pango.so.0'.format(libprefix)],
             resolve_from_ldd_output(libraries, output))
 
     def test_header_is_ignored(self):
         output = '''/tmp-introspection/libfoo.so.999:
-            0000000000000000 0000000000000000 rlib  0    3   0      
/usr/local/lib/libfoo.so.1'''
+            0000000000000000 0000000000000000 rlib  0    3   0      
/usr/local/lib/{}foo.so.1'''.format(libprefix)
         libraries = ['foo']
 
         self.assertEqual(
-            ['/usr/local/lib/libfoo.so.1'],
+            ['/usr/local/lib/{}foo.so.1'.format(libprefix)],
             resolve_from_ldd_output(libraries, output))
 
     def test_executable_path_includes_library_name(self):
@@ -88,29 +95,29 @@ class TestLddParser(unittest.TestCase):
         output = 
'''/usr/ports/pobj/libgepub-0.6.0/build-amd64/tmp-introspectnxmyodg1/Gepub-0.6:
             Start            End              Type  Open Ref GrpRef Name
             00001066c8400000 00001066c8605000 exe   2    0   0      
/usr/ports/pobj/libgepub-0.6.0/build-amd64/tmp-introspectnxmyodg1/Gepub-0.6
-            000010690019c000 00001069003a8000 rlib  0    1   0      
/usr/local/lib/libgepub-0.6.so.0.0'''
+            000010690019c000 00001069003a8000 rlib  0    1   0      
/usr/local/lib/{0}gepub-0.6.so.0.0'''.format(libprefix)
         libraries = ['gepub-0.6']
 
         self.assertEqual(
-            ['/usr/local/lib/libgepub-0.6.so.0.0'],
+            ['/usr/local/lib/{0}gepub-0.6.so.0.0'.format(libprefix)],
             resolve_from_ldd_output(libraries, output))
 
     def test_library_path_includes_library_name(self):
         output = 
'''/usr/ports/pobj/gnome-music-3.28.1/build-amd64/tmp-introspectuz5xaun3/Gd-1.0:
             Start            End              Type  Open Ref GrpRef Name
             0000070e40f00000 0000070e41105000 exe   2    0   0      
/usr/ports/pobj/gnome-music-3.28.1/build-amd64/tmp-introspectuz5xaun3/Gd-1.0
-            00000710f9b39000 00000710f9d51000 rlib  0    1   0      
/usr/ports/pobj/gnome-music-3.28.1/build-amd64/subprojects/libgd/libgd/libgd.so'''
+            00000710f9b39000 00000710f9d51000 rlib  0    1   0      
/usr/ports/pobj/gnome-music-3.28.1/build-amd64/subprojects/libgd/libgd/{0}gd.so'''.format(libprefix)
         libraries = ['gd']
 
         self.assertEqual(
-            
['/usr/ports/pobj/gnome-music-3.28.1/build-amd64/subprojects/libgd/libgd/libgd.so'],
+            
['/usr/ports/pobj/gnome-music-3.28.1/build-amd64/subprojects/libgd/libgd/{0}gd.so'.format(libprefix)],
             resolve_from_ldd_output(libraries, output))
 
     def test_basename(self):
-        output = '''/usr/lib/libfoo.so'''
+        output = '''/usr/lib/{0}foo.so'''.format(libprefix)
 
         self.assertEqual(
-            ['/usr/lib/libfoo.so'],
+            ['/usr/lib/{0}foo.so'.format(libprefix)],
             resolve_from_ldd_output(['foo'], output))
 
 
--- origsrc/gobject-introspection-1.62.0/gir/meson.build        2019-09-09 
20:22:10.000000000 +0100
+++ src/gobject-introspection-1.62.0/gir/meson.build    2025-01-07 
13:56:17.722556800 +0000
@@ -7,6 +7,8 @@ elif host_machine.system() == 'windows'
   else
     cairo_library_name = 'libcairo-gobject-2.dll'
   endif
+elif host_machine.system() == 'cygwin'
+  cairo_library_name = 'cygcairo-gobject-2.dll'
 elif host_machine.system() == 'darwin'
   cairo_library_name = 'libcairo-gobject.2.dylib'
 else
--- origsrc/gobject-introspection-1.82.0/tests/meson.build      2024-09-13 
22:08:54.000000000 +0900
+++ src/gobject-introspection-1.82.0/tests/meson.build  2025-02-24 
21:43:48.638287400 +0900
@@ -124,6 +132,7 @@ test_typelibs = []
 if (glib_dep.type_name() == 'pkgconfig' and
     test_girscanner.found() and
     get_option('build_introspection_data') == true)
+  if host_machine.system() != 'cygwin'
   test_gir_files += [custom_target('gir-everything',
     input: test_everything_sources + test_everything_headers,
     output: 'Everything-1.0.gir',
@@ -149,6 +158,7 @@ if (glib_dep.type_name() == 'pkgconfig'
       '@INPUT@',
     ]
   )]
+  endif
 
   test_gir_files += [custom_target('gir-gimarshallingtests',
     input: test_marshalling_sources + test_marshalling_headers,
--- origsrc/gobject-introspection-1.82.0/tests/offsets/meson.build      
2024-09-13 22:08:54.000000000 +0900
+++ src/gobject-introspection-1.82.0/tests/offsets/meson.build  2025-02-24 
21:35:37.089302300 +0900
@@ -12,7 +12,7 @@ test_offsets_lib = shared_library('offse
 )
 
 if glib_dep.type_name() == 'pkgconfig'
-
+  if host_machine.system() != 'cygwin'
   test_offsets_gir = custom_target('gir-offsets',
     input: test_offsets_sources + test_offsets_headers,
     output: 'Offsets-1.0.gir',
@@ -50,6 +50,7 @@ if glib_dep.type_name() == 'pkgconfig'
               '--includedir', meson.current_build_dir()
     ],
   )
+  endif
 
   gitestoffsets_exe = executable('gitestoffsets',
     'gitestoffsets.c', 
@@ -64,12 +65,13 @@ if glib_dep.type_name() == 'pkgconfig'
     test_offsets_env.prepend('PATH', join_paths(build_root, 'girepository'))
   endif
 
+  if host_machine.system() != 'cygwin'
   test('test_offsets.py',
     python, 
     args: files('test_offsets.py'),
     env: test_offsets_env,
     depends: [gitestoffsets_exe, test_offsets_typelib],
   )
-
+  endif
 endif
 
--- origsrc/gobject-introspection-1.82.0/tests/scanner/meson.build      
2024-09-13 22:08:54.000000000 +0900
+++ src/gobject-introspection-1.82.0/tests/scanner/meson.build  2025-02-24 
21:56:05.207263700 +0900
@@ -315,6 +315,7 @@ if (glib_dep.type_name() == 'pkgconfig'
     command: gircompiler_command,
   )
 
+  if host_machine.system() != 'cygwin'
   gtkfrob_gir = custom_target('gir-gtkfrob',
     input: ['gtkfrob.c', 'gtkfrob.h'],
     output: 'GtkFrob-1.0.gir',
@@ -353,6 +354,7 @@ if (glib_dep.type_name() == 'pkgconfig'
     depends: [gobject_gir],
     command: gircompiler_command,
   )
+  endif
 
   gettype_gir = custom_target('gir-gettype',
     input: ['gettype.c', 'gettype.h'],
@@ -532,7 +534,7 @@ if (glib_dep.type_name() == 'pkgconfig'
   )
   test_typelibs += regress_typelib
 
-  if host_system != 'windows'
+  if host_system != 'windows' and host_machine.system() != 'cygwin'
     regress_unix_gir = custom_target('gir-regress-unix',
       input: [
         '../../gobject-introspection-tests/regress-unix.c',

Reply via email to