Page 1 of 3

Unbloated coding resources

Posted: Fri 07 Oct 2011, 17:35
by technosaurus
I have decided to start really learning how to program, and didn't want to start off with bad bloat habits, so I have been doing research on the topic for quite some time. So long that some of the better bloat-light example have gone into hiatus. It's probably time I started posting some findings.

I don't have enough time to post a philosophical statement on the subject or reasoning behind my choices, so I am just posting the projects at the moment.

Here they are in no particular order:
Ssl/encryption ... libtomcrypt
Imaging ... stb_image (nothings.org) or nanojpeg+lodepng+webp
Ecmascript (aka javascript) ... see-3.1.1424.tar.gz (currently unmaintained), duktape
OpenGL ... tinyGL <<== SDL implementation
Html5 ... hubbub
Css ... libcss
Svg ... libtinysvg
Lua ... stua (nothings.org)
Freetype ... stb_freetype
Tcl ... jimtcl
Ogg ... stb_ogg
Gcc ... llvm+clang or tcc
Java ... avian
Perl ... microperl (distributed with perl)
Python ... tinypy
Ruby ... tinyrb
GUI ... sdl + agar + tekui ...
Gnu-utils ... Googles toolbox, busybox, embutils, toybox...
Video ... Webm
Mp3 ... minimp3, pdmp3
libc... musl, uclibc, bionic,diet,bsd...
Libstdc++ ... uclibc++, stlport, eastl, ustl, libcxx, libcpp,... the sgi stl,
More to follow.

Posted: Sun 09 Oct 2011, 04:25
by sunburnt
Do check out "gtk-server" at: http://www.gtk-server.org/
It works with any interpreted language to make GTK+ GUIs.
It uses absolute coordinance, or hBox / vBox, or table box ( best ).

I`m stuck at a point with a mod. I`m writing to simplify it`s syntax.

Posted: Sun 09 Oct 2011, 16:42
by technosaurus
Here is the most interesting part of gtk-server:
The configfile also defines which GTK libraries should be used. Next to the regular GTK libraries any library can be specified, like Glade, GtkMozEmbed, GtkGlArea, GtkGlExt, but also libc, libmikmod and so on!
so it appears that anything written in C can be used. I need to check on the license though.

Posted: Sun 09 Oct 2011, 20:48
by sunburnt
Yeah... I neglected to mention that part, I hadn`t played with it yet though.
It appears to be totally open and can be expanded in almost any manner.!

Here`s the GPL doc. that Peter posted at the web site:
http://www.gtk-server.org/gpl.txt

Posted: Mon 10 Oct 2011, 06:55
by jamesbond
technosaurus wrote:Here is the most interesting part of gtk-server:
The configfile also defines which GTK libraries should be used. Next to the regular GTK libraries any library can be specified, like Glade, GtkMozEmbed, GtkGlArea, GtkGlExt, but also libc, libmikmod and so on!
so it appears that anything written in C can be used. I need to check on the license though.
That's what I was hinting in my post here http://murga-linux.com/puppy/viewtopic.php?t=72142. The tarball contains a few non-GTK demo scripts: one that uses gtk-server to call libmikmod to play a MOD file, and one that uses ncurses.

Posted: Fri 11 Nov 2011, 18:28
by jamesjeffries2
You may also be interested in the TinyCCompiler. Not sure about the size of the code it produces but it's pretty inspirational if nothing else!

Posted: Sat 12 Nov 2011, 07:51
by technosaurus
tcc could go in the list I guess, but not because it is a small compiler (the compiler is a choice of the end user or packager and _should_ be irrelevant to the developer except to test that code compiles with it) - just because it can be used to run c code as a scripting language (with it, who needs gtkserver)

Posted: Sat 12 Nov 2011, 18:45
by sunburnt
Just because it can be used to run c code as a scripting language (with it, who needs gtkserver)
# Interesting... Some code examples would be great...

But I imagine that GTK+ code would look about the same as gtk-server.
The Q would be which ran the code faster. Kinda hard to say...

Posted: Sat 12 Nov 2011, 20:15
by technosaurus
The tcc web site uses the linux kernel as the example of using C as a script, but you can use pretty much anything that you can compile on a single line (you can specify multiple files and defines - I've done it with jwm, rxvt and others)

tcc

Posted: Sat 12 Nov 2011, 21:59
by vovchik
Dear puppians,

Some time ago I asked Peter (GTK-server and BaCon) to include a compile option for tcc, which he kindly did (quite some time ago), since I thought it would be nice to have an unbloated minimal development environment (tcc and BaCon) for tiny Puplets. I compiled tcc and then tried compiling a few things in C and in BaCon and discovered that the resulting binaries were immense. Technosaurus could probably figure out why this is the case and provide a nice solution. I didn't pursue it...but if tcc could be made to generate tiny binaries it would indeed be a useful.

With kind regards,
vovchik

Posted: Sun 13 Nov 2011, 20:43
by sunburnt
That`s something you don`t think about...

tcc may not have many options and methods for stripping and reducing size.

Posted: Sun 13 Nov 2011, 21:31
by seaside
Can't remember which thread this was, but I think Big_bass compiled some bacon binaries in tinycc and after upxing, they were of reasonable size.

Regards,
s

Posted: Tue 15 Nov 2011, 05:22
by technosaurus
I don't know if tcc uses the -s flag or just ignores it (as it does with all unsupported flags) but it doesn't matter because ...

you get a smaller binary with:
strip -s -R .note -R .comment *
or for libs
strip --strip-unneeded -R .note -R .comment *.so*

fyi, Rob Landley is debating on relicensing toybox to a more permissive license
http://landley.net/notes-2011.html#13-11-2011

Posted: Wed 17 Oct 2012, 09:08
by technosaurus

Posted: Fri 19 Oct 2012, 19:02
by Ibidem
perl:
also miniperl (perl builds microperl to start configuring, then miniperl to finish that, then builds perl itself); it's a lot closer to full perl.
CC/gcc: also pcc http://pcc.ludd.ltu.se/ - there are some very recent fixes you may want if you use it.
code is around 30-40% larger, if musl libc.so is taken as representative
browser:
retawq is the smallest I've seen; links2 in gui mode aka xlinks is the smallest with a reasonable gui (retawq offers an X version, but uses xcurses/pdcurses to do it)
asmutils is small, though it is so feature-starved that it may be unusable; klibc-utils is standard for initramfs.
gettext-tiny (https://github.com/rofl0r/gettext-tiny) is a package to fake having gettext/libintl when you don't want it.

Posted: Sat 24 Nov 2012, 13:36
by jamesbond
This thread should be pinned, it is very useful.
Also, klone is super cool :)

Posted: Sat 24 Nov 2012, 18:00
by technosaurus
I forgot to add ph7 engine for embedded php.
http://ph7.symisc.net/downloads.html
It uses a Berkeleydb/sleepycat style license

And baresip voip library (bsd license)
http://www.creytiv.com/baresip.html

Posted: Tue 30 Apr 2013, 00:23
by Ibidem
Pnglite http://sourceforge.net/projects/pnglite/
is a very small (<1k lines) read/write png library; it's one header and one C file.

The stb_* stuff is meant for demos only, afaict.

Posted: Thu 12 Dec 2013, 05:57
by technosaurus
another voip

https://code.google.com/p/umurmur/
since it can use polarssl, it should be able to handle one of the BSD maintained versions of xyssl (bsd licensed project polarssl was forked from)

Posted: Tue 17 Dec 2013, 18:21
by technosaurus
I need to go through these pages and point out the best ones but till then:

Lots of json, sqlite and other C related stuff:
http://fossil.wanderinghorse.net/repos/
Various C stuff:
http://git.suckless.org/
http://suckless.org/other_projects
http://wiki.musl-libc.org/wiki/Alternative_libraries