stefan@nuc ~/gintro $ ls -lt
    total 40
    drwxr-xr-x 1 stefan stefan   210 Jul  7 00:31 gintro
    -rw-r--r-- 1 stefan stefan  2288 Jul  7 00:30 gintro.nimble
    drwxr-xr-x 1 stefan stefan    48 Jul  6 17:32 tests
    drwxr-xr-x 1 stefan stefan    94 Jul  6 15:27 examples
    -rw-r--r-- 1 stefan stefan   113 Jul  6 15:27 nim.cfg
    -rw-r--r-- 1 stefan stefan 25629 Jul  6 15:27 README.adoc
    -rw-r--r-- 1 stefan stefan  1071 Jul  6 15:26 LICENSE
    stefan@nuc ~/gintro $ cat gintro.nimble
    # Package
    
    version       = "0.1.0"
    author        = "Stefan Salewski"
    description   = "High level GObject-Introspection based GTK3 bindings"
    license       = "MIT"
    skipDirs = @["examples", "tests"]
    
    # Dependencies
    
    requires "nim >= 0.17.0"
    
    import ospaths
    
    #mode = Whatif
    
    proc prep =
      let this = thisDir()
      let td = getTempDir()
      cd(td)
      let wd = "gintrosalewski"
      mkDir(wd)
      cd(wd)
      mkDir("ngtk3")
      cd("ngtk3")
      
      exec("git clone https://github.com/ngtk3/nim-gdk_pixbuf";)
      exec("git clone https://github.com/ngtk3/common";)
      exec("git clone https://github.com/ngtk3/nim-atk";)
      exec("git clone https://github.com/ngtk3/nim-cairo";)
      exec("git clone https://github.com/ngtk3/nim-gdk3";)
      exec("git clone https://github.com/ngtk3/nim-gio";)
      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-gtk3";)
      exec("git clone https://github.com/ngtk3/nim-pango";)
      exec("git clone https://github.com/ngtk3/nim-gir";)
      
      exec("ls -lt")
      exec("ls -lt " & this)
      echo this
      echo(this / "tests" / "gen.nim")
      cpFile(this / "tests" / "gen.nim", td / wd / "gen.nim")
      cpFile(this / "tests" / "combinatorics.nim", td / wd / 
"combinatorics.nim")
      #mkDir("nim_gi")
      
      cpFile("nim-gio/src/gio.nim", td / wd / "gio.nim")
      cpFile("nim-atk/src/atk.nim", td / wd / "atk.nim")
      cpFile("nim-glib/src/glib.nim", td / wd / "glib.nim")
      cpFile("nim-gdk3/src/gdk3.nim", td / wd / "gdk3.nim")
      cpFile("nim-gtk3/src/gtk3.nim", td / wd / "gtk3.nim")
      cpFile("nim-gobject/src/gobject.nim", td / wd / "gobject.nim")
      cpFile("nim-cairo/src/cairo.nim", td / wd / "cairo.nim")
      cpFile("nim-cairo/src/cairo_pragma.nim", td / wd / "cairo_pragma.nim")
      cpFile("nim-pango/src/pango.nim", td / wd / "pango.nim")
      cpFile("nim-pango/src/pango_cairo.nim", td / wd / "pango_cairo.nim")
      cpFile("nim-gdk_pixbuf/src/gdk_pixbuf.nim", td / wd / "gdk_pixbuf.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]
        echo j
        cpFile(i, this / "gintro" / j)
    
    task prepair, "prepairing gintro":
    #before install:
      
      echo "prepairing gintro"
      prep()
    
    

Well, not yet pushed to github, but when I execute nimble in the gintro 
directory it does indeed work.

If you don't know what it is: It is nimble install for 
[https://github.com/StefanSalewski/nim-gi](https://github.com/StefanSalewski/nim-gi)
 with new name gintro suggested by Araq.

But a few questions remain:

Currently I have to type "nimble prepair" followed by "nimble install". I guess 
some users may prefer to type only "nimble install". So I tried the before 
install hook. but that does not work, the hook seems to be not executed. What 
"nimble prepair" does: It generates all the modules like gtk.nim, glib.nim, 
pango.nim ... into the gintro directory. That dir is initially empty. If that 
is done, then "nimble install" installs that files into 
~/.nimble/pkgs/gintro-0.1.0/gintro

That is fine, and after that I can place my applications everywhere, use 
imports like gintro/gtk and I can compile them. Great.

Next question: mode = Whatif as mentioned in nimscript module would make 
debugging easier, but I got it not working, Whatif symbol was undefined.

Next: In ~/.nimble/pkgs/gintro-0.1.0/gintro I get all the generated modules, 
and that modules partly import each other. Currently the modules still use 
plain import, for example gtk.nim uses import glib, gobject. Seems still to 
work. Should I fix that to import gintro/glib, gintro/gobject?

Next: What shall I do with the example files from the tutorial in examples 
directory?

Next: listFiles() seems to give not plain file names, but directory prefix, 
which is difficult to remove. Is there a better way.

Well, the dependency check for gtk developer files are still missing, I will 
add that tomorrow. And some more checks and cleanup when possible. 

Reply via email to