This user built libshsql.a as a shared library.

The correspondence related to this is all here.

Revised Makefiles are at the end of this file.

--------------------------------------------------------------


Steve,
I am the developer of a tiny distro called Puppy Linux.
I have just put in xshttpd, a very small http server with
all the goodies, and I have been looking around for some kind
of database backend.

I like Quisp from the description, and I have just now compiled it.

However, I have a question about which executables are required and
also the size of them.

Puppy is a very small distro that is designed to boot off a 50M credit-
card-size CD and also usb pen drives and zip drives.
Every app has to be the absolute smallest size possible.
(well, Puppy is running Skipstone web browser, which has Mozilla 1.7
core code, which is not exactly small, but I did manage to trim it
to under 8M compressed :-) ).

The Quisp package creates a static libshsql file, so doesn't that make
the total size of all the executables much bigger than they need to be?

If my interest is just to use Quisp with the http server, as a cgi,
does that mean that I can get away with using just quisp and shsql executables?

I see in your docs that you state Quisp is about 270K. After stripping, quisp
is 178K, quisputil is 159K and shsql is 109K.

Any advice you can give, even alternative shared-library Makefiles if necessary,
to install a minimal system, will be greatly appreciated.

I have been reading the docs, and think Quisp is very nice. I reckon it
would be an excellent addition to Puppy, and would fill a gap in the
application suite.
(note, Puppy has Gequel, a mysql client, that I plan to remove).

Puppy's homepage:
http://www.goosee.com/puppy
News page:
http://www.goosee.com/puppy/news.htm

Regards,
Barry Kauler

--------------------------------


Steve,
The total size of all the executables, after stripping, is about 1.5M.
However, most of them have duplicate code inside. For example, shsql has
mostly the same code as shsql_join.

I edited the Makefiles, created a libshsql.so and linked the executables
to that, and got a total size of all executables including the shared
library file, of about 550K.
buildix for example, was 109K and became 14K.

However, I am far from a expert at this. The most I have ever done with
Makefiles before is tweak some parameters.
So, although it all compiled, I got segmentation faults when tried to
run the apps.

The idea is sound though.
The file sizes in Quisp can be greatly reduced, to at least one third.

probably the ultimate would be a single executable, with multiple entry
-points, like Busybox. I have no idea how that is done.

Regards,
Barry Kauler


----------------------------

Date: Mon, 13 Sep 2004 10:13:27 -0800
To: Stephen C. Grubb <___>
Subject: Re[3]: quisp / shsql bare bones configuration

Steve,
I got it to compile and the apps no longer have a segmentation fault.

For sqlsrc/Makefile, I added "-fPIC" to CFLAGS, as I think this is
needed for the objects files that go to make up the shared library
libshsql.so.
The "-fPIC" also gets applied to the final executables, which doesn't
seem to harm them, but I don't think it is needed and if possible
should be omitted.

libshsql.so needs to be copied to /usr/lib/, which I did manually.

I don't know if they actually work, I just tried a couple, for example
quisp complains that the config file is missing and exits (as I haven't
got as far as installing yet).

Anyway, if this interests you, I have attached the two Makefiles.

quisp and quisputil are still very inefficient as they have a big chunk
of duplicate code, but I didn't bother about that.

Regards,
Barry Kauler

----------------------------------

Date: Mon, 13 Sep 2004 10:17:53 -0800
To: Stephen C. Grubb <___>
Subject: Re[4]: quisp / shsql bare bones configuration

Steve,
One more thing:
I stripped the executables with this:

strip --strip-unneeded *

And the shared lib file:

strip --strip-debug libshsql.so

...although it is probably alright to strip libshsql.so completely.

Regards,
Barry Kauler

-------------------------------------

Date: Mon, 13 Sep 2004 19:34:26 -0800
To: Stephen C. Grubb <___>
Subject: Re[5]: quisp / shsql bare bones configuration (fwd)

Steve,
Good news.
I installed Quisp into Puppy Linux.
I ran the basic test that your docs gave to test shsql (which is now
a mere 12K) and it worked.

I have installed ghttpd web server into Puppy, but haven't got it
working right. It reads html files inside the htdocs directory ok
but won't execute anything in cgi-bin. Anyway, that's a server setup
problem.

What I did was execute quisp from the commandline, and it fetched the
default web page from the project folder.

So, those makefiles that I sent you seem to be ok.

Regards,
Barry Kauler


--------------------------------------
modified qsrc/Makefile
--------------------------------------
# QUISP
# 



######### To include embedded PLOTICUS support, uncomment the following and fill in
######### the names/locations of libploticus and any other required libraries (eg zlib):
######### Note: if enabling embedded ploticus, you may want to build two separate executables 
######### for best performance.. see the note at the end of the #graphic man page.
# PLFLAG = -DENABLE_PL
# PLLIBS = 
# PLLIBS = /home/scg/ploticus/src/libploticus.a  /home/scg/lib/libpng.a  /home/scg/lib/libz.a 


######### SHSQL embedded sql database is included by default.  To omit SHSQL, comment out 
######### the first 2 lines below, and uncomment the following 2 lines.
DBFLAG = -DTDH_DB=2
#DBLIBS = ../lib/libshsql.a
# DBFLAG = -DTDH_DB=0
DBLIBS = 


######### Done.  Now type:  make clean;  make
#########
######### After building quisp, the executable may be moved to your cgi-bin and renamed however you like.
######### Eg.     dbcgi dbcgi.cnf    pricelist.cgi pricelist.cnf



CC = gcc
BIN = ../bin

CFLAGS = $(DBFLAG) $(PLFLAG) 
LIBS = $(DBLIBS) $(PLLIBS) -lm

TDOBJ = variable.o value_subst.o value.o times.o tdhkit.o sqlbuild.o sinterp.o \
shell.o secondaryops.o reslimits.o glroutines.o functions.o fieldmap.o err.o \
dbinterface.o dbfunc.o dates.o containswords.o condex.o checksum.o

CGIOBJ = quisp.o oplist.o cgiops.o cgic.o 


default: quisp quisputil


# QUISP - CGI-based quick server pages system
quisp: $(CGIOBJ) $(TDOBJ) custom.o
	$(CC) $(CGIOBJ) $(TDOBJ) custom.o -L../lib -lshsql $(LIBS) -o  $(BIN)/quisp
	chmod 6755 $(BIN)/quisp
	rm -rf quisp.o cgiops.o


# QUISPUTIL - command line quisp processor
quisputil: quisputil.o $(TDOBJ) custom.o
	cc quisputil.o $(TDOBJ) custom.o -L../lib -lshsql $(LIBS) -o  $(BIN)/quisputil
	rm -rf quisputil.o

# STRIPPER - utility to strip out quisp #operators and @variables, ie. for spell checking
stripper: stripper.o glroutines.o
	cc stripper.o glroutines.o -o $(BIN)/stripper

all:
	make clean; make quisp
	make clean; make -f Makefile_pl
	make clean; make quisputil

clean:
	rm -rf *.o 


------------------------------
Modified shsql/Makefile
------------------------------
# SHSQL
# 

CC = gcc
CFLAGS = -DSHSQL -fPIC
BIN = ../bin

SQLOBJ = shsqlconfig.o api.o sqlcom.o sqldel.o sqlins.o sqlsel.o sqlupd.o indexlook.o \
	tablelock.o recordlock.o sequence.o general.o

TDOBJ = condex.o err.o fieldmap.o glroutines.o tdhkit.o value_subst.o variable.o value.o containswords.o

# Note: shsql requires its own copy of certain TDH files such as condex.c and tdhkit.c
# Other TDH files are present in this directory by way of soft links, for convenience in distributing
# the software.

# Note: the compile flag SHSQL is needed in a few places where tdh functionality is truncated.
# See notes in the source code (grep "ifndef SHSQL" *.c)

default: libshsql  shsql  shsql_join  shsql_create shsql_alter tabmaint buildix tabdef shsql_fldsel tabo catofs dataedit dbcat 


# LIBSHSQL - shsql API library
libshsql: $(SQLOBJ) $(TDOBJ)
	rm -rf ../lib/libshsql.a
	rm -rf ../lib/libshsql.so
	ar r ../lib/libshsql.a $(SQLOBJ) $(TDOBJ)
	ld -o ../lib/libshsql.so -shared $(SQLOBJ) $(TDOBJ)

# SIMPLE - example shsql program
simple:	simple.o $(SQLOBJ) $(TDOBJ)
	$(CC) simple.o -L../lib -lshsql -o $(BIN)/simple

# CTEST1 - another example shsql program
ctest1: ctest1.o $(SQLOBJ) $(TDOBJ)
	$(CC) ctest1.o -L../lib -lshsql -o ../sqlexampledb/testruns/ctest1

# SHSQL - command line SQL tool
shsql:	shsql.o $(SQLOBJ) $(TDOBJ)
	$(CC) shsql.o -L../lib -lshsql -o $(BIN)/shsql

# SHSQL_JOIN - join tool invoked by shsql - generally never invoked directly
shsql_join: shsql_join.o $(SQLOBJ) $(TDOBJ)
	$(CC) shsql_join.o -L../lib -lshsql -o $(BIN)/shsql_join

# SHSQL_CREATE - executive for creating databases, tables, and indexes
shsql_create: shsql_create.o $(SQLOBJ) $(TDOBJ)
	$(CC) shsql_create.o -L../lib -lshsql -o $(BIN)/shsql_create

# SHSQL_ALTER - executive for implementing ALTER..
shsql_alter: shsql_alter.o $(SQLOBJ) $(TDOBJ)
	$(CC) shsql_alter.o -L../lib -lshsql -o $(BIN)/shsql_alter

# TABMAINT - executive for packing tables and updating indexes
tabmaint: tabmaint.o $(SQLOBJ) $(TDOBJ)
	$(CC) tabmaint.o -L../lib -lshsql -o $(BIN)/tabmaint

# BUILDIX - actually build index files
buildix: buildix.o $(SQLOBJ) $(TDOBJ) 
	$(CC) buildix.o -L../lib -lshsql -o $(BIN)/buildix

# TABDEF - display fields (columns) for a table
tabdef: tabdef.o $(SQLOBJ) $(TDOBJ)
	$(CC) tabdef.o -L../lib -lshsql -o $(BIN)/tabdef

# DBCAT - cat a shsql data table 
dbcat: dbcat.o $(SQLOBJ) $(TDOBJ)
	$(CC) dbcat.o -L../lib -lshsql -o $(BIN)/dbcat

# DATAEDIT - wrapper for invoking text editor on data table file
dataedit: dataedit.o $(SQLOBJ) $(TDOBJ)
	$(CC) dataedit.o -L../lib -lshsql -o $(BIN)/dataedit

# SHSQL_FLDSEL - select fields - this needs to be kept separate from tdh fldsel
shsql_fldsel: fldsel.o $(SQLOBJ) $(TDOBJ)
	$(CC) fldsel.o -L../lib -lshsql -o $(BIN)/shsql_fldsel

# TABO - nice outputter
tabo: tabo.o glroutines.o
	$(CC) tabo.o glroutines.o -o $(BIN)/tabo

# CATOFS - view files w/ begining line byte location 
catofs: catofs.o
	$(CC) catofs.o -o $(BIN)/catofs

clean:
	rm -rf *.o