diff --git a/gintro.nimble b/gintro.nimble index 2b21431..9d52dff 100644 --- a/gintro.nimble +++ b/gintro.nimble @@ -67,8 +67,8 @@ proc prep = cd(td) rmDir(wd) # cleanup -task prepare, "preparing gintro": -#before install: +#task prepare, "preparing gintro": +before install: echo "preparing gintro" prep() diff --git a/gintro.nimble.bak2 b/gintro.nimble.bak2 new file mode 100644 index 0000000..2b21431 --- /dev/null +++ b/gintro.nimble.bak2 @@ -0,0 +1,76 @@ +# 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() + +