[pkg-d-commits] [gir-to-d] 01/03: New upstream version 0.10.0
Matthias Klumpp
mak at moszumanska.debian.org
Thu Jun 8 18:10:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to branch master
in repository gir-to-d.
commit 08f161d3ee11c924417378a8b4e54950133681aa
Author: Matthias Klumpp <mak at debian.org>
Date: Thu Jun 8 20:07:18 2017 +0200
New upstream version 0.10.0
---
source/girtod.d | 9 ++++++---
source/gtd/GirPackage.d | 52 ++++++++++++++++++++++++++++++++++++++++---------
source/gtd/GirStruct.d | 11 +++++++++++
source/gtd/GirWrapper.d | 1 +
4 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/source/girtod.d b/source/girtod.d
index 0a2d817..865b26c 100644
--- a/source/girtod.d
+++ b/source/girtod.d
@@ -32,6 +32,7 @@ void main(string[] args)
bool printFree;
bool useRuntimeLinker;
+ bool useBindDir;
string inputDir;
string outputDir;
string girDir;
@@ -40,11 +41,12 @@ void main(string[] args)
{
auto helpInformation = getopt(
args,
- "input|i", "Directory containing the API description (Default: ./)", &inputDir,
+ "input|i", "Directory containing the API description. (Default: ./)", &inputDir,
"output|o", "Output directory for the generated binding. (Default: {input dir}/out)", &outputDir,
- "use-runtime-linker", "Link the gtk functions with the runtime linker", &useRuntimeLinker,
+ "use-runtime-linker", "Link the gtk functions with the runtime linker.", &useRuntimeLinker,
"gir-directory|g", "Directory to search for gir files before the system directory.", &girDir,
- "print-free", "Print functions that don't have a parrent module", &printFree
+ "print-free", "Print functions that don't have a parrent module.", &printFree,
+ "use-bind-dir", "Include public imports for the old gtkc package.", &useBindDir
);
if (helpInformation.helpWanted)
@@ -68,6 +70,7 @@ void main(string[] args)
GirWrapper wrapper = new GirWrapper(inputDir, outputDir, useRuntimeLinker);
wrapper.commandlineGirPath = girDir;
+ wrapper.useBindDir = useBindDir;
wrapper.proccess("APILookup.txt");
diff --git a/source/gtd/GirPackage.d b/source/gtd/GirPackage.d
index cee6858..f0086a7 100644
--- a/source/gtd/GirPackage.d
+++ b/source/gtd/GirPackage.d
@@ -502,9 +502,9 @@ class GirPackage
return lib;
}
- private auto dllRegex = ctRegex!(`([a-z0-9_]+)-([0-9\.]+)-([0-9]+)\.dll`);
- private auto dylibRegex = ctRegex!(`([a-z0-9_]+)-([0-9\.]+)\.([0-9]+)\.dylib`);
- private auto soRegex = ctRegex!(`([a-z0-9_]+)-([0-9\.]+)\.so\.([0-9]+)`);
+ private auto dllRegex = ctRegex!(`([a-z0-9_]+)(-[0-9\.]+)?(-[0-9]+)?\.dll`);
+ private auto dylibRegex = ctRegex!(`([a-z0-9_]+)(-[0-9\.]+?)?(\.[0-9]+)?\.dylib`);
+ private auto soRegex = ctRegex!(`([a-z0-9_]+)(-[0-9\.]+)?\.so(\.[0-9]+)?`);
private string getDllNames()
{
@@ -520,7 +520,12 @@ class GirPackage
{
auto match = matchFirst(lib, dylibRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~"-"~ match[3] ~".dll\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty )
+ libs ~= "-"~ match[2][1..$];
+ if ( !match[3].empty )
+ libs ~= "-"~ match[3][1..$];
+ libs ~= ".dll\"";
if ( lib != libraries.back )
libs ~= ", ";
@@ -536,7 +541,12 @@ class GirPackage
{
auto match = matchFirst(lib, soRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~"-"~ match[3] ~".dll\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty )
+ libs ~= "-"~ match[2][1..$];
+ if ( !match[3].empty )
+ libs ~= "-"~ match[3][1..$];
+ libs ~= ".dll\"";
if ( lib != libraries.back )
libs ~= ", ";
@@ -556,7 +566,12 @@ class GirPackage
{
auto match = matchFirst(lib, dllRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~"."~ match[3] ~".dylib\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty )
+ libs ~= "-"~ match[2][1..$];
+ if ( !match[3].empty )
+ libs ~= "."~ match[3][1..$];
+ libs ~= ".dylib\"";
if ( lib != libraries.back )
libs ~= ", ";
@@ -576,7 +591,12 @@ class GirPackage
{
auto match = matchFirst(lib, soRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~"."~ match[3] ~".dylib\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty )
+ libs ~= "-"~ match[2][1..$];
+ if ( !match[3].empty )
+ libs ~= "."~ match[3][1..$];
+ libs ~= ".dylib\"";
if ( lib != libraries.back )
libs ~= ", ";
@@ -596,7 +616,15 @@ class GirPackage
{
auto match = matchFirst(lib, dllRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~".so."~ match[3] ~"\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty && !match[3].empty )
+ libs ~= "-"~ match[2][1..$];
+ libs ~= ".so";
+ if ( !match[2].empty && match[3].empty )
+ libs ~= "."~ match[2][1..$];
+ if ( !match[3].empty )
+ libs ~= "."~ match[3][1..$];
+ libs ~= "\"";
if ( lib != libraries.back )
libs ~= ", ";
@@ -612,7 +640,13 @@ class GirPackage
{
auto match = matchFirst(lib, dylibRegex);
- libs ~= "\""~ match[1] ~"-"~ match[2] ~".so."~ match[3] ~"\"";
+ libs ~= "\""~ match[1];
+ if ( !match[2].empty )
+ libs ~= "-"~ match[2][1..$];
+ libs ~= ".so";
+ if ( !match[3].empty )
+ libs ~= "."~ match[3][1..$];
+ libs ~= "\"";
if ( lib != libraries.back )
libs ~= ", ";
diff --git a/source/gtd/GirStruct.d b/source/gtd/GirStruct.d
index b208eaf..fb2f795 100644
--- a/source/gtd/GirStruct.d
+++ b/source/gtd/GirStruct.d
@@ -727,6 +727,17 @@ final class GirStruct
imports ~= pack.name ~".c.functions";
imports ~= pack.name ~".c.types";
+ //Temporarily import the old bindDir.*types modules for backwards compatibility.
+ string[string] bindDirs = ["atk": "gtkc", "cairo": "gtkc", "gdk": "gtkc", "gdkpixbuf": "gtkc", "gio": "gtkc",
+ "glib": "gtkc", "gobject": "gtkc", "gtk": "gtkc", "pango": "gtkc", "gsv": "gsvc", "vte": "vtec",
+ "gstinterfaces": "gstreamerc", "gstreamer": "gstreamerc"];
+
+ if ( pack.wrapper.useBindDir )
+ {
+ if ( auto dir = pack.name in bindDirs )
+ imports ~= *dir ~"."~ pack.name ~"types";
+ }
+
if ( wrapper.useRuntimeLinker && shouldFree() )
{
imports ~= "gtkd.Loader";
diff --git a/source/gtd/GirWrapper.d b/source/gtd/GirWrapper.d
index b689c60..8e2c2e2 100644
--- a/source/gtd/GirWrapper.d
+++ b/source/gtd/GirWrapper.d
@@ -41,6 +41,7 @@ class GirWrapper
{
bool includeComments;
bool useRuntimeLinker;
+ bool useBindDir;
string apiRoot;
string outputRoot;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/gir-to-d.git
More information about the pkg-d-commits
mailing list