$Id: README,v 1.3 2010/02/08 13:31:57 mwesdorp Exp $

Building sqsh on Windows in the Cygwin environment

Cygwin (http://www.cygwin.com) is a free Unix-like environment (complete
with X Window server, bash, etc.) that you can install on Windows
machines. sqsh and other Unix tools can be built in that environment
and then used to access resources/servers/etc as if you were using a
Windows program.

Building sqsh in the Cygwin environment requires a couple of
non-standard operations both because the configure script
hasn't been adapted for Cygwin, and because sqsh can't use the
Sybase DLLs directly.

For building sqsh using Sybase Open Client 15 see below.

1. Generating the appropriate libXXX.a files
   The cygwin.sh script in this directory can be used to generate
   these files (libblk.a, libcs.a and libct.a). HOWEVER - this script
   does not generate usable files with recent (12.5.1 and later)
   versions of OCS. This directory includes copies of these "libraries"
   that you should be able to use. Note that these .a files aren't
   real libraries - they just document the entry points to the DLLs.

2. config.h
   This file is normally generated by the configure script. You can
   either use the one provided (which should work), or run configure
   yourself to generate this file.

3. Makefile
   The Makefile in this directory has been tailored for use with
   Cygwin. To use this file directly you need to update the
   SYBASE_OCOS macro (near the top of the file) to point at your 
   OpenClient installation - it defaults to c:/sybase/OCS-12_5/
   The SYBASE_LIBS macro points at the .a files in this directory,
   and the CPPFLAGS include the extra defines
   (-D_MSC_VER=800 -D_CYGWIN32_) that are needed to build sqsh in
   this environment.

Building:

1. Copy config.h to ../src
2. cd ../src
3. Run "make -f ../cygwin/Makefile"

You should normally now have a sqsh.exe binary in the src directory.


--------

Linn Anderson sent me the following comments regarding Cygwin when 
using FreeTDS:

 First, thanks for sqsh.  I just built it for my cygwin desktop and had
only a little trouble, mostly following the instructions in the cygwin
directory.  What I ended up doing was much easier.  I havn't used the
sqsh much, but the build seems robust.

  Maybe this is all old hat to you, but if it helps, here is what I did:

            Default Freetds install (configure, make, make install)
            Extract sqsh
            SYBASE=/usr/local
            Export SYBASE
            ./configure
            Edit src/Makefile, replacing -ldl with -liconv
            Make
            Make install
            Make install.man
            And of course, edit up some usable interfaces file.

The only problem with the build, out of the box, was -ldl not found and
several links were needed from -liconv.

  Again, thanks.

--Linn


          Building sqsh for Cygwin using Sybase Open Client 15.

1) As described in the procedure above for OCS-12_5, you need to generate
   link libraries, using the script cygwin-syb15.sh. Make sure the location
   of your Sybase install directory is correct.
   The default is /cygdrive/c/Sybase.
   Run the script in the cygwin directory and you will have three library files:
   libsybblk.a, libsybcs.a and libsybct.a. Copy these files to /usr/local/lib or
   any other location you want or keep them here in the cygwin directory.

2) Check the Makefile-syb15 for the default Sybase OCS-15_0 location
   SYBASE_OCOS (default location is /cygdrive/c/Sybase/OCS-15_0).
   and the SYBASE_LIBS entry must point to the directory you copied
   the libraries to in the previous step. Default is /usr/local/lib.
   If you want X and Motif support, you must uncomment the appropriate
   entries in the Makefile.

3) Go to the sqsh root level and do a
     export SYBASE=/cygdrive/c/Sybase
     ./configure --with-readline   # optional --with-x --with-motif
   If you run into errors you probably miss some Cygwin development packages.
   Install missing packages and retry the ./configure.
   Copy the Cygwin makefile to the src directory:
     cp cygwin/Makefile-syb15 src/Makefile

4) Now you can run
     make
     make install
     make install.man

5) Install a .sqshrc file in your $HOME directory. If you choose the
   more-advanced.sqshrc file as template from the doc directory, you also have
   to create a $HOME/.sqsh and $HOME/tmp directory.

6) Make sure you have a valid sql.ini file in your %SYBASE%\ini directory.

7) Now you should be able to run sqsh and connect to an ASE server.

