fixes for latest compiler and latest nimble

This commit is contained in:
Stefan Salewski 2018-02-26 11:42:49 +01:00
commit 0e39573031
12 changed files with 77 additions and 4353 deletions

View file

@ -1,6 +1,6 @@
= High level GTK3 bindings for the Nim programming language = High level GTK3 bindings for the Nim programming language
(c) Stefan Salewski (c) Stefan Salewski
//Version 0.2 2017 //Version 0.3 2018
:experimental: :experimental:
:imagesdir: http://ssalewski.de/tmp :imagesdir: http://ssalewski.de/tmp
:source-highlighter: pygments :source-highlighter: pygments
@ -11,7 +11,7 @@
:MAC: MacOSX :MAC: MacOSX
//(c) Stefan Salewski + //(c) Stefan Salewski +
//2017 //2018
TIP: A more fancy copy of this document with dark source code background is available at http://ssalewski.de/gintroreadme.html[GIntro README] TIP: A more fancy copy of this document with dark source code background is available at http://ssalewski.de/gintroreadme.html[GIntro README]
@ -19,7 +19,7 @@ NOTE: This work is partly based on earlier works of J. Mansour and has been supp
The `combinatorics` module was kindly provided by R. Behrends. The `combinatorics` module was kindly provided by R. Behrends.
//icon:thumbs-up[] //icon:thumbs-up[]
This repository contains bindings from the Nim programming language to the GTK3 _GUI_ (_Graphical User Interface_) library and related libraries. (With minimal fixes This repository contains bindings from the Nim programming language to the GTK3 _GUI_ (_Graphical User Interface_) library and related libraries. (With some fixes
it should also work for upcoming _GTK4_.) it should also work for upcoming _GTK4_.)
https://nim-lang.org/[Nim] is a modern universal programming language. https://nim-lang.org/[Nim] is a modern universal programming language.
@ -45,7 +45,7 @@ _Application Programming Interface_ (_API_).
Currently there are at least 3 sources of GTK3 bindings for Nim: Currently there are at least 3 sources of GTK3 bindings for Nim:
* https://github.com/ngtk3 * https://github.com/ngtk3 (obsolete, will be deleted)
* https://github.com/StefanSalewski/oldgtk3 * https://github.com/StefanSalewski/oldgtk3
* https://github.com/StefanSalewski/gintro * https://github.com/StefanSalewski/gintro
@ -69,7 +69,7 @@ have these advantages:
These high level bindings are based on _{GIR}_, an _XML_ based database like interface description. Compared to the _C_ header These high level bindings are based on _{GIR}_, an _XML_ based database like interface description. Compared to the _C_ header
files this description gives us more and deeper information about data types and function calls, for example ownership transfer of objects and files this description gives us more and deeper information about data types and function calls, for example ownership transfer of objects and
in or out direction of procedure variables, which makes writing the glue code much easier. in or out direction of procedure variables, which makes writing the glue code much easier.
And it should work with no or minimal And it should work with minimal
modifications also for the upcoming GTK4. modifications also for the upcoming GTK4.
Unfortunately there are also some drawbacks: Unfortunately there are also some drawbacks:
@ -101,18 +101,7 @@ But maybe more is missing, we have to investigate that. Until now these bindings
These basic libraries are already partly tested: These basic libraries are already partly tested:
* GLib Gtk, Gdk, GLib, GObject, Gio, GdkPixbuf, GtkSource, Pango, PangoCairo, PangoFT2, GModule, Rsvg, fontconfig, freetype2, xlib, Atk and *cairo*
* GObject
* GModule
* xlib
* Gio
* Atk
* Pango
* cairo
* GdkPixbuf
* Rsvg
* Gdk
* Gtk
In best case it should be possible to add more GObject based libraries to this list without larger modifications of the generator source code. In best case it should be possible to add more GObject based libraries to this list without larger modifications of the generator source code.
Unfortunately the bindings for the _cairo_ drawing library provided by {GIR} was only a minimal stub -- we have extend it manually. Unfortunately the bindings for the _cairo_ drawing library provided by {GIR} was only a minimal stub -- we have extend it manually.
@ -122,27 +111,34 @@ Unfortunately the bindings for the _cairo_ drawing library provided by {GIR} was
Of course you will need a working Nim installation with a recent compiler version and you have to ensure that GTK and related libraries are installed on your system. For some Linux Of course you will need a working Nim installation with a recent compiler version and you have to ensure that GTK and related libraries are installed on your system. For some Linux
distributions which provide mainly pre-compiled software you may have to also install some GTK related developer files. distributions which provide mainly pre-compiled software you may have to also install some GTK related developer files.
This package supports the _Nimble Package Manager_, so ideally a plain `nimble install gintro` should do. But as this package does not With a recent nimble version (>= v0.8.10) you only have to type in a shell window:
only provide some plain text files, but uses {GIR} database query on your local computer to generate
binding files exactly matching your system, that does not work currently. We have to download the files, compile and execute
the `gen.nim` generator program and finally to install the generated bindings modules on your computer as a _nimble package_.
These instructions should be enough for that:
---- ----
cd /tmp nimble install gintro
git clone https://github.com/stefansalewski/gintro
cd gintro
nimble prepare
nimble install
---- ----
//This package supports the _Nimble Package Manager_, so ideally a plain `nimble install gintro` should do. But as this package does not
//only provide some plain text files, but uses {GIR} database query on your local computer to generate
//binding files exactly matching your system, that does not work currently. We have to download the files, compile and execute
//the `gen.nim` generator program and finally to install the generated bindings modules on your computer as a _nimble package_.
//These instructions should be enough for that:
//----
//cd /tmp
//git clone https://github.com/stefansalewski/gintro
//cd gintro
//nimble prepare
//nimble install
//----
NOTE: Latest version of gintro package uses some files from oldgtk3 package for bootstrapping. We assume that NOTE: Latest version of gintro package uses some files from oldgtk3 package for bootstrapping. We assume that
users of gintro generally are not interested in low level oldgtk3 package, so we try to download only 3 single files users of gintro generally are not interested in low level oldgtk3 package, so we try to download only 3 single files
from oldgtk3 package. That should work if wget or nimgrab executables are available. If it fails you should from oldgtk3 package. That should work if wget or nimgrab executables are available. If it fails you should
get a longer error message which may help you to solve the issue. If that should not work for you, you may get a longer error message which may help you to solve the issue.
copy the old file gintro.nimble.bak to gintro.nimble before calling `nimble prepare`. That would use files from // If that should not work for you, you may
deprecated ngtk3 repository for bootstrapping. //copy the old file gintro.nimble.bak to gintro.nimble before calling `nimble prepare`. That would use files from
//deprecated ngtk3 repository for bootstrapping.
NOTE: Nimble prepare should run for about 20 seconds, it compiles and executes the generator program `gen.nim`. NOTE: Nimble prepare should run for about 20 seconds, it compiles and executes the generator program `gen.nim`.
Unfortunately we can not guarantee that the generator command will be able to really build all the Unfortunately we can not guarantee that the generator command will be able to really build all the
@ -153,7 +149,12 @@ The {GIR} based built process generates bindings customized to the OS where the
so for older GTK releases or a 32 bit system different files are created. Later we may also provide pre-generated so for older GTK releases or a 32 bit system different files are created. Later we may also provide pre-generated
files for various OS and GTK versions, but building locally is preferred when possible. files for various OS and GTK versions, but building locally is preferred when possible.
Now you can built `app0.nim` and launch it: == A few basic examples
NOTE: Currently we do not install the example programs. If you want to try them, you have to copy the source code of the
examples from https://github.com/StefanSalewski/gintro/tree/master/examples to your local computer, maybe to /tmp/gintro/examples directory.
Then you can compile and run them from shell with commands like
---- ----
cd /tmp/gintro/examples/ cd /tmp/gintro/examples/
@ -161,7 +162,8 @@ nim c app0.nim
./app0 ./app0
---- ----
== A few basic examples or you may open the source files in your favorite Nim IDE or editor. Taking the source code from this Readme file is not
really recommended, as these source code listings may be not the latest versions.
GTK3 programs can use still the old _GTK2_ design, where you first initialize the GTK library, create your widgets and finally enter the GTK main loop. GTK3 programs can use still the old _GTK2_ design, where you first initialize the GTK library, create your widgets and finally enter the GTK main loop.
This style is still used in many tutorials as in http://zetcode.com/gui/gtk2/[Zetcode tutorial] or in the GTK book of A. Krause. This style is still used in many tutorials as in http://zetcode.com/gui/gtk2/[Zetcode tutorial] or in the GTK book of A. Krause.
@ -188,7 +190,7 @@ We start with a minimal traditional old style example, which should be familiar
.t0.nim .t0.nim
---- ----
# nim c t0.nim # nim c t0.nim
import gintro/gtk import gintro/[gtk, gobject]
proc bye(w: Window) = proc bye(w: Window) =
mainQuit() mainQuit()
@ -222,11 +224,9 @@ differences between the source code displayed here and the sources in examples d
---- ----
# app0.nim -- minimal application style example # app0.nim -- minimal application style example
# nim c app0.nim # nim c app0.nim
import gintro/gtk import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication # we want to use GTK application
#from gintro/gio import ApplicationFlags, scActivate, run
proc activate(app: Application) = proc appActivate(app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)
window.title = "GTK3 & Nim" window.title = "GTK3 & Nim"
window.defaultSize = (200, 200) window.defaultSize = (200, 200)
@ -234,18 +234,25 @@ proc activate(app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard run(app) discard run(app)
main() main()
---- ----
In the `main proc` we create a new application and connect the activate signal to our `activate proc`, which then creates and displays In the `main proc` we create a new application and connect the activate signal to our `activate proc`, which then creates and displays
the still empty window. For this program we need the `gtk` module and also some procs and data types from `gio` module. As both modules the still empty window.
have a data type called `Application` (`gtk.Application` extends indeed the `gio.Application`) we can either qualify the `Application` data type and its `new proc`
with `gtk` prefix, or as we did here, exclude that from `gio` imports. Another solution would be to import from `gio` only what is really needed. NOTE: We are importing modules gtk and gio. Initially both modules had a data type called `Application` (`gtk.Application`
The source code of this minimal example is stored in the examples directory, you may `cd` into it and type `nim c app0.nim` to create extends indeed the `gio.Application`), so we would have to use module name prefixes, or we could import from gio only
the executable. what is really needed (`from gio import ...`) or use the form (`import gio exept ...`). But as gio.Application is generally
not needed often, we have no renamed gio.Application to GApplication. No more name clashes.
// For this program we need the `gtk` module and also some procs and data types from `gio` module. As both modules
//have a data type called `Application` (`gtk.Application` extends indeed the `gio.Application`) we can either qualify the `Application` data type and its `new proc`
//with `gtk` prefix, or as we did here, exclude that from `gio` imports. Another solution would be to import from `gio` only what is really needed.
//The source code of this minimal example is stored in the examples directory, you may `cd` into it and type `nim c app0.nim` to create
//the executable.
//(Well not yet, as we provide no real nimble install. Copy app0.nim to nim_gi directory where the bindings live, or //(Well not yet, as we provide no real nimble install. Copy app0.nim to nim_gi directory where the bindings live, or
//create symlinks for now.) //create symlinks for now.)
@ -360,13 +367,12 @@ this:
.button.nim .button.nim
---- ----
# nim c button.nim # nim c button.nim
import gintro/[gtk, glib] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
proc buttonClicked (button: Button) = proc buttonClicked (button: Button) =
button.label = utf8Strreverse(button.label, -1) button.label = utf8Strreverse(button.label, -1)
proc activate (app: Application) = proc appActivate (app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)
window.title = "GNOME Button" window.title = "GNOME Button"
window.defaultSize = (250, 50) window.defaultSize = (250, 50)
@ -377,7 +383,7 @@ proc activate (app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard app.run discard app.run
main() main()
@ -433,8 +439,7 @@ happens when you click on the buttons.
.connect_args.nim .connect_args.nim
---- ----
# nim c connect_args.nim # nim c connect_args.nim
import gintro/[gtk, glib] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
type type
O = object O = object
@ -455,7 +460,7 @@ proc b4Callback(button: Button; w: ApplicationWindow) =
else: else:
w.title = "Nim with GTK3" w.title = "Nim with GTK3"
proc activate (app: Application) = proc appActivate (app: Application) =
var o: O var o: O
var r: ref O var r: ref O
new r new r
@ -481,7 +486,7 @@ proc activate (app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard app.run discard app.run
main() main()
@ -548,8 +553,7 @@ each button click. The amount of decrease (5) is passed to the callback as a int
.count_button.nim .count_button.nim
---- ----
# nim c count_button.nim # nim c count_button.nim
import gintro/[gtk, glib] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
type type
CountButton = ref object of Button CountButton = ref object of Button
@ -560,7 +564,7 @@ proc buttonClicked (button: CountButton; decrement: int) =
button.label = "Counter: " & $button.counter button.label = "Counter: " & $button.counter
echo "Counter is now: ", button.counter echo "Counter is now: ", button.counter
proc activate (app: Application) = proc appActivate (app: Application) =
var button: CountButton var button: CountButton
let window = newApplicationWindow(app) let window = newApplicationWindow(app)
window.title = "Count Button" window.title = "Count Button"
@ -572,7 +576,7 @@ proc activate (app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard app.run discard app.run
main() main()
@ -621,10 +625,9 @@ Converting that to Nim is again straight forward:
.label.nim .label.nim
---- ----
# nim c label.nim # nim c label.nim
import gintro/[gtk, glib] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
proc activate(app: Application) = proc appActivate(app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)
let label = newLabel("Yellow text on green background") let label = newLabel("Yellow text on green background")
let cssProvider = newCssProvider() let cssProvider = newCssProvider()
@ -639,21 +642,21 @@ proc activate(app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard run(app) discard run(app)
main() main()
---- ----
For this example we create a plain label widget with some text. To colorize it, we generate a For this example we create a plain label widget with some text. To colorize it, we generate a
CssProvider and load it with a textual description of of our desired colors. Then we extract the CssProvider and load it with a textual description of our desired colors. Then we extract the
style context from the label and add our CssProvider to it. style context from the label and add our CssProvider to it.
The last parameter of the _C_ function gtk_css_provider_load_from_data() is of type GError and can The last parameter of the _C_ function gtk_css_provider_load_from_data() is of type GError and can
be used in _C_ code to detect runtime errors. The _C_ code above just passes NULL to ignore this error. be used in _C_ code to detect runtime errors. The _C_ code above just passes NULL to ignore this error.
For Nim we map that GError argument to _exceptions_. To test what happens in Nim when an GError would For Nim we map that GError argument to _exceptions_. To test what happens in Nim when an GError would
report an error condition, you may uncomment function loadFromPath() in the code above. As the specified path report an error condition, you may uncomment function loadFromPath() in the code above. As the specified path
does not exist, we should get an exeption with a message telling us the problem. Of course in your real does not exist, we should get an exception with a message telling us the problem. Of course in your real
code you may catch such exceptions with Nim's `try:` blocks. (You may also modify the data variable above to code you may catch such exceptions with Nim's `try:` blocks. (You may also modify the data variable above to
an illegal CSS statement -- if the statement is seriously wrong, then you should get an exception from an illegal CSS statement -- if the statement is seriously wrong, then you should get an exception from
loadFromData(). loadFromData().
@ -667,14 +670,13 @@ and shows a sine wave which is continuously moving to the left.
NOTE: The gobject-introspection generated cairo module was only a minimal stub, because cairo NOTE: The gobject-introspection generated cairo module was only a minimal stub, because cairo
library does not really support introspection. Now we are using a cairo module which is generated library does not really support introspection. Now we are using a cairo module which is generated
directly from the cairo C header files with the tool c2nim and then modified to support an high level directly from the cairo C header files with the tool c2nim and then modified to support a high level
API. That modification is still work in progress, so not all cairo functionality is available already. API.
[[cairo_anim.nim]] [[cairo_anim.nim]]
[source,nim] [source,nim]
.cairo_anim.nim .cairo_anim.nim
---- ----
# nim c cairo_anim.nim
# https://lists.cairographics.org/archives/cairo/2016-October/027791.html # https://lists.cairographics.org/archives/cairo/2016-October/027791.html
# Nim version of that plain cairo animation example # Nim version of that plain cairo animation example
@ -696,13 +698,13 @@ proc drawingAreaDrawCb(widget: DrawingArea; context: Context): bool =
var redrawNumber {.global.} : int var redrawNumber {.global.} : int
let width = getAllocatedWidth(widget) let width = getAllocatedWidth(widget)
let height = getAllocatedHeight(widget) let height = getAllocatedHeight(widget)
for i in 1 .. < NumPoints: for i in 1 ..< NumPoints:
context.lineTo(i.float , sineToPoint(i + redrawNumber, width, height)) context.lineTo(i.float , sineToPoint(i + redrawNumber, width, height))
context.stroke context.stroke
inc(redrawNumber) inc(redrawNumber)
return true # TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further. return true # TRUE to stop other handlers from being invoked for the event. FALSE to propagate the event further.
proc activate(app: Application) = proc appActivate(app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)
window.title = "Drawing example" window.title = "Drawing example"
window.defaultSize = (400, 400) window.defaultSize = (400, 400)
@ -714,7 +716,7 @@ proc activate(app: Application) =
proc main = proc main =
let app = newApplication("org.gtk.example") let app = newApplication("org.gtk.example")
connect(app, "activate", activate) connect(app, "activate", appActivate)
discard run(app) discard run(app)
main() main()

View file

@ -1,8 +1,6 @@
# app0.nim -- minimal application style example # app0.nim -- minimal application style example
# nim c app0.nim # nim c app0.nim
import gintro/[gtk, glib, gobject] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication # we want to use GTK application
#from gintro/gio import ApplicationFlags, scActivate, run
proc appActivate(app: Application) = proc appActivate(app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)

View file

@ -1,6 +1,5 @@
# nim c button.nim # nim c button.nim
import gintro/[gtk, glib, gobject] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
proc buttonClicked (button: Button) = proc buttonClicked (button: Button) =
button.label = utf8Strreverse(button.label, -1) button.label = utf8Strreverse(button.label, -1)

View file

@ -19,7 +19,7 @@ proc drawingAreaDrawCb(widget: DrawingArea; context: Context): bool =
var redrawNumber {.global.} : int var redrawNumber {.global.} : int
let width = getAllocatedWidth(widget) let width = getAllocatedWidth(widget)
let height = getAllocatedHeight(widget) let height = getAllocatedHeight(widget)
for i in 1 .. < NumPoints: for i in 1 ..< NumPoints:
context.lineTo(i.float , sineToPoint(i + redrawNumber, width, height)) context.lineTo(i.float , sineToPoint(i + redrawNumber, width, height))
context.stroke context.stroke
inc(redrawNumber) inc(redrawNumber)

View file

@ -1,6 +1,5 @@
# nim c connect_args.nim # nim c connect_args.nim
import gintro/[gtk, glib, gobject] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
type type
O = object O = object

View file

@ -1,6 +1,5 @@
# nim c count_button.nim # nim c count_button.nim
import gintro/[gtk, glib, gobject] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
type type
CountButton = ref object of Button CountButton = ref object of Button

View file

@ -1,6 +1,5 @@
# nim c label.nim # nim c label.nim
import gintro/[gtk, glib, gobject] import gintro/[gtk, glib, gobject, gio]
import gintro/gio except Application, newApplication
proc appActivate(app: Application) = proc appActivate(app: Application) =
let window = newApplicationWindow(app) let window = newApplicationWindow(app)

View file

@ -1,65 +0,0 @@
# Package
version = "0.2.0"
author = "Stefan Salewski"
description = "High level GObject-Introspection based GTK3 bindings"
license = "MIT"
skipDirs = @["examples", "tests"]
# Dependencies
requires "nim >= 0.17.0"
when defined(nimdistros):
import distros
if detectOs(Ubuntu) or detectOs(Debian):
foreignDep "libgtk-3-dev"
elif detectOs(Gentoo):
foreignDep "gtk+" # can we specify gtk3?
#else: we don't know the names for all the other distributions
# foreignDep "openssl"
import ospaths
proc prep =
let this = thisDir()
let td = getTempDir()
cd(td)
let wd = "gintrosalewski"
if dirExists(wd):
quit("gintro: tmp directory already exists!")
mkDir(wd)
cd(wd)
mkDir("ngtk3")
cd("ngtk3")
exec("git clone https://github.com/ngtk3/nim-glib")
exec("git clone https://github.com/ngtk3/nim-gobject")
exec("git clone https://github.com/ngtk3/nim-gir")
cpFile(this / "tests" / "gen.nim", td / wd / "gen.nim")
cpFile(this / "tests" / "combinatorics.nim", td / wd / "combinatorics.nim")
cpFile("nim-glib/src/glib.nim", td / wd / "glib.nim")
cpFile("nim-gobject/src/gobject.nim", td / wd / "gobject.nim")
cpFile("nim-gir/src/gir.nim", td / wd / "gir.nim")
cd(td)
cd(wd)
exec("nim c gen.nim")
mkDir("nim_gi")
exec(td / wd / "gen")
let mods = listFiles("nim_gi")
for i in mods:
let j = i[7 .. ^1]
cpFile(i, this / "gintro" / j)
cd(td)
rmDir(wd) # cleanup
task prepare, "preparing gintro":
#before install:
echo "preparing gintro"
prep()

View file

@ -1,76 +0,0 @@
# Package
version = "0.2.0"
author = "Stefan Salewski"
description = "High level GObject-Introspection based GTK3 bindings"
license = "MIT"
skipDirs = @["examples", "tests"]
# Dependencies
requires "nim >= 0.17.2"
when defined(nimdistros):
import distros
if detectOs(Ubuntu) or detectOs(Debian):
foreignDep "libgtk-3-dev"
elif detectOs(Gentoo):
foreignDep "gtk+" # can we specify gtk3?
#else: we don't know the names for all the other distributions
# foreignDep "openssl"
import ospaths
proc prep =
let this = thisDir()
let td = getTempDir()
cd(td)
let wd = "gintrosalewski"
if dirExists(wd):
quit("gintro: tmp directory already exists!")
mkDir(wd)
cd(wd)
mkDir("ngtk3")
cd("ngtk3")
cpFile(this / "tests" / "gen.nim", td / wd / "gen.nim")
cpFile(this / "tests" / "combinatorics.nim", td / wd / "combinatorics.nim")
cd(td)
cd(wd)
try:
exec("wget 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gobject.nim' -O gobject.nim")
exec("wget 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/glib.nim' -O glib.nim")
exec("wget 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gir.nim' -O gir.nim")
except:
try:
exec("nimgrab 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gobject.nim' gobject.nim")
exec("nimgrab 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/glib.nim' glib.nim")
exec("nimgrab 'https://raw.githubusercontent.com/StefanSalewski/oldgtk3/master/oldgtk3/gir.nim' gir.nim")
except:
echo "For bootstrapping of gintro package we need the low level files gobject.nim, glib.nim and gir.nim."
echo "We take these from package oldgtk3. As most gintro users will not need the whole oldgtk3 package"
echo "we tried to only download these 3 single files using wget or nimgrab. But that failed."
echo "Ensure that wget or nimgrab are available. wget should be available for Unix like systems."
echo "Nimgrab should be available in Nim/tools directory. You may compile it with 'nim c -d:ssl nimgrab.nim'"
echo "and put it into your search path"
echo "For the unlikely case that you have already full oldgtk3 package installed, we will just try to continue..."
exec("nim c gen.nim")
mkDir("nim_gi")
exec(td / wd / "gen")
let mods = listFiles("nim_gi")
for i in mods:
let j = i[7 .. ^1]
cpFile(i, this / "gintro" / j)
cd(td)
rmDir(wd) # cleanup
task prepare, "preparing gintro":
#before install:
echo "preparing gintro"
prep()

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff