Only seen one (old) post on the forum related the long available IUP (for C, Lua, or LED, or even old ScriptBasic interpreter...) so posting here in case proves useful for others (and myself) to currently investigate further:

The Basic Guide to using IUP with Lua, which I provide a link to below, is particularly interesting in terms of the simplicity of programming the creation of GUIs with IupLua from a programmer's perspective:

Had some trouble installing IUP for Lua, but just as I'm about to go to bed I seem to have success on XenialDog64. I installed Lua5.1 because the IUP stuff seemed to suggest was available for that. The IUP install itself is not bad at just over 7MB, so it seems to be a fairly small development system and the Basic Guide tutorial I linked to above seems to work when the commands just typed straight into the Lua interpreter prompt terminal (I don't know Lua, so happy with progress thus far). Just typing in a couple of Lua code lines and a gui popped up as it should...

I'll work more on this tomorrow and report back how to try it all.

First 'program' tried was:

Code:

require( "iuplua" )

iup.Message('YourApp','Finished Successfully!')

Yeah, there were some 'Warnings' but I'm not worried about that at this stage...

wiakLast edited by wiak on Sun 25 Mar 2018, 19:33; edited 1 time in total

Sure looks promising !
I was thinking that it would be important to know if it depends on gtk3 (which is installed by default in Xenialdog).
If it does, there might be a problem, because many puppies only have gtk2.

I was thinking that it would be important to know if it depends on gtk3 (which is installed by default in Xenialdog).
If it does, there might be a problem, because many puppies only have gtk2.

Fred

I'm pretty sure, but have to check it out more, that it can use either gtk2 or gtk3. But yeah, I guess that would need it compiled for one or the other and it may be that the binaries I've downloaded are for gtk3(?). Not sure how to check that offhand.

GTK 3.x is supported. But the pre-compiled binaries, up to Linux 3.2, are still built with GTK 2.x.
...
To build the driver with GTK 3.x support define USE_GTK3=Yes before calling make in the "iup/src" folder. Just the main library must be rebuilt. Also, if CD is used, the CD main library must be rebuilt with the same parameter.

Since Linux 3.13 the default is to use GTK 3

.

The version I am using is for Linux kernel 4.4 so using GTK3 at the moment.

I'll get round to trying to compile my own binary later so can choose GTK2 or GTK3.

EDIT!!!: I think I will have to modify this HowTo since only seems to partly work. Maybe I should be only installing lib tar.gz files, not bin tar.gz and I have to make sure all im and cd libs are available/installed maybe to; to be continued later...

Use for programming simple gtk utilities and apps using small Lua interpreter with iup (an alternative to, for example, bash/gtkdialog/yad)

The following assumes:

Installing on XenialDog 64bit system, which uses kernel version 4.4.x.

Installing iup graphical toolkit for Lua version 5.3.

The instructions may or may not work for higher kernel versions or on other 64 bit distributions. Otherwise, some alternative binaries are available at the iup download site (or you can compile your own from the iup-provided source code). You can also look for the appropriate files for 32bit Linux systems at the iup website.
-------------------

Steps:

1. If you do not already have it, install the Lua interpreter version 5.3 with command:

Code:

apt-get update && apt-get install lua5.3

2. Make a directory somewhere for holding the Lua5.3 compatible main iup files and libraries.

Code:

mkdir -p /<somewhere>/iup53

replace <somewhere> above by dir name of your base directory of choice.

So today/tomorrow I'm going to work on compiling IUP version that uses gtk2 rather than gtk3 to find out how easy or otherwise that is. If I manage, I'll post a howto in the hope that it will then be relatively easy for Puppy and Dog developers to create IUP lib/binaries that will run on any Puppy or Dog.

EXCEPTIONS: Actually, (according to https://webserver2.tecgraf.puc-rio.br/cd/en/building.html), I think ftgl isn't needed for Linux cos already in canvasdraw below, but in Linux should install the freetype-dev package (on re-reading the compile Guide, ftgl sources may be needed after all - canvasdraw maybe only creates a blank ftgl directory in the overall dir structure - we will see...). For Windoze zlib sources are required, it seems from the guide, but in Linux zlib-dev is to be installed. I couldn't find that name, so have tried installing lua-zlib-dev in the hope that is the one...

I am having trouble compiling CanvasDraw using sources above because of apparent errors in the source code (such as in sim/cd_truetype.h:14:22: fatal error: ft2build.h, should be #include <ft2build.h>, but still other problems...). Might be better to try SVN code which may or may not have error patches applied:

[quote=Guide]Building
By default the Makefiles and Tecmake files will build for Lua 5.1. To build for other Lua versions define USE_LUA_VERSION=52 or USE_LUA_VERSION=53 in the environment.
...
As a general rule (excluding system dependencies): IUP depends on CD and IM, and CD depends on IM. So start by build [lua5.3, then ftgl and then:] IM, then CD, then IUP.

To start building go the the "src" directory and type "make". In IUP there are many "srcxxx" folders, so go to the up directory "iup" and type "make" that all the sub folders will be built.[/quote]

As far as using Lua/IUP is concerned, my early objective, for practice mainly, is to try and write a Lua/IUP version of an existing bash/gtkdialop app - something like an early version of Precord maybe.

I guess I'd like to see a small Linux distribution that used Lua/IUP for its small utils rather than gtkdialog (which doesn't seem to be maintained any more) or yad; nothing wrong with gtkdialog or yad, but for me it would be pleasant to have a relatively sophisticated but small and efficient interpretive programming language such as Lua as a core part of the system distribution anyway - and if it's there anyway, it can be used! Of course Python is often installed nowadays but the problem is finding a small easy to program graphical toolkit, and that is where IUP with Lua seems to fit so well.

Of course, typically we are relying heavily on bash and underlying commandline utilities (such as sed and so on) in our bash/gtkdialog/yad/Xdialog Puppy-style utilities. Whilst there will often (maybe usually) be alternatives in Lua (functions) itself, I hope for simplicity to still be able to lever the power of such commandline utilities so am checking out some likely useful methods of calling up and getting results from shell commandline utils from Lua. Main thing is I want is to use IUP for the gui creation rather than gtkdialog or yad or Xdialog. The following links are as much a reminder to myself as anything else:

I now have IUP apparently successfully compiled to use gtk2 rather than gtk3, but I'm still working on best packaging for Puppy/Dogs and not tested yet.

I am more impressed with IUP than ever and wonder why it has taken me so long to try it (especially since I long ago recognised Lua as a relatively small but very powerful scripting language; trouble is, back then I looked into using wxWidgets as the cross-platform gui toolkit and there was a lot to learn there...). Murga Lua, as I've said, used FLTK, but that has its problems in terms of look-and-feel and murga lua doesn't seem to have been developed for a long time (admittedly, the early murga Lua with FLTK was tiny, but doesn't 'need' to be quite that tiny nowadays - IUP fits ok)

Of course, no one on Puppy was using Lua, except in the early days, and bash and gtkdialog were provided on the systems (and similarly nowadays with yad). However, IUP seems actually easier to use than gtkdialog, albeit it is not directly from bash but rather from Lua. Certainly it is not as small an install as gtkdialog or yad (which are relatively tiny) but compared to overall current Pup or Dog iso size the Lua with IUP combination isn't going to be a very large addition at all.

IUP uses same 'Abstract vbox, hbox, container type layout as gtkdialog, but without the hard-to-get-right xml-like structure of gtkdialog. Really IUP is easier than gtkdialog IMO and much more powerful than yad dialogs (in fact IUP can pretty much match Qt in terms of target app capabilities... but with programming simplicity/abstraction as gtkdialog).

And... any app written in straight Lua with IUP should run exactly the same on Windoze if you happen to also use that or want to give your new app to friends who do! One great thing about IUP is that it uses the underlying native app toolkit, and on Linux it has chosen to use GTK and on Windows the buttons, sliders and so on will show up in native Windows API. That's perfect IMO; unlike FLTK which draws its own widgets, which can look 'untidy' since different to the native GTK (or Windows API) toolkit icons.

And IUP is long established yet also in current development. And though once a commercial app (long ago) it is now liberal MIT licensed (so can be used for free or commercial programming too...)

I hope to publish dotpet and deb (or at least tar.gz) package of my newly compiled IUP GTK2 with Lua5.3 combination soon. In the meantime, here is a really nice youtube explanation (interview of it's main developer, Antonio Escaño Scuri) of IUP from long ago (2011), which also explains really why IUP (with Lua or C) would be a better fit for programming apps/utilities on Puppy and puppy-like Dogs than the likes of Qt or wxWidgets (but with similar power in terms of the apps that could be produced... unlike simplistic yad or gtkdialog, which are very restricting really - but IUP just as easy to use as yad or gtkdialog, albeit with Lua rather than bash, unlike complex Qt or wxWidgets-based toolkit programming).

I can't help thinking that IUP has been mainly not noticed because it is developed in Brazil and not really widely promoted elsewhere (despite being fully open-source GPL compatible, MIT licensed, software) - and for simplicity, Lua needed on the system (considering how small Lua is, it's a pity it isn't included by default on most recent Pups/Dogs anyway IMO - bash/gtkdialog/yad is a bit limiting, unless we are a bit lazy and don't want to learn how to use anything more powerful?).

The following are great examples of lua plus iup scripts. There is one old subdirectory in these examples called 'misc' which relates to Basic Guide tutorial - only some of these old examples still work. I believe that's cause iupx module isn't used anymore and the method of doing directory trees and menus is different. But aside from 'misc' subfolder, all the examples below seem to be working, and they are simple to program with great results...:

I do have iup compiled to work under GTK2 (rather than the default-provided GTK3) but I am still testing that compilation all works. I intend publishing either a small deb package or a tar.gz of that for testing in the next day or two.

Not sure what the overall size will be: depends which iup/cd/im modules included. If it greatly keeps the install size down, I hope to publish a core version first (for most simple gui creation use), with the other parts optional.

I now think IUP isn't adopted more generally simply because it is a bit tricky to compile and package (but it isn't really difficult - just a lot of documentation to find and read first - not exactly a job for newbies - no simple deb package available that I know of...). It seems to be incredibly powerful (yet very simple to program GUIs) once installed. I don't know yet if compiling iup on an older system would result in an iup package that would work on many systems, or whether it always needs to be compiled on the exact target system. Certainly, the programs you write with iup/lua can be used on any system that has lua and the appropriate iup libraries installed (be they Linux or Windoze systems.

One, important I feel, thing I haven't investigated yet is using lua-sh (or similar) module for easy interaction with underlying bash shell commands - that's the last piece of the jigsaw and hopefully an easy one.

Aside from the extended power of iup for creating simple or complex GUIs, it is worth reading Serge Zaitsev's comments at the beginning of the above link why it could be advantageous to move away from only using bash-shell with yad or gtkdialog scripting to Lua etc despite the slight extra install size to small distributions (it isn't going to be a painfully large install).

EDIT:

1. tar.gz of enough for basic gui's (including lua5.3 binary) is 579 KiB. Uncompressed install size of that is just 1.4 MiB (not bad since includes lua interpreter).

2. tar.gz of basic + main iupcontrols additions (again including lua5.3 binary) is 1.1 MiB. Uncompressed that fuller gui capable option is just 2.7 MB so again not bad at all. So this fuller option would just add 1.1 MiB to iso (assuming iso compressed with gz (even smaller if compressed with xz of course).

Okay, I'll make two debs (and later two dotpets for Puppy): one for minimum basic gui creations with Lua, and second a bolt-on for more controls. These are being produced on XenialDog64 at the moment, so will hopefully also work on XenialPup64. If anyone finds it useful I will endeavour to produce similar Xenial 32bit compiled versions.

I'm keeping this IUP development/compiling thread separate from the one I provide dotpet/debs on because I want to keep the other thread more for actual usage discussions/examples. I refined my compile process somewhat from what can be found in various posts of this thread. It remains far from refined, but rough details which should be enough to allow others to compile it are given below. Of course I should refine and automate all this, but haven't... Also I haven't got round to packaging the latest compile I made. Easiest way for myself to work out requirements is to check structure of my previous uploaded deb packages. This latest compile is more of an intermediate step to jog my memory so I can compile and package again once I need it:

By default the Makefiles and Tecmake files will build for Lua 5.1. To build for other Lua versions define USE_LUA_VERSION=52 or USE_LUA_VERSION=53 in the environment.
...
As a general rule (excluding system dependencies): IUP depends on CD and IM, and CD depends on IM. So start by build [lua5.3, then ftgl and then:] IM, then CD, then IUP.

To start building go the the "src" directory and type "make". In IUP there are many "srcxxx" folders, so go to the up directory "iup" and type "make" that all the sub folders will be built
...
TIP: If GTK headers or libraries are not being found, even when the libgtk2.0-dev package is installed, then their installation folder is not where our Makefiles expect. Build the GTK/GDK dependent libraries using "make USE_PKGCONFIG=Yes".

Edit cd/src/sim/cd_truetype.h and if has #include "ft2build.h" then change to #include <ft2build.h> (seems fixed in SVN version); Also may need Patch for Freetype2 from sur-behoffski to tecmake.mak in cd (and probably in iup and ftgl as well) - I used the patch for cd and iup tecmake.mak(s) only (applied details manually) but don't know if required (though seems to be since clears up errors, tho does compile without). You can get the patch from IUP mailing lists here
https://sourceforge.net/p/iup/mailman/message/36159491/:

libgtk2.0-dev (for the GTK driver)
or
libgtk-3-dev (for the GTK driver)
libmotif-dev and x11proto-print-dev (for the Motif driver, OPTIONAL)
libgl1-mesa-dev and libglu1-mesa-dev (for the IupGLCanvas)
libwebkit-dev or libwebkitgtk-dev (for the IupWebBrowser using GTK 2)
or
libwebkitgtk-3.0-dev (for the IupWebBrowser using GTK 3). Now do the following:

If not using SVN checkout version, untar download and then:

cd iup

In iup run make from top-level iup directory to build all libraries. Alternatively drop into individual srcxxx lib and run make there to build individual lib.

At least in the Xenial 32bit version I needed to symlink gtk/ to gtkunixprint libs.

NOTE: I'm currently ignoring GTK_CHECK_VERSION() pre-processor errors.
Also during compiling I still get errors like:
error: missing binary operator before token "("
#define CAIRO_VERSION_110 CAIRO_VERSION_ENCODE(1, 10, 0)
But these also seem able to be ignored (IUP message board drew attention to these but no fix suggested).

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum