New Upstream Release - gir-to-d
Ready changes
Summary
Merged new upstream version: 0.23.1 (was: 0.23.0).
Resulting package
Built on 2023-06-22T04:28 (took 8m11s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases gir-to-d-dbgsymapt install -t fresh-releases gir-to-d
Lintian Result
Diff
diff --git a/GNUmakefile b/GNUmakefile
index cb611fa..cfaecf3 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -2,7 +2,7 @@ SHELL=/bin/sh
OS=$(shell uname || uname -s)
ARCH=$(shell arch || uname -m)
-GIR_TO_D_VERSION=v0.19.1
+GIR_TO_D_VERSION=v0.23.1
ifndef DC
ifneq ($(strip $(shell which dmd 2>/dev/null)),)
diff --git a/debian/changelog b/debian/changelog
index bc40f26..ce7282b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+gir-to-d (0.23.1-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Drop patch 01_improve-gir-lookup.patch, present upstream.
+ * Drop patch 02_fix-granite-segfault.patch, present upstream.
+ * Drop patch 03_fix-glib-segfault.patch, present upstream.
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Thu, 22 Jun 2023 04:21:07 -0000
+
gir-to-d (0.22.0-3) unstable; urgency=medium
* Pass -fall-instantiations when building with GDC
diff --git a/debian/patches/01_improve-gir-lookup.patch b/debian/patches/01_improve-gir-lookup.patch
deleted file mode 100644
index 1f0fe41..0000000
--- a/debian/patches/01_improve-gir-lookup.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From fa68183af917b6cd721600a075648a4cddaa8937 Mon Sep 17 00:00:00 2001
-From: JustABanana <JustABanana@users.noreply.github.com>
-Date: Wed, 31 Mar 2021 01:45:30 +0200
-Subject: [PATCH] Improve gir file lookup (#37)
-
-* Improve gir file lookup
-This makes the getGirDirectory function return multiple possible
-candidate directories and makes it behave according to the XDG_DATA_DIRS
-spec on linux.
----
- source/gtd/GirWrapper.d | 70 ++++++++++++++++++++---------------------
- 1 file changed, 34 insertions(+), 36 deletions(-)
-
-diff --git a/source/gtd/GirWrapper.d b/source/gtd/GirWrapper.d
-index 86e5512..8e4f61c 100644
---- a/source/gtd/GirWrapper.d
-+++ b/source/gtd/GirWrapper.d
-@@ -24,6 +24,7 @@ import std.uni;
- import std.path;
- import std.stdio;
- import std.string;
-+import std.process : environment;
-
- import gtd.DefReader;
- import gtd.GirField;
-@@ -558,15 +559,17 @@ class GirWrapper
-
- string getAbsoluteGirPath(string girFile)
- {
-- if ( commandlineGirPath )
-+ string[] girDirectories = getGirDirectories();
-+ foreach(dir; girDirectories)
- {
-- string cmdGirFile = buildNormalizedPath(commandlineGirPath, girFile);
--
-- if ( exists(cmdGirFile) )
-- return cmdGirFile;
-+ string girFilePath = buildNormalizedPath(dir, girFile);
-+ if (exists(girFilePath) && isFile(girFilePath))
-+ return girFilePath;
- }
-
-- return buildNormalizedPath(getGirDirectory(), girFile);
-+ error("Couldn't find the gir file: ", girFile, " in any of: ", girDirectories.join(", "));
-+ // Error shouldn't return anyways
-+ assert(0);
- }
-
- private void printFilePath(string fileName)
-@@ -585,56 +588,51 @@ class GirWrapper
- }
- }
-
-- private string getGirDirectory()
-+ private string[] getGirDirectories()
- {
-- version(Windows)
-+ static string[] dirs;
-+ if(dirs !is null)
- {
-- import std.process : environment;
--
-- static string path;
-+ return dirs;
-+ }
-
-- if (path !is null)
-- return path;
-+ if ( commandlineGirPath )
-+ {
-+ dirs ~= commandlineGirPath;
-+ }
-
-+ version(Windows)
-+ {
- foreach (p; splitter(environment.get("PATH"), ';'))
- {
-- string dllPath = buildNormalizedPath(p, "libgtk-3-0.dll");
--
-- if ( exists(dllPath) )
-- path = p.buildNormalizedPath("../share/gir-1.0");
-+ dirs ~= p.buildNormalizedPath("../share/gir-1.0");
- }
-
-- return path;
- }
- else version(OSX)
- {
-- import std.process : environment;
--
-- static string path;
--
-- if (path !is null)
-- return path;
--
-- path = environment.get("GTK_BASEPATH");
-+ string path = environment.get("GTK_BASEPATH");
- if(path)
- {
-- path = path.buildNormalizedPath("../share/gir-1.0");
-+ dirs ~= path.buildNormalizedPath("../share/gir-1.0");
- }
-- else
-+
-+ path = environment.get("HOMEBREW_ROOT");
-+ if(path)
- {
-- path = environment.get("HOMEBREW_ROOT");
-- if(path)
-- {
-- path = path.buildNormalizedPath("share/gir-1.0");
-- }
-+ dirs ~= path.buildNormalizedPath("share/gir-1.0");
- }
--
-- return path;
- }
- else
- {
-- return "/usr/share/gir-1.0";
-+ string xdgDataDirs = environment.get("XDG_DATA_DIRS", "/usr/local/share:/usr/share");
-+ foreach (p; splitter(xdgDataDirs, ':'))
-+ {
-+ dirs ~= p.buildNormalizedPath("gir-1.0");
-+ }
- }
-+
-+ return dirs.filter!(p=> exists(p) && isDir(p) ).array;
- }
-
- private GirParam findParam(GirStruct strct, string func, string name)
diff --git a/debian/patches/02_fix-granite-segfault.patch b/debian/patches/02_fix-granite-segfault.patch
deleted file mode 100644
index fe9de10..0000000
--- a/debian/patches/02_fix-granite-segfault.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 739a67d58e98a51d8c064a175f74e875f367efdb Mon Sep 17 00:00:00 2001
-From: Mike Wey <mike@mikewey.eu>
-Date: Thu, 9 Sep 2021 23:20:43 +0200
-Subject: [PATCH] Fix segfault when wrapping Granite.
-
-See also: https://github.com/gtkd-developers/GtkD/issues/344
----
- source/gtd/GirType.d | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/source/gtd/GirType.d b/source/gtd/GirType.d
-index 5b0edb2..90fef4d 100644
---- a/source/gtd/GirType.d
-+++ b/source/gtd/GirType.d
-@@ -18,7 +18,7 @@
- module gtd.GirType;
-
- import std.algorithm: among, canFind, startsWith;
--import std.array: replace;
-+import std.array: replace, split;
- import std.conv: to;
- import std.range: empty;
-
-@@ -103,6 +103,13 @@ final class GirType
- if ( cType is null && (name == "filename" || name == "utf8") )
- cType = "gchar*";
-
-+ //Vala libraries can have the package name in there name twice, befoer and after the dot.
-+ string[] arr = split(name, '.');
-+ if ( arr.length > 1 && arr[1].startsWith(arr[0]) )
-+ {
-+ name = arr[1][arr[0].length .. $];
-+ }
-+
- if ( reader.front.type == XMLNodeType.EmptyTag )
- return;
-
diff --git a/debian/patches/03_fix-glib-segfault.patch b/debian/patches/03_fix-glib-segfault.patch
deleted file mode 100644
index b3e0680..0000000
--- a/debian/patches/03_fix-glib-segfault.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From f4dfc8cfb130280291db458629ab11b6904e5191 Mon Sep 17 00:00:00 2001
-From: Mike Wey <mike@mikewey.eu>
-Date: Wed, 23 Mar 2022 23:26:51 +0100
-Subject: [PATCH] Fix segfault with the latest Glib.
-
----
- source/gtd/GirFunction.d | 27 ++++++++-------------------
- 1 file changed, 8 insertions(+), 19 deletions(-)
-
-diff --git a/source/gtd/GirFunction.d b/source/gtd/GirFunction.d
-index 49a663d..6a8c15b 100644
---- a/source/gtd/GirFunction.d
-+++ b/source/gtd/GirFunction.d
-@@ -398,7 +398,7 @@ final class GirFunction
- if ( returnType.length > -1 && param == params[returnType.length] && params[returnType.length].direction != GirParamDirection.Default )
- continue;
-
-- if ( paramCount == 0 && strct.type == GirStructType.Record && isInstanceParam(param) )
-+ if ( paramCount == 0 && strct.type == GirStructType.Record && isInstanceParam(param) && type != GirFunctionType.Constructor )
- continue;
-
- if ( paramCount++ > 0 )
-@@ -444,26 +444,15 @@ final class GirFunction
-
- if ( instanceParam || ( !params.empty && isInstanceParam(params[0])) )
- {
-- GirStruct dType;
--
-- if ( instanceParam )
-- {
-- dType = strct.pack.getStruct(instanceParam.type.name);
--
-- if ( dType.cType != instanceParam.type.cType.removePtr() && !instanceParam.type.cType.among("gpointer", "gconstpointer") )
-- gtkCall ~= "cast("~ stringToGtkD(instanceParam.type.cType, wrapper.aliasses, localAliases()) ~")";
-- }
-- else
-- {
-- dType = strct.pack.getStruct(params[0].type.name);
-+ GirParam instance = instanceParam ? instanceParam : params[0];
-+ GirStruct dType = strct.pack.getStruct(instance.type.name);
-
-- if ( dType.cType != params[0].type.cType.removePtr() && !params[0].type.cType.among("gpointer", "gconstpointer") )
-- gtkCall ~= "cast("~ stringToGtkD(params[0].type.cType, wrapper.aliasses, localAliases()) ~")";
-- }
-+ if ( dType.cType != instance.type.cType.removePtr() && !instance.type.cType.among("gpointer", "gconstpointer") )
-+ gtkCall ~= "cast("~ stringToGtkD(instance.type.cType, wrapper.aliasses, localAliases()) ~")";
-
-- if ( instanceParam && instanceParam.type.name in strct.structWrap )
-+ if ( instance && instance.type.name in strct.structWrap )
- {
-- GirStruct insType = strct.pack.getStruct(strct.structWrap[instanceParam.type.name]);
-+ GirStruct insType = strct.pack.getStruct(strct.structWrap[instance.type.name]);
-
- if ( insType )
- dType = insType;
-@@ -471,7 +460,7 @@ final class GirFunction
-
- if ( type == GirFunctionType.Constructor || strct.isNamespace() || strct.noNamespace )
- {
-- string id = tokenToGtkD(instanceParam.name, wrapper.aliasses, localAliases());
-+ string id = tokenToGtkD(instance.name, wrapper.aliasses, localAliases());
-
- if ( dType && !(dType.isNamespace() || dType.noNamespace) )
- gtkCall ~= "("~ id ~" is null) ? null : "~ id ~"."~ dType.getHandleFunc() ~"()";
diff --git a/debian/patches/series b/debian/patches/series
index 320b3b0..e69de29 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +0,0 @@
-01_improve-gir-lookup.patch
-02_fix-granite-segfault.patch
-03_fix-glib-segfault.patch
diff --git a/meson.build b/meson.build
index dc28f25..62409dd 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('GIR-to-D', 'd', version: '0.19.1')
+project('GIR-to-D', 'd', version: '0.23.1')
source = [
'source/girtod.d',
diff --git a/source/gtd/GirFunction.d b/source/gtd/GirFunction.d
index 49a663d..0169d8b 100644
--- a/source/gtd/GirFunction.d
+++ b/source/gtd/GirFunction.d
@@ -398,7 +398,7 @@ final class GirFunction
if ( returnType.length > -1 && param == params[returnType.length] && params[returnType.length].direction != GirParamDirection.Default )
continue;
- if ( paramCount == 0 && strct.type == GirStructType.Record && isInstanceParam(param) )
+ if ( paramCount == 0 && strct.type == GirStructType.Record && isInstanceParam(param) && type != GirFunctionType.Constructor )
continue;
if ( paramCount++ > 0 )
@@ -444,26 +444,15 @@ final class GirFunction
if ( instanceParam || ( !params.empty && isInstanceParam(params[0])) )
{
- GirStruct dType;
+ GirParam instance = instanceParam ? instanceParam : params[0];
+ GirStruct dType = strct.pack.getStruct(instance.type.name);
- if ( instanceParam )
- {
- dType = strct.pack.getStruct(instanceParam.type.name);
+ if ( dType.cType != instance.type.cType.removePtr() && !instance.type.cType.among("gpointer", "gconstpointer") )
+ gtkCall ~= "cast("~ stringToGtkD(instance.type.cType, wrapper.aliasses, localAliases()) ~")";
- if ( dType.cType != instanceParam.type.cType.removePtr() && !instanceParam.type.cType.among("gpointer", "gconstpointer") )
- gtkCall ~= "cast("~ stringToGtkD(instanceParam.type.cType, wrapper.aliasses, localAliases()) ~")";
- }
- else
+ if ( instance && instance.type.name in strct.structWrap )
{
- dType = strct.pack.getStruct(params[0].type.name);
-
- if ( dType.cType != params[0].type.cType.removePtr() && !params[0].type.cType.among("gpointer", "gconstpointer") )
- gtkCall ~= "cast("~ stringToGtkD(params[0].type.cType, wrapper.aliasses, localAliases()) ~")";
- }
-
- if ( instanceParam && instanceParam.type.name in strct.structWrap )
- {
- GirStruct insType = strct.pack.getStruct(strct.structWrap[instanceParam.type.name]);
+ GirStruct insType = strct.pack.getStruct(strct.structWrap[instance.type.name]);
if ( insType )
dType = insType;
@@ -471,7 +460,7 @@ final class GirFunction
if ( type == GirFunctionType.Constructor || strct.isNamespace() || strct.noNamespace )
{
- string id = tokenToGtkD(instanceParam.name, wrapper.aliasses, localAliases());
+ string id = tokenToGtkD(instance.name, wrapper.aliasses, localAliases());
if ( dType && !(dType.isNamespace() || dType.noNamespace) )
gtkCall ~= "("~ id ~" is null) ? null : "~ id ~"."~ dType.getHandleFunc() ~"()";
@@ -1288,6 +1277,9 @@ final class GirFunction
if ( type.cType == "guchar*" )
return "char[]";
+ if ( type.cType == "gunichar2*" )
+ return "wchar[]";
+
if ( type.size > -1 )
size = to!string(type.size);
diff --git a/source/gtd/GirType.d b/source/gtd/GirType.d
index 5b0edb2..90fef4d 100644
--- a/source/gtd/GirType.d
+++ b/source/gtd/GirType.d
@@ -18,7 +18,7 @@
module gtd.GirType;
import std.algorithm: among, canFind, startsWith;
-import std.array: replace;
+import std.array: replace, split;
import std.conv: to;
import std.range: empty;
@@ -103,6 +103,13 @@ final class GirType
if ( cType is null && (name == "filename" || name == "utf8") )
cType = "gchar*";
+ //Vala libraries can have the package name in there name twice, befoer and after the dot.
+ string[] arr = split(name, '.');
+ if ( arr.length > 1 && arr[1].startsWith(arr[0]) )
+ {
+ name = arr[1][arr[0].length .. $];
+ }
+
if ( reader.front.type == XMLNodeType.EmptyTag )
return;
diff --git a/source/gtd/GirWrapper.d b/source/gtd/GirWrapper.d
index 86e5512..8e4f61c 100644
--- a/source/gtd/GirWrapper.d
+++ b/source/gtd/GirWrapper.d
@@ -24,6 +24,7 @@ import std.uni;
import std.path;
import std.stdio;
import std.string;
+import std.process : environment;
import gtd.DefReader;
import gtd.GirField;
@@ -558,15 +559,17 @@ class GirWrapper
string getAbsoluteGirPath(string girFile)
{
- if ( commandlineGirPath )
+ string[] girDirectories = getGirDirectories();
+ foreach(dir; girDirectories)
{
- string cmdGirFile = buildNormalizedPath(commandlineGirPath, girFile);
-
- if ( exists(cmdGirFile) )
- return cmdGirFile;
+ string girFilePath = buildNormalizedPath(dir, girFile);
+ if (exists(girFilePath) && isFile(girFilePath))
+ return girFilePath;
}
- return buildNormalizedPath(getGirDirectory(), girFile);
+ error("Couldn't find the gir file: ", girFile, " in any of: ", girDirectories.join(", "));
+ // Error shouldn't return anyways
+ assert(0);
}
private void printFilePath(string fileName)
@@ -585,56 +588,51 @@ class GirWrapper
}
}
- private string getGirDirectory()
+ private string[] getGirDirectories()
{
- version(Windows)
+ static string[] dirs;
+ if(dirs !is null)
{
- import std.process : environment;
-
- static string path;
+ return dirs;
+ }
- if (path !is null)
- return path;
+ if ( commandlineGirPath )
+ {
+ dirs ~= commandlineGirPath;
+ }
+ version(Windows)
+ {
foreach (p; splitter(environment.get("PATH"), ';'))
{
- string dllPath = buildNormalizedPath(p, "libgtk-3-0.dll");
-
- if ( exists(dllPath) )
- path = p.buildNormalizedPath("../share/gir-1.0");
+ dirs ~= p.buildNormalizedPath("../share/gir-1.0");
}
- return path;
}
else version(OSX)
{
- import std.process : environment;
-
- static string path;
-
- if (path !is null)
- return path;
-
- path = environment.get("GTK_BASEPATH");
+ string path = environment.get("GTK_BASEPATH");
if(path)
{
- path = path.buildNormalizedPath("../share/gir-1.0");
+ dirs ~= path.buildNormalizedPath("../share/gir-1.0");
}
- else
+
+ path = environment.get("HOMEBREW_ROOT");
+ if(path)
{
- path = environment.get("HOMEBREW_ROOT");
- if(path)
- {
- path = path.buildNormalizedPath("share/gir-1.0");
- }
+ dirs ~= path.buildNormalizedPath("share/gir-1.0");
}
-
- return path;
}
else
{
- return "/usr/share/gir-1.0";
+ string xdgDataDirs = environment.get("XDG_DATA_DIRS", "/usr/local/share:/usr/share");
+ foreach (p; splitter(xdgDataDirs, ':'))
+ {
+ dirs ~= p.buildNormalizedPath("gir-1.0");
+ }
}
+
+ return dirs.filter!(p=> exists(p) && isDir(p) ).array;
}
private GirParam findParam(GirStruct strct, string func, string name)
diff --git a/source/gtd/IndentedStringBuilder.d b/source/gtd/IndentedStringBuilder.d
index 886490f..6ae1f9f 100644
--- a/source/gtd/IndentedStringBuilder.d
+++ b/source/gtd/IndentedStringBuilder.d
@@ -17,7 +17,7 @@
module gtd.IndentedStringBuilder;
-import std.algorithm: canFind, startsWith, endsWith;
+import std.algorithm: canFind, count, startsWith, endsWith;
import std.range: empty;
import std.string: strip;
@@ -26,7 +26,7 @@ public class IndentedStringBuilder
{
string tabs;
bool statement;
- bool paramList;
+ int paramList = 0;
this()
{
@@ -59,7 +59,7 @@ public class IndentedStringBuilder
return tabs ~" "~ line ~ "\n";
}
- if ( endsWith(line, "}", "};") || startsWith(line, "}", "};") || line == "));" || line == "connectFlags);" || (paramList && endsWith(line, ");", ")")) )
+ if ( endsWith(line, "}", "};") || startsWith(line, "}", "};") || line == "));" || line == "connectFlags);" || (paramList > 0 && endsWith(line, ");", ")") && count(line, '(') != count(line, ')')) )
{
if ( !canFind(line, '{') && tabs.length > 0 )
tabs.length = tabs.length -1;
@@ -70,7 +70,8 @@ public class IndentedStringBuilder
if ( endsWith(line, ");") && !endsWith(line, "));") && line != ");" )
statement = true;
- paramList = false;
+ if ( paramList > 0 )
+ paramList--;
}
if ( line.empty )
@@ -102,7 +103,7 @@ public class IndentedStringBuilder
else if ( endsWith(line, "(") )
{
tabs ~= '\t';
- paramList = true;
+ paramList++;
}
return text;
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/lib/debug/.build-id/b2/4facbb13a35048ce33da6d523c632182f83a8a.debug
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/lib/debug/.build-id/8a/7756f9eed972aa03a2ff1acedf691fecee1c88.debug
No differences were encountered between the control files of package gir-to-d
Control files of package gir-to-d-dbgsym: lines which differ (wdiff format)
Build-Ids: 8a7756f9eed972aa03a2ff1acedf691fecee1c88 b24facbb13a35048ce33da6d523c632182f83a8a